Code

this.Log– Source, NuGet Package & Performance

Recently I mentioned this.Log. Given the amount of folks that were interested in this.Log, I decided to pull this source out and make a NuGet package (well, several packages). Source The source is now located at https://github.com/ferventc... Please feel free to send pull requests (with tests of course). When you clone it, if you open visual studio prior to running build.bat, you will notice build errors. Don’t send me a pull request fixing this, I want it to work the way it does now. ......

From Zero To Deployed Contest–Winner Announced PLUS Extension To Most Creative

Recently we had a contest to see who could beat my time to get from no code to deployed. Thanks to everyone that participated and everyone that thought about participating in the contest. Most Creative From Zero To Deployed Contest Extended! Unfortunately there were not enough entries to award the most creative video for ZtD. So what we are doing is extending the most creative until May 15, 2011 @ 11:59 PM CST. This gives you almost two months to get your videos in! If you entered before, you are ......

UppercuT - Automated Builds - CruiseControl.NET Integration

So now you are rolling with UppercuT, but you don’t yet have Continuous Integration (CI). You can make that happen with CruiseControl.NET (or any other CI server like TeamCity or Hudson). This article is geared to CruiseControl.NET (CC.NET), although there will be future articles on other CI servers. This is specifically geared towards CC.NET 1.4 and above, because it takes advantage of preprocessors. First a few sideline notifications and then we'll get right into it. UppercuT Compatibility with ......

UppercuT - Automated Builds - User Group

If you have questions, you want to know about new features, or you want to get more involved, feel free to join the group.

http://groups.google.com/group/chucknorrisframework

Uppercut - Automated Builds - DeploymentBuilder

UppercuT comes with DeploymentBuilder. What is DeploymentBuilder? Perhaps you maintain a bunch of deployment scripts that point to all your different environments. We now you can define a template batch file and let UppercuT create all of those deployments scripts for you. It's less for you to maintain, and you no longer have to update a bunch of different scripts. Just one or a couple depending on the types of deployment. To help people better understand what it can do, we've included a starting ......

Super D to the B to the A – AKA Script for reducing the size of a database

The following is a script that I used to help me clean up a database and reduce the size of it from 95MB down to 3MB so we could use it for a development backup. I will note that we also removed some of the data out. I shared this with a friend recently and he used this to go from 70GB to 7GB! UPDATE: Special Note Please don’t run this against something that is live or performance critical. You want to do this where you are the only person connected to the database, like a restored backup of the ......

Refresh Database–Speed up Your Development Cycles

Refresh database is an workflow that allows you to develop with a migrations framework, but deploy with SQL files. It’s more than that, it allows you to rapidly make changes to your environment and sync up with other teammates. When I am talking about environment, I mean your local development environment: your code base and the local database back end you are hitting. Refresh database comes in two flavors, one for NHibernate and one for Entity Framework. I’m going to show you an example of the one ......

Symbolic Regular Expression Exploration

This is a pretty sweet little tool. Rex (Regular Expression Exploration) is a tool that allows you to give it a regular expression and it returns matching strings. The example below creates10 strings that start and end with a number and have at least 2 characters: > rex.exe "^\d.*\d$" /k:10 This is something I could use to validate/generate the Regular Expressions I have created with both UppercuT and RoundhousE. Check out the video below: Margus Veanes - Rex - Symbolic Regular Expression Exploration ......

Virtual Alt.NET – UppercuT Automated Builds

Tomorrow on February 24th, 2010, I’m going to be giving a presentation on UppercuT (UC) at Virtual Alt.NET (VAN). If you are interested in learning about an automated build tool that will save you time and get you to a professional build in moments, not days, you can log into the VAN around 8PM CST on Wednesday (tomorrow). You don’t even have to go to a physical place to see the presentation! You can hang out from the comfort of your own home and watch me walk through how easy it is to use UC. Here ......

HowTo: Use .NET Code on a Network Share From Windows

If you use VMWare/VirtualPC and you want to offload your source code repositories to your host OS and code from it inside the VM, you need to do a few things to fully trust the share. I’ve found that I keep heading out and searching on this every time I need it so I thought I would write it down this time to save myself the trouble next time. CasPol Changes Save the following as caspol.bat: %WINDIR%\Microsoft.NET\Fram... -q -machine -ag 1.2 -url file://e:/* FullTrust %WINDIR%\Microsoft.NET\Fram... ......

DropkicK–Deploy Fluently

DropkicK (DK) has been in development for over two years and has been used for production deployments for over a year. Dru Sellers originally posted about DK back in 2009. While DK isn’t yet as super easy to grok as some of the other ChuckNorrisFramework tools and offers little in the idea of conventions, it is still a stellar framework to use for deployments. DK works well in environments where you know all of the environments you will deploy to ahead of time (although not required due to the ability ......

SidePOP XMLConfigurator

From my previous post on SidePOP, I wanted to make it even easier to configure SidePOP. So instead of the configure_mail_watcher() from the last post, this is what it looks like now: private void configure_mail_watcher() { EmailWatcherConfigurator configurator = new SidePopXmlConfigurator(); foreach (EmailWatcher emailWatcher in configurator.configure()) { emailWatcher.MessagesReceived += runner_messages_received; emailWatcher.start(); } } Pretty. Notice that Runner became EmailWatcher and instead ......

How To Check Email Programmatically - SidePOP

Background Sending email has long been easy to do with the .NET Framework. There really hasn’t been a facility for checking email though. I recently had a need to be able to check email with and send a response with Bombali (a monitoring tool). I went searching for examples or a solution I could use. I found a few articles on this from a few years ago including the .NET POP3 MIME Client. I never found anything that was free and I never found anything that was easy to configure. Those who know me ......

Command Line Parsing on Windows with Mono.Options

When you have command line arguments to parse (whether on Windows or Linux), the place to look is Mono.Options. To date, I have not found anything better to get the job done. It is a single C# file if you do not want to download the entire Mono Library to use it. I was first introduced in Mono 2.2. The equivalent product is NDesk.Options by Jonathan Pryor. His single Options.cs file has been implemented as Mono.Options. To demonstrate how easy command line parsing can be, I’m going to show you is ......

RoundhousE: Version Your Database

Versioning your database is as important as versioning your code. How much time do we waste currently before we are even productive when we have to fix or enhance something in a database? RoundhousE versions your database how you want. The recommended way is to version based on source control, but that may not be your solution. But for a moment let’s pretend it is. Why would versioning your database based on source control be a big help? What happens if you get a prod fix (or work order) to fix a ......

NHibernate Event Listener Registration With Fluent NHibernate

I’m a huge fan of NHibernate. It has excellent documentation and just makes the whole job of getting things into and out of the database much more enjoyable. There is a whole series of posts on NHibernate from one of the committers, Ayende. When Fluent NHibernate (FNH) came out, it was like butter on sliced bread. FNH makes it even easier to use NHibernate. Ayende had a post a while back on how to use Event Listeners. That helped me to get to event listeners set up. Event Listeners namespace somethingimportant.we.hope.... ......

RoundhousE: Configuration

This week I introduced RoundhousE and it’s getting quite a stir. Let’s take a look at the configuration. We are going to focus on the MSBuild/NAnt task configuration for now because the console isn’t yet complete. The console will actually have at least this much if not more (we’ve talked about how to use it to create the migration scripts and not just run them). Because we like to be able to infer things, we have determined that there are only two required items. Thus – the minimal configuration: ......

RoundhousE DB Migration: Action Shots

I just started the appetites with my last post on RoundhousE. RoundhousE itself has a migration sample to help you get familiar with how it works. You can get to that by using a subversion client to download the source. When you download the RoundhousE source from SVN and run build.bat, you get a code_drop folder. Go in there and look at the deployment folder for a sample run. Prerequisites: Locally installed (and running) SQL Server 2008 Run That Bad Boy When you get into the code_drop folder, take ......

Published Applications AKA _PublishedApplications

Less maintenance. Less work to package during your automated builds. Too easy. Remember Our Old Friend _PublishedWebsites? You’ve probably seen the _PublishedWebsites folder when building websites in automated builds. If not you can stop paying attention now. Still with me? Great! So you know how it packages up everything nicely with content files going where they should with nearly ZERO cost to your build scripts. All you need to do is override the output directory (OutDir) and you get this feature. ......

AppHarbor - Azure Done Right AKA Heroku for .NET

Easy and Instant deployments and instant scale for .NET? Awhile back a few of us were looking at Ruby Gems as the answer to package management for .NET. The gems platform supported the concept of DLLs as packages although some changes would have needed to happen to have long term use for the entire community. From that we formed a partnership with some folks at Microsoft to make v2 into something that would meet wider adoption across the community, which people now call NuGet. So now we have the ......

UppercuT v1.2–NuGet Support

For those that have not yet heard, NuGet went v1 recently along with a whole slew of tools from the Microsoft folks. I’ve been lucky to be a part of the NuGet project and see it take shape over the past few months with community input and contributions. Even though v1.0 was released, we are already moving forward with getting ideas and prioritizing features for the next version. To follow the announcement, UppercuT (UC) v1.2 now includes support for NuGet out of the box. Plus, it will handle versioning ......

The Evolution of Package Management for .NET

The thing to realize is that the destination is never the most important part of the journey. It’s the journey itself. When you start a journey, you are never fully sure where it is going to end up. We started the journey down package management for .NET three times with Nu[bular] (we in this context means the nu team, not me in particular, I was only involved in the last reboot) before we decided to try an existing infrastructure with Ruby Gems. I have always said that I would use the best tool ......

Herding Code Talks About Nu

Dru and I were recently featured on Herding Code Podcast. In the podcast we talk about everything from package management in general to Nubular (Nu) to other package management systems (OpenWrap, Bricks, and Horn, although horn was/is slightly different) to the possibility of Microsoft releasing a package management system. It was a good time and I enjoyed doing the podcast, but the herding code guys start recording at an insane 10:30 PM! I have no idea how I made it through the whole thing and was ......

Gems For .NET – Community Response

There has been a lot of response in the community about this gems idea we’ve been talking about. I even had the opportunity to sit down with Nick Quaranto, the guy behind Rubygems.org, over coffee Sunday and talk about where we think we are going and what it will take to get there. One of the biggest things that everyone wants to see carrying this idea forward is that we migrate off of Rubygems.org and have our own gem server. And we all agree this is a great idea. There are just two things that ......

How To – Gems And .NET – Dependencies (References)

In my last post I didn’t mention dependencies. Dependencies are their own animal. They require a couple more things to be in place. Let’s talk about those things. In the .NET world, the dependency for compiled bits is usually an exact version of a reference. Let me explain. So for example, you have a reference to log4net, and you don’t ILMerge it into your assembly. You now have a dependency that the DLL needs to be there and a particular version (outside of redirecting the bindings). So what I’m ......

How To - Gems And .NET

In my last post I showed gems being used for .NET. Now let’s talk about How. Most of this stuff I’ve learned over the past two days, so if I have a mistake here or you have a better idea, please don’t hesitate to offer a better solution. The GemSpec The Gem::Specification reference is your friend. In order to create a gem, you need to define a gem specification, commonly called a “gemspec”. A gemspec consists of several attributes. Some of these are required; most of them are optional. From here ......

The Future of .NET Open Source Software Delivery

Imagine we are awhile into the future. How do you get open source releases down to your project so that you can use them? How do you get the products down to your computer so that you can use them? Is it easier or harder than the way we’ve always done it before? The Past and Present Before we can go there, let’s look at what we do now (the past is really the same for us here). Let’s say I want to use NHibernate. What do I do? There are basically three paths we all follow in this process. 1. Never ......

How To – UppercuT and Gems

In a previous post I mentioned how I was going to show you how UppercuT (UC) has the ability to make gems stupid simple to create and publish. You ask if gems can get any easier and to that I answer, “Why YES, they can!” How about just filling out the information for the gemspec, running a build and having a nice, shiny new gem ready for publishing? Rock The Gems Basically you want to get the latest release of UppercuT. You can download it or grab the source and compile. There are already instructions ......

Nothin but .NET Developer Boot Camp - Day 5

Friday was the last day of the training course and today we went over a couple of patterns and had a discussion on Domain Driven Design. After the discussion, we were released to continue working on our end to end solution. The team I was on (Go Conquistadors!) got all the way down to the database second out of four teams. We were first to have all parts vertical though. Then we started to refine our design even more. And that is where we left the solution on Friday night. People Bowing Out As the ......

Nothin but .NET Developer Boot Camp - Day 4

So you may notice this post is a little late. The course moved to an open format today and the last people left for the night at 4:30 AM. That's 9 AM to 4:30 AM. Basically today we got direction from JP and then formed groups that we worked with all day to implement an end to end solution from the point that we were already at. One of the things you will push yourself for today is understanding fluent interfaces to whatever extent that you can. The other part is how to build them. They are much harder ......

Nothin but .NET Developer Boot Camp - Day 3

Today the most important thing is Coffee! When you take this course (not if *grin*) you definitely need to get coffee after lunch. Some things of note today: Group Interaction There is a lot more group interaction with tasks and the tasks are getting to a point where they take quite a bit lot longer to complete. Group dynamics has definitely picked up and come into play a lot more because by the third day you are much more comfortable with everyone. I am seeing personalities coming out as we get ......

Nothin but .NET Developer Boot Camp - Day Two

Today has been awesome! More of what we learned yesterday, plus more. We got more in depth into certain patterns and have had a huge helping of BDD all day long. The format has been that JP has written the specs and we get the tests to pass. The format looks like it will start to shift to JP doing less and less code and us doing more and more of it. Three Project Solution So one thing I immediately picked up on is the 3 project solution. One of the projects holds all of the automation and automated ......

Nothin but .NET Developer Boot Camp - Day One EOD Update

Today I learned I have a lot to learn! Patterns, Delegates, Lambdas, PSake, Extension Methods, etc, etc, etc. Photo credit to Hikako. So far we have went through patterns and principles. Ones that come to mind are the Strategy Pattern, Static Gateway Pattern, Decorators, and Specification Pattern. We also got into SRP (single responsibility principle), OCP (open closed principle), Composition over Inheritance, BDD (behavior driven design), DDD (domain driven design), and then we talked a little about ......

Nothin but .NET Developer Boot Camp - Day One Midday Update

My brain hurts. That is all.

Delegates FTW!!!!

Going Back to Boot Camp

In 1998 I went through Basic Combat Training for the United States Army. It was 9 weeks of grueling, awesome and exhausting training. It was training that definitely pushed the limits of your body and mind. I learned quite a lot and the training forever shaped the person I am today. Next week, I will have the opportunity to go to Boot Camp again, but this time it will be for .NET development. JP Boodhoo, a great guy who I met at Alt.NET, conducts a course known as Nothin' But .NET Developer Boot ......

Call For Input: Branch Development Syncing Issue

All of the code we write must be tested and accepted by users before it can go into production. Which brings about a unique possibility of a syncing issue when we are doing so in a branch development scenario. The image below is a great reference. Say we have two imaginary branches, one for features and two for production fixes. In reality there would probably be a branch for every production fix and multiple branches for on-going development. The trunk is code that has been released to production. ......

From Zero to Continuous Integration Presentation: Tulsa TechFest 2008

Thanks to all who made it through my talk on Continuous Integration, as it was pretty dry with lots of page refreshing to show changes as we were building. I am thinking this presentation isn't geared towards a fast format or I wasn't quite ready for it. Either way, CI is an important tool to leverage anywhere code is being written, even if it is a dry talk. :D Here are the files and the configuration that show how to connect up to SVN, VSS, TFS, and Vault. Also there is a triggered build in here ......

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 ......

Enhancing VisualSVN Server to Allow Anonymous Access

Rick Strahl had a great recent post on Running VisualSVN Server for Subversion Source Control. I have been running VisualSVN Server for my repositories for a little while now and especially love how painless the setup is. Not to mention that VisualSVN Server is 100% free! One part that I especially liked was the part I have been missing and that is anonymous access to repositories. I have been thinking about having this for awhile and with Rick's post I was able to allow it: Anonymous Repository ......

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 ......

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" ......

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 ......

Inserting into Microsoft SQL Server Database Identity Columns

This came up in a discussion the other day so I thought I would share it. CREATE TABLE dbo.TestIdentity ( ID bigint identity(1,1) --primary key ,[Desc] char(20) ) INSERT INTO dbo.TestIdentity ([Desc]) values ('first') INSERT INTO dbo.TestIdentity ([Desc]) values ('second') SET IDENTITY_INSERT TestIdentity ON --note the identities being inserted INSERT INTO dbo.TestIdentity (ID,[Desc]) values (1200,'id-third') INSERT INTO dbo.TestIdentity (ID,[Desc]) values (1,'id-fourth') -–this works until you set ......

Test Driven Success Story Plus Side Effects of Good Design

Once you understand good design and the benefits, you don't go back. One of our projects at work has nearly 800 tests in it (across 5 test projects). The point isn't that we have 100% test coverage (because I doubt we do). The point is that we know how a method behaves when sent empty and null values, and also for nearly every edge case in addition to the happy path. Most of these are 800 tests are logical unit tests. Some are system integration tests (parts of the system working with each other). ......

Continuous Integration Enhancement : The Broken Build Token!

I thought I would post about this because I find myself putting notes about this in comments here and there. One of our team members bought the rabies plush doll from ThinkGeek a little over a month ago. From the site: Most folks never realize how cute microbes can be when expanded 1,000,000 times and then fashioned into cuddly plush. Until now, that is. Keep one on your desktop to remind yourself that there is an "invisible" universe out there filled with very small things that can do incredible ......

Gems - Package Management For .NET

The Ruby community has enjoyed a great user experience with a package management system they use called Gems. A gem is a package (or a library), compressed with some additional metadata, and can be either source files or binaries. Let’s focus on binary gems. We have the same concept in .NET (DLLs/EXEs). You may have references to other DLLs. When you want to update a reference you are using on a project, you may also need to update its dependencies as well. And so on and so forth. A package management ......

UppercuT - Automated Builds - ConfigBuilder

UppercuT comes with ConfigBuilder. What is ConfigBuilder? ConfigBuilder will build a configuration file per environment so you no longer have to maintain a bunch of configuration files. In any project you have app.config (or web.config) files. You just create a .template file next to it. The web.config has a file next to it named web.config.template. What do you name the app.config template files? You have to name the file based on what app.config becomes when visual studio builds the application. ......

Full Code Archive