idea for programming tool

Posted in Hacking, programmer productivity, Technology trends at 10:36 am by ducky

As I work, I find myself asking a question over and over “how do I get information from point A to point B?”. For example, “How do I get the position of the active editor from EditorSashContainer into TabBehaviourAutoPin?”

It seems like there is probably room for a tool that figures out a path from point A to point B.

This might also make the code more maintainable — instead of me going and making new methods in the chain from A to B through six intermediate methods, maybe the tool can find a path that goes through only two classes.

I can imagine the tool giving me the shortest path through public methods, and (if it exists) the shortest path that requires private variables or methods. Maybe it would find that there is a private variable that, if I made a public getter, I could use.

UPDATE: my supervisor (“advisor” in the US) pointed me at a paper describing a system (Prospector) to do just that. Alas, I haven’t been able to find any code for it. The code is at here, and there is also a web interface (which knows about J2SE 1.4, Eclipse 3.0, and Eclipse GEF source). The plugin also unfortunately seems to be too downrev for me. 🙁

There is also a tool called Strathcona which does something sort of similar — it finds examples of existing code that goes from A to B. I don’t think that would have helped me with the specific things I was looking for, because I don’t think there was any existing code anywhere that did all of what I wanted to do. It might have helped me get from A to C and then from C to A, however.


meme: non-Indo-European programming languages

Posted in Hacking, Random thoughts at 1:30 pm by ducky

I had a very interesting lunch yesterday with Dan Delorey, who is a PhD student at Brigham Young University and interning at Google Kirkland.  While we covered a wide range of topics, there was one meme of his that stuck with me through most of the (four-hour) drive home:  Almost all of the programming languages today were developed by men whose native tongues were Indo-European languages.  (Obvious exception:  Ruby, by Yukihiro Matsumoto.)

What would a language developed by someone with a non-Indo-European background look like?

What would a language developed by someone whose mother “tongue” was sign language?

I was reminded of something I saw ten years ago: a woman commented that if a woman had invented the WIMP interface,  there would have been two cursors.


robobait: difficulties setting up Eclipse for plug-in development

Posted in Eclipse, Hacking, robobait at 10:40 am by ducky

It took me way longer than it should have to get setup for my current project. I need to change some very fundamental behaviours of Eclipse. There is a plugin that does 80% of what I want, so I need to modify it.

I checked the plugin out of Eclipse’s CVS, but I couldn’t get at the Eclipse source (e.g. when I tried to do F3 or control-click on a class or method). I tried downloading the entire Eclipse source, but

  • I got tons of errors because the projects weren’t set up right to refer to each other, and setting them up by hand would have been a nightmare.
  • Everything got dog-slow.


It turns out that I needed to first download the plugin from CVS, then convert it to a plug-in project. (Right-click on the project, then select PDE Tools, then select Convert Projects to Plug-in Projects.)

That gave me access to a lot of source, but not all of what I needed. To get other source, I needed to do

File -> Import -> Plugin&Fragments -> Project with source folder

then select the packages that I wanted the source for, Add, and then Finish.

Keywords: eclipse development, all eclipse source, attach source eclipse


semi-robobait: macros in Eclipse

Posted in Eclipse, Hacking, programmer productivity, robobait at 3:26 pm by ducky

Cool! Eclipse has keyboard macros! Eclipse calls them “Editor Templates”, and has a bunch of them predefined. For example, if you type

sysout Cntl-SPACE

it converts that into


with the cursor in the middle of the parens. Similarly, if you type

for Cntl-SPACE

you’ll get a short menu of options; selecting the first one (“iterate over array”) magically converts into

for (int i = 0; i < array.length; i++) {


with the first “i” selected If you type in “fooIndex”, then all the “i”s in the line change to “fooIndex”. Pressing tab takes you to the “array”, where you can then type in the name of the array. Press return, and then you are sent to the middle of the curly braces.


My old housemate, Chris Beekhuis, once set up macros like this and said that it made his coding significantly faster. I’m very much looking forward to using Editor Templates, and am a little puzzled as to why their existence isn’t being shouted from the rooftops. (Or was it? Did I have my headphones in at the time?)

(To see all of the pre-defined macros — or to define your own — go to Window->Preferences->Java->Editor->Templates. Or press Control-3, type “template”, and Editor Templates will be one of the options.)


semi-robobait: way cool Eclipse keyboard shortcuts

Posted in Eclipse, Hacking, programmer productivity, robobait at 12:07 pm by ducky

I found two really cool Eclipse keyboard shortcuts today.

  • Quick Access (Control-3): This brings up a dialog box. Start typing, and it will present a selection list of windows whose title contains the text you just typed. Thus, if you type “expl”, it will present “Package Explorer”, “CVS Package Explorer”, “Project Explorer”, and so on. You can also type the names of the files that you have open, e.g. “foo” to get “Foo.java” as a selection option. (It does not take you to method names or classes, just window names.) Way cool. I think I’m never touching the mouse again. Ever.
  • Word Completion (Alt-/), aka “hippy completion”: When you are editingcode, you can type a few letters, then Alt-/, and Eclipse will fill in the rest of the word with a guess as to what you meant. For example, if I type “Fo”+Alt-/, it might present “FooFactory” first, then “FooTemplate”, then “ForeignFilmDatabase”, etc. When it reaches imagination failure, goes back to the first one. It is case-aware, so it would not present “for” or “format” or “foo”. It seems to be pretty clever about its guesses, too.


robobait: gd library bug – horizontal lines

Posted in Hacking, Maps, robobait at 11:12 pm by ducky

I had had a problem with horizontal lines in my census maps mashups for a long time.  Note the line at the bottom left.

Horizontal line bug

I was sure it was a bug in my code because the graphics library that I used, gd, was extremely mature and heavily-used.  (Way back in 1994 or 1995, my then-office partner Carlos Pero was using gd for Carlos’ Coloring Book!)

It turned out to be a bug in the gd polygon fill code. The fix turned out to be a very small number of lines of code, so if you are having problems with horizontal lines occasionally appearing in your images, look there.

More keywords: libgd, gdlib gd lib, flat, fill polygon, colored polygon, horizontal line, missing line, extra line, flat line, sideways line

census maps mapplets

Posted in Hacking, Maps at 10:53 pm by ducky

James Macgill prodded me to turn my census maps into a mapplet, and so I finally made a census mapplet.

Most of you are probably wondering what a mapplet is. A mapplet is a Google map that has been encapsulated in a way that makes it easy to combine with other mashups. To see them, go to maps.google.com and select the My Maps tab. You’ll see a list of mapplets next to checkboxes.

I’ve been enjoying playing with combining my demographics maps with other mapplets, like

  • population density + sea level rise
  • various demographics + real estate listings
  • % black + Chcago Transit Authority lines


robobait: Prefuse histograms

Posted in Hacking, robobait at 2:02 pm by ducky

I’ve recently been working on showing histograms using the Prefuse framework. I released five files today to help with that:

  • BarRenderer.java — renders x,y coordinates as a bar that goes from x,0 to x,y
  • HistogramTable.java — a Decorator that takes a Prefuse Table object and creates another Table (as a subclass) that has two columns for every column of the source: one column to define the range of a bin and one that says how many objects are in that range.
  • HistogramGraph.java — a JComponent subclass which displays a graph for a bin/count pair of a HistogramTable.
  • HistogramFrame.java — a JFrame subclass which lets you switch between all the data columns in a histogram and also lets you reset the bin count on the fly.
  • HistogramTableTest.java — JUnit4 tests for HistogramTable.

Known bugs:

  • There is a bug somewhere that manifests itself in HistogramGraph. If you select “Species Name” and then “Petal Width”, the first two x-axis labels are species names instead of numbers. I’ve looked at this enough to decide that it is quite possibly a Prefuse bug, and that it was not worth my time to try to fix it.
  • I only recognize two types of column, numeric and string. I don’t distinguish between ints, floats, and doubles. Everything else is a string.
  • I haven’t tested with boolean columns. I suspect that it will treat them as strings, and so it might just happen to do the right thing.
  • I haven’t tested with derived columns. It might accidentally work, but I don’t know.

I encourage people to give me feedback on these. While I’ve done a lot of coding, I am relatively new to Java, so am quite willing to believe that I did something in a suboptimal way.

Administrative note: I’ve made a new category “robobait” for postings whose purpose is primarily to alert search engines to the existence of some other page.  These are likely to be less interesting to human beings.

I’m also going to put “robobait” at the beginning of posting titles for robobait postings.


robobait: prefuse labels on graphs

Posted in Hacking, robobait, Technology trends at 10:04 pm by ducky

I’ve been working with an open-source visualization library called prefuse for a while. It’s used quite a bit, but mostly for graph visualization. I’m trying to use it for chart visualization. (Why? Because I also want to do graph visualization, and I figured — perhaps wrongly — that it would be better to learn the tao of one library well than two poorly.)

There are almost no examples out in the wild of how to do charts with prefuse. Here, then, is a link to ScatterPlotWithAxisLabels.java. Humans, you probably don’t care about this, this is just to let the robots find it.

It is a variation on the program ScatterPlot, but with axes labelled. You wouldn’t think that would be a big deal, but there are a lot of little things you have to get right, and with few examples, it is hard to know what you have specify and what is the default behaviour.

More on why Linux will win / gnumeric customer support

Posted in Hacking, Technology trends at 10:43 am by ducky

(Ooops, I wrote this a while ago and forgot to post it.)

In my recent post, Linux on the desktop, I mentioned that oocalc and/or gnumeric had let me down six months ago when I was working with an admittedly challenging spreadsheet. (It contained LOTS of obscure fonts from around the world.)

Within three days, I got a posting from one of the maintainers of gnumeric, asking me for more information. This is why Windows is doomed. I can’t imagine getting email from someone at Microsoft asking me for more information about a bug based on a posting in what is a pretty obscure blog.

Unfortunately, my problems were such that I couldn’t write a good bug report on it. (If I could have, I would have done so at the time. I consider writing bug reports one of the obligations of using open-source software.) At the time, there was a long, long delay between whatever-I-did-to-corrupt-the-file and my discovery of the corruption. My bug report would have said something like, “I worked for three hours, saving regularly, and at the end of the three hours, I discovered that my file was corrupt.” Alas, that kind of bug report is probably worse than no bug report, as the best that a triager could do is say WORKSFORME.

I did go back through my notes, and it looks like oocalc was the original offender, and that I switched to gnumeric at least briefly. I didn’t see anything in my notes that gnumeric let me down. However, I don’t see any .gnumeric files in the directory, and I would think that if gnumeric was working smoothly for me, I would have left at least some .gnumeric files around.

Note, though, that I had these troubles in November 2006, which is about 56 dog-months ago. I would be surprised if they had made no progress since I had trouble, and (to be fair!), the spreadsheet that I worked on was a very challenging one.

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »