Archive for October, 2006

Old habits die-hard, I’m still tempted to put semi colons and curly braces in my Ruby code.  This is what happens when you are coding in two different languages.

Ever since I started programming in Ruby, I’m forgetting to declare the access modifier in front of my methods and other times I didn’t bother declaring a main method, I just started writing code in the middle of the class wondering why Eclipse is drawing red lines under my code.

I experienced the same problems when I was coding in C++ and Perl at work, and it took about a year to get over it.  At least then I was using a different IDE, lately I’ve used Eclipse for both Ruby and Java development and there’s nothing to remind me that I’ve started coding in a different language.

Maybe this is a sign that I should look into JRuby.

Sometimes, your network administrator may force you to connect to the internet through a HTTP Proxy. While this makes the administrator’s job of managing net security easier, a http proxy server will make your java application that communicates with the internet fall flat on its face.

If you are behind a proxy server, your java application must know that internet calls will go through a proxy, to do this, add the following lines to your program:

System.getProperties().put( “proxySet”, “true” );
System.getProperties().put( “proxyHost”, “server1″ );
System.getProperties().put( “proxyPort”, “8080″ );

Some proxies also require you to send a username and password, if your proxy requires such action then you must also add the following lines to your code:

URL url = new URL(”http://www.somedomain.com/”);
URLConnection conn = url.openConnection();

String password = “username:password”;
String encodedPassword = base64Encode( password );
conn.setRequestProperty( “Proxy-Authorization”, encodedPassword);

Search