Going from zero
A friend of mine and I were discussing cars the other day. He said that he
thought the invention of the electric motor was a curse on cars, because it
meant you wouldn't have a gearbox to control which gear you were in. A
suitable electric motor has enough power to drive the car from zero to a
comfortable top speed (110km/hr) at a reasonable acceleration using a fixed
gear ratio - the car stays in (in this case third) gear and you drive it
around like that. He maintained, however, that you needed to know which
gear you were in, and to change gears, because otherwise you could find
yourself using a gear that you hadn't chosen.
I argued that, in fact, having to select a gear meant that drivers both new and experienced would occasionally miss a gear change and put the gearbox into neutral by mistake, causing grinding of gears and possible crashes as the car was now out of control. He claimed to have heard of a clever device that would sit over your gearbox and tell you when you weren't in gear, but you couldn't use the car like that all the time because it made the car too slow. So you tested the car with this gearbox-watcher, then once you knew that the car itself wouldn't normally miss a gear you just had to blame the driver if the car blew up, crashed, or had other problems. But he was absolutely consistent in attitude towards electric motors: you lost any chance to find out that you weren't in the right gear, and therefore the whole invention could be written off as basically misguided.
Now, clever readers will have worked out that at this point my conversation was not real, and was in fact by way of an analogy (from the strain on the examples, for one). The friend was real - Rusty Russell - but instead of electric motors we were discussing the Go programming language and instead of gearboxes we were discussing the state of variables.
In Go, all variables are defined as containing zero unless initialised otherwise. In C, a variable can be declared but undefined - the language standard AFAIK does not specify the state of a variable that is declared but not initialised. From the C perspective, there are several reasons you might not want to automatically pre-initialise a variable when you define it - it's about to be set from some other structure, for example - and pre-initialising it is a waste of time. And being able to detect when a variable has been used without knowing what its stage is - using valgrind, for example - means you can detect subtle programming errors that can have hard-to-find consequences when the variable's meaning or initialisation is changed later on. If you can't know whether the programmer is using zero because that's what they really wanted or because it just happened to be the default and they didn't think about it, then how do you know which usage is correct?
From the Go perspective, in my opinion, these arguments are a kludgy way of seeing a bug as a feature. Optimising compilers can easily detect when a variable will be set twice without any intervening examination of state, and simply remove the first initialisation - so the 'waste of time' argument is a non-issue. Likewise, any self-respecting static analysis tool can determine if a variable is tested before it's explicitly defined, and I can think of a couple of heuristics for determining when this usage isn't intended.
And one of the most common errors in C is use of undefined variables; this happens to new and experienced programmers alike, and those subtle programming problems happen far more often in real-world code as it evolves over time - it is still rare for people to run valgrind over their code every time before they commit it to the project. It's far more useful to eliminate this entire category of bugs once and for all. As far as I can see, you lose nothing and you gain a lot more security.
To me, the arguments against a default value are a kind of lesser Stockholm Syndrome. C programmers learn from long experience to do things the 'right way', including making sure you initialise your variables explicitly before you use them, because of all the bugs - from brutally obvious to deviously subtle - that are caused by doing things in any other way. Tools like valgrind work around indirectly fixing this problem after the fact. People even come to love them - like the people who love being deafened by the sound of growling, blaring petrol engines and associate the feeling of power with that cacophany. They mock those new silent electric motors because they don't have the same warts and the same pain-inducing behaviour as the old petrol engine.
I'm sure C has many good things to recommend it. But I don't think lack of
default initialisation is one.
posted at: 11:00 | path: /tech | permanent link to this entry
Critical Thinking
In the inevitable rant-fest that followed the LWN story on the proposal to
have /lib and /bin point to /usr/lib and /usr/bin respectively (short story), I
observe with wry amusement the vocal people who say "Look at PulseAudio - it's
awful, I have to fight against all the time, that's why we shouldn't do this".
The strange, sad thing about these people is that they happily ignore all those
people (like me) for whom PulseAudio just works. There's some little concieted
part of their brain that says "I must be the only person that's right and
everyone else has got it wrong." It's childish, really.
And in my experience, those people often make unrealistic demands on new software, or misuse it - consciously or unconsciously, and with or without learning about it. These people are semi-consciously determined to prove that the new thing is wrong, and everything they do then becomes in some way critical of it. Any success is overlooked as "because I knew what to do", every failure is pounced on as proof that "the thing doesn't work". I've seen this with new hardware, new software, new cars, new clothes, new houses, accommodation, etc. You can see it in the fact that there's almost no correlation between people who complain about wind generator noise and the actual noise levels measured at their property. Human beings all have a natural inclination to believe that they are right and everything else is wrong, and some of us fight past that to be rational and fair.
This is why I didn't get Rusty's post
on the topic. It's either completely and brilliantly ironic, or (frankly)
misguided. His good reasons are all factual; his 'bad' reasons are all
ad-hominem attacks on a person. I'd understand if it was e.g. Microsoft he was
criticising - e.g. "I don't trust Microsoft submitting a driver to the kernel;
OT1H it's OK code, OTOH it's Microsoft and I don't trust their motives" -
because Microsoft has proven so often that their larger motives are
anti-competition even if their individual engineers and programmers mean well.
But dmesg, PulseAudio, and systemd have all been (IMO) well thought out
solutions to clearly defined problems. systemd, for example, succeeds because
it uses methods that are simple, already in use and solve the problem
naturally. PulseAudio does not pretend to solve the same problems as JACK. I
agree that Lennart can be irritating some times, but I read an article once by
someone clever that pointed out
that you don't have to like the person in order to use their code...
posted at: 10:16 | path: /tech | permanent link to this entry
Private Stupidity
Kate and I heard a talk on the radio the other day in which a
German-sounding American professor, or pundit, or something, tried to
establish that actually we needed a society where everything is owned.
Obviously it's hard for me to know his full thesis, because we started
listening in the middle of the talk and switched off in disgust less than a
minute later. But of the bit we heard all of it was, basically, complete
rubbish.
His idea seemed to be that public property was a real problem - that it made things difficult because then you had to have laws and police and you had people sponging off the public good and abusing public property. Then you had to pay all these taxes to keep everything going and it was all very draining and stopped people just doing whatever they wanted with their stuff. Yes, a nice straw man argument, but then the alternative completely baffled me. According to him, in addition to owning your own property you'd also have to be a kind of shareholder in the road in front of your street, and the footpath, and the fences between your neighbours and yourself.
What baffles me here is that he clearly didn't see this going much further. Presumably he stays in his own street, grows all his own food, has an amazing naturally-occurring spring of fresh water in his back yard, and doesn't use electricity or the internet. Because as soon as you start looking at where all those things come from, you realise that they're all some kind of shared property. Once you drive outside your street, you need to be a shareholder in the company that owns that street, and so forth. I can only assume the pundit doesn't have any friends, because they moment they come and visit him they're going to have to pay a fee to his street-ownership-company to get there and park. He may well never use a public hospital, gone to a public school, gone to a public park, flown in public airspace, used the public radio spectrum, or have to claim unemployment benefits, but only because he's most probably a well-off white male.
I'll hopefully save my readers the tedium of reading through the first course
in a standard lecture on Government and Democracy. It's just incredibly
irritatingly bizarre to hear someone spout this kind of nonsense which almost
naturally disproves itself. He probably even thinks the world will be a
better place if they followed his philosophy. I'd like to invite him,
publicly, to stop using all our public resources and only use the ones he
actually privately owns. Then, when the oxygen starts running out in a couple
of hours, he may like to reconsider. Meanwhile, get off my public
broadcasting network and pay for your own publicity yourself.
posted at: 13:27 | path: /society | permanent link to this entry
Time to make something better
I've just managed to release the magic smoke from some or most of my
battery management modules - the little boards which sit on each cell and
make sure that it doesn't over-charge and notifies you when the cells are
getting low. Unfortunately, EV Power's basic design has a fundamental
flaw: they require two through-hole soldered connections which are very close
to the cell terminal. With the large cell interconnect blocks, this makes it
rather easy to end up with one cell's sensor wires touching the traction
battery. When another cell somewhere else also has its sensor wires touch
the traction battery, the tiny MOSFETs that do this switching end up with
a potential difference of several tens of volts with over a hundred amps
ready to gleefully emit magic smoke.
I consider it a basic flaw in EV Power's design. They could supply the modules with wires already soldered in and epoxied over. They could have supplied explicit instructions about how to wire them up which warned me of this possibility. The most recent design had an even worse flaw in my opinion - the holes which you feed the sensor wires through to provide some strain relief on the solder joint were on the wrong side. Earlier designs had it so the insulation of the wire would be the bit touching the terminals if things went wrong; the new design makes sure that you put the solder joint is right there to contact the traction battery.
In addition, the circuit board didn't go all the way across, instead using a wire and a lug (in some kind of supererogatory effort to save a fraction of a cent in circuit board cost, as far as I can see). This means that the sensor wire solder joints are literally pressed against the terminals unless you turn the board sideways. I did try to avoid this, but apparently not fervently enough, and the result seems to be numerous module boards with scorch marks and (in the next-to-most-recent design) burned-off heat-shrink.
Now I have to find another BMS, because there's no way I'm paying for any
more EV Power products. I would strongly recommend anyone considering
using them on 60AH Thundersky cells look elsewhere. I will now be ordering
a Lithiumate Lite
BMS from Elithion - the communications interconnect is top-soldered only.
EV Power's BMS probably works fine for 90AH cells and anything larger than a
61mm between-centres connection. But for me this is definitely a dud.
posted at: 23:58 | path: /personal/ebike | permanent link to this entry
PHP Getopt::Long
In my current work I have to occasionally work with PHP code. I don't really
like PHP, for a variety of otiose reasons. But one of the things that
surprised me was that it didn't have an equivalent to Perl's
'Getopt::Long' module.
There are a couple of other modules that are in PHP's PEAR package repository
which attempt to handle more than PHP's built-in getopt function, but all of
these lack a couple of fundamental features:
So I wrote one.
The result is available from my nascent PHP Subversion library at:
http://tangram.dnsalias.net/repos/PWphp/getopt_long/.
It's released under version 3 of the GPL. It also comes with a simple test framework (written, naturally, in a clearly superior language: Perl).
This is still a work in progress, and there are a number of features I want to add to it - chief amongst them packaging it for use in PEAR. I'm not a PHP hacker, and it still astonishes me that PHP programmers have been content to use the mish-mash of different half-concocted options for command line processing when something clearly better exists - and that many of the PHP programs I have to work with don't use any of those but write their own minimal, failure-prone and ugly command line processing from scratch.
I'd love to hear from people with
patches, suggestions or comments. If you want write access to the repository,
let me know as well.
posted at: 13:19 | path: /tech | permanent link to this entry
Adding Cans to C
I've been meaning to copy some of my personal C libraries to
CCAN, Rusty Russell's C Code Archive.
It's not yet quite as comprehensive as he would like, I suspect, but it's
certainly a good project. And I think, bold as this may be, that I have
something to offer it even if I'm not
a full-time C programmer.
The thing that's scared me off is the whole "meeting someone else's standards" thing. So after Rusty's talk at OSDC this year, and finding out that 'ccanlint' can prompt you with what you need to do to make a good package, I decided to give it a go. And after I started having a few minor problems understanding exactly what I needed to do to get it working, I decided to write it down here for other people.
LED strip lighting for the deck
Yesterday we got the electrician to install a switch in the dining room which
would turn on a power point in the ceiling. This powers a 100W 12V DC power
supply which in turn powers twenty metres of LED strip lighting. The parts
list:
Trying to get a photo that shows what the eye sees of the strip when lit is hard - the camera just thinks it's way too bright. This is the closest I could get with our camera:
With the eye you can see the individual LEDs and they're bright but not so bright as to be difficult to look at. So the strip doesn't make the deck feel too bright or oversaturated. The light is warm without being monochrome or too intense. And the fact that it's a strip means that you don't get shadows or bits of the deck that are dark - the whole deck feels quite evenly lit, even at the corners.
100 watts feels like a lot, but in comparison to even one 18W fluorescent
globe per space between beams (12) it is still much more efficient on power.
That arrangement of fluorescent bulbs would also mean shadows, single point
sources, and having to put an extra beam in the middle of the deck. And let's
not even consider spot lights. No, this is a really good layout.
posted at: 09:01 | path: /tech | permanent link to this entry
Who are you trusting
The "Secure Boot" proposal from Microsoft - to turn on digital signatures on new
UEFI-enabled motherboards so that only signed operating systems get booted,
allowing them to get motherboard manufacturers to lock Linux out under the guise
of "preventing malware" - is worrying enough as it is. Several large Linux
companies - Canonical and Red Hat amongst them - have already been working on white
papers, and an expert in the field has proposed IMO a better
solution to the problem. But really, if you think about it, Microsoft should be
working to prevent the whole thing working at all.
Why? Very simple. Just think of the number of state-level attacks on software and Internet infrastructure in recent years. "Hackers" getting fraudulent SSL certificates issued for *.google.com and other sites. People requesting Mozilla remove CNNIC from the certificate authority list because of the Chinese government similar faking of SSL certificates. Malware created by the German government for spying on people. British companies selling malware to the Egyptian government. The list goes on.
One can easily imagine any government in the world telling motherboard manufacturers that they need to install the government's own public keys in order to import motherboards into the country. It's obvious in the case of countries like Iran, Syria, and Jordan, and it's no stretch to imagine the US, Australian or any other 'Western' government doing it under the guise of "protecting our citizens". After all, we do want the government to snoop on those evil child molesters, dont' we? Or at least, the people the government tells us are child molesters. Or, at least, the people who turn out to have child abuse material on their computers after the government has done their investigation. They wouldn't use those powers to spy on ordinary citizens, right? Right?
Wrong. For state-level actors, it's not about the ordinary citizens. It's about protecting the status quo. It's about protecting their access to information and protecting their powers. The idea that someone can lock government spyware out of their computer has an easy solution - make sure that the computer itself will always install the spyware. And they have the power to go to motherboard manufactuers and get these keys installed. It's a no-brainer for them, really.
I also have no doubt that secure booting to a secure operating system will do little to stop real malware. There's always flaws to be exploited in something as large and kludgy as Microsoft's software. The phenomena Microsoft is allegedly trying to protect against - rootkits that start at boot time - are a relatively small portion of the malware spectrum. And if you're going to let an unsigned binary run - the alternative being to lock all but the large players out of the Windows software market - then malware is already exploiting the user's trust in the system and their lack of knowledge about what is good software and what isn't. "Your PC is already infected" and all that; it's trojan horses all the way down.
I don't think Microsoft is going to care that state-level players can exploit
the system their proposing. It's not like they don't already give the source
code to the Chinese government and so forth. But I think the rest of the PC
using world has a right to be very worried about a system that will tell you
that it's running signed software without you being able to choose which
signatories you trust. And choice is never going to be on the agenda with
Microsoft.
posted at: 21:13 | path: /tech | permanent link to this entry
Wag
This is half a bleg and half an idea.
Trying to get useful information of log files that are being continually written is kind of frustrating. The usual Linux method is to tail -f the file and then apply a bunch of grep, cut, sed or awk filters to the pipeline. This is clumsy if you don't know what you're dealing with or looking for yet, and there are a bunch of other limitations with this approach. So my idea is to create an application with these features:
If such a thing even vaguely exists, please
email me. Otherwise I'll have to
think about learning how to write inotify-based ncurses-driven applications
in my copious free time.
posted at: 14:10 | path: /tech | permanent link to this entry
The a-logical
On the drive back from CodeCave 2011 many moons
ago, Rusty and I (amongst many other things) talked about the problem we see in
modern society where some people use logic as a kind of optional extra. When it
suits them - usually when attacking other people's ideas - they can use logic
like a scalpel: dissecting arguments, finding flaws or exposing the problems in
your examples and analogies. Yet when it comes to their own beliefs, logic not
only doesn't apply, it isn't even in the same suburb.
You see these people in every role from the people that knock on my door and try to tell me to believe what they believe, through lobbyists and radio "entertainers" who wilfully exclude certain things from their arguments but are only too happy to criticise their opponents, to the run of the mill ordinary people who are outraged that people could be against gambling, drinking to excess, speeding, or whatever it is that they want to do. It's particularly pernicious in people we're dealing with personally, but aggravating when it's someone on the TV or in public life spouting their fallacious arguments and ignoring their own contradictions when we can't say a thing against it.
The fundamental contradiction is that they're ready to prove you wrong but won't accept the same in return. They use every trick in the book to avoid this - wilful misunderstanding of your arguments, using fallacies and specious logic, criticising your method of arguing, constantly turning arguments back on you, sidestepping or mis-answering your questions, and so forth - the catalogue is is too vast even for a Wikipedia page. You can't disprove them with logic. You can't be illogical or they point out the logical fallacies in your argument. You can't declare their beliefs invalid because that's too arbitrary. You can't reason with them, and yet if you don't you're portrayed as being unreasonable. You can't make up things like Pastafarianism without being, in some small part, the kind of thing you hate - and they don't see the relevance of your ridicule or see the parallels anyway.
Rusty and I debated a term for these people. When a person consistently does things that sane people wouldn't do, we call that person's behaviour insane. Yet to use the term "illogical" for who shuns logic consistently is more of a once-off offence descriptive of individual incidents rather than ongoing behaviour, and something that can almost be excused - like not sticking exactly to the speed limit. I thought that "alogical" would be a better coining - a deliberate absence and eschewing of logic. But sometimes these people can sound perfectly reasonable, and use very precise logic in disproving things they don't believe in.
Where is the balance? How do we deal with these people? Because I do believe that they are as much a danger to the social health of a community as office psychopaths are to workplaces. When these people can tell armies to go to war, make multi-billion dollar spending decisions based on pure fictions, and dictate how people are allowed to live and behave, their decisions cannot be based simply on whatever they believe and no argument will be entered into. As a society we need to see that there are rational, reasonable foundations for the principles governing our lives.
At the base of it I don't want to get into an epistemological debate - endlessly answering the questions 'why do you believe that' and 'what basis do you have for that'. Yes, at some point we have to have certain fundamental beliefs that may not be justifiable, or may even have a justification but be completely arbitrary, personal decisons (like my preference for blue over cyan, for example). How do we separate the preference of someone who says "I think someone who kills someone else is wrong and should be punished" from those that say "my magic book says that only men and women can get married" for example?
The only hope I have in this is that rationality and sense is gradually prevailing. We might rail against people who deny that climate change is man-made or who believe that the rapture will take them up to heaven according to the evidence in some pseudo-mathematical formula, but these are already far progressed from the kind of crank beliefs of centuries ago. No-one believes in spontaneous generation - that maggots are literally created from nothing in the presence of rotting meat. The belief that the earth is flat is rare to the point of extinction. Even school dropouts don't believe that the only elements in existence are fire, water, earth and air. These were all serious propositions debated by intelligent, reputable people - today we know them to be bunkum.
Likewise, in everyday life people tend to use rational thinking rather than magical. Everyday people no longer throw spilled salt over their shoulder to ward off the devil. Normal adults do not attribute stomach pains to demonic influences or yellow bile. People no longer use leeches to cure anything that isn't treated with cod-liver oil or tincture of sulphur. People do not say "bless you" when someone sneezes in order to ward off the devil stealing your soul from your nose. People walk under ladders with due care. Most superstitions are amusingly enjoyed rather than carefully observed.
While we obviously still have some distance to go, I think we are seeing
reason and sense triumph over bigotry and alogical thought.
posted at: 22:37 | path: /society | permanent link to this entry
Git for Nomic
I read of an interesting project today: Open
Knesset (in Hebrew). It takes the laws created by the Knesset (the
Israeli parliament) and checks them into Git, an open-source, distributed
version control system. Other people can then get those versions and modify
them to their own preferred wording. Because git provides information about
what lines of each text file have changed, it's easy to see where people
agree and disagree, and to see what improvements people might have. By
merging and copying from other people's work, you can converge on a more
universally applicable system of laws.
Long ago I started playing Thring Nomic, and I and some friends created Mornington Crescent Nomic. Nomic is a game where you start with an initial set of rules and people propose modifications to the rules; the modifications get voted on and the ruleset changes. You can win either by satisfying some condition in the rules, or by proving that the game is in a state of paradox. It's an amusing system for exploring how rules work and what makes rules function - you get very good at coming up with loopholes and thinking of problems with the way rules are worded.
The fundamental burden of traditional Nomics is that the ruleset changes and other game mechanisms have to be coordinated by a person, usually designated "the Speaker". I wrote a system of Perl scripts and a database to encode and automate some of this (it's not worth linking to, it's mainly defunct). The type of game you play, of course, depends in part on the functionality of the system implementing it; in CGI Nomic there's no point in proposing a rule that states there's a fourth sub-level of rules, because the system was only ever designed to cope with three. (Well, you could propose it, but it would be impossible to implement in the game system with out me revising the code.)
Most games, and most Nomics in my experience, work on having a common, single set of rules. But what if everyone worked on their own personal set of rules, and could request updates from other people? I would say "I've got a new rule that allows people to collect a point for each new rule they've created that gets into another person's ruleset", and people would choose whether to add that rule to their ruleset or not. Rules would be numbered by the ID of the commit that first introduced them, to avoid overlap. And there would have to be some understanding of 'consensus' in the game - for instance, you can only declare a thing to be true if two thirds of all the rulesets allow for it to be true. So I can create a rule saying "Paul wins the game", but it only becomes true if two thirds of the people then copy that rule (verbatim) into their ruleset.
The automatic versioning might also come into play with fixing rules. One of the traditional problems in Nomics is that a rule might be proposed which has a flaw that the author missed but that's obvious to someone else. Usually you can't change your proposal, so while there's some incentive to get it right first time, there's also an incentive to vote against version A and then propose version B. With git, however, you can see what someone else has done and say "hey, I like that, but I think it could be better written like this". And then the other person can see your improvement and might think "that version really is better, although it misses out a thing I wanted to avoid", and changes their old rule to a new version. Then you might copy that because it has the best of both authors, and others might do the same. That way you can collaboratively work on fixing rules rather than being limited by the fixed interaction of traditional Nomics.
It'd be an intriguing game to play, that's for sure. One where everyone has a copy of the rules that is divergent to a lesser or greater extent, yet one where there is a growing consensus about what's going on in the game. Would it inevitably fracture, or would it keep a core of rules that kept on working and people kept on using?
If only I had the free time to try it out.
posted at: 14:34 | path: /personal | permanent link to this entry
The Convoy of No Help
How does one tell the difference between a protest to get the government to hear
the legitimate claims of the people and a bunch of thugs whose idea of community
engagement and debate is to piss everyone off until they get their way?
Yes, that's a snide comment on the "convoy of no confidence" that's decided the best way to keep their generous handouts is to bring the traffic in Canberra to a standstill. But shorn of the inflammatory language it's a legitimate question. These people obviously feel they have a legitimate complaint. They think that the best way they can bring attention to their plight is to cause a big news story.
The problem here is that this is the same logic terrorists use. It's the same logic lobbyists use. It's the same logic the rioters in London used. It's the same logic that Martin Luther King used in the cause of racial equality. It's the same logic GetUp uses all the time in getting signatures on petitions and donations for advertising.
My question is really: is it valid? Is the right way to get your cause heard to shove it in everyone's faces? Does this not merely render us vulnerable to everyone with a loud mouth and a radical cause? How do we protect freedom of speech and the right of the citizens to have representation of their causes without also surrendering it to those louder than us?
Never mind the conflation of "Canberra" with "Government" in every non-Canberran news story I've ever seen - as if it was even possible that the entire 350,000 people living here decided, as one, to knobble the trucking industry. Never mind the howling rhetoric, invoking everything from the Eureka Stockade to the Dockyard Strikes in trying to justify the Convoy's actions. Never mind the hundreds of millions of dollars the trucking industry gets in handouts to keep it profitable, while it screws ever-longer shifts and ever-tighter margins out of its employees.
Sadly, I fear it won't matter how irrelevant, stupid and aggressive these
drivers are - all that will be reported by the conservative leaning press
in Australia is that there was this big protest about how totally unfair the
carbon pricing is to all those poor ickle struggling truck drivers. Every
person I've seen commenting on the ABC news stories that is against the
convoy can state facts in support of their argument. Every person I've seen
commenting in favour of them evokes some brave, Patersonesque
"little aussie battler" in a truck struggling against some improbable
mad-scientist figure determined to cause their demise. Forget
the facts, forget the reasoning, forget the mountains of scientific evidence
for a carbon pricing scheme, forget the numbers showing how most industries
and most people won't suffer under the carbon pricing scheme, let's imagine
we can drag the country back to 1980 when the world hadn't heard of the
ozone layer using some sort of magical thinking that ignores evidence.
It's pathetic. Millions of people marched to protest against the war in Iraq
and the news services passed by. Now a couple of thousand get all the air
time they want. Trial by media indeed.
posted at: 11:52 | path: /society | permanent link to this entry
Every car should have one
What I want is a small device that has a fuel flow meter suitable for use in
a car or motorbike, and a digital radio (e.g. bluetooth) to connect to it.
It can run of the car's 12V power system, and simply reports the amount of
fuel used every second in serial form.
Then I want a piece of software, say on my android phone, which reads information from the fuel meter and GPS coordinates. It then records how much fuel is used and where the car was at the end of that second. This can be used simply to work out how much fuel is being used, or a kilometres per litre or miles per gallon figure based on the current distance travelled. The software can then show you your average fuel consumption and km/l 'score' per trip.
But what constitutes a trip? Well, the software can work that out fairly easily - the engine is consuming fuel constantly while it's on, and people usually start it before the start of the trip and turn it off at the end of the trip. A fairly simple check of start and end points could then group your trips by their purpose - going to work, going shopping, etc - and report your average and best score for each journey of the same purpose. You could then also compare fuel efficiency when going at different times and using different connecting roads to determine, on average, which paths and times were more efficient uses of your petrol.
But journeys often start the same way - if you live in a cul-de-sac, you always drive to the end of it to get any further, for example. So looking at the paths can then break those into segments that are common, and you can be scored on your individual performance per segment. This also means that if you drop into the shops on your way to work then this counts for two or more separate segments rather than one. The algorithm could both find short segments - roads you always went along and never deviated from - and long segments that you occasionally deviated from but mostly drove in one go.
For many journeys there's more than one way to get there, and after a period of time the software can tell you which route was the most optimal and even possibly when to drive it to get the best efficiency. This would have saved a friend of mine, who had to suffer her father going many different ways between two points on a common journey in Brisbane to determine, over time and in varying traffic, what the most efficient way was. Of course, it can tell you what your best time was and that may be a different route from the most fuel-efficient path.
And then it can start to challenge you. You want to drive to work? How about doing it using less fuel than your best effort so far? It may even be able to tell you specific segments where you can improve - where your fuel efficiency varies widely, or where it is greater than your average over similar terrain. Once you get something that can actually tell you how to improve your fuel efficiency, I think that'll make a lasting difference to how much money people spend on fuel. Classic positive feedback technique.
Finally, a device which would actually offer to provably improve your fuel efficiency.
Sadly, it joins every other device out there being touted by snake oil
salesman, because - like them - it doesn't exist.
posted at: 23:18 | path: /tech | permanent link to this entry
CodeCave 2011 wrap-up
After a hectic two evenings preparing for
CodeCave 2011 and a morning
that seemed full of reasons to stay at work, I picked up James and Rusty and
we headed up to Yarrangobilly Caves with Tridge and Ian in convoy. After a
small panic of me not remembering the landscape (and trusting my memory rather
than e.g. a map or a GPS) we arrived. Andreas had got there beforehand and
unlocked so we moved in.
I was immediately very pleasantly surprised - Caves House is really well appointed, with an excellent kitchen, nice wide corridors, plenty of heating and great facilities all round. I had been worried about finding a forty year old oven and one knife (I brought my own favourite cleaver and carving knife just in case) but it was excellent.
The other thing that was good was that everyone pitched in and helped in the cooking and cleaning. I wasn't surprised by this - I think open source people generally expect to pull their weight and contribute, and I think everyone understood that I was only passing on costs rather than making a profit. But I had been a little worried that I'd have to set up rosters and roust people out from under their laptops to help me, and that wasn't the case at all. I had planned a group menu that pretty much everyone joined in with, and I really enjoyed having help as I cooked (as much as I also enjoyed the process of cooking for friends). Another win.
We had quite a variety of projects being worked on. Andreas was working on an Arduino home alarm system, Ian was continuing to work on his password manager integrating with the arcane complexities of XWindows' clipboard, Andrew and Tridge worked on getting SaMBa to talk to various Windows servers via IPv6 (you can guess where the problems lay), James continued ironing out the wrinkles in Zookeepr, and Rusty took up Tridge's challenge to write an algorithm that could find a bright dot reliably in a picture, not easy when the actual source is a quarter of a pixel wide - this was for the UAV Challenge: the bright dot is an infra-red light source, the picture is a IR-bandpass image of a field with that source in it, and each quarter of a second a new picture is taken, during which time the plane can move over twenty metres.
I was learning Go, something I had wanted to attempt at the previous CodeCon but had failed to get the compiler correctly installed before leaving contact with the internet. This was a general theme in the background of the weekend - nice as it was to be away from all the quotidian distractions of life, including those of the internet, it would have been rather useful in certain circumstances: looking up Wikipedia articles, for example. While Tridge's grand plan of taking his quad-copter up high enough to get his phone in contact with the 3G network, and then to use it as a wifi access point for emergency internet access, didn't eventuate, it was wished for on more than one occasion.
In between hacking and feeding ourselves, we watched Tridge fly his quad-copter (briefly) and went for tours through the three main cave systems at Yarrangobilly. I'm always left in wonderment at the amazing beauty and delicacy of the cave formations: flowstone, straws, helictites (which grow against gravity), shawls, and more, all solid, real examples of the amazing processes of crystals, physics and time. Fractals so perfect in their execution they make computer-generated ones look fake; persistent, unfathomably patient processes eroding away and building up in intricate, complex sculptures. Places where you can see these geologically slow processes already subsuming the man-made fittings that have been there for a blink of an eye. Caves really do have an aura of wonder to me that awakens the scientist in me.
Tridge had the good idea of each of us giving a talk about what we'd learnt so far and what we were working on and still to overcome, in a convenient spot in the self-guided cave. We didn't disturb anyone else and it was quite wonderful to have that completely different setting for something as interesting and familiar.
We packed up by about 11AM on Sunday to go on the final cave tour, and then to have lunch at the thermal pool. Sadly it wasn't warm - it was tolerably cool; with a cold Winter upon us there was nothing about it to entice one to stay in. Still, it was kind of fun to do something different again. And there was still one treat in store - we found an open place on the snow plains south of Kiandra and Tridge flew his model plane. It went very well despite the wind, which would have been at gale strength in scale and had the motors struggling to keep it going upwind.
Overall it was a really great weekend, full of interesting talk, cogently
argued ideas, personal insights and wonder-generating surroundings. I was
really glad to have been a part of it and I hope to run another one next
year!
posted at: 09:18 | path: /personal | permanent link to this entry
All posts licensed under the CC-BY-NC license. Author Paul Wayper.
You can also read this blog as a syndicated RSS feed.