For those in need, here's a step-by-step tutorial on asking a girl for a date.

On a more serious note (or not) the following link contains some nice interaction design patterns, or what we call "Web UI" design patterns. Kudos to Martijn van Welie; if I had to be Siskel and Ebert I woudn't disagree with much of anything here.

Here's a heart-warming story of a dog sharing her love on my birthday.

I started looking into making my "blog" software use case insensitive searching. I thought that would make the "Search" facility for this site much more powerful.

The secret to Postgres case insensitive searching is to use regular expressions. If you're used to standard Unix/POSIX regular expressions, the implementation is pretty easy as well. Instead of using the standard database LIKE operator, you use the Postgres ~* operator.

Here's an example of how to forward from a servlet to a JSP in your J2EE code. I can never remember how to do a forward like this when I need it, so even though this example is pretty easy, I've put it out here so I can find it later.

The typical scenario is that you're working on a Java servlet, and you need to forward the user from that servlet to a JSP. Assuming the name of the JSP is "searchResults.jsp", here's the code that will forward from your servlet to that JSP:

If you haven't seen it, w3.org offers an HTML Validation Service for free that is pretty cool. Give it a URL, and it calls the URL and checks the document for errors and HTML validity. Of course this page bombed the big one, but I'm still in a major rebuild process here, so I'm not sweating too much as long as it renders in IE and Mozilla. They also offer a CSS Validator that I haven't had a chance to test yet. That one also appears to offer a download.

So today I learned that you can't just access PATH_INFO (pathinfo) information from a servlet when you're using Tomcat (at least not Tomcat 3.2.4 running under Apache). I can access the PATH_INFO information okay under Tomcat running standalone on my PC, but for some reason the same config did not work properly using Tomcat under Apache. (I'll investigate this more in the future.)

Specifically, for me to be able to access PATH_INFO (PathInfo) information in a servlet, I had to add this servlet mapping information to my web.xml file:

This is an easy task. For the purposes of this exercise assume (a) the high-level directory of your project is named "MyProject", and (b) that you are on a Unix computer, and (c) that your "MyProject" directory is in your home directory on your Unix system. With these simple assumptions, just follow these steps:

  cd
  cd MyProject
  cvs import -m "your description here" MyProject alexander start

If everything works ok, you should see a message that says something like "No conflicts created by this import."

 

JDBC try/catch/finally exception FAQ: Can you show me a decent example of how to catch a JDBC exception in a try/catch/finally block?

Beauty is in the eye of the beholder, but here's a JDBC example showing some Java code that uses a try/catch/finally block with a Java JDBC query:

Java Properties file FAQ: Can you show me how to read a Java Properties file?

Here is a snippet of Java source code that shows how to read a Java Properties file named Pizza.properties. It reads in two properties named CRUST and TOPPINGS.:

CVS checkout FAQ: How do I get a snapshot of a CVS repository back to a certain date?

To solve your first problem, let's assume that yesterday was September 14, 2001, and your project name was KickStart. To check out the code from your KickStart repository from late last night, use this cvs checkout (cvs co) command:

"CVS tag" FAQ: How do I tag a release of a software project with CVS?

Assume that you have a software project named KickStart checked into a CVS repository. Further assume that you want to tag the current release of the project with the name "Release-2001_09_15". Here's how to tag that release with the "cvs tag" command:

Several times when working with CVS I've forgotten to check a binary file into CVS with the binary file flag. Fortunately this problem can be fixed using the cvs admin command. It's just important to remember that fixing this problem is a two-step operation.

CVS binary file FAQ - How do I add a binary file to a CVS repository?

Answer: You add a binary file to a CVS repository with the cvs add command, like this:

cvs add -kb myfile.zip

 

CVS remove FAQ - How do I move or rename a file that is checked into a CVS repository?

Good question. This is neither obvious or straightforward with CVS. It also requires administrator priviledge.

cvs remove example - how to move a file

To move a file that's checked into CVS and save it's revision history, do the following:

CVS FAQ - How do I go back to a previous version of a file?

Solution: What revision would you like to revert to?

Let's see ... I just messed up revision 1.25, so I would like to go back to version 1.24.

And what is the name of the file?

LoginController.java

Move to the directory where your file is located, then run this command:

JBuilder FAQ: Is there a way I can see the parameters a Java method expects?

Yes, assuming that your cursor is position right after the opn parenthesis, type this magic keystroke:

[Ctrl][Shift][H]

You will see a list of parameters that the method accepts, and it will not disappear right away.

How did you know that?

I found it one day in the JBuilder menu system. I also heard it at the Borland Developer Conference.

To browse a symbol when using JBuilder, you just need to use the magic keystroke: [Ctrl][Enter].

Java number formatting FAQ: How do I format numbers for output on reports in Java programs?

Generally speaking you want to use the Java NumberFormat class and its descendants, such as the Java DecimalFormat class.

Quoting the API documentation, the Java DecimalFormat class "also supports different kinds of numbers, including integers (123), fixed-point numbers (123.4), scientific notation (1.23E4), percentages (12%), and currency amounts ($123). All of these can be localized."

Java random numbers FAQ: How do I create random numbers in Java?

To create random numbers in a Java program, use the java.util.Random class.

Example Java Random number class

Here's an example Java class named JavaRandomTests that generates ten random integers whose values range from 0 to 100:

Java Swing FAQ: How do I set my Java/Swing (GUI) application to use the default look and feel of the current system/platform?

In a Java / Swing application, to use the default look and feel of the current operating system (platform), first import the necessary class:

import javax.swing.UIManager;

Then use this code:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Java Swing FAQ: How do I set my Java look and feel to the "metal" look and feel?

To set your Java / Swing application to use the metal look and feel, first import the necessary classes:

import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;

Then put this in your code:

UIManager.setLookAndFeel( new MetalLookAndFeel() );