« February 2008 | Main | April 2008 »

March 2008 Archives

March 28, 2008

Are You Taking Advantage of Web 2.0?

So asks David Pogue of the New York Times, who describes the benefits of Web 2.0 as offering "a direct, more trusted line of communications than anything that came before it."

Around my office we have discussions about just what "Web 2.0" means. I usually interpret it in a more technical, feature-oriented fashion, saying that it applies to sites that have near-real-time interactivity with a web site, using AJAX to make themselves appear to work more like a desktop application than a page-request-based website. My boss thinks of Web 2.0 as meaning that a site has a user community and user-contributed content. There probably isn't just one meaning to the term, anyway. But Pogue gets the point-- it's no use talking about what Web 2.0 means. You just want to concentrate on what benefits it has to your company:

"When a company embraces the possibilities of Web 2.0, though, ... it [will] gain trust, goodwill and positive attention. You'll put a human face on your company. And you'll learn stuff about your customers that you wouldn't have discovered any other way."

Completely true. And here are other ways that your web site reflects the character of your company:

  • The design: does this company have enough money to afford a good designer?

  • The copywriting and layout: is the company smart and detail-oriented?

  • The server uptime: is this company reliable?

  • Graceful degradation: does the company think about its customers and their needs?

  • Snazzy, cool AJAX features: does the company willing to explore new ideas?

  • Splash page: is this company so into its branding and so clueless about what users really want to know that it throws a useless splash page in their way?

UI: Double-click to search keywords on NYTimes.com

A colleague just brought the coolest feature to my attention: on the NY Times' website, you can bring up search results on any term they use in an article merely by double-clicking on the words in the article itself. You don't have to go typing in a search box, or pull up a contextual menu with a right-click.

Continue reading "UI: Double-click to search keywords on NYTimes.com" »

March 27, 2008

When to create indexes in your database

The discussion over on Ben Nadel's posting on tips for writing better, more-optimized SQL is pretty interesting, with a number of users writing in with good tips on SQL optimization and even db optimization. I suggested that any column used in a WHERE clause should be indexed, which in truth is rather a strong statement; I suppose it's more accurate to say that any column in a WHERE clause should be considered for indexing. The possible drawback to the over-use of indexes, as some people pointed out, is that indexes can possibly slow down your database by taking up too much disk space or by being so large that they take too much overhead for the database to maintain.

While I suppose that's technically possible, and those folks say they've observed it, I have to say that I've never experienced that kind of problem, even on high-traffic tables with several millions of records. In the end, you just have to experiment to see whether an index makes your query run faster. But do consider indexes for more than your foreign keys.

People have been asking for some solid technical rules or advice on when to implement indexes, so I thought I'd post links to the best guides on indexes:

My take: should a web developer know SQL?

There's a pretty good discussion that I've been part of on Andrew Powell's blog and Ben Nadel's blog about whether a web developer should have to write SQL code. Andrew says that developers should concentrate on web code and either leave the SQL in the expert hands of DBAs or should use an ORM that abstracts the SQL code for the developer. Ben thinks that developers should have some understanding of SQL for the sake of writing better applications.

I think that web developers should know SQL because SQL is a great, and sometimes necessary, skill to have throughout your career. Simply put, DBAs (and ORM software) arent' available for every project. While I will glady (eagerly! quickly!) hand over the responsibility for database creation, maintenance, and query input/output to a DBA if one is available, most of the time such a person isn't there. I've worked in medium-sized companies, tiny companies, and by myself, and for most every project I've been the only resource available to manage databases and SQL. I've had to learn it. And even if you, as a developer, currently work at a company that has a DBA, I feel confident in saying that you're not going to find as many opportunities with other companies if you don't know any SQL.

Andrew does make the good point that developers probably aren't going to know SQL as well as a DBA will, because the DBA makes a focus on the SQL language. I would agree. And I also agree with his suggestion that you should never be afraid to ask how to do something, or to do it better. But I disagree with the contention that developers shouldn't need to know SQL. I think that the web industry gets a lot more good out of developers' SQL than bad.

March 26, 2008

Speaking on Subversion at Boston CFUG, May 20th

I'm a big fan of the version-tracking application Subversion (aka, SVN), as it's saved my bacon many a time. It's so easy and so helpful that I wonder why I didn't start using it sooner than two years ago.

I like SVN so much that I'll be speaking on how to use Subversion to the Boston CFUG on May 20th, 6:00pm. If you live in the Boston area, make sure to RSVP-- I'd be thrilled to see you there. Whether you're on a development team and want to avoid overwrite conflicts, or whether you're a solo developer who wants to have a record of coding changes over time, Subversion can save your bacon, too.

March 19, 2008

Demo now available for Webmail

I want to share the news that there's now a demo available for Webmail, my ColdFusion web-based email client. Oh-- and as always, I'll make a free copy available to anyone who can make a translation file available in their language. I still need German, Portuguese, and many Oriental languages.

Fast, random sorting of queries, arrays, lists, and structs

I need to create a page that takes a structure of members and displays it in random order on the page (kind of an ever-changing "here are the latest members to sign up on our site" table). I needed to work with a struct because 1) it's what our CFC was built to return, and 2) the member data had a nested hierarchy that would have been impossible to output easily if it were in a query. While Googling on randomization, I came across Ben Nadel's post yesterday on randomly-ordered lists. He makes an interesting comparison between different methods of sorting: by sorting a struct (fast but doesn't allow duplicates), random append/prepend from one list to another (slow), multiple swapping of items in an array (fast, but perhaps not very random), and random selection from one list into another (extremely slow). So it occurred to me that with a bit more thought about the sorting algorithm, I should be able to build on Ben's work to create a randomization function that was speedy, handled duplicates, and could return a random list (or list of keys) when passed a structure, array, query, or list.

Continue reading "Fast, random sorting of queries, arrays, lists, and structs" »

March 25, 2008

IE8's graphical live bookmark: the "WebSlice"

Internet Explorer 8 Beta introduces a new live bookmark feature they call "WebSlices". WebSlices actually subscribe you to portions of a Web page. It's a pretty cool idea-- with some easy mark-up in your page, you can allow users to subscribe to subscribe to your site's information without creating an extra RSS feed. And, users can view the feed not as a text list in a grey menu, but as a slightly larger window with its original HTML/CSS formatting. It's kind of like a graphical RSS feed, but without the work of maintaining the feed.

Continue reading "IE8's graphical live bookmark: the "WebSlice"" »

March 17, 2008

Joel's got it right; it's about browser-share, not designers

So you've heard about IE8 and how it implements standards mode, right? Unless you add a specific meta tag to your page that indicates to IE8 that it should render pages to its full capability (<meta http-equiv="X-UA-Compatible" content="IE=8" />), it will render them as if it were IE7 instead. And it's set the web industry abuzz with wonder and discussion. Why would you upgrade a browser with new capabilities but have them turned off by default?

Jeffrey Zeldman says that Microsoft is just guaranteeing that future versions of IE (8 and onward) will work with the existing sites of "millions of small business owners, school teachers, pastors, coaches, and so on who create websites every day, armed with crappy software and little else." That could be true, but does Microsoft really care about those millions of small-time content creators? After all, they've never seemed to care too much about all of us professionals.

But I think that Joel Spoelsky put it best in today's article, Martian Headsets (a.k.a., pragmatists versus idealists). Joel points out that it's not the web designers, professional or not, that Microsoft is worried about: it's the end user. He argues that if end users were come down to their desktop computer in the morning after it's been automagically Microsoft Updated to IE8 in the middle of the night, and if IE8 were set to standards mode by default, then most of the sites people viewed would break. And who or what would these end users blame? The creators of the web site which looked so good and worked so well just the previous day? Nope.

They'd blame IE8. And perhaps, just perhaps, IE would lose some market share.

Now I think that makes sense as a reason for Microsoft to be cautious in how IE8 renders sites. They probably don't care too much about making life easy for professional developers-- after all, we all know how to add a meta tag to a site pretty easily, and who knows, some of use will make some money off of it. Microsoft probably doesn't even care about the small business owners and coaches who-- let's face it-- wield little money and even little influense in the technology industry. But I can't blame them for not wanting to "break the web" for users.

Look at Joel's article, it's well worth a read.

March 14, 2008

CF8 tabbed-form layout gotcha in Firefox, Safari

I just found a "gotcha" with using forms that are spread across several tabs in a cflayout area. The form would render properly in all browsers, the tabs worked just fine, and my "Save" and "Apply" buttons submitted properly. Everything worked well, except whenever I submitted the form using Firefox my changes wouldn't be saved. In IE, however, the changes were kept. I checked out the problem in Safari 3, and the problem existed in that browser as well. (I'm referring to a Windows environment, by the way-- I don't know if this circumstance would occur on a Mac, although I tend to think it would.)

So the first thing I did to solve the problem was pretty revealing. I used cfdump to view the contents of the FORM scope after the form was submitted; in IE, obviously, all of the form data was being submitted, but in FireFox, none of it was being passed to the server. Why would this be?

Continue reading "CF8 tabbed-form layout gotcha in Firefox, Safari" »

March 12, 2008

Using MS-SQL's NOLOCK for faster queries

A nice little coincidence just happened for me: right after my boss had emailed me asking if a certain click-tracking report in our site's admin section could run any faster, the developer next to me, who was looking through some of our existing code, asked me what this "NOLOCK" mention in an MS-SQL query meant. Talk about perfect timing! I probably wouldn't have remembered NOLOCK if he hadn't brought it up.

Continue reading "Using MS-SQL's NOLOCK for faster queries" »

March 10, 2008

Doh! Using this.mappings in Application.cfc

I've been working with ColdFusion ever since version 4.0, but of course every once in a light bulb goes on over my head and I realize how I've completely misunderstood something. Like this.mappings in Application.cfc.

I have to admit that I had stopped trying to use this.mappings because I could never get it to work. I would create a mapping in the fashion that the docs told me to:

<cfset this.mappings['myMapping'] = "/path/to/my/folder" />

And then I'd try to refer to my mapping name in my code, as I figured I should:

<cfinclude template="/myMapping/myFile.cfm" />

But it never worked. The server would just throw an error and tell me that the mapping didn't exist.

But tonight it dawned on me, and I wanted to share the epiphany so that you can either solve the mystery, too (if you also could never figure it out) or have a good chuckle at my expense (if you can't fathom why I ever got something so simple wrong in the first place). You don't refer to the mapping name in your file path... you refer to the this.mappings variable. Doh.

So the correct use is:

<cfinclude template="/#this.mappings['myMapping']#/myFile.cfm" />

Don't laugh too hard at me. I can only hope this revelation of my own foolishness will lift the wool from someone else's eyes.

Digital Millenium Bill of Rights

A Slashdot user came up with an excellent idea last week: how about a Bill of Rights for the Digital Age? He asks:

"Since we are living in a world where the need is growing for privacy measures and rights to use emerging technology, it seems to me that state governments should adopt a bill of rights regarding internet privacy, use of technology and speech on the internet. For example: make it illegal to allow ISPs to release personal information to anyone who wants it. Now, obviously, that's not the only issue. If you were asked by your state government to come up with a bill of rights for internet privacy, technology use, and free speech regarding the internet and emerging technologies, what would you include?"

The American government has certainly seen fit to protect the interests of parties like copyright holders in our current technological era with bills like the Digital Millenium Copyright Act. And the world is definitely encountering a new set of personal abilities and personal risks with the reach of the Internet. So I don't see why they shouldn't recognize the protection needed for citizens as well. Here's what I'd like to see in a Digital Millenium Bill of Rights:

Continue reading "Digital Millenium Bill of Rights" »

March 7, 2008

A gotcha when calling Java/CFC with AJAX

I wanted to share this "gotcha" that I spent an hour on the other night: I was using <cfajaxproxy> to call a CFC that I had created as a proxy to another (the proxy CFC had methods which were accessible remotely, while the other CFC, stored in session, had public methods that woudn't have been accessible via AJAX. The final CFC accessed Java functionality. The proxy was really simple; it just took the exact same arguments as did the other CFC, and passed them on to the appropriate method call:

<cffunction name="setIndicator" access="remote" output="Yes" returntype="boolean">
        <cfargument name="cat" required="Yes" type="string">
        <cfargument name="indicator" required="Yes" type="boolean">
		
        <cfreturn SESSION.user.finalcfc.setIndicator(ARGUMENTS.cat, ARGUMENTS.indicator) />
</cffunction>

But every time I tried to call the proxy via AJAX, I received an error...

Continue reading "A gotcha when calling Java/CFC with AJAX" »

March 5, 2008

How does your company handle customer account security?

Yesterday an issue came up at the office that I wanted to ask the rest of the community about: we had a person call in, identifying themselves as being from a large law firm, asking for the names of those people from her firm who were signed up for our services. My company offers web-based financial services by subscription, so it's not at all uncommon for us to have customers from financial and legal firms, and to get calls from them asking about their accounts. Sometimes we even have a relationship with one person at a company who doles out bulk-rate subscriptions for our services to their colleagues.

What was notable about this caller, however, was that we didn't have a prior relationship established with this person or company, and we really had no way of verifying that they were who they said they were. My colleague who was taking the call put this person on hold and asked me whether he should grant this person's request; my answer was to have him say that while he could tell the caller how many people from her company were signed up with us, we were not allowed to give her their names. We did offer to contact them on her behalf to ask them to get in touch with her.

These kinds of calls, while not frequent, are somewhat common. For instance, we get secretaries calling on behalf of busy lawyers, or the folks from the finance department who've noticed our company's name as a charge on the company credit card and want to know who placed it. I'm sure this happens to other web-based businesses as well. So my question to the rest of you is this: how do you handle requests for customer account information? Do you take any measures to verify that the caller's stated identity is authentic? If a third party calls and asks for information about other people, how do you handle it?

Want a copy of a ColdFusion-based webmail client?

WebmailI'd like to get some language files translated for my ColdFusion-based webmail client, which reads POP accounts. If anyone would like to provide a translation of a language file for me, I'll give them a free copy of the Webmail application, which normally goes for $29.00. The language file consists of about 250 words and phrases, which shouldn't take much time. Just drop me a line in the comments below or via my contact form.

The folks who help me out with this will also get priority to test my forthcoming ColdFusion-based IMAP client, which is currently in development.

Note that while I've gotten several responses already, you should feel free to offer me a translation even if you think that someone else has likely volunteered one for your language already. I'm perfectly happy to get multiple translations for the same language so that I can account for regional differences. So don't be afraid! Thanks.

March 3, 2008

Updates to textarea-resizer script

After my recent post on enabling resizable textareas with the textarea-resizer script, a reader noted that the script shouldn't be run in Safari 3 since that browser adds its own resizer widget in the lower-right-hand corner of all textareas. So, with confirmation from the script's author Jonathan Leighton that the textarea-resizer script is redistributable and modifiable under the GPL, I've posted a tweak to the script so that it won't run on Safari 3. I've also included my own stylesheet and handle graphic for the grab bar.

Download textarea-resizer.zip

FancyZoom: like lightbox, but with a "zoom" effect

I came across FancyZoom the other day, which calls itself "Smooth Javascript Image Zooming For Your Web Pages". It's a lot like lightbox, but with a "zoom" effect and no shading over of the original page.

Continue reading "FancyZoom: like lightbox, but with a "zoom" effect" »