December 6, 2005

Implement the Portable Sleep Function in Linux and Windows

Suppose you have exisiting code written in Windows and you want to run it in Linux, but you want to keep the original API calls. One of those calls is Sleep. In Linux, it’s usleep. Here’s the sample code: void sleep(unsigned int useconds ){ // 1 milliseconds = 1000 microsecond.

Improve Javascript Performance by Caching Your Objects

JavaScript often repeatedly accesses a certain object, for instance: In the above example, the object document.images is accessed multiple times, forcing the browser to dynamically look it up twice during each loop (once to see if i

Determine the Type of Modifcation Operation on a Table

Sometimes, when you’re working with PL/SQL trigger code, you need to determine the type of modification operation that’s been performed on the ‘triggered’ table. You can do this using the INSERTING, DELETING and UPDATING trigger predicates. The following code demonstrates, using the trigger Tr on table Ta: create or replace

Ask Users Before Rejecting X509 Certificate

This tip implements a X509TrustManager that asks clients before it rejects a certificate chain. The keystore used is just an example? you can adapt it for any other keystore: import java.security.*;import java.security.cert.*;import java.net.*;import javax.net.*;import javax.net.ssl.*;import java.io.*;import java.awt.*;import java.awt.event.*;class X509TrustManagerDialog implements ActionListener{Button accept=new Button(“ACCEPT”);Button reject=new Button(“REJECT”);Label label1=new Label(“A X.509 certificate was

Support Eastern Languages in Your Struts Web Applications

nternationalizing (i18n) Web applications has become a prerequisite for most Web development projects. Whether a Web site has a worldwide audience who speak different languages or a local audience in a country where the population commonly speaks more than one language, development teams need to have the proper application infrastructure