Thursday, December 17, 2009

Run jQuery QUnit tests from Java

QUnit is a powerful, easy-to-use, JavaScript? test suite. It can be used to test jQuery code and jQuery plugins as well as any generic JavaScript? code. Like JsUnit or any other javascript testing frameworks, QUnit needs to be run in a web browser. How good it is if we could run QUnit from Java code directly and don't need to worry about how to construct a web page and load it up with a browser?

Here we introduce one way to implement the above idea. The basic idea is to use Java 6 http server to run a web page created by Java code. A web page is created dynamically using Java to include QUnit tests and TelluriumJunitTestCase is extended to automatically open the web page in a web browser.

More details on

http://code.google.com/p/aost/wiki/RunQUnitFromJava

Wednesday, December 16, 2009

Google’s Safe Browser

Just got to know that Google provides a safe browser capability from the blog

http://webhostinghelpguy.inmotionhosting.com/web-hosting/website-security-part-2-detecting-a-hack/

The URL pattern is

http://www.google.com/safebrowsing/diagnostic?site=http://www.yourwebsite.com

For example,

http://www.google.com/safebrowsing/diagnostic?site=telluriumsource.org

Sonar: an open source quality management platform

Sonar is an open source quality management platform, dedicated to continuously analyze and measure technical quality.

http://sonar.codehaus.org/features/

Sonar is a really powerful tool and it can analyze your code and report various code format problems, potential bugs, test coverage, and a lot more.

Sonar is very easy to set up, simply unzip, modify the configuration, setup mysql data store, and run it.

http://docs.codehaus.org/display/SONAR/Install+Sonar

After that, you can go to your Maven project and simply run

Maven clean install sonar:sonar

All results will be pushed to the sonar data store and now you can view all of them from
your web browser, even look at the code snippets that may cause some problems.

Thursday, December 10, 2009

jmap

jmap is a command to dump the heap of a running application. Here is a good blog on this topic:

http://blogs.sun.com/alanb/entry/heap_dumps_are_back_with

For example, run the following command and you will see the result:


> jmap 5631
Attaching to process ID 5631, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 14.3-b01
0x0000000040000000 49K /usr/java/jdk1.6.0_17/bin/java
0x0000003747a00000 180K /lib64/ld-2.11.so
0x0000003747e00000 2348K /lib64/libc-2.11.so
0x0000003748200000 30K /lib64/libdl-2.11.so
0x0000003748600000 199K /lib64/libpthread-2.11.so
0x0000003748a00000 615K /lib64/libm-2.11.so
0x0000003749200000 56K /lib64/librt-2.11.so
0x0000003749600000 1277K /usr/lib64/libX11.so.6.3.0
0x0000003749e00000 12K /usr/lib64/libXau.so.6.0.0
0x000000374a200000 110K /usr/lib64/libxcb.so.1.1.0
0x000000374aa00000 119K /lib64/libresolv-2.11.so
0x000000374ae00000 75K /usr/lib64/libXext.so.6.4.0
0x000000374ba00000 23K /usr/lib64/libXfixes.so.3.1.0
0x000000374d200000 41K /usr/lib64/libXrender.so.1.3.0
0x000000374d600000 61K /usr/lib64/libXi.so.6.1.0
0x000000374de00000 41K /usr/lib64/libXcursor.so.1.0.2
0x000000374ea00000 34K /usr/lib64/libXrandr.so.2.2.0
0x0000003757e00000 25K /usr/lib64/libXtst.so.6.1.0
0x0000003758600000 154K /lib64/libnsl-2.11.so
0x00007f9f426e1000 143K /tmp/jna4030808797710417467.tmp
0x00007f9f43cf9000 29K /lib64/libnss_dns-2.11.so
0x00007f9f680f4000 213K /usr/java/jdk1.6.0_17/jre/lib/amd64/libdcpr.so
0x00007f9f84a1d000 37K /usr/java/jdk1.6.0_17/jre/lib/amd64/libmanagement.so
0x00007f9f85045000 7K /usr/java/jdk1.6.0_17/jre/lib/amd64/libjawt.so
0x00007f9f854d7000 140K /tmp/jna8909216851551683645.tmp
0x00007f9f86407000 43K /usr/java/jdk1.6.0_17/jre/lib/amd64/libnio.so
0x00007f9f86610000 680K /usr/java/jdk1.6.0_17/jre/lib/amd64/libfontmanager.so
0x00007f9f867b4000 383K /usr/java/jdk1.6.0_17/jre/lib/amd64/xawt/libmawt.so
0x00007f9f86902000 741K /usr/java/jdk1.6.0_17/jre/lib/amd64/libawt.so
0x00007f9f86c78000 109K /usr/java/jdk1.6.0_17/jre/lib/amd64/libnet.so
0x00007f9fd4695000 89K /usr/java/jdk1.6.0_17/jre/lib/amd64/libzip.so
0x00007f9fd47a9000 69K /lib64/libnss_files-2.11.so
0x00007f9fd49dd000 54K /usr/java/jdk1.6.0_17/jre/lib/amd64/native_threads/libhpi.so
0x00007f9fd4ae8000 229K /usr/java/jdk1.6.0_17/jre/lib/amd64/libjava.so
0x00007f9fd4c17000 65K /usr/java/jdk1.6.0_17/jre/lib/amd64/libverify.so
0x00007f9fd4e27000 10730K /usr/java/jdk1.6.0_17/jre/lib/amd64/server/libjvm.so
0x00007f9fd583d000 47K /usr/java/jdk1.6.0_17/jre/lib/amd64/jli/libjli.so

Tuesday, December 8, 2009

Implicit getter in Groovy caused stackoverflow problem

For example, we have a Groovy class A


class A{
protected Connector connector;
}


Groovy will define the default setter and getter for the attribute connector, i.e.,
getConnector() and setConnector().

If you have a subclass such as


class B extends A{

Connector getConnector(){
return connector;
}
}


What will happen? You will get stackoverflow problem. The reason is that when you return connector, the implicit getter getConnector() is called and thus, the above code is same as


Connector getConnector(){
return getConnector();
}


One way is to rename the attribute "connector" to "conn" to resolve the problem if you need an explicit getter or you need to implement an interface so that you can call it in your Java class.

Transfer cassette tape video to computer

I have a camera I bought couple years ago with cassette tapes. I need to transfer the video I recorded to my computer. Of course, I could use 1394 Firewire. But my solution is a tricky one.

I have a WinTV card installed in my computer. I connected my camera to the WinTV card using the video cable, thus, the camera worked as an external video input. I replayed the video on my camera, selected channel ext1 in winTV 2000, and then started recording. That is all.

Be aware that you should select the video format as compressed, for instance, MPEG 4, otherwise, you may got the record file at the size of 20G!.

Monday, December 7, 2009

Tellurium at Rich Web Experience 2009

http://code.google.com/p/aost/wiki/TelluriumAtRichWebExperience2009