Recently in Web Development Category

I want to keep the comments open on this blog, but I keep getting hit with tons of comment spam, particularly from China. has an excellent list of Chinese IP blocks at  The following script reads the data file and formats the CIDR's into .htaccess "deny from" format.  The output can be pasted into your .htacces file.  You do need to have an "order allow, deny" at the start and "allow from all" at the end!
I recently put up a copy of our main site,, on a new server for test purposes and pointed at it.  I didn't want Google (or anyone else) to see all of duplicate content, so I put some basic HTTP Authentication on it, using the .htaccess file:
Figuring this out was somewhat painful, so I thought I would blog it.

I want to use the same form yaml for several different actions (update, create, view) andI had a list of field names I wanted to remove that were not relevant for create.

The remove_element method only works on the immediate children of the invoking object (as does get element), so $form->remove_element does not usually work.  I found a posting on the HTML::FormFu list where Carl Franks showed the idiom $element->parent->remove_element($element);

So my code became:

# remove fields not needed for this action
for (qw(created_by created_time changed_by changed_time version)) {
	my $element = $form->get_all_element({name => $_});
	if ($element) {

Works great!

Firefox FOUC fixed

| No Comments
Had a nasty FOUC (flash of unstyled content) on one of our websites.  It was real bad in Firefox, didn't check it in IE. 

The page loads a fairly small amount of CSS (28k) in the head.  No scripts though.  Our main site does not have this problem, and it has a small script in the head (to prevent external framing), so I added that but no difference.

The main site also has a scipt at the top of the body to pre-load the "Cool DHTML Tooltip" from  Adding that script fixed the FOUC:

<div id="dhtmltooltip"></div>
<script type="text/javascript" src="js/tooltip.js"></script>

Now there is a blank screen for a while, then the formatted page loads.  I guess the script stops the rendering from starting too fast.  I don't actually use the tooltip script on this site, but it is only 4k.

About this Archive

This page is an archive of recent entries in the Web Development category.

Tools is the previous category.

Find recent content on the main index or look in the archives to find all content.


OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.38