dans.blog


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

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:

<div>
    outer
    <div>
        inner
    </div>
</div>

more…


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:

more…


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.

more…


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.

more…


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.

more…


Oh no! Outlook crashing on ntdll.dll! Whew, problem fixed!

So I woke up this morning and Outlook had crashed on me. Every time I'd try to restart Outlook, I'd get the same crash error—even rebooting didn't help. The error was in the ntdll.dll.

I figured maybe there as something in my POP3 account that Outlook was having problems reading, so I snagged a tool to allow me to read the headers and delete messages. In my POP3 account were some messages with some Shift-J encoding—so I thought for sure that was the cause of the crash. However, even after deleting those messages I was still getting crashes.

After over an hour of troubleshooting, I was getting pretty frustrated. I figured at this point it was either some Windows Update that installed itself or a add-on causing the issue.

more…


ColdFusion 8 Released!!!

I really was convinced they'd wait until 8/8 to release it, but Adobe released ColdFusion 8 today. There are lots of new features in ColdFusion 8—a few of which everyone has been waiting years for (image manipulation, programmatic threading, per Application settings—such as mappings!) Adobe's also worked hard to make creating AJAX applications faster and easier by providing lots of built-in tags that make use of the Yahoo! User Interface (YUI) library (as well as many other DHTML/AJAX libraries.)

If you haven't played with the betas, you should definitely download ColdFusion 8 Trial or Developer Edition and fire up your favorite virtual machine and give it a test drive. Lots and lots of new functionality to explore—and oh yeah, it's much, much faster.

Download ColdFusion 8


ySlow? Well find out with Yahoo!'s new Firebug plug-in...

Yahoo! has just released a new Firebug plug-in called ySlow. I just finished installing it and playing around with it for a few minutes and it definitely looks like it could be one of those must have web developer tools. It provides the following:

  • Performance report card
  • HTTP/HTML summary
  • List of components in the page
  • Tools including JSLint

The Performance Report card is pretty slick. It provides lots of tips on improving performance—such as ways to minimize HTTP requests, removing duplicate tags, adding expiration headers, etc.

more…


It's Steelers time!

I'm starting to get real pumped up about the upcoming football season. The Steelers new Head Coach, Mike Tomlin, gets me more excited every time I hear him speak. He just says all the right things. The real measure of a Head Coach is how they handle things on Sundays, but I think Tomlin will prove to be the next great Steelers Head Coach. I can absolutely see why the Rooneys were impressed by his interview.

For a 35 year old HC, he sure seems awful old school. From listening to his football philosophies, you'd think he was a 60 year old HC coaching in the 60s. He certainly fits the mold of a Steelers HC.

Training Camp starts this Monday, so more and more news should start rolling in every day. To get you started, here's a summary from Tomlin's news conference.

more…


IE6 & IE7 quirks with cloneNode() and form elements

I've been working on some code for a contracting client which involves a really cool drag-n-drop interface for building forms on-the-fly. While working on the project, I ran into an issue in IE6 when dragging a <div /> element that form fields and there values had been changed by the user, the values were not properly reflected when I'd copy the node using the cloneNode() DOM method.

It turns out IE 6/7 doesn't properly clone some form elements when you use the cloneNode(true) and the form element is a checkbox, radio or select element. My suspicion is this is because MSIE stores the element in a non-XHTML way (if you do an innerHTML on the source element you'll see that checkbox elements have a "CHECKED" attribute with no value.)

I was able to work around the issue by doing the following:

more…


Mobile Live Search v2 Released

The Live Search Team just released released Mobile Search v2. Windows Mobile Live Search is one of the few programs I frequently use on my Windows Mobile 5 phone. I'd recommend this as one of the first applications you install when you get a new Windows Mobile phone.

Here's a list of some of the new and improved features as defined by the Live Search Team:

  • Movie Showtimes: Want to see a movie but don’t know what’s playing? Get Movie Showtimes near you and be on your way!
  • More Local Data with Reviews: Want to go out for dinner but not sure which restaurant to pick? Let your fellow restaurant goers help you out — make a decision based on user ratings.
  • Maps: View Mobile Virtual Earth maps wherever you are. For improved performance, pop in your storage card to enable the large cache option. Street maps, Aerial and Hybrid are supported.
  • Directions: Lost? Get found with better support for GPS integration and improved turn-by-turn navigation. We’ll even prompt you to auto-reroute if you get lost!

more…


MSSQL: Recompiling views and stored procedures

Occassionally you come across something in a language you never knew existed, but always needed. Today I discovered a stored procedures included in MS SQL that I didn't know existed, but in the past have just used work around for.

Today I discovered the sp_refreshview stored procedure which updates "metadata for the specified non-schemabound view." In plane english that means if you've made changes to your tables that invalidates the view, it should refresh the view (this is problem if your view uses a select * from table—which should be avoid at all costs.) In the past I've always just done an ALTER VIEW to refresh the view—not very elegant, but it worked when I needed the view to pick up changes in the schema. This stored procedure provides to do the same thing.

For a simple explanation of the sp_refreshview see Vadivel's post on "Sp_refreshView explained..."

more…


Apple releases Safari for Windows v3 Beta 3 Today...

Apple has released a beta version of Safari 3 today. The biggest news is that it includes a Windows version of Safari. Hopefully they're aren't substancial differences between the Mac & Windows versions. I'll be glad to finally be able to test sites in Safari, without having to get to a Mac.

Go get Safari v3 for Windows (Beta) now.