Monday, January 26, 2009

Changing the default backup directory for SQL 2005

I got tired of using regedit to do this (the value is in HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\{your instance}\MSSQLServer\BackupDirectory) and write a quick script to do it. I found it really tedious to change this on so many servers and clusters. It'll work with all versions of SQL 2005 and Express AFAIK.

I've posted it for anyone else interested, and be aware that it does use the "undocumented" xp_instance_regread and xp_instance_regwrite extended stored procedures.


DECLARE @SmoDefaultFile nvarchar(512), @NewBackupDir nvarchar(250);
SET @NewBackupDir = N'\\dbs51ykf\SQL_Backups'; --THE NEW BACKUP DIRECTORY TO USE

--LIST THE CURRENT DIRECTORY
EXEC master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\MSSQLServer\MSSQLServer',
N'BackupDirectory',
@SmoDefaultFile OUTPUT;

SELECT @SmoDefaultFile as [Old Backup Directory];

--CHANGE THE DIRECTORY
EXEC xp_instance_regwrite
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\MSSQLServer\MSSQLServer',
N'BackupDirectory',
REG_SZ,
@NewBackupDir;

--CONFIRM CHANGE
EXEC master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\MSSQLServer\MSSQLServer',
N'BackupDirectory',
@SmoDefaultFile OUTPUT;

SELECT @SmoDefaultFile as [New Backup Directory];

Monday, January 12, 2009

Hiding Panels in ASP.NET

When you're using the AJAX controls with Visual Studio you'll probably eventually make use of the ModalPopupExtender control. I like it.
The one issue is that you'll see it flicker while loading the page unless you add the following to the panel style:

Style="display:none"

This will ensure the panel doesn't show and then disappear during a page load.

Sunday, January 11, 2009

Hello Roomba my old friend...

Ah Roomba. The Roomba has made my life even easier and for that I say thank you. I won't lie; I hate doing "chores". Vacumming (seriously; how do you spell this in Canadian English??) sucks a lot. It takes time, it throws dust all over despite the HEPA filter, and it's just not a task I WANT to allocate some of my finite amount of time to.
So, flush with Christmas cash I bought a Roomba. I couldn't be happier! The Roomba (530 model) does an excellent job of cleaning my apartment (all hardword/laminate and vinyl) and it does it while I lay in bed, play games, surf the 'net, pick my nose... you get the point.
< /roomba promo>

The other reason I'm so satisfied with my Roomba is the fact that I can hack it. I've already wired up an RS232 converter from Maxim and hit Sayal for parts to breadboard that via some Cat5e cable and started writing a C# app (yeah, I've dropped VB.NET... I'm a switcher!) It's working quite well and I've already been able to program my Roomba to clean on a schedule while I'm at work; can the future get any more real?! I've got a freaking robot cleaning my place while I'm at work!! AWESOME!
Anyways, I'll likely be tossing the source code up on something web-ish when it's done, and I'll certainly be helping out my friends to hack their Roombas. Here's a video until I get more done.


I would like to conclude this note by saying: I HAVE BEEN VALIDATED!!!