Tue, 10 Jun 2008
#include <stdio.h>
#include <sys/types.h>
int main(int argc, char *argv[])
{
#ifdef LITTLE_ENDIAN
printf("Little Endian defined\n");
#endif
}
On Linux/x86, this prints outputs little-endian. Unfortunately it also does so on the IBM BlueGene (Linux, GNU Libc), which is, by default, big-endian. (Thanks to my colleague Honore Tapamo for discovering this).
It turns out that this is due to <sys/types.h> including <endian.h>, which has:
#define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __PDP_ENDIAN 3412 /* This file defines `__BYTE_ORDER' for the particular machine. */ #include <bits/endian.h> #ifdef __USE_BSD # define LITTLE_ENDIAN __LITTLE_ENDIAN # define BIG_ENDIAN __BIG_ENDIAN # define PDP_ENDIAN __PDP_ENDIAN # define BYTE_ORDER __BYTE_ORDER #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # define __LONG_LONG_PAIR(HI, LO) LO, HI #elif __BYTE_ORDER == __BIG_ENDIAN # define __LONG_LONG_PAIR(HI, LO) HI, LO #endif
We're working on a code at the moment that has LITTLE_ENDIAN defined in Makefiles on Little-Endian architectures. This all needs to be changed to something like IS_LITTLE_ENDIAN to avoid this issue.
POSIX requires that all symbols beginning with an underscore, followed by a Capital letter or another underscore, are reserved for "the system". Unfortunately the reverse does not appear to be true, and this then is a collision with a symbol that programmers thought was unique to the code being defined in system headers but with different meaning.
Is there a standard for detecting byte order? There doesn't appear to be in POSIX. Linux / libc provides __BYTE_ORDER but what other Operating Systems does this work on ?
Tue, 06 May 2008
An interesting discussion appeared over on the NANOG mailing list, based on the article, Up to 300 Megawatt Worth of Keepalive Messages to be Saved by IPv6?
This points to an original study by Haverinin, Siren and Eronen at Nokia that shows how much energy is used via "keepalive" messages sent in VoIP, Instant Messaging and other systems, in order to satisfy NAT. In order to maintain connectivity through a NAT router these systems need to keep sending messages to stop the NAT router closing the connections. With IPv6 this would no longer be necessary. It turns out the power requirements are quite significant.
There is good work happening elsewhere in Linux and elsewhere in IT, to minimise the amount of energy wasted, such as the Less Watts project. But perhaps its worth doing an audit of the protocols we use, to see what energy savings we can use?
Fri, 02 May 2008
Just up on arxiv.org this week appeared Warming the early Earth - CO2 considered, by von Paris et al.. Just a preprint, and i'm working through its 53 pages now, put its likely to put the cat among the pidgeons:
Abstract: Despite a fainter Sun, the surface of the early Earth was mostly ice-free. Proposed solutions to this so-called "faint young Sun problem" have usually involved higher amounts of greenhouse gases than present in the modern-day atmosphere. However, geological evidence seemed to indicate that the atmospheric CO2 concentrations during the Archaean and Proterozoic were far too low to keep the surface from freezing. With a radiative-convective model including new, updated thermal absorption coefficients, we found that the amount of CO2 necessary to obtain 273 K at the surface is reduced up to an order of magnitude compared to previous studies. For the late Archaean and early Proterozoic period of the Earth, we calculate that CO2 partial pressures of only about 2.9 mb are required to keep its surface from freezing which is compatible with the amount inferred from sediment studies. This conclusion was not significantly changed when we varied model parameters such as relative humidity or surface albedo, obtaining CO2 partial pressures for the late Archaean between 1.5 and 5.5 mb. Thus, the contradiction between sediment data and model results disappears.
The suspected composition of the eary Earth (the Archean, when life is believed to have started, 3.8 to 2.5 billion years ago), has alternated between CO2 and other reducing gases, such as methane.
Originally CO2 was thought to be the main greenhouse gas, making life possible. However the high CO2 levels required were a problem; high CO2 levels would have created siderite (FeCO3) in the top layers of soil as iron interacted with CO2 in the oxygen-free air. Since then methane has top billing as the greenhouse gas responsible, with significant hydrogen levels a possibility. Over time, methane has come out on top. And thats what I wrote when I did my literature review for my PhD. Now I'm tidying it up a bit, and that section may be in for a rewrite.
But what does it mean for our Climate change models of today?
Wed, 30 Apr 2008
So, the solar panels are now installed, and heating. We're getting the water in the tank heated to around 50 C on these grey days; (there is also an electric immersion coil to heat to 60 degC as necessary, at night-rate electricity). They heat a 300L tank in the utility.
The panels are grant-aided by Sustainable Energy Ireland, and we reckon they'll pay for themselves in 5-8 years, depending on water usage with three kids. Time now to see what the actual savings are.
Thu, 03 Apr 2008
After the April fools joke that wasn't, the hangovers have cleared and OOXML has passed. Unless it is successfully appealed, it will become standard in 2 months. Thankfully, it is being appealed. If you can, lobby your national standards authority to appeal and stop this.
All around the blogosphere, people have been slating ISO for passing this. While a lot of irregularities happened to pass it, for which the ISO should be ashamed, we need to be aware of one thing: ISO is on the good side, folks: we want standards. Most people who are involved in ISO, want good standards. Microsoft don't.
Those on ISO committees felt worldly wise about corporate lobbying: they'd seen it before. They were used to companies lobbying them to rubberstamp their technology as an international standard. But Microsoft were playing a different game. They don't want standards. They already have their monopoly. They don't even want their formats to be standarised. They want to be able to change them every release, and force another sale of Office 2010,etc. What they want to do is trash the idea of standards, and they're succeeding.
ISO was used to being the battleground, the referee. Instead it was the target, and didn't know how to cope.
This battle is like the Celts fighting the Romans. Used to cattle-raids-as-warfare, they hole up and defend themselves when the Romans come marching in, and expect the Romans to give up in a day or two when their 'cattle raid' fails. Instead the Romans dig in for the long siege, and win, while the Celts look on puzzled, and lose.
We need to retake ISO and defend it. I set up the iso-codes project within Debian several years ago to minimize the number of country and language lists out there. Now with OOXML it appears we have to also track the Microsoft list, and incompatabilities, as OOXML requires it. Ditto with DrawingML instead of SVG, and a wholew host of other standards.
Standards committee work is hard and boring. But if we don't get involved theres a lot of boring coding ahead, just tracking Microsoft. Time to join the National standards committees, somehow. Or should we lobby ISO to join as an international body?
Thu, 07 Feb 2008
So, those on Planet Debian may have noticed, I've moved my blog into git, which went fine. And 'git-cloned' it on the laptop for editing, which worked. And then 'git-checkout' on the server. Which didn't.
Bang. All the modified times were updated.
The solution, it appears, it "metadate". Which I'm implementing ASAP.
UPDATE:
The code for the plugin is not at the URL pointed to in sourceforge, but google says its here.