Thursday, August 14, 2008

Regular expressions: Remove last appearance of some element

If you want to match A, B and C but don't want C to be the last element you can do it using this regular expression:


Note that [ABC]+ can be mutch more complex then this is.

Wednesday, August 13, 2008

Binding ASP.NET TreeView to a DataSet or an ObjectDataSource

Excellent article:

Wednesday, August 06, 2008

Monday, August 04, 2008

Retrieve local ip address

CStringArray straIPAddresses;


WSADATA wsa_Data;

int wsa_ReturnCode = WSAStartup(0x101,&wsa_Data);

char szHostName[255];

gethostname(szHostName, 255);

struct hostent *host_entry;

host_entry = gethostbyname(szHostName);

int nAdapter = 0;

while ( host_entry->h_addr_list[nAdapter] )


char * szLocalIP;

szLocalIP = inet_ntoa (*(struct in_addr *)host_entry->h_addr_list[nAdapter]);





Saturday, August 02, 2008

Detect available serial ports

You can use class found at to detect available serial ports on your PC. Class is using seven different methods to enumerate serial ports.