Archive

Archive for the ‘Software Engineering’ Category

Eclipse: Bootstrapping A New Install

November 16th, 2009 John No comments

For those of us who upgrade Eclipse regularly, it’s sometimes necessary to start ‘from scratch’ with a new installation. I’ve had cases in the past where P2 (Eclipse’s software update mechanism) couldn’t find updates, or couldn’t resolve dependencies.

There are many different causes of software update issues and it’s often quicker to abandon the update and reinstall. Sometimes I’m chasing milestone revisions, which I prefer to install fresh to avoid any preference store problems.

This procedure below is how I generally bootstrap a new Eclipse install on an existing workspace.

  1. Backup your workspace. Make a zip or a 7z file of everything that’s in there, .svn folders and all.  Put this somewhere safe.
  2. Backup your Eclipse settings:
    1. File -> Export, then General -> Preferences.
      …to a file on your desktop called eclipse.xml
    2. Check “Export All
  3. Make a note of all the plugins and addons you have installed.
  4. Shut down the old Eclipse.
  5. Download and unzip the new version of Eclipse to a new folder somewhere.
  6. Start up the new Eclipse
    • Do not allow the new eclipse to use your production workspace. Pick a new, empty one.
  7. In the new Eclipse, install all the plugins and addons you need. Do a Help -> Check For Updates and let it install any updates.
    • You’ve doing Check For Updates on a weekly basis anyway, right?
  8. When you’ve got everything installed, do File -> Import, then General -> Preferences, giving it the eclipse.xml file created in step 2.2.
  9. Now restart Eclipse, allowing it to start on your production workspace.
  10. You may need to re-apply preferences but generally it should be ok.

This procedure might seem rather long, but in reality it’s very quick and you can usually get back to a productive state in half an hour or less (depending on how many plugins and addons you have installed).

  • Share/Bookmark
Categories: Software Engineering Tags:

OSX/Cocoa UI Event Spy

October 11th, 2009 John No comments

I recently had to profile an application, and one of the metrics I wanted to obtain was the performance of the GUI, without (if possible) resorting to GUI testing frameworks. This metric would be the duration of time from when the user commanded a redraw/update, until the render of that redraw actually completed (effectively a complete client-server-client round-trip time).

To cut a long story short, there doesn’t seem to be a developer tool in OS X or XCode to spy on these UI events, but you can enable them on individual applications by supplying the -NSTraceEvents YES flag to the binary, which you must start from Terminal.

For example, here’s how you’d start TextEdit and spy on its events.

/Applications/TextEdit.app/Contents/MacOS/TextEdit -NSTraceEvents YES

In my case, I actually only wanted to have the mouse-up events which would trigger the refresh. Here’s how I did it:

/Applications/TextEdit.app/Contents/MacOS/TextEdit -NSTraceEvents YES 2>&1 | grep "Received event.*LMouseUp"

NSTraceEvents outputs the trace to the stderr stream, which is ignored by grep, so the 2>&1 is there to redirect stderr to stdout. The “Received event.*LMouseUp” regular expression selects the mouse-up events from the complete stream.

Result:

2009-10-11 16:56:13.291 TextEdit[29990:903]
Received event: LMouseUp at: 320.0,243.0 time: 199375872740000 flags: 0x100 win: 1832 ctxt: f0df data: 2531,1

  • Share/Bookmark
Categories: Software Engineering Tags: ,

Mac OS X Snow Leopard Has No Java 5 – Warning!

September 24th, 2009 John No comments

Here’s one I spent a day learning: OS X 10.6 “Snow Leopard” has no Java 5 installed, despite appearances to the contrary.

The Java 1.5 installation is actually a symbolic link to the Java 1.6 installation. There is a fix available, which essentially entails copying the Java 1.5 installation from a Leopard install, and fixing up the symlinks. It’s available here.

I found this because we have a product which must be linked against Java 1.5, or rather, the JDBC version 3 specification. We don’t yet support all the extended functionality of JDBC 4.

In Eclipse, I had selected Java 5 (= JDBC 3) as the JRE, but was still getting lots of “method unimplemented” errors for JDBC 4 (= Java 6) signatures. These aren’t present in Java 5, so they should not have appeared.

After unfolding the JRE Library node in the Eclipse Package Explorer, it was clear that, although the JRE was reporting itself as Java 5, the jars within were clearly coming from Java 6.

I applied the fix and the compiler errors disappeared – Java 5/JDBC 3 was in use again.

For (my) future reference, here are the JDK / JDBC versions:

  • JDK 1.1 → JDBC 1.2
  • JDK 1.2 → JDBC 2.1
  • JDK 1.4 → JDBC 3
  • JDK 1.5 → JDBC 3
  • JDK 1.6 → JDBC 4
  • Share/Bookmark
Categories: Software Engineering Tags: , ,

Using Eclipse on Small Screens

August 25th, 2009 John No comments

Two awesome plugins for those of us using Eclipse on screens with low resolutions:

Also to consider:

  • Is your editor font too big? Can you make it smaller and still be comfortable working with it?
  • Look at your window layout – do you have a view docked to the right of the editor – probably Outline? Do you really ever use outline?  Get rid of it if not, or make it a tab in the dock on the left.
  • Share/Bookmark
Categories: Software Engineering Tags: ,

Misleading Java Generic Errors in Eclipse

August 19th, 2009 John No comments

An incompatibility between Java source versions in Eclipse made a generics error show up as:

Type mismatch: cannot convert from Object to ILocationService.

when it should really have read something like:

Type mismatch: return type of TypeLoader is generic – this project is not.

Read more…

  • Share/Bookmark
Categories: Software Engineering Tags: ,

Reducing Tooltip Time in Eclipse 3.5 (Galileo) on Mac OS X

June 25th, 2009 John No comments

Tooltips in Mac OS X display, by default, after 2 seconds. I find this is ample time in the general operating system, but in Eclipse it’s an eternity. Eclipse uses Tooltips in the Java tooling to display all kinds of useful information, not the least of which is the javadoc for the element and the source.  Waiting for these is frustrating.

The general workaround of using OS X defaulting to change that didn’t work with previous versions of Eclipse because the SWT (IBM’s excellent widget set) was built on Carbon, OS X’s “UI Compatibility Library”, which ignored the default.  Eclipse is now available for Mac in a native Cocoa version, which does take the defaulting into account.

Here’s how to change the global OS X tooltip delay (in Terminal):

defaults write -g NSInitialToolTipDelay -int 100

I personally want to keep the 2-second delay for everything except Eclipse, so I applied the default just to Eclipse using the Eclipse bundle name:

defaults write org.eclipse.eclipse NSInitialToolTipDelay -int 100

The delay time is in milliseconds. You might have to log out and back in again to make the default take, but usually restarting Eclipse does the trick.

Nice work IBM!

  • Share/Bookmark
Categories: Software Engineering Tags: , ,

Overloading the Eclipse Job Management System

April 30th, 2009 John 2 comments

We’ve had an issue with our Eclipse-based application which would cause it to slow down exponentially under stress test.  The problem lie in the job management system:  new fast code could essentially cause it to bog down under the weight of update jobs.

Read more…

  • Share/Bookmark

Exporting “Non-Exportable” Private Keys from Vista

March 6th, 2009 John No comments

Going through the Thawte sign-up process to get a code signing certificate, I noticed that the certificate signing request (CSR) generated by Vista has the “Yes, export the private key” option grayed out.  I’m surmising that Vista marks all keys (at least those for code signing certificates) as not exportable.

This is obviously bad when you have more than a single developer who must sign code.  After beginning the process I found an article at Thawte which says ‘don’t do this on Vista!’, but I also found the Jailbreak util from iSec.  This was able to export the private key with the CSR into a PFX file.  As a test I also re-imported it from the export file and that worked fine.

  • Share/Bookmark
Categories: Software Engineering Tags:

Mysterious CPU Performance Loss Solved

February 28th, 2009 John 2 comments
mainboard

I just started to notice that the CPU in my main desktop machine was grossly underperforming, despite BIOS tools telling me it was running at nominal speed.  It’s a (now old) Pentium 4 3.0 GHz HT single core which has been fine for what I need up to now, but lately I’ve been getting massive frame-rate problems with MS Flight Sim 9.

I should get around 20 FPS (I’m using some really detailed sceneries and aircraft) but it was topping out (!) at around 4.  This is unplayable.

In the BIOS I found an option entitled “CPU Internal Temperature Control”, which apparently means that if the chip gets hot, it internally idles to prevent overheating.  This occurs while the FSB and the internal clock gen operate at the same frequency (according to Gabriel Topola’s excellent SIW – System Information for Windows.)

I turned that off and started Flight Sim.  Temperature shot up to 98°C (the last time I was able to check it) then the machine shut down – it didn’t halt, or hang, it turned off – completely.

Spring cleaning time.  I took the CPU fan off, took the CPU out of its ZIF socket and cleaned all the thermal paste off both parts.  The paste had totally broken down.  I blew out the CPU fan (outside) and a very large quantity of dust came out.  New paste, replace the fan assembly and voila – 20 FPS and the temp tops out at 55°C.

  • Share/Bookmark
Categories: Software Engineering Tags:

Eclipse Won’t Update Any More

February 26th, 2009 John No comments

If you use Eclipse with lots of plugins, eventually you might get into a situation where the Software Updates ‘feature’ doesn’t work any more.  It will find updates okay, but when you come to install them, you’ll get a message which reads something like “No repository could be found containing bundle…”.   I think I’ve solved this problem.

Read more…

  • Share/Bookmark
Categories: Software Engineering Tags: ,