Archives

Archives / 2005
  • Is SQL Server 2005 ready for prime time? Maybe, but the docs aren't.

    At my company we've been working with SQL Server 2005, and in particular Analysis Services 2005, for the better part of a year. One of the new features of SSAS 2005 is Analysis Management Objects (AMO) - a managed class library for administering SSAS. AMO let's you define cubes, measures, and dimensions, process cubes, monitor traces, etc. It's very powerful, but we've struggled with it because through the entire beta program, it was virtually undocumented. The method and class names were listed in the documentation, but there were no descriptions for anything, nor was there a developer's guide for how to use the classes.

    I'd always assumed that MS would flesh out the documentation by the time the product shipped. Apparently I was wrong. When I installed the RTM bits, I was surprised to find that the AMO documentation was still just a skeleton. For examples, look here, or here. Note the rather conspicuous blanks in virtually all of the description columns. I don't recall Microsoft ever shipping with such gaping holes in the documentation (at least, not in the .NET era). It's surprising that a company with the resources of Microsoft would do so.

    To be fair, SSAS 2005 is a killer product - a huge leap forward in OLAP capabilities. Over the last year, I've really come to appreciate the power of OLAP and BI, and I suspect SSAS 2005 will bring OLAP much more into the mainstream (if you're not down with OLAP yet, I strongly recommend you take a look - it's hugely powerful stuff). Hopefully Microsoft will flesh out the documentation in the near future, to make it easier for ISVs to take advantage of.

    Update - via Chris Webb, Microsoft released a December update to the SQL Server 2005 Documentation (available here). In this release they've started fleshing out the AMO documentation at last. It's not complete, but it's a step in the right direction.


  • Tab control with no visible tabs

    One of my co-workers wanted to use a Windows Forms (2.0, in this case) TabControl as a way of swapping between sets of controls, but without display the actual tabs (controlling the switching entirely through code - a sort of swappable panel stack). After some fiddling around with various control settings, I found that  the following seems to work:

    1. Set SizeMode to Fixed.
    2. Set ItemSize to 0,1. The control won't let you set a size of 0,0, but 0,1 seems to have the desired effect.
    3. Set Appearance to Buttons. This removes the tab control border.
    And that's it. You can work with the tab pages easily in the designer, and use the TabControl properties to set the active tab at runtime.

    Update - One limitation with this approach is that you can't easily change the background color of a tab control. So if you want, for example, a white background on your form, you're out of luck.

  • Riffing on Scoble - Live.com launching without Firefox support

    OK, this commentary is a little late, as plenty has been said about Live.com's initial lack of support for Firefox, and the problem has already been addressed. But dammit, I'm writing it anyway.

    A while back Robert wrote about an MS web site with no RSS feed. His stance?

    Sorry, if you do a marketing site and you don't have an RSS feed today you should be fired.
    Robert, my version of that comment is:
    Sorry, if you do a web site and you don't support Firefox today, you should be fired.
    Especially if the web site is targeted at tech types, which Live.com clearly is (at least initially). Why? Because the majority of influentials (the tech type influentials, anyway) run Firefox. In fact, virtually everyone even remotely technical that I know runs Firefox these days, including my boss' boss. Hell, you probably would have been better off ONLY supporting Firefox. By only supporting IE initially, an entire group of users (and a rather important one) were disinterested right out of the gate, and getting them back on board is going to be extra work that shouldn't have been necessary.

    I know that there are time and resource contraints on these projects, there's no feature in Live.com that should have been given a higher priority than Firefox support. I hope that the initial response from the blogosphere has made that clear for the future.

    PS - I'm not actually in favor of anyone geting fired. Just, you know, a little dramatic exaggeration for effect. :)







  • MSBuild Team releases AssemblyInfoTask

    The MSBuild team has released a great new task, the AssemblyInfoTask. This task makes it easy to automatically update the assembly version numbers (both AssemblyVersion and AssemblyFileVersion, as well as other assembly information attributes) as part of your build process. Neil, on one of the PMs on the team, was nice enough to give me an early look version of the task, and it ROCKS. It's very flexible and easy to use - easily the best solution to the problem that I've found.

    It took me a couple iterations to figure out the best way to incorporate it into our multi-project, multi-solution build, but with some tips from the MSBuild team, I got it working very cleanly and effectively. I'll post some info about how I did it in another blog post when I get a chance.

    Oh, and they've released the source (with unit tests) as well. Very cool.

  • Holy smokes, it finally happened - VS2005 on MSDN Subscriber Downloads

    That's right, VS2005 has been posted for download. That groaning sound you hear is the MS servers being crushed under the load of too many downloads. So far Pro and Standard versions are up, as well as something called "Team Suite Trial Edition". Huh? Also, they've only posted the CD images - I'm hoping for DVD images soon.

    Unfortunately, I'm just getting errors when I try to download it right now.

    Update - It seems that which media you see depends on which server you hit. I went back in again, and the CD version was gone and the DVD version was there. I was able to successfully kick off a DVD download, and it's chugging along. Should be done downloading sometime next month. ;)

  • PDC software - back to CTP hell

    Lots of bits coming out of the PDC this week. Most of the bits - Atlas, WinFX, WWF (someone had some fun picking that name), run on VS2005 beta 2. But the LINQ stuff requires VS2005 RC1, as does the latest drop of SQL Server 2005. *Sigh* I can't wait til November 7. Really I can't.

    Update - Joseph Cooney commented that LINQ does in fact run on VS2005 beta 2. I swear I saw some MSDN page that said otherwise, but now I'm not finding that page, so perhaps I was suffering from an information-overload-induced hallucination. ;)

    Update 2 - Duh, found the page that says the VS2005 RC is required for the LINQ tech previews - the main LINQ project page!

  • VMWare 5.5 supports Virtual PC images - sweet!

    VMWare just released the beta of VMWare 5.5, which is capable of opening and directly working with Virtual PC images. Very cool! Now that Microsoft has taken to releasing pre-installed VPC images for various products, I was considering installing VPC just to be able to use them.  Now I won't need to. Of course, VMWare has had a converter tool for a while, but directly working with VPC images without converting them is much nicer.

    It looks like you can't directly change the native VPC image - changes are accumulated in a separate VMWare-specific file. But I think I can live with that limitation. For now, anyway. ;)

  • Top 10 signs you're addicted to VMWare

    10. You're more excited about the next release of VMWare than the release of Longhorn.
    9.   Your home network has 3 machines, but your router reports 15 IP addresses in use.
    8.   Your Windows reports 418MB of RAM. Just because you can.
    7.   Every time a Windows patch is released, you need to run Windows Update 15 times.
    6.   You have no qualms about installing every Microsoft beta product there is.
    5.   You'd rather have an ISO image of a product than a real CD.
    4.   Before alt-tabbing to Outlook to check your email, you always hit Ctrl-Alt first.
    3.   Before installing any software, your first instinct is to take a snapshot.
    2.   When sitting down in front of a freshly booted Windows XP machine, you hit
          Ctrl-Alt-Insert.
    1.   1GB RAM? Not nearly enough!

  • CruiseControl, MSBuild, and Unit Tests

    While converting our continuous integration process from Nant to MSBuild, I ran into a problem with unit tests. The build script runs our unit tests by calling the nunit-console.exe test runner with the Exec task. The tests reside in a number of assemblies, so I used an ItemGroup to list test assemblies, and batched the call to nunit-console.exe (as described in Peter Provost's blog posting). I wanted to run all of the tests, even if some of them failed, and my first thought was to set the ContinueOnError attribute of the Exec task to true. Unfortunately, there's a problem with this - it turns out that "Continue On Error" really means "Pretend task succeeded". In other words, even with test failures the outcome of the build was "success", and CruiseControl wouldn't report the build as failed. No good.

    The solution to this turns out to be trickier than it probably should be, but it is possible. The idea is to store the exit code of the Exec task into an item group (one item per Exec), then use an Error task to check if any of the Exec's returned errors. Building on Mr Provost's example, the UnitTest target becomes:

    <Target Name="UnitTest" DependsOnTargets="Compile">
     <Exec ContinueOnError='true' Command='$(NUnitEXE) $(NUnitArgs) @(TestAssembly)' WorkingDirectory='%(WorkingDirectory)'>
    <Output TaskParameter="ExitCode" ItemName="ExitCodes"/>
    </Exec>
    <Error Text="Test error occurred" Condition="'%(ExitCodes.Identity)'>0"/>
    </Target>




  • ObjectDataSource and Caching in .NET 2.0

    One of the disappointing limitations in .NET 2.0 beta 2 is that the ASP.NET ObjectDataSource control only supports caching when binding to DataSets and DataTables. Since ObjectDataSource is really intended for binding to domain objects, that design limitation didn't make much sense to me.

    According to Nikhil Kothari, demi-god of ASP.NET, this limitation is being addressed for the final release. This is great news!

  • IE6 Tabs with MSN Toolbar - Nice idea, flawed implementation

    When I heard that MS was adding tabbed browsing features to IE6 via the MSN Toolbar, I thought it sounded like a great idea. Unfortunately, the implementation of the idea isn't so hot. Things I've noticed so far, just in playing around with it for a few minutes.

    • Creating a new tab and switching tabs causes the entire UI to flash and repaint in a very annoying way. This is the biggest problem I have with the feature - it's very distracting.
    • Explorer bar visibility is remembered per-tab. This causes the UI to rearrange itself as you flip tabs.
    • There doesn't seem to be a way to open a Favorites item in a tab.
    I'm happy that MS is embracing tabbed browsing (it is one of the big reasons that I switched to Firefox). But it looks like we'll have to wait until IE7 for an effective implementation.

  • MSBuild with Solutions

    When you build a Visual Studio 2005 solution file from the command-line using MSBuild, it constructs an in-memory MSBuild project, that project is what actually gets built. It turns out it's possible to have MSBuild save that temporary MSBuild project to disk, to make it easier to understand what's going on. To do this, set the MSBuildEmitSolution environment variable to 1, then build the solution. MSBuild will save a .sln.proj in the same directory as the solution.

    This trick came in handy to answer two related questions I had about building solutions - how do you build just a specific web project of a solution, and how do you build a particular target of a particular project in the solution. You can determine this by inspecting the target names generated in the solution project file. It's turns out that the current MSDN documentation is wrong here. The MSBuild command line reference documentation says to specify "MSBuild solution.sln /t:<Project Name>.<Target Name>". But in reality the correct syntax is
    "MSBuild solution.sln /t:<Project Name>:<Target Name>" -

    Thanks to
    Lukasz Gwozdz of the MSBuild team for this info.

  • My first GreaseMonkey script - MSDN Product Feedback

    It's a bit of a pain to use Microsoft's Product Feedback Center to report bugs using Firefox. The various text areas for describing the problem are very narrow when rendered in Firefox, which makes it unpleasant to enter long descriptions. If you compare the HTML source on Firefox vs IE, you'll see that on IE the text areas are rendered with width of 100%, but on Firefox the width is not specified. This has been a problem for ages, but I guess it hasn't percolated up the priority list for the MS folks.

    Enter GreaseMonkey. Register the following GreaseMonkey script:

    var allTextareas, thisTextarea;
    allTextareas = document.getElementsByTagName('textarea');
    for (var i = 0; i < allTextareas.length; i++)
    {
    thisTextarea = allTextareas[i];
    thisTextarea.style.width = "100%";
    }

    against the PF url:
    http://lab.msdn.microsoft.com/ProductFeedback/EditFeedback.aspx*

    and bingo, you get nice wide text areas.

  • DOSKEY in XP

    Add this one to the "how did I not know about this?" file. Via the Off-Topic list, I learned that the venerable "doskey" app is still alive and well in XP. I remember doskey from the old MS-DOS days, but I didn't realize that it had survived to the present. One cool thing about it is that it lets you define macros - essentially your own command-line commands - without messing around with batch files. For example, from the command prompt type:

    doskey mydocs=cd /d "%USERPROFILE%\My Documents"

    and when you type "mydocs" from the command line, it will change to your "My Documents" folder. Sweet.

    Full docs can be found here.



  • Episode III

    • If anger and hatred are the path to the dark side, and Yoda is good, why he does look so pissed off when he fights? And if he can jump, twirl, flip, and spin when he fights, why does he walk with a cane?
    • Apparently, despite all of the technical marvels of the Star Wars universe, nobody ever invented railings. Numerous fight scenes take place on platforms hundreds of feet up in the air, and inevitably someone ends up hanging over a ledge. I guess there were no lawsuits in the Republic.
    • Any scene where two people converse has to take place in front a giant window with hundreds of flying cars whizzing by. At times it felt like the actors were positioned practically out of frame to avoid blocking the window. OK, George, the cars fly, we get it.
    • What's with the R2-D2 Inspector Gadget upgrades? Jetpack? Oil slick? Apparently he actually gets downgraded in the future.
    • Why did Padme have to turn from a scrappy fighter in Episode II to a weepy nothing in Episode III?

    Easily the best movie of the second series. It had its slow spots, and I had some issues with the way "the big switch" was done, but the last half hour was very good. It had some nice connections to the original series at the end, and actually made me want to go back and watch Episodes 4,5, and 6 again.

  • Firefox's dirty little secret

    OK, it's not really a secret. And for me, it's definitely not little. The issue? Firefox leaks memory. I mean, like crazy. It's getting really bothersome. Memory usage simply grows and grows while browsing, and closing all open tabs doesn't release the memory. I quickly end up with Firefox taking 150MB+ of memory, and at times end up using 250MB+ (although I try not to let it get that high). I'm forced to periodically shutdown the app and start fresh, and that's a serious pain - I practically live in the browser, and always have half a dozen tabs open.

    Now, I love Firefox. It's a great browser. But the leaks are very frustrating, and although there are numerous bug reports on Bugzilla, there doesn't seem to be a lot happening on them. There have been several Firefox updates, but no fix yet. I see that 1.1 is on the horizon - I can only hope that the problem is addressed in that release.




  • Web Projects in VS2005

    Chris Szurgot posted complaints about the changes to web projects in VS2005 - especially the elimination of the project file for web projects. I quite agree with him (I've been meaning to blog about it for some time). Now, VS2003 had it's problems - the evil .webinfo file in particular. Being able to open a web project directly, without setting up a virtual dir, is brilliant. But the complete elimination of the project file is not, in my opinion, a good change.

    I don't really understand the problem that they were trying to address by eliminating the project file, but it seems to do more harm than good. I've actually lost capabilities, such as the ability to selectively exclude files from a project. Also, I was hoping that the next version would supporting file links - a feature in VS2003 for non-web projects - but obviously that's impossible with the new model.

    My biggest complaint, though, is that the web project model is simply very different from non-web projects. I would guess that many, if not most, web site developers will eventually create class libraries, which means that most developers will be forced to use two different development models. Why?

  • Choosing project code names

    From an eWeek article: MS has chosen "Hawaii" as the code name for a future Visual Studio release "because the team plans to celebrate redesigning the IDE (integrated development environment) in Hawaii".

    Now THAT is a brilliant bit of project planning. Code name your releases after beautiful vacation destinations and convince management to have the release celebration party there. I've already started lining up code names for our future products - Tahiti, Bali, Venice, Paris, Fiji...


  • Problems with Mac OS X Tiger Upgrade

    Earlier this week, my wife upgraded her PowerBook to Tiger. Big mistake. She found herself unable to connect to our wireless network at home. Even worse, while her machine was trying to connect, it prevented any other machine from connecting. It appears that something about how Tiger requests an IP address causes our US Robotics 8054 router to continously reboot itself. Other people have reported a similar problem with a D-Link router - supposedly the problem has been fixed in the forthcoming 10.4.1 update. A work around that solves the problem in the short term is to use a static IP address on the Mac instead of a dynamically allocated address.

    The other problem that she encountered was that her Epson printer stopped working - it displayed a cryptic error about the raster imaging system. It is apparently quite a common problem with the Tiger upgrade - removing the printer and re-installing it seems to fix the problem.

    At least I know that even if I switch my parent's computers to Macs, I'll still be needed for tech support duty. ;)


  • Easily installing MSIs with verbose logs

    While building and testing the WiX-based installer for our product, I often need to run the install with verbose MSI logging. This also turns out to be handy for figuring why other product's flaky installs won't run on my machine (which is surprisingly common). Here's a registry script I created that adds a couple of new context menu items for .MSI files - "Install with Log" and "Uninstall with Log". Simply copy the following into a text file named with a .REG extension, then double click it in Explorer to merge into your registry.

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedInstall]
    @="Install with &Log"

    [HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedInstall\command]
    @="\"msiexec.exe\" /i \"%1\" /l*v \"%1.install.log\""

    [HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedUninstall]
    @="Uninstall with Lo&g"

    [HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedUninstall\command]
    @="\"msiexec.exe\" /x \"%1\" /l*v \"%1.uninstall.log\""



  • VS2005 C# Code Snippets for NUnit

    Many moons ago, James Newkirk posted some VS2005 code snippets for unit testing with Team System's unit test framework. I'm a NUnit user, so I converted those snippets to use NUnit constructs. I'm sure I'm not the first to do this, but I haven't seen anything similar posted yet, so if anyone else is interested, here they are. To use them, simply copy them to either the "My Documents\Visual Studio 2005\Code Snippets\VC#\My Code Snippets" folder or the "Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#" folder (the latter makes it available to everyone on the machine).

    On a related note, although VS2005 Code Snippets are easy to use and very nicely integrated, I do wish they had a little bit more flexibility. In particular, they don't have a way of transforming user input in the snippets. I've used QuickCode.NET for code expansions in the past, and it lets you do things like take a snippet parameter and convert the first character to lower case in the expanded text. That little extra bit of flexibility allows you to, for example, generate a property declaration by only entering a single string, the property name, with the snippet automatically creating the appropriately named private backing field with the correct casing.
     

  • Beware the perils of the VS2005 Development Web Server

    One of the slick new features of Visual Studio 2005 is the ASP.NET Development Web Server - basically a scaled down web server that you can use during web application development instead of using IIS. I've been using it for a while, and it generally worked great. However,  I recently tried to deploy my web app to an IIS server, and it suddenly stopped working. It turns out that the behavior of one the 3rd party ASP.NET server controls I was using changed when I switched to IIS. In this case, it was a chart control that suddenly stopped rendering its images correctly.

    I haven't yet figured out the fundamental problem (the control wasn't designed for .NET 2.0, so it could be a version issue). I'm not bashing the Development Web Server - it's a very handy feature. The moral of the story is that the DWS is not IIS - don't be lulled into believe that they are interchangeable.


  • MFC Serialization behavior change between VC6 and VC7

    We recently decided to port one of our existing MFC applications from VC6 to Visual Studio 2003 (VC7.1). This particular application uses MFC serialization to persist MFC object graphs to disk. After some minor changes to get the application to compile, things generally looked good. However, some additional testing discovered that the serialization process was resulting in corrupted files. After a little tracing, we found that the problematic code did something like this in one of the object's Serialize method:
     ...
    VARIANT varValue;
    GetBSTRVariantValue(&varValue);
    ar << varValue.bstrVal;

    The VC6 version of this code worked fine, but not the VC7 version. Stepping through the code in the debugger revealed the issue - the CArchive operator<< overload for the bool data type was being called, even though we were trying to serialize a BSTR. The result is that only the first byte of the string was being serialized - not good. Since this code hadn't changed for years, it was clearly due to a change in the compiler behavior, not the code behavior.

    We went back to the VC6 version of the code and stepped through the code in the debugger. The result? It turns out that when serializing BSTRs in VC6, the CArchive operator<< overload for CString, rather the overload for bool. The VC6 compiler was generating an implicit conversion to CString during serialization. Making that conversion explict in the VC7 version of the code resolved the problem.

    In fairness to the VC7 compiler, I believe it was generating a compiler warning for this code, which happened to be lost in some other warnings. Yet another reason to be sure that your code compiles without any warnings.






  • Cross page postbacks in ASP.NET 2.0

    Brock Allen posted a couple of interesting tidbits about cross page postbacks in ASP.NET 2.0. He talks about two options for accessing data from the post source page - weakly typed access using the FindControl method and strongly-typed access using the the PreviousPage directive. The problem with the PreviousPage option comes if you want to post several different source pages to the same target page. There is, however, another alternative that isn't obvious and isn't really described much in the documentation - the Reference directive. Inserting this directive makes the specified page type accessible in the declaring page. Including the following in your post target page:
    <%@ Reference Page="SourcePage.aspx" %>
    types the PreviousPage property  as Page but allows you to cast the it to the SourcePage_aspx type.

    Some people don't like the cross-page posting feature, as it causes strong coupling between pages. I think it definitely has its uses (eliminating the need for the Server.Transfer abomination, for example). One way to address the strong coupling issue is to use interfaces instead of page types, in which case the Reference directive isn't needed. But it's handy to know about if you need it.

    Incidentally, this directive is actually part of .NET 1.1, but I've never needed it with that version.. It seems to become more useful in .NET 2.0.

  • NTeam Press

    I was rather surprised when I ran across this article on eWeek about the recently announced NTeam project. NTeam, intended as an open -source alternative to Microsoft's Team System platform, is currently about a vaporous as they come - the GotDotNet workspace was created just 3 days before the article was posted. Isn't it a little early for major press coverage? I mean, SourceForge and GotDotNet are littered with with literally thousands of ambitious projects that are now defunct.

    Now, I'm not trying to pooh-pooh the project. I think it's a great concept, and the NTeam development team seems to be heavy into planning discussions already. As a small ISV who will likely be priced out of the Team System platform, I would certainly welcome an affordable (ok, free) alternative. But waiting until there's something concrete to talk about before running stories in trade journals seems appropriate here. NTeam got quite a bit of coverage in the blogosphere this week - could that be the reason that eWeek picked up on it? If so, I find that a little worrisome.

  • Development, Virtual Machines, and Winamp

    I'm doing a lot of development on Visual Studio 2005 these days. I don't want to install VS2005 on my main machine, so I'm doing my development in a virtual machine (on VMWare). I like to listen to music while I code, and I use Winamp as my music player. I'm a long time Winamp user, and I still prefer it to WMP as a lean and mean music player (plus the FLAC support is better than WMP). But since I'm running Winamp on my main machine and developing in a VM, controlling the player is a bit disruptive - I end up bouncing in and out of the virtual machine to switch tracks.

    Recently I discovered a great solution to this problem - WAWI - the Winamp Web Interface. It turns Winamp into a mini web server, and lets you control Winamp remotely over a web browser. Even better, it includes WAWITray - a small app that runs in the notification area and gives you control of a remote Winamp instance running WAWI. It's the perfect solution for me. Recommended.

  • Issues with new MSDN blogs UI

    Over the weekend, blogs.msdn.com was upgraded to the latest CommunityServer bits. The new platform has all kinds of nifty new features, no doubt, but it's got some major UI annoyances - especially around comments. For example:

    • The comment entry form is not longer displayed automatically at the bottom of the comment list - you need to click "post a comment" first. A little annoying - one extra click - but not a huge deal.
    • When you do click "post a comment" and the comment entry for is displayed, it doesn't display the other comments while you're typing yours. That is a big deal - it makes it incredible difficult to comment on someone else's comment rather than the original post, or maintain a conversation in the comments. Bad, bad, change.
    • As a NewsGator user, I'm used to clicking in on the "Comments" link that NewsGator adds to the bottom of the page to view the comments people have made to a post. The problem is, that link now takes you do the "post a comment page", not the "show existing comments" page. I'm not sure if this is a problem with the link NewsGator is generating (I haven't tried it in other aggregators), but 90% of the time it's not where I want to go. Of course, resolving the first two things on this list would resolve this issue as well.
    I hope these issues are addressable by the MS/CS teams, because they make it much harder to interact with the blogs.



  • Value

    AMD Athlon 64 3000+ and motherboard:  $179
    512MB PC3200 memory: $30
    Antec Sonata case: $80
    Gigabyte Radeon 9550 video card: $66

    Finally replacing your ancient 1.1 Ghz celeron machine: Priceless


  • Getting disenchanted with Whidbey master pages

    I've just started doing some non-trivial stuff with Master Pages in Whidbey, and I'm already hitting some of their annoying limitations. Things that I've hit in just the last hour are:

    • Nesting master pages disables the design view. That's right, as soon as you start nesting master pages, you're limited to the HTML code view (in both your master and content pages). That's such a major limitation that it's hard to believe MS even claims nested masters as a feature.
    • ContentPlaceHolder controls render themselves as gigantic block elements in the designer, which can not be resized in any way. Essentially that limits their use to defining large regions on the page - forget about using content placeholders in small, precisely positioned regions in a title bar, for example (at least if you want any kind of decent designer experience).
    Both of these problems have been reported already on Ladybug, with the predictable response - not going to be fixed. Grrrr..

    UPDATE - Scott Guthrie comments that that ContentPlaceHolder's will fill their container, and so it's size can be controlled by placing it in a fixed-size container. Unfortunately, that's not the behavior I'm seeing with the Feb CTP - perhaps it's a bug. Also, if you want to design around the natural size of the content, the fill behavior is problematic.

  • Log4Net updated

    [Via Loren Halvorson]

    It seems that Log4Net has finally awoken from it's long slumber, and has been updated - version 1.29 beta (hmm - has there ever actually been a non-beta release?). The great news is that it finally has a proper .NET-style API - no more all-cap constant names, non-camel-cased namespaces (except the root - oh well). inconsistently capitalized abbreviations, etc. Lots of breaking changes there, but it had to happen eventually - the API was just so inconsistent with the framework naming standards that I had to wash my hands after using it. Lots of other improvements, too - details here.

  • SysInternals RSS Feed

    Woo-hoo! The SysInternals folks finally have an RSS feed for keeping up with changing in their awesome tools. Subscribed.

  • Things They Didn't Fix in Whidbey - Fonts in Windows Forms

    I've been developing with the .NET framework and Visual Studio .NET for several years now.  Like most developers, I've accumulated my list of annoyances, hassles, and mistakes that I've encountered using the tools over that time. As an optimistic chap, I cling to the hope that these problems will be addressed in the next version of the toolset.

    Well, the next version is here. The improvements are vast, the productivity gains substantial. Naturally, as I've beeng playing with the newest bits (ok, more than play at this point - I'm writing production code on the VS2005 Feb CTP bits), I've been checking to see if MS has addressed any of the problems that have plagued me in the past. Sometimes the news is good, sometimes not. From the title of this post, you can guess which I'm focusing on here. I've already blogged about one such issue. Here's another.

    In the .NET Framework 1.x, Windows Forms is really the poor step-child to Web Forms. Yes, MS gave us a reasonably nice object-oriented GUI framework for rich client apps. But let's face it - apps generated with the out-of-the-box controls are the equivalent of circa-1995 Windows applications. One particularly egregious issue with Windows Forms 1.x is with default font handling. Specifically, a Windows Forms application uses the Microsoft Sans Serif font for its controls when running on Windows XP rather than Tahoma, the default system font for XP.

    Why is Microsoft Sans Serif used? If you use Reflector to poke in the Control class, you'll find a property called DefaultFont. This is the font that is used if the font isn't explicitly set on the control or its parent. Looking through the source for the property getter, you'll find the following key line of code:

    IntPtr ptr1 = UnsafeNativeMethods.GetStockObject(0x11);

    So what is stock object 0x11 (decimal 17)? In WinGDI.h, this corresponds to DEFAULT_GUI_FONT. If you look at the MSDN help for GetStockObject, it all becomes clear. Or, maybe not. The first line of help for DEFAULT_GUI_FONT is "Default font for user interface objects such as menus and dialog boxes". OK, that sounds right. Unfortunately, the second two sentences say "This is MS Sans Serif. Compare this with SYSTEM_FONT." So that explains why MS Sans Serif.

    Jump down to the description for SYSTEM_FONT, however, and you'll see the following: "By default, the system uses the system font to draw menus, dialog box controls, and text". Erm. Hmm. That sounds familiar, doesn't it? The next two lines clarify "Windows 95/98 and Windows NT: The system font is MS Sans Serif.  Windows 2000/XP: The system font is Tahoma".

    So it looks suspiciously like someone at Microsoft simply plugged the wrong value into GetStockObject. Now, I'm not a Win32 GDI expert, so maybe there's some history here that explains why they used DEFAULT_GUI_FONT instead of SYSTEM_FONT (Raymond, are you out there?).

    OK, so here comes Whidbey. Windows Form 2.0. Finally, Windows Forms gets first class treatment. Slick look-and-feel, richer control set, ClickOnce deployment - MS starts pushing the Smart Client in a big, big way. So of course they're going to fix this font thing, right? Bzzt, sorry, wrong, thank you for playing. No, Windows Forms in Whidbey still uses MS Sans Serif as the default font. In other words, the newest generation of Microsoft's premiere development tool, on Microsoft's latest development platform, generates UIs that don't follow their own UI guidelines.

    In all fairness, I'm assuming that MS couldn't change the default font to maintain backward compatibility with existing .NET apps. There's a Ladybug report on this issue describing how to deal with the problem in code, but it's a hack, and there's not a good design-time solution. A small bit of good news is that the new MenuStrip control uses the correct font.

    Ideally, I think design-time font selection should work much like color selection, allowing you to select a system font or a custom font. In fact, I started writing a TypeConverter to give you this, but ran into a bug that prevents you from overriding a class TypeConverter with a property TypeConverter. So for the moment there doesn't seem to be a great solution.

  • Visual Studio 2005, Web Sites, and Test-Driven Development

    After doing lots of spiking and visual design on a Visual Studio 2005 web site project, I set out to write some production code for the site. I've done some TDD-based component development already on this project, but this was my first foray into writing actual logic (humble dialog style) in the web site project itself. It didn't take long to hit a big snag.

    I typically like to put my unit tests in the same assembly being tested. That's always worked well in VS2003, even in web projects, so my first thought was to take the same approach in VS2005. The flaw in that plan is that "building" the web site doesn't generate an assembly that I can point the NUnit test runner at (the assembly ends up in the Temp. ASP.NET Files folder, which isn't too helpful for testing). Oops.

    The only solution I've come up with so far is to put the testable UI logic in a separate assembly. Are there any other options that I'm missing?

  • Wow, it finally happened

    The good news is that MS finally released their very first ever service pack for a Visual Studio .NET product.
    The bad news is that it's Visual Studio .NET 2002 SP1. Presumably VS 2003 SP1 is right around the corner.

    And perhaps we shall be free of The Woe at last.

  • DataGridView in Windows Forms 2.0

    I finally got a chance to start poking at the new Windows Forms DataGridView control in .NET 2.0.  I've only just started with it, but I'm finding it to be a bit of an odd beast.

    The .NET 1.1 DataGrid had some major limitations. A big one is that it's fundamentally a data bound control. You can bind it to objects, making it useful without a database, but you can't really use it unbound. The DataGridView addresses this quite well. You can directly create row and cell objects, and it even supports a virtual mode. Nice.

    A second big limitation of the DataGrid is that it is column oriented. Creating a column where some cells contain checkboxes and others textboxes is difficult, if not impossible. Again, the DataGridView handles this scenario well.

    The design-time experience for the DataGridView is where things get a little weird. At design time, the control still appears as if it's strictly column oriented. When you add columns to the grid, you specify a column type - textbox, checkbox, button, combobox, etc. The cells of that column, however, are not restricted to be of that type. You can add a DataGridViewTextBoxCell to a DataGridViewComboBoxColumn, for example, and it works fine.

    Perhaps the assumption is that if you are doing fully unbound data display, you won't use the designer to configure your columns anyway. But you still need to add columns in your code, so you basically just pick a random column type. All-in-all, it makes for an odd overall developer experience. Perhaps something like an UnboundDataGridViewColumn or GenericGridViewColumn that can be added in the designer would be helpful (you can already create a generic DataGridViewColumn, but you still need to specify a cell template, so it doesn't really address the problem).

    Three other general comments on the control:

    • I really wish MS had included hierarchical support. It's an extremely useful UI model at times (MS uses it in their own apps - Outlook being the most prominent example), and that one missing feature will end up forcing me to use a 3rd party control at some point, I'm sure.
    • Creating a custom DataGridViewCell type looks at first glance to be more complex than I would like to see. At least, the Reflector'd implementations of the current cell types are quite complex, essentially doing all of the painting themselves. However,  I'm not sure yet if that's a requirement or just for best performance.
    • I wish there was a way to plug in a custom column type to the design time experience for the control. Once you start using custom column types, you're pretty much outside of the designer.
    Even with these quirks and limitations, the DataGridView is easily the best grid control that Microsoft has ever released, and I'm glad to have it.




  • Add Reference dialog in Visual Studio 2005

    Visual Studio 2005 includes some fantastic UI enhancements over VS 2003. One change that I'm not thrilled with is the Add Reference dialog. The 2003 Add Reference dialog included two lists - a list of available components and a list of selected components. You can easily add multiple references by highlighting them in the available components list and clicking Select, at which point they get added to the selected components list.

    In VS2005, the dialog changes to only a single, multi-select list (a single list per tab, that is). This is bad. Multi-select lists have poor usability - especially for very long lists (and the default list in 2005 is about 9 pages, which qualifies as long in my book). Selecting multiple items from disjoint sections of the list is difficult, and its easy to accidentally unselected something that you selected three pages back with an errant mouse click. Adding both COM references and .NET references multiplies the problem - now you multiple multi-select lists. I don't know why MS decided to make this change - in my mind, the 2003 version was much more usable.

    On the other hand, the references dialog now includes a "recent" tab, listing recently used references. This is a definite usability improvement.


  • IE7 - hard to be excited

    Microsoft has announced plans for IE 7, but it's kind of hard to excited about it. Why? Because it's pretty clear that they're being dragged kicking and screaming into it. How can I get excited about using a product that Microsoft clearly isn't excited about creating? I have little faith they they will do much beyond to the absolutely minimum they need to do to stem the migration to Firefox.

  • Cool app - Foxit PDF Reader

    Here's a nice little application - Foxit PDF Reader. It's a free, small, fast PDF Viewer. It requires no installation - just dump it into a folder and run it. It wouldn't surprise me if there were some gnarly PDFs that it couldn't handle, but for now it looks good. Adobe's Reader has become a major pig, and it's nice to have an alternative. Recommended.

  • Tip for Windows Forms developers - use Form.CancelButton on your modal dialogs

    There's a problem that I encounter with unpleasant frequency using a variety of Windows Forms applications. The problem is that dialog boxes don't dismiss when the escape key is pressed. It's a small thing, but for a keyboard jockey like me, it's very annoying.

    The problem occurs when the CancelButton property on the Form isn't set. In a properly coded modal dialog, you set this property to be your cancel button, and the framework handles dismissing the dialog when the escape key is pressed. However, if you directly set the DialogResult of the cancel button to Cancel but don't set the CancelButton property on the form, clicking on the cancel button will dismiss the dialog, but hitting escape will not. If you're only testing with the mouse, everything appears to work as expected.

    I reported this as a bug against Whidbey, but MS doesn't seem inclined to change it. So please, people, set that CancelButton property. Take pity on a poor keyboard addicted soul.

  • Separated at birth?

    A recent post from Larry Osterman paid tribute to David Weise, one of the legendary engineers at Microsoft. He also linked to article about David, which included a picture. My first reaction was to note a striking resemblence to a well respected.NET blogger.  So you tell me - separated at birth? :)


  • My Favorite Firefox Extensions

    The Extension architecture is one of the coolest features of Mozilla Firefox. PC Magazine recently published an article rating their top 15 Firefox extensions. I found the list uninspiring - only a couple of the extensions were remotely interesting, and there are many extensions that I like that they didn't list. So here's list of my favorite extensions:

    Browsing Enhancments
    ieView
    I don't like running IE, but there are a few sites that still require it to work properly. Fortunately, with this add-in IE is never more than a click away when you need it.

    Focus Last Selected Tab
    As far as I'm concerned, FLST makes Firefox behave the way it always should have. With this extension, when you close a tab, the previously active tab gets focus. Particularly useful when searching the web and launching new tabs when exploring search results (something I do a lot).

    ImageZoom
    Because some times those images are just too darn small. Great for zooming into screenshots.

    FlashBlock
    I hate navigating to a site and being blasted by a flash animation or ad (especially when they have sound). This extension lets me control when those animations play. It desperately needs a whitelist feature, though - especially since more companies are incorporating flash into regular old business web sites. UPDATE - the latest version does include whitelists. Awesome.

    GoogleBar
    Because Google is the source of all knowledge.

    DuplicateTab
    Opens the currently viewed URL in a new tab. Not something that I use constantly, but every once in a while it comes in handy. The "Merge Windows" feature is particularly handy - it combines all the open Firefox windows into one.

    AdBlock
    Uh - it blocks ads.

    Disable Targets for Downloads
    Prevents annoying blank tabs from popping up when downloading files from some sites.

    ScrapBook
    I learned about this one from the PCMag article. Allows you to save a web page or snippet of a page into a library for future viewing and searching.

    Web Development Extensions

    DOM Inspector

    An option in the advanced Firefox install. It gives you a nice tree view of the current DOM document. Very handy.

    User Agent Switcher
    OK, I haven't actually needed this yet, but it's there just in case. :)  Allows you to switch the browser that is reported to the server when requesting pages.

    Web Developer
    A fantastic grab-bag of developer-related functions. From disabling cookies and scripts to viewing style and tag information, this is a must have extension for web developers.

    Live HTTP Headers
    View HTTP headers on your web requests - great for troubleshooting problems.

    ColorZilla
    Another one that I learned about from the PC Mag article. A handy little tool that lets you view the RGB color definition for any point on a page.

    Miscelleneous Extensions
    ChromEdit
    Provides easy access to the various user customization files of Firefox (userChrome.css, user.js, etc)

    Gmail Notifier
    A fantastic tool for keeping tabs on your Gmail account.


    How about you? What extensions do you run?

  • If it ain't broke, don't upgrade it

    Last weekend I decided to upgrade the firmware on my US Robotics 8054 wireless router. The latest firmware (1.64b34) added WPA support, as well as bumping the speed up to 125 Mbps and improving resistence to interference. This turned out to be a bad decision. At first the upgrade looked good (aside from the fact that the upgrade dumped the entire router configuration - an ongoing issue with firmware upgrades on this router).

    Things turned ugly, however, when I connected to my company's VPN over the wireless connection (it worked fine over a wired connection). After about a minute, the router would reboot itself and dropped all connections. A little Googling showed that other people have had the problem, and that there's no resolution yet. This firmware version has been out since October, so it stinks that they haven't fixed it. After downgrading to the previous version of the firmware, the problem disappeared, but I wasted almost half a day working on it.

    Incidentally, there's lots of good information on various vendors' networking hardware over at Broadband Reports. I won't again make the mistake of upgrading the firmware before consulting that site for known issue. I should have known enough to check there in the first place - I had problems with firmware upgrades on my first wireless access point too.

  • Microsoft's Fiddler PowerToy?

    Today I ran across this article on MSDN, titled "Fiddler PowerToy - Part 1: HTTP Debugging". Now, I've been using Fiddler for ages - it's a fabulous tool. But "Microsoft Fidder"? Has it always been a Microsoft tool? Did I miss something? Near as I can figure, it was either developed by a Microsoft employee but originally delivered independently, or it was aquired by Microsoft on the down-low, Lookout style. Either way, I'm glad to see it's still being enhanced. But it caught me by surprise.

    UPDATE - Omar dispels my conspiracy theories by informing me that Fiddler is (and always was) written by a MS employee. Damn you and your dose of reality, Omar. :)

  • Storing network passwords in Windows

    Every once in a while I run across some feature of Windows that somehow has escaped my attention over the years. Usually this realization is followed immediately by slap to the forehead, followed by wondering if I'm the last person to discover this feature. I had one of those moments this week.