Generating Colored Gosper Curves

Yesterday I finished a script to generate colored Gosper Curves. You can find it in Github, as a Gist:

The main idea behind this code is to generate an ordered list of points using a L-system (a set of production rules combined with a mechanism for translating the generated strings into geometric structures).

One extra idea I've applied is to work with the HSL color space instead of the RGB color space, this way I can do a random walk over the Hue dimension (with "smooth" steps) keeping lightness and saturation as constants.

And this is one of the generated images: Gosper Curve

Tags: Fractals, Geometry, Mathematics, Generative Art, Art

Dealing with precise timestamps in PHP

PHP does not offer any native class to implement timestamps with milliseconds or microseconds precision, the only "native" way to do it is working with the weird microtime function and/or the \MongoDate class (available through the mongo extension).

Using the \DateTime class is not enough, because it only can offer seconds precision, and using the \MongoDate class isn't a good idea if you aren't using MongoDB or if you care about coupling. In fact, the mongo extension will be deprecated in a few months in favour of a new extension that is in active development right now.

Because this, I've developed two Composer packages to allow using type hinting without increasing coupling and with less abstraction leaks:

Is my intention to modify the PHP-Jiffy library at the same time of the new MongoDB's extension release, so it will be very useful for people who likes moving fast to new software versions.

Tags: PHP, Timestamps, Doctrine, MongoDB

Added Isso commenting system

Since today is possible to post comments in this blog :) . I've integrated the Isso commenting system in order to allow readers to send comments.

My reasons

I've chosen this software because I don't want to help big companies to destroy our privacy. If people want to tell to the world everything about themselves then I'm not opposed to that, but I don't want to force the people who are worried about protecting its privacy.

Disqus is a great option to add comments in static blogs, but it requires registration and allows user tracking around the web.

About the underlying technology

Isso is programmed in Python and runs in the server as a daemon, and it can be integrated with the following "http handlers": Gevent (this isn't an http handling library, but a generic non-blocking IO handling library), uWSGI, Gunicorn, mod_wsgi (for Apache), and mod_fastcgi (also for Apache).

For simplicity, I've chosen to use Gevent, it's the easiest option (no settings :D), but maybe I'll change the settings in the future in favour of uWSGI because its flexibility.

Gunicorn is not an option because I need to optimize every service in my server (my server is VERY tiny), and the prefork model isn't enough efficient.

mod_wsgi, and mod_fastcgi require some configuration and are too coupled with the Apache server, so I won't consider them neither.

Some points that I dislike

I'm very grateful for the existence of Isso, but I it needs some rework: The management system is too complicated and rigid, there is lack of documentation, and there aren't new releases since 7 months ago (I think this is because there is a work in progress on a big refactor).

Because this, I'm considering to study the Isso's code in order to be able to contribute, or to fork the project if my needs don't match with the project's aims.

Tags: Blog, Isso, Privacy