Archive for the 'blather' Category

h1

Displaying Referrers

Saturday, March 23rd, 2002

That other, somewhat better known blogging Brent guy posted a neat article about how he does his referrer list with PHP/mySQL.

I’ve been tracking my referrers out of my Apache logs. It’s the 11th field in each log line, so I use this awk one-liner to do it:

awk ‘{a[$11]++}END{for(e in a)print a[e] ” ” e}’ access_log | grep -v blogchat.com | sort +1

(my ISP leaves two logs in my logs dir – the current one, and one for yesterday)

This translates to:

“For each line, look up the referrer from the 11th field, take an associative array element by that name and increment it. At the end of the file, loop through the elements in the array, giving their counts and the referrer name, then filter out any refs from my own site and sort all of this by referrer.”

This is great – does just what I want. But then I have to cut and paste from the commandline to follow those links.

So I wrapped it all in PHP:

(update: added unset($a) to clear array between days)


<html><head>
<link rel=”stylesheet” href=”styles-site.css” type=”text/css” />
</head><body>
<?php
$logfile = “/path/to/my/access_log”;
$cmd = “awk ‘{a[$11]++}END{for(e in a)print a[e] ” ” e}’ $logfile | grep -v blogchat.com | sort +1″;
print “<h4>Today:</h4>\n”;
exec( $cmd, $a, $ret );
for( $i=0; $i < count($a); $i++ ){
   print ereg_replace(“(“.*”)”,”<a target=”_blank” href=\1>\1</a>”, $a[$i]) . “<br />\n”;
}
unset($a);
$logfile = “/path/to/my/access_log.1”;
$cmd = “awk ‘{a[$11]++}END{for(e in a)print a[e] ” ” e}’ $logfile | grep -v blogchat.com | sort +1″;
print “<h4>Yesterday:</h4>\n”;
exec( $cmd, $a, $ret );
for( $i=0; $i < count($a); $i++ ){
   print ereg_replace(“(“.*”)”,”<a target=”blank” href=\1>\1</a>”, $a[$i]) . “<br />\n”;
}
?>
</body></html>

Here’s the result.

There’s always a different way to do everything!

h1

the right tool for the job part 2

Tuesday, March 19th, 2002

Have I told you that Netscape 4.x Sucks?

====

Dear Admiral Motor Company;

Why can’t I repair my 2002 Admiral 3-door hatchback with my trusty set of all-imperial measure socket wrenches? My brother has no problem with his newer socket set which includes metric heads. Whenever I try to turn a bolt, it doesn’t quite fit and I get a suboptimal user experience. Why have you started to design your cars so they can’t be repaired by everyone? You could at least only select a subset of nut sizes for your vehicles that closely approximates my socket set.

Signed Joe User

====

Memo from Marketing to Production

Guys, come on, quit being unnecessarily innovative with “standards” and give our customers what they need. Please retool the assembly line to use only those bolts that everyone can turn. Our studies show us that up to 10% of home mechanics and some large shops have resisted the global move to metric tools. We’re losing a significant amount of their valuable business.

====

engineering drawing change summary:

– changed all 20mm bolts to 25mm to approximate 1″. Moved essential parts for extra clearance.
– changed all 10mm bolts to 12mm to approximate 1/2″.
– changed all bolts to titanium alloy to reduce head stripping from poorly fitting socket wrenches.

h1

Switcheroo

Monday, March 18th, 2002

Nice style switching at Liorean’s site and sashadesign.

h1

in the zone

Sunday, March 17th, 2002

Been working hard on a project lately and I’m just rounding the corner into the home stretch. All features in and unit tested, checked in to CVS. System testing to follow. It’s a nice feeling.

I’ve been truly in the zone on this particular project. Nobody could quite understand the intensity if they haven’t been through it.

It’s like carving. I’ve been told that to carve a bear, you take a block of wood and cut away all the bits that don’t look like a bear. When you’re in the zone, you instinctively know where you’re going, which bits to whittle.

If I stand back and look at its beginnings and where it is now, I find it difficult to comprehend the complexities, but when you’re sculpting in the zone, the shavings just fly.

h1

Rants might actually work sometimes

Thursday, March 14th, 2002

March 11th, 2002. Javascript errors. Always. Continuously. For weeks and weeks. No sign of abatement.

March 14th, 2002 No Javascript errors. Fixed. Done. Old news.

Coincidence? We may never know.

h1

the right tool for the job

Wednesday, March 13th, 2002

Dougal is looking for Netscape 4.x Sucks articles.

=====

Dear FM100.2;

Why can’t I hear your radio station in full hi-fidelity stereo on my monaural transistor radio? It works fine when I use my home stereo system. Why do you design your radio station to only support certain radios? My AM radio in my car doesn’t even get your station. You could at least design it to degrade gracefully.

Signed Joe User

=====

Memo from Marketing to Tech Staff:

Guys, come on, stop being prima donnas and give our customers what they need. Our stats show us that a full 8% of our audience tries to tune us in on AM radios. I don’t care how, you have to provide them with the SAME experience as other users. Everyone must have exactly the same experience or you’ll ruin our branding initiative.

=====

v 1.1 Release Notes:

– reduced audio to 16khzmono to unify experience across platforms
– put hooks in to accomodate split AM/FM transmission in future
– scrapped plans for digital station id – not cross-radio compatible.

h1

fab cross-browser dhtml api

Wednesday, March 13th, 2002

The TechnoMagician pointed me to cross-browser.com, where Mike Foster has a killer dhtml api happening. Very nice indeed.

h1

Remarkably out of touch

Monday, March 11th, 2002

What the freakin goddam hell is up with the twats at siliconvalley.com who after *at least* a goddam month STILL haven’t got Dan Gillmor’s pages coming up without this error:

Doorknob alert: this is just a picture of an error!!!

the error on Dan Gillmor's page

I saw it the FIRST DAY. I opened my debugger and found the problem with the function initMenus() apparently not being defined before it is called.

error2.png

I could have told them right away, told them EXACTLY what the problem was (as could anybody with just a smidgen of javascript experience), but NOOOOO, I figured I’d cut them some slack and let them get their kinks figured out. Well, it ain’t happenin’.

As Ace Ventura would say: “Loo-Hoo…Ze-Herrs!!!” Tech credibility down the shitter.

Oh yeah, send me a comment, and when I’ve decided to stop sitting on the fence and take a definite side on this issue, I’ll notify you right away.