Hackaton in Zurich

I am quite excited about the upcoming Hackaton event in Zurich, which I will attend. I've been learning a whole lot more about functional programing, and this event is all about Haskell and hacking. While I'm not really working on a huge project that I plan to present on the Hackaton like others are (for example the Utrecht Haskell Compiler), I hope this to be a great experience.

Currently I'm working in a team (of 2) on an interpreter for a toy language very much resembling lambda calculus, and I hope to do some advances during the Hackaton weekend. I am responsible for the evaluation strategies that will be used in this language (ideally more will be supported, and the evaluation strategy will be a command line parameter), and also for garbage collection.

Then, I will spend Monday and a part of Tuesday to go sight-seeing around Zurich.

POST#0079 2010-MAR-2

Add Comment

How checklists can improve processes

When a doctor prescribes a medicine, the patient has to take a number of pills every so often. My grandmother is very old and must take 5 different type of pills, each at a specific time of day. It's easy to forget and make mix-ups – there should be a mechanism to help patients remember. Here are a few ideas from the top of my head:

  • Electronic: you have a watch or a pager-sized device that keeps beeping until you confirm you've taken the pill. Disadvantage: I bet it would be a pain in the ass to program it. Some healthy people can't handle electronic watches, let alone ill people handling more complex technology.
  • On paper: have the doctor print a table with check-boxes that you check each time after taking the medicine. When prescribing drugs, instead of writing with a pen (doctors have terrible writing anyway), they could just enter some information (how often take the pill and for how long) and generate a timetable. This way it's more fun and you can know for sure when you've forgotten to take the medicine. Additionally, there is a feedback mechanism – you know if you're improving or not when looking at the table.

This idea is based on the fact that checklists tend to reduce mistakes on average. In hospitals, the number of accidental deaths in surgery has dropped after nurses went through a checklist during the procedures. In what other areas could this idea be applied? What are the downsides to checklists?

POST#0078 2009-AUG-10

Add Comment

Moving in Netherlands

On August this year I'll be moving in Utrecht, Netherlands (for at least two years) to study „Software Technology“ at Utrecht University. I'm really excited about the things I'm going to learn there, and also about the fact that I'll be surrounded with people having similar goals. I'm leaping into the unknown here, in the sense that everything about Netherlands is unfamiliar, but I am absolutely convinced it's going to create a lot of opportunities for self improvement. The Dutch language is somewhere in the middle between English and German, it's not easy to learn, but I can already say useful simple things like „How much does that cost“ or „I am going to eat something“. Anyway, all the courses will be in English. The Software Technology research at UU is mostly related to functional programming and programming languages in general from what I can tell, and I look forward to getting started!

POST#0077 2009-JUN-20

Add Comment

How do rail car wheels manage to go round the curve?

Recently I remembered a puzzle I thought about a few years ago: „How do rail car wheels manage to go round the curve?“. My friends and I, we were in a train returning from a trip to the mountain. The train had a small incident, something related to a short-circuit and electric failure: there was a bolt of electricity which could be seen from under the train reaching a considerable distance and touching a nearby house. The train came to a stop and there was some smoke, but we were fine and we got back home safely. Oh yes, going back to wheels, well, this event made us more conscious that we are actually traveling in a train, on a set of wheels on a track, and someone posed the question.

Take a normal car, the one that can be driven on the road. Have you observed that, while you're inside it, when the car steers, a part of the vehicle moves more than the other? Consequently, when in a curve, some of the wheels have to roll more than the others. To make this possible, cars are equipped with differentials placed between them on the axis, allowing wheels to turn independently one from another.

Rail vehicles, however, use no differentials: the axis and two wheels are all connected in one piece. This shows that the problem of trains negotiating curves is not as easy as one can initially think. My first guess was that tracks are tilted in curve, allowing trains to bank when needed. It turns out that this is true, this type of curves are called cants1. They allow trains to change their direction while maintaining a greater speed. However, we're not done yet, there's something more at work…

Another instance of curved tracks I observed is that which is used by tram-ways. There is at least one place in Bucharest where the tracks lead trams in a tight curve (it's actually a U-turn at the end of the line). They slowly pass through it, making a lot of noise resulting from the friction of metal. In this case, the wheels are spinning at the same speed, except superelevation (or banking) and the centrifugal force cause more weight to be placed on the inside wheels. Since there is less force placed on the outside wheels, they skid over the rail (producing the friction noise).

But leaving the trams aside and going back to trains, the most interesting fact, seems to be this one: the wheels and track have such a geometry that, as the car enters a curve, the lateral displacement causes the rolling radius of the left and right wheel to change. This means that the wheels start to behave as a cone rather than a cylinder, allowing the car to steer freely through the curve.

So yes, have you ever wondered why are railroad wheels shaped like that? it seems that indeed there is a purpose to the geometry of the wheels and the rail profiles as well.


1: „http://en.wi­kipedia.org/wi­ki/Cant_(road/ra­il)“

POST#0076 2009-JUN-2

Add Comment

The Artificial Brain, Singularity

„Sir, the following paradigm shifts occurred while you were out“, announces the secretary to its returning boss in a the now classic cartoon related to the Singularity, the moment when even the most intelligent human will be surpassed by a machine in all ways.

If we are to trigger this event, then our own brain is a good starting point. Just like that of humans, the artificial brain will probably have to learn everything about reality and solve the problem of interacting with the environment. In contrast with us, however, it will have to find other ways to get experienced, since it will probably be difficult for it to pass through a genuine childhood.

Arguably, the artificial intelligence could learn everything just like a newborn, perhaps through special training. But will that be of much value? Would it result in something more than an average human? In my opinion, it would be necessary to supplement the processing power and hardware resources that support the artificial brain with sensory experience required to write, say, a poem about a tree. This way, it would be something along the lines of a supercomputer with a character, possessing two types of knowledge: the first one, common knowledge would include information about every subject, and perhaps every existing taxonomy – and the second one would be subjective knowledge, allowing for fuzzy connections and associations which can only be created through personal experience.

But what is a brain, really? Is it just the sum of all its neurons, a collection of automaton cells working together in a predictable way, or is it something more? To attempt to answer this, we could start by looking at how the brain is formed. It may be safe to consider it pretty much empty at birth, with not much in it – other than perhaps some instincts.

In becoming sentient, however, the brain is dependent on its surroundings. It is quite literally their reflection, since it considers true whatever it observes and predicts about the environment. If you look at a tree, for example, you recognize it's a tree but would a put-together simulation of neurons understand that? The simulation didn't go to kindergarten, it doesn't know stories with trees, it hasn't seen movies with trees, it hasn't seen a tree before. In order for it to be effective, the association between the word „tree“ and the experience of perceiving it through all the five senses would have to become possible.

In a story I read (but unfortunately no longer find on the Web to credit the original author), after the extinction of Man, two computers remain, created with the purpose of serving mankind and solving problems such as building cities. A newly created machine, however, is curious about the nature of humans. It studies all the artifacts it finds and gathers all the possible information about them, and after doing so it reaches the conclusion that the way to become human is to transfer itself inside a human body (which it does, then takes over all the other machines).

Ultimately what we would like to possess is an artifact having intelligence and processing power superior to our own, combined with a relentless occupation of this virtual mind on how to solve our problems and make new discoveries, and to elaborate new scientific theories. Of course, we would ask it far more significant questions than „Answer to the Ultimate Question of Life, the Universe, and Everything“, to which everyone knows the answer is 42, as Douglas Adams tells us. In parallel to the Deep Thought supercomputer imagined by the author, our Singularity intelligence will have to allocate resources (energy, time, materials) to find answers to our queries about reality.

POST#0075 2009-MAY-8

Add Comment

Why should marijuana be kept illegal, 2

Regarding the previous post about Why should marijuana be kept illegal, it would be interesting to note that Portugal experimented with a policy of decriminalizing not only marijuana, but other drugs as well. While this doesn't mean it's legal, it does mean it put the focus on helping users overcome the problem. The result was: „Compared to the European Union and the U.S., Portugal's drug use numbers are impressive. Following decriminalization, Portugal had the lowest rate of lifetime marijuana use in people over 15 in the E.U.: 10%.“ (Source).

POST#0074 2009-APR-27

Add Comment

The morality of using brain stimulants

There's an interesting article about the illegal use of certain types of brain stimulants in order to boost brain activity. It's a lot of text, but it's worth reading everything.

Often we are distracted and cannot concentrate on our work (whether is for the job or for studying). On one hand, it is moral to use medicines and chemicals to alter our body chemistry and improve our life. Coffee for example is considered a performance booster for many. On the other hand, is it really worth the risk to pump oneself up with this stuff just to be able to work more?

POST#0073 2009-APR-23

Add Comment

Database and Model Naming Conventions, the NULL Value

When creating a new database model, I always prefer to use the singular form when naming entities. For example, instead of using „customers“, I like using „customer“. It is in my opinion consistent with OOP programming.

When dealing with database tables, as beginners we think about them in the first way it comes to mind: as a table drawn on paper, or maybe as a HTML table. The table we first imagine is likely to have a header (the column names) and rows (each one for every entry in the table). However, there is a different way of looking at them. Each table could be seen as an Entity. An Entity represents a template, such as a „customer“, just like a Class is a template for an instance. It makes then sense to use the singular name when creating the table in this case.

This is because, when creating classes, it's much more intuitive to create a single customer with:

$object = new Customer();

rather than with

$object = new Customers();

Continuing this train of thought, the table columns are no longer columns, but are properties of the object. A database table has columns just like a class has properties. The semantics of NULL value for properties of a record: the object doesn't have that property. So, when we declare a field as Nullable, we are actually saying that a record for that entity can be instanced even without a value for that property. We could retrieve a nonexistent property from a record, and that will also return NULL. So, for a certain record, a non existent field and a defined one (but NULL one) should be identical from the API point of view. However, when we do in MySQL something like:

SELECT `inexistentColumnName` FROM `customers`;

we get the following error:

#1054 - Unknown column 'inexistentColumnName' in 'field list'

and there is no setting to control whether we can accept those columns or not. But because we still want to see the NULL values at work, we can create a test database with a couple of tables, after which we will use the LEFT JOIN query:

CREATE TABLE IF NOT EXISTS `a` (
  `idA` int(11) NOT NULL,
  `fieldA` int(11) NOT NULL
);
INSERT INTO `a` (`idA`, `fieldA`) VALUES (1, 111), (2, 222);

CREATE TABLE IF NOT EXISTS `b` (
  `idB` int(11) NOT NULL,
  `bField` int(11) NOT NULL
);
INSERT INTO `b` (`idB`, `bField`) VALUES (1, 555);

Having created these data structures, we now just query the a table using a LEFT JOIN with the b table. What this translates into is „Show me all the records from a that have an idA value that is found in b.idB“. The „LEFT“ actually says „And also return the records from a that have no match in b“:

SELECT * FROM `a`
LEFT JOIN `b` ON `a`.`idA` = `b`.`idB`;

The query returns:

idA fieldA idB bField
1 111 1 555
2 222 NULL NULL

So, now we should have our results, observe the NULL values, which in this context could be said to mean „This resulting record doesn't have the properties idB, bField“. After seeing how database tables and classes in OOP are analogous, it should be even more clear that we should name our classes and database tables in the same way. As you work with legacy applications and with other programmers, you learn to accept the plural as a different naming convention, which is okay as long as there is consistency. A few problems may arise only when having to deal with a mix of plural and singular names.

POST#0072 2009-APR-22

Add Comment

On (Business) Success Literature

When starting a business, or any sort of enterprise, one can get into a great state of mind and get excited from a variety of books that teach the rules, presented as a sure way to guarantee success. This exists in programming too, it's also known as the silver bullet, either in the form of books about programming methodologies or in the form of software components and frameworks.

But how much of the success is attributed to a specific method and set of rules and how much to other factors, such as pure chance or something else, not so glamorous? This is a question raised in Luck Inc.

It seems to me that the conclusion is that the best way to learn programming or doing business is to just go out there and do stuff. The more you do, the more you will learn.

POST#0071 2009-APR-20

Add Comment

The arguments not against Religion

I was brought up in a religious country. Even now, in Romania, religion is quite a big deal. Since now we're close to Easter holidays, you should know that foreigners witnessing the orthodox tradition are surprised by the amplitude of the events happening on Easter day. Basically everyone goes to church, listens to the priest's hypnotic discourse, and lights up candles, making sure to „take the light“, that is – to light their candle from the „official“ candlestick (or other candles as long as they are lit from there).

I have kept thinking and writing in the past about the arguments against religion, but never why it's useful in the first place. It's sometimes required to think from people's perspec­tive, so here it is – cases where I think religion could be a positive thing:

  • Missionaries are the first to intervene in a third world country, wherever there is a society needing this, even if it costs them their lives – they try to educate people and get them to coexist peacefully.
  • Sometimes (not so often today), people or groups of people are found in situations where there is no visible way out. Religion helps them cooperate in difficult settings and gives them hope to overcome hardships easier. It also eases the psychological pain when sacrifice is needed (for instance, there are 40 virgins waiting for you in heaven if you die). This may explain the emergence of religion through an evolutionary standpoint: the communities that were supported by a religious belief may have acted in bolder ways, and therefore had greater chances of survival.
  • When someone dies, the priest giving the mess somehow provides comfort. This is something I experienced. I guess it has to do with the superstitious nature of humans. For example, think of a disgusting insect, but made of chocolate. It's not a real insect, you know it's edible, but would you easily eat it? In the same way, I guess priests provide some comfort for the loss of someone – somehow they appeal to our superstitious self, telling us the deceased are in a better place.

In conclusion, we are fortunate that today we are living a better life, closer to the truth, and in chance there is a God, then it's most probably something stretching a lot the definition that religions give of God.

POST#0070 2009-APR-15

Add Comment