Putting DynamicFields in a Validation Group [Dynamic Data]

If you're like me, you've implemented Dynamic Data with master-detail pages that include GridView controls and perhaps multiple drill-down DetailsView controls or other form controls.

You also proceeded to realize that validating two or more controls on the same page with DynamicFields is hard, to the say the least. Luckily, I found a streamlined solution!

More »

URL Rewrite Not Working? Use IIS7 Integrated Mode

Recently for our web site, we ran into a problem where our URL rewrite module wasn't working with non-.NET-handled files. As you may know, IIS7 supports using URL rewriting with all kinds of files without too much web.config editing.

The solution was simple: our host did not set our web site to Integrated Mode in IIS7. Once they did, all of our rules were working.

For more information about IIS7 settings, take a look at this post:

Wildcard script mapping and IIS 7 integrated pipeline

Function That Generates a Page Title Based Off Web.Sitemap [Helpers]

On the Intrepid Studios site, we use a web.sitemap file to keep a list of the static pages on the site. It's becoming more common in web design to have a page title that is a reverse-breadcrumb. Learn how to do it for your own site using a helpful function. More »

Function That Resizes Dimensions to Bounds [Helpers]

In one of my current projects at work I needed to load photos off the file system and resize them so that they fit within a specified set of bounds. So, obviously, I created a function to calculate it for me! More »

PHP String Format Function [Helpers]

In .NET we have a great little function called String.Format that will transform a string and format it. Here's a PHP function that will substitute strings in the same fashion. More »

Function to Generate a Slug (URL-friendly String) [Helpers] [Updated]

Update #1: With the help of my esteemed colleague Zach, I've provided a PHP function as well and fixed some bugs with the .NET version.

Update #2: Added the "-" character to the non-invalid chars list so passing in an already-generated slug didn't break it.

Update #3 (3/17/2010): After some unit testing, fixed bug where it would keep multiple hyphens instead of condensing them into one hyphen. Added parameter to adjust max length.

Update #4 (9/11/2010): For some reason spaces weren't escaped. Stupid Live Writer… or something. Fixed.

The term "slug" was first coined, I believe, by Wordpress to mean a URL-friendly version of a post title. From their codex:

A slug is a few words that describe a post or a page. Slugs are usually a URL friendly version of the post title (which has been automatically generated by WordPress), but a slug can be anything you like. Slugs are meant to be used with permalinks as they help describe what the content at the URL is.

How do you go about converting an unfriendly title into a friendly one?

Here's a helper function that does just that:

What is it doing?

  1. Transform string into lowercase
  2. Remove invalid characters (not alphanumeric or spaces or hyphens)
  3. Trim and convert multiple spaces/hyphens into only one space, to get the best string.
  4. Extract first 45 characters then trim spaces (in case the 45th char is a space)
  5. Transform spaces into a hyphens.

You can add on features, like changing common symbols into words, like "." into "dot" and so on.

Why a max of 45? In my DB I have the column set to a max length of 50 and in the future I may implement some sort of duplicate checking and append numbers at the end of the title. Also, I think 50 characters is a good enough length for someone to type in.

Enjoy!

Using Default Values in LINQ to SQL

If your SQL Server automatically provides default values for certain columns, you may be scratching your head wondering why Linq to SQL throws errors when you don't provide values for those columns whenever you insert rows. Learn how to make Linq to SQL behave. More »

Hamster Malfunctions [Buggy]

Please forgive us if you encounter errors while browsing the site. We are constantly working on it and when transferring files over we sometimes miss ones. The errors should go away after a few minutes. More »

Release: Just Another Carousel [jQuery]

Just Another Carousel - Designs Example

We've released another jQuery plugin, dubbed Just Another Carousel.

While there are certainly already other carousels out there, we developed our own because we wanted some unique things that the others didn't offer. Namely, we wanted to have some mouse interaction. It's simple, all it does is center the element on your mouse cursor… it's a small feature that looks really cool.

So, head on over to the project page to take a look!

An error has occured while trying to process your request. Hide