I wonder who is acting like a moron…

It is often surprising how some people can really lose control of a situation.

Take this example http://dev.gentoo.org/~ferdy/tmp/seemant-moron.log . It is actually sad having to deal with that kind of thing. I asked three times for an apology and (surprise surprise) I didn’t get one. One publicly in IRC, another one in a /query and a third one by mail.

Besides wondering who is the one acting like a moron, I really wonder why people have the feeling that Gentoo is oh so nice and friendly.

No love.

— ferdy

PS: Despite of his attitude, I still can’t be bothered with personal issues. So if he wanted me to have an issue with him, I’m thankful he failed.

Been to Morocco, loved it

I didn’t really want to go there because it meant lots of car (4100 Km in a week) and not enough time to enjoy and getting to know each place we went.

ferdy as a twareg

In the end, well, I went. And I’m quite happy I did it. It is a very interesting country where the first thing you learn is:

Hurry kills...
    and lazyness re-kills. — Anyone in Morocco

We crossed the Atlas twice. Some of the views up there are just amazing.

We also went to the dunes in Merzouga. If you ever consider going to Morocco, you can’t miss a couple of nights in ‘Atlas du Sable‘ with Ali’s crew, those guys make it very comfortable and enjoyable.

We also visited M’Hamid and that part of Morocco, that part was a bit harder emotionally. But it is still enlightening and a very interesting place to visit.

Last place was Marrakech. I loved it so much that I’ll have to go again because two nights is not enough for this city.

Only complains are: Too many hours of ‘car stuck because of sand’ and not enough time to get to know any place. but all in all it’s been a wonderful trip and a very nice experience. Their way of living and thinking is just too different from anything in Europe.

We took hundreds of photos, some of them are on my picasaweb album: http://picasaweb.google.com/fpereda/MoroccoTour07 .

If you ever have the oportunity to go to Morocco, go for it.

— ferdy

Hidden PI

The people from Gaussianos.com (spanish blog abouth math) posted a couple of algorithms to calculate Pi and asked readers to provide some more.

I recently read on The Computational Beauty of Nature that Pi is hidden in the Mandelbrot set:

Take the mandelbrot iteration function:

z0 = 0
z = z^2 + c

And the initial complex number:

c = -3/4 + a * i

That set of complex numbers lays just between the two main parts of the body of the set, it is also known as the ‘neck’ (since it joins the cardiod with the biggest ‘head’).

For a = 0 the point belongs to the mandelbrot set. Let k be the number of iterations needed for a point (c = -3/4 + a * i) to reach modulus greater than 2 (escape radius), as a approaches to zero, k * a approaches to pi.

I wrote a simple C program that shows this (http://dev.gentoo.org/~ferdy/stuff/pi_mandel_gmp.c). When compiled, linked against libgmp and run, it outputs something like the following:

  a      || k         || aprox. pi
 --------++-----------++-----------
  1      || 3         || 3.0000000
  0.1    || 33        || 3.3000000
  0.01   || 315       || 3.1500000
  0.001  || 3143      || 3.1430000
  0.0001 || 31417     || 3.1417000
  1e-05  || 314160    || 3.1416000
  1e-06  || 3141593   || 3.1415930
  1e-07  || 31415927  || 3.1415927

It is an utterly expensive and pointless way to calculate pi, but it is one of the most obscure and weird ways to do it 🙂

Of course, all the credit goes to Dave Boll, who discovered the fact on 1991.

– ferdy

Random Git Stuff

Switching between projects using different SCMs is painful sometimes, and I always fail to remember the branch I’m on in my Git repositories. I use some bashrc/PS1 magic to show some SCM information in my PS1, I thought someone would find it useful: bashrc-scm.

Lately I’ve been working on RepoDoc whenever I’ve found a bit of free time. We are using Git as our SCM mainly because it is easy and very flexible and we can follow a pseudo-centralized workflow that probably only suits us 🙂 We faced some problems with it but given the flexibility of Git, fixing them was really easy.

We keep a central repository with one branch per committer plus master. Those are the top-level branches, and not everybody can update every brach, so the traditional Unix filesystem permissions doesn’t solve our problem. Then we can create as many temporal branches as we want under the tmp/ directory.

Also, we decided to keep a ‘fast-forward only’ policy on top-level branches, so everything has to be cooked in temporal branches first and then cleanly merged into top-level branches.

To enforce both policies (permissions and ‘fast-forward only’) we call a script from the update hook who does all the magic: http://dev.gentoo.org/~ferdy/stuff/enforce-perms. The users-allowed file is something like:

refs/heads/master$  alice bob
refs/heads/alice$   alice
refs/heads/bob$     bob
refs/heads/eve$     eve
refs/heads/tmp/     ^
refs/tags/          alice

Today I also decided to hack a CIA bot to send repodoc stats. It was fairly easy since the ciabot.pl included in Cogito did almost everything I wanted. However, being a perl-ignorant I rewrote the whole thing in bash to suit my needs, grab it from http://dev.gentoo.org/~ferdy/stuff/ciabot.bash.

For those with the ability to read or understand some Spanish I wrote a little introduction to Git: http://dev.gentoo.org/~ferdy/git-intro/

I have also been trying to import the gentoo-x86 module into Git without much luck, both parsecvs and git-cvsimport failed, I’ll probably try Tailor later. I haven’t payed much attention to it anyway, since I’m a bit busy with university stuff. I guess I should seek help in the Git mailing list once I take it seriously.

Oh, and by the way, there is a new Git version in the tree. Go grab it!

– ferdy

Mutt macro trick

So Greg KH wonders how to fix his macro in mutt.

Here you have something that works. Doesn’t do anything fancy (in fact it is useless), but I guess you could adapt it to suit your needs:

macro index T "<enter-command>unset wait_key\n \
                <pipe-message>cat - > /home/ferdy/foo.blah\n \
                <shell-escape>vim -c 'set ft=mail' /home/ferdy/foo.blah\n \
                <enter-command>set wait_key\n"

I tried using ‘decode-save’ and/or ‘save-message’ but for some reason it didn’t work. I guess you could replace ‘x.sh’ or almost all of it with a mutt macro like the one above.

Cheers,
Ferdy

Solving the Missionaries and Cannibals puzzle

There is a traditional puzzle where 3 missionaries and 3 cannibals have to cross a river using a small canoe. Rules are:

* You cannot have more cannibals than missionaries in either bank because cannibals will eat missionaries.
* The canoe can be run by either one or two persons. Both cannibals and missionaries know how to run it.

This puzzle is really easy to solve either by hand or programming. However, hacking a script to solve it is always more challenging than solving it by hand. Juanjo proposes a solution using Ruby in Misioneros y can

Status update (alpha,haskell,ctags,…)

So It’s been a long time since I wrote anything, not because I’ve done much for Gentoo but because Uni starts sucking once again.

However I found some time to do a couple of (maybe) interesting things:

I added some base-system binary packages for alpha. So if you screwed your alpha instalation doing something brave (or stupid) just take a look at http://dev.gentoo.org/~ferdy/bins/alpha/. You should be able to recover your system if you have a working busybox (which you SHOULD have).

I also managed to build ‘The Glorious Glasgow Haskell Compiler’ under alpha. Even if it is an unregisterised build, the result binaries are pretty usable (although they are HUGE). I built darcs with it and works perfectly. If you want to give it a try, get it from the url above, and put it in /usr/portage/packages/. You should be able to ’emerge -k’ it by just removing the <virtual/ghc-6.5 dependency in dev-lang/ghc-6.4.1-r1.

I’ll work with the gentoo-haskell guys to get it into the portage tree soon. Since I’m learning haskell, expect more haskell-related alpha porting 🙂

I also hacked a portage atom parser in haskell for a script I’ve been meaning to do for a long time. Doesn’t do anything fancy yet since I’m still implementing the Ord class operators. However it is considerably fast, it parses ~71000 lines in less than 1.5 seconds. Get AtomParser.hs and see a proof of concept showing its use in parser-test.hs. ( I’m still learning haskell so yes, it is really easy to improve my code ).

Since ctags is almost unmaintained upstream I’ve been collecting some useful patches around the net and might consider give it a big bump in the near future. The patches series are (in order):

  • Haskell support [by me]
  • Very basic ObjC support (ObjC hackers are welcome to send me ideas and code to improve the regexes) [by me]
  • Add patch to make Ruby class names in the form Foo::Bar work [by Ciaran McCreesh]
  • Add patch to improve C handling [by vim hackers, pointed out by Ciaran McCreesh]
  • Add support for Java 5 generics [found somewhere in the ctags forums]
  • Ebuild syntax support [by Ciaran McCreesh]

If you have an interesting and useful patch for ctags, please send it my way so I can integrate it in the next bump if I ever manage to do it. I’m maintaining all those patches in a stgit repository that I might share if anybody asks me to do it.

Also the Alpha Arch Testers project is reaching its final stage. We’ve got a quiz and we are giving the final touches to a policy document describing how we should behave (i.e. herd and arch-testers) one to each other.

Also I’m looking forward to Stephen Bennett‘s SELinux work under alpha. He kind of promised to test the hardened-sources; it’ll rock if he gets them work; because since the grsec-sources were removed we’ve got no ‘secure’ sources in the tree.

And last (and probably least) I wrote a dirty bash script some time ago and thought I might share. It simply lists the files that are no longer ‘claimed’ by any package installed under /usr/portage/distfiles. I know there are some nice python scripts around but I found this one to be way faster than those. WARNING: It is a hack, it won’t work without gnu-sed and will probably miss some files. However, it seems to work great here. If you want to give it a try, it is here (distfiles-clean). ( More scripts in http://gentoo-es.org/~ferdy/git/?p=gentoo-scripts.git;a=summary )

Ok time to get back to the mips assembly University work…

Cheers,
Ferdy

Multiple git enhancements

I’ve been working on dev-util/git and git-related software for a week and today I committed the following git related packages and enhancements:

dev-util/git – An init script to use git-daemon. It is way faster than HTTP for ‘clone’ and ‘fetch’ (and thus ‘pull’). A really nice way to share repositories if you don’t have lots of bandwidth.

dev-util/stgit – Stacked GIT is a SCM on top of GIT that works a la quilt. Lets you manage a series of patches in a stack fashion.

www-apps/gitweb – Gitweb is a handy cgi script to show git repositories ‘via Web’. It uses webapp.eclass. I’ve added this one to package.mask because I think it needs a bit more testing before going to ~arch. Unmask it, test it, and send feedback please 🙂

I started using git a month ago and I’ve migrated almost all my code to git. The documentation is good enough and git’s layout is in fact very easy. Moreover, there are scripts to import both cvs and arch repositories (git-cvsimport and git-archimport). Both of them work pretty good as far as I know.

Test and enjoy them 😉

New mutt and maildrop versions

Yesterday I added a new mutt version to the tree (1.5.11, ~arch). Except from a bug regarding SASL that I fixed a couple of hours after adding it; should work fine.

I also added maildrop-2.0.0 to the tree AND package.mask. This version comes with nice features such as fam integration and uses libpcre for pattern matching. Please test it and send bugs if you find any. I’m using it without problems so it shouldn’t break too badly 🙂

A simple:

# echo '>=mail-filter/maildrop-2.0.0' >> /etc/portage/package.unmask
# emerge -va maildrop

should do it.

Cheers,
Ferdy

Groups forgetting basic rules

Somehow big groups tend to forget basic rules, (i.e. someone from the group breaks the rule), even if the rule is one of the Top5 rules they have to follow. One common example of this is the (BTW, really easy) Keywording Policy in Gentoo. Luckily our Sparc team is very good at fighting people forgetting it 🙂

But today I’m not going to remind the Keywording Policy since surprisingly enough nobody broke it recently. I want to remind every person participating in mailing lists, usenet groups, … to read again the Netiquette. This specially applies to my LUG fellows, it’s mailling-list moderator/administrator and of course myself.

As somebody said the quality of our LUG and therefore its mailling-list only depends on our behavior. Also please consider reading Email Etiquette and the comments on top-posting. The constant breaking of this basic rules will keep valuable people out of the list and you will even force some of them to leave the LUG and cease their activity.

Cheers,
Ferdy