Tuesday, 9 December 2008

Saving Space From C:\Windows\Installer

My home PC has been getting critically short of space recently - medium-term I need to get another hard drive for it but I need to take the case off first to see if I have a SATA connection and it's just a hassle.

I deleted a load of old data last weekend but it hasn't made the dent I was hoping for. I noticed my C:\Windows\Installer folder was huge, like taking up nearly 30% of the used space. I had a look to see it was full of MSI and MSP files, which I didn't know for certain whether I could delete or not. However I Googled the folder path and discovered the existence of MsiZap, which will clean up old Installer files from C:\Windows\Installer. You have to install it and then run 'MsiZap G' from a command line. ZAP! 14Gb gone and a much healthier hard drive :-)

I also discovered Defraggler this week, which might be a better defragger then the Windows XP one or not, but even if it isn't it looks much better as you can see your data moving around the drive as it gets defragged.

Thursday, 4 December 2008

SQLExpress and Compressed Files

Another of those things I'm blogging for future reference...

A little while ago I ran the Windows Disk Cleanup utility to recover some space on my hard drive. One of the things it did was go through my filesystem and compress files that I hadn't used in a little while.

I went back to some of those files yesterday - a WinForms project that I started ages ago that uses a SQL Express database - but when I tried to run the project I got strange errors in my DAL. I fired up SQL Management Studio and attached to my SQL Express instance, where things got even stranger. I had two databases showing, one with the path to my database and one with just the name of the database, but no plus sign next to them to expand them. Couldn't detach them, couldn't delete them. I did a bit of Googling and I saw a comment that SQL Express doesn't work with compressed files. Almost instantly I figured out what had happened - I uncompressed all the files in the folder and everything started behaving itself again.

Tuesday, 2 December 2008

Removing Items From the OutputCache

Today's learning point from StackOverflow:

Whilst it's clear that using output caching is a Good Thing, it can be a little counter-productive sometimes if a user changes some detail that invalidates the cached version of the page e.g. changing the price of a product, adding a new comment to a blog post. But as I've now discovered you can programmatically remove the cached version of the page by calling this static method on the Response stream:
Call HttpResponse.RemoveOutputCacheItem(myCachedUrl)

Looking it up on MSDN I discovered that this method has been present since .NET 1.1 and I've never come across it before!