July 17, 2000

Transforming a String to Uppercase Letters

To change the case of all the letters in a string object, use the std::transform() algorithm. This algorithm is defined in the standard header . It takes four arguments. The first two arguments are input iterators that mark the beginning and the end of the string, respectively. The third argument

Tied iostream Objects

The standard streams cin and cout are automatically tied to each other. This means that whenever you’re using both of them, C++ ensures that their operation is synchronized. In other words, if you have cout > name; C++ ensures that cout displays the message on the screen before cin will

iostream Objects and Complex Numbers

The standard stream objects support all built-in types as well as several classes of the Standard Library, e.g., std::string. If you’re using complex arithmetic, you’d be pleased to hear that C++ streams also support objects of type complex: #include #include using namespace std; int main(){ complex num(0.5, 0.0); // create

What’s Wrong with Inheriting from a Class that Has no Virtual Destructor?

Classes having a non-virtual destructor aren’t meant to be derived from (such classes are usually known as “concrete classes”). std::string, std::complex, and all STL containers are concrete classes. Why is inheriting from such classes not recommended? When you use public inheritance, you create an is-a relationship between the base class

Releasing Database Locks

Question: How can I release all existing database locks for all the sessions a specific user has started? Answer: The easiest way probably is to log that user out. Otherwise, you can find out which locks are out there by typing onstat -k. Find the address of the owner of

ASP Error: ODBC Driver General Error

Question: I have been receiving the following (albeit general) error sporadically: “Microsoft OLE DB Provider for ODBC Driverserror ‘80004005’ [Informix][Informix ODBC Driver]General error.” This error has occurred when the code accesses the datasource: (set conn = server.createobject (“ADODB.connection”): conn.open “DatasourceName”. However, it happens only occasionally when using ASP. Cold Fusion

Date Time Values in Parameterized Queries

Question: I have a parameterized SQL statement like the following: “insert into eSession (ESessionID, eUserName, eLastActivityTime) VALUES(?,?,?)” It’s parameters are ‘bbb’,’name’ and ‘2000/01/01 22:23:25′, using an ODBC connection. I can’t make the date work. Even using the ODBC timestamp format of {ts’yyyy-dd-mm hh:nn:ss’} does no good, although it does work

IMC and Latency

Question: Outbound messages are being delayed randomly. You can send them to the same host—sometimes they don’t queue up long enough to even see. Other times they are there for hours. Also inbound Internet mail randomly will time out with a “unable to find host” error. Can you explain this?

No more posts to show