Friday, January 28, 2011

Parameter WARNING from Tomcat catalina.out

More often than not, we see tomcat server log prints many warnings, and 2 are very common. After some tests and google, these are warning and will not impact tomcat a lot.

Jan 28, 2011 6:22:53 PM org.apache.tomcat.util.http.Parameters processParameters
WARNING: Parameters: Invalid chunk ignored.
Jan 28, 2011 6:23:11 PM org.apache.tomcat.util.http.Parameters processParameters
WARNING: Parameters: Character decoding failed. Parameter skipped. isHexDigit
Jan 28, 2011 6:42:54 PM org.apache.tomcat.util.http.Parameters processParameters
WARNING: Parameters: Character decoding failed. Parameter skipped. EOF (Invalid chunk ignored.) (Character decoding failed...isHexDigit) (Character decoding failed...EOF)

These characters are used to URL specific function like “&” id used to differentiate various URL parameters. This generates a “null” value for the parameter you will try to retrieve in Servlet. % is URL reserved character for urlencode.

The simple way to get over this problem is to massage your Special Character String with “escape()” funtion in javascript, so & will get encoded to %26, % will get encoded to %25. In Java, URLEncode can also do the same protection.

Tuesday, January 25, 2011

Group buying

Recently I got many deals from group buying sites like 50% off $20 Amazon gift card from LivingSocial, $4 AMC movie ticket from, Los Gatos museum family membership from Also there are many news regarding group buying web sites (which are expected to have huge marketing share from local advertisement, a billion dollar web tread) , including today Google launched Google Offers from iGoogle, after denied Google's 6 billion acquisition request, also LivingSocial promoted its web site traffic with Amazon overwhelming gift card offer. The concept (tuangou, team buying, group buying, or group shopping) was originated from China, and There are more than 800 tuangou websites in China.

So what is group buying? See

Here is some excerpt to discuss about group buying characteristics, and also a new model from an e-commerce company called Next Jump.

The most notable characteristic of all those intermediaries is the selected deals' orientation towards local markets, bound to cities and towns. Leaders include Groupon, which has 79% of the market share, LivingSocial (8% share) and BuyWithMe(3% share)[5]
In 2010, several new business models for group buying have been proposed, emerging from the overall popularization of micropayments. After the offer's deadline, buyers make direct purchases from the vendors' web sites, achieving higher mutual benefits. The most prominent company in this area is Next Jump, which handles a line called 'Overwhelming Offers', offered through many loyalty programs, including Borders Rewards, MasterCard Marketplace, and their own website. This method does not charge percentage fees, but uses reservations as pledges of interest for after-deadline purchases.

There is another group buying site which is a deal aggregator from other popular group buying sites. The example is Yipit.

This article compares many group buying sites from many aspects including countries, cities, referral incentive, reward points, mobile app (on-the-go), unique features, gifts etc.

Wednesday, January 19, 2011

ACE TCP Offload

This white paper provides more details about 2 options regarding ACE TCP offload, namely TCP connection reuse and SSL Acceleration.

TCP connection reuse - TCP connections pooling to eliminate the server connection processing bottleneck
SSL Acceleration - Offloading SSL processing onto the ACE Module

HTTP persistent connections, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using the same TCP connection to send and receive multiple HTTP requests/responses, as opposed to opening a new one for every single request/response pair. Using persistent connections is very important for improving HTTP performance. The advantages are even more obvious with HTTPS or HTTP over SSL/TLS. There, persistent connections may reduce the number of costly SSL/TLS handshake to establish security associations, in addition to the initial TCP connection set up.

See more info about HTTP keep-alive in JDK

SSL hardware accelerator is performing SSL offloading, because part of the SSL processing is “offloaded” from the server’s CPU to the card’s co-processor. The term “offloading,” however, is generally used to describe an appliance or a completely separate computer that performs all SSL processing, so that the SSL load is taken off of the Web server completely.

SSL offloading can greatly increase the performance of your secure Web servers, thus increasing customer satisfaction. However, offloading means the SSL connection extends only from client to offloader, not from client to server. Data passes across the network unencrypted from offloader to server.

Tuesday, January 18, 2011

No urlencode resulted in HTTP 505 error

HTTP GET always need URL encoding the request, one typical case is space should get encoded to %20. IE will do the encoding automatically, but when you program using httpclient in Java, do not forget to do this, otherwise you will possibly get 505 error (HTTP Version Not Supported)

Here is one example:
Without URL encoding (505 code)
GET /context/ xx HTTP/1.1

With URL encoding (200 code)
GET /context/ HTTP/1.1

In JDK, there is a URLEncoder utility class to provide methods for URL encode and decode.

Note that because the <space> character is very commonly used, a special code ( the "+" sign) has been reserved as its URL encoding.  Thus the string "A B" can be URL encoded as either "A%20B" or "A+B". Therefore in JDK, it was converted to plus sign (+).

Here are excerpts from SUN javadoc
When encoding a String, the following rules apply:

  • The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same.
  • The special characters ".", "-", "*", and "_" remain the same.
  • The space character " " is converted into a plus sign "+".
  • All other characters are unsafe and are first converted into one or more bytes using some encoding scheme. Then each byte is represented by the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the byte. The recommended encoding scheme to use is UTF-8. However, for compatibility reasons, if an encoding is not specified, then the default encoding of the platform is used.

Wednesday, January 5, 2011

Windows XP 1394 connection

The IEEE 1394 interface is a serial bus interface standard for high-speed communications and isochronous real-time data transfer, frequently used by personal computers, as well as in digital audio, digital video, automotive, and aeronautics applications. The interface is also known by the brand names of FireWire (Apple), i.LINK (Sony), and Lynx (Texas Instruments). IEEE 1394 replaced parallel SCSI in many applications, because of lower implementation costs and a simplified, more adaptable cabling system.

It is very common to see 4-circuit firewire connector shipped with digital camera, camera recorder, smartphone, external hard driver and so on.

The history and more info regarding to 1394 interface can be found from wikipedia

However, recently my laptop lost wireless connection I open "Network Connections" from Start -> Settings, and found there is a "Connected" status connection called 1394 connection. After some research, it has nothing to do with network connection, because 1394 interface is designed for real-time data transfer explained above. However, Windows XP labeled 1394 adapter as a new network device.

The details are explain by Microsoft at
New Windows XP users might notice a new network device labeled 1394 Connection on their system. This network device is actually your FireWire card. Although most users use FireWire to connect video and storage peripherals, Microsoft chose to list FireWire as a network device, which might confuse some users. Either you can ignore this connection, or you can disable it by right-clicking the connection from within Network Connections (from the Start menu, go to Settings, Network Connections) and selecting Disable.

Therefore, "1394 adapter" is for your "firewire" port -- a port you can use to hook up your video camera (or some external hard drives) -- as in many instances it (FireWire 800) can be faster than USB 2.0. This port will have absolutely NOTHING to do with your internet.

Laptop wireless connection switch

Here was the issue: suddenly the laptop could not connect via wireless. As I didn't have Ethernet wire to test wired connection, so I tried a couple of ways:
1. Restored configuration (no effect)
2. Installed antivirus software Avast (scanned, but not virus found)
3. Checked network adapter device and drivers (good)
4. Safe Mode with network connection (no luck)

I brought the laptop to office and found wired worked. Therefore I believe it is not Virus related, instead of some configuration, so I contacted IT department, and they told me there was a switch for wireless connection. I toggled switch on the left side towards the front by the PCMCIA slots and headphone, then it worked.

Usually for Dell laptop, it is Fn + F2 to switch on/off wireless connection. However, for some models, it is a bit different, need try other Fn combination keys. For Dell Latitude D630, on the left side of the laptop - a real on/off switch for wireless connection. It had been switched off, I turned it back on and found all my wireless networks again.

For more info, read this thread How to turn on/off Wireless in various Laptop Models

Update: 5/18/2012 - Facebook IPO date
I met this issue again, and could not recall this blog. When I try to ipconfig /renew, I got media disconnected error message. After google, I figure out the root cause. My wife switched off the wireless.


Since JDK1.0, there is such a error (extended from java.lang.VirtualMachineError), thrown when a stack overflow occurs because an application recurses too deeply. This is the java doc from Sun (now part of Oracle). Therefore, usually StackOverflowError results from too deep nest calls, or recursive calls. It might be direct recursive or indirectly recursive.

Recursion is when a function calls itself.
Tail Recursion: A call is tail-recursive if nothing has to be done after the call returns. I.e. when the call returns, the returned value is immediately returned from the calling function. More simply, tail recursion is when the recursive call is the last statement in the function.
Head Recursion: A call is head-recursive when the first statement of the function is the recursive call.

Efficiency of Recursion?
Tail Recursion v.s. Iteration?

Tuesday, January 4, 2011

Sound recorder didn't work after WebCam installation

Recently I installed a Logitech WebCam Pro 9000, but my company internal IM didn't work for voice chat. It was the same case for "Sound Recorder" from Windows XP. I can still listen to music, but cannot speak via microphone. After some thoughts, I finally figure out the root cause was WebCam audio becomes the default audio device which takes over my original sound card.

The fix is easy, go to Start -> Settings -> Control Panel -> Sound and Audio Devices, then switch back to original device.

Voice Setting
Audio Setting