martes, 22 de septiembre de 2009

zsh spell checking

I was talking to David about bash vs zsh features, and looking at the wikipedia page on comparison between shells We saw They only mentioned a couple (maybe 4) things where zsh is superior to bash.

One of the things that seem to make a very little difference (if any at all) is spell checking. Is it useful?

Well, the answer is: Definately!

If the next command outputs a zero, then you don't need this feature

history| grep 'ks\|,ale\|male\|gi\|' | grep -v "history" | wc -l

Otherwise, keep reading.

For short commands you don't use tab, you can misspell them and zsh guesses what you meant.

rgrau@ares [ ~ ] %,ake
zsh: correct ',ake' to 'make' [nyae]? y
make: *** No targets specified and no makefile found. Stop.
rgrau@ares [ ~ ]:2 %ks
zsh: correct 'ks' to 'ls' [nyae]? n
zsh: command not found: ks
rgrau@ares [ ~ ]:127 %
Great, If you ask me.

Disimulando

Hoy me he levantao indeciso, y he salido a la calle silbando y mirando al cielo, como disimulando...

Creo que no se han dado cuenta.

lunes, 21 de septiembre de 2009

JOOOOODEEEEERRR! (Oh God!!)

That's one of the funniest codes I've seen in a long time.

It's a JAPH 2.0, a social JAPH, a traveler JAPH. I don't know how to describe it....

Perl is movin' along with the times, right?

Its a kind of traveller japh. that fetches another twitt, forks into 2 other twitts, and ends showing a growing string. I'm still on my way to fully understand it, but it's worth the time.

http://twitter.com/johanviklund/status/4100664178


viklund++.

This one had to be a post full of puns, but in the end, there's none. Really

domingo, 20 de septiembre de 2009

Fully vim style linux - part 3 - Get geeker

In this third part (part1, part2) , I'll explain how to get a couple of programs act like vim. With 'act like vim' I mean understand hjkl, and probably nothing more, but if you are really addicted to vim, you know it makes a great difference, right?

pdf viewer


If you're on ubuntu (then you should try vectorlinux, really) , you probably use evince to open pdf files. Well, surprise! evince (at least in ubuntu 8.04 with no extra tweaks) knows what hjkl mean, so you're done :)

If you use xpdf, you can teach it hjkl adding the next lines to your ~/.xpdfrc

bind h any scrollLeft(16)
bind l any scrollRight(16)
bind k any scrollUp(16)
bind j any scrollDown(16)
you can find out more about theese comands in xpdf's man page

xchm viewer

Chances here are xchm, kchmviewer or firefox with a chm viewer plugin.

I haven't seen any option if you use xchm, but kchmviewer can be configured to behave vim-ish (only if compiled with qt libs enabled). pressing ctrl in kchmviewer underlines all links in the view, and makes them accessible with a keystroke.

One of the safest options is using any firefox plugin. Then, hopefully, vimperator will do all the dirty job.

DIY


Apart from all those programs, you'll end writing your own tools to help you in your daily tasks.

Then I recommend you a couple of apps/libs.

First is ratmen/9menu/ratmenu . A simple menu aplication that generates menus navigable with hjkl. Priceless

If you feel like programming your own tools, perl module Curses::UI has all bindings you need... by DEFAULT!

On part 4 I'll talk about shells and gtk, and maybe...emacs!

PS: If you have suggestions, or you just liked the post, or... please comment!

viernes, 18 de septiembre de 2009

Una red....

Davide Careglio cuenta en la primera clase efectiva de XC:
"Internet es una red de paquetes".

Joder, si solo fuera internet....
De paquetes, y de mediocres, y de ansiedades,
De síes pero noes, de cobardes,
de 'lo hablamos más adelante',
de 'estas horas no se cobran',
de porfin es viernes, y tampoco tengo nada que hacer.
Yo el primero.
Si 'la internet' fuera 'la' red de paquetes me daba de baja del ADSL.


Pero en la first-life tb estamos 4 paquetes dándonos porsaco unos a otros, buscando maneras de llegar a otros sitios y esnifando que hace la vecina de enfrente. Aunque de esta no tengo ganas de darme de baja.

zsh saved my home

zsh has just saved my whole /home/rgrau directory .

I was hacking like crazy, listening to some techno music, typing as if I were mad, and that's what happened:

rgrau@ares [ ~/Desktop/pharo ] %cd ..
rgrau@ares [ ~/Desktop ] %cd ..
rgrau@ares [ ~ ] %rm *
zsh: sure you want to delete all the files in /home/rgrau [yn]? n
rgrau@ares [ ~ ]:1 %
Obviously, what I wanted to do is delete all files under Desktop/pharo dir , but I typed the 2 cd .. commands without thinking (I suppose I wanted to do a cd ..;rm -fr pharo )

Anyway, zsh asked me and I read what I was going to do... cold sweat... typed 'n', and went to smoke a cigarette.

Thank you zsh. I really love you.

Btw, if you don't want zsh to save your life, you can add setopt rmstarsilent to your .zshrc .

upgrading mercurial and closing branches

If you follow my blog (unlikely), you already know I've been reading about source version control alternatives.

At $work, we use mercurial, but we had a quite old mercurial version (0.9.5). At that time, mercurial wasn't able to close named branches, so when you opened a new branch, you had to carry that branch with you forever. It was not really suited for a-branch-per-feature workflow.

Since mercurial 1.2 though, we can close branches with a --close-branch flag when commiting.

First things first. Upgrading mercurial is not that easy (at least in Ubuntu 8.04)

There's a launchpad user that seems to upload mercurial builds, but I never figured out how to use launchpad. My damn ubuntu can't manage the gpg key or whatever.

Installing from source requires python-dev and python-setuptools. apt-get install them .

Then, you can easy_install Mercurial, and hopefully it'll work.......OOOOOPS, no :)

you see some warnings there, right?
***** failed to import extension hgext.hbisect: No module named hbisect**
ok, as root, go to /etc/mercurial/hgrc.d/hgext.rc and comment the line with

bisect=


After that, you'll have a working updated mercurial, but probably, your hg view command will disappear.

you can find hgk in the source mercurial package, in the contrib directory.

wget http://www.selenic.com/mercurial/release/mercurial-1.3.1.tar.gz
Just untargz, and move mercurial-1.3.1/contrib/hgk to anywhere in your path.

Now with mercurial 1.3.1, my workflow can follow a-branch-per-feature without problems.

hg branch checkSinglePond
echo "say 'hey! I'm a new feature' ; " >> foo.pl
hg commit -m "fin de feature"
hg up default
hg merge myNewFeature
hg up myNewFeature
hg commit --close-branch -m "closed"
That's what I did the first time, but well, I thought if I could close a branch when commiting real stuff. It only makes sense if later, we plan on merging.

hg branch BarFeature
echo "say 'bar' "; >> foo.pl
hg commit --close-branch -m "added and closed"
hg branches # only shows 'default'
hg up default
hg merge BarFeature
hg commit -m "I'm Tip, with BarFeature Merged after closing"
Here's a screenshot of the mess :)




I'll keep posting my findings about version control and how I keep modifying my workflow to fit its 'best practices' ¬¬ .