Archive for November, 2007

MacOSX, VMWare Fusion and PKR… it works!

Monday, November 12th, 2007

UPDATE: I've created a short video to help people with settings for VMWare, DX and PKR.
View the new post here

At long, long, last, with the new VMWare Fusion 1.1 PKR works on my MacPro if I run it in 'min spec' mode (launch it from the start menu). It runs fairly well on my 3.0GHz Mac Pro. I only give one core to VMWare. I didn't stay for long because to be honest I've gone off poker. It even runs in Unity mode so it's doesn't look quite so windows and crap.

Pkr

Congrats to the VMWare guys and I guess congrats to the PKR Guys, maybe they should be offering cash players free copies of VMWare fusion.

MacOSX: Flushing the DNS Cache

Wednesday, November 7th, 2007

Just a quick note: flushing the DNS cache on OSX used to be:

 
    lookupd -flushcache
 

but on Leopard (OSX 10.5) its

 
    dscacheutil -flushcache
 

As my ADSL connection goes up and down i find my DNS cache is getting screwed with.

Debugging My ADSL

Saturday, November 3rd, 2007

My ADSL hasn't been perfect at my home for a year or so now. Basically it looses the connection. Sometimes once a week, sometimes it's 4 or five times a day. I've been too lazy to sort it out because it just seemed easier to reboot the modem, wait 30 seconds and carry on with my life. I've had ADSL nightmares before where I spent hours on hold waiting to talk to a support serf and I haven't been keen to repeat this.

A friend of mine coincidentally asked me if I knew anything about a provider he was thinking of joining. He started to bemoan his provider and the ancient wiring in his london flat. So I replied and tried not to think about my problems. As often happens I couldn't stop thinking of my own problems! I stumbled upon RouterStats. It's a cool little win32 app that basically knows how to read you routers stats page and display a little graph. I ran it on my mac using VMWare Fusion and sure enough it showed my modems 'noise ratio' getting lower and lower toward the magic 6db mark where most routers just give up and drop their ADSL connection.

A this point I decided that I couldn't be bothered to run this App (and a resident copy of windows JUST so I could look at my router stats. So I turned to python to scrape my router page

 
#script to scrape the stats from a Netgear DG834GT
import urllib2
import re
from BeautifulSoup import BeautifulSoup
from time import sleep
from datetime import datetime
 
base_path="http://192.168.1.1/"
monitor_page='stattbl.htm'
username='admin'
password = 'password'
top_level_url = base_path
 
#register an opener with urllib2 which knows how to respond to basic
#authentication requests from a webserver
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(None, top_level_url, username, password)
handler = urllib2.HTTPBasicAuthHandler(password_mgr)
opener = urllib2.build_opener(handler)
urllib2.install_opener(opener)
 
#re to extract the number section from a string in the form xxx.xx db
dbre=re.compile(r"(?P<num>[\d\.]+)\s*db")
 
#for ever, ask for the stats page, extract the data and print it,
#it's  not pretty code but I am scraping a bloody router stats
#page so WHO CARES
while True:
    response = urllib2.urlopen(base_path+monitor_page)
    html= response.read()
    soup = BeautifulSoup(html)
    tables= soup.body.table.findAll('table')
    tds = tables[0].findAll('td')
 
    tx = tds[13].span.contents[0]
    rx = tds[14].span.contents[0]
 
    def extract(node):
        s  =dbre.match(node).group('num')
        return float(s)
 
    tds = tables[1].findAll('td')
    att_down = extract(tds[7].span.contents[0])
    att_up = extract(tds[8].span.contents[0])
 
    nm_down = extract(tds[10].span.contents[0])
    nm_up = extract(tds[11].span.contents[0])
 
    now = datetime.now()
    print now.strftime("%H:%M:%S"), "atd:", att_down, "atu:",\
        att_up, "nd:", nm_down, "nu:", nm_up, "rx:", rx, "tx:", tx
    sleep(5)
 

Every five seconds this prints out the stats for my router

13:44:18 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10138 tx: 4138
13:44:23 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10138 tx: 4138
13:44:29 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10137 tx: 4138
13:44:34 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10136 tx: 4137
13:44:39 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10135 tx: 4137
13:44:44 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10135 tx: 4137
13:44:50 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10134 tx: 4136
13:44:55 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10133 tx: 4136
13:45:00 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10132 tx: 4136
13:45:05 atd: 21.0 atu: 22.0 nd: 13.0 nu: 26.0 rx: 10131 tx: 4135

Well I left this running and guess what? When the phone rang my noise ratio dropped... and if it was already low my router dropped the connection. If I even picked up my phone the noise ratio dropped. After poking around with the wiring it turns out one of the phones in the house didn't have an ADSL filter so it was spewing noise on to the telephone line in the frequency range ADSL uses! Doh. Without the filter my best noise ratio was 9db, with the filter it never drops below 12db.