Monthly Archives: May 2011

How to convert html entity characters to normal text with jquery

I display Google Local Search results in custom InfoWindows and text input fields. Recently I discovered that if place titles have html entity characters in their name such as ", they show up in their encoded forms if I print them with:

$(obj).text(title);

One way to convert/decode to normal text:

$(obj).text($('<span/>').html(title).text());

I agree, it’s not very pretty. If you know a better way please let me know!

How to generate UML diagrams from java source code

I want to create good documentation of the classes and their relationships in my Java project but without drawing it all by myself. And if there are changes in the future it would be great if it can be automated. After a brief search and trying different products, eUML2 Eclipse plugin seems quite nice for this purpose.

http://www.soyatec.com/euml2/installation/

The installation did not work according to the docs, I also needed to install GMF SDK. In the “Install New Software” dialog simply type “gmf”, and the download site should show up in the list, like this:

GMF Update Site – http://download.eclipse.org/modeling/gmf/updates/releases/

After installing GMF SDK the eUML2 install worked fine. Here’s a tutorial to get started:

http://www.soyatec.com/euml2/documentation/com.soyatec.euml2.doc/gettingstartedwithclassdiagram/firstDiagram/creating-1/index.html

Testing applets without a browser

I don’t like applets. They are troublesome and slow. But that doesn’t change the fact that sometimes I still have to work with it.

I was having some difficulties testing an applet in Chrome. At first the Java Console came up when I clicked on the failing applet, but then it disappeared and I could not bring it back. It also takes ages to load applets, very inconvenient for debugging.

Luckily there is a way to test applets without a browser, with the appletviewer command line tool:

appletviewer applet.html

It’s not perfect though, because the environment can be very different when you run the applet from the command line and when it is executed in a browser. So after testing outside a browser you probably have no choice but to repeat your tests in a browser too.

How to delete files safely on Mac

Melt your harddisk. Melt the whole computer. Drop in a volcano, or hot magma.

I was actually looking for something like the shred tool in Linux, but for Mac. There is something similar on Mac OS X and it’s called srm. To shred a directory recursively:

srm -r path_to_dir