Tuesday, July 13, 2010

Turning off the comments on this thing

I've decided to turn off comments on the blog because comments were running 8 spam links for every 1 meaningful comment.  If you want to send me feedback about a post feel free to send me something on Twitter.

Tuesday, July 6, 2010

Where did FxCop go?

I've used FxCop to do code analysis for years now (and brow beat co-workers to use it, too).  I've incorporated it into my automated build scripts and use it every time I do a code review.  So imagine my dismay when I heard the FxCop site was no longer running (I usually get there from the MSDN Library entry about FxCop).  I wasn't sure if this was just a case of a dead link, but then I read this article by Jonathan Allen on  InfoQ.  Apparently FxCop 1.36 was yanked from the Microsoft Downloads site.  Jonathan's article directs the reader to the Windows 7 SDK.  The Microsoft Download site has an entry for FxCop 10 but it turns out that just gets you a readme.txt file instructing you to download the Windows SDK for Windows 7.

That's not terribly useful.  There isn't even a link to where to get the Windows 7 SDK in the readme file.

So thank you to InfoQ and Jonathan for providing the link.

BTW, it seems the only reason the older FxCop version was removed was because the functionality FxCop provides is in some versions of VS2010.  This is going to have an impact on my automated build scripts so I expect I'll be following the advice from this blog post from Travis Illig's blog at some point - so thanks to him, too.

Monday, June 14, 2010

Which came first, the variable or the literal?

Today I received the feedback from a code review one of my peers did of my code and they asked a question about a particular coding style technique I use.  Specifically they asked why when comparing a variable to a literal value I always put the literal value on the left side of the operator?  Put another way, why do I do this:
if(null == someVariable)
instead of this:
if(someVariable == null)

After all, this person pointed out, the second method is more easily read as "someVariable equals null" as opposed to "null is equal to the value of someVariable."  I think that's a fair point and while I'm a big proponent of increasing the readability of code this is an instance where I'll take the hit.

My habit of putting the literal value before the variable comes from dealing with Javascript.  When coding Javascript I might check to see if a value is set to zero, like this:
if(someVariable = 0)

Maybe that looks good to me because I haven't had my third espresso of the day - but it introduces a bug in my code.  I fat-fingered the operator and put = instead of ==.  So now the statement isn't doing an evaluation, it's doing an assignment.  I'm not going to catch that as part of a compile because Javascript is not compiled.  And it's not going to raise a run-time error because it's syntactically valid.

But it's not going to do what I want it to do.

Because I've been burned by this in the past I got in the habit of putting the literal on the left side of the operator.  Because while I still won't get any compile-time love I will get a run-time error when the code says:
if(0 = someVariable)

Yes, the code review was being done against some of my C# code so the same risk isn't there.  But I don't feel like changing this habit from language to language.  Especially where I'm doing ASP.NET and am jumping between C# and Javascript all day anyway.

Friday, May 21, 2010

Follow up on CamStudio

I've done a couple of videos for work now using CamStudio (as mentioned in my previous post).  One thing is the resulting AVI files are HUGE.  I'm trying to get familiar with how to compress the video and found this tutorial from Video Tutes helpful so I figured I would share.

Wednesday, April 14, 2010

Free screen capture tool: CamStudio

Yesterday I gave a 2 hour presentation to all our new developers about some of the tools we use. Unfortunately, I neglected to mention one of them. Rather than schedule another meeting for a 5 minute topic I decided to record a quick screen cast.

I thought it would be quick, anyway.

I've done this in the past using Snagit which has a video capture function. But for whatever reason the act of recording the screen caused my actions to suffer a terrible delay. For example, click a menu item and wait 45 seconds for the menu to react. Not good. I lost about an hour trying to get the system to work correctly while recording without success.

Over lunch a coworker suggested using a free tool called CamStudio. I installed it, changed a couple of settings to record audio and boom! Done. Free and easy. Two of my favorite four letter words.

Friday, April 9, 2010

Getting ready for Visual Studio 2010 and .NET 4

Monday is the launch of Visual Studio 2010 and .NET 4! Are you as excited as I am? Yeah, I thought so.

One of the things I've been doing to get ready for this (in addition to playing with the RC) has been preparing for the April VT.NET user group meeting. Our meeting coincides with the release date so we're dedicating the meeting to have people share their favorite new feature. I'll be talking about:
  • snippets for web developers (e.g. HTML, ASP.NET and MVC)
  • web.config transformations
  • JavaScript intellisense
  • and the revised Add Resources dialog
Information about the VT.NET user group is available at http://www.vtdotnet.org/ and registration for the event is at http://vtdotnet.eventbrite.com/. One of the new things we're going to do at this meeting, by the way, is to conduct the raffle for people who have registered for the meeting. So go sign up before the meeting!

Tuesday, February 16, 2010

New tool I'm using - SSMS Tools Pack

We do a lot of SQL Server programming where I work. I'm using SQL Server Management Studio 2008, which is nice, but I just made it much nicer by installing Mladen Prajdic’s SSMS Tools Pack (http://ssmstoolspack.com/). The features I've discovered so far are:
  • color coding the editor by connection (so you have a visual cue that you're connected to production versus QA versus your development DB)
  • auto-formatting
  • snippets
  • New Query templates (so you always start with a Begin Tran)
I like this quite a bit.

Friday, February 12, 2010

Making tiny things big - no, not Viagra

Today I got an email from a friend who was taking over a web site from someone else. Apparently he hadn't been given all the original files and is picking up based on what exists on the web server. He was contacting me because there was a JS file which was formatted to all be on one line. He was looking for a way to reformat the file to something he could read.

This is one of those rare occasions when I'm actually able to help someone.

One of the things I've learned since starting at the current gig has been the importance of minifying (sometimes called "packing") the CSS and JS files our application delivers to the browser. If you're not familiar with minifying CSS and JS files, it's when you take your file which is formatted nicely for humans with stuff like comments, indentation, vertical white space, meaningful variable names and etc. and you run it through a program that removes all the stuff that humans like, but which the browser doesn't need. By removing all that stuff, the file can be made significantly smaller - which reduces download time and improves the performance of the web site.

The file he was dealing with had clearly been run through a minifier. The trick now would be to unminify the file. I've never had to do that because we're always starting with the source code. But a quick search on Google lead me to http://jsbeautifier.org/. The tool on this site can reintroduce white-space, such as vertical white-space and indentation, to make the code easier on the eyes. Obviously, it cannot restore comments or meaningful variable names, but if you're going to have to dig in and figure out the code it's a good way to start.

Tuesday, January 19, 2010

Book Review: "slide:ology"

When I attended PDC in November one of the booths I visited in the exposition hall was O'Reilly Media. They have been, and continue to be, supporters of the VT .NET user group and the VT Code Camp - so I wanted to drop by and thank them for that. It turns out Marsee Henon was there. Marsee's job is to reach out to user group leaders on behalf of O'Reilly - so she was the perfect person to run into. Knowing that I have done presentations for the VT .NET user group she was kind enough to give me a copy of "slide:ology" by Nancy Duarte.

Nancy Duarte is CEO of Duarte Design, one of the largest design firms in Silicon Valley, which focuses exclusively on presentations. She has poured her expertise into "slide:ology" (subtitled "The Art and Science of Creating Great Presentations"). The book sets out to liberate presenters, and their audiences, from the tedium of presentations which are little more than documents shown through a projector. We've all attended such presentations, of course. Slide after slide loaded with bullet points with the speaker reading each one in turn.

The early parts of "slide:ology" takes the reader by the hand and reviews with him/her how bullet points can be distilled down to ideas to be communicated. Additionally, by considering the audience those ideas can be delivered in the most appropriate manner. Those practices alone can help presenters be more effective.

Much of the remainder of the book is focused on moving your presentation from merely effective to compelling. Examples of effectively visualizing data (using graphs, images, diagrams, etc.). Guidance on the impact of color and font choices to communicate and to best represent yourself and/or organization are offered. Incorporating movement and animations was a topic I had not considered before, but was a section I found particularly useful. Finally, there is a section on how templates can be defined to provide a uniformity for an organization with several presentations.

I've prepared two presentations since reading "slide:ology" and both were better as a result.

The book itself is a fairly quick read and presented in a clear, concise manner. The size of the book is reminicent of a slide show, too, with the layout of each page following many of the same guidelines for design and communication. I found some of the early sections a little pretentious - but that might be due to the fact I'm not preparing presentations designed to save the world or provide clean drinking water to the third world. If you read "slide:ology" and start to feel that way just power through... there is more than enough content to justify reading the whole book.

This book belongs on the shelf of anyone who prepares presentations - especially if they lack a design background.

Tuesday, January 12, 2010

Links from my VT.NET User Group talk

I had a lot of fun presenting at last night's VT.NET user group meeting. The topic was a wrap up of my trip to Microsoft's PDC conference in Nov. 2009. There were a few links I mentioned during the talk I wanted to share.

Obviously folks will want to check out the PDC web site at http://microsoftpdc.com/ for access to all the videos and slide decks. There are additional materials for some of the official announcements at the PDC press site, http://www.microsoft.com/presspass/events/pdc/default.aspx.

The data developer center can be found at http://msdn.com/data

As I mentioned during the talk, one of the sessions I attended was "Building Location Aware Applications with the SQL Spacial Library." I described a demonstration from that session where location information in an Excel spreadsheet was used to highlight portions of a map. There's a fairly comprehensive blog post outlining that demo from the presenter available at http://blogs.msdn.com/oliviermeyer/archive/2009/11/17/introducing-the-excel-spatial-spreadsheet-building-an-excel-add-in-for-doing-spatial-analysis-and-spatial-operations-in-net.aspx with a follow up blog post at http://blogs.msdn.com/oliviermeyer/archive/2009/12/29/the-excel-spatial-spreadsheet-part-deux.aspx.

Finally, during the session I mentioned a few speakers who stood out. Here are links to their blogs:
I hope everyone that attended the session got a little something out of it.