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
  • Nasty FireFox "bug" - empty img src= loads current URL.
    10/08/2008 7:41PM
    2008-10-15 Update:

    Unfortunately, it looks like MSIE 6, and possibly others, do not reliably set the HTTP_ACCEPT header to reflect the content type being requested. Often MSIE will send a */*.

    So at the present moment it's not clear to me how one can recognize a request on the server which resulted from an img src="" line.

    It looks like this is a known problem but no good solutions are provided for cases of user contributed content:

    http://brian.pontarelli.com/2006/05/02/is-your-browser-requesting-a-page-twice

    There are a couple of hacks one could try such as using javascript to loop through the page looking for empty image tags or maybe doing some in-line filter operation on the server to check for the same. Apparently this double request behavior is actually according to the standard and it occurs in some form or another in many browsers. Extremely annoying.



    Unfortunately this does not work for MSIE:

    Let's say you have a simple PHP script on a page such as:

    <?php

    if ( @$_SESSION["counter"] == NULL )
       $_SESSION[ "counter" ] = 1;
    else
       $_SESSION["counter"] += 1;

    print ("<h1>Counter is currently " . $_SESSION["counter"] . "</h1>" );
    ?>

    You would expect that counter would increment by 1 on each subsequent page load.

    HOWEVER, a case can arise where you notice the session counter increasing by more than one on each page load under FireFox but not under MSIE. This occurs, as was the case in some code I was working on today, when you have an empty <img src=""> in your document somewhere.

    In this case, FireFox will attempt to pull whatever the current page is as the source for the image, which will load your PHP script page and increment the counter "in the background".

    MSIE will attempt to load the default directory index of the current directory as opposed to attempting to load the current page which is why this issue is typically not visible under MSIE.

    In the static content case this is not much of a problem as you just have to make sure all of your references back to the server are correct. However, in the case of dynamically generated content and content provided by endusers you are much more likely to run into this situation.

    To guard against this case you can check the HTTP_ACCEPT request header before manipulating your session. This works in Firefox but not MSIE, unfortunately. I have not come up with nor found a good cross browser solution.

    if (( @$_SERVER[ "HTTP_ACCEPT" ] != NULL ) &&
       ( preg_match( "/^.*image.*$/", $_SERVER[ "HTTP_ACCEPT" ] )))
      {
      die();
      }


  • Kubuntu Linux Hardy Heron 8.0.4 Shift Key problem
    09/28/2008 6:09PM
    I'm running the Kubuntu Gutsy Gibbon linux distribution. Randomly, the SHIFT key will stop functioning. It seems to somehow be related to running VMWare Workstation and switching screens. It's a known bug listed here:

    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/195982

    Getting your SHIFT key working again does not require a reboot. Simply enter the command

    $ setxkbmap

    in a command window and it'll reset it.

    Update: Rumor has it that upgrading to VMware 6.5 fixes the problem.

  • Biochar-Agrichar: New/Old Technology As A Weapon Against Climate Change
    09/11/2008 9:30AM
    A new take on 2500 year old technology could help make a huge dent in the greenhouse gas problem, while simultaneously improving soils and agricultural output.

    See the video introduction here.
  • Open Source Climate Change Mitigation
    07/21/2008 5:18PM
    Looks like an old idea for fixing excess atmospheric CO2 levels is gaining new life, and may prove to be practical after all: seeding the oceans with treated limestone.

    Supporters claim this approach would not only increase the ocean's ability to absorb CO2, but fix the PH problem (acidification) created by the increased disolved CO2 levels as well.

    Proponents are further claiming that this could realistically drop atmospheric CO2 back to pre-industrial age levels(!). And on top of all that, the project's being run open source style.

    Get the details here.
  • We're now multi-homed running BGP across two T1's
    07/02/2008 6:56PM
    Our network is now multi-homed running BGP across two T1's; one connected to Qwest and another connected to Verizon.

    The Qwest guys absolutely rock. They have been above the call of duty helpful. Tweaking BGP to get it to work right can be an error prone process.