Wednesday, October 21, 2009

The October 22nd

This October 22nd, there are couple of big product launches,

Windows 7 : The much waited OS from Microsoft is all set to launch. Steve Ballmer will unveil the new Windows 7 in NewYork. Though it had been released to manufacturing on July, now this release is for general retail availability. Lets wait and see how the public reacts after the so called failure product in market Vista.

Nokia 3G booklet : Nokia's booklet available with AT&T for $299 (2 year data plan and i hope $60/month) $599 for unsubsidized version. Will Nokia success in this crowded area?



Acer 3D gimmick : This has been promoted as world's first 3D laptop. It demands to wear glasses to see the 3D image. This may price around $1500. I feel this is the cheap way to fake 3D. This technology is being around for decades. However a step towards the 3D vision on computer screens.



Powered by ScribeFire.

Wednesday, September 23, 2009

One reason to put braces in IF statement

Recently it happened to read adam-bien blog. I found the interesting explanation for why curly braces blocks are required for IF statements in Java.

Without curly brackets, you could accidentally write a semicolon after the IF-statements. The semicolon is a valid, empty statement, which will be "execute" instead of the actual (intended) one.

So either write the IF-statements with curly brackets blocks ...or carefully search for semicolons after the IF-statement.


Powered by ScribeFire.

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

Monday, May 25, 2009

Adobe Flex

I'd like to refresh my UI knowledge after a long gap of 2+ years. By the time i left eclipse based plug-in development, i tuned myself in core application program. I did few XML server side stuff and managed a team in Java Swings and finally built an adapter for webMethods Integration server. I was into little bit of XQJ1.0 spec implementation. little bored? yes. now i get some time. Somehow i turned my attention from core application to UI.

By the time, i looked UI, it tremendously grown and more stylish too. JSP, Struts, velocity, looks like vintage classic tools to develop UI. Now i could see this is the age of Rich Internet application (RIA). As i want to part of this modern phase, i started learning Adobe flex.

I'll write my experience with Flex soon.

Saturday, May 16, 2009

Stax parser's hard to solve problem

I ran into some sort of serious issues with stax parser(woodstox implementation) in the recent time. You might have also encounter the problem with woodstox.

WstxEOFException: unexpected EOF prolog row[0,1]...

According to the document, this would happen when the TCP connection is broken when the stream is being read. because of this, the XML read was not successful. But this was not in my case. My connection to http server never end. then what's the problem? what went wrong?

It took more than five hours to resolve. When the stream is received from the http connection, one of my API reads the header information of the stream and then pass the stream for further parsing, when it uses the same stream (half read by other opeartion) for parsing the rest of the response, it failed. when i reset the stream, it went very well.

So please be sure that your input stream is reset before you parse every time.

Thursday, May 07, 2009

Big mess around XQJ1.0

One of the oldest JSR which has started in 2003 and not yet reached the final stage. I still doubt whether there is an active group working towards it's 1.0 spec release. Many of the comments from the approval forum says the interface level were not sufficient. There are quite a few XML databases in the market. Except XQuery there are no similar interaction layer. Data Direct is one such company trying to standardize this but in a wrong direction. As a key member in JSR-225, Data Direct might take a strong step towards its release.

Even after 6 long years, the specification fails to come to the center stage, there are chances that people might forgot XQJ. Whoever dealing with XML databases now with their own proprietary API will stick with them. Rewriting them would cost and might affect the stability. Quick releases in specification would increase the chances of stability and feature packed by early feed backs from industry.

I could find one open source implementation on proposed 1.0 spec is saxon.

Though there are chances for improvement, I'm waiting to see the XQJ spec in the limelight soon.