Exception handling in multi-threading in java

In my recent project i need to handle the exception in case of multiple thread. As Thread run in parallel and simply putting a try/catch around thread.start() would not help much. So, here is the solution. Thread has nested class named “UncaughtExceptionHandler” which can be used in much better way to handle exceptions.

Other way around could be to just put try/catch in run method of Thread but better way would be handle the exception in callback way explained above.

Thanks!!!

Mysql like AES_ENCRYPTION and AES_DECRYPTION in groovy/Java

In my recent project there was a requirement of encrypting the data in Database but same was needed in the application level as well so at the mysql end i used AES_encryption() and AES_decryption().

e.g.

and in the Groovy/Grails/Java (application end) same can be achieved using the following code :

The main thing to note in the code given above is that for encryption first you need to encrypt data and then apply hex and in case of decryption unhex the data and then decrypt the same.

The main thing to note in the code given above is that for encryption first you need to encrypt data and then apply hex and in case of decryption unhex the data and then decrypt the same.

This helps me hope that helps you guys!!!

Thanks,

Anuj Aneja

Using custom tag for embedding the video in grails

I had to make a video available on my gsp page. So I looked at the grails flash-player plugin. After going through the documentation I found that it could not be used with videos on Youtube. This code given below will generate the script for the flash player on your gsp for playing youtube videos.

This is the general code for a youtube video. URL in the browser for video looks like -http://www.youtube.com/watch?v=YG9RGKYauhE&feature=related.The common thing between embed code and URL of video is the key for the video which uniquely identifies it.So copy and paste the code of the in your gsp page and pass the video key to change the video as you want. But to make it simple I made a custom tag like–

so you just need to write the following tag which will set its default height,width etc.

I hope it helps you guys!!!

Anuj Aneja