Skip to main content

Posts

Organizing Properties Files

Organizing Properties Files After a year of development our properties files have become very long and unorganized. It's time for cleanup. Here are the steps we took: Sorting lines in properties files using text fx in notepad++ Aligned equals using textfx in notepad++
Recent posts

Combining multiple svn repositories into one

Combining multiple SVN repositories into one For many years our department have been using 1 project = 1 repository layout which worked well until our entire company decided to consolidate our fragmented SVN servers into one central SVN server. They have provided use with one department repository. The problem is how to move our projects into one single repository. Here is the original setup: Here is the target setup: Here are the steps we took: Create dump files from the existing repositories svnadmin dump c:\repositories\project1 > project1.dmp svnadmin dump c:\repositories\project2 > project2.dmp Load the dump files to new or existing repositories svnadmin load --parent-dir project1 c:\repositories\department < project1.dmp svnadmin load --parent-dir project2 c:\repositories\department < project2.dmp When loading a dump file, disable the logic which validates property values. svnadmin load -- bypass-prop-validation -- parent-dir pr...

How to create a Tomcat Instance

Prerequisite: How to set JAVA_HOME / PATH variables in Windows How to set CATALINA_HOME/PATH variables in Windows 1. Create a serverA directory in C:\Apache\Tomcat. This should result to C:\Apache\Tomcat\serverA 2. Create the following empty folders bin, conf, lib, log, temp, webapps, work. There the same folders found in C:\Apache\Tomcat\apache-tomcat-6.0.26 3. In C:\Apache\Tomcat\serverA\bin create startup.bat and put the following          set CATALINA_HOME=C:\Apache\Tomcat\serverA C:\Apache\Tomcat\apache-tomcat-6.0.26\bin\startup.bat     4. In C:\Apache\Tomcat\serverA\bin create shutdown.bat and put the following set CATALINA_HOME=C:\Apache\Tomcat\serverA C:\Apache\Tomcat\apache-tomcat-6.0.26\bin\shutdown.bat 5. In C:\Apache\Tomcat\serverA\bin create setenv.bat and put the following. Note that this is where heap size is set. 6. Copy the content of C:\Apache\Tomcat\apache-...

Integrate Redmine with Eclipse

Install Mylyn Tasks Connector: Web Templates  1. Add Mylyn Incubator plugin into eclipse Name : Mylyn Incubator Location : http://download.eclipse.org/mylyn/incubator/3.8 Adding Redmine Task Repository 1. Open Task Repository View 2. Click Add Task Repository 3. Select Web Template (Advanced) 4. Next 5. Add the following  Server :  http://serverurl /redmine Label : Redmine Instance User ID : Password : Under Additional Settings  - Add loginToken Under Advanced Configuration add the following Task URL : ${serverURL}/issues/ New Task URL :  ${serverURL}/projects/ /issues/new Login Request URL :  ${serverUrl}/login?username=${userId}&password=${password}&authenticity_token=${loginToken}   Login Form URL :  ${serverUrl}/login  Login Token Pattern :  Adding Query to Task List View 1. Open Task List View 2. Right Click - New - Query 3. Select Redmine Instance in the List of Re...

Setting ${user} in Eclipse

Everytime I created a new eclipse workspace, I had to modify my @author template to display my full name instead instead of the name given to my computer by the admin team. I found out that I could set the ${user} variable in the STS.ini which all workspaces can use. Instructions: 1. locate and edit your STS.ini 2. Add -Duser.name="your name" example -Duser.name=<a href="mailto:fvinluan@princesscruises.com">Francis Vinluan</a>

Trigger Quartz Job to run at start-up

To trigger the a specific quartz job to run at start-up in Spring-Quartz environment, you must create two triggers. 1. The trigger that will run on schedule. <bean id="someJobCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="someJob" /> <property name="cronExpression" value="0 0 0,6,12,18 ? * *" /> </bean> 2. Trigger that will only run 10 seconds after start-up with zero repeat. <bean id="someJobStartUpTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail" ref="someJob" /> <property name="startDelay" value="10000" /> <!-- repeat every 50 seconds --> <property name="repeatInterval" value="50000" /> <property name="repeatCount" value="0"...

Compressing Javascript and CSS using YUI and ANT

Before we look into more specifics you will have to download these two: 1. YUICompression jar from the Yahoo developer site:  http://yuilibrary.com/download/yuicompressor/ 2. YUIAnt jar file from  http://www.ubik-ingenierie.com/miscellanous/YUIAnt/ Place the YUIAnt.jar and YUICompression jar into the lib directory of the project. build.xml: <property name="tools.lib.dir" value="tools"/> <property name="jsmin.dir" value="jsmin"/> <target name="cleanJSMin" description="Remove all generated files.">     <delete dir="${jsmin.dir}"/> </target> <target name="minify" depends="cleanJSMin" description="Minifiy a set of files">     <taskdef name="yuicompress" classname="com.yahoo.platform.yui.compressor.YUICompressTask">         <classpath>             <pathelement path="${tools.lib.dir}/yuicompressor-2.4....

How to set CATALINA_HOME/PATH variables in Windows

1. Download  apache-tomcat-6.x.x.zip and unzip to C:\Apache\Tomcat. This should result in C:\Apache\Tomcat\apache-tomcat-6.x.x 2. Right click on the My Computer and select properties 3. Click Advanced Tab 4. Click Environment Variables 5. Under System Variables, click New 6. In the Variable name field, enter CATALINA_HOME 7. In the Variable value field, enter the path to where the Tomcat is installed 8. Under System Variables,  look for Path and click Edit 9. In the Variable value, add %CATALINA_HOME%\bin; 10. Click OK 11. Click Apply

How to set JAVA_HOME / PATH variables in Windows

1. Right click on the My Computer and select properties 2. Click Advanced Tab 3. Click Environment Variables 4. Under System Variables, click New 5. In the Variable name field, enter JAVA_HOME 6. In the Variable value field, enter the path to where the JDK is installed 7. Under System Variables,  look for Path and click Edit 8. In the Variable value, add  %JAVA_HOME%\bin; 9. Click OK 10. Click Apply

Jasper Report with embedded SQL using Struts2 + Spring Framework

We have decided that in order to make our Jasper Reports portable we need to start embedding SQL queries in our JasperReports. The plan is for all future Jasper Reports with embedded SQL queries be deployed to a dedicated JasperServer. This way the applications do not hang when someone runs a huge report; this will prevent hair being pulled out of frustration. Our environment uses Struts 2-Spring-Hibernate + Jasper for reporting. The challenge is how to pass the connection to the JasperReports. So here is the solution I came up with: 1. Make sure that the dataSource is declared in Spring. 2. Add a DataSource variable to the Action. In this example I autowired the datasource; it can also be mapped declaratively.  3. Add a Connection variable in the Action and a getter. The connection will be set when the method that will return the Report is called. 4. In the struts.xml, provide the connection parameter name with the name of the connection variabl...