Archive for June, 2007

The Intuitive Naming Awards…

I found myself needing to subtract a number of days from a date today in SQL Server. I couldn’t think what the function name was that would do this for me so I speculatively typed in DATESUBTRACT, which obviously didn’t work as there is no such function.

So, I had a shufty around the good ol’ Internet and what did I find?

The function I needed to use to subtract from a date was… yes, you guessed it…

DATEADD

I believe the American phrase ‘go figure’ would be appropriate in this instance…

Advertisements

Deploying Web Apps with Powershell

During my recent forays into the world of Rails I have discovered, as do most people working with Rails, the deployment tool Capistrano. For those of you unfamiliar with it, in a nutshell you end up with a simple command that deploys your application either afresh or as an update including all the database stuff etc. Very nifty (or at least it looks like it is as, being a bit of a newcomer to the leafy green world of Linux, I had a few issues but that was me not Capistrano).

In use, you check your source into Subversion and then Capistrano instructs your server to check it out onto the server and organise it all. So the code only gets onto the server when the server ASKS for it rather than when someone puts it there. This is good… Capistrano communicates via SSH and so this is all the server has to listen for. All is well…

Of course, deploying an ASP.NET app is different in that it isn’t necessarily the source that you want to deploy but the binaries. What I hadn’t considered before is to put the builds into source control as well as the source. This then allows you a central repository for the latest build that your servers can draw down from giving you the Capistrano like experience (to a point). What is missing is the SSH-esque bit.

Enter Windows PowerShell. I won’t go on as you can get a good idea of the possibilities by watching Scott Hanselman discuss Corillian’s deployment set up which is extremely impressive I might add.

While I’m about it Scott mentioned that he was after a good PowerShell editor and we had discussed the possibility of a bundle for e-texteditor although I think maybe this fell out of favour a bit as e-texteditor was quite flakey at the time. It is still in beta but much more stable now so that might be something for a budding PowerShell programmer to look into. Also, I just noticed that the new beta of PrimalScript has PowerShell support although I haven’t tried it.