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

Amazing ending to a Div III Football game..

This is a pretty amazing ending to a NCAA Division III. Trinity University uses 15 laterals to defaut Millsaps for first place in their conference.

Running IIS and Apache on the same Windows 2003 server

Today I was working on server and need to run Apache v2.2 and IIS6 on the same Windows 2003 server. Whenever I would try to start the Apache service with any Virtual Host and listener configured to port 80, it would give me an error like the following in the Windows Event Viewer:

The Apache service named reported the following error:
>>> (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : make_sock: could not bind to address .

It was then followed up with another error message:


jQuery: Understanding the "chain"

Yesterday I was writing some jQuery code and I thought I came across a bug—until I realized it was a bug in my way of thinking and not with jQuery.

What I was trying to do is to dynamically append to the body tag some html that looked like this:



Using CFMAIL to send attachments stored in memory

Awhile back I was looking for a way to send e-mail attachments in CFMX without writing data to disk. That solution uses the Javamail API to directly send a e-mail with attachments to an SMTP server. This method also completely bypasses the CF mail spool.

Charlie Arehart linked to the article from an article he wrote about storing CFDOCUMENT and CFREPORT contents in a variable. In the comments on his post, Jon Wolski posted a solution that uses the built-in ColdFusion tags CFMAIL and CFMAILPART. So, I thought I'd re-do my original example using Jon's technique in this post—just so you can see an example of both methods.

Below is some source code that will show you how to use the CFMAIL tag to send a multipart message that contains:


Joke: The Drunk

An extremely modest man was in the hospital for a series of tests, the last of which had left his bodily systems extremely upset.

Upon making several false alarm trips to the bathroom, he decided the latest episode was another and stayed put. He suddenly filled his bed with diarrhea and was embarrassed beyond his ability to remain rational.

In a complete loss of composure he jumped out of bed, gathered up the bed sheets, and threw them out the hospital window.


Generate PDFs from within Flex

I came across a post today on Ryan Stewart's blog about a Flex project called AlivePDF created by Thibault Imbert.

In a nutshell, AlivePDF is a Flex library for creating PDFs completely within Flex. Thibault has blogged an example of how easy to save PDFs using the library.

Pretty cool stuff...

Google's JSON library...

As part of Google's Caja project, they have released a JSON library (for JavaScript) that looks like it's very solid. For more information on the Caja project, check out this Ajaxian article.

IE6/Flash Field Focus Problem

A user reported to me a strange behavior with IE6 and Flash that I've never noticed. If you're using IE6 and there's a SWF on the page when you go to another Application Window and came back to IE6, if the cursor was placed in any text box, the focus will be lost.

The quickest way to verify this bug is to go to the Adobe website and place your cursor in the "Search" box at the top of the page. Now ALT+TAB to another Window. Now ALT+TAB back to IE6. You'll notice the cursor is no longer in the search box.

Now, if you do the same test on the Google website you'll notice this behavior doesn't exist.


Expiring Session via AJAX using HTTP Response Headers

Raymond Camden recently asked on his blog How can you timeout a session in an Ajax-based application?. Most of the comments on the entry relate to doing some kind of server-ping, but my suggestion would be to just let your application tell your Ajax code when the session actually expires.

The concept is to use HTTP response headers to inform your Ajax request when the session has actually expired. This allows you to do everything in one single call, without having to worry writing other code. Besides you should be adding some failure code to your Ajax calls anyway, so this fits right in with good Ajax practices.

There are two basic approaches you can take. Using a "custom" response header or sending back HTTP status code to indicate the user is no longer authorized to view content.