Showing posts from April, 2006

Change default printer via command line

An old application I still need to use has no way of printing to a printer other than the Windows default. It is the only program that we need to print on an ink jet with form paper. All other applications usually print on a laser. In order not to have to change the default printer manually before starting that application I wrapped it up in a little batch file. It changes the default printer appropriately with this command line: @RunDLL32.EXE printui.dll,PrintUIEntry /y /n "Canon i560" The printer name has to be the value displayed in the control panel. All available options can be displayed like this: RunDLL32.EXE printui.dll,PrintUIEntry /?

Java Source File Encoding

Some time ago we switched our CVS Server from Debian to RedHat and ran into issues with file name encodings. Now we switched to a new build machine, changing platforms from Windows to RedHat. The ant build process had run in a Cygwin environment on Windows, so most scripts could be used without changes on the new machine, too. So far the change went pretty smoothly. However our application for some reason failed to resolve some I18N text values that are stored in property files. Not all of them, but some were suddenly messed up in the GUI, as if the resource's key could not be found in the property file. It turned out to affect only keys that had German umlauts in the key part. While this is not exactly good style it had worked up to now, so we wondered what might have caused it to suddenly fail. After a while we compared the .class files (produced on the Windows and Linux build servers) of an affected dialog and indeed found a difference in the binary representation of the str

Awt_Robot and File Handles

In January I wrote about translucent windows with Swing. I found it in O'Reilly's Swing Hacks book and was pretty pleased with the results. However for some time we have been experiencing problems with our application in production (running Sun's JRE 1.4.2 on RedHat 9). They were not obviously GUI related; for some strange reason a barcode reader attached to the machine randomly stopped working. We traced and debugged a whole lot, but could not find any reason apart from a bug in the native driver layer for these (JavaPOS) devices. As a result we went to the driver vendor and had them look into it on the driver level. After a while they came up with some results which revealed that there really was a problem in the native part of the driver; however they could not find a way to reproduce it using their test tools, but only when using our application. Basically what they found was a process called awt_robot that had a file handle on a device node in the /dev filesystem

Insultingly Stupid Movie Physics

Surfing about the German c't-magazine's web site I found a link to a site about movie physics being so dramatically wrong it is almost insulting for the audience. Go have a look for yourself (the site is in English). They first offer some common mistakes that are shown in virtually any action movie and an explanation what is wrong with what Hollywood's film makers present us. After that they have a long list of movies they "reviewed" in respect to physical correctness. I really had to hold on to my chair reading some passages. Great fun and you may eventually even learn something new (as did I; see the section about throwing lit cigarettes into puddles of gasoline.)


Just a couple of days ago I returned from a vacation in the San Antonio, TX area. One day the postal office was closed, police vehicles blocking the entries to the parking lot. Afterwards I saw in the news that someone had placed a package labelled "BOMB" at the front door which led to an evacuation. Some days later I drove by there again, and again saw the police blocking the entries. However this time the center lane was also closed and there were lots of employees of the postal service taking envelopes from passing cars. It produced quite a traffic jam in both directions and I was somewhat unnerved because it took like forever to get through there. Suspecting something similar to the bomb incident (which luckily turned out to be a bad joke) I scanned the news and found that Postal workers were aiding tax filers on deadline . Has anyone ever heard of such nonsense? Why could people possibly have to wait till the very last day to file there taxes? I would very much like t

Mind Deprecation Warnings

One of our projects allows to "emergency dump" some database contents to XML files. There are multiple reasons for this, one of them being unreliable networks. However, that's not my point here. When the code detects its needs to dump out data, it creates XML files that mainly contain base64 encoded CDATA regions, because this proved to be the least problematic way to handle certain types of content. At a later time that data needs to be reinserted into the database. This works just the other way round, calling the corresponding tool in a "reverse" mode to put the decoded base64 data back into the database. The only thing the people using this stuff do not like is that they have no idea what's encoded in the base64 region. So I started to write a second output module that displayed the data from the XML to the screen instead of putting it directly into the database. To make it look nice I wanted to simply apply a stylesheet after having decoded the base64 i

Distaster Recovery

What's the difference between a backup and a restore? Right: A backup is made to preserve a known-good state for later, after something has gone wrong (so called "disaster"). A restore is the backup being re-installed after something went wrong (so called "disaster recovery") So far so good. But what about a restore that is installed when nothing went wrong and the server is just running nicely, handling lots of requests... Call that a "home made disaster". Yes: THAT'S REALLY BAD! Last week we suddenly got lots of failure reports from one of our production systems (decentralized structure). People complained about all clients failing with somewhat random error messages. We first took the stacktraces and looked at the code in question to find out why it might suddenly start failing in places that had been working fine for months. We quickly realized that data corruption must be the cause. So the next step was to do some integrity checks on the

Adobe Reader without Ads

While Adobe Reader 7.0.7 seems to be faster than 6.0 it still has this nasty little ad-display in the upper right corner of the window. This annoys me very much, but I found this tweak to turn it off. Launch regedit.exe and navigate to "HKEY_LOCAL_MACHINE/SOFTWARE/Adobe/Acrobat Reader/7.0/FeatureLockdown" . Create a new DWORD value named "bShowAdsAllow" . The default value "0" is ok, it disables the ad-display.

Head First HTML with CSS and XHTML

It's been a long time since I have actually written HTML pages... Back then ASP was state of the art (no flamewars please) and HomeSite was the editor of choice. Dreamweaver was version 2 and most image editing software was beginning to learn about GIFs and their transparency. Since then a lot has happened, and while I have been doing some XSLs at work I somewhat lost contact with state of the art website building. When I started this blog I was pleased with the pre-defined themes from a purely aesthetic point of view; but looking at the sourcecode I was even more impressed. Ok, I know what CSS classes are, how to define a background color for all td's and some other things. But seeing what's possible and how elegantly so, I really feel the urge to try some of that again. Incidentally I recently read a short summary about O'Reilly's new Head First HTML with CSS and XHTML and after reading the sample chapter I ordered a copy. Maybe this page will look different i