Archive for the ‘RIM’ Category

Rod Nolan

Getting repetitive tasks done quickly and efficiently

Wednesday, February 20th, 2013

I’m working on a project right now where I often have to grab a master copy of a single file, paste it into my current working directory and open it for editing. My environment is Windows 7.

Since the master file exists in a static location, I wrote a batch script to copy the file into my current directory and open it.

  copy %ANT_HOME%\..\..\build.xml . /-Y
  build.xml

The first line of this script will copy the master version of build.xml into whatever directory I run it from from. The -Y option prompts me to overwrite if a file named build.xml happens to be present. The second line will open the local file in the system default editor for .xml files (if you have one configured). So it’s just two lines. Nice and simple and it sure beats doing this manually.

To make this script callable from anywhere on my file system, I placed it in a directory that is included in my PATH and I called it getBuild.bat.

At this stage, calling the script requires me to SHIFT+right-click > Open Command Prompt Here and type the name of the batch file. Too many clicks and keystrokes for my liking.

Ideally, I’d like to be able to access this functionality from the context menu and bypass the need to open the command window at all. Here’s how I did it.

  • Open regedit.exe
  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell
  • Add a new key called getBuild
  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\getBuild
  • Add a new key called command
  • Modify the (Default) value and set it to C:\Windows\System32\cmd.exe /c getBuild.bat
editing the registry to add an item to the Windows Explorer context menu

editing the registry to add an item to the Windows Explorer context menu

  • Save and close the registry editor
  • Open Windows Explorer and right click on a file in any directory to see the new context menu item. I haven’t bothered to try to make it work by right clicking anywhere so as it stands, you have to right click a file.
using the new context menu

using the new context menu

  • Next, you’ll see the prompt to overwrite the .existing file.
the batch file doing its job

the batch file doing its job

  • Answering ‘y’ opens the file in my editor.
so I can do my job

so I can do my job

 

If you’re wondering why I need to copy build.xml so often, keep an eye on this space for my next blog post. I’ll be talking about the ANT build script I wrote  to package and deploy WebWorks apps to the upcoming BB10 smartphone. But until then, happy copying. :-)

Rod Nolan

Getting started with AIR and BB10

Wednesday, May 23rd, 2012

I just started to play with the latest BB10 SDK for Adobe AIR. I had a couple of issues right away so I’m going to document them here to save you the headache.

First, make sure you download the correct SDK. Sounds simple, I know, but it wasn’t immediately apparent that there are currently two different SDKs available for download.

  • BlackBerry PlayBook SDK for Adobe AIR, easy to find but not the one I wanted
  • BlackBerry 10 SDK for Adobe AIR beta, the one I wanted but tucked out of the way

The Tools link in the bottom half of the page points to Tablet OS SDK for Adobe AIR v2.0 which is not the right version. If you’re after the BB10 SDK, you have to click on the rotating banner above the Tools link when it comes around to the “BlackBerry 10 SDK for Adobe AIR beta now available” section. That will eventually bring you to the page where you can download the BlackBerry 10 SDK for Adobe AIR v3.0 beta. Here’s the page https://bdsc.webapps.blackberry.com/air/beta/download/sdk/ where you’ll also find the link to download the new simulator. Moral of the story: don’t ignore rotating banners.

After installing the SDK and the BB10 simulator, I tried to run the Hello World sample as described here https://bdsc.webapps.blackberry.com/air/beta/documentation/aa_getting_started_bb10/Create_your_first_application_FB_ms_2006005_11.html and I got some errors on the imports for classes from the qnx.dialog package.

I had checked this option: Project Properties > ActionScript Build Packaging > BlackBerry > Add platform specific libraries to the class path so I went on the hunt for qnx.dialog. This is what I found.

all four swcs are present...

... but there's no qnx.dialog package anywhere

I found two entries in the forums which led me to the solution but to summarize, here’s what you have to do in Flash Builder 4.6:

  • Project Properties > ActionScript Build Path > Add Folder > C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs\qnx\ane
  • Project Properties > ActionScript Build Packaging > BlackBerry > Native Extensions tab > turn on all the Package checkboxes (might have to scroll horizontally to see them)
This links in the additional extensions required to use all the APIs.

Read this for the background story: http://supportforums.blackberry.com/t5/Adobe-AIR-Development/BB10-Error-1065-SkinAssets-is-not-defined/td-p/1720721

You may have to rework some imports in the sample code to refer to the qnx classes instead of the flash classes but that should do it. It’s also worth noting that this doesn’t seem to be a problem with FDT, only Flash Builder.

Happy coding.

 

 

oliverm

BlackBerry Hackathons – Come out and Play(Book)!

Wednesday, May 16th, 2012

I’m currently in Bogotá, Colombia taking part in my third Hackathon on behalf of RIM. These hackathons are two-day events where local developers get the opportunity to interact directly with experts in PlayBook development. They also get a free PlayBook just for showing up!

We typically have a team of three experts covering AIR, HTML5/WebWorks and Native development. Most of the events have been focused on game development, but I’ve also done one centred around business apps using WebWorks.

Developers, either in teams or individually, work some long hours over the two day period. At the end of the second day, their apps are judged and winners awarded additional prizes. Nothing like a bit of competition to bring out the best in a dev team!

And with BB10 on the horizon, there’s a lot of anticipation from developers. Keep your eyes open for an event coming to your city this summer. Hope to see you there!

oliverm

Links roundup

Friday, November 4th, 2011

Here are a few unrelated links I’d like to pass on for your reading pleasure.

  1. Opportunistic Refactoring by Martin Fowler, author of the best programming book ever (Refactoring).  I’ve been preaching this one for a long time: “while you’re in there, refactor any smelly code, but don’t get caught in a death spiral”.
    http://martinfowler.com/bliki/OpportunisticRefactoring.html 

  2. jQuery4u – lots of great jQuery plug-in round-ups. I’m starting to visit this almost daily now.
    http://www.jquery4u.com/ 

  3. Finally, for you old KDE 3 fans, the beast is still alive and well. I loaded this onto a VM and started feeling very sentimental for the old days when KDE didn’t suck and I didn’t have to settle for Gnome.
    http://www.osnews.com/story/25283/KDE_3_5_Fork_Trinity_Releases_Third_Major_Update 

As usual, I look forward to your comments on any of these.

Oliver

Andrew Rybak

Enterprise Mobile App Survey

Thursday, October 13th, 2011

New Toronto Group recently participated in a global Enterprise Mobile App Survey where we shared our perspective on the issues around developing and deploying enterprise apps on mobile devices.

The survey results have been released and they provide some excellent food for thought. In many cases they echoed what we have been hearing from our clients and prospects. One of the areas that I found particularly insightful was around the barriers to increased usage of mobile enterprise apps. Here are the top barriers listed and the percentage of survey participants that mentioned them as a concern.

  • security issues (e.g. integrating personal devices, data wiping ) 68%
  • fragmentation of mobile platforms/devices 40%
  • increased administration & management costs 37%
  • lack of sophisticated app solutions for the enterprise market 31%
  • mobile network capacity limitations 25%
  • lack of internal app store solution for companies incl. billing and fulfillment 19%
  • lack of app management know-how 18%
  • resistance from partners & customers (externally) 10%
  • resistance from employees (internally) 6%

What do you think? Are these concerns similar in your organization?

cathyj

Loading HTML content in PlayBook Applications

Tuesday, October 11th, 2011

When I was working on a PlayBook application using Flex 4 and Air, I tried displaying the HTML content from an external website to my PlayBook application. Here are some of my findings:

First, HTMLLoader control can be used on desktop apps but is not supported on mobile devices; instead, StageWebView class can be used.  The sample code is shown as below:

 

webView = new StageWebView();

webView.stage = this.stage;

webView.viewPort = new Rectangle( 0, 0, stage.stageWidth,stage.stageHeight);

webView.loadURL(“http://www.google.com”);

 

Second, the HTML content is shown in a viewport and displayed on top of other Flash content. If you created a tabbed view application, you will notice that the HTML content won’t disappear when clicking the tab button to switch to another view. What you need to do is to add one line of code shown as below.

webView.addEventListener(ViewNavigatorEvent.VIEW_DEACTIVATE,removeWebView);

The event VIEW_DEACTIVATE is triggered when switching to another view, and the function named removeWebView is invoked. In the function, simply use the dispose method of StageWebView class to destroy a StageWebView object.

To learn more on StageWebView class, please refer to the Adobe Help website http://help.adobe.com/en_US/as3/dev/WS901d38e593cd1bac3ef1d28412ac57b094b-8000.html.

Rod Nolan

Debugging WebWorks applications using the PlayBook simulator and Google Chrome

Saturday, September 24th, 2011

By: Rod Nolan

I encountered an error recently while working on a WebWorks project. So I broke out the PlayBook WebInspector (aka Developer Tools in Google Chrome) and got to work… sort of.

In case you haven’t discovered this yet, to use the debugging tools in Chrome, you just launch your application in the simulator and then open Chrome and connect to the simulator over port 1337 (http://{simulator IP address}:1337).  You should see a simple page with a single link and when you click it, you’re connected to the running application.

Connecting to the PlayBook WebInspector

Connecting to the PlayBook WebInspector

This usually starts the Developer Tools in Chrome complete with Console, Script Debugger, Profiler and all the goodies you know and love. But this time around I got a nearly empty page… a blank toolbar area and the toggle buttons at the bottom of the page that didn’t work.

Where are the Chrome Developer Tools?

Where are the Chrome Developer Tools?

Hmm, this worked last week?! What changed?

I confirmed that the Chrome Developer Tools worked as expected with a regular public web site.

Then I tried a different version of the PlayBook simulator since I have two:

  • version 1.0.1 (from the BlackBerry WebWorks SDK for TabletOS 2.1.0.6)
  • version 1.0.6 (from the blackberry-tablet-sdk-1.1.0)

But both simulators produced the same result.

Maybe it was Chrome? You probably know how Google Chrome just silently updates itself without asking. (Can software be arrogant?)

The solution turned out to be this:

  1. Completely uninstall Google Chrome.
  2. Go find an installer for an older version (oldapps.com).
  3. Install it and get back to work.
PlayBook WebInspector works as expected in Chrome ver13

PlayBook WebInspector works as expected in Chrome ver13

Happy debugging. But keep that Chrome (Lucky 13) installer around and be ready to undo the auto update.

Thanks to Oliver Merk, NTG principal Consultant, for discovering this fix.

cathyj

Creating a DropDown List for PlayBook Applications

Monday, August 29th, 2011

By Cathy Jin – Consultant

If you’re using Flex 4.5.1 to develop a PlayBook application, you will notice that there is no DropDown list control in the Component View. This is due to the fact that DropDown list is not mobile optimized for Flex. I’ve tried to use it but had little success. There are two possible solutions:

1. You can use a Text Input box and a list popup window. You can refer to this link for an example: http://www.adobe.com/devnet/flex/samples/expense-tracker-application.html.

2. An alternative is to use a QNX component, but you will need to rewrite the code if you want the application to run on different operating systems such as iOS or Android. You can find more infromation on using QNX components at the link: http://corlan.org/2011/02/01/working-with-playbook-qnx-list-components/.

Good luck!

oliverm

A Date with SQLite

Thursday, August 11th, 2011

By Oliver Merk – Principal Consultant

Been doing a lot with SQLite lately (sqlite.org) on the PlayBook and elsewhere and wanted to pass on a few quick notes.

First, SQLite columns are typeless.

What?

Yup. Even though you may declare fields as VARCHAR or DATETIME, you may actually store any type of data you want in them. The exception to this rule is for PRIMARY KEY fields declared as INTEGER.

I’ve found that typeless fields can lead to some problems when storing and retrieving date values. I suspect that minor version differences in SQLite are returning different CURRENT_TIMESTAMP values.

Here’s an example of some SQL which creates a table with a date field:

CREATE TABLE location (
    location_ID INTEGER PRIMARY KEY NOT NULL,
    name VARCHAR,
    latitude NUMERIC NOT NULL,
    longitude NUMERIC NOT NULL,
    addDate DATETIME DEFAULT CURRENT_TIMESTAMP);

If I INSERT a new record without specifying the addDate value, SQLite will default to inserting its CURRENT_TIMESTAMP value to populate the addDate field and I get something like 2011-08-11 12:05:10.

But if I decide to explicitly use CURRENT_TIMESTAMP in my insert statement, the value gets stored in an odd-looking decimal format. For example, 2455769.105023148.

Depending on the SQLite version, I may or may not be able to convert the returned date field using JavaScript’s date parsing functions for fields inserted with CURRENT_TIMESTAMP:

Client SQLite version Format Supports JS Date parsing
Chrome (Win) 13.0 beta 3.7.6.3 NO
Firefox (Win) 5.0 3.7.5 NO
PlayBook AIR Runtime 3.7.3 YES

My concern is that the code which now works with the PlayBook might break when it gets its next SQLite update. Guess I’ll burn that bridge when I get to it.

I should also mention a great Firefox add-on called SQLite Manager that allows you to manage these databases.

Oh, and how did I get the SQLite version?

SELECT DISTINCT sqlite_version() AS version FROM sqlite_master;

I’ll leave the rest up to you…

Chad Upton

BlackBerry PlayBook Tips and Tricks

Wednesday, June 8th, 2011

By Chad Upton – Senior Consultant

I’ve been using the BlackBerry PlayBook for a number of weeks now and I’d like to share some useful actions, most of which are not well known.

 

PlaybookSwipes

Swipes

  • Show/hide the title bar inside an app – swipe along the path of a red arrow
  • Show/hide the keyboard – swipe along the path of the blue arrow
  • Rotate the simulator between landscape and portrait mode (simulator only) – orange arrow

Power

  • Wake up from standby – swipe from bezel to bezel (side/side or top/bottom)
  • Restart or shutdown – tap the power icon in the status bar to reveal a menu that has shutdown/reset options (OS 1.0.5+) or hold the power button for two seconds or tap the power app
  • Power cycle – hold the power button until it begins rebooting

Keyboard

  • Add an ellipse – hold down the letter M to reveal a new character menu
  • Add the copyright symbol – hold down the letter C to reveal a new character menu
  • Add the trademark symbol – hold down the letter T to reveal a new character menu
  • Add the registered symbol – hold down the letter R to reveal a new character menu
  • Add the paragraph symbol – hold down the letter P to reveal a new character menu

Other

  • Mute - Hold the play/pause button for 2 seconds
  • Screenshot - Press the volume down and volume up buttons at the same time, photos appear in the pictures gallery
  • Caps Lock – Hold the shift button on the keyboard for one second
  • Add a period – Double tap the spacebar when typing (doesn’t work in all apps), same as BlackBerry and Android phones and iPhone/iPad
  • Show calendar – Tap the clock in the status bar
  • Keyboard and mouse – pair it with a bluetooth keyboard and/or mouse (right mouse button used for bezel gestures)