June 2008 - Posts - Jon Galloway

June 2008 - Posts

Speaking at the So Cal Code Camp on 6/29/08: Deep Dive Into Deep Zoom

I'll be speaking at the SoCal Code Camp in San Diego on Jun 29, 2008. My session’s titled Deep Dive into Silverlight Deep Zoom. We'll look at the code that runs the Hard Rock Memorabilia site, then build a site on the fly that takes advantage of Deep Zoom, including all the new features in Silverlight 2 Beta 2.

UPDATE: You can grab the slides from my talk here.

Posted by Jon Galloway | 1 comment(s)
Filed under:

Our Round Table Podcast gets legit - Now we're the Herding Code Podcast (herdingcode.com)

We’ve been experimenting with a weekly technology round table podcast for the past five weeks; now we have our act together to the point where we’re ready to officially launch it. We’re at HerdingCode.com, and you can subscribe to our feed at http://feeds.feedburner.com/HerdingCode on your iPod, Zune, or whatever crazy podcast client you choose.

By we, I mean:

  • K. Scott Allen (a.k.a. OdeToCode)
  • Scott Koon (a.k.a. Lazycoder)
  • Kevin Dente
  • Jon Galloway
  • Head on over and give it a listen. On the current episode, we argue discuss whether Silverlight is just another flavor of ActiveX, or if it’s here to stay.

    Herding Code 6: Silverlight - Fad Or Fab?

    Posted by Jon Galloway | 1 comment(s)
    Filed under:

    Jon's News Wrapup - June 25, 2008 Edition

    Development Tools

    Here's the grab bag of tools, development toolkits, etc.

    • live.sysinternals.com

      live.sysinternals.com
      Run Sysinternals utilities directly off the internet without having to install them. You can browse to them at http://live.sysinternals.comor open them as a network share using \\live.sysinternals.com\tools\. I'd love to see more Microsoft utilities delivered this way - it's incredibly convenient.
      • 1_32 jongalloway
      • May 30, 2008 at 01:18 AM
      • May 30, 2008 at 01:18 AM
    • Microsoft StyleCop: Source Analysis for C#

      Microsoft StyleCop: Source Analysis for C#
      We are very excited to announce the release of a new developer tool from Microsoft, Source Analysis for C#. This tool is known internally within Microsoft as StyleCop, and has been used for many years now to help teams enforce a common set of best practices for layout, readability, maintainability, and documentation of C# source code. Source Analysis is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while Source Analysis analyzes the source code directly. For this reason, Code Analysis focuses more on the design of the code, while Source Analysis focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:59 PM
      • Jun 24, 2008 at 04:59 PM
    • Shoes, a Tiny Toolkit

      Shoes, a Tiny Toolkit
      Shoes is a very informal graphics and windowing toolkit. It's for making regular old apps that run on Windows, Mac OS X and Linux. It's a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets. (More in the README.) Here's a trivial little button app: Shoes.app { button("Press Me") { alert("You pressed me") } }
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:46 PM
      • Jun 24, 2008 at 04:46 PM
    • Ruby / Shoes (Scott Hanselman)

      Ruby / Shoes (Scott Hanselman)
      Ruby is a very aesthetically (to me) pleasing and flexible language. Shoes is a GUI Toolkit for making Windowing Applications using Ruby. Shoes is legendary for a number of reasons, but above all, it has the greatest API documentation in the history of all software documentation.
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:44 PM
      • Jun 24, 2008 at 04:44 PM
    • ReSharper 4.0 Released with C# 3.0 and Visual Studio 2008 Support

      ReSharper 4.0 Released with C# 3.0 and Visual Studio 2008 Support
      ReSharper 4.0 Full Edition and C# Edition provide comprehensive support for C# 3.0, including LINQ, implicitly typed locals and arrays, extension methods, automatic properties, lambda expressions, object & collection initializers, anonymous types, expression trees, and partial methods.
      • 1_32 jongalloway
      • Jun 20, 2008 at 03:36 PM
      • Jun 20, 2008 at 03:36 PM
    • Windows Vista DRT (Demo Readiness Toolkit)

      Windows Vista DRT (Demo Readiness Toolkit)
      Installing the Demo Readiness Toolkit will completely erase all data on your hard drive and create a Windows Vista Demonstration PC. Be sure to use a machine that can be re-formatted. Do you demonstrate Windows Vista features? Or maybe you demo 3rd party applications, services, solutions and/or hardware with Windows Vista? With the Demo Readiness Toolkit, your workload just got a whole lot lighter! With a comprehensive demo script, sample content, and a preconfigured installation including user accounts and applications, you have everything you need to demo with Windows Vista with virtually no effort. No more searching for the right software, creating user accounts, tweaking settings, or writing product/feature messaging - now you can focus on your pitch, NOT on building a demo environment.
      • 1_32 jongalloway
      • May 30, 2008 at 01:28 AM
      • May 30, 2008 at 01:28 AM

    Web / Cloud / Interwebs

    The big news here has to be the official release of Firefox 3. I'm not going to dump a bunch of links here, see Lifehacker's Firefox 3 coverage for more in-depth info.

    • Top 10 Firefox 3 Features (Lifehacker)

      Top 10 Firefox 3 Features (Lifehacker)
      • Souped-up Add-ons manager...
      • More intuitive interface overall...
      • Stronger phishing and malware protection...
      • Improved download manager...
      • Native looks for every system...
      • Streamlined "Remember password" handling...
      • Smart bookmarks...
      • Places Organizer replaces the Bookmark Manager...
      • Smart Location Bar learns how you browse...
      • Insanely improved performance
      • 1_32 jongalloway
      • Jun 20, 2008 at 05:30 PM
      • Jun 20, 2008 at 05:30 PM
    • BrowserPlus™

      BrowserPlus™
      Yahoo BrowserPlus™ is a technology for web browsers that allows developers to create rich web applications with desktop capabilities. The most unique attribute of BrowserPlus is its ability to update and add new services on the fly without a browser restart or even reloading the page! As a user, this means no more installers to run or losing your place on the web. For developers, you can check for and activate new services with a single function call, pending user approval - we handle the complexity of software distribution and updates for you. (Runs Ruby on the client, probably a much better fit than the server).
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:49 PM
      • Jun 24, 2008 at 04:49 PM
    • Comparison of Microsoft and Applesync services

      Comparison of Microsoft and Applesync services
      Apple’s introduction of the successor to .Mac — a k a, MobileMe — raises the question as to what’s taking Microsoft so long to roll out Live Mesh. There aren’t a whole lot of details yet available on MobileMe, other than that it will allow cloud-based synchronization of data and devices. (And will make use of Microsoft’s ActiveSync technology, which Apple licensed from Microsoft in order to bring push e-mail to the iPhone, creating its “Exchange for the rest of us.”) From initial reports, MobileMe sounds like a combination of a Windows Live (the various Webified versions of the .Mac point products), Live Mesh (the Mobile Me sync service) and SkyDrive (the Mobile Me cloud-based storage). It is slated to be available to customers in July for a (pricey) $99, which includes 20 GB of storage.
      • 1_32 jongalloway
      • Jun 20, 2008 at 04:37 PM
      • Jun 20, 2008 at 04:37 PM
    • goosh.org - the unofficial google shell.

      goosh.org - the unofficial google shell.
      goosh is a google-interface that behaves similar to a unix-shell.
      • 1_32 jongalloway
      • Jun 08, 2008 at 04:15 PM
      • Jun 08, 2008 at 04:15 PM

    .NET Community

    The ALT.NET community coalesced over a common disatisfaction with the direction the Entity Framework group was heading, so it's no real surprise to see a public statement as the Entity Framework gets set to ship without having substantively addressed any of their core criticisms. I don't have production experience with Entity Framework or pre-existing comptetitors like NHibernate, so I don't really feel qualified to much of an opinion here, other than this: deferring community engagement on core issues as a "Version 2 feature" is generally a bad development model (c.f. Internet Explorer), and that seems to have been part of the problem here. On the other hand, the ALT.NET community, as a whole, is absolutely awful at communicating effectively. While this "No Confidence Vote" letter could improve with a quick proofread by the Unibomber, it's probably the most coherent problem statement they've put forth. Like I said, though, my uneducated opinion here doesn't matter much. I've pulled some links in which cover some of the opposing viewpoints.

    • ADO .NET Entity Framework Vote of No Confidence

      ADO .NET Entity Framework Vote of No Confidence
      The signatories of this letter are unanimous in expressing concern for the welfare of software projects undertaken in the Microsoft customer community that will make use of the forthcoming ADO .NET Entity Framework...
      • Inordinate focus the data aspect of entities leads to degraded entity architectures
      • Excess code needed to deal with lack of lazy loading
      • Shared, canonical model contradicts software best practices
      • Lack of persistence ignorance causes business logic to be harder to read, write, and modify, causing development and maintenance costs to increase at an exaggerated rate
      • Excessive merge conflicts with source control in team environments
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:37 PM
      • Jun 24, 2008 at 04:37 PM
    • Testers give Microsoft’s Entity Framework a no-confidence vote | (Mary Jo Foley)

      Testers give Microsoft’s Entity Framework a no-confidence vote | (Mary Jo Foley)
      Another Entity Framework tester, who requested anonymity, noted that the no confidence vote shouldn’t be interpreted as across-the-board dissatisfaction among .Net developers with Microsoft’s course. “The best thing that happened in response to this latest action is that the Entity Framework team responded to it immediately,” the tester said.
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:29 PM
      • Jun 24, 2008 at 04:29 PM
    • Tim Mallalieu's response to the Vote of No Confidence

      Tim Mallalieu's response to the Vote of No Confidence
      The unfortunate reality is that these are scenarios that we care deeply about but do not fully support in V1.0. I can go into some more detail here. One point to note is that the choice on these features were heavily considered but we had the contention between trying to add more features vs. trying to stay true to our initial goal which was to lay the core foundation for a multiple-release strategy for building out a broader data platform offering. Today, coincidentally, marked the start of our work on the next version of the product and we are determined to address this particular developer community in earnest while still furthering the investment in the overall data platform.
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:42 PM
      • Jun 24, 2008 at 04:42 PM
    • Thoughts on the Entity Framework Vote of No Confidence - Blog

      Thoughts on the Entity Framework Vote of No Confidence - Blog
      I'm far from an expert on Microsoft's Entity Framework (EF), but I have dabbled a bit with betas 2 and 3. Recently, Brian Ellis, a colleague of mine, summarized the points made in an open letter claiming a "vote of no confidence" in the Entity Framework. I'm no ORM guru or EF junkie, but I know enough about EF to see that it has both potential and limitations. I'd like to share my thoughts on the letter. To be fair, I've never used NHibernate (the Holy Grail), and work primarily with Microsoft technology. That doesn't make me an EF evangelist. I'm still quite skeptical, but interested in understanding the value of the technology.
      • 1_32 jongalloway
      • Jun 24, 2008 at 04:40 PM
      • Jun 24, 2008 at 04:40 PM
    • I’m not taking on the Alt.NET world

      I’m not taking on the Alt.NET world
      Cohesion and maturity do not define the best approach for the vast numbers of programmers that make up this industry. That’s why the good thing is that Microsoft did not blindly follow the pattern that worked for the relatively small Alt.NET community when developing Entity Framework. Entity Framework is a far broader initiative and EF must work in scenarios where the other pieces of Alt.NET style development are not in place (BDD, behavior based objects, test first development, etc). If the Alt.NET ideas are the whole answer, why isn’t everyone using that approach? If it’s because everyone hasn’t personally been indoctrinated by working for months on an Alt.NET project, as I understood Scott Bellware to be implying about me in a recent comment on my blog, then Entity Framework cannot succeed regardless of the perfection of the tool. If you have to go be personally instructed, you can no more be personally instructed in EF than in NHibernate. Entity Framework should not block any technique, including agile, additional infrastructure, code generation, rules engines, workflow, SOA, dynamic user interfaces, as the top of my head list. But neither should it be built in the vision of one existing – and therefore outdated – approach to software development. The change in terminology from TDD to BDD illustrates how fast thinking within the Alt.NET community changes and Entity Framework cannot chase these changes must but blaze its own trail based on the best thinking in every community.
      • 1_32 jongalloway
      • Jun 25, 2008 at 02:39 PM
      • Jun 25, 2008 at 02:39 PM
    • Windows UX Taskforce

      Windows UX Taskforce
      Hey, something interesting that's got nothing to do with Entity Framework! Long Zheng started something, again. The Windows UX Taskforce is a community driven site where users can submit and vote on UI inconsistencies and problems in Windows Vista. Apparently the Windows Experience team team is treating these as bug reports.
      • 1_32 jongalloway
      • Jun 20, 2008 at 05:05 PM
      • Jun 20, 2008 at 05:05 PM

    Future MS Tech

    There were some announcements at TechEd 2008, most of them pretty much expected. It seems like the bigger announcements this year will be at PDC08. One surprise was Velocity, a distributed caching solution which is conceptually similar to memcached. Little bits of news on Windows 7 are trickling in, although the featureset of this Windows release is being kept pretty quiet.

    • TechEd 2008 Keynote Summary

      TechEd 2008 Keynote Summary
      • Internet Explorer 8 beta 2 will be available this August
      • Silverlight 2 beta 2 will be available this week with a commercial Go Live license. NBC Universal's 2008 Beijing Olympics will be using Silverlight 2 Beta 2 (which may have had something to do with that commercial go live license). Along with the Beta 2 release, we'll get Expression Blend 2.5 June 2008 Preview and Microsoft Silverlight Tools beta 2 for Visual Studio 2008. Dan Wahlin has a concise summary of what's new in Silverlight 2 Beta 2. I'm really excited to be able to talk about some of the new features here as well, but that's a subject for future posts.
      • IBM DB2 database access with Visual Studio Team System 2008 Database Edition due to an IBM / Microsoft alliance.
      • A new CTP (community technology preview) of the Microsoft Sync Framework, along with announcements of partnerships.
      • Microsoft code-name “Oslo.” At least from the demo (and from what I've heard so far), Oslo is a unified model platform along with some visualization tools which will be built into future versions of Visual Studio, Microsoft System Center, BizTalk Server and Microsoft SQL Server. It's still a little too buzzwordy and high level for me to get excited yet. You can view the demo at 45 minutes into the keynote in case you're able to get more out of it.
      • A new version of Visual Studio 2008 extensions for Windows SharePoint Services 3.0 v1.2, which will allow developers to use Visual Studio 2008 to extend the value of Windows SharePoint Services and Microsoft Office SharePoint Server by providing a simplified development environment.
      • The first CTP of the Microsoft project code-named “Velocity,” a distributed, in-memory application cache platform that makes it easier to develop scalable, high-performance applications needing frequent access to disparate data sources. Large clusters of machines can be seamlessly integrated into a single cache, providing high availability to data.
      • 1_32 jongalloway
      • Jun 20, 2008 at 03:49 PM
      • Jun 20, 2008 at 03:49 PM
    • Velocity - Microsoft Distributed Cache (Scott W.)

      Velocity - Microsoft Distributed Cache : Simpable
      There is an interesting distinction between these tools. One on hand you have Memcached which treats the cache as something you should never rely on. It is there to help but you should always assume it is going to fail on you and even more importantly (to Memcached) you should accept that as a fact. If you read the Memcached FAQ you can almost here the author laughing when talking about fault tolerance. On the other side of the fence you have features like replication and high availability. It is just a CPT, but it looks like Velocity wants to be in the latter group.
      • 1_32 jongalloway
      • Jun 20, 2008 at 03:51 PM
      • Jun 20, 2008 at 03:51 PM
    • Setting Up Velocity (Distributed Cache)

      Setting Up Velocity (Distributed Cache) : Simpable
      Velocity is currently in its first public CTP, so there are certainly going to be some rough spots. The documentation is pretty good, but setting it up and using it the first time required some trial and error. Here is a quick overview on getting it Velocity setup and and using the API.
      • 1_32 jongalloway
      • Jun 20, 2008 at 03:52 PM
      • Jun 20, 2008 at 03:52 PM
    • Microsoft project code named "Velocity" : Introducing Project Codename "Velocity"

      Microsoft project code named "Velocity" : Introducing Project Codename "Velocity"
      Microsoft is announcing the first CTP of a distributed caching product to provide the .NET application platform support for developing highly performant, scalable, and highly available applications. The project code named “Velocity” is a distributed cache that allows any type of data (CLR object, XML document, or binary data) to be cached. “Velocity” fuses large numbers of cache nodes in a cluster into a single unified cache and provides transparent access to cache items from any client connected to the cluster. http://msdn.microsoft.com/data provides additional information about project code named “Velocity” as well as links to download our first CTP.
      • 1_32 jongalloway
      • Jun 20, 2008 at 03:41 PM
      • Jun 20, 2008 at 03:41 PM
    • Windows 7 to add native support for Virtual Hard Disks

      Windows 7 to add native support for Virtual Hard Disks - istartedsomething
      Windows 7 is adding native support for creating, mounting, performing I/O on, and dismounting VHDs (virtual hard disks). Imagine being able to mount a VHD on any Windows machine, do some offline servicing and then boot from that same VHD. Or perhaps, taking an existing VHD you currently use within Virtual Server and boost performance by booting natively from it.
      • 1_32 jongalloway
      • Jun 02, 2008 at 12:09 PM
      • Jun 02, 2008 at 12:09 PM
    • What we do know about Windows 7

      What we do know about Windows 7
      • Windows 7 is being designed around five pillars (specialized for laptops; designed for services; personalized for everyone; optimized for entertainment; engineered for “ease of ownership”)
      • Windows 7 will be more modularized and componentized
      • Windows 7 will be a minor update to Vista — with “minor,” here, meaning as less disruptive as possible to users and their applications. Microsoft has said Windows 7 will use the same driver model that Vista did.
      • Windows 7 will allow users to run legacy applications in virtualized mode to minimize backward compatibility problems.
      • Windows 7 will include touch functionality
      • Windows 7 will be more tightly integrated with Windows Live services.
      • Windows 7 will be more tightly integrated with Windows Mobile.
      • Windows 7 will add support for “HomeGroup” networking
      • Windows 7 will add native support for Virtual Hard Disks (VHDs)
      • 1_32 jongalloway
      • Jun 20, 2008 at 05:16 PM
      • Jun 20, 2008 at 05:16 PM

    .NET Dev Releases

    Things were busy here, with the release of SP1 Beta for Visual Studio 2008 and .NET Framework 3.5. Silverlight 2 hit Beta 2, as well. I'm just going with bullet point excerpts from ScottGu's blog on these; there's a ton of information. They could have called this .NET 4.0 and I don't think anyone would have argued.

    • Visual Studio 2008 and .NET Framework 3.5 Service Pack 1 Beta - ScottGu's Blog

      Visual Studio 2008 and .NET Framework 3.5 Service Pack 1 Beta - ScottGu's Blog
      • ASP.NET Data Scaffolding Support (ASP.NET Dynamic Data)
      • ASP.NET Routing Engine (System.Web.Routing)
      • ASP.NET AJAX Back/Forward Button History Support
      • ASP.NET AJAX Script Combining Support
      • Visual Studio 2008 Performance Improvements HTML Designer and HTML Source Editor
      • Visual Studio 2008 JavaScript Script Formatting and Code Preferences
      • Better Visual Studio Javascript Intellisense for Multiple Javascript/AJAX Frameworks
      • Visual Studio Refactoring Support for WCF Services in ASP.NET Projects
      • Visual Studio Support for Classic ASP Intellisense and Debugging
      • Visual Web Developer Express Edition support for Class Library and Web Application Projects
      • .NET 3.5 SP1 and VS 2008 SP1 contain major performance, deployment, and feature improvements for building client applications.
      • Application Startup and Working Set Performance Improvements
      • New .NET Framework Client Profile Setup Package
      • New .NET Framework Setup Bootstrapper for Client Applications
      • ClickOnce Client Application Deployment Improvements
      • Windows Forms controls - including new vector shape, Printing, and DataRepeater controls:
      • WPF Performance Improvements
      • WPF Data Improvements
      • WPF Extensible Shader Effects
      • WPF Interoperability with Direct3D
      • VS 2008 for WPF Improvements
      • Data Development Improvements
      • SQL 2008 Support
      • ADO.NET Entity Framework and LINQ to Entities
      • ADO.NET Data Services (formerly code-named "Astoria")
      • .NET 3.5 SP1 and VS 2008 SP1 include several enhancements for WCF development.
      • 1_32 jongalloway
      • Jun 20, 2008 at 06:26 PM
      • Jun 20, 2008 at 06:26 PM
    • Silverlight 2 Beta2 (ScottGu's release notes)

      Silverlight 2 Beta2 (ScottGu's release notes)
      • More Built-in Controls
      • Control Template Editing Support
      • Visual State Manager (VSM) Support - (being added to WPF as well)
      • TextBox: Text scrolling with text-wrap, multi-line text selection, document navigation keys, and copy/paste from the clipboard, FullScreen mode (arrow, tab, enter, home, end, pageup/pagedown, space), new APIs to support inking and stylus input support.
      • UI Automation and Accessibility
      • DeepZoom
      • WPF Compatibility
      • Adaptive Streaming
      • Content Protection (Windows DRM and PlayReady DRM)Server Side Playlists
      • Cross Domain Sockets
      • Background Thread Networking
      • Duplex Communication (Server Push)
      • REST and ADO.NET Data Services
      • JSON (LINQ to JSON support)
      • DataGrid enhancements
      • Core data-binding features and better validation support
      • Isolated Storage (Increased local storage, better end-user management for Isolated Storage)
      • 1_32 jongalloway
      • Jun 23, 2008 at 04:34 PM
      • Jun 23, 2008 at 04:34 PM

    General Microsoft News

    Wasn't sure where to put this one, but it's interesting. Will Office 2007 be the first Office suite to support ODF?

    • Microsoft Office 2007 SP2 gets ODF and PDF support

      Microsoft Expands List of Formats Supported in Microsoft Office: Move enhances customer choice and interoperability with Microsoft’s flagship productivity suite.
      When using Microsoft Office 2007 SP2, customers will be able to open, edit and save documents using ODF and save documents into the XPS and PDF fixed formats from directly within the application without having to install any other code. It will also allow customers to set ODF as the default file format for Office 2007. To also provide ODF support for users of earlier versions of Microsoft Office (Office XP and Office 2003), Microsoft will continue to collaborate with the open source community in the ongoing development of the Open XML-ODF translator project on SourceForge.net.
      • 1_32 jongalloway
      • May 30, 2008 at 01:29 AM
      • May 30, 2008 at 01:29 AM

    Technology Podcast #5 - Firefox 3

    Show #5 - Topics

    1. Firefox 3... that's it

    Listen

    Download (click the play button to listen)

    Announcements

    The Name, The Feed, etc.

    This is our last podcast hosting the audio on SkyDrive, I promise. I’d planned to take care of it last weekend and a family emergency… um… emerged. You can help! Please take our super quick survey to vote on a name for our podcast.

    I'd hoped we could use SkyDrive to host the audio and set up a nice podcast feed on top of it via FeedBurner, but it turns out that SkyDrive doesn't send the media type with MP3 enclosures in a way Feedburner expects, so that's out. I'm looking into other hosting options, please comment in our survey if you’ve got any recommendations. We’ve been wanting to keep our costs down so we have the option of continuing long term without requiring sponsorship, but we’ll get our site set up for you for next week’s podcast. Honest.

    The Audio

    I think we finally nailed the audio this week. Thanks to Joe Pruitt and others for some great suggestions on how to set this up.

    Posted by Jon Galloway | 5 comment(s)
    Filed under:

    Using <body> Classes To Fight CSS Class Explosion

    I previously wrote about taking CSS beyond a simple style library by writing HTML that’s easy to style. I’d like to go into one point in a bit more detail – avoiding class explosion by leveraging descendant selectors:

    You might think that really stylable HTML needs classes all over the place. That's not true, thanks to descendant selectors, which let you target elements inside a parent element. For instance, descendant selectors will let you style all <a> elements which appear inside a <div> with and id of "nav":

    div#nav a { font-weight:bold; }

    This is great because we're able to target specific elements (only <a> tags inside <div id="nav">) without a lot of extra work or code.

    Act 1. The Simple Plan

    Things start out simple enough – we lay out all the content for a site, match it against the awesome site design we’ve been provided, and set up a masterpage and consistent style rules for our site. For instance, we’ll have a  decide that <h2> headings in the main content area should be big and dark green:

    div#maincontent h2 { font-size: 1.4em; color: #090; }

    …and we pat ourselves on the back. This stuff’s easy!

    Act 2. Introducing the Villain: Reality

    In the real world, clients tend to get their priorities all messed up. They put things like “content” and “message” above the really important things, like clean consistent code. We’re two days away from launch, and they decide that the headings on two pages in the site should be smaller and a slightly different color to match with the other content. Well, it does look a little better, but it doesn’t fit with our style rules at all.

    Act 3. The Conflict

    At this point, we’ve got a choice. We can create a custom class:

    <h2 class=”specialHeading>

    That’s sometimes the right answer, but it can lead to a class explosion – if we head down this road, we’ve got tons of custom classes for every exception, which makes our CSS harder to manage and clutters up our HTML with piles of non-informational goo, which is exactly what we’re hoping to get away from with CSS and semantic HTML.

    What’s the alternative? Body classes, like this:

    <body class=”about-us>
      <div id="maincontent">
        <h2>Sample Text</h2>
      </div>
    </body>
    Now we can write a selector in our CSS which targets that page specifically:
    div#maincontent h2 { font-size: 1.4em; color: #090; } /* This rule sets the default for the site */
    body.about-us div#maincontent h2 { font-size: 1.1em; color: #161; } /* This rule overrides the default on the About Us page  */

    Of course, we’ve got a draw at this point – we added a class to the body instead of a div, so the improvement’s not as obvious. But that’s just the sample code scenario talking here – in real life we’d have more complex HTML on each page, and the client requests would come in fast and furious. Body classes scale beautifully, because setting that one class allows us to override site style rules for any page in the site.

    Act 4. Do Try This At Home

    If you’re using ASP.NET and taking advantage of the Master Pages feature, you can easily add page-specific classes with a minor tweak to your Master Page. First, set your master page’s Body tag to run as an HTML Generic Control by assigning it an ID and slapping the old runat=”server” attribute in there:

    <body id="Body" runat="server">

    Now we’ll add the following code to the Master Page’s code behind:

    protected void Page_Init(object sender, EventArgs e)
    {
        SetBodyCssClass();
    }
    
    private void SetBodyCssClass()
    {
        string pageType = Page.GetType().Name;
        pageType = pageType.Replace("_aspx", string.Empty);
        pageType = pageType.Replace('_', '-');
        string bodyClass = Body.Attributes["class"] + " " + pageType;
        Body.Attributes["class"] = bodyClass.Trim();
    }

    That’s it. This will write out page classes that are unique, taking into account folder paths as well. For example, let’s look at the following site structure:

    CSS Body Class - Folder Sample

    Here I’m using a Default.aspx page in every subfolder, so we can navigate to sample.com/Products/ or sample.com/Support/ and the Default.aspx page in that subfolder will be displayed. In the case of the Default.aspx page in the Products folder, the body tag would get this class: products-default. For sample.com/Support/Downloads/Drivers.aspx, we’d have the class support-downloads-drivers:

    <body id="ctl00_Body" class="support-downloads-drivers">

    You can of course change this to fit with how you structure your sites, but this seems simplest from a maintenance point of view – it’s obvious what class you’ll be expecting given a URL.

    The code’s pretty simple. Each compiled page has a declared type that’s named based on the folder path and the page filename (e.g. Default.aspx). That works despite the fact that the code is declared in a Master Page, since a Master Page is really a User Control that’s injected into the page rather than the other way around. So when our code executes for /About/Default.aspx, Page.GetPage().Name will return about_default_aspx. We’re just trimming the _aspx from the end and converting the underscores to dashes because they’re more readable. The other thing to notice is that we’re not just replacing the class attribute, we’re appending a new one, since you can (and frequently should) assign more than one class to an HTML element, separated by spaces, like this: <div class=”callout bio about-default”>. So it’s important to append a class rather than overwrite the old one.

    Note that I’m not recommending that you slap this code into your site two days from launch when content changes require it – you should do it early in your project, so that you can make use of the body classes throughout the development cycle.

    Why A Class Instead Of an ID?

    Good question. In general, when you’re working with something that will only appear once on a page, you’d want to use an ID rather than a Class, since an HTML ID attribute is (by definition) unique to the page. I went with the Class in this case because it’s simpler – ASP.NET munges ID’s in server controls to make sure they’re unique (turning body id=”body” into body id=”ctl00_body”, as seen above), but doesn’t do anything to classes.

    Technology Round Table Podcast #4 - iPhone v2 and K. Scott Allen's report from TechEd 2008

    Show #4 - Topics

    1. iPhone v2 announcments from WWDC
    2. TechEd 2008 recap by our roving reporter, K. Scott Allen

    Subscribe

    Here's our temporary podcast feed.

    Listen

    Download (click the play button to listen)

    Announcements

    The Name

    We're closing in on a name (and thus a domain and a website and a real podcast feed, etc.). Here's our current list, please give us your feedback or alternate suggestions.

    • BytecodePodcast
    • Four Horsemen On Software
    • Four Horsemen Podcast
    • Technology Roundtable Podcast

    The Audio

    Audio quality's a bit worse this week. We're working on it - it's harder than you'd think (you should have heard what the source audio files sounded like). Right now we use Skype for the call, but everyone records their own audio and I edit and clean it up. We use Call Graph as a backup in case someone's audio recording doesn't work. UPDATE: Fixed a problem with K Scott's audio. Much better now.

    The Hosting

    So far we've been hosting the audio on SkyDrive. We've been planning to host it ourselves, but I'm wondering if SkyDrive's hosting would be sufficient provided that we had a solid podcast RSS feed. This should only be a problem if you can't access the files for some reason - it's requiring a login, or blocked by your corporate network or something. Please let me know if you have problems with this episode so we can make an informed decision. Other alternatives we've considered are the Site5 Uberplan and Amazon S3. Got any input there?

    Posted by Jon Galloway | 2 comment(s)
    Filed under:

    Silverlight 2 (beta 2) and Firefox 3... so happy together...

    Silverlight loves the Fox like Joanie loves Chachi!If you've been holding off on using Silverlight 2 or Firefox 3 because they weren't playing well together, it's safe to come out now. One of the best "undocumented" features in Silverlight 2 Beta 2 is that it now works with Firefox 3.

    I've been following this issue on Bugzilla (Bug 421217) for a few months. It reads innocently enough: "NPRuntime object reference counting is violated by NPObjWrapperPluginDestroyedCallback causing Silverlight 2.0 beta: crashes when closing tab/window [@ JS_SetPrivate - NPObjWrapperPluginDestroyedCallback]". Here's what that means in plain English:

    You could view Silverlight 2 (Beta 1) objects in Firefox 3, but when you closed the tab, it would crash the entire browser process.

    There's a lot of back and forth on the Bugzilla thread. It appears that something changed in the way that Firefox disposes objects on the move from Firefox 2 to 3, as Wilco Bauwer's comment indicates:

    ...the problem is that we're calling ReleaseObject from a call to DeallocateObject (which is called by FF). Apparently FF3's ReleaseObject implementation crashes when an object is passed in that FF3 believes to be dead. The reason why we do this is related to how reference counting works in FF2. In our experience, FF2 calls DeallocateObject on our NPObjects when *it* no longer references that NPObject. It ignores the reference count.

    The Firefox team clearly didn't want to be bothered with this issue, despite the fact that it was near the top of the list of topcrash bugs for Firefox 3. After a bit of back and forth, it was apparent that the Silverlight team would be the ones making modifications so that they'd handle both Firefox 2 and 3's different behaviors. So we've been waiting on a Silverlight 2 update for it to run Firefox 3. That didn't prevent the (futile) flurry of questions on every Firefox 3 release: "Does this one work with Silverlight 2?"

    So we're good now. Silverlight 2 Beta 2 works on Firefox 3.

    But, about that crashy thing...

    Note that Wilco raised some questions for the Firefox team which don't really sound like they've been solved:

    For us it's important that the reference counting rules are followed strictly for our NPObjects, because we allow you to pass them from one plugin to another. Unless we'd rip out our entire HTML/JS bridge, this would be an easy way for developers to write apps that crash a browser or cause other type of unexpected behavior.

    And it's not a Silverlight specific issue. As I read the Bugzilla thread Firefox 3 has kind of broken reference counting in a way that makes it easy for any plugin to (accidentally or maliciously) crash the browser by calling ReleaseObject on a null or destroyed object. That seems like a problem, because Firefox 2, Safari (and all other WebKit based browsers), Opera, and IE apparently implement the Netscape Plugin API in a way that respects reference counting, and now Firefox 3 no longer follows that. Presumably Silverlight's doing some internal reference counting or checking to work around this issue, and anyone else that wants to write a plugin that allows for communication between instances in a page (or communication with other plugins on a page) will need to do the same. I guess it's not my problem, and clearly the Firefox team has decided it's not theirs, either.

    Technology Round Table Podcast #3 - Should Developers Learn C? + TechEd 2008 Keynote Announcements

    Show #3 - Topics

    1. Should developers learn C?
    2. TechEd 2008 Keynote Announcements
    3. Microsoft "Velocity" distributed caching solution

    Subscribe

    Here's our temporary podcast feed.

    Listen

    Technology Round Table #3: Should developers learn C? + TechEd 2008 Announcements

    Thanks for your patience (and great feedback) as we get our act together here. We've decided to make the content the top priority, and get the non-content details (feed, website, branding, etc.) next. Any suggestions for website address, podcast name, or any other ways we can improve?

    Posted by Jon Galloway | 2 comment(s)
    Filed under:

    TechEd 2008 Keynote Summary

    Here are the highlights from the TechEd 2008 Keynote (as seen from afar by watching the TechEd 2008 Keynote and reading posts and press):

    Via Microsoft PressPass, here are the key announcements (with my notes):

    • Internet Explorer 8 beta 2 will be available this August
    • Silverlight 2 beta 2 will be available this week with a commercial Go Live license. NBC Universal's 2008 Beijing Olympics will be using Silverlight 2 Beta 2 (which may have had something to do with that commercial go live license). Along with the Beta 2 release, we'll get Expression Blend 2.5 June 2008 Preview and Microsoft Silverlight Tools beta 2 for Visual Studio 2008. Dan Wahlin has a concise summary of what's new in Silverlight 2 Beta 2. I'm really excited to be able to talk about some of the new features here as well, but that's a subject for future posts.
    • IBM DB2 database access with Visual Studio Team System 2008 Database Edition due to an IBM / Microsoft alliance.
    • A new CTP (community technology preview) of the Microsoft Sync Framework, along with announcements of partnerships.
    • Microsoft code-name “Oslo.” At least from the demo (and from what I've heard so far), Oslo is a unified model platform along with some visualization tools which will be built into future versions of Visual Studio, Microsoft System Center, BizTalk Server and Microsoft SQL Server. It's still a little too buzzwordy and high level for me to get excited yet. You can view the demo at 45 minutes into the keynote in case you're able to get more out of it.
    • A new version of Visual Studio 2008 extensions for Windows SharePoint Services 3.0 v1.2, which will allow developers to use Visual Studio 2008 to extend the value of Windows SharePoint Services and Microsoft Office SharePoint Server by providing a simplified development environment.
    • The first CTP of the Microsoft project code-named “Velocity,” a distributed, in-memory application cache platform that makes it easier to develop scalable, high-performance applications needing frequent access to disparate data sources. Large clusters of machines can be seamlessly integrated into a single cache, providing high availability to data.

    I saved Velocity for last because it seems like the most interesting (Silverlight 2 Beta 2 is really cool, but not too big of a surprise). As several people have pointed out, it seems pretty similar to memcached, an open source distributed caching solution under the pretty friendly BSD license. Why rewrite memcached? Well, here's what the  introductory post on the new Velocity blog says about it:

    Distributed caches are not new – during the last couple of years several caching products have emerged to address the performance and scalability needs of applications. Most of these products are point products, primarily supporting key-based access. Other than memcached, which is an open source technology, most others target enterprises and enterprise workloads and scale. I think the web workloads require considerably large scale, with 1000s of cache nodes in a cluster. The web scale distributed caches not only require mechanisms that can scale and provide availability in very large clusters, they must be easy to manage or self-managed. In the Future, “Velocity” envisions being an integral part of the .NET application stack targeting both enterprise and web workloads (and scale). As applications start using the caches for data access, I also believe, they will demand richer data services like query, transactions, analytics, synchronization etc. For example, we believe .NET applications will require LINQ queries on the distributed cache, the same way they query the backend SQL Server database. We envision “Velocity” becoming such a comprehensive distributed caching platform. The performance, scale, and availability functionality of “Velocity” along with its rich data services will allow for rich web and enterprise applications development and deployment.

    I bolded the parts that look like the two main reasons:

    • The Velocity hopes to become an integral part of the .NET application stack (easier if it's their product)
    • By building a caching system specifically for the .NET platform and data access technologies, they can create a deeper level of integration (LINQ To Velocity?)

    You can download the Velocity CTP 1 here: http://www.microsoft.com/downloads/details.aspx?FamilyId=B24C3708-EEFF-4055-A867-19B5851E7CD2&displaylang=en

    If you're watching the Keynote video, you can skip the first 30 minutes (fluff and comedy) without missing any real information. There are some additional demo's which don't coincide with new releases, but are interesting - the SQL Server 2008 demo at 55:00 includes some cool stuff about the new spatial data and filestream features, as well as the Sync services. There's a plug for the Microsoft Robotics Studio and RoboChamps (as well as a Ballmer-Bot which chants "Developer, developers, developers!") at 72:00.

    More Posts