Get Out Jail Free

Every once in a while, you get a randomly odd idea (thanks, @brentone80– like this one: DeadGranny. It might seem shallow, but not so actually. It was also relatively quick to code and more fun to play with. It actually solved a real-world problem too; which is a bonus. And soo…

Ever get stuck in a awkward situation where you need an escape- and you need it fast- but you need a catalyst to spark off your rescue? Maybe you’re stuck in public transport, listening to some random citizen with bad teeth and equally attractive halitosis chew your ear off about a personal drama of theirs from 1979; or the conversation is just plain inappropriate and you’re the odd one out; or you’re in a meeting that doesn’t know how to end? Trickiness abounds. That’s when you need “DeadGranny”.

All of a sudden, your phone starts ringing. You casually glance down to see who it is. (It’s not outright anti-social just to keep a tab on your phone.) Cue your drama skills. Look worried. Interject with a “Sorry, I’ve been expecting this call”. Answer the phone. Look even more worried. “What?! When?! Ok, I’m coming now” Put down the phone and excuse yourself. If you’re asked what’s up… well, the rest is up to you.

So how does DeadGranny work?
First, you need to activate DeadGranny mode. You can do this by clicking the “End Call” button when your home screen is showing. You will notice the wheelchair icon appear. You are now in DeadGranny mode. To set your phone back to normal, just click the “end call” button again. The wheelchair icon will disappear. Simple.

Now to activate -and control- the ringing on your phone. Click the “back” button 3 times (while in DeadGranny mode) to activate a call. You will hear an anonymous tone played 5 times. If you want to repeat the tone, press the “back” button 3 times again. Repeat as often as you need to.

Simple. There are no configuration screens, icons or settings. It operates discreetly and with a bit of practice, you could even get this going without looking down at your phone. If you use a BlackBerry you are probably more than capable of using it blindfold.

It’s as simple as it needs to be and no simpler. How effective it will be is largely up to your convincing display of drama 😉

Available on AppWorld


EPIRB, A Personal Emergency Beacon

GPS utilities for your phone are becoming pretty useful (and popular) so I’ve added my app into the mix- I hope you find it useful too. More than that, my wish is that it one day saves a life. Other than that, my hope is that it gives you peace of mind in a not-so-safe scenario.

I’m putting this here because even though it may be obvious, it’s not. EPIRB (your phone) can quite possibly fail you in your hour of need. Don’t think that this ONE single application (or your phone) is all the safety and security you need. It’s not. Even when you climb mountains with brand new equipment, you never just use ONE rope. That’s just asking for trouble. ALWAYS have a PlanB and ALWAYS let somebody know in the real world where you are, what you up to and where you going.

If you know all about EPIRB already and just looking to download it, you can go straight here.
The basic idea is this:
Before you set out on a journey, make sure you have some emergency contact numbers listed in the application. You can also optionally set an Estimated Time of Arrival (ETA).

And then off you go.

Now the part comes in your journey when you get into trouble. There’s roughly three kinds of trouble you can get into:

1. A bad situation but you are still able to self-rescue.
2. A pressing situation where you still have the ability to call for help (make a call, send an SMS, push a panic button) but your interaction is quite limited.
3. And then there’s the really bad situation where you’re completely incapacitated (or separated) from any form of help whatsoever. This is also why you need a real-world-contract in place and tell people around you what, where and how you doing your journey.

Given those situations, how do you get help?
1. In the case where you self-resuce, it’s all good. No need to panic. You usually contact people AFTER the event to let them know what’s going on. You might want to alert them that you’re in potential trouble and to be on standby.
2. You’re limited in your ability to call for help, but you can at least press a button. With EPIRB, all you need do is press MAYDAY. This will immediately start sending off an SMS to each emergency numbers listed with your last known GPS location. Once you’ve pressed MAYDAY, you could try phoning (if you are able to) or just focus on getting yourself out of the situation. Keep in mind, your emergency folk will usually try to phone you to find out what’s going on!
3. You’re completely unable to call for help. This is usually quite bad. However, if you fail to inform the application that you’re OK (i.e. you have exceeded your ETA) it will start sending out WARNING SMS to each of your emergency contacts. EPIRB will call for help when you can’t.

Of course, this does not cover 100% of all situations, or 100% of one. It should hopefully cover what you need and assist. It’s just a tool to cover a gap that can be covered.

Of course, after a MAYDAY situation, it is also important to let everyone know that you’re OK. This is easily achieved by deactivating the MAYDAY and all your emergency contacts are notified by a once-off SMS that you are OK. And then another feature of EPIRB is not accidentally pushing the panic button (how many times have you done that before?). EPIRB has a simple safety pin designed to avoid accidentally setting off your emergency peeps into a high state of alert and panic.

So, with a simple and effective application like EPIRB, and a little planning, you could make sure someone’s got your back **just in case**.

1. Does EPIRB use any data? No. Not this version.

2. Will EPIRB cost anything to download? No. I’m making this available for free for a lot of personal reasons.

3. Will EPIRB cost anything to run? Only in emergencies will it start sending out SMSs. You control just how many though (number and frequency). Considering your life’s at risk, the last thing you need to worry about is a couple extra bucks in SMS.

4. But what if EPIRB never switches off after being set in an emergency (lost/stolen phone)? Tricky. At the moment, it will just keep sending SMSs until you run out of battery life. Not ideal. If you have some suggestions, let me know.

4.1 Does this integrate with my BBM? Not yet. Working on some memory issues and ensuring some robustness around the BBM integration for OS6+.

5. Why does the UI look so .. erm.. plain? I prefer simpler UIs because they draw less resources, have fewer code (read: “latent bugs”) and they’re less likely to “date”. In addition, for EPIRB in particular, the light-yellow/orange contrast has been used so you can easily spot the difference in glaring sunlight when you only have but the wink of the eye to make sure your MAYDAY is ON.

6. Is there an online-tracking version? You bet. That version is, I’m happy to say, very stable and just about ready to hit the wide wide world. Watch this space…

7. I like what you’re doing- how can I get involved? Easy. Just contact me.

8. EPIRB rescued me- how can I repay you? Pay it forward. Do good and help a stranger. If you don’t know where to start, get in your car right now and go buy somebody who really needs some food, a nice meal.

9. I used EPIRB wrongly and now it cost me a couple bucks in SMSs- how are you going to reimburse me? I’m not. Sorry. The app has been given to you for free in good faith. If it didn’t work for you, it didn’t work for you. It works just sweetly for me (and mine) is all I can add.

Yeah… eye candy; although, not a lot of candy! 🙂
When starting EPIRB, this is what you’re going to see:

Once you have a GPS signal and we’ve managed to get a fix on where you are, the screen will continuously update with that information. It might look geeky, but it’s amazing what your mind will remember in a heightened state of anxiety- and what you can do with that information so there’s no hiding that from you:

With the settings, you can set a pseudonym (or your real name- or a race number if you’re racing) which is used when an SMS is sent out. You can choose numbers from your phone book or just type in numbers to add (like a race organizer’s number, your local community police station, traveling buddy…). You can also set how frequently you want the MAYDAY flare to be sent out.

Then of course, the main screen- MAYDAY. Once you’ve clicked MAYDAY (and released the safety pin to prevent false alarms) you can let your phone get on with updating emergency folk about where you are and get on with rescuing yourself (if you can).

You can explore the other features, ETA and a little “Where am I?” menu option which will open BlackBerry Maps with your last known location. From there, you can send it by email, BBM, MMS and so on… So EPIRB is more than just a simple panic button- but it does try to be as simple as possible. Oh, and to download, point your BlackBerry here


BlackBerry AutoText

The BlackBerry OS is filled with features and configurations that would make any advanced geek user drool. That is if you really wanted to jump into the depths of what is available. Fortunately, BlackBerry also comes pre-configured in a very reasonable and intuitive kind of way so that you don’t actually need to- it just works (or at least, that has been my experience- others may differ). Even Grandma can use one “as is”. One of the really cool features that is worth spending some time on is the AutoText.

On your BlackBerry go to: Options > AutoText

The AutoText feature is useful for two situations, out the box: typos and macros. Typos such as ‘hte’ become ‘the’ and ‘acn’ become can. Let me guess, you thought it was a built-in spell-checker, right? Then there are other macros like ‘mypin’ or ‘myver’ which automatically become replaced with your BB pin number or OS version and device model. Well, these are both possible thanks to the AutoText application.

In a world filled with SMS-speak abounding with abbreviations, there is now no reason to communicate ambiguously or without vowels. SMS-speak taught us (out of necessity) to limit our characters and given the nature of language, “a sntnc abbvd cn stil mk sns” (sic), we could get away with it- mostly. Evidently, Twitter is re-inforcing this new dialect. Of course, there is also the other issue of actually physically typing out all the required vowels and letters which just takes too long. However, on the BlackBerry, you can both have your cake and eat it. You can still type SMS-speak while actually communicating “proper” native tongue.

All you need to do is add AutoText options like:
tx = thank you
cn = can
e = the
ha = hahaha
btw = by the way

And so on, as you require and pretty soon, you will type out:
tx! btw, cn you pop pick it up 4 me? ha
But be communicating:
Thank you! By the way, can you pick it up 4 me? Hahaha

Of course, when it comes to SMSs you might get slightly annoyed at having to correct the abbreviations again- but why would you need to SMS? Oh, wait. Let me guess. You still have friends on iPhone, right? 😉

programming Technology

Upgrading Playbook Beta

If you’re keeping up with the Playbook SDK Betas, you will no doubt have gone through the cycle of getting your signing keys and installing them. Thing is, when you update your SDK version, you don’t want to lose those artifacts. Else, you’ll have to request new keys. So before you update, let me tell what to expect…

You will have -a- version of the SDK setup nicely. You will also have your signing keys installed with the .p12 file artifacts along with some barsigner.csk and barsigner.db files. You will also have updated your file. Now, when you install the new SDK, it will display a prompt along the lines of: “Detected previous version. Uninstall old version first. Cancel, Ignore, Retry”. Wait.

If you uninstall your old version, you’re going to lose all those artifacts. You WILL need to request new keys and install them all over again. Mission, but not impossible 🙂

You might want to cancel and think it over. I chose “Ignore”.

I ignored the warning and went on with (Plan A) installing the newer SDK alongside the older one. This kinda worked well, but there were some issues with the paths and picking up the correct one (a non-signing SDK alongside the first version of a signing SDK). It got messy. It turned out easier (at this stage) to just uninstall everything, request new keys and start again.

With the next upgrade, I chose “Ignore” again. But this time, I just installed it right over my old installation folder. I got prompted during the install to “Overwrite existing file? Yes/No/Yes To All”.

“Yes to All”, please.

Didn’t need to request new keys or configure any additional paths- it just worked. Re-compiling against 0.9.4 and signing went off without a hitch.

So, based on my experiences, I would say, once you have a 0.9.n version of the SDK setup with signing keys and it’s all good, the next upgrade experience should be relatively safe if you just ignore the previous version warning and install right over the old SDK 🙂

Of course, if it didn’t (or doesn’t) work for you, you probably didn’t (or won’t) do something that I wouldn’t not have not recommended or didn’t suggest you shouldn’t have tried or didn’t do something that wasn’t not unlike the process that I haven’t described in this or any other post that I may not have written (sic) :p


Right-Align Text On BlackBerry BasicEditField

It would seem a simple thing to do, no? In fact, positioning/aligning text has become such an abundant demand over the last few years, that the ability to do so in most environments is fairly trivial. And if you’re working predominantly in the web field, it’s a no-brainer. The native Java components for BlackBerry are a little different however.

An exhaustive search on RIMs support forums and in general, “the internet” reveals many a frustrated developer struggling with the right-alignment of text within a field. I’m emphasizing that since there’s also a lot of confusion with right-aligning the field itself; an entirely different and altogether more straightforward task.

The gritty: you need to handle drawing the text yourself.
The algorithm:
* blank out the field entirely (i.e. fill the background with white paint)
* drawText() in your label at 0, 0
* drawText() in your text with DrawStyle.RIGHT
* fillRect() a cursor at the right hand side of the input field

The catch:
maintain a local copy of the text value of the field

The bonus:
Along the way I started stumbling across other ideas for highlighting the input field and making it a little more catchy for the user.

Here’s a screenshot of my custom input field with the focus.

Right Aligned Input Field
Right Aligned vs Default

You’ll notice the default field below it (R120) is the BlackBerry standard BasicEditField. The R1234 field is my custom field, with highlighted background, slightly pronounced text and right-aligned with a dark cursor on the right edge.

Kudos, references and inspiration drawn from:


Repair Your Own BlackBerry

It seems to be a bit of a theme at the moment, and this one is hardware related.

The scrolly-wheely-thingy on my Curve 8900 was giving me hassles. Remember the days of the scrolly-wheell mouse? And how it all got tangled with grit and dust and hair… ew! Well, the same thing happens with the BlackBerry after miles of tracking that ball. So what’s a man to do when you can’t scroll down to read that email, tweet or web page? Why, take it apart and clean it, of course!

I double-checked for a step-by-step guide as to the disassembly of my phone here. Turns out, the instructions are very accurate 🙂

The result?

BlackBerry Curve 8900 Disassembled

If you going to do this yourself a couple tips:
* use the right tools (TX 6)
* everything you detach, put on sticky (or non-slip) surface
* keep all the tiny bits- they really are tiny
* try finish with no left-over bits
* try finish with no missing bits
* be patient

So if next you have a hardware issue with your phone, follow the tradition of fashion apparel and handymen around the world and Just Do It… yourself.

NOTE: you may void the warranty on your phone if you try this. Which is not such an issue unless you end up with an epic fail.


Manage Cookies with BlackBerry Java

When interacting with [generally and widely interpreted] web services, you may be required to communicate state (usually a login authentication token). This [usually] takes the form of a cookie and in our interconnected wide world of interwebs, browsers handle cookies just fine; custom-built clients not always. On the BlackBerry, if you’re putting together a Java app, and using the HttpConnection class to communicate with said server, you need to manage that cookie (and hence state) by yourself. Fortunately, it’s not rocket science.

The basic workflow is: you connect to the endpoint and POST some data. On the response, you need to read the headers and look for the “Set-Cookie” field. From that value, you can extra the data you need. On all subsequent requests, you set the “Cookie” field on the header. Simple. Time for some code.

NOTE: Exception handling omitted for brevity and readability.

The first request is just a regular POST in this instance. The buffer variable is a byte[].

HttpConnectionFactory factory = new HttpConnectionFactory(endpoint);
HttpConnection connection = factory.getNextConnection();
connection.setRequestProperty("User-Agent", "BlackBerry Client");
connection.setRequestProperty("Accept", "*/*");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
OutputStream output = connection.openOutputStream();

From that request, we wait for the response and read that. In this example, I am looking for the PHPSESSID field that was set as part of the response in the header.

String cookie = connection.getHeaderField("Set-Cookie");
if(null != cookie) {
  int php = cookie.indexOf("PHPSESSID=");
    if(0 <= php) {
      php += "PHPSESSID=".length();
      int term = cookie.indexOf(";", php);
      if(0 <= term) {
        _session = cookie.substring(php, term);

Now I have the token required (cookie) that I can now send on every subsequent request. The code for that is for all intensive purpose, the same as the first code snippet with one additional line:

connection.setRequestProperty("Cookie", "PHPSESSID=" + _session + ";");

The order of the setting of the request properties won’t make a difference, so just use that anywhere before you open the output stream for writing.

programming Technology

BlackBerry Security

It’s not uncommon when moving across to the BlackBerry platform, to get a little confused or even frustrated. It’s a “who moved my cheese” series of moments because in reality, “we” tend to expect that BlackBerry will do things in exactly the same way as “our” previous handsets. And when it doesn’t, “we” might think it’s broken. Truth be told, BlackBerry does do a lot of things a little differently and IMHO those differences are what make it great.

I see the same kind of frustration when users migrate from Windows to Ubuntu or Mac.
I see the same kind of disappointment when users switch from Symbian to BlackBerry.
I see the same kind of disillusionment when developers switch from [insert-language-of-choice-here] to Ruby.

Security prompts on the BlackBerry platform are one of those areas that come up for discussion quite often. To understand “why” it does things the way it does things, here’s an 8min video clip which is extremely useful in explaining that. You decide wether that’s good or not, but whatever conclusion you come to, remember, it’s just the way it is.

Personally, I think giving the user (or the BES admin) the final say and control is the better policy when you start examining all the other options available.

Yes, it can be argued that it does demand a level of sophistication on the user’s part, but like anything out there (be it a carving knife, a phone, an OS, an application, a motor vehicle, a bank account or a piece of sports equipment) your understanding of that “thing” is directly related to your proficiency and enjoyment in using that “thing”. A phone, even a BB, is no different.


Building For BlackBerry

A suggestion for all budding (and current) BlackBerry developers out there. When you purchase your signing keys, be sure to NOT use your regular email address. Instead create an account like or to receive all the automated emails you get when signing.

For example, on one project, I have a build process that signs about 30 .cod files per build. But each build has specific builds for different OS levels, as well as different builds for testing, staging and production.

Add that up and you get 30 .cod files x 3 (one for each cert) = 90 x 3 (for each build type) = 270.
270 x 2 (for each platform) = 540. 540 x 4 (one for each white label) = 2160 emails!

For a daily build… and then adhoc builds. And not including any other projects. And you cannot get rid of the automated emailing. Standard RIM policy.


zaFin Update

If you’re running zaFin on your BlackBerry smartphone, now’s a good time to update the data tables:
* Reserve Bank dropped the lending rate a short while ago
* StatsSA released CPI figures for 2010 up to end of March and
* SARS released the 2011 tax rates for individuals.