Monday, November 19, 2007

My first Ruby gem

This past weekend has a special importance for me. I am finally able to stand by my favorite language, Ruby, with more than just words.

To cut a long story short, I'm playing with smart cards for my research. I didn't find any good library for accessing cards from Ruby, so I was faced with either writing my own extension, or leaving my favorite language for something else. My desire for beauty triumphed over my laziness, and my first Ruby extension was born.

It wasn't as bad as I expected. It took me 4 half-days to figure out PC/SC, ruby's extension mechanism, gems, and Rubyforge. And in the fifth day I rested got it to work under Linux/Windows.

So, yay, I've made my small contribution to the Ruby community. If you're curious to check it out, go to its Rubyforge page.

Wednesday, November 7, 2007

Resetting a Blackberry, All the Way

Why should you read this?
You have a Java (read: past 2 years) Blackberry. You want to start from a clean slate, and you realize that Wipe Handheld only goes half way there. You want to take advantage of the hours I spent googling this issue, and trust me it's non-trivial.

My Motivation (skip if you don't care)
My beloved Pearl started acting up, and I wanted to start from a clean slate. I did some unconventional experiments, so I was pretty sure that starting fresh would bring an advantage to the table.

I searched blackberry reset and firmware reflash and what not, and got no answer. In the end, I got bored and clicked some random links (I believe they had to do with hacking your Berry), and got to what I wanted.

So I'd like to share what I learned. Hopefully, Google will like the fact that I'm using its blogging tool and index the page with a good rank, so other people don't waste as much time as I did.

Proposed Solution
Without further ado, here's how I reset my Blackberry. It worked for me. Comments with refinements to my method are welcome.
  1. Backup your data
    I can't help here, because I didn't want to backup my data. Everything is synced with my Mac, so why risk restoring the cause of my issues?

  2. Wipe your handheld
    I'm not sure this is necessary, but I did it, and it can't hurt. Go to the Settings application, then get to Security > General Settings. Push the menu key (the one with the Blackberry logo) and select (yes, you've guessed it right!) Wipe Handheld from the menu. Let it do its thing for a few minutes.

  3. Get the tool to wipe your handheld for real
    The tool is pretty geeky (text-mode), but does the job. It's a wrapper around an even more geeky tool (javaloader from the Blackberry SDK). Here's a link to a place where you can get it from.
    http://www.blackberryforums.com/general-blackberry-discussion/18789-jl_cmder.html
    Alternately, you can google JL_cmder and you should be able to find it.

  4. Wipe your Berry for real
    Connect your Blackberry to your PC via the USB cable. Exit Desktop Manager if it pops up. Then run the tool, choose wipe, and follow the on-screen pointers.
    Warning: those people aren't kididing. Pay attention on this step, so you don't brick your Berry.

  5. Get the firmware you want to install
    Go to blackberry.com to be pointed to the download site for your carrier. Or google the firmware you want. Google search works well for this part, so there's no need for me to post links. Install both the desktop software (Desktop Manager) and the firmware (Blackberry calls it handheld software).

  6. Install the new firmware
    Run Desktop Manager, while your Berry is still connected to the PC. Application Loader should pop up by itself, and let you choose which components of the firmware you want to install. I skipped the foreign languages, as well as applications that I don't use, and was happy to get the free space.
    Be patient. This can take anywhere from 30 minutes to an hour. Don't mess with the phone during this time, unless you have the time to go through a bricked phone replacement.
  7. Restore your data
    If you did a backup in step 1, now's the time to restore it. If not, you'll probably spend a couple of hours downloading your applications and redoing the phone's settings.

That's it. Enjoy, and share any refinements you come up with!