I recently upgraded to dasBlog 2.0 and went ahead and updated my site design while I was at it. With the new design, I wanted to use dasBlog's navigator links for the horizontal menu. However, the navigatorLinks macro is hard-coded with a vertically-oriented table structure. So I wrote a custom macro to provide the links in a simple unordered list that I could style with CSS. I started from the source code for the navigatorLinks macro and just replaced the HTML-generating bits. While I was tempted to consolidate the redundant logic, I avoided any other refactoring to save time. For those interested, my code is below. For more information on creating custom macros, read: Creating custom macros for dasBlog.
public class CustomMacro
{
protected SharedBasePage requestPage;
protected Entry currentItem;
public CustomMacro(SharedBasePage page, Entry item)
requestPage = page;
currentItem = item;
}
/// <summary>
/// Return the navigator links in an unordered list.
/// </summary>
public Control GetNavigatorList()
string fileName = "navigatorLinks.xml";
StringBuilder navigator = new StringBuilder("<div class=\"navigatorContainer\"><ul class=\"navigatorList\">");
string itemTemplate = "<li class=\"navigatorListItem\"><a class=\"navigatorListItemLink\" href=\"{0}\">{1}</a></li>";
try
string fullPath = HttpContext.Current.Server.MapPath(SiteConfig.GetSiteConfig().ContentDir + fileName);
if (File.Exists(fullPath))
NavigatorXml nav;
using (Stream s = File.OpenRead(fullPath))
XmlSerializer ser = new XmlSerializer(typeof(NavigatorXml));
nav = (NavigatorXml)ser.Deserialize(s);
foreach (NavigatorItem navitem in nav.Items)
navigator.Append(String.Format(itemTemplate, navitem.Url, navitem.Name));
else
NavigationRoot nav;
fullPath = HttpContext.Current.Server.MapPath("~/SiteConfig/" + fileName);
XmlSerializer ser = new XmlSerializer(typeof(NavigationRoot));
nav = (NavigationRoot)ser.Deserialize(s);
foreach (NavigationLink navitem in nav.Items)
return new LiteralControl("Add '" + fileName + "' to your SiteConfig directory<br />");
catch (Exception exc)
ErrorTrace.Trace(System.Diagnostics.TraceLevel.Error, exc);
return new LiteralControl("There was an error processing '" + fileName + "'<br />");
navigator.Append("</ul></div>");
return new LiteralControl(navigator.ToString());
Be the first to rate this post
Tags: blogging
Design / Technique | Tools / Services
The Patterns & Practices group has published a beta version of their Team Development with TFS best practices guide. According to J.D. Meier:
It's our Microsoft playbook for TFS. This is our guide to help show you how to make the most of Team Foundation Server. It's a distillation of many lessons learned. It's a collaborative effort among product team members, field, industry experts, MVPs, and customers.
The contents (360 pages) include:
Parts Part I, Fundamentals Part II, Source Control Part III, Builds Part IV, Large Project Considerations Part V, Project Management Part VI, Process Guidance Part VII, Reporting Part VIII, Setting Up and Maintaining the Team Environment Chapters Introduction Ch 01 - Introducing the Team Environment Ch 02 - Team Foundation Server Architecture Ch 03 - Structuring Projects and Solutions Ch 04 - Structuring Projects and Solutions in Team Foundation Server Ch 05 - Defining Your Branching and Merging Strategy Ch 06 - Managing Source Control Dependencies in Visual Studio Team System Ch 07 - Team Build Explained Ch 08 - Setting Up Continuous Integration with Team Build Ch 09 - Setting Up Scheduled Builds with Team Build Ch 10 - Large Project Considerations Ch 11 - Project Management Explained Ch 12 - Work Items Explained Ch 13 – MSF Agile Projects Ch 14 - Process Templates Explained Ch 15 - Reporting Explained Ch 16 - Team Foundation Server Deployment Ch 17 - Providing Internet Access to Team Foundation Server
Chapters Introduction Ch 01 - Introducing the Team Environment Ch 02 - Team Foundation Server Architecture Ch 03 - Structuring Projects and Solutions Ch 04 - Structuring Projects and Solutions in Team Foundation Server Ch 05 - Defining Your Branching and Merging Strategy Ch 06 - Managing Source Control Dependencies in Visual Studio Team System Ch 07 - Team Build Explained Ch 08 - Setting Up Continuous Integration with Team Build Ch 09 - Setting Up Scheduled Builds with Team Build Ch 10 - Large Project Considerations Ch 11 - Project Management Explained Ch 12 - Work Items Explained Ch 13 – MSF Agile Projects Ch 14 - Process Templates Explained Ch 15 - Reporting Explained Ch 16 - Team Foundation Server Deployment Ch 17 - Providing Internet Access to Team Foundation Server
Tags: tfs
Process / Methodology | References / Resources | Tools / Services
Krzysztof Cwalina is a Program Manager on the Microsoft .Net Framework team and one of the principal architects of the base class library. Along with Brad Adams, he wrote the Framework Design Guidelines, which is available on MSDN or in hardcover. The hardcover includes in-line comments from several other framework developers, which provide background on the reasoning and internal debates that occurred around various guidelines. If you haven't read it, I highly recommend it.
If you're more of a "wait for the movie" type of person, you're in luck! Krzysztof recently gave a Designing .Net Class Libraries presentation to Microsoft Research, which was recorded and is available online. It is a three hour presentation, so you might want to bring sodas and popcorn. From Microsoft:
This class presents best practices for designing frameworks that are reusable object-oriented libraries. The guidelines are applicable to frameworks ranging in size and in their scale of reuse from large system frameworks to small components shared among several applications. They started as a small set of naming and design conventions, but have been enhanced, scrutinized, and refined to a point where they are generally considered the canonical way to design frameworks at Microsoft. They carry the experience and cumulative wisdom of thousands of developer hours, over three versions of the .NET Framework.
[Update: 10/15/07] The video is now available for download for offline viewing.
Tags: framework design, class library
Design / Technique | References / Resources
Microsoft recently published guidance for branching and merging with Team Foundation Source Control. Branching/merging can be a major headache if not thoughtfully planned and managed. However, it is a valuable and necessary tool for parallel development activities. Examples from Microsoft:
Example 1: A team of 40 developers is building an application. There are four feature teams, each led by a development lead. The feature teams vary in size from two developers to fifteen developers. The milestones for each feature area also vary. There needs to be a mechanism to provide isolation to each of the feature teams while allowing for changes to the common areas of the application in a reliable and controlled fashion. Branching is a very good solution here; this is referred to in this document as Branching for Feature Team Isolation. Example 2: A development team has just gone live with the first release of a Web site. The development team has started working on the next version of the site, but a critical bug is found by an important customer on the live site. A strategy needs to be introduced to allow the core development team to continue evolving the next version of the site while bug fixes can be made for maintenance of the released site. There needs to be a mechanism to isolate these two work streams. This is referred to in this document as Branching for Maintenance.
Example 1: A team of 40 developers is building an application. There are four feature teams, each led by a development lead. The feature teams vary in size from two developers to fifteen developers. The milestones for each feature area also vary. There needs to be a mechanism to provide isolation to each of the feature teams while allowing for changes to the common areas of the application in a reliable and controlled fashion. Branching is a very good solution here; this is referred to in this document as Branching for Feature Team Isolation.
Example 2: A development team has just gone live with the first release of a Web site. The development team has started working on the next version of the site, but a critical bug is found by an important customer on the live site. A strategy needs to be introduced to allow the core development team to continue evolving the next version of the site while bug fixes can be made for maintenance of the released site. There needs to be a mechanism to isolate these two work streams. This is referred to in this document as Branching for Maintenance.
You can read the guidance online, or download a PDF version.
Process / Methodology | Tools / Services
PhotoshopNews is hosting a couple sample chapters from one of my favorite Photoshop authors, Martin Evening.
From: Adobe Photoshop CS3 for Photographers
From: The Adobe Photoshop Lightroom Book
If you're considering upgrading or purchasing either of those products, these chapters provide much more information than I've read in any other web reviews/articles.
I recently started using Lightroom and am very impressed. I'm a serious amateur photographer and love doing "digital darkroom" work with Photoshop. However, since Photoshop wasn't originally designed with photographers in mind (it serves a much broader user-base), it isn't the most intuitive or easy to use image manipulation tool. And Bridge is seriousely lacking as a workflow/management tool. Lightroom, on the other hand, was created from the ground up for photographers - and it shows! I expect I will spend 80-90% of my darkroom time in Lightroom. It can handle all my image management, exposure compensation and touch-up needs. I'll still use Photoshop for advanced tasks like multi-image composition/blending/merging, geometric adjustments, advanced filters, etc. But the easy stuff will actually be easy now with Lightroom.
Without a doubt, the best feature is non-destructive editing. Since I'm not a pro, I do a lot of experimenting and "trial and error". Now I can go nuts adjusting images without worry. In Photoshop, you're forced to commit at the end of your session. In Lightroom, there really is no notion of saving a file - and you have unlimited and persistent history. So you never have to commit.
Tags: photoshop, lightroom
Tools / Services
Discovered this today when trying to link from a secure page on an ecommerce site to an un-secure file on a media streaming site that pseudo-authenticated the request by validating the referrer header. From Microsoft:
Internet Explorer Does Not Send Referer Header in Unsecured Situations SUMMARY When linking from one document to another in Internet Explorer 4.0 and later, the HTTP Referer header will not be sent when the referer is a non-HTTP (or non-HTTPS) page. The Referer header will also not be sent when linking from an HTTPS page to a non-HTTPS page. MORE INFORMATION The Referer header is a standard HTTP header in the form of "Referer: <URL>," which indicates to a Web server the URL of the page that contained the hyperlink to the currently requested URL. When a user clicks on a link on "http://example.microsoft.com/default.htm" to "http://example.microsoft.com/test.htm," the theoretical example.microsoft.com Web server will be sent a referer header of the form "http://example.microsoft.com". However, Internet Explorer will not send the Referer header in situations that may result in secure data being sent accidentally to unsecured sites. For example, Internet Explorer will not send the Referer header for each of the following example hyperlinks from one document URL to another document URL: javascript:somejavascriptcode --> http://example.microsoft.com file://c:\alocalhtmlfile.htm --> http://example.microsoft.com https://example.microsoft.com --> http://www.microsoft.com This prevents local file names from being sent inadvertently to Web servers when linking from local content to Web sites that might snoop on such information. Also, many secure (HTTPS) Web servers store secure information such as credit-card data in the URL during a GET request to a CGI or ISAPI server application. This information can be unwittingly sent in the Referer header when linking out of an "https://" server to an "http://" server elsewhere on the Web. Internet Explorer attempts to prevent this bad practice by not sending the Referer header when transitioning from an HTTPS URL to a non-HTTPS URL.
Internet Explorer Does Not Send Referer Header in Unsecured Situations
SUMMARY When linking from one document to another in Internet Explorer 4.0 and later, the HTTP Referer header will not be sent when the referer is a non-HTTP (or non-HTTPS) page. The Referer header will also not be sent when linking from an HTTPS page to a non-HTTPS page. MORE INFORMATION The Referer header is a standard HTTP header in the form of "Referer: <URL>," which indicates to a Web server the URL of the page that contained the hyperlink to the currently requested URL. When a user clicks on a link on "http://example.microsoft.com/default.htm" to "http://example.microsoft.com/test.htm," the theoretical example.microsoft.com Web server will be sent a referer header of the form "http://example.microsoft.com".
However, Internet Explorer will not send the Referer header in situations that may result in secure data being sent accidentally to unsecured sites. For example, Internet Explorer will not send the Referer header for each of the following example hyperlinks from one document URL to another document URL: javascript:somejavascriptcode --> http://example.microsoft.com file://c:\alocalhtmlfile.htm --> http://example.microsoft.com https://example.microsoft.com --> http://www.microsoft.com This prevents local file names from being sent inadvertently to Web servers when linking from local content to Web sites that might snoop on such information. Also, many secure (HTTPS) Web servers store secure information such as credit-card data in the URL during a GET request to a CGI or ISAPI server application. This information can be unwittingly sent in the Referer header when linking out of an "https://" server to an "http://" server elsewhere on the Web. Internet Explorer attempts to prevent this bad practice by not sending the Referer header when transitioning from an HTTPS URL to a non-HTTPS URL.
Tags: ie, http, troubleshooting
Design / Technique
I recently upgraded my Safari subscription to the "all you can eat" option. One of the benefits is access to "rough cuts" - books that are still in development, but already have substantial content. One such book that I've been browsing is High Performance Web Sites, by Steve Souders - Yahoo!'s "Chief Performance Yahoo!". He offers 14 rules that "have been tested on some of the most popular sites on the Internet and have successfully reduced the response times of those pages by 25-50%".
Rule 1 - Minimize HTTP Requests Rule 2 - Use Edge Computing Rule 3 - Add an Expires Header Rule 4 - Gzip Components Rule 5 - Move Stylesheets to the Top Rule 6 - Move Scripts to the Bottom Rule 7 - Avoid CSS Expressions Rule 8 - Inline in Home Pages Rule 9 - Minimize Domains Rule 10 - Minify JavaScript Rule 11 - Avoid Redirects Rule 12 - Remove Duplicate Scripts Rule 13 - Turn off ETags Rule 14 - Make AJAX Cacheable and Small
A more appropriate title might be "High Performance Web Pages", as these are predominately page-level optimizations. That is the title of the book's companion web site, wich has before/after examples of each of the rules. This site is worth checking out, even if you don't have the book or a Safari subscription.
Tags: performance, http, html, css, ajax, javascript
I just started reading through Charles Petzold's new book on Windows Presentation Foundation: Applications = Code + Markup: A Guide to the Microsoft Windows Presentation Foundation. What was going to be the initial C#/.Net primer chapter of this book, ended up being a seperate 267 page book of its own, entitled .Net Book Zero. He decided to make this book available as a free download! You can get it here: http://www.charlespetzold.com/dotnet
Don't be confused by the version number. The book is version 1.1, but it covers .Net 2.0.
Tags: c#, class library
References / Resources
I just read James McCaffrey's MSDN article on Test Automation for ASP.NET Web Apps with SSL. Aside from the test automation advice, he describes a useful trick for running/debugging a secure web site locally with a temporary/test certificate - without getting the usual security alerts. From James:
Setting up a Test SSL Server Until recently, it was quite a chore to set up a test Web server with SSL enabled. You can purchase a "real" SSL certificate from one of several providers, but that takes time and money. Another option is to generate a self-signed SSL certificate using the makecert.exe utility that is part of the .NET Framework Tools, then install it onto your Web server. But now there is a much simpler way. The IIS 6.0 Resource Kit (available for download from Windows Deployment and Resource Kits) contains several valuable tools including one—selfssl.exe—which makes it very easy to create and install a self-signed SSL certificate for testing purposes. The screenshot in Figure 4 shows exactly how I did this. The key is to use the /T switch so that the local browser will trust the certificate and also to use the /N switch to specify "localhost" as the Common name. Amazingly, this is all you need to test with HTTPS directly on the Web server. If you want to test HTTP with SSL from a remote client machine, the first time you manually browse to the test server you will get a Security Alert dialog asking if you want to proceed. If you click on the View Certificate button, then click on the Install Certificate button, you will enter a wizard. If you accept all the defaults in the wizard, then after you finish installing the certificate the client will be able to access the test server without the warning dialog and your test automation will run from the client. Although the selfssl.exe tool is part of the IIS 6.0 Resource Kit and does not explicitly support earlier versions of IIS, my colleagues and I have successfully experimented with it on IIS 5.0. I have also used the makecert.exe tool to generate a self-signed x.509 certificate that can be used for testing. The MSDN Library has instructions for the makecert.exe tool at Certificate Creation Tool, but using the selfssl.exe tool is easier. After you are finished testing with your self-signed SSL certificate you will want to remove it to prevent possible interaction effects on your test server. The easiest way to remove the certificate is by using the Microsoft Management Console (MMC). Launch MMC and add the Certificates snap-in for a Computer Account to manage the Local Computer. Now you should expand the Certificates store and then expand the Personal folder. After selecting the Certificates folder, your self-signed certificate will be displayed and you can delete it.
Tags: asp.net, iis, ssl, troubleshooting
James Lau, a Program Manager with the Visual Studio IDE team posted an article with some good Visual Studio 2005 IDE Tips and Tricks. From James:
Summary: Visual Studio 2005 is the leading developer tool on the market, and I would like to share with you some tips and tricks that will make this great tool even more powerful. Getting familiar with a tool is crucial to getting the most out of the tool, and development tools and IDEs are no different. But with the many new technologies such as C# 2.0, ASP .NET 2.0, Windows Workflow Foundation, Windows Presentation Foundation, and Windows Communication Foundation, who has time to learn about Visual Studio itself? By spending 10 minutes to read this article, I hope you will learn a couple of useful things that will make your life inside Visual Studio more pleasant and productive. (19 printed pages) Contents Keeping Your Hands on the Keyboard Window Layout Selector Code Snippets Customizing Visual Studio Start Page Team Settings /resetuserdata Switch
Read the article, here: http://msdn2.microsoft.com/en-us/library/bb245788(vs.80).aspx
Tags: visual studio
I'm an Internet technology business strategist, software architect, and development leader specializing in interactive marketing and social media. read more...