Monday, April 14, 2008

The importance of backups; the dangers of "rm -rf"

One can't truly appreciate the importance of backups until it saves you from certain doom. I can now say that I personally have been rescued by my backups.

It all started innocently enough - I wanted to wipe out my build directory and start clean again. However, in this case, my build directory happened to have the same name as my Git repository. My Git repository is located in /Users/joe/devel/sipx/git_main. Meanwhile, my build directory is located in /Users/joe/devel/sipx/build/git_main.

Some of you are already shaking your heads, knowing what comes next. Without double-checking my current directory, I typed:
$ rm -rf git_main

All right, now it's time to start a new build. I'll just go into my project root directory...
$ cd ~/devel/sipx/git_main
-bash: cd: /Users/joe/devel/sipx/git_main: No such file or directory


My stomach churned.
$ pwd
$ /Users/joe/devel/sipx

I had just trashed my project root!

After about 30 seconds of panic - I don't have permission to push my changes to our official repository, so I had lots and lots of changes that hadn't been submitted - I remembered that just the previous Friday, I had started backing up my Git repository to a WD Passport USB hard drive. This was first thing Monday morning, and I hadn't made any new changes yet.

So, thankfully, I was able to restore my entire Git repository:
cp -R /Volumes/WD\ Passport/Projects/sipx/git_main .

My woes didn't end there, unfortunately. For compatibility across my different computers I use, the Passport was formatted as a FAT32 partition. The file permissions were all messed up, and apparently my sync software was too smart for its own good - it had changed the newline markers so now all the files appeared changed.

So, when I tried to rebase my branch against the master branch, I got hundreds of errors about "suspicious patch lines" and it wouldn't continue. My stomach started to churn again, but before giving up and tendering my resignation, I searched Google for this error message.

I found a blog post with a strangely appropriate domain name: www.dont-panic.cc, entitled Git on Windows: “You have some suspicious patch lines”. The solution was to edit .git/hooks/pre-commit and comment out the following lines:
if (/\s$/) {
bad_line("trailing whitespace", $_);
}


Although I am running a Mac, the trick still fixed my problem. After that, my rebase was successful and I was back in business.

So, remember: Always make backups, and double-check your working directory before you wipe out its contents!

Wednesday, April 02, 2008

JavaOne :-(

Ahh, another year, another JavaOne coming up!
And another year I can't attend because of the $1,500+ price tag! (And that's with the early bird "discount")

I'd love to be able to go, maybe someday when I have an extra $1,500+ lying around.

Saturday, March 08, 2008

Java coming to the iPhone after all!

A friend of mine pointed me to this InfoWorld article, which describes Sun's plan to write a Java VM for the iPhone using the just-announced iPhone SDK, with availability after June.

This is an exciting development, and I hope Apple doesn't try to interfere. Steve Jobs made his opposition to Java on the iPhone apparent with the "heavyweight ball and chain" remark. The only possible objection I can think of is that this could open up a way to get applications on the iPhone without going through the App Store, running on the Java VM instead of on the iPhone native platform.

If Apple is smart, they should talk with Sun and work together to bring a great, well-integrated Java VM to the iPhone.

Friday, March 07, 2008

Some thoughts on the iPhone SDK


I'm sure this has been done to death already on countless other blogs, but being a mobile device fanatic I had to sound off too.

Like most people, I was very impressed with the iPhone SDK roadmap yesterday. The game demos, the App Store revenue sharing model, and the enterprise features are all very cool and I look forward to seeing them implemented.

The App Store in particular seems like a really great setup, and I think Nokia/Symbian should learn a lesson from this. Freeware developers can have a difficult time getting a Symbian application signed to easily distribute, and there are only a select few applications available for over-the-air installation with Nokia's Download! client.

It's still not enough to lure me away from my beloved Nokia N95, though.

The game demos looked great. I'm not sold on the iPhone as a gaming device, though. First there's the battery problem. Games suck up a lot of battery power, and since the iPhone battery is not user-replaceable, it's not possible to carry a spare battery for extended gaming sessions. The other problem is the lack of tactile buttons. Touch and gesture control is great, but for many games you still need your basic D-pad and action buttons. Anybody who has tried the NES emulator on a jailbroken iPhone can attest to the difficulty of playing Super Mario Bros. without feeling the D-pad or A/B buttons.

I had a hope, however faint it may have been, that Apple would come to their senses and introduce a Java ME runtime. The iPhone still has the distinction of being the only consumer targeted smartphone missing Java ME. Steve's comment about Java being a heavyweight ball and chain that "nobody uses anymore" couldn't be further from the truth.

My other complaints are not new ones, but I'll summarize them here anyhow:

  • No MMS! You can't send a picture to a friend using MMS, something pretty much all basic level handsets have.
  • EDGE! Until there's a 3G iPhone (or even, wishfully, 3.5G), I can't see how the iPhone's Internet experience can be enjoyable. Unless you live in an area with citywide Wi-Fi, of course! The coverage is really good in the Boston area, and let me tell you, the difference between EDGE and a HSDPA connection is astounding.
  • No video! Most camera phones now have the ability to record video clips. I can't understand Apple's decision to leave out the capability to record videos, especially on a phone that has such an emphasis on multimedia.
If the next revision of the iPhone resolves these issues - it's a certainty that it will at least be 3G - I think it will really be a serious threat to the big mobile players. Or, at least, give them a run for their money.

The next year or two will be very busy with new developments in the mobile space. We've seen peeks of the innovative touch features of the upcoming Windows Mobile 7, the S60 Touch demos from the Mobile World Congress last month, and the impending arrival of Android. At this point, it will be anyone's game!

For now though, I'll keep loving my N95.

Friday, December 07, 2007

I'd like to apologize...

About 6 months ago I wrote a rant about people wearing Bluetooth headsets. It was a poor attempt at humor, and if I offended anybody I'm truly sorry. I use my headset all the time, after all!

Monday, December 03, 2007

A double negative makes... a confusing user experience

We all learned in school that a double negative makes a positive. "I don't have nothing" is really just a more confusing way to say "I have something". George Carlin once had a bit where he says that, when asked how you are doing, he sometimes replies "I'm not unwell, thank you". In both of these examples, the double negative version is somewhat confusing and unclear, especially to a non-native speaker of English.

I've critiqued Troels Bay's Google Reader Notifier here before. And again, I have to stress: It's a wonderful program that I use daily. It just has some UI quirks that sometimes give me a spark for a blog posting.

Reader Notifier uses a few double-negative based options in its preferences:
For example, I have unchecked the "Don't show tooltips" checkbox, because I want to see the tooltips. This is essentially telling the program "Don't not display tooltips". Confusing, right? Sure, it doesn't take a genius to figure out the preferences, but it's still not as intuitive as it could be. A clearer option would be "Show tooltips". Of course, then the semantics of the checkbox would have to be reversed in the application logic.

By changing the "Don't display items", "Don't show tooltips" and "Don't play sound" checkboxes to "Display items", "Show tooltips" and "Play sound" respectively, the UI will also be consistent. In its current state, it's inconsistent - there are three "negative" checkboxes ("Don't display items", "Don't show tooltips", "Don't play sound") and two positive checkboxes ("Show count in menu bar", "Check for updates on startup"). A consistent UI would use all positive (recommended!) checkboxes or all negative (bad idea!) checkboxes.

Again, though, let me say - Google Reader Notifier is a great, useful app. If you are running Mac OS X and use Google Reader, you should check it out at http://troelsbay.eu/software/reader.

Sunday, December 02, 2007

Time and Date 2.0 published!

Today I finished version 2.0 of my Time and Date gadget for the Google personalized homepage. The main changes from the original are:

  • You can stop the blinking separator if you don't like it.
  • You can choose from several different formats for showing the date, or hide the date if you don't want it.
  • I removed the greeting feature, because I got a lot of negative feedback about it.
  • The look and feel of the clock has been improved.
Below is a live preview of the gadget. If you want to add it to your iGoogle homepage, just click the button below.