boriel.com

Hacks, science and curiosities

PostgreSQL ODBC connection from Mac OS X

– 🕓 3 min read

Wow! Almost a whole (sabbatic?) year has passed since my last post! I really was neither in the mood, nor motivated for writing. But after having sorted out a little some other aspects of my life, I'm back, stronger than ever! :)

Among the things I've recently had to deal with …

Magic Square

– 🕓 3 min read

This week El Pais' math challenge was easier to solve than previous ones (maybe that's why I resolved it without using the computer this time :D).

The problem is the following: get a product magic square, that is, a 3x3 square whose product for numbers in every row, column or …

Ants

– 🕓 2 min read

This week's El País' math challenge (Spanish video) is again about a graph. In this case, the graph is a cube (8 vertex, 12 edges) numbered as shown in the video.

An ant starts walking from vertex #1 and changes it direction at random on each vertex (might even turn …

Hamiltonian Path

– 🕓 2 min read

Yesterday at midnight was the deadline of El País math challenge which consisted in finding the Hamiltonian path of a given graph (or to give a demonstration it hadn't any as it was the case).

A friend of mine told me a simple and elegant demonstration based on graph coloration …

Properties in C++

– 🕓 2 min read

In a previous post I wrote about Python's elegance and some tips to make your code look even fancier and closer to the English language. I'm currently rather busy programming in C++, a language I have not used for 2 years, and the code certainly looks dirtier. :(

Sometimes I want …

Idiomatic Python

– 🕓 1 min read

These last three weeks have been really stressful for me due to various reasons. Anyway, I managed to get some spare time to do something funny, like the self-replicating script posted in the previous entry.

Sometimes, when we're working on a problem, we need to denote a variable with an …

3D Fractals

– 🕓 1 min read

We're used to see 2D Fractals. I remember using Fractint fractal generator in the 90's and getting excited about the images like Mandelbrot or Lyapunov.

But now some people have extended de 2D mandelbrot fractal to a 3D complex space, obtaining these beautiful (and somewhat creepy) images:
Mandelbrot 3D  3D Fractal Zoom

There's also a …

A ZX Spectrum BASIC Compiler

– 🕓 1 min read

I'm currently programming a ZX Spectrum BASIC cross compiler in my (little) spare time. It's entirely written in python, and almost finished (hope to release V1.0 this month). It's a three stage retargeable compiler. The backend outputs Z80 code, so it should be easily portable to other Z80 micros …

Calling Perl functions from Python

– 🕓 1 min read

I'm currently working on a project and need to call old Perl functions from Python (until the perl code is refactorized and translated to python).

A friend of mine told me about PyPerl, but we found it's currently unmaintained. :(

Suppose you have a perl module, named mylib.pl, which has …

Context Free

– 🕓 1 min read

A friend of mine has sent me an URL to Context Free, a programming environment for the CFDG language -very simple, but very powerful that defines context free grammars- which generates beautiful graphic structures as shown in this post.

Ifs

This language allows you to define a ser of non-deterministic rules …