Main

Web Development Archives

June 11, 2008

Getting Windows applications into your MacOSX dock

I just discovered a neat little trick with VMWare on my MacBook Pro. I still need to QA against IE/Win, and I still love using Homesite+. Up until now, to use either of them I've launched VMWare, launched those programs, then switched to Unity mode. The next day, I would have to do the same thing all over again. But with less than 5 minutes of work, you can get your favorite old Windows apps to appear on and launch from the Dock. It works like this: if you switch your Windows VM to "Unity" mode so that the applications you have open appear each in their own window, their icons will appear on the right side of the Dock (note the Windows Remote Desktop and Firefox icons):

temporary-doc-icons.jpg

Now if you click-and-drag those icons from the right side of the Dock to the left side, they'll stay there permanently (note the Internet Explorer and Homesite+ icons):

permanent-dock-icons.jpg

And whenever you click on these icons, VMWare will start up and bring up the application for you-- in Unity mode! It's just like... no, it really is having your favorite Windows apps available to you just like any other MacOS app. Awesomeness, no extra charge.

May 27, 2008

Boston CFUG Subversion presentation follow-up

Thanks to everyone who attended tonight's Boston CFUG presentation on using Subversion. If I can help anyone get set up with the server or a client, just let me know.

May 16, 2008

So, you think there's no worthy Subversion client for the Mac?

Wow. Between a new job with Ping Identity and attending the cf.Objective() conference, it's been at least 3 weeks since my last posting. Well, one of the things I learned at the conference came after asking a presenter for his opinion on whether there was any Subversion client for Macintosh that was worth using. The Finder plugin is a great idea, since it's like TortoiseSVN, but it's not full-featured and doesn't always show status overlays correctly; and other clients keep views of working folders and repositories in separate windows. Finally, other clients don't have a built-in diff program. The presenter didn't think that any Mac client was worth using either.

But someone from the end of my row in the audience told me to speak to him after the session was over, and he told me about Syncro SVN. It has everything you could want in a client-- an integrated view of your repositories, working directories, a great diff viewer, and session log. Plus, it has all of the features you might want, such as the ability to relocate working directories between repositories. If you're not satisfied with other Subversion clients on the Macintosh, I'd suggest you give Syncro SVN a look.

April 14, 2008

Spam/RBL lookup added to EmailParse.CFC

I made yet another update to EmailParse.CFC last week while I was working in the code for other reasons: I've added spam lookup on the sender's IP address courtesy of SpamHaus.org.

Continue reading "Spam/RBL lookup added to EmailParse.CFC" »

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.

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 5, 2008

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.

February 28, 2008

Click-and-drag resizing of a textarea

In a few applications, I've noticed a relatively new feature (at least, new to me): a "handle", or bar, at the bottom of a textarea that allows you to resize it by clicking-and-dragging. I think this is a great addition to the usability of any site where a user might type in just a little or a lot into a textarea.

There are a number of JavaScript toolkits which can give you this capability, but not everyone wants to add the loadtime of a full toolkit to their site. So I'll point out one script that can give you this capability: Jonathan Leighton's Textarea Resizer.

Continue reading "Click-and-drag resizing of a textarea" »

February 22, 2008

Great ColdFusion 8 article; how about a comparison to PHP/RoR?

Boston's own Brian Rinaldi has just authored an article on SitePoint, ColdFusion 8: Believe The Hype. In it, he tells web developers about why they should consider using ColdFusion 8, with details on increased speed, stability, AJAX integration, server monitoring, debugging, and other items. All in all, the article is a great read. Kudos to Brian for working to publicize the great strides that Adobe has made in an already-fantastic development platform.

One topic that I'd like to see more of in ColdFusion articles, though, is why a developer should switch to ColdFusion from another environment, or what the specific advantages of CF are over other languages. Until this kind of thing is addressed, I don't think that people who have already invested their time in PHP or Ruby on Rails will bother to even consider CF, not to mention bother to read CF articles. Brian quotes a ColdFusion developer at The Economist who recently upgraded to ColdFusion 8, who says, "...the whole thing is ridiculously stable." That's absolutely true, but when we have a former PHP/RoR developer saying that instead of a CF developer saying it, then we'll have reason to really shout about it!

(Sheepish) Yes, I know, I should probably just volunteer to write an article myself... but I want to encourage others to do it as well.

February 15, 2008

Using TortoiseSVN's "diff"(aka TortoiseMerge) to pass updates to new files

Today when I checked a third-party site for updates to the XSLT files I use in Microformats.cfc, I found myself wondering how I'd update the new files so that they contained the minor modifications needed for use in my component. I could have saved the new files in a separate directory, then opened each new file and compared it to my older version, making changes by hand. But I was a little worried that I'd forget to notice a change or two-- these XSLT files aren't exactly easy to read, and I only work with them once every few months. Then I remembered the ever-so-handy "diff" utility from my Subversion client, TortoiseSVN.

Continue reading "Using TortoiseSVN's "diff"(aka TortoiseMerge) to pass updates to new files" »

XSLT style files updated for Microformats.cfc

For you microformats buffs out there who use my microformats CFC, I have an FYI: I've updated the XSLT stylesheets with the latest from hg.microformats.org. The updated files include:

  • hAtom2Atom.xsl
  • hreview2rdfxml.xsl
  • mf-templates.xsl
  • xhtml2vcal.xsl
  • xhtml2vcard.xsl
There were no updates available for datetime.xsl and uri.xsl.

January 31, 2008

"How do you pronounce URL?" Techrepublic, who cares?!?

The subject line of today's email newsletter from Techrepublic asks "How do you pronounce URL?" The body goes on to say '[a user] asks: "Is it common practice to pronounce URL as 'Earl,' or is it more common for people to spell it out as U-R-L when they talk about a URL?" Find out what TechRepublic members say about pronouncing URL, SQL, and more...'

They really must have been scraping the bottom of their idea barrel when they sent this one out. What a waste of space in my inbox! C'mon, TechRepublic, I really don't care how your editors pronounce "URL", I don't care what your readers think on the question, and I'm willing to bet that most other readers don't really care either. You can do better than that.

January 16, 2008

A nice-to-have developer extension: MRI bookmarklet from Westciv

MRI will highlight all elements which match the selector you enter in the MRI dialogRob Wilkerson reminded me in yesterday's post regarding XRAY to mention the MRI bookmarklet from Westciv as well. From WestCiv's site: "MRI is a free cross browser tool that lets you test selectors with any web page. Selectors, particularly complex ones can be difficult to get exactly right - MRI lets you experiment with them on any web page (local or online, static or dynamic).

Essentially, MRI lets you search and identify specific selectors on your web page. Selectors are the names or tags that you specify in your CSS so that you can "select" which elements to style. So MRI will help you find all anchor tags within a list item (li > a), or all elements with a certain class or ID.

I put this as a "nice to have" since I don't think it's as useful as XRAY is. It's more often that I'm wondering "why on earth is this particular element styled/not styled this way?", which XRAY will tell me, than I wonder "which elements have this certain selector?"

January 15, 2008

Another must-have developer extension: XRAY bookmarklet from Westciv

I've got to add to my list of must-have developer tools:

  • XRAY in action, showing the CSS inheritance of the posting titles on my blogXRAY: XRAY is a JavaScript bookmarklet which allows you to "see the box model for any element on any web page". That doesn't sound very sexy, but it is-- when activated, this bookmarklet brings up a modal dialog box that will show you the nested parents for whatever element you click on, and you can even traverse up. Whichever element you click on or is in focus will be outlined. It's fantastic for determining an element's exact height, width, nesting, and CSS inheritance.

January 11, 2008

What would happen if Apple bought Adobe?

Robert X. Cringely wonders in today's column about a possible purchase of Adobe by Apple. I wonder how this would affect ColdFusion? Any thoughts out there?

Two must-have web developer extensions for Firefox

In case other developers aren't aware of two of the handiest extensions for Firefox:

  • MeasureIt: This puts a small widget in the left side of your status bar; when you click on the widget, your cursor turns into a crosshair which you can then click-and-drag to get a to-the-pixel measurement of any area of the page. Perfect for the times that you're wondering just how much room you have for a graphic or table.

  • ColorZilla: This puts a small widget in the left side of your status bar; when you click on the widget, your cursor turns into an eyedropper which you can then use to color sample any area of the page-- and you can then copy the color value to your clipboard in RGB or hex. Great when you're wondering what nice color some other site is using, or when you need to pick one color as the matte for a transparent GIF that's going over a gradient.

January 7, 2008

How to get dynamic content on static HTML pages

When I first started my blog, I was using an old version of Coldfusion that couldn't support any of the modern blog projects. So, I installed MovableType instead, which publishes my blog as static HTML pages. Static code makes it kinda hard to put in all of those nice, dynamic touches that web developers are used to including in their pages, especially of the subject of the blog is often ColdFusion.

But I got it in my head that I wanted to put interesting and ever-changing quotes at the bottom of my blog entries, as I've seen on a few other major sites (you may have noticed the pithy quote at the bottom of this page). More experienced developers will be able to guess right away how I got it to work, but if you're curious about how I did it exactly, please read on.

Continue reading "How to get dynamic content on static HTML pages" »

December 21, 2007

Removing ".svn" folders from zip archives

I use Subversion for all of my projects. While it's a life-saver for keeping records of all changes to your source code, it can be more than a little annoying to deal with the ubiquitous ".svn" folders that get put into every directory of your project. If you want to create a zip archive to publish your project, you don't want to publish those .svn folders along with it-- but up until now I haven't known of any other way to get rid of them other than to go into the zip file and delete the unwanted folders one by one. But today I found out that there's a better way (at least on Windows) by creating a new registry entry.

From John Galloway's blog:

[This] REG file adds "Delete SVN Folders" to the context menu for folders. When you select it, it removes all folders named .svn inside the folder and it's children (it does nothing if the project's not under Subversion source control.

John doesn't tell you how to get the new registry entry imported into your own registry, but I will: just copy the lines from his blog and save them in a text file with a ".reg" extension. Then open RegEdit, choose File -> Import..., and then import the file.

December 20, 2007

Beta testers needed for Webmail

I'm nearly finished with a new version of Webmail, my web-based POP email client which is written in Coldfusion. But to make sure that it works well in many different environments and with many different POP servers, I'm looking for people to serve as beta testers. Those who are selected as testers and who provide feedback will get a free copy of the code.

webmail-screenshot-login-sm.pngAs a quick introduction, Webmail provides web-based access to any POP account. It's not intended to be your main email client-- instead, it's intended to be used to read and respond to your emails when you're away from your main client (such as when you're away at a conference, at a client's office, or in a friend's house). Webmail will not delete any of your emails from your POP account unless you specify that certain emails should be deleted.

webmail-screenshot-messagelist-sm.pngWebmail now offers the ability to save user preferences including a timezone setting so that all dates are displayed properly, spam keyword recognition, an address book, and even a search function. This new version of Webmail requires ColdFusion 8.

I'm also looking for people who can provide language translations for Webmail (it's about 240 words or phrases, which might take you an hour or two). So if you can test and/or provide a translation, please post a comment below and put your email address in the comment form (I'll be the only one who has access to your email address).

Note: as per Nick's comment, please let me know your web server and email server specifications in your comment. If you have something unique, I'm more likely to include you as a tester.

November 1, 2007

Get in high gear with Flex Camp Boston

Flex Camp BostonBrian Rinaldi, the ColdFusion CFUG manager for the Boston area, announced today that registration is open for Flex Camp Boston. Kudos to Brian for arranging this seminar-- he's rounded up a fantastic list of speakers, including Peter Farland and Tom Jordahl from Adobe.

October 31, 2007

Safari browser now available for Windows

For those of us who don't have immediate access to a Mac for testing our code, there's now a tool to help. Apple has released a version of its Safari (Beta 3) browser for Windows. It uses the same rendering engine, WebKit, on both Mac and Windows (as well as on the iPhone, for that matter), so you can be reasonably confident that web sites tested in Safari on Windows will render and behave similarly on the Mac. (I am not advocating that anyone completely skip testing on non-Windows platforms, just saying that there's a quick "cheat" available.)

JavaScript for centering a popup window to the screen

Ever wondered how to get your popup windows to center themselves on screen instead of appearing wherever your browser wants to put them? Just measure window.screen.width and window.screen.height. Divide each of them in half to get the center point of your screen. Then subtract from those numbers half of the width and height of your popup window. The result is the X,Y coordinates of where you should place the upper left corner of your popup to make it centered:
function newWindow(windowName, URL, width, height, scrolling) {
	width = width || 400;
	height = height || 360;
	scrolling = scrolling || 0;
	
	var topX = (window.screen.width / 2) - ( width / 2);
	var topY = (window.screen.height / 2) - ( height / 2);
	
	window.open(URL, windowName, 'width=' + width + ',height=' + height +
 ',location=no,resizable=yes,scrollbars=' + scrolling + 
',screenX=' + topX + ',screenY=' + topY);
}

September 26, 2007

Creating database indexes on single columns

I have to admit that when I posted an entry a few days ago on creating indexes to make your database queries run faster, I made a small error of omission when I suggested that indexes be created for every two columns that are used in a join. The fact is that you should create indexes even for single columns if they're the main lookup in the query. From the MySQL documentation:

Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially.

September 17, 2007

A simple lesson on using indexes in your database

I was taught a simple lesson in the power of database indexes today. Here's how it happened: for a while, one of the sites I'm responsible for seemed to become slower and slower over time, even to the point of timing out during a database query. I always figured that it was because the web server was over 5 years old and needed a re-install or something like that. So, I switched to a new server and migrated the database to the new machine, which has more RAM and an has a more modern version of MySQL.

But guess what occurred on the new server when I started testing on it? The site and its database were as slow as ever. At that point I could no longer blame the problem on the machine, so that left... me. I had to figure that code optimization and/or database optimization were the only issues that could be at fault. So, I fired up a browser and looked at the MySQL docs. I knew enough to start investigating indexes to get things working a little faster, so one of the first lines I saw was this:

Use of indexes on the relevant columns is the best way to improve the performance of SELECT operations.
That was enough to convince me I was in the right place. I looked up the CREATE INDEX syntax, and started to create indexes for the columns that showed up in my most common joins. Bingo! After the first index was created, the query that used it sped up by an embarrassing 20 seconds. I'm ashamed that I didn't create these indexes sooner.

I'm definitely no database administrator, but my suggestion would be to create a two-column index for each join that you perform in your application. One column would contain the primary key of the table that you're indexing, and the other column would be the foreign key in that same table.

For instance, to create an index on a table of users that you join to a table of accounts via a foreign key in the users table, you'd write a MySQL index like so:

CREATE INDEX users_accounts ON users (userID, accountID)

Do this for each of your joins and your database should be nice and speedy for a good, long while.

June 4, 2007

What do you show users while you're upgrading a site?