Archive for August, 2008

Copy a Single File to Avoid Re-Activating Windows XP [Tutorial]

Friday, August 29th, 2008

The Online Tech Tips site offers up a great tip for anyone reinstalling XP off something other than their original CD—such as a slipstreamed and automated installation—or lacking a net connection to run the activation. Before wiping your system clean, grab a file named WPA.DBL from the System32 directory and save it to a thumb drive or other external media. When you load up your new system, skip registration, enter "Safe Mode" from the boot menu, and drop it back into that System32 folder. Now you're re-activated and free of nagging. Hit the link below for detailed explanation of each step.

How to avoid having to reactivate Windows XP after fresh install [Online Tech Tips]


ShopNotes: A smooth finish

Thursday, August 28th, 2008
I like to use MDF to make shop projects. It's flat, smooth, and inexpensive. To give the MDF some protection and dress up its bland appearance, I usually paint it. Here are a few tips for getting the best results. Continue reading "SHOPNOTES: A smooth finish"

Startup Delayer Staggers Your Startup Apps for Smoother Loading [Featured Windows Download]

Thursday, August 28th, 2008

startup-delayer.pngWindows only: Free application Startup Delayer staggers the applications that launch when you log in to Windows by user-defined increments. The reason: To mitigate the common startup bottleneck caused by all of your startup applications fighting to run at the same time. You'd never try launching eight different applications simultaneously under normal circumstances and expect your computer to handle it well, so why should your startup apps be any different? To use it, just drag applications to the delay bar at the bottom of the window. You can visualize the time between the launch of different apps and drag-and-drop the delays until you've got the perfect spacing.

Though you'll likely be delaying app launches by seconds, you can delay a launch for up to 24 hours (though we're not sure why you would). If Startup Delayer sounds familiar, that's probably because we featured an identically named application a while back. This Startup Delayer, however, makes the process much simpler and more manageable. Startup Delayer is freeware, Windows only.

Startup Delayer

Skip the File-Wiping if You’re Caught File-Sharing [File Sharing]

Thursday, August 28th, 2008

The defendant in a much-watched file-sharing case was dealt a serious blow this week when a judge ruled he tampered with evidence in the case. After first getting notice from the Recording Industry Association of America, Jeffrey Howell, according to Ars Technica,

... uninstalled KaZaA and deleted everything in the shared folder, reformatted his hard drive, downloaded and used a file-wiping program, and then nuked all the KaZaA logs on his PC.

Something to keep in mind if you ever find yourself unlucky enough to get caught. For more on the RIAA's take-down tactics and defenses against them, check out out this Ask the Law Geek post.

RIAA wins P2P case after defendant reformats hard drive [Ars Technica via CyberNet]


A Dynamic Menu For Your Dynamic Data

Wednesday, August 27th, 2008

So I am still playing around with building a Northwind Dynamic Data web site. Tonight I thought it would be interesting to see what it would take to create a menu for navigating the tables in the site. I was particularly interested in seeing if I could get some grouping or categorization to the metadata so I could create a multi-leveled menu. It turns out it wasn't too difficult at all (see the screen shot below - the menu is on the left). I have my tables organized into 4 categories: Sales, People, Products and Reports. And the cool thing is that this menu is completely dynamic. You can add, remove or reorganize the categories without touching the UI. And depending where you are keeping your metadata you could even do this without recompiling your app. The grouping is automatically discovered from the metadata and the menu is built solely off the it so everything 'just works'.

Besides adding the grouping information, I also tagged each of my tables with a custom description that I am displaying under the grids title. Nothing too complicated, but still interesting. Read on if you are curious how I did this and don't forget to check out the download.

Download

image

Adding Category and Description

When MetaTable objects are created, the Dynamic Data components automatically populate the the MetaTable's DisplayName property from the DisplayNameAttribute that is hanging off the metadata class (if you are using the default metadata provider). This is why you see the nice 'Products By Category' title in the screen shot above. I have specifically told Dynamic Data to use this value because I tagged my metadata class with the DisplayName attribute and given it a value of 'Products By Category'. Below this metadata ...

[MetadataType(typeof(ProductByCategoryMetadata))]
public partial class Products_by_Category { }
 
[DisplayName("Products By Category")]
public class ProductByCategoryMetadata
{
    [ScaffoldColumn(false)]
    public object Discontinued { get; set; }
}

To add a category and description to the metadata, I just used the existing Category and Description attributes and added them to the metadata class as well. So now we have ...

[MetadataType(typeof(ProductByCategoryMetadata))]
public partial class Products_by_Category { }
 
[Category("Products")]
[Description("You can use this page to view your products by category")]
[DisplayName("Products By Category")]
public class ProductByCategoryMetadata
{
    [ScaffoldColumn(false)]
    public object Discontinued { get; set; }
}

The Category and Description attributes don't directly map to any properties on the MetaTable type. But, any extra custom attributes that are applied to in the metadata are passed through to the Attribute collection that hangs off the MetaTable class. So with a couple of pretty simple extensions methods I can add them myself (ignoring error handling for now) ...

public static class MetaTableExtensions
{
    /// 
    /// Gets the description for the MetaTable
    /// 
    public static string GetDescription(this MetaTable table)
    {
        return ((DescriptionAttribute)table.Attributes[typeof(DescriptionAttribute)]).Description;
    }
 
    /// 
    /// Gets the category for the MetaTable
    /// 
    public static string GetCategory(this MetaTable table)
    {
        return ((CategoryAttribute)table.Attributes[typeof(CategoryAttribute)]).Category;
    }
}

... and now to get at the MetaTable's description or category I can just go through these methods. So I updated the List template and added a little bit of code that generates a simple title bar generated from the MetaTables DisplayName and Description attributes.

image

and now our List pages have a nice dynamic title bar ...

image

Building the Menu

To build the menu, I am using a ListView tied to a LinqDataSource that uses a Linq query to create a 2 level object structure that I can bind to. First, I wired the LinqDataSource's Selecting event to the following bit of code that groups my tables by their category ...

protected void LdsMenu_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
    e.Result =
        from vt in MetaModel.Default.VisibleTables
        //  use the category to group the tables
        group vt by vt.GetCategory() into groups
        select new 
        {
            CategoryName = groups.Key,
            Tables = groups 
        };
}

Then I bound this data source to my ListView ...

image

And that's all it took to build my 2 level menu. Awesome!

image

Conclusion

Can Dynamic Data be used for more than admin screens and prototyping? I think it might. What about you?

That's it. Enjoy!