How to set SVN global ignores

There are some customizations that I make that pertains to my development computer only and because I work in a team environment I cannot commit in things that are customized towards my development environment. In order to do this, I do a global ignore on the file. Here’s how to do a global ignore. The subversion config file for Ubuntu 12.04 LTS or 12.10 is here:

[code language=”bash”]sudo nano /etc/subversion/config[/code]

There is a section that looks like this

[code language=”bash”][miscellany]

Set global-ignores to a set of whitespace-delimited globs

which Subversion will ignore in its ‘status’ output, and

while importing or adding files and directories.

‘ matches leading dots, e.g. ‘.rej’ matches ‘.foo.rej’.

global-ignores = .o *.lo *.la *.al .libs *.so *.so.[0-9] *.a *.pyc *.pyo

.rej *~ ## .#* .*.swp .DS_Store[/code]

You can uncomment that “global-ignores” part.

How to run multiple applications on a single tomcat

I do this in Ubuntu 12.10 but I think it applies to Windows 7 configurations too. I wanted to run more than one application in a single instance of tomcat. I have to say this is not the best decision I have made.

You can load two apps in one server instance if you put them in different directories and have two different host names.

In my case, my two hostnames are and, yours will be different. You can edit your hosts here in your /etc/hosts

Both of my apps would be called app1 and app2. I put them into the corresponding directories, as specified in appBase. In my case, I placed them in:

  • /var/lib/tomcat7/app1
  • /var/lib/tomcat7/app2

You can open up your /etc/tomcat7/server.xml file. In Windows 7, it would be where ever your central tomcat configuration files are at. This is my server.xml file:

[code language=”xml”]<?xml version=’1.0′ encoding=’utf-8′?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />


You can refer to it. Unfortunately I cannot provide much support for this.


Well, this method has a key disadvantage, each time you rebuild your Java classes, you need to restart the server and it would be better to be able to restart one application at a time rather than both applications together due to a longer loading time. Most of the time you will only make changes to one application anyway. It is better to have a configuration with two servers and each of them supporting just one application. That’s my take and I learnt it the hard way.

Too much magic in Java IDEs

I am very bothered by the way a typical Java web site development works. Java website developments, through JSP (Java Server Pages) is largely supported by IDEs such as Eclipse and Netbeans. It is not in any way the easiest to utilize. And at worst these huge IDEs are too kludgy for my liking.

Take the current Java project that I am working on, it’s a website that has sign in and numerous data presentation tools. Everything .java compiles into a .class file and the remaining JSP files are deployed into this WAR file through Apache Maven into tomcat. With an IDE, everything seems seamless. You don’t even need to know how it works. Just by magic. You configure the servers and paths and it just works.

You could of course decide to dump WAR files again and again to the server paths and watch it automatically deploy after you do a manual restart of tomcat. Unfortunately that’s too unproductive, starting a tomcat server takes 2 seconds for me, and starting the application takes 10 seconds in debug mode. That’s unacceptably slow because it all adds up.

So, IDEs make you more productive by deploying the files in the server for you and compiles the .java files into .class and .jar files or something like that. Essentially you only need to restart the tomcat7 server if you updated the controller. Updates to the views do not require compilation. However — there’s always a caveat — you have the .jsp file edited on the server path rather than your workspace.

Now, under the hood of the IDE, each time you save a .jsp file, what you are essentially doing is:

  1. Saving the file in your workspace.
  2. Copying the file from your workspace to the server path.

Your workspace can be managed by revisioning tools such as SVN or git and the remnants don’t get copied over to the server space. It’s pretty well thought except that you really need a proper IDE set up to save you all the repetitive work.

So the reason why I am writing this is because I wanted to use Sublime Text and Sublime Text doesn’t have Java and tomcat integration features at all. At first this seemed surprising, after all Java is so common. Upon discovering what Eclipse and Netbeans actually does, I can’t help but to feel that there is a certain amount of over-engineering.

Forgive me if that’s not the way Java IDEs work. I’m uncovering new things every day still, so please correct my mistakes, I want to understand the platform better too.

Tomcat paths in Ubuntu 12.10

And so I have the displeasure of working with Java — a platform I once swear to avoid for the rest of my life — and I had to have my Ubuntu 12.10 environment set up. This is also verified to be similar in Ubuntu 12.04.

If you install tomcat7 from the official repository using “sudo apt-get install tomcat7”, the following paths and commands are probably helpful to you too.

Your WAR files

WAR files (.war) typically go into:

[code language=”bash”]/var/lib/tomcat7/webapps[/code]

Your log files

Your log files should be here:

[code language=”bash”]/var/lib/tomcat7/logs[/code]

It should be called “catalina.out”. It’s useful to check here for troubleshoot Apache Tomcat. It doesn’t mean that tomcat’s successful start would mean the application to be working. catalina.out has saved me on several occasions.

Your tomcat7 configuration files

Server settings goes here:

[code language=”bash”]/etc/tomcat7/server.xml[/code]

You might find the other properties files useful as well:

[code language=”bash”]/etc/tomcat7[/code]

Your tomcat7 and catalina startup shell files

You might need to edit some .sh files like in my case to change Catalina options. You can find the shell scripts here:

[code language=”bash”]/usr/share/tomcat7/bin[/code]

You can read more on setting up Catalina environment options.

Other notes

If you know of other paths worth including, do post a comment. While this is documented more for personal use, I hope you can find it useful too!

How to set Catalina options in Ubuntu 12.10

This is more of a personal note and a really specific topic. This tutorial assumes you are using Ubuntu 12.10 or Ubuntu 12.04 and installed tomcat7 package. If you haven’t already installed tomcat7, use:

[code language=”bash”]sudo apt-get install tomcat7[/code]

After doing so, create and edit the file Putting in CATALINA_BASE/bin allows you to keep your customizations separate.

[code language=”bash”]sudo nano /usr/share/tomcat7/bin/[/code]

I set my environment variables (in my case) as in

[code language=”bash”]
CATALINA_OPTS="$CATALINA_OPTS -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m"

If the file is present, will pick it up and add to the runtime parameters.

To restart tomcat7, use:

[code language=”bash”]sudo service tomcat7 restart[/code]

Verifying that it works

After the server restart, run this to check:

[code language=”bash”]ps aux|grep jar[/code]

This should return:

[code language=”bash”]tomcat7 14140 63.8 11.4 4001076 918296 ? Sl 12:26 1:37 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/ -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 org.apache.catalina.startup.Bootstrap start
kahwee 15564 0.0 0.0 13580 936 pts/1 S+ 12:29 0:00 grep jar[/code]

You should be able spot your line of customization. And that’s the proper way to setting up Catalina options. You can also set JAVA_OPTS through this method too.

On life being difficult

On life being difficult. From the book “The Road Less Traveled”:

“Life is difficult. This is a great truth, one of the greatest truths. It is a great truth because once we truly see this truth, we transcend it. Once we truly know that life is difficult-once we truly understand and accept it-then life is no longer difficult. Because once it is accepted, the fact that life is difficult no longer matters.”

― M. Scott Peck

I constantly remind myself this.

Share about your problems

I kept a fair share of things to myself, trying to solve problems in my own way. Maybe I felt that sharing on my problems is a sign of weakness and that weakness I can overcome. It came to me that these little problems I have might be solved much quicker had I just shared with others.

The mere act of sharing requires verbalization of the problem. I find myself forced to frame the problem in a manner that can be easily digested by the listener. There’re times that already solves half the problem. Then the listener will probe the issue at stake and this further constraints the boundaries of the problem and that might just lead me to discover the primary sources of the issues.

Well two minds can work better than one. It doesn’t hurt to share and the best part is no one really judges me as much as I judge myself. So share.

The credit card that is also a token

The new Standard Chartered Bank credit card is clever. It combines the token device with the credit card. I received mine not long ago and took some pictures of it. I haven’t got the time to post it until now. It’s not much thicker than a normal credit card too. I like you to observe that the credit card numbers are not raised too. How they manage to squeeze a token device into this card is wonder.

Standard Chartered Bank bonus saver card side view

This is the top view, you can sign your transactions through this device.

Standard Chartered Bank bonus saver card top view

This is just new to me, very sensible design. Great ideas enabled by great engineering.

Interesting discoveries #02

It’s been a busy week at work; I never thought I had the time to write this. So here’s what I gathered the past week or so.

1. Read: The Art of Racing in the Rain

A sweet book about a racer from a dog’s perspective. It’s not a book I would have picked up if not for Amazon’s offer and reviews. It’s a good book but I shan’t delve into what Amazon has already decide to be anyway.

The fact that I bought a book on mere offer must have meant something. My spending methods have changed. I use to despise the idea of going to the supermarket and purchasing goods simply because the item is on offer. I now found myself succumbing to that temptation and a half-an-hour introspection was to follow.

Story! Yes, the book is good and this is coming from a reader neither a racing enthusiast nor a dog owner. I do like dogs though.

2. Gun fires in Sandy Hook Elementary School

The most heart-wrenching story of the week is to be the case (CNN) where a gunman killed 26 people at the school, including 20 children, before taking his own life on Friday. I was watching the video reports of this online.

It’s leading to gun control debates, even the National Rifle Association has pretty much shut up in their Twitter account. Moving on from the tragedy, it’s a good opportunity to discuss on the issues with gun ownership and I believe America will reach a rightful conclusion in the months to come. It does irk me a little that the discussion got distracted by people who are calling for more god in schools. Focus on the gun policies first, we’ll talk about morals later.

3. The Walking Dead

Kevin recommended me The Walking Dead and I have been pretty much glued to it. The Walking Dead is an American television drama series developed by Frank Darabont. It is based on the comic book series of the same name by Robert Kirkman, Tony Moore, and Charlie Adlard. The series stars Andrew Lincoln as sheriff’s deputy Rick Grimes, who awakens from a coma to find the world dominated by flesh-eating “walkers”, resembling the zombies of George A. Romero’s horror movies. He sets out to find his family and encounters many other survivors along the way.

I am not why the drama distance themselves from the “zombie” association. I found that hard to accept. Given the whole setting was made to resemble reality — i.e. having places like the CDC, Fort Benning and Atlanta — I feel a little “betrayed” that no one seems to know about “zombies.” Why is that even so? This is not the reality I live in. Of all the efforts that place in creating this familiar environment, I found myself constantly awaken at each mention of the word “zombie.”

The Walking Dead has good story arcs but falls shorts in their lines. I love the visuals too.

4. Apache Maven

I never came across Apache Maven until this week where my new job requires me to. Maven is a build automation tool typically used for Java projects. Maven serves a similar purpose to the Apache Ant tool, but it is based on different concepts and works in a profoundly different manner. It can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.

I don’t have much of comment on this accept that it is one of the most complicated build management tool I have seen. Or maybe I’m just unfamiliar with these things.

5. SimCity, released on March

What got me excited this week most is the upcoming SimCity.

I leave you the video to watch.

6. Upgrading/buying a new computer

I never learnt so much about computers until I have intentions to buy on. My new work place is at Sunshine Plaza and that is a 5 minute walk away from nerd heaven Sim Lim Square. So I was there doing a bit of cost research. I don’t plan to spend a lot on a computer since I’m just going to play SimCity on it when it is released.

If possible I am going to just stick with an integrated graphic card. I saw that the upcoming Intel Haswell micro-architecture has a significant improvement on their Intel HD offerings and I am looking forward to it although I might not have the patience to wait for it. Making a decision when SimCity is out is definitely not too late so, I’ll do that!

For those self-professed hardware idiots, like me, the update is they are now on DDR3 RAM, and the graphic cards are less a necessity more an option. Also the CPU casings are getting more beautiful. And also Intel i5 3330 (Ivy Bridge) seems to suffice. MSI is cheaper than Asus and it’s okay to get cheaper motherboards, they aren’t as bad as the cheaper motherboards of the past. Okay I know nerd language now. Moving on.

7. Sunshine Plaza

How little they did for Christmas decorations:

Sunshine Plaza

Sunshine Plaza has a mall, a residential and office building. It’s across Fortune Center. Good location, I’m happy it’s near all the tiny food places. Will update on that.

8. Google Maps for iOS

Google Maps for iOS is just pure joy to use after the 4 month deprivation of it. Currently the Google Maps application is top in Apple’s App Store and has a 5 out of 5 average rating. Google really deserves this and Apple has help educate the public how hard it is to get mapping right. Google has triumphed this time and Apple is probably a bit thankful for that. It’s time to put Apple Maps in the folder where I place all the crap I can’t uninstall.

I would have but cannot get rid of the following applications:

  • Reminders
  • Notes
  • Weather
  • Compass
  • Voice Memos
  • Stocks
  • Passbook
  • Maps

Google Maps team definitely deserve a good vacation.

End notes

This week has been busy and my sore throats gotten worse. I met my new colleagues that I haven’t been as able to be chatty as I could have been. I spend more time reading this week, mainly on Maven, Backbone.js and Handlebars.js. It’s going to an exciting next week.

A new job

So I have a change of work place. Now I work in a company that’s focused on delivering advertisements in videos through prerolls — Tremor Video. My role will involve JavaScript, CSS and HTML, mainly implementing user interfaces. There’s a bit of Java too where I tend to frown.

The new company is located in between Dhoby Ghaut and Bugis MRT Stations and this brought me back to the city. There’re so much nice food to have here. Having worked at Cherry Credits for a year, I’ve hardly been to the city much. Being here puts me in a different mental state. It’s more exciting just being here, although the commute time has increased. I’ll probably be more focused here. To another successful year coming!