AFTER ENTER - Episode 2 - Pressing!

Tags: English, technology, projects, learning
Created on Fri, 20 Nov 2015

The story so far:

Hi again. Last time we spoke about what happens before a search engine like Google has to accomplish before doing a search through billions of documents that make the Internet. Today we are starting our journey by doing a real search.

Our particular search will be the age old question that every child asks and every adult is ashamed to not know the answer:

Why is the sky blue?

How many ways can you think of doing that search? If you are on a phone or have a smartwatch you can say “OK Google, (hear a small bleep) why is the sky blue?”. Or you can tap on your home screen box and type with the keyboard that appears on the screen. If you are at home and have a laptop on your… well, lap… you could type on your keyboard.

So which one was it for you? This interaction is called interfacing. The word interface is used frequently and interchangeably but basically it means what are the ways to communicate from one thing to another. If you used your laptop keyboard, that was an interface. Inter meaning between and face - ummm … face? On the other hand the keyboard interfaced with the computer via some internal cables, the laptop interfaces with the internet via WiFi, cable or mobile network and so on.

Okay so you typed it and pressed enter or said it and are now waiting. Well you don't wait for too long because the response comes almost instantly. But the story is incredible! Listen…

Let's assume you pressed enter and we slow down time a LOT. So much that a blink of an eye will take the next 10 episodes. That's long…

All right, here we go!

Let’s look around, what is happening. A keyboard consists of electrical switches in a similar way a lamp switch is made.

Key schematic

Now, see that switch. The two cables have electrons which stay relatively static. (Well, that's a lie, they move all the time buzzing randomly like flies.) Why do they buzz randomly? They are excited but they don't feel strongly to move one way or another. There is no direction in their life. It's like when you are in a big pool and you have more than enough energy to enjoy swimming but with no particular direction. Where is that energy coming from? The loud Big bang. Now, concentrate!

Once we press the button, closing the switch the electrons start feeling a force. It's like a wind starts blowing in one direction and they slowly obey. They still are kind of randomly moving, but randomly with direction.

Key press

While our finger is still on the keyboard, the electrons start flowing in one direction. Where is that force actually coming from? Your finger? Not exactly. When you turn on your lamp, your finger just opens the gates for power to go. Now how does your computer know that?

Well, your keyboard is actually not just these two wires connecting the enter. There are many more connecting each key. But if there was one cable connecting each key, that will be a lot of cables! Your keyboard will be big and bulky.

No, let's not do that. Let's organize the cables in a matrix. Now in this case a matrix is a fancy way to say that cables form grids on two layers. If you have an old keyboard connected to a desktop computer, I would disassemble it and see what's inside. It's pretty cool! You’ll see two thin plastic sheets with some very thin paths made of some metal separated by a third layer with holes… it's like a sandwich with emmental cheese, mmm..

Metal sandwich

So when you press the button you connect the two pieces of bread of this sandwich through the cheese which lets these electrons flow.

Now the keyboard has small computer itself called a controller. What it does is checks every thousandth of a second or so which two metal pieces of the two grids made contact if any. If any of them did, the controller records that in a memory of its own called the endpoint.

And then it waits. Remember, we slowed down time a lot. The controller checks every thousandth of a second just to be sure but there is no typewriter in the world that is that fast.

Turns out the the fastest of the fastest types about 200 words per minute which is about 1000 characters per minute equating to merely 15 keystrokes per second. I said merely because from our standpoint that's eternity. In real time, that's pretty impressive!

This is of course in the case of a real, solid keyboard. What if it was one on your smartphone?

finger pressing smart display

Well, it’s pretty similar, just your finger acts as a connector between the two components. Don’t worry, these electrons are actually pretty tiny and won’t hurt you.

Anyway, the information about the press got to the keyboard controller. And the keyboard controller waits. For what? Remember we slowed down time. The keyboard controller queries for keypresses thousands of times per second but the computer queries the keyboard much less often. There are two ways computer stuff communicate - they either push or they pull. Let’s say our keyboard controller waits for a pull from the computer. If it was more pushy type, it would flush down what it gathered down the line for the computer to collect and not wait at all.

Why the two ways?. Well, the brain of any computer, called the Central Processing Unit or CPU is a very important and busy boss. It allows you to listen to music while you type, move your mouse, browse the Internet and many other tasks.

Workers queue

Now she can either order that some of her workers go and fetch things in which case the workers go, pull and then queue or if the keyboard pushes a message, the keyboard worker queues. This queue exists so that you can do many things seemingly at the same time. What actually happens is that the boss reads messages really quickly and passes messages around the workers.

Fast workers queue

It depends on many factors whether the communication will be push or pull. Some interfaces like USB wait for pull from the computer, other push. In the end, the messages always end up in the queue for the boss.

All right. So a worker goes to the keyboard controller endpoint and asks: “Do you have anything new for me?” to which the keyboard controller answers: “Yes, indeed I do. Here is what I gathered in the last 10ms” and passes the code for Enter.

This is very cute and all but it’s not really what happens. See, there are no small humans inside your machine. There are just wires and electrons. What I just pictured above is a model of how it works because you, reader, are probably a human and humans speak abstractions. The real language that the keyboard controller communicates with the computer speak is not really English. It’s called binary.

Binary is the language that comprises of two letters - 0 and 1. Zero means no (or very weak) signal, one means (stronger) signal. The controller actually sends these signals in a specific variation in order to encode the message that the key was pressed down the wire to the cable connecting via the computer interface.

Let’s recap:

You press a button on a physical or virtual keyboard which is the interface to your machine. A physical keyboard has a matrix or a grid of electrical conductors separated by a layer of electrical insulator like a sandwich with emmental cheese. By pressing the button you let some small amount of electrons move around. The keyboard controller reads the matrix about a thousand times a second to check for changes, saving the change in a memory location called the endpoint. Now it can either push this data down the cable to the computer or wait to be pulled. Computers communicate in a language called binary which uses only zeros and ones as letters.

So far we know what has to happen before a search occurs and what happens when you press a button of a keyboard. The information about your query has just started - 10 milliseconds into the trip only your keyboard knows that you have asked something. The journey continues next time as we follow the information flowing into your computer and what happens there.

Stay tuned!

Размисли за референдума, астрономията и всичко останало

Tags: Български, политика, мнения
Created on Mon, 26 Oct 2015

Първият ми блог пост на български от известно време насам. Всъщност дори няма да е блог пост, 'щото ще си е директно видео, което направих тая сутрин.

За електрическото гласуване, кои хора успяват и как да си живеете живота щастливо, вижте единственото правилно мнение само тук :)

Big Game - score 10 of a Murica movie

Tags: English, opinions
Created on Fri, 08 May 2015

I fell victim to another brainwash called Big Game, an american movie featuring Samuel Jackson's face and the Bratislava Radio Orchestra (epic music guys, worth it!). At the time of writing the movie had 80% rating on Rotten Tomatoes.

Spoiler alert obviously, although I advise you to save your precious hours on this planet and skip the movie. Unless you have murican flag on your wall, murican pants and tatooed one or more presidents on any parts of your body. Then you will probably like it but just please, stay in your southern state.

The movie starts okay - a boy in some far away, wild country, is to become a man by proving he can hunt on his 13 birthday. The country we later understand is Finland - a country with universal health care.

The boy has a typical character bad day - he doesn't really fit the expectations of his father or his tribe but he is allowed anyway to go and prove himself, a leap of faith provided by a not-so-moving dialogue between the father and the tribe's senior.

We then see the president of the United States of America, the greatest country in the Multiverse, played by Samuel Jackson, an american, riding in the mega presidential airplane of the United States of America, the only country in the Universe together with fighter jets that are ready to fight anyone who doesn't agree with anything Murica says.

Then he is betrayed, plane is shot, communications lost, plane crashes, his staff is killed and he lands in an emergency hatch in the Finish woods where he meets the boy.

The hatch can't be opened from the inside so the president writes the code on the muddy glass from the inside. 1492. Patriotism, madafaka!

The boy opens the hatch and the president, I am not joking asks the boy:

"You don't know who I am?! I am the President!!.... (waits for reaction by the FINISH 13 year old boy)... OF THE UNITED STATES OF AMERICA"


I am not especially patriotic about Bulgaria. But I think I might be offended if my country was displayed as a middle of nowhere forest where the people are kind of primates. And Hollywood decided to compare America with Finland... Oh, my Random... Where is Finland compared to M in terms of education, health care, democracy levels?

The movie goes very quickly downhill from there. Turns out there are terrorists who want to... well, we never really understand what they want to. Every scene is full of display of some american flags, satellite live coverage of the situation over the finish forests, panic at the Pentagon, the president claiming stuff as the property of the USA (the greatest... oh whatever). We never understand the characters motivations to kidnap/kill the president, there are just a lot of explosions. Including blowing up a lake for some reason. There is also the ala Indiana Jones and the Kingdom of Crystal Skull "Fridge is the ultimate survival place" and a decision by the president to enter a trap plane under water.


Samuel Jackson is cast as the quote "the weakest president in the history", not the badass he knows how to play. Well, he does say at almost the end "Madafa..." but is cut midway I guess cause the movie was made for children. Although it was rated >12.

I understand if the movie should be targeted at children. It could be seen fun and you know, bring patriotism. But then why do we have >12!?!

And how Rotten Tomatoes gave it 80%

Yes, I know it's about money and patriotism and Americans love this. Just I wish we displayed more independent movies or the movies just reverted to telling a good story rather than flashing bombs, explosions and ending the world behind CGI, blue/green screens and maybe flashing actors face (if it's not too much).

Learning through participation as the rule rather than the exception

Tags: English, opinions, essays, university, learning
Created on Wed, 18 Feb 2015

School has never been only about learning stuff.

For few years I believed it’s the things happening in the breaks that matter. Relationships, doing stupid things and talking about crazy ideas. But that’s not completely true. I believed that because just my last memories from school are that things in the break matter. But it didn’t use to be the case. I loved learning things when I was younger.

Oh my, I would read like crazy - Encyclopedias, science books, I would draw the planets of the cosmos and remember the map of Europe. For 16 years of education, school and later University were trying really, really hard to kill this in me. My love and passions, my curiosities. I (almost completely) stopped going to school in the last couple of years. I was having my own projects and I didn’t care about the things in the breaks so nothing could keep me there. There were a few subjects like Physics that were interesting to me but by the last couple of years I started slowly falling out of love for the subject. Computers were my new passion and school just could not keep any challenge in that subject for me.

In my visits to the schools this year I saw this projection of myself clearer than ever. My first class was 4th year students. When I looked at them, that’s exactly how I remember feeling - bored our of my mind, not caring, trying to squeeze in a conversation about anything but the class. But then I met with 1st years... My host teacher, Mrs McVey, can confirm how staggered I was the first time I saw the difference! They were so lively, passionate and open to meeting me! And most of them, actually interested in the subject as well. I loved meeting them - they would ask me all sorts of questions about my country, about my studies, about my work at Google. The fourth years? They would barely notice I was there or anything was there at all for that matter!

So what changes in these few years time? Everything! Your priorities shift. While you were once genuinely interested to know the world, eager to meet new people to play with, you now start copying adults. Everybody starts expecting you to be an adult - your parents, your teachers, your more mature friends. And while you still play secretly with robots at the lone hours at home, the picture that the society tries to project on you changes. They want you to throw away your toys and start going to parties. Hey, you want to do that too - you gotta fit in! It is where the new playground has moved. It’s the same people most of the time, yet with louder music, questionable substances and new dictionary.

And your genuine interests slowly fade substituted by interests of society. Who is your girlfriend? Do you smoke? Do you drink? Which University are you going to choose? What are you going to work? A lot of character and/or antisocial behaviour is needed to not care and continue doing what you were doing. Most of the people don’t make it, you change.

You are not a child anymore. You have responsibilities. You start having life of your own, your hormones are going crazy, you start searching for intimacy but without knowing what to expect or do since nobody teaches you this. You start crafting your own world. Your music. Your movies. Your sports. Your troup. You are not anymore attached to your parents as you used to, you start questioning their authority, their tastes, their boring, grey life. You are so full of things to do, yet they expect you to wash the dishes. Or be home by 8. 8? That’s when all the fun starts! Now, you know you are not a child anymore, you reshaped, you want to be seen like this!

And that’s okay. It’s how the world works.

But in the same time, school stays the same. School doesn’t pay attention to your changing environment. School wants you to learn stuff as you have learnt it before. No, it wants you to do it better. It acknowledges that you are an adult by giving you more things to do. Harder things to do. But a human being can only care about a constant amount of things.

So what happens? You stop caring about most of the subjects. You give in to the gossips and coolness talks. It is cool not to care about the subjects. The plan of action becomes a challenge - “No matter what the teacher does, I will be against it! I will not let her interest me in anything or I will appear weak in front of my buddies!”

But the truth is every single one of us has a child in himself. It is buried under deep levels of walls of prejudices, barriers and adult things. For some big adults it is being crushed completely almost beyond repair. But for the most teenagers it is purely a matter of tact to bring it out and let the curiosity and interest spur.

How do we do that? Well, the teenager’s (and adults) most important signal for right behaviour is the approval of his higher ranked friends. If they approve, the action is right and he will be still in the group.

Therefore, this becomes a power game. Could the teacher win it? The teacher has the most absolute power - she could say when to speak and when not, the grades (and therefore the peace at home) depends on her. But as an unrespected monarch, if the teacher doesn’t seem interested in what her “citizens” are interested in, she will lose the battle to “impose just laws”, i.e. teach them something.

The monarch needs to come down to her citizens, to understand them in order to rule them. And she has to do that without sacrificing authority.

This is all well in theory but what does it mean in practice?

Stop pretending to be omniscience and omnipotent and discover the knowledge with them. Be a good leader - just lead, don’t pretend to be the ultimate power. Engage them in workshops where you are the facilitator rather than God. Don’t be afraid to ask if you don’t know something, let them help you understand.

Show them why this thing is interesting in the proverbial real world. How does it apply in their terms, not in yours. What does it mean to know Excel? Finding job? They don’t care about that yet. In few years, maybe, but not now. Maybe they care about calculating their GPA. Show them that with Excel, not how to manage a library! And if someone knows something more which is interesting - ask them to go in front and show the rest. Don’t tell them to keep quiet all the time, let them talk what is interesting to them.

It is a monstrosity what I am seeing in the Scottish schools - start the day with one and a half hour of studying, no break. And then 10 minutes of break before another 1.5 hours!?!!? When is the social interaction happening? When are they talking about the things they care about?

The times I’ve seen pupils engaged is when they are allowed to speak between each other and it is something that they care about.

Workshops should be the standard, not the exception. Workshop which emphasises on participation, allows speaking and if you show them why this is interesting to them - they would discuss how to do it, play with it and it will bring the child out of them.

Participation, discovery, curiosity - things that mostly miss in schools today.

Thinking inside of a box

Tags: English, personal
Created on Sat, 14 Feb 2015

Yesterday I experienced what is it to be thinking inside of a box. I did that so that you never have to. I also spun a bit around which was okay for a while, but it gets tedious, boring and very hot, very soon. The real world is much cooler once you get out of it with a fresh mind.