Aug 21, 2013

[Solved] Jetty HTTP 500 "A full JDK (not just JRE) is required"

Today I am deploying Jetty in my machine, my machine configuration is:
OS: windows 7, JDK: jdk1.7.0_25, Jetty: Jetty9
And I have configured JAVA_HOME in system environment and also add %JAVA_HOME%\bin in Path

I can start Jetty:
Java -jar start.jar

And I can see in console it successfully started.
But when I try to access the web application via browser, I met a strange problem:

ERROR:
PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required



SOLUTION:

1. Edit jetty.xml which is under the jetty installation folder \etc folder, for example C:\Program Files\jetty-distribution-9.0.5.v20130815\etc

2. Add a section

    org.apache.jasper.compiler.disablejsr199
    true
  


within section





It's a happy world now!
The solution was referring Jetty document: http://wiki.eclipse.org/Jetty/Howto/Configure_JSP

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Aug 15, 2013

How to add code snippet in Google Blogger

This blog is interesting because it's a blog about Blogger itself. Google Blogger is powerful but it's not easy to use. As a developer, we often want to add some code snippet in our blog but it's not available in blogger. Fortunately there is a way to do it - The solution is to use:
SyntaxHighlighter (http://alexgorbatchev.com/SyntaxHighlighter/)



Step1: go to blogger dashboard -->Template--> Edit HTML

Step2: In the part, add the codes below to enable SyntaxHighlighter.





http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/



    
     
     
     
    
 
 
 -->-->





to add more language support, for example SQL, you can add the js below in the codes we added to head section:
  

3. In the blog you write, edit html, add the codes For example, below is what I put:
































And when publish or preview the post, it looks great!































Bingo! We can write more nice posts now.

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Aug 7, 2013

[Solved] Chrome Debugger Cannot Modify Local Variable

I found it's strange that Chrome Debugger doesn't allow modify modify local variables. For example:

you have a variable: instanceType, which original value is "VERTICA"
in the console, you write:
instanceType="MAPR"
But when you type instanceType again, it still shows
"VERTICA"


I did some search but found it's a know problem, and yet not be fixed in latest Chrome build. Luckily I found an easy solution, which is to use Canary Chrome:
 https://www.google.com/intl/en/chrome/browser/canary.html


With the debugger tool of Chrome Canary,



Aha, what a happy world!

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Jul 11, 2013

Use CURL to test POST RESTful API

I was working one specific task about RESTful API and it took me sometime, and after finish it I think it's worth sharing.

The task is: I need to implement a POST RESTful API, which accepts multiple parameters. And I will make it be able to call by a C++ or shell script.

The API looks like this, and in JAVA codes:


@POST
@Path("updatecache")
public void postCache(@QueryParam("instanceID") String instanceID, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime) {
        /*The implementation details are hidden herer*/
}

To test it in POSTMAN

To test it in CURL, it took me really a long time, and

curl -H "user:abc" -H "password:abc" -X POST "http://localhost:8080/dsm/resources/heatmap/updatecache?instanceID=96&startTime=2013-06-29%2000:00:00&endTime=2013-07-02%2010:00:00"

Note: the URL should be double quoted. Because Typing & in the command line means run the preceding command in the background , because of this anything after the & is being treated as a new command.

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Jul 4, 2013

Windows 7 Free Partition Tool - EaseUS Partition Master Edition

I have been using Norton Partition Magic since Windows XP era, but on Windows 7 it doesn't work very well. Fortunately there is a good tool which can well replace partition magic for Win7, and the name is:


EaseUS Partition Master Home EditionEaseUS Partition Master Free Edition

You can download it here here or here

For normal users, the free edition is good enough. The features I used most are: 
  • Resize/Move partitions to avoid data loss, like extending NTFS system partition without reboot to maximize PC performance
  • Create multiple-partitions, delete partition
  • Safely merge two adjacent partitions into a bigger one without data loss.
If you find this article useful, please kindly click the ads on this page to help. Thank you.