Careers @ StackOverflow.com

StackOverflow.com has launched a new careers initiative that connects IT professionals with potential employers. Creating a profile is free, but search placement costs $99 annually. In the spirit of the holiday season, however, if you register before Jan. 1st the cost is only $29 for the first year. StackOverflow is associated with Joel Spolsky and Jeff Atwood, people I consider to be pioneers in the professional software developer community. You can read Jeff Atwood’s official announcement on his blog. If you’re interested, my public profile is here: http://careers.stackoverflow.com/nicholascloud.

Foray into ASP.NET MVC

I’ve been working with ASP.NET MVC for the last week. It has seriously renewed my hope in a Microsoft web product. I am among the snobs who think ASP.NET WebForms is a terrible leaky abstraction. MVC changes all that by assuming that web standards and semantically meaningful markup are not only desirable, but necessary for a web application. At first blush, it reminds me an awful lot of my previous experience with symfony, the popular PHP web framework. Splitting models, views, and controllers into distinct and decoupled files and classes is a very powerful concept, and buys the developer tremendous flexibility when changes on any of those tiers are mandated. A database change need not break the view; markup change need not affect page logic. It’s a beautiful thing. The routing system in MVC is also very powerful and effectively creates a paradigm shift for how we view URLs. MVC treats URL requests as logical paths to information as opposed to physical paths to pages. It does this by mapping specific URLs to controllers that have actions which contain the page logic to render given views. This is especially significant for SEO purposes where URLs are often crafted to communicate as much relevant content to search engines as possible. It also makes traditionally cryptic URLs far more reader friendly. (For example, the URL to this post contains the route /2009/10/foray-into-asp-net-mvc, which is more understandable than ?y=2009&m=10&title=foray%20into%20asp%20net%20mvc.) Routes are specified in the Global.ascx.cs file. The URL helpers that come with MVC allow internal links to be specified by Controller/Action, but renders them as specified in the global routing table. If a URL needs to change for a given resource, instead of finding all references to it in the source tree, only the routing table needs to be updated. My favorite feature of MVC so far, though, is the simple fact that it doesn’t muck with my markup. One thing I loathe about WebForms is that it insists on re-writing my HTML and making it damn near impossible to write standards-compliant code and adhere to web development best practices. In MVC, when I assign and id to an element, that’s the id it gets – not some hogwash like _ctl00_ucPrimaryNav_primaryNavigationTable_ctrl1_lnkPrimaryNavigation_. (WebForms is kind of like the government. When it says “I’m here to help”, run away screaming.) This one tiny feature also frees up ASP.NET developers to leverage robust Javascript frameworks like jQuery and Prototype, feats that are not impossible in WebForms but require significant jury-rigging. The single-form-per-page has also been eliminated in favor of traditional HTML forms, which has always been a personal gripe of mine. (There are many scenarios where multiple forms on a page is a good idea.) In place of the one genuinely useful feature of WebForms server controls, data binding, MVC introduces the concept of a strongly typed ViewModel that acts as the data source for a given view. This is a common development pattern gaining tremendous momentum in WPF circles (it is officially called Model-View-ViewModel in WPF and Silverlight), and it allows developers to interact with an object that contains all of a view’s data, but is not itself the view. WebForms violates this pattern by confusing the view with it’s own data, but MVC encourages it by supporting views that derive from System.Web.Mvc.ViewPage, where T represents the ViewModel object to which the view will be bound. Fields in the view have IDs and names that correspond to properties in the ViewModel. They are automatically populated with the values of the ViewModel at runtime when the controller renders the view. This also provides a layer of encapsulation for the developer to leverage, masking the actual implementation of the data model, since model objects are not directly exposed to views. In fact, all that a view need know about is the interface that a ViewModel exposes, which is typically composed of simple types like strings, numbers, and boolean values. The view is agnostic to the data structures behind the ViewModel. I am thrilled that Microsoft is supporting the MVC project as a viable alternative to WebForms. As I learn more about the framework, I will be sure to add more posts, including some code samples.

Windows Vista/7 Icon Cache

I seem to have a problem corrupting the icon cache in Windows Vista, and now Windows 7. For some reason shortcuts on my start menu, desktop, and in Windows Explorer occasionally do not display correctly (the generic shortcut icon is displayed, or a random icon from the iexplore.exe assembly). After living with this pain for some time, I finally found the solution in this terse article appropriately titled “How to Rebuild the Icon Cache in Windows Vista and Windows 7“.

My Experience with Windows 7

I was one of the early adopters who purchased Vista. I bought Vista Ultimate, took it home and installed it on my custom-built PC, and everything seemed to work fine… until I ran Windows update and my machine would not boot. I reinstalled Vista several times, all with the same result. I shelved the OS, reinstalled XP, and waited for six months until the updates, drivers, and compatibility issues were ironed out. After that, Vista ran with minor issues, but nothing that wasn’t workable, and it’s improved ever since. I use it now, relatively problem-free. So when Microsoft promised that Windows 7 would essentially be the apology for Vista, I was pretty excited. I downloaded the RC when it was released and installed it on my laptop at home and desktop at work. I was pleasantly surprised. It ran as good, and in some ways better, than my Vista installation – and it wasn’t even the final “bits”. When the MSDN RTM release dropped, I wiped my machines and installed that as well. Other than a minor speed difference (the RTM actually seemed a tad slower), I have used it steadily with minor issues. On thing I did notice today is that if I restart my laptop while connected via RDP and then reconnect when it has finished rebooting, I gain an extra “Unidentified Network” in my network settings that shares the same network adapter as my pre-configured home Ethernet connection. Wireless seemed fine, but I could not browse to the internet until I restarted my machine again, removing the network cable before Windows started, then plugging it back in once Windows finished booting. I did this several times, all with the same results. I don’t know if it’s a bug with RDP (it doesn’t happen if I am working directly on my laptop), but it’s a mild inconvenience that I can live with. Another issue is compatibility. I own Adobe Creative Suite CS3, and out-of-the-box, Acrobat Pro has issues with all 64-bit versions of Windows. This is the first time I am leveraging Windows 64-bit technology, and I am actually pleasantly surprised that I have had little friction finding drivers and running my favorite software. I’ve had to jump through a few hoops with network printers, but nothing that manual driver installations couldn’t solve. Even the Acrobat Pro problem had been addressed with the 64-bit version of Vista, and some minor updates corrected that problem. Other Microsoft software, such as Visual Studio 2008 and SQL Server 2005/2008 seem to run flawlessly once updates are applied. Other than that, Windows 7 has been smooth sailing. I thought I would hate the new taskbar, but I actually like it a lot. Cosmetically, that’s really the only significant difference between Windows 7 and Vista – but it _is_ significant. Anything that saves me time and helps organize my workspace is a plus. A lot of people will probably like the more reserved security prompt system (you don’t have to hit the “Ok” button a hundred times to do something), but it never really bothered me in Vista too much so I’m not acutely aware of the change in Windows 7 when I use it. I haven’t taken the leap with my desktop at home, mostly because I loathe the thought of reinstalling all my software and reconfiguring all my settings. It will inevitably happen though. I think Windows 7 will be a much safer step for current XP users, and a sigh of relief for the Vista faithful. If Vista was the new ME, I think it’s safe to say that Windows 7 is the new 2000. It’s stable, secure, and actually looks kind of sexy. In that Billy G kind of way.

Coping with CSS

I have a confession – CSS drives me apeshit. I’m much better at it than I used to be, but I swear there are times when I would rather have napalm in my eyes than look at one more nested

tag. One relatively simple technique that I use to help me cope, though, is gratuitous use of the background-color declaration. For every significant element, I set the background-color to an obnoxious value like Fuchsia or Lime, which helps me visualize each element’s position, margins, and padding. When the page is finished, I remove the unnecessary colors. CSS background-color example This is a tremendous help, since I try to avoid table-based layouts. In the example above, data is displayed in a tabular, repeating fashion, but there is no table present. I use a combination of
,
    , and

    to accomplish the layout, and position elements as appropriate, using colors to illustrate the application of the CSS box model. Incidentally, this also prevents me from crying in my beer. Tools like the Web Developer Toolbar for Firefox and the Internet Explorer Developer Toolbar are also necessary tools for coping with a CSS crisis, but each require you to fiddle with their menus and controls before you can do anything on a page. By using CSS’s native background-color, all you have to do is press F5 to immediately see the effect of any CSS changes you’ve made. It’s quick, it’s dirty, and it really scares the ponytails who don’t realize that the color scheme is only temporary.

Novell gives me hope, then dashes it to pieces

Well, not really. I received welcome news today about Novell’s new iPhone development library, MonoTouch, which “allows developers to create C# and .NET based applications that run on the iPhone and can take advantage of the iPhone APIs as well as reusing both code and libraries that have been built for .NET as well as existing skills.” Since I’m a .NET developer that hasn’t splurged on a Mac yet, I was nearly ready to shell out $399 for the MonoTouch Personal developer license, until I glimpsed the following caveat conveniently stashed at the bottom of the splash page:

“MonoTouch requires a Mac and Apple’s iPhone SDK to test on the emulator and deploy on the device. And you will need to be an Apple iPhone developer to deploy on the device.”

Why Novell? Why do you hurt me so? Why can’t I just develop an iPhone app on Windows, in Visual Studio? It’s not really Novell’s fault though; Apple keeps all of its technology on a tight leash. I wonder if MonoTouch will represent a watershed in mobile device development, however. Consider:

  1. Even though Mono typically trails the .NET framework by at least one major revision, it has the maturity of at least .NET 2.0, which is still in use by a significant number of .NET developers.
  2. The allure of C# development on the iPhone might just be the catalyst that justifies cross-platform development for many traditionally “Windows-only” developers. The popularity of the iPhone, and the iTunes App Store, are certainly tempting prospects for freelancers who want to make some additional income.

It may be time for me to revisit my technology budget.

Testing CopySourceAsHtml

8 class Program {

9 

10 static void Main(string[] args) {

11

12 Console.WriteLine(“Hello World!”);

13 Console.ReadLine();

14 }

15 }

Hanselman's 2009 List of Powertools for Windows Development

Scott Hanselman, a titan in the .NET community, maintains a growing list of Windows development power tools on his RSS-worthy blog. Once a year, on a very magical day, Hanselman releases an update to his amazing list. I like to call it Hanselmas, because I feel like my good coding behavior is finally being rewarded after yet another year of toil. I’m a few days late, but his 2009 update happened a few days ago, on September 2nd.

Tools added

I’ve added a page with a list of all the tools I regularly employ for software development. It will include favored IDEs, plugins, editors, extensions, etc.

Resume added

Hello everyone, this is my professional software development blog where I showcase myself and pimp my talents. I’ll add a proper introduction shortly, but I’m just adding pieces at a time right now, the first of which is my resume. You can find it by clicking on the “Resume“ link toward the top of the page. More will come shortly.