ripper.rhetoric

Monday, December 11, 2006

Good Eats for the iPod

Good Eats taught me how to cook. I always thought it would be very convenient to have Alton's recipes loaded on my iPod, so when I found myself aimlessly walking around the supermarket, I would have a bunch of ideas and the list of ingredients available to me. About two years ago I used some web scraping program and a script to load my iPod with all of his recipes. When it came time for an update, I combined my need for new recipes and my desire to play around with C# to create an application that does it automatically. Being xmas is around the corner and I'm feeling generous, here is the application and it's source.

Executable: goodEatsIpod.zip (7kb)
Source: goodEatsIpod_src.zip (74kb)

Caveats: Requires .NET 2.0 Framework. If it doesn't work for you, you have the source to figure out why, don't expect me to fix it unless it's broken for everyone.

Enjoy!

Friday, April 07, 2006

CFDUMP and CSS

Recently I ran into a problem with using CFDUMP on a HTML 4.1 quirks mode page. When I turn off quirks mode, CFDUMP renders correctly, but when it's on, the text inside of the collapsible div's is way too small. Unfortunately you cannot edit the CSS that CFDUMP generates, but you can change it with JavaScript...

<script language="Javascript" type="text/javascript">
//set object for brevity
replaceObj = document.getElementsByTagName("td");

//loop over element objects returned
for (i = 0; i < replaceObj.length; i++ ) {
    replaceObj[i].style.fontSize = "x-small";
    }

</script>

Thursday, March 30, 2006

rSession 2.0

Session management for clusters that support failover with Macromedia Cold Fusion. Older code that is still applicable for sites that want more interaction and control over their session management. 2.0 is a CFC version of rSession and only requires one line of code each in Application.cfm and OnRequestEnd.cfm. Get it here.

activateActiveX

Recently, Microsoft lost a patent battle with Eolas that will affect the ActiveX functionality of Internet Explorer. Now, while I know a lot of people aren't too fond of ActiveX controls, they do have their uses and a lot of websites will be affected by this change. In about 60 days your users will start having to click any HTML elements using object, applet, or embed.

Microsoft has posted solutions and work-arounds to the problem, but as an experiment in JavaScript and the DOM, I wanted to create a script that would dynamically solve the problem on any page it's attached to.

After reading the MSDN article, I started experimenting with removing the elements from the DOM, and trying to reinsert them. In lieu of having to hand code every possible object property, I went in the direction of enumerating the objects to read the properties. That didn't work so well, as the objects have child objects that go on into infinity. My next attempt was just reusing the same object, and that failed as well...it seems Internet Explorer 7 stores info in the object itself that says it hasn't been activated yet. But, after some playing around I found the solution: remove the object via the DOM and reset the innerHTML value of the parent element.

Now, while it seems that this is just a quick fix for the lazy, it does have some real applications that couldn't be done otherwise, like fixing ColdFusion generated Flash Forms.

There are two flavors available for download:

Header version that traps the window.onload event and can be put in <head> section of your HTML document for clean, well formed code.

Footer version that won't interfere with existing window.onload events, but must be placed at the end of the HTML document.

Installation instructions are in the file. Enjoy!

Update 4/17/06:
After the final Microsoft updates, this page has been getting a lot more traffic, and some people have been emailing me about issues. It seems that this trick doesn't want to work for Shockwave elements, and people are having problems using <param> values for Flash. I will look into tweaking the script to handle this.

Update 4/4/06:
Some people have had a problem with using this script on their local machine. Internet Explorer will prompt you to let this script run if you load it locally for security reasons. However, the Internet security zone will not ask this question and will run the code without any security notifications. An example of the code in action can be found here.

Also, a comment was left that said IE7 can't tell that the objects have been loaded. This does not happen in IE6, and if anyone has an idea on how to fix this, please let me know.