Clean Up Google Drive Icon Files

I had a Git repo that I was storing on Google Drive (Yes that probably was not a great idea, but it was a lazy way of sharing some pdfs in the repo with a non-technical coworker). The Google Drive app on the Mac uses an “Icon” file to indicate sync statuses of folders.  Unfortunately this kept screwing up the repo by also putting “Icon” files in all the folders in the .git directory.  Having the repo was more important than it being in Google Drive so I moved the folder out of Google Drive.  Once the folder was moved the “Icon” files remained and the repo was still throwing an error when I tried to code in Adobe Brackets.

Here is how I cleaned up all the Google Drive “Icon” files.

WARNING: BE SURE YOU DON’T HAVE FILES NAMED WITH “Icon” AS THE FIRST 4 LETTERS OR THIS WILL DELETE THEM.

  1. Open terminal
  2. Change directories into the folder that was once in Google Drive
  3. Issue the following terminal command:
    find . -name 'Icon*' -type f -delete

Now the repo is back to normal.

SQL Server SELECT into existing table

This morning I needed to add a single record to an existing table in database1 from an existing table in database2. Here’s how I was able to do it:

INSERT INTO database1.dbo.tablename
     SELECT *  
     FROM 
          database2.dbo.tablename
     WHERE 
          ID='4d08aeb0bedd01452dfef3eabc2816dcc75533c8'

Please note that the databases use a SHA-1 Hash for the ID field. If you use an IDENTITY field in SQL you’d have to take some extra steps to briefly allow inserting an IDENTITY field.

Using a ColdFusion Ternary Operator for an Optional Tag Attribute

Today I had to write a script to process a form and send an email as part of the processing. The form allows the user to specify an email address to bcc, but it’s not required. I’m a big fan of using the Ternary Operator for doing either/or stuff like css classes. So I decided to extend that fandom to set the bcc attribute of the <cfmail> tag if the email specified in the form was valid.

Assumptions for this example:

1. You have validated form.bccEmail as a valid email.
2. You have a default mail server specified in Application.cfc or CFADMIN.
3. You may see more utility in using the Ternary Operator for other conditional cases.

The “magic” is in the bcc attribute below:

    
	    Message Body here...
    

ColdFusion function returns space before value

I had an annoying issue this morning where a function I wrote that rounds and formats values for use in an internal financial app kept sticking a single space before the value returned. This was obviously not good for a financial app. After spending 10-15 minutes tearing the function’s innards apart it turns out what was going on in the function was not the cause. The cause was simple.

In a tag based ColdFusion function you need to be sure to include the ‘output=”no”‘ attribute.

 
     ... MAGIC STUFF HERE ...

ColdFusion 9 SELECT IN query using ormExecuteQuery()

For some reason this took me some effort to figure out. Maybe others will find it useful.


CategoryList = '1,2,3';
Categories = ormExecuteQuery("from Category where Id IN (:IdList)",{IdList=ListToArray(CategoryList)});

If you know a better way please drop me a comment. I posted this in the Adobe Coldfusion forum for a few days but didn’t get anything.

CAPTCHA Fails

I was buying some software this morning and got the following CAPTCHA at checkout. CLASSIC.

Yup. For real. My other favorite was one I received while working on an application at the office.

Good stuff.

Mac Diff/Merge Utility for Dreamweaver

If you have done web development on a PC in Dreamweaver you have probably used WinMerge to check for differences between local and remote files.  Since I moved to the Mac a few years ago I have been neglectful in finding a similar tool for the Mac.  Thanks to some changes in my current day job I now have a larger team and more of a need for getting my act together on this.

The tool I have decided on in a free one called DiffMerge.  Part 1 of the install is the typical Mac install (drag a file to the Applications folder).  Part 2 is a little more detailed (but dead simple).  There is a readme.txt file in the installer image with instructions for copying 2 files to facilitate command line usage (You will need this for Dreamweaver).

Once you have done the installation and followed the readme.txt fire up Dreamweaver and click Dreamweaver > Preferences > File compare and set the path to your equivalent of the screenshot below:

DiffMerge for Dreamweaver on the Mac

Save, Format, View Dreamweaver Checked Out By Report

I wrote a post a while back about a file I created to format Dreamweaver search results for printing. Recently the need arose for me to apply that same formatting to Dreamweaver’s “Checked Out By” report.

Here is what your report will look like:

Checked Out By Report View

Download the search_results.zip file here. It contains the files to transform both “Search Results” and the “Checked Out By” report.

*** UPDATED 2/27/2015 ***

As a security measure Chrome blocks access to local files. You must open Chrome from the command line with a flag to allow access to local files.

Follow these steps to allow local file access in Chrome on the Mac:

  • If you have Chrome open, close it
  • Open a terminal window
  • Execute the command:
    open /Applications/Google Chrome.app --args --allow-file-access-from-files
  • Once Chrome opens select ‘File > Open File’ and browse to your local xml file
  • Voilà

Best Firefox Add-ons for web developers?

I’m looking for the best Firefox Add-ons for web developers.

A few things you should know about me:

  1. I like lists.  A lot.  I make them all the time for everything.
  2. I hate repetition and drudgery in my work.  If there is a (legitimate) shortcut I want to know about it.
  3. I’m a ColdFusion web developer who dabbles in jQuery.
  4. I dig Firefox for helping me with all of the above.

Now this is where you come in… What are your favorite/most useful Firefox Ad-ins that help you get your work done on a daily basis?

Here are mine (alpha order):

  • ColorZilla – Eyedropper/colorpicker
  • Dummy Lipsum – Generate “Lorem Ipsum” dummy text.
  • Evernote Web Clipper – For selecting text to evernote
  • Fast Dial – Visual bookmark homepage
  • Firebug – My main usage is debugging AJAX
  • FIreGestures – Executes commands with mouse gestures
  • FireShot – Screen shot utility
  • iMacros – Awesome utility for building test cases or automating repetitious tasks
  • TinyURL Generator – Generates TinyURLs
  • Web Developer – Adds tons of tools (too numerous to list)
  • Xmarks – Sync your bookmarks across multiple machines (and platforms!)

Thanks, I look forward to hearing from you.