July 20, 2004

Count the Number of Occurrences of a String Within a String

The select statement below takes the name “george” and finds how many occurrences of “ge” appear within it. select (length(‘george’) – length (replace(‘george’,’ge’,”))) / length(‘ge’) countfrom dual/ COUNT———- 2 Using

Look Up a DataSource Object in Your Web Server

This code demonstrates how to look up a DataSource object in your Web server using JNDI Lookup. import javax.sql.DataSource;import java.util.Hashtable;import javax.naming.InitialContext;public void findDatasource() { // Initializing DataSource object DataSource dataSource

Sort a Collection of Objects

Suppose you have objects of type MyClass. Further assume that you have a collection (named myCollection) containing objects of type MyClass. To sort this collection, follow these steps: MyClass must

Track Process Runtime for Perl Scripts

For any script that takes more than just a few seconds to run, it’s always a good idea to track the runtime itself. This is especially useful in the development

Power Python: Do More with Less Code

hat’s Power Python, you ask? It’s the effective use of Python language features to get a lot of work done in fewer lines of code. The lambda, reduce, filter, map,