Tech Ecstasy
Thinker's Lounge
Sunday, June 12, 2011
Java Swing Tips
Tuesday, January 18, 2011
Java classpath setting on UNIX/LINUX
Just a caveat:-
On Windows :-
java -cp path1;path2 abc
On Linux:-
the colon ':' separates the paths instead of the semicolon ';'
java -cp path1:path2 abc
Monday, November 29, 2010
Some common tech jargon:-
Hello,
What I am about to discuss are very trivial technical points for programmers, But just for the sake of Jargons :-
1) Off-by-one error (OBOE): suppose you want to traverse an array from beginning to end. lets say its size is 100. And in the implementation programming language, the index starts from zero.
The following code segment demonstrates OBOE:-
for(i=0;i<=100;i++)
{
----------------------- some code
}
We end up traversing 101 elements. the array ranges from o to 99.
Its very common in C language.
2) Fencepost Error:-
This is an error associated while answering questions such as:-
If you build a straight fence 100m long with posts 10m apart, how many posts do you need?
At first sight we would say:- 100/10 = 10 posts are needed.
But looking closely we find that the answer is ((total_length/individual_length)+1) posts are needed.
See you guys,
Bye
Sunday, November 28, 2010
REASONS FOR: java.net.SocketException: Permission denied: connect
Hello friends,
Was trying to fetch response from a website, through the use of Socket class in a Java program.
Socket s1=new Socket("www.oracle.com",80);
Was getting the error:-
java.net.SocketException: Permission denied: connect
Solution:
The most probable reason for this, is that we are trying to access a port which is below 1023, which requires special privileges. In my case, I did not login as the administrator. Hence the error.
If I run the same lines of code , logged in as administrator, there will be no error.
Hope it helps,
Ashish Mishra
Wednesday, August 18, 2010
Friday, June 18, 2010
Struts CheckBox BUG
Hi friends,
Today I learnt about a bug in struts version 1.2
The checkbox bug :- Its quite famous among struts framework related programmers :-
The bug is that
if you uncheck a checkbox and submit a form, then the corresponding field in the targeted bean (the one in which form elements will be filled) will not be altered and hence, the next time you try to get back the data, you will have the discrepancy of a checked check-box (you will get it checked when you were expecting it to be unchecked).
This is due to the fact that, internally struts 1.2 has a setter method only if the checkbox is checked and not when its unchecked.
Googling about this may help resolve your additional doubts.
Saturday, June 5, 2010
Hi guys,
Today I had the opportunity of sitting in amdocs fresher's walkin.
The test was conducted online :- It had the following condition:-
1) aptitude test : 20 questions 25 min
2) attention to details :20 questions 25 min
3) passage - emphasis on attention to detail
4) Core java questions 20 questions
5) SQL - tricky 20 questions
6) Unix. 20 questions