Archive for the ‘Web Development’ Category

Tonight we had Adam Lehman from Adobe speak to our CFUG about Scorpio. It was very impressive! They’ve truly done an excellent job at making this a ‘must have’ upgrade. The UI tools, server monitoring, image manipulation, presentation generation, the list goes on. It was just one amazing feature after another. And I can finally use var++ to increment a variable! I have been waiting for this since I started using ColdFusion 4.5.

You can find the Scorpio Tour events on Adobe’s website: http://www.adobe.com/products/coldfusion/events/

Some people have encountered problems during the ColdFusion MX 7 install on Linux/Apache. When you first start the ColdFusion server, you may see something like this:

Configuring the web server connector (Launched on the first run of the ColdFusion MX 7 start script)
Running apache connector wizard...
=======================================
There was an error while running the connector wizard
Connector installation was not successful

Continue reading ‘Problems installing the ColdFusion connector on Linux/Apache’ »

Did you know that in MS SQL and MySQL, a UNION query will automatically filter out duplicate records between the tables that are being unioned?

I ran into this on an email tool I was working on. The client wanted to email users that had recently signed up for either of two different services. So I did a UNION between the two tables to pull all the users into one query that I could loop through. But for some reason, my test user that was in both tables (but with the same name and email address) was only showing up once. I had expected to need to filter out duplicates myself, and I was puzzled as to why both users weren’t showing up. Here is the query:
Continue reading ‘SQL ‘UNION’ queries automatically filter out duplicates’ »

I am currently working with a client that sends large amounts of mail using ColdFusion. They are having a few problems, and I am going to be doing some optimizations to improve their mail delivery. One of the things we are going to do involves monitoring the number of messages in the ColdFusion spooler directory that are waiting to be handed off to the SMTP server. This involves looking at the files in the ColdFusion spool directory. I did not want to hard code the path to the spool directory, because it may change between production and development machines, and the path may also change when ColdFusion is upgraded.

It is possible to find the spooler directory programatically. My first thought was to look in the adminapi. No luck there. But digging around in the ColdFusion ServiceFactory java class lead me to my answer:

<cfset sFactory = CreateObject("java","coldfusion.server.ServiceFactory")>
</cfset><cfset MailSpoolService = sFactory.mailSpoolService>
</cfset>

<cfoutput>#MailSpoolService.getSettings().spooldir#</cfoutput>
Continue reading ‘Programatically finding the ColdFusion installation and mail spool directories’ »

I recently wrote a routine to export a client’s newsletter subscribers as a CSV file. There are a little over 7000 records in the database now and that is expected to increase at a steady pace. I have been wanting a good reason to reach into Java and do some fancy string manipulation, as I’ve read it can be quite a bit faster than in native CFML. So this looked like a perfect chance to try it. Here’s my first take in plain old CF. I had some additional quote and comma checking in there but I’ve left it out for readability.
Continue reading ‘Using the Java StringBuffer class ColdFusion – faster CSV files’ »

This week I had a need to copy some data between SQL Server database tables. A client of ours has three tables containing users – subscribers, seminar users, and weekly report users. He wanted his subscribers and seminar users to be placed into the weekly report table, along with modifying the subscriber and seminar signups to also insert those users into the weekly report users table.

Copying data between tables in SQL is pretty straightforward:

INSERT INTO reportUsers (fname, lname, email)
SELECT fname, lname, email FROM seminarUsers

The problem with this is that some of the subscriber and seminar users already exist in the weekly report table. We can exclude them with a subquery:

INSERT INTO reportUsers (fname, lname, email)
SELECT fname, lname, email FROM seminarUsers
WHERE email NOT IN (select email FROM reportUsers)

But, the seminarUsers table contains signups for every seminar. That means a given user could have signed for several seminars, and would be imported into the reportUsers table more than once. To solve that we need to eliminate the duplicate records coming from the select statement. But for a given email address, which of the several record should we choose to import? On the second or third time the user signed up for a seminar, they may have given us an updated name or address. Only the name is relevant in this example, but in actuality I was copying more fields than just the first and last name. So lets grab the most recent signup. We can do that by just using the record with the highest userid, since it’s an identity field – the more recent records will have a higher user id number. Continue reading ‘Copying data into other tables while eliminating duplicates’ »

Unless you’ve been living on a desert island for the last year, you’ve probably heard that you’ll need to upgrade ColdFusion’s JVM (java virtual machine) before March 11th 2007. Thats when daylight savings time takes effect this year. Since the dates have shifted in 2007, anything that is aware of daylight savings time will require an update. This includes your operating system (Windows, Linux, OSX, etc.), and Java since it has its own internal timezone tables.

And if you use NTP (network time protocol) to set the time on your servers from an internet time server, don’t think you’re immune. NTP simply syncs your internal UTC (universal time) clock with a UTC clock on the internet. Your timezone tables then determine your actual local time, based on your UTC offset, which changes during daylight savings time.

Updating ColdFusion’s JVM is very easy. The version of java that ColdFusion ships with is 1.4.2_09. You can see this if you login to your CF Administrator, then click on SYSTEM INFORMATION at the top of the page.

CF Administrator - Java details
Continue reading ‘Upgrading the ColdFusion JVM – on Linux and Windows’ »

I was working on converting an application from ColdFusion 5 to CFMX 7 last week, and ran into some problems converting cfgraph (CF5) to cfchart (CF7). The graphs that looked nice in 5 weren’t coming out so good in 7.

Original chart in CF5, using the CFGraph tag:
CF5 chart

How the chart looks after converting to CFChart in CF7
CF7 chart
Notice the problem with the y-axis labels.
Continue reading ‘ColdFusion CFChart woes – converting from CFGraph’ »

Usually to setup an SSL-enabled website (a website available via the secure, https protocol), you purchase a certificate from a trusted authority such as Verisign or Thawte. This costs anywhere from $150-400 per year. But this cost is not always necessary.
Continue reading ‘Self-signing your secure certificate – SSL for free’ »

Last weekend I wrote my first GreaseMonkey script. If you are unfamiliar with GreaseMonkey, its a FireFox extension that lets you run specific JavaScripts on specifc webpages. This is incredibly cool, you can basically bend websites to whatever you want. Everything from changing the look and feel to adding new functionality. GreaseMonkey puts you back in control of your browsing experience. A neat example is the GM script that, when you are browsing Amazon, will put a link to the book at your local library and indicate if its available there.

The GreaseMonkey script I wrote works with Craigslist.org. Craigslist is a popular free classifieds site. Craigslist’s posts are not moderated, so anyone can post an ad. That includes spammers. Craigslist spam is mostly controlled by craigslist users themselves. See an ad thats spam? Click the spam button. If enough people mark it as such, it automatically gets taken down. I really like CL, so I do my part by flagging any spam I see. To do this you must click on the item title from the list, then click the spam button on the detailed listing. But I can often identify spam just from the title. Posts like “FREE 4gb ipod nano!!” and “Take Your New Pair of Uggs!” are obvious spam.
Continue reading ‘My GreaseMonkey Script: craigslist spam buttons’ »