<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>marc paradise &#187; blackberry-dev</title>
	<atom:link href="http://marcparadise.com/articles/tag/blackberry-dev/feed" rel="self" type="application/rss+xml" />
	<link>http://marcparadise.com</link>
	<description>projects, blog, and other oddities</description>
	<lastBuildDate>Thu, 26 Aug 2010 16:39:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Blackberry and Netbeans &#8211; Localization Tutorial</title>
		<link>http://marcparadise.com/articles/blackberry-and-netbeans-localization-tutorial.html</link>
		<comments>http://marcparadise.com/articles/blackberry-and-netbeans-localization-tutorial.html#comments</comments>
		<pubDate>Mon, 15 Feb 2010 17:51:59 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[blackberry-dev]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://marcparadise.com/?p=124</guid>
		<description><![CDATA[RIM provides us with a powerful API for developing Blackberry applications.  They&#8217;re making improvements in the ready availability of good documentation (slowly).  They really seem to be responding to both their community and the threat posed by iPhone and Android.  For all of that, though, their toolchain still sucks. Presently, we have two supported options [...]]]></description>
			<content:encoded><![CDATA[<p>RIM provides us with a powerful API for developing Blackberry applications.  They&#8217;re making improvements in the ready availability of good documentation (slowly).  They really seem to be responding to both their community and the threat posed by iPhone and Android.  For all of that, though, their toolchain still sucks.</p>
<p>Presently, we have two supported options for developing Blackberry projects: use the RIM JDE (if you&#8217;ve tried to use it, you know that this isn&#8217;t an option at all); or use their Eclipse/JDE plugin.  Outside of that, you&#8217;re pretty much on your own.</p>
<p>I&#8217;m a long-time Netbeans fan &#8212; I&#8217;ve tried Eclipse multiple times, and I just don&#8217;t get along with it.  With a bit of headache and digging, I&#8217;ve been able to get most BB development tasks working in Netbeans.   Until this week&#8230;</p>
<p>In working on <a href="https://sourceforge.net/projects/bbssh/">BBSSH</a>, I realized that people may eventually want translations, so I set out to use the provided localization features of the Blackberry platform. (Also, all those raw GUI-related strings in my code were annoying me.) Unfortunately, because I don&#8217;t fall into the &#8220;JDE&#8221; or &#8220;Eclipse&#8221; categories mentioned above, I fell into the third: pretty much on my own.  In hopes of preventing the next person who attempts this from falling into the same category, I figured I would write up how I worked this.  Note that this isn&#8217;t necessarily the best or the only way &#8211; but it does work, and it does not add a lot of pain to the process.</p>
<p>This tutorial assumes you are familiar with Netbeans, and have some familiarity with the JDE. Read on for more. For the impatient, you can skip straight down to &#8220;3. The solution&#8221;.</p>
<p><span id="more-124"></span><strong>1. Some Background </strong> <em>(skip this if you&#8217;re familiar with how BB localization bundles work)</em></p>
<p>When you create a localization bundle in the JDE, it does some behind-the-scenes work that allow you to start using it right away.  Let&#8217;s say you created files named &#8220;MyApp.rrc&#8221; and &#8220;MyApp.rrh&#8221;.  Behind the scenes, JDE will create a file named MyAppResource.java, compile it, and add it as a resource to your project.   (Also important but less relevant here, it will also generate a binary file containing the actual string data.) The java file MyAppResource.java is a simple interface &#8211; here is an excerpt from BBSSH:</p>
<pre>package net.uglydesign.bbssh.i18n;

public interface BBSSHResource {
 // Hash of: "net.uglydesign.bbssh.i18n.BBSSHResource".
 long BUNDLE_ID = 0xe8304654750e8634L;
 String BUNDLE_NAME = "net.uglydesign.bbssh.i18n.BBSSHR";

 int MENU_EDIT = 12;
 int INFO_SETTINGS_GENERATING_KEYPAIR = 35;
// snip
}
</pre>
<p>Those int values map to the string table, allowing you to look the value up at runtime using the appropriate ResourceBundle instance.   You would either reference this new interface directly, or implement it in your class to get direct access to the key values.  For example:</p>
<pre>public final class SessionDetailScreen extends MainScreen <em>implements BBSSHResource</em><strong> </strong>{
 private final SessionProperties prop;
 ResourceBundleFamily res = <em>ResourceBundleFamily.getBundle</em><strong>(BUNDLE_ID, BUNDLE_NAME)</strong>;
 // snip //
 private final String[] CONNECT_CHOICES = res.getStringArray(S<strong>ESSION_DTL_LIST_CONNECT_CHOICES</strong>);
 // snip // 

 SessionDetailScreen(SessionProperties prop) {
     super(Screen.DEFAULT_CLOSE);
     this.prop = prop;
     if (prop.isNew()) {
         setTitle(res.<em>getString</em><strong>(SESSION_DTL_TITLE_1)</strong>);
     } else {
        setTitle(res.<em>getString</em><strong>(SESSION_DTL_TITLE_2)</strong>);
 }
</pre>
<p>The text in bold is  made available to your class when you implement the by the BBSSHResource interface. Implementing this interface is a convenience to save you a bit of typing. You could just as easily do this:</p>
<pre>
<pre>public final class SessionDetailScreen extends MainScreen {
 private final SessionProperties prop;
 ResourceBundleFamily res = <em>ResourceBundleFamily.getBundle</em><strong>(BBSSHResource.BUNDLE_ID,
     </strong><strong><strong>BBSSHResource.</strong></strong><strong>BUNDLE_NAME)</strong>;</pre>
<p>// snip //private final String[] CONNECT_CHOICES =</p>
<p>res.getStringArray(<strong><strong>BBSSHResource.</strong></strong>S<strong>ESSION_DTL_LIST_CONNECT_CHOICES</strong>);</pre>
<p><strong>2. The Problem</strong></p>
<p>As long as you&#8217;re in the JDE or Eclipse environment, the creation of  this interface is completely transparent to you.   Once you step outside  of that realm, troubles begin.  As it turns out, the java interface  file is created in a temporary folder, and is usually deleted shortly  after it is created &#8211; giving it a lifespan of a few seconds in many  cases.  The Eclipse plugin then performs some hidden internal magic to add the compiled  version of that file to the Eclipse project, making it available for you  to use.</p>
<p>I spent far too much time trying to find a way to get my Netbeans project to recognize this generated class, with no luck.  The details aren&#8217;t relevant here, but I lost about two days trying to force some the appropriate level of cooperation between RAPC and Netbeans before giving up.  My attempts yielded run-time errors or build-time errors, depending on what I was trying at a given moment.</p>
<p>Posting to the Blackberry development forums yielded people willing to help, but the suggestions provided did not seem to do this trick.  (Note that this could be my fault entirely, so no fault to the posters there )   Google trawling turned up a lot of references to someone who had solved this exact problem a couple of years ago &#8212; Jonathan Fisher.  Unfortunately, he has taken all of his Blackberry-related content off of his web site , so the net result was a bunch of dead links.</p>
<p><strong>3. The Solution</strong></p>
<p>This seemed to narrow it down to two remaining options: implement my own resource parser (possible, but pointless work &#8211; I shouldn&#8217;t <em>have</em> to when Blackberry already has a perfectly good one), or find a way to have a separate project that contains only localization resources.   The latter is the path that I took, and what I&#8217;ll be describing here.</p>
<p><strong>Create a Resource-only project</strong></p>
<p>First we need to use the JDE to create a project.  The only thing contained in this project will be our localization resources.  <strong><em>Note: </em></strong><em>at your discretion you may also add other resources such as graphics, but this is not covered here. </em><strong><br />
</strong></p>
<ol>
<li>Using the JDE, create a new workspace such as &#8220;YourProjectName&#8221; in a new folder named &#8220;JDE&#8221; under the project root.
<ul>
<li>The location you choose to create this workspace is ultimately up to you.  However, I would strongly recommend creating this project under a new folder  located in your main project, such as in &#8220;/JDE&#8221; as described. It will generate a lot of clutter if you keep it at the project top level; while moving it to a new directory outside of your project folder just means that you will have to remember to check out an additional set of files before you can build/test.</li>
<li>Do <strong>not</strong> put any files from this new project anywhere under your Netbeans &#8220;YourProjectName/src&#8221; directory.  Doing so will cause further complications that I will not be addressing here. (I know this because I went that route first <img src='http://marcparadise.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</li>
</ul>
</li>
<li>Using the JDE, create a new project within the workspace, called &#8220;YourProjectNameResources&#8221;
<ul>
<li>You should probably put this in the same folder you used for the workspace.</li>
</ul>
</li>
<li>Designate the project as a Library.
<ul>
<li>Right-click on the project name and choose Properties.</li>
<li>Click the Application tab</li>
<li>Change the project type from &#8220;CLDC Application&#8221; to &#8220;Library&#8221;.</li>
<li>You&#8217;ll probably also want to take this opportunity to set a version string, vendor, and description so that when someone sees this installed as a module on their BB, they will know what it&#8217;s for.</li>
</ul>
</li>
<li>In the JDE, create your resource header <em>yourproject.rrh</em> and resource content <em>yourproject.rrc </em>files.
<ul>
<li>When prompted for a package name after creating the RRH file,  make sure to update it.  For example, most of BBSSH&#8217;s content is under &#8220;net.uglydesign.bbssh&#8221;, so I specified &#8220;net.uglydesign.bbssh.i18n&#8221; for localization resources.  This is the package that your Resource interface class will be created under.</li>
<li>More details on how to create these files and their significance can be found in <a title="Blackberry Tutorial: A12 Localization" href="http://na.blackberry.com/developers/resources/A12_Localizing_V2.pdf">the official BB localization tutorial</a>.</li>
</ul>
</li>
<li>Add some strings in the resource editor to get started.</li>
<li>Build your project in the JDE by right-clicking the project name and choosing &#8220;build&#8221;
<ul>
<li>Ignore the warning about no main() function</li>
<li>Upon completion, you&#8217;ll now see a bunch of files in your &#8220;JDE&#8221; folder. The one that we care about is called <em>yourproject.jar </em>(or in my case, BBSSHResources.jar).</li>
</ul>
</li>
</ol>
<p><strong>Add the JAR file to Netbeans. </strong></p>
<p>Now we have to make sure Netbeans is aware of our new dependency, so we&#8217;ll add the jar file created by the previous step to this <strong><br />
</strong></p>
<ol>
<li>On the Projects tab, right-click on the Resources heading and choose &#8220;Add jar/zip&#8230;&#8221;</li>
<li>Find your way to the .jar file created by the JDE &#8212; if you followed above, you should find this in /JDE/YourProjectNameResources.jar.</li>
</ol>
<p><strong>You&#8217;re done!</strong></p>
<p>Netbeans takes care of the rest, ensuring that the new JAR file is included in the RAPC compilation.</p>
<p>Adding new strings is now very straightforward.  The only downside is that you&#8217;ll need to keep the JDE running in the background.  To add string resources:</p>
<ol>
<li>Alt-tab over to the JDE and add them via the resource editor.</li>
<li>Build the resource project.</li>
<li>Return to Netbeans and begin using the new resource constants immediately. Netbeans will (after a second or two) pick up the updates automatically.</li>
</ol>
<p><strong>4. Some Notes<br />
</strong></p>
<p>That aside, there is room for improvement in what I detailed above&#8230;.</p>
<ol>
<li>Thee generated resource .jar file also contains the COD file for the resource library; by extension this means that the actual binary resources are also getting packaged in your main application COD files.  This is redundant and takes up extra space.  I&#8217;ll post back on this when I update it properly (Likely  sometime around when BBSSH is in public beta.)  I think the proper solution will be:
<ul>
<li>Modify project build.xml to clean the JAR file when creating a deployment: remove everything except  the  interface class file.</li>
<li>Modify project build.xml to update the JAD and ALX files, indicating the new resources COD as a dependency.</li>
</ul>
</li>
<li>The JDE can be avoided by using RAPC directly to compile your RRH/RRC files into a COD. You can run this from any location, allowing you to remove the  output clutter.  This would let you just create a new build target in  build.xml, and do your resource builds from inside of Netbeans while you  work.   The only drawback to that is that string editing is going to be  painful if you&#8217;re not using a GUI resource editor.  It is possible  (rrc/rrh are just text files after all), but after going that route myself I  found it easier to just switch back and forth between the JDE and  Netbeans for string editing. Maybe one day I&#8217;ll get around to a  standalone editor &#8211; or maybe RIM will open source their Eclipse plugin which contains a good editor -  but for now this suffices.</li>
<li>It has to be possible to have the main application COD reference the resource COD to  provide title and description data. I haven&#8217;t looked into this yet, but I suspect this will require using a &#8220;rapc&#8221; configuration file specific to this project.</li>
</ol>
<p><strong>5. I&#8217;ll shut up now</strong></p>
<p>I&#8217;ll continue to hope that one day RIM will realize  that there really is  a need to provide better tools for managing this.  Android and iPhone  have great development toolchains, and Blackberry&#8217;s lack of one can only  hurt it.   In the mean time, even though this is not ideal it suits me  well and does the job. Hopefully it will do the same for you.</p>
<p>Please post a comment here to let me know if this helped you, or if you have other feedback, questions, or concerns.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 1291px; width: 1px; height: 1px; overflow: hidden;">package net.uglydesign.bbssh.i18n;</p>
<p>/**<br />
*<br />
*/<br />
class ResourcePlaceholder {<br />
ResourcePlaceholder() {    }<br />
public static void main(String[] args) {}<br />
}</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://marcparadise.com/articles/blackberry-and-netbeans-localization-tutorial.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Announcing BBSSH- a free SSH client for Blackberry devices.</title>
		<link>http://marcparadise.com/articles/announcing-bbssh-a-free-ssh-client-for-blackberry-devices.html</link>
		<comments>http://marcparadise.com/articles/announcing-bbssh-a-free-ssh-client-for-blackberry-devices.html#comments</comments>
		<pubDate>Fri, 05 Feb 2010 17:59:53 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[bbssh]]></category>
		<category><![CDATA[blackberry-dev]]></category>

		<guid isPermaLink="false">http://marcparadise.com/?p=88</guid>
		<description><![CDATA[With a recent update to BB os 4.6, my backspace key stopped working in midpSSH - and that was the proverbial back-breaking straw.   I steeled myself and dove in. I decided that I would go "whole hog" -- I would  make a Blackberry-specific SSH client, building on the core of MidpSSH while eliminating the support for non-BB phones, taking advantage of the features BB has to offer programmers - and adding new features and usability tweaks along the way. I would keep the core functionality of the original (terminal emulation and SSH/telnet layers) but rewrite the rest using BB APIs. In keeping with the spirit of the original name, this project will be called "BBSSH".    
]]></description>
			<content:encoded><![CDATA[<p>I have long been a fan of Karl von Randow&#8217;s midlet SSH client, &#8220;<a title="MidpSSH" href="http://www.xk72.com/midpssh/">MidpSSH</a>&#8220;.  I&#8217;ve been using it for years now on various model Blackberry devices, and overall have been satisfied with it.  However, I have always wished it was a bit more tailored to Blackberry&#8217;s feature set &#8212; I even looked at the only commercial Blackberry SSH client on the market  in hopes of finding something a bit more BB-specific.  While it had some good ideas, the commercial client did not work very well on my device, making that a dead end.</p>
<p><span id="more-88"></span></p>
<p>Separately, I&#8217;ve also been toying with entering the under-served BB games market with an idea I&#8217;ve been fermenting in the back of my head.  In order to pull that off, I needed to have real-world experience with BB platform development. I took a close look at my most-used app (MidpSSH) and saw  again that it  could  become a lot more powerful if it was built in a way that  allowed  it to  take full advantage of the blackberry-specific features.</p>
<p>With a recent update to BB os 4.6, my backspace key stopped working in midpSSH &#8211; and that was the proverbial back-breaking straw.   I steeled myself and dove in. I decided that I would go &#8220;whole hog&#8221; &#8212; I would  make a Blackberry-specific variant of midpssh, eliminating the support for non-BB phones, taking advantage of the features BB has to offer programmers &#8211; and adding new features and usability tweaks along the way. I would keep the core functionality of the original (terminal emulation and SSH*/telnet layers) but rewrite the rest using BB APIs. In keeping with the spirit of the original name, this project will be called &#8220;BBSSH&#8221;.</p>
<p>Because this is a pretty drastic set of changes &#8211; practically a rewrite save a subset of core classes -  I have forked the original code, which is still available via Karl&#8217;s site and Sourceforge.     The new code will also be released under GPLv2, and will be published once the first beta OTA download is available. I contacted Karl ahead of time, and he was friendly and  supportive of  the idea. While he does not have time to maintain MidpSSH any more, he  has been  (and continues to be) helpful in providing me  with  information I need to make the project go from my end.</p>
<p>Which brings us to the present.  Over the last month or so, I&#8217;ve been   working on this conversion and learning a lot about the BB platform   along the way**.  It has been in some ways less difficult than I expected, but in other ways more so. Information about development for the BB is scattered with little central organization.  Tidbits here, chunks there. RIM is working hard to resolve this, but I think they still have a ways to go before they&#8217;re there.    Much of the information I needed <strong>is </strong>in RIM KB articles &#8211; but I wasn&#8217;t able to find much in there on my own.  (Frankly I think it&#8217;s because they&#8217;re using livelink &#8211; a document management solution which has been pretty horrible for the ten years I&#8217;ve been stuck using it..)   Instead, I stumbled across or was directed to them from old forum postings in various places, Stackoverflow answers, and helpful replies to my inquiries on the RIM Blackberry dev forums.</p>
<p>Lunch is almost over, so I have to get back to work .  I have time for some screenshot uploads which I&#8217;ll be posting separately in a moment.  Later today, I&#8217;ll be adding a features roadmap post.</p>
<p>* I am also looking at the Blackberry crypto layer &#8211; it may be possible that I can replace the SSh layer with this for the most part. THat&#8217;s still up in the air though &#8211; as it may require additional licensing/code-signing fees beyond the basic $30 BB signing fee &#8212; which isn&#8217;t high on my list of things to do.</p>
<p>**Among  other things, I&#8221;ll be posting project updates here (tag:   bbssh) , but I  will also be journaling my experiences as I develop  my  first &#8220;real  world&#8221; BB application (tag: blackberry-dev).  This is  information that I&#8217;ve  been uncovering  from a dozen or more different  sources, piecemeal. It  would have  helped me a lot to have one place to  find the information, and it will help me in the future when I start my  next app &#8212; and hopefully by publishing it I can also save someone else  the headache I  went through.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcparadise.com/articles/announcing-bbssh-a-free-ssh-client-for-blackberry-devices.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
