« March 2007 | Main | May 2007 »

April 2007 Archives

April 30, 2007

Creating a "Loading..." Animation Page with ColdFusion

There's a reports section on the web site at work that crunches through a lot of data and makes a number of CFHTTP calls to grab real-time stock quotes from another server. All this made for enough latency for my boss to notice it and ask if there was anything we could do to improve it. When I told him that we couldn't get around the time it took to process so much data and get stock quotes, he asked if we could at least show the user a page with an animated graphic to make it appear that the page was being generated and delivered to them. So, I did a bit of research and came up with a loading page. It was, admittedly, a little harder than I thought it would be...

Continue reading "Creating a "Loading..." Animation Page with ColdFusion" »

April 26, 2007

Barack Obama Gets American Security

In his New York Times editorial for today, David Brooks mentions the following exchange during an interview with Barack Obama:
When I asked him to articulate the central doctrine of his foreign policy, he said, “The single objective of keeping America safe is best served when people in other nations are secure and feel invested.”

That’s either profound or vacuous, depending on your point of view.

If I had to pick one of Brooks' two labels for the statement I'd call it profound, but I don't know if it qualifies because the idea is so damn sensible. I wish more politicians would make it part of their policy.

April 25, 2007

The Difference Between Block-level and Inline Elements

I've been vaguely aware that there's a concept in the world of HTML regarding whether a set of code is block or inline. Thanks to the book I'm currently reading,The Best-Practice Guide to XHTML & CSS, I finally understand-- and can remember-- what the concept means.

Block-level elements treat multiple elements on the page as a single block, putting them all in one rectangular area (think <div>, <table>, and <blockquote>). Inline elements-- and this is the part that's easy to remember-- aren't treated as a block; instead, they fall within lines (ie, "in line") and can go next to other inline elements (think <span>, <a>, and <img>).

One thing to remember is that block elements cannot go inside inline elements.

April 24, 2007

Microsoft ClearType and other powertoys

I found myself wondering why the typeface in my blog looked so much worse on the desktop computer at home than it did on my laptop, when I realized that I have Microsoft ClearType installed on my laptop. If you don't have it on your computer, install it-- it makes screen fonts look amazing by anti-aliasing. Now the designs you get from your designer, with those nice, softly rounded letters, will actually resemble what you see in your browser. Imagine that.

Here's a graphic showing an example of how ClearType improves the look and legibility of text:
cleartype-compare.gif

Be sure to check out the other Windows XP PowerToys, too, especially the Alt-Tab replacement.

A List Apart 2007 Web Design Survey

i-took-the-2007-survey.gifI just finished responding to A List Apart's Web Design Survey 2007 (their first in an annual series, they say), and I encourage you to do the same. If you don't read A List Apart, you should-- it's a fantastic resource on coding and publishing. From their site:
People who make websites have been at it for more than a dozen years, yet almost nothing is known, statistically, about our profession. Who are we? Where do we live? What are our titles, our skills, our educational backgrounds? Where and with whom do we work? What do we earn? What do we value?

It’s time we learned the answers to these and other questions about web design.

Migrating From HTML and Tables to XHTML/CSS: Replacing 1-Column Tables with Lists

As a part of my series on migrating from HTML and tables to XHTML/CSS, this post covers one of the hacks that I commonly relied on: using tables to create lists with images instead of bullets. Read on for details.

Continue reading "Migrating From HTML and Tables to XHTML/CSS: Replacing 1-Column Tables with Lists" »

Migrating From HTML and Tables to XHTML/CSS: Removing 1-Column Tables

In my first post on migrating from HTML and tables to XHTML/CSS, I wrote that I'd try to document my experiences as I changed my code. Some of the first things I addressed were the low-hanging fruit: switching one- or two-column tables to padded divs. Read on for details.

Continue reading "Migrating From HTML and Tables to XHTML/CSS: Removing 1-Column Tables" »

April 20, 2007

Why Don't Scheduled Tasks Always Run As Scheduled?

I have a certain scheduled task configured to run once a day on my production server. It queries the database for a certain subset of users, then sends those users an email. It also writes the results to a log file that I then send to myself later that morning. It's very similar to several other scheduled tasks on the same server. So... why doesn't the task run at all? Nothing shows up in the log at all, despite the fact that I can run the task from my browser without error; there's nothing in the application log showing that an error occurred; and the Scheduler log shows that the task was executed and rescheduled.

The one anomaly that I do notice is that the scheduler log shows this particular task being rescheduled and then being executed, which happens with no other task. Does anyone have any tips or prior experience they can share?

April 19, 2007

Another Path to American Security

No matter what your political persuasion, no matter what your religion, I'm sure we can all agree on one particular goal for us as Americans: we want to feel safe and secure. It's a reasonable goal for any citizen or country around the world. But what's the right way to achieve it?

Continue reading "Another Path to American Security" »

April 18, 2007

Want To Enjoyably Waste a Few Hours? Then Go to The Animated GIFs Group on Virb.

Check out the Animated GIFs group on Virb. Some of these are just hilarious! My favorites are Bob Barker the Sith Lord, a "have it my way" drive-by from the King, Data from Star Trek: Next Generation getting a Windows BSOD, or one penguin thwacking another...

April 17, 2007

Writing an Email Autoresponder Script with PHP

It's very convenient for users to be able to communicate with web applications (or businesses) via email, but it's not always easy for the employees of the company to respond. Some of the email requests could be complex, and others could be simple but occur very frequently. So it's a real advantage when we can write scripts to respond to user emails for us. Here are some of the many uses I've found for autoresponder scripts:
  • Distributing emails to a dynamic, user-defined list of recipients;
  • Handling unsubscribe requests and subsequent feedback;
  • Auto-responding to support requests to let the user know their email has been received;
  • Parsing email campaign bouncebacks and marking hard bounces as bad email addresses, and;
  • Adding senders to a newsletter recipient list.

Fortunately, PHP fits nicely into the role of a scripting language which can talk to your application databases (to get user data), generate emails, and be called as a command-line interface by your mail program. That's the most important part-- many web languages support reading and sending emails and talking to your database, but few are accessible both as application servers and as command-line programs. I'll explain how to write such a script next.

Continue reading "Writing an Email Autoresponder Script with PHP" »

April 12, 2007

Contextual Form Field Labels with ColdFusion

I think that form field labels should be used to give users feedback about the status of the field: whether it's required, or whether they've filled it out correctly. If a user didn't fill out a field correctly and you need to send them back to the form again, you can use a ColdFusion custom tag to highlight form labels to instantly show users which fields need their attention. Personally, I really like it when web sites go the extra mile to do this for me, and conversely I get annoyed when a site makes me search around in their form because they haven't clearly indicated which field or fields needs correction.

Continue reading "Contextual Form Field Labels with ColdFusion" »

What's Behind That TinyURL?

By way of Lifehacker, I've found a nifty little Greasemonkey script called Tin Foil Hat. This little gem gives you the ability to see the real URL behind a TinyURL in the TinyURL's tooltip.

April 11, 2007

Have You Ever Desperately Wanted a Previous Version of Your Web Page?

I'm willing to bet that like me, you've at some point in the past desperately wanted to undo a change that's happened to a web site you're working on. Perhaps you've made a text edit, saved the change, and then wanted the old version of the text back; perhaps you've uploaded your own version of a document up to the server and unknowingly overwritten changes that someone else made to the same file. We've all been there.

After having this happen to me several times, I finally woke up and smelled the coffee-- I went and set up Subversion as a version-control system for all of our web files. What a lifesaver! I will never, ever do web work without saving changes to Subversion (SVN) again.

If you've never used a version control system before, I can't encourage you enough to start. There's no longer any valid excuse not to use it:

  • Using version control will be too hard to do, with checking files out, checking them in, and resolving conflicts.
    That may be what it's like to use Microsoft's Visual SourceSafe product, but SVN solves all of those problems, and makes it so easy to save changes. With SVN, you check out a copy of all of the files in the project, then edit them as you wish and save changes as you wish. There are no locks-- you can save your changes any time you like. If another developer happens to have saved changes to the same file, SVN will automatically merge the changes for you. If your changes directly conflict with those of the other developer (meaning that you've changed the same lines), SVN will let you know that you need to perform the merge yourself.
  • I'm the only developer working with these files. Why would I need version control if I can't overwrite my own changes?
    True, you can't unknowingly overwrite your own changes. But certainly there have been and will be times that you wish you could revert to an earlier version of a page that had a better layout or lacked a certain bug. Unless you're using version control, you can't get those versions back.
  • My web site just isn't important enough to merit version control-- it's only HTML, after all.
    When Subversion is easy to use and free, there's no good reason not to use it. And there's no site that's not going to run into the issue of needing to revert to a previous version of one page or another. Even with an HTML-only site, you may want to revert to an earlier version of your design, your CSS, your HTML, or most likely, your content.

Here I Go: Migrating From HTML and Tables to XHTML/CSS

At An Event Apart Boston, the references to XHTML/CSS really made an impact on me. All of the presenters were using it; half of the books in the conference bookstore mentioned it (the others covered AJAX); and half of the job postings were for XHTML/CSS developers. A few years ago I would have thought that an HTML development job would be low-level and low-paid, but I guess presentation markup has gotten a whole lot more sophisticated since I last paid attention to it.

I realized that I had better start updating the web site I work on, for several reasons: I should update my skills; I could make the site more modern; and, I could make the site's presentation code lighter and faster. So, I'll write about my experiences as I go in this blog.

April 10, 2007

Do You Find It Challenging to Get Your Kids to School in the Morning?

For those of you who have young children as I do (my oldest is in kindergarten), you may know that it can be pretty stressful trying to get your kids to school on time. It used to take a lot of pushing, prodding, moaning, groaning, and crabbing on our part to get her to get dressed, shoes on, jacket on, backpack packed and stowed, in order to get to school on time. I don't think it was a pleasant morning experience for my daughter and I know it wasn't pleasant for me. It stressed me out.

But now I think I've found the solution. I just don't force my daughter gets to school on time on any particular morning. I'm not going to complain at her or send her off to get socks on. I relax in the kitchen and perhaps softly remind her of what time it is, since she doesn't look at the clock. But it's up to her when we leave. She got a tardy slip the first time I did it, which she didn't like a bit. But now I'm more relaxed in the morning and so is she. I wonder why I didn't do it earlier.

April 6, 2007

Tech Interviews

After reading Cameron Moll's posting Surviving the all-day tech interview, I have to give a sigh of relief that I've never had to go through one myself-- although I can see why they'd give you a pretty good feel for how a potential candidate would really perform during a stressful day on the job.

I think that for development positions, though, it's a little easier to really see how well they know their stuff: I just give them a test where they have to write code samples. And while I require them to write their own code from scratch, I don't expect people to come up with every solution themselves. During the test, I let people look up whatever they'd like from reference books or the web. After all, it's what I do all day. All I care about, in the end, is that they can create good code in good time-- it doesn't matter to me whether they think it up themselves or look it up somewhere else.

A Background Image with Browser Window Sizes

Some browsers don't offer Firefox's convenient ability to set the browser's window size to standard dimensions for the purpose of testing how your web site looks at different screen resolutions. So rather than change my screen resolution, I use a background image with standard screen dimensions on it, then just resize my browser to the marked location.

Click on the image below if you want to download the full-sized version.

Click on this image to view the full-sized version

April 4, 2007

Another Use for CSS Attribute Selectors

In a previous post, I discuss the use of attribute selectors in your CSS to highlight any required form fields that a user left blank. Here's another good use for attribute selectors: in one of the sites I work on, we used small graphics to create rounded corners just about everywhere (it was 2002 and we didn't know any better). After a while, I noticed that whenever someone printed a hardcopy of a page from the site, those graphics showed up as little floating quarter-circles. So, I did the tedious work of creating a new section in my stylesheet to prevent the display of those corners in printed format:
@media print {
.hideFromPrinter {
display: none;
}
}

Then I assigned the hideFromPrinter class to each and every image tag for those blue corners... but I'm sure that I didn't find them all.

But now I know about attribute selectors, and the task of hiding those rounded corners during print view becomes much easier. I just added a new clause to my @media print section, like so:

@media print {
.hideFromPrinter {
display: none;
}

img[src^='/images/blue_corners/'] {
display: none;
}
}

There you have it! All of the blue corners, whose src attributes start with "/images/blue_corners/", no longer show up in print view. This works across the whole site just from 3 lines added to my stylesheet instead of adding code to every image tag.

April 3, 2007

A/B Split Testing on the Web

Have you ever gotten into a discussion (or perhaps even an argument) with a colleague or client over the effectiveness of one particular feature of your web application? Goodness knows I have. The good news is that if you can both agree that the end goal is to serve your site's users, then there's a solution: A/B split testing.

Continue reading "A/B Split Testing on the Web" »