CodeGen

Code Generation In .NET

This is an important site for an important topic.

Years ago I was involved on a project that was seriously delayed due to the failure of a CASE tool. The project had all of the design completely modelled – it was just that the CASE tool that was suposed to split out the code did not work and the company making it went under.

Code Generation seems to fulfill the promise that CASE tools had been making at the end of the 80’s. Kathleen Dollards approach is entirely feasable. She uses XSLT to generate code from metadata that is either manually created or extracted from for example a database. This is ideal for the middle tier and data access layers which are typically mechanical.

Monoppix 1.0 Released

Monoppix 1.0 has been released.

Monoppix is a linux live CD version of Knoppix that includes a working version of Mono.

Knoppix is the major Live CD for Linux. It allows you to experiment with Linux applications without risk to your current operaing system installation. All you have to do is put the Live CD into the CD drive, set the PC to boot from the CD and reboot.

Knoppix is a must have for any PC user. I have managed to get Knoppix to boot and get online even when my PC’s hard drive had failed.

Mono is an open-source implementation of the .NET Framework. There have been complaints that it is hard to configure Linux to get mono to work. A live CD is the best way to demonstrate a working system (so you can easily find what is missing).

Kylix is dead

A couple of weeks ago I attended an introduction to Delphi 2005 seminar.

During the Q & A session questions were asked about the future of Kylix.
A quick summary of the answer is that Kylix is dead.
They have no plans to update the product as yet.

GO is not a Transact-SQL statement

This week I tripped over the following in the MSDN library:


GO is not a Transact-SQL statement; it is a command recognized by the osql and isql utilities and SQL Query Analyzer.

This is a bit of a pain.

I work on a three tier application that makes heavy use of stored procedures (600 and growing).
 
I have a set of expect scripts that I use to refresh the stored procedures.
These are great – it puts a gui onto the batch files that actually run osql commands.
This takes away a lot of the support issues involved in having people misstype complex commands.

The only problem is the scripts are slow to run. It can take 5 mins to refresh the lot.
This is not really that big a problem – but I am trying to put together a continuous integration server and it would be good if the database could be rebuilt very quickly.

To advance my C# knowledge I have started an ADO.NET app that reads the same batch files and then executes the stored procedures (one per file).

This is where I found the above problem. OleDBCommand objects don’t understand the GO command. It looks like I am going to have to preprocess the script and replace GO with ;

Regional Settings Issues

SQL Server 2000 has some interesting issues regarding it’s use of regional settings.
I had a slight problem with some date conversion issues.

If you wanted to convert a string to a date in transact sql typically you would use:

DECLARE @DATE DATETIME
SET @DATE  = ‘2005-03-15 09:46’

This should be 15th March 2005 etc

Since no default conversion has been specified a sane assumption would be that the machines regional settings would be applied. This is how windows applications are supposed to work.

I developed and tested this code on a standard US-English installation of SQL Server.
I even played with the regional settings and it worked just fine.

A customer installed it on a Spanish langauage version of SQL Server and the code broke.
They tried changing the regional settings to US-English and it still did not work.

SQL Server uses the language of the installation to determine the defaults for date conversion.
This is horrible from a testing perpective. I would need to install foreign language editions of SQL Server to test this – and I still can’t find this documented anywhere!

The solution to this problem is to specifiy the date format explicitly using the third parameter of the convert function:

DECLARE @DATE DATETIME
SET @DATE  = Convert(DATETIME,’2005-03-15 09:46′,121)

The moral of this story is don’t trust any automatic conversion always be specific.

Welcome

Welcome to Dev Rants.

This blog contains the random musings of a software developer.

It is probably fair to give some background first.
I am an experience software developer with a diverse background.

The majority of the development that I have done over the last ten years has been in Delphi,
although I have also used C++, Java, Visual Basic, Powerbuilder, APL, Tcl/Tk/Expect,
Python and a fair amount of SQL. Recently I have started investigating C#

I am pro Open Source (but not rabidly so).

This Blog should allow me to record various devlopment issues that I have found along the way. Hopefully someone else (possibly myself down the line) will find these useful.