Atom Feed SITE FEED   ADD TO GOOGLE READER

Champagne Floats

Suppose you've got a string that contains a floating point number: "3.5" or "2.5E-3". Your goal is to get a float from that number. There are a few different techniques to try...

If you're familiar with parseDouble(), you could use that and then cast:
    String s = ...;
float a = (float) Double.parseDouble(s);

Or you could save some bits and parse directly using parseFloat():
    String s = ...;
float b = Float.parseFloat(s);


Do the two mechanisms yield the same result?


Ponder the problem, and when you're ready you can read my analysis in the comments...

IntelliJ goes open source!

I absolutely love IntelliJ IDEA; it's my favourite application. This tool makes programming in Java fun. It's my gateway to the zone, that magical hypnotic place where I disappear into the code for hours at a time. I write better code because I use IntelliJ, and I enjoy my job more.

So I am thrilled that the fine folks at JetBrains are open sourcing the core of their flagship product. The Community Edition includes the key features that make using it fun. Hooray!

Cedric doubts that going open source is a good idea:
"JetBrains deserves the utmost respect for what they have created and pioneered, but IDEA going opensource means that it will now slowly die. [...] Commercial software that goes open source never ends well, even for products that don't suck.
I disagree. I predict that going open source will increase the product's revenue. Consider the universe of all Java programmers. JetBrains' potential customer base is limited to those developers that are both:
  1. Fans of IntelliJ. Knowing an IDE deeply is similar to knowing a programming language deeply.
  2. People willing to pay for good tools. These are the serious developers who recognize that their productivity and enjoyment is heavily impacted by their choice of IDE.
This is a small intersection, particularly since many developers start with an open source IDE and never try anything else:

Now let's assume that by going open source, more developers will try IntelliJ to see what the fuss is about. They'll fall in love with it eventually. Those willing to pay will upgrade for some productivity-boosting premium features.

As the IntelliJ userbase grows, the premium edition ownership will follow.

This free/premium model is also used by Flickr and Flickr Pro: give away community editions (which cost nothing) to sell premium editions. Chris Anderson's latest book, Free covers this subject in detail. It's an entertaining read, and you can get a community edition of the book for no charge.