We are using Groovy on Grails for an incubator project, which is incredibly refreshing! Groovy as a dynamic language with optional type annotations doesn’t quite rock my boat though. With static type checking the types you define are an essential element of design. I like to point out that Groovy’s creator wrote:
“I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I’d probably have never created Groovy.” >> more…
http://www.findjar.com
Yep, that’s it. A jar search engine. “Simply enter the name of the class or the JAR file you are looking for and start your search.”
Recently there was an opportunity to remember the right way to handle closure of streams.
-
-
-
try {
-
// do something with inputStream which could throw an Exception
-
}
-
finally {
-
inputStream.close();
-
}
-
}
If we wouldn’t want the method to throw exceptions we needed to nest another try/catch block inside the finally, as also the InputStrem.close method can throw an IOException. But this should only happen in really bad cases, when closing definitely fails, so it might be a very bad idea to simply swallow it. Moreover it complicates the code especially when handling more then one stream. >> more…
For a new feature recently added to conjectPM we needed to extract information like original sender, send date and subject from the “header” that is generated by mail clients for forwarded emails as shown below.
From: Susan Sunshine
Sent: Friday, November 04, 2009 6:13 PM
To: Daisy Daffodil
Subject: Flowers
And because conjectPM supports 18 languages, we needed to make this work with all of them. Therefore Maria compiled a list of all keywords found in Gmail, Outlook and Apple Mail. The basic idea is simple: write a regex that (for each language) matches the part before the colon, e.g. ^(Sent|Date): (.*)$ and take the captured value in the brackets to analyze it further. But as we are dealing with the real world here which has lots of exceptions, the task turned out to be trickier than we thought, especially for dates. Good that conject employs people from many different countries, so we had native speakers for almost all languages at hand. (Is there anyone from Japan looking for a job..?) >> more…
I don’t even know since when it’s possible, but ever since I started working here, all I ever heard was ranting that java files can’t be saved in utf-8. However, all is fine if you tell your compiler:
-encoding utf-8
Now we have no more annoying \u0420\u0443\u0441\u0441\u043a\u0438\u0439 in our code, but a pretty Русский. Nice!
I’m currently looking into another one of your bowling games, this time written in F#. Again a language I’ve never heard of, but it seems to be pretty nice. Very similar to SML (yes, I also know some languages nobody else knows!), which I learned at university. I really like functional languages, especially when it comes to list operations, with all the folding, mapping and filtering. And I really miss them in Java!
Instead of a plain
-
result = List.map function inputList
you need that clumsy and not at all explicit
-
List<OtherType> result = new ArrayList<OtherType>;
-
for (Type each : inputList) {
-
result.add(function(each));
-
}
>> more…
As the Issue Manager – a liaison position between our tech support and development – you always discover interesting constellations under which Java applets that our web application uses simply won’t run. A bunch of customers with Internet Explorer 7 or 8 could not launch any of our applets, although other applets worked perfectly fine for them.
Internet research yielded no similar experiences this far, so hopefully this one will help if you are facing the same issues… the message is: keep your system clean!
These were the tests I ran: