Posts

Dockerfile debugging

Today I was working with Dockerfile which would download a package from internet , unzip it and then install it as component. Learnings during the process: 1. Every command in Dockerfile is executed in a different intermediate container which serves as base of the next command. 2. This helped to debug the application. I was getting issues where it could download the file but would not unzip saying it is not in gzip format. Running curl command on local, I was getting right tar file and was able to decomress as well. So what was wrong. To figure it out I wanted to debug the command in docker file, so figured following command to debug the image at different stages: docker run --rm -it <instance id of last container in docker run> sh This will launch the last container with the command executed that was successful and then I could see the output of the command and run remaining commands on the same image to fix my Dockerfile. (It was a proxy issue offcourse :) )

Install Jenkins and configure with mercurial repo for Continous Integration

Today I had to run all the tests of the build on my local system to be sure that the changes I made would not break anything. So I had to configure the CI on my system which we were using till now for the project from stage server.  Following are the steps I followed to do this: Download Jenkins Download Ant Download Apache Tomcat 7.0 Unwar Jenkins into tomcat webapp folder Install Ant and add it to the PATH system variable Ensure you have JAVA_HOME set to point your java installation directory and that you have tools.jar in the JAVA_HOME\lib folder Start Apache Tomcat from services Access Jenkins in web browser using link <tomcat url>/jenkins Now Jenkins will take a while to configure itself and will come up with home page If you want to configure with CVS or SVN skip to step , for other versioning software like Mercurial go to next step Click on Manage Jenkins and Manage Plugins Add the Mercurial Plugin In case y

Some quick tips

To uninstall a service and remove the entries from Registry use following command:  sc delete <servicename> To submit a form in Struts and open the result in new window: $("#myButton").click(function() {         var url = this.href + "?" + $('#myForm').formSerialize();         window.open(url, "_blank");         return false;     }); <s:form id="myForm"> ..... </s:form> <s:url id="urlToopen" action="submitForm"/> <a id="myButton" href="${urlToopen}" > Click to see</a>

How to solve “svn: Checksum mismatch while updating..” ?

SVN (version system) is good tool for version control. Howeveer, if we commit some mistake while updating or cancel a file being up dated then the files in which it keeps the information get corrupted and all subsequent update tries will give the error o f Checksum.   To resolve th is follow following steps: 1. Open the entries file located in .svn directory where you are getting the error. 2. Find the entry for the file giving error and replace the expected value with actual value in error. 3. Now synchronize and try to update.  If it st ill does not work. Try these. Its just a workaround though: 1. Delete the file from your system. 2. Delete the entry of the file from entries file. (Starting from the name of the file till the special characters ) . 3. Now Synchronize and update the file. T his will get latest version of file from repository and all conflicts will be resolved. Cheers..      

FTP Command to upload file

A small but useful piece of information for uploading a file to FTP from batch file Put the command in batch file: ftp -i -s:ftpComm,txt -n <ftp servername> Create a file with ftp commands(ftpComm,txt): USER username password bi cd buildDir mput c:\new.sql bye

Optimized Database access

Optimized Database Interaction: While writing applications for interacting with database using JDBC or using ORM tools like hibernate, we face the problem of optimizing the memory and resource usage. Some tips that would be handy in this: 1. Always close the statements and other resources object after use. 2. Select the specific required fields instead of getting all fields.    eg.      Use           Select OrderId,ItemId from  orderDetails      instead of          select * from orderDetails 3. Use Connection pools 4. Prefer stored procedures instead of direct SQL 5. Turn autocommit off if  not using stored procedures but dont let transactions wait for too long. 6. Tune the SQL to return the minimised data return. 7. User joins instead of sub-queries if possible. 8. Cache data to avoid multiple DB calls for the same data.