Archive Page 6

Chrome OS vs Android for Tablets

Android’s strength is cellular voice and data transfer and its low power consumption while Chrome OS has better support for various hardware architectures, and they are both based on the Linux kernel.

If you were to build a tablet that has a touch screen not bigger than 9 inches and a modern browser as its only application, GSM + data connection, instant startup and a batter life of 12 hours, which OS would you choose?

I can’t understand why Google needs Chrome OS. Is it only for devices that don’t have touchscreens?

Use AJAX for Cache Invalidation

Let’s have a site wide version number that is changed every time something is updated and cache needs to be invalidated. This number is stored in a simple text file. Cache keys are made up of Request-URI and this unique key, which is passed around in a cookie VERSION_NO.

On every page request javascript calls version.php?timestamp (which is never cached because of the timestamp), which using stat() reads the last modified timestamp of that text file and compares it to the value of VERSION_NO cookie. If they are different, a new cookie value is set, which in turn changes the cache key for all future requests, and the cache is invalidated.

The only thing I don’t know is how fast and resource hungry is the stat() call?

Update: or would it be better to use filemtime()? There is a comment which says that 1000 filemtime() calls take 0.0049 seconds, which I think is very reasonable.

Regarding the ‘Like’Button

You can like something and there is nothing you have to do about it. It is an effortless act and there are no explanations required or expected. And people actually don’t care for what you like. They are interested in what you care for, because caring isn’t pointless, it means you take a stand.

PHP APC Potential Cache Slam Averted for Key

APC opcode cache TTL lockup

APC opcode cache TTL lockup (via t3.dotgnu.info)

This server uses PHP 5.3 with PHP-FPM (FastCGI Process Manager) patch and APC opcode cache. Several minutes after activating APC, I noticed that some pages stopped loading. Turns out it was because of an APC timebomb bug which is when all cache writes got locked because of expiring cache entries and new writes happening at the same time. The temporary solution is to add apc.slam_defense = 0 and apc.write_lock = 1 in php.ini.

Moving Away from MediaTemple

Excuse the mess while I’m moving away from MediaTemple. It feels so good to be home in Latvia on a speedy VPS.

There is a handy little WordPress feature that I had not used before:

define('RELOCATE', true);

which allows you to set up a temporary domain name while your new name server records are spreading across the internets. For example, if you changed the NS record for example.com, you could use new.otherdomain.com to access the site you’re moving. Normally WordPress would try to redirect you to example.com (which is it’s site_url).

Coincidence

[Y]ou can’t ascribe great cosmic significance to a simple earthly event. Coincidence — that’s all anything ever is. Nothing more than coincidence. [...] There are no miracles. There is no such thing as fate. Nothing is meant to be.

(500) Days of Summer