Early Performance Benchmarking is a Disease

Benchmarking and performance concerns should be one of the last things you address while building your application, but it seems as though, in the PHP community especially, it’s often one of the first things novice developers think about.

Any PHP developer who’s been in the community for a while has heard preposterous claims like “use single quotes (‘) for strings instead of double quotes (“), because it’s faster”. That is, faster over the 100,000 or so iterations it took the tester to generate a number sufficiently large enough to justify the claim, with a particular version of PHP, in a particular development environment in which it was tested.

Continue reading

Reading a FeedBurner Feed with PHP and cURL

Just thought I’d post a quick HOW-TO article on how to get the contents of a FeedBurner feed with PHP, because it’s something I was attempting to do last night that really annoyed me. Since I started this blog here, I decided to narrow another website of mine – czaries.net – to just distribute some PHP scripts I’ve made and take down the news that was there. I replaced it with a short paragraph explanation and a feed of the recent blog posts here. The problem was, the feed wasn’t displaying, and I couldn’t figure out why.

Continue reading

Building a Better Woot! Checker: Comparison is Key

The famous “one item per day” e-commerce store Woot! periodically holds a “woot-off”, where multiple different items are sold in quick succession, each item appearing as soon as the previous one sells out completely. The quick succession of potentially interesting items selling for steep discounts has created a proliferation of scripts and programs called “Woot checkers”, and has even lead to the creation of an official list of Woot-off checkers. All of this because of the potential of missing out on the opportunity to buy something great and get a great deal on it.

Continue reading

Fixing IE7 Z-Index Issues with jQuery

For some reason, Internet Explorer 7 does some pretty funky things, and has several known bugs with it’s rendering engine that drive web developers like me crazy.  While most of the known bugs occur in relatively obscure situations and go largely unnoticed, there are a few that really stick out and cause web developers to waste many hours trying to fix them.  The way IE7 renders z-index stacking orders is one of them.

One way to fix many of the issues with IE7 is to dynamically reverse the default z-index stacking order of the elements on your page. This will ensure the elements higher in your HTML source will also have a higher z-index order on your page, solving most of the IE stacking issues. more If you’re using jQuery (the best Javascript library there is), here’s the quick fix:

$(function() {
     var zIndexNumber = 1000;
     $('div').each(function() {
         $(this).css('zIndex', zIndexNumber);
         zIndexNumber -= 10;
     });
});

This code will start with a z-index of 1000, and decrement the z-index for each DIV element of the page by 10, giving the first DIV a z-index of 1000, the second, 990, the third 980, and so on. Notice that the selector will find all DIV elements with the code “$(‘div’)”, using the same syntax as CSS selectors. If your HTML code has different requirements, feel free to change the code or the selector to suit your needs by following jQuery’s documentation on selectors.

Update for MooTools

(04/14/2009):

A generous commenter has posted the code for fixing z-index issues with MooTools 1.2:

if (Browser.Engine.trident){
     var zIndexNumber = 1000;
     $$('div').each(function(el,i){
         el.setStyle('z-index',zIndexNumber);
         zIndexNumber -= 10;
     });
};