If you are looking for the epic motorcycle journey blog that I've written, please see the Miles By Motorcycle site I put together. 
  • Subscribe to this RSS Feed
  • Character Encodings
    07/09/2009 1:25PM

    Here is an EXCELLENT article in the HTMLPurifier documentation on character encodings.

     And I guess it was just a matter of time before I too linked to an article over at Joel on Software.

  • MSIE "Operation Aborted" issues
    05/18/2009 5:22PM

    While testing the latest codebase we've once again run into the infamous MSIE Operation Aborted error. 

     Here's an article that discusses the issue in some depth:

    IE and Operation Aborted

    MSDN Knowledgebase Article

    MSIE IE Blog article

    Interesting the same codebase running on a non-SSL enabled site is not exhibiting this problem for me.More as I find out more.

  • New Flu Stain Discovered
    04/25/2009 2:17PM

    As reported on Slashdot:

    Combat Wombat writes with this excerpt from Reuters: "A strain of flu never seen before has killed up to 60 people in Mexico and also appeared in the United States, where eight people were infected but recovered, health officials said on Friday. Mexico's government said at least 20 people have died of the flu and it may also be responsible for 40 other deaths. [The government] shut down schools and canceled major public events in Mexico City to try to prevent more deaths in the sprawling, overcrowded capital. ... Close analysis showed the disease is a mixture of swine, human and avian viruses, according to the CDC. Humans can occasionally catch swine flu from pigs but rarely have they been known to pass it on to other people. Mexico reported 1,004 suspected cases of the new virus, including four possible cases in Mexicali on the border with California.

    See the slashdot article.

  • PHP Leaks Memory in socket_read()
    04/13/2009 1:51PM

    This has taken quite some time to track down. Ref this bug report over at bugs.php:

    http://bugs.php.net/bug.php?id=42846

    Personally from what I'm seeing, the comment in the report that this is just how PHP memory management works is incorrect. Calls to socket_read() in PHP 5.2.6 under Ubuntu 8.10 causes the process to grow without bounds.

    Here is a slightly modified sample client and server pulled from the PHP documentation socket examples page::

    The server code:

    <?php
    error_reporting(E_ALL);
    
    /* Allow the script to hang around waiting for connections. */
    set_time_limit(0);
    
    /* Turn on implicit output flushing so we see what we're getting
     * as it comes in. */
    ob_implicit_flush();
    
    $address = '127.0.0.1';
    $port = 10000;
    
    if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
        echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
    }
    
    if (socket_bind($sock, $address, $port) === false) {
        echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
    }
    
    if (socket_listen($sock, 5) === false) {
        echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
    }
    
    do {
        if (($msgsock = socket_accept($sock)) === false) {
            echo "socket_accept() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
            break;
        }
    
        do {
    
    	 	print( "MEMORY USAGE BEFORE READ IS '" . memory_get_usage() . "'\n" );
    
            if (false === ($buf = socket_read($msgsock, 2048, PHP_NORMAL_READ))) {
                echo "socket_read() failed: reason: " . socket_strerror(socket_last_error($msgsock)) . "\n";
                break 2;
            }
    
      	 	print( "MEMORY USAGE AFTER READ IS '" . memory_get_usage() . "'\n" );
    
        } while (true);
    
        socket_close($msgsock);
    
    } while (true);
    
    socket_close($sock);
    
    ?>
    
    

    The client code:

    <?php
    error_reporting(E_ALL);
      echo "<h2>TCP/IP Connection</h2>\n";
      /* Get the port for the WWW service. */
    $service_port = 10000;
      /* Get the IP address for the target host. */
    $address = gethostbyname('localhost');
      /* Create a TCP/IP socket. */
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    if ($socket === false) {
        echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
    } else {
        echo "OK.\n";
    }
      echo "Attempting to connect to '$address' on port '$service_port'...";
    $result = socket_connect($socket, $address, $service_port);
    if ($result === false) {
        echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
    } else {
        echo "OK.\n";
    }
      while( true )
        {
          echo "Sending Hello";
          $in = "hello\n";
          socket_write($socket, $in, strlen($in));
        echo "OK.\n";
          sleep( 1 );
        }
      echo "Closing socket...";
    socket_close($socket);
    echo "OK.\n\n";
    ?>

    Running it:

     Running it will produce a constantly growing server process.

     MEMORY USAGE BEFORE READ IS '61324'
    MEMORY USAGE AFTER READ IS '61728'
    MEMORY USAGE BEFORE READ IS '61788'
    MEMORY USAGE AFTER READ IS '61924'
    MEMORY USAGE BEFORE READ IS '61924'
    MEMORY USAGE AFTER READ IS '61956'
    MEMORY USAGE BEFORE READ IS '61956'
    MEMORY USAGE AFTER READ IS '61988'
    MEMORY USAGE BEFORE READ IS '61988'
    MEMORY USAGE AFTER READ IS '62020'

  • How To Opt Out Of Verizon Info Sharing
    03/09/2009 8:50AM
    If you don't want Verizon to start sharing various bits of your personal info with "affililiates, agents, or parent companies", you must notify them within 45 days. Further details can be had here.