David Janes' Code Weblog

June 4, 2012

Editorial – How to Save RIM

ideas,rim · admin · 5:57 am ·

Apple and IBM are two companies that made successful turnarounds from seemingly fairly desperate situations. Generally the turn arounds were done by a powerful outsider[1] brought to the company, who cut through a Gordian Knot type situation.

RIM has two major issues: their hardware and their apps.


Their hardware lineup is confusing, frequently breaks and uninspired of design and engineering.

When Steve Jobs returned to Apple, he simplified the product line from a jumble of numbered products with overlapping feature sets into 4 four products, based on a 2×2 matrix: inexpensive / expensive × desktop / laptop.

RIM should do something similar, simplifying its hardware line into three or four models easily grasped in purpose:

  • BlackBerry Student / Third World — Nokia competitor inexpensive  starter model
  • BlackBerry Business — Keyboard model
  • BlackBerry Touch — Touch Screen model, iPhone / Android competitor

And that’s that. I don’t know what to do with the PlayBook but unless it supports some critical business function that people buy BlackBerry mobiles for, it should be dropped.


Apps used to be almost impossible to develop cost effectively for BlackBerries due to a plethora of semi-compatible devices and a backwards Java ME development environment. RIM’s solution — for the future — is to allow you to develop in HTML5, C++, Java ME, Android, and Adobe AIR.

Where does this leave us? There is no reason to develop anything for RIM now, as things that run on the old OS are certainly approaching end-of-life; things that run on the new OS BB10 don’t have a device to deploy to! And what a confusing mess of choices.

What to do?

IMHO Simple: RIM should become (and announce that it is becoming) the best device to run HTML5 on it the world. It should hire the best the team of developers to make this happen and make sure that when anyone views a webpage on a BB device, it’s the best possible experience possible. RIM should provide an environment for security and e-commerce infrastructure that works HTML5 websites — that can be run on non-BB devices. Add massive and/or intelligent caching in the device to speed things up. Built in jQuery. And so forth.

And it should run on all the BB models above.

And it should drop support for C++, Java ME, Android and Adobe AIR.

[1] it’s safe to say Steve Jobs had any major favours left  owed to senior Apple management

November 10, 2011

Naming Standard: _configure and _update

android,ideas · admin · 12:13 pm ·

In preparation for a series of posts I’m about to do on Android Activities, I want to do a brief post on a recent standardization I’ve decided on. When doing user interfaces, there’s two things that I’m always doing: some initial configuration of elements (such as setting the color or font of a label) and then maybe multiple times changing the state of an element (such as setting the actual label text).

So from now on, I’m naming these:

  • _configureXYZ – a function / method for the one-time setup of an XYZ.
  • _updateXYZ – a function / method for changing the state of an XYZ, with the expectation this is going to be called multiple times.

Note that I don’t write one-function per UI element. It’s more like _updateButtons, _updateMaps, etc.

Note the underscore. Whenever I write a function that’s intended only for the use of the current object, I prefix with “_“.

November 29, 2010

Good-bye XML, SOAP & SOA

ideas,javascript,xml · David Janes · 7:17 am ·

In my callow youth, I remember being so excited about XML. Ah, how wrong I was. Two articles of interest:

The End Of The Road For Web Services

Web services as a strategy was fundamentally flawed in my view because it was so un-web. It took an idea that hardly worked on an Intranet – remote manipulation of tightly-specified objects – and tried to make it work on the Internet. It led to software applications that by default were complex, brittle and heavy. Although I know many brilliant software engineers who worked unexpected miracles with Web Services, implementation by the common corporate programmer was stodgy in every case I heard about. In the end Web Services became an intranet tool for most uses, rendering the “W” incorrect even if WS* will be with enterprise developers for years to come as a kind of architectural COBOL.


XML vs the Web

It’s “Yay”, because for important use cases JSON is dramatically better than XML. In particular, JSON shines as a programming language-independent representation of typical programming language data structures. This is an incredibly important use case and it would be hard to overstate how appallingly bad XML is for this. The fundamental problem is the mismatch between programming language data structures and the XML element/attribute data model of elements. This leaves the developer with three choices, all unappetising


So what’s the way forward? I think the Web community has spoken, and it’s clear that what it wants is HTML5, JavaScript and JSON. XML isn’t going away but I see it being less and less a Web technology; it won’t be something that you send over the wire on the public Web, but just one of many technologies that are used on the server to manage and generate what you do send over the wire.

In the short-term, I think the challenge is how to make HTML5 play more nicely with XML. In the longer term, I think the challenge is how to use our collective experience from building the XML stack to create technologies that work natively with HTML, JSON and JavaScript, and that bring to the broader Web developer community some of the good aspects of the modern XML development experience

Having in recent memory been involved in a SOA deathmarch project (still in the process of tumbling down to inevitable failure), and dealing daily with the issues of transferring data using XML, I can firmly say: good riddance.

What do we do now? We do JSON. Why do we do JSON? Because the JSON object model (and the implicit RESTful JSON API model) is almost an exact match for how programmers – especially those of languages such as Python, Ruby & JavaScript – think about data .

November 20, 2009

How to use XCode for Android Projects

android,code fragments,ideas,macintosh · David Janes · 6:07 pm ·

Let’s assume you already have an Android project on your Mac.

Create the XCode Project

  • start XCode
  • select File > New Project…
  • select External Build System
  • go to the parent directory of your Android Project
  • in the Save As: field, enter the directory name of your Android Project
  • select the scarily-misnamed Replace option [not in XCode 4 -- thanks Jusin]

Add Files

In your new XCode project:

  • select first item in the left hand column, which is the name of your project
  • right-click, select Add > Existing Files…
  • select add files (don’t select the Copy option)
  • organize as desired (I like to do a lot of grouping). You should be probably adding at least your Java files and your Layout resources.

Configure your Build Target

In your new XCode project:

  • look for Targets
  • inside will be a target for your project’s name
  • double click on it
    • change Build Tool to ant
    • change Arguments to install

Clicking ⌘B should now compile your project.

Note: if you figure out how to have a Build vs. Build & Install (e.g. ⌘ENTER) please let me know!.

Getting XCode to Recognize Java errors

  • Reconfigure the Build Target, changing ant to ./xant
  • Make a file xant in the project’s home directory, using the code below
  • do (from a Terminal) chmod a+x xant
#!/usr/bin/env python

import sys
import re
import subprocess

av = list(sys.argv)
av[0] = "ant"

p = subprocess.Popen(av, stdout = subprocess.PIPE)

javac_rex = re.compile(" +[[]javac[]] +")
line_rex = re.compile("[.]java:[\d]+:")

pending = ""
while True:
    d = p.stdout.read(128)
    if not d:

    d = pending + d

    nx = d.rfind('\n')
    if nx == -1:
        pending = d
        d, pending = d[:nx + 1], d[nx + 1:]

        d = javac_rex.sub("", d)
        d = line_rex.sub(r"\g error: ", d)


Note: this code has been updated from the original post. It now reads little chunks and outputs them immediately rather than post-processing the ant output.

November 14, 2009

Twitter uses WOEIDs – why you should care

ideas,maps · David Janes · 5:43 am ·

Because I don’t think this announcement got sufficient attention: Twitter is using Yahoo’s WOEIDs to identify locations in its Geolocation API.

WOEIDs are:

  • a numeric identifier for geographical places or regions, from a “place of interest” all the way up to continent
  • uniquely defined, for each place
  • hierarchically nested
  • related to each other by natural concepts, such as neighbor-of, sibling-of, etc.
  • managed, by Yahoo
  • a language independent way of talking about place
  • not necessarily tied to political boundaries, i.e. there’s a WOEID for the Bay Area

This announcement is important because:

  • it orders tweets into “containers” that can be used to find those tweets easily. In particular, there’s now codes that a machine can easily work with to find human concepts. Previous attempts at identification depended upon things such user entered hash tags for things such as a nearby airport, postal code, zip code, etc. and other concepts that don’t necessarily reflect what’s really going on
  • it encourages others to start building on WOEIDs, a non-Google way of identifying places

Read more:

Note that I have some concerns about how well WOEIDs will work when we start wanting them being dynamically/crowd defined down to the business level (e.g. sort of like what foursquare is doing; I don’t think they use WOEIDs though.)

November 8, 2009

Next Generation iPhone to include RFID reader?

ideas,iphone · David Janes · 5:38 am ·

This was something I was hoping would be in the 3GS. Rumor: Next generation iPhone to be RFID enabled:

A highly reliable source has informed me that Apple has built some prototypes of the next gen iPhone with an RFID reader built in and they have seen it in action. So its not full NFC but its a start for real service discovery and I’m told that the reaction was very positive that we can expect this in the next gen iPhone.

If Apple does it, expect every phone manufacturer and their sister to begin pumping out NFC enabled phones, at least for service discovery and sync.

This just reinforces what we knew based on the two separate patents Apple submitted that had the iPhone enabled to read RFID tags. I’m told that the touch project video and the BT SIG’s specs were all driving forces to push this forward as well as other factors.

Guess I’ll be touching my iPhone to my Mac to link them together to sync iTunes by next year.

My thoughts:

  • this will be a game changer for RFID, bringing applications down to the small business and hobbyist layer
  • RFID + applications is a wicked combination, making the mobile phone an Anything Device; Microsoft, Motorola and RIM should all try to get the jump on this
  • RFID + in app purchase is a wicked combination; put your thinking cap on for this one
  • RFID + Augmented Reality makes context sensitive layers start popping up
  • I’m not a game person, but you know there’s got to be gaming implications for this
  • what are the implications for big chains — groceries, consumer electronics — when anyone can walk in the door and get a better price buy waving their phone at a shelf

August 10, 2009

Travel Websites & Web 3.0

Discover Anywhere Mobile,ideas,semantic web · David Janes · 2:53 pm ·

On my Discover Anywhere Mobile blog, I’ve posted a list of recommendations about how travel websites can use information to extend their reach.

March 27, 2009

The Three20 Project: Photo viewer and more for the iPhone

ideas,iphone · David Janes · 4:59 am ·

This code could be very useful for iPhone developers:

The name of the new project is Three20, after the 320-pixel-wide screen of the iPhone. The code is all hosted on github for your cloning pleasure. There is an excellent sample app called TTCatalog which lets you play with all of the various UI components. Documentation? Well… there are instructions for how to add Three20 to your project, but I am still working on comprehensive documentation for each of the classes. For now, the sample app and the code itself are your documentation.

The projects are:

  • Photo viewer
  • Message composer
  • Web image views
  • Internet-aware table view
  • Better text fields (including type-ahead)
  • HTTP disk cache
  • URL-based navigation (this could be interesting)

The source base is under the Apache license.

March 1, 2009

AUAPI: JSON to XML serialization

auapi,ideas,tips · David Janes · 8:40 am ·

Here is a brief outline of how one would “naively” transform Almost Universal API‘s (AUAPI) JSON into XML. We say “naive” because in general one wants to make a transformation into a specific XML application: Atom, RSS, OPML, KML, etc.. In those cases, one has to rename and rework certain elements first for standards compliance, then complete the naive transformation for remaining elements.


Walking JSON objects is done depth first. Most of the complexity involved is in handling dictionaries, which can be valued as being comprised of ( key, value ) pairs. For each dictionary, we are creating an XML node whose properties are defined as follows:

  • keys beginning with @@ are ignored
  • the key @ means “the text” of the  node (the examples will make this more clear)
  • other keys beginning with @ are attributes of the node
  • all other keys are defining children of the node

There are number of complexities that have to be addressed; for this I suggest looking at the examples or source code.

Namespace handling

  • collect all the namespaces used in the JSON and add to the root XML node
  • if any JSON element has a namespace, assume that namespace is inherited by its children


You can see the code for this in the AUAPI source base in api.py in XMLAPIWriter.TranscribeNode.

Example 1

    "numbers" : [ 1, -0.23, ],
    "strings" : [ "bob", "caf\xe9", ],
    "booleanish" : [ True, False, None, ],
    <booleanish />

Example 2

    "a1" : {
        "b1" : 1,
        "b2" : 2,
    "a2" : {
        "b3" : "hi",
        "b4" : "there",

Example 3

    "@attribute" : "hello",
    "@bttribute" : "there",
    "a" : "some string",
<root attribute="hello" bttribute="there">
    <a>some string</a>

February 22, 2009

What is the framework for public APIs?

ideas,semantic web · David Janes · 3:55 pm ·

This post was originally sent to the ChangeCamp mailing list in response to a question about “what framework should we use for public APIs?“.

The core “frameworks” are POSH, REST and JSON. POSH is “Plain Old Semantic HTML”, meaning websites should be developed using modern web standards, pages should validate and use HTML elements correctly, and presentation is coded using CSS. REST can have deeper implications, but amongst the simplest is that pages can be returned using simple GET statements against well known URLs. JSON has emerged as the defacto standard for returning API results, amongst the reasons for is simplicity of creating mashups and embedability.

Atom and/or RSS provide the framework for update notifications. There are emerging technologies for real-time delivery, but it’s too early to worry about that.

Microformats provide a framework for embedding well-understood objects in HTML, are based on popular and well-understood standards, are easy(-ish) to implement, and a “consumer” ecosystem exists. In particular, people can be represented by hCard, events by hCalendar, tagged data by rel-tag and microcontent (articles within a page) by hAtom. Note that no parallel infrastructure need exist to do microformats: they are served within HTML pages.

Identify should use OAuth and OpenID; pragmatism says Facebook Connect and Google Friend Connect should be in the mix too, though I have a number of reservations about those.

I am very non-bullish about RDF, particularly as a model for delivering data of well-defined formats. IMHO it has missed almost the entirely the mashup wave of the last few years, and successes seem to be scattered at best. RDFa is competing in microformat’s “space” and may see success yet if it starts proving concrete solutions rather than “here’s a format that can do anything”, especially given microformat’s process issues.

Older Posts »

Powered by WordPress

Switch to our mobile site