A Map of Visitors: Mostly from Reddit

Here are the statistics I gathered from Google Analytics about who visits Codexon. After a month of using it, this website has received more than 52,000 hits. Unfortunately I could only take screen shots because there seems to be no way of sharing the interactive map.

About 78.5% of the visitors are from Reddit and 7.78% from Hacker News.

World Heat Map

World Heat Map

Read the rest of this entry »

Leave a Comment


A Convenient Paradox

An Inconvenient Truth is a documentary by Al Gore about global warming. I just wanted to share an amusing thought.

…the Great Lakes are the remnants of that huge lake… one day it broke, and all that fresh water came rushing out, ripping open the St. Lawrence there, and it diluted the salty dense cold water, made it fresher and lighter so it stopped sinking, and that pump shut off.

thermohaline

The North Atlantic Heat Pump

And Europe went back into an ice age for another 900 to 1000 years… Now, of course, that’s not going to happen again because the glaciers of North America are not there… Is there any other big chunk of ice anywhere near there?  Oh, yeah [camera pans over to Iceland].

So I suppose this means that global warming will turn off the heat pump (which caused an Ice Age) and will cancel each other out?

Leave a Comment


Finding the Current Address in a C Program

Let’s say for some reason you don’t have a disassembler and you wanted to find the address of a place in your program. This is useful for things like finding out how the size of a function, stack, or some code.

There are many ways to do this.

Probably the easiest way is to use GCC, a free compiler.

int main()
{
    int c;
 
    here:
    c = 5;
 
    printf("Address: %p", **here);
    return 0;
}

Read the rest of this entry »

Leave a Comment


Debunking Google’s Internet Optimization Tips

Google recently published a website called Let’s make the web faster.

Aimed mostly at newbies, they have a few tips that made people cringe despite having Google’s Seal of Approval. We will look at some of these optimizations and see if they really help.

spoiler

Micro-optimization

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. – C.A.R. Hoare

Read the rest of this entry »

21 Comments


Tips for Monitoring PHP

Just a couple hours ago, you may have noticed that this website was showing blank pages.

For some reason, PHP decided to stop working. Every PHP page was blank. I simply restarted it, and it worked again.

Unfortunately the error-logs are disabled for PHP in the default “production site” configuration. So be sure to enable that option.

Another option is to use Monit to monitor whenever PHP stops working. The trick is to use the “checksum” option:

[Usual monit php configuration here]
  if failed host www.codexon.com port 80
    protocol http and request "/monit.php"
      with checksum 5eb63bbbe01eeed093cb22bb8f5acdc3
      then restart

Where checksum is the MD5 value of the file. Then we create monit.php.

<?php
echo "hello world";
?>

So whenever PHP starts choking and serving blank pages, Monit will restart your PHP for you.

For those interested, this is the PHP I am running. All of which are from the Ubuntu 9.04 repository.

PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli)
(built: Apr 23 2009 14:37:14)

APC 3.0.19-2

Leave a Comment