Viewing by month: August 2007
Posted on Aug 31, 2007
After those two paths were blocked, I found an excellent beginners tutorial on client-side XSLT simply by loading the XML with the defined XSL template in the browser. The example they gave worked nicely in IE7, Firefox and even Safari on Windows. Seeing as Safari and AIR both use WebKit, I thought this might work in AIR. To my dismay, it did not. Here's what I did...
Posted on Aug 29, 2007
As I have mentioned on this semi-regular column before, I love Latin music, just not the stuff you might catch on American Top 40 radio stations. Most of what I like falls under the "Alt-Latin" category but I am also a big fan of the "Electronic" music category and sometimes these two worlds meet nicely. The following are my three favorite electro-pop bands and the respective albums. If you have some favorites of your own in this genre, please feel free to share them in the comments as I would love to hear more. :)
Posted on Aug 28, 2007
Here's a simple but useful UDF for handling arrays in ColdFusion. I was working on something today where I would create an array that happened to have a number of undefined elements contained within. What I wanted was to have all the undefined elements removed. ColdFusion 8 did add the ArrayIsDefined() function, but I needed this to work on 7 as well, so I copied a bit from Ray Camden's ArrayDefined UDF. CFLib actually had an ArrayCompact UDF that has a similar goal, except that it will only work for arrays with simple values, while this will work for arrays with any type of value.
Now, before anyone criticizes the use of duplicate(), I will make it known that the original version of this function simply tried to modify the reference to the original array and returned nothing. Theoretically, this should have worked since arrays are passed by reference, but it didn't and I am not quite sure why. When I dumped the argument in the function itself after it ran, you would see the array was properly modified, but when I viewed the original it still showed the empty values. If anyone can explain this, I would love to hear it (p.s. for this, I was testing on 7).
<cffunction name="arrayRemoveEmpty" access="public" description="removes empty array elements" output="false" returntype="array"> <cfargument name="theArray" required="true" type="array" /> <cfset var i = 0 /> <cfset var newArray = duplicate(arguments.theArray) /> <cfloop from="#arrayLen(newArray)#" to="1" index="i" step="-1"> <cftry> <cfset newArray[i] /> <cfcatch type="coldfusion.runtime.UndefinedElementException"> <cfset arrayDeleteAt(newArray,i) /> </cfcatch> <cfcatch type="coldfusion.runtime.CfJspPage$ArrayBoundException"> <cfset arrayDeleteAt(newArray,i) /> </cfcatch> </cftry> </cfloop> <cfreturn newArray /> </cffunction>
Posted on Aug 28, 2007
Mark Mandel, the creator of Transfer ORM for ColdFusion, has posted on about an upcoming update to his JavaLoader component for dynamically loading Java classes into ColdFusion without requiring that they be added to the ColdFusion classpath. In this instance he uses ColdFusion 8's new functionality (including onMissingMethod() support) to create an automatic ColdFusion Component (CFC) proxy for the Java class rather than returning an instance of the class itself. Very interesting and potentially useful stuff for deeper CF/Java integration.
Usually I save this stuff for my open source updates, but this one I found particularly fascinating personally - particularly since I had a similar idea when I read about the onMissingMethod() support in ColdFusion 8. Nonetheless, looking at Mark's code, it is clear that my working on this would have been like Miss Teen South Carolina at a Mensa conference. Nice work Mark!
Posted on Aug 27, 2007
Four new projects and one update this week. I wanted to take this opportunity to send a thank you to Justin Treher for sending me Super Princess Peach for the Nintendo DS from my wish list. Technically speaking, this game was for my son who is a big time Mario fan though I am totally digging it myself. No, this game isn't too "girlie" - Peach rocks, 'nuff said, though I still prefer Daisy 'cause she's got attitude! ;)