Shane O'Sullivan's technical blog… really ties the room together

Tip: Declare regular expressions once and reuse for performance win

Posted by Shane O'Sullivan on September 22, 2011

A pattern I see quite often in JavaScript is of people using a regular expression in a loop, e.g.


for (var i = 0; i < array.length; i++) {

The naive assumption is that a regex is some special native thing, like a boolean. However regular expressions have a cost to construct, which you can see in this performance test –

So, if you’re using a regular expression in JavaScript more than once, declare it first and reuse it to see a dramatic performance gain

Posted in Javascript | 3 Comments »

CSS Box Sizing makes me happy

Posted by Shane O'Sullivan on September 13, 2011

Quick note: For anyone fighting for years against the CSS box model, where the visible size of an element depends on the sum of it’s width, height AND padding, check out the box-sizing: border-box;. It does exactly what we need, where if you say

.myclass {
width: 100%;
padding: 10px;

then myclass will still take up 100% width of its container, instead of overflowing.

Posted in Technical | Leave a Comment »

This is what a successful platform launch looks like

Posted by Shane O'Sullivan on September 2, 2011

… pity it had to happen as a result of a liquidation sale.

WebOS looks to be on it’s last legs, and HP has announced that it’ll never make new WebOS hardware. In the meantime, the fire sale of TouchPads has done fantastic things for us WebOS developers. The image below is a graph of the Flickr Mundo HD sales for 2011.

If only HP had anything resembling courage, rather than wimping out with the revelation that “Competition is hard? What? No one told me! Run away!!”, this sales trend might have actually continued for a long time.

Ah well, I’ll enjoy it while it lasts!

Touchpad Sales of Flickr Mundo HD

Posted in apps, Flickr Mundo, Palm, Tablet, WebOS | 2 Comments »

Unpacking webOS .ipk files on a Mac

Posted by Shane O'Sullivan on August 28, 2011

Quick tip: For some reason, the archive files that webOS uses as application installers are very awkward to extract on a Mac. It’s simple on Windows.

After a little digging, I found a handy script at that does the trick.

Posted in Palm, WebOS | 3 Comments »

HP Enyo talk from the London Ajax conference

Posted by Shane O'Sullivan on July 3, 2011

I really enjoyed talking about HP Enyo at the London Ajax groups conference on July 2nd.  People were genuinely interested, and hopefully will take a closer look at the framework, which I find great to develop HTML5 apps with.

You can view the talk below [source]

The slides are embedded below.

Thanks to Dylan from SitePen for organising everything and RIM for sponsoring the event.

Posted in Ajax, enyo, Palm | 3 Comments »

Come hear about HP Enyo at the London Ajax event

Posted by Shane O'Sullivan on June 30, 2011

I’m very happy to have been invite to speak at the London Ajax event on July 2nd, 2011 – .  I’ll be giving a talk about the new HP Enyo framework, and how you can use it to develop HTML 5 apps.


Posted in Ajax, enyo | Leave a Comment »

Sweep line Voronoi algorithm in JavaScript

Posted by Shane O'Sullivan on March 22, 2011

Years ago I translated Steven Fortune’s sweep line Voronoi algorithm to C++, and have been meaning to make a JavaScript version for some time, but never got around to it.

Now, someone has actually done it with the D3 charting library, and it’s fantastic.  Check it out at

Posted in Javascript, voronoi | 9 Comments »

Quick canvas effect prototyping

Posted by Shane O'Sullivan on March 7, 2011

I’m doing some playing around with image processing on HTML5 Canvas elements, and so I’ve hacked together a simple page for prototyping different algorithms. Check it out

The code abstracts away most of the complexities of working with Canvas elements, and just lets you get down to what you need: your pixel manipulation algorithms.  It provides a number of test images and examples to get you started, so have fun!

Oh and yes, it’s pretty ugly :-)

Posted in Technical | Leave a Comment »

Palm and the Mobile Expressionists

Posted by Shane O'Sullivan on January 28, 2011

Palm/HP have a new advertising campaign aimed at getting app developers all excited, and I was very happy to be a part of it.  Here’s hoping it helps give webOS the kick it needs to show developers how simple and fun it is to develop for.

Posted in Technical | Leave a Comment »

Using Flickr Mundo to make your webOS app better

Posted by Shane O'Sullivan on November 14, 2010

If you are a webOS developer with an interest in Flickr, you can now greatly improve your users experience by integrating your app with Flickr Mundo. (thanks to @rparvez for the idea to integrate with @neato_webos)

I’ve added the ability for other webOS apps to launch Flickr Mundo with a Flickr URL.  This gives a far better experience to the user than simply loading Flickr in the browser – they’ve already purchased the app, it is built natively for webOS and can do many things that the web interface cannot.

For example, loading the link

Many different patterns of Flickr URLs are supported.  However if you pass a URL that is not supported, Flickr Mundo will simply launch the browser at that URL.

To make this work just takes a few lines of code.  From within any Mojo scene assistant, simply use the followinf JavaScript code:

var url = "";
this.controller.serviceRequest("palm://com.palm.applicationManager", {
  method: 'open',
  parameters: {
    id: 'com.chofter.flickrmundo',
    params: {
      target: url

As you can see, you can even upload photos to Flickr using this method. So if you have some kind of photo app, would like to be able to upload to Flickr but don’t want to have to go to all the trouble of correctly authenticating a user, you can just use Flickr Mundo to do it for you.

The version of Flickr Mundo with this included, v1.4.0, was submitted for review today, Nov 14th 2010, and should hopefully be available for download in a couple of days. Many different URL patterns are supported, but if you find one that isn’t, please let me know and I’ll look into adding it.

A future version will also include the ability to specify the file to upload – v1.4.0 asks the user to pick the file, similar to the stock Photos app on webOS.

Posted in Ajax, apps, Flickr, Flickr Mundo, Javascript, Palm, WebOS | 3 Comments »


Get every new post delivered to your Inbox.

Join 535 other followers

%d bloggers like this: