Posted by & filed under perspective.

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? 😉

Posted by & filed under programming, Technology.

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 bbwp.properties 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

Posted by & filed under perspective.

There’s always a lot of debate (and hence opinion) on the “standard of education”. From politicians to parents, teachers and taxpayers, everyone (including Grandma) has something to say about (generally) the decline in the standard of education. Problem is, all this negative media is very public.

If I was a school-going kid today and all I heard on the radio, saw on television and endured at the dinner table was complaints about:
* ill-equipped teachers
* low standards
* education “crisis” after “crisis”
* decay in the moral fibre of the education system at large
* incompetence of the government to execute decent delivery of education

And so on…

Would I be enthusiastic about going to the same place everyday which everyone else drums up as a “hole”? Hell, no. And more- pay attention?

And then we exacerbate the situation when we bemoan the lack of attitude and performance of the learners. Really? We actually expect them to ignore our very public and negatively distorted opinions on education and apply themselves?

What if we told our kids that going to school was:
* fun
* exciting
* filled with opportunities
* a time to create and invent -yourself-
* all-round just plain awesome
?

Because truth be told, it is all of the above.

Posted by & filed under Business, Technology.

Over the years in which I’ve been involved with IT as a software developer, I’ve been on all sides of a major systems upgrade. As developer, I’ve written systems that were the upgrade for a system being phased out; had to support plug-ins that integrate with the newly upgraded systems; assisted in rolling out upgrades.
As a consumer, I’ve been a customer of a corporate who’s upgraded their systems. As a spectator, I’ve seen companies execute upgrades and read the aftermath. One thing is common: upgrades are a headache. As a colleague and friend I’ve listened to peers regale their experiences with corporate upgrades and been the shoulder to cry on.

Sure, updating your WordPress installation is just a click these days- but this is just one piece of software yet a good analogy. It’s rarely the core system that gives you the hassles- it’s all the integration points. The plug-ins that were dependent on the core. Assumptions would have been made in those integrations that were beyond the documentation, the implementation or vision of the core platform. Or they within scope, but now have to change due to “architectural changes” (or any other all-encompassing label). Trust- it can get messy. If you’ve been there, you will know.

And in all that, nothing has impressed me more than the way CellC recently rolled out their billing systems upgrade. They tweeted, they facebooked they warned everyone. It was like their upgrade was a major party that you had been invited to share in and it was going to be awesome! They kept tweeting hour by hour updates as to progress and where the problems were. They released press statements highlighting their challenges and where they were getting unstuck. And when they solved those problems, they let us know. And when it was all done, they kept us in the loop with more updates.

Was I impacted by their upgrade? Yes. Did it affect me to the point where I couldn’t communicate and do business? Yes. Was it for very long? No. Was I satisfied with the progress and the way they handled it? Absolutely! Would I recommend CellC as a provider? Yes! Am I a fan? You bet. Am I amazed by their execution (knowing what I know an upgrade to be like?). Definitely. Geek respect. They did an awesome job.

Posted by & filed under perspective, Technology.

Words are powerful, no argument there. Words shape what we see (not just what we look at) and words shape our understanding of the world around us. Some words have been beautifully chosen while others remain questionably in existence only to serve confusion and engender ambiguity. Once such example is the word “hacker”.

In days of old, ok, not that old, a hacker was someone who lived, eat and breathed binary. They were the geeks of the day and relished their 10000 hours on the computer with zeal. They were not necessarily deviant or trying to overthrow governments, banks or universities. They just (mostly) coded. And then somewhere between 1980 and 2000, the meaning of the word changed and now a hacker is largely understood to be a “bad” person. And I use the term “bad” loosely because one man’s terrorist is another man’s freedom fighter. Heck, these days, just participating in a DDoS (even unknowingly- ha!) can get you labelled a “hacker”. Oooo…

Phishing is another one. I have trouble with the word phishing. Just coming up with the term and calling ‘it’ by something else robs the essence of what ‘it’ is. Let’s face it, phishing is fraud- on so many levels.

If someone knocked on your door, dressed as a policeman, claiming to be a policeman, flashed a policeman badge and requested to enter your house on the premise of official police business (but he wasn’t a policeman)- he would be arrested, tried, found guilty and sent to jail for doing only that. He wouldn’t even need to enter your house to make new chums in the block. He just needs to pretend to be someone he’s not in order to gain something that’s not his. He’s a conman. A fraud. A liar. A cheat. A decepticon.

Do this online (or via text) and you’re only phishing. Happily, justice departments see through the thin veil that the word phishing tries to hide. They apply existing criminal codes which match the behaviour of the phishing agent(s) and go to trial based on that but we tend to be blasé about the word despite very real consequences. Only when there’s a consequence do we upgrade our language and start calling it for what it is: fraud.

Hopefully, with time, the word phishing will convey a stronger sense of immorality. That way, when we are confronted with phishing emails, sms, phone calls, we take them a little more seriously. Not just, “Oh. Spam. Delete”. If some “policeman” was walking around your neighbourhood knocking on everybody’s door, asking to come in, would you just: “Oh. Fake. Close door.” and carry on as you were? Or would you: “Uh-oh. Call the real cops. There’s a phony on the prowl”?

Continuing with cliche abuse, evil reigns when good men do nothing. With Data Protection Day coming up (28 January 2010), think for a moment about your contribution to the battle against fraud.

Posted by & filed under programming.

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:
http://stackoverflow.com/questions/2007975/basiceditfield-customization

http://supportforums.blackberry.com/t5/Java-Development/Cursor-Caret-not-appearing-in-EditField/m-p/553556#M112688

http://supportforums.blackberry.com/t5/Java-Development/Custom-TextBoxfield-cursor-problem-in-9800/m-p/597140

Posted by & filed under Technology.

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.

Posted by & filed under programming.

If you don’t need to pay attention to a particular detail every day, it can sneakily bite you in the derriere. Division is one of N culprits floating around the programmer’s haven. And this little guy thrives on C# .NET code.

Let’s take something simple like

int a=9, b=0;
return (a/b);

You’re expecting something similar to a “can’t divide by zero exception”, right? And indeed you do get one. In fact, all good programming courses will teach you the following idiom:

int a=9, b=0;
return (0==b)?0:(a/b);

Which is to say; only divide by ‘b’ if i’t not zero otherwise return 0 (or any other logical value).

Back to the code; what happens if I change the type from int to a floating point (float or double)? Afterall, no self-respecting programmer would do any financial calculations using integers, right?

double a=9, b=0;
return (a/b);

Divide by zero exception?

Nope.

What?

This is not a divide by zero exception condition. In fact, dividing by 0.00000 (or even -0f, yes, that’s a minus floating point zero) is perfectly acceptable and does give you a result.

What?

Yes. As I mentioned above, this is one of those “stickies” that you don’t often pay attention to, but definitely mess with your fundamental assumptions about life and the universe when you not getting the results you expect.

For a little more history on the problem, you can always refer to WikiPedia.

Is all hope lost? No. Just be careful out there because programming _is_ hard (for this and countless other reasons).

Posted by & filed under Technology.

Yes, I broke mine. Good and proper. Hey, I’m a mobile dev. If I don’t get to break a phone once in a while, I’m not doing my job properly 😉 Problem is, the X10 I have (had?) has only a virtual keyboard :/

So the first thing you need to do is install the PC Suite from Sony Ericsson. And then it’s straightforward: Tools > Phone repair. Simple.

The app will prompt further instructions; follow those (yes, you actually have to read the screen). And remember to press the BACK key while connecting the USB cable to the phone.

Of course, that doesn’t always work or solve ALL your problems. Sometimes you just brick it real good- like mine.

Posted by & filed under programming.

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");
connection.setRequestMethod(HttpConnection.POST);
OutputStream output = connection.openOutputStream();
output.write(buffer);

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.