Saturday, August 27, 2011

OS X Lion Automator And Mobile NOKIA Maps

When I have read this article about Making Desktop Webapps in Lion my first thought was "cool!" instantly followed by "what about an experiment with Mobile NOKIA Maps WebApp?" ... and here I come :)



m.maps.nokia.com

is the beta project I am working on right now together with a bounce of HTML5 geeks :P in order to bring the mature NOKIA Maps experience on Android 2.2+, iOS4+, and others already supported or "coming soon" devices.

Optimized for mobile but still usable with Desktop Chrome or Safari browser, the web app is quite "cute" seen in iPhone or other medium and small screens and this experiment was about bringing same "cuteness" on my Mac Mini as well: partially successful!



Lion Automator And WebPopup Limits

Unfortunately it is not possible to customize that much the popup browser user agent and I am not even sure what kind of engine is used there ...

With iPhone UserAgent the version exposed is 3 and Webkit 430+.

When it comes to iPad UserAgent the version is 4 while with Safari UA the version is the current one.

GeoLocation API does not seem to work, and the cache seems to be cleaned every time the app is closed.

Unfortunately these limits make the current beta less cool than usual, specially because every time the app is closed the storage seems to be reset which means last position is not shown next time, history and suggestions do not show off and even more annoying the routing "home to place" is not available due missing location.



Grab The Desktop App For OSX Lion

I have prepared everything you need to launch m.maps.nokia.com in your OSX Lion so you can give it a try.



Mobile NOKIA Maps For Automator and if necessary extract its content and click on the .app file.



I swear I did nothing different from what Andy Ihnatko described in its article, except changing the icon with the one downloaded automatically on iPad if you pin the website to your home screen.



If you are in OSX Lion give it a try and play around but bear in mind this beta offers much more on your smartphone ;)

Wednesday, August 24, 2011

Simulate Script Injection Via Data URI

Well, not only downloads on the fly, the data uri works for almost everything ( only iOS 5 beta does not want to work with inline data uri AUDIO sources .... but this is another story ... ) ... so ...



How To Simulate Script injection

Let's say you want a test but you don't want to bother a server. However, you want to be sure the test is asynchronous and it simulates the server.



var

head = document.getElementsByTagName("head")[0],

script = document.createElement("script")

;

head.insertBefore(script, head.lastChild);

script.src = "data:text/javascript;base64," + btoa(

"alert('Hello World')"

);





How To Simulate JSONP

Same trick, isn't it? ... except:



script.src = "data:text/javascript;base64," + btoa(

"callback(" + JSON.stringify(dummyData) + ")"

);





How To Drop Server Requests

well, this is the tricky one ...



Surely there is some job to do in the createResponse() function but ... hey, we can stop bothering servers now ;)

Sunday, August 21, 2011

wru, unit tests have ever been that easy

Do you remember my good old wru project? It has been refactored, readapted for both client and server side environment such node.js and Rhino and, most important, it landed in github ;)



Please spend few minutes to read the documentation and you'll realize why I chose this title for this post.



Have fun with JavaScript Unit Tests!