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

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

.NET Framework 3.5 SP1: No More Need for CasPol on Network Shares

http://www.infoq.com/news/2... In the past, one could not run managed code from network shares due to security reasons. That feature was introduced in .NET from the beginning to prevent security attacks coming from network locations. The feature did not resolve the respective security threats because unmanaged code always was allowed to run in such a circumstance. A pool organized by Brad Adams, Program Manager at Microsoft, shows that many people would like to have ......

Calling PowerShell Functions with Parameters

This threw me for a loop today. You can't call a PowerShell function with commas "," or parentheses "()" and have it believe it goes to both parameters. Try running the following and see what your output is on every line call to "foo." function foo([string]$a, [string]$b) { Write-Host "a:", $a, " b:", $b } foo("A", "B") foo "A", "B" foo "A" "B" foo("A", "B") "C" rm function:/foo You may find you get different results than you may first expect. I did. Reference: http://weblogs.asp.net/soev... ......

TFS 2005 Team Build Error: Referenced Assembly Missing (Not In Build Folder)

You may run into this at some point. TFS Team Build may not deploy some assembly file you needed. If you look through the logs, you will see something like this (cleaned up for readability): C:\WINDOWS\Microsoft.NET\Fr... /noconfig /optionstrict+ /rootnamespace:Company.Proj... /doc:obj\Release\Company.Pr... /define:"CONFIG=\"Release\"... /reference:..\libs\Castle\C... ..\libs\Castle\Castle.Dynam... ......

Possible Performance Counter Corruption Or Performance Counters are Just Disabled | SQL Server 2008 Installation Errors

If you are installing SQL Server 2008 (or anything for that matter) and it won't let you continue for the following reason: Rule "Performance counter registry hive consistency check" failed. The performance counter registry hive is corrupted. What does this mean? This may mean that the value in HKEY_LOCAL_MACHINE\SOFTWARE... NT\CurrentVersion\Perflib under Last Counter and the last number value in Counter under HKEY_LOCAL_MACHINE\SOFTWARE... NT\CurrentVersion\Perflib\009 ......

Always Use Nullables for Dates Follow-up

I have always wondered why you can't have an "empty" date in VB and C#. I had some good feedback on my recent post on nullable dates and I wanted to clarify why I think nullables are great for dates. The point I am trying to get across is that with dates, in a business sense, you either have a date or you don't. You never really have a 01/01/0001. Using 01/01/0001 or 01/01/1753 is a hack for lack of being able to say that you have an empty date. I am going to make a quick comment on strings. Strings ......

SQL Server 2008 Ready - VS2008 SP1 Coming Aug11

On MSDN you are greeted with this: The fun begins: Thanks Steve ......

Always use Nullables for Dates: C# and VB.NET

Always use Nullables for dates at the least. Trust me on this. I dogged Nullables for the longest time because I thought they were buggy, then I realized today when testing that I was using them wrong. Nullables allow you to actually have null values, which for dates is arguably a must. Why? Keep reading... Tip: Never call Nullable.Value. The nullable item will error out if it is a null value. This is where I was going wrong and thought they were buggy. Just call the nullable item and it will return ......

How Did I Get Started Programming?

How old were you when you started programming? Well, most people don't know that I am still kind of new to computers. I grew up poor and my first experience with computers was in high school (Apple IIs and Craptastic Macs). I almost failed keyboarding class in 7th grade (required a minimum of 27 WPM with less than 4 errors/minute). I actually didn't own a computer until I was in my second semester of college. It was a Gateway and it broke so much I got good at fixing computers. That was 1998. I have ......

End2End Automated Testing: Second Day & More Thoughts on Why Automation

How about doing a full regression of the system under development every ten minutes? Second Day Automation Testing One of the things I neglected to mention (on purpose) in my End2End post the other day was that you also test for the second day. In this test you are sending in new items and updating some existing items. You also leave some of the items from the first day completely alone to see what happens to them. This is done in the same way as the first, except you look for a second input file ......

Problem Solver or Developer?

My friend Raymond just posted a great perspective on development. I have come to the conclusion that I am a problem solver. That’s my business. Whether its process management, software architecture, personal growth for my development team or trying to keep my daughter from stealing my son’s toys, I solve problems. I totally agree with Raymond about being a problem solver. I have been saying that for years, so it's nice to see someone else come to this conclusion as well. One thing I have learned ......

Automated Deployment - MSBuild.Community.Tasks - WebDirectoryCreate / WebDirectorySettings Example

From my previous post of WebDirectoryCreate I have an example script of how you would use MSBuild Community Tasks to Set up Virtual Directories and/or do updates to the current virtual directory. The below is an example of how you can create or update virtual directories. This is what you would add to the MSBuild.proj file. <PropertyGroup> <!-- Virtual Directory Items--> <EnableVirtualDirectoryS... <VirtualDirectoryApplica... ......

MSBuild.Community.Tasks - WebDirectoryCreate / WebDirectorySetting / WebDirectoryDelete

Recently I submitted a patch for the MSBuild.Community.Tasks because there were certain tasks that were not working for us. I decided to blog about this because there are others that indicated they were having the same issues. In IIS, you are able to specify more than one website with the same ports. By default, the WebDirectoryCreate task will always loop through and choose the last website with that port. If you do have more than one website with the same ports, you need to distinguish differences ......

Subversion 1.5.0 Released

Subversion (SVN) just released version 1.5.0 recently on June 18, 2008. With it comes bug fixes and boosts in performance. It is highly recommended that you reference the release notes, and pay attention to merge tracking: Merge tracking means Subversion keeps track of what changes have been merged where. This reduces the overhead involved in maintaining branches, and gives users a way to inquire what changes are merged — or are available to be merged — on different lines of development. VisualSVN ......

End2End Automated Testing: Calling Applications Remotely

Calling a remote application, you want it to run almost always in its native directory and not against your calling End2End code's directory. Why? You don't want to have to verify whether the application uses or will use any kind of relative paths. You want your End2End Tests to work in any respect. So you can implement the basic code for starting a process using the System.IO and System.Diagnostics .Net libraries. Public Sub RunApplication(ByVal filePath As String, ByVal args As String, ByVal waitForExit ......

End2End Automated Testing: Setting Network Permissions Automatically

When setting network permissions, you are going to want to use a random permission name that you can clean up once the test is complete. The "-q" in the call for CasPol is very important, because it quietly and automatically sets the permission. You can implement the basic code for starting a process using the System.Diagnostics .Net library. Private Const FRAMEWORK_DIRECTORY As String = "Microsoft.NET\Framework\v2... Public Sub AssignNetworkPermission(ByVal remoteDirectory As String, ByVal ......

End2End Automated Testing

We have started an initiative this year. We call it End2End Automated Testing. The idea is based on a couple of factors. Many times in the past we have not had an easy way to verify our configuration, security and deployment to an environment in an automated way. The second is that regression testing is a very arduous process for our QA staff when it must be completed. How do we give time back to our testers and verify everything in a given environment is correct? With automation of course! So what ......

Develop for Maintenance

One thing I always keep noticing is that people will develop things without even giving a thought to maintenance. This somehow seems impolite to me. I suffer from Coder Alzheimer's, which means I can't remember a thing I wrote after not seeing after three weeks. That is why I think about things like maintenance. I am seeing all new code if I have been away from it for awhile! Now that is not completely true, but imagine how it may be for the guy who has never seen your stuff. Challenge: How Easy ......

Technology Adoption Lifecycle: In Response To "Why Alt.NET?"

Scott C Reynolds (no known relation) wrote an excellent post a few weeks ago that is definitely worth reading on Why Alt.NET. He talks about the us vs. them and the reasoning that might be behind it. I will forgo the use of labels that may be seen as derisive and divisive, and state my observation from my career that developers fall into two very broad camps: those who at least lurk but maybe participate in "community" activities (blogs, conferences, mailing lists, etc) and those who, for whatever ......

THE Best Methodology on How to Successfully Develop Software

I know you see this post and think that I am going to shock you with the best approach to software development and I am! The great thing is I am not a consultant being paid for this so you don't have to spend countless thousands of dollars for me to come into your organization and tell you what processes are working for you and what you need to change to have successful projects. Why not? Shockingly, I don't want to take your money! I don't want your organization's money either. What I really want ......

Inversion of Control Containers

One of the questions that I received during my recent presentation was how many different inversion of control containers are there for .NET? I managed to name about four off of the top of my head. Scott Hanselman just did a post listing more than ten .NET IOC Containers. Check it out here: http://www.hanselman.com/bl... ......

.NET User Group Presentation - Windsor Container: Inversion of Control/Dependency Injection

A while ago I spoke about giving a presentation at the .NET User Group meeting. I gave that presentation on Tuesday and it went pretty well. I am still working on a possible video podcast of the presentation. Here is the Visual Studio solution (be sure to read the readme file): IoC_Example.zip Here are all of the references. Interfaceshttp://www.c-shar... ......

ALT.NET Conference Seattle Filling Up Fast

81 spots have been filled since 4PM CST when registration opened (about 3:30 hours ago). There is still time if you want a spot! Hurry though, at this rate registration will close off soon. There are only 150 spots total. http://altdotnet.org/events... ......

Real Life Examples of Agile Development

I just saw this challenge to find real life examples of agile development by Tom Perry. He was hanging Christmas lights and found a way to incorporate test driven development (TDD) and continuous integration (CI) into putting up the lights. He put up his lights, then turned them on and found he had a problem. I had broken the first rule of agile development - Test First! Of course, any reasonably competent handyman would have known to try plugging in each strand of lights before beginning the life ......

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

RoundhousE – ADO.NET over SMO

One thing most database change management tools use is SQL Server Managment Objects (SMO). Most do that because ADO.NET doesn’t allow the batch statement separator keyword GO in sql statements. So most people write off the ability to use a database change tool for sql server without actually having the sql server installed on the machine that is running the tool. This is not a reality in some organizations, especially when licenses for SQL server are limited. Split the GO Recently, a few guys have ......

Full Code Archive