Programming

Java Multi-threading, Synchronization

by: Matt Hofstetter | April 18 , 2011 | Java

This example demonstrates a multi-threaded program that must share a resource between threads. Each thread will be required to obtain an exclusive lock on the shared resource to avoid a potentially disastrous conflict. We will create two threads, one called MissileFactory and one called MissileLauncher. The… view article

Java: Serialization, Number, Date and Currency Formatting

by: Matt Hofstetter | April 11 , 2011 | Java

The following class demonstrates the use of Java's Format, Number, Date and Locale classes (util.*, text.*). It also shows how to serialize and de-serialize and object by implementing the Serializable interface (io.*). Item.java //Demonstrates: //Serialization, //Number/Currency Formatting,… view article

Java: Pattern, Matcher and Regex

by: Matt Hofstetter | April 11 , 2011 | Java

The following class demonstrates basic use of Java's Pattern and Matcher class by adding the rel attribute 'nofollow' to the anchor tags of several links. *Note, this is for educational purposes only. Pattern, Matcher and Regex are NOT ideal for manipulating HTML in Java. NoFollow.java //Adds… view article

Connect to Database with JDBC, Singleton

by: Matt Hofstetter | April 5 , 2011 | Java

This example shows how to connect to, and query, a MySQL database in Java using JDBC. The example will attempt to implement the singleton design pattern. The singleton design pattern restricts the instantiation of a class to one object. First get a copy of the MySQL JDBC driver at: http://www.mysql.com/downloads/connector/j/ Extract… view article

Javascript Dynamic Tables

by: Matt Hofstetter | March 17 , 2011 | Javascript

function addCol(table){ var table = document.getElementById(table); var th = document.createElement('th'); th.innerHTML = ""; table.rows[0].appendChild(th); for(i=1; i view article

MySQL Union

by: Matt Hofstetter | March 14 , 2011 | SQL

A UNION is used to combine the result sets of multiple queries into one result set. The queries that are being combined may come from any table, but must have two similarities in order to be combined. The queries must return the same number of fields. If the number of fields does not match,… view article

«StartPrev123NextEnd»