Monday, January 29, 2007

FXCop Custom MSBuild Task

FXCop is great for checking code, and it's easy enough to run the command
line utility from MSBuild. This will run the analysis and produce a report
of all the issues, but this has no "teeth", that is, nothing makes anyone
look at the report and fix the issues. In order to have FXCop actually
break the build you need to write a custom task the following is an example
of a simple task that breaks the build if there are any issues. It does
need to be told where to find the report via the report location property


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.IO;
using System.Reflection;
using System.Diagnostics;
using System.Xml;

namespace Framework.Build.CustomTasks
{
public class CheckFXCop : Task
{


private string _reportLocation;


[Required]
public string ReportLocation
{
get { return _reportLocation; }
set { _reportLocation = value; }
}

/// <summary>
/// Executes the Task
/// </summary>
/// <returns>true if the task successfully executed; otherwise,
false.</returns>
public override bool Execute()
{

bool returnVal = true;
int numIssues = 0;

try
{

FileStream xmlFileStream = new
FileStream(this.ReportLocation, FileMode.Open);

XmlTextReader fxReport = new XmlTextReader(xmlFileStream);

while (fxReport.Read())
{

if (fxReport.LocalName == "Issue")
{
returnVal = false;
numIssues++;
}


}

if (!returnVal)
{

Log.LogError("There are " + numIssues.ToString() + "
FXCop issue(s). Please review the report");

}


return returnVal;

}
catch
{
return false;

}

}


}
}

Thursday, January 25, 2007

Handling alerts in WATIN

Update: I posted a response awhile ago as a new blog entry http://tmichealson.blogspot.com/2007/03/use-once-dialog.html



One of the most common user interaction on a website is the javascript
"alert" funcions.
With a syntect of:

alert('message');

This function displays a message to the user and requires that they click a
button labeled OK before continuing.

Creating an automated test for a website that uses this poses a couple of
problems. First the is no DOM object
for the window, and second the window runs under a different thread then the
main browser window. Luckly any
web automation tool worth its salt will address both these issues and WATIN
is no exeption. The following code is an
example of how to use the alertdialog handler.


using( IE ie = new IE("http://hostname/pagename.htm"))
{


AlertDialogHandler alertDialogHandler = new AlertDialogHandler ();
using (new UseDialogOnce(ie.DialogWatcher, alertDialogHandler ))
{


/*************************************
* -- code to generate alert -- *
* *
* must use the "nowait" to allow *
* the code to goto the next line *
* *
*************************************/

alertDialogHandler.WaitUntilExists();


alertDialogHandler.OKButton.Click();

IE.WaitForComplete();

}

}

Wednesday, January 24, 2007

WATIN vs WATIR

I've been messing about with WATIR for awhile now and am very impressed. Very powerful, very flexible and I love any excuse to learn a new language (ruby). However, most of my coworkers do not share my thirst for knowledge. Nobody seamed interested in the amazing things that I was doing. Guess they were to busy getting the bug count down, forget that what I'm doing could keep it from getting high in the first place. Knowing this I've moved on to WATIN which so far seems to have most of the same features comes with an IDE and intellisense. Oh and lets not forget the US Navy and its list of approved software. The couple of DLLs that make up watin can be included in a project, but I don't think that an entire interpreter could be thought of in the same way.

New Blogger

So I'm on the new blogger now. To be honest, I'm not sure what that means exactly. But hey, if it's new it must be better right?

Monday, January 22, 2007

Super Hero Results

Your results:
You are Green Lantern
























Green Lantern
70%
Iron Man
70%
Spider-Man
70%
The Flash
65%
Catwoman
60%
Hulk
60%
Superman
60%
Robin
47%
Supergirl
40%
Batman
30%
Wonder Woman
20%
Hot-headed. You have strong
will power and a good imagination.


Click here to take the Superhero Personality Test

Wednesday, December 27, 2006

OpenXML The new Default format for Office 2007


> Despite my classification as a Developer at work, I often find myself
> doing research projects. In this case I was told to research how to
> generate Office Documents from the server. Then I'll have to write a
> whitepaper and do presentation. So far my research has lead me direclty
> to OpenXML the new default format for Office 2007. Now mind you there is
> no way on god's green earth that we will migrate to office 2007 but I'm of
> the opinion that we should use the format anyway. So I'll be spending the
> next couple of weeks writing a paper and trying to convience everyone
> (including myself) that OpenXML is the greatest thing since the invension
> of the wordproccesor.
>
> In case I acutlly have readers I'm gonna post some links and maybe the
> whitepaper when it done.
>
> T.
>
>
> MSDN Magazine: Server-Side Generation of Word 2007 Docs
>
> <http://msdn.microsoft.com/msdnmag/issues/06/11/BasicInstincts/>
> MSDN: Walkthrough: Word 2007 XML Format
> <http://msdn2.microsoft.com/en-us/library/ms771890.aspx>
> MSDN: Introducing the Office (2007) Open XML File Format
> <http://msdn2.microsoft.com/en-us/library/aa338205.aspx>
> ECMA: Office Open XML Overview
> <http://shrinkster.com/ku8>
>

Monday, November 20, 2006

Linerider

This is sweet! I’m so not getting any work done this afternoon

 

http://www.linerider.com/

 

 

T

Friday, November 17, 2006

Wrestling Season take 2

So, we had what I think is called a Nor’easter yesterday and they cancelled school activities so today will be my first day of practice

 

T

Thursday, November 16, 2006

Wrestling Season

I take up the post of Head Wrestling Coach at Hugo Owens Middle School today.

It’s going to be me and 50+ 7th and 8th graders.  May god have mercy on my soul.

 

 

T

Thursday, November 09, 2006

.Net 3.0 Released!

.Net 3.0, however poorly named, was released to market with full support today.  To bad the US Navy seams content to use Windows 2000 till the end of all time, maybe someday I’ll get to be cutting edge. Anyway, check it out.

 

http://www.netfx3.com

 

 

T

Tuesday, October 31, 2006

My Virtual PC Woes

I love Virtual PC. It's a great place to install betas and screw with all kinds of OS features without fear of destroying your computer. But whenever I run a windows operating system on a virtual pc it runs slow. So slow that I can't really perform anything; well I've just read the single most important virtual machine performance tip and as it happens I just bought a new hard drive on sale. So, when I get home I'll installing that baby and moving my VHDs to it. I'll post again with any performance boosts

 

T

My Virtual PC Woes

I love Virtual PC <http://www.microsoft.com/windows/virtualpc/default.mspx>.
It's a great place to install betas and screw with all kinds of OS features
without fear of destroying your computer. But whenever I run a windows
operating system on a virtual pc it runs slow. So slow that I can't really
perform anything; well I've just read the single most important virtual
machine performance tip
<http://www.codinghorror.com/blog/archives/000714.html> and as it happens I
just bought a new hard drive on sale. So, when I get home I'll installing
that baby and moving my VHDs to it. I'll post again with any performance
boosts.

T

Thursday, October 12, 2006

Ubuntu Linux

I'm a windows guy.  Always have been always will be.  However, I like to see what the other side is like now and again.  Usually when I want to scratch my Unix itch I turn to my old friend FreeBSD  this is the Unix I used in collage and the one I'm most familiar with.  This time though I heard about  Ubuntu and their live CD, and I've got to tell you I'm really impressed.  While I never really considered the actuall install process for Unix/Linux to be more difficult then Windows the configuration of Xwindows and the either the KDE or GNOME desktops can be quite a pain, VI and I don't get along.  Ubuntu on the other hand has made the entire install and configuration so simple I'd go so far as to say it's easier then a windows install.  They call it "Linux for human beings" and it lives up to its name.

If you'd like to play with the penguin for awhile here's the scoop:

First goto www.ubuntu.com and download the desktop ISO image,
and burn it to CD

At this point you have several options

Super Cool No Risk Ubuntu preview from Live CD
    -Boot your machine from the CD
    -Ubuntu will load into memory and allow you full access to the entire OS.  This includes by default the GNOME desktop so even the most die hard of windows zealots should feel comfortable.
    The OS will not mount your Hard Drive so there is no risk of corrupting your current system.

Full Installation
    If you have a spare machine, some unformatted space on your hard drive, or like me want to run from a Virtual PC simply boot as before and click the install icon from the desktop.
    A wizard will walk you through all steps needed to configure user accounts and netwoking


Ubuntu comes with a host of Free software pre-loaded the CD it really is a complete package, here's a small list of the included software:

FireFox (Web Browser)
Evolution (Mail and Calendar)
OpenOffice (Word Processor, Spreadsheet, Presentation, etc..)
GIMP (Photo Editor)
Games
Multi-media Players


I Say Check it out.  Catch Ya Later

T

 


Friday, September 29, 2006

Refill your own Swifer WetJet Cartridges

I'm not really a clean nut. However I was mopping the floor in my kitchen just now and had to swap out the solution container for our swifer wet jet and I had a thought. "I bet this could be refilled", I said to myself, and in fact it is very simple and easy. The cap screws off; it has some plastic bits in place to keep you from doing it, but with a pair of pliers it came right off, and will screw back on and off after that by hand. Fill with any floor cleaning solution

If this seems silly or off topic see my post about operant conditioning


T

Sunday, September 17, 2006

Portable Apps

I've always thought I'd be more organized with a PDA or smartphone but a couple of things have always keep me from getting one. First I'm to cheep to buy something I "think" I might use, and second I would loose or forget it so often as to be impractical. On an average week, my current cellphone spends about 2 weekdays and all weekend just sitting on my nightstand where it is of use to nobody. Now on the other hand my USB key comes with me everywhere I go, not because I think I need 256MB of storage where ever I go but because it is attached to my key chain and I can't get back into my house without it. This is where portable apps come in. A portable app is an computer application that does not need to be installed and configured to run, allowing it to run directly from a USB or other portable storage device. Most single .exe files will fall under this category, so things like Notepad2 would be included. However what impresses me the most is at Portableapps.com there is an entire library of application that normally would require installation but have been wraped in a launcher that allows them to be run directly from USB this include Firefox, Openoffice, Sunbird (mozilla calendar client), and Thunderbird (mozilla email client). equipped with this software my $20 USB drive becomes an 80% solution for a $300 PDA. Another way to look at it is; instead of just carrying your documents with you, know you can garentee that you have the ability to open them.

Wednesday, June 28, 2006

Installing Windows Vista Beta on Virtual PC

I got the bright idea a few weeks ago, to install the windows vista beta. Now I don't have random power machines laying around my house so I thought that that virtual pc would be a great option. I had done this before, download the iso file for the os mount it inside virtual pc's virtual cd drive and away you go. So I get my vista iso an proceed to drop it into the cd drive when I get this message to the effect of, this file exceeds the 2.2 gig limit, well shit what am I suposed to do now? The solution turns out to be quite simple but I thought I'd share it with you anyway.

Basicly what you need to do is mount the iso on the host operating system with a drive letter. Then tell virtual pc to use that drive and away you go. As it turns out this is not a native feature of windows xp. Undaunted my search for a utility lands me at a free but unsupported tool form microsoft for doing just that. I said it was unsupported but its more like unusable, the ui made little sense and when I did figure out how to use it, it did not deliver as promised. Several tools later I found daemon tools at http://www.daemon-tools.cc/dtcc/announcements.php this free tool installed easily, and work without any fuss on the first try.

With a drive letter in place the rest of the install went smoothly. I am alittle mifed about how slow it runs though, thats the downside to virtual pc you really need a behemoth to run well. Anyway my next task will be to install the office 12 beta, and mybe the orcas beta for the full package. Catch ya later.

T

Sunday, April 23, 2006

Richmond Code Camp

I attended the Richmond code camp and I have come away with two main ideas. First, I really think they should change the name of these because when I tell anyone where I'm going they laugh, and it's not fair Code Camps are wonderful community events and everyone who does .Net development should attend one if they can, they just need a more professional sounding name. The other thing that happened is I am officially changing my view of paired programming. I attended Jonathan Cogley's session on it and I am now convinced that it can work in the right environment.

get slides and other info from the conference go here (www.richmondcodecamp.com)

Thursday, April 06, 2006

Podcasts and operant conditioning

A subset of operant conditioning says that the more you repeat a behavior the easier it becomes to perform that behavior in the future. So I'm going to just start writing anything that comes to my head and to hell with continuity until I'm used to this blog thing.

As part of my attempt to keep up with the 3rd millennium I have recently discovered the podcast. Who knew there where so many people willing to record a radio show and post it on the internet for free. Anyway in particular I've been listing to ARCast with Ron Jacobs available at http://channel9.msdn.com/shows/ARCast_with_Ron_Jacobs
just wanted to share. Later!

T

Monday, March 27, 2006

My First Post

Ok, so this is my first blog post ever. I've definitely been dragging my feet on the blog thing, but I'm hoping that in the coming months I will actually have something to say so I'm going to give it a shot. Look to see a lot about Test Driven Development, my current preoccupation and possibly some other random garbage. Catch you on the flip side. T