Change background color of fckeditor / ColdFusion rich textarea

Preface: I work on a project for my office that is hosted by a third party.  Therefore, I do not have access to all the inner workings of ColdFusion.  Specifically I do not have access to the fck_editorarea.css file.

For a new form in the project I need to add a rich textarea.¬† The rich textarea will sit atop a div with a background color so I need to change the textarea’s background color to white.¬† If I can’t access fck_editorarea.css to change the style what can I do?¬† I can change it via the DOM with JavaScript.¬† For kicks I also added a border.¬† Place the following script just before the </html> tag.

<script type="text/javascript">
fckItem=document.getElementById('NEWSBODY___Frame');
// change bgcolor
fckItem.style.backgroundColor="#FFFFFF";
// add a border
fckItem.style.border="1px solid #0A0A4F";
</script>

Easy enough.

Dual Monitor Heaven USB2VGA

I have finally joined the world of dual monitors.¬† Finances and standards at my office have thwarted my quest for two years to have a dual monitor setup.¬† My propensity to multi-task and staring at a fairly small (by developer’s standards) monitor for many hours a day has made this a painful defeat.

But at last… victory.

Meet the USB2VGA from startech.com (purchased via Dell).¬† This little guy finally allowed me to win the battle of not having to “open the box” to install any hardware.¬† It works quite well, is cost effective, and best of all… easy to configure.¬† If you can plug a device into a usb port then you have skills to set it up.

Can a dropdown box be imperialistic?

usa! usa! usa! 

I¬†recently received a¬†request from a management member to put “United States of America” at the top of the countries dropdown list for our user registration process.¬† While this may seem an innocuous change to that person we do have a lot (maybe 1/3) of users not born in the U.S.¬†¬† I know it used to be popular to put the good¬†ole¬†U S of A atop of dropdown lists for its vast superiority “convenience” but it seems somewhat “politically incorrect” or “imperialistic” to me.¬† Any thoughts?

Who’s down with OPPM

I have struggled for some time now with an expanding workload.  I direct a lot of projects for a couple of different business entities.  Since I have yet to find a way to disrupt the time space continuum and add more hours to the day I am ever searching for ways to stay focused and cram more into a 24 hour day.

Enter the OPPM.

one page project manager for it projects

The OPPM (One Page Project Manager) is the most effective tool I have found yet for project tracking/communication.  The real genius of it is its simplicity.  It literally is a one page document that can be easily interpreted by the boss, the project stakeholders, the managers, or just about anyone.  All you need is about 2-5 minutes to explain it to them once.  Where can I get more information you ask?

The OPPM (One Page Project Manager) website is a good start.

Then buy the book and read it.¬† The one I read is the one specifically geared for IT projects.¬† It’s about 125 pages and you can read it (and more importantly digest it) over a weekend.¬† Actually, once you read the first two chapters of the book you’ll be up and running.¬† Although I recommend reading the whole thing to learn the finer points.¬† I found the analysis of team member personalities very interesting (I’m the one with lots of unfinished books on the nightstand).

“But dude”, you say.¬† “I just dropped a wad of cash on MS Project.”¬† Don’t fret my friend.¬† You probably still need it to manage the nitty gritty.¬† And don’t throw out your Outlook task lists.¬† You can still use them.¬† The OPPM is meant to augment standard project management tools and methods.¬† The power of OPPM shines in meetings when people actually UNDERSTAND what is going on with the project without having to be a PMP.

Get it.  Use it.  You will be glad.

Using Dreamweaver to work with .cfmail files

I had a BIG problem recently at a hosting company for a project I work on. They had “something go wrong” during an upgrade to ColdFusion 8 and they lost our site’s settings from ColdFusion 7. Rather than wasting valuable time trying to get them to restore a backup and redo the upgrade I forged on trying to set everything right.

One of the problems I came across was that the hosting company set the mail server to be a different one than what we had for CF7. Why did this matter? Well, there were about 300 messages sitting in the “Undelivr” folder that needed to go out. In each of those messages was the old (now incorrect) mail server info. Since I was under the gun to get the mail out I pulled them all down via FTP to parse through them with Dreamweaver.

I used this article to configure Dreamweaver to edit my extensions.txt file to be able to open and perform search and replace on .cfmail files:

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16410

Here is a what the extensions.txt file looks like:

Dreamweaver\'s extensions.txt file

Once I got all of the .cfmail files updated, I FTP’d them back into the spool folder for re-processing. No dice. ColdFusion moved it all back to the “Undelivr” folder with a cryptic error:

The ColdFusion Mail Spool Encountered An Invalid Spool File In The Spool Directory. The invalid file MailXXXXXX.cfmail was moved to the undeliverable directory.

The next step… Hot Fix. Read about it here.

After the Hot Fix I again dropped the .cfmail files back into the spool folder for re-processing. This time… Sweet Success.

Save, Format, View Dreamweaver Search Results

For as long as I can remember I have wanted a formatted, printable report of Dreamweaver search results. Since Dreamweaver’s “Save Report” of the results pane is an xml file I have always been too lazy to pursue it. I have finally put forth a little effort to generate one using XSLT. XSLT stands for XSL Transformations. XSLT “transforms” XML documents into other formats, like XHTML.

Download the search_results.xsl file here. Unzip it. It is the file that will perform the styling of your XML results file. Hang on to it for now.

Open Dreamweaver’s “Find and Replace” window (Command + F). Enter your search criteria and click “Find All”.

.DW Finder Window

In the “Results” pane click the save icon.
DW Results Pane

You can accept Dreamweaver’s default file name or give the file a name related to your search. I’ll call mine Post.xml. Save it in the same directory where you put search_results.xsl. Open Post.xml (or whatever you called it) with Dreamweaver and add the one line of code annotated below with the red arrow.

XSL code

Now open your Post.xml file with a web browser such as Safari. You should see your search report formatted as follows:

Post.xml

You now have a nice printable report complete with results total.

*** 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à

Virtual hosts with MAMP on Leopard

Assumptions (Kind of major assumptions):

  • You are running Leopard (and therefore cannot use “Netinfo Manager” to edit your hosts).
  • You already have MAMP up and running and MAMP is using the Apache config file located here: /Applications/MAMP/conf/appache/httpd.conf
  1. Set up a directory for your dev website. I created: /Applications/MAMP/htdocs/csimmons
  2. Create a “host” for your site. In Leopard this will require you to edit the hosts file manually. Be sure to use sudo or you will not be able to save the file. Type the following and enter the root password when prompted:
    $ sudo pico /etc/hosts
    Add the following at the bottom

    # VIRTUAL HOST START
    127.0.0.1 csimmons.dev
    # VIRTUAL HOST STOP

    CTRL+O to write the file (then hit ENTER)
    CTRL+X to exit pico
  3. Flush the DNS cache
    $ dscacheutil -flushcache
  4. Edit the Apache config file:
    $ pico /Applications/MAMP/conf/apache/httpd.confChange the following:
    OLD:
    ServerName localhost:8888
    NEW:
    ServerName 127.0.0.1:8888

    Continue to the very bottom of the file (use CTRL+V to page down faster) and you will find “Section 3: Virtual Hosts”. Add the following at the very end:

    NameVirtualHost 127.0.0.1
    <virtualhost 127.0.0.1>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
    </virtualhost>
    # DEVELOPMENT HOSTS START
    <virtualhost 127.0.0.1>
    DocumentRoot /Users/username/Sites/csimmons
    ServerName csimmons.dev
    </virtualhost>
    # DEVELOPMENT HOSTS STOP

    CTRL+O to write the file (then hit ENTER)
    CTRL+X to exit pico

  5. Restart the MAMP servers. I just click “Stop Servers” and then “Start Servers” on the MAMP widget.
  6. Try it out. Point your browser to the following (no www in the address and don’t forget the port[8888]): http://csimmons.dev:8888
  7. Rinse. Repeat for each of your dev sites. Multiple sites would look like this:

    hosts file:

    # VIRTUAL HOST START
    127.0.0.1 csimmons.dev
    127.0.0.1 site2.dev
    # VIRTUAL HOST STOP

    Apache config file:

    # DEVELOPMENT HOSTS START
    <virtualhost 127.0.0.1>
    DocumentRoot /Users/username/Sites/site2
    ServerName csimmons.dev
    </virtualhost>
    <virtualhost 127.0.0.1>
    DocumentRoot /Users/username/Sites/site2
    ServerName site2.dev
    </virtualhost>
    # DEVELOPMENT HOSTS STOP

Subversion backup of multiple repositories via DOS .bat file

I recently had to implement Subversion at work to manage our source code. Part of that implementation was coming up with a way to automate the backup process. Since developers could be accessing code repositories at any time there is a special command (called hotcopy) in Subversion for copying a repository to another location, which you can then backup to disk, tape, etc.

I started out just doing a simple DOS .bat file to run the hotcopy. My plan was to schedule this to run in the Windows scheduler prior to the nightly backup. As I started working on the script though I found myself trying to improve it to be as generic and hands off as possible. I also wanted to backup multiple repositories.

Here are some “features” of the script:

  • It will hotcopy multiple repositories in a specified directory.
  • It can be run attended or unattended
  • It has some basic log functionality

Here is a look at the actual hotcopy command in the .bat file:
ECHO Starting SVN backup for %%G... >> %repolog% & ^
svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^

Download it here and rename it from svn_backup.txt to svn_backup.bat.

Prepend existing data in SQL

Disclaimer: This tip will probably be really basic for most SQL folks.

The task: The company I work for has a web application that does some basic tracking of grants. The system feeding information to this application just had an across the board change to the numbering scheme of the grants. All grants must have a prefix of “999-“. Therefore, any grant not beginning with “999-” must be updated. Example: a grant with the current number 8789966 needs to be 999-8789966.

The solution: The SQL below does two things. It updates all the grants to prepend the 999- prefix while also skipping any grants that are already correctly prefixed.


UPDATE tbl_grants
SET grant_no = '999-' + grant_no
WHERE grant_no NOT LIKE '999-%'