Monday, March 30, 2009

Enabling iPhone 3G Tethering

Apple recently announced iPhone OS 3.0 boasting over 100 new features. However, the feature that really held my attention was tethering.

After installing the new OS, I could not find the tethering option anywhere and enabling it required a little bit tinkering around with the carrier support files. I followed this How-To and had it working with Airtel India after a little bit of trial and error.

If you are in India and got your hands on the iPhone 3.0 SDK, you can download the ipcc files for the official Indian providers below:

Airtel India
Vodafone India

The Airtel configuration file works great. I did not test the Vodafone configuration file. If anyone has got it working, please let me know.

Enjoy!!

Tuesday, March 24, 2009

Google Maps Street View

A lobby group called Privacy International (PI) wants to Google Maps Street View shutdown. I think it is stupid if folks expect privacy on streets. Where else would you expect to see ETs or pretty girls flashing (or rather almost flashing) their wares. Anyway, street view is fun. I too feature on Street View if you happen to be looking for 1444 Charleston Rd, Mountain View, California.


View Larger Map

Here is a screen shot if someday they decide to take down these images.



You can find the top 15 Google Street View Sightings here.

Saturday, March 14, 2009

Sixth Sense

No. I am not talking about "Sixth 'I see dead people' Sense". This is what I am talking about. It looks something straight out of a sci-fi movie (in fact a lot like the one in Minority Report). Watch the video.



Thanks to my friend Abhinav for sharing.

Printing from the command line in Mac OSX

I had to print close to 50 individual PDF files and one way to do that was to open each one of them and then print them. But there is a fundamental issue with that. I am lazy. Opening 50 files and then printing them was not something I wanted to do on a Saturday morning.

So, I fired up the browser and started searching for ways to print from the command line and got lucky with the first hit. 'lp' is a command line tool that submits files for printing or alters a pending job and it is very easy to use. To print a bunch of pdf files in a folder, type the following commands in the terminal:
# Printing to default printer.

lp *.pdf

# Printing a document to the default printer in landscape mode

lp -o landscape foo.pdf

# Printing the first and the second pages of the document

lp -P 1,2 foo.pdf

# Printing pages between 4 and 20 in landscape mode

lp -P 4-20 -o landscape foo.pdf

# Printing to a non-default printer called "bar"

lp -d "bar" foo.pdf
More information is available in the man document for 'lp'.

P.S.: I did not use 'really' in this blog post. Oops!! I think I just did it again.

Tuesday, March 10, 2009

Word Clouds

I came across a tool (or as the website calls it, a toy) called Wordle today which allows you to create word clouds. The size of a word in the visualization is proportional to the word frequency in the input text. On my website, apart from 'Android' and 'iPhone', I realized I use 'Really' a lot :-). Here is the wordle for my website.

This will look great on a t-shirt. You can create one for yourself here.

Tuesday, March 3, 2009

Development on iPhone vs Android

As I mentioned in an earlier post, I have been working on both iPhone and Android platforms simultaneously. While the road has been bumpy, it has also been a lot of fun. I think I know enough of both the platforms to give my opinion on development on iPhone and Android.

Apple officially announced an iPhone SDK sometime in March 2008. The SDK contains an iPhone version of the Cocoa libraries called 'Cocoa Touch'. The SDK itself is a free download, but you will have to cough up $99.00 (registration fee for the iPhone developer program) if you want to run the apps you are developing on an iPhone. That is a lot when you compare it with Android, where you have to pay just $25.00 to be a registered Android developer.

The latest version of the SDK is a whopping 1.7 GB and contains the entire iPhone development toolchain including XCode, Interface Builder, Instruments, the simulator and APIs including Cocoa and Cocoa Touch. The SDK can be used to develop applications for both iPhone and Mac OSX. Android SDK on the other hand is a much more reasonable ~80 MB. Andorid SDK contains the Android API, the Android tool chain, Android simulator and Eclipse plugin called ADT.

Android Development Tools or ADT is an eclipse plugin that makes it really easy to create, build and debug Android applications.

One of the biggest drawbacks in developing for iPhone is that it can only be done on a Mac OS X machine. There is no support for Windows (which is good) or Linux (which is bad). Android SDK on the other hand is multi-platform and gives more or less the same user experience on all the supported platforms.

Disclaimer: I am not an Eclipse or an XCode expert and my comments are based on my experience (or lack thereof).

I love and hate developing on both platforms. There are certain great features which each one offers and there are features which both can improve on.

IDE:

XCode is definitely the winner here. It is very stable and takes up a lot less memory than Eclipse. The 'Interface Builder' is an awesome tool, but more about it later.

Not so easy on ADT/Eclipse. While not really an Android issue, using Eclipse slows down my machine. Once it was taking up more than 75% of the physical memory on my machine. I know, I don't have to use Eclipse. But being inherently lethargic and lazy, I never really bothered to figure out how each of the tools works.

I also find Eclipse 'auto-compile/let me display the squiggly line before you finish typing' feature very distracting and annoying. I am sure there is a way to disable it, but could never find it.

UI development Tools:
Getting the UI right for a mobile application is the key. It makes or breaks the app. I feel it is important to spend a good amount of the development time to get the UI right.

UI design on iPhone is very easy. and lets folks like me who are 'UI Design Challenged' an easy way out. You just drag and drop the components, connect the outlets and actions and you are done.

The UI design tool in ADT is useless. DroidDraw is definitely a better alternative but cannot match 'Interface Builder'. The recommended way for creating Android UI is through what are called 'layout files'. Layouts are XML files where you define the hierarchy for your UI. While the learning curve is very small, getting the elements to be at the right place drove me nuts!! There are attributes like 'weight', 'gravity', 'orientation' ... aaarrrrggggghhhh!!! There were times where I spent 30 mins writing the functionality but 3 hrs trying to get an element where I want it.

Debuggers and other tools:
Debuggers on both environments are pretty decent and I really have no complaints there.

The iPhone SDK also has 'Instruments', an instrumentation tools, that is extremely helpful in analyzing performance of the app.

Android SDK comes with Android Debug Bridge (adb) and Dalvik Debug Monitor Service or DDMS which provides a bunch of services like port-forwarding , screen capture on the device, thread and heap information on the device, logs, process information and some really funky features like spoofing incoming calls, location data and SMS.

I must admit that my knowledge of both Instruments and DDMS is very limited. I just understood enough of each to get out of some tight spots.

The Code:
Android is clearly the winner here. The API is really rich. There are things you can do which you cannot really dream of on iPhone (at least not without jailbreaking). The features I really like the best are Intents (Intents are very difficult to explain, but pretty simple to use/abuse and I recommend having a look a the documentation to really understand it). Android API also allows creating of background services opening up more creative avenues for the developer. iPhone API does not support background services yet and does not allow for more than one third-party app to run in the background.

Android API is in Java which means the learning curve is much less steep (for someone who knows Java). Not so easy for iPhone. iPhone API is in Objective-C which while being extremely feature rich is also very, for a lack of a better word, non-traditional. I found the syntax a bit weird at fast, but got over it very fast. Objective-C uses named arguments. For example, a Java method looks like:
someObject.someMethod(someParameter, someOtherParameter);
An Obj-C method on the other hand looks like:
[someObject someMethod:someParameter withSomeOtherParaMether:someOtherParameter];

This can make method names pretty long. For example:
- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName baseURL:(NSURL *)baseURL;
Memory management is another issue. Android supports garbage collection while iPhone does not. So, keep track of object allocations and releasing them when not required is a big task on iPhone.

Conclusion:

My goal here was not to do a feature by feature comparison, I neither have the experience or the expertise to do so. I feel that developing on both platforms have their own issues and I accept that some of these issues are probably because I did not take time to understand a feature or an API before using them.

Having said that, both Android and iPhone APIs make mobile development really a fun experience and I would find it very difficult to choose my favorite platform among the two.

I recommend this book for Android and this one and this one for iPhone.