Posts

Showing posts from 2008

XP SP3: STOP 0x0000007E (0xC000001D) (solved)

Update: If you arrived here, looking for a solution to a blue screen problem that started to occur on Feb 12th, 2010 - this is a different kind of problem. The solution to that can be found here: Heise Online (English). Basically, it is a side-effect of a Microsoft update (MS10-015) that triggers a flaw in an already present bootkit malware, which then leads to the blue screen of death problem. From time to time (i. e. every workday ;-)) I still use Windows XP. Recently I kept getting complaints about the system partition being too full. I guess on all operating systems this can have all kinds of funny (or disastrous) effects, so I tried to clean up a little. Apart from the usual suspects (temporary internet files, some huge downloads on the desktop and the like) I noticed that there were literally dozens of $NtUninstall...$ folders containing the setup/uninstall files for a lot of updates that had accumulated over time. I realized that those could be deleted, however I prefer having …

OS X Development

Image
While waiting for my in-law's Ubuntu machine to download the update from 7.10 to 8.04 over a "DSL light" (384kbit/s) line I thought I might just write a bit about my first developer experiences on the Mac.Back in August I switched from the PC to a 24" iMac. Now that I got a little more acquainted with it I thought I might just as well have a look at what the developer experience is like. People tend to say all sorts of things about Objective-C and that for a Java guy like me it would be a huge step backwards.For that reason I was glad to read that Objective-C 2.0 comes with support for garbage collection, because manual memory management after years of Java would have been a real pain-point for me. I find it interesting to still see a discussion going on in the Mac developer world about whether or not GC is a good idea or not. I would have expected everyone to jump at it and leave the manual stuff behind with delight. Well, seems like a little bit of history repe…

US power sockets in the eyes of a European

Image
I recently went on a trip to the U.S. For 10 days I stayed in different hotels, and in each of them I wondered about the state of the power outlets...Armed with an adapter for my German/European plugs I tried to charge the camera's or phone's batteries. I don't know if it's just me, but I expect to just plug a device in and get a firm and secure connection to the power outlet. At least that's what I am used to at home.However in all the hotel rooms the sockets seemed to have no "grip" on the plugs which then tended to either slip out completely or at least lose contact all the time. I first thought it might just be the adapter model I brought, but even the lamps and TVs in the rooms had flaky connections which would easily slip out even when just brushing the cable slightly. I believe this may have to do with the fact that in the US system the power outlets are just flat while in Europe they recess into the wall and provide a much firmer mechanical hold o…

W-JAX 2008 OSGi Day

After the rather basic Power Workshop on Monday I attended the OSGi related sessions of the main conference yesterday. Though I was skeptical before - from my experience I often find conference speakers put too much focus on introductions and basic stuff at the beginning just to run short on time later - I was rather happy with the overall outcome.The first session "OSGi Today and Tomorrow" was held by Peter Kriens of OSGi alliance fame and provided some insight into the history and ideas of the platform which he co-invented. The "tomorrow" portion was rather short - about 5 minutes out of 75 - I would have liked some more information here. However as it was the first session of the main conference I did not expect to dive into much detail here.After that Matthias Lübken and Martin Lippert of akquinet it-agile GmbH talked about strategies and caveats when "porting" existing applications to use OSGi. I liked that talk even though I do not see why it was ma…

w-jax 2008 OSGi Power Workshop

Today I attended the Einführung in die OSGi Service Platform (Introduction to the OSGi service platform) power workshop at w-jax 2008 in Munich. I had hoped to get some more detailed insight into using that stuff in practice. While the workshop was clearly not a waste of time I was a little disappointed about the lack of practical relevance. The workshop was packed with about 50 people - with only 20 registrations.The first 90 minutes were spent installing Eclipse 3.4 and the Equinox SDK onto the participants' laptops. That time could have been put to better use had the session description not only told to bring a machine prepared with Java 5 but with the whole stack installed. So we had to hand around 5 CDs an some pen drives to get everyone up and ready.After that and some introductory words about OSGi we went through increasingly "complex" examples and tutorials. Though I understand the idea to explain the inner workings of bundle lifecycle, Activators, package im-/ex…

Short note on code readability

Yesterday I came across a piece of code which at first had me a little startled. My first impression was, that the events would not be sent to any listener. Then I thought it would throw a NullPointerException. Only after that I realized that its fully functional, but a little awkward style-wise: public static void handle(String data) { DataListener dl; for (Iterator iterator = dataListeners.iterator(); iterator.hasNext(); dl.eventOccurred(data)) { dl = (DataListener)iterator.next(); System.out.println("Sending data to " + dl.toString()); } } Did you get it? I have never before seen someone do the "actual work" in the third part of the for loop... Reminded me that even a short piece of code written in an unorthodox style can be somewhat challenging to grasp at first sight.

As promised...

... the next post comes from OS X :-)

Changing platforms

It's been a while since the last post. This is mostly due to me entering new territory in several ways. For one, I have been digging into JavaME development lately (platform change #1), building a mobile data entry and manipulation application that uses a an embedded database and talks to its server via Webservices, if connected. Otherwise data will be queued up locally and sent as soon as the network comes back.The whole thing is build as an Eclipse embedded rich client platform app (eRCP) leaning on the included Equinox OSGi platform (#2). One of my favorites there is Declarative Services which helps cut down boilerplate code and at the same time encourages modular design. Really cool stuff, however somewhat difficult to get into if you are completely new. I plan on posting some sort of tutorial on this. Of course there are already several out there, that's how I learned to do it (and still am). However some of the material seems a little outdated, so maybe someone will find…

A little more on Windows Drag and Drop

A few days ago I complained about the silly drag and drop behavior of several ZIP tools, my favorite 7-Zip included. My post contained a remark that this is actually a Windows problem, but I did not have any further information on it other than a few links to the 7-Zip forum where people talked about this.Thanks to an anonymous commenter on the earlier post I can now point to a good source of more information: The also fabulous WinSCP tool comes with a special drag and drop extension that works around the limitation of first unpacking to a temp file and then copying to the final destination, making unzip operations very slow. From the documentation page at http://winscp.net/eng/docs/dragext you can learn this:Here is short explanation: Windows drag&drop mechanics does not allow source application of drag&drop operation to find out easily, where the files are dropped. It is up to target application (Windows Explorer usually) to transfer files to destination. It is rather reason…

Vista still stands in its own way with USB drives

Image
Some things will apparently never change. After I learned that the notorious temp-dir-copy-cycle most zip tools go through is probably a Windows feature, today I came across an issue I thought should finally have been addressed in "Windows 6" (Vista).I had inserted a USB pen drive ("USB DISK") earlier and just wanted to eject it.From my point of view this is a fairly typical scenario. When you insert the drive Windows will offer to open it in an explorer window. This is just what I did. I copied a file from there to the desktop and wanted to remove the device:"Auswerfen" is the German word for "Eject". Guess what...The same old story once again... This lengthy message tells me that some application is using the drive and that removing it might cause data-loss, kittens could die and the whole blah blah.Of course I can click on "Fortsetzen" (Proceed), but this is not what I would expect of a 21st century user interface... The least thing…

7-Zip, drag and drop and the temp-dir mystery

Today I downloaded the Eclipse Ganymede M6 Java EE package. It is a 178MB ZIP archive containing the IDE. Downloading took a few minutes and then I was ready to go. Well, almost. Of course the ZIP needed to be extracted first. I use 7-Zip as the archive tool of choice. It has proven to be reliable and fast.However it shares one "habit" I have seen so far with every archive tool I tried: Wherever you want to extract the contents of the archive, it will first put all files into the %temp% directory - often on the system partition - and only then copy the unpacked content to the final location.With the Ganymede package this means 217MB of data in 4180 files and folders are first read from the archive and stored in a folder. On my P4@3GHz this takes about 110s. After that a copy of that some data - almost 4200 files - takes another 90s. Apart from that, instead of 217MB I now need twice as much almost half a gigabyte to store both the temp copy and the final one. Why is that nec…

Stale /etc/group.lock & /etc/gshadow.lock on RH9

Last week for the first time in quite a long time an automated update process failed me. Even though it had been in use for several months already, and had seen numerous successful test runs, one machine was (almost) completely screwed up after the process. It may be interesting to know that all this is taking place on rather "antique" Red Hat 9 systems. I have not had the time to double check whether the following still holds true for more modern systems, any comments are appreciated.The update logs contained a strange line:useradd: unable to lock group file Well, while the message itself is one of the more explicit ones, I could not understand what would be causing a lock on the group file. There is indeed a useradd command in the upgrade script, however it is the only one, and the update takes place right after a reboot. Hence no other process could possibly hold a lock on /etc/group.Looking at the /etc directory I found these two files: /etc/group.lock and /etc/gshadow.lo…

Amazon.de Browser Switch

Image
Just noticed that Amazon.de seems to deem Firefox users "not worthy" of their new site design ;-)Strangely enough Amazon.com show the same (blue) layout in both browsers.Just wondering...

Locale.getDefault() FindBugs Detector

I just hacked together a little FindBugs plugin that will just detect calls to the static Locale.getDefault() method. This may be undesirable for application code to do - e.g. in cases where you have an application framework that provides a more flexible way of localization.This is nothing I deem worthy of contributing to the FindBugs team, because technically there is nothing wrong with Locale.getDefault(). Nevertheless maybe you can use it, too.Just drop it into the plugin directory of your FindBugs installation. The plugin contains the source code of its single class inside the jar. Because this page is not yet full, I post it here as well for a quick glance:package de.shipdown.fb.detect; import java.util.Locale; import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.ObjectType; import edu.umd.cs.findbugs.BugAccumulator; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.ba.AnalysisContext; import edu.umd.cs.…

Windows Live Writer

Image
During the transition from JRoller to Blogger one of the factors that drove my decision were the available editors. Both offer some sort of WYSIWYG HTML editors to compose blog posts. However I was not too pleased with either one of them. Both tended to produce somewhat bloated markup with lots of divs and spans, combined with inline style attributes - in the end not really much better than <font> tags...In the end I gave up on the "rich edit" modes and wrote the markup by hand, usually with Bluefish. While I was generally fine with that I still kept looking for some decent blogging tool a little more sophisticated than either the browser's text-area control or Bluefish. I tried ScribeFire for a very short time, but was not pleased with it. Maybe it suits people better who usually blog about stuff they find while surfing the web, but for me it just did not work. Finally - I cannot really remember when or how I got to it - I stumbled across the Windows Live Writer.I…

Follow-up: Strange InnoDB Locking Behavior

On March 4th I wrote about an observation we made concerning InnoDB locking behavior in combination with foreign key constraints. Since then we have been in contact with MySQL support and they in turn with the InnoDB developers. One of the conclusion I can already draw from the whole thing is that another level of indirection (InnoDB being a part of Oracle, i. e. an external resource to MySQL, too) does not tend to speed things up...But be that as it is, here is a more thorough explanation we got about how the more aggressive locking comes to pass in case a foreign key constraint references a parent table's primary key. As the original response from the support staff spans several emails and includes some internal stuff I will paraphrase to protect the innocent (i. e. me ;-)).First - just to remind myself - some notes on how the foreign key checks work. For any update you do to a child table, the DBMS needs to make sure that you cannot concurrently remove the parent table's ro…

Enable Explorer Window Titles on Vista

Image
Something struck me recently about the appearance of the Vista desktop. I did not consciously realize it at first. What's "wrong" with this picture:If you do not see it, compare it with this one:See the difference? The second screenshot was taken with "AeroBar" loaded. The only thing it does is make use of the otherwise wasted space in the title bar by displaying the folder name. Does anyone know why Microsoft would not do this by default?

iPhone SDK - Sweet with a smack of bitterness

When Apple released the iPhone SDK to finally allow 3rd party applications on the iPhone and the iPod Touch, I was immediately excited. Even though Apple claimed that web applications were a great way of developing software for their devices, I did never think so. It may be a feasible way for some simpler types of software, but not being able to leverage the full potential of a "fat client" (even on a device as thin as that ;-)) always struck me as a severe limitation.However the sun does not shine so brightly after all. The Register's Bill Ray writes about his view on things in "Cometh the hour, cometh the iPhone SDK". I tend to largely agree with him. When I watched the "March 6 event" video I didn't even realize that the $99 fee for the development tools was supposed to be a yearly subscription, but got the impression it was simply the price for a license to use the tools in the SDK. This is still what I understand from the iPhone Developer Pro…

iGoogle for iPhone

While iGoogle is nothing really new, I only recently (and by accident) noticed, that there now is an iPhone optimized version of it. While the regular Google home page for mobile devices has seen some improvements specific to the Apple mobile devices as well (tabs at the top of the screen), I really like the combined iGoogle and small display optimized combination iGoogle/i offers.Unfortunately the latter one does not have the nice tabs to quickly switch between GMail, Calendar, Google Reader and the other apps they offer. This would be the last thing to make it close to perfect for me.I wonder how this got past me without noticing it earlier...For some screenshots see tuaw.com (iGoogle/i) or TechCrunch (Google/m). It seems you have to use an iPhone or an iPod to see the differences, the "regular mobile version" appears to be unchanged when opened with e. g. Internet Explorer.

Monsters of the Programming World

Through a comment on my post about my latest encounter with unexpected/unexplained locking phenomenaDavid Linisin's blog caught my attention. Looking through some older postings there I found a post called "The Cruel World Of Programming" which contains some hilarious drawings of "bug species" everyone knows. Go have a look, a hard copy of this is now pinned to the wall behind my desk :-)

Importing Audiobooks to iTunes on Windows

I may have found a new passion: Audiobooks. While for quite some time I was rather skeptical, even when my girlfriend gave me "The Hobbit" as a Christmas present a year ago I hardly tried it. I just could not imagine sitting around and listening to someone reading a story to me.However back then I did not have an iPod (or any other portable music player for that matter), so now - listening to podcasts most of the time I drive, walk or do my household chores - I reconsidered when I got hold of a "Glenkill" set of CDs.My first shot was to just import them into iTunes. However that way all 5 CDs with all their tracks showed up in my "Music" library section where I really did not like them. Even though you can change the files' properties to exclude them from shuffling this was not really acceptable for me.A colleague told me that he had found "Doug's AppleScripts for iTunes" when he was trying to do the same thing for his children's aud…

InnoDB Primary Key and Secondary Index Locking Strangeness

Image
Recently we noticed a strange locking problem within our application. While the previous release worked flawlessly the current version produced a number of Lock Wait Timeouts.The code itself did not change in the area we experienced the problems, however our persistence framework had been updated to a new release in conjunction with our app.One notable difference was the schema generation strategy (the schema is generated based on an UML class model). In the previous version primary key columns were always created alphabetically. Because that is not necessarily a desirable thing it always created a secondary index, too, that contained the same columns in a user-specified order. In case you really wanted the alphabetical order you ended up with two identical indexes. Especially for InnoDB this is a very inefficient thing to do. (See my Index Analyzer tool for more info on why.)Often we ended up with something like this:CREATE TABLE `parent` ( `A` char(3) NOT NULL default ''…

Vista (Home Premium)

Last weekend I decided to buy a license of Vista to replace the XP install I still kept for the occasional necessity. I went for the Home Premium version which I got from Amazon.de for €89.As I usually use Ubuntu I decided to do a clean install to replace the XP partition completely. All documents are on the Linux disk anyway, so nothing to lose there.The install worked flawlessly, even though I do not know how long it took, because I let it run over night after I had entered the product key. In the morning it was asking for a user name and allowed me to log in shortly afterwards.At first glance I did not notice any striking differences compared to the RC1 build I had tried out some time ago. Nevertheless I quickly realized that the computer was beeping using the internal speaker. A look at the device manager (Ctrl-Pause still works) revealed missing drivers for my sound card.Windows update pulled about 170MB and wanted a reboot. After that I had new graphics drivers (nvidia Geforce) …

Blogger Backup

Tonight for the first time I realized that all my posts to JRoller and Blogger are all just present on their respective websites, but not as a copy on my local machine or some other backup. While I have full trust in Google's engineers to keep Blogger up and running as well as my data safe, it is never a bad idea to make a copy of your stuff.So I just googled for "Blogger Backup" and found just that: A Blogger Backup tool. It is a .NET based tool that utilizes Google's C# data access libraries. Probably it would have worked with Mono, but as I had a VirtualBox'ed XP instance up anyway I used it there.Once I had downloaded and installed the tool, it was just a matter of a few clicks to get all my posts saved in Atom/XML files locally. One thing has to be noted though: Make sure your blog feed is set to "Full posts", not just the summary. I first got this wrong, so all the backup files just contained at most the first paragraph.Now all 99 posts I posted t…

Back to text mode

Over the past couple of weeks my machine repeatedly just froze - mouse not moving, keyboard dead. I do not know if it was just X11 crashing, because I do not have any remote services active on the machine, so I could not log in remotely. Just as a precaution I did not boot into X11, but now I am in text mode (80x25), backing up my home folder to an external hard disk. After that I will go for a fresh install of Ubuntu 7.10. The current install has seen upgrades from 6.06 to 6.10 to 7.04 to 7.10, spiced and seasoned with some manual tweaks, especially when something did not work in one of the previous Ubuntu versions. So I cannot really tell if something that was need back then now tends to destabilize my machine. It almost feels a little like this "again Windows syndrome" - where people claim that Windows just "needs a reinstall once a year" to remain fast and stable. I am a little reluctant to admit this, so a part of me hopes this is really a hardware problem; t…

String.replaceAll() caveat

Sometimes I wonder how it is possible to write Java programs for as long as I have now and still stumble across little gotchas I did not know about.When writing a class that is intended as a utility to write well-formed queries for our persistence framework, I was bitten by a nice little subtlety of the String class. Just a little background: In our application we use a persistence framework with a SQL-like (but still different) query language. Statements in that language are easier to read because they are closer to the business object model, but in the end they get translated into "real" SQL.Unfortunately the query parser is based on simple query strings without support for something like prepared statements which makes it susceptible to injection attacks if you put user-entered values into a query directly. While there is a way to escape the input accordingly it is a little cumbersome and makes the code to assemble the query conditions into the final String hard to read.I…

Sun javac / Eclipse compiler difference

Our primary development environment is Eclipse 3.3.1.1, set to Java 5 compatibility. However during the nightly builds we use Sun's javac, currently version 1.5.0_12 I believe.Today I noticed one of the builds had failed in this code (reduced to a small test case): public interface Task<V> {} public interface RunnableTask extends Runnable, Task {} public class ProgressMonitorUtil { public <V> V execute(final Task<V> aBackgroundTask) { return null; } public void execute(final RunnableTask aBackgroundTask) {} } public class Test { public static void main(String[] args) { new ProgressMonitorUtil().execute(new RunnableTask() { public void run() {} }); } }Put these classes into an Eclipse project, either with Java 5 or Java 6 compatibility settings. You will see no problems. However compiling this with Sun's javac (also either 5 or 6 will do) leads to this: Test.java:4: reference to execute is ambiguous, both method <V>execute(Task<V>) in Progres…

SAXParseException: -1:-1: Premature End Of File - Misleading error

Today I had to look at a piece of code a colleague had written, using my XPathAccessor class. She used it in a servlet which gets XML formatted requests. As those are generated by an external 3rd party tool we agreed on some XML schema definitions. Everything they send us needs to conform to its corresponding schema, each reply we send gets validated against a different set.In order to allow independent testing on either side, we provided a little test kit that allows testing our system without having to set up a servlet engine. Basically it just takes a file, reads it into a String and hands that to the handler.First it gets parsed without validation. This is necessary to find out which type of request we were send (the address is the same for all of them). After the root element is known, it will be read again, this time using the right schema to verify the request.Once that is done, some reply is put together and sent back to the client. So far, so good.When I looked at the code I …

Can't start server: Bind on TCP/IP port: No such file or directory (some progress)

Back in October last year I wrote about a peculiar MySQL error message: Can't start server: Bind on TCP/IP port: No such file or directoryThis error only seems to occur on Windows (Server 2003 in this case). While the first part is clear - a port could not be bound, because it was already occupied by another process - the second part does not make any sense.We got in contact about this with MySQL support recently, because we came across the problem again on a machine that had received the "treatment" described in the earlier article which did not seem to work. Turned out that server had not been rebooted ever since, so the registry change was never activated.However as a nice side-effect we now know (almost for sure) what that strange "No such file or directory" is all about: see MySQL Bug #33137. It has been categorized as a feature request - I doubt it will get any serious attention soon. So I will just summarize here to have it all in one place.Apparently wh…

Preload-mania killing aging machines

Over the holidays a friend of mine asked me to have a look at his machine, because it was extremely slow and barely responding at all anymore. When he tried to print a few documents it took more than 10 minutes for the first page to come out of the printer after the job had been started.First I suspected a hardware problem, but when I booted it up I quickly realized that this was a bad case of "freeware congestion" combined with "pre-load-mania". When I had last set up the machine I had just put F-Secure Anti-virus, the necessary hardware drivers, Word and Firefox on the machine.Hardware-wise a Celeron 2,4GHz with 512MB RAM is not exactly a high-end machine, but for web surfing, some emails and the occasional letter it should be very sufficient.Now, about a year and a half later the login screen was followed by a desktop building up icon-wise and a colorful ICQ login even before the anti-virus software's splash screen. After that the hard drive kept working fur…

Switch/Case and Autoboxing/Autounboxing

Because I have seen people trying this several times in the last couple weeks I decided I might just as well write a post about it: A seemingly common misconception of Java 5's auto(un)boxing.While it has been a while now since we moved to Java 5 only now are people slowly getting familiar with the new syntax features. Most of them learned Java beginning with 1.4 and have a history in the DBase or FoxPro world. So object oriented programming and Java as one implementation of it are understood, however maybe not as deeply as you would expect. Some are especially impressed by the ease of use autoboxing and -unboxing bring to the wrapper classes for primitives. I also find that feature quite useful, because objects falling out of the persistence framework have full-blown object types for boolean values or numbers. This makes it rather cumbersome to work with them. Autounboxing helps a lot there: if (theBusinessObject.isCompleted().booleanValue() && theBusinessObject.getNumbe…