Plugin or the Egg?

Yeah, I’m lookin’ at you, Google.

The Best Programmers Prefer IDEA

WAX (Writing API for XML)

Batman discusses WAX:

Don’t miss the exchange at the very end, after the credits.

Energy Plan

Here is my energy plan.

  • Cars and trucks will run on “gasoline”, a toxic, flammable liquid.
  • Vehicles will emit pollution that contributes to global warming and a bunch of other scary shit.
  • We’ll need “refineries” to convert oil into gasoline.
  • We’ll use big trucks (also burning “gasoline”) to haul the gasoline all over the country to “gas stations”.
  • These so-called “gas stations” will have huge underground tanks to store the gas. They may leak occasionally.
  • We can build massive oil drilling platforms, lay giant pipelines, build roads to remote sites, because fuck you Mother Nature.
  • We’ll build huge ships to transport the oil. Occasional spills are OK because they are rare and usually far away. Hardly anybody lives in Alaska.
  • We can buy much of our oil overseas, funneling trillions of dollars to foreign dictators who sponsor terrorism, treat women poorly, etc.
  • Some of these dictators will build huge skyscrapers, providing hours of “How did they build that big building?” entertainment on the Discovery Channel and TLC.
  • The same guys who give us shiny tall towers can create tax-free zones for US corporations to relocate, thus avoiding many U.S. taxes.
  • When China starts consuming more gas and oil, we can lower gas taxes and send government rebate checks to combat rising prices, thus keeping consumption high for as long as possible.
  • Coal is great for generating electricity. We can burn it and let the toxic waste dissipate harmlessly into the atmosphere.
  • We won’t allow offshore windmill farms because they may hurt a Kennedy’s ocean view.
  • Inland wind farms are too noisy and might kill some birds. The fossil-fuel thing is much better for birds. Except perhaps seagulls during an oil spill. But oil spills are rare.
  • Solar farms are a bad idea because we’d need to build more long-range transmission lines, which will harm nature, possibly even ruining pristine views in remote national parks. It’s better to cart around giant trucks and trains full of gasoline and oil.
  • Germany builds a lot of solar panels, but they also like David Hasselhoff. We don’t want to be like them.
  • Wave power kills fish. Oil spills are rare, and global warming might not kill lots of fish for 50-100 years. In fact, with rising oceans, we might HELP fish!
  • Oil gives us something to fight about.

Twitter: Leave my URLs Alone

Twitter has an annoying feature: it auto-shortens URLs. You might think this is useful given the 140 character Tweet limit, but in fact the opposite is often true. In many cases, the URL itself is self-descriptive. Let’s make up an example:

This is hilarious: http://imgs.xkcd.com/comics/freemanic_paracusia.png

That tweet takes 70 characters, and is self-descriptive. You can tell I’m linking to an XKCD comic, and you even know which one. Despite being well-within the 140 character limit, Twitter changes it to this:

This is hilarious: http://tinyurl.com/5gmpbn

They cut it from 70 to 44 characters…but why? It wasn’t anywhere near the 140 character limit. And what the hell does that Tweet describe? For all you know, I’m Rick-Rolling you. To give my Tweet context, I now have to describe it:

This XKCD comic is hilarious: http://tinyurl.com/5gmpbn

That’s 55 characters, but you still don’t know which comic I’m linking to. I could add more description:

This XKCD Freemanic Paracusia comic is hilarious: http://tinyurl.com/5gmpbn

Which brings us up to 75 characters, longer than the original Tweet with the full URL. (And I might still be Rick-Rolling you.)

Hacking a Workaround

Because Twitter does this automatically, without any explanation, I find myself spending more time on Tweets trying to find workarounds to avoid the URL tampering. I’ve tried posting URLs without “http://”, and that seemed to work for a week or so.

Then I posted this Tweet, and as you can see, they shortened AND BROKE the URL!

One surefire workaround: post an upside down URL. But that won’t render in many Twitter clients, Twhirl for one.

Content Tampering

Twitter is mostly just harmless fun, often a waste of time, but I find it enjoyable. Who cares, right? But…my Tweets are MY WORDS. Given that URLs often describe their destination, I choose my words in combination with URLs to say something specific. Cramming a coherent thought down to 140 characters is a challenging and fun exercise, and it is very frustrating when a flawed algorithm changes what I type without asking.

In fact, I think this problem is more profound. Changing what people write without asking permission is in fact a misquotation:

Omission of important context: The context can be important for determining the overall argument the quoted person wanted to make…

I argue that URLs often provide context, and our words — even URLs — should not be changed without permission. I suggest Twitter add a preference option allowing users to enable or disable this feature. Sadly, the broken URL shortening occurs whether you Tweet from the web or a Twitter client.

New Header Graphic

If you don’t see the new “comic bubble” header graphic, you may have to refresh the page, or even Shift-Reload. I find that whenever I change background images on this blog, the old images are cached for awhile.

I still need to fix the caveman favicon.ico file, but I seem to have forgotten how I created an “.ico” file in the first place. Time for some research!

I was working on a completely new theme, but everything I come up with ends up being more complex and ugly. So rather than start from scratch, I plan to incrementally tweak this theme, hopefully removing some clutter as I go.

Balloons

One of the managers where I work turned 40. This is what his team did to his cube:

Balloons

I Love Twitter

I am a Twitter junkie…tweets like this keep me coming back, day after day:

Navel gazing…yeah, right!

Cuil, Find My Keys

Cool sunglasses.

Search Engine that Can\'t Find Anything

Nimbus JTable Checkbox Rendering Bug

I ran across a Nimbus Look and Feel bug that affects the GUIs I work on. This is a known issue: see Bug ID 6723524 on the Bug Parade. It is marked Low priority, so I hope it is fixed before the Java 6u10 release. (unlike Bug 4795987, for example, which has been open since 2002 and is also affecting my GUIs).

Here is a standard JTable with Boolean values in the third column. Notice how the standard checkbox renderer fails to properly paint alternate row colors: (this is very subtle on some displays)

In this next picture, I clicked on “Jones” to demonstrate the standard Nimbus focus border:

In this next picture, I clicked on the checkbox. Notice how the border is not painted on the checkbox renderer:

Sample Code

Here is the demonstration program, it requires JDK 1.6u10 to run.

import javax.swing.*;
import static javax.swing.UIManager.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import java.awt.*;

/**
 * Demonstrates bug 6723524, checkboxes do not render properly in JTable.
 *
 * @author Eric M. Burke
 */
public class NimbusDemo extends JFrame {
    public static void main(String... args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                setNimbusLaf();
                new NimbusDemo().setVisible(true);
            }
        });
    }

    private static void setNimbusLaf() {
        try {
            for (LookAndFeelInfo lafInfo : getInstalledLookAndFeels()) {
                if ("Nimbus".equals(lafInfo.getName())) {
                    setLookAndFeel(lafInfo.getClassName());
                    return;
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        throw new RuntimeException("Unable to find Nimbus LAF.");
    }

    public NimbusDemo() {
        super("Bug 6723524");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Object[] columnNames = {
                "First Name", "Last Name", "Married"
        };
        Object[][] data = {
                {"Harry", "Smith", true},
                {"Sally", "Jones", false},
                {"Bob", "Clark", true},
                {"Eric", "Burke", true}
        };

        TableModel tm = new DefaultTableModel(data, columnNames) {
            public Class getColumnClass(int columnIndex) {
                return (columnIndex == 2) ? Boolean.class : String.class;
            }

            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        add(new JScrollPane(new JTable(tm)), BorderLayout.CENTER);
        pack();
    }
}

A Bit More Info on Balsamiq Mockups

Peldi had some questions from my earlier post, so I figured I’d answer them here.

Arbitrary Lines

Mockups supports a Vertical Rule and a Horizontal Rule. These are two separate “line” components, each is locked to its axis. I was thinking it might be simpler to have just one line component, and let the user drag, drop, and resize the line to any position, length, or angle. This would make it more like a line from a 2D drawing tool, like this:

Shapes

Mockups has a rectangle shape, and you can resize and move it. I would suggest adding a few more drawing-tool-like features:

  • In addition to resizing the rectangle, let us rotate it to any angle.
  • As you mention, add an ellipse tool. Like the rectangle, let us drag and drop, resize, and rotate.

Honestly, if we had lines, rectangles, and ellipsis, each with resize and rotate capability, we could draw just about anything we wanted to. Hell, I could use Balsamiq Mockups to create my comics.

Arrows

Peldi mentioned an arrow feature in the works. One kind of arrow might look something like this:

I suppose this kind of arrow would just be a predefined polygon that I could move, resize, and rotate. If implemented properly, Mockups could include an entire palette of polygons, each would resize and rotate the same way. In theory you could even define your own custom polygons, given the ability to draw arbitrary lines and group things together.

The second kind of arrow would be much simpler: just let us specify the shape of the start and/or endpoint of any line.

Storyboarding

I agree, make this a standalone tool.

One More Idea

Take a look at the source code for the Napkin Look and Feel. This has a neat package called sketchers that draws “jittery” lines and makes polygons look like they are hand-drawn with some randomness. You might get some good ideas from that work.