The pleasure of block selection whilst editing code

Sometimes you wish that writing code would be easier… or at least a bit more efficient. Today I used the block selection mode (default shortcut: Alt + Shift + A) in Eclipse once again. There was a need to insert a common piece of text into several lines. The first thing I noticed was that the lines were all aligned perfectly. This made me think that block selection mode would be the best way to save some time and avoid making mistakes.

The first thing I did was selecting the block of lines that needed editing, but keeping the selection’s width to zero because there was nothing that needed replacing. Then it was time to type in the text, putting in the same words across several lines at once! Was this efficient? Yes, it was because any mistakes made will be uniform and, while I was still in block mode, the same would go for the corrections. Then I decided to blog about it, so in the end I actually lost some time on it after all.

Getting Tomcat heap memory to a sufficient level

Just a small post this time. I ran into the “insufficient Permgen space memory” problem for the nth time again. In essence the Tomcat instance I’m running from inside of Eclipse gets too little space allocated for me to use tools like JRebel or even just the basic reloading of classes that happens when you save your edits in Eclipse.

The solution is simple, you should “just” change the allocated memory for Tomcat instances being started from inside Eclipse. Of course you will need enough memory for this, but that shouldn’t really pose a problem for any modern developer workstation today.

The settings are at Window > Preferences > Java > Installed JREs. Here you will edit the JRE settings and put "-Xms384m -Xmx768m -XX:MaxPermSize=768m" as the default VM arguments for running a Tomcat instance. Why 768 Mb? Coz I can afford it and the other guy had it as his setting for the project he started. I guess if I conform to that level, then it will run without too much problems for me as well.