Creating a BlackBerry WebWorks app

Some notes on building my first WebWorks app.

I figured the quickest way to get an app up and running would be to take the examples from BlackBerry.

Working from https://github.com/blackberry/WebWorks-Samples/tree/master/UIExamples I first did a git clone, but then reading the documentation I downloaded a zip of the UI examples instead.

The documentation talks about downloading a zip, unarchiving it, shuffling things around, and rearchiving it. The first problem I came across (on a Mac) doing this was Apple’s resource forks screwing up the zip:

bbwp mac zipInvalid application archive: resource name is not valid(__MACOSX/UIExamples/._bbmBubbles.htm

Next up, another packaging problem: despite following the documentation (or so I thought), I could not get bbwp to build my package:

bbwp config not foundInvalid application archive – failed to find config.xml

bbwp zip

It turns out I was doing it wrong – the config.xml needs to be at the same level as the containing folder (http://stackoverflow.com/questions/4433092/package-my-first-blackberry-widget-xml-file-not-found). A tweak to the layout and then:

zip -r UIExamples.zip UIExamples config.xml

That fixed the packaging problem (both with missing files and with Mac resource forks). The next error I got was “Spinner not found”:

bbwp spinner

There’s quite a few extra steps you need to go through to add the UI Spinner extension, which can be summed up as:

  • download the SpinnerControl zip
  • extract the zip
  • create the /Developer/SDKs/Research In Motion/BlackBerry WebWorks SDK 2.3.0.9/ext/blackberry.ui.Spinner directory
  • copy the library.xml file into that directory
  • copy the blackberry-WebWorks-Community-APIs-4d7c20a/Smartphone/SpinnerControl/src/blackberry folder into the ext/blackberry.ui.Spinner directory.

Phew. The packaging will then work:

bbwp completeBlackBerry WebWorks application packaging complete

I think there’s some optimisation that could be done on this process. In general the WebWorks development seems to involve a lot of copying files here and there.

One thing that wasn’t clear was where the output package went. I was running

./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/UIExamples.zip

… but although it declared success, I could find no output. So don’t do this. It turns out you need to add -o (picked up from Lukasz‘ excellent presentation on differences between Enyo and WebWorks):

./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/UIExamples.zip -o /tmp/

This gives two folders, OTAInstall and StandardInstall, which contain a bunch of files with .cod, .jad, .cso, .csl, .alx extensions. No idea what these are – I guess I’ll find out as I continue to explore.

Now I’ve got a packaged app, what do I do now? Next up: time to try out the emulator.

~

Update: turns out I’m not quite right about the folder structure and location of config.xml – although it worked, when you deploy it on a phone it fails. Instead you have the config file at the same location as your resources, and do the zipping of the contents of the project, rather than the project folder:

zip -r UIExamples.zip *

And then package:

./bbwp /Users/savs/Downloads/blackberry-WebWorks-Samples-0a5693e/ProjectRoot/UIExamples/UIExamples.zip -o /tmp/bbwp/

… and it works on the phone as well.

Posted in Mobile Tech, Planet, Research, Technology | Tagged , , , | 2 Comments

BlackBerry WebWorks

Based on today’s upcoming Hackathon I’m investigating WebWorks (not WebWorks (with annoying voice popup!) or WebWorks). These are rough, quick notes in the spirit of “publish early and often”.

So far I’ve downloaded Ripple (the emulator), the smartphone and tablet SDK. Initial reaction: it would be better if there was one download that comprised all three components. You don’t, for example, download a separate iPhone and iPad SDK, or Pre and Touchpad SDK. But bonus points for having Mac OS X installers at all – last time I looked at RIM/BlackBerry development, it was Windows-only. Unshackling from the Windows ecosystem is a good plan for any mobile platform.

On the corner of the WebWorks SDK download page you’ll note the ribbon “Fork me on GitHub”, which takes you to blackberry.github.com which includes for example BlackBerry WebWorks – I’m impressed. This looks like open development, with actual commits and merges taking place in public. So RIM should be recognised for doing this – it’s a step that so many mobile platforms have not yet made.

Another thought – since everything is branded BlackBerry, isn’t it time RIM renamed? Research In Motion is a cool name, RIM not so much, and everyone just says “BlackBerry” anyway.

Let’s dig in to the Smartphone SDK:

The installer is an app which is an installer. I always prefer Mac software to use the native Apple install app – the tooling to create these is extremely good, and a non-native InstallAnywhere installer just looks poor. It also helps prevent some of the unfortunate user experience errors that are present in RIM’s installer. Also, InstallAnywhere is just not pretty:

sdk installer

The first area for improvement I noticed was the Install location. The installer suggests it will be put in a root folder called ‘/Research in Motion‘ which would be just horrible. In reality, it sort-of does the right thing and installs to ‘/Developer/SDKs/Research In Motion/BlackBerry WebWorks SDK 2.3.0.9‘ if you accept the defaults. I don’t like version numbers in folder names – a workaround if they must have this would be to add a symlink ‘Current’ pointing to ’2.3.0.9′, which allows for less fragile scripting.

sdk installer location

The SDK is 20mb, which is very light compared to others – but let’s not forget this is only for smartphones, and only for web apps.

During installation I got an overwrite error message, despite never having installed WebWorks before:

sdk installer overwrite

This is the kind of ugly hiccup you can mitigate by using a platform-native installer. I told it to overwrite, and the installation seemed to complete successfully:

sdk installer complete

There doesn’t seem to be any sort of GUI with this SDK – in fact I’d go so far as to say it’s less of an SDK and more of a packaging tool, allowing you to bundle your web apps into a format to drop on a phone.

Next up: my first-run experience of producing a sample app.

Posted in Mobile Tech, Planet, Research | Tagged , , , , | 2 Comments

Twitter Weekly Updates for 2012-02-04

Powered by Twitter Tools

Posted in Tweet | Tagged , | 1 Comment

Predictive Text, part 2

Not even a month after my predictions for the year, and the first of them has failed. I said:

No IPO for Facebook: This could go either way. My bet is it will be very late 2012 or early 2013

They said:

Facebook unveils $5bn stock market flotation plans

Hrmph. Thanks Zuckerberg, you impatient hasty prediction-killer!

Posted in Computing, Mobile Tech, Planet, Technology | Tagged , , , , | 1 Comment

Backlight

If you use a computer for any amount of time, you may find some backlighting for your computer screen is beneficial.

I couldn’t find any medical research that says one way or another whether it’s a good thing or not, though I did find one article which states “one of the recommended tips for reducing computer eye strain is to control the screen glare caused by both indoor and outdoor lighting” (Reduce eye fatigue by backlighting your monitor).

I thought I’d give it a try. Via hackaday I read about the awesome Ikea Dioder light strips; the white 4-piece strips are now £19.99, reduced from £40, which makes them a bit of a bargain. So I snapped some up on a recent trip to Ikea, and so far I’m impressed.

Here’s my laptop screen with and without the backlight. I stuck the backlight to the edge of the desk behind the laptop:

Laptop with backlight

And here’s my monitor with the backlight:

Backlit monitor

And here’s the LED strips stuck on the back of the monitor:

LEDs on back of monitor

The LEDs are low power. They don’t get warm, and come with fairly long cables. You can either run them serially or have them on individual spurs from the main plug.

So far I’m preferring them to normal halogen or tungsten desk lights. The light is whiter, which is somehow more pleasant. And my eyes definitely feel happier when I’m working at night.

Posted in Computing, Planet, Technology | Tagged , , , , , , , | 2 Comments

Juice

This week has been a mini detox, with copious juices. Here’s the recipes for a couple of them, from Sainsbury’s magazine. These make enough for one glass. Throw the ingredients in a juicer, or apparently you can put them in a liquidiser with 300ml water and then strain well.

Apple and Carrot Detox Speeder

Apple and Carrot Detox Speeder

  • ¼ white cabbage
  • 3-4 carrots
  • 1 small apple
  • 5cm root ginger, peeled

Super-charged Spring Cleaner

Super-charged Spring Cleaner

  • 2 carrots
  • 1 beetroot, peeled
  • 5cm root ginger, peeled
  • 1 apple
  • 3 broccoli florets
  • Juice of ½ lemon

Alternatively you can just chuck a handful of whatever sounds good into the juicer. This morning’s was an arbitrary amount of carrots and apple, with a chunk of ginger for extra kick.

Enjoy!

Posted in Personal, Planet | Tagged , , , , , , , | 1 Comment

Tethered to o2

I’m on a train tomorrow, and thought it was a good opportunity to use my phone as a wifi hotspot.

This works flawlessly with the Samsung Wave 3 (though the GUI to turn it on is a bit suboptimal). It turns out it’s not so simple with the iPhone – because the network operators appear to have “upgraded” the experience for iPhone users.

On an iPhone you turn on Personal Hotspot by going to Settings, then General, then Network. You get a straightforward-looking button “Set Up Personal Hotspot”, like so:

Set Up Personal Hotspot

Unfortunately, when I click on it, I get a prompt to visit my network operator’s website, at http://www.o2.co.uk/iphonehelp/modem:

Visit o2 Website

Fortunately there’s a button “Go to Website”. Unfortunately, when you click on it, this is what you get:

o2 personal hotspot website

That small text says “File not found“.

I opened the website in my desktop browser, and it redirects to http://service.o2.co.uk/IQ/SRVS/CGI-BIN/WEBCGI.EXE?New,Kb=Companion,question=ref(User):str(Mobile),T=guruCase,VARSET_COBJID=11820,Problem=Obj(11820) (that’s a nice URL). The page is basically a collection of FAQs, but rather surprisingly the first FAQ is not “How do I set up tethering?”:

The o2 modem website in a desktop browser

While I was on that page, I got prompted to use o2′s online support chat, which seemed like a shortcut to solve the problem. I was connected to Guru Hayley, and encouraged to ask her anything. Turns out anything does not mean “how do I set up tethering?”:

o2 online support chat

“Our system isn’t working” is the new “my dog ate my homework”.

Ok, so reading through the FAQs a bit more it looks like I need an “Internet Tethering bolt-on”. According to the “My tariff & Bolt Ons” page on o2′s website, I already have “iPhone Web Bolt On (Unlimited data access in the UK on your iPhone)” and “Unlimited Wifi for iPhone SIMO (Unlimited Wi-Fi access on your iPhone at over 7,500 Wi-Fi hotspots from The Cloud or BT Openzone in the UK)“. Leaving aside whether it should be “Wifi” or “Wi-Fi” (doesn’t matter but at least be consistent), neither of these sound like “iPhone Internet Tethering”, so let’s have a look at the other bolt ons I can add to my account:

o2 Bolt Ons

None of those sound like “iPhone Internet Tethering” either.

So if I want internet tethering on my iPhone it looks like I need to email o2 and wait 24 hours, or call them up at 5p a minute (probably to be told to call back when their system is working).

Or I could just stick my SIM back in the Samsung Wave 3 when I need tethering, and skip the “Bolt-On”. Which option seems easier, cheaper, and more likely to work in the time available – and less offensive to a customer who’s just wasted 30 minutes on what should be a perfectly simple task?

Perhaps I’ll just read a book on the train tomorrow…

Posted in Mobile Tech, Planet | Tagged , , , , , , | 4 Comments

Out for delivery?

It feels like my Amazon order has been in transit for ages. It was dispatched over 40 years ago and I’m still waiting …

amazon order

Posted in Personal, Planet | Tagged , , , , | 3 Comments

Media and storage of the future

I just lost a hard disk. No big deal.

My somewhat complicated home media setup is this: I have a Samsung TV plugged in to a first generation AppleTV. The AppleTV is connected to the network via wired ethernet to an Apple AirPort Extreme base station / router. Hanging off the USB port of the Airport Extreme is several terabytes of storage courtesy of a Drobo containing a bunch of cheap(ish) OEM hard drives.

The AppleTV has been upgraded with a Broadcom Crystal HD chip in the internal PC Card slot – which normally has a wifi card in it. I figured it was worth sacrificing wifi, since with the size of HD video you really want to be using a fast wired network anyway. In order to make use of the HD chip, I have XBMC installed on the AppleTV.

So I sat down this evening to watch a film over dinner. I switched the TV over to the AppleTV, fired up XBMC, and navigated to the files on my Drobo – except they weren’t there. For some reason, the AppleTV wasn’t seeing the Drobo. I pulled the face plate off the Drobo to find out what was going on, and noticed it was in standby mode – unmounted by the Airport Extreme. No wonder the AppleTV couldn’t see it!

I restarted the Airport Extreme, but when it came back up and woke up the Drobo, I had the ominous flashing red light beside one of the drives. The light that means “drive failure”.

At this point in the story, there would normally be panic at the thought of lost data. What actually happened was a swift trip to Amazon, a quick calculation of cost per megabyte followed by ordering a new OEM drive to replace the failed one. It should be here on Monday, but meanwhile I can still access all my data.

It’s not always smooth sailing – see Drobo good, bad, ugly and Drobo updates. But when talking to a friend the other day who was still nursing individual external USB drives, I realised that on the whole the Drobo has been well-behaved and fits into the “it just works” category of technology that is so rare these days. It’s been online for almost two and a half years, and I’ve only had to mess with it on three occasions until now: installation, adding capacity, and replacing the first blown disk.

So I’d thoroughly recommend a Drobo instead of an external USB drive, and for a home media centre solution it works really well with the AppleTV (and associated hacks) as well.

Posted in Computing, Planet | Tagged , , , , , , , , , , , , | 1 Comment

Statistics

Blog stats

Borrowing from Alex King’s Simple SQL Queries for Blog Stats, here’s some stats on this blog.

  • The first post “It’s alive!” was made on 31st May 2003, some nine years ago.
  • There have been 1,572 posts.
  • On average, there are around 160 posts a year.
  • Most posts are comfortably over 1000 characters long.
  • The average post is about 170 words long; the longest is currently FOSDEM 2011: Saturday, and the shortest is This week’s addiction (whatever happened to…)
  • There’s been an inexorable move toward fewer, longer posts in the last few years.
  • These stats don’t include this post. I’ll leave that madness to xkcd.

Meta meta…

Here’s some useful queries for getting blog stats from a WordPress database.

Get first and last post:

select min(post_date) as start, max(post_date) as end from wp_posts;
+---------------------+---------------------+
| start               | end                 |
+---------------------+---------------------+
| 2003-05-31 10:35:11 | 2012-01-13 18:14:58 |
+---------------------+---------------------+

Get number of posts:

select count(*) from `wp_posts` WHERE post_status='publish';
+----------+
| count(*) |
+----------+
|     1572 |
+----------+

Get number of posts per year:

select YEAR(post_date), count(*) from `wp_posts` WHERE post_status='publish' GROUP BY YEAR(post_date);
+-----------------+----------+
| YEAR(post_date) | count(*) |
+-----------------+----------+
|            2003 |      154 |
|            2004 |      329 |
|            2005 |      501 |
|            2006 |      225 |
|            2007 |      176 |
|            2008 |       75 |
|            2009 |       17 |
|            2010 |       19 |
|            2011 |       70 |
|            2012 |        6 |
+-----------------+----------+

Get average number of posts per year:

drop table if exists average_posts;
create temporary table if not exists average_posts
select YEAR(post_date) as Year, count(*) as Count from `wp_posts` WHERE post_status='publish' GROUP BY YEAR(post_date);
select avg(Count) from average_posts;
+------------+
| avg(Count) |
+------------+
|   157.2000 |
+------------+

Get average length of posts (in characters) per year:

SELECT YEAR(post_date), AVG(LENGTH(post_content)) FROM `wp_posts` WHERE post_status='publish' GROUP BY YEAR(post_date);
+-----------------+---------------------------+
| YEAR(post_date) | AVG(LENGTH(post_content)) |
+-----------------+---------------------------+
|            2003 |                 1260.8182 |
|            2004 |                 1174.0729 |
|            2005 |                 1062.4770 |
|            2006 |                 1003.2622 |
|            2007 |                 1473.9489 |
|            2008 |                 1862.2267 |
|            2009 |                 3575.2941 |
|            2010 |                 3447.3158 |
|            2011 |                 6024.9000 |
|            2012 |                 8707.6667 |
+-----------------+---------------------------+

Get average word count of posts per year:

drop table if exists word_counts;
create temporary table if not exists word_counts
SELECT `ID`, `post_date`,
SUM( LENGTH(`post_content`) - LENGTH(REPLACE(`post_content`, ' ', ''))+1) AS 'Wordcount'
FROM `wp_posts`
WHERE `post_status`='publish'
GROUP BY `ID`
ORDER BY `post_date` DESC;
SELECT YEAR(post_date), AVG(Wordcount) FROM `word_counts` GROUP BY YEAR(post_date);
+-----------------+----------------+
| YEAR(post_date) | AVG(Wordcount) |
+-----------------+----------------+
|            2003 |       148.3052 |
|            2004 |       147.6809 |
|            2005 |       112.4611 |
|            2006 |       105.3289 |
|            2007 |       161.6875 |
|            2008 |       218.9600 |
|            2009 |       451.3529 |
|            2010 |       450.3158 |
|            2011 |       673.8714 |
|            2012 |      1017.6667 |
+-----------------+----------------+
Posted in Personal, Planet, Research | Tagged , , | 2 Comments