Using FxCop 1.36 with CruiseControl.Net

I’ve been trying to use the lastest FxCop release with CruiseControl.Net but I couldn’t get the output to work on the CCNET page with the FxCopReport.xsl file that comes with FxCop 1.36 Beta 2. The xsl file seems to get nearly all of the build report and writes it to the screen, which makes it unusable.

I tried the xsl file that comes with CCNET and it got a little better. The first assembly would show up in the list, but all the rules kept getting indented way too far, and none of the other assemblies showed up.

The CCNET xsl seemed to be closer to being correct so I decided to use that as a starting point and began mucking with the xsl to see if I could get the transform to work correctly.

The fix turned out to be as easy as commenting out the section titled “Rule Details”. That was hiding my other assemblies as well as messing up the indentation.

You can download the xsl file that I’m using if you’re having the same issue: FxCopReport.xsl.zip

UPDATE: Turns out the change I made was dumb and removed all the good details about the rules, I did a little more work and got that back in there correctly.

Beer #4: Honey Porter

I kegged my latest beer a couple weeks ago but forgot to post about it. I went to Midwest Supplies and picked up two kits, Honey Porter and Java Stout.

The Honey Porter contains 2 lbs of honey, similar to the Honey Steam I made last time. I was hoping that the extra sugar that the honey added would make the beer more alcoholic, but the final gravity was still 1.020 (the closer to 1.0 it gets the better, as far as alcohol content). Since it was at 1.020 that means that there was still sugar left that the yeast didn’t consume, so the beer is sweeter. It still tastes really good, its deceptively dark as you pour it and it has a thick head.

  • Beer: Honey Porter from Midwest Supplies
  • Brewed on 9/30 hydrometer reading 1.051
  • 10/7 transferred from plastic to glass fermenter
  • 10/22 transferred to keg, hydrometer reading 1.020
  • 10/25 hooked up co2 tank, up to 30 psi
  • 10/26 tried first beer with Rett. A little under carbonated since it had only been one day, but drinkable for sure.

I’m going to try and brew the Java Stout this week so I can force myself to get the second keg setup in the fridge downstairs. This one should be interesting as its got actual coffee beans in the brewing process.

Improving SqlMetal with SqlPlastic

The Refresh Problem with LINQ to Sql

When the Orcas beta 2 came out this summer I decided to download it and take a look at the new changes in the IDE as well as check out LINQ.

After reading K. Scott Allen’s post about building a testable data access layer using LINQ to Sql, I wanted to finish his implementation. I was using a small database that I made at home to test out the data access layer, by using the visual LINQ designer in Orcas.

As I was playing with the designer I wanted to add a new column that I had added in the database. So I right-clicked on the table in the designer, looking for the “Refresh” command. I didn’t see it. I looked at the database level, not there either. I looked everywhere in the IDE, but there is no “Refresh” command because it doesn’t exist.

So the way you refresh a table in the designer is to delete it, and any column customizations you’ve done, and re-create it. This sucks. I frequently like to name my database columns all lowercase, with a “_” in between word (”customer_id” for instance), but I want my .net code to have standard .net names (”customer_id” -> “CustomerId”). So the visual designer is out.

SqlMetal

Next, I looked at SqlMetal. SqlMetal is a command line tool from Microsoft that you point at a database and it generates LINQ to Sql code based on the database schema, much like the visual designer does. There is an option in SqlMetal to instead generate a metadata xml file which can then be fed into SqlMetal to generate code based on the xml file. This got me thinking that if I could modify this metadata before it gets fed back into SqlMetal, I could rename my columns programmatically, which implies automation and consistency.

SqlPlastic

So I started working on my own tool, SqlPlastic, that wraps SqlMetal. SqlPlastic is a command line tool that takes arguments similar to SqlMetal. SqlPlastic runs SqlMetal on the specified server and database to generate the intermediate xml file. Then, SqlPlastic runs your custom actions, called “MetaDataTasks” that can modify the content of the xml file. After the custom actions are run, SqlPlastic runs the modified xml file into SqlMetal to generate c# or vb code.

You specify your custom actions in C# or vb class files, classes that implement SqlPlastic.MetaData.IMetaDataTask. At runtime, SqlPlastic finds all your custom classes and compiles them, then queries the assembly for all the classes that implement SqlPlastic.MetaData.IMetaDataTask, instantiates them, and executes them. This way your code is interpreted each time so you can make changes to your code and simply re-run SqlPlastic to see the changes.

The scenario that I had in mind when coding this was a continuous integration environment, where the persistence code gets generated during every build. The fact that SqlPlastic and SqlMetal are both command line tools makes them integrate easily into automated builds, and you gain confidence that your persistence code is current if you are constantly regenerating it.

As of right now, there are 8 built in tasks that SqlPlastic exposes for you to use:

Renaming Tasks

  • RenameTableTask
    • Changes the .net name of a Table.
  • RenameTypeTask
    • Changes the .net name of a Type. Database tables can have several types.
  • RenameColumnTask
    • Changes the .net name of a Column.
  • RenameAssociationTask
    • Changes the .net name of an Association .

Aggregate Tasks

  • AggregateTableTask
    • Iterates over all tables and applies custom tasks to each one.
  • AggregateTypeTask
    • Iterates over all types and applies custom tasks to each one.
  • AggregateColumnTask
    • Iterates over all columns and applies custom tasks to each one.
  • AggregateAssociationTask
    • Iterates over all associations and applies custom tasks to each one.

The way you use these rules is to create a new class that inherits from any of these rules and then simply set the necessary properties (for the Renaming tasks) or override ExecuteCore (for the Aggregate tasks). When SqlPlastic is run, it will find your custom tasks and compile and run them against the generated metadata.

Trying it out

SqlPlastic is hosted at Google: http://code.google.com/p/sqlplastic/

You can get the code at: http://sqlplastic.googlecode.com/svn/trunk

I haven’t put together a release yet, so you’ll have to download the code and open it in VS 2008 to compile it. Theres a unit test project that I maintain as well in there.

The code is all written in VB, but you can use vb or c# to write your custom tasks, you just need to specify which language you want to use by using the /language: command line switch.

I’d love to hear what people think of this, so please don’t hesitate to leave feedback, thanks!

MVC codename

By now most people have heard about the MVC framework that Microsoft is working on.

The one piece of information that I find crucial that hasn’t been answered though: what is the code name for this project?

We all know the final project will be called something lame like “Microsoft Front Controller Framework Extensions for ASP.NET”, so how will we know what we should really call the framework when its finally released?

New desktop, what OS to use?

My desktop computer at home took a shit on me on Monday night when we got back from NYC. I tried to fire it up and got a blue screen with “STOP 0×000000000001″ (or some other hex number) in white letters. Since I got the machine about 5 years ago from General Nanosystems, I figured it was an appropriate time to get a new one.

The WAF on a new computer was initially very low, but after the initial shock Erin is usually very accommodating of my geek purchases. I’m not much for buying a bleeding edge computer, rather I like to get the best bang for the buck while also making sure the machine will last several years.

I’m thinking a Core 2 Duo, 2 gigs of ram (which will become 3 when I salvage one of the gigs from the current machine), dual 160 gig hard drives, and a modest video card that supports dual monitors. My two 15″ lcd displays are good enough for me, so I don’t need any monitor. I’m not a gamer at all so I don’t need a badass video card or sound card.

The biggest decision is actually what OS I’ll be using. I had Vista on the current desktop before it bit the bullet, but I had some problems, specifically with my FreeAgent drive and other usb devices. Not being able to use my usb devices is reason enough for me to go back to XP, but I might be willing to give Vista another chance with some newer hardware, I don’t know.

I won’t be getting said machine for a couple weeks, so I have some time to hem and haw about it.

UPDATE: Unfortunately, I fixed the existing computer by removing a bad ram chip, so now I can’t justify buying a new one :( I also fixed the usb device issues by removing a 4 port usb PCI card that I had installed. So now the computer is actuall pretty usable.

St. Paul Triathlon

Over a year ago I mentioned that I had decided to start training for a triathlon. Last month I finally did one, the St. Paul Triathlon. It was really shitty weather that day, I had to be there about 6:30 am and it was ~60 degrees and raining, which made the swim that much worse.

I finished in 1:48, which was below my target of two hours. The nice thing is that since I did really poorly in the swim and bike, theres plenty of room for improvement next time :)

coming

Beer #3: Honey Steam

I finally got around to finishing my next home brew last week. I brewed the Honey Steam from Midwest Supplies. I also finished making my kegerator setup as well, which means I didn’t have to bottle this batch. Kegging the beer was a lot easier and faster than bottling, and I also didn’t have to wait one to two weeks to drink the beer like I would have with bottles.

  • Beer: Honey Steam from Midwest Supplies
  • 6/13: Beer gets brewed, (I forgot to take a reading when I brewed it, so I don’t know the initial gravity)
  • 6/21: Transferred from plastic fermenter to glass carboy, there was a lot of gunk floating on the beer
  • 6/28:  hydrometer reading: 1.009
  • 7/6: hydrometer reading: 1.009
  • 7/6: transferred to keg, but I couldn’t get the CO2 working correctly
  • 7/9: talked to Justin and got the keg pressurized to ~33 psi
  • 7/12: beer was done being carbonated on 7/11, didn’t drink it until today

I think this is the best my beer has tasted on the first try. The other two beers were good, but they got better as they aged a bit, but this one was delicious right away. Honey Steam is similar to Anchor Steam, but the recipe called for 3 lbs. of honey which gave it a sweet taste.

I’ll post some pics of the final kegerator setup later.

New Job

Once again its been about three weeks since I last posted. I haven’t really felt like doing much geek stuff this summer so far which kind of reduces the blog fodder.

I did start a new job this week, at MinuteClinic headquarters in downtown Minneapolis. I’m part of their internal software development team, and on my first day I was already waist deep in a project. Leaving Magenic was a tough decision, but this seemed like a fun opportunity to try out, so here I am.

I also have another beer brewing, Honey Steam, that should be ready in about a week, so that’ll give me something else to talk about as well.

Enjoy your weekend

Minneapolis Wifi Launches

I saw in the newspaper yesterday that the Minneapolis Wifi network launched in one neighborhood of the city:

Wireless Internet service is now available in the first section of the Minneapolis Wi-Fi network, near the University of Minnesota’s West Bank campus. Construction downtown should be completed by this weekend and in final testing next week.

To purchase the service for your home, the fee is $20 a month for speeds of 1MBps. However, to guarantee that speed, you need to either rent a special modem for $5 a month, or purchase it for $80. I don’t see this as a big deal for most people; you usually need a modem from the cable company anyways to get broadband.

From the article it sounds like the access was pretty good with a wifi enabled laptop that the writer took to ten random locations in the area. It will get more interesting when the service is released downtown as it becomes more difficult to get a good signal with all the buildings.

In another story about municipal wifi networks, foxnews.com mentions that many city wifi networks are failing due to lack of adoption. I think Minneapolis might be better off than some of the other cities mentioned because the network isn’t being run by the city; they’re just the biggest customer because they’ve agreed to purchase access for the police and fire deparments. US Internet is the one installing and operating the network so its a business rather than a taxpayer subsidized network.

It was also comforting to see this quote from the press release that US Internet released when they were chosen to operate the network last year:

US Internet proposes a combination of systems: Wi-Fi for private use including most city users, a separate network for public safety, and WiMax for businesses and residences wanting speeds up to 60 megabits.

I’m glad they’re talking about imlementing Wimax as well as standard wifi, that way they’ll be ready if and when Wimax becomes standard to roll that out to the general public.

Small VPC image - leave AD on

I followed the steps that Jeff Atwood outlined to create a blank VPC image. Having a really small VPC is nice for testing stuff out, especially now that I’m running Vista at home.

My Wix installer creates a new user on the machine that I’ll use as the user for the Monorail web application. While testing the installer out I kept getting an error while creating the user and I naturally assumed it was my (lack of) Wix skills.

Eventually I just tried creating a user through the computer management snap-in and that was failing too. So it wasn’t an issue with my Wix file, but it was still an issue.

Go back to creating a small VPC. I used XPLite to remove a bunch of junk, so I fired that up again to see if I removed something that I shouldn’t have. I did.

Just an FYI to people trying to make small VPCs, don’t remove the “Active Directory” item under the Advanced items. Its less than 100k and its worth it so you don’t have this (and potentially other) issues.