Thursday, April 17, 2008

Lock free communication channel

By taking advantage of existing Windows XP API such as InterlockedPushEntrySList and InterlockedPopEntrySList is possible to decouple data exchange in communication channel. That is very important in places where processing speed is crucial point. “An interlocked singly linked list eases the task of insertion and deletion from a linked list. Singly Linked Lists are implemented using a non-blocking algorithm to provide atomic synchronization, increase system performance, and avoid problems such as priority inversion and lock convoys.” Access to the Singly Linked Lists is synchronized on a multiprocessor system, and with no need of locking mechanism.

Writer’s thread will save data into Singly Linked Lists and assign unique ID to the package. Then reader’s thread will pick packages one by one, order them by ID, and store packages in a cache list.

The cache itself could be ignored when processing is interested only in latest package – real time data. Since InterlockedPopEntrySList could read packages in random order, is considered necessary after extracting all packages from a cache to find latest one.

Singly Linked Lists are straightforward to implement and use in 32-bit code.

Monday, April 7, 2008

SQL Express failed to install


During SQL Server Express installation on Microsoft Windows XP Home Edition next unexpected error occurs:

Product: Microsoft SQL Server Native Client -- Error 1706. An installation package for the product Microsoft SQL Server Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'.

Workaround:
Extract 'sqlncli.msi' file from a package and install separately, then run SQLEXPR32 again.

Wednesday, April 2, 2008

Backing up and restoring MySQL db via the command line


In Windows click Start, select Run and type cmd, then hit OK button.

Backing up via the command line

    mysqldump -a -u USERNAME -p DATABASENAME > FILENAME.sql

Restoring via the command line

Drop the database (optional):

    mysqladmin -u USERNAME -p drop DATABASENAME

Create the database:

    mysqladmin -u USERNAME -p create DATABASENAME

Import the backup data:

    mysql -u USERNAME -p DATABASENAME < FILENAME.sql