Wednesday, March 12, 2014

MySQL Substring with Last index

Sometimes you may need to use substring in your queries to extract some parts of the values, specially from last index of the value. To achieve that you can use substring_index and reverse functions together.

Monday, February 10, 2014

Java keystore - Copy key from one keystore to another

One day you may need to isolate some of your key(s) to different keystore. Here is the command for it,

keytool -importkeystore -srckeystore mystore.jck -destkeystore myotherstore.jks -srcstoretype jceks -deststoretype jks -srcstorepass mystorepass -deststorepass myotherstorepass -srcalias myserverkey -destalias myotherserverkey -srckeypass mykeypass -destkeypass myotherkeypass

Here is my Scenario - Why I needed to do it? to be added..... :-)

Thursday, January 02, 2014

How to Create MicroSIM from standard SIM

As name says MicroSIM is smaller than standard sim, but chip is exactly same size in both cases. MicroSIM is 15 mm in height and 12 mm in width. So we can cut plastic area in order make it. Please be careful not to damage chip while you cut it.

Please use below pdf document for the MicroSIM template.

MicroSIM Template

Good luck...

Friday, November 08, 2013

Example Spring MVC, JPA, Hibernate Project with Maven

Here is the github link for sample Spring MVC, JPA, Hibernate Project with Maven. You can download and build your project on top of it.

sample-spring-mvc-jpa

Happy Hacking..

Thursday, October 03, 2013

Write Text file to network drive


First you have to download CIFS Client library from http://jcifs.samba.org/

if you use domain then you have to use user variable like below,
    String user = "domain;user:password";

else use below code,
    String user = "user:password";

rest of the code should be like below,
    NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user);
    String path = "smb://server/D/MyLocation/data.txt";
    SmbFile sFile = new SmbFile(path, auth);
    SmbFileOutputStream sfos = new SmbFileOutputStream(sFile);
    sfos.write("Test".getBytes());

There you go, data.txt should be there in your locatoin :-)

Sunday, August 25, 2013

Change/ Modify Image meta data in Linux


Assume you need to change Image meta data like Date Taken etc. Believe me you may need to change something like this in some cases ;-)
Step 1.) sudo apt-get install libimage-exiftool-perl
Step 2.) exiftool -AllDates='2013:08:08 15:35:33' -overwrite_original image.jpg
Hope this tip would help you in one day :-)

Friday, January 21, 2011

Asynchronous programming in Java with Jsp and Servlets

Have you ever needed to do some task asynchronously with Jsp and servelet? If if is EJB container like jboss then we can use message driven beans or some other technique. I found a good discussion thread that has suggested few good solutions for that.

http://cephas.net/blog/2004/02/02/asynchronous-method-invocation-in-java/