null is null or not an object http://nullisnotanobject.com Most recent posts at null is null or not an object posterous.com Tue, 05 Jul 2011 15:37:00 -0700 Untitled http://nullisnotanobject.com/59788238 http://nullisnotanobject.com/59788238

If you need to know all the people that have contributed to one of your github repos here is some git-fu for you:

git log | grep ^Author: | sed 's/ <.*//; s/^Author: //' | sort | uniq -c | sort -nr

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/4V6Myfre Dave Johnson davejohnson Dave Johnson
Fri, 20 May 2011 12:27:39 -0700 Background Services in webOS 2.1 http://nullisnotanobject.com/background-services-in-webos-21 http://nullisnotanobject.com/background-services-in-webos-21 http://pdnblog.palm.com/2011/04/building-background-services-with-webos-2-1/

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/4V6Myfre Dave Johnson davejohnson Dave Johnson
Fri, 13 Aug 2010 09:51:00 -0700 PhoneGap Native Bridge http://nullisnotanobject.com/phonegap-native-bridge http://nullisnotanobject.com/phonegap-native-bridge

The “native bridge” is the secret sauce of PhoneGap and is what allows JavaScript in an embedded browser talk to native code and vice-versa.

On every platform we do this differently depending on what features that native browser has. Here is the list of platforms and how we do it.

iOS: To communicate from JavaScript to native we call window.location = “gap://Class.method/args” and then intercept the url in native code and parse our the parameters. The class / method is then dynamically loaded / called. To call JavaScript from native we use UIWebView.stringByEvaluatingJavaScriptFromString.

Android: Communication from JavaScript to native is achieved by overriding the JavaScript prompt function in the Android native code and the message passed is much like that used in iOS. We used to use WebView.addJavascriptInterface to add Java objects directly to the JavaScript sandbox but that was causing some devices to crash with Android 2.3. To call JavaScript from native we currently use WebView.loadUrl(”javascript:…”) but that has some problems so we are soon moving over to polling a Java message queue calling a local HTTP server via a long-lived XHR connection.

BlackBerry 4.x: document.cookie is the only way to talk between JavaScript and native. JavaScript sets the cookie for native to read and JavaScript polls the cookie for messages from native. Fucking elegant!

BlackBerry WebWorks: Astoundingly the new BlackBerry WebWorks SDK is pretty damn nice. You can expose Java objects to JavaScript with ScriptEngine.addExtension and you can call JavaScript from native with ScriptEngine.executeScript. The context for the JavaScript execution can even be specified. Seriously great work there.

Qt: This one is not quite ready but it will use the QWebFrame.addToJavaScriptWindowObject to expose native objects to JavaScript and will likely use polling of those exposed native objects to get data back into JavaScript - much like the Android approach

Windows Phone 7: There is something called window.external.Notify in the browser (mapped to a native object through the ScriptNotify event) on Windows Phone 7 that we use to send messages into native code. Going the other way there is WebBrowser.InvokeScript.

webOS, WRT: The platforms that are just JavaScript don’t have any native code. Well, we might look into the native side of webOS one day but no time soon.

 

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/4V6Myfre Dave Johnson davejohnson Dave Johnson
Thu, 05 Aug 2010 10:10:00 -0700 PhoneGap and BlackBerry OS 6 http://nullisnotanobject.com/phonegap-and-blackberry-os-6 http://nullisnotanobject.com/phonegap-and-blackberry-os-6

RIM OS 6 for BlackBerry smartphones is being released very soon on the new BlackBerry Torch 9800.

It looks like a pretty nice upgrade from OS 5, most notably including a WebKit based browser. This should be a *huge* improvement for PhoneGap on BlackBerry.

The bad news is that OS 6 will not work on a lot of the older hardware. OS 6 will run on the following:

  • Storm 3 (as yet unreleased)
  • Bold 9700
  • Bold 9650
  • Perl 9100

Notable devices missing from that list are the original Bold 9000 and the Storm 1 and 2. Those will be stuck on OS 5.

The kicker here is that anecdotally, and based on AdMob stats from April 2010, the most widely used RIM devices (remember AdMob stats represent devices that ads are being served to) are from the BlackBerry Curve line 8300 and 8520 in the US and UK respectively.

The tentative plan for PhoneGap on BlackBerry is likely going to be a “final” release for BlackBerry 4.6 / 4.7 tagged on Github (sometime in the near future) and then shifting focus to BlackBerry Widgets on OS 5 and 6.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/4V6Myfre Dave Johnson davejohnson Dave Johnson
Tue, 20 Apr 2010 10:05:00 -0700 PhoneGap Desktop http://nullisnotanobject.com/53780973 http://nullisnotanobject.com/53780973

So if PhoneGap was running on the desktop, what would you call it? Well I have not come up with a good name yet but after a few nights of hacking we threw together a version of PhoneGap for Mac OShttp://github.com/shazron/phonegap-mac and a version for Windows http://github.com/davejohnson/phonegap-windows.

@shazron has implemented the sound API on the Mac version and I did Geolocation on the Windows version using a simple GeoIP lookup.

Check it out, write some code, and let us know what you think!

For the Windows version I have used the awesome WebKit .NET project written by Peter Nelson. If you use the Visual Studio 2008 solution file, you will have to download the source or binary versions of WebKit .NET and setup the references correctly. I have so far used the 0.3 release of WebKit .NET. It is pretty cool being able to write a native Windows app (or Mac OS) in Canvas using all free and open source code :)

One other caveat on the Windows side is that you might need to install some Visual Studio C++ redistributables for building it … check the WebKit .NET forum on SourceForge for all the details.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/4V6Myfre Dave Johnson davejohnson Dave Johnson