Jenny Pope: Missing in Ecuador

I was driving to band practice tonight and an item came on Radio Four about Jenny Pope, a lady from Mossley who has gone missing in Ecuador. She was last heard from while she was in Banos, Quito on 9th January and shortly afterwards her bank account was systematically emptied. I don't know her personally but a lot of my friends in the Manchester drumming community do, and we had a big busk in Manchester a couple of weeks ago to try to help raise awareness (and money!). We managed to bring in £300 in a couple of hours, thanks to the kindness of the people of Manchester. The Manchester police were on the radio this evening saying that they were sending a couple of officers out to Ecuador to help in the search for her. Fingers crossed that they manage to make some progress, everyone who knows the family is obviously very concerned about her.

Categories : Personal, Friends, Drumming

JNI_OnUnload(): mostly useless

I've been writing a JNI wrapper that requires the creation of a native thread and I've set things up using a JNI_OnLoad() function to initialise the DLL and create an event handling thread thread. I also used the JNI_OnUnload() function to kill the thread and clean up the DLL, but what was puzzling me was that although JNI_OnLoad() was being called OK, JNI_OnUnload() was never being called, and because the thread was attached to the JVM via a call to AttachCurrentThread(), the JVM would never exit as it still had an active thread. A simple workaround was to attach the thread to the JVM as a daemon thread using AttachCurrentThreadAsDaemon as daemon threads don't keep the JVM alive, but that still meant the DLL wasn't being cleaned up properly.

Google revealed a post on the Java Forums which explained that the ClassLoader was keeping a reference to the class containing the native code wrapping the DLL, and that was preventing the JNI_OnUnload() function from being called. The post also explains that if you make a call to System.runFinalizersOnExit() then the finalizer for the ClassLoader will be called on exit and that in turn will call the native code's JNI_OnUnload() method, and a simple experiment proves that is indeed the case. However the System.runFinalizersOnExit() method is deprecated:

This method is inherently unsafe. It may result in finalizers being called on live objects while other threads are concurrently manipulating those objects, resulting in erratic behavior or deadlock.

In light of this it appears that although JNI_OnLoad() is useful, JNI_OnUnload() is less than useful. There is a workaround, which is to register a native exit callback using Runtime.addShutdownHook() and do the cleanup that way, but it's kind of broken that JNI_OnUnload() doesn't actually do what it is supposed to, and even more odd that the JNI documentation is completely silent as to why it doesn't actually work. I think I feel a bug report coming on ;-)

Tags : , , ,
Categories : Java, Tech

Bypassing those annoying website registration forms

Picked this tip up off slashdot - some websites (e.g. the Washington Post) insist on making you register to read their content, even if the content is actually free - the assumption is that they only want the registration so they can harvest your email address and use it for marketing purposes, and as someone who gets huge volumes of spam already (despite 500+ a day caught by the corporate filters, 40-50 still get through) I'm very loathe to give out my email address when I don't have to. Although there are services such as BugMeNot which allow you to create a throw-away email address for registration and to look up already registered addresses, the webmasters of the sites that require registration cotton on to these pretty fast and block them.

However, these selfsame sites obviously want google to index them, so they allow the google search robot in without requiring registration. Enter the User Agent Switcher plugin for Firefox. I've used this in the past to get access sites that insist you use Internet Explorer to view them, but you can add an entry to make your browser look like it is the google bot. In the Description field put whatever you want to identify the entry, and in the User Agent field put the string googlebot/2.1 (+, you can leave the rest of the fields empty. Switch to the new User Agent string and hey presto, all that content you couldn't previously access is visible. Unlike the disposable email address arms race, I don't see how this can be circumvented without making the content invisible to Google as well.

Tags : ,
Categories : Web, Tech

JSlider oddity - setFont() is ignored

Despite what you might expect, the labels on a JSlider ignore any font that you specify with setFont(), at least in the Windows L&F. Most odd.

Tags : , ,
Categories : Java

Oooh! Shiny! ... NetBeans 5.0

I've been very happy with NetBeans 4.1, but I've been keeping an eye on all the new stuff in NetBeans 5.0 with anticipation, especially the new Mattise GUI designer. Over the last couple of days I've been knocking together a simple Java GUI and today I finally cracked, and I grabbed a copy of 5.0 from the internal staging servers rather than waiting for the public release of 5.0 and having to fight my way through the download crowds - hey, working for Sun has to have some benefits, right? ;-)

First impressions are very favorable - having already used NB4.1 a fair bit, NB5.0 feels very familiar from the start - which is a good thing - I get very tetchy when stuff is moved around just for the hell of it between releases of a product. There's a lot of nice usability touches in there - there's an Options dialog that allows you to set the most common preferences quickly and easily, and at last you can edit your code templates easily - it always bugged me that I had to hand-edit the banner blocks in each of the generated files. The new CVS stuff seems to just work - I pointed it to a project of mine on sourceforge and it synced up with no tweakage required.

One of the most noticeable features is the new Matisse GUI designer. I'd already done some outline design in my app and I expected I'd have to throw it all away and start over, but it turns out you can pretty easily retrofit existing GUI designs to use Matisse - I'd been using the GridBag layout manager, and to switch to Matisse I just had to right-click on the layout manager icon in the Navigator pane and select 'Free layout'. Once that's done you can start dragging your components around Matisse-style - nice!

I also pulled down the profiler and mobility packs and tested out an existing MIDP application which all worked fine. The only thing I'd forgotten to do was to pull down a copy of cpptask so I could build the JNI code I have in one of my Win32 projects. I've only given the tyres a cursory kick so far, but I like what I see.

Whilst I was looking around for the the install images I found one of the internal wikis where the team were discussing categories of developers who might use NetBeans, and I think I'm in the 'tough nut to crack' category, i.e. someone who uses mainly vi and make for development. I must admit I was initially sceptical about NetBeans, having had some *bad* experiences in the past with IDEs that were anything but what their names suggested, but I'm a firm convert, and NetBeans is now my prefered environment - I just wished it handled C with the same degree of cleverness as it does Java ;-)

Nice work and kudos to the NetBeans community!

Tags : , ,
Categories : Java, Tech

Nuclear Glossop

Nuclear bunker

I was futzing around on the web looking for something else entirely when I found this site which catalogues all of the 1563 Royal Observer Corps bunkers that are scattered over the UK. The history of the ROC is fascinating - they were originally set up in 1925 to visually report and track any enemy aircraft flying over the UK. At the height of the Cold War in 1957 they became part of the United Kingdom Warning and Monitoring Organisation (UKWMO), the intention being that in case of a nuclear attack they would report the location and extent of the bombs that were dropped on the UK. To this end a chain of small three-man bunkers were built across the UK, so naturally I had a look to see where the closest one was to me, and to my astonishment it was less than 400m from my house! Most of the posts stuck to to a standard design - in the photo above you can see the top of the entry shaft in front of the telegraph pole, to the front and right of the entry shaft is the blanked-off pipe that held a radiation counter. There's also a smaller pipe lower down in the grass which was the input port for the blast overpressure gauge. To the right of that (with the baffles) is the top of the air ventilator. This particular bunker was decommissioned in 1991, shortly before the ROC was itself disbanded.

The bunkers were small and cramped - there was no mains electricity, no water supply and the toilet facilities consisted of a bucket, and quite often they were damp as well. I'm not sure just how effective they would have been had anyone actually dropped anything that went 'bang' in a serious fashion - the telegraph pole in the picture above was in fact the only communications mechanism when the bunker was originally commissioned, and lengths of dead pine tree with wire strung between them doesn't seem to be a particularly blast-proof communications system to my untrained eye! Perhaps the most unenviable job in the post was that of the 3rd observer who, shortly after the attack, had to climb out of the bunker and retrieve the photographic paper from the Ground Zero Indicator (GZI), which was basically a pinhole camera - the fireball of the detonation would burn marks on the graduated paper inside the GZI, and from that the position and altitude of the detonation could be determined. If that wasn't bad enough, he was also responsible for hauling the chemical toilet up the 15 foot entrance shaft and disposing of the contents!

Categories : Peak District

Stealth samba

mouse mat

As anyone who plays samba knows, it's a bit of a noisy pursuit, and tamborim is especially so as it's so high-pitched. This makes practising at home a little problematic unless everyone in your household (and the surrounding households!) is completely deaf. I found a tip somewhere on the web that I thought I'd pass on - find an old mouse mat, put your tamborim on top of it, draw round and cut out a circle, making allowance for the wall thickness of the tamborim. Make sure it's a really snug fit, and push it inside the underneath of the skin. It barely affects the feel, and makes the tamborim much, much quieter, so you can practice your virada without being banished from the house. The best sort of mouse mats to use are the thick neoprene ones - as you can see a former employer of mine kindly provided me with one ;-) and it's also a good idea to thread a bit of string through two holes in the mat so you can get it out easily.

Categories : Drumming