Operational Dynamics
Technology, Strategy, and IT Operations Consulting   |   Open Source Research and Development   |   Blogs

hackergotchi
Operations and other mysteries

A blog by Andrew Cowie

RSS 2.0

Tuesday, 12 May 2009

Roman Numerals

Some things about Unicode are really impressive. And some things just make you wonder.

Why are there unicode characters for roman numerals? ie, Why is U+2167 'Ⅷ' better than VIII? And, whoa, thank God that there’s U+216F 'Ⅿ' there, because otherwise I’d have to use the letter 'M' to write ©MMIX.

As we were chatting about this in #gnome-hackers, Xan Lopez found a wikipedia entry about it which seems to say “Only for compatibility” & “do not use”. I can handle that.

AfC

Sunday, 03 May 2009

java-gnome 4.0.11 released!

This blog post is an extract of the release note from the NEWS file which you can read online … or in the sources, of course!


java-gnome 4.0.11 (1 May 2009)

This is a bug fix release.

We made a few mistakes in our handling of the PangoAttribute structures’ memory which resulted in VM crashes [unfortunately, the normal GNOME way of debugging things is to SIGSEGV. That’s fine for a C program but Bad™ for your average Java Virtual Machine as it takes out the entire process. We therefore work rather hard to avoid — or at least trap — this sort of thing]. Releasing corrections for these bugs was a priority.

Concurrently a significant internal improvement in our handling of accumulating Attributes into AttributeLists was made. While this is not user visible per se, we were able to drop the requirement that the text you were formatting already be in the Pango Layout before assigning the range that the Attribute would cover. You also no longer need to pass that Layout to setIndices() when building up Attributes. This makes things a great deal easier if you are simultaneously aggregating the text and assigning markup.

Martin Garton contributed some documentation quality improvements and new coverage. Serkan Kaba made some minor fixes to ensure the unit tests run in a Turkish locale. And as ever there are small incremental improvements to various classes, including a number of additional properties exposed care of the work of new contributor Thijs Leibbrand.

Looking ahead

This was a brief cycle; as noted we’re mostly pushing some bug fixes. Meanwhile there are a number of significant branches underway by various hackers; which, hopefully, will feature prominently in the next release.


You can download java-gnome from ftp.gnome.org or easily checkout a branch frommainlineusing Bazaar:

$ bzr checkout bzr://research.operationaldynamics.com/bzr/java-gnome/mainline java-gnome

though if you’re going to do that you’d best follow the HACKING guidelines.

AfC

Changed blog engines

We switched from our long standing [the original Perl] blosxom installation and are now using pyblosxom instead [same idea, just in Python, a bit more up to date, and a nicer plugin architecture]. Appropriate redirects are in place, so hopefully no one will notice. My blog’s RSS 2.0 feed URL is now http://blogs.operationaldynamics.com/andrew/index.xml

AfC

Tuesday, 28 Apr 2009

Risk analysis

I’ve got a client who needs to get a critical production system upgraded. Frankly, the risks involved — and indeed the plans one prepares — don’t really change from site to site; but each event is still unique and takes careful investigation to make sure you’ve figured out all the interactions you need to look after.

Anyway, one of the pieces of this system is MQ (which, in case you’ve not heard of it, is a very widely adopted — if somewhat cumbersome and archaic [not to mention proprietary and commercial] — enterprise message queue platform; no, you’re not missing much, and yes, there are open source alternatives). So the other day I was quietly investigating the sequence involved in doing an upgrade of an existing MQ installation. Along the way I came across a forum posting by someone asking a similar question to what I had in mind:

Q: Is is possible to move directly from MQ V5.3 to V7.0???

ie, skipping MQ 6.0. A reasonable thing to ask (even if they did overdo the question marks); these things are not always obvious and sometimes you have to go through an intermediate step. An experienced individual quickly replied:

A: Yes.

Which was terrific. An enlightening answer; to the point, authoritative, direct, and concise. Very helpful. Well done, and much appreciated.

I was certainly well satisfied at that point, pleased to be able to benefit from the shared wisdom of the global village. Our erstwhile original poster, however, under the mistaken assumption that the internet is a place where you can go to get people to do your job for you for free, continued on with a degree of persistent sticktoitiveness that one can only admire:

Q: What kind of challenges do we need to face during this process??

The answer wasn’t long coming:

A: Overcoming any fear of reading the documentation.

:)

AfC

Tuesday, 14 Apr 2009

No typing day

An old friend popped into an IRC channel and said:

“Sorry I’ve been out of touch; I’ve been away travelling on business.”

Interesting contrast. When I’m on business travel I tend to be more in contact.

Or, perhaps it’s just that I’m just more conscious of it, since one has to go to extra trouble to get email in airports, retrieve messages from hotel rooms, and find ways to make affordable phone calls (instead of succumbing to the temptation to just using your mobile at the cost of having to sacrifice a major organ to pay the roaming fees), etc.

I’ve noticed that it actually takes me going off trekking to get away from the curse of modern communications. Being up in the mountains is about as uplifting an experience as you get, but I’m sad to say that at least part of it must be the freedom from not having to check your email.

Pine trees on Grotto Mountains, Banff
Half way up Grotto Mountain near Banff, Alberta, Canada.

Even harder — but essential — is that once in a while you need to have a no typing day. It’s should be easy to just decide not to do any typing tomorrow, but it’s astoundingly difficult to actually schedule such a day — especially when you’re an Open Source hacker and all you want to do with your spare time is work on the things you love.

But just as serious athletes need to take rest days to prevent over-use injuries, so does anyone who spends huge numbers of hours in front of a computer need to take a day off once in a while. We all need to give the tendons and fine motor muscles in our fingers, wrists, and forearms a rest. I’m not talking about “typing breaks” periodically though the day (I mean, jeesh, just get up and go for a glass of water), but an entire day with no keyboard, no mouse, and no being hunched over starting at the screen.

If you can, take a no typing day once every two weeks. It may not seem like much, but makes a wonderful difference to well-being. And since you’re not sitting at your computer, you might as well head up into the mountains instead. :)

That I had to type this is an irony that does not escape me.

AfC

Saturday, 07 Mar 2009

3 mobile broadband on Linux

I had to get a mobile broadband gizmo this week. It’s something I’ve been avoiding (not having internet access while sitting at a cafe by the beach is a feature, not a bug), but I need it for a current client. After advice from one of my colleagues that “3” (one of the carriers here and the first that did 3G digital phones in Australia) was reliable and, more importantly, that their device worked with Linux, I went and picked one up along with a prepay SIM.

3’s offering has two devices at the same price right now; the Huawei E160G and the ZTE MF627. I thought my friend had the latter and so bought that one. Big mistake.

E160G
Bit older
works great
MF627
Brand new
doesn’t work

Do not get the ZTE MF627 device if running Linux. Stay away from it. Even after trying the usb_modeswitch hassles, it still does not present as the device as a GSM modem like it is supposed to. Tried it on two separate laptops; one running Gentoo, the other with Ubuntu’s “J” version on it. Spent the better part of a day researching and debugging the issue, but no joy on either. One person in London claims to have a similar device working, but comparing their lsusb and dmesg output, I’m not convinced the electronics in the one available here were the same; after doing a mode switch the miniSD adapter presents, but not the modem. Anyway, sure, maybe someday someone will figure out how to make it work here, but that’s not right now.

Even worse, people writing in places like Whirlpool cite chronic quality problems with ZTE devices. Clearly this is something to avoid.

I took the thing back to the store the next day and finally managed to get a refund which I promptly used to buy their other device (why they couldn’t just do an exchange was as puzzling to the poor guy in the store as it was to me. Whatever; they kept him on the phone for almost an hour while the corporate drones he had to call for permission made up their minds that it was ok to give me my money back).

So home I went with a Huawei E160G (which is what Peter had) and it worked perfectly, right out of the box, literally. Plugged it in, device properly recognized by USB subsystem and, after adding a “mobile broadband” connection with NetworkManager 0.7, it immediately started working. Pretty amazing.

You need to have the PPP stack built into your kernel and pppd installed (once upon a time we all had that, but most of us haven’t needed to do point-to-point over a dialup modem for years, so if you’re running a modern system with a custom Linux kernel you might not have it). The relevant kernel modules are “ppp_async“, “usbserial“, and “option“.

So a big hooray to the NetworkManager team and all the people working on the drivers that made this magic work. That NetworkManager seamlessly handles all the PPP configuration and dialing is brilliant.

mobile broadband connection in NetworkManager
Neat connection active icon.

And as for the lovely staff in the store, don’t let them tell you that their service doesn’t work on Linux — but do get a device that does.

AfC

java-gnome 4.0.10 released!

This blog post is an extract of the release note from the NEWS file which you can read online … or in the sources, of course!


java-gnome 4.0.10 (5 Mar 2009)

Sculptures made of letters

This release is a landmark, because it features coverage of the Pango text rendering library and so, along with our coverage of Cairo, brings us to a complete solution for drawing graphics with text — be they custom Widgets, PDF documents, or beautiful vector illustrations.

In addition to merging Pango work from numerous contributors, we have made massive improvements to our Cairo coverage, support for writing PDFs, and better access to the system Clipboard.

Drawing API improvements

We’ve done a huge amount of refinement to our APIs for the ever fabulous Cairo Graphics drawing library, including full coverage of matrix translations, rotations, and scaling and more integrated ways of setting the source pattern to be used in stroke, paint, and fill operations. Thanks to Kenneth Prugh for having seen this through and having done the lion’s share of the testing.

We’ve also had a number of improvements in the lower levels of GTK relating to image rendering. The gdk-pixbuf library contains a capable image parser and we can now feed it directly from a Pixbuf constructor. Thanks to new contributor Martin Garton for his hard work getting that tested and accepted.

Drawing graphics often also requires drawing text. This release features coverage of Pango, GNOME’s powerful text rendering library. Pango is not just about drawing mere glyphs; it also includes a sophisticated paragraph layout engine which gives us a capable solution for drawing text onto Cairo Surfaces.

Thanks are due to Serkan Kaba and Kenneth Prugh have both been really helpful testing; it was Vreixo Formoso who did the original leg work in April that identified Layout as the key class that we needed to concentrate on and cleaned up much of the underlying infrastructure.

As we were working on this we had occasion to continue the polish in and around the TextView / TextBuffer APIs, including a number of convenience methods for inserting text while simultaneously applying multiple TextTags, and supporting changing default fonts.

We’ve also modelled “notify signals” for when a property changes; see the TextBuffer.NotifyCursorPosition signal for this in action.

Finally, thanks to contributions from Zak Fenton and Kamil Szymala we have support for applications running in composited window managers to have transparent backgrounds — which is an exceptionally cool effect, even if it doesn’t have much to do with creating HIG compliant usable applications :).

Handling cut & paste

The GTK clipboard APIs are fairly complex, in no small part because the underlying implementations in X are really rather complex. Our coverage here in java-gnome is still fairly basic relative to that, but it’s been enough for people working on applications like text editors to write text to the system clipboard, get notification when the clipboard changes, and read text back out again.

Printed document support

The work on Pango noted above represented the essential machinery necessary to make effective use of Cairo’s PDF backend, and this has started us down the road of covering the GNOME printing APIs. You can now generate .pdf documents with java-gnome, and we’ve included an fun example showing this in action.

Thanks to Nathan Strum for permission to use one of his sketches in the example (you might find reading the blog where we found this interesting — it’s a fascinating exposé of a graphic artist in action).

Continuing improvement

Thanks to new contributor Stefan Schweizer we now have better coverage of signals relating to Notebook style Containers, and to new contributors Miloud Bel and Bruno Dusausoy for numerous small improvements in and around ProgressBar.

Miscellaneous documentation improvements and minor feature improvements always feature in our releases, with minor changes having accrued in many classes.

Just as important as new coverage is getting rid of cruft that we don’t need. Libraries like GTK and GDK are, like any other mature project, full of deprecated, obsolete, and unnecessary code — not to mention things that we just plain don’t need in a Java binding of these underlying native libraries. We’re already pretty good about not generating translation Java or JNI C code for such things; this release continues our refinements in this area with a considerable refinement of the .jar and .so which is ultimately what we ship.

Finally, it’s worth noting that java-gnome’s test suite is now 40 unit test classes with 186 individual test fixtures. Combined with over 30 screenshot generating programs and 17 example programs, we actually have surprisingly good test coverage of our library. It’s high time they — and more to the point the people who work hard to create such tests — got as much credit as the visible public APIs do.

Anyone can run the tests (and anyone wanting to submit a patch had better run the tests!); they’ve been accumulating since java-gnome 4.0.0; it’s just:

$ make test

and

$ make doc

If you’re working in Eclipse launch class UnitTests as a JUnit test suite.

Build improvements

We have some fixes from new contributor Przemysław Grzegorczyk ensuring we include the correct headers in a few corner cases. This came to us via work on a GNOME Love bug, which is a first for us. Thanks!

Meanwhile, the ever industrious Serkan Kaba has added some changes to ensure that our magically locating the native shared library component of java-gnome works properly even under strange and unusual conditions.

Configuration and prerequisite detection on Open Solaris is improved thanks to reports from new contributor Kamil Szymala.

Instructions for how to optimally lay out your branches when working with java-gnome have been moved to the HACKING file. People intending to hack on the bindings from Eclipse are really urged to set things up this way as it will make their lives much easier. Also, using the latest release of Bazaar (ie bzr >= 1.12) is definitely recommended — it’s getting really fast. We’ve upgraded our public branches, so you will need 1.9 at a minimum.

Note to those creating packages for distributions: java-gnome now depends on the current stable GTK (ie gtk+ >= 2.14).

Looking ahead

Coverage of Poppler, GNOME’s PDF rendering library is well along, but didn’t quite make it in time for this release. It could very likely feature in the next version of java-gnome, as might coverage of GConf, GNOME’s simple store for application configuration options. People are also known to be working on coverage of GtkSourceView, libwnck, and librsvg. We’ll see what gets contributed!

The most exciting part about java-gnome at the moment, though, is the number of people working hard on applications using it. It takes a long time to write a mature, well rounded, robust end-user program, but there are some pretty cool projects ticking away out there, and it has been terrific to see the authors of these projects joining our community.

Happy developing,


You can download java-gnome from ftp.gnome.org or easily checkout a branch frommainlineusing Bazaar:

$ bzr checkout bzr://research.operationaldynamics.com/bzr/java-gnome/mainline java-gnome

though if you’re going to do that you’d best follow the HACKING guidelines.

AfC

Tuesday, 03 Feb 2009

Miraculous

While at linux.conf.au a few weeks ago, my laptop decided to blow. It had been twitchy with suspend and resume for about a day, and then Tuesday, not 48 hours until I was scheduled to give the GTK & GNOME tutorial, the thing quite petulantly decided to stop booting. No POST. Nothing. Zap.

Eeek!

Now, laptops breaking are nothing special, and I do keep fairly regular backups. So I wasn’t that concerned about data loss. But in so far as the live-action style tutorials I give are less about formal presentation slides (though I do have lots of those as backdrop) and instead more “everyone gather around and watch Andrew play in his happy place”, suddenly losing my development meant that actually coding live in front of people was looking to be a bit of a problem.

My current laptop is from ASUS, and I’ve been very happy with it. That it fried, ok, fine whatever. But as we were now in Hobart, Tasmania I had a real problem. I needed a mainboard replacement. Fast. ASUS has service centres in Perth, Brisbane, Sydney, and Melbourne. But not Hobart.

Several people offered to lend me a laptop “for the presentation” which was lovely of them, but given that it wasn’t just me playing a slide deck but rather me needing my full development stack on board such a machine — and more to the point, me needing my system so I could get back to real work during and after the conference — my option space was very limited. Indeed, it took me all of about 3 seconds to realize that I was going to be on a flight (to Melbourne, probably) in about 90 minutes. Sure I could have couriered it and had it back in a “few days” but I patently did not have that kind of time.

Steve to the rescue

I was in the process of booking my flight out when Steve Walsh suggested that he might have a system I could use. At first it was borrowing one of the desktop machines they had around (yup, would have worked), but then he realized he might be able to lend me “the conference laptop”, which was a computer that Hewlett-Packard had donated to linux.conf.au a year or so ago. Josh wasn’t using it anymore, and Ben agreed I could use it. You guys are awesome.

As I was thinking about what I’d have to do to bootstrap and restore off of my closest available backup (on an SD card, but that’s a story for another day), I saw one of these lying on the table

usb hard drive enclosure

and we suddenly had a very bright idea. Why not pop the hard drive out of my laptop and put it in that thing?

I had already considered putting my hard drive into the new laptop, but only for a brief moment. Even assuming it fit, I happen to have a very tightly tuned kernel and I knew was unlikely to have enough drivers to get booted on foreign hardware. Besides, the Linux installation on the new laptop was already running great.

But why not try putting my drive into Steve’s external USB enclosure? Would that even be possible?

Steve cracked his enclosure open and carefully extracted his drive. Then we started removing endless screws from my system and found our way down to the harddisk compartment and pulled my drive out:

laptop with drive extracted

To be honest, I would never have attempted such a thing, but Steve knew what he was doing (and more importantly, had all his tools handy). So, having taken the cradle off of my drive, we even more delecately then attached the enclosure’s logic board to my drive.

(I gather that these things are “standardized” but still. The hardware you find in your average laptop is always wacky and weird. So I was pretty excited) With that done, we plugged it into the new system:

my drive in enclosure attached to foreign laptop

and to my supreme happiness,

Hooray for the Linux kernel, HAL, the GNOME automounter, Nautilus, and everything else that made that work.

And then, even better,

Hooray! My data was all ok!

A little fiddling about to make sure there was now a user andrew with a matching UID on the Ubuntu system, and then, very simply:

$ rsync -av... /media/disk /home/andrew

Outstanding.

So thanks to the help of Steve and the others, I had my /home on this new system. And one of the magic things about the GNOME Desktop for the last few years has been them safely writing down everything you need to run, so pretty much instantly I had my happy place back.

The data, at least.

Comparing distros; comparing laptops

The one problem I still faced was that the system in hand was not configured as a development machine. I had to work out what the appropriate packages were for all the different bits and pieces I was accustomed to having.

One thing I really like about Gentoo is that they clued in long ago that disk space is cheap and that things like .h files don’t take up that much room. So when you install a package on Gentoo you get development tools, header files, debug symbols [if so configured], compilers, documentation, the works. I had forgotten that Debian and Debian derived systems like Ubuntu do not install all the development libraries and tools. So I proceeded to tear my hair out for over a day wading through endless package lists trying to find what I would need to get development headers and the various tools necessary to build software (the morning of the tutorial I discovered the laptop didn’t have any man pages. What the hell?)

Granted, such things are essentially trivialities, and I accept that they were the sort of thing that one runs into when working on a new system. No big deal. Sure I could easily have built a Gentoo system in less time, but it’s not my machine and in any case I was enjoying the learning experience.

Far more interesting was living on a new distro for a few weeks. It was nice to experience all this “polish” that I’ve heard people going on about, and I was indeed duly impressed. After a while, though, I started to notice all kinds of little changes that Canonical has made to the Desktop that are really cool, but which have not been contributed back upstream to GNOME. That bothers me a little bit, but I’m hopeful that in time this sort of practise will fade in favour of them working more closely with the upstream projects they are using.

Meanwhile I also got to trial a new laptop brand. I gotta say I was really impressed with the build quality, robustness, and power efficiency of the HP corporate laptop line. This one is a couple model-years old, but I was able to have a few good chats with Bdale Garbee about it and he walked me through their current line up. After this experience I can definitely say that we will be getting HP laptops in the future.

Drove me nuts having a different keyboard layout to deal with for a few weeks. And having just about spent enough time on it to get it in my fingers, now my laptop is repaired and I’m once again mistyping everything… :)

Again, thanks to Steve who totally saved the day. And thanks to everyone anywhere who ever contributed to all the wonderful software that made the transfer from one system to another miraculous — and easy.

What about next time?

So what I have I learned?

I travel a huge amount, and having my laptop blow up is clearly something I need to be more prepared for. Remote backups are still necessary, of course, and the SD card I carry around with more or less continues snapshots of my critical files is also clearly going to continue.

But it’s kinda obvious to me now that it would be a good idea to carry around an external USB enclosure with a hard drive big enough to back up my entire system — nice encrypted partition and all set, just rsync the whole damn thing. Disk space is cheap. Along with a boot partition holding a nice generic runs-everywhere kernel, that would be enough to not only recover from, but also boot from live the next time my computer fries.

AfC

Monday, 22 Dec 2008

Positive Y

The excellent Cairo graphics library has a simple function to draw arcs; in C it’s cairo_arc(); from java-gnome it’s Context’s arc() method, etc.

Quite unsurprisingly they define increasing angles as going from the positive x axis on toward the positive y axis. Nothing unusual about that. The only thing that was surprising is that they even mention this in their documentation.

I should know better.

What I totally missed was the implication of this. I didn’t quite clue in that the positive y direction in screen positioning and page drawing is down, and so increasing angles go clockwise. Using cr.arc() to go from 0 to say π/3 radians does not give a rise of 60° like I expected; it gives this:

cairo arc positive

Whoa. This is not the counter-clockwise increasing θ like we’re all used to seeing in normal Cartesian or Polar co-ordinates. But it is indeed increasing toward the positive y axis. Oops. Oh well :)

So I made this illustration and added it to the documentation for Context’s arc() method. Really it’s mostly about pointing out which direction positive y is, but when I’ve learned something like this the hard way, I do my best to try and incorporate that knowledge into our public API. With any luck others can be spared my folly.

Drawn with Cairo, of course!

AfC

Update: Some people have pointed out that you can use a transformation matrix, and if you happen to (say) mirror across the horizontal axis then the clockwise notion would no longer apply. Fair enough; but if you have forgotten that +y starts out going down, then you’re not going to think to do such a flip in the first place.

Saturday, 20 Dec 2008

You never know

I was pleased to find a decent l’Entrecôte restaurant in east Berlin around the corner from where I was staying.

I ordered what looked like it might be a promising little Côte de Rhône. Somewhat to my chagrin, a bottle of Côte de Beaune showed up instead. Which turned out to be delightful.

Hautes-Côtes De Beaune 2005
“Clos De La Perrière”
Domaine Parigot Père et Fils
Meloisey

Which just goes to show that what you ask for has little to do with what’s actually going to work with the meal you’re having.

AfC

Wednesday, 03 Dec 2008

Subversion revision number?

If you’re using the bzr-svn plugin to allow you to easily to interact with upstream projects using Bazaar, how do you find out the Subversion revision number that you happen to be at? (The bzr revno is, in general, going to be something different)

Seems to be a common question; I found myself asking it today. Turns out that the bzr-svn plugin adds a line to the bzr log output telling you the answer:


$ cd ~/vcs/gnome-util/trunk
$ bzr pull
$ bzr log | less
------------------------------------------------------------
revno: 6852
svn revno: 8199 (on /trunk)
committer: gforcada
timestamp: Tue 2008-11-25 12:52:19 +0000
message:
  Updated Catalan translation
------------------------------------------------------------
revno: 6851
svn revno: 8197 (on /trunk)
committer: gforcada
timestamp: Tue 2008-11-25 12:37:53 +0000
message:
  Updated Catalan documentation
------------------------------------------------------------
revno: 6850
svn revno: 8194 (on /trunk)
committer: ebassi
timestamp: Mon 2008-11-24 22:45:28 +0000
message:
  2008-11-24  Emmanuele Bassi  <ebassi@gnome.org>

        * gnome-screenshot.c: (save_options): Save the include-pointer
        setting to GConf.
------------------------------------------------------------
...

8199, apparently. :)

Nice feature!

Thanks to Matt Nordhoff for pointing this out to me in #bzr.

AfC

Friday, 28 Nov 2008

Falling prey to fear

I have a number of clients, colleagues, and friends who live in Mumbai, a place that is sadly no stranger to trauma and which is going through it again. In such times we can only hope that our friends and their families have not been hurt in the unpleasantness that is presently besetting their world.

It is hard for outsiders to understand the confusion that embroils such situations; people reporting the news always seem to convey the air of knowing what is going on. Of course they don’t, but the people that can spot the discrepancy usually aren’t exactly watching television.

Being present during a terrorist attack is, sadly, an experience that far too many of us share. Many people find it difficult to remain calm in the face of crisis and chaos. Not for us, far away, to say that they should feel any differently.

What I can offer, however, is the absolute certainty that the one way above all others that we beat those who would tear down our society is by not falling prey to fear. Incidents are bad enough, but the real damage is afterward, when we allow the circumstances to themselves become a cause and a self-inflicted excuse for curtailing our freedoms. No. Returning to normal is not easy, but it’s how we win.

AfC

Wednesday, 26 Nov 2008

Slashtime goes gooey

A long time ago I wrote a tiny perl script that told you the time in various places. It was a somewhat unusual take on the usual approach to the timezone problem in that it displays offsets from where you are, not offsets from UTC (which, unless you’re in the UK in the winter time, are really kinda useless). A number of people liked using it, which was nice. It was called “slashtime” since /time is a shortcut on my company’s website to get to an HTML version of it. Slashtime places list

For a while, though, I’d wanted to make a version that would be graphical; in addition to being more compact, I wanted it to be live and to help me with arranging meetings. So I did!

Here’s a screenshot of Slashtime running.

The new Slashtime inherited the original’s premise of showing offsets, of course, and adds some other nicities. When the sun is up is irrelevant in this day and age; but business hours aren’t (white background), as is knowing when it’s not a good time to call someone (the dark shading).

Knowing where you are is important too; that’s the blue line. There are a number of heuristics to try and figure that out, but if your Linux box’s /etc/localtime is a symlink to a file in /usr/share/zoneinfo like it’s supposed to be, you’re golden; it degrades gracefully from there, looking at what /etc/timezone says, then the TZ environment variable, etc, and doing all this in a hopefully OS aware way (there’s code in there that made it work Solaris, for example).

Oh, and yes, 01:30 is the fold point, quite deliberately. Hackers don’t go to bed at midnight. Perish the thought. So if the person you’re looking for is in the dark portion but at the bottom of the display, there’s every chance they’re still up :).

The list of places shown is specified in from a simple text file at ~/.tzlist (a default list will come up if you don’t have one). Instructions of how to set this file up properly to your own preferences is shipped with the program in the PLACES file. As you can see, I have quite a number of places in my .tzlist file, but there’s nothing wrong with just having two or three if those are the only places you want to know about.

The discussion in the PLACES example makes a point that might night be obvious at first glance: you control the names of the places shown. So if you live in Marseilles, and are tired of every other gizmo out there showing the time in “Paris”, you just go right ahead and put “Marseille” in your .tzlist file as:

"Europe/Paris"    "Marseille"    "France"

There’s also a meeting planner. Right-click the list and select “Meeting…” from the context menu:

Slashtime right-click context menu

and you can set the program to display a specific time and date somewhere in the world. More typically, you ned to hunt for a good time to have a phone meeting with someone; just move the sliders back and forth until you find a nice alignment for you and the other people on the call.

ime of Christmas 2007 in Toronto and Sydney Meeting planner Dialog

This example shows me working out that assuming I’m in Sydney that week, if I want to call my Mum to wish her a Happy Christmas, so long as I call just before I go to bed on 25 December it won’t be too early there (the red border is a warning that you’re not seeing current time displayed).

The GUI version of Slashtime has actually been around a long while; It’s written in Java and served as an early test bed for the java-gnome bindings of GTK and GNOME. Thanks to recent work by Serkan Kaba, however, the program is now properly internationalized. Not that there’s much to translate, but it’s important to at least set the foundation. Serkan did Turkish; I’ve done French Canadian (ahem, that’ll just go to show how rusty my Quebecois is). I must admit that I’m still pretty new to internationalization and localization, so I’m sure there’s room for improvement here.

Slashtime 0.5.9 was released this week with that branch merged. It’s packaged on Gentoo Linux as app-misc/slashtime. Building it yourself shouldn’t be hard; Thanks to people like Carl Worth and Rob Taylor it works out of the box on a number of other distros. You’ll need java-gnome >= 4.0.9. Just follow the instructions in the README file; once you’ve make installed it to the right place it’ll be in your system menus and whatnot. I personally also have a keybinding set up so I can easily run it on demand, but:

$ slashtime

will certainly do the trick :)

If you want to hack on Slashtime, just use Bazaar to grab the sources. The 'mainline' branch is at bzr://research.operationaldynamics.com/bzr/slashtime/mainline/ and you can find me in #java-gnome if you want to chat about it.

Incidentally, no, this isn’t a GNOME clock applet replacement — although I’m very pleased that Bryan Clark picked up on some of the UI ideas when I showed Slashtime to him last year in Boston; sharing ideas and learning from each other is what Software Freedom is all about — but it is a fantastically useful program to have around when you’re dealing with people around the world, as so many of us do. Enjoy!

AfC

Fixed

One of the less pleasant things about upgrading is the risk that new versions will break existing capabilities that you’re used to. Sometimes these are for-real regressions; others its just a case of codebases having moved on and unfortunately things not gelling together properly.

Upgrading my Linux kernel to >= 2.6.26 from 2.6.24 or so caused me two problems; the brightness controls for my screen were inverted, and the wireless networking applet suddenly stopped working!

Both of these bugs were resolved in the last two days! I’ve been very fortunate to have the help of some wonderful people. In one case it involved backporting an as-yet-unreleased bug fix in HAL, and in the other it was my kernel config lacking a necessary setting.

The details aren’t really important. The mutual support that is so often evident in Open Source communities like Gentoo Linux is. So to the inestimable Daniel Drake, “Sergey”, Ricardo Salveti, and all the others who helped me isolate and troubleshoot these problems, thank you very much!

AfC

Tuesday, 18 Nov 2008

A nice way to wake up

I’m the lead author and maintainer of java-gnome, an Open Source project that enables Java developers to write native GNOME applications using the GTK user interface toolkit. Like any such effort, it’s a huge amount of work, much of which goes on unseen. So there are few better ways of starting off your morning than finding a message like this in your Inbox:

I just want to thank you for this great API to GTK.

It feels entirely natural in Java, is very comfortable and very approachable. The names and APIs are as you’d think them up when you’d draw a widget set API in your mind, thus they are easy to find, too. They also work as expected (as least so far, I am still new).¹ The API documentation for each class has a nice prose introduction text, which is very helpful and saves most “tutorials”. I also appreciate that it points out just the right level of footangles to be aware of.

All in all a really great piece of work. When you talked about “quality” on your website, I was suspect, as that’s most of the time just words, but you really deliver quality. You show an good example of what quality means in the context of an API.

Sun should take a good example from you and many in the open-source world, too. Such brightness and care is rare.

Hey, thanks!

Quality versus Barrier to Entry

Regardless of the underlying economic circumstances, most Open Source projects are labours of love. But they can go one of two ways.

One tendency is to just accept anything, and hope that “someone” will fix it later. This approach has the beneift of a low barrier to entry, making it easy for people to contribute. But it can result in a muddle; code that is not yet up to scratch but whose authors have moved on to other things. The only time that Open Source fails to live up to its promise (as a software development methodology) is when someone starts something and doesn’t finish it. A situation nobody wants, but it is easy to have this inflicted upon your project if you accept incomplete contributions from other people — it can be hard to incent them to come back and finish the job.

The other way is to maintain a high standard, putting emphasis on internal consistency and clarity and asking people to rise to that level. While setting a high bar does put some people off, the contributions from those who invest the effort to rise to the occasion tend to be really good.

I tend to favour the second way. If your initiative is worth working on at all, then it is the kind of thing you work hard at making perfect because it deserves nothing less. You’re not going to let it down, and you don’t want anyone else to either.

Anyway, it’s all a lot of work. Sometimes I hate it. But when you receive a note like this from someone who appreciates the effort you’ve put in, it really does make your day — and makes you feel that result of staying clearly focused has been worth it.

AfC

¹ I pointed out to him in my reply that there was still plenty of time for him to trip over something :)

Friday, 14 Nov 2008

Imagery of another solar system

Look what they found:

Keck observatory image of HR8799

yes, very nice, but what is it? Maybe this image (care of the BBC News article about this) will help:

diagram comparing our solar system and HR8799

That’s right. Not just “we found another planet outside our solar system”. This is a picture of another solar system. Incredible.

AfC

Tuesday, 11 Nov 2008

Ambition, Attrition, and Armistice

“At the 11th hour on the 11th day of the 11th month, one minute of silence will be observed to mark the signing of the Armistice and to remember all those who fell in the cause of their nations.”

Most of us were raised to the myth that the Normandy invasion on 6 June 1944 was an inevitable triumph that swept aside all opposition. Most of the books you read on the subject focus on paratroopers and weather forecasts and the bloody grind to get across the beaches. Yet that was just one day. The part that most people don’t think about is that the bloody grind continued… for months.

The Allied objectives for “D-Day” (a silly name, seeing as how every single military operation has a D-Day and an H-Hour) were ambitious; Caen, for example, was expected to be under by the end of the first day. Well, despite overwhelming firepower, it took almost 2 months to capture Caen.

They had planned on a campaign of movement, thinking of the experiences in the desert. Tankers today still dream about grand sweeping movements. But in close country, where a single defiladed anti-tank gun can wreak havoc on an approaching formation, tanks moving against defended positions without infantry support are easy pray, and yet those soldiers are likewise exposed to murderous fire. The inclination (can’t quite call it instinct) to go to ground when a gun opens up is incredibly strong. It’s even harder to get up again, especially when the officers attempting to lead by example are being mowed down.

Which is why the senior generals were increasingly terrified that the campaign was bogging down; they who had somehow survived the Somme, Ypres, and Passchendaele saw the attrition of the Great War happening again.

One veteran observed that his company had taken over 100% casualties. Another that his had seen 51 officers pass through it between Normandy and the Rhine. Given that in a company there are only an officer commanding, maybe a 2IC, and 3 platoon commanders, that is almost unfathomable. And this was only a shadow of what had happened 1914-1918?

The old blasphemies endure: “God loves the infantry”.

So we observe this day; these people are the ones who bought our freedom from the ambitions of those who took us into the maelstrom. And although the memorials name those who didn’t come back, we must think too on those who did, those who rallied to continue their advance, and carried the day.

And as you remember, perhaps spare a moment for those who serve still, who struggle in cold, dark, or scorching places, far from home.

AfC
11:00 hrs
11 November 2008

Monday, 13 Oct 2008

java-gnome 4.0.9 released!

This blog post is an extract of the release note from the NEWS file which you can read online … or in the sources, of course!


java-gnome 4.0.9 (13 Oct 2008)

The pen is mightier than the sword

New coverage

This is the first release with coverage of GTK’s powerful TextView/TextBuffer multi-line text display and editing Widget. This has been the result of several months of careful effort to present a clean and self-consistent API while remaining faithful to the underlying implementation. This bulk of this work was done by Stefan Prelle and Andrew Cowie, with contributions from Kenneth Prugh and testing by many people in the #java-gnome community.

The snapshot at right is from ExampleInstantMessenger, included with the sources. It is a somewhat detailed example showing the use of TextView, TextBuffer, and related classes.

Other improvements

Continuous improvement to various classes, especially in our documentation. Incremental changes have occurred in a number of places. In the TreeView/TreeModel APIs, some useful methods for translating TreeIters from one model to another have been added.

Also thanks to the persistent work of Stefan Prelle, we now have nice coverage of GTK’s Assistant (aka druid, wizard, etc), along with better support for doing popup context menus, including some bug fixes. Thanks to Srichand Pendyala for taking care of this and to Owen Taylor for having explained out some of the underlying implementation details.

As usual, incremental improvements to core classes continue. Virtually every class has been touched in one way or another; many changes are cosmetic but they add up to a nice delta overall.

Reducing memory pressure

Internally, java-gnome maintains a lookup table so that pointers coming from the C side can be converted into proxy objects for the case where a proxy has already been created. In any library there a great number of transient and temporary objects and structures allocated, and in wrapping native GNOME libraries we are no different. It turned out that registering these temporary objects was putting pressure on the lookup table. While these objects were properly weak referenced and being garbage collected (and thence freed), there were nevertheless an enormous number of temporary objects being inserted and removed from the lookup table — and that sort of thing causes hash tables to grow overly large.

To do something about this we have split the former hierarchy root into two classes. Only structures which have a persistent identity (which, in practise, means only GObjects and certain Cairo entities) are registered so they can be looked up by address later as necessary. The rest of the Java side proxies aren’t registered, essentially eliminating the transient pressure on the lookup table.

Thanks to Vreixo Formoso for doing the bulk of the leg-work on this one.

Making it easier to run java-gnome programs

Because java-gnome is directly binds to underlying system libraries, it has a native shared library component. This led to the usual development hassle of having to specify where this library is to be found if it were anywhere other than /usr and of course the nightmare of ensuring a VM used the right library in the event you were developing against or hacking on a newer version of java-gnome; in Java this meant:

$ java -classpath /opt/local/share/java/gtk-4.0.jar:. -Djava.library.path=/opt/local/lib com.example.Program

No longer!

The native shared library part of java-gnome is now located deterministically and loaded automatically. You don’t need to faff about with java.library.path on the command line or in your IDE any more!

$ java -classpath /opt/local/share/java/gtk-4.0.jar:. com.example.Program

Our native component is completely coupled to the specific release you are using, so sufficient version information is embedded in the .so name to ensure that the right library (and only the right library) is loaded.

There are no changes if you are simply working against an “in-place” development build of java-gnome, be it from command line, or in an IDE like Eclipse. Things will Just Work™. Again, no -Djava.library.path.

This whole issue turned out to be a real stumbling block for new developers attempting to use the bindings; it’s not something that many Java programmers have had to deal with, so engineering around this problem to make the native library loading transparent is a big win for us.

Build system improvements

Serkan Kaba has contributed a number of internal improvements allowing the top level ./configure script to be precise about the versions of various GNOME dependencies we require.

Thanks to some hard work from Serkan Kaba and new contributor George McLachlan, java-gnome correctly builds against GTK 2.14 without any problems due to deprecations.

Note that java-gnome releases do not set GTK_DISABLE_DEPRECATED (this is a change from 4.0.8); thanks to Mart Raudsepp of the Gentoo Linux desktop team for pointing out why this would be better. These macros are still enabled for builds checked out from version control so hackers working on the bindings so will be able to keep up with ensuring we react to future deprecations (it’s always awesome when downstream is a part of the upstream community; Serkan and Kenneth are also Gentoo packagers, and take care of the java-gnome .ebuild for us).

Looking ahead

We’re pretty happy with the state of the java-gnome right now. Coverage of the most important parts of GTK are in place. Our treatment of the underlying drawing library, Cairo, still has a bit to go, but the basics are there and a firm foundation to build from. More interesting are the remaining areas; the more general GNOME utility libraries and other parts of the Free Desktop stack that might be needed by an end-user application. It’ll be interesting to see how these areas evolve in the coming months.


You can download java-gnome from ftp.gnome.org or easily checkout a branch frommainlineusing Bazaar:

$ bzr checkout bzr://research.operationaldynamics.com/bzr/java-gnome/mainline java-gnome

AfC

HTTP response code nuttiness

The technique of using a 404 error handler to actually render a web page from some underlying source or data is widely used. We use it on the java-gnome website to render prettily marked-up versions of our text meta documents (NEWS, README, HACKING, etc). The document you’re asking for (“README.html“) doesn’t exist, but a text source (“README“) does and so it reads that file in, runs the markup processor, and then serves the result. Yawn.

If you’re already in an error handler, then the default status code as far as the web server is concerned is, of course, HTTP 404. So you need to change that. In PHP, that’s as simple as:

which is actually treated a bit magically to tweak the response code. Too easy. This worked fine on our test site and on the production site for, well, years.

We ran into a weird problem that at some point over the last few weeks that suddenly I was seeing garbage appearing at the beginning and end of documents being so rendered on our SourceForge website. Huh?

I still have no idea what is wrong, and won’t detail all the diagnostics it took to track down the problem, but I ended up isolating it to the header() call. If I skipped that, then the document would render and serve correctly. But that’s no good, because then you are serving documents with an HTTP 404 error code, which will inhibit search indexing and caching even if it doesn’t screw with your browser.

The workaround ended up being this:

I have no idea why, but with whatever SourceForge has done to their webservers lately, this made it work fine. Go figure.

The real inanity, though, is that using wget to fetch the document while showing HTTP headers the result is this:

$ wget -x -S http://java-gnome.sourceforge.net/4.0/README.html
--2008-10-13 14:11:28--  http://java-gnome.sourceforge.net/4.0/README.html
Resolving java-gnome.sourceforge.net... 216.34.181.96
Connecting to java-gnome.sourceforge.net|216.34.181.96|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx/0.6.31
  Date: Mon, 13 Oct 2008 03:11:29 GMT
  Content-Type: text/html; charset=UTF-8
  Connection: close
  X-Powered-By: PHP/5.2.6
  Last-Modified: Sun, 12 Oct 2008 14:02:37 GMT
Length: unspecified [text/html]
Saving to: `java-gnome.sourceforge.net/4.0/README.html'

    [    <=>                                ] 16,052      22.3K/s   in 0.7s    

2008-10-13 14:11:30 (22.3 KB/s) - `java-gnome.sourceforge.net/4.0/README.html' saved [16052]
$

Their web server sent an HTTP/1.1 response anyway! Talk about adding insult to injury. What a waste of time.

I’m sure this is just one of those transient conditions that’ll be gone by this time next week, but it sure as hell frustrated me. If you’re seeing something weird going on with PHP pages on one of your SourceForge sites, perhaps have a look and see if this workaround helps.

{shrug}

AfC

Sunday, 05 Oct 2008

Congratulations Manly!

Manly Sea Eagles team logo

There really is nothing better than being in your home town at a pub surrounded by several hundred screaming fans when the home side is playing in the Grand Final of its league and then watching them trounce the opposition 40 to 0.

Steve Menzies scoring a try
Photo by Brendan Esposito, as presented on the League HQ website

Congratulations to the Manly Sea Eagles for winning the 2008 Rugby League premiership!

AfC


Material on this site copyright © 2002-2009 Operational Dynamics Consulting Pty Ltd, unless otherwise noted. All rights reserved. Not for redistribution or attribution without permission in writing.

We make this service available to our staff in order to promote the discourse of ideas especially as relates to the development of Open Source worldwide. Blog entries on this site, however, are the musings of the authors as individuals and do not represent the views of Operational Dynamics. All times UTC.