Nice way to minify css/js on build


By the way, I cannot find link to download yuicompressor in hisblog.

So here it is, yuicompressor –


Failure initializing default SSL context

I was trying to use this apache HttpClient to have my web application publish posts to facebook wall.

At first sight, it looks good when I test it in my local machine. I can publish posts to user wall and I’m happy.

But when I deploy it to shared server. Things don’t go as expected. My application can not post to user’s wall and spit this error instead.

org.apache.http.conn.ssl.SSLInitializationException: Failure initializing default SSL context
   at org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(
   at org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(
   at org.apache.http.impl.conn.SchemeRegistryFactory.createDefault(
   at org.apache.http.impl.client.AbstractHttpClient.createClientConnectionManager(
   at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(
   at org.apache.http.impl.client.AbstractHttpClient.createHttpContext(
   at org.apache.http.impl.client.AbstractHttpClient.execute(
   at org.apache.http.impl.client.AbstractHttpClient.execute(
   at org.apache.http.impl.client.AbstractHttpClient.execute(
Caused by: java.lang.IllegalStateException
   at org.apache.http.conn.ssl.SSLSocketFactory.createSSLContext(
   at org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(
   ...32 more

I thought it might be something related to the server since the code works properly on my local machine.

I tried googling but that didn’t help much.

About two weeks later, I came back to the issue and decided to switch to use basic connection using code from

and, viola, it works fine now, happy ending 🙂

A (free!) TED for teenagers: Announcing the incredible lineup for TEDYouth in New York City

TED Blog

Just like school … not! TEDYouth is like a TED Conference for high school students, starring a lineup of speakers working at the top of their fields of culture, science, technology and art. You’ll hear about scientific discoveries and crazy art projects that will surprise you, make you laugh and blow your mind a little.

TEDYouth will take place on Saturday, November 17, from 1 to 6pm EST, at the Times Center in Manhattan. After the jump, the exciting lineup of speakers from NASA flight director Bobak Ferdowsi to producer-slash-inventor  Young Guru.


Young Guru is one of the most important music producers of the past decade, having worked on 10 Jay-Z albums and countless more with other well-known artists. He’s currently working on the future of sound.

Kelly Benoit-Bird is a marine biologist using sophisticated sound technology to explore how animals in the ocean find their…

View original post 598 more words

Useful tips for frontend web development from catswhocode

When ServletContext.getRealPath() return null…

The latest issue I have is when I call event.getServletContext().getRealPath(“/”); to set the path for It turns out that somehow I cannot get my path and the method return null instead.

I do some researches and find the root of my problem.

Here, the API doc state that

This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).

For my case, it’s likely to be that either my hosting service have disabled it for security reason or my application is deployed undexploded.

Now for the workaround, instead of using getRealPath to get the path for properties file, we can (and IMO, we better) use event.getServletContext().getResourceAsStream(“WEB-INF/”); instead

This method will return the resource located at the named path as an InputStream object and PropertyConfigurator.configure() also accept that as well.

Facebook Graph API : publishing user posts with link no longer show in feed

Yesterday I worked on publishing user’s post to his/her facebook wall and everything worked fine. Except one thing. The post won’t reach the feed.

After half an hour of research I found this document

It state that

Updating a User’s Status

You can use this method to simply update a user’s status. When you do so, the status message appears at the top of the user’s profile and on the Friends > Status Updates page. The message also appears in the stream with your application icon.

To use this method to set a user’s status do the following:

  • Do not include an attachment or action link. If you do, the story will get published and will appear in the stream and on the user’s Wall only. It won’t appear at the top of the profile or in the Status Updates page.
  • Make sure the message is no longer than 420 characters. Otherwise, an error gets returned

Now I have to choose between

  • still add a post with your link even it doesn’t show in feed
  • sending just a message and have it in feed?

think would go with first one.