After upgrading JRE to Java 7u45, running the Java applet under the default High setting, you may face the below warning message:

“This application will be blocked in a future Java security update because the JAR file manifest does not contain the Permissions attribute.”

If the version is 7u51, more directly, that unsigned code is set to “Don’t Run” so the applet is blocked: 7u45_example_blocked_dialog Read the rest of this entry »

How to write to a file in Ant

8Nov2013 In: Ant

To write the text message to a file in ant, you can use ant target echo, it provides the way to directly append to an existing file or write to the new file.

The below target demostrates how to write the string to a file in ant script

<echo file="myoutput.txt" append="true"/>
   The content to be written to myoutput.txt, the classpath is ${classpath}
<echo/>

If the file myoutput.txt already exists, Ant will append the content to this file, if it does not, Ant will create a new one and write the content to it.

The below target print_classpath in build xml demonstrates how to print the project classpath in ant script, this gives the ability to check loaded classpath at runtime. Read the rest of this entry »

How to enable ANT verbose?

2Nov2013 In: Ant

The Ant verbose option can give you the information about what Ant is doing. you can turn on the verbose flag to debug the ant script:

How to do? If you use Ant command line, you can execute ant with -verbose flag:

ant -verbose  OR  ant -v Read the rest of this entry »

1. Java Thread-safe Map Overview

The Map object is an associative containers that store elements, formed by a combination of a uniquely identify key and a mapped value. In Java, the most important Map implementation is HashMap, unfortunately it is not synchronized.

Tips: A map cannot contain duplicate keys, each key can map to at most one value.

What does the thread safe Map means? If multiple threads access a hash map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally to avoid an inconsistent view of the contents. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) Read the rest of this entry »

Revision History
Revision 1.0 10.04.2013 Admin TCPMon Tutorial
Revision 1.1 10.05.2013 Admin Add Tips, bug fixes and enhancements

When developing web services applications, it’s often on demand to be able to track the SOAP messages passed along in TCP based conversation, the TCPMon comes as the first option to capture the outgoing and incoming SOAP envelopes.

1. TCPMon Introduction

TCPMon is a open source utility debug tool, distributed under the Apache 2.0 license. It has originally being part of Axis1 and now stands as an independent project. The official web site is http://ws.apache.org/tcpmon/. It is based on a swing UI and works on almost all platforms that Java supports. It allows user record, monitor and resent the messages, This TCPMon tutorial is step-by-step guide to explain how TCPMon works and also to explain its features.

(There’s a same name TCPMon project in a Google Code, but that’s not the same one, and it only has less features).

Read the rest of this entry »

Ant – how to get current directory in Ant

24Feb2013 In: Ant

how to get current directory in Ant ?

To get the current directory, you can directly use ant build-in property ${basedir}, it  gives us the actual directory where ant is ran from (also the parent directory of the buildfile).

<target name="print-directory">
  <echo>current directory: ${basedir}</echo>
</target>

how to get user working directory in Ant ?

To get the user working directory, you can directly use ant build-in property ${user.dir}, it is actually exposed by Java System.getProperties(). so it’s the JVM current working directory. it is for often located C:\Users\user_name.

<target name="print-directory">
  <echo>current directory: ${user.dir}</echo>
</target>

If you store the date in milliseconds, for instance, 1126483200000, its milliseconds since January 1, 1970, 00:00:00 GMT in Oracle, we can see, even one second converts to thousand milliseconds, its just a huge number which means nothing and hard to read. So usually we have to write Oracle SQL query statement to get this milliseconds and convert to a date string format as instead: Read the rest of this entry »

How to deploy a war file to jetty

18Jan2013 In: Jetty

Like what we often do in tomcat, we can still static or hot deploy war file(packed or unpacked) to Jetty container, this tutorial will demonstrate how to deploy a war file to jetty? Read the rest of this entry »

Fiddler tutorial – How to use Fiddler

15Jan2013 In: Tools
Revision History
Revision 1.0 01.15.2013 Admin Fiddler tutorial
Revision 1.1 – 1.3 09.09.2013 - 10.04.2013 Admin bugfixes and enhancements

Fiddler is a free and open-source packet analyzer. It is used for network troubleshooting, analysis, software, communications protocol development and education. Fiddler captures HTTP and HTTPS traffic data between the browser and server. These data are extremely valuable to troubleshoot HTTP, Java script errors and performance issues related to browser page rendering, this article is a step by step tutorial to guide how to use Fiddler and capture HTTP Traffic.

Read the rest of this entry »