HJCotton.net

July 26, 2009

Thanks, Snapple

by @ 8:16 am. Filed under Humorous.

Snapple Fact #680: “More Siberian tigers live in zoos than in the wild.”

That’s pretty much the most depressing thing I’ve ever read on the underside of a bottle cap.

July 25, 2009

Amazon MP3 Downloader

by @ 10:33 pm. Filed under Linux, Music, Technology.

Did you know that the Amazon MP3 Downloader runs on Linux? I didn’t. Generally, when I see a note stating that additional software is required on a website, I head for the hills figuring there’s no chance it will run in Ubuntu. Today, for some reason, I clicked to find out more about the “Requires Amazon MP3 Downloader” button next to the album I was looking at. Much to my surprise, they offer Linux support. Not the “here’s the source, good luck compiling it” kind of support, but rather the “here’s a .deb package, ready to install” kind of support. I was mighty impressed… for about a minute – the 32bit package is not a straight-forward install for 64bit users. Fortunately, it’s pretty easy to make the 32bit package work.

AmazonMP3 Linux

Of course, the fact that extra software is required to download purchased audio tracks doesn’t exactly thrill me, but it sure beats trying to run iTunes in Wine. The fact of the matter is that this is bare-bones, working software that actually runs on Linux:

Whether or not it turns out that tracks you have downloaded can be spontaneously deleted remains to be seen, of course ;)

July 13, 2009

cfcatch was born a struct, then it wasn’t but now it’s back

by @ 9:19 pm. Filed under Coldfusion.

Recently, I came across an interesting “catch” when passing around a cfcatch structure. I created a function that would take a cfcatch struct and send out an email with the results formatted as I wanted them to be:

<cfcomponent output="false">
  <cffunction name="sendCFCatchEmail" access="public" output="false" returntype="void">
    <cfargument name="cfcatchStruct" type="struct" required="yes">
    <cfargument name="emailAddress" type="email" required="yes">
 
    <cfmail from="email@email.com" subject="Error" to="#arguments.emailAddress#" type="html">
      <table>
        <tr>
          <cfoutput>
            <td>#cfcatch.type#</td>
            <td>#cfcatch.message#</td>
            <td>#cfcatch.detail#</td>
          </cfoutput>
        </tr>
      </table>
    </cfmail>
 
  </cffunction>
</cfcomponent>

What threw me was that I kept getting the following error when passing a cfcatch struct to the function:

“The CFCATCHSTRUCT argument passed to the sendCFCatchEmail function is not of type struct.”

Huh?

The difficulty I was having was that when you dump a cfcatch, it identifies itself as a struct.

cfcatch

It took me a little while (and maybe some googling) to figure out what was going on. Doing an “isStruct(cfcatch)” shows that for some reason, cfcatch is not a structure. What is it then? Well, an “isObject(cfcatch)” shows that it’s an object… of some kind. The particularly odd part is that “Duplicate(cfcatch)” will return a structure, not an object. Weird, huh?

<cftry>
  <cfset answer = 3 / "t">
 
  <cfcatch>
    <cfoutput>
      <h2>Standard cfcatch</h2>
      Is Struct: #isStruct(cfcatch)#<br />
      Is Object: #isObject(cfcatch)#<br />
 
      <h2>Duplicated cfcatch</h2>
      Is Struct: #isStruct(Duplicate(cfcatch))#<br />
      Is Object: #isObject(Duplicate(cfcatch))#<br />
 
    </cfoutput>
  </cfcatch>
</cftry>

cfcatch Output

In short, I just ended up changing the expected type for the cfcatchStruct argument to be “any”. I could duplicate cfcatches before sending to the function, but that’s not optimal in the least, so I just let cfcatch pretend that it’s an object if that’s what it wants to be.

HJCotton.net

pages:

categories:

search:

archives:

July 2009
S M T W T F S
« Jan   Sep »
 1234
567891011
12131415161718
19202122232425
262728293031  

So it goes.
— Kurt Vonnegut

general links:

Dscn1067.jpg

Dscn1067.jpg

01-23-2010

01-23-2010

other:

Page 1 of 1First

19 queries. 1.052 seconds