« October 2004 | Main | December 2004 »
November 30, 2004
Genetically Engineered Plants Detect Land Mines

This is a truly amazing and useful genetic invention.
A Danish company, Aresa Biodetection, has developed genetically-modified flowers that change color when their roots come in contact with nitrogen dioxide in the soil. Explosives used in mines produce NO2 as the chemicals gradually decay. The company plans to sow fields of NO2-sniffing Arabidopsis thaliana (Thale or mouse cress) in areas riddled with long-forgotten ordinance from Angola to Cambodia.
The effort's life- and limb-saving potential is staggering: More than 100 million land mines kill or injure 26,000 people in 45 countries each year. Today's most popular detection method is poking around with a stick.
Posted by 0xFF3300 at 10:49 AM | Comments (0) | TrackBack
November 24, 2004
The SQL Server Timestamp Type
Ahhh. The dreaded TIMESTAMP datatype. Unfortunately you really can't use TIMESTAMP for any type of comparison. Or really for much of anything. To quote from SQL Server Books Online:
"The SQL Server timestamp data type has nothing to do with times or dates. SQL Server timestamps are binary numbers that indicate the relative sequence in which data modifications took place in a database. The timestamp data type was originally implemented to support the SQL Server recovery algorithms."
It further states Never use timestamp columns in keys, especially primary keys, because the timestamp value changes every time the row is modified.
I'd suggest using a DATETIME or SMALLDATETIME column in this case. DATETIME columns can store dates from January 1st, 1753 through December 31st, 9999 (there's that Y10K problem) and are accurate to roughly 3 milliseconds. They use 8 bytes of storage. SMALLDATETIME columns can store dates from January 1st, 1900 through June 6th, 2079 and are accurate to the minute. SMALLDATETIME columns only use 4 bytes of storage.
You can insert values into DATETIME columns (or SMALLDATETIME) columns by enclosing them in quotes.
INSERT Table1 (DateTimeColumn)
VALUES ('6/3/2021')
This will insert the date part with the time set to midnight (12:00:00 AM). You can insert the current system date and time using the GETDATE() function:
INSERT Table1 (DateTimeColumn)
VALUES ( GETDATE() )
Your SELECT statement from above might look something like this:
SELECT * FROM links WHERE gdate = '2000-11-05'
This will run fine if you are putting dates in with no times. If you are adding times and want all the records for a particular day you can do something like this:
SELECT * FROM links WHERE LEFT( CONVERT(varchar, gdate, 120), 10) = '2000-11-05'
Using the CONVERT function makes SQL Server very picky about formats though (since that's what CONVERT does).
Posted by 0xFF3300 at 09:46 AM | Comments (0) | TrackBack
November 22, 2004
Google Makes Deskbar API Public
This seems to be good news direct from Google PR:
Today, Google announced the availability of the Google Deskbar API (application programming interface). This technology makes it possible for software developers to build their own features, or plug-ins, for the popular Google Deskbar.
For instance, a developer could use Google Deskbar APIs to create a movie search command that enables users to search their favorite movie site by entering a movie name into the Deskbar search field and typing a special command such as "Ctrl'M." Other examples include:
- Locate and play a music play list on your hard drive
- Solve algebraic equations
- Send instant messages from the Deskbar (example: type "AIM
- [screen name] [message text]")
Results will be displayed within the Google Deskbar mini-browser which appears to the bottom right of the user's computer. New features developed with the Google Deskbar API will be displayed as an option in the Deskbar main menu.
The Google Deskbar API is in the experimental, beta phase. We invite developers to use the service and encourage them to send us their input and feedback. Plug-ins can be written in any .NET language, such as C# or Visual Basic.NET. More information about the Google Deskbar API can be found here:
http://deskbar.google.com/help/api/index.html
Posted by 0xFF3300 at 09:35 AM | Comments (0) | TrackBack
November 19, 2004
Microsoft Patents BASIC IsNot Operator
Unbelievable, MS has moved to actually patent the IsNot operator in BASIC.
Abstract
"A system, method and computer-readable medium support the use of a single operator that allows a comparison of two variables to determine if the two variables point to the same location in memory."
Posted by 0xFF3300 at 11:18 AM | Comments (0) | TrackBack
November 15, 2004
TryEnterCriticalSection vs EnterCriticalSection
I have always wondered about the advantages of TryEnterCriticalSection vs EnterCriticalSection.
To enable mutually exclusive access to a shared resource, each thread calls the EnterCriticalSection or TryEnterCriticalSection function to request ownership of the critical section before executing any section of code that accesses the protected resource. The difference is that TryEnterCriticalSection returns immediately, regardless of whether it obtained ownership of the critical section, while EnterCriticalSection blocks until the thread can take ownership of the critical section. When it has finished executing the protected code, the thread uses the LeaveCriticalSection function to relinquish ownership, enabling another thread to become owner and access the protected resource. The thread must call LeaveCriticalSection once for each time that it entered the critical section. The thread enters the critical section each time EnterCriticalSection and TryEnterCriticalSection succeed.
After a thread has ownership of a critical section, it can make additional calls to EnterCriticalSection or TryEnterCriticalSection without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns.
Posted by 0xFF3300 at 04:04 PM | Comments (0) | TrackBack