January 2006 Archives

Flipping the Funnel

Bookmark and Share

If you're not familiar with Seth Godin, It's probably because you spend too much time coding and not enough time figuring out WHAT you should be coding.

While not strictly focused on web development, Seth has written numerous books and e-books on all things related to marketing, offline and online. Basically, how to make your company, product, service, whatever stand out from the rest. For more, read Seth Godin's Bio.

Seth also has a great blog at http://sethgodin.typepad.com/ and has recently released a new e-book, free to download, titled "Flipping the Funnel". It's a great, quick read on how leveraging newer web technologies can help a company attract more customers without a lot more work and/or money.

From the site: This new ebook (3 versions, 18 pages each, PDF format) explains how I believe some of the new Web 2.0 tools (flickr, de.licio.us, squidoo and others) combine with ideaviruses and the Purple Cow.

It's definitely worth reading and will, if nothing else, give you a break from the coding articles you usually read.

Seth's Blog - Flipping the Funnel

There's someone out there smarter than you… ask them

Bookmark and Share

Whenever I get stuck on a problem I do what most developers do. I ask my friends in the business for help and they do the same to me. It's impossible to know everything there is to know in this field so when all else fails we often turn to outside resources. But what happens when no one you know can solve your problem? Well... get more friends.

The web is filled with online communities where people can post questions and share information. These are a great place to get answers from others in the field. Chances are, whatever you're doing, someone else has already done it and will be willing to help.

I encourage all developers out there to actively participate in these groups. Posting to forums is a great way to get your questions answered but it's also a great way to learn by helping others. Here a couple of my favorites:

Microsoft ASP.NET Forums
http://forums.asp.net/

ASP Messageboard
http://www.aspmessageboard.com/

Tek-Tips Forums
http://www.tek-tips.com/

The Design Triangle

Bookmark and Share

I've been pretty busy this week and haven't had time to do much writing so I'm taking a cop-out approach to this blog entry by stealing from someone else. I didn't create this, nor do I remember where I found it, but I think it's genius and holds true for just about everything we do in this field.

Fast - Good - Cheap

You can only have one point on the triangle.

If it's Fast and Good, it isn't Cheap.

If it's Cheap and Good, it isn't Fast.

If it's Fast and Cheap, it isn't Good.

Scalable Inman Flash Replacement (sIFR)

Bookmark and Share

One of the major limitations of web design is the number of available fonts. Traditionally, designers have been limited to "web safe" fonts like Arial, Verdana, and Times. These work well for all of the main page copy but most designers I know like to use nicer looking fonts such as Futura, Univers, or Trade Gothic for things like headers and pull-quotes.

For years, developers have handled this the only way they knew how... Photoshop. 150 pages meant 150 GIF files of rendered text. This solution is obviously time consuming and makes maintenance a nightmare.

Enter Scalable Inman Flash Replacement (sIFR). In a nutshell, sIFR lets you take CSS-styled text and, using some fancy javascript, dynamically replace the text with a Flash SWF file of the text rendered in the font of your choice.

Since this replacement is done dynamically, the underlying (X)HTML code isn't affected. Users with the Flash plug-in installed will see the intended special font. Users without will instead just see regular CSS-styled text in a fallback font such as Arial. Search engines and screen readers can also easily pick up the underlying text without problems.

See an example page using sIFR

A word of caution… As with any trendy new technique, sIFR should be used in moderation. While it is pretty efficient, you're still creating Flash files on the fly and dynamically replacing text using javascript. This is a great technique for things like headers but it wasn't really designed to replace massive blocks of text so keep that in mind when you implement it.

For more information see:

Microsoft Developer Security Resource Kit

Bookmark and Share

Kudos to my buddy David for finding this and sending it to me. It's a free (couple bucks for S&H) resource DVD from Microsoft with info, videos, developer tools, etc. related to security, which is often the most overlooked part of development, even though it should be one of the most important. I have some blogs planned in the next week or two about web-app security but wanted to post this for anyone else that enjoys free, nerdy, computer stuff.

Get the Microsoft Developer Security Resource Kit.

Website Launch Checklist

Bookmark and Share

Your new website launches tomorrow. You've got twelve rounds of edits from the client and eighteen other people calling you about different projects. You always want to deliver the highest quality work but things inevitably get lost in the shuffle. How do you make sure you don't leave anything out?

This field can get pretty crazy at times so I've started a website launch checklist which can help us make sure we've got everything perfect before we flip the proverbial switch and the site goes live.

I put this list together with some of the things in mind that I usually leave until the last minute. If anybody has any suggestions on what to add, leave them in the comments and I'll update this document.

Download the Website Launch Checklist PDF - 24 KB

My day with Microsoft

Bookmark and Share

I spent the majority of my day at the Microsoft launch event for SQL Server 2005, Visual Studio 2005, and BizTalk Server 2006. Microsoft does events like this periodically across the country and they're often free (as this one was) or relatively inexpensive. They provide great insight into some of their new products and services and they often give away software, books, magazines, etc. At the very least it's free food and a day away from the office so I recommend them to anyone in the field.

This particular conference was pretty good, although I don't use BizTalk and I'll admit that some of the SQL stuff went over my head. I, like most of my readers, user SQL Server for small to medium web applications like content management systems, not things like massive enterprise-level transaction based banking systems.

I'd already been playing with Visual Studio 2005 and ASP.NET 2.0 so I was mainly interested in the SQL Server 2005 info. Some of the new features were pretty interesting so here's a few of my random notes on that topic:

  • SQL 2005 now has an XML data type which you can use to store XML data. You can also store a schema for the data to validate against and use XQuery to query it within a SQL statement
  • End user ad-hoc reporting is now built into the Reporting Services allowing users to create reports on the fly
  • Improved error handling features have been added to T-SQL in the form of Try/Catch blocks
  • SQL 2005 now has built in data encryption functions using both symmetric and asymmetric keys
  • SQL-CLR allows you to write things like Stored Procedures, Functions, and Triggers in VB.NET or C#
  • New LOB support with varchar(MAX) and varbinary(MAX) allowing you to store large amounts of data without using text and image fields.
  • CacheSync - allows data from the database to be cached by IIS. When the data is updated, SQL Sever will automatically let IIS know to expire the cache.

One last thing, not SQL related, is that the new Team Foundation Server allows developers to work together and integrates new source code control functionality into Visual Studio as an alternative to SourceSafe. SourceSafe (even the new 2005 version) isn't exactly everyone's favorite application so let's hope this will be better.

That's it for now. I want to give a quick thank you to everyone who reads this blog for the positive feedback I've received so far. I love comments so keep posting them and/or send any ideas, stories, etc. to jay@codescene.com.

Why didn't you tell me it’s a #$%*ing PDF?

Bookmark and Share

This entry will be a slight rant about a pet peeve I have. I’m reading some information on a site about a product I’m interested in. I see a link for more information on the product. I click it. My PC slows to a crawl as my browser loads Acrobat and attempts to open a 7meg PDF file. Why? Why would you not tell me I’m opening a PDF… a 7meg PDF?

I don’t hate PDFs. This one was actually quite useful and I’m glad I was able to get it. However, it would’ve been nice to know what it was so that I could right click and save it, rather than having it open in the browser window. Note to Adobe: I love your stuff but you need to make some serious improvements to the Acrobat plugin. I have 2.5 gigs of RAM, it shouldn't take this long to open a PDF.

If you’re a web developer… and you probably are if you’re reading this… I make the following request to you. Putting PDFs on your site is great but please let your users know that it’s a PDF. If it’s a large file, put the file size there as well. Format your links something like...

Download the widget fact sheet (PDF, 7megs)

Maybe use a little PDF icon... something. The same would go for Word Docs or Excel files to. If I'm clicking something and it's not another HTML page, then let me know.... please?

Never DELETE Anything

Bookmark and Share

A cautionary tale about data recovery

Your giant database application is up and running. Hundreds of users from across the globe are managing the data within. Months go by. Productivity is up. Users are happy. They love you. Mission accomplished. Then you get the call...

"We're in the database and it looks like a couple weeks ago so-and-so accidentally deleted one of the key records in the database. We didn't notice it until today but now we need the information for a presentation in a few hours. How do we get it back?"

They no longer love you. You didn't cause this problem but you'd damned well better fix it... and fast.

It's for this reason that I don't much care for the SQL DELETE function. Running it will wipe the record in question making it difficult to recover. Sure, you can retrieve it from your backups (you do have a backup plan right?) but that's often tedious. You'll have to locate the backup file (possibly offline on a tape), restore it to a separate location on the server so you don't affect any of the data in the live database, retrieve the record and restore it.

As an alternative to flat out deleting data, I like to use a stored procedure that will transfer the record to a separate DELETED table within the database before removing it from the actual live table. This way the data is removed from the live application but easily retrieved when the client calls in a panic. This also has the added benefit of being able to mark the deleted record with a timestamp and the name of the user who deleted it.

Here's the stored procedure I use to do this:

CREATE PROCEDURE dbo.DeleteMyRecord
(
	@ID int,
	@UserSession varchar(20)
)
AS

SET NOCOUNT ON

DECLARE
@new_id int

-- Copy the record to the deleted table
INSERT INTO DELrecords (id, myfield1, myfield2, myfield3)
SELECT id, myfield1, myfield2, myfield3 FROM records WHERE id=@ID

-- Get the new record's ID (the deleted table has a separate primary key called deleted_id)
SELECT @new_id = @@identity

-- Update the record with the date and username
UPDATE DELrecords SET deleted_by=@UserSession, deleted_date=GETDATE() WHERE deleted_id=@new_id

-- Delete from master table
DELETE FROM records WHERE id=@ID
GO

Note that using this method has obvious performance and disk space implications. I don't advocate it's use for systems where lightning-fast response time is mission critical or for extremely large systems where this method could cripple the disk space. For most smaller intranet-style applications though, this procedure has worked very well for me. You can experiment with different procedures but the principle is the same: Users will delete things they shouldn't and you'll have to fix it. Do yourself a favor and put a plan into place before you get that phone call.

Party like it's 1/1/1900

Bookmark and Share

(or how to insert null values into SQL using ASP.NET)
I've built several online applications using Microsoft SQL Server as the backend database and one thing that's always given me trouble was inserting dates, or more specifically NOT inserting dates.

Users can enter a date or use a calendar control to select one and, assuming it's valid, it goes into the database with no problems. But what happens when the user leaves the date field blank? If SQL is expecting a date, and you pass it a null value instead, it ends up in the database as the SQL default date of 1/1/1900 when most often you just want it left blank.

So how do you insert a blank value into the database? Here's an easy trick using VB.NET (assuming txtDate is an asp:TextBox)

<%@ import namespace="System.Data.SqlTypes" %>

Dim nulldate As SqlDateTime
nulldate = SqlDateTime.Null

If (txtDate.Text = String.Empty) Then
    cmd.Parameters("@Date").Value = nulldate
Else
    cmd.Parameters("@Date").Value = txtDate.Text
End If
Free the web - Boycott Internet Explorer 6