Showing posts with label magic. Show all posts
Showing posts with label magic. Show all posts

Tuesday, March 09, 2010

Portable apps for iPhone, Android, Pre, n900 - Can Processing.js help?

I don't know. But if you want to find out, then I have something for you.

Processing.alt

Visit this website from your desktop browser. You will see an IDE. Write some processing code to create a sketch and save it when you are done.

Visit the same website from your iPhone/Android/n900/Pre browser. You will get a simple viewer interface. Find your sketch under My Sketchbook and run it.

Processing is a well known language to create sketches, animations, games. It is a simplified dialect of java. The resulting sketches are in the form of bytecode and can be run on desktop or in java applets. In Summer of 2008, John Resig (jQuery fame) ported Processing to javascript. Processing.js uses the HTML5 canvas element to render the sketches.

The modern browsers that ship with today's smart phones support HTML5 element. So it is very much plausible to get your Processing sketch/game working on all the modern smart phones without any knowledge of native app development for each platform. Processing.js has a potential to become an uber-portable library for mobile development.

That was the idea I started out with about a month ago. After several iterations, I ended up with a website that you see now. It is an IDE when opened from desktop browser. You can write Processing code, run it, save it, share it for others to see in the Gallery. There are also some samples you can find in Gallery right now. Try them out.

The same website acts as a viewer for your processing sketch when opened from a mobile phone. You can view the shared sketches from the Gallery or you can login and find your saved sketches in My Sketchbook.

One great advantage of Processing.js is, it can intermix javascript with Processing code. So in the samples you will find how javascript is used to automatically find  the kind of browser and adjust the dimensions of the sketch accordingly.

I have tested the site on Android HTC Magic and Nokia n900. A friend told me it worked as expected on his iPhone too. Also I am treating Palm Pre's user agent as mobile platform. So on these four platforms you should see the mobile interface of the website. But in case if you don't, let me know and I'll see what is wrong.

As you will see that running Processing code on smartphones is indeed possible, but is fairly sluggish. However I believe the future is not far when the phones will become more powerful, browsers will become more optimized and Processing.js can also be tuned for speed. We already have two gadgets with 1GHz processors - Nexus One and iPad.

The IDE also has a lot of scope for innovation. But before jumping ahead of myself, I decided to open it as beta. I would like to hear your thoughts and suggestions on this idea.

So try it out and leave your opinion in the comments.

P.S. For logging in to save your sketches, use your GMail account. You don't need to login to browse through the Gallery.


Ads:
* Processing: A Programming Handbook for Visual Designers and Artists
* Learning Processing: A Beginner's Guide to Programming Images, Animation, and Interaction (Morgan Kaufmann Series in Computer Graphics)
* Processing: Creative Coding and Computational Art (Foundation)

Thursday, September 17, 2009

Wifi and Battery

Although I didn't dedicate a blog post to my latest beloved gadget purchase - I have been a happy owner of HTC magic for about three weeks now. I used it for first two weeks with the factory ROM. It worked quite well - except for the Google apps and access to Android market. To my delight I found that it had very good battery life. After around 6-7 hours away from the USB charger, it would loose 10-15% battery. Remembering people's experiences of 24-hr battery life, this seemed quite impressive. However to my annoyance, I found a problem. When the phone was not in use, its wifi would be off. I had ReaderScope on it downloading news every 1 hr. It cancelled the downloads because it didn't find any wifi (and I had set it to use wifi only). Moreover, some apps (which I never found out) would go over the Mobile network if they didn't find wifi. I use a prepaid SIM card. So after every usage of Mobile network, I get a message showing me how much credit was used in last call and what's the balance remaining. So after leaving phone unused for the night, I would find some of these messages in the morning. Using Rs. 0.30 to 9.00 at times. This really bugged me. Loosing money for no reason.

Last week I rooted the phone and installed a different ROM (Amon_RA), the one with all the good stuff (Google apps and access to market). With this ROM, I do not see the wifi getting turned off when the phone is not in use and the screen is off. The ReaderScope periodic downloads go on without any problem over wifi. However now the battery life has much deteriorated. Over night, when the phone is not hooked to a USB charger, it looses about 40-50% or more charge.

My conclusion, always ON wifi is sipping the juice out of battery.

What I find more interesting however, is HTC's default setting to turn off the wifi when device is unused and screen times out. (And I couldn't find any way to change that setting at all.)

I wonder if they had a noble motive of giving the user longer battery life OR was it to boost revenue of Airtel (partner carrier) by favoring Mobile traffic over Wifi, even when the later is available.

Anyhow... Glad to be with the new ROM!!

Saturday, July 25, 2009

HTC Magic (Indian version) - expectations and facts

This month HTC Magic came to India. Being the first Android phone to be introduced in India, it is much longed for by Indian geeks. I know how much I have waited for it. Yesterday afternoon when I eventually received a list of dealers from HTC support, that are selling Magic, I almost left for the nearest one to buy a piece. But after I googled a little thouroughly, I found some early reports of HTC magic.

If you are a geek in India looking for a hackable Android cell phone, HTC magic (so far) is not the one for you. The biggest attraction of Android, is the ability to install new apps and a rich variety of them. The biggest repository of such apps, is Android Market. It has loads of free and paid apps. Unlike Apple, Google doesn't enforce exclusivity on App store choice for Android phones. So there are other app repositories too - but they are not nearly as rich in variety as official Android Market. Now note that HTC Magic in India does not come with Android Market App.

If you don't already know, here is the trouble: Android Market is only accessible through the app installed on the phones (you can check the featured/top apps from website, but can't download them from web). Furthermore, the Android Market App is not open source (like rest of the Android platform).

There are however ways to get around this problem. Root the phone and flash it with a ROM image that has Android Market binary in it. (didn't i say this post if for geeks only :) You will find many places which have well documented steps on how to do this. Some of the best resources: Haykuro's blog, xda-developers forum, android-dls wiki, Magic rooting post for South Africa version

The problem is, all of the above methods won't work for the HTC Magic released in India. Someone has already tried it here and reported here. Also some frustration can be seen here. The crux of the problem is Indian version of HTC Magic comes with "HBOOT-1.33.0010" which is a so-called "dreaded perfect" SPL. It will only accept signed images to flash the firmware, so the ROM images from G1, or ION or Hero are not useful with this HTC magic. There is however work going on to find a way around this. Follow this thread. There are many suggestions - ranging from dumping the memory during an update and searching for keys used to sign the firmware to exploiting the buffer overflow in linux kernel 2.6.27 to gain root access. People are offering money for someone to do this job. It will be interesting to see how this turns out. But all in all no Android market for HTC Magic in India.

I also explored more formal channels. I emailed HTC support (which is very responsive BTW) asking "whether HTC plans to provide firmware updates in near future that will enable support for Android market and other Google Apps. OR HTC will never provide any such support?". They diligently replied:

"In this regard, we would like to inform that we are not having such information that HTC is going to provide the android market software for Magic device in future or not.
We request you to for regular updates visit our site i.e. www.htc.com "

For a serious Android developer the need for rooting the device goes beyond just the Android Market app. Once the flashing powers are tamed, we can use the same device to test our apps for different ROMs - G1/ION/Hero for now.

My impression is HTC Magic is not targeted for geeks in India ('m asking for too much you say? :). This version comes with Microsoft Exchange Sync facility (check specs) - something that is useful for the "suit". (This feature in itself is rare I believe, not seen in many of the US/Europe versions of Magic)

Anyway. As far as my first purchase of Android phone goes, I see three choices.
  1. If someone successfully exploits the dreaded perfect SPL, I will buy Indian HTC.
  2. If Google announces HTC ION (the GoogleIO version of Magic) as ADP2 I will order it (Note that ADP1 i.e. unlocked G1, is out of stock).
  3. If Samsung Galaxy (i7500) that is releasing in India next month comes with an exploitable ROM, I will go for it instead.
In any case: I wait.