Thursday, February 28, 2008

Ox Liver and Steroids for Pharaoh Ants?

A local newspaper wrote about someone who got pharaoh ants in the kitchen and are fighting them with ox liver and growth hormons (it apparently stops ant reproduction).

Not the most obvious solution, and I seriously doubt it is generalizable to other situations.

Saturday, February 23, 2008

Compiling Python through Lisp?

Several articles have described the similarities between Python and Lisp, e.g.
From my perspective Lisp compilers seems mature and produce relatively high performance code (about 10 times faster than Python), and if Python is compiled to Lisp it can probably be done without any restrictions to how the Python code is written (which doesn't seem to be the case with Shedskin and RPython that compile to C/C++ code).

A possible approach could be to to use the Antlr Python 2.5 grammar and rewrite to a tree grammar (which looks very similar to Lisp), and with the forthcoming Antlr version you can rewrite the tree grammars to another tree grammar which happen to be Lisp?

It is probably not as simple as suggested, but let me know if you try :-)

Vault of greater value than Fort Knox?

On Tuesday 2008-Feb-26 the Svalbard Global Seed Vault opens. Its purpose is to (physically) store millions of types of seeds to contribute to biological diversity (e.g. of food crops) for future generations, and I am quite sure that they will appreciate it sometime into the future.

Svalbard Global Seed Vault has 3 chambers capable of storing 1.5 million seed samples each, i.e. 4.5 million seed types in total. Since seeds have a limited lifetime (high variance though) they will be incrementally replaced. This replacement process is done by selecting a few seeds from each sample and grow the plant to provide new seeds of that type.

The replacement process seems sustainable, but I would guess there are interesting challenges in growing all kinds of seeds. Probably not very hard for them to find gartners or plant biologists :)

Some pictures of the Vault (also called the Global Crop Diversity Trust):

Entrance (click to zoom)

Building Plan (click to zoom)

Hm, this reminds me of my startup-that-never took-off which was sort of an acronym for "Agent-Based Simulation for Biological Diversity"

Wednesday, February 20, 2008

Para 2008 in Trondheim

Prof. Anne C. Elster is chairing Para 2008 - 9th International Workshop on State-of-the-Art in Scientific and Parallel Computing here in Trondheim.

Coding in Academia

Interesting opinions about coding in academia presented here.

My opinion on coding is that code should read like prose, but instead of verses (~code paragraphs) one should use function calls. Kent Beck's books implementation patterns and test-driven programming are good reads (e.g. his thoughts about symmetry in code). Hm, perhaps it could be a thought to learn test-driven programming before object-orientation?

Have you ever thought about that precise naming of methods (or comments for code paragraphs) increases in difficulty with number of lines (i.e. harder to name something that does a lot of stuff)?

Tuesday, February 19, 2008

Greenlet Python is concurrently alive and kicking

As I mentioned before I am a big fan of the Python programming language, and for good reasons, in particular support for thousands of simultaneous lightweight threads (tasklets) with Stackless Python (which requires a modified Python interpreter).

Greenlet and Eventlet
What I recently discovered was Greenlets. It is a spinn-off library from Stackless Python but as opposed to Stackless it is supported by the standard Python interpreter. There are also some interesting additional libraries based on Greenlets, e.g. the Eventlet networking library.

(Hm, maybe using Greenlets with Parallel Python could be a thought)

Concurrency seems to be getting increasingly more attention, and it is great to see that Python is not falling behind, actually far from it. Maybe Python can be used to solve some of the challenges in concurrency.

Tuesday, February 12, 2008

Estimate early and often

I believe numbers are one of world's most generally useful discoveries (even beating the wheel), and they have several different forms, e.g.
  1. Estimated numbers
  2. Measured numbers
  3. Exact numbers
Estimated numbers is the compass
Estimated numbers is the most useful form of numbers since they can be easy to obtain and are often accurate enough to make a decision. My belief is that most sound decisions in the world are and should be based on estimated numbers where the level of precision is known. Estimated numbers are frequently obtained by having an numerical model (of arbitrary simplicity or complexity), and create estimates by doing approximations/calculations or simulations within the boundaries of the model. Estimating extreme numbers (e.g. minimum and maximum) can also be useful for understanding.

Estimation techniques typically works within a range
An example an estimated number is to estimate distance by stretching your arm with your thumb up and use the thumb as a sight towards the point you want to estimate the distance to. Then the distance is roughly ten times the perceived distance you see when switching between closing left and right eye (e.g. if a mountain is 500 meter from you the perceived distance when switching eyes to aim with would be 50 meter). This estimation technique has its limits since it requires you need to be able to estimate the perceived distance by switching eye to aim with, and that probably doesn't scale up or down by orders of magnitude.

Measured numbers is the path (in retrospect when looking back)
Measuring something before it exists to my knowledge impossible (at least for all practical purposes), this means that measurement numbers only can be found in retrospect of an occurrence.

Measured numbers have limited accuracy
Heisenberg showed (roughly) that measurements of particles have a finite precision (or if the precision is overly high the measurement influences the particle being measured). I believe that in most cases of measurements there will be errors, but fortunately the error distribution can be estimated. When you hear someone talking about exact measurements they may be right, but usually they aren't, but the measurements could very well be exact enough for their purpose.

Exact numbers are rare
There are a few exact numbers, e.g pi and e (and even they rely on approximations when being used), but not overly many in the real world. Sometimes a number appears to be exact, but then it is usually a measured number or an approximation. Sometimes numbers appears as exact numbers but that is usually either a measurement or an estimate with what looks like high precision (but it could also be more or less educated guesswork), e.g. 0.00730100000000 looks impressively exact, or at least more accurate than 0.007 but that might not be the case.

value(estimates) > value(measurements) > value(exact numbers)

Thursday, February 7, 2008

Arction in the language scene..

..but not for everyone

Paul Graham's programming language Arc currently gets a lot of attention. For many it looks indistinguishable from lisp^H^H^H^Hmagic, but since it is not for everyone that really doesn't matter.

"It's not for everyone. In fact, Arc embodies just about every form of political incorrectness possible in a programming language. It doesn't have strong typing, or even type declarations; it uses overlays on hash tables instead of conventional objects; its macros are unhygienic; it doesn't distinguish between falsity and the empty list, or between form and content in web pages; it doesn't have modules or any predefined form of encapsulation except closures; it doesn't support any character sets except ascii. Such things may have their uses, but there's also a place for a language that skips them, just as there is a place in architecture for markers as well as laser printers.", source: - 2008-Feb-7

Development in perhaps less political incorrect language alternatives include Grails version 1 and Arc in Javascript.

And as if that wasn't enough Fowler is starting to tempt developers with domain specific languages, wonder if he will take the Arc Challenge? It seems like the current replies could fill a book, beautiful code anyone? Eh, that title is already taken.