Thursday, July 5, 2012

Git remote Dropbox

I wanted to make a quick note mainly for my own memory, but if it helps anyone else out, well all the better. I do really like Github, but there are times that my work/code just isn't ready for public consumption (not that too many people seem to dig into my Github work). Which leaves me with the question, where should I backup my repository?

My quick and dirty solution appears to be Dropbox. With the way git works, it's quite simple to use a dropbox folder as a kind of "central repository" that's automatically backed up while remaining private.

So here's the simple method I used; first create a bare repo in Dropbox:

cd dropbox-directory
git init --bare project.git

This is a very simplistic analogy to what happens when your create a new repository on Github.

Now we need to push the local repository to the new "remote" Dropbox repo:

git remote add dropbox dropbox-directory/project.git
git push -u dropbox master

The '-u' parameter will automatically set up tracking, so if you use 'git pull', any changes stored in the dropbox repo will be pulled into the local repo. Also, master is simply the default branch name, so you can substitute it with your desired branch name if necessary.

Lastly, to make a clone of the repo, all you need is to have dropbox installed and then use the command:

git clone dropbox-directory/project.git
cd project

Thursday, May 10, 2012

Digging Into Web Development

An alternative title for this post might be: Digging Out Of Low Level Programming... or something like that.

I've known the basics of "web development" for close to 10 years now. Those basics are essentially HTML, CSS and Javascript. Now anyone who knows a thing or two about "real" web development, especially as it exists today, is probably thinking "you simply CAN'T get more basic than that!". There are two reason why I want to write a bit about this. First, I've spent the last several years in university for computer science, as both an undergrad and graduate student. In school our concentration was primarily theory and design, and much less about the specifics of particular programming languages or libraries. This meant that the major evolution of web development, specifically social media and web apps, appeared to be outside the scope of what I needed to concentrate on. The second reason is closely related to the first, having to do with my graduate and research work the past 2-3 years. I took a significant interest in ray tracing and high performance computing (HPC), and in this domain C/C++ and a few other "intermediate-/low-level programming languages are king. Spending such a long time dealing with low-ish level problems; like floating point rounding error, packaging data for inter-process communication and coordinating hundreds of individual processors; has made it a challenge to step back and get used to the relatively "easier", high-level world of Ruby, Python, HTML5, CSS3, jQuery and so on.

For the last week or two I've finally gotten around to making a personal website for myself (WAY overdue). At first I concentrated entirely on HTML and CSS, completely forgoing Javascript and all the fancy frameworks that seem to be out there. Currently the site is really only 3 pages, but even with such a small size, I had a nagging voice saying "why are you copying all this markup when the only difference between them is the content on the page?". When I began to look for a simple solution I looked at the problem from the perspective of a C programmer; essentially I wanted an "#include" statement, or something similar to pull in markup from different files. OK, I could use PHP or something along those lines to pull it off, but then I remembered the websites a couple of my more web-savvy graduate school colleagues had put together. They had bragged about their use of a cool little static HTML generator called nanoc; then the flood gates opened.

I basically feel like I've been living under a rock with respect to Ruby, scripting languages, and web development in general. In the past I had really gotten into Flash/ActionScript development. Although I hated the idea that it had to be contained within a 3rd party plugin, the vector drawing capabilities and relative ease of putting together complicated games and applications was extremely attractive. Now with the advent of HTML5, just about all the capabilities of Flash are now defined as standard for modern web browsers! It's been astounding to watch some of the things that developers (much more creative than myself) have come up with using the HTML5 features. The best example that sticks out in my mind right now is BrowserQuest by Mozilla. Their open source code is up on github. This is essentially everything I really wanted from Flash, including embedded audio, video, graphics rendering, network communication; all without the necessity of Flash Player.

Alright now I'm just descending into rambling. Going forward I don't want to forget and leave behind all my experience in those compiled, statically typed, lower-level languages; but I need to broaden my range of expertise a bit. I need to realize I don't need to meticulously control every minor aspect of an application, I can probably trust an established and supported framework, like Ruby and its libraries, to do some of the mundane details for me. I'll keep experimenting with nanoc as I flesh out my website and see what strange and interesting things it's really capable of. For those of you that read this far, is it important to really dig into the web based development world or is a skill set in intermediate-level programming still just as valuable?

Sunday, July 24, 2011

Migrating to iTunes: A Nearly 3 Year Journey

Until recently, I've hardly seen the appeal of Apple's iTunes. Being a Windows user since my first home desktop, I've always been accustomed to listening to mp3's and music in general with Windows Media Player. Everyone has their opinions on which player/OS is best but I'd made my choice simply because it was what was on my computer. Over the last 10 years or so I've compiled a pretty extensive collection of music. Some of it being from the early days of mp3s, even, and much more still from a tonne of ripped CDs I still have sitting on a shelf. Within Media Player, I'd gone so far as to start rating most of my tracks. You know, those 5-stars your see in the library that nobody uses. I'd also started making auto playlists to make those high rated songs easy to find. And then, around the end of 2008, I finally got an iPod Touch.

Catastrophe! I had basically no choice but to download iTunes and find some way of transferring my (somewhat obsessively) organized Media Player library. My initial solution came down to this: 1) Select all songs in my "top rated" smart playlist, copy them into a regular playlist and save it as an m3u file, 2) Remove all songs that might be in the iTunes library and then import the m3u file to iTunes, thus bringing in all my "good" songs. Now when syncing the iPod I would select that one imported playlist.

I won't be insulted if you have a palm placed squared against your face at this point, I know I do. The biggest problem I had with making the switch was a nagging problem I've tended to have with all of Apple's software, relinquishing control. With Media Player I'd gotten used to being able to make changes to music files directly (such as change the filename), and those changes would show up in the library without any fuss. If you do this to iTunes, it just marks the song in the library with an '!' and leaves it up to you to sort out the mess you've made. It's taken me nearly 3 years to come to terms with this....

The biggest issue with making the switch, however, came down to the track ratings. At the time there was simply no way to convert media player song rating to iTunes ratings. To get a bit technical, Media Player gives two options for storing ratings. The default, like iTunes, is to keep the ratings in a database. If you lose this database, all the ratings are lost as well. The second option is to store the Media Player rating as an ID3 tag within the file itself. ID3 tags are simply bits of "meta-data" that contain information about the song, like title, artist, album, length, and whatever else you might want to know about a track. In this case, if the database is lost, the ratings are safely stored within the music files themselves and are easily recovered. iTunes, on the other hand, only allows ratings to be stored within its library database.

About a month ago I finally found my saviour. On a personal programming/project blog, here, was a little piece of software called Orzeszek Ratings. Granted I haven't looked too deep into its inner workings, it works by accessing the Media Player and iTunes API's to match tracks that appear in both programs, and "translate" ratings from one to the other. This was basically the last hurdle for me to let iTunes into my life for good.

So now, for the sake of the iPhone 4 I bought 3 months ago, I'm entirely managing my music through iTunes. There are a couple things that still nag at the back of my head though. If the iTunes database/library files get corrupted or lost, then all my ratings, playlists, etc. are gone. I'm no fool, of course, I do regular back ups of music, photos, work, and all that bric-a-brac. So, in theory, if iTunes breaks, all I have to do is copy the backup files and all should be good. I hope I never have to test that theory.

I'll wrap up with some actual praise for iTunes for a change, especially recently. First off, subscribing to podcasts and the interface for syncing with the iPhone/iPod is very slick. I can hardly think of easier ways of doing it. Changing the music you put on it or the organization of apps is hardly more than a couple mouse clicks. If I buy a new song and rate it highly, it'll automatically appear on the high rated smart playlist and then, since that playlist is selected for syncing, will automatically copy to the iPhone. Second, the newer Home Sharing feature Apple added is very nice. Sharing existed before in the form of being able to access and play other people's shared iTunes library's. Home Sharing, however, depends on you entering your Apple/iTunes account information. Doing this means that you can not only play the music on a shared library but also COPY songs into your local iTunes library, as well as automatically download new purchases. I now can't see myself going back to Media Player.

Now, the next hurdle will be to enable the "Let iTunes keep your files organized" check box....

Friday, July 22, 2011

Starting fresh

I'm totally new to the blog space (though I hear it's all the rage!). This will probably be organic as I decide what might be good for posting on here. Some general things I would post about would be programming, new and interesting tech, science, and maybe a smattering of general life stuff.

As of this writing, I'm a graduate student (hopefully) near completing a Master's degree in computer science. My work the last few years has centred mostly on graphics and parallel programming. I've just returned from an amazing trip to Ireland to many of my cousins, aunts, uncles and significant others as well as that incredible Irish countryside. Perhaps that will be something I make a post about, not only to share it but to make sure I really remember it all.

I'll likely try to do some posts, as well, about what my master's thesis has been all about. Within the confines of the thesis and the faculty I usually have to use very specific "sciencey" terms. But when it comes to trying to explain just WHAT DO I DO to the rest of my family, I tend to get blank, perhaps dumbfounded, stares. So, in the future I'll hopefully take the time to write about what I've been doing in a way that makes sense to the layman.

Onward and upward! Now back to thesis writing...