Wednesday, July 21, 2010

Eclipse debug running very slow

I hit a problem developing with App Engine which took me a long time to figure out.  I have been flipping between projects so didn't really notice when GAE and GWT started so run so slowly.  I have also been experimenting with JRebel and messing with JVM memory parameters.  Well "suddenly" every started running really really slowly and App Engine would take around 10 minutes to start up and run my 6 async parallel queries.  Was it the new version of App Engine Java introducing a concurrency problem?  Was it that my local datastore local_db.bin was too big - holy shit its 10MB!

After a lot of kafuffle I finally removed all break points and viola - Every thing was lightening fast again!  Even though they were not being hit they somehow slowed the dev server down to a crawl.  What a massive waste of time.

Wednesday, March 17, 2010

GWT Eclipse and testing with Parallels

I use Parallels to run IE6, 7 and 8 for testing my GWT site. I use Bonjour to easily find my local server running on the mac without fiddling with ip addresses that change often. From a windows VM I use something like http://my-computer-name.local:8888/?gwt.codesvr=my-computer-name:9997"

Suddenly after upgrading GWT to 2.0.2 this stopped working - at least the GWT part did but the page still loaded.

The trick is to add an argument to the launch config: -bindAddress 0.0.0.0

Seems that 2.0.2 added a new feature to only bind to localhost by default.

Author name JavaDoc on Eclipse Mac

To change the author name from you login name like "john" to your full name and email like "John Patterson " open the Application bundle by right clicking on the Eclipse app and selecting "Show package contents". Then edit the MacOS/eclipse.ini file to include the line:

-Duser.name=My Name

Restart Eclipse and voila!

Tuesday, February 23, 2010

GWT and Google Maps - Opening an Info Window on a Marker

I am using the Google GWT APIs library to use maps on www.targetrooms.com

Opening the info window at a certain location worked fine but when I tried to open it over a marker an error was thrown.

This works:

map.getInfoWindow().open(latLng, content);

But this:

map.getInfoWindow().open(marker, content);

throws this:

com.google.gwt.core.client.JavaScriptException: (TypeError): b is
undefined
fileName: http://maps.gstatic.com/intl/en_ALL/mapfiles/193c/maps2.api/main.js
lineNumber: 1224

By using FireBug to break on the exception I found that the maps were looking for an anchor point for the info window:

line 1224: b=a.infoWindowAnchor

So by setting an anchor point on the markers icon before using it like so:

icon.setInfoWindowAnchor(Point.newInstance(10, 10));

MarkerOptions options = MarkerOptions.newInstance(icon);

Marker marker = new Marker(latLng, options);

the info window now opens as expected.

Saturday, September 5, 2009

We have Twig!

I have just made my first commit to Twig on Google Code: http://code.google.com/p/twig-persist/

This is my first open source project and in all likelihood my last. I worked quite solidly for two weeks on it although at first I imagined it would be 3 or 4 days work. So probably one of my more accurate predictions actually!

My meagre unit tests pass and now I can spend some time actually using it on a real project before alerting the rest of the app engine crew that there has been a shift in the force. JDO is not my father... it is a piece of shit.


Tuesday, August 18, 2009

GWT - Unhelpful RPC serialization message

There are a number of causes for this error message:

com.google.gwt.user.client.rpc.SerializationException: Type ‘blah.blah.blah’ was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.

Check: I have a no args constructor (private is OK)
Check: I have implemented IsSerializable
Check: It is on my source path for my module - in

What else could be wrong?

It turned out that one of the fields within my class was not Serializable due to not implementing IsSerializable.

Sunday, August 16, 2009

Recover deleted photos on a Mac for free!

Oops... someone deleted all the photos on the camera after our holiday instead of just one. It was Mr or Ms nobody. Fear not, because as long as you don't fill the camera with new photos the old ones will still be there - just hidden from the operating system.

Firstly you need a usb card reader so your computer can get direct access to the "drive". I bought a cheap one from Tescos here in Thailand for 140 baht (3 quid) that reads my large CF card and many others.

I downloaded a free demo of a program called PhotoRecovery for Mac by AppleXsoft that found my photos but wanted 50 bucks to give them to me. That gave me the confidence that they were indeed still accessible so I googled on the interweb a bit more and came up with this:

http://www.cgsecurity.org/wiki/PhotoRec

It is a command line tool you can download or you can install it straight from the brilliant MacPorts by typing

sudo port install testdisk



TestDisk is the package that contains the photorec command.

Now type "photorec" and the UI kicks in to guide you through the process of selecting the drive etc.



I chose the drive by guessing from its size - my card was 1GB so I chose the 991 MB option

Then I had to guess a filesystem type - I chose EFI for lack of a better idea.

Then I chose where to save the files and the program started doing its thing. Like so:



and low and behold the damn thing worked like a charm and spat out all my deleted photos into the folder I chose.


Sing hallelujah!