Archive for March, 2008

Mar 28 2008

Interesting aspects of Xmonad

Published by Dougal under Computing

Xmonad isn’t really a window manager in the proper sense of the word, in the same way that libogg (the reference Ogg media library) isn’t really a music player. It’s actually an elaborately constructed set of tools for the construction of window managers.

If you want to write a window manager which arranges windows in a clock-shaped pattern on screen, you would do it like this:

module Main where
 
import XMonad
import XMonad.Layout.Circle
 
main = xmonad defaultConfig { layoutHook = Circle }

In short, you import the main window-manipulation tools, then an optional layout, and tie them together in your own program. Xmonad works as a vast library — and what seems like a configuration file at first is in fact the main program. (Configuring the WM is getting people to write Haskell without their knowledge.)

Just as interesting is the problem this raises for on-the-fly configuration. If the program you’re running doesn’t read configuration from a text file to operate, how do you reload when the “configuration” changes?

The problem is made slightly easier by the X windowing system, which doesn’t require a window manager to be operating at all times — only when something changes. So if the window manager “drops the reins” this is no real problem, as long as the horses are not charging towards a ravine. When something else grabs the reins (the same window manager or a different one) the applications are none the wiser.

To restart Xmonad the system recompiles the configuration-file-cum-program and then passes the complete state of the world to this new version. It’s quite weird because when you first run xmonad you just invoke xmonad. But then if you restart and look at all the running processes it seems Xmonad has about three lines of strange configuration. It’s a neat trick. ;-)

One response so far

Mar 28 2008

The real Bullshit Bingo

Published by Dougal under Bad Science, Humour

I took it upon myself, to save you the effort, of collecting together some of the interblag’s lists of common denialist arguments. Feel free to add some more interesting ones in the comments.

  • The best place to start is John Baez’s Crackpot Index, a scoring system to help you decide if someone’s personal system of “advanced”, “revolutionary physics” is merely common-or-garden delusion or something altogether grander.

    Many of the ideas in this list can be easily applied to other pseudosciences. Ben Goldacre recently posted a horrifying “lecture” from a homeopath that invoked Einstein, Hawkings (sic) and so on in the same vein. Only stupider — much much stupider.

  • And on the related topic of science journalism, Black Stacey has a list of Science Story Tropes which crop up all over.

    It’s honestly hard to choose which one I hate the most. The “folk wisdom” stories are probably the most dangerous because people have a hard enough time disbelieving things they’ve “always known” — having distorted scientific evidence just makes things worse.

  • If you’re not sick of people taking liberties with reality and science from that homeopathy video, how about some Creationist Bingo? With a leap and a bound and some long-since refuted talking points you too can call the Earth an even 6000 years old.

  • Last on the list is Global Warming Denial Bingo with a useful set of links to refutations built in. Isn’t modern technology wonderful?

Are there any more good pages of a similar nature? I was surprised not to find a general woo/pseudoscience checklist. Maybe a gap in the market?

3 responses so far

Mar 27 2008

When you send a message, where does it go?

Published by Dougal under Networking

When you send any kind of message on a network it gets shunted from place to place until it finally arrives at its destination, or is discarded. I’ll cover the successful case at some point in future, but for now we can look at why a message (a ‘packet’) might be ‘dropped’.

A network is a series of interconnecting machines which all have a small, possibly erroneous, view of the world. They have an idea of which machine is connected to which other machine but since networks are inherently unreliable this internal map is never accurate for very long.

Occasionally a group of machines will be convinced that someone else in the group is the “next step” when delivering a packet. So A will transmit to B will transmit to C will transmit back to A again. This would ordinarily constitute an infinite loop, where these packets will continue being shunted round forever (or at least until someone accidentally pulls out a power cable and kills one of the machines…).

This can be prevented by giving each packet a “lifetime”, known as its Time To Live (TTL). Rather than being measured in seconds the TTL is measured in hops — whenever it is transmitted from one machine to another this number is decremented. If a machine receives a packet which has a TTL of zero, but that machine is not the ultimate destination, then the packet is discarded. This prevents immortal packets from roaming the network forever, undelivered and lost.

The TTL also gives us a nifty tool to find out where packets are disappearing. When a router discards a packet for being too old, it’s supposed to send back a message saying what happened (ie, “too old”) and who discarded it. A packet with a TTL of zero should be discarded at the first machine it meets; a packet with TTL of one at the second machine; and so on down the line. So we can send out little packets with gradually increasing TTLs to see where they go.

This is an example: me tracing the hops to reach www.google.com. The first line is the default gateway for my ISP, which all our home traffic goes through, and the last line is a machine belonging to Google.

dougal@cuttlefish ~ $ traceroute www.google.com
traceroute to www.google.com (64.233.183.104), 30 hops max, 40 byte packets
 1  10.123.104.1 (10.123.104.1)  18.965 ms  19.484 ms  20.071 ms
 2  77-96-1-2.cable.ubr01.azte.blueyonder.co.uk (77.96.1.2)  20.959 ms  21.532 ms  22.123 ms
 3  * * *
 4  pop-bb-a-so-300-0.inet.ntl.com (213.105.175.130)  126.573 ms  127.143 ms  130.025 ms
 5  pop-bb-b-ae0-0.inet.ntl.com (213.105.174.230)  130.604 ms  131.190 ms  131.766 ms
 6  * * *
 7  212.250.14.138 (212.250.14.138)  118.341 ms  120.692 ms  163.523 ms
 8  209.85.252.76 (209.85.252.76)  118.807 ms  124.392 ms  123.757 ms
 9  72.14.232.149 (72.14.232.149)  132.502 ms  133.543 ms  133.671 ms
10  209.85.255.137 (209.85.255.137)  139.149 ms 209.85.255.13 (209.85.255.13)  137.904 ms  138.661 ms
11  72.14.233.77 (72.14.233.77)  143.339 ms 72.14.233.79 (72.14.233.79)  161.037 ms 72.14.233.77 (72.14.233.77)  124.609 ms
12  216.239.43.34 (216.239.43.34)  132.107 ms 209.85.249.129 (209.85.249.129)  132.696 ms 209.85.249.133 (209.85.249.133)  131.462 ms
13  nf-in-f104.google.com (64.233.183.104)  130.411 ms  127.656 ms  132.048 ms

The numbers in the left-hand column are TTL values. So it basically took 13 hops to get into the Google heartland. On each line there is an IP address and sometimes a host name for the machine that discarded the packet. Each packet is sent three times, so there are three times at the end of each line showing how long it took to get there and back. (You’ll notice from about line ten onwards there are several IP addresses and several times per line. This suggests that the packets with identical TTL values were going through different routes. I would guess this points to load-balanced routers which share the incoming packets.)

The asterisks which appear on lines 3 and 6 are where the packet was discarded but no error message was received within 5 seconds. And since most of these messages have a round-trip time of about 200 milliseconds, that’s considered time enough to abandon hope.

No responses yet

Mar 27 2008

Flat buying updates: this time it’s happening

Published by Dougal under Blogging, Home

Sorry for the lack of updates lately. I’ve been variously too tired, elsewhere or just lacking in anything interesting to say. But it’s time for an update, I think.

The flat situation is idling at the moment. The surveyor was holding their verdict to ransom until we paid them. So, their fee was paid today and so the building society should have also received the valuation and will agree to give us money for that particular property.

When that’s out of the way the subject to survey bit will be done and, I suppose, a wee bit legal shenanigans takes place. After that it’s more or less over. Until then we still don’t really know when we get our grubby paws on the keys. Maybe a month, maybe more.

Meanwhile we have to think about letting our landlords ken we’ll be leaving — of course, we’ll need to know exactly when that is so we don’t find ourselves without a house — and look for furniture too.

You can see why I haven’t been blogging about this: it’s cos we basically haven’t a clue. ;-)

No responses yet

Mar 25 2008

Delicious gone AWOL, for me at least

Published by Dougal under Computing

For some reason we can’t access del.icio.us URLs at home:

dougal@cuttlefish ~ $ wget del.icio.us
--00:13:59--  http://del.icio.us/
           => `index.html'
Resolving del.icio.us... 69.147.76.140
Connecting to del.icio.us|69.147.76.140|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.
 
--00:14:00--  http://del.icio.us/
  (try: 2) => `index.html'
Connecting to del.icio.us|69.147.76.140|:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

No data, no data, no explanation. Anyone else use Virgin Internet experience this? I think it happened early last week and still hasn’t resolved. I can access it fine at work and through proxies, so I know the problem is ours and not theirs.

No responses yet

Mar 24 2008

This is a rug that doubles as a side table

Published by Dougal under Home

I’ll try to prevent this from becoming an overworked theme on this blog, but we’re currently planning out our new flat from almost-scratch. We own

  • a sofa bed which doesn’t really fit anywhere in the new flat, so we want to sell it on and replace it with a corner sofa
  • a double bed, which we’ll probably keep
  • a coffee table which has seen better days
  • some slightly-unstable Ikea bookshelves

Stuff like dining table and chairs, wardrobes, bedside tables, desks, etcetera are on the list and really need addressing. Our new living room is an entirely blank canvas, begging for something bold and interesting but I don’t know what. I spent the afternoon drawing out vague plans and sketches — but without any concrete dimensions to work off, just one photo from the schedule and our memory, it’s easy to get carried away. Space for a small armchair warps and amplifies to take a three-seater sofa and metre-diameter globe (no, this is not on the cards).

Eventually I got a bit bored drawing plans and started playing with the perspectives and creating bookshelves as seen through fish-eye lenses. Interesting, but no so informative.

I can say this though: there are some crazy armchairs out there.

No responses yet

Mar 24 2008

Sports injuries shoot up in wake of Wii purchases…

Published by Dougal under Computing, Culture, Family

We went home at the weekend and I had my first play of a Wii, and have an incredibly sore shoulder/arm now. That tube of ibuprofen gel must have been there for a reason. But Helen are now decided — we definitely need a big television. ;-)

No responses yet

Mar 21 2008

Theatre comedy - The 39 Steps

Published by Dougal under Comedy, Reviews

We’re just back from an adaptation of John Buchan’s The 39 Steps. I had been a bit lax and hadn’t really noticed that it had received a comedy award rather than a drama award. I was expecting a somewhat-straight rendering of the story, but it was straight in the same way that The Muppet Christmas Carol is an accurate retelling of Dickens’ story.

I had also only read the book, so I didn’t realise that none of the three films were anything like the book. This stage version apparently uses the Hitchcock plot but hams things up to an incredible degree. That’s not to say it’s difficult though; suspension of disbelief is definitely required for the book and it doesn’t take much to highlight the inherent silliness in the story. With a cast of four, including the hero and one woman, the two supporting males have a really hard time of filling out the full cast of policemen, villains, magistrates, theatre-goers and hotel owners.

There was a bit of slapstick and lots of visual comedy, mostly playing on the conventions of drama and bad theatre — sound effects that don’t come in at the right moment, really badly hidden puppeteers and so on. It surprised me, all this humour, but it didn’t take me long to get in to different style.

Tonight was also a signed performance so that added an extra interest, though it was really hard to keep an eye on the visual stuff on stage and the interpreter at the side. But there were bits and pieces I could follow reasonably well.

I’d definitely recommend this version if you can see it — it seems to have been all over West End and Broadway so it might appear near you soon.

No responses yet

Mar 21 2008

Adapting to our collective needs

Published by Dougal under Culture, Home, Society

You remember that weird 5-minute TV program Trade Secrets? Or if you ever read a copy of the strange Take A Break, you might remember the readers’ tips section.

This is the equivalent for those who submitted to the IKEA nesting instinct: IKEA hacker. Doncha just love the new meeja?

No responses yet

Mar 21 2008

The home network

Published by Dougal under Networking

It’s been a while since I wrote about networking here. So let’s look at domestic networking setups.

The scenario we have in our flat is quite ordinary. There are two computers on the network, one desktop machine and one laptop. Traditionally these two would be connected to a switch so they can communicate with each other. In big companies or other places with extensive networks then a switch is necessary to juggle all the traffic in a reasonable way.

(The diagram here shows three computers connected to a switch, the box with the extended X shape in it. The computers can send packets to each other through the switch.)

A small network

But for small networks a full-blown switch is pretty useless. It’s like having a private telephone exchange in a house with only two telephones. So most people won’t see a separate switch: it will be integrated in the box with other things.

One thing you’ll notice in the diagram shown is that there’s no external communication. There’s no internet access — the machines can only talk with others on the same network. The connection between the home network and the rest of the internet is done with a router. It directs the network traffic like a traffic policemen. Local stuff stays local, but data that needs to be sent elsewhere goes via the router.

This is what a network with external access looks like:

A small network with external access

You can see that here the router is doing very little as well. There’s only one connection in and one connection out. So in my house, and probably in yours, the router and the switch are combined into one box. It does switching and routing (and often wireless access too). My home network looks like this:

A simple home network

(Apologies for the lame diagrams. Anyone know pretty diagram software for Linux? Pastel shades and smooth gradients welcome.)

Inside the router/switch hybrid beast the software analyses the destination for each packet sent and decides whether the destination is on the local network or somewhere else, and then sends it in different directions accordingly.

Apart from this, it can probably also hand out IP addresses to new machines as they join (extremely useful, so you don’t have to do any manual configuration). There may be some firewall capability too, so that particular programs can be prevented from sending signals in or out. It’s quite amazing what features are available in 50 quid devices!

3 responses so far

Next »