Archive for September, 2005

Remove default padding and margins

Saturday, September 3rd, 2005

Most web browsers add default padding and/or margins to certain HTML elements; for example, and unstyled <body> or <p> will have space around it, depending on the browser. To start with no padding or margins, begin your CSS stylesheet with the following:

* { margin:0; padding:0; }

From there explicitly add padding and margins to elements in your stylesheet by declaring CSS classes as usual. See an unstyled page with default padding. Compare it to a page with unpadded elements including the CSS bit above.

Update: Kevin Hale’s quick start CSS templates include the * element above with font-family and font-size, too.

Cheat Sheet Roundup

Friday, September 2nd, 2005

Developer Pete Freitag lists more than 30 “cheat sheets” for developers, ranging from HTML to SQL to version control. Personally I’m always headed over to Web Monkey’s Special Characters reference myself.

Cheat Sheet Roundup - Over 30 Cheatsheets for developers [Pete Freitag]
Reference: Special Characters [WebMonkey]

View your cookies

Thursday, September 1st, 2005

A quick way to see all the cookies a web page has currently set is to type the following into your browser’s address bar (works in all browsers):

javascript:alert(document.cookie);

How to use the robots META tag

Thursday, September 1st, 2005

The robots <meta> tag in the <head> of your web page tells well-behaved robots (like the Googlebot) whether or not to index a page and whether or not to follow links on a page. For bloggers and zine publishers, robots should only index the permanent locations of posts, not the ever-changing front page or archive pages.

To use meta tags to direct the Googlebot to your permalinked post locations, insert the following in the <head> on your front page and archive pages:

<meta name="robots" content="noindex,follow" />

That says, “Hey bot, don’t index this page, but follow the links.” You don’t want these pages indexed because they will change every time you post to your site. The posts’ permanent locations, which should be linked on your front page, will never change however, and so the robot should follow the links and index them. Those permanent locations of your posts should have the following in the document:

<meta name="robots" content="index,follow" />

Alternately, if you don’t want the links in your posts followed but you do want your posts added to the search engines’ indices, use:

<meta name="robots" content="index,nofollow" />

To achieve this in a WordPress template or any PHP page where $single is set if you’re viewing a single post’s permalinked location, insert the following into the templates that include <head> tags:

<meta name="robots" content="<?php echo (!$single?'no':''); ?>index,follow" />

HTML Author’s Guide to the Robots META tag [robotstxt.org]

Herd Your Code with TextWrangler

Thursday, September 1st, 2005

TextWrangler iconWebMonkey’s published a helpful how-to on my favorite free text editor for Mac OS X, TextWrangler. Even though I’ve been using TextWrangler for some time now, some things mentioned in this article were still news to me:

What TextWrangler delivers isn’t just less with more, it’s less with everything. The interface — menus, toolbars, command keys, document panes, et cetera — is customizable eight ways from Sunday. The language-sensitive syntax highlighting is a gift from heaven, and the integrated scripting (Unix, Apple Script, and so on) is powerful enough to be, quite frankly, way beyond my daily needs. Oh, and SFTP. And regular expression searches, even PCRE. And spell-check that actually ignores code!

Herd Your Code with TextWrangler [WebMonkey]
TextWrangler [Bare Bones Software]

One to-do to one person

Thursday, September 1st, 2005

Developer, project manager and company founder Jason Fried says one to do item should be assigned to one person and one person only:

The more people you make responsible for something, the less chance there is for it to get done.

The more people responsible for something, the more finger pointing, the more blame deflection, the less direct responsibility. Making multiple people responsible for something simply diffuses the responsibility, and diffused responsibility generally leads in one of two directions — stagnation or mediocrity.

Make one person responsible [Signal vs. Noise (by 37signals)]

WordPress review

Thursday, September 1st, 2005

Having built this site in one day using free web publishing tool WordPress for the first time on a production weblog, I must say I’m impressed.

I’ve spent the last 6 months publishing 12 posts a day under a tight schedule on Lifehacker using SixApart’s MovableType, Gawker Media’s CMS of choice. Otherwise I’ve only used my own publishing system. Given my experience, a few of WordPress’ features really knocked my socks off. On the other hand, there were things I reasonably expected WP to do out of the box which it didn’t. Also, in many ways I can see that WP is inaccessible to the non-technical user.

Here are some off-the-cuff thoughts about WordPress, in some cases as compared to MT. (more…)

Server log IP resolution

Thursday, September 1st, 2005

Apache’s Logresolve is a little utility translates all those IP addresses in your server logs into English, ie displays 67.19.139.26 as ginatrapani.org. Before my host resolved this site’s logs for me, this batch file on my Windows box resolved logs named something.log and saved them in a folder named “resolved”:

for %%F in (*.log) do "c:/program files/apache group/apache2/bin/logresolve" < %%F > resolved/%%F

Web Developer Firefox Extension

Thursday, September 1st, 2005

Live CSS editing

I don’t know how I did any development before installing Chris Pederick’s Web Developer Toolbar in Firefox, it does so much. The live as-you-type CSS editing is what I use the most for tweaking design, but code validation, the quick View Source button, toggling images on and off and viewing form information and div class names are also super-helpful.

Web Developer Extension [chrispederick.com]