The Essay Is the Unit

While I was reading “The distraction-free iPhone (or ‘Why I’m happier since I disabled Safari’)” I noticed a bunch of icons alongside different paragraphs.

Obviously, before finishing reading an article about short time span and productivity (how many productivity articles have been written in the past couple months?!), I had to know what those icons were.

As I suspected, they were discussions that medium.com allows to have on each single paragraph.

Challenges of Maintaining a Rapidly Changing Code Base

For the past year, I have been working as cofounder at SkillHound working intensely on the development side. The concept of SkillHound came to be after spending a few months in 2011 reading and implementing proof of concepts data mining code to extract knowledge from git repositories.

My cofounder and myself are both (who isn’t these days among the HN crowd?) Steve Blank’s method practitioners wannabes. We couldn’t wait to get our feet wet going through the Startup Owner’s Manual’s table of contents with our very own concept.

Derek is not a developer, although he is good at screwing up the indention of my HAML files haha — jk derek! As the only developer in the team, I’m the sole responsible for the codebase’s sanity (and my own).

iPad Blogging on the Go

And in preparations for my trip I decided to look into what possibilities I had for some light, offline-friendly blogging on my Jekyll blog.

Turns out this is easily accomplished mixing a few tools together: iA for iPad, Dropbox and a simple daemon running through incron (cron that reacts to inode changes instead of time) was all I needed. And yes, I’m typing this on my iPad and publishing it just by… actually, doing nothing but typing!

Pretty cool!

Psyched!

I’m psyched, I’m now T minus ~20 hours away from the start of my journey around Southern Africa, loading my physical backpack and unloading my mental one.

For the next few weeks I don’t expect to have internet access. I’ll be back on January 19th.

And yes, I’ll repeat the cliché (hey, they are clichés for a reason, right?)

“Travel is fatal to prejudice, bigotry, and narrow-mindedness.” - Mark Twain

Company Smells

Most developers won’t need a reminder of what a “* Smell” refers to, but I’ll assume that the companies that fit the description of this post won’t (incidentally, those companies probably wouldn’t read this blog post either). A “code smell” is an indication, a symptom, within a codebase, of a problem.

A company smell is an indication of a larger problem in an organization.

When a company uses a service for sourcing developers in today’s crazy world that opens with the following epic line:

What we do…

We’re a new style of recruiting service that charges by the hour for our time.

As a developer/hacker/überninja/engineering-talent all I see is a giant red flag. These are not recruiters that will try to get to understand the requirements of the position they are trying to fill, nor will they try to understand how I, as a human being, can contribute (or detract) in that position. Quite the opposite, the incentive is in delivering a result quickly. Any result. Quickly. Time is money. And all ruby on rails ninjas are made equal.

The homepage of “theSourcery” goes on to say:

We’re re-inventing the way recruiting is done by changing the incentive structure for recruiters and leveraging data and software while keeping our work human powered and personal.

Intro

Testing!

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sollicitudin, massa eu vestibulum laoreet, nibh ante vulputate lorem, ac lobortis ante tellus eu mi. Duis sem nisi, luctus at feugiat eget, fringilla ut tellus. Nam a molestie justo. Sed pulvinar est vitae tellus semper tincidunt. Fusce euismod luctus lacus nec placerat. Mauris rutrum scelerisque nulla ut tempor. Nunc porttitor posuere mi, aliquet vehicula lorem feugiat in. Ut ut fermentum risus. Aliquam tincidunt ultricies ante sit amet bibendum. Cras nec sapien odio. Duis posuere congue sem, at congue massa faucibus at.

Integer ut sapien eget nisl auctor faucibus ut fermentum arcu. Nunc rutrum urna non risus congue et tristique felis eleifend. Maecenas blandit est eu mauris aliquam aliquet. Quisque porttitor enim eget risus blandit in mollis orci eleifend. Nam malesuada nulla sed lacus elementum placerat accumsan arcu rhoncus. Phasellus feugiat cursus turpis nec facilisis. Duis eget metus arcu, eget commodo velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer cursus vulputate enim, vel gravida velit faucibus et. Ut a urna vitae tellus cursus rhoncus. Maecenas at odio eget quam cursus elementum. Aliquam vitae eros quis tellus laoreet accumsan sed id lorem. Suspendisse et rutrum leo. Integer scelerisque vestibulum adipiscing. In posuere, libero ac accumsan suscipit, nulla ligula gravida erat, ut tempor odio erat nec sem. Quisque justo ipsum, adipiscing volutpat varius vitae, blandit eget nisi.

Nullam adipiscing neque ac lacus commodo vitae imperdiet dui sollicitudin. Ut ac nunc augue. Nam at sem ut quam commodo aliquet vitae vitae dui. Vivamus scelerisque felis eget dolor cursus feugiat. Phasellus at dui sed lectus scelerisque pretium. Etiam nec massa ut justo vestibulum fringilla ac vitae urna. Morbi tortor erat, tempus sed consectetur at, elementum nec eros. Vivamus mattis arcu a sapien semper non lacinia eros pretium.

Proin ut hendrerit arcu. Maecenas ullamcorper tristique magna vel mattis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam tincidunt euismod viverra. In sit amet neque turpis. Suspendisse ac sapien mi, id blandit purus. Ut tortor turpis, rutrum ac tempor at, accumsan sit amet erat. Etiam ultricies eleifend dolor, eget tempus justo tristique vitae. In hac habitasse platea dictumst. Aliquam eu enim neque.

Morbi massa lorem, viverra non dictum at, malesuada vel nibh. Nam fermentum lobortis varius. Sed a nulla lacus, quis posuere risus. Nunc id urna libero, quis rutrum mi. In gravida felis urna. Praesent nec dolor ac urna tempor fermentum. Curabitur rutrum arcu et lorem volutpat viverra.

Compare Permissions Script

Recently I needed to compare some permissions between two directories, I wrote this script that could be useful for someone else:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# This script will go through a list of files and directories and match their
# permissions against another directory, it can also copy the permissions from
# the first directory.
#
# Written by Pablo Fernandez
#

function showusage()
{
      echo "USAGE: $0 OPTS DIR1 DIR2"
      echo
     echo "OPTIONS:"
      echo "-a Apply changes (update permissions of DIR2"
      echo "-w Warning on missing files"
      echo "-q Quiet mode"
      echo "-h Show this help"
      echo "The directory DIR1 will be matched against DIR2. The directory DIR2 will"
      echo "be corrected with all permission differences."
}

apply_changes=""

Acts_as_authentic Nightmare

So I decided to do a few tests on the Server Protectors’ website and noticed a few annoyances with the register form, I decided to delve in and fix it, just a couple of extra validations, not too much.

Half an hour later I was pretty much ready to do some open heart surgery on authlogic, man is the configuration of act_as_authentic confusing! And of course, RTFMing doesn’t work, there is not a single example of how changing the default act_as_authentic configuration works!

Searching around I found a few persons with the same problem and no solutions, so I thought I should share how I did it, or rather, what I did.

This is the resulting code:

1
2
3
4
5
6
7
8
acts_as_authentic do |c|
 c.validates_uniqueness_of_email_field_options = {:if => "false"}
 c.validates_length_of_login_field_options = {:if => "false", :minimum => 4}
 c.validates_format_of_login_field_options = {:if => "false", :with => Authlogic::Regex.login}
 c.validates_length_of_email_field_options = {:if => "false", :minimum => 4}
 c.validates_confirmation_of_password_field_options = {:if => "false"}
 c.validates_length_of_password_confirmation_field_options = {:if => "false", :minimum => 4 }
end

So as you can see a couple of options are a bit lame, like having a minimum when the if is being set to false, well, if you remove the minumum validates_length_of will complain (it makes sense from validates_length_of point of view, after all, if you are never going to be using the validation why call the function at all?)

I hope this helps and saves some time.

XBMC Issues With Smb

I’ve been having issues with XBMC playing files served through samba, I don’t recall when this started, but for sometime I couldn’t even browse the collection of files in my own server. Nothing changed, well, I did upgrade Ubuntu to 10.04 on my server, but I think this was happening before that.

Anyway, I browsed the internet and didn’t find anything related to this error or how to fix it.

After looking around in the configuration I’ve found something which caught my eye and I got it working.

The error I was getting was:

1
2
3
23:09:42 T:3077850992 M:1831804928   ERROR: SMBDirectory->GetDirectory: Unable to open directory : 'smb://'
unix_err:'2' error : 'No such file or directory'
23:09:42 T:3077850992 M:1831804928   ERROR: GetDirectory - Error getting smb://

And what I had to do is remove the XML path in $HOME/.xbmc/userdata/guisettings.xml that started with the tag <smb>. Removed that, restarted XBMC and things started to work again.

A Brave New Media Center Revisited

I recently wrote a post about my new media center, running off my laptop, well, while that setup was sweet and all, there was some sort of hole in it, that is, my laptop went belly up…

That was quite unfortunate, but it gave me the possibility to play with some new stuff, namely ITX setups.

I have finished yesterday building my ITX box, an Intel D510mo with an Atom D510 processor (dual with hyperthreading so 4 threads), 2 GB of RAM at 800 Mhz, WiFi PCI card on a Vitsuba Blackbox case, with a generic DVD-RW.

The setup is very sweet, I had lots of troubles building the system, at one point I thought my motherboard was faulty and I had to take it back to the store, but it seems the motherboard was ok, it was simply a matter of the mother producing a short while sitting in the case because of a mislocated screw in the case.

After the case was done I proceeded to install Ubuntu Karmic 9.10, to my surprise I had lots of troubles installing it, I had to perform the installation booting the netinstall through PXE (since I was out of CDs and all stores were closed). Once I was able to install Ubuntu I found that Ubuntu didn’t support the video card in the motherboard, and during the boot sequence the screen would go blank and there was pretty much nothing I could do about it.

Googling around I found other users with the same problem and determined to go with the same solution others had used… saying goodbye to Ubuntu and the beautiful Debian and APT world and totally selling out to the Fedora and Red Hat town (notice my strong bias :p).

I went through the horrible Fedora installation experience which is like getting hit on the ballsack while driving on a bike with no seat, configured GDM to autostart (which amazingly is not supported through gdm-config) and then I proceeded to build XBMC (since there is no XBMC build for non debian distributions (well done, and no, I’m not being ironic)).

It turns out building something like XBMC with support for many different codecs is not as straightforward as imaginable, who would have thought?! (now I am being ironic).

Here are some tips for others:

1
2
su -c 'rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'
su -c "rpm -ivh http://rpm.livna.org/livna-release.rpm"
1
yum -y install ccache subversion git gcc-c++ boost-devel mesa-libGL-devel glew-devel libmad-devel libjpeg-devel libsamplerate-devel libogg-devel libvorbis-devel freetype-devel fontconfig-devel bzip2-devel fribidi-devel sqlite-devel mysql-devel libpng-devel pcre-devel lzo-devel libcdio-devel libsmbclient-devel SDL-devel SDL_image-devel SDL_mixer-devel enca-devel jasper-devel libmms-devel libXt-devel libXtst-devel libXmu-devel libXinerama-devel libcurl-devel dbus-devel hal-devel pulseaudio-libs-devel pulseaudio-libs-zeroconf faac-devel avahi-devel ffmpeg-devel a52dec-devel libdca-devel faad2-devel mpeg2dec-devel libass-devel libmpcdec-devel flac-devel wavpack-devel python-devel cmake gperf unzip make libtool flex bison libtiff-devel avbin-devel libmicrohttpd-devel libdvdcss-devel faad2-devel
1
ln -s /usr/lib/mysql/libmysqlclient.so.16.*.* /usr/lib/libmysqlclient.so
1
svn co https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/
1
2
3
4
./bootstrap
./configure --disable-debug --enable-external-libfaad --enable-external-libdts --enable-mid --enable-profiling --enable-external-libmad --enable-external-liba52 --enable-external-libmpeg2 --enable-external-libass --enable-external-libvorbis --enable-external-libogg --enable-external-libmpcdec --enable-external-libflac --enable-external-libwavpack --enable-external-python
make -j 4
make install

Note that the make -j 4 command might succeed but not finish, I have found a few times that when using make in parallel even with multiple cores it will skip files, you want to use make -j 4 a few times to accelerate the process but do make sure its actually finished running make.