Sunday, April 20, 2008

eXtreme Programming is WRONG!

Yes - it is very much wrong. How can you convince serious, old-school, close-brained president of your company (or even high level manager) to use agile methodologies if they have Extreme word in their name? I find it difficult, almost impossible.

It may be funny but I'm dead serious - many people are afraid of XP because it's extreme. Personally I see nothing extreme in XP besides the name.

eXtreme Programming is wrong!

It should be Smart Programming instead.

Friday, April 18, 2008

Apache -> Tomcat (mod_proxy_ajp)

Another hard developer's day... I developed an application under Tomcat and used session to store some of my data there (sounds quite normal, right?). Everything works on my box ;)

The application was then deployed on some production-like environment with Apache server as a front end. So far, so good... Not exactly.

I discovered that I have no session! The problem lies in my webapp (I could rewrite jsessionid in the URLs) as well as in the Apache configuration (the latter is more annoying). The problem was that the cookies were not forwarded to and from the Tomcat server - but why?! It should be the default behavior but it is not, unfortunately.

Solution is quite simple but requires some non-zero knowledge of the Apache server configuration - that sucks! I'm not an Apache admin but a software developer. Anyway here is the solution: link

REMEMBER: Always check whether session ID is stored in a cookie or you need to rewrite jsessionid in the URL - see encodeURL

Thursday, April 17, 2008

Coding horror...

I've just check-outed project from CVS (shit!) and try to build it - it's not so easy, although project is not so big. Ant script which is stuffed with tons of system properties dependencies is a little too big for me. It's only 67 125 bytes (yes - about 65KB !!!) long but it's too much for me...

Let's hope it works at least - more about this story some other time - I'm too depressed now to write.

BTW. Maven2 - I LOVE YOU!!!

Recursion sucks?

After writing yesterday's post I thought that many people don't like (I mean understand) recursion. Because of this I decided to modify my "algorithm" ;) and make it iterative.


private static String convertIter(int decimal) {
StringBuilder sb = new StringBuilder();
int number = decimal;

while (number > 0) {
for (int i = 0; i < NUMBERS.length; i++) {
if (number >= NUMBERS[i]) {
number -= NUMBERS[i];

return sb.toString();

Wednesday, April 16, 2008

Funny coding test

Today I received an email from an Irish company (that probably found my CV somewhere in the outer space) with the following content:


Test #1 - "Roman numerals"

Implement a program which can take an integer and convert it into a Roman Numeral string.

1 = "I"
5 = "V"
19 = "XIX"
101 = "CI"

The function should be capable of converting every number between 1 and 3999.

A file is included for reference (roman.txt).

Test #2 - "Hangman"

Implement a version of the "Hangman" game. A word is given, and the user tries to guess the word before the little stick figure is fully drawn.


/ \


- You may use any of the following languages in implementing your solution: Java 1.5, C, C++ or C#
- Extra credit given for elegance and neatness in code, acceptance tests, etc.
- Comments are not necessary.
- Please provide instructions on how to run the code

That was pretty funny because it seemed like at least second part of the interview ;) and I haven't sent any email to this company before.
More so there was no "Hi", "Hello", "Regards", etc. - what a rudeness ;)

Anyway - I decided to solve the first task during my coffee break and here it is:

public static final int[] NUMBERS = new int[] { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };
public static final String[] LETTERS = new String[] { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };

public static String convert(int number) {
for (int i = 0; i < NUMBERS.length; i++) {
if (number >= NUMBERS[i]) {
return LETTERS[i] + convert(number - NUMBERS[i]);

return "";

Funny... :D

Friday, April 04, 2008

10 ways to screw up with SCRUM

Excellent (and short :) presentation from Henrik Kniberg's Blog.


PS. I personally find it very very useful to know what can go wrong but ONLY when I know the framework enough to know what to do in order to make it WORK.