Leap years plus BCD are a nasty combo


I am working on the final touches (I hope) to the VMUFAT filesystem.

It has to write dates to disk in binary coded decimal, which is problem enough. But leap years are the real pain.

Perhaps I should be happy that I have now discovered a bug in the code, and in any other year it would slip past. But it is still something I could do without.

Advertisements

“One of the finest engineers of the open source movement”


Me & Eric Raymond .. Open Source Evangelist.
Image via Wikipedia

If one were ever to dare to apply this to Richard Stallman, one could expect to be cast into the outer darkness. Whatever else he is, Stallman is nothing to do with “the open source movement” – which he rejects as a capitulation to corporate interests that seek to destroy free software.

Stallman is, though, entitled to regard himself and be regarded as “one of the finest engineers” of free software. I doubt he is very active as a developer these days, but as the creator of GCC and GNU EMACS he more or less made everything else possible.

But the title of this post does not refer to Stallman at all, but rather ridiculously to Eric S. Raymond.

Raymond has written some software – he wrote most of Fetchmail and as a user I want to thank him for it. But does that make him one of the finest engineers of open source or anything else? Not really.

Magnetic fields, again


English: The magnetic field of a bar magnet re...
Image via Wikipedia

I asked a couple of questions about magnetism before and I have to say I was not fully convinced by the answers – so here is another way of stating what puzzles me.

Imagine a static magnet. Now magnetism cannot propagate instantaneous as if it did the magnet would surely immediately cease to be magnetic – even though we know, via Oblers’s Paradox if nothing else, that the universe is finite, we must surely also assume it is very large and contains a very large number of magnetic objects.

So magnetism is propagated at some finite speed. Naturally we will assume that speed is c , the speed of light and the propagation is via photons. But what are these photons?

If they are real, physical particles, then they must carry energy and so the magnet should ‘run down’ – otherwise it would be a perpetual motion machine. But static magnets apparently run down very slowly – so slow I have never been aware of it really happening, though I have no doubt it does.

So what else might they be? Presumably a function of quantum electrodynamics (QED) as formulated by Feynman? In this case then the energy of these “virtual” photons is a function of the uncertainty principle.

This would essentially mean that the strength of these magnetic photons would be limited by \delta E \delta t \leq h where E is the energy of the QED photon, t time and h the familiar Planck constant – a very small number indeed.

Here the particles can come and go in an instance or presumably, live mysteriously for a very long time at very low energies. But no actual energy is expended unless this virtual photon is “observed”.

So, is this right? And if it is, how did anyone explain magnetism before QED? And if it is wrong how do magnetic fields propagate.

Not one for the Apple fanbois


If you are one of those people that thinks paying twice as much as the rest of us for your computer equipment makes you clever then don’t read any more of this:

Steve Jobs smelled so foul that none of his co-workers at Atari in the seventies would work with him. Entreating him to shower was usually futile; he’d inevitably claim that his strict vegan diet had rid him of body odor, thus absolving him of the need for standard hygiene habits. Later, friends would theorize that he had been exercising what would prove a limitless capacity for sustained and gratuitous lying that came to be nicknamed the “reality distortion field.”

Computer scientists’ lousy citation style


I am reading this book: Soft Real-Time Systems: Predictability vs. Efficiency, and I am struck, once again, by the truly lousy style of publication reference that seem to be preferred by so many

Journal of the American Mathematical Society
Image via Wikipedia
computer scientists,

The style used in the book appears to be that favoured by the American Mathematical Society – the so-called “authorship trigraph” – with references made up of letters from the author’s name followed by the last two figures of the year of original publication eg., [Bak91] which references in the bibliography:

[Bak91]        T.P. Baker. Stack-based scheduling of real-time processes. Journal of Real Time Systems, 3, 1991.

Now it is possible, if I were an expert in the field that I might recognise this reference, but it is far from helpful. When referencing papers written by multiple authors the system is hopeless – using the first letters of the first three authors and ignoring the rest, eg., [DGK^+02] is a real reference in the book to a paper with eight authors. I really doubt many people would get that straight away.

But at least this reference system contains slightly more than the IEEE‘s citation system, which demands papers are merely referenced by a bracketed number in the text, eg., [1].

These reference systems are so widely used that I worried that my own use of the Chicago system – which specifies author and year, eg., (Denning, 1970), would be frowned upon in Birkbeck – but a re read of the regulations showed their demand was for a consistent and well-recognised system.

The ACM, too, promote a sensible citation format eg., [Denning 1970].

Does this matter? Yes. I am sure many readers of these books and papers are students who are conducting literature reviews or similar exercises. Reading the original reference may often be important and having to flick back and forth to a bibliography to check the meaning of an incomprehensible reference is not calaculated to add to the sum of human happiness.

(I don’t have any real complaints about the book though – except that the translation is plainly a bit stilted – for instance, the first sentence of the book refers to real time systems being investigated “in the last years” – a fairly common mistake in syntax from non-English speakers and one that the editors really ought to have corrected. But the occasional infelicity of language does not detract from the book’s overall appeal.)

Seems neutrinos do not arrive before they leave after all


English: The first use of a hydrogen bubble ch...
Image via Wikipedia

It would appear, reports Science magazine, that neutrinos may not travel faster than light after all – a finding from CERN’s OPERA experiment that would mean, assuming that every other aspect of relativity was not broken, that either neutrinos arrive at a destination before they leave a source or that they cross the universe via some other dimensions than our world of spacetime.

It is now suggested that a faulty connection with a GPS transceiver

may have skewed the results.

Heartland Institute: an update


English: Peter Gleick lectures at SkeptiCalCon...
Image via Wikipedia

Last week what were reported to be internal fundraising plans and strategy papers from the hard right anti-science Heartland Institute were leaked to the media.

Heartland said the documents – which seemingly reported on plans to scare teachers away teaching climate science – were stolen and/or were fakes.

Now a scientist called Peter Gleick has come forward top confirm that he obtained the documents from Heartland by deception.

Gleick has apologised for his actions and has been subject to a lot of harsh criticism from fellow scientsists. He has, however, also confirmed that the documents are genuine and rather blown Heartland’s attempt to deny that out of the water.

I am in two minds about the ethics of all this. Some years ago the Guardian newspaper brought down the career of a UK Cabinet minister, Jonathan Aitken, through the use of what they called a “cod fax”: they used deception to find out that Aitken, while minister for defence procurement, had had his hotel bill paid by an arms lobbyist. Aitken denied the whole thing, fought a defamation action, lost and ended up in jail for perjury.

Seemed to me that the Guardian’s deception was very much in the public interest. And I find it difficult to say that Gleick’s exposure of Heartland – who have had a major impact on the debate in the US – was not motivated by a similar desire to do public good. But Gleick was not a journalist and – this is pretty important – Heartland were not breaking any laws (or ministerial codes of conduct).

Taking down the bug


Finally nailed the bug in my readdir function.

The code was stuck in an endless loop because it did not return an empty dirent when it reached the end of the directory – instead returning the list of files in the directory over and over again.

To fix this I made sure that any following scan of the directory began where the previous one left off. As this would return an empty dirent, the problem was solved.

The end of the CAPTCHA?


CAPTCHA Insanity
CAPTCHA Insanity (Photo credit: JillOW)

Between 2009 and 2011 my work included establishing and editing a website (in English) about news and events in Georgia, in the Caucasus.

Lots goes on in Georgia – it’s a fascinating place – but the number of people interested in reading news in English about it is quite limited: still the site built up a good readership and was widely noted amongst the small international community that follow events there for academic, human rights and other reasons.

But Google Analytics also showed that the bulk of the audience was in Georgia itself. Some times this was because the website was one of the few places that gave a reasonably straight report of some controversial events there, especially if these involved criticism of, or statements by, the Georgian Orthodox Church, by far the most respected institution in the country and one that the government had a deeply uneasy relationship with.

But a growing audience also meant attracting spambots and how to deal with them was an important consideration. Even going away for a few days could attract many dozens of spam messages and deleting them was a pain. Bayesian filters for Drupal (the CMS) seemed to be quite poor, so that was not an automatic solution either.

So, I chose the CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) – in this case some mangled text that would be posters had to decipher before they could successfully comment on the site. With the CAPTCHA spam all but disappeared (though plainly there are some desperate people even prepared to wade through CAPTCHAs to post their ads).

Now, nobody likes CAPTCHAs – they are a terrible pain, because quite often the text is so mangled it is difficult to read. But I discovered Georgian readers loathed them. For a start they were in an unfamiliar alphabet -he Georgian – Kartuli – alphabet is completely different (for instance there are no capital forms) from Roman or even Cyrillic, even if there are some Greek influences on it –  and then it required them to use a different keyboard layout. ი სტილლ ჰავე ა გეორგიან ლაყოუტ ავაილაბლე ჰერე – სო ტჰის ის სომე ენგლისჰ ტრანსლიტერატედ ინტო გეორგიან.

So eventually the CAPTCHA had to go and I went back to relying on poor quality Bayesian filtering and hand weeding.

Now, it seems, that might be where we are all headed: as Slashdot reports audio and video CAPTCHAs have been cracked and cracking software can even score a 1% success rate against reCAPTCHAs – the toughest type apparently (do read this link on reCAPTCHAs and the social function they fulfil, I often wondered why it was possible to ‘pass’ them with little better than guesses and now I know why).

The failure of audio CAPTCHAs is, I fear, quite likely to lead to their demise as a widely used security technique – as without them those using screen readers and similar audio technology may face some sever difficulties in accessing CAPTCHA guarded content.

Still, well implemented Bayesian and other filtering has already saved email from complete collapse, so maybe it is time to give the Georgians a break and turn all the CAPTCHAs off?

A question for a C guru


English: Dada guru
Image via Wikipedia
The debugging continues, but unfortunately I have not yet been able to identify what is fundamentally broken with my file system code.

But along the way I have spotted and fixed various bugs. Here is one, I am not even sure why it compiled in the first place, so maybe a C guru could tell me…

Was:

if le16_to_cpu(((u16 *) bh->b_data)[j * VMU_DIR_RECORD_LEN16 + VMUFAT_FIRSTBLOCK_OFFSET16] == ino)

Now:

if (le16_to_cpu(((u16 *) bh->b_data)[j * VMU_DIR_RECORD_LEN16 + VMUFAT_FIRSTBLOCK_OFFSET16]) == ino)