April 2006 Archives

Firefox Web Developer Extension

Bookmark and Share

Christmas has come early this year. A few weeks ago I wrote about the Web Accessibility Toolbar. My main problem with it was that it was IE-only and I'm a Firefox guy. Today my prayers were answered by the Firefox Web Developer Extension. It has everything the accessibility toolbar has plus a lot more and it's strictly a Firefox add-on. If you're a web developer you need to have this. Seriously it will make your life so much easier.

Download the Firefox Web Developer Extension here.

Special thanks go out to my friend and colleague Nik Livadas who pointed this awesome tool out to me. He's a Flash specialist out of Rochester, NY with a standards-based site in the works. I'll keep you all posted on that.

Missing the Point

Bookmark and Share

I've been pretty busy lately but I wanted to write a quick rant about something that annoys me to no end... and that is clients that spend 3 weeks and 17 rounds of text edits with miniscule changes that no one would ever notice before launching a website. I completely understand the need for consistency and accuracy but there's a limit, especially since they're going to destroy the site with a CMS anyway.

Seriously, from a business standpoint, which is worse:
A) Having a period missing from a bullet point on page 3 of your product specifications page
B) Not having a website to showcase your products

When was the last time you were on a site and thought "WHAT!?!!? Is that a hyphen? No way! I'm going to buy this product from a competitor for $100 more because they know how to use an em dash." Probably never. If you actually have, then you don't deserve to use the internet.

Again, quality is important. You obviously don't want a website full of egregious typos but don't lose site of the bigger goal. Get your website up. Get your message out. There will be plenty of time to iron out the miniscule issues afterwards.

Building a Website: Getting Started

Bookmark and Share

I build a lot of websites. To date, I've launched dozens of sites: some, microsites of only a few pages; others, massive dynamic sites with content that would span several reams of paper. While the projects always differ in size, style, and project goal, they mostly start the same way. With each new project I begin the same process; create a folder to house the files, subfolders for things like images and javascript files, add some basic style sheets to control font face and sizes, etc., etc. With every new project I found myself cutting and pasting code from other sites I built previously to get me started. Being a junkie for organization, I decided to take this cut and pasted code and create a very basic set of files to use as a starting point when building a website. It works reasonably well for me so I'm sharing it with you.

This includes some basic CSS files for screen and print and a default html with things like a link to skip navigation and a notice to outdated browsers. Note that my files use the .aspx extension since I usually code with .net but you can easily rename them. I recommend using .aspx, .php, .cfm, or some other server-side extension instead of just plain old .htm. Even if you don't have any fancy scripting or databases on your site, you may be asked to add it in the future and having the extensions in place makes it a lot easier.

This is a work in progress so feedback is encouraged. If anyone has any suggestions or additions, leave them in the comments below.

Download the Site Template Zip File

UPDATE - 4/19/06: a colleague of mine noticed an extraneous </td> tag in the upgrade.aspx file (Thanks Jeff). I don't know how that got in there but the zip file has been updated to fix it

AJAX - A paradigm shift

Bookmark and Share

Hearing about all the new AJAX functionality that Microsoft’s Atlas allows us to easily implement got me thinking about how to effectively leverage it.

While most of the improvements to ASP.NET, Visual Studio, etc. enable us to do what we’ve been doing faster and more efficiently, AJAX really changes the game by altering the very foundation on which we build website applications.

The OLD Way – Submit Forms / Receive Pages
The NEW Way – Submit Requests / Receive Data

What this means is that we can selectively update portions of the page without causing the entire browser to refresh (a postback), effectively making the web run much more like a desktop application. This functionality provides for better user interfaces and richer client experiences.

Thanks to frameworks like Atlas, much of the technical hurdles can be easily overcome but there’s another underlying problem. How do we design, architect, or wireframe for AJAX-enabled sites? A typical design or wireframing process involves mapping out each page in the site and defining what types of content it contains. What happens with AJAX however, is that portions of the content, site functionality, and elements requiring user interaction can now take place without the need for a separate page.

In my humble opinion, this represents a new way of thinking and a significant shift in the way we approach building a site. As developers on the cutting edge of employing this new technology I think it’s also part of our job to work with the designers and architects to figure out the best way to create the user interface using all of the tools we now have at our disposal.

DevConnections - Day Four

Bookmark and Share

I'm posting this from the Orlando International Airport which apparently has free wireless internet access. That's just fantastic. DevConnections is officially over. Here's my take on the last day.

Session 1 - Managing Memberships and Roles
One of the things ASP.NET 2.0 was designed for was to increase productivity and save developers time. To that end, Microsoft has added a suite of controls and components that allow for easily setting up login forms, creating users, managing permissions, etc. These components and methods take much of the work out of some of the more tedious tasks such as hashing password values, enforcing password creation rules, and locking users out after too many failed login attempts.

Since most of us will be using this with the SqlMembershipProvider for storing the data in SQL Server, it should be noted that by default, this is setup in Visual Studio to work with SQL 2005 Express. For use in a production environment with a full version of SQL, you'll need to prep the database first. There's a utility called aspnet_regsql.exe included with Visual Studio that will do just that. It can be run from the command line or there's a nice GUI if you run it in Windows.

The presenter, Bill Evjen, is also a member of INETA.org, which is an organization of Microsoft user groups that can be a great asset to continue learning.

Session 2 - ASP.NET 2.0 Essentials for building Professional Websites
This was a decent if somewhat repetitive session, which seemed to just recap some best practices from earlier sessions such as:

  • Use master pages to control page templates.
  • Create user controls to reduce complex and duplicated code
  • Plan for localization when you build your site so it's easy to add in later if needed
  • Always provide custom error messages to your users. Use the global.asax to create a custom error handler to log errors and/or alert administrators.
  • Design and test a caching strategy to improve overall site efficiency.

Session 3 - The Atlas Application Framework
More good stuff on Microsoft's new AJAX-enabling framework for ASP.NET 2.0 by Dino Esposito. This session contained a lot more technical information that I don't have the space to recount here. I plan on trying out a lot of the Atlas demos in the coming weeks and will post some more in-depth info at that time. This is pretty bleeding-edge so I recommend that anyone who's interested simply download the Atlas framework and start playing with it.

Session 4 - Improving .NET Application Performance and Scalability
There is always a bottleneck. Find it. Remove it. Repeat.
That was the overall message of this last session of the conference. For any application that manages data and/or supports multiple users, tuning your application for performance should play an important role. Here are some good tips and tricks:

  • Minimize round trips for data. Write stored procedures that retrieve multiple recordsets rather than running multiple queries
  • Acquire late - release early - open your connection at the last possible moment and close it immediately after you're done. In most cases it's better to have multiple open/close statements than it is to open it once, do all your processing, and close it at the end. ALWAYS make sure to close your connections, SqlDataReaders, etc.
  • Put the processing closer to the resources it needs - If you need to sort or filter data, do it in SQL instead of returning a large recordset and doing it in code
  • Defrag and rebuild database indexes regularly
  • Use the StringBuilder class for string concatenations within loops

Parting Thoughts
I am exhausted. I've crammed more new information into my brain in the past four days than I have in the past four months. Although very tired, I'm also extremely encouraged. With tight budgets and tighter deadlines, often the emphasis is on getting the project done and not necessarily on getting the project done right. Conferences like this provide a great venue for developers to learn in-depth details about the new technologies being offered and how to effectively utilize them. I have several projects coming up this summer that should be able to take advantage of things like Atlas, localization, fragment caching, and web parts. The knowledge I learned this week should help prevent a lot of late nights in the office and allow me to catch up on something I've been missing for a while... sleep.

DevConnections - Day Three

Bookmark and Share

I am not a morning person. I officially decided that these events start too early in the morning when I was stumbling around in the dark, half-asleep, tripped, fell into the wall, and nearly broke my nose. Yes, I am that awesome. Thankfully the rest of the day was not as awful as the beginning.

Session 1 - Accessing Data with the ASP.NET 2.0 Data Controls
This session was a decent introduction to the new data source controls in ASP.NET 2.0. Data source controls are non-UI helper controls that enable 2-way databinding with little or no code. I've already been using ASP.NET 2.0 for a couple months now so unfortunately there wasn't much new here. If you're new to ASP.NET you can view the slides from this session at www.deeptraining.com/litwin

One off-topic remark that speaker Paul Litwin made was about the new ways to encrypt your connection strings (and anything else you want) inside of the web.config file. This is a great habit to get into since it easily adds another layer of security to your application. Mr. Litwin has a great blog on the subject that will help.
Encrypting/Decrypting Web.config Sections

Session 2 - Localizing ASP.NET 2.0 Applications
Let's face it. Not everyone speaks English. Localization in ASP.NET 2.0 provides easy mechanisms for adding multi-language support to your projects. I have to say that I'm incredibly impressed by how easy this is. Using ASP.NET 2.0 localization allows you to maintain one core set of your website files and then use standard resource (.resx) files to implement however many languages you'd like. You can also setup a global resources folder for content that is repeated on multiple pages.

Most of the built in controls are localizable and there's even an asp:Localize control which can be used to wrap static content, making it localizable as well. Creating a method for the user to select a locale is simple and can be easily stored in a database for authenticated users or via a cookie using the Profile object for anonymous users. There's even a pretty easy way to add a custom caching parameter to vary by locale.

If you have any intention of creating a website in more than one language, the ASP.NET 2.0 localization features should not be overlooked.

Though not there at the time of this posting, speaker Dave Sussman has promised to post the slides and demos on his site at http://www.ipona.com/samples/

Session 3 - Maximizing ASP.NET Performance with Data Caching
ASP.NET 2.0 has made some major improvements to it's caching model which this session delved into. Caching can be set at the page level, selectively turned on and off for specific user controls, and the new data source controls have configurable parameters to apply caching to individual datasets. The web.config file now also supports caching profiles which can be configured and set for each page so different types of pages can have different caching durations and parameters.

Perhaps the most significant improvement though is the addition of sqlCacheDependency. Many sites pull content from databases, which is then cached. If the content in the database is updated, the page will still show the old data until the cache expires. SqlCacheDependency provides a mechanism for the database to notify the webserver of the change to automatically expire the cache. This can function both in SQL2000 and SQL2005, although 2005 enhances the process with what's called the Broker Service.
The code and slides for this session can be found at www.daveandal.com/download

Session 4 - SQL 2005 Indexing Strategies: Finding the Right Balance
I took a break from the ASP.NET 2.0 sessions and attended this one on SQL Server Indexing. I'm not a DBA but as a web developer I'm often stuck doing those tasks anyways. Indexing is a topic I'm planning to cover in more detail in a later blog and I gathered a lot of information here that will be helpful for that.

For now, here're a few quick notes from speaker Kimberly L. Tripp.
3 Things you need for doing database development:

  1. Know your data - Knowing exactly what data you're storing helps you design for performance
  2. Know your users - Knowing how people interact with the data helps you index for optimal performance
  3. Know what really goes on - Users often lie or are uniformed about how things actually work so profiling the user requests and server responses will help you figure out an efficient strategy

4 Steps for creating indexes:

  1. Create your clustered index
  2. Create indexes on primary key (PK) and unique keys (UK)
  3. Manually index foreign keys (FK) - This improves key relationship management and may improve join performance
  4. Manually create your extra indexes for AND, OR, JOIN, and aggregate queries

Full-text indexing has been significantly improved in SQL Server 2005 and catalog indexes now build 400% faster. The Index Tuning Wizard (ITW) has also been replaced by the newer Database Tuning Advisor (DTA), which possesses many new algorithms to help SQL optimize and run more efficient queries.

Session 5 - Building N-Tier ASP.NET 2.0 Applications
About half of this session was interesting. The other half admittedly went over my head. I'm most definitely not an application architect but, like not being a DBA, this responsibility often falls on my head. N-Tier is "a software architecture methodology that defines distinct physical or process boundaries between application modules." When you hear people talk about separating the data-access layer from the business logic from the presentation layer, their talking about N-Tier architecture.

One of the main benefits of this is flexibility and ability to re-use code. If you build your app on SQL server and then need to port it to Oracle, you can do so very easily by only modifying your data-access layer. There'd be no need to actually change any of your .aspx pages.

This concept is still pretty new to me. I'm lucky if I have time to actually build the project. Who has time to create an architecture?

That's all for today. 4 more sessions tomorrow and then it's back to the office.

DevConnections - Day Two

Bookmark and Share

The morning started with keynotes touting many of the new and improved features of Visual Studio 2005. You can find some good demos, as well as a sneak-peak at the new ad campaign at www.400plusdifferences.com. After that it was off to the individual sessions...

Session 1 - Creating Dynamic Web Sites with ASP.NET 2.0 Web Parts
Web parts are a set of new controls in ASP.NET 2.0 that allow us to provide users with flexible display options and personalized content. The most common application of this interface would be for portal-type sites like MyYahoo and Google's personalized homepage but you can really leverage this technology for any kind of site.

The best part about web parts is that they work with existing ASP.NET controls and custom user controls with little or no effort. Just by dragging some controls onto the page you can quickly and easily give your users the ability to personalize the content. This could be a great feature for allowing your users to customize the homepage of any database-driven web application. By default the controls integrate seamlessly with Microsoft SQL server to persist data for authenticated users but that can also be modified to use any data store such as Oracle, MySQL, or XML.

Note: The drag and drop functionality to customize the display parts will only work in Internet Explorer at the moment but there are controls in the new Atlas framework that enable it for other browsers such as Firefox and Opera.

Session 2 - New Enhancements for Web Developers in Visual Studio 2005
This was an informative albeit sales-pitchy session about the improvements made to VS2005. My team has already been using VS2005 for a couple of months so a lot of the information I already had, but here's a quick breakdown of just a few of the cooler new features:

  • Built in development server. No need to have IIS installed
  • Better integration with SourceSafe for versioning and code control
  • WYSIWYG DataSet designer
  • Customizable tag formatting options
  • Better Intellisense
  • XHTML and 508/WCAG compliant code and built in validators

Another thing I should point out is that Microsoft has also released Visual Web Developer Express along with SQL Server 2005 Express. Both products are free to download and provide a great platform for developers to test-drive and learn ASP.NET 2.0 and the Visual Studio environment without having to plunk down hard-earned cash.

Lunch
I didn't plan on blogging about lunch but I had the pleasure of eating with Microsoft guru Joe Stagner who happens to be an exceptionally nice guy. We chatted a bit about Microsoft and general development stuff and he also pointed me to The Code Room, which is a "1/2 hour internet TV show that exposes technologists to the latest tools and technologies for tackling real-world software development issues". He wrote and produced an episode in Las Vegas last December that's worth checking out.

Session 3 - Using Visual Studio Team System to Build Enterprise ASP.NET Web Applications
Visual Studio Team System is a new version of VS that enables project management and collaboration functionality right within the developer environment. It also integrates directly with Excel, Project, and SharePoint to allow multiple developers and project managers to work together. While it seems useful for large teams working on an enterprise-sized project, I can't envision it being all that helpful for smaller web apps. They system is divided into parts for system architects, developers, and testers. Most of the developers I know (myself included) usually get stuck doing all three so this almost seems more bother than what it's worth.

One part I did find especially interesting however, was the testing features available for web applications. You're able to simulate any number of incrementally increasing users using multiple browsers to effectively stress test your applications before deployment.

Session 4 - An In-Depth Look at Building Enhanced Web Apps Using Atlas
By far the biggest draw so far, the Atlas session was packed with people standing and sitting in the aisles. For good reason it would appear. Atlas seems to be the most interesting surprise in Microsoft's bag of tricks.

Atlas is a cross-browser JavaScript library and server-side assembly that provides AJAX functionality on top of ASP.NET 2.0. The most impressive part about it is that it enables AJAX-style partial-page rendering without a lot of work and without having to write any complex JavaScript. The coolest part for me was the ability to extend existing controls within the framework such as adding drag and drop functionality or auto-complete for textbox controls.

Session 5 - Cool Tips & Tricks in ASP.NET 2.0
The day concluded with a session by keynote speaker Scott Guthrie who is not only brilliant but also a great presenter. It was designed to provide 10 tips and tricks to help increase overall productivity and it was exceptionally beneficial. I won't bother to recap the tips and tricks Mr. Guthrie provided since he's made them available on his blog. I highly recommend downloading this session.
ASP.NET Connections Tips and Tricks Slides+Demos Posted

DevConnections - Day One

Bookmark and Share

Right now I'm down in beautiful Orlando, FL for the 2006 Microsoft DevConnections conference that my company was gracious enough to send me to. Today was day one and I just returned from the reception and keynote speeches by Scott Guthrie and Matt Nunn. Both speakers were excellent and I'm looking forward to the sessions tomorrow.

There's a ton of stuff going on during the next three days but I'm going to concentrate on the ASP.NET track. It looks like one of the more interesting topics is going to be "ATLAS", Microsoft's new framework for implementing AJAX functionality in ASP.NET. Mr. Guthrie did a brief demo of it during the keynote and it looks very impressive. With just a few lines of code, he took a DataGrid with paging, sorting, edit, and deleting, and made the whole thing AJAX-enabled. It looks both easy and powerful, and best of all it's free. You can download the Atlas framework from the asp.net site and try it out.

One of the more interesting things I found out was that the popular social networking site MySpace.com is running on ASP.NET 2.0. MySpace ranks as the #2 most popular site on the Internet (Yahoo! holds #1) with 1.5 billion page views per day. That's some serious traffic. Later this month they plan to role out a new profile personalization engine using Atlas so that'll be something to look for.
More info on how MySpace takes advantage of Microsoft technology.

There're conference sessions and events from 7AM until 9PM tomorrow so I'll hope to have some more good info to report then.

Free the web - Boycott Internet Explorer 6