I had the need to instantiate some static nested Java classes, from within ColdFusion. I was doing some searching through IMAP. The Java code I was trying to emulate went something like this:

import javax.mail.*;
import javax.mail.internet.*;
InternetAddress address = new InternetAddress();
SearchTerm toTerm = new RecipientTerm(Message.RecipientType.TO, address);
SearchTerm ccTerm = new RecipientTerm(Message.RecipientType.CC, address);
SearchTerm bccTerm = new RecipientTerm(Message.RecipientType.BCC, address);
SearchTerm[] recipientTerms = {toTerm, ccTerm, bccTerm};
SearchTerm orTerm = new OrTerm(recipientTerms);

Continue reading ‘Instantiating Nested Static Java Classes from ColdFusion’ »

I ran into this issue when adding a new datetime column to an existing table in my MySQL 5 database. I did not get the error in my production environment, only the dev environment on my local machine.

I was puzzled by this error, because I thought the all zeros value basically meant a null/unknown date value. Also I wasn’t using a type TIMESTAMP, I was using a DATETIME column type, so that threw me, too. After digging through the data a little bit, I found that the values for these new columns in the production database were NULL, but the values in my dev database were ‘0000-00-00 00:00:00’. A little googling told me that the all zeros value is what happens when an invalid date is assigned to a datetime field.

I could not see any differences in the schema, so I’m not sure how this happened. But updating my dev data to be NULL where the value was ‘0000-00-00 00:00:00’ solved the problem.

The other option, if you can’t change your data, is to add these items to your connection string value in the ColdFusion Administrator for your datasource:

noDatetimeStringSync=true&zeroDateTimeBehavior=convertToNull

This tells MySQL to return a null instead of throwing an exception when one of these values is found. This is how I initially solved the problem, until I figured out that ‘0000-00-00 00:00:00’ was not a proper value.

I’ve never found a great solution for pagination in SQL 2000. I much prefer MySQL’s syntax: SELECT * FROM table LIMIT 100,10. That will get you 10 records starting at the 100th record. Why MS SQL still doesn’t offer an opposite to TOP, I don’t know. Yes, I’ve seen the double TOP method where you sort your data twice to end up with the last X rows. It works, but its not exactly elegant.

But I have come across a new method for pagination using some new 2005 features that is pretty neat. What I really like about this solution is that it gives you a count of the total number of records, which you usually don’t get with other pagination methods.
Continue reading ‘Elegant pagination with MS SQL 2005’ »

I came across this neat site that allows you to select which of the many eclipse plug-ins you want. It will then build a custom eclipse install with those plug-ins installed and allow you to download it. Very cool!

http://ondemand.yoxos.com/geteclipse/start
Continue reading ‘Online Eclipse configurator and download’ »

When debugging a Flex 3 application on Vista / IE 7, you may encounter this error when debugging an application for the second time.

Another flash debugger may be running. Close it to Continue.

Another flash debugger may be running. Close it to Continue.

Even though it appears there are no IE instances still running, this error comes up.

There are several solutions to this, one is to configure Flex Builder to launch a different browser for debugging, such as FireFox. Another is to disable Vista’s UAC. Neither of these were good solutions for me.

The problem has to do with a socket getting left open. As a short term fix you can use your task manager and kill the ieuser.exe process when you get this error. Then you should be able to launch the debugger ok.

This bug is discussed in Adobe’s bug tracker system. Their suggested solution for now is to add this string to your flexbuilder.ini file:

-Djava.net.preferIPv4Stack=true

After searching around for a while and not finding my flexbuilder.ini file, I discovered that file only exists if you’ve installed Flex Builder stand alone. If you install it as an eclipse plug-in, as I have, then you need to add that line to eclipse.ini. But that didn’t solve the problem for me, and I’ve read it didn’t solve it for some other people as well.

My solution was to add it to the shortcut I was using to launch Flex Builder. This solved the problem and I can now debug as many times as I want with no errors.

Today I needed to view the details for all the scheduled tasks on one of our client’s servers. I needed a print out showing the tasks including the URL, the schedule and whether the task was disabled or not. There were quite a few tasks on this machine, and I wasn’t looking forward to manually going into each task, printing it, and then ending up with a huge stack of printed pages.

So instead I wrote this short script that displays the information I need all in one page.
Continue reading ‘A one page view of scheduled task details’ »

My SQL savvy coworker Jason Troy has done some work recently on finding and deleting duplicate records in a database. One of the things he had to do was compare on a text field (that is, over 8000 characters and not a varchar). Very interesting.

http://phillyun.blogspot.com/2008/10/power-of-sql-find-and-delete-duplicates.html

I’ve released an update to my Craigslist Spam Buttons greasemonkey script. (If you don’t know what this is about, see my original post).

This new version works completely differently, it flags items in the background using a hidden iframe. This should fix the problems people were having with the old version. Special thanks to Steve Sweet for his help on this version.

I’m not 100% sure this is working perfectly yet, so please try it out and let me know what you think.

Update 10/29/2008 – this is now working great! And it keeps the [spam] links marked as visited, even after reloading the page, so you can see which posts you’ve already marked.

The latest version can always be downloaded from http://userscripts.org/scripts/show/7399

One of my clients has a site where they offer their archived radio shows for downloading. The files they provide us come from directly from the radio station. They are already in MP3 format, but they are encoded at an insanely high bitrate for a talk show, and are in stereo to boot. This can eat up a lot of bandwidth unnecessarily.

There are over 100 files, so opening each one in an audio tool such as Audacity or SoundBooth to re-compress would be quite tedious. Here is a short script I wrote to re-encode the files. Note that I did this on our Linux server, but since Perl and lame/notlame are both available for Windows you shouldn’t have a problem doing it there either.
Continue reading ‘Batch conversion of audio files – shrinking MP3s’ »

I thought enabling the new ColdFusion 8 server monitor was not supposed to affect your applications, but apparently it can. This morning all of the sudden I could not get one of my coldfusion applications to start, it kept throwing timeout errors in weird, almost random places. When I removed the offending piece of code I would just get a timeout error somewhere else.

I finally tracked it down to the fact that someone enabled the server monitor on this server. Turning it off let the application start up just fine. This is a ModelGlue/ColdSpring application, that may have something to do with it because we had other ColdFusion apps running ok on this same server.

I was able to turn monitoring back on after the application had started. The application scope was only using 3.3kb of memory, much less than some of the other applications. My lone session in the application was taking up 76kb though, which seems kind of high.

Thoughts???