David J.

The website of David Johnson

Songs Available for Download

I grabbed the audio from the videos that are on youtube as mp3 files.

These files are not great quality. If I ever record good sounds, I'll let you know, and probably put them on soundcloud.

Call Me
Cheshire Cat
Cody
Dizzy
Gold Rush
Wild and Free

posted on 2012-02-16 10:37:51

permalink: http://www.davidj.org/blog.html/2012/2/16/19/Songs_Available_for_Download

Using ColdFusion to Create a Zip File of the Files in a Folder

Please remember this is not scalable and should be improved with possibly a cflock. This was a one-off request that had to be done quickly.

My user needed to be able to download a zip file of photos in a folder.

I create a directory, copy the files in to that folder, and then zip the folder for downloading.

Upon running the page, past folders are deleted. This is the part that does not scale. Either a lock or an age check should be done.

I have included comments in the code.

<!---~ A simple form post of listed ID's posts to this page --->
<cfparam name="form.zipids" default="0">

<!---~ Run the query to get the filenames --->
<cfquery name="request.qryGetInfo" datasource="THEDATASOURCE">
	 	SELECT	
			fname,
			lname, 
			leadid,
			filename
		FROM
			containingTable
		WHERE 
			leadid in (<cfqueryparam cfsqltype="cf_sql_integer" value="#form.zipids#">)
</cfquery>

<!---~ Get any current directories in our temp path zips folder --->
<cfdirectory action="list" directory="#GetTempDirectory()#zips" name="directorylist">

<!---~ Loop through and delete any existing directories (not scalable) --->
<cfloop query="directorylist">
	<cfdirectory action="delete" directory="#GetTempDirectory()#zips/#NAME#" recurse="true">
</cfloop>

<!--- Get some random directory names --->
<cfset request.randomzip  = randrange(1000,9999)>
<cfset request.randompath = "#GetTempDirectory()#zips/#randrange(1000,9999)#">

<!--- Create the directory that will contain the files to be zipped --->
<cfdirectory action="create" directory="#request.randompath#" mode="777">

<!--- Copy the files to the created directory --->
<cfloop query="request.qryGetInfo">
<cftry>
	<cffile action="copy" destination="#request.randompath#/#fname#.#lname#.#leadid#.jpg"
source="#AnApplicationVar#/#filename#.jpg" />
	<cfcatch type="any">
		<!---~ Missing File --->
	</cfcatch>
</cftry>
</cfloop>

<!---~ Create the zip file --->
<cftry>
	<cfzip action="zip" source="#request.randompath#"
file="#request.randompath#/#request.randomzip#.zip" overwrite="yes" recurse="no" storepath="no" />
	<cfcatch type="any">
		<!---~ Zip Problem --->
	</cfcatch>
</cftry>

<!---~ Send as content --->
<cfheader name="content-disposition" value="attachment; filename=images.zip" />
<cfcontent type="application/zip" file="#request.randompath#/#request.randomzip#.zip" deletefile="true" />

Hope that helps!

posted on 2012-02-15 15:54:37

permalink: http://www.davidj.org/blog.html/2012/2/15/18/Using_ColdFusion_to_Create_a_Zip_File_of_the_Files_in_a_Folder

jQuery Cookie - Delete Across Frames

I was working with some legacy code that existed in a frameset. One of the frames was responsible for setting a cookie for the value LEADID.

The user could logoff and if they did, I had to clear the LEADID value.

It seemed crazy that I could not set the value of a cookie when the user clicked logoff. The logoff page was not in the frameset anymore and I keep using google to find information about framesets and cookies.

It wasn't the frameset.

The path of the page that sets the cookie is included in the cookie when the cookie is set.

Because the logoff page was at the root and the page that set the cookie was in /company/centerofthecall I had to specify the path of the cookie to reset the value.

The final jQuery line was like this: $.cookie("leadid",null,{path:'/company/centerofthecall'});

Lesson learned? Watch for the path of the page where the cookie is set.

posted on 2012-02-14 12:45:00

permalink: http://www.davidj.org/blog.html/2012/2/14/17/jQuery_Cookie_-_Delete_Across_Frames

Wild and Free - David Johnson - What I Sang To You

This is a song I wrote called Wild and Free. My fantastic wife Kiersten put the video together. Thank you, Nathan, for putting up with a couple of crazy parents.

Wild, wild, wild and damn near free

On the road to what could be

Choose your fate, your destiny

You can be what you want to be

But I'm going wild and damn near free

I'm tired of thinking about what was

I need a better reason than because

I know a phoenix can only rise

From the ashes to the skies

Wild, wild, wild and damn near free

On the road to what could be

Choose your fate, your destiny

You can be what you want to be

But I'm going wild and damn near free

You are holding yourself down

You like to stand on familiar ground

You could set your own self free

You could come with me!

And go wild, wild, wild and damn near free

On the road to what could be

Choose your fate, your destiny

You can be what you want to be

But I'm going wild and damn near free

I'm going wild and damn near free

posted on 2012-02-09 10:20:21

permalink: http://www.davidj.org/blog.html/2012/2/9/16/Wild_and_Free_-_David_Johnson_-_What_I_Sang_To_You

Cheshire Cat - David Johnson - What I Sang To You

This is a song I wrote called Cheshire Cat. My apologies to schmonz and belle for lines with really bad grammar.

Lyrics

When the moon is grinning like a Cheshire cat

I always think of you.

I wonder where you might be at

And I wonder what you're doing.

Do you remember me kindly?

Do you think it was over too soon?

And do you still see a Cheshire cat

in the smile of the moon?

 

We were best of friends you and me.

We swore we always would be.

But circumstances change, lives get rearranged,

Moments become memories.

The distance between us grows on.

Wonder if we're too far gone.

Neither of us try

Too reach beyond our pride

And get back where we belong.

 

When the moon is grinning like a Cheshire cat

I always think of you.

I wonder where you might be at

And I wonder what you're doing.

Do you remember me kindly?

Do you think it was over too soon?

And do you still see a Cheshire cat

in the smile of the moon?

Do you still see a Cheshire cat in the smile of the moon?

posted on 2012-02-07 10:00:49

permalink: http://www.davidj.org/blog.html/2012/2/7/15/Cheshire_Cat_-_David_Johnson_-_What_I_Sang_To_You

Latest News

The Internet Bumper Stickers are back! Refresh the page for more. Click the link to see the latest funny stickers under automotive at Amazon.

Latest Additions

Quotes and Things Said: Hey, old friends! Do you remember the quotes page? Well, it's back! Watch for new ones and enjoy the past ones!

The Top Ten Podcasts of 2011: Get your mp3 players ready for download. Here is my countdown of what I consider to be the best podcasts of the year.

Ann Arbor Burrito: I found a great place to get a burrito in Ann Arbor. It's great food at a great price.

Homemade Sushi: Here is a step-by-step pictorial guide to making sushi at home starring my favorite daughter!

Neti Pot: After years of migraines, sinus infections and absent work, I am happy to be a Neti Pot user.

Goji: Ever since my Chinese friend Xuhui told me about Fructus Lycii, Goji, Wolberries or whatever you want to call them, I have been hooked!

Eclipse IDE: I love being an Eclipse user. It is truly a joy to keep my fingers on the keyboard and get things done with the Eclipse editor.

Chord Wheel: The Chord Wheel book by Jim Fleser as published by Hal Leonard is the ultimate tool for all musicians.

Song Quotes: Months later, after downtime and site changes, here, once again, are my song quotes. More to come!

The Credit Card Story: I will get this site organized, but until then, I am dropping this here.