Web

When to use JPEG, when to use PNG

November 12, 2008 Web 1 comment

Too often I see web graphics that have been saved as JPEGs, not PNGs, and I cringe. How can I tell? This comic shows the difference.

How to write a simple database-backed website with Perl modules Mason and Class::DBI

May 16, 2008 Databases, Web No comments

Alfie John over at rental-property.co.nz wrote to tell that the source code for the entire site, written using Mason and Class::DBI, is available for download.

For someone wanting to see an overview of how either Mason or Class::DBI work with real-world examples, not just samples from documentation, this is a great place to start.

Google now returns code snippets

March 31, 2008 Documentation, Web 2 comments

Google’s main search screen now returns code snippets in its list of results. This is not just in code.google.com any more.


I needed to find the docs for the PHP function ftp_connect, so searched Google for it. (I could have gone to php.net and searched there, but why?)
The list of results has three hits to PHP manual pages, and the fourth and fifth are bits of code that use ftp_connect. Anyone know if they’re getting Perl stuff in there as well? I tried it with WWW::Mechanize, but couldn’t turn up hits.

Simple Apache/FastCGI/Catalyst configuration

December 7, 2007 Web 4 comments

Leon Brocard posted this minimalist Apache configuration that covers Catalyst and FastCGI.

I keep seeing more people not using mod_perl. Leon calls mod_perl “very bloated.” Thoughts?

Who’s making bogus web requests?

November 28, 2007 Data munging, Web 1 comment

Yesterday I noticed in my Apache access log a lot of 404s that looked like this:

aaa.xx.65.186 - - [25/Jul/2007:05:55:05 -0500] "GET http://www.some-advertising-site.com/banner/digits HTTP/1.1" 404 305 "http://some-different-website.com/" "legitimate-looking agent"

Not only am I not hosting banner ads, the GET request is invalid. It should be GET /banner/digits..., without the scheme and hostname part of it. I wondered how many I had of these, and how many hits I was getting. A Perl one-liner to the rescue!

perl -MData::Dumper -nae'++$n{$F[0]} if /GET http/; 
END{print Dumper%n}' access.log
$VAR1 = {
'aaa.xx.65.186' => 132, # Real IPs obscured
'bb.yyy.7.60' => 48,
'ccc.zzz.46.147' => 111,
'dd.qq.71.82' => 33
};

So it looked like I was getting hit by a couple of 0wnz0red boxes with some sort of virus on them. I added them to my iptables DROP list and was done with it.