getting my bearings with ruby

I come from a mavenized world.

a world where a project’s structure and dependencies are well specified in a model and a world where that model, maven and the Java SDK are everything I need to build a project anywhere. maybe there’s some things wrong with maven; I think this is one of the things where it excels.

so when I play with other languages, my tendency is to look for the “maven metaphor”, the “maven way” to define a project, build it and have its dependencies resolved, hopefully from an all-knowing internet entity.

I felt in heaven when I found Leiningen for Clojure, but I almost cried when I found weird things for C# and ugly things for C++. I won’t even talk about JavaScript here but for Ruby… ahh Ruby… a language homonymous with Silvio Berlusconi’s underage exotic dancer… a language that follows that principle of least astonishment… seriously Ruby, you’re messed up. here’s how I understand the Ruby world of project management / dependency management. probably it’s all wrong, which just speaks to how much I suck at this.

so, a common practice seems to be to use Rake to build the project and Gem to distribute it. Rake is like Make. But for Ruby. and Gems are like Maven artifacts. but then, it seems like the best way to use these two things together is by means of another tool — Bundle.

so, let’s imagine a system where you have Ruby, Gem, Rake and Bundle installed. the (rough) equivalent to mvn archetype:generate would be bundle gem rubacuori.

this will create a directory structure with some not very obvious things:

  • Gemfile — this would normally be where you would put your project’s dependencies. except your won’t. because it will point to the gemspec, a way of saying “dependencies are all in rubacuori.gemspec“;
  • rubacuori.gemspec — this is where you have information about your project as well as dependencies and is the closest we get to a pom.xml file except it isn’t. because it does not define any project build phases;
  • Rakefile — this is where your build phases would be defined. by default this includes something called gem_tasks, which is a set of default tasks like “build”, “install” and “release”, kind of equivalent to mvn compile, mvn install and mvn release:prepare + mvn release:perform;
  • ./lib and finally, your code should go in this directory.

so, somewhat different that Maven, in that Maven tries to do everything and here each tool does one thing and one thing only. Not worse nor better; just different.

now what is definitely good is that this seems to be an accepted standard for building Ruby applications — in RubyMine, if you create a new project, this is exactly the structure it will have:

/Users/Luis/.rvm/gems/ruby-2.0.0-p0@global/bin/bundle gem untitled
create untitled/Gemfile
create untitled/Rakefile
create untitled/LICENSE.txt
create untitled/README.md
create untitled/.gitignore
create untitled/untitled.gemspec
create untitled/lib/untitled.rb
create untitled/lib/untitled/version.rb
Initializating git repo in /Users/Luis/dev/untitled

you can always count on JetBrains.
:-)

nanites will rush from your script

You and the machine together will run this latest Ruby script, the product of your obsession. And the script will fire up chainsaws to trim the trees, hearths to warm and regulate the house. Builder nanites will rush from your script, reconstructing your quarters, retiling, renovating, chroming, polishing, disinfecting. Mighty androids will force your crumbling house into firm, rigid architecture. Great pillars will rise, statues chiseled. You will have dominion over this palatial estate and over the encompassing mountains and islands of your stronghold.

Why’s (poignant) guide to ruby is probably the best text I’ve ever read by a computer guy. Fun, clever, technical and it has talking animals.

Yes.

Talking animals.

the menu is not the food

(I’d like to thank all the people writing useless crap on their blogs about agile/lean/kanban/communication/whatever for giving me inspiration to write this post. I’d name all the 6 or 7 of you that I read tonight, but that would not be generating any good karma now would it?)

there was this buddhist monk who had studied the buddhist scriptures for many many years. and although he had become very knowledgeable in the words of the buddha, the abbot of his monastery still refused to make him a master. one day he approached the abbot and asked him why he would not make him a master.
- “abbot, I have been in this monastery for 18 years. I know the buddhist scriptures so well that I could cite any given part of the whole of the buddhist texts. but still you will not make me a buddhist master. why?”
the abbot then replied:
- “the words are not the meaning. the map is not the territory. the menu is not the food.”
- “i don’t understand abbot, what do you mean?”
- “you are like the man who goes to eat at a restaurant, asks for the menu, eats the menu and then goes home — even though he went to the restaurant, he is still hungry. you know the words of the buddha but you still don’t understand the meaning of the words. so you eat the words, you memorize the words, you recite the words to others — but you don’t understand the meaning.”

Agilers.

Also known as agile/lean/kanban/extreme authors/coaches/managers.

There’s a lot that should be said about their habits and their (many times) overstretched importance, but I realized that this story says almost everything I wanted to say.

There’s a lot of agilers out there eating the menus and not producing anything. There’s a lot of agilers preaching agility but not empowering team members. They became a bridge betwen product owners/project managers, designers and software developers — a bridge that in many cases is just not needed.

I would argue that if an agiler really values individuals and their interactions, then teaching the individuals in his team to work without him is the point of his job. If he preaches the value of working software, then his focus should be on the quality of the code that his devs produce — and how they can be better at. If an agiler values costumer colaboration, then his aim is to teach his team members how to collaborate, so that they can grow up and be able to collaborate without a collaborator. If an agiler wants his team to respond to change, then he has to teach them that change is part of the game — for both devs and PO and designers and you-name-it.

This is not the menu — that is the food.

I would propose that the ultimate function of an agiler is to teach. And a teacher’s purpose is to eventually not be needed. Team members need to be able to work together, in a professional way, by themselves. Communicating as human beings. Writing software with less (of the same) bugs. Collaborating with common sense with other stakeholders. Understanding change as something always present in life and work.

If all an agiler does is creating a team that works well under his guidance but falls apart without him, then he has created a bunch of useless people, who will be able to repeat the agile manifesto, but who ultimatelly don’t really understand it.

what ever happened to real power-of-2 kilobytes?

From the resize2fs man page:

when kilobytes is used above, I mean real, power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct folks insist should be the stupid-sounding ”kibibytes”. The same holds true for megabytes, also sometimes known as “mebibytes”, or gigabytes, as the amazingly silly “gibibytes”. Makes you want to gibber, doesn’t it?

seriously, I’m loving being back on linux.

debian + enlightenment on macbook pro

Been spending the last nights on trying to make a clean installation of Debian with Enlightenment on my macbook pro (mid 2010). The idea was to start with a really basic Debian server, no desktop environment at all, and then go all the way up to having Enlightenment as the window manager; all this, installing just the absolutely necessary software.

small warning: these instructions are for the mid-2010 model. If your model is another one, then just hack your way through http://wiki.debian.org/MacBook and http://wiki.debian.org/MacBookPro.

Part 1: preliminaries

  1. Get your debian cd. I picked up one of those netinst small CDs (180 mb) since I wanted a really small installation, where I would do all the tweaking afterwards;
  2. Get rEFIt and install it.
    1. I really suggest that after you install rEFIt you try first to restart your Mac and verify that you can still login to OSX.
  3. Open Disk Utility and make that HFS+ partition smaller. No need to create any new partition for linux – parted will do that for you later.
  4. Shove that debian cd in your mac and reboot

Part 2: installing Debian

  1. As you boot your mac into the rEFIt menu, you should see an option there to boot from the CD. Otherwise, just press C when booting and the Mac bootloader will do that for you.
  2. Here’s the things you should pay attention to during the installation:
    1. get yourself a network cable so that you can pull new packages from the internets during the installation. You will not have wifi until much later in the process.
    2. During partitioning, you may see another partition (something like Mac OS Recovery partition) in your disk, besides the OSX partition and the rEFIt partition. You’ll probably have to delete this one since Linux needs to be on one of the first 4 partitions and the installer will still create another partition after the OSX one.
    3. When the time comes to install Grub, do not put it on the Master Boot Record — that’s for rEFIt!
    4. As for the UTC clock settings, I really don’t know so I chose No.
  3. If everything goes ok, you’ll end up removing the CD from the drive and rebooting. Now, DO NOT boot into linux yet!
    1. While in the rEFIt screen, first go into the settings screen and synchronize the partition table
    2. Restart the mac again and now yes, boot into Linux.

Part 3: Getting Enlightenment

So, after you boot into linux, you’ll only have the good old bash. In fact, the system is so basic that you won’t even have sudo, lynx or vim (these are kind of standard for me, but you will certainly have your own favorites here).

Now, I’m going to focus on what you have to do to get enlightenment. If you notice you that there’s some other tool you’re missing, just apt-get it.

  1. You’ll start by editing your sources.list and changing your distribution to testing. You’ll need this because (as of writing time) E17 is part of the testing distribution and is not part of stable.
  2. I also added to each line there the contrib and non-free repositories, just in case.
  3. Save and apt-get update and apt-get dist-upgrade
  4. This will take a while. After that is done we get Xorg and E17.
    1. apt-get install xorg e17

You’ll be able to start E17 by running startx.

You’ll notice that E will be very very empty.

As in, totally completely empty.

But that is what I was wanting to do. Now I have a clean system where I will install all the things I need and want, and only those. Again, whatever you want to install is your business. There is only one more thing to finish this post and put you in the right track and that is to be able to let go of that cable.

Part 4: cutting the cable

Going wireless was by far the thing that took more time so far. Now that I managed to do it, it actually looks pretty simple…

  1. Install wireless-tools to figure out if your network card was found:
    1. apt-get install wireless-tools
    2. /sbin/iwconfig
      1. check what’s under wlan0. If it’s empty then just read through
  2. apt-get install module-assistant
  3. m-a a-i broadcom-sta
  4. update-initramfs -u -k $(uname -r)
  5. modprobe -r b44 b43 b43legacy ssb
  6. modprobe wl
  7. iwconfig
    1. You should now see your network card under wlan0. Only thing missing is installing an app to connect to your wireless network
  8. apt-get install wicd wicd-cli wicd-daemon wicd-gtk
  9. In your E menu, under Applications, Network, you’ll find Wicd. Open it and in the preferences make sure that under Wireless interface you have wlan0

That should do it.

Now, there’s still a lot to do. I’m currently fighting with making the touchpad behave normally so once that is done, I’ll make another post.

:-)

your point of view is only temporary

Jeff Bezos, offering some advice to the 37signals team:

(…) the smartest people are constantly revising their understanding, reconsidering a problem they thought they’d already solved. They’re open to new points of view, new information, new ideas, contradictions, and challenges to their own way of thinking.

being open-minded and willing to re-discuss and re-visit things you already implemented. for the sake of getting better, of being better and improving your next solutions.

this doesn’t mean you shouldn’t have a well formed point of view, but it means you should consider your point of view as temporary.

like a writer, your aim is not to write a lot of books but to write good books that are bought a lot of times.

and quality requires that you revisit your premises.

again.

a nyc retreat

Grant yourself a moment of peace,
and you will understand
how foolishly you have scurried about.

Learn to be silent,
and you will notice that
you have talked too much.

Be kind,
and you will realize that
your judgment of others was too severe.

Hasten slowly,
and you will soon arrive.

Ajahn Brahm quoting a Chinese Proverb, while talking about retreats.

As I lay here, less than 12 hours of flying to NYC, I realize that this is my retreat, my opportunity for more silence, less speed and more moments of peace. The rest of the world will stop for two weeks and I’ll be incognito in the middle of 10 million people.

Between books, art, museums, history, all while I’ll see the rest of the world hasting around, running behind their lives.

Because sometimes, you need to see yourself in others, so you can better see what you need to change.