September 2008 Entries

SharpZipLib Versus 7-Zip for Large File Sets

Recently I was asked to help out when we had a need to reduce the size of a directory of rolling backups. And when I say size, I am talking around 12GB a day backup sizes. This was already a compressed directory, but I found that if we zip up the folders, we can get even better compression (to the tune of 60+% more room). First note: Windows built-in zipping utility is not so good, it won't even try to compress anything that size. Instead it throws an error. Nice. Basically I started working with ......

Late on Your Credit Card Bill? You May Be Able to Avoid Default Rate

You just realized that you forgot to pay your bill and it was due yesterday. What do you do? Pay it and call customer service immediately. They may be able to help you out, especially if you have been a good customer and are cordial on the phone. There is probably a grace period on your account. Understand that this has nothing to do with how late your payment can be without adverse action. Grace period is how long before the credit company starts charging you interest on new purchases (typically ......

Defining MSBuild And NAnt Tasks Together in the SAME Class

I haven't seen ANYONE talk about putting MSBuild together with NAnt. To me, writing two separate classes (one for MSBuild and one for NAnt) is repetition. There may be a reason to keep them separate (and that might have to do with keeping other required assemblies around, i.e. NAnt.Core.dll when just wanting MSBuild), but I have not found a really good reason yet to separate them. If someone does, please let me know. I just made the two play nice together in my last post ......

How to Programmatically Install A Windows Service (.NET) on a Remote Machine (with or without Dependencies) - Part Two

Last time we created WmiService. Now we are going to create the Tasks so that we can call it from the build script. This time we are going to get our Create Service and Delete Service into our Automated Deployment Scripts of MS Build and/or NAnt. Let's define our tasks. The MS Build Tasks <CreateService MachineName="serverName" ServiceName="aService" ServiceDisplayName="A Service" PhysicalLocation="C:\Locati... StartMode="Automatic" UserName="user" Password="password" Dependencies="MSMQ,hlpsvc" ......

How to Programmatically Install A Windows Service (.NET) on a Remote Machine (with or without Dependencies) - Part One

Sometimes there is no good way to do things on remote computers except through something as low level as WMI (Windows Management Instrumentation). Installing a service is a great example of this. Fortunately for us, Jared Boelen has already figured this out. I recommend reading his posts on how to do this. We are not going to get into the actual MS Build Task that he put forth this time, just the code that would allow you to install a service remotely. NOTE: This is based heavily on Jared's code ......

MSBuild.Community.Tasks - WebDirectoryCreate / WebDirectorySettings Patch Accepted

It appears that my patch finally got accepted and rolled into MSBuild Community Tasks. I posted it back in December and just saw the commit email in the last two weeks. It is the first patch I have submitted to Open Source that has been accepted (also the only patch submitted so far). I plan on submitting patches to this and possibly to Nant as I start working heavily in tasks in the near future. One of which will be ServiceCreate based on one I found from a guy, except adding the ability to set ......

Replacing Notepad With Notepad2 on Windows XP SP3

One of my favorite utilities is Notepad2. I had a script to replace the original Notepad with Notepad2 on Windows, but as of Windows XP Service Pack 3, that no longer works. Luckily, I found this script from Travis: @echo off echo *IMPORTANT* echo This will kill all open instances of Notepad. echo To cancel, end this batch file now (ctrl+c), or hit any key to continue. pause echo Killing all instances of notepad running... TASKKILL /F /IM notepad.exe /T echo Backing up... call :backup %systemroot%\servicepackfil... ......

Do Not Store Environment Files in Source (i.e. config files) - Just Say No To Environment Files Period

Environment files in source control are a big No No. Environment files are a big No No anywhere. Period. Except one place - where they are used. You should ONLY maintain ONE local environment file. You should only store in source that one file that is needed to run the code locally. If you have a config.DEV, config.TEST, config.PROD, etc. YOU ARE WRONG! Stop this, you are causing yourself more pain! Every time you update one value, you have to update it in several places. You are violating DRY (don't ......

Tools Matter: Automated Builds / Automated Deployments

Recently Oren posted about how Tools Matter. I agree completely (110%!). I remember a time when we didn't have automated builds and most assuredly didn't have automated deployments either. I remember how long it took to get an environment set up. Our testers would ask us to put the latest code in an environment and it would literally take over an hour sometimes to get the environment updated because we would deploy first to a DEV environment and then a TEST environment for them. Then we would have ......

Windows Services: Update Configuration Without Restarting The Service Follow up

I recently posted on How To Receive Configuration Updates without restarting a .NET Windows Service. For some reason it never showed up in Google Reader. I guessed the reader maybe missed it for some reason. Perhaps it was something in the naming of my post. Like I mentioned in the article, it is possible to update the configuration and not have to restart the service. I was interested in learning how when I saw that log4net was doing it. I didn't take quite the same path they did, but I was influenced ......

.NET Windows Services: How to Receive Configuration Updates without Restarting the Service

Something I have been working on recently is a utility that will watch the configuration file and let me know when it changes. It is a work in progress (I am always tweaking code) even though it works now and I am always open for feedback. I was heavily influenced by looking at how log4net implemented the same thing with the XMLConfigurator (although they used a custom way of getting the file). Basics of How to Receive Configuration Updates Without Restarting a Service To start setting up a configuration ......

MCSD Certification Retiring March 31, 2009

You know you've had a certification a long time when it's retiring. http://www.microsoft.com/le... Not sure if I will get another one yet or not. In the world of programming, I have noticed that certifications really don't seem to mean as much as in other career paths. Some may disagree with me on that statement and that is fine. But having the certification doesn't mean I am better at what I do over the next guy, and it certainly isn't a legal requirement for ......