// 07.Feb.2010

PHP Caching to Speed up Dynamically Generated Sites


// 06.Feb.2010

WordPress, Caching and index.html

I became aware of an annoying little glitch on the Urban Mainframe yesterday. It seems that WordPress, on which this site is running, doesn’t handle the URL http://example.com/index.html on an unmodified install (I’ve confirmed this on a handful of other WordPress sites). This is significant because index.html is a special file on many web-servers, often being the “home” page of a directory on the server. Without special handling, a request for index.html on a WordPress installation generates a 404 (file not found) error — which is obviously something we don’t want our visitors to be presented with.

In my case the impact of the glitch was magnified because I employ a quite aggressive caching policy on this website — and yesterday an unlikely combination of factors resulted in my 404 error page replacing my home page for a complete cache cycle. It went something like this:

  • cached “home” page expires
  • next “home” page request is for http://urbanmainframe.com/index.html
  • index.html file request results in a 404 error
  • 404 error page is cached
  • all subsequent requests for http://urbanmainframe.com/ — and other “home” page URLs — return the cached 404 error page until the cache is next invalidated

Quite a serious glitch then!

There are two things that shouldn’t have happened here.

  1. Requests for index.html should not result in 404 errors.
  2. Error pages should never be cached.

I resolved the first issue by adding the following snippet of code to the very beginning of the 404.php file in my WordPress theme:

<?php
if ($_SERVER['REQUEST_URI'] == '/index.html') { header("Location: http://urbanmainframe.com/"); exit; }
?>

For the second issue I’ve filed a bug report with the authors of W3 Total Cache, which is the caching system I use here on the Urban Mainframe.


// 29.Jan.2010

Kernel Level Root-kit

When do I get crazy-assed bikini models with sexual addiction issues lurking in the bushes? I think I could handle that. Instead, I get this tripe.

Hilarious mailing list exchange in which John C. Welch, who suffers no fools, goes from being helper to stalker in just four moves. Keep reading into the comments to see the inevitable appearance of a lawyer-wannabe (and his subsequent about-face). A must read.


// 29.Jan.2010

Confessions of an Introverted Traveller

Sophia Dembling has a different style of travelling, and she’s tired of hiding it:

Introversion and extroversion are inborn traits, and the difference between them is not that one is gregarious and at ease in the world and the other shy and awkward. Rather, extroverts are outwardly motivated and gain energy from interaction with the outside world while introverts are more inwardly directed and drained by interaction with others. Introverts’ thinking tends to be deep and slow, we require copious time alone, we prefer probing conversation to shallow chitchat, and our social lives are geared more towards intimate one-on-one interactions than “more the merrier” free-for-alls.


// 27.Jan.2010

Unify: A Fantasy Fulfilled

Ever since I first started making web pages, I wanted a CMS that would allow me to make content updates by simply going to my website and changing the content right on the page. My fantasy was that this system did not require me to know any programming language or tagging system beyond HTML and CSS and it didn’t require me to play with a database. In my fantasy, the system took minutes to implement and my clients could use it as easily as I could.


// 27.Jan.2010

Unix Turns 40: The Past, Present and Future of a Revolutionary OS

After four decades, the future of the operating system is clouded, but its legacy will endure.

Regardless of the ultimate fate of Unix, the operating system born at Bell Labs 40 years ago has established a legacy likely to endure for decades more. It can claim parentage of a long list of popular software, including the Unix offerings of IBM, HP and Sun, Apple’s Mac OS X and Linux. It has also influenced systems with few direct roots in Unix, such as Microsoft’s Windows NT and the IBM and Microsoft versions of DOS.

The [Association for Computing Machinery] may have said it best in its 1983 Turing award citation in honor of Thompson and Ritchie’s Unix work: “The genius of the Unix system is its framework, which enables programmers to stand on the work of others.”


// 27.Jan.2010

Monitor Applications, Processes and Files in OS X with opensnoop

Using the command line tool opensnoop you can track any Mac application’s (or system process’) usage of the file system. This is a very handy tool for administrators and troubleshooting! The simplest way to use it is as follows:

sudo opensnoop -n Safari

You can also track a specific file, and what is accessing it, like so:

sudo opensnoop -f /etc/hosts

Tracking a specific process is as simple as just specifying the process id:

sudo opensnoop -p PID

opensnoop will keep tracking the file until the process itself is ended, so just hit Control-C in the Terminal to stop opensnoop from running. In case you’re wondering, opensnoop is based on DTrace, a popular UNIX tool.

[via]


// 27.Jan.2010

Awesome Studio Demo Reels

These stunning demo reels from Stargate Studios provide a little insight TV/movie production:


// 27.Jan.2010

Using LaTeXiT to Display Math Formulas

Would Will Hunting use OS X? He might now:

TeX is a typesetting standard that, among other things, allows you to typeset complex math formulas. One flavour of Tex is LaTeX, for which LaTeXiT serves as a front-end on Mac OS X. Using LaTeXiT, one can drag and drop complex math formulas to a number of apps — Pages, Keynote and TextEdit, to name a few.


// 26.Jan.2010

Hiding Files and Folders in OS X

In OS X any file or folder whose name is prefixed with a period is automatically invisible to the Finder and Terminal unless specifically requested.

Sometimes though, one might want to hide a file (or folder) without changing its name. Fortunately OS X provides a means to do this too. In the Terminal the command:

chflags hidden /path/to/my_secrets.txt

will hide my_secrets.txt from the Finder (but not the Terminal). The following command will reverse the action:

chflags nohidden /path/to/my_secrets.txt

Note that while the file is hidden from the Finder it is still accessible to the OS.