Archive for the ‘Web Development’ Category

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???

Recently I’ve had a couple occasions where I needed to clean up some data that had non-ascii or high-ascii characters in it. Usually this happens when the data originates from MS Word or Excel. The first time I was producing XML, and was getting errors when I tried to validate my feed. Thats when I noticed I wasn’t using XMLFormat(), which of couse I should be.

I added XMLFormat() around my data, but was still getting errors. Evidently XMLFormat() still leaves in a lot of characters that are just plain illegal in XML. Here is a function I wrote to give me clean data.
Continue reading ‘Cleaning up non ascii chars for XML or other uses’ »

I had heard of this book a few years ago, and have had it on my Amazon wishlist for some time. So when fellow ColdFusion programmer Mike Henke offered me a copy, I quickly accepted. Steve Krug’s Don’t Make Me Think! A Common Sense Approach to Web Usability is a short read, designed to be read in under 4 hours.
Continue reading ‘Book review: Don’t Make Me Think!’ »

Could it be true? Yes, check out MusicArsenal.com, a new service that allows indie managers and labels to promote their bands. It provides access to all kinds of contacts for setting up shows, radio appearances, etc, as well as organizing all aspects of managing and promoting a band.

It was built in ColdFusion 8, using Model Glue, ColdSpring and Transfer.

The basic account is free so feel free to signup and try it out. The man behind the project is Jimmy Winter, he has a blog at musicarsenal.com/blog/. And you may just bump into him at an NECFUG meeting.

music arsenal

I’m setting up mysql locally on my laptop this weekend, and ran into a snag that cost me at least an hour. To mimic a web app I am running locally, I needed to connect to mysql with a specific username and password. But no matter what I did, I always got this error:

MySQL: access denied for user: username (Using password: YES)

I got this when connecting via the command line client and via ColdFusion. Finally after some googling I came across this blog post suggesting to change the privilege details to allow connecting from ‘localhost’ instead of ‘%’. The % indicates a wildcard and should allow connections from any host. But for some reason this was not working for me. Changing it to ‘localhost’ fixed the problem and allowed me to connect. I think it may have had something to do with the fact that I checked a box when installing that would only allow connections from the localhost.

I used this SQL to fix the host setting after connecting to the ‘mysql’ database:

update user set Host=’localhost’ where User=’myUserName’

The cfdirectory tag can be pretty slow when reading in large numbers of files. I was trying to read a directory that contained 13,000 files and it was often timing out. In my case, I only needed the names of the files, not the size or date modified or anything else that cfdirectory returns. In that case, specifying the LISTINFO=”name” attribute should speed things up considerably. That tells CF not to stat() each file to get the additional information. Unfortunately this only became available in CFMX 7, and this particular project is running on 6.1

But using java you can achieve the same result:
Continue reading ‘Fast alternative to cfdirectory for large file lists’ »

CFIMAGE, the new image manipulation tag in CF8 is a great tag. One of the things its often used for is manipulating an image (resizing, cropping, etc.) and then displaying that image using the action=”writeToBrowser” attribute. If this image is linked to something by wrapping an anchor tag around it, many browsers by default will display a blue border around it.

Example:

Small car, an example photo

If this is undesirable, there are several ways around it. Normally we’d just put a border=”0″ attribute in the <img> tag, but in this case, when we use the cfimage tag with action=”writeToBrowser”, ColdFusion is creating a temporary image and writting out the <img> tag pointing to it. So we can’t add the border=”0″ attribute.

You could use CSS to turn off the border on all your images. In your stylesheet you could use:

<style type="text/css">
img { border: 0px;}
</style>

Thats painting with a wide brush, though. We can also use a little trickier CSS to access the exact image element, by placing a class in the anchor tag that surrounds the image. For example, if you add an class of nobdr to the <a href…> tag, then use this:

<style type="text/css">
.nobdr img {border: 0px;}
</style>

If you want to place that CSS in the header of your document (technically, all style tags should be in your header), yet still have it right above the element in the unrendered source code (I find this easier to maintain later), then drop it into the cfhtmlhead tag:

<cfsavecontent variable="tmpCSS">
<style type="text/css">
.nobdr img {border: 0px;}
</style>
</cfsavecontent>

<cfhtmlhead text="#tmpCSS#">

My Job Went to India - book coverDespite the alarmist title, I loved this book. The author, Chad Fowler, spent a year and a half in India setting up his company’s new software development center. Chad’s task was to interview and select 25 people who would form the “seed team” of a development shop that would eventually employ 250 people. The book contains his thoughts on the steps you need to take to ensure your job is not one of the many IT jobs that are moving over seas. Because of his experience there he is in a good position to expound on the differences between IT services performed here and abroad.

There are 52 bite sized chapters that are usually around 2-4 pages each. Its very easy to get through this book, the small chapters make it easy to read just a few pages whenever you can find time. Most chapters end with an “Act on It!” section where Chad gives you a short list action items that will help you implement the topic of the chapter.

Some of my favorite chapters are:
Continue reading ‘Book Review: My Job Went to India’ »

Sometimes its necessary to delete all the .svn folders from your subversion working copy.

Here is a simple way to do it on Linux:

rm -rf `find . -name .svn`

That might not work if you have hundreds or thousands of folders, as it might be too many arguments for the rm command. I still like it because its simple. But a more robust way would be:

find . -name .svn -prune -exec rm -rf {} \;

This calls rm on each file separately.

I haven’t tried the following, but on Windows you may be able to:

Create a cleanSVN.cmd file in the root containing these lines:

for /f “tokens=* delims=” %%i in (’dir /s /b /a:d *svn’) do (
rd /s /q “%%i”
)

You could also try browsing to the files in Windows Exporer and then:
Right click on the folder and click Search..
Enter .svn as the filename to search for.
Click “More advanced options” and select:
– Search hidden files and folders
– Search subfolders
Press search button and delete the folders you find appropriate.

The Windows tips came from Axel’s blog at http://www.axelscript.com/2008/03/11/delete-all-svn-files-in-windows/

A while back I had a couple posts on preventing double form submissions and showing an in-progress meter for long running pages. These work great, as long as you are using a type of validation that redisplays the form when there are errors.

This doesn’t work so well when you are not redisplaying the form. For example, I’ve seen some validation where the user is shown an error message and just told to use their ‘Back’ button to fix the errors. Sometimes a JavaScript history.go(-1) link is displayed as well. I had to work on a site today that used this type of validation.
Continue reading ‘Resetting the DOM and JavaScript when using the ‘Back’ button in FireFox’ »