Complexity of David

Data Science, Machine Learning, Artificial Intelligence, Visualization, and Complex Systems.

The El Farol Bar Problem in WallStreetBets - Reddit

reddit / wallstreetbets reminds me of the El Farol Bar Problem. Every Thursday a fixed population wants to go to the bar, unless it is too crowded. 1) if less than 60% they’ll have fun 2) otherwise they’d rather stayed at home. Now what has this to do with $gme?

The premise of the game is everybody decides to go or not in isolation. The strategy is based on historic data from previous weeks. This is a minority game where there is no winning strategy and the attendance of the Bar oscillates in characteristics patterns around 60.

The wallstreet regulators want the buyers and sellers to act in the same way. They can have historical data about the market, they can have fundamental knowledge about companies activities, but they must take individualised decisions.

A few years ago I studied the sharing of information between the agents in the El Farol Problem. The modified version introduced a variation where each agent would ask a few other agents (friends) if they were planning to go to the bar.

Then, confronted with what the majority decided (it is like an election) the agent could flip its initial decision. This made the dynamics completely different. The amplitudes of the oscillations changed dramatically.

wallstreetbets/reddit are doing just that. Users sharing information about their intentions. Each one deciding about what to do after receiving that collective map of information. This alters the dynamics of the market and the regulators hate it.

Reply @sixhat

Covid Em Portugal E Na Europa, Porque Não Estamos Indignados?

Em casa onde não há pão, todos berram e ninguém tem razão

COMPROMISSOS LEVAM-NOS O VENTO, para o CEO da AstraZeneca um contrato não é um contrato, apenas uma manifestação de intenções. Diga lá outra vez? — Eu quando faço um contrato com um banco para comprar uma casa manifesto intenção de a pagar, agora se o pago já é outra coisa e o banco fica sereninho e oferece-me bolinhos e chá. Lembremo-nos que a AstraZeneca é uma companhia Britânica (sim aquele que saiu da Europa e que enquanto esteve sempre comeu à la carte). Alguém tem dúvidas que estamos a assistir a uma forma de F*** You EU por parte dos bifes?

Questão 1, a Pfeizer anuncia nos EUA que vai aumentar a produção, entretanto por cá andamos todos a escoar os galheteiros das ampolas que nos restam? Conseguem explicar? Entretanto a única boa notícia é que a incapacidade da Pfeizer de fabricar na Europa vai ser colmatada em parte pela francesa Sanofi. Quem é que vai receber essas 125M doses primeiro? Any guesses?

Questão 2, com as taxas de vacinação verificadas na europa (e daí esta polémica com os contratos) só teremos 50% da população vacinada lá pelo Natal. Teremos? Lembram-se que Portugal não quiz comprar todas as vacinas a que tinha direito porque iam ser entregues só em Dezembro? Pois, parece mesmo que foi uma decisão acertada. Mais uma.

Que prioridades da vacinação são estas? É muito difícil alguém da DGS ir aos dados que a própria DGS publica, abrir o excel no boneco dos óbitos por grupo etário e definir as prioridades aí? Algo tipo +80anos, +70anos, +60anos, etc… e incluir também aqueles que tem que cuidar desses doentes quando eles aparecem nos hospitais assim como os desprotegidos? Bastava só isso. É preciso agora fazer disto um “Salve-se quem poder”? Bem se calhar o não comprar vacinas para Dezembro tem outras razões que desconhecemos. Será?

Questão 3, onde está a Graça Freitas?

Two Vaccines, More to Come

COVID19 IS BEATING THE CRAP out of this old world. In dealing with it we have seen both the best and the worst of humanity. We have two new vaccines. More are coming soon. I couldn’t be happier.

BUT THESE VACCINES come with a price attached. They are difficult to distribute. This makes vaccines a rich-people solution. They will face great difficulties to reach the poorest and remotest regions of the world.

THE WORLD HAS to decide on a joint strategy and a joint financing scheme. Without one, we will live with SARS-cov-2 for years to come. This will lead to reinfections. Vaccination (if immunity is not long) will be in constant need.

THIS IS HOW the pharmaceuticals will make profit. Not from the first season of vaccination. The world will pay and they won’t charge much (as not to loose the market for another company). But if COVID returns every winter, then that’s when they’ll have a gold mine in their hands. We will pay for these vaccines, or our taxes will. Either way the pharmas will get their pay.

COMPETITION at the levels predicted by pundits will not be real. Plenty candidate vaccines will dwindle. One thing is to come up with a vaccine, another is the ability to mass produce it and mass distribute it.

WHERE existing distribution channels will play big roles, smaller companies will struggle. Those with a head start will impose their technology. They will have better distribution and clamp down competition.

TWO mRNA vaccines are now on track to the public. The technology is novel. They will open the door for new drugs and treatments. Anything you can express with genetic material will be at hands reach. That poses great ethical challenges. Think about non-health related applications.

What Are Pull-Up and Pull-Down Resistors?

Most of the inputs (sensors) connected to Arduino work by exploring some kind of Voltage Divider.

Voltage Divider

As the name gives it away, a voltage divider splits the voltage of a circuit in two parts.

Voltage Divider

in the above circuit, the voltage betweenand ground is divided at. The value ofis dependent on the resistorsandvia:

Pull-Up Resistor and Pull-Down Resistor

Imagine that you replace eitherorwith a switch (but not simultaneously). When the switch opens the circuit the value ofis “pulled” to the voltage present on the resistor side. If theis replaced by a switch,is a pull-up resistor, if instead the switch replaces, thenpulls-down the voltage to ground.

Pull-up and pull-down resistors are useful because without them the inputs that readwould be floating without a reference to measure when the switch was open. And when that same switch closed without the resistor in series there would be a short-circuit betweenand ground.

What if I don’t use a pull-down with a switch?

Pull-up/down resistors stop the circuit from floating. Frequently new users setup a switch in series between 5V and the input PIN on Arduino, without a pull-down resistor. They assume the PIN to be at ground level. This is wrong.

The input PIN is floating. This means that its reading will be subject to whatever momentary internal currents are flowing through the internals of the Arduino. If you try to setup the switch in this way you’ll find that it will act in an apparently random way. It might read LOW most of the time, but sometimes it will read HIGH with the switch open. Not desirable at all. ALWAYS USE A PULL-DOWN/UP RESISTOR.

Raspberry Pi Tip: Headless With Ssh and Wifi Enabled

This tip is mainly for my own reference during future installations, but it might be helpful to anyone trying to setup a headless Raspberry Pi.

After creating the SD Card with your Raspberry Pi OS don’t rush to try it out. Add two files to its root folder: ssh and wpa_supplicant.conf


The existence of the ssh file in the boot folder will instruct Raspberry Pi to enable SSH and delete the ssh file. This file can be an empty file or with any random text in it. It doesn’t matter.


The wpa_spulicant.conf file enables wifi (if you have a wifi dongle connected to the Pi).

The contents of the file matter as they contain the passwords and wifi networks that you want to connect to. Here’s an example:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


If you want to configure multiple networks you can add more network blocks.

find the Raspberry Pi IP in the local network

It remains to find the Raspberry Pi address. I just nmap the local network with

sudo nmap -sS -p 22

Gravações - Amanhecendo Em Tempo De Quarentena

o pior do tempo de quarentena é a impossibilidade de passear na natureza. a prisão adultera-nos os sentidos. mas isso não significa que não se possa trazer a natureza até nós, pelo menos ninguém nos impede de colocar um microfone na janela numa manhã de abril e gravar.

John Conway Has Died

i’ve been a fan of his work for a long time. if I remember one of my earliest research interests was on the complexity of the game of life (2007 maybe?). well time has gone by, and today i realized John Conway has died. here is a compilation of readings about his work and life that are worth reading. any of them makes John Conway a better justice that whatever i could have written here. i just want to stay silent and appreciate the beauty of the imaginary worlds John Conway created for us.

P5.js 1.0 Released

Yesterday P5js reached version 1.0.0. This is of major, major, major importance for the community. P5js is library that promises to do in the browser what Processing did in Java, and allow the Processing community to do the transition to modern web technologies without relearning a new syntax.

But better than my words, go and read the announcement published in Medium by Laureen Mccarthy.

And finally, this is all good and fine but what P5 is there for is for the sketches. Starting with P5js is simple. Just use the online editor where everything is there waiting for your ideas.

Stop Using Sleep in Your Arduino Projects

Arduino sketches are single threaded. This means your Arduino won’t be doing two things simultaneously. The problem of this is that when you use the command sleep the micro-controller is blocked waiting for the time to pass and won’t be able to do anything full.

Wasm to Stay

It is fast && it is creepy because it will be even more difficult to know if certain websites are doing something wrong (IF YOU DON’T KNOW, TH3Y ARE), and is it THIS THING the way of the future. Why? … Because. Wasm, the WebAssembly language is here to stay. That does not mean that we have to like it. But we’ll live with it if we want the browser window to be something more than a browser window. The W3C just published the official WASM recommendations and that means basically NOTHING. Except it does. IT IS OFFICIAL. We are now in the era of the cryptic web. Let’s all hug and keep on coding strange digital currency miners and exhaust our poor users cpus with crappy code.

A Sound of Time

The guardian has a piece on Podcast, the past, the present and the future or How podcasting is falling prey to the broadcast companies.

But the internet is a marvelous place, because if you choose your pills right, you’ll be able to jump from quality page to another quality page. Only if the authors you start with put some effort into it. And John Naughton did. You should go and read his readings.

And if you follow my lead you’ll read Building a More Honest Internet and maybe think a little about this. The future of the Internet is in danger of becoming a vast rubbish landscape. Or, we can think of new ways to reinvent it. Read it and think.

Also worth reading is The Second Wave of Algorithmic Accountability. It connects with the previous links and touches some interesting points on the ethics of modern technologies. The XXI century will not be about the CAN Tech do this, but instead about the SHOULD tech do it. The discussion has started.

Sending Data to AskSensors With Python

AskSensors is an online IoT dashboard service that allows you to track data coming from your sensors. They have tutorials on the website to get you started, but for raspberry pi they went with an example using node.js. Can’t understand that.

In any case it isn’t difficult to write a python script that reads from your sensor and sends data to the AskSensors api. Here are my tips:

  1. In python use the easy to understand requests library.
  2. The URL endpoint to send data to is something like
    1. Make sure to replace the API_KEY and VALUE_1,2,xxx to the number and values of your application.
    2. The API_KEY is unique for each sensor you have.
    3. Each sensor can have several modules. For example the DHT11 sensor reads both Temperature and Humidity. This means you have one device (sensor) sending two values to module1 and module2, hence the previous url structure.
  3. send data with requests.get(URL of POINT 2).
  4. profit.

Back to School

And it’s that time of year again.

Everything that needs to work is broken, every cog in the systems is stuck, and students demanding urgent action that we cannot provide.

That’s the first week of classes. Keep calm and carry on.

Mirroring Websites Is a Pain

Modern web is a pain to mirror, or to make a copy for future reference.
You have to go through every single page in a website and probably print it to keep a copy of what was there.

I end up with mountains of Pdfs. And that sucks, namely when websites have the same title for every page. You manually have to come up with filenames for each of the pages you need to preserve and the all process is slow.

Wget might be a solution, and I’ve used in the past, but it isn’t ideal.

The --mirror switch is not enough and you end up needing to go through the manual anyway to find out what each switch means.
This is because Wget is not a mirroring tool, but a general purpose one.

Yes, I can hammer a screw in, but it isn’t the right tool for the job.

Como a Estatística Pode Enganar

Constants, Constants, and Time Is Ticking On

dentist emoji

A search engine for datasetshm it would be interesting if not for the fact that most datasets are not that public anyway. But a good idea, although it crossed my readings one year too late.

And if all cities are equal, at least under some magnifying (or should I say unifying) constant? The Commuting Principle that Shaped Urban History explains how from ancient Rome to modern Atlanta, the shape of cities has been defined by the technologies that allow commuters to get to work in about 30 minutes.

And yes, it has been a long time. And I know it has been. But time is something that I don’t have. 1440 minutes of production per day. And you better make good use of those minutes. Something that I tend to forget constantly.

And a side-note: I went to my dentist today and he asked about Brexit since I’ve lived in the UK for a couple of years. This crazy brexit mania is contagious but a train reck is better than the thought of the dentist tools in my mouth, so I talked, and talked and… couldn’t escape his tools, like the no-deal brexit is certain.

Moving to Github or Not

I’ve been wanting to move my web assets to Github for a long time. Partially because I’m downsizing my web presence (as many have noticed), and partially because of backup/versioning.

This moving is going to be multi-step process and somethings might break. But everything should be completed soon (I hope).

update: I’m back to my own server.

Plotting More Than One Data Series in One-Liner

plot of mulitple data series in R

I already covered several ways to plot multiple data series in the same R plot, either using plot, points and lines or using ggplot and using facets. What I didn’t show was probably the easiest (and I mean easiest), way to plot all data series in one plot. Using matplot!

matplot is part of the graphics library and therefore is installed during your normal R installation. It does not need any further installation and you can use it with the usual plot parameters.

Assuming that you have a data frame df with N columns and M observations and that you want to plot all columns against the first column that will provide the x points.

matplot(df[,1], df[, 2:ncol(df)], pch=19)

The above command will plot multiple data series in R in the same plot without further problems and producing the above picture.

The only condition to plot data series with the above command is that the data frame needs to be wide format (and usually it is).

If your data is in the narrow format you need to pivot the data to wide layout before you can plot multiple data series. In R, the conversion between wide and narrow layouts of the data can be accomplished using the tidyr package.

Processing Community Day @Lisboa

Processing Community Day @ Lisboa 2019

Em janeiro de 2019 decorre mundialmente o PCD ( A fundação Processing agrega o maior número mundial de designers e artistas interessados em programação para a expressividade individual e é responsável pelo desenvolvimento open source das linguagens Processing (, P5*js (, entre outras, para programação visual e artística.

O moto do processing community day é a celebração da arte, o design, da programação e da diversidade.

Este ano o PCD vai ter uma edição em Lisboa, na Biblioteca Municipal de Marvila.

No dia 18 de janeiro, pretende-se que este seja um ponto de encontro de designers, artistas e interessados, e uma exposição dos trabalhos desenvolvidos pelo os alunos da disciplina de Sistemas de Design Digital do 2º ano da Licenciatura em Design Gráfico da ESAD.CR e dos alunos de Laboratório de Projecto I do 3º ano da Licenciatura em Design Multimedia da ESAD.CR.


11:00 Sessão de abertura
11:15 Catarina Maçãs 
      (Lab. Design Computacional e Visualização (CISUC))
11:45 Tiago Martins 
      (Lab. Design Computacional e Visualização (CISUC))
12:15 Sessão de perguntas e respostas
13:00 Pausa para almoço
15:30 Inauguração da exposição
16:00 Catarina Sampaio 
      (Faculdade de Belas Artes da Universidade de Lisboa)
16:30 Marta Verde (Creative Coder (ES))
17:00 Sessão de perguntas e respostas
18:00 Encerramento

O evento conta com o design gráfico dos meus alunos:

Estão todos convidados a aparecer no dia 18 de Janeiro na Biblioteca Municipal de Marvila em Lisboa.

From Bézier 2 Turtle Graphics, All Is Smooth

— When everyone thinks Severless computing, someone is thinks about the pitfalls of it. Serverless Computing: One Step Forward, Two Steps Back

— One of the topics I teach to my Design students is turtle graphics. They find it intuitive and is a great approach for a starter programming course. You can find different implementations of Turtle graphics online (including my Utils for P5js), but Turtetoy aggregates creations on a portfolio like environment.

— Another online portfolio website for art generated by code is ShaderGif. The structure is slightly different from Turtletoy, but … horses for courses.

— Bézier curves are mind bending curves, until you dig in and understand their inner works. Secrets of smooth Bézier curves takes the plunge.

— And if you need pageviews, this Minimal Google Analytics Snippet might be enough and short.

When Is Art Not Art in the Science Zoo?

Sails Art Harmonograph

Take 1 - A Comparative Study of Computational Aesthetics — When is art not art? Or when can a machine make art?

A machine can classify, but always in reference to other things. Humans can classify, but they have been trained before on what makes something beautiful of not.

beautiful doesn’t mean meaningful, sometimes.

Take 2 - Why are tech companies making custom typefaces? — An interesting read, with an historical perspective (I love timelines :-) ).

Take 3 - Bio-inspired computing: Algorithms review, deep analysis, and the scope of applications — Genetic Bee Colony (GBC) Algorithm, Fish Swarm Algorithm (FSA), Cat Swarm Optimization (CSO), Whale Optimization Algorithm (WOA), Artificial Algae Algorithm (AAA), Elephant Search Algorithm (ESA), Chicken Swarm Optimization Algorithm (CSOA), Moth flame optimization (MFO), and Grey Wolf Optimization (GWO) algorithm? You have to love this science ZOO. And you MUST read it.

Working With Data and Python

Working with data, in any form, is the XXI century toolkit for any computation based job. And although I’m a fan of R for much of my data analysis work, python comes as a close second. And if you favor python then, there are a some aspects to consider:

  • Using pandasA Gentle Visual Intro to Data Analysis in Python Using Pandas
  • numpy — a workhorse of data manipulation. If you have data that needs linear algebra, you’ll use numpy—even if numpy is a dependency of other package (e.g. pandas uses numpy). Check the quick start of numpy if your starting out. Also, interacting with C,C++, or fortran routines is a must.
  • If you need to use Tensorflow, python has you covered.
  • Working with Jupyter Notebooks — Everybody seems to love them. I use them for EDA (exploratory data analysis) and prototyping small ideas, but not for long complicated sessions. The burden of knowing the state of computation makes it daunting for long sessions. This comes in part from the fact that you can re-run code cells in out of page flow order. This means that you have to consider if the output you are getting is affected by code ran in another cell. But if you can’t code in a code editor, then coding in a browser might work for you. The most interesting thing in Jupyter are the different kernels. They allow you to experiment with other languages in an unified interface.
  • Scikit way — Another ML library that runs on top of numpy. See a trend here?
  • All this data is nice and all that, but you need to visualize it or it won’t be of much help. For this Matplotlib is king. Almost every package will ask you to import matplotlib.pyplot as plt so you can plot your data with python. It has come a long way and is a mature plotting solution.

Reading About Podcasts - Are They Returning?

Podcasts are near and dear to my ♥ — But I imagine some of you know this by now if you’ve been reading this blog — The New Yorker wrote a long format piece about how podcasts became a seductive way of storytelling ♣ This is a nice read although centered on the major podcasts of the past years (the crime-investigation type).

Markdown Is the De Facto Language for Writing in the XXI Century

I’ve talked before about how much I use Markdown for my day to day writing • Heck, markdown powered this blog for a long time, even while running on Wordpress • but now I decided to tell you how I use Markdown in different scenarios, and what the tools are

Taking notes in Markdown

nvalt • the clone and improved version of Notational Velocity • I use to write everything I need in Markdown • A cloud folder stores all my MD files and make them accessible everywhere • Even when I’m not on my computer and don’t have nvalt around, I still can edit the files • No more need for messing around with proprietary formats

Blogging in Markdown

My blog runs on Hexo, a Node.js static content blogging platform • I write all posts in markdown • When I’m blogging I use any Markdown app installed on my computer or any simple code editor • I’m not fussy about it • It depends on the project I’m working on and the editor is the one open at the time of the writing • Hexo also has a plugin for editing post called hexo-admin • Pretty basic, but if you wan’t to use something simple and dedicated to your blogging experience, it works

Fast Markdown documents

When I need to write an exam, a letter, or even a journal paper I gravitate towards using Typora • A Markdown editor with default styles so nice that I created a couple of my own based on the defaults offered • This allows me to write something “academic” fast enough without thinking about extra shenanigans • It replaced writing in LaTeX for most of my document needs

Markdown Presentation

For years I’ve been a fan of Keynote but I started using Markdown for most of my work • I mainly use two tools • Marp for quick presentations that don’t require much thought and reveal-md for presentations that need more interaction and that I can release as a mini-website for my students to experiment with

The main reason to abandon keynote has to do with code snippets and code highlight • In keynote you can’t do it • You have to prepare your code somewhere else and hope that when copy and pasting everything is style properly • That or making screenshots • With Markdown you write the code inside a code section and the renderer will highlight it for you • Both Marp and Reveal-md take care of it

The reason I like reveal-md these days is that it allows an extra layer of presentation: Interaction •I can mix Markdown with HTML and Javascript and create some interesting interactions for my users • I always found it somewhat problematic that the interactive presentations I gave to students were flattened out when producing slides to take home

With reveal-md I export my presentations to a static website and I can either give them the zip file or upload the contents online to my server • In any case the copy they get is not crippled by the lack of features of the format • Reveal-MD is an helper project to work with Markdown files in RevealJS • It is must-have because it makes it so much easier to be productive • If I had to write the entirety of a presentation in HTML I wouldn’t be using it • Markdown gives me the freedom to write content first and then add the interaction needed via JavaScript making slides unique

Markdown in Data Science Notebooks

Jupyter Notebooks support Markdown cells and this makes the code much nicer to read • Everything is formatted correctly and you don’t need to hurt your eyes in pages trying to resemble fixe-space typewriters from the pre-computer days

Markdown Logs

My backup system uses rsync and a handful of locations && hard drives • To keep everything working correctly I tend to log events like backup start, backup end, error copying, among others • And from time to time I like to manually read the log to see if everything is correct • Instead of having a TXT file, I log everything in MD format and to read I see a converted format in HTML • Much easier to spot problems


Markdown is not perfect and somethings from other environments might be missing, but it becomes handy as soon as you adopt the semantic conventions of the language • You end using them even if not intending to render them * The terseness of Markdown makes it one of the most useful languages/conventions to know and use in the XXI century

Aesthetics With Deep Learning

Pantograph Rose

Understanding Aesthetics with Deep Learning ♣ This is an oldie but a important topic. Aesthetics. Can “machines” create beautiful objects? Can machines even tell us what is beautiful and what is not? Other work on the same topic is taking a comercial approach to this problem. eg Deep Learning for Classifying Hotel Aesthetics Photos. What is the role of beautiful photos in online hotel room booking (tldr: is not the price alone that matters).

Another aspect of this is that not everyone sees beauty in the same way ♣ Personalized Aesthetics: Recording the Visual Mind using Machine Learning.

And in Design: is it important to re-think the tools of the trade in the age of ML? ♣ Rethinking Design Tools in the Age of Machine Learning

And one unrelated topic—as such thing exists ♣
Motif and Hypergraph Correlation Clustering

Why Are Ants So Smart?

Modeling tropotaxis in ant colonies: recruitment and trail formation ♣ Ants are marvelous little creatures.

Unifying Isolated and Overlapping Audio Event Detection with Multi-Label Multi-Task Convolutional Recurrent Neural Networks

Topological Approaches to Deep Learning ♣ This has to be a deep read… no pun intended. :-)

Building an Argument for the Use of Science Fiction in HCI Education

Sunday Networks on Arxiv

Nothing to do on a raining Sunday afternoon? I was going through the CS section of arxiv and a couple of submitted abstracts caught my attention.

The former is all about speech synthesis and I’ve seen much interest in this area. There will be game-changing applications and we are now past the time of robotic interaction voices of the sci-fi movies. The latter is about getting new backcloth to convolutional neural networks based on graphs. Hm… always an interesting read.

Machine Learning News

Uber Introduces PyML: Their Secret Weapon for Rapid Machine Learning Development

Facebook, NYU expand available languages for natural language understanding systems

Demystifying Convolutional Neural Networks

Turnilo — let’s change the way people explore Big Data

Significantly faster generation and training for AI-based audio systems

Interesting links in this collection today, namely PyML by Uber. It has become important to understand what they are doing right here as the world is moving fast in ML domains. And they are using Python. The FB links are of particular interest because of their application fields (NLP and audio systems). I’m interested in these two topics right now and was a surprise to come about this research.

Some Interesting Tek Readings

Golden Rules of Typography on the Web

Building AR/VR with Javascript and HTML

Node.js Guide for Frontend Developers

Drawing Images With CSS Gradients — HTML and CSS are so mature now that they are becoming a fun playground. Animations, transitions, drawing images… you name it.

Object detection with 10 lines of code — Interesting approach, but… not really 10 lines of code, just calling library functions doesn’t make it simple.

7 Performance Tips for Jank-free JavaScript Animations

How to Steel 50 Million Bees — An amazing story about an industry that is so invisible 99% of the time.

Are we stuck with cement? How one of the biggest industries in the world is not doing its part in getting a sustainable environment. Read and think about it. You next sustainable project might not be as clean as one thinks.

Why Is the for Loop Faster in This Javascript?

I’ve measured and tested and what not javascript loops and always came to the conclusion that we don’t know how Javascript is going to behave.

In the following example function f1 is substantially faster than function f2. Can’t understand why.

function tic() {
the_time =

function toc() {
console.log( - the_time)

function f1(z) {
let len = z;
let buff = []
for (let i = 0; i < len; i++) {
buff[i] = i;
return buff;

function f2(z) {
let len = z;
let buff = []
while (len--) {
buff[len] = len;
return buff
tic(); f1(2 << 20); toc();
tic(); f2(2 << 20); toc();

Your Results:

Normally I would say that the reversed while would be faster. It has been in other instances. But in this case we want to create an array with numbers from 0 to z-1. In this case the for loop is much faster (tested in Chrome, Firefox, Opera). What is going on? Is it a caches problem where JS engines expect the “straight” order and not the reverse one?


What if we pre-allocate the size of the buffer before iterating over it as in function f2. This would lead to the new function f2_new

function f2_new(z) {
var len = z;
var buff = [];
while (len--) {
buff[len] = len;
return buff;

Notice that I’m creating a buffer with the correct length before looping over it. If you run this version you’ll get the fastest while loop.

This version is now on par with the for loop and in some benchmarks it is substantially faster. So, order restored in the realm of Javascript. Me happy again.

Quick Way to Use Jeromq in Eclipse

  1. Download a jeromq JAR from the maven repository (current version 0.4.3)
  2. Place the jar file in a “lib” folder in your project.
  3. Add jeromq.jar to your project libraries in the Project Build Path
  4. Try the simple hwserver/hwclient examples
  5. you can run both the server and clients from within eclipse, but if you want to run them from the command line:
  • Assuming that you are using eclipse, and that you placed the jar in a “lib” folder
  • go to your “bin” folder and run
  • java -cp "../lib/*:." HWServer

  • java -cp "../lib/*:." HWClient

  • Notice the codepath setting with -cp "../lib/*:." In windows you’ll have to replace the : with ;.

This will create a little setup that allows you to develop and experiment with jeromq.


See the Pen Pug+SASS testing by Dave (@sixhat) on CodePen.

This Is a Kafkian World. May 17, 2018

Four Distributed Systems Architectural Patterns by Tim Berglund

Algorithms Behind Modern Storage Systems

Finland offers free online Artificial Intelligence course to anyone, anywhere

Take Five, Sunday, May 13

Supercollider - This could be such a great tool if it didn’t force me to learn a new language. Not saying that it is a bad language (per Wikipedia sclang is dynamically typed, garbage-collected, single-inheritance object-oriented and functional), it is just that right now I have my hands (and brain) full with other things.

Artificial Neural Nets Grow Brainlike Cells to Find Their Way - Can’t understand Wired use of ALL CAPS. But what do I know?

How to build a Gesture Controlled Web based Game using Tensorflow Object Detection Api

Burned out: why are so many teachers quitting or off sick with stress? - One more month to go, one more month to go… :-)

Inbox zero and the search for the perfect email client - My inbox count is 1324 :-( .

Saturday, 12 May

I Used The Web For A Day With JavaScript Turned Off - Unfortunately the web is a race between those that push stuff out and those that have to implement them. (

Getting Started With The Web MIDI API - It is a real pity that web Midi isn’t well supported across browsers. (

Consensus Mechanisms — As Detailed and Concise as possible! - Great read on such important algorithms, informative, mainly focused on blockchain technologies. (

“A Sloppy Machine, Like Me”: The History of Video Synthesizers

What’s the difference between UX and UI design? - Everywhere you need to tick boxes, put things into small confined spaces, otherwise they’ll bite you in the hand. (

Help! Need an Index Card and Contacts Manager Apps for OS X

I’ve rely on physical index cards for many tasks related to managing information, but I’d like to have the same functionality on the desktop. I don’t want it integrated in a “brainstorming, mindmapping” package, or in a “screenplay” software. I wanted something like a shoe box of index cards, that I could just sort by some criterion, or group under certain labels. Just something simple. In design making things simple is sometimes the hardest.

My other need is about the Contacts app in OS X. As all Apple software, Contacts is suffering from the “we don’t have time to think about OS X software while we are stealing candy from hipsters buying iPhones” syndrome. I really need to have some way of categorizing, cleaning, and searching through my contacts easily. Every time I open Contacts, I’m surprised by the number of people that I don’t know and never contacted. I’m starting to think that the app just comes up with fake contacts like fake twitter followers.

If you know about an app that can help me, please share it with me! I’m avidly searching for apps to solve these two tasks.

Big Data, Digitization, and the Social Change: Big Data Ubiquity Symposium

I’m very happy that Ubiquity just started publishing a symposium on Big Data, where I have a humble contribution as editor and author. The introduction statement of this symposium is available from the ACM website.

For you to get an idea about what this simposium is all about pleasel let me quote the paper:

The term “big data” is something of a misnomer. Every generation of computers since the 1950s has been confronted with problems where data was way too large for the memory and processing power available. This seemed like an inconvenience of the technology that would someday be resolved when the next generation of computers came along. So what is different about big data today? The revolution is happening at the convergence of two trends: the expansion of the internet into billions of computing devices, and the digitization of almost everything. The internet gives us access to vast amounts of data. Digitization creates digital representations for many things once thought to be beyond the reach of computing technology. The result is an explosion of innovation of network-based big data applications and the automation of cognitive tasks. This revolution is introducing what Brynjolfsson and McAfee call the “Second Machine Age.” This symposium will examine this revolution from a number of angles.

Our authors will argue the big data challenge is the not technical problem of moving the maximum amount of bits in the minimum amount of time, but the scientific challenge of formulating methods to represent the complex and entangled systems that we must design and manage to run the modern world. This goes beyond “computational analytics” that abstract statistics from large data sets; “data mining” that discovers useful structures in combined data streams; and “visual analytics” that display multisource data as ingenious maps, color-coded images, and multidimensional videos to aid understanding and inform decisionmaking.

Big Data is a no brainer game changer. Understanding it and more importantly, understanding its implications for society will clear many misconceptions around Big Data. I hope that by reading this symposium we can contribute for some clarification of the field.

[REFERENCE:] Jeffrey Johnson, Peter Denning, David Sousa-Rodrigues, and Kemal A. Delic. Big data, digitization, and social change: Big data (ubiquity symposium). Ubiquity, 2017(December):1:1–1:8, December 2017.

A Collection of Great Visuals on Sort Algorithms

Sorting algorithms are one of those basic concepts that every CS course has, and that act as a great pedagogic tools for teaching students about how computers work. But many times they tend to be difficult to visualize and explain. That’s why it is always great to find some visualizations that are very clear and that compare several algorithm side by side.

Android Default Calendar APP Just Doesn't Cut It Anymore

I’ve been using Google’s Calendar since I can remember. The fact it has become one of the most important tools in my daily running around. I use it both to plan the future and to take short notes of the past. It acts like a life log.

Lately I’m finding that the Android version of Google Calendar needs an upgrade in terms of usability and simplicity. It doesn’t show all my calendars. When adding events, seems to hide them until some background thread thinks that I should see them (usually at random). The events entered sometimes don’t sync quickly with the online version. Argh…

The worse thing is the lack of feedback in the cases when your event doesn’t show right away on the calendar. You don’t know if it was recorded or if it just disappeared into the internet oblivion…

Calendar Alternatives?

Right now I’m using the simple (and beautiful) Cal. In works in a totally different way, and I’m taking some time to get used to it. But it has many positive things, namely that it did recognise ALL my calendars from the G company.

If you have other preference of a calendar app for android, please leave your comments below and tell me why. I’m searching for something really productive. I’ll take a careful look at your suggestions.

Hello New Static World

I’ve been trying to move away from Wordpress for so many years that I don’t even remember when I first started using it. It was probably in early 2000s but who cares anymore? WP has since improved and has grown up but also sideways. It has become the blogging platform of choice.

My God, it feels great to be free again.

All I really needed was a simple static website. That’s why I’m moving on. The old 6H is still there if you want to check it out, but now everything is powered by a static site generator.

I’ve chosen Hexo. Why? Jekyll, Hugo, and many others could be chosen. But I couldn’t run away from Node.js. Javascript is a great language and with all the recent developments it will very important in the years to come. Therefore, if I’m writing a blog why not use a static engine that runs on the same technologies? Can’t beat that.

  • What’s next?

I’m updating things slowly and trying other things as I explore the static generator. Somethings might break, but I’ll try to fix them quickly if they don’t work.