Posts

When we tried to clean up a rather large (4.500.000 rows, 20GB) InnoDB table some days ago, we were astonished by the time MySQL took to complete the task. We had already LIMITed the transaction size, but every single chunk still took minutes to execute. The table itself contains some number columns, including a numeric primary key, and a blob. The delete condition was mainly based on the primary key (being smaller than a predefined value) and status field. After some mails between the support crew and us an optimizer bug was identified: MySQL Bug #28554.The problem is that in some cases the optimizer makes a bad choice concerning which index to use. It will pick a secondary index that can be used to cover a WHERE indexed_column=<constant> condition, even though it will cause way more data to be scanned than necessary. The primary key for the second condition pk_column<=<constant> would be a far better choice, visiting only a much smaller number of rows.The bug has been…

I recently changed my health-insurance company. Today I got a letter asking me to return my insurance card or notify them in case I destroyed it myself. So I thought I might just fax them an image of the destroyed card. Because Fritz!Fax works beautifully in my virtual XP box, I wanted to get my Canon LiDE Scan 70 installed in the VM (no Linux support...). I downloaded the most recent driver from Canon's website and installed it.Unfortunately I only get blue screens as soon as I "connect" the scanner to the virtual machine using the VMware server console. Being somewhat disappointed I will now have to boot up the RealThing(TM) Windows partition again...

As a part of an ongoing project I had to write a little on-screen keyboard. It is a very simple thing: Just a panel consisting of a series of JButtons that - when clicked - insert KeyEvents into the EventQueue to enable any Swing text component to be used. I do not have the original code at hand right now, but I reconstructed it at home:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class TestTool extends JFrame {
private JTextArea textArea;
private JButton btnA;
private JButton btnB;
private KeyEvent createEvent(Component aSrc, char aChar) {
return new KeyEvent(aSrc, KeyEvent.KEY_TYPED, System
.currentTimeMillis(), 0, 0, aChar);
}
ActionListener btnLstn = new ActionListener() {
public void actionPerformed(ActionEvent e) {
EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
if (e.…

This is the second part of the "Howto write a FindBugs Bug Detector" (see the first part here). To understand why one would write the kind of detector mentioned here, you should read the first part if you do not already know it.Last time I presented a detector that is able to detect static fields of the types java.util.Calendar and java.text.DateFormat. While declaring fields like this may be suspicious, there is not necessarily something wrong with the code. The real danger comes from calling methods on suchlike fields, especially if they are not synchronized to protect them against concurrent access. So in this article we will extend and improve the existing detector to cope with this problem.Something to chew onThis a simple class that uses a static Calendar instance. It does not really do much, but the shorter the program, the easier to understand its bytecode (this is what we need to do this time).
import java.util.Calendar;
public class StaticCalendarSample3 {
pub…

SAP's Markus Kohler wrote a blog entry about their Memory Analyzer tool I blogged about some days ago. It includes a flash based walk-through video about its core features. It also includes a download link. I did not try to download, because I have the DVD from jax.07. The blog says "for free", so I am not sure if the tool is really limited to a 30 day trial (as is the Netweaver Composition Environment which includes it).