Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Fear and Loathing

Gonzo blogging from the Annie Leibovitz of the software development world.

  • Back at work after coughing up a lung and hey, check out SPDesigner

    I'm back at work after a few days off (of course getting sick over the weekend is no fun). I thought my lungs were going to collapse on Friday so I headed home early and stayed in bed all weekend taking every concievable legal cough/cold remedy drug known to mankind. After 72 hours of wandering in and out of conciousness I think I'm pretty healed so back to the grind.

    By way of Daniel McPherson and this blog I found a very cool new (beta) tool by James Milne called SharePoint Style Designer (or just SPDesigner or SPSkin depending on where you look). It's basically a simple way to create your CSS files (one for SPS, one for a custom theme in a WSS site). Rather than plodding through the CSS files yourself with something like Top Style (my choice of CSS tools), James tool just breaks the sections down and gives you what you need to configure. Very cool and very slick.

    You can view the tool online here. You can tweak the values in each category and view the resulting CSS. You can even work your style online and submit it for future versions of the Style Designer. I can't seem to find a way to download it and use it locally but it's currently in beta and perhaps not available. In any case, check it out if you're looking to change the look and feel of your SharePoint installations.

  • FabriKam, FabriKam, FabriKam

    What the hell is he talking about? Only a really cool leaning platform that we've been waiting for awhile now. The Office System Fabrikam Learning Platform is now available for pre-order. The documentation has been on MSDN for quite awhile but now we can order the real meal deal. Okay, so it's still not released but according to Mark Bower here, the DVDs are currently in production and should be shipping soon. 

    FabriKam is a Virtual PC image that contain sample solutions and components for SharePoint, BizTalk, and Office 2003 with a mess of goodies that you can take and munge into your own. What's inside this package? Plenty. While you can learn about the Office System as a development platform it also contains a wealth of knowledge with best practices, white papers, code samples, etc.

    What can you do with this cool tool? Looking at the documentation there are some great OOTB (out-of-the-box) solutions in the SharePoint space like a Routing Service, a Multi-Library List View Web Part (aggregate multiple document libraries into one view), and a Project Site Manager solution. These are showcased solution samples that are initially horizontal specialty applications that can be re-used, repurposed or extended by developers. In addition to the SharePoint goodies there are some SQL Server Reporting solutions (Expense Report, Team Weekly Status Report, etc.) and other solutions that tie into BizTalk and other Microsoft Technologies.

    Be sure to get your DVD today! You can pre-order the DVD from here (no charge for the DVD, you just pay shipping) which should be shipping in about 2 weeks.

  • CDI's Education Canadian Technology Briefing Tour

    My fellow SharePointBlogger and all around nice guy Eli Robillard is off starting next Tuesday on a two week, nine city tour across Canada promoting that favorite portal you love to hate. It's a free even and he's been kind enough to slosh by and drop in on us here in Cowtown (as well as those "other" cities). You get a continental breakfast and Eli will ramble on for a couple of hours on SharePoint, ASP.NET, and SQL Server 2005. Looks like it will be fun and informative and hey, it's free. Check out the CDI Technology Briefing home for dates and schedules or head on over to the online registration to reserve your seat today.

  • Brain overloading... must release knowledge!

    Lots of good stuff going on here. I'm winding down on a fairly intense SharePoint application development project (a Contract Management system). Still a month (or 6 you never can tell with these "agile" projects) left but things are working well. 100,000 lines of SharePoint configuration (lists, sitedefs, etc.) and 100,000 lines of C# code between 3 developers over 3 months. Not a bad effort. Out of which I have to say my SharePoint knowledge (and frustrations) have soared to new heights and I'm just full of stupid little SharePoint giblets that I'll be sharing over the next few weeks (OneNote is a great tool for capturing all  these little thoughts).

    On the publishing front, I'm starting to write articles for the new SharePoint Advisor magazine. Still haven't figured out what my first one will be one (feel free to toss out some ideas if you're looking for something specific that you want me to dive into). I'm also putting together a proposal for a new book on SharePoint. I want to do something in the same flavour as the O'Reilly Cookbooks (Problem/Solution/Discussion) so I'm starting that now (again if you're just itching to get something in there now's your chance). We'll see how this goes and if I can keep up the pace of my 12+ hour days along with another 4-6 hours writing. Luckily I truly only sleep 3-4 hours a night. To bed around 10 or 11 and up at 2 or 3. Guess my body is just used to it that way (I would have used the term trained by my body is anything but trained).

    Visual Studio Team Systems is rolling and I'm just getting past a few quirks in the Beta 2 stuff. A few things I would have really liked to see:

    • I would really like to just drag one project into the reference of another. It's such a pain sometimes to bring up the dialog to set references to projects that are in my solution. Maybe I'm just complaining because b2 keeps crashing on me with this.
    • Why can't we rename classes in the Class View? We can rename them in file form (which magically will rename the class) and we can rename the class in the Designer. So why not in Class View?

    These are silly and nitpicky I know and for the most part are fine the way they work now. Just some things I thought would be nice to have.

    And here you thought this was going to be a well informed, thought out, and highly knowledgeable post.

  • Hiding a list through FrontPage

    Often you might have a list in a SharePoint site that you don't want users to get to. Something like lookup lists or whatever (adminy type stuff) that you need to have in a site but nobody should mess with. Its easy to do it through code but here's how you can do it using FrontPage 2003.

    In FrontPage open up the site that contains the list. Right click on the list and select Properties and choose the Settings tab. You'll see an option Hide from browsers. Now the list won't show up in the Documents and Lists page for prying eyes to get into. Note that this will not ghost your page/site/etc. so it's a safe thing to do in FrontPage.

    As with most things in SharePoint, the list is still there so someone who knows how figure out the url to it (which isn't hard) could still get to it. You can toggle this on and off anytime so to edit the list you make it visible, make your changes, and then turn it back off again. You could also link the list to a spreadsheet and save the sheet for future use. Then hide the list and make your edits through the spreadsheet.

  • Expanding on Expanding and Collapsing Fields in a View

    I'm pretty pleased when people get something from my blogs (it sort of validates my existing in this silly world). I'm even more pleased when they expand, extend, and otherwise enhance what started from a simple blog scribble.

    One of my fellow MVPs, Renaud COMTE, took my post on creating an toggleable (if that's even a word) DataView (with a little evil JavaScript to expand and collapse large copius amounts of text in a view) and ran with it. Him and his co-worker Eric moved the work I did into the SCHEMA.XML file for a view so it would be part of the normal views in SharePoint. Very nice stuff. You can see the work they did here.

    BTW, I really like the .Text skin that Bob Roudebush made which emulates the OneNote look and feel. You can download it from here. Nice stuff.

    A couple of other short but somewhat important tidbits for your Friday reading.

    • The Beta 2 Installation Guide for Team Foundation Server is available here. This is updated and different from the one that's included in the DVDs and MSDN download so be sure to grab it and be current.
    • The FabriKam help file is available here. We've been waiting for FabriKam for a long time (and it keeps getting pushed out). I'm interested because of some of new Web Parts in it (like a really cool Multi-doclib viewer) and the solutions that are available in it that you can customize. Guess we'll have to wait a little longer.
    • Finally there's the Virtual Server Deployment Manager. The Virtual Server Deployment Manager provides a streamlined way to manage and deploy Virtual Machines. Using this tool, regular users (not just administrators) will be able to create and manage their own machines, without impacting other users' machines. It's available here.

    Have fun and have a great weekend!

  • Best Practices and Member Initialization in C#

    Today I thought I would present two slightly different approaches to class member initialization and see what people were doing out there. When you define a class you have the option to initialize member variables in the declaration or in the constructor. Here's our class creating a new ArrayList at declaration time:

    public class MyClass

    {

        private ArrayList myList = new ArrayList();

     

        public MyClass()

        {

        }

    }

     
    So you create a new instance of MyClass and the array list it created for you. The second example is to initialize it to null (a C++ type approach) and then "create" it in the constructor:
     

    public class MyClass

    {

        private ArrayList myList = new ArrayList();

     

        public MyClass()

        {

            myList = new ArrayList();

        }

    }

     
    Pretty much the same effect isn't it. There is one danger in initializing the ArrayList at declaration time though. Sometimes a developer might come along and create another constructor and re-initialize or create the ArrayList again:
     

    public class MyClass

    {

        private ArrayList myList = null;

     

        public MyClass()

        {

            myList = new ArrayList();

        }

    }

    No big deal in C# as it'll just add a few more operations at the IL code. No harm no foul. However if your field wasn't an ArrayList but another more complex class (that maybe incorporated other classes) it might not produce the wanted effect (especially if you read a config file or something to initialize values like in a data class to read the connection string).

    Steve Eichert blogged about this a couple of years ago and asked the question as well. There didn't seem to be any hard and fast rule but there were a couple of interesting observations about it. James Curran mentioned that he prefers to initialze all data members at declaration because it parallels the initialization of local variables. That makes sense so why not? According to Sigurdur Gunnarsson, the other really interesting thing I didn't know (although I can't find it documented anywhere) is that initialization of some members (like say "string myString = string.Empty;" the compile will move the initialization into the constructor so he does his creation in the constructor to control order.

    Is there a right way or wrong way here or is it a "it depends" answer? Do you have any standards you use around doing this like "all member variables will be initialized in the constructor" (at least for consistency). The Constructor Usage Guidelines in the .NET Framework General Reference doesn't seem to suggest one or the other (although the simple example they have initializes strings in the declaration).

    PS anyone have a nice way of copy/paste code into .Text without it looking like it's been through the washing machine?

    PPS thanks to Darrell Norton for the tip on the CopySourceAsHtml addin that I've updated the blog with. Works great!

  • Validating SharePoint Web Parts

    A bit of perspective, a bit of a quandry, a bit of a question today.

    SharePoint web parts work fine with validation controls. If you just want to display a validation like any other you would do it (using a ValidationSummary control or the validation control itself) things work fine. Just add them to the Controls property of the Web Part and render them. No worries.

    Recently I had a fairly large form that contains half a dozen fields that need to be validated. Luckily they're all simple validations (required fields only). When you have a SharePoint form (using the built-in ListForm Web Part) it displays all the controls and a red "*" where required fields are. If you try to save the form without filling out any of the fields two things happen. First you get a client side message saying something like "You must specify a non-blank value for <fieldname>" (where field name is the Display Name of the field that's required). Second, it scrolls to where the control is (and if I remember correctly sets the focus to the control for entry). So here I am trying to mimic this behavior and running into some head-scratching activities.

    The way I currently started my cloning process was:

    1. Create a RequiredValidator control and attach it to my control I want to validate (a TextBox) in my Web Part
    2. Create a ValidationSummary control and set the ShowMessageBox property to true and ShowSummary property to false. This will popup a client side message box that displays whatever the error message for the control is.
    3. Set the ValidationSummary.CssClass property to "hidden" to prevent it from being seen in the Web Part
    4. Render the ValidationSummary control in the RenderWebPart method

    This works fine and gives you the same result as what SharePoint does with a Form, namely popup a message box and prevent you from going forward. This works great for the first control but then when you add a second control the message box shows all messages from all invalid controls. This isn't quite what I'm looking for as the SharePoint form will only give you the latest validation message and stop there. So without getting into managing all the various messages (say through a stack object) what gives? Also there must be a way to leverage the code that the Web Part framework has to do these validations and not have to write all this stuff over again (at least that's what my pea brain says to me) however there's nothing in the ClientAPI or the standard JavaScript (blech) files I can see that would help here.

    Anyone got some perspectives on doing validations in Web Parts. While it may look like madness, trying to mimic what SharePoint does, there is method to it. I would prefer to have a consistent view of error messages throughout SharePoint, both stock Web Parts and custom ones, so the users don't get all peeved that our Web Parts show it one way but when working in a list or doclib they get treated differently. Or maybe I'm just kidding myself here and it's not worth the effort.

  • SQL Server 2005 CTP April 2005 available

    Yeah, blog titles are getting longer and my patience for installing/uninstalling/re-installing is wearing thinner. Anyways, the April 2005 CTP edition is available for your bandwidth hogging pleasures via MSDN now. Be sure to grab the Developer Edition to get your Team Foundation server up and running (I don't think the Express edition will work but go on and prove me wrong). 840MB then another 5 hours of setting a new image again and we're golden.

  • Team System Install Update

    Just a quick update as I got a lot of emails about Team Foundation server and the fact that it states it needs the April CTP of SQL Server 2005 but that's not avialable on MSDN downloads yet. Yes, it's true but for my tests I had run using the February 2005 CTP. The install worked fine but some features were disabled (Reporting was there but not functional). I guess they'll have the April CTP up shortly so you can do a proper install so it might be best to wait for that. In addition to the SQL Server sillyness, you still need to install Windows SharePoint Services on the server with MSDE because it cannot talk to the SQL Server 2005 instance that Team Foundation uses. So at the end of the day your data server is going to be running SQL Server 2005 and MSDE which also means your project documents cannot exceed 2GB (due to the limit that MSDE has). Clear as mud? Yeah, time to hit the bottle again and wait for another download.