January 6th, 2010
JavaScript doesn't have a handy sleep() or wait() or delay() function to pause the execution for a few seconds, so we can use setTimeout() function to emulate such behaviour. It's not straightforward and may require you to refactor the workflow, but it's delaying the execution and is really simple:
JAVASCRIPT:
-
setTimeout(start, 1000);
-
var i = 0;
-
-
function start() {
-
console.log('i am here ' + i);
-
i++;
-
setTimeout(start, 1000);
-
}
Posted in Programming | No Comments »
December 15th, 2009
To make JTidy work correctly with UTF-8 strings and process international characters in a proper way, use the following code:
JAVA:
-
Document doc = Tidy.
createEmptyDocument();
-
try {
-
doc = tidy.
parseDOM(new InputStreamReader(IOUtils.
toInputStream(html
),
"UTF-8"),
new NullWriter
());
-
-
log.error(e);
-
}
Posted in Java | No Comments »
November 29th, 2009
What a pity! I was really disappointed today - it appears you can't make fring calls (SkypeOut or SIP calls) while you are not using an available WiFi connection on iPhone. After my good old Nokia E71 it looks really weird. We got a new 32 gig iPhone 3GS for my girlfriend and I was thinking about getting the same toy when my current plan is over. But that fact turns me away, sorry apple 
Posted in Mobile world | No Comments »
November 24th, 2009
If you are getting this exception from your Java program using HTTPClient library, that means the site you are trying to connect to has a test/self-signed or invalid certificate. The easiest way to workaround this problem is to grab InsecureSSLProtocolSocketFactory and InsecureTrustManager from HTMLUnit project and before making a request use this code:
JAVA:
-
final ProtocolSocketFactory factory = new InsecureSSLProtocolSocketFactory();
-
final Protocol https = new Protocol("https", factory, 443);
-
Protocol.registerProtocol("https", https);
Posted in General, Programming, Java | No Comments »