Archive for the ‘Programming’ Category

Join the Conversation

If you’re a reader of my blog, or a friend of mine, you know I recently started working on a new project named BlackPing.  BlackPing is my first foray into BlackBerry development and what a bumpy road it’s been.  The BlackBerry API (for CLDC applications) is very robust and is written in Java. Java is a big part of my life, I’ve written thousands of lines of code and most of it has made it into a production environment.  But writing for the BlackBerry is different.  You may know how to speak the Java language but do you know the BlackBerry dialect?  Different APIs, different rules, different constraints to take into consideration.

Over the years I’ve learned a few different languages - C, C++, Java, Java Script, some PHP, some Perl, some Ruby-on-Rails, PL/SQL and a slew of other ones.  With all of them I learned through trial-and-error, by looking over a friend’s shoulder or by looking at code examples.  I only ever asked for help at 3am.  Once my brain was fried, my eyes about to bleed and I could barely write a coherent sentence let alone a technical paragraph describing the problem I was having.  Not a good, or fun, way to learn a new language.

This time I decided to do something different - instead of simply posting questions to a forum I found, I tried answering them.  A lot of the posted questions were well over over my head but I read them anyway.  I performed Google searches, I analyzed what other people wrote back.  I tried to understand, I asked questions about the responses not the original post.  By joining in the conversation I was able to learn a lot about BlackBerry programming.  More than I ever would have using my trial-and-error methodology.  By reading what other people had to say I found problems in my application that I didn’t know I had!  I was able to find cool coding tricks and learn what else the BlackBerry API had to offer.

By joining the conversation I was able to rapidly expand my knowledge of what the BlackBerry API allowed me to do.  I think this is the way I’ll try to learn every new language.

Wednesday, March 25th, 2009

BlackBerry Application OTA Download Setup

While working on my latest project, BlackPing, I ran into another snag - I couldn’t get my application to download Over-The-Air (OTA).  The problem was due to my lack of understanding, hopefully my trouble is your gain.  Below you’ll find instructions that guide you through preparing your application for OTA downloads.

Setup the HTTP Servers MIME Types

If you do not have administrator access to your web server then you’ll need help from the administrator to perform the following.

Verify that there are MIME Types setup for COD and JAD files.  The correct MIME Types are respectively “application/vnd.rim.cod” and “text/vnd.sun.j2me.app-descriptor”

Upload the Application to the Server

You’ll need to upload the application’s COD, JAD and JAR files to the web server.

Create an HTML “Download” Page

This is the part that I spent a while figuring out.  During my first attempts at OTA installation I opened the BB Browser and went directly to the application’s JAD file.  Each time I did this the browser displayed the contents of the file instead of trying to download and install it.

To get around this issue, create a “download” page.  I recommend a simple page that way you don’t have to worry about the page renders on varios BlackBerry devices.  This page should reside in the same place as the application files, but you can place it whereever you want, you’ll just have to do more configuration.

My simple download page:

<html>
<head>
<Title>Download [APPLICATION_NAME]</Title>
</head>
<body>
<a href=”[APPLICATION_NAME].jad”>Download</a>
</body>
<html>


I hope this post saves you some trouble.  If it does, or if you have questions, please leave a comment.

Sunday, March 1st, 2009

BlackBerry Code Signing Help, Part II

In a previous post (BlackBerry Code Signing Help), I ran into problems signing my API Keys (.CSI files).  Also in that post, I had trouble Requesting Signatures for my application.  Both problems are now resolved and I was able to successy install my latest project onto my BlackBerry Storm.  (My tweet-of-joy)

Instead of simply making this a “yippee” post, I’m going to provide details on how to sign your API keys and then how to request signatures for your application.  I realize that BlackBerry provides instructions but they don’t seem too clear, at least they don’t to me.

Request Java Code Signing Keys

RIM requires that a developer register with them before he is allowed to access certain “sensitive” APIs.  These APIs fall under three categories: Runtime APIs, BlackBerry Application APIs, and BlackBerry Cryptography APIs.

Registration is $20 and you can register online using the “BlackBerry Code Signing Keys Order Form.”  For more details as to why RIM requires registration and for what specific APIs are controlled, visit the “Java Code Signing Keys” page.

Registering Your Keys with The Signing Authority

Once you have registered for your code signing keys, RIM will send you three files: a “client-RCR-#####.cod,” “client-RRT-#####.cod,” and a “client-RBB-#####.cod.” Each file will be sent in a different email.  You can then follow the instructions in the “BlackBerry Signature Tool Developer Guide” (a PDF download).

This is where I ran into my first problem - when I double-clicked a .COD file, Windows did not know which application to open the file with.  Please refer to my “BlackBerry Code Signing Help” article for instructions on how to resolve this issue.

Once you have successfully registered your keys with the signing authority two files will be generated - a “sigtool.db” and a “sigtool.csk.”  These files will be placed in the same location as the “SignatureTool.jar” file.

If you have the BlackBerry JDE Plug-In for Eclipse and the BlackBerry JDE installed be very careful as the “sigtool.XXX” files may have been placed where you don’t expect! In my case, they were placed in the directory of the stand-alone JDE therefore the Eclipse plug-in couldn’t find them.

Signing Your Application Using the BlackBerry JDE Plug-In for Eclipse

To sign your application first make build it by going to Project >> Build Active BlackBerry Configuration.  Next, go to BlackBerry >> Request Signatures this will bring up the “Signature Tool” window.

The Signature Tool window will contain multiple rows of data but you really care about the rows with a “Status” of “Not Registered” and a “Category” of “Required.”  If the text in the “Status” field is red it means that the key mentioned in the “SignerID” column is missing or that the key hasn’t been registered.  If the text in the “Status” field is navy blue it means that the key mentioned in the “SignerID” column exists and has been registered but the application has been signed with that key.

To sign your application (represented by a .COD file) click the “Request” button at the bottom of the “Signature Tool” window.  You will then be prompted for your Private Key.  Note that the Private Key is different from the Registration PIN you supplied to RIM.

Once your application is signed the “Status” fields will read “Signed” and they will be green in color.  You are now ready to deploy your application to a real BlackBerry.

Remember that each time you build your application a new COD file is generated and it will need to be signed again before the application can be deployed to a BlackBerry device.


I hope this article provides you some guidance as you get started in developing BlackBerry applications.  If you have any comments please feel free to email me or post a comment.

Saturday, February 28th, 2009

BlackBerry Code Signing Help

I ran into a little trouble with BlackBerry’s code signing scheme.  The root problem was that Windows didn’t know what program to use when opening a .CSI file.  I feel this is a problem with the BlackBerry JDE Plug-In for Eclipse installation, but I still needed a resolution.  The tech support team at RIM referred me to a knowledge base article which pointed me in the right direction.  Since I had a compatible Sun JDK installed, and I didn’t want to re-install RIM’s tools again, I opted for the command line method.  Since you have to sign three different keys, I created a batch file to make things easier.

The batch file I created is below.  Please look at the simple code since you may have to change some of the paths to make them appropriate for your system.  Once you create the file, place it in the same directories as your .CSI files and then you’ll be able to simply drag-and-drop the .CSI file “into” the batch file.  You’ll then be prompted for all the information RIM needs to register your keys.

javaw -jar “C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\signaturetool.jar” %1
pause

Now that your CSI files are signed, you need to register your application.  In Eclipse, you go to Eclipse >> Request Signatures.  Then you select each record in the table with a status of “Not Registered” and click the “Request” button.  This is where I, again, run into trouble.  Check back later, hopefully tomorrow, when I write up instructions on registering your application.

Monday, February 23rd, 2009

First Experience with the Blackberry JDE for Eclipse and Some Tips

I’ve embarked on a new project that involves writing software for the Blackberry.  So far it has been a maze of encryption keys, development environments, simulators and lots of mis-steps.  In the coming months I plan on writing a few posts on my experiences but, for now, I plan on focusing on one of the things that has been causing me the most pain - The Blackberry JDE (Java Development Environment) plug-in for Eclipse.

In the past I’ve used Eclipse extensively.  While at Lodgenet, it was my main IDE.  So I’ve gotten familiar with the environment and it’s plug-in potential.  Although I consider myself experienced, I’m definitely not an expert when it comes to Eclipse which could be the main source of my agony.

Overall the JDE plug-in is very nice.  It allows you to seamlessy develop and test your Blackberry application against a wide variety of simulators.  (If you’ve ever checked out the original Java Development Environment from RIM, you realize how much nicer Eclipse is.)  The problem I ran into is this - I had all of the JDE Component Packages installed yet I couldn’t see the simulator for the Blackberry Storm.  After some back-and-forth with RIM’s Technical Support proved to be worthless, I returned to a lot of digging on Google.  Thankfully I came across this thread in their support forums.  It had the answer I was looking for:

You can then select the comoponent pack to use  from Window->Preferences->BlackBerry JDE->Installed Components.  This will let you use the simulators available for the component pack you choose.

That one simple paragraph saved the day.  I can now test applications for my Storm, and my friends’ Blackberries (Friends, if you’re reading this you’ll be getting an email soon asking you to help me alpha/beta test this software.)

To help other people who are as dense as I am, or those who just want to see what I’m talking about in action, below are some instructions and screen shots that show the problem I had.  I will also show you how to configure Eclipse to make your development go a little more smoothly.

Choosing Your Component Package

This is where I went wrong - I didn’t know this could be done!  Simply go to Window >> Preferences and you’ll see a dialog like the one below.  In the “Choose one of Installed Components” menu, you’ll see all of the JDE Component Packages that you have installed.  Each component package is used for testing a different version of the RIM’s Java API and for running different phone simulators.  You must do some research on which component package is appropriate for your situation, see RIM’s KB article:  What Is - Appropriate version of the Blackberry JDE.

Note - I think it’s safe to assume that if the Component Package you select doesn’t include all of the devices you’d like to support, you’ll need to create a separate release.  There may be a work-around or “Compatibility Setting” to make things easier, but I haven’t found (nor have I really researched) one.

Eclipse Preferences Dialog

Creating a Run Configuration

If you’re familiar with Eclipse, Run Configurations are nothing new.  But, I include some instructions here just for completeness.

To create a new Run Configuration, go to Run >> Run Configurations and you’ll be presented with the dialog below.  Using the tree on the left of the dialog, select “Blackberry Simulator” then click the “New Launch Configuration” button.  Give the configuration a meaningful name (Example: “BB Pearl 8130″) and select the “Simulator” tab.  On this tab you’ll see a “Profile” menu.  In that menu are all of the devices that are supported by the Component Package you selected previously.  To make this configuration match the name above select “8130-JDE.”  Now, click the “Apply” button and that will save your configuration.

I recommend that you create a Run Configuration for each device you want to test.  Alternatively, you can create a configuration for each Component Package you have installed.

Eclipse Run Configuration

Using Run Configurations

Using the configurations you create is simple - Open the Run Configurations dialog, select the appropriate configuration and then click the “Run” button.  Once you use a configuration once, it will be added to the list of configurations under the “Run” button (the one that is located on the main IDE screen). One thing to remember is that you’ll get odd errors if you use a run configuration that includes a device that isn’t supported by the Component Package that you’ve selected.  Therefore, be sure to keep in your mind which device you’re using and which Component Package you have selected.

Sunday, February 22nd, 2009

Ping Fire Gets a New Home

Ping Fire, a Firefox extension for Ping.fm, can now be found at http://www.pingfire.us. All new versions and announcements will be posted there.

If you’ve downloaded Ping Fire from this site in the past seven days you will want to check http://www.pingfire.us to ensure that you’re running the most recent version. 

Sunday, August 10th, 2008

Ping Fire (Beta)

Well that was quick!  The people at Ping have approved Ping Fire.  I’m going to consider the extension in beta mode as only two people have looked at it.

If you have any comments or suggestions feel free to email me or post a comment.

Installation Instructions

  1. Download and Install PingFire.
  2. Add the “Ping” button to a menu.  You can do this by going to View >> Toolbars >> Customize.
  3. Provide the extension with your Application Key.  (You can find your key by going to: http://ping.fm/key.) From within Firefox, go to Tools >> Add-Ons.  Find “Ping Fire” in the list then click the “Preferences” button. Enter your User Name and your Application Key into the fields provided then click “Ok.”

Friday, August 1st, 2008

Ping Fire Release - Almost

Ping Fire is ready for open testing.  I’ve been using it these past few days with no problems.  The download link is below.  Unfortunately, I still need to get Ping’s blessing before the application will work for anyone but me.

Installation Instructions

  1. Download and Install PingFire.
  2. Add the “Ping” button to a menu.  You can do this by going to View >> Toolbars >> Customize.
  3. Provide the extension with your Application Key.  (You can find your key by going to: http://ping.fm/key.) From within Firefox, go to Tools >> Add-Ons.  Find “Ping Fire” in the list then click the “Preferences” button. Enter your User Name and your Application Key into the fields provided then click “Ok.”

Editor’s Note: About an hour after this post the people at Ping let me know that PingFire was approved! So now everyone can use it.  Just remember that the plug-in is still in beta.

Friday, August 1st, 2008

Ping Fire Updates

What a busy few days!  I started development on Ping Fire, my first FF Extension, on Saturday afternoon. It’s late Tuesday night and I think it’s a good time to provide some updates.

PingFire is working.  You can now post using all of the different “Ping My” types (Default, Blog, MicroBlog and Status) as well as any custom triggers you have created.

You can also quote something you’re reading on the web with Ping Fire.  Simply select the text you want to quote and hit the “Ping” button.  Ping Fire will automatically copy the text you’ve selected, append the URL and add it to the message box.  All you have to do is hit the “Ok” button.

I figure this puts PingFire in an un-official Beta status.  The status is still un-official since I haven’t gotten PingFire approved yet.  I submitted the stripped down version on Monday night so I’m hoping that it’ll get approved soon.  I’m also hoping that I don’t have to go through another submission round to get all of the new features I approved.

In the grand scheme of Firefox Extensions, PingFire is relatively simple but I’m still proud of how far I’ve come since Saturday.  When I started this project I knew some Javascript, knew some XML and I had never heard of XUL. Now it’s three days later and I’m still by no means a pro but I think that I’ve come a long way. I hope everyone enjoys the extension as much as I enjoyed developing it.

Tuesday, July 29th, 2008

Ping Fire - A Firefox Extension for Ping.fm

Often times I will be reading Twitter, Pownce, etc and will want to post something. So I have to navigate to Ping and write my post. This is tiresome for me because that means I have to open another tab when I already some many open. Enter Ping Fire.

Ping Fire will a Firefox extension that allows a user to post a Ping without having to be on their Ping.fm Dashboard.

Initially, the only thing the extension will allow you to do is post to Ping. I will add new features as I find a new or when someone requests a feature that I feel will be useful.

The extension is still in the beginning phase.  I have the extension running in Firefox along with most of the necessary windows and Javascript.  I’m still waiting on my API key from Ping.fm before I can work on the rest of it.

If you’d like to make a feature request add a comment here.

Sunday, July 27th, 2008