Tuesday, August 11, 2009

Apple's mistakes on iPhone in India


Apple's iPhone is great phone with high memory, highest display clarity, smooth touch screen panel and many other compared to other phones available in India. It has already got a world wide community which delivered cool applications for iPhones. But it is yet to get a big sales attraction in India though it has been launched year ago.

Why apple fails? Doesn't care the sales in India? Why apple hesitates to land in India firmly? No official stores yet to open. I do not know what apple thinks or what business pressure it has with Indian mobile market. I feel the below

  1. It is price tagged huge (200$ in US should be priced below Rs 12,000. But now the 8GB model priced Rs.31,000 and 16GB is Rs.35,000 (approximately 660$ and 770$)
  2. India is a big market for mobile phones (more than 60% by Nokia). Indians can afford the cost if this is available in rest of the world. Phones with features that iPhone has are available in India. but they are(will be) expensive if apple quoted 12,000 rupees.
  3. India has huge GSM market and should not stick with operators. but iPhones are currently with Airtel and Vodafone. (I've changed this point as i didn't know this earlier)
  4. I do not think they understand the India mobile market clearly.
I like the Apple's strategy with iPod and iPhones. Keep the same name for the upgraded model and the applications have backward compatibility. This is missing in current Indian mobile market. Every phone behaves its own way and interestingly we have hundreds of model actively available. Few options apple can consider
  • Reduce the price as they can sell more.
  • Should not tie up with service operator.(I know that there are many to disagree with this point)
  • Apple can have more direct stores.
  • Design sales and marketing strategies FOR India

Wednesday, July 29, 2009

Accessing protected URL in Java

Come through an elegant code yesterday. Somehow the content needs to be accessed from the database server which is password protected. A simple URL query would fetch the content. I've tried Apache commons. I could managed to access the content via plain java.net classes works for me pretty smoothly.

here is how

Authenticator.setDefault(new MyAuthenticator("user","password"));

URL url = new URL("http://localhost:5300/database?_query='for $a in collection('test')/types return $a'");
InputStream resultStream =url.openStream();

And the simple inner class
class MyAuthenticator extends Authenticator {
private String username, password;

public MyAuthenticator(String username, String password) {
this.username = username;
this.password = password;
}

// This method is called when a password-protected URL is accessed
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
}

Are there any better way?

Monday, July 27, 2009

Returning null from methods in Java

It's best not to return null from a methods that returns an String type. instead return just empty string "". This will actually avoid extra checking in the calling method. Return variables can be created and initialized with empty (""). If any results constructed in the method, can be assigned to this result variable. if nothing constructed, it might fall on the last instruction that simply return the initialized variable.

Another approach can be using an Static String constant when empty string need to be requited.

It's best not to return null from a method that returns anarray type. Always returning an array, even if the array has zero length, greatly improves the generality of algorithms. If you
anticipate that your methods will return zero-length arrays frequently, you might be concerned about the performance implications of allocating many such arrays. To solve that problem, simply allocate a single array, and always return the same one, for example:
<code>private static final int ZERO_LENGTH_ARRAY[] = new int[0];</code>
This array is immutable (it can't be changed), and can be shared throughout the application.

We can return null in case of returning an Object.

Sunday, June 14, 2009

Application launchers

Now it's season of thinking (at least for my known circle) for improving productivity in workplaces. It happened to me to read few chapters in a book by Neal ford, called "The Productive Programmer" A somehow very informative book on introducing various tools which can actually help in increasing the productivity.

I still love command line tools, pretty fast, low memory footprint. Over the years, i always try to create batch files are shell scripts for my routine work, like start various servers with different settings, invoking project build, folder syncing. Once i create them, i put all together in one folder and make the folder available in the PATH. That's all. The problem i was facing with this approach, Whenever i change my machine, it was hard for me to transfer them in to my new machine and make them work as the path changes.

So i decided to give a try to launchers. I tried several application launchers and i settled with Launchy, pretty decent tool then. Though i like it's simple UI, It doesn't completey solve my needs. When i looked at Executor, i was impressed and currently playing with it. At first glance, it's UI looks simple and skinnable(I'm not a fan of fancy skins, but it allows me to choose my colors), its feature list also impressive. Mostly I'll end up with Executor.

Another application launcher is ENSO is worth to give a try. it may be strong by features, for me it is not user friendly.

Until next time,
Arunachalam