August 22, 2001

FlashSound API: The Sound of Invisible Flash

ave you ever wanted to add interactive sound and backing music to a Web site but were unable to use Flash because you didn’t require any visual presentation? Now there’s a new way to “sonify” Web sites?the FlashSound Javascript API. The FlashSound API allows you to add interactive sound to

Stop an IP Address From Accessing Your Site

If you want to stop a user from accessing your website, you can do it by using some relatively simple code. First, you must know the IP address of the user. Then you can redirect him to some other page. In this case, the user is redirected to notallowed.asp. visitorIP

Convert an Exception StackTrace to a String

This feature will be required if you want to store exceptions in a database: import java.io.*;public class Test{ public static void main(String args[]) { String trace = exceptionToString(new Exception(A new exception)); System.out.println(trace); } public static String exceptionToString(Throwable th) { String stTrace = null; try { StringWriter sout = new StringWriter();

Using System.gc() to Force the Garbage Collector

The garbage collector works automatically, whether you request it to or not. However, it is possible to make a garbage collector request, by invoking the System.gc() method. When garbage collector starts its work, you may have a short pause in the application’s execution. This is the reason why you should

Creating a Recordset for Testing

When working with pages, the database is not always available. Sometimes, you need to access a test recordset. Here are is an example of how to create a function that returns a recordset for testing:

Overriding toString()

While definitely not required, overriding the toString() method in your classes will make their use much easier. Although java.land.Object provides basic implementation for this method, it is far from being informative. A good idea is to include values of ALL the important fields of the object into the output of

<fstream> Open Modes

The library defines the following open modes and file attributes: ios::app // appendios::ate // open and seek to file’s endios::binary // binary mode I/O (as opposed to text mode)ios::in // open for readios::out // open for writeios::trunc // truncate file to 0 length You may combine several flags by using

Truncating a File Stream

Certain files need to be emptied every time an application opens them before it writes new data to them, for example, a per-session log file. One way to achieve this is by deleting the original file and creating a new one with the same name. However, the library offers a

No more posts to show