Friday, September 15, 2006

Opera 9 browser on Ubuntu Dapper

I was pleased with Opera's offer for easy download and install of its browser for many linux platforms.
The installation was easy. Just double click on the .deb file and the installation will take care of the rest. Opera is famous for its lightweight and fast page loading. I find that it actually loads the web pages faster than any other browser. But there are some incompatibilities with lots of websites on the Internet for Opera browser. Even this blogger site textbox does not auto wrap the text to the next line.

Monday, September 11, 2006

Customizing JCAPTCHA, opensource Java api for CAPTCHA

It took me some time to customize the engine which generate words for CAPTCHA validation. The api has no easy way to change the behaviour of the word generation. After all, I find a way to do it. I extends the class SimpleListImageCaptchaEngine and overwrite buildInitialFactories method to get desired behaviour. Basically what I want is to use UPPERCASE letters and numbers only which are also safe from confusion(for example 0,O,L,I).Here's the code:

import java.awt.Color;

import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator;
import com.octo.captcha.component.image.backgroundgenerator.FunkyBackgroundGenerator;
import com.octo.captcha.component.image.fontgenerator.FontGenerator;
import com.octo.captcha.component.image.fontgenerator.TwistedAndShearedRandomFontGenerator;
import com.octo.captcha.component.image.textpaster.RandomTextPaster;
import com.octo.captcha.component.image.textpaster.TextPaster;
import com.octo.captcha.engine.image.gimpy.SimpleListImageCaptchaEngine;

public class MyImageCaptchaEngine extends SimpleListImageCaptchaEngine {

public MyImageCaptchaEngine() {
super();
}
protected void buildInitialFactories() {
com.octo.captcha.component.word.wordgenerator.WordGenerator wordGenerator = new com.octo.captcha.component.word.wordgenerator.RandomWordGenerator(
"123456789ABCDEFGHJKMNPQRSTUVWXYZ"); //Use only uppercase letters and safe characters (i.e. omits chars like O,L,I)
TextPaster textPaster = new RandomTextPaster(new Integer(5),
new Integer(8), Color.white);
BackgroundGenerator backgroundGenerator = new FunkyBackgroundGenerator(
new Integer(200), new Integer(100));
FontGenerator fontGenerator = new TwistedAndShearedRandomFontGenerator(
new Integer(25), new Integer(30));
com.octo.captcha.component.image.wordtoimage.WordToImage wordToImage = new com.octo.captcha.component.image.wordtoimage.ComposedWordToImage(
fontGenerator, backgroundGenerator, textPaster);
this.addFactory(
new com.octo.captcha.image.gimpy.GimpyFactory(wordGenerator,
wordToImage));
}
}

Sunday, August 20, 2006

Firefox and Socks Proxy Woes

When it comes to socks proxy configuraiton, Firefox is a weaker contender to IE. For a few hours, I could not figure out why some socks proxies don't work. I have verified that those proxies were working before I set them on Firefox. After searching around, I found out that there is a setting called network.proxy.socks_remote_dns which in my opinion is to request remote socks server to resolve dns on behalf of the client. Unfotunately this setting is not available from the Conneciton Setting GUI. I have to type about:config in the address bar to bring up all the firefox settings and type proxy in the filter. This, in my opinion is serious problem with useability. Why is it not available from GUI settings?

If this setting is set to true which I think is default for better security, some proxies will not work! If you don't know this fact and encounter the problem like me, chances are highly likely that the proxy server does not support dns resolving and it is turned on in Firefox.

And the fact is that you don't even have to choose what version of socks you are using in IE. I don't know why Firefox requires it.