11/03/2009
Yesterday someone dropped on the IRC channel where my fellow programmers, computer enthusiasts, and I hang out to get help to find a bug. He uses one of the paste sites (like pastebin.ca, pastebin.com, or rafb.net), pastes his piece of offending code, and so we get a look at the code. Of course, I go over the short program, notice a mistake in the scanf but it took me a full two minutes to notice the loop:
for (c=0; c++; cwe don’t read what’s actually written, but what we think is written, unless we pay the utmost attention to the code—what we should be doing anyway, but do not always. Usually, you zero in on that kind of bug rapidly, as you guide your search from the bug’s symptoms which leads you to defect’s approximate location. If you’re like me—write a little, test a lot—you find those bugs right away most of the times. However, even if you zero in rapidly, you still get a coarse-grained location: module, class, function.
Read the rest of this entry »
Leave a Comment » |
algorithms, C, hacks, Life in the workplace, programming, Zen | Tagged: automatism, automatisms, bugs, C, debug, debugging, Delphi, duh!, efficient code, Fortran, functional programming, Incremental Coding, IRC, Pascal, programming, Turbo Pascal |
Permalink
Posted by Steven Pigeon
10/03/2009
Our planet is indeed quite a marvelous place. Full of surprises:
- Montréal, the city were I live
- The Château de Versailles
- The Lake Pink, a natural curiosity.
- Vatican City, seat of an ecclesiastical constitutional monarchy, ruled by Pope Palpatine.
- The Pyramid of the Sun, at Teotihuacán
- The Forbidden City, home to the Emperors of China
- Mount Everest, also known as Chomolungma, the Mother of the Earth.
- Huge, weird, graffiti at Nazca
- Stonehenge, a megalithic site
- Machu Pichu, probable home to Inca rulers
- The Valley of the Kings, eternal resting place of King Tutankhamun
- The Great Pyramids, the last of the original seven wonders.
- The Eye of Mauritania, an unlikely circular anticline.
- Lake Manicouagan, a big-ass crater (but not the largest on Earth).
- Area 51, where the SGC keeps all the cool alien tech a military installation of some kind.
- Massada, a fortress with a bloody history.
- A weird Indian Head
- A Chalk Horse in England.
- A Giant Man Petroglyph in Australia.
- A small boat in Africa.
- Another prehistoric horse in England.
- wtf? srly.
- Taj Mahal a superb mausoleum, not to be confused with the very kitsch clone.
- Some kind of radio facility, near Exmouth, Australia, apparently belonging to the US Navy.
- Atlantis? Not really.
*
* *
Our planet is a truly wonderful place. Take care of it. Share its beauty. Know some weird feature visible from space? Let me, let us know.
Leave a Comment » |
Uncategorized | Tagged: Alien Technology, Area 51, Chalk Horse, Château de Versailles, Chomolungma, Emperors of China, Exmouth Hexagon, Eye of Mauritania, Forbidenn City, Giant Man, giant pink rabbit, Indian Head, Lake Pink, Machu Pichu, Massada, Montréal, Mount Everest, Nazca, Petroglyph, Pope Palpatine, SGC, srly, Stargate Command, Stonehenge, Taj Mahal, The Great Pyramids, Tutankhamun, Valley of the Kings, Vatican City, wtf |
Permalink
Posted by Steven Pigeon
03/03/2009
In a previous post, I’ve presented an ad hoc compression method known as digram (digraph, bigram, bigraph) coding that coded pairs of symbols on used codes from the original alphabet yielding a very simple encode/decode and also sufficiently good compression (in the vicinity of 1.5:1 or so). While clearly not on par with state-of-the-art codecs such as Bzip2 or PAQ8P, this simple codec can still buy you extra space, even when using a very slow/simple processor.
This week, I’ll introduce you to another simple algorithm, Move To Front coding.
Read the rest of this entry »
4 Comments |
algorithms, C, data compression, embedded programming | Tagged: binary encoding, C, coding, data compression, Data Structure, efficient code, Efficient data structures, programming, Reverse index |
Permalink
Posted by Steven Pigeon
28/02/2009
Peter Seebach — Beginning Portable Shell Scripting — Apress, 2008, 352 pp. ISBN 978-1-4302-1043-6

(buy at Amazon.com)
This book, like Bash Cookbook: Solutions and Examples for Bash Users isn’t overly technical. It focuses on one particular aspect of shell scripting, portability. While no one really expects a bash script to be excuted using a different shell, such as zsh, for example, Seebach shows us that there are ways to ensure that the scripts behave reasonnably well when executed in different environments and by different shells. Seebach presents various shell constructs and discusses their portability, giving numerous examples.
Read the rest of this entry »
1 Comment |
Bash (Shell), Portable Code, Suggested Reading | Tagged: bash, bash scripting, csh, internationalization, portable shell scripts, sh, shell scripting, zsh |
Permalink
Posted by Steven Pigeon
28/02/2009
Donald A. Norman — The Design Of Everyday Things — Basic Books, 2002, 257 pp. ISBN 0-465-06710-7

(buy at Amazon.com)
In the same lineage than Machine Beauty, this books explores the fundamental rules of good design. Built around the following seven precepts, Norman lays out the problems (and solutions) to good design:
- Use both knowledge in the world and knowledge in the head
- Simplify the structure of tasks
- Make things visible: offer feedbacks for actions
- Get the mappings right
- Exploit the contraints, both natural and artificial
- Design for error
- When all else fail, standardize
The book is filled with examples of each principle. Fully annotated and with numerous references, this book (although a bit aged) will serve as a good introduction to the subject, especially for people interested in the design of user interfaces (while, however, the books is not very concerned about computers as the original edition was written in the late 80s).
To read with Machine Beauty, User Interface Design for Programmers, and The Inmates are Running the Asylum.
Leave a Comment » |
Design, Suggested Reading, Zen | Tagged: asylum, inmates, machine beauty, rules of design, user interface |
Permalink
Posted by Steven Pigeon
27/02/2009
If you’re anything like me, you like to create a musical bubble to isolate you from your surroundings and being able to concentrate on what you actually have to do. To do so, I have amassed a rather long list of dub, trance, techno mixes. Some are 90 minutes long, and are very well crafted. People who think that techno is always the same (boom-tss-boom-tss) are clearly missing something.
I have bought numerous CDs over the years, but it turns out that there are a lot of (legal, DRM-free) free podcasts out there, and while they’re not all easy to find, they’re easy to share. Here are the few I d/l recently:
The Zoolook Project has several podcasts of ambient, trance, hard techno, etc., mixes. Amongst which I like:
There’s also the T.O.U.C.H. Samadhi website that offers both streaming and pod casts. A bit wierder, maybe. I like:
Other personnal favorites include the DJ LNG mixes found at DJ LNG (aka Romalong)‘s page. Especially Random Regularity.
Happy hacking, then!
4 Comments |
Life in the workplace, Zen | Tagged: DJ LNG, remixes, Romalong, T.O.U.C.H. Samadhi, techno, techo hard, trance, tribal, Zoolook Project |
Permalink
Posted by Steven Pigeon
24/02/2009
I’m sure that if you’re more than twenty, you’ve seen one of those really bad Sci-Fi movies with computers with lights everywhere. As the computer worked, computing at incredible speeds of course, the lights would flash like crazy, often accompanied by weird beeps and bops. When the computer completed its computation, like some kind of bizarre oven, the computer would make a loud ding! The answer would then be printed on a teletype with a characteristic loud buzzing noise.

The IBM 370 (from Simon Fraser University Network Services. Click on image to follow original link.)
Read the rest of this entry »
Leave a Comment » |
Life in the workplace | Tagged: Blinking lights, Cathode Ray Tubes, CRT, IBM 370, Nostagia |
Permalink
Posted by Steven Pigeon
17/02/2009
Ad hoc compression algorithms always sound somewhat flimsy, but they still have their usefulness whenever the data you have to compress exhibits very special properties or is extremely short. Universal compression algorithms need a somewhat lengthy input to adapt sufficiently to yield good compression. Moreover, you may not have the computing power (CPU speed, RAM and program space) to implement full-blown compressors. In this case also, an ad hoc algorithm may be useful.
Digram (bigram, digraph, bigraph) coding is one of those ad hoc algorithms. Digram coding will compress text (or any source, really) by finding pairs of symbols that appear often and assigning them codes corresponding to used symbols, if any.

Let us see in detail what digram compression is, and how effective it really is.
Read the rest of this entry »
2 Comments |
algorithms, C, data compression, hacks, programming | Tagged: ad hoc, average code length, bigram, bigraph, compression, Digram, digraph, efficient code, simple, text compression |
Permalink
Posted by Steven Pigeon
10/02/2009
I was reading ZFS‘s specs, and it struck me how Sun deliberately over-engineered the filesystem. To make sure that ZFS would be able to deal with just any storage device (or pool), they made ZFS a 128 bits filesystem. Now, 2128 blocks (2137 bytes) is a truly enormous quantity of data. In fact, it is so enormous that Jeff Bonwick explains how populating such a capacious device it would require more energy than is needed to boil all of Earth‘s oceans, give or take a few cubic miles.
The quote, which I find thoroughly amusing, is reproduced here:
Although we’d all like Moore’s Law to continue forever, quantum mechanics imposes some fundamental limits on the computation rate and information capacity of any physical device. In particular, it has been shown that 1 kilogram of matter confined to 1 litre of space can perform at most 1051 operations per second on at most 1031 bits of information. A fully populated 128-bit storage pool would contain 2128 blocks = 2137 bytes = 2140 bits; therefore the minimum mass required to hold the bits would be (2140 bits) / (1031 bits/kg) = 136 billion kg. […] To operate at the 1031 bits/kg limit, however, the entire mass of the computer must be in the form of pure energy. By E=mc2, the rest energy of 136 billion kg is 1.2×1028 J. The mass of the oceans is about 1.4×1021 kg. It takes about 4,000 J to raise the temperature of 1 kg of water by 1 degree Celsius, and thus about 400,000 J to heat 1 kg of water from freezing to boiling. The latent heat of vaporization adds another 2 million J/kg. Thus the energy required to boil the oceans is about 2.4×106 J/kg * 1.4×1021 kg = 3.4×1027 J. Thus, fully populating a 128-bit storage pool would, literally, require more energy than boiling the oceans. [ref]
Even though this quote reeks of hubris—although I’m not expecting vengeful bolts of lightning striking Bonwick any time soon—it got me thinking about the fundamental limits of computation, and how he could derive such a result.
Read the rest of this entry »
2 Comments |
Mathematics | Tagged: computing, Hubris, limits of computation, Moore's law, quantum physics, ZFS |
Permalink
Posted by Steven Pigeon
07/02/2009
Damian Thompson — Counterknowledge: How we surrendered to conspiracy theories, quack medecine, bogus science, and fake history — Viking Canada, 2008, 162 pp. ISBN 978-0-670-06865-4

(buy at Amazon.com)
Reminding me of the Petit cours d’autodéfense intellectuelle,
Counterknowledge deals with various pseudoscience and the strategies employed by their supporters to spread the “counterknowledge”. Everything goes: quack medecine (chakra-aligned neuromagnetic cristals), pseudohistory (apparently the Chinese circumnavigated the globe in 1421), and, my favorite, Creationism.
As you may have guessed, Thompson demolishes the quack theories, but must importantly, he shows how the most basic critical thinking will tear the pseudosciences down.
Do not read if you’re a conspiracy theorist.
Pedlars of counterknowledge often insist that their ideas should be taken seriously because ‘no one has been able to come up with a better explanation’ for whatever mystery they have lighted upon. But this argument only betrays their muddled thinking. The fact that a subject is genuinely puzzling, that there are vast gaps in our understanding of it, does not lower the standard of evidence we require in order to fill the gaps
Read the Blog
Leave a Comment » |
Suggested Reading | Tagged: blog, chakra, pseudoscience, quack medecine |
Permalink
Posted by Steven Pigeon