Simple Tomcat and Apache HTTP Server Configuration
It took about an hour to do this seemingly simple thing so I write it here not to forget it later! I needed Apache server to be as an interceptor for tomcat calls.install both Tomcat and Apache...
View ArticleSCEA Exam
I paid and registered to take the first part of SCEA (Sun Certified Enterprise Architect) exam. Even I have been studing for the past couple of months and everything was almost OK! But there was a...
View ArticleChoosing an IDE - JDeveloper 11g
To start a new open source project I was looking for some handy IDE. I tried the following famous ones: Eclipse (SDK 3.2 and ee) IntelliJ Idea 7 (beta) Netbeans 6 (nightly builds) JDeveloper 11g...
View ArticleTarget Typing in Java
Target typing is a language feature wherein the type of the variable in which a result is to be stored influences the type of the computation. Java does not have it, and then the following expression...
View ArticleJava's compound assignment operators
The compound assignment operators are +=, –=, *=, /=, %=, <<=, >>=, >>>=, &=, ^=, and |=.The Java language specification says that the compound assignment E1 op= E2 is...
View ArticleIterating a Map
I am sorry to post this fairly simple piece of code here but I usually forget how to iterate a Map so I wire it here not to forget it again: Iterator it =...
View ArticleString Concatenation with +
The + operator performs string concatenation if and only if at least one of its operands is of type String; otherwise, it performs addition. In this case 'a'+ 'b' prints an int number not the string...
View ArticleInternet in Iran
Around a year ago the Iranian minister of communication and telecommunication said that "home users" DO NOT NEED more than 128 KB Internet speed and all ISPs were banned to give home users faster...
View ArticleString Interning
Java provides two basic mechanisms for equality testing. The “==” operator can be used to test primitive values for equality, and can also be used to determine if two object references point to the...
View ArticleUsing Pattern.quote
We know that for replacing all the periods in "a.b.c" we can use replaceAll method of String. It take a regular expression and a replacement string.This is a mistake:...
View ArticleInteger Underflow
It is stupid that java underflows when it reaches the boundries of some primities types. For example: int i = Integer.MAX_VALUE + 1; goes back to the lowest possible int which is also a negative...
View ArticleJava's Mathematical Infinity
We have the mathematical representation of infinity in double or float:double i = Double.POSITIVE_INFINITY;and it behaves like mathematical infinity so that i == i+1; is correct! In Java adding a small...
View Articleexit(0) over finally
I have always thought that finally blocks are executed in any circumstances; but that wasn't true! public class Test { public static void main(String[] args) { try {...
View ArticleIE for Linux
Our client at work reported that some javascript is not working on IE but it was working on firefox. I was at the edge of taking my whole dev environment back to windows on my dual boot windows/Ubuntu...
View ArticleApache Rewrite Rules
I have always been thinking that apache rules are useless! but recently I came across a situation that left me with no choice other than using apache redirect rules. There was a web based project with...
View ArticleinsideApps
The other day, I was trying the new open source application monitoring tool called insideApps. Features seem to be good but the installation process is lengthy and does not go smoothly. I encountered...
View ArticleJava Frameworks and Pattern Usage by Developers
A couple of days ago I was thinking of the last time I used a pattern in my daily programming. I think it was 3 months ago! Then I tried to find out why. What I mean about a pattern is a GOF or J2EE...
View ArticleDelete the Returns of a SQL Select Statement
I needed to delete the rows returned by a complex and nested select statement. Something like this: DELETE FROM table1 where table1.x NOT IN (SELECT table1.x ...) Which was not possible in MySQL or at...
View ArticleLogging Tips
I noticed a lot of enhancement in production environment performance when we turn the logging from debug to info. Another best practice is this piece of code:if (loger.isDebugEnabled()) {...
View ArticleFixed IP addresses in Home LAN with Netcomm Router
I was wondering for a while how I can have fixed IP addresses on my home LAN. I needed that because I was getting different IPs after a each boot and this was a problem in port forwarding since I had...
View Article