Friday, February 16, 2007

My first Groovy program

When I heard the JavaPosse interview about Groovy I became really interested in it. The fact that it offers a scripting language based on the JVM and that it can be seamlessly integrated with Java fascinated me.

So I decided to buy the Groovy in Action book and try it out.

This is my first attempt at something that might become useful later:

def foundtypes = [:]
def sum = 0              
def stats = ""

bugs = new XmlSlurper().parse(new File("/home/ds/findbugs.xml"));

bugs.BugInstance.findAll { instance -> 
}.each { instance ->
 type = instance.@type.toString()
 foundtypes[type] = foundtypes.get(type,0) + 1
foundtypes.each { sum += it.value }

println "Found ${foundtypes.size()} types of errors and $sum total:"
foundtypes.each() { type ->
 stats += type.key.padLeft(42) + " : "
 stats += type.value + "\n"
println stats

What this does is slurp in (hence the class name...) an XML file. In this case it is a FindBugs analysis result. It then looks for all the BugInstance elements with a category attribute matching the regular expression CORRECTNESS|BAD_PRACTICE|MT_CORRECTNESS. For all matching elements it builds a map of the specific error type and a count for each. Finally it sums up all occurrences of all found bugs and prints them out somewhat nicely formatted:

Found 4 types of errors and 8 total:
                  SWL_SLEEP_WITH_LOCK_HELD : 3
                    UG_SYNC_SET_UNSYNC_GET : 1
                            DC_DOUBLECHECK : 1
                     IS2_INCONSISTENT_SYNC : 3

Next thing I am going to try is put those into a simple database, just to get some practice with it.

Wednesday, February 14, 2007

Google company name change?

Did Google just change their company name? If so, I did not read anything about it beforehand. But maybe they want to make the process easy and introduce only subtle changes.... Notice anything in the screenshot?

Hint: Count the letters ;-))

Monday, February 12, 2007

Fax via Fritz!Box

For some weeks I have been using the AVM Fritz!Box 7170 as my DSL modem/router. I do not know how commonplace AVM products are outside Europe, so suffice it to say they are just great! In the past I have used their ISDN cards, now I switched to the DSL box. The reason mostly was that my previous DrayTek Vigor 2500We could only do WEP but not WPA or WPA2 wireless encryption. Apart from that I did not really miss anything.

However when I got a letter last week that asked me to fax back an answer I noticed that I could not do any faxing from my computer. Granted, until then I had not even thought about faxes for almost a year (when I got the previous letter of that kind :)), and back then I had just used the office fax machine. But this time I remembered the Fritz! software suite that came with the ISDN cards.

As the Fritz!Box 7170 can act as a DSL modem/router, a WLAN access point and a VoIP/ISDN/analogue telephone system I it would be very unlike AVM not to include some way of using the ISDN part from a computer. And I was right: has a version of the Fritz!Fax application that allows you to fax from any machine that can reach the box via Ethernet or wireless or is hooked up to the USB port. If you allow the installer to do so, it will configure the box correctly and install the Fritz!Fax virtual printer. Just make sure your Fritz!Box's firmware is recent enough to support it (read the notes included).

AVM does not offer official support for it, but it just plain works. Unfortunately as far as I know there is no way to get it running on WINE, but as I am not going to use too frequently, this is something my VMware'd Windows will come in handy for :)

Friday, February 09, 2007

MySQL "Culture Shock"

I just thought I might link to an article on RegDeveloper called MySQL is the company's SQL now...

Go read it yourself, it is rather short, but interesting nevertheless. I especially like the sentence at the bottom: It remains to be seen whether the company fully understands, and can cope with, the culture shock it is about to suffer; as callers change from 'friends' to 'customers'.

This is what I have been thinking about too, when they started releasing enterprise builds more often than community builds (binary builds that is). In the past MySQL always suggested to use the binaries provided by them to rule out any effects that may be introduced by a 3rd party build process or patches. That made much sense to me.

However now they tell you that you can check the source out and compile it yourself. I do not know what happens when I report a bug against such a home-made build. And I cannot really imagine that it would be any more effort to release binary builds for the community edition, too.

Do not get me wrong: As a software developer I totally agree that there is nothing bad in earning good money for professional work. I also completely understand that MySQL wants to grow and get more paying customers (in fact my company is one of those). But I am also curious how well they will handle that new situation without disappointing all the community fans and users that probably led MySQL to where they are now.

From what I have read the community edition will include community provided patches and additions that will not be part of the enterprise releases. While this appears to be a good idea, because more people are invited to contribute their ideas to improve the product, it makes me frown, too. I am not sure what consequences this splitting of the source tree might have. E. g. I could image a little company starting development with the community edition - perfectly ok, because the product they are building starts as an internal tool. During development they might use some nifty community-provided additions that they find most useful for their purposes.

However should they decide to start selling their product and provide the MySQL server with it, they will need a commercial license. However those builds will not include the additions they require, leaving them in an impossible position.

Please take this as what it is: Pure speculation. Probably there will be ways to manage such situations. However I fear MySQLs "beloved simplicity" is going to slowly fade away as their focus on larger businesses grows bigger.

Thursday, February 08, 2007

MS Word - Headers Lost?

Several times I have fooled myself into some "restore Microsoft Word's template" session, because apparently something had mixed it up that led to the page header not being shown.

Have you ever seen something like this? (Note the very small amount of space between the tool bar and the document)

Just by switching to edit headers and footers like this... (I did not insert the WordArt there right now, it has been in the document before!)

... and switching back to normal text edit again you get this:

Now the header with the WordArt is visible, even though (trust me) I did not just add it to the header, but merely switched to edit it once and switched back again, without doing anything else.

I have seen this behavior several times over the past few years, always wondering what the heck was the solution, so now I am gonna post it here for others and me to find... :)

See the mouse pointer in the space between the tool bar and the beginning of the page? This is what it's all about: Hiding the headers to save some screen space. Just click when the cursor is shown as the two arrows and you are back to normal. I do not know where this is stored, but it is not the document template, because I tried copying a from a different computer with no effect.

Hopefully I will remember this post when I run into it next time ;)