The Blog of Fourthbit

Explorations in Software

Building a Distributed Fault-Tolerant Key-Value Store

I’ve been splitting my time lately between the new Spheres project and the Coursera Cloud Computing specialization, in order to sharpen my distributed systems skills. My personal experience has been great, and I have learned tons of new stuff. The first two courses proposed building a Membership Protocol and a Distributed Fault-Tolerant Key-Value Store respectively. The store of the second assignment relies on your own membership protocol implementation (so it pays to build a solid implementation!).

These assignments were optional, but I think there is no better way for truly learning the concepts than to implement the code. In this post I will describe the architecture of the minimalistic NoSQL database that I built while studying these courses.


Traffic analysis of an SSL/TLS session

In this post I want to show what happens at the protocol level when we use SSL/TLS. For the purpose of this analysis I’ll be using a non-blocking implementation of a TCP client and server based on OpenSSL for the Scheme Gambit compiler that I’m currently working on.

Is important to note that SSL/TSL enables applications to be only as secure as the underlying infrastructural components (networks and hosts). SSL/TLS is a separate protocol that inserts itself between the application protocol (generally HTTP, but any other is perfectly possible) and the transport protocol (TCP). By acting as such, TLS requires very few changes to the protocols below and above, so the protocol can operate nearly transparently for users, meaning that users need not be aware of the fact that the protocol is in place. Of course this comes with some drawbacks, as it limits the protocol in some fundamental aspects (such as the inability to use UDP).

SSL/TLS has evolved considerably since its beginnings. Nowadays SSL 2.0 and 3.0 are considered insecure, so they are being replaced by the newer TLS 1.0/1.1/1.2 versions. The history of these protocols is an interesting topic.


SchemeSpheres Experimental: R7RS libraries and more Scheme implementations

This post is to annouce a new step towards a general and stable set of libraries for Scheme. We are finally going to port the libraries to R7RS, and try to open the architecture and organization of the project to other Scheme implementations. The main focus will continue being Gambit, but fully-compatible r7rs implementations like Chibi will be taken into account.

Some things I have to mention regarding this new (experimental) version of SchemeSpheres are:


My Time-Management Algorithm for Freelancing, Open-Source Projects and Multiple Other Tasks Simultaneously

I have multiple things going on always at the same time (lecturing, freelancing, open-source projects…). Managing so many types of work becomes daunting quite easily. I’ve always felt unconfortable with the feeling of time-wasting that comes with it. One solution, sometimes the best one, is to focus on one project and finish it, then go for the next one. But this isn’t always possible. So I devised a strategy to handle multiple simultaneous tasks, for when it becomes unavoidable and too complex to handle without a method.

First, lets give a generic name to encompass the concept of projects, jobs, tasks and responsibilities. I’ll call them threads, a computer engineering metaphor, in absence of a better word (you might suggest a better one, English is not my first language).

My methodology consist on 1) classifying threads by a particular logic and 2) running them through an algorithm.


SchemeSpheres release v0.8: Towards Beta

This release gets SchemeSpheres much closer to its original purpose: serving as a good starting point for rapid application development in Scheme. The changes in this release are pretty big!

  • Improved syntax support, thanks to SCSC (a custom version of PSyntax, by Matt Hastie).
  • Syntax-case is now supported thanks to the new expander.
  • OSX support. This expands currently supported platforms to: Linux, OSX and Android. Next in the list is iOS.
  • Emacs integration of remote debugging facilities.

If you’ve been using SchemeSpheres for your own project, beware that there are some non-backwards compatible changes. The project is still in alpha stage, thus making this sort of changes unavoidable, but is getting close to a beta release.

Happy Hacking!


Lightweight object systems for Scheme

The Scheme programming language is a minimal one – not brainfuck-like minimal, contrived and obscure, made for entertaining the twisted mind. It is a minimal language in the sense of light and form and in the concept of emergent processes, musical notes, pigments – essential materials or ideas that give birth to forms of art and construction. It is from this idealistic reductionism that my passion for this language stems. The beauty of its essential building blocks feels as the quintessential elements of the digital architecture.

But this comes at a price. Just as clay is not the material of prefabrication, light and form is not the language of mass production. A language of extreme flexibility is not a language for distribution; it’s a language for the individualistic hacker. And if you don’t agree with my digression, well, you can just look at the community. Scheme is a pure language with a very fragmented community. Nevertheless, I believe SchemeSpheres can be a useful project for a number of people and here I bring some new modules that might be useful if you are building software in Scheme.


SchemeSpheres release v0.7: New Spheres

  • New Sphere: Cairo bindings back to life! (thanks to Francisco Vallarino).
  • New Sphere: Object. Object systems for SchemeSpheres. Check the documentation to see what’s about.
  • Nice improvements and bug fixes to Spheres’ pipeline and tools.
  • More functionality and modules in some of the Spheres.
  • Improvements to the documentation and

If you want to try it out follow check out the Quickstart and Installation Guide.

Happy hacking! :)


The Best Programming Language (or How to Stop Worrying and Love the Code)

EDIT: This post has been translated to Japanese.

Every once in a while, someone, somewhere, decides it’s time to write yet another post on what’s the best programming language, the mighty properties of a forgotten language, or the new language that does it right. So my time has come. Finally, I get to say what I think about programming languages.

First of all, a disclaimer: unless you’ve developed in 30+ languages, and suffered the code of others in all (or most) of them, you can’t really be objective. So yes, I’m biased. Like most of the people writing about this topic. Actually, I believe that this topic becomes absurd as soon as you are well-versed in many languages.


SchemeSpheres v0.6 release

  • Support for Android.
  • New generators, with Android support: (minimal, remote REPL, SDL OpenGL application with remote inspection/debugging).
  • Fusion/Sake tasks handle Scheme/C/Java avoiding recompilation whenever possible.
  • Full SDL2 bindings.
  • Full OpenGL/ES2 bindings.
  • General improvements to the overall infrastructure and bug fixes.
  • More functionality in several spheres.

If you want to try it out follow these quick instructions (or check out the Quickstart and Installation Guide):


The end of 2013 brings SchemeSpheres v0.4!

The new pipeline for the Gambit Scheme compiler (featuring modules and dependencies processing, hygienic macro expansion, and library/executable compilation) is ready for Linux. With this new release, we get these (very important) changes:

  • Riaxpander is the new hygienic macro expander. This brings a number of advantages, the most important ones being better macro debugging and better define-macro / syntax-rules interaction.
  • Optional positional and named parameters are now available.
  • Spheres and Sake programs got fully refactored to make them more solid, extensible and maintainable.
  • Sake now accepts extension tasks more naturally, just placing them in the /sake/extensions directory of the Core Sphere.
  • As a consequence, sakefiles got cleaner and unified.
  • Fusion Sphere brings a new minimal generator, plus an improved opengl2d one.

If you want to try it out follow these quick instructions (or check out the Quickstart and Installation Guide):