May 5, 2005

Be Careful When Assigning Data Members During Initialization

Be careful how you assign data members during initialization. For example, consider the following code: class test{ public: test (int y) : j (y), i(j) { } private: int i; int j;}; When compiled, the compiler interprets that as: test (int y){ i = j; j = y;} Because the

Using Inheritance in CSS

Suppose you have a table and you need to give styles to all the tags. Using inheritance to do this helps you avoid generating more content to be delivered to the client. Take this code, for example: This can be replaced with the following style sheet : Table.Cell TD{ }

Using T-SQL to Check Whether a Table Exists

Assume that an application creates a new table every month. The table name can be coined using some pattern, like sales0501, sales0502,, etc. To identify whether a particular table exists in a database, the following query can be used in the application: “select name from sysobjects where xtype=’u’ and name

Manage User Control Values Using Javascript in an .aspx File

Suppose you have a user control named TestControl in your .aspx page. Further, suppose that TestControl contains a textbox named txtFirstName. To access txtFirstName in your aspx page using JavaScript, use: document.forms[0][‘TestControl:txtFirstName’].value To set txtFirstName, use: document.forms[0][‘TestControl:txtFirstName’].value = ‘Naveena’

How To Perform a Telnet Operation from a Java Application

Follow these simple steps to perform a telnet operation from a Java application: Download the free API, jta20.jar. Set the file in the classpath: public class TestTelnet{ public static void main(String args[]){ //instantiate the telnet wrapper class TelnetWrapper telnetWrapper = new TelnetWrapper(); try { //connect to the ipaddress telnetWrapper.connect(“192.168.0.xxx”, 23);

Modeling to Invariants: A Faster Route to Design Convergence

t was the final night of the SD West conference in Santa Clara, CA, as attendees wandered the hotel, seeking the locations of the different BOF (bird of a feather) sessions that we were interested in. Scott Meyers, the C++ guru, was leading a large band through the bar towards