eggfriedrice.com

Ubuntu, WPA and a stinking headache

February 18th, 2007

Argh!  Wireless networking is stupidly complicated and Linux support for it is rubbish and it’s been driving me nuts all night!  It’s reached the point where only playing Doves loudly is going to help.  That’s never a good sign.

I haven’t updated for a while because I still haven’t got the hang of this blogging lark.  I keep thinking I should wait until I have something to say, and then I come up with a Great Idea for a post and then forget what it is.  But just now I realised that I don’t need anything particularly to say, other people waffle incoherently and get away with it.  And only about three people read this crap anyway so what the hell!  Haha!

I can tell you all just how crap Wifi is and why having to install something as stupidly named as “wpa_supplicant” is really annoying, especially when it doesn’t play nicely with my ndiswrapped driver (it’s a pile of crap is the conclusion).  The most irritating part of this is that I can’t figure it out.  I like a challenge as much as the next challenge liking person, but I like my challenges to be solvable and, preferably, have some usable documentation.

OK, enough of all that.  In other marginally less interesting news I missed my maths NAB on Monday because I had a stinking cold.  Which was probably for the best because I hadn’t revised much and everyone seemed to fail an outcome or two anyway.  Today I read up on Polynomial Synthetic Division and the discriminant in anticipation of actually taking it.  I say “anticipation” like I’m anticipating my eventual mortality.  All pretty dull, but I managed to actually get right answers for some of the example questions (I can tell you’re fascinated).  We were in The Southern on South Clerk St for a revision/working and avoiding the internet-blogs-time-sucker hour or so.  Nice pub/bar, good food and quite quiet for sitting about in during the day.

I’m threatening to type up and blog my notes on Synthetic division but I’d get sued by some poor suckers who failed because of them.

An aside: I’d forgotten how good J Mascis and the Fog’s album More Light is.

Not much else has happened recently really, I made a little LED widget for Sarah.  It was a simple thing really but I was quite chuffed that considering I only had a cordless drill and basic tools it didn’t look shite.  And the spaghetti code in the PIC did actually make a couple of different patterns work.

I also did some work on an old site someone else bodged together years ago for which I had to use Frontpage.  I still feel dirty.  Evil stuff.

Things I have recently discovered that are useful:

  • Ubuntu has an /etc/rc.local file like Redhat’s, it’s bugged me that not enough distros copied Redhat on this so well done Ubuntu.  Nice.
  • If you press [Ctrl] + [1] or [Ctrl] + [2] etc in Firefox you jump to the first or second tabs (etc).  Mmm.
  • Gnome’s Nautilus (the file manager) has a really simple little timesaver, if you press [F2] to rename a file it highlights the file name for you to type over (ala Windows) BUT not the extension!  No more having to type “.jpg” after renaming!  Smooth.

So there you go.  Tune in soon for another fascinating instalment of Al’s Life!

Crewe Alexandra F.C., big in Kyrgyzstan

February 8th, 2007

Evening all

Today has been a bit shite really. I’ve got a stinking cold for a start, I dragged myself out of bed to sit on a bus for 50 minutes to college (in the cold) to find that the lecturer (teacher, whatever they call themselves these days) hadn’t turned up. Probably nice and warm in his bed. So I came back and tried to catch up on the sleep I need but couldn’t. To really rub salt into my Unable to Sleep wounds, Sarah managed to sleep solidly from 1-5 PM.

So I’ve faffed around today and not done much of any consequence. I did, however, play with the BBC news site, mostly by viewing it in all the different languages. It’s weird seeing the ticker go backwards in Arabic versions. I screen grabbed this page because it tickled me, check the BBC Sport section in the middle:

BBCKyrgyz

In case you’re interested, I used the Screengrab! extension in Firefox 2, which is really very handy if you need to, yunno, make a webpage screen grab…

I’m off to drown in snot now, laters!

Widget of the Week: athcool

February 6th, 2007

Your computer isn’t a high tech super clever thinking machine, it’s a box for turning electricity into heat and occasionally adding some numbers together.  What you have on the floor under your desk, or on your lap, is an expensive bar heater with a calculator glued on the side.

Basically modern computer processors are very inefficent, much like incandescent light bulbs. A bog standard 100 Watt incandescent light bulb turns 95 of the watts you put in into heat, only 5% of the electricity it uses gets turned into what you’re after, light.  Modern computer processors are pretty much the same, they produce massive amounts of heat and only work because of the big lump of metal that is the heatsink attached to the top of the processor.  Your computer is a piece of crap, and so is mine!

The annoying thing is that heatsinks get hot, it’s their job, they are sinking heat after all.  So to get around this fans are attached to the heatsinks to help dissipate the heat.  So far so good, it works.  Processor gets hot, fan blows air.  The problem is that the heat pumped out costs money (as electricity going in) and fans are noisy.  The best thing to do is cut the amount of heat generated by the processor in the first place, then the fan can slow down and still properly cool the processor.

Less heat = less wasted money and less noise, excellent!

But how to put out less heat?  Most modern processors have some throttling system built in, my Intel based laptop, for example, is currently running at 600Mhz instead of the 1.4Ghz it’s rated for because I’m typing slowly (relative to a processor… and, well, my Mum who touch types) and there’s not much going on in the background.  (This is turning out quite rambly, bear with me!)

This whole thing of heatsinks and fans being noisy hasn’t really bothered me until this week while I’ve been building the MythTV box which I’d like to make less noise than Harrier jump jet.  The first attempt at construction booted but hung after a few minutes of trying to install Ubuntu.  I thought this was weird as the Ubuntu installer never bothered me before and seemed quite stable.  Oddly it wasn’t happy running Knoppix either.  I found out that the processor was overheating because the heatsink I was using was too cheap and nasty for my second hand Athlon XP 2100.  I upgraded to a nice heavy Akasa one and it’s been working fine ever since.

End of the story?  No, amazingly I haven’t even got to the point yet!

Now this box runs and is nice and stable I thought I’d see what temperature the processor is idling at, I grabbed GKrellM which while being quite ugly does give me a readout of the temperature with zero configuration.  The processor was idling around 54° C.  This, I thought, was a bit on the high side, so I wondered if there were any throttling things I could enable or tweak to cool it down a bit.  Long story short, I didn’t find anything tweakable, I think the kernel generally does a pretty good job of enabling the right stuff to cool processors by default.  As I’m using an Athlon for this I was interested when I came across this though…  (drumroll as I finally get to the point)

athcool!

This seems to be written by some Japanese guy and really looks very fishy.  The page mentions STPGNT and ACPI C2 state and other stuff I only vaguely understand.  It also has some nice red bits in the supported chipsets section where people have reported that their computer hangs or the hard disk writes garbage or the monitor starts flickering and other really nice sounding side effects.

I figured as I’d only just installed Ubuntu on this box I wouldn’t mind if I corrupted the filesystem at this point, I can always reinstall.  I had a look in Synaptic and athcool was already in the Ubuntu repository (admittedly in Universe where any stuff can end up), so, bugger it, I downloaded it.  Once I got past the nice warning “!!!WARNING!!! … may cause… massive filesystem corruption”.  Not just corruption, no, MASSIVE corruption.  This must be good.  And surprisingly, it is!  The processor now idles at about 45° C, a nine degree drop.

I haven’t noticed anything weird with the box, it still seems to be stable but it is running cooler and
the fan has been slowed down by the motherboard as it’s happy with the temperature.  All in all, I’m quite amazed this actually works!  Whether you’ll want to try it or not is something else altogether.  It’s quite happy with my (antiquated) Athlon XP2100+ on an MSI KM3M-V with a VIA KM400(A) chipset.  YMMV!

A warning though, don’t stick your thumb in your Akasa heatsink’s fan by accident (or deliberately), it turns out the blades are sharp considering they’re made of plastic.  I guess “blades” should give it away really.  I nearly lost a chunk of my thumb!  That’s number 4156 on the “Stupid Things I have Done” list.

When is long not long?

February 4th, 2007

When it’s exactly the same length as something shorter!

For my Higher Computing C Programming assessment I’ve had to write a simple program, part of which calculates the file size of a video by multiplying the height, width, colour depth, number of frames per second and length. Simple? I thought so.

I’ve done a bit of C programming, but mostly for 8 bit microcontrollers, I’m used to thinking in terms of unsigned chars and this is my downfall here.

Using one of the example tests for the program gives a sum like this 270 * 340 * 16 * 25 * 189 = 6,940,080,000. That’s too big for an int. Luckily C has datatypes for bigger numbers, like “long” and “long long” (for even longer things). Great! So all I need to do is swap to longs or long longs and then it’ll work! Except this is stepping into a bit of a minefield.

It turns out that a long is exactly the same length as an int on 32 bit computers (like most of mine). On my Linux and Windows boxes an int is 32 bits long. So, a long long it is then! That’s 64 bits everywhere I’ve looked. Only as it’s quite uncommon I found it tricky to work out what to use at the format specifier. This is mostly because long longs seem to be a GCC addition to the C language, not part of the spec. That’s fine because I’m using GCC on Linux to develop this program and at college we’re using Bloodshed Dev-C++ under Windows XP.

Dev-C++ is a nice, lightweight and open source IDE for C and C++. I was quite impressed with Telford College for choosing something open source for their Windows boxes (I’m adding more OS software by running Firefox at Telford using the portableapps version from the student network share).

Anyway, back to the problem. %lld is the GCC printf specifier for a long long, nice and easy to remember, ll == long long. And luckily Dev-C++ uses the MinGW version of GCC so I can port my code straight over. Ha! No such luck. It turns out (I discovered after some really handy exchanges on the Edlug mailing list) that the MinGW GCC implementation of printf is actually made to use the Microsoft long long print specifier with is %I64d. Catchy. Unless you use %I64 you experience some sort of weird miscounting thing and printf prints out garbage. This page explains it.

So after all the faffing around and general irritation of this half hour job taking three days I finally have it working. Along the way I discovered that for a language that’s been around for a million years C isn’t all that well defined. Also, I found that the datatypes vary. I knew this was the case anyway but I didn’t realise how weirdly they vary.

I’ve complied and run this code on a few different computers here:

#include

int main(){
printf(" TYPE BYTES BITS\n");
printf(" char: %d %3d\n", sizeof(char), sizeof(char)*8);
printf(" short: %d %3d\n", sizeof(short), sizeof(short)*8);
printf(" int: %d %3d\n", sizeof(int), sizeof(int)*8);
printf(" long: %d %3d\n", sizeof(long), sizeof(long)*8);
printf("long long: %d %3d\n", sizeof(long long), sizeof(long long)*8);

return 0;
}

I expected the length of an int to be 32 bits on a 32 bit system and 64 bits on a 64bit system. Strangely it seems to be 32 bits everywhere but the long is 32 bits on a 32 bit system and 64 bits on a 64 bit system. That’s enough, I’m past caring, it’s all too weird! I’m almost beginning to wish they’d chosen to teach Java this year and that’s a really bad sign!

Apologies to the non-geeks who might read this entry but well done for getting this far! Apologies to the geeks who read this entry, but well done for getting this far without posting a comment pointing out a cockup or inaccuracy, you can post it now!

So long Mr Wisdom

February 1st, 2007

I’m back in Edinburgh with a bump. I flew back on Monday and on Wednesday I had two wisdom teeth taken out.

The Awards was good fun, Bill Bailey was the secret guest presenter and really was fantastic. He started by addressing the audience as “drug dealing scum” which for a room full of Pharmaceutical Marketers was pretty much spot on. He performed the Kraftwerk Hokey Cokey, proved that most pop songs do not work when sung in a west country accent and managed to insult (without offending) most of the winners and products. Particularly the wince making winner of this category.

The set up the night before wasn’t too painful either. The award for the trickiest thing to velcro to an exhibition panel this year goes to a blood glucose monitor. At least there were no sellotape dispensers this time!

Back to Wednesday, get up at sparrow fart, get taxi to hospital, see the surgeon at a bit past eight, have anesthetic at nine, have teeth stolen, wake up at 10, taxi back about three. That’s the advantage of BUPA, sod all use for most things (they don’t “do” M.E.) but occasionally comes in handy. I’ll point out here that my Dad pays for it because he got some kind of company bulk discount and now wouldn’t dare to cancel it. So that’s even handier. They did send my pre-op bumf addressed to “Mr Wisdom” though so I hoped the surgeons were better than the secretaries.

My surgeon was Dr Robert Brown (not Mr, must be toothologist thing) which meant I was humming Doctor Robert by the Beatles all the way up until anaesthetic time. That stuff is quite brilliant and beats the pants off Amitriptyline.

So now I feel like I’ve been punched in the face and I’m “eating” food that’s slurpable. Mind you, Sarah’s Pea and Mint soup ain’t half bad so I’m putting up with it at the moment. Other culinary delights include jelly, tapioca and banana and custard. I’m thinking of creating the Bennett Lumpiness Scale for future wisdom toothectomy sufferers. A bit like the Beaufort scale for wind. 1: water, 2: cream … 9: walnuts, 10: ball bearings.

Right, I’m off to lie on one side of my head!