Sunday, 1 January 2012

Tumblr Mangles Developer Relations

Last week I logged on to Tumblr and was confronted with this abomination:

missing e notice from tumblr

Missing e notice from tumblr. Way to encourage API development, guys.

Needless to say, this is pretty disturbing, and I wonder what Tumblr is thinking by posting this.

Continue reading: Tumblr Mangles Developer Relations »

Sunday, 25 December 2011

Parent-Child DropDownList Controls In ASP.NET Web Forms (VB.NET)

Some time ago I promised a formspring anon I would do a tutorial on parent / child DropDownList controls in ASP.NET Web Forms. At long last, I’m delivering. (From here on out, I will use “DropDownList” and “select list” interchangeably.)

Parent-child DropDownList controls means you have a parent, or main / master select list. Based on whatever selection is made in that first DropDownList, a second, “child” or “detail” select list is populated with relevant results.For example, if we had a database of cars, we might have a parent (master) DropDownList of manufacturers — Ford, Chevy, Toyota, etc. — and populate the child DropDownList with models from the selected manufacturer. So, if someone chose Ford in the parent select list, the child select list would automatically populate with choices such as Fusion, Mustang, Explorer, F-150, etc.

I’ll be demonstrating two different ways to accomplish this task, as well as a few variations on the first: First, binding with only SqlDataSource controls, which is by far the easiest way to proceed and will suffice for about 90 percent of applications; second, using code behind and CompareValidator controls, to cover all possible roadblocks.

Some notes before we proceed:

  • I’ll use the ZIP Code database I’ve been using for a while as the back-end data. I also have a separate table of USPS state codes I’m using as the parent data, to help illustrate that you can use several tables / data sources to fuel this solution, provided the keys that relate the data make sense to each data store. In other words, you can use a lot of different sources for your data, so long as the data is relational.
  • I’m going to use SQL Server, stored procedures and a connection string stored in my web.config file to access my data. I recognize that some people prefer to use SQL statements / LINQ and the like, or can only use Access / MySQL or other data stores. I really urge you to always use stored procedures, as they are way safer than inline SQL statements. As far as alternative data stores go, that should be a easy a fix as switching your code to use to the relevant ADO.NET ODBC classes, rather than the SQL Client classes.
  • This solution should work for ASP.NET versions 2.0 forward.

Continue reading: Parent-Child DropDownList Controls In ASP.NET Web Forms (VB.NET) »

Friday, 23 December 2011

Hi Doug, “Sorting Your MySQL Results Set In PHP Using jQuery” is perfect for what I need, thanks.The cursor changes to an “I” beam rather than a hand when hovering over a column heading – can this be altered to show a hand for the clickable heading?

You can use CSS and the hover pseudoclass:

#sortedtable thead th:hover {
    cursor: pointer;
}

Ask me anything

Saturday, 17 December 2011

also with auto hashtagging: if you have already a hashtag you get double hashtags…

Read the follow-up article.

Ask me anything

Saturday, 17 December 2011

I read your article about auto-hashtagging. Maybe you forgot when a to-be-tag is ending with a ‘.’ of ‘,’ or other punctuation…?

Seems that’s the case. Good catch! An easy fix is to simply run the input string through a regular expression that strips out the punctuation before exploding it into an array.

Ask me anything