Javascript

  • Jul 20 2008 - Networks, Assignment 1 ...

    I just finished my first assignment in a beginning networking course I’m taking and I am so far pretty impressed with how interesting this stuff is. I have a working knowledge of networking that includes decent understanding of the application layer, high level knowledge of the transport layer and basically just awareness of the link layer. It’s pretty rare that in my position as a developer that I need to answer questions about the link layer. (thank you my friends in IT)

    Some of the questions are actually kind of fun in that they had me visualizing data flowing through networks in ways I had not before. For example given a link between two hosts X km apart, with a transmission rate of R and a propagation delay of N….

          2.4.d What is the width (in meters) of a bit in the link? Is it longer than a football field?

    Kind of useless, but super fascinating at the same time, imagining the physical manifestation of all this work I do day in and day out. Pulling these bits from all over the world is so effortless, so fast and so transparent that it’s easy to forget the actual resources behind it.

    The football field question actually relates to a pretty interesting concept called bandwidth-delay, which refers to the amount of data that exists “on the wire” or “on the air” at any given moment. Data that has been sent but not yet acknowledged. It’s helpful in determining minimum buffer sizes for receivers and transmitters over a given link.

    http://en.wikipedia.org/wiki/Bandwidth-delay_product

    Another element to this first assignment was to setup apache as a proxy server on your local machine which was a bit surprising. I assumed at first that the assignment meant squid, but no, apparently apache itself can be configured to be a proxy server for a number of protocols including both ftp and http traffic.There are numerous articles out there on using it as a personal ad blocker, or caching server.

    For reference this is what I had to do to Httpd.conf to make it work :

    LoadModule disk_cache_module modules/mod_disk_cache.so
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so

    <IfModule mod_proxy.c>
    ProxyRequests On
    <Proxy *>
    Order deny,allow
    Deny from all
    Allow from 10.0.1.2/255.255.255.0
    </Proxy>
    </IfModule>

    <IfModule mod_disk_cache.c>
    CacheRoot “c:\apachecache"
    CacheDirLevels 5
    CacheDirLength 3
    </IfModule>
    Interestingly if you get that configuration wrong, you actually get a big “It Works!” page shown in your browser for any page you try to visit. Go figure. My mistake at that point was just not having uncommented the right modules, so apache was just serving the It Works page rather than attempting to proxy my request. 

  • May 13 2008 - Javascript session hacking ...
    I had to blog this, and yeah I'm going to be the billionth person to do so, but that's ok because no one reads my blog and it's basically just my personal public archive. (ppa?) 

    This guy http://www.thomasfrank.se/sessionvars.html has managed to find a very clever place to store data within the browser without resorting to cookies, flash or anything beyond basic cross browser javascript. Apparently "window.name" which lost it's usefulness when the spammers started making popups obsolete can contain arbitrarily long strings that persist as long as that window is open (equivalent to a session cookie) 

    This is damn cool, and while a part of me twinges at the hack-ish nature of overloading a window property with a bunch of json strings, well this is javascript we're talking about here so what the hell.  You're already standing out in the rain trying to build a fire with soggy sticks and no pants so why not use what you've been given. 

    This is just one of those things I know I'll want to come back to one day for one of my pet projects so I thought I'd blog it.