Tuesday, October 13, 2015

The Open Source Revolution

12 years ago after experiencing yet another blue screen of death, I decided to switch to GNU/Linux. That is how I progressively built an interest and ultimately a passion for Open Source.

As you may know, Open Source softwares allow users to freely access and modify the source code, as opposed to proprietary softwares where only the owners can do that. Thanks to the Internet, this enables collaboration at a planetary scale.

Questions often arise such as: how to make money with Open Source? I'm not gonna discuss that. That might even be a bogus question. It's clear that as measure as Open Source spreads, the role of money is shifting anyway.

So, back to the main topic: the Open Source Revolution is happening! We already know how pervasive GNU/Linux is in the tech industry. But what about other sectors where a much smaller portion of the users are techies, like say the music software industry? Well, something unprecedented has recently happened. A manufacturer (and a darn good one) of professional mixing consoles, Harrison, has chosen to build the software part of their product based on Ardour, an Open Source Digital Audio Workstation. As a consequence, they can sell the software part at an unbeatable price, and of course they use some of their benefits to invest back into Ardour's development.

Another recent cool project, OpenBazaar. An Open Source alternative to Ebay! Or YaCy, an Open Source P2P web search engine (although, it's coded in Java, I hardly think it's gonna succeed, but at least they are trying!)

Personally, I have no doubt that the rise of Open Source is gonna come with a raise of awareness, ultimately leading to a more collaborative, creative, efficient and free world. And, as I hope you agree, we can already see the early signs of it!

Sunday, January 5, 2014

Increase your productivity under Xfce with rename-xfce-workspace

To increase my productivity and better organize my work under Xfce, I find a simple way is to bind to shortcut keys the following workspace operations:
  1. insert workspace
  2. delete workspace
  3. rename workspace
That way whenever a task comes up I can insert a workspace, rename it, do some work in it, and once done delete it.

By default insert and delete workspace operations are bound to Alt-Insert and Alt-Delete. And you can rebind them to anything you like via the Windows Manager settings. However, there is no way to bind a shortcut key to rename a workspace, so I wrote a tool that does just that:

https://github.com/ngeiswei/rename-xfce-workspace

All you have to do (beside fulfilling the requirements, see README.md) is copy it under /usr/bin or anywhere accessible by your PATH and bind it to some key (via Keyboard settings, I usually use Super-R).

For example, say you want to start doing some music, you insert a new workspace, but the name (here "Hard Work") doesn't match your new task.

You move to that new workspace, press Super-R (which fires rename-xfce-workspace), and then rename that workspace to match your task, say "Music" (see screenshots below).



In the meantime if some task comes up, just re-insert a new workspace and rename it accordingly.

You can delete your workspace once you're done with your task. However
Xfce will delete the right most workspace, not the current one, I've actually looked for a workaround and it doesn't seem difficult to fix but I'm already satisfied enough not to bother any further. All you've gotta do, till that is fixed, is stack up your tasks.

Hope you find rename-xfce-workspace useful, drop me a comment if you do.

Friday, November 1, 2013

The universe is not a simulation, the universe is timeless.

To explain what I mean by that, let me show you how you can simulate a world, going forward (just like you and your PC are), containing virtual beings with a consciousness of time going backward.

If you ask them the direction of time they will point to the opposite direction (well you can't really ask in real time, you'd receive the answer before you ask, but you can embed rules to produce that answer and look for it, or you can switch the direction of the simulation while waiting for your answer, but that's somewhat cheating).

So how to do that:

1) Define a simulation, say a world similar to ours that contains sentient beings aware of time.

2) Take a state that you know contains a past with such intelligent beings.

3) From that state run the rules in reverse, now you'll naturally end up with multiple worlds, there might well be determinism when you go forward, but its mirror will produce indeterminism. If you've got enough computational power just generate them all, otherwise pick a few at random and hope your sentient beings will be in the sub-multiverse you're creating.

4) Eventually you should get someone answering your question.

If you can have sentient beings in your computer that go backward in time, why not have that in the universe already? After all quantum physics produces indeterminism, a good candidate for supporting creatures going backward in time. And, BTW, while all that is sitting on your hard drive, you do get time existing in a timeless state? All that to say that time is completely arbitrary, the universe fundamentally doesn't need time, time is only an emergent concept, that can have as many flavors as you are willing to call that time.

So that is why the universe is not a simulation, the universe is more abstract than that, it is pure timeless math.

Wednesday, March 7, 2012

Another BASH weirdness: associative array really unordered

Associative arrays in bash do not necessarily have their values or keys in the same order even if the keys are identical. This is not a bug (according to the people hanging at #bash), the associative arrays are simply unordered... But, IMO, it is quite contrary to what the programmer expects, because in most programming languages the hash function is static, in bash don't count on it!

Try that for instance:

$ declare -A aa1 aa2
$ for s in test train; do for i in $(seq 0 10); do aa1[$s,$i]=value_of_$s,$i; done; done
$ for key in ${!aa1[@]}; do aa2[$key]=value_of_$key; done
$ echo ${!aa1[@]}
$ echo ${!aa2[@]}

Look carefully... surprise!

You can fix that by sorting the keys and iterating through them, here some code that does that:

# sort words. For instance
# $(sw "truc troc trac")
# returns trac troc truc
sw() {
    echo "$1" | tr " " "\n" | sort | tr "\n" " "
}

# display the values of an associative array according to a static
# order of its keys
sa() {
    eval keys=\${!$1[@]}
    sorted_keys=$(sw "$keys")
    echo $(for k in $sorted_keys; do eval echo \${$1[$k]}; done)
}

Now you can use

$ echo $(sa aa1)
$ echo $(sa aa2)

instead of

$ echo ${aa1[@]}
$ echo ${aa2[@]}

and see that the order is respected.