Terminal emulators reviewed

I spend a lot of time at the command line, so a good terminal emulator is important to me. Unfortunately, the ones that get packaged with Linux aren't that great: Konsole Terrible text wrapping support, no-reflow and newlines get inserted when you cut & paste Slow **[Gnome Terminal](http://en.wikipedia.…

Fixing IntelliJ crashes in StartupActionScriptManager

On my Ubuntu box IntelliJ began crashing on startup with an unhelpful stacktrace: chixdiglinux:intellij-idea-6$ /usr/lib/intellij-idea-5/bin/idea.sh java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2237) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2703) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:760)…

EasyMock and OutOfMemoryError: PermGen space

I wrote a test using the easy-to-use EasyMock Unit-testing API: package com.publicobject.pizzadelivery; import junit.framework.TestCase; import org.easymock.classextension.EasyMock; public class PizzaDeliveryPersonTest extends TestCase { private PizzaStore pizzaStore; private Customer customer; private Order order; private Address address; private DeliveryPerson deliveryPerson; @Override public void setUp() { pizzaStore = EasyMock.createMock(…

Extensible Properties for the Java Language

Remi Forax is leading some research on hacking in properties into the JVM. Richard Bair's latest post has inspired me to write about how I think observable properties could be implemented. I would like properties to be extensible, so that all the generic boilerplate (not just get/set) can be…

Javac bug: the order of imports is significant

The following Java code does something slightly weird - it statically imports a symbol that is defined in the same file. Although it's a little unconventional, it should be perfectly legal: package com.publicobject.dinosaurs; import static com.publicobject.dinosaurs.Dinosaur.GeologicPeriod.CRETACEOUS; import static com.publicobject.dinosaurs.Dinosaur.GeologicPeriod.…

Google Code Search IntelliJ plugin

I'm thinking about developing an IntelliJ plugin that does Google Code Search. This will let me try out some new Glazed Lists features in a fun way. IntelliJ is good Google Code search is good What are some potential uses? Whenever I'm using a new API (like EasyMock or WebWork)…

System.getProperties() on Vista

I'm running Sun JDK 6 RC on Windows Vista RC 1, Build 5600. Here's what System.getProperties() reports... awt.toolkitsun.awt.windows.WToolkitfile.encodingwindows-1252file.encoding.pkgsun.iofile.separator\idea.launcher.bin.pathC:\Program Files\JetBrains\IntelliJ IDEA 6.0\binidea.launcher.port7533java.awt.graphicsenvsun.awt.Win32GraphicsEnvironmentjava.awt.printerjobsun.awt.windows.…

All the Vista Search Fields

For the Glazed Lists project I'm thinking about developing a Swing search field that looks like the standard one on Windows Vista. I gathered some screenshots from Long Zheng's blog, which leads me to believe there isn't a 'standard' search field on Vista... Vista ClassicAero Glass![](/publicobject/stolen/searchbox/explorer_…

ListEvent & the deleted element

I'm working on making the deleted element available in every ListEvent. The difficult part is providing that value when the EventList is describing its change to its listeners via our ListEventAssembler API. The ListEventAssembler and ListEvent provide a lot of functionality that developers don't even have to think about: When…

The Vista UI Guidelines

I just browsed through the Vista UI Guidelines. As far as I know, the Windows Vista release is all about making Windows fun to use, and the UI guidelines provide the rules of the game. But I think they missed this critical opportunity to fix some things... Label buttons like…

JXTable multiple column sorting

Tonight I fixed Glazed Lists Issue 365 by adding multiple-column sorting support for JXTable. The new code works just fine but I think users will still be better off with the TableComparatorChooser approach for a handful of reasons: it's more programmable the right icons for each look and feel multiple…

Swing Tutorial demo requires Java 6!

Since I'm working on new TreeList support for Glazed Lists, I decided to go through Sun's fantastic Swing Tutorial. Although it's a really useful resource, it is still really rough around the edges. For example, instead of a Mac screenshot, there's the text [PENDING: Mac pic goes here]. Engineering teams…

Glazed Lists on Java Posse #76

I'm a big fan of The Java Posse podcast. It's a weekly audio show that covers all things Java. But beyond the regular news are insightful, fun and concise commentary by some really likeable guys! The show's lead, Dick Wall is a technologist. He tries out a lot of Java-related…

Speed up REST with HTTP Pipelining

Lots of apps download data over HTTP. It's what we use for the Issues Browser demo, and our up-and-coming Amazon Browser demo. In the simple web service paradigm REST, HTTP is the transport layer. HTTP is not just for web browsers! If you're writing an app that uses HTTP, you…

Don't buy from ip01.net, they're spammers!

Shortly after registering a domain, I got an unsolicited email from ip01.net, offering to host my domain with them. Unsolicited commercial email is spam, and ip01.net is a spammer! Avoid doing business with ip01.net.…

SortedList, now faster

Externally, Glazed Lists is all lists. No other ADTs - no heaps, trees or graphs - just lists. But internally, much is implemented using trees. For example, FilterList remembers which elements are filtered out using a custom AVL-tree called Barcode. SortedList maps indices using two instances of our custom IndexedTree…

Wanna download iTunes shared tracks? Get Git!

If you use iTunes streaming, you'll know how annoying it is that you can't download other user's tracks. Get It Together is a pretty simple Java app that solves this problem. If you've got two computers and you need to move music around, it's a great tool in a pinch.…

Using m4 as a macro processor for Java, the nice way

For reasons I won't disclose, I've come to need a macro processor to generate a bunch of .java files. Somebody at work is using m4 for a similar task, so I decided to try it. Unfortunately, using macro processors with Java brings a huge problem - you typically cannot use…

Fine grained events: for performance

One critical difference between Glazed Lists' EventList and Swing's ListModel is that Glazed Lists uses fine-grained events and ListModel doesn't. What's the difference? First, lets compare the APIs: Classjavax.swing.event. [ListDataEvent](http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/event/ListDataEvent.html)ca.odell.glazedlists.…

JSR 295: the future of observable lists?

JSR 295 will create a spec to bind plain old Java Objects to Swing components. Its a great idea which will increase productivity for Swing developers. Ultimately the spec will include bindings from java.util.List to components like JTable and JList. This tiny subproblem is what I've spent the…

Why there's no String.getCharset()

With Java's String class, there's a 2 arg constructor that takes bytes and charsetName: byte[] characters = { 83, 87, 65, 78, 75, 46, 67, 65 }; String myString = new [String(characters, "ISO 8859-1")](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[],%20java.…

Tuning Java Performance? Think Japex

Unit testing has spawned a new type of development, test driven development. In TDD, test coverage leads the way in development, and it's a great way to develop new functionality. Unfortunately performance tuning hasn't kept up with unit testing in terms of tools support and ubiquity. Usually when Java developers…

Canonical path of a file in Bash

In Java, it's pretty straightfoward to take any abstract pathname (such as ~/Desktop/regina.jpg) and convert it to it's canonical pathname, /Users/jessewilson/Desktop/regina.jpg. Sometimes I find myself needing this function when writing simple shell scripts in Bash, and Google Groups showed me how. Save the following…

VB on the JVM

For years, we Javaers have been comparing Swing to VB, particularly with respect to ease of development. The conclusions usually involve Swing being much more difficult and much more powerful. I agree with this, but I also think Swing left out some critical APIs for way too long which made…

Glazed Lists 1.6

The next rev of Glazed Lists is out, 1.6.0. This is an interim release while I try to find time to rework how ListEvents are created, stored and managed. Hopefully things will get a lot more powerful for 2.0, and this paves the way. Plus James has…

SimpleDateFormat considered harmful

There's been some discussion on the lists at work about SimpleDateFormat. Apparently it's not safe to be used by multiple threads simultaneously, despite the fact that the format() method doesn't appear to mutate the state of the object. It's a huge design flaw that has bitten many a developer in…

Why no API docs?

I'm preparing the latest release of Glazed Lists, and as with every release I'm going to post the Javadocs online. Posting the Javadocs on the public Internet is pretty easy and it provides some nice benefits: The project becomes Googleable. [http://google.com/search?q=BasicEventList](http://google.com/search?…

Both Rich and Thin

There's an ongoing battle between rich and thin applications. Rich client applications like iPhoto are powerful and productive. Thin client apps like Flickr are easy and connected. Lately, it seems like the industry is going thin, but I think eventually both application styles will converge. Internet applications with rich-client frontends…

Corel Draw 11 crashing on Mac OS X? I have tips!

Last night I ran software update on my Mac Book Pro, bringing me up to Mac OS X 10.4.6. And today? Corel Draw 11 crashes on startup! Thread 2: Crashed (0xb7fffabc, 0x82fc9d1f) 0x8387196c: /Applications/CorelDRAW 11/Required/Programs/MacUtilities.DLL.cfm/Contents/MacOS/MacUtilities.DLL [CFM] : + 0x896c 0x83870ea4:…

Mac OS X Update 10.4.6 Update kills my Mac

I'm usually a really big fan of the Mac OS X Software Update app. It's easy to use, automatic and mostly nonintrusive. But after applying today's update, my shiny new Mac Book Pro stopped booting! ![Booting](/publicobject/stolen/booting.png) Each time I rebooted, it beachballed on or right before…

Rounded Corners as a Swing Border

In order to get a desired effect in the Glazed Lists issues browser, I created a border with rounded corners, a la Web 2.0. Implementing the painting logic was tedious, but not particularly difficult -- there's a lot of "magic-numbers" Java2D code to write, such as offsetting…

Defending UnsupportedOperationException

I just listened to super-smart guy Elliot Rusty Harold critique the Java Collections API on his recent Javapolis interview: In the Java Collections API, I really do not like the UnsupportedOperationsExceptions. I do not like that given a list I don't know whether I can actually add something to this…

An IntelliJ live template for Swing developers

Whenever I'm prototyping Swing code, there's lots to remember about getting a component on screen: invokeLater() for thread safety setDefaultCloseOperation() to clean up after myself pack() and setLocationRelativeTo() for a convenient frame To make this easier, I've created a Live Template for IDEA. Add this to your collection of live…

James' Screencasts in the IDEA Blog

Today's IntelliJ blog makes mention of the Glazed Lists screencasts, and how they use IntelliJ. Fantastic! Some lovin' from our Swing-commanding friends at JetBrains is always welcome. We're gearing down towards a new Glazed Lists rev, with a whole bunch of new functionality and the bugs that come with it.…

HP Scanner software sucks, so does snapfish.com

I need to send some confidential documents to the immigration team at my new job. So I scan the documents on my girlfriend's HP Scanner, then use the 'email' function to send the documents to myself. The software asks my email address, I tell it. Life is good. But instead…

Undecorated Icon JButtons

If you want your JButton to have no decoration across the standard look and feels, there's two things you need to do: JButton myButton = new JButton(myIcon); myButton.setBorder(BorderFactory.createEmptyBorder()); myButton.setContentAreaFilled(false); setBorder prevents the Aqua look and feel from drawing a glassy aqua button We need setContentAreaFilled…

Burned by wildcard imports and SwingWorker

The following code uses com.publicobject.swing.SwingWorker from the Java tutorial: package com.publicobject.demo; import com.publicobject.swing.*; import javax.swing.*; public class HelloWorldWorker extends SwingWorker { private final JLabel label; public HelloWorldWorker(JLabel label) { this.label = label; } public Object construct() { return "Hello World"; } public void finished(…

CorelDraw 11 for Mac is dead

I get the feeling that a recent software update for Mac OS X 10.4 has broken compatibility with CorelDraw 11, causing Corel Draw 11 to crash on startup. My Mac OS X crash reporter message looks like this: Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at…

Buy.com sucks, so does greatfunonline.com

After buying something at buy.com, I was presented a link labelled, "get $25 back from your purchase". I clicked the link without reading the fine print that it accompanied: This click caused my my Visa number to be sent from [Buy.com](http://buy.com) to [greatfunonline.…

Shrink your Jars, its easier than you think!

James just referred me to the Ant <classfileset>. It examines dependencies between your .class files and removes any of the ones you don't actually need at runtime. Why is this useful? Suppose you're building an app with some Jakarta libraries. Inevitably, you'll get the 2 classes you need,…

Fix your JScrollPane's resizable corner under Aqua

Regular mac windows have a grippy control in the bottom right hand corner that allows you to resize the window. Unfortunately, most Swing apps don't take this control into consideration, and it's painted right over their precious scrollbar buttons! Here's two versions of the same application, before and after fixing…

mirrors.playboy.com

Now serving only the hottest in opensourceware:…

Java 5 on Mac crashing, burning? Blame SWT, of course

I was having a weird problem with a Java Swing app crashing and burning on my Mac, with this crazy exception: JavaAWT: NSException not handled by native method. Passing to Java. java.lang.RuntimeException: Non-Java exception raised, not handled! (Original problem: Error (1002) creating CGSWindow) at apple.awt.OSXOffScreenSurfaceData._copyNSImagePixels(…

Kwikr for Flickr

We haven't finished our ambitious Quickr project yet, but I still wanted to download all my Flickr photos at full resolution for use in an iPhoto project. The solution was so simple it hurts. I needed: A [key](http://flickr.com/services/) for the Flickr web services API [Flickrj](http:…

One Action for one clipboard

In our app at work you can copy data to the clipboard from text fields, tables, graphs and probably more. The problem was that we needed 'cut', 'copy' and 'paste' actions in the Edit menu on the menu bar, and those actions needed to act upon different components when invoked…

Empty array, comma

Pop Quiz What does the following program print? public class FunkyArray { public static void main(String[] args) { System.out.println(new Object[] { , }.length); } }…

Swinger Hack: Blow your stack

Here's a common Swing problem. You're a _XYZ_Listener and you've just received a fresh new _XYZ_Event. So you make some changes to XYZ, coloring it blue, doubling its value and removing its tartar sauce attributes. Unfortunately this all fails with an unpleasant error: _XYZ_ cannot be modified by…

Launchd & Tomcat

Launchd is amazing. It's predictable, simple, easy and correct. When Apple makes an app like Launchd in 2005, it makes me wonder what the hell Sun, HP and IBM were doing while improving UNIX for the last 30 years. Regardless it's my new favourite thing and it's much better than…

Stupid Bash Tricks: Open a file

Frequently I'm working from the command line in my Mac OS X box, and I want to open a file in my editor. With my file-type associations set, this is as easy as $ open ./source/ca/odell/centricclient/Contact.java`</pre>The only problem is that I'm a…

Mac OS X Mail Crypto and GMail SMTP

2004 has a great article on how to set up crypto for Mac Mail, without any plugins, self-signed certificates or even command line configuration! Here's all you need to do to sign messages: Create a certificate through [Thawte](http://www.thawte.com)'s free web of trust. Download that certificate…