April 09, 2009

the BOOK OF est

This is a superb book that I picked up for a second reading. I own a used copy but with some effort you might find it somewhere:

The Book of est on wikipedia

The Book of est on Amazon

Here is a small excerpt, which as soon as I read some minutes ago, just knew I had to post it. Apologies for the use of offensive language (to those that requiring such apologies):

Let me remind you before I go on that I don't want you to believe a word I say over this weekend, just listen. Because the reason your lives don't work is that you're all living mechanically in your belief systems instead of freshly in the world of actual experience. You don't look at reality and then construct conclusions, no. No, you did that decades ago. You asswholes are roboting through life with your conclusions, and with your conclusions developed decades ago you are constructing reality! No wonder you've lost all aliveness. No wonder your lives don't work.

Have fun!

Dimitris Staikos

November 18, 2008

The code is THE documentation

Yeah sure... Sleep tight and noone is gonna rock your boat, at least while you are sleeping in it.

This is a very luring statement. The reason it is so luring is that it is so obviously true. Or is it not? Doesn't the program do exactly what the code tells it too? So the code is THE one and only always up-to-date documentation of any program. Right?

It is so convincing that you just can't resist falling for it, especially when faced with an aficionado that passionately claims that she doesn't need to write comments as "extra" documentation, because the code is THE documentation, and since she obviously writes top quality code, comments are simply redundant. A waste of screen estate more or less. Useless clutter around the actual documentation.

Sorry to break the news boys and girls... The reality is somehow different.

The code is the imperfect translation into a programming language of the programmer’s imperfect understanding about what the program should do.

You can figure out the rest. The code is THE documentation of the programmer's imperfect language translation of an imperfect understanding. It documents how the programmer failed to code properly what he failed to understand properly.

Anyone still battling on the issue of whether the code is THE documentation and whether comments (in any form) are needed or not, most likely hasn’t worked on a big project (300+KLOC) long enough (5+ years) to figure things out for him/herself.

Life is so sweet when 90% of the time you fool around your own code. Everything is so simple, because everything is in your head. However once you start spending 50% of your time on pieces of code that other people wrote, pieces of code you have NEVER seen before, or pieces of your own code that you wrote 4 years ago and haven't glanced at since, then life is not as sweet.

When you read code you are not familiar with, then you are doing the reverse translation, from imperfect programming language to imperfect understanding about the program's intentions. This is tough. Some may be better at it than others, but trust me... without good comments it can be much more painful and error prone than it has to.

So please, make others' lives easier. Let them cherish your memory after you are gone and enjoy fixing the bugs in your code. Because you WILL be gone some day and your code WILL still have bugs that need fixing.

Enjoy,
Dimitris Staikos

November 05, 2008

Psychology is a science, NOT just Common Sense

This is an excerpt from an excellent book that I am currently reading:

It's no surprise that people who are faced with choices about how to influence others will often base their decisions on thinking that's grounded in fields such as economics, political science and public policy. What's puzzling, however, is how frequently decision-makers fail to consider established theories and practices in psychology.

One explanation is that, in contrast to how they regard the fields of economics, political science and public policy, which requires learning from outsiders to achieve even a minimal level of competence, people believe they already possess an intuitive understanding of psychological principles simply by virtue of living life and interacting with others. This overconfidence leads people to miss golden opportunities.

It is really sad to see otherwise smart people feverously deny any chance to improve their soft-skills, to attend seminars about human behaviour, influence, negotiations, etc. Their thinking appears to be something of the sort "Hey dude, can't you see what great a manager I am? How did I get here? Because I am smart and because I am good, really good. I need no silly seminars to tell me how to do my job!".

As the book says, they believe they already have ALL the skills they need, plus they believe (in their hearts) that they do a damned good job, almost perfect. They think that psychology is common sense; if you are smart enough you can figure it out by yourself. But it's not that way. Psychology is a real science and you definitely cannot figure it out. Just read a couple of good texts and after your jaw drops to the floor for a couple dozens of times you will know that you could never have figured it out.

Needless to say, the competition will sooner or later do their part of the studying and inevitably they will outrun these managers and their companies. It's as certain as death and taxes.

Have fun,

Dimitris Staikos

October 28, 2008

Common Sense Quiz: Traffic patterns on my blog

Now this is a really tough one...

I was checking my blog statistics as usual and all of a sudden noticed that there was a pattern that I just couldn't explain... No way...

Why is it that my stats skyrocket (double the average value) every Monday and Friday?

Really mindblogging :-D

Have fun,

Dimitris Staikos

June 12, 2008

Infinite Energy

This is a very important issue that I would like to inform you about today.

There is a branch of physics that deals with the concept of "New Energy". This branch of physics is not recognized by the "scientific establishment" as anything serious, but this is always the case with science. Various madmen start on various types of crazy research and the establishment calls them madmen and fools. Then some of these madmen actually produce new and valid science, so they are not madmen any more and become part of the scientific establishment.

This is the case with "New Energy". You can visit the Infinite Energy Magazine for the gory details.

Here I will give you a brief outline of one of their research branches, the one I find most fascinating. This is the so called Zero Point Energy, or more popularly Vacuum Energy.

These guys, based on quanum physics, claim that you can draw infinite energy out of the vacuum. This is a shocking idea. Disruptive innovation. If this ever becomes a reality, then the energy problem will be solved once and for all, for all ages to come.

I am not in the position to judge the physics behind these theories, or how long it may be before they make it a reality, but what I know is that there is HOPE for humanity.
The additional reason why there is hope, is that today's world CAN be saved if such an innovation appears. Thank the almighty for the Internet. If the solution is found, then hopefully it will be made public on the Internet. Noone can prevent that. Then everyone will have the infinite energy technology, it will not be one country's top secret technology so that it can dominate over the others. Everyone will have free energy. The world can be a better place then.

Enjoy!

re: My Desktop

My good friend George Adamopoulos extended this invitation to me, so here is an overview of my desktop at work:

Desktopframe_009

So what can we see here?

On the right is my main workstation, with two monitors of course. The monitors are raised higher, using a dead UPS and a bunch of books, so as to reduce neck strain. On the left monitor you can see the video stream from where the capture came from. A recursive photo really, since it contains itself.
I used a Point Grey Grashoper 1394 camera and set our application to grab a frame every 5 seconds, then I picked one that was clear enough.

On the left is my laptop and in the middle is my private test PC, the one I first debug my drivers on. It's the one underneath the table, opened up of course so I can add/remove 1394 adapters easily. Please pay special attention to the light blue rubber keyboard that I bought for 4 euros (!!!) from Taipei. You can just roll it up and put it in your bag to carry along! Very convenient in that aspect, but really hard to type ultra fast with it as you get lots and lots of missed keystrokes.

At the far end you can also see my great collection of cups :-) Yeap, I am a proud cup collector!

Have fun!

February 28, 2008

Elements of Inner Change

Inner change is an issue that has in one way or the other occupied the mind of each of us, at one point or another in our lives. Becoming better persons, better partners, finding what we really want and following our heart, becoming ourselves, becoming happy.

"Am I ever gonna change?"
"Will I always stay the same?"

Do these ring any bells?

There is a lot of talk about change so I can freely add to that my own point of view.

Inner Change can happen. Inner change happens.

From my personal experience I have an idea of how it happens, but...
Although you may know how change happens, you can't force it to happen.
If it is going to happen, change will happen by itself.

This does not mean that you can do nothing at all about change. Of course you can. You can do a lot. You can do a lot, but only to prepare the grounds for change to happen. You can only prepare for change. If and when it is going to happen, change will happen by itself, almost spontaneously.

If you try to force change, you only make it harder for it to happen.
This is because what we do about change is mostly at the logical level. True inner change happens at the subconsious.

We all think we are purely logical, rational beings. We are not and we can never be. We can never articulate all the reasons why we are who we are, why we do what we do, why we like what we like, mostly because there are NO reasons to articulate. No reasons to analyze, examine and then logically substitute with new reasons that will make us somebody new. It doesn't work that way.

You have most probably heard that finding oneself in a real life-threatening situation and having a narrow escape is a life changing experience. Instantly your life flashes before your eyes, instantly you reevaluate everything and all of a sudden you are a new person.

OK, you know that, now try thinking really hard of yourself being in a life-threatening situation and having a narrow escape. Does it make you a new person? Does it change you? It should, damn it! But it won't... No matter how hard you try.
Why? Because you are NOT a purely rational being. Just accept it and play on. A logical thought like the one above cannot by itself cause inner change to happen, because... it is LOGICAL and inner change happens at the subconsious.

I said that I think I know how change happens but you can't force it to happen. I briefly covered the second part, which is the most crucial to realize. So how does change happen then?

Basically it is a truly stunning and staggering... two step process:
(1) Get new input
(2) Go to step 1.

Who would guess that inner change would be as simple as that???

Here is how it works. As you see, all that the process requires from you is to get new input, mainly into your logical brain. New input, new information, broadens your understanding, your perspectives, your options, your logical reasons TO and NOT TO do things.
New input will hopefully make you a bit wiser and it will prepare the path for inner change, but will not change you by itself.

As you keep on getting new input at some point a "critical mass" will be accomplished.
Now, it IS possible for change to happen. Now, it MAY happen.

Yes, but how does change happen after all?

Well, let's discuss first HOW do you get input. The input you need can only come from other humans. Not from a video game. Discuss life with your friends, open up to a total stranger you met in a bar, discuss with the barman if you will, see a psychologist, two psychologists, read books (they are mostly written by humans), any kind of book, not just psychology or self-help. Any kind of input is worthy. Any kind of input somehow contributes to the critical mass.

It is not a matter of how much input you gather. Once you are above critical mass, you are good. How much input you've got will only determine what kind of change will happen to you. Not when it will happen.

So, once again, how and when will change happen?

The missing element, the element that cannot be included in the two-step process above, is the TRIGGER.
It is an event that will trigger the inner change in the subconsious. By event I mean either an actual event (like a life-threatening car crash), something personal a friend told you, a thought that "randomly" poped up in your head, an unusual dream, or even some lyrics in a song. Anything can be your trigger.

There is no way to force the trigger to "happen". You can only be "open" to it and give it some fair chances, tempt chance. I mean sitting at home watching TV or staying awake in bed late at night thinking things over and over don't sound very triggering. Tempt chance, don't try too hard and remember to stay just a bit reasonable :-)
I mean, attempting suicide just to see how it feels like and if anyone will come to rescue you and care for you, or quickly divorcing your wife only to find out that it is her that you really love are probably "trying extra-hard" and plain silly. Take it easy, take it slow, and fate will take you anywhere you deeply intend to go.

Haven't you heard of the saying "When a disciple is ready, the teacher will appear"?
Do you see any similarities here? Will the teacher come to teach? Or will the teacher only come to trigger the disciple and make him LEARN in his heart apart from his mind and thus make him wise? The teacher's true mastery is not the knowledge of facts, it is knowing how to create the proper triggers for the disciple.

I do believe that when we are ready to learn then the true teacher always appears, because we can finally let him appear. Because finally anyone can serve as the teacher.

Similarly I do believe that when we are ready for inner change then the trigger always appears, because we can finally let it appear. Because finally anything can act as a trigger.

Have fun!
Dimitris Staikos

January 14, 2008

Embracing Confusion

I've been feeling a bit recursive the past days, so I thought I should try to explain the word "explain".
Let's start by seeing what the infamous online dictionaries propose:

Cambridge: To make something clear or easy to understand by describing or giving information about it.
Webster's:
1. Give an explanation for.
2. State by way of explanation.
3. Serve as an excuse for
Comments section: Explanations can only be given by those with understanding of the object which is explained.

Since Webster is recursive, i.e. uses the word "explanation" while trying to describe "explain" I also looked up "explanation" to see whether it included anything more thought provoking:
1. A statement that explains; "he launched into a detailed explanation"; "he demanded that I give an account for my failure".
2. Thought that makes something comprehensible.

Option (2) is good enough for my purposes, since "thought" may as well be replaced with "statement" or "description".

The operation and workings involved in communicating information from one human to another is a topic that has been extensively analyzed, although only a few care enough to study a little about it. It's mainly those to whom communication plays an important part in their profession (salesmen, politicians, managers, etc).

The rest of us know everything by definition, so we also know how to communicate :-)

So, since I by definition know everything too, I say that both the Cambridge and Webster definitions convey very little essence. Enter my vastly superior definition :-D

Explain: To make the target audience think they understand what you think you understand.

Understanding is nothing but an illusion. It can always expand and it will always expand. Confusion expands our understanding: You thought you understood, but now you are confused and don't understand. Hey, your understanding has just expanded and what previously looked solid and clear now appears complex and mysterious. Eventually you will reach a new and higher level of "solid" understanding, which may again be expanded by confusion, etc.

They routinely say "Embrace Change", I dare say "Embrace Confusion"!
And don't forget... Confusion is an illusion as well...

Have fun!
Dimitris Staikos

December 27, 2007

Like Father Like Son?

Given that we all need to relax a bit these special days, I won't blog about Writing Debuggable Code yet. Rather I thought I should share a photo I shot almost two years ago, when my son was just 19 months old.

Likefatherlikeson

Have fun!

Dimitris Staikos

November 26, 2007

Demystifying Device Driver Development (DDDD)

It just occurred to me recently that most people don't really have a clue about what it is that Device Driver Developers (DDDs) do for a living. Since I am a DDD myself, among other things, I thought I should make an attempt of describing what I do in a way that Common People can hopefully digest.

Since I enjoy making wannabe hilarious Tom & Jerry dialogs, I will try to put it in a dialog between Jerry the Technical Interviewer and myself. I will intentionally wear the hat of the anti-social, psycho-path, under-the-hood programmer and let Jerry extract all the information from me in a criminal-interrogation like style.

Here we go...

Jerry: So you are a DDD.
Me: Yeap.
Jerry: Can you tell me what it is that you do?
Me: Yeap.
Jerry: I mean you build device drivers right?
Me: Yeap.
Jerry: What exactly is a device driver?
Me: It's just a piece of software that controls a device. Don't you know that? Are you wasting my time?
Jerry: Yes, I guess I do, ehhh I mean I do know, but what exactly is a device?
Me: That's an interesting question so I will dignify it with an answer. A device is a clever piece of hardware. To make things simple, imagine that a device has a little CPU of its own, a CPU that can execute various tasks depending on the hardware at hand.
Jerry: Wow64, there is a CPU on these things? A CPU on a PCI card that I buy off the shelf?
Me: Duh, but of course, how else do you think they would do any useful work?
Jerry: I thought the computer's CPU was the only CPU in the block.
Me: No, devices have CPUs and depending on the hardware they can be pretty sophisticated.
Jerry: That's awesome! What can you tell me about these little CPUs?
Me: For starters, they are not little. Most of them can do several tasks at the same time and they can be pretty darn fast.
Jerry: Hmmm, wherever there is a CPU, there is a program right?
Me: Yeap.
Jerry: Well, where are the programs that these CPUs execute? Firmware stored in flash memory may be?
Me: You'd wish.
Jerry: Please elaborate, I'm getting really curious here.
Me: OK, if you insist... These programs are generated by the device driver.
Jerry: Pardon me?
Me: The programs that the device CPUs execute are generated by the device drivers. Clearer now?
Jerry: Wow64!
Me: Indeed.
Jerry: Generated by the device driver... In what language?
Me: That was a good one! Machine language of course.
Jerry: You mean mov ecx,edx and the like?
Me: Well, in a sense yes. Each device CPU has its own machine language.
Jerry: You are kidding me right?
Me: No way. Don't be an idiot.
Jerry: So the device driver builds machine language programs for the device CPU?
Me: Actually, it's even worse than that. These CPUs usually have many sub-CPUs, execution contexts we call them. The device driver generates programs for several (if not all) execution contexts. Each program is called a context program.
Jerry: Wow64 once again! And where are these context programs located at runtime?
Me: Well, in most cases in main memory, the little thingy you call RAM. Sometimes devices may have onboard memory for storing these programs, but in most cases it's just RAM.
Jerry: In RAM? Wait wait... And how can the device CPU read from RAM? Can it handle virtual addresses and the like?
Me: Man, you are really something! Virtual addresses? What are you talking about? When was the last time you heard the term "Physical Address"? These are the kind of things these CPUs can swallow.
Jerry: Physical Address? What are YOU talking about? Are we talking about DOS here?
Me: LOL. Please realize NOW that devices are what's called "Close To The Metal". They don't and they won't understand virtual crap of any sort. They operate at the PCI level, so they will only understand PCI-level physical addresses.
Jerry: Then how does it all work?
Me: Well the device driver allocates some piece(s) of memory where it intends to store the context programs and then kindly asks the operating system to give it the physical addresses of these pieces of memory. The OS happily obliges and then the device driver prepares the context programs, using physical addresses wherever a jump is required. When the context programs are ready, the device driver sets the Program Counter register on the various sub-CPUs of the device and then starts these CPUs. Ain't it cute?
Jerry: Wowowowowow64!!! That's super cool.
Me: Yeap.
Jerry: If I understand well, the device driver is like a mini operating system for a device, right?
Me: You couldn't phrase it better.
Jerry: Now I realize why being a DDD is so tough! You have to write a mini OS of your own and make the device do your bidding!
Me: Yeah, but the truth is making the context programs and handling their operation is the easy part.
Jerry: Huh? And what is the difficult part?
Me: ERROR HANDLING.
Jerry: Please please, please elaborate!
Me: Well, it's no big deal for an experienced DDD to write a device driver for a well behaved device. The tough thing is to write a driver that does not malfunction or crash the OS in the presence of device errors. These do not happen often so it is really hard to test the error handling code. Actually if you write ANY decent program, user mode or kernel, error handling largely amounts to 50% of the code. If it does not amount to 50% in your code, then you haven't done enough error handling. No developer likes error handling (with the exception of myself of course). It's boring, it's nasty, it's creepy. But unless you do it and you TEST it throughly you can't write decent software. For device drivers this is even more crucial, since in the presence of device errors the best thing that you can hope for is that the device stops functioning (we call it the device is dead). However in the majority of cases (at least in Windows) you get an OS crash.
Jerry: And how do YOU test your error handling code?
Me: That's a trade secret.
Jerry: Com'on now...
Me: I keep an arsenal of malfunctioning devices at my office. Everyone in my team has strict instructions to immediately hand me any device that appears to be malfunctioning. They are my secret treasure.
Jerry: But how can you be sure that your driver handles correctly all possible errors?
Me: I am not.
Jerry: You're NOT???
Me: Well, why do you think it is that people still get BSODs when something unusual happens? Even if you get a driver developed by a team that takes error handling very seriously, they can't test everything, simply because they haven't seen everything yet. So you get BSODs.
Jerry: I am shocked. This is brutal.
Me: Well, as I've said elsewhere BSODs are a blessing. As far as your complaints are concerned, please pass them on to the device manufacturers. If they would put some "test mode" into their devices and make them fail randomly then MY job would be MUCH more easier. But these things would have to go to the chip level and then they would have a significant added cost as you realize. So practically everyone in the industry operates in a "hoping for the best" mode.
Jerry: ...
Me: You can't imagine what I have to go through to make buggy devices operate correctly. In your mind the term "bug" is most probably related to software, but let me break some news to you: There are COUNTLESS bugs in hardware chips and devices, and poor DDDs like me have to struggle hard to ship a decent driver only to have lusers scream their lungs out at ME when they get a BSOD. They scream because probably I didn't handle 100% correctly all the bugs in the hardware chips. But who am I supposed to scream at? Texas Instruments? Intel? You get the picture.
Jerry: Well, I can only say that under this new light I have a whole new appreciation for the work you DDDs are doing.
Me: Darn right you should.
Jerry: My special thanks for this enlightening interview.
Me: May the force be with you.
Jerry: Any last minute advice for Common People who use PCs?
Me: Don't add more RAM to your PC unless you know what you are doing.
Jerry: Excuse me? Don't add more RAM? What harm could additional RAM possibly cause???
Me: I will describe that in a separate post, when I feel like having mercy on the masses. For the time being I know, and you don't. Huh!

Have fun!
Dimitris Staikos