Not sure if this Gmail feature is cool or not…

I went to click send on an email today and received a funny warning. See the image below.

Apparently Google scans your email and if it finds the phrase “attached file” in the body and the email has no attachment, it gives you this reminder that you may have forgotten to attach the file.  I know we have all sent out the dreaded email telling people to look at the attachment only we never attached it.  With that in mind, this is a pretty handy little feature.  At the same time, when the warning came up, it caught me off guard and I was fairly confused as to why it did not send my email immediately.  Once I actually processed what it said, it makes perfect sense.  I would assume that Google did not implement this sort of thing for a single scenario, so it makes you wonder what other phrases it is scanning for.  Anyone else encountered this or any others?

Disclaimer:  If everyone else in the world knew about this and I am just out of touch, I apologize!

You know what sucks?

When I take the time to sit and write code samples to prove that jQuery’s live method does not respond to the native load event, and then my test cases prove I was wrong all along. Guess I will have to revisit the code where I ended up using a custom event called “loaded” because I believed this to be the case. Fail, but I guess it is never a bad thing to figure something out even if it proves yourself wrong.

Visual Studio Theme Generator

Pretty awesome tool to build Visual Studio themes via a simple user interface.

http://www.frickinsweet.com/tools/Theme.mvc.aspx

Google Talk “… has left the conversation”

Anyone else find the feature in Google Talk where it tells people you have left the conversation uncomfortable.  Due to this feature, I feel the need to leave a chat window open at least 10-15 minutes after the end of a conversation to avoid offending the other person.  Maybe I am just nuts, but that’s how I feel!

ColdFusion ListToArray – includeEmptyField

Most ColdFusion developers have probably realized at some point that ListToArray ignores empty values between delimiters altogether.  What I mean is that "a,,,b,c,d" would return an array with only 4 items in it, rather than 6 items with two of them being empty.  This has been frustrating to say the least.  ColdFusion 8 to the rescue, ListToArray now has a third arguments "includeEmptyField" that defaults to false, but if true will not ignore empty values. See the following code for an example:

ColdFusion:
  1. <cfset letters="a,,,b,c,d" />
  2. <cfdump var="#listToArray(letters,',',true)#" label="listToArray(letters,',',true)" />
  3. <cfdump var="#listToArray(letters,',',false)#" label="listToArray(letters,',',false)" />

The above code results in the following output. Nothing unexpected here, but a welcome addition nonetheless.

ColdFusion’s serializeJSON(): Query of Query vs Database Query

So I was working on an ajax request that reloads a select based on it's dependency to the selection made in an adjacent select, and noticed that all of a sudden, the javascript helper I was using was no longer working.  This came as a surprise as this had been stable for quite some time and the scenario I was using it for seemed identical to those I have used it for in the past.  After spending some time looking into it, I realized the problem.  My function that returned the results to reload the select in this scenario was using a Query of Query, where in the past I had always been returning a Query result straight from the database.  Upon taking a peak at the actual JSON object returned from serializeJSON() and realized that the keys for the data object returned from a normal Query would always return in all caps, and the JavaScript followed this assumption.  The Query of Query actually returned the keys in the exact case used for the select in the query itself.  Look at this example to see what I mean:

ColdFusion:
  1. <!--- ColdFusion query against the database with it's json string ---> 
  2. <cfquery name="getResources" datasource="#helpers.config.getDatasource()#">
  3.     select id, name
  4.     from sport
  5.     group by id, name
  6.     order by name
  7. </cfquery>
  8.  
  9. {
  10.     "ROWCOUNT":2,
  11.     "COLUMNS":["ID","NAME"],
  12.     "DATA": {
  13.         "ID":["1","2","3"],
  14.         "NAME":["Football","Baseball","Soccer"]
  15.     }
  16. }
  17.  
  18.  
  19.  
  20.  
  21.  
  22. <!--- ColdFusion query of query with it's json string ---> 
  23. <cfquery name="getResources" dbtype="query">
  24.     select id, name
  25.     from [local].getSports
  26.     group by id, name
  27.     order by name
  28. </cfquery>
  29.  
  30. {
  31.     "ROWCOUNT":2,
  32.     "COLUMNS":["ID","NAME"],
  33.     "DATA": {
  34.         "id":["1","2","3"],
  35.         "name":["Football","Baseball","Soccer"]
  36.     }
  37. }

Scriptaculous Sortable: onUpdate and onChange events

Today I was working with some nexted Sortable lists using the Sortable class from Scriptaculous.  My list looked something like this.

HTML:
  1. <ul id="list">
  2.     <li id="item_EA13CC21-D86C-4A8D-84A6-016262DBA72E">Room 1</li>
  3.     <li id="item_291BF49D-9FBA-446B-8C32-0E43C0879830">Room 2</li>
  4.     <li id="item_0F8BF7B5-9AF7-4DE0-885C-17BE57126444">Room 3</li>
  5.     <li id="item_0F72290C-FC72-4887-91FF-21E1D460B6FA">Room 4</li>
  6. </ul>

For some reason the onUpdate event did not seem to fire. I found a post here mentioning that not only do the list items have to each have unique ID's, which mine clearly do, but they must also following a naming scheme something like [name]_[id] which mine seems to follow as well. Upon further investigation, it turns out that it needs be formatted with an [name]_[integer]. I assume this is required in order for the class to offer the sequence method.

Clearing options AND optgroups in a select

Until today, I always cleared options from a select by doing something like this:

JavaScript:
  1. //Clear select of exiting options
  2. element.options.length = 0;

A quick Google search turned up this blog post where they had this helpful snippet:

JavaScript:
  1. //Clear select of exiting options and optgroups
  2. while (element.hasChildNodes()) {
  3.      element.removeChild(element.firstChild);
  4. }

This clears all items in the select and there is no noticeable performance loss when dealing with a select with a reasonable number of options.

Brett Favre’s supposed cracked rib

http://sports.espn.go.com/nfl/trainingcamp09/news/story?id=4434939

Something inside of me says this is yet another media stunt by the attention craving Brett Favra.  Saying he believes he has an injury, that is of course not listed on the injury report, gives him two benefits.  He either looks heroic if he has success despite it or he can fall back on it as an excuse if he tanks it again like last week.  Someone needs to deflate this guy's ego.  Hopefully that someone is Briggs or Urlacher!

Inheritance in ColdFusion: Private is more like Protected

We are beginning to utilize inheritance with ColdFusion in one of our new applications we are building currently at work.  We have some parent classes that really have few, if any, methods that should be initialized directly as they where designed to be extended by various other classes.  I realized I wanted some sort of access to use for these methods similar to Protected access in Java.  In the past, I tried to utilize the Package access that ColdFusion supports, but that ended in disaster as I did not do my homework and it did not truly understand what it means for two classes to be in the same Package.  I'm not sure if this changed or I just read it wrong, but it turns out that Private access in ColdFusion is not implemented the same as it is in many other languages.  My understanding of Private in most languages is that the access is limited to the immediate class and nothing else.  it turns out that in ColdFusion it is actually accessible within the immediate class, but also available to any of it's subclasses.  This was good news as it offers a solution that I was looking for.  However, it poses a new question.  Is there no truly private access in a ColdFusion component?  I have heard mention that the variables scope is private as well, but upon running some tests, confirmed it is private to the extent of the private access used for functions which means again, that is is available to a class's subclasses as well.

One one hand, I am delighted to find that I can protect methods in my parent class, but on the other, I am left wondering what would one do if they wanted a private method or attribute in a ColdFusion class.  If anyone has any insight on this, please let me know!