December 30, 2004

Make Text Scroll Vertically

Use the following code to make text scroll vertically: Vertical ScrollerThis is Vertical Scrollerwww.devx.com

Use GDI to Draw on Top of Other Windows

Have you ever wanted to draw or write something on top of another window using GDI? It can be done by obtainig a DC to the desktop window and then using normal drawing functions on it. For example: HDC hDC;hDC = CreateDC(“DISPLAY”, NULL, NULL, NULL);if (hDC) { TextOut(hDC, 0, 0,

Posting Forms Programmatically

Posting forms in Java is easy. All you need is just a HTML code snippet. Here’s an example: Your Email : * Message : *

A Multiple Getter/Setter Implementation

Suppose you’ve got a user interface class with many user options that you need to set/get at the same time. Here’s one way to implement this: class CUI{public: CUI() : m_bOption(false), m_cOption(”), m_iOption(0), m_dOption(0.0){} //… void GetOptions(bool bOption, char cOption, int& riOption, double&rdOption) { bOption = m_bOption; cOption = m_cOption;

How to Write, Use, and Test a Singleton Class

class Mysingleton{ private Mysingleton objsingleton = null; private Mysingleton() { } //single way to get its instance. public Mysingleton getInstance() { if(objsingleton == null) { objsingleton = new Mysingleton(); } return objsingleton; } public Connection dbconnectivity() { //some connectivity code …. }}public class Testclass{ public void callSingleton() { Mysingleton singobj

Get Separate Records for the Comma Delimited Values of One Field (TSQL)

Use this code: if object_id(‘tblTemp’)0 drop table tblTempCreate Table tblTemp (Field1 varchar(5),Field2 Varchar(100))insert into tblTempselect ‘C1’ Field1, ‘Value1,Value2’ Field2Unionselect ‘C2’ Field1, ‘Value3,Value4’ Field2 if object_id(‘tblTempOutPut’)0 drop table tblTempOutPutselect * into tblTempOutPut from tblTemp where 1=2 set nocount onDECLARE tables_cursor CURSORFORSelect ‘insert into tblTempOutPut Select ”’ + Field1 + ”’ Field1