Keep Current with Coldfusion Talk Around the World

December 3rd, 2008 Jon Dowdle Posted in coldfusion | 1 Comment »

Looking for a way to keep up with the global Coldfusion community on Twitter? Its quite simple. You only need 1 thing for this to work in its entirety: A Google Reader account.

  1. Create a search feed for the terms you want to follow here. I simply used "Coldfusion" but you might want to play with some hash tags such as #maxmilan.
  2. On the search results page, grab the feed for the query.
  3. Add the feed to your Google Reader account
  4. Under feed settings, select "Translate into my language"Image
  5. Enjoy reading multilanguage tweets!

jQuery Ajax Loading with Selectors

October 29th, 2008 Jon Dowdle Posted in Code | No Comments »

If you don't know, jQuery can load a remote page into a DIV very easily. Not only that, it can also filter on which parts of that page get loaded.

First you have to use load method of the target div. For example if my div looks like <div id="target">, then my load call will look like $("div#target").load(  "file.html" );

The load method has more to offer than that though!

You can only load into your target div the sections of interest my specifying selectors after the url.

Ex.  $("div#target").load("file.html .targetClass"); will loading all of the elements in file.html with the class "targetClass".

To see this in action, see the live example here. The file being loaded is here.


cfqueryparam, NULLs and Lists

September 17th, 2008 Jon Dowdle Posted in Code | No Comments »

While inserting null for values while using cfqueryparam has been written about before, I'd like address the specific case of lists. When I say lists, I'm referring to (in MySql) queries that use something along the lines of

SELECT this, that FROM table WHERE id IN (12, 13, 29, 56)

So the paramerterized version would look like this:

<cfset id_list = "12,13,29,56">
<cfquery name="aQuery" datasource="dsn">
Select this, that
From table
Where id in
(
<cfqueryparam value="#id_list#" >
)
</cfquery>

That looks fine and dandy, unless your list (id_list in this case) is null or empty. Coldfusion 6 doesn't insert a null for you automatically, which causes MySql to throw an error. To remedy this, I employed a solution similar to the null-ifying of the parameter. The addition being that the list parameter also needs to be set inversely to the null parameter. So if the list parameter is hard coded to true, null will not be inserted.

<cfset id_list = "">
<cfquery name="aQuery" datasource="dsn">
Select this, that
From table
Where id in
(
<cfqueryparam value="#id_list#"
list="#LEN(id_list) GT 0#"
null="#LEN(id_list) EQ 0#"
>
)
</cfquery>

Note: It looks like CF8 works fine without this method.

Links:
cfqueryparam and conditional handling of NULL’s


Talk Like A Pirate Day 2008 - Booty

August 27th, 2008 Jon Dowdle Posted in Life | No Comments »

In preparation for "Talk Like a Pirate Day", I've bought some supplies. See below.

Pirate T-Shirt

Pirate T-Shirt

Jolly Roger

Jolly Roger

Pirate Monkey

Pirate Monkey

Pirate Mug

Pirate Mug

Other links:
Holiday's site: http://www.talklikeapirate.com/
Translator: http://www.syddware.com/cgi-bin/pirate.pl

Note: I am not in any kind of partnership with thebigpirate.com in anyway. I just like their stuff. Argh.


Displaying Friendly Errors with jQuery

July 20th, 2008 Jon Dowdle Posted in Code | No Comments »

In just one week, I have encountered this problem twice, so I think it's worthy of a post.

The problem was that a form needed to provide negative feedback while the user was entering data. I find this to be more useful than an all at once "You're missing <this> and <that>. Go back and fill them out or I will never accept your submission."

What better to solve this issue than the worlds greatest Javascript library, jQuery!
Read the rest of this entry »