Quaternions aka Hypercomplex numbers


There is a funny history septernion that I will post about someday. Today I will talk Hamilton’s quaternions.  They are also called hyper complex numbers and can be summarized by the formula below, which by the way, is in a plate in a bridge in Dublin. Quaternios expression is:

q = {\displaystyle a+b\ \mathbf {i} +c\ \mathbf {j} +d\ \mathbf {k} }

The i, j and k part are the vector part, or imaginary.


Multiplication is not COMMUTATIVE  – yes the first to be discovered.

{\displaystyle \mathbf {i} ^{2}=\mathbf {j} ^{2}=\mathbf {k} ^{2}=\mathbf {ijk} =-1}

ij=k           ji=k

        jk=i           kj=i  

         ki=j          ik=j


Quaternions, as well as part of Hamilton’s work was forgot specially because of the utilization of vectors representation actually.


But recently quaternions were revived by describing spatial rotations! Yup! Forget vector representation haha.


Well, my main suggestion if your interested is to learn it from [3], which explain with some details about quaternions for computer 3D graphic animation.



[2] http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2008/ErikEkedahl/reportErikEkedahl.pdf

[3] https://www.3dgep.com/understanding-quaternions/



Although I did not post about FADO before, I think it’s better late than never.

Fado was developed in the Universidade do Porto (yes, they speak Portuguese) and it is used for Automata manipulation and tools [1].

I developed together with another researcher a small website in Django for Automata properties verification[2*]. Finite automatas might be deterministic or not-deterministic and although simple, they are very powerful computing machines.

Combined with I-Laser and GUItar[3], which is the visualization tool, Automata can be very simplified and used for many things.


[2*] Later this project was named i-Laser and can be accessed here:




The Simian Army

All, Suggestion, Tools

I remember once in an interview I was asked in how could I improve the system that there were developing in terms of security and performance.

The answer was quite fast, I would not reinvent the wheel but rather use Doctor Monkey from the Simian Army.

I was quite surprise that actually they did not know what was the Simian Army and how Netflix was using it to assure Amazon services and the cloud services were actually working. THEY DIDN’T KNOW! HOW COME RIGHT?

Basically the tool was I talking about use several external tools for health checks in the instances.

The tools are an analogy to a simian being released from a cage, this analogy is specially interesting as the Chaos Monkey, this tools is very interesting. It actually disable some random instances to verify how the system would react!!

Netflix thanks for that!!


[1] https://medium.com/netflix-techblog/the-netflix-simian-army-16e57fbab116

[2] https://github.com/Netflix/SimianArmy/wiki

Distributed Tracing

All, Tools

Although my master thesis was in local tracing, e.g. Lttng and dtrace, there are very powerful tools called end-to-end tracers that basically work tracing a request from top to bottom in distributed systems. In other words, it allows to log information of distributed system.

The example in [3] is the wikipedia, but any major platform nowadays is distributed in several places and could potentially use this tool.

An example of end-to-end tracer is X-trace[1], which was developed by Rodrigo Fonseca, and presented at his PhD Thesis and it’s available in his github account [2].

Currently there are several tools, in this so called end-to-end tracers but also techniques and tools to complement this, e.g. Pivot tracing technique.

This is clearly a hot-topic and has received for attention from several companies, e.g. Google and others.

I will be posting more about end-to-end tracers soon.

[1] http://xtrace.sourceforge.net/

[2] https://github.com/rfonseca




Table-driven approach


During my reading I came to the Table-driven approach is very interesting and sometimes can be useful instead of using a complicated logic approach [1]. The site [2] is very useful too.

This approach uses the table as forms to represent relationships, I think the book gives a more complex example the but example in the site is very interesting and smaller.

Python approach

For python we can actually use a dictionary the same way, as table converting specific values, as key-value operation. In python you can also use functions within data structures and this makes it very powerful.

Function in Dictionary in Python

I remember we were dealing with 4 kinds of results in an array and for each kind of result one different funtion would be called. So my first approach was to use the typeof() way, i.e. open the array and for each element see the type and call the different one. But actually, as one collegue taught me, we can store the function within a dictionary and do so much magic with a clean code passing a function as argument.

   Key into callable

Well, I cant put my company code here, but I will steal from here [3], with some changes thanks Martijn Pieters.

def bark(self, name):
    return 'Bark!'.format(name)

def meow(self, name):
    return 'Meow'.(name)

dispatch = {
    'cat': meow,
    'doc': bark,

def animal_sound(animal, arg):


The example above is very simple and lack of meaning, since one could basically create one function and send the sound as parameter, but I think you will understand my point. You can put a callable in a dictionary! hahaha!!

 I hope I helped!

[1]: Code Complete, by Steve McConell

[2]: https://www.techopedia.com/definition/30408/table-driven-design


Millers’s Thesis


After some emails, I came to read John Alexander Miller’s Phd Thesis at Univ Chicago. It is very interesting and talks specifically about using Python for teaching. Although this might not be in the title, the thesis is about it.

Although in the beginning I would disagree, since I used other languages to start teaching kids and young adults to learn how to program, after some time I came to the conclusion that Python might be the best approach to teach how to program.

[Why I changed my mind]

One day I was talking with a collegue and he was describing his new endevour that was learning how to program. He was recently hired in a school and he was suppose to show for the students some programming schemes. But he did not know how to properly program! So he started learning!!

I was very surprised in a good way and asked him to show his first codes.

He showed me with some exitation but also with some excitement. At the same time he was excited the first programs worked, now his codes were not compiling anymore. His conditionals basically were not properly developed.

He highlighted that his teaching choose JavaScript as his first language and the it was not that difficult.

But after seeing the codes below I realized that the syntax of JavaScript was limitating factor in his path to learn!!!

JavaScript vs Python

In JavaScript he was using a combination of conditionals as below, but he was forgetting the {}!! So although the conditions were nicely done and worked, the syntax made huge impact on his path!

if (condition1) {
      if (condition2) {
block of code to be executed if the condition is true



So I suggested him to see some conditionals in Python and see how it is suitable for first time learners:

if condition1:

      if condition2:
block of code to be executed if the condition is true


Although JS might be very simple, I tend to suggest the use of Python as a first building block of code.  Miller’s right!



W3Schools is the best site for learning a new language – personally opinio.

[1] https://www.w3schools.com/js/js_if_else.asp



Root Framework

All, Tools

Another framework that is very interesting and powerful, although not very used beyond the physicits and the Cern people is the ROOT Framework [1].

I have the experience to play with it, using its functions to generate meaningful results.

Root is very optimized, written in C++ but nowadays you can used it combined with python and R.

I personally don think its interface is easy, as other libraries/frameworks, but its optimized and the community is great. People from several backgrounds helping specific questions.

At Instituto de Fisica in USP University, we used it a lot. But not rarely we faced situations that it played some trick answers on us, e.g. some of the results were inconsistents.  But anyways.

It is interesting to try it straight on the browser too.

Is always important to watch CERN and its tools, since they become a tendency in the world, the WWW is an CLEAR example.

[1] https://root.cern.ch/

List comprehensions Python

All, Tips

I think one of the most beautiful things and also powerful are the list compreehensions, which makes the language quite interesting.

The syntax is quite simple:

[ expression for item in list if conditional ]

The tutorial [1] explains specifically how to do it. I confess it’s not easy to take it at first try. You can also use directly from the source [3].

But when you learn it, you will want to use all over your code. EVEN WHEN YOU SHOULDN’T!

In some cases, when you dont need a list actually, its better to use a simple NEXT() function[2].

[1] https://www.pythonforbeginners.com/lists/list-comprehensions-in-python/

[2] https://docs.python.org/2/library/functions.html

[3] https://docs.python.org/2/tutorial/datastructures.html



Companies Should Adopt Hack rank

All, Suggestion


I remember once during an interview, I didn’t sleep well the night before and I failed in every single simple questions. In the end obviously I did not pass, however, I learned that the companies should considering add Hack Rank in their interview process.

That’s actually quite ironic, because I usually not good when I have 15 minutes to solve a maze or finish a question. However, I felt that it is the most honest approach a company can do, basically to avoid hiring someone which answers were lucky but also to give the interviee an honest and sincery change of apply.

I even sent  a message to the recruiter for them use Hack Rank on their next interviews, so they could improve the hiring process.

In my case, I didn’t sleep well so my questions were not good, but the next day, even the same day, my mind was sharp as never before. Unlucky them.


[1] https://www.hackerrank.com


H2HC University 14 Conference



In 2017 I was able to present the work I have been doing at the Dorsal Lab in Sao Paulo, Brazil.

There was too many concepts to present, for an unknown and heterogenous public. So I managed to do a generic presentation, with a mix of concepts, tools and results we came to that time.


The concent was about profiling, tracing and debugging. Things that are completely different and somehow we need to present them to the common public, i.e. people that might not know about Donald Knuth maximas or even know but not empirically.

The slides can be found here [1] and here [2].


[1] https://github.com/h2hconference/2017

[2] https://www.slideshare.net/fjdemelo/h2hc-tracing-profiling-debugging