Archive for September, 2005

Ajax invite-only comments

September 26th, 2005 | Filed under AJAX

I’ve been MIA here because we just launched invite-only comments over at Lifehacker which involve a crazy MT plugin and really neat Ajax as-you-type comment preview and posting.

Usually velvet ropes aren’t my cup of tea, but the invitation system seems to be working well. I’ll send anyone an invite who offers an earnest and worthwhile tip for the site. So far there have been fewer comments than I anticipated but the ones that are there are super-high quality and on-topic, so that makes me happy.

Comments completely change the face of a site, making a post an interaction instead of a statement, which is nice. I felt kind of high up there on my LH horse and disconnected from the readership. Now, with comments, I feel like we can all stand around and chat.

Comments also went live on Gawker, and already commenters there have been banned and threads seem more like a standup comedy routine where people compete to show who’s snarkier. Which makes sense for Gawker, I guess.

Anyway, most other stuff has been put on hold while I pack my apartment to move West and keep Lifehacker on track. Hopefully more dev posts soonish.


Ajax quick searches and lookups

September 21st, 2005 | Filed under Javascript, DHTML, AJAX

ObjectGraph’s define-as-you-type dictionary and Wikiwax’s dynamic Wikipedia lookup are my two favorite uses of Ajax.

ObjectGraph Dictionary
WikiWax

SimpleBits Chameleon icon set

September 21st, 2005 | Filed under Design

I prefer open-source graphics, but this icon set is beautiful enough to pay for. (And it includes the camera icon, which always seems to be missing from icon sets I’m interested in!)

Chameleon: an icon set that changes color [SimpleBits]

PHP MVC

September 18th, 2005 | Filed under PHP, MVC

A couple of buddies and I have been doing some testing and research into Model View Controller frameworks in PHP. In the process, I did the PHP Cake tutorial in which you build a simple blog engine. Cake aims to be the Ruby on Rails of the PHP world and does well. While it is impressive, it’s not quite what we’re looking for. (More on the other app I wrote with Cake later.)

I tried PHP MVC, and I’m not sure if I or the developers should be embarrassed about the fact that I couldn’t get the example app to run (as in, unintelligable error in my logs.) Neither could either of my cohorts.

Long story short, this OnLAMP article tackles MVC in PHP, and begins to build a custom MVC framework, which it looks like me and my co-coders are going to do as well with a new app we’re building - though not exactly the way the author is going about it. Still, timely article with lots of good info.

Understanding MVC in PHP [ON Lamp]

Big vs small development teams

September 16th, 2005 | Filed under Startup dot com

An interesting debate about small vs big companies is going on between SixApart’s Mena Trott and 37 Signals’ Jason Fried.
The Signals’ whole schtick is getting apps built with small teams. Mena responds, explaining why she and her husband expanded to a bigger, more traditional, funded company when given the choice to stay small or grow.
Personally I dig the 37S’ small teams should “embrace constraints” approach because it makes me feel like I can get together a couple of friends and make something happen. However, I can’t say for sure that I would have turned down the opportunities to expand that Mena and Ben were given with MT, either.

In Defense of Big (relatively speaking) [Six Apart - Mena’s Corner]
Mena’s Counterpoint Corner: In defense of big [Signals vs Noise]

You are here

September 15th, 2005 | Filed under Essential Tools

The GeoBytes IP address locator is pretty good at telling you exactly where, geographically, your IP is originating from.

IP Address Locator [GeoBytes]

Perl global search and replace

September 13th, 2005 | Filed under Code snippets, Perl

I produce a monthly web magazine which consists of eight years worth of flat HTML files. One of the writers, who recently got a new email address, asked me to update it everywhere it appeared on the site - which was in dozens of .htm and .html files nested in subdirectories all over the tree. The very thought gave me a headache.

But, after a little researching, I found this quick Perl script did the trick on files piped from the find command:

[trapani@colossus html]$ find . -name "*.htm*" | xargs perl -pi -e 's/user\@oldaddress.com/user\@newaddress.com/g'

Scary, running that sucker a bit recklessly on the production server, but it totally worked, and fast. Modified from the suggestion at this O’Reilly Linux Server Hack.


Assign a domain name to your home server

September 12th, 2005 | Filed under Servers

My latest Lifehacker feature details how to use DynDNS.com to assign a domain name to your home web server, or VNC server, or FTP server. I love DynDNS.com.

How to assign a domain name to your home web server [Lifehacker]

Ten CSS tricks you may not know

September 8th, 2005 | Filed under CSS, Reference

I didn’t know about 4 of these. The vertical alignment with CSS and image replacement seem particularly useful.

Ten CSS tricks you may not know [Webcredible]

Ajax SuggestBox

September 8th, 2005 | Filed under AJAX

SuggestBox in actionThe free Ajax SuggestBox will render a search input box that drops down with suggestions as-you-type on a web page. The Javascript and server-side script for getting suggestions available for download.

The most useful applications of this type of suggest I’ve seen are for entering freeform tags in del.icio.us, and for a Wikipedia search at WikiWax. Of course, there’s always Google Suggest which I think started the whole suggest theme. Any others out there?

SuggestBox


Apache HTTP server on Windows

September 7th, 2005 | Filed under Essential Tools, Apache web server

I published a detailed tutorial on how to set up Apache web server on a Windows PC at Lifehacker today. It’s pretty basic httpd.conf editing and .htaccess/.htpasswd authentication setup stuff. I’ve been running Apache at home for years now, using it for dev sites and to share music and other files.

What was interesting is that when I started writing the piece I saved all my config files and uninstalled Apache, so I could go through all the steps of installation again and get screengrabs for the writeup. And when I tried, the installation would fail, telling me another service was running on port 80. I thought was going nuts - Apache had been removed, and IIS wasn’t running, my firewalls were all off… then I found a board post that explained how to troubleshoot:

A common during-installation error with Apache reads, “Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down. Unable to open logs.” This means that some other server program (like Skype) is interfering with Apache. To figure out what program it is, open a command prompt and type:

netstat -a -o

Find the PID (Process ID) of the program running on your local machine on port 80 (or http.) Then open the Windows Task Manager (Cntl-Alt-Del). In the View menu, choose Select Columns, and check off PID. Then match the PID to the running process to find out what server program is running, and stop the program. Then retry the Apache installation.

Anyway, it was Skype that was running an http server on port 80, blocking my Apache (re)install. Skype! WTF?

How to set up a personal home web server [Lifehacker]

JavaScript Archive Network

September 7th, 2005 | Filed under Javascript, Reference

The CPAN for Javascript, JSAN seems to offer a whole lot of useful Javascript code for download. An interesting bit in the FAQ:

[The Javascript] people seem to fall into two camps. The first are people who consider themselves programmers or application developers. They like JSAN because it allows you to develop in an application style. Thinking about modular components is important in software design. The second group of people consider JavaScript a scripting language, something you write small things in.

I’ve tended toward the ’something that you write small things in,’ but then I saw Gmail and Google Maps, and I changed my mind.

JSAN - Home

JavaScript Logging

September 6th, 2005 | Filed under Javascript

FV LoggerJavascript logging using the fvlogger library looks SO MUCH BETTER than sprinkling alert()’s through your Javascript code.

JavaScript Logging [A List Apart]

View live site referers

September 6th, 2005 | Filed under PHP, MySQL, Essential Tools, Traffic stats

Programmer Dean Allen’s free PHP/MySQL app, Refer, displays live real-time referring URLs to your web site.

Of course, one could just watch one’s site logs to get an idea of who’s clicking in from where. But Refer filters out certain types of files (CSS, JS, etc), referers from your own domain, and can exclude certain directories, too. (Like, I don’t want to see any referers generated while I’m working on a post in WordPress.)

I’ve used Refer for several months now on my other site, and besides occassional referer spam problems, it’s a fantastic way to see immediately if your site is getting a whole lot of traffic from fresh links.

The downside of Refer is that it requires a database insert on EVERY request for pages for which you want referers recorded. This can slow things down considerably, and perhaps give your conservative performance-concerned sysadmin indigestion. Refer uses this neat .htaccess line which automatically adds the PHP script to the end of each page for processing:

php_value auto_prepend_file /www/ginatrapani/refer/refer.php

Not sure how long I’ll keep this unpassworded, but here’s Spun’s installation of Refer so you can check out how it works yourself..

Refer 2.1 [Textism]

Getting started with Subversion

September 5th, 2005 | Filed under Subversion, Eclipse

My first Subversion repository was set up using an excellent, 3-year-old OnLAMP article, “Single User Subversion,” which I continue to refer back to it for basic SVN administration commands and explanations. My personal Subversion repository runs on a Windows XP box, and I mostly interact with it using Subclipse, an Eclipse IDE plugin which provides easy right-click check out’s, commits and graphical file version histories.

Single-User Subversion [O’Reilly OnLAMP]

Email address obfuscator

September 4th, 2005 | Filed under Code snippets, HTML, Javascript, Essential Tools

Every time I have to publish a clickable email address on a web page I wind up Googling Javascript tools that obscure the mailto: link and telltale user@example.com format so that spam bots can’t easily pick up the address and tsunami the user with junk.

There are plenty of tools out there, but none that do all that I wanted: namely, encode the ‘mailto’ bit and display a live preview of the link. So I’ve gone ahead and thrown one together of my own.

Go ahead and give it a whirl, it’s got exciting iframe cross-scripting going on for the preview. *

* For now it’s Firefox-only while I work out the IE and Safari compatibility issues. Tested and works now on Internet Explorer 6 with SP 2 on Windows, Safari on Panther and Firefox Windows and Mac.

Javascript Email Address Obfuscator by Gina Trapani

Learning Ajax

September 4th, 2005 | Filed under AJAX

O’Reilly developer Micheal Smith asks readers what resources will help him learn Ajax, and gets a few good recommendations in response.

Learning Ajax (JavaScript and XML): recommendations? [O’Reilly XML.com]

Create a favicon.ico from any photo

September 3rd, 2005 | Filed under Code snippets, HTML, Design, Essential Tools, Browsers

FaviconThe makers of one of my favorite markup/text/code editors on Windows, HTML Kit, have made a web service available which creates favicons out of images.

Favicons are the small images just before the URL in the address bar of many web browsers.* The images are in the .ico file format, so this web service takes any graphic (like a jpg or gif), resizes it and converts it to the .ico format which includes both a 16×16 and a 32×32 pixel version embedded within it.

It’s a tough challenge finding an image that is recognizable at that size, but totally worth it for the visual branding it brings to your site on readers’ and users’ tab bars and bookmark lists.

Once you’ve created an unzipped your favicon.ico to the web server, include the following inside your pages <head> tag to activate the icon:

<link rel="shortcut icon" href="/path/to/your/favicon.ico" type="image/x-icon" />

* Firefox’s support is probably the best, displaying favicon’s on bookmarks, tabs and in the address bar. Internet Explorer’s support for favicons is pretty much nonexistent.

FavIcon from Pics — how to create a favicon.ico for your website [Chami]

Startup School

September 3rd, 2005 | Filed under Startup dot com

Serial entrepreneur Paul Graham and co are holding a free, one-day “Start up school” for hackers looking to get their company going. If Graham’s essay “How to start a startup” is any indication, Startup School will be good.

Startup School [Y Combinator]
How to start a startup [Paul Graham]

Photoshop color gradients

September 3rd, 2005 | Filed under Color, Photoshop

Creating a gradient in PhotoshopTo create a gradient from one color to the other with Photoshop (like, um, a lightening blue sky), choose set the foreground color to the starting color and your background color to the ending color. Select the area in your image where the gradient will occur. Then choose the gradient tool (in Photoshop, not ImageReady) and draw a line in the direction the gradient should occur (up/down, horizontal, diagonally, like in the screen grab.

(Disclaimer: I am Photoshop-stupid, and this is rudimentary how-to on the Gradient tool, which I just discovered today.)