Tuesday, April 29, 2008

Impressed with Jawbone headset and its customer service support

A week or two ago, I purchased the Jawbone bluetooth headset which has got a lot of reviews as the best bluetooth headset in the market. I should say I am pretty impressed. The noise canceling feature is just awesome, people on the other side rarely hear any other noises other than my voice. After trying the multiple ear pieces and loops and fixed on a set. I haven't used a bluetooth headset before so I can't really compare. My long calls started turning effortless and I was pretty happy with the piece. Worth every penny, oh yeah..

And then the inevitable according to Murphy's law had happened. I broke the left standard ear loop. I was trying to remove it when it broke. I called up the Jawbone support guy. They wouldn't give their number on the website but a quick Google search revealed their support phone number 408-848-4348. The customer service guy was cool and he told me that he will send me a complimentary one in 7 business days. Now, how cool is that. I didn't know you could also buy the ear loops from their website, you pay $10 for the ear loops but then you will need to order the 4 piece set. I should say that I am pretty impressed both with the piece and the customer service. All the negative reviews on the web, I guess those guys were probably having a bad day :)

Monday, April 28, 2008

Too smart or too novice in Java: Relevance of for loops

During the course of my work, I have had to fix some code written by others and modify existing code for enhanced functionality. In one of such projects, I encountered this piece of code written by someone


for(boolean valid = false; !valid; valid = true)
{
try
{
sp = spf.newSAXParser();
parser = new ProjectParser();
sp.parse(projectFile, parser);
}
catch(Exception e)
{
e.printStackTrace();
log.throwable(e);
throw new RuntimeException((new StringBuilder("Unable to parse ")).append(projectFile.getAbsoluteFile()).toString());
}
}


Let's see how this for loop works. It initializes a boolean called valid with a value false. The condition is until valid is false. The increment is making valid true. And then inside the loop, the coder wants to accomplish something. Now what is the point of this for loop at all. Was the for loop used because the coder didn't know that loops are used for, you guessed right, looping. If he/she just wanted it to run only once, then what is the point of using a for loop at all. How different is the below code from the above code.


try
{
sp = spf.newSAXParser();
parser = new ProjectParser();
sp.parse(projectFile, parser);
}
catch(Exception e)
{
e.printStackTrace();
log.throwable(e);
throw new RuntimeException((new StringBuilder("Unable to parse ")).append(projectFile.getAbsoluteFile()).toString());
}


This would execute the code only once and that is the desired behavior that was accomplished by using the for loop for once. I think keeping your code clean and staying away from such unnecessary stuff helps you in keeping your code clean and reducing any unwanted bugs. Why turn the hand around the neck to eat something when you could directly eat it.. Is this trying to be too smart or being too much of a novice to know what loops are used for. Or is there something, that I am missing that is something great that I haven't realized in using this type of code. If someone could elaborate, I would be glad...