Delivering Pre-Compressed (gzip) Javascript with PHP only

There are plenty of results in Google for delivering compressed Javascript files using PHP.  However, most of those techniques involve compressing the JS file(s) on the fly. I was looking for a method that would meet the following criteria: The JS file should be pre-compressed using gzip. The gzip version of the JS file should only be delivered if the client’s browser supports gzip. The code below has some pitfalls: It will not work with a CDN or any external content server that does not support PHP. It is more difficult to maintain than compressing on the fly at the web server level (as you must maintain the compressed version of the JS file. I’ll use my quick and dirty … Continue reading

Using Postfix with MySQL Stored Procedures? (Just Use Functions)

postfix_random

If you’re like me and want to use Postfix with a MySQL backend, you may have also wanted to be able to call stored procedures from Postfix. Unfortunately, MySQL stored procs return multiple resultsets while Postfix’s call to the MySQL C API can only process a single resultset.  I banged my head against the wall for a while until I realized that a function called from a SELECT statement would return a Postfix-friendly single resultset. For example, this would be a perfectly acceptable virtual alias map file: user = mailreader password = somepassword dbname = mail_config query = SELECT retval FROM (SELECT fnPostfixVirtualAliasMapGet(‘%s’) AS retval) t WHERE t.retval IS NOT NULL; hosts = 127.0.0.1 This is useful if, for example, … Continue reading

Quieting Dell PowerEdge 1855/1955 Blade System Chassis Fan Noise: Undocumented DRAC/MC Commands

fan_speed_hex

TL;DR: Skip right to the undocumented commands Background I recently purchased a Dell BMX blade chassis on eBay that came loaded with ten 2x dual-core, 24GB PE1955 blades.   For a system with 40 cores, 240 GB of RAM and two 16-port gigabit switches in a 7U frame, $2500 was too good to pass up.  Especially since shipping cost me a mere 2 hour round-trip to Brooklyn. I didn’t really need ten more servers, so I figured I’d sell off 5 or 6 of them (hopefully breaking even on the entire system — the 4GB FB-DIMMs in 6 of the servers is worth $1450 – $1900 alone).  The remaining servers would be all mine! But I forgot to research the noise!  … Continue reading

The Mac vs. PC Debate (Makes No Sense, and PCs are Better)

I grew up on the Mac vs. PC debate.  Hell, I before that I grew up on Apples.  But “Mac or PC” was the first decisive computer issue on which I can remember taking a side. The first computer I ever programmed was an Apple IIe.  I guess I’m dating myself here, but at the time that computer was the greatest thing since .. sliced apples?  Not only was I programming on a IIe, but I was programming robots, using a Fischertechnik robotics kit.  (Oh, and I was doing it at summer camp, putting me that much higher in the nerd-hierarchy).  5.25″ floppies, CATALOG, LIST, GOTO 10;  The whole deal. At some point we got our first computer at home:  A 386SX … Continue reading

Basement Update

We’ve been in the house for about 3 months, and I’ve made some progress in the basement. Here are a few pictures just for posterity: The server rack (well, shelving unit) isn’t pretty, but it gets the job done.  I’m not exactly the computer version of Scrooge McDuck over here, so I stick with desktops.  The UPS on the right is a real old beater — I’ve replaced the batteries 3 times so far.  It’s a nice double-conversion full sine wave model, so I keep it around.   My workstation setup.  My primary machine needs upgrading badly:  A Dell GX280, P4 3.0Ghz, 3GB RAM.  It works for now.  All the monitors are hooked up to something or other, but I … Continue reading