Jim Roepcke's weblog have browser, will travel (est. 1999)


links for 2009-11-28

Filed under: Uncategorized No Comments

Open class listed in Java Stack Trace in Eclipse

I whipped up a little Mac OS X service today (using ThisService 2.0.2 and AppleScript).

Where I'm working right now we run WebObjects applications (which are written in Java of course) in the Terminal. If there's an exception, a stack trace is written to the Terminal. We'll find and remember an interesting stack frame from the trace (which includes the class name and the line number), then switch to Eclipse, load that class into an editor and jump to the line number.

This service automates that process. Just triple-click the stack frame's line in Terminal and activate this service. It will (using AppleScript) activate Eclipse, and then load the class using the Cmd-Shift-T keyboard shortcut, and then go to the line number using the Cmd-L keyboard shortcut. (If you have removed or changed those shortcuts, this service will not work.)

How to install in Mac OS X Snow Leopard:

Download http://files.me.com/roepcke/9zxcla

In System Preferences > Universal Access, turn on "Enable access for assistive devices".

Decompress this downloaded zip file and copy the .service file into ~/Library/Services.

In System Preferences > Keyboard, select Services on the left, and enable the "Open Selected Stack Trace line..." service. You can optionally set a keyboard shortcut by double-clicking on the right of that row. I used command-option-control-f, but it's up to you.

Note: if you set a keyboard shortcut for the service, you MUST LET GO OF THE KEYS AS SOON AS POSSIBLE after activating the service, as it works by simulating key presses in Eclipse. If you still have the keys for the service's shortcut pressed, the service will fail.

Also note, if you have multiple Eclipse instances open, I have NO IDEA which one will be activated. And if Eclipse isn't already open, it will launch an Eclipse (not necessarily the one you want if you have more than one) but will fail after that. Launch Eclipse fully before using the service!

Absolutely no warranty implied or given. I release the bundled AppleScript into the public domain.

PS: I'm not an AppleScript programmer, so I'm sure the code looks horrible, but it "works for me". :)

Filed under: Uncategorized No Comments

links for 2009-11-16

Filed under: Uncategorized No Comments

links for 2009-11-15

Filed under: Uncategorized No Comments

links for 2009-11-12

Filed under: Uncategorized No Comments

links for 2009-11-10

Filed under: Uncategorized No Comments

links for 2009-10-31

Filed under: Uncategorized No Comments

links for 2009-10-28

Filed under: Uncategorized No Comments

Dave Winer’s MacBook battery life

Dave Winer likes to talk about how bad the battery life is on MacBooks. He's always looking for a power outlet.

Maybe if Dave's OPML.app was a Universal binary and wasn't generally a CPU hog, his battery would last longer. OPML is built for PowerPC only, therefore it has to be emulated by Rosetta, and therefore using more energy than it would if it was native.

See for yourself. Download his OPML Editor, and launch it. Also launch Activity Monitor so you can watch OPML's CPU usage. Do some simple stuff in OPML like Cmd-N to open a new outline. Watch the CPU usage...

OPML's ancestor, Frontier, was written back in the day of cooperative multitasking on the classic MacOS. Yes it was multithreaded but it was never very good at yielding the CPU. Any app that sucks CPU time on a laptop (Mac, Windows, Linux or otherwise) is going to drain the battery.

This isn't the MacBook's problem.

Update: Rosyna corrects me on Rosetta - it's a dynamic binary translator, not an emulator. Thanks! So it doesn't have as much runtime overhead as an emulator (over time). As she says, "A CPU hog is a CPU hog." Gotcha.

Filed under: Uncategorized 5 Comments

links for 2009-10-26

Filed under: Uncategorized No Comments