08.17.07
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.
SOLUTION
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
Permalink
08.14.07
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
System.out.println();
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.
Whoa!
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.)
Permalink
08.13.07
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.
Permalink
08.12.07
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.
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
Permalink
08.01.07
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.
Permalink
07.22.07
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.
Permalink
07.16.07
Posted in Hacking, robobait, Technology trends at 5:28 pm by ducky
How do you enable core dumps?
ulimit -c unlimited
(This was harder to find than it should have been, so I’m helping the world to find it.)
Keywords: core, coredump, enable, limit, unlimit, allow.
Permalink
05.09.07
Posted in Hacking, programmer productivity, robobait at 1:50 pm by ducky
I’m starting to look at a bunch of software engineering tools, particularly those that purport to help debugging. One is javaspider, which is a graphical way of inspecting complex objects in Eclipse. It looks interesting, but which has almost no documentation on the Web. I’m not sure that it’s something I would use a lot, but in the spirit of making it easier to find things, here is a link to a brief description of how to use javaspider.
Keywords for the search engines: manual docs instructions javaspider inspect objects Eclipse
Permalink
« Previous Page « Previous Page Next entries »