dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

My lab 16 months after double bilateral TTA…

In February 2008, our black lab (then just 4 years old) was in pretty bad shape. Both of her rear knees had gotten so bad she basically could no longer walk. We decided to proceed with a bilateral TTA (tibial tuberosity advancement) in both her hind legs. It was a tough decision for us, because it's not a cheap procedure and we weren't sure how we'd manage to keep her constrained for the 11-12 week recoup time.

I've blogged several times about how successful the operation was. She's really done excellent and there are no real hints of her knees ever bothering her. She'll occasionally get up slowly, but I can't say that's because of the surgery. What I do know is the dog still loves to run and jump. The knee surgery has not slowed her pursuit of climbing trees one bit, so I know she's doing well.

The other night my wife was playing around w/our new iPhone 3GS that we're trying out and I thought it was a good idea to post a video of her running and playing fetch in our yard. Well the video is not terribly exciting, I thought it might be useful for someone debating on whether or not it's worth the investment of the bilateral TTA procedure. I know in our case w/out the surgery we would have had to put her down—because she was just in too much pain and it was only going to get worse. So, seeing her run around today still thrills me to no end.

I try to play ball w/my labs for at least 30 minutes every day (weather pending.) I've run Nikki (our black lab) pretty hard this year and she's held up great. She'll run for as long as I'm willing to throw the ball and I've seen no side effects from the surgery at all. So here's she is doing her favorite activity in the world—playing fetch:


Stay w/Verizon Wireless or keep my iPhone 3GS?

Ok, so on Friday I decided to pick up an iPhone 3GS to try it out. My Verizon XV6700 really has issues and just is a horrible phone (I can't see the display when outside and also have always had problems hearing the person on the other land if there's any amount of background noise.)

I've been eligible for my "new every two" for almost a year, but Verizon still hasn't put out a phone I'm completely happy with. Every time I think they might have a winner (like the Storm) it fails.

So on Friday I was supposed to play golf, but due to some severe storms in the morning my party cancelled the outing (although I did end up playing a round later by myself.) Since I had the day off and nothing to really do, I thought I'd see if the local AT&T had any of the iPhone 3GS' in stock. Sure enough they had several still in stock, so w/my 30 day guarantee, I thought I'd sign up and see how it goes.

The biggest thing that's held me back from the iPhone is the lack of physical keyboard and AT&T's network (which I keep hearing bad things about.)

So, over the weekend I did a lot of playing around w/the iPhone. Well there's a lot of stuff I really like, I'm still a bit wary about AT&T's network and I really dislike the software keyboard—especially since the iPhone seems to require a lot of password typing (I'm sure the whole App Store password re-entry is for security purposes, but when you have a very secure password it's very cumbersome to keep re-typing the password in. Instead of constantly re-typing the password I'd rather be able to disable iPhone access to the App Store via the Preferences in iTunes.)

Anyway, is AT&T's network really that bad? So far the coverage has seemed ok, although when playing golf Saturday while my bars showed full, the conversation with my wife seemed to be breaking up a lot.

Should I go ahead and move the wife and me to iPhones and move off VZW?


structFilter() UDF - Filtering a structure based upon a regular expression

Today I thought I'd share a little ColdFusion helper function I've been using for years: structFilter(). The structFilter() parses a structure and returns only the keys that match a given regular expression.

<!---
 Searches a structure for keys matching a regex and returns a structure containing the
 matched keys.

 @param input        The structure to filter. (struct; required)
 @param regex        The regular expression to filter keys against. (string; required)
 @param useNoCase    Do a case insensitive search? (boolean; default = true)
 @param useDeepCopy  Do a deep copy on the keys? (boolean; default = false)

 @return Returns a structure containing the matching keys.
 @author Dan G. Switzer, II (dan.switzer@givainc.com)
 @version 1, June 17, 2009
--->
<cffunction name="structFilter" returntype="struct" output="false" access="public"
    hint="Filters keys in a structure to those matching the regular expression.">
  <!---// define valid arguments //--->
  <cfargument name="input" type="struct" required="true" />
  <cfargument name="regex" type="string" required="true" />
  <cfargument name="useNoCase" type="boolean" required="false" default="true" />
  <cfargument name="useDeepCopy" type="boolean" required="false" default="false" />

  <!---// define local variables //--->
  <cfset var result = structNew() />

  <!---// if using NoCase and the (?i) directive doesn't exist, append to regex //--->
  <cfif arguments.useNoCase and not reFind("^\(\?[mx]*i[mx]*\)", arguments.regex)>
    <cfset arguments.regex = "(?i)" & arguments.regex />
  </cfif>

  <cfloop item="key" collection="#arguments.input#">
    <cfif reFind(arguments.regex, key)>
      <cfif arguments.useDeepCopy>
        <cfset result[key] = duplicate(arguments.input[key]) />
      <cfelse>
        <cfset result[key] = arguments.input[key] />
      </cfif>
    </cfif>
  </cfloop>

  <!---// return the new structure //--->
  <cfreturn result />
</cffunction>

I've found this helper UDF to be extremely handy in when you have a bunch of serialized form fields that follow a given nomenclature. For example, if you have a bunch of form fields like:

<input type="text" name="name" value="" />
<input type="text" name="description" value="" />

<!---// dynamic list of variables //--->
<cfloop index="i" from="1" to="10">
  <cfoutput>
    <input type="text" name="id_#i#" value="" />
  </cfoutput>
</cfloop>

Using the structFilter() UDF you can vary easily process all the fields starting with "id_" by doing:

<!---//
  get all the fields:
  * starting with "id_"
  * and ending with one or more numbers
//--->
<cfset stIds = structFilter(form, "^id_\d+$") />

This will give you a structure containing all the "id_" fields that you can then process in a collection-based loop. This method is much more effective then passing in some kind of hidden "counter" variable where you loop from 1 to the counter variable (which is a technique I've used in the past) as it doesn't rely on the numbers being serialized.

There are obviously many other uses for this function, but I use it a lot for processing complex forms that have dynamically generated fields that have a fixed nomenclature.


Safari 4 z-index issue with Flash

I was doing some testing with Safari 4 (on Windows Vista) and noticed that it was running into the z-index issue that's normally fixed by having a wmode attribute. The issue is that Flash was always displaying on top of all other elements. Normally this can be fixed by applying the wmode attribute of either "opaque" or "transparent" to your SWF, however that was already present.

After playing around with the problem for a good bit trying various solutions of applying an z-index to elements, I decided to check to see if I had the latest version of Flash installed. Turns out I was running Flash 10,0,22,54 and 10,0,22,87 is the latest version. Sure enough, after upgrading Flash everything started working as expected.

So, if you're having problems with Flash being overlaid over all of your elements in Safari, try upgrading to the latest version of Flash to see if it fixes the problem.

(To see how things should work, check out http://pipwerks.com/lab/swfobject/z-index/2.0/dynamic.html. If mousing over the menu options is not showing some pop-up elements, then something has gone awry—so try upgrading Flash.)


CFHTTP "Connection Failures" issues when using mod_rewrite

Several years ago I ran into some issues with CFHTTP giving "Connection Failures" when using GZIP, but recently I ran into some new "Connection Failures" when using CFHTTP. I recently installed some mod_rewrite rules on our server to:

  • Redirect naked domains to the www subdomain (i.e. map domain.com to www.domain.com)
  • Force SSL

My rules were pretty simple and worked great when invoked from the browser, but I quickly realized they were causing issues with CFHTTP.

more…