February 25, 2000

Using Your Own VB Components in ASP Pages

Question: I want to create a three-tier application that has a browser front end and a Visual Basic middle-tier. How do I access my VB code from ASP? Should I compile my code as a DLL or as an EXE? Answer: First, create your VB app as an ActiveX DLL.

Formatting Your SQL Statement Correctly

Question: I am trying to set up a recordset from the results of a form. On the ASP page, I have set a variable to the entry from the form but I want to enter this value in the search query, whatever it may be.

Determine if a PDF File Exists From ASP

Question: We have an ASP page that displays product information from a database. We also have a button to download/view a related PDF file that should only appear on the page if the PDF file physically exists. We used Request.ServerVariables(“APPL_PHYSICAL_PATH”) to determine the path to check whether the file exists.

Present Data From TEXT Field With Line Breaks

Question: I have data (text + CR + LF) stored in SQL Server 6.5 as a TEXT data type. When I want to display the data on an ASP page, the text loses its format. If I use TEXT INPUT on my ASP, it works fine but I need to

Stringtokenizer That Works with Empty Strings

import java.util.*;import java.io.*;class Class1 { static Vector split(String string,String delimiter) { //StringTokenizer that works with empty strings boolean wasDelimiter=true; String token=null; Vector vector=new Vector(); if(string!=null) for(StringTokenizer stringTokenizer=new StringTokenizer(string,delimiter,true);stringTokenizer.hasMoreTokens();) { if((token=stringTokenizer.nextToken()).equals(delimiter)) { token=wasDelimiter?””:null; wasDelimiter=true; } else wasDelimiter=false; if(token!=null) vector.addElement(token); } return vector; } static boolean test(String original,String delimiter) { // split,

Customizing a JComboBox

The JComboBox API provides a programmer with very little directcontrol over how list items are displayed. This is because, in trueobject-oriented fashion, a JComboBox object knows or cares very littleabout the items it displays to the user. It only knows that itdisplays Components, which it gets from its ListCellRenderer’sgetListCellRendererComponent() method.

Doing an [import java.package.*]

This tip is probably cosmetic, but it could result in great convenience. Doing a [import java.package.*] would allow usage of [public] classes in theaforementioned package without the usual required verbosity. This means that [java.package.class1] and [class1] would mean the same thing(and be legal as well). But one thing about it

How to Format Numeric Values

At times you want to output the numeric values in specific format, for example, you may want to display monetary value with two decimal points, or scientific data with five decimal point places or an exponent. You can use NumberFormat class from java.text package for this. Here is some sample

Java Applications and the “Current Directory”

A recurring question in the Sun Java Forum groups is, “How do Ichange the current directory of my Java application?” The correct answer is that you don’t! Java applications don’t use the metaphor of ‘current directory’ in the same way native Unix and Windows applications do. A native Unix or

No more posts to show