Pidgin configuration through web proxy

Port used by Pidgin for chatting is different from that of the web. In networks where only web proxy is allowed you have to change the port number. For using google talk, the different options can be configured as shown below

Reduce gnome panel size

I have a wide screen laptop, but I want to get as much vertical space as possible. Here are some of the things I did for that purpose.

  • Removed one of the panels. I removed the bottom panel. To retain the list of opened windows I added window list applet to top panel. The trash applet also you can add to top panel. For switching the desktop I uses keyboard short cuts (Ctrl+Alt+Arrow), so that is not a problem

  • Reduced size of the panel. By default gnome panel does not reduce the size after a limit(24pixels I remember). If you want to reduce more than that limit, you have to reduce the font size and icon size. I set my application font size to 8px. For reducing icon size I did a hack I got somewhere from internet. Go to the Icons directory you r currently using(either in /usr/share/icons/< icontheme>/ or .icons/< icontheme>/). Rename the 24x24 directory to something else. Create a new link to 16x16 with the name 24x24. Then I could considerably reduce the panel size. U can see that the top panel is enough to include all opened windows. A small panel looks better than a bigger one

  • For a nicer look I added a awn dock and put it in auto hide option so that it won't cover opened applications.

Console input in java using scanner

Often we have to read input from the user through console and most of the time we need to read primitive types(int,long,float,char ...). For reading an array of integers as input , we often coded as shown below. That is we input was read as a string and converted to integer for using it.

int[] array = new int[size];
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for (int j = 0; j < array.length ; j++) {
int k = Integer.parseInt(br.readLine());
array[j] = k;
}
}catch (Exception e) {
e.printStackTrace();
}

From J2SE 5.0 onwards Java has added a new classes called Scanner which is basically used for reading primitive types of data. The above code can be implemented with the Scanner class as shown below.

int[] array = new int[size];
try {
Scanner in = new Scanner(System.in);
for (int j = 0; j < array.length ; j++) {
int k = in.nextInt();
array[j] = k;
}
}catch (Exception e) {
e.printStackTrace();
}

Scanner class is pretty much simpler to work with than the BufferedReader, when you have to read only the primitive types.

Scanner class can also be used for parsing input based on regular expression. For more details check http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html