Reference vs. Interpretation April 17 2021 In Brains in a vat Putnam argues that if an ant walks around and the path it traces happens to “draw” or “resemble” Churchill that doesn’t imply the image left in the sand represents Churchill, because the ant had no way of knowing about Churchill. The same about a description of trees found in a text that happens to be written by monkeys randomly typing…
Programming Languages are not Languages September 01 2018 In my previous article I talked about how the metaphors used to present a problem, set the stage for how we are going to talk about the problem. They provide a framework for our thinking, on one side helping us solve it, and on another side they constraining the solutions we find. I ended the article by saying that we are so used to call…
The Power of Generative Metaphor August 31 2018 In Generative Metaphor: A Perspective on Problem-Setting in Social Policy Donald A. Schön presents the idea of how metaphors are central to the task of setting the frame in which we are going to make sense of a problem[1]. According to Schön, the metaphor used to present a problem, sets the stage for how we are going to talk about the problem, how we…
A Veritable System of Intercodical Relations August 24 2018 In the episode “Kimmy Goes on a Playdate!” from Netflix’s TV Series Unbreakable Kimmy Schmidt , there’s a couple of interesting bits that can lead us to reflect on how we humans learn about interpreting codes, and thus we can extract meaning from text in different contexts. Understanding when context changes the meaning of a text is a…
Lector in Codigo May 07 2018 You can download a PDF of the paper pre-print here In this article I want to explore the relation between the process of writing computer programs with that of writing literary works of fiction. I want to see what parallels can we trace from the ideas presented by Umberto Eco in Lector in Fabula and Six Walks in the Fictional Woods , with the way we write programs…
Metaphors We Compute By January 17 2017 In the book Metaphors We Live By, George Lakoff and Mark Johnson set out to show the linguistic and philosophical worlds that metaphor wasn’t just a matter of poetry and rhetorical flourish. They showed that metaphor permeates all areas of our lives, and in particular that metaphor dictates how we understand the world, how we act in it, how we live it. They…
Java ThreadLocalRandom Explained October 26 2016 In this blogpost I’d like to present some things I’ve found while trying to understand the implementation of the jdk8 ThreadLocalRandom class. What was my motivation for doing something like that? Over the weekend I was reading the Second Volume from Knuth’s TAOCP “Seminumerical Algorithms”, where he devotes the whole of Chapter 3 describing…
Donald Knuth Was The First Erlang Programmer Combing through The Art Of Computer Programming (TAOCP) by Donald Knuth, I’ve found something interesting. Right at the beginning of the book, where he’s stating the basis of his presentation of algorithms, he proposes a different notation for expressing algorithms, that seems to be used only there on section 1.1, and then forgotten for the rest of the…
Testing Java Libraries from ScalaCheck In this article I would like to show you how to integrate ScalaCheck into a Maven project in order to test your Java classes. I will use as an example the PhoneNumber class as seen on Item 9 on the book Effective Java. The idea will be to test that the equals method implementation on that class conforms to the equals contract according to the Java…
What We Talk About When We Talk About Distributed Systems For quite some time now I’ve been trying to learn about distributed systems, and it’s appropriate to say that once you start digging, there seems to be no end to it, the rabbit hole goes on and on. The literature in distributed systems is quite extensive, with lots of papers coming from different universities, plus quite a few books to…
Gossip Protocols, Where to Start This week I started reading about Gossip Protocols, or Epidemic Protocols as they are sometimes called as well. It’s quite an interesting topic in distributed systems and as you might guess, once you start investigating, the rabbit hole goes on and on. Gossip protocols were initially used as a way to maintain consistency on databases that were replicated at several…
This Erlanger Used The Process Dictionary, Look What He Found Erlang has something called Process Dictionary which is a sort of Key/Value store that belongs to each Erlang process. We can use it to store values in a simple manner inside Erlang programs while avoiding the limitations of Pure Functional Programming. The anti-flames suit is sold separately tho. There are some articles out there…
Folding Erlang Records April 27 2015 When developing the new RabbitMQ Delayed Exchange plugin I had the problem of extracting values from deeply nested records like the one created for message deliveries in RabbitMQ. Imagine you have the following record from which you need to access the headers filed of the innermost #'P_basic' record. #delivery { message = #basic_message { content = #content {…
Harmful GOTOs, Premature Optimizations, and Programming Myths are the Root of all Evil What follows is the presentation I gave in the inaugural meeting of Papers We Love Madrid. The subject of the talk was the paper Structured Programming with Go To Statements by Donald Knuth. The biggest problem we have as human beings is that we confuse our beliefs with reality” - Alan Kay. The question is…
A Programmer’s Role September 02 2014 The other day I found an article from 1967 that could easily be called “Clean Code, 1967 edition”. The article explains what separates bad programmers from good ones, and bad programs from good ones. One of the main themes of the article is how to make our programs so that they survive the passage of time, entropy as they called it back then, or code rot as…
On Contributing to Open Source August 29 2014 The other day I was reading a blog post in Spanish where it was discussed how people and companies contribute to open source. Many people shared their views in the comments section, on why to collaborate, why not to collaborate, about why some certifications should be cheaper, about rewards to contributors and what not. The whole discussion prompted me…
Replication Techniques: some papers and an interesting book August 27 2014 In this post I would like to share some papers I’ve found this week, along with a book on database replication techniques. This week I started doing some research about replication in distributed systems. My first stop was a book called Replication Techniques in Distributed Systems which has quite a few interesting quotes…
A Not So New Software Morality May 07 2014 Now that we all know TDD is dead, is time to perform some archeology, to understand from where it came from. A good place to do that is the book Software Testing Techniques by Boris Beizer. Originally written in 1983, there’s a “new” edition from 1990 that can be purchased form Amazon. The book covers Unit Testing as well as Integration Testing, among…
On the speed of Algorithms and Faster Hardware April 08 2014 Today I’ve read on Twitter a half-joke saying that basically we can just implement our code and then wait for faster computers to improve the speed of our programs. As many might know, that’s not actually the case, but instead of trying to explain this, I’d prefer to let the authors of The Design and Analysis of Computer Algorithms…
The Power Algorithm March 19 2014 In this blog post I would like to show how a very basic idea like raising a number to a certain power could lead us to discover abstractions like Semigroups and Monoids. There’s a very well known algorithm for calculation powers, that is x to the power of n or simply: x^n . Donald Knuth presents the algorithm in section 4.6.3 Evaluation of Powers of TAOCP. The…
You don’t roll your own crypto March 2 2014 Imagine you enter a contest organized by the National Institute for Standards and Technology (NIST), where the goal is to design a new encryption standard to replace DES and Triple-DES . Some of the contestants? The RSA, IBM, Deutsche Telekom and Counterpane (a team lead by Bruce Schneier). Would you think you stand a chance of winning? I know I…
Why you should learn Erlang February 24 2014 With all the rage about WhatsApp acquisition by Facebook , people is going crazy over Erlang. Even recruiters are using it as a weapon to lure engineers in. So I said, what don’t I write that blogpost about why I consider people should learn Erlang? Keep in mind this is not a blog post about how to program in Erlang, nor is it a fanboy attempt to say…
Shift-And Visualization January 05 2014 In this article I would like to describe the Shift-And algorithm for pattern matching, based on the book Flexible Pattern Matching in Strings . Apart from the actual description, you can scroll down for a demonstration of how the algorithm works. Shift-And is categorized as a prefix-based algorithm, similar to KMP , but what Shift-And does is to keep a set…
Things I learnt last year January 01 2014 In this blog post I’ve plan to share some of the topics that caught my attention last year, like programming languages I used, algorithms I’ve learnt during the year, and even books I’ve read. I’m sharing this with the hope that something might be interesting to you. Let’s start with a programming language/tool that was really interesting to play with,…
Failure modes in distributed systems December 20 2013 As I said in my previous blog post, I’ve been reading the book Fault-Tolerant Real-Time Systems: The Problem of Replica Determinism , which now I call “The Yellow Book” . Since the book is small and self-contained, I’ve found it very good to get an introduction to Distributed Systems. It has a very good section with a list of papers that the…
Tell me more about your real-time systems December 14 2013 I’ve been reading the book Fault-Tolerant Real-Time Systems: The Problem of Replica Determinism and I’ve been sincerely blown out by the content. The book is really interesting, and even more for me: a complete n00b with regards to real-time systems. The second chapter gives an introduction about automotive electronics, since the…
RabbitMQ Internals - Credit Flow for Erlang Processes September 09 2013 With a queueing server like RabbitMQ there’s the potential problem of having publishers that out pace consumers, creating the issue of queues that start to back off and get filled with messages. If this problem is not taken into account, RabbitMQ will run out of disk space at some point. While this is more off an issue for the…
RabbitMQ Internals - Validating Erlang Behaviours September 04 2013 RabbitMQ implements several routing algorithms in the form of exchanges, therefore we say that each exchange has a type . By default RabbitMQ comes with four exchange types: direct , fanout , topic and headers and allows the user to add new exchange types via plugins. For example there’s the rabbitmq-consistent-hash-exchange which…
RabbitMQ - Sanitizing user input in Erlang September 02 2013 This post presents a rather basic technique for user input sanitization but useful nonetheless. Let’s first introduce the problem at hand. RabbitMQ supports various types of routing algorithms that are implemented in the form of exchanges. Therefore each exchange has its own type . Exchange types are declared as Erlang binaries, like…
RabbitMQ - Validating User IDs with Erlang Pattern Matching September 01 2013 In the previous blog post on this series on RabbitMQ internals we saw how Erlang’s pattern matching can be used to process protocol calls, in this one we are going to see how RabbitMQ handles the validation of user ids by using pattern matching, one of Erlang most powerful features. User IDs can be used in AMQP to tell a…
Erlang Pattern Matching, Protocols and RabbitMQ August 29 2013 Here’s a very simple example from RabbitMQ ’s source code on how easy it’s to implement a protocol calls with Erlang. While RabbitMQ supports many protocols , internally mostly everything is handled via AMQP. In AMQP there’s the concept of a Channel , which is just a way to subdivide connections. Most of the commands send to the…
Writing RabbitMQ Plugins With Elixir June 3 2013 RabbitMQ is a very extensible message broker, allowing its users to extend the server functionality by writing plugins. Even many of the broker features are shipped as plugins that come by default with the broker installation: The Management Plugin , or STOMP support, to name just a couple. While that’s pretty cool, the fact that plugins must be…
Using RabbitMQ in Unit Tests April 29 2013 In this blog post I want to show you a very simple technique for using RabbitMQ in our Unit or Functional Tests. Let’s say you wrote a bunch of tests for your RabbitMQ consumers and then it’s time to run them. To do that you probably need to setup a RabbitMQ server just for tests with their own users and passwords, or you need to set up a whole new…
Conference Speaking Tips June 23 2012 After having attended way too many conferences over the past two years both as an atendee and a speaker I would like to share some tips I’ve learnt along the way for those who want to present at conferences. My tips are quite simple and even obvious, but I’ve committed these mistakes many times and I’ve seen others commit them as well quite a few times, so…
The Future of php-amqplib November 16 2011 Yesterday I moved the development of the php-amqplib from here https://github.com/tnc/php-amqplib to here https://github.com/videlalvaro/php-amqplib . This library started as a fork from the repository hosted at Google Code since we wanted to use the library with PHP 5.3 and back then it was raising a lot of E_STRICT errors. The code hosted at the tnc…
Scrum is just a tool November 14 2011 Today I read an article by Martin Fowler called Flaccid Scrum that gave me a lot to think about the way I’ve seen Scrum used. He talks about a common problem in software development where the speed of a team starts to go down and down. The development process stagnates. It gets harder and harder to add new features and technical debt starts to accumulate more…
Command Line Editing Tips August 16 2011 Back when I was in Shanghai I saw one of our chinese colleagues to be able to work really fast on the command line. By really fast I don’t mean fast typing but fast edition of commands. He could jump around his cursor over the line and move words here and there with ease. Perhaps you are an advanced CLI user but in my case I’ve got really impressed by that.…
RabbitMQ Chat Post Mortem May 12 2011 NOTE 1: I’m preparing a post update to clarify some questions that I’m getting here and on Reddit. Also I’m creating some test scripts to try to easily reproduce the messaging bits so other people can test this scenario. So far I’m failing to kill RabbitMQ on my machine with 1000 consumers, 1 queue and 1 channel per consumer. I’ve got a loop publishing 50…
An Army of Zombie Minions for RabbitMQ April 30 2011 Imagine that you spawn a bunch of RabbitMQ consumers and let them in a zombie state waiting for orders to start performing some sort of work, like counting words occurrences in text files. Then from the secret chamber where you orchestrate things you will send a message to all those zombies and the will start working on what you tell them to.…
Learn You Some Refactoring For Great Good April 22 2011 The last few days I had to refactor a class of 3600+ LoC… I don’t want to go into the details of how painful is to accomplish such thing with a language like PHP that lacks a type system ala Haskell. What I would like to talk about are some coding practices I’ve found that I thought they where part of the past. Objects with a purpose Objects…
Reply to “Scala is Easier than PHP” November 20 2010 This week I came across the blog post by Wade Arnold Scala is Easier than PHP and while I agree with most of it, there are some things where I don’t. Before going on with the points, let me state something: please avoid flame wars, all the Scala vs. PHP stuff, fanboyism and what not. This post is not about that. Regarding Wade Arnold I have to…
Speaking at Zendcon - RabbitMQ and PHP October 25 2010 Next week I’ll be speaking at Zendcon 2010 in Santa Clara, California about Integrating RabbitMQ With PHP . This time the talk will be a little bit different from the one I gave at the IPC Spring Edition conference in Berlin. In this future talk, besides from presenting all the greatness that RabbitMQ is, I will show many messaging/queuing…
RPC over RabbitMQ October 13 2010 In this post I would like to address a question that I see often in the RabbitMQ mailing list and IRC channel. How to reply to a client request with RabbitMQ? I think this question can be quite tricky for new users when we are not familiar with AMQP. The big deal here is to know about the options that we can use to call exchange.declare and queue.declare . So…
Haskell and RabbitMQ September 09 2010 Since long time I wanted to try the Haskell AMQP library that’s on hackage , both to practice some Haskell and to learn more about RabbitMQ’s default exchanges. If you go to your rabbitmqctl and try the following command: ./rabbitmqctl list_exchanges Among the list of exchanges you will see a topic exchange by the name amq.rabbitmq.log . As you can guess,…
Riak Map/Reduce Queries in Clojure August 14 2010 Over this week I’ve been working on a proof of concept to see if it’s possible to use Clojure as the map/reduce language for Riak, in the same way now we can use Javascript and Erlang for that purpose. To accomplish that I needed a way to call Clojure code from Erlang. So I set up a very simple server in Clojure that runs as an Erlang node using…
Hello World August 14 2010 After some thoughts I decided to move my tech blog over to GitHub. My main reasons are that writing code examples at Blogspot is plain annoying. Also I think that writing the blog posts in a plain text file is much easier for me than doing so at Blogspot’s web interface. So, I hope to be writing here soon about the technology I’m working with right now. Expect to read…
Closerl - Clojure Erlang Bridge August 15 2010 In order to learn to program with Clojure I decided to work on a bridge between Clojure and Erlang. Why? I wanted to start by doing something that I’m familiar with. I’ve worked with erlang_interface before, bridging Erlang with PHP, so I thought that doing the same with Clojure will be a nice exercise. Besides that I’ve go to learn a lot about the…