Tuesday, July 30, 2013

Lumino - an arduino input device

Hi readers!

I'm here to share with you an experiment I've been having fun these days.

While I was playing DOTuino, I found out that I could use a light sensor to make my personal and unique "joystick".

Using my hand to change the light intensity over the sensors I could create some kind of interesting input.

Once I came up with the idea, developing a circuit to achieve it was really simple. All I needed was 2 light sensors (LDR), a couple of wires and an arduino.

For a while, I winged it with some pasta box. Anyone there with a 3d printer? =P

Just before making the little holes (for the sensors)

Usb connection

In order to test its responsiveness in a real application, I made a simple game with python + pygame.

Below, a video recorded with my brother.

Actually, while the hand comes closer to the sensor, the light variation is smoother than the presented in this game, which I deliberately made it detect just 3 states.

If you liked the idea and wanna try this at home or contribute, it's all open source.
Below, links with code:

  • lumino (arduino code + experimental python driver);
  • lumino-projects (sample code using the above python driver, including the game featured in the video).

Hope you liked it!

Feel free to leave comments to this post!

Ronald Kaiser

Saturday, July 27, 2013

DOTuino - an arduino game

Hello readers!
Today I finished DOTuino, a minimalist space game for arduino. It was a wonderful experience -- making a minimalist console by myself. I recommend it for you 2!

In order to accomplish the job I gathered the following components:
  • an lcd display (16 columns x 2 lines);
  • a potentiometer (to adjust the lcd contrast);
  • a push button (a minimalist joystick);
  • a bunch of wires;
  • 2 resistors (1 for the push button and 1 for the lcd backlight);
  • of course, an arduino.
The low level connections are relatively straightforward for those already initiated in arduino projects. No eletronics gotchas. Nevertheless, if you decided to try this at home and got any problems, do not hesitate in contacting me. 

Below, the game running!

Source code is available at github, use at your own peril, =P
And feel free to contribute!

Till the next post!

Ronald Kaiser

Saturday, June 22, 2013

A gota d'água

Um belo dia saí para comprar uma garrafa de água.

Corri, sedento, esperando que ao chegar em casa, pudesse abrir aquela garrafa e ter o prazer de experimentar o elemento da vida: insípido, inodoro e incolor.

Para minha surpresa, percebi que o líquido que adentrava meu estômago continha não apenas moléculas de Hidrogênio e Oxigênio. A sombrancelha franzia ao sentir o gosto amargo do alimento. Não era insípido.

Após deixar registrado meu devido descontentamento com a situação, acompanhei outra garrafa ao meu lar. Novamente, a sensação se repetiu. Por anos.

Passei a acreditar que os livros de ciência precisavam se atualizar. A água tinha cansado de não ter gosto.

Passados muitos anos, não aguentei, tive que contar para alguém. Já não conseguia mais sonhar, apenas "pesadelar" aquela frustração velada. Tinha medo do que aquela revelação pudesse causar ao mundo.

De repente, percebi que a muitos o segredo já tinha se revelado. A maioria das pessoas daquela região já estava ciente do que estava acontecendo. A minoria era tida como louca e alienada. Mas todos sabiam.

Não teria sido elegante esboçar a ideia de que a água tivesse opinião e vontades a Bertrand Russell.

Todos sabiam que a água estava sendo adulterada, não tinha ninguém calado.
Eu permanecia fixo na ideia de um "antropolíquido" porque a voz dos outros não tinha o meu respeito. Não queria ouvir.

Cansados de tanta pressão da consciência, resolvemos sair às ruas para reinvindicar uma água de qualidade. Queriamos demonstrar nosso descontentamento com aquela situação.

Ao fim do dia, o dono da Empresa de Água subiu ao palco pra dizer que estava do lado de todos, mas tinha adulterado a água porque era mais barato não investir na qualidade. Sobrava mais recursos para os gerentes.

Sabendo que a qualidade da água não parecia ser uma prioridade de todos, a Empresa de Água não se sentiu na obrigação de cumprir com o contrato implícito de entrega da água insípida até então. Prometeu tornar mais urgente a necessidade.

Após o sono do microfone e promessas de melhoria, todos resolveram acreditar novamente em mais uma adulteração, ligar a TV e assistir ao jogo.

Ronald Kaiser

Saturday, May 11, 2013

Should you keep that book?

Hello readers!
Today I was thinking about why we keep books at home. This post is about the development of this idea.

Looking at my bookshelf I realized that there are books and books. Books that we actually read regularly and others we accumulate just as trophies of accomplishments.

It seems that it is common to have an affection upon our books. But is it rational? Is it wise to keep a lot of books at home when someone outside of our little world could be making a better use of it? Why not get rid of some? Why not give one to a child, a student or a friend?

I decided I was willing to give some books, keep my shelf cleaner and share knowledge.

The problem
But which books?
What is going to be the criteria to evaluate if a book is ready to be given or not?

It seems rational to choose the books I'm not going to need again. But this carries a bit of uncertainty and subjectiveness. It may deal with emotions. When we look at an old book a lot of memories may come into our minds. And this is an understandable argument to keep a big shelf. The invisible potential to recover memories.

But it doesn't happen with all of our books...

Developing a formula
Then, I started to think in a formula to evaluate if it's time to get rid of a book or not.

I think it is reasonable to suppose that if I didn't pick up a book for 10 years, it is very unlikely that I'm going to pick it up again in the future. So, the chances of needing a book again is inversely proportional to how many days passed since the last day I used it until today. Technically speaking,


where N = chance of needing a book again and L = number of days since my last usage.

The frequency of times I took a book to read is strikingly relevant too. If I picked it up many times, it should be the case that it is still very relevant for me. Thus, the number of days I took a book to read must contribute in a directly proportional way to its usefulness. Hence,


where F = number of days I read it.

Finally, a subjective metric must be taken into account. There are books we read a lot recently that we are very unlikely to read again. This is the case of text books used in a course that we didn't like and have no plan to read again. But the chances would be high with the 2 variables above only. Then, a rating to the book may be used to deal with these cases. Thus,

∝ R

where R = personal rating from 0 to 10.

The formula
Gathering all those considerations, we can devise a formula to determine the chances of needing a book again, which is:

N(L, R, F) = (kFR)/L

where k is a constant that is personal to the reader.

In order to find the value of k, I took a book that I'm very confident in needing again. It is a book about time, not so popular, but I like it.

I read it, approximately, during 60 days, so F = 60.
I think it is a nice book, so I gave it a rating of 9, then R = 9.
I didn't take it for about a month, so L = 30.
I want to obtain N = 1 when the chances are high of getting a book again. Given that, replacing F, R and L for N = 1, I obtained my k as 0.055.

If you tried to use the formula, you could see that the value of N can be sometimes greater than 1. It is not perfect, but it worked well for some books I tried.

Maybe I should use other units to define the values of F and L. Sometimes it's hard to remember how many days we read a book. The same to remember how many days passed since the last reading.

But it is a beginning.
You may be asking yourself, why all this?

Well, because it's fun! =)

Thanks for reading!
Till the next post,
Ronald Kaiser

If you have any point or critics to my model, please feel free to leave a comment!

Thursday, May 9, 2013

The intern

Hello readers!

This is a joke with interns.
Hope you like it!

Till the next post!
Ronald Kaiser

Tuesday, May 7, 2013


Hello readers!
Knuth once said "Premature optimization is the root of all evil".
Well, this is my version of a premature optimization in a scalability context.

Hope you like it!
Till the next post!
Ronald Kaiser

Sunday, May 5, 2013

Paper industry

Hello readers!

Imagine your paper being accepted in a big conference. I think you would agree with me that you should be proud of your hard work, right?
Depending on your ethical judgement, maybe not.

Three guys from MIT developed a solution to randomly generate research papers, aka SCIgen. In 2005, they made a submission to WMSCI, the World Multiconference on Systemics, Cybernetics and Informatics. The paper was accepted.

It's 2013. I didn't see any changes in the machinery of research papers production. In general, it seems that quantity is still more important than quality.

Two years ago this kind of mentality made me get out of the academic world. Since then, I'm studying in my rhythm, in my pace. Thinking by myself.
However, now I realize that there are good and bad professionals everywhere. Perhaps, it's just a matter of finding our right peers.

By the way, if you want to generate your personalized paper, check the SCIgen project, =)

Till the next post!
Ronald Kaiser

Saturday, May 4, 2013


Hello readers!
Yeah, another comic experiment! =)
Now, using just mechanical pencil. Hope you like it!

Till the next post!
Ronald Kaiser

Thursday, May 2, 2013

Polynomial roller coaster

Hello readers!

Another comic! Now using a Post-it and mechanical pencil.

Hope you liked it!

Till the next post!
Ronald Kaiser

Wednesday, May 1, 2013


Hello readers!
Another comic experiment! Again, using mechanical pencil and gimp!

Hope you liked it!

Till the next post,
Ronald Kaiser

Tuesday, April 30, 2013

To infinity and beyond!

When you have an opportunity, ask a child if he wants to win one or two candies.*
If the child is rational, it seems quite obvious that he will take 2. "More is better", he would think.

This kind of reasoning doesn't hold in a special world; the magical world of infinites.
When we come into this subject any basic arithmetic is useless.

Georg Cantor left many insights to humankind about the conundrums of infinite. He once said, shocked with his own discoveries: "I see it, but I do not believe it". And unsatisfied with a lack of understanding of infinite, he came with the idea that there is an infinity of infinites. Yes, you read it right, an infinity of infinites.

In order to give you a simple example of how our basic arithmetic doesn't work in this strange world, let's take two sets:

E = { 2, 4, 6, ... }
N = { 1, 2, 3, 4, 5, 6, ... }

Which one has more elements, N or E?

The common reasoning is to think that E has fewer elements than N because E is a subset of N; a valid thought if they were finite sets. But here, our intuition doesn't suit. 

N and E, surprisingly, have the same number of elements! In other words, the number of natural numbers is equal to the number of even numbers!
But, but...how can it be?!

The key to understand this idea is one-to-one correspondence. An even number always has a half representation in the natural numbers. If we map all the even numbers to their half representations, we can check that for each element in set E there is an element in the set N. Hence, they have the same number of elements, or technically speaking, the same cardinality.

Strikingly simple as that, and at the same time mysterious. 

Despite all Cantor's et al endeavours, we still have a lot more to learn from 

Till the next post!
Ronald Kaiser

* Please, don't do that if you do not have 2 candies in hand, =P

Monday, April 29, 2013

Programmers are NOT necessarily bad graphic designers

Today I want to share with you something that upsets me.
It is popular in the tech world the opinion that a programmer can't do graphic design [1] [2].

It is true that there are good programmers that are bad graphic designers. However, doing a blind conclusion about it is a logical nonsense, a non sequitur.

It is well known that analytical/logical thinking takes place on the left-side of the brain, while creative activities -- such as drawing -- on the right-side. This is the main argument to support the statement that programmers can't be good planning an UI (User Interface), for example.

Given that, saying a programmer is not good at graphic designing is similar to saying that a programmer is not capable of using all of his brain, what I see as an insult. It seems that is cooler to practice just one side of the brain.

What is more shocking for me is that some programmers accept that as a fact.
And most of them don't even try.

Realistically speaking, of course, in a typical daily routine of a tech/IT department there is always a lot of work to do and it is more convenient and wise to let the designers do this kind of work.

But, IMHO, it is unwise to say that programmers are not good designers.

Thanks for reading!

Till the next post,
Ronald Kaiser

Sunday, April 28, 2013

Physics in a song?!

Hello readers!

I found this song searching for a new band to listen in grooveshark. Fortunately, I tried "Particles" played by Greenland is Melting and I decided to share it with you.

Hope you like it!

This was a short one, till the next!
Ronald Kaiser

Friday, April 26, 2013

Buffon's needle simulation

Hello readers!
Have you ever heard about the Buffon's needle?
This is a very interesting experiment. In a nutshell, it is a fun approximative method to calculate the value of π. 

Watch this video to understand what is going on:

After playing for 20 minutes I came with a simulation in python and I thought I could share it with you. Please, be nice. It was a quick hacking, ;)

The code:

import sys
import math
import random

def get_random(l, k):
    return random.random()*(l - 2*k) + k

def get_point(w, h, k):
    return (get_random(w, k), get_random(h, k))

def get_angle():
    return random.random()*2*math.pi

def intercept(p1, p2, h, k):
    for line in range(0, h+1, k):
        if (line >= p1[1] and line <= p2[1]) or \
           (line <= p1[1] and line >= p2[1]):
            return True

def drop_and_check(w, h, k):
    p1 = get_point(w, h, k)
    angle = get_angle()
    p2 = (p1[0] + (k/2.0)*math.cos(angle), 
          p1[1] + (k/2.0)*math.sin(angle))
    return intercept(p1, p2, h, k)

def repeat(times):
    w = h = 1000
    k = 10
    count = 0
    for i in range(times):
        if drop_and_check(w, h, k): count += 1
    return float(times)/count

if __name__ == "__main__":

It is available via github too.

Hope you liked it! =)

Till the next post!
Ronald Kaiser

Absolute value

Hello readers!

This is my second comic experiment. Now, in a xkcd style. Hope your elementary math is ok, ;)

Leave a comment if it made you laugh, ;)

Till the next post!
Ronald Kaiser

Friday, April 19, 2013

How and what we observe?

Hello, readers!
Today I'd like to invite you to make an experiment.
Look at the image below.

Now, say out loud what you've just saw and observed. [1]
Please, don't skip this process and do not start to imagine how this is stupid. I think this exercise is going to be extremely important to have a grasp of the whole point of this post.

What did you observe?
There are many ways you could observe it. To list a few:
  1. A table;
  2. A photo of a table;
  3. A 3d model of a real table;
  4. A particular composition of woods that looks like a table. Since a table is just an idea (a concept), I'm not looking at an idea;
  5. your answer...
If you are a computer scientist (like me) you could answer something like "I can observe a sequence of pixels, since this is a definition of an image and I'm looking at an image". Evidently, there is no correct answer to the question.

The reason why there is no right answer is because the question was too broad. No scope was defined. No contexts. No directions. No theories. [2]

The importance of theories

Karl R. Popper proved in his book: 'Conjectures and Refutations' that there was no way Isaac Newton could devise his laws from pure observation of the world. This is a strong assertive and I suggest you to read the proof if you are interested in more details.

Popper believed that you cannot successfully reach a general theory exclusively through observations. The point is we have to have a system of references to make an observation. It's like a guide in what perspective to use.

Thus, in order to answer the table-observation-problem, you picked out one theory from your experience, probably unconsciously, and thought something like: "I'm gonna look with the eyes of a Platonist (through Platonic ideas), so I'm gonna answer like 4: "A particular composition of woods...".
And not the other way, from observation to theory. [3]

Few words on big data

Today, the term "big data" is a well known buzzword. But what people mean with "doing" big data?
Doing big data, as far as I have seen and known, is trying to fit the data to one of our human theories. The most used are statistics and machine learning. In this particular case of big data, we clearly make a conscious decision of what theory to use to support our observations.

And maybe we should use other theories to look at it...

Till the next post!
Ronald Kaiser

[1] Feel free to comment in this post your answer, ;)
[2] Nevertheless, someone would frown if you say "I can see my grandma through this table!".
[3] Please, don't mess the words look and observe.

Tuesday, April 16, 2013

On making mistakes

Hello readers!
Today I'm gonna talk briefly about making mistakes.

We, human beings, usually regret ourselves on making mistakes. Avoiding them, undoubtedly, has been an advantage in an evolutionary point of view. Imagine a prehistoric man hunting in a savana. When he stumbled upon a rock while trying to catch a lion he was punished for his mistake with his life.

The work of Karl R. Popper, which I'm reading a lot nowadays, delineates another standpoint about errors, or perhaps, I should say, a discussion in another level.

Popper believed that the only way to get closer to truth (if it exists...) was to trust in reason and be critical. Thus, according to him, making mistakes is not just inevitable, but very necessary to improve our understanding about the world. In few words this is what his critical rationalism is all about.

Similar ideas are pointed out by other 'successful' people:

"You say you want innovation...If you're serious about this, you need to celebrate and promote failures" - starts at 10'47''.

"Let's forget about avoiding mistakes...We want to limit our ability to make mistakes. Making mistakes is like a crime. No! It's a normal part of the thinking process." - starts at 33'30''.

When Irene Adler is in scene you can observe that Sherlock Holmes makes more mistakes. And as far as I know, it is an invariant in all Sherlock Holmes movies/series. Watch this video:

In this particular scene, Holmes is easily poisoned. Immediately after being poisoned, he still strives to understand how he was deceived, mentally reconstructing Adler's poisoning strategy. In a nutshell, learning from his mistake.

So, next time you make a mistake, laugh. It probably means that you are trying something new. And most importantly, learn with it!

Till the next time, readers!
Ronald Kaiser

Saturday, February 2, 2013

Why did I release suggestmydomain.com ?

What do you think about registering xipne.com as your next domain name?

Let me predict...hmm...you thought it was awful, right? I can hear you saying to yourself: "No one would use it, no one would remember it". Well, perhaps you are right. At least, right at this epoch (around 2013).

Yesterday I released suggestmydomain.com that does such stupid thing; suggests an available domain name randomly. This post is about why I did it.

It's not from another world
I didn't do it alone. My young brother was 80% of the time at my side. I did it to show him very deeply that what he sees around the Internet didn't come from another world; that google.com is not really a magical thing: it's made by people, for people and machines are just tools. Furthermore, he saw that in order to accomplish a goal, obstacles appear and you must face them to succeed.

It had a purpose
Its purpose is clear. When you have a clear purpose and you see its value, it makes a huge difference. You don't waste time in code styling, you deliver what must be delivered. Using suggestmydomain.com is straightforward, you don't need to type anything, just access.

For fun
Not much to comment about this.

What's the meaning of XKCD? As far as I know, none. Answer me, sincerely, do you really think xkcd.com is a good name? The point is content matters, not names. If you have a good content, don't be fooled by what people say about "best practices" for domain names; people will be forced to remember your name.

Look at the mirror
Writing this post made me think...why didn't I choose a random name for suggestmydomain.com too? Hmm...I will, soon, ;)

Special thanks
Special thanks to my love Juliana, helping me in so many ways I couldn't imagine. Many thanks for your help! You know you are part of it too. I love you!!!

That's all for now, folks

Till the next post!
Ronald Kaiser