Previous and Next in Coldfusion

I have done this before when the data was clean and when I only needed to worry about one ID by just adding or subtracting one from the ID value. On my photo album pages I wanted to create a way to view my photos without lytebox. I have 2 IDs photo album and photo. Also my data is not the cleanest for example in my Denver photos I do not have a photo 1. I came up with a solution, not the most elegant I will admit. My work around for this problem includes looping the query to set the row number to a variable than instead of displaying against the photo ID I display against the row number. To create the next and previous I just add or subtract 1 from the row number. I also had to put a cfif to check to make sure my previous row variable was not -1. The code is below. You can see it in action here.

<cfloop query=“QPhotos”>
<cfif QPhotos.Photo_ID eq URL.PHOTO>
<cfset displayrow = QPhotos.currentrow>
</cfif> </cfloop>
<cfset nextrow = displayrow+1>
<cfset previousrow = displayrow-1>

<cfif previousrow GT 0><cfoutput query=“QPhotos” startrow=“#previousrow#” maxrows=“1”>

<cfoutput query=“QPhotos” startrow=“#displayrow#” maxrows=“1”>

<cfoutput query=“QPhotos” startrow=“#nextrow#” maxrows=“1”>

Using CFIMAGE to create a watermark

Continuing my week off playing around with cfimage, I am thinking this is fast becoming my favorite new feature in Coldfusion 8. This morning I was thinking it would be cool if Coldfusion could watermark images for me. After about 30mins playing around I came up with this.

<cfimage source=“img_2566.jpg” name=“image”>
<cfimage source=“watermark.png” name=“watermark”>
<cfset ImagePaste(image, watermark, 0, 0)>
<cfimage source=“#image#” action=“writeToBrowser” format=“jpg”>

First 2 lines I basically give both images a name. The reason the watermark is a png is I want to have the ability to use alpha channels. Next line I paste the watermark onto the image at 0x and 0y. I cheated and created the images the same size, but you could easily read the image info get the size then calculate where you want the watermark to be. The last line writes the image to the browser in the format of a jpeg. You can check it out in action at my CFwatermark page.

Using cfimage to create thumbnails

I have been playing around with the new cfimage tag in coldfusion 8. I am very impressed with the resize capability. Coldfusion 8 seemed to do a great job resizing my images into thumbnails. I created a tutorial here.

Here is a little bit of code to create thumbnails.

<cfimage action=“info” structname=“imagetemp” source=“Path to your image”>
<cfset x=min(150/imagetemp.width, 113/imagetemp.height)>
<cfset newwidth = x*imagetemp.width>
<cfset newheight = x*imagetemp.height>
<cfimage action=“resize” source=“#Path to your image#” width=“#newwidth#” height=“#newheight#” destination=“#thumbnail destination#”>

Update: My Using CFIMAGE to Generate Thumbnails tutorial was published at

NTSC Action on Adobe Studio Exchange

My Photoshop NTSC action is now on Adobe Exchange. If you have not check out the Adobe Exchange it is a great place to download tons of mostly free stuff for all of the Adobe products.

Blog roll for BlogCFC

I have been playing around with Ray Camden’s BlogCFC for the past few weeks. I am planning on moving over from BlogCFM. One think that I really wanted with my new blog was the ability to easily update links in my blog roll. BlogCFC did not have this out the box, but I came up with a very easy whay of doing this. Using BlogCFC’s Textblocks feature I created a textblok called “blog roll”. Next I created a pod called blogroll.cfm and called my blog roll text block using

FROM dbo.tblblogtextblocks
WHERE LABEL = ‘Blog Roll’


Now all I have to do is update the links in my blog roll textblock, refresh blog cache and my blog roll is updated.

Remote into your Macintosh from Windows

I discovered this great video how to on the net. It demonstrates how to setup remote desktop on the Macintosh for free, no need for apple remote desktop. It also allows you to control your Macintosh via a Windows machine. I have configured my Macintosh this way and it works great. I setup everything on a thumb drive so I can take it with me anywhere.

  1. On your windows, machine download puttygen.exe from
  2. Generate a private key file and save it on your thumb drive also save your public key file and copy it to the Macintosh you want to control.
  3. On your Macintosh, copy the “publickey.txt file you created in step 2 to your user directory.
  4. Make sure that port 22 is open to this Macintosh if you have any firewall in place
  5. Open terminal (applications/utilities) and type “mkdir .ssh” to create the .ssh folder
  6. Type “chmod 700 .ssh”
  7. Type “mv publickey.txt .ssh/authorized_keys”
  8. Type “chmod 600 .ssh/authorized_keys”
  9. Type “sudo nano /etc/sshd_config”
  10. After you type in your password hit control W and type “AllowTcpForwarding”
  11. Delete the # sign
  12. Control W again and type “PasswordAuthentication”
  13. Remove the # and change the yes to no
  14. Control W and type “UsePam” and remove the # sign from this line
  15. Control X and save the file
  16. If you want the finger print type “ssh-keygen –l –f  /etc/” and write the hash value down or save it to a text file on your thumb drive
  17. Open up system prefs and click on shareing make sure you have a check next to the remote login service
  18. Next download OSXVNC from and start it up
  19. Back on the Windows machine download putty.exe from and UltraVNC from I put both of these application on my thumb drive
  20. Start Putty and under session IP type the IP address of your Macintosh, goto the Data item in the list on the left and Auto-login username type your Macintosh short name, go under the SSH item and on auth private key browse to your private key file you created in step 1, finally goto tunnels 5900 for source port and localhost:5900 for destination and click add.
  21. Now click Open if this is your first time on the machine connecting to the mac you should get a popup with the hash value from step 16 if this does not match some one is possible doing a “man in the middle” attack to hack your Macintosh
  22. If the hash matches click Ok and then type the password you setup for your private key file.
  23. Startup UltraVNC and connect to localhost
Final Cut Pro Easter Egg

Bruce the Yak in Final Cut Pro 5.1. To get to this easter egg, Open up your video scopes (tools menu – video Scopes) Control click on the vectorscope area then choose magnify do it again then control click and double click on magnify. If you do it just right a little patch of grass will come out and then along will come Bruce the Yak. If you are patientBruce will bubble up some words of wisdom.

CFChart not working with Coldfusion 7.0.2

I installed Coldfusion 7.0.2 and my TSX Avg MPG chart would not display in IE. It would display fine in FireFox and Safari. After doing some searching I found a trick that worked for me, under your web root create a folder named CFIDE inside of it create a folder called Scripts. Do a search on your hard drive for cf_runactivecontent.js and copy it to the CFIDE/Scripts folder you created. It is working like a charm for me now.

Dual tuner tivo upgrade

I have been a Tivo fan for a while so I was excited today to see the UPS man left my new dual tuner Tivo. First thing I have to upgrade it 80 hours will not do. I got a 300 gig HD from Compusa for $57.00 after $10.00 mail in rebate. I got the Tivo from for $45.00 after a $20.00 coupon I had and a $150 mail in rebate from Tivo. Now on to the upgrade, I have documented the very easy process with pictures and instructions after the jump.
Step one: Make sure you have basic computer knowledge (setting jumpers on IDE Hard drives, not being afraid to take electronics apart)

Step two: Download Instant Cake from< make sure you download the correct version for the Tivo you have. Your model number is listed on the back of your Tivo. Note: you can hunt around some hacked together ISO. I just find it much easier to drop the $20 for Instant Cake<

Step Three: Burn the ISO you downloaded with your favorite cd burning software.

Step Four: Shutdown your computer and install you new HD as the secondary IDE master make sure your CDROM is setup as primary IDE slave and your bios is set to boot off of the cdrom drive.

Step Five: Boot your computer with the CD burned in step three answer the few questions you are presented and let Instant Cake do its magic.

Step Six: Shutdown your computer and remove the HD and hook everything back up.

Step Seven: Install the new HD into your Tivo

Step Eight: Power your Tivo back up and do a clear and delete everything

You are done enjoy your increased recording capacity!




3 new tutorials

I have been busy the last week or so creating 3 new tutorials. I created a Final Cut pro Lower Third with luma matte tutorial last Sunday on my way to San Jose, CA. I have also been meaning to create two using some CSS tricks I discovered. One is a three column layout using CSS (I use a variation of this on my own site). The second is a link color schemes using CSS (I also use this on my site).

Older Posts →
← Newer Posts