The idea it was named after

Monday, September 26, 2005

New tools for development

Now that I have finished the exams I can concentrate in preparing myself to develop AVD (Aeromodels Virtual Designer). I finally read the Vol 1 of Thinking in C++ and I'm already starting to read vol 2. Plus, I've been reading a bit about Scons, which seems a very easy to use and powerful software construction tool. Scons follows what seems to be the natural way, because it uses only 1 language (autotools use 3 arcane languages!), and what's more, it's OOP: Python.

To give a very brief idea I'll give you a simple example. If you want to compile a simple file like Wrapped.cpp, you just create a file called SConstruct like this:


This is the output of the scons command is:

$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -c -o Wrapped.o Wrapped.cpp
g++ -o Wrapped Wrapped.o
scons: done building targets.

That.s what I do for simple programs testing ideas while reading TIC++ Vol 2, and saves me some typing. It's easy & clean, isn't it ?

Konqueror Tip

For those konqui web browser users, you know that you're lucky because it's as light speed to launch. Just click and pops, more or less. There are some available tricks that can make it feel faster than it is, such as keep one instance running in the background all the time, so when you launch it what's really doing is just showing a new window of an already running program. But lately konqueror launching has become a bit slower because it shows a cool but slow to render webpage, with lots of images (icons, huge background) that need to be loaded from the harddisk, which happens to be the bottle-neck of everyday PCs.

So my simple solution is not to show that initial screen, but about:blank. Before thinking put about:about as the Starting URL! think it twice: the starting url in konqueror configure dialog is actually for the filebrowser profile, so it doesn't solve the problem.

So now right click in the konqueror icon, and open the Properties dialog. In the Application tab (the third one) add to the end to the command " about:blank", and then press Accept. The command will end being like this:

kfmclient openProfile webbrowsing about:blank

Now I cannot even measure how much does konqueror take to launch, what means to me that it doesn't matter anymore (what's the different between 0.1 and 0.05 seconds in this matter?).

Saturday, September 17, 2005

Magical keyboard

Lately I've seen some strange keyboard models in Internet. The most revolucionary one is the Optimus keyboard. What special feature has it built-in? Keys are no longer a static thing. Instead of each key having printed their respective symbols, it has a small OLED display!

So you can change the keyboard layout, literally. In the link above, the example that convinced me is the one showing the keyboard layout for playing Quake3: you don't need no more to show the list of shortcuts for your videogames & programs and memorize it: just look at the keyboard! This is really useful for people like me, who only play videogames from time to time and thus don't know very well all the shortcuts WYSIWYG on your keyboard!

What's more, you could add any other layout easily, or maybe change it interactively (i.e.: when you press Ctrl then the shortcuts available appear in the keyboard); in the FAQ it's said that it will be OS independent and the drivers will be open source, with SDK available. BTW the pictures in the keys can be animated also. And it includes a set of keys on the left side meant as shortcuts for your favorites apps or actions.

Before bumping into this keyboard, I saw the Das Keyboard. I wouldn't buy it, but its concept is still interesting. It's an ultra geek keyboard, and because of it.. they decided not to print they symbols in the keys. The idea is that they force you not to look at the keyboard, because there's nothing printed on it. So in the end, you are supposed to memorize where is what easily and thus speed up your writting. But after discovering the Optimus keyboard, I find it much more powerful: you could even emulate the Das Keyboard behaviour just removing all the images in the keyboard, although you could do that as well in any normal keyboard, and only a good rubber is needed hehe.

Thursday, September 15, 2005

Public Domain, Censorship & Syndication

If after reading the title of this entry you thought I'm going to start talking about politics, you're wrong!

In the footer of every page in my weblog, you can read "NO RIGHTS RESERVED" and "This weblog is in the Public domain". I decided to license the text of this weblog in the most permissive license available today, which is just to give it away to the Public Domain. It means that you can do whatever you can imagine with my texts available in this weblog, provided that you mention me (the original author) and don't use it offensively, and those are just common law restrictions.

I could have as well used many free licenses, probably a Creative Commons one like many people do. How did I reach to that decision? In order to get an idea about the state of the art about weblog licenses, I visited some weblog of people I respect. I finally bumped into Jorge Cortell's weblog. His weblog was just in the public domain! He even has a nice explanation about it in his footer - Unfortunatelly it's in spanish - it really convinced me. I thought: yeah, why should I care about people copying? just give it free. In the end, everything is supposed to become public domain after XX years, so just in case the copyright extends and extends all over again, I wanted to be sure that *this* words I write, won't have those limits.

What I wonder now is under what license are the comments of a web page? Are they under copyright - everything is, by default - or they are supposed to accept & endorse the license of the page? I'll clarify it soon.

Talking about freedom & comments, why not censorship. I think I need to say the way comments are allowed in this weblog. I allow anonymous comments, because it's really annoying the neeed to register in so many websites, when you just want to write something fast. I have suffered it. But I don't want off-topics, trolls, non-constructive critics, offensive comments, etc. I don't have a voting system like other weblogs like slashdot, so I'll delete them in those cases. I'm surprised I already had to delete one comment of such a kind, but I don't regret; this kind of censorship is good when in small dosis, just like drinking a glass of wine (yeah alcohol is a drug) at lunch is good for your health.

Oh and syndication! I'm already in the blog list of Agali, and I have added posibility to syndicate this weblog not only with Atom but with RSS2; Thanks for all Mogu!

Sunday, September 11, 2005

Now Multiple assignation really works

I've been hacking a bit the small example implementing multiple assigments in C++. The code is acually even a bit easier, as I have simplified the process. It's funny to see that depending on if you return void or nothing in the operator =, its precedence seems to change! At least in gcc which is the compiler I'm using.

Let's explain the modus operandi of the code; let's say we have the following statement:
a, b, c = d, e, f;

What happens?

  1. The operator = is called, for c = d. It initialices a static var called stage to 1, saves those two elements in two static pointers for later use and finally acts as if we wanted to do c = d;, because this is the only chance we have to do it, and if that's not the case, we'll fix it later. Finally, the operator returns d, reducing everything to this list of elements:
    a, b, d, e, f;

  2. The comma operator is called for a, b. We're in stage 1, everything is fine. The operator finds that the second element is still not d, so we are in the left part of the comma-separated list. It links a to b as in a linked list, and sets the static pointer actual to &a. actual stablishes which is the following var we want to assign. It was zero until now (the = operator initizalized it to zero).

  3. The comma operator is called for b, d. It detects that the second element is d when comparing it against the static var right. We are in the middle of the assigment! b is linked to c (that was saved in the satic pointer left), and it assigns d to a using actual. Finally it sets actual to the next element in the linked list, and the operator returns d.

  4. The same process is repeated again and again for d, e and e, f. It just continues retrieving elements from the linked list and setting them to the value of the second element of the operator (inside both operators, the first element is the pointer this and the second one is passed by reference as an argument: obj).

So there you go! Now the program doesn't need to treat a, b = c, d; as an special corner case. It just works =). The code is in the same place as before, but it's been updated.

Non sequitur

This is a term that means "it doesn't follow". Vamos, que no se sigue. Who doesn't like to be like that sometimes?

I love programing, just for fun. Now I'm going to start a new project written in C++, called Aeromodels Virtual Designer. It will be my first graphical program and big project in such a language. I'll talk about it later on. The thing is that I'm preparing to bbe up to the task, and now I'm finally finishing reading the Thinking in C++ book. I was learning the usage of operators overloading and thought: what the heck, let's try to implement multiple assignation in C++!

Multiple assignation means that you can do something like this:

a, b, c = d, e, f;

Yeah, and it works! I have the example code for you. Given that code, this is the output in my system when I execute it:

$ g++ multassign.cpp -o multassign && ./multassign
0xbffff7c0: 1
0xbffff7b8: 2
0xbffff7b0: 3
0xbffff7a8: 4
0xbffff7a0: 5
0xbffff798: 6
0xbffff790: 7
0xbffff788: 8
0xbffff780: 9
0xbffff778: 10
0xbffff770: 11
0xbffff768: 12
a = b;
b, c, d = e, f, g;
e, f, g, h = i, j, k, l;
0xbffff7c0: 2
0xbffff7b8: 5
0xbffff7b0: 6
0xbffff7a8: 7
0xbffff7a0: 9
0xbffff798: 10
0xbffff790: 11
0xbffff788: 12
0xbffff780: 9
0xbffff778: 10
0xbffff770: 11
0xbffff768: 12

All right, so you noticed it? It doesn't support yet to do something like:

a, b = c, d;

Why? Because it's difficult to implement so many things at once hehe. I think I only need to refactor some code, perhaps add some temporal vars and add some code to deal with the special case. Maybe today I'll finish it, because it's certainly possible to do.

Saturday, September 10, 2005


Welcome to my readers!

This is a piece of the cyberspace that I'm starting. I'll write it in English because of it's the language that most people can understand in this era; however some entries might appear in Spanish and others even contain languages type 2, like C++ and what's worse, they could not compile at all.

What will I write about? Probably about computer related matters. I'll mention whatever I find interesting. Music. News. Crazy toy programs. Stories. Scientific Discoveries. Maths. Software projects. Conspirations. Humor. Politics. Discover it by yourself!

Hope you enjoy my blog as much as I'll do. Note that you can write comments, and it doesn't matter if you're logged or not: anonymous comments are allowed!