August 10, 1999

Nonblocking I/O

Question: Say I have 10 sockets and I want to have a thread which checks for a message from the sockets using their InputStreams. The thread will wait in the first socket until it receives a messagein that socket. How can I skip to the next socket when there is

Capturing KeyEvents

Question: How can I capture KeyEvents in a Frame that doesn’thave any TextFields or TextAreas? Answer: To enable a particular AWTEvent in a Component it suffices to add alistener for that event. When the first listener for a particularevent type is registered, that event automatically becomes enabled forthe component. So,

A Simple Sort Not Working

Question: I have the following: sql=”select * from products” How do I sort or order by two columns retrieved in the “*”? Answer: You need to specify them directly in a clause following the one you have, as in: select * from authorsorder by au_lname,au_fname This will get you all

Detect if the Submit Button Was Pressed

Question: How do I tell if the ‘submit’ button on a form has been clicked when I call the ASP page back to process the input? Answer: If you set up your submit button like this: You will see a command button with the caption “Do It” on it. When

ASP String Functions

Question: I have a string that changes in length and has information separated by commas. For instance, it might contain something like: agfd, addc, aprev, ads, adft I need a loop that calls each group of letters individually and then stops at the end of the string. I don’t know

Get Milliseconds From Time in ASP?

Question: Can I get milliseconds from time in ASP? For example, 12:30:00.234 HH:MM:SS.fff. Answer: No, not without using a custom COM component that will return the milliseconds. But then, by the time you call the COM component, the milliseconds would have changed anyway. NOTE: Reader Henry M. Bass provides a

Cannot Use Server.CreateObject on Client

Question: I created an ActiveX DLL that contains a class used to hold application settings. I registered the DLL (and a subsidiary DLL) on the Web server, but when I call Server.CreateObject in the Window_OnLoad event, I get an ‘Object Required: Server’ message. Answer: You cannot use a Server.CreateObject on

MySQL to MS SQL Syntax

Question: I have the following dump for MySQL and am having a problem getting it corrected for MS SQL. Can you help? Here is the dump file: # MySQL dump CREATE TABLE tblBids ( biNum int(11) DEFAULT ‘0’ NOT NULL auto_increment, biItem int(11), biUser int(11), biQuantity int(11), biPrice decimal(7,2), biMax

Catching Exceptions

Question: Do you have to individually catch each exception that a method maythrow? Or can you just have one generalized catch?For example, can I do this?: try{ method1 //which throws exception1 method2 //which throws exception2}catch(Exception e){} Answer: No, you do not have to catch each individual exception and you may

No more posts to show