Cast for two

Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Wednesday, July 04, 2007

Twitter tweets on Goople maps mashup



I figured out a simple way to make a mashup that displays tweets from twitter on a Google Map. Click on the pin and a window pops up containing the last tweet that was updated. It is easy to change the location of the pin or the twitter feed that is addressed to obtain the latest tweet. For your reference, here's a pretty print of the code using Google Code Javascript code prettifier:

alt : test.html

Here is how it works:
Twitter API rocks with a JSON feed for every user. Adding a callback function makes it very convient to read the data. Just call a JSON object http://www.twitter.com/statuses/user_timeline/user.json and add a callbackfunction. In our case, the function is called "twitterCallback". The full URL becomes:

http://www.twitter.com/statuses/user_timeline/user.json?callback=twitterCallback&count=1
Replace user with your Twitter nickname. In my case, it's cast42.
The count parameter is set to 1 such that only the most recent tweet is obtained. In the callback function it's easy to obtain the text from the latest tweet:
   var tweet = new Object;
function twitterCallback(obj) {
tweet
.text = obj[0].text;
}
The full source code can be downloaded from the example. Don't forget to fill in your own Google Maps key and replace cast42 with your own twitter name.

Wednesday, June 13, 2007

Future of mobile apps = Google Gears + Javascript on Iphone ?

Last Monday his Steve Jobness announced at WWDC'07 that native applications on the Iphone can not be developed (yet) by third parties. A highly contested strategy as explained in
Mobile Disruption: Apple's iPhone and Third Party Software
. More complaints arose after the keynote.

Read for instance what John Gruber wrote about the keynote:

Web Apps as the Route for iPhone Development

Perhaps it’s playing well in the mainstream press, but here at WWDC, Apple’s “you can write great apps for the iPhone: they’re called ‘web sites’” – message went over like a lead balloon.

Could it be that Apple opted for the way forward to escape the schisma between a secure and stable mobile platform and the richness of being open ? Remember that Google Gears is coming to Safari Webkit and hence the Iphone: Google employs advanced Apple technologies for Gears support. Is Gears + AJAX not THE technology for the next generation applications that blur the line between mobile and desktop? Something Iphone promises to establish ?
This nice example of a Javascript interface for the iphone shows that Javascript can deliver sleek interfaces. I guess the speed of Javascript on the iphone will be ok. At least it won't be slower then other sandbox solutions like Sun Java or Microsoft .Net Mobile. According to Steve Jobs keynote, Javascript executed faster in Safari than Firefox and Internet Explored. Google Gears has the potential to alliviate the drawbacks of networked applications that must store all their data in the network. Maybe the 4 or 8BG storage is a bit underdimensioned to shoehorn modern application into ? What do you think ?