The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Tuesday, March 29, 2011

Add tf.exe and other .net command line tools to your powershell path

I really don't like cmd.exe, it is difficult to work with. PowerShell ISE is much nicer and the bonus is you can run non powershell programs from this environment as well.

I needed to run some TFS commands, adding the ide directory to the path is easy
$env:path += ";C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
another directory you might want to add if you are messing about with IIS7

$env:path += ";C:\Windows\System32\inetsrv" 
now you can do things like recycle all of the AppPools on your machine

appcmd list apppool /xml | appcmd recycle apppool /in

Rows and Columns with CSS

here is a code snippet for creating rows and columns with css - I guess you could say this is a table?




Resources

Tuesday, March 15, 2011

asp mvc jquery from cdn with fallback to localhost

Paul Irish has some nice code for loading jquery from cdn but then falling back to localhost if it cannot be loaded from cdn. Check it out here.

For asp mvc you usually also want jquery.valdiater and possibly unobtrusive validation as well. Here is an html helper to generate html mark up that handles loading these via cdn with fallback

The helper



Usage, most likely from your layout file



And the rendered html

Monday, March 14, 2011

Powershell script to generate a TODO report

You can use this from your CI build process, help keep the code base clean. I am a big fan of the TODO: comment, but you don't want too many building up in the code base at some point you either need 'TO DO IT' or else forget about it.




the above script is excluding all files found under lib or Test directories, and selecting only a subset of file types. Modify to your needs

Friday, March 11, 2011

MSTest output result to HTML

MSTest generates trx (xml) files which can be viewed in Visual Studio. But often you will be executing MSTest from the command line via your Continuous Integration (CI) server and you will want to view them in an html format outside Visual Studio.

trx2html to the rescue!

  • download the zip file here - http://trx2html.codeplex.com/
  • unzip and put the files somewhere
    • I choose C:\Program Files (x86)\trx2html
  • execute it from the command line 

# in YourTestProject\bin\Release
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /testcontainer:YourTestProject.dll /resultsfile:TestResult.trx

"C:\Program Files (x86)\trx2html\0.6\trx2html.exe" TestResult.trx
# outputs TestResult.trx.htm


Wednesday, March 9, 2011

Visual Studio Solution Items in a sub directory

Visual Studio Solutions have the "Add New Solution Folder" option.



I don't know about you but this makes me think it is going to create a physical directory on the hard drive to emulate what is in the solution, but this is not the case.



The thing that really drives me crazy is if you try to add Test1.txt to the SubFolder it will throw an error because it is really trying to write to the root directory. I think solution folders are only really supposed to be used to organize Visual Studio projects.

In my case I want to have a set of files that are not really part of a Visual Studio project but I want them available in the solution. It turns out there is a Project type called "Empty Project".


This is exactly what the doctor ordered!

You will probably want to do one additional step. Set this "Empty Project" to not build, otherwise you will get a compile time error. Right click on the Solution > Properties > Configuration Properties > Configuration, then un-check the "Build" for this project.

Found out about this from this stackoverflow post.

Here is a good link explaining what you would use a solution folder for, besides a ReadMe.txt

Sunday, March 6, 2011

Ergonomic keyboard for the Mac

The keyboards that come with Macs look really nice, the quality seems pretty good, but I just cannot use a flat keyboard, after a few days my wrists and hands started complaining big time.

After some searching I came across the Kinesis Freestyle keyboard, they make one with Windows layout and another with Mac layout. They are not cheap, however I use a keyboard all day, every day so for me it is worth the money.

If you get the Freestyle you also need to get the Freestyle VIP - Keyboard accessories kit, otherwise you basically just have a flat keyboard again
The VIP accessory kit will give you 10 and 15 degree angles, they also have some other accessory kits that will give you up to 90 degree angle, I believe that kit is very expensive, the 15 degree works fine for me, but the Ascent kit looks interesting.

Eight inches of cable between each side of the keyboard, put them where you want

pivot point if you want them close and asymmetrical

10 degree

15 degree



Thursday, March 3, 2011

varchar (MAX) SqlParameter length

I am using log4net and the AdoNetAppender to log all entries to MSSQL server. The exception column by default is 2000, sometimes the stack traces get large. Not wanting to lose any information I changed the DDL to use varchar (MAX) but I also had to update the appender configuration. Using a size of -1 for the @exception parameter seemed to do the trick.



Resources