May 5, 2004

Return the Absolute File Path of a Class

This code retrieves the local absolute path of the class file containing the specified class name, as prescribed by the current classpath. import java.net.URL;public class FilePath { public static String getFilePath(String className) { if (!className.startsWith(“/”)) { className = “/” + className; } className = className.replace(‘.’, ‘/’); className = className +

Determine Whether a Combobox Is Being Loaded

Say you have a combobox being loaded at form initialization from a database and you have code in the combobox’s SelectedIndexChanged event. This may cause unwanted exceptions: Private Sub LoadComboBox() ‘Connection and SQL code ‘… ComboBox1.ValueMember = “ID” ComboBox1.DisplayMember = “Customer” ComboBox1.DataSource = ds.Tables(“Customers”) ‘Clean up code ‘…End SubPrivate Sub

Identifying Memory Leaks in Linux for C++ Programs

Most C++ programmers agree that it can be harrowing trying to identify the memory leaks in a given program. If you’re working on the GNU/Linux platform, there’s an interesting tool you can use to minimize the hassle of this task: mtrace. Here’s some background on mtrace: You call the mtrace()

Exploring the J2ME Mobile Media APIs

s J2ME gains prominence, the range of things that developers can do with Java on devices is expanding. This month I’ll cover the Mobile Media API (JSR-135), which is an optional J2ME package. The Mobile Media APIs enable the playing and recording of audio, taking pictures and playing videos, and