Tuesday, August 07, 2018
Brexit: Much Adieu About Nothing
The title says it all, really...
Friday, June 20, 2014
BASIC
Wednesday, May 21, 2014
Software blues.
Just done a little light reading for relaxation - a guide to optimising x86 assembler code... it is both amazing and appalling how much hardware there is inside these poor processors to try to deal with the awful code they're given to run by compilers.
It's insane. Rather than have programmers write competent code - which, I keep having to remind myself, is actually quite easy - we've ended up in a world where nearly all programmers write complete garbage that includes masses of other complete garbage that other equally-incompetent garbage-mongers have gathered together, and all this offensively incompetent shite gets compiled to a vast swamp of instructions that are then examined by the hardware, broken up into smaller micro instructions and re-ordered into some kind of sense before actually getting executed... but no matter how impressive that hardware is - there are typically tens of billions of examples of this happening in each and every computer in every second - it doesn't make the whole ridiculous process any less inefficient... and all this hardware and furious activity burns electricity and generates waste heat.
Feel your computer - is it warm? hot? Unless you're doing something that actually needs lots of computation (3D games count) that heat is almost entirely generated by programmers being stupid.
Why is this all so inefficient? Mainly because the languages and tools programmers prefer to use are chosen *not* by any logical, rational process but by the whims of fucking fashion by programmers with no idea of what is actually going on under the hood and no interest in finding out.
And they'll tell you this doesn't matter - hell! they tell *me* it doesn't matter and I know exactly how full of shit they are - but it matters to the extent that at the present moment the IT industry accounts for about 2% of all the energy used in the world. That's about the same as the entire aviation industry.
Think about that for a second... it should be such a small fraction that it can't be bloody measured easily. Instead it's a major source of wasted energy and pollution... and this energy isn't used because it needs to be used; not at all. This energy is almost entirely wasted, and it's wasted because programmers are so fucking useless. And they're not getting more efficient either, quite the reverse. All the time they find new ways to add layers of inefficiency to everything.
Programming constantly moves away from energy efficiency towards less efficient languages and tools. Programmers actively choose not to use efficient languages and expect everyone to buy faster and faster computers to keep up with the growth of their inefficiency. But this is hardly new, it was old news thirty years ago... for most of my life I've watched them at it with a kind of shocked disbelief... knowing how to write efficient software easily leaves you wondering what the hell it is about getting things wrong that other programmers find so appealing. It's harder to do it badly.
Reading this status has probably used about a million times as much energy as it should have done, and would have done if all the programmers involved in writing the code involved were skilled... the sad fact is most programmers aren't just bad but completely fucking clueless. So monumentally incompetent that there is no way anyone outside the IT industry will ever understand how fucking thick and clueless they are - most of you just don't have any experience of anything being done as badly as programmers do things. They make cowboy builders look like paragons of efficient competence. Saying they build structures like Heath-Robinson contraptions is ridiculously understating the absurdity of their habits.
Ah, fuck it. This is pointless... It's our energy and money they're wasting, and it's our planet they're raping, but nothing I say is going to stop that or make even a single one of the lazy bastards change their ways or admit to their crimes. And make no mistake - they are crimes. I just hope that one day they're recognised as such and the software industry becomes accountable for the energy they waste.
Now, programmers will be reading this and bursting with asinine remarks in defence of bloat and crud - understand clearly that I don't give a shit what miserable justifications you present; I've heard them all, and shown them all as the tripe they are countless times... what I'm left with is the sense of utter shame that people outside the IT industry confuse what I do with what you do.
Monday, October 01, 2012
The pigeon
Monday, September 03, 2012
There are some strange people in the world.
I just went outside and moved the car onto the high street, where it would be out of the way in the morning. I'm half asleep but it needed moving, I'd had to leave it parked on the pavement earlier.
And when I'd moved it and got out I noticed a worm on the road. It has been raining and the damned thing had probably been rained out.
So, I feel sorry for it because it's clearly going to die there and I crouch to try to pick it up. It resists... I start muttering at it...
"Come on, you stupid bugger, I'm trying to help you. Stop squirming. Stop it. Behave! Oh, for fuck's sake cooperate!" and so on.
At which point some guy with a dog wanders past. Looking disturbed about something.
I realise that being crouched in the middle of the road appearing to be talking to myself might be a little out of the ordinary so I look up, smile and say "Worm" by way of explanation.
This does not have the desired effect; he recoils and gathers in the dog hurriedly.
"I'm just... It's... Um. They drown, you know..."
"What?"
"Worms. Not very good swimmers"
"What?"
"Worms. This worm. It's lost, I'm just... Oh..." I said to his rapidly retreating back.
I get the impression he thought I was weird, which is strange really considering I'm not the one carrying a bag of warm dogshit home...
Wednesday, August 29, 2012
Radio Gaga

Saturday, December 26, 2009
Yas hotel
Remember the Yas hotel from the F1 coverage?

Am I the only one who suspects the architect had this in mind?

(Nope, not alone - Googling for "Yas hotel penis" gives 38,000 hits)
But unfortunately rather than an enormous glowing penis what they've actually ended up with is a giant balls-up, because after only a couple of months hundreds of the LED panels have failed and it now looks like this:

Perhaps it should have worn a condom...
(For the record I was not involved in this project and those aren't our LED panels)
Monday, November 02, 2009
Religious education
"The thing you have to remember about religions is that they can't all be right... They could, however, very easily all be wrong"
Tuesday, July 07, 2009
Ouch
So, today I'm working on a new industrial input card for our logger family. Lots of 0..20mA inputs and some switched outputs, usual sort of stuff.
For added interest it has two AVR processors. A Mega128 sitting down near ground doing most of the work (handling the comms, multplexing inputs, driving the ADC and so on) and a Mega8 sitting up near the supply positive rail watching the current drawn on the outputs and turning them off if the current exceeds preset limits. These two talk to each other through a level shifting serial link.
Doing it with two processors is both the cheapest and neatest solution to the problem, the alternative would be to have lots of level shifting hardware for the various outputs and current sensing lines, which would involve much more hardware and be less accurate with it.
But - there had to be a but - it does mean that I have to simultaneously develop software for two processors that are running at different grounds, and also one of them needs a software emulated serial port because the hardware ones are busy doing other comms jobs, hence there is some slightly awkward software and the programming requires isolated AVR programming/debugging interfaces. Well, I have those, so no problem.
Hah. The gods don't like cunning designs.
I blow the first Mega8 up when the bloody ground clip of a 'scope probe unclips itself and wanders across the PCB, managing to touch one of the AVR I/O pins. Normally this wouldn't be a problem, but it picks the AVR that has its ground up at +20V or so. It doesn't like having one of its pins dragged down to -20V (as it sees things) so bye-bye and off to silicon heaven it goes.
Much gallic muttering ensues as Herve replaces it.
A few hours later I'm busy working on the serial comms between the two processors when the 'scope probe slips out of my hand. It misses the board and I have a moment of relief until I realise it's heading for the exposed PCB of the isolated AVR programmer... It lands on it and there is a very slight, but clearly audible, click as the earthed shield of the probe makes contact with some component or other on the programmer.
Of course, it doesn't do this with the programmer that's sitting at ground, it picked the programmer that was connected to the positive rail and which was sitting with its ground at +20V or so, and that click signifies the end of that particular programmer. And, of course, the end of the bloody AVR it was connected to as well.
This happened at 10:30 pm, and at about 11:30 pm there was even more gallic muttering as Herve (dragged back into work) replaced the Mega8 again. This was accompanied by a fair bit of my own muttering as I repaired the AVR programmer.
About an hour and a half later the other AVR, which had been sitting down at ground and minding its own business, stopped talking to the debugger. After a bit of investigation it turned out that one of its I/O pins was damaged at some point in the preceeding fiasco and had quietly rotted.
Think I'll wait 'till tomorrow before I tell Herve he's got to replace the Mega128 now.
I'm starting to think the gods really don't like this design...
Friday, April 10, 2009
Another interesting problem at work today.
A recent batch of 25 turned out to have four failures, when moved up and down they would not remain flat, basically the actuator at the foot end of the bed was not being controlled correctly - it was not moving as far as the actuator at the head end, only about 60% of the distance. The four were so consistent (all showing nearly the same degree of tilt) that we decided it pretty well had to be a software issue, hard as that was to explain.
But it wasn't - let me digress back a few years to the start of the project:
When the first bed hardware (frame and actuators) arrived for us to design the control electronics it came with a example mattress. These medical mattresses are not as you might expect - designed with disease control in mind they are waterproof and made of materials that can survive being steam cleaned. Basically they're dense and covered with some polymer that resembles rubber. And they are supplied, as most things are, in a plastic cover.
I must stress that in the eternal war of man against mattress these may be regarded as special forces, highly trained and motivated opponents. If you are asking yourself "what war?" then you are either damned lucky or have not yet made love in an uncooperative bed. But that's another saga.
So, picture the scene - we have a dirty-great mattress standing up on end against a wall with a polythene cover that needs to be removed. Along comes an unsuspecting Leon, I guess he winds up doing this because he just happened to be tall enough to reach the top of the mattress. As the only other person involved who is tall enough to have done this I must now give thanks to the gods of laziness who were smiling upon me on this occasion, because Leon walked over to the mattress as I was getting to my feet, grabbed the polythene bag near the top of the mattress and tugged it off with a manly flourish.
It was probably the last manly flourish or tugging off he managed for some time, because as he did this the friction between the polythene and the mattress built up a massive static charge which then discharged between the centre of the mattress and the part of Leon that happened to be closest to it as he lent backwards... The flash was visible in a brightly lit room, and the crack, while not exactly thunder, certainly wasn't a tiny little "click!" either... Leon clutched at his groin, managed a strangled squeak and collapsed. The mattress then celebrated its victory over humanity by slowly collapsing on top of him, which was followed by a general collapse of everyone who'd witnessed this event...
"You... Bastards..." Leon managed to say, after some considerable time had elapsed. "Get this... this... THING... off me"
Well, actually he probably said it a few times before we noticed, we were far too busy trying to breathe. Excessive laughter can be dangerous...
Anyway, the upshot of this is that removing the bags from these bloody mattresses is deadly. You don't do it fast. Given the chance you don't do it at all, you give the mattress in its bag to some poor unsuspecting suckers and let them find out for themselves, as we did.
"Do you know what happens if you remove the bag quickly?" I asked the supplier.
"Don't" they said.
"You don't know?"
"No - don't remove the bag quickly"
[pause]
"Thanks. I'll tell Leon that."
Knowing this at the start I designed the electronics with more of an eye to static protection than is normal, and it was successful because we have built a fair number of these beds without further problems (though other equipment the beds take a dislike to has been destroyed by it, they don't always choose the kinetic energy weapon option).
So, what about these four failing beds? Well, yep - static damage. They'd been built, calibrated (to define the range of movement allowed, etc), and then the mattresses had been fitted, only this time they'd done four of them differently - someone had put the mattress on the bed before pulling the bag off and also done this in such a way (yet to be determined) that the discharge was through the same actuator of all four beds. This then overpowered and destroyed a filter component (ironically something that was only there to protect the rest of the electronics from this very static) and did so in almost the same way on all four beds. It went from looking like a ~10nF capacitance to resembling a ~25K resistance, with all four having more or less the same resistance when dead... This added resistance then loaded the actuator's position sense pot, destroying the linearity, so the bed control loop thought the beds were flat when they weren't.
This input protection laughs at human-body model static discharges, you understand. Eats them for breakfast, so gods alone know how much energy is involved with these combat mattresses.
I now suspect this is the real reason why nurses are forever warning people not to sit on the beds during hospital visits. They're trying to do us all a favour, they know the evil forces that lurk beneath that innocent looking exterior. Be afraid. Be very afraid...
Interesting, eh? What? Well I didn't say it was very interesting... Oh, well, suit yourselves...
PC audio hardware
The idea has occasionally wandered across my mind (leaving a messy trail) that the audio outputs of a modern PC should be capable of generating fairly high quality audio test signals, and further that if the PC audio inputs are up to scratch they could be used to digitise the results of stuffing these test signals through external equipment-under-test, so that with a bit of signal processing jiggery-pokery the PC should be capable of quickly providing THD readings, frequency response curves (for RIAA networks and the like) and so on and so forth, basically the sort of things I used to do (albeit crudely) in the seventies with test gear that cost monopoly money (to build, that is, couldn't just buy it. Or would have cost the earth if I'd had any money. I was making it up as I went along with bits and pieces I managed to beg, borrow or, um, liberate).
This is hardly original, I hear you think. "Well, it was when I first did it" I respond grumpily, "analysing audio output stages using boxcar sampling thirty years ago. All my own ideas, too. Were you even born? Huh?" And other suchlike grumping sounds that an olde dinosaur makes when challenged. Where was I? Oh, yes...
In fact, aside from electrical noise (hard to avoid inside a PC) I'd have thought that a modern audio DAC/ADC combination from even the cheap end of the PC market would comprehensively outperform the hardware I was using back then. Hah! Foolish crem...
So, tonight while I'm feeling a little under the weather (man flu setting off an opportunistic dental abscess) I decide to have a play with this idea rather than doing anything particularly demanding. A few minutes in Delphi generating an accurate sinewave (no - I'm not slowing down - you can generate an inaccurate sinewave in seconds, but doing it properly requires it to be generated with correct dithering (TPDF) applied to the fractional bits that would otherwise be truncated, and that needs a little thought) and lo - I'm sat here listening to a 1KHz sinewave. Sounds nice enough and everything's looking good for a quick and dirty THD test set until I look at the waveform on t'scope.
(A special hell is reserved for anyone even thinking about questioning the triangular dither. If you think it could be better using a shaped function then you need to brush up on dithering - shaped functions are only suitable for final output - you really don't want to skew the noise frequency distribution going in to the gear under test. Running error accumulation instead of dither? Just don't. Tie the dither generation into the ADC with synchronous correction in the readback? Good thinking but not with unknown systems inbetween... Besides, it's not always a sinewave and I'd hardly tell you what I'm intending to do with this eventually, would I? triangular it is then. Good...)
Now, I admit I was expecting a reasonably clean looking sinewave. Dumb, but I admit it. Oh, crem-the-eternal-pessimist was expecting noise, and hum, and mush of various kinds, but with a smooth sinewave hiding underneath it all none the less. A sinewave lurking behind the sort of noise and mush that will average out give enough signal processing, is the point. Hah! Idiot. I'm not feeling well, that's my excuse.
Here it is:
Magnified (x2.5 post sampling):
Well, it's a sinewave, I suppose, but at first sight it looks like a sinewave generated using a raw 8-bit DAC. Very reminiscent of the stepped waveforms I'd expect from a cheap embedded design that didn't care much, not a supposed high quality (hah) DAC system.
So, does this motherboard, which claimed good audio qualities, use short DACs? A moment of experimentation and it becomes clear - it's not a short DAC but the cheapskate designers of the motherboard haven't applied any analogue reconstruction filter to the output... Nada. Zip. Not even a token RC filter...
Same again, but at 10KHz:
I suppose we should be thankful that they've at least upsampled the digital data to 96KHz, so at least most of the shit they're throwing out is well outside the audio band. Mind you, I bet they did that so they can cut back on the DAC length/ADC input filters and then just didn't bother to fit either. Gah...
Oh, I know, I could always use off-board audio hardware but that's not the point; if this is the normal sort of performance the idea's useless. Gah.
My laptop does rather better, clean looking sinewaves at 1KHz and 10KHz, so filtered at least, though that might be just the headphone driver not keeping up with the edges ;)
[that lot was edited into some degree of coherence after some sleep]
Maybe I was being too picky anyway. Even for simple tests I'd probably use the stereo outputs to generate antiphase signals and then use a differential amplifier to get rid of as much common mode noise as possible, so it's no great bother to put a quick and dirty reconstruction filter in/in front of that stage... I wonder if it's worth doing the same sort of thing going back in; turn the signal into a differential pair for the stereo inputs and subtract them in software? Have to think about that, doubt it'd do that much good. Hmm...
Thursday, April 02, 2009
Wrong.
Wednesday, August 27, 2008
Language fascists
I've been watching programmers parading their miserable ignorance again. The sort of playground squabble "My language is better than your language, my compiler's smarter than your compiler and my dad's bigger than your dad!" type of nonsense that would terminally embarrass a normal five year old, in other words the sort of reasoning few programmers ever advance beyond. Useless fuckers.
Grump. Snarl.
Think they'd understand if I show them allegorically how close their bigoted nastiness is to racism/sexism? No, it'd go wheeee-splat over their empty little heads. Tiresome pillocks... Gah...
[How about... Ponder...]
Heard the one about the programmer who loved and was fluent in C, the programmer who loved and was fluent in Pascal and the programmer who loved and was fluent in assembler?
When she wasn't writing software she was a pretty damned good hardware designer as well...
[Hmmm. Should I stop there? Would the target audience understand how much that exposes their stupid, narrow-minded prejudice? Would they even notice? Hmmm... Needs more...]
One day a stranger, a programmer of the modern ilk, who had travelled long weary years across the desert seeking enlightenment, laden down with objects and paradigms of the most exquisite kind, so wise in the ways of templates they were utterly incapable of actually writing code, arrived at her tent and, pausing unknowingly before the solution to all the questions he could possibly dream of having answered, saw only the dusky maiden; "Is your master about? And get me a drink could you, chop chop..."
And so the closest they came to enlightenment was the sound of one hand slapping...
[Too verbose. Far too verbose... Why do I waste my time on these people?]
** with that thought, crem is enlightened **
Sunday, April 27, 2008
Accents
A friend of mine was nearly sacked last week for having his wife phone him at work to say she was stuck in traffic.
"Huh?" I hear you ask - "how does that work?"
Well, you need a few particular circumstances. First you have to work for an American company. Second, said company needs to have a system where phone calls to your works phone are automatically run through speech recognition software which turns them into e-mails and sends them out to you, and thirdly your wife needs to have an accent which causes American speech recognition software to think "stuck in" is really "fucking"... i.e. no particular accent whatsoever.
Add to that mix a company policy where emails containing swearwords get flagged up and sent to all and sundry and you're, um, fu... in the deep, ah, well, you're completely, um. Whatever.
The part I find most amazing is not that the software fu-umbled the words, but that they think he's responsible for the language used (or not as it happens) by someone who called him... And that's from people who appear to have declared war on the wrong country because they can't tell the difference between Iran and Iraq.
Sheesh.
Thursday, January 17, 2008
Crapacitance
"We're going to blow up a capacitor, want to watch?"
Now, anyone else would ask "why?" at this point, but experience suggests that I wouldn't like the answer, so after due consideration I downed tools and followed him. A very alert observer might have noticed the pause.
In his room he'd already attached wires to the capacitor, which was potted inside a box as part of some device or other. I suppose the idea was to see how safe the device was if this capacitor ever decided to explode in normal use, but as I say, I didn't ask.
A power supply was attached, connected backwards across the poor cap and switched on. Cue rapid exit from room... The power supply quickly ramped up to about 4 volts and about 3 amps.
"Twelve watts? It's not going to last long" I opined, from the doorway.
"About... now, I'd expect" I ventured, after several seconds had passed with no visible result.
"Any time now..."
"Soon..."
After about a minute at 12W I wandered in and wound up the supply up to full power, which was about 20W. People started to cower...
A minute or so passes, with nothing visible happening.
"Twenty watts? I don't believe it..."
I wander over to the device and feel it - it's distinctly warm... No smoke, but I do start to smell a rat - "You did disconnect the cap from the rest of the circuit, didn't you?"
"Ah..."
Gah... Bloody capacitor's probably laughing itself silly while the rest of the circuit dumps all the power.
Saturday, January 05, 2008
Software challenge?
Something along the lines of having them trawl the web for scraps of obsolete and buggy source code, then bodging these poorly-understood fragments together to make a flakey application that can be made to do something badly after only an hour of tinkering, and which is then thrown away as useless.
We could call it "programming"...
Friday, January 04, 2008
Artificial sarcasm
Today I was idly reading part of Wikipedia and was amused, and very nearly annoyed to discover a couple of places where other people were being given credit for inventing things that I'd done years before... One example was syntax highlighting in text editors, the others were in a similar vein [1]. Well, my development tools still do one or two useful things that programmers haven't yet thought of and it struck me that I really ought to get the olde anagram generator out and encode the ideas so that I can use them in my dotage to support claims of "Idiots - I was doing that forty years ago!" and suchlike profoundly unhelpful but satisfying remarks.
Unfortunately the first anagram it came up with started "Oh dear me, holier-than-thou..." (that's not the complete wording, no point decoding it) which I took as a hint and abandoned the whole enterprise.
But what the hell - here's one for you all to be going on with. Decode this and untold millions of programmers will bang their heads on their desks with cries of "Why the fuck didn't anyone else think of that?"
"Oh dear me! Damnation, the stealthier acuteness"
Mind you, it's probably easier to just get me pissed and ask nicely.
[1] Of course, I could just edit the entries in Wikipedia, but somehow changing them to "Actually, Design Design invented this in..." seems a little bit too sad. Besides, who's to say we were the first? Good ideas that give a commercial advantage are not openly discussed. The whole idea's intrinsically flawed and offensive.
Friday, November 02, 2007
Quantum mice - a watched mouse never gets caught...
So, following on from a design for a mouse trap Ste and I made about twenty years ago, which caught a dozen mice in its first four hours of operation, I hacked together a transparent box with some bait, an infra-red beam to detect the mouse and a solenoid operated trap door to catch it. This was then placed in a likely spot and an infra-red video camera rigged up to watch the mice being caught.
About an hour later the first customer turns up. After a cautious sniff around the outside it stuck its head and shoulders into the box and rooted about, not going far enough in to break the beam. Fair enough, perhaps mice have grown more cunning in the last twenty years... Nil desperandum - give them a chance to get used to it.
A bit later another mouse appears and goes through the same process... Perhaps they don't like plastic boxes?
Then one turns up and gets inside the box - I sit poised - surely this is it? But no, somehow the bloody thing doesn't trip the trap, and leaves. Bastard, I'll get it next time... But no, it's back, and this time it brings a friend. To cut a long story short they explore the box, they party on down on the bait, they jump about, have sex, snooze a little, and at no point does the bloody trap door close. After a bit they get bored waiting for something to happen and wander off, presumably giving the place a bad review.
Only then does it occur to me that a mouse trap that relies on the mice breaking an infra-red beak in a transparent box is probably not the best thing to watch using an infra-red camera that has about a dozen high-intensity infra-red LEDs built in as illumination... Doh!
Got 'em when they came back an while later - amazing the difference a bit of cardboard around the camera makes...