Boost C++ Libraries on OSX (Xcode 5)

For a long time I have been away from C++ code, but a few days ago I was confronted with it again. I launched myself to write C++/ObjectiveC code using Xcode. The first obstacle that I found is that using boost (the c++ library) is not as easy as it should ( specially for an iOS 7 setting). Searching the internet I found several forums describing how to install the thing, compile options and everything. Finally I came across this gist, which is basically a shell script that downloads, compiles, and install boost :-) (as an osx framework). Another option may be using homebrew and executing brew install boost.

To execute the script you may either clone (git repo) or download the gist and execute

Once executed, the only thing that you need to do is add boost as a framework package using the project configuration UI. First open the “Build Phases” panel and unfold the “Link Binary With Libraries” option.

Click on the “+” sign and select “Add another…”.

Navigate to the directory where you executed and select osx/framework/boost.framework and you are good to go.

Finally you will see the boost library appear in the linked libraries option.

osx c++ c++ programming cpp xcode xcode 5 ios7 objective-c

OSX 10.9 Mavericks CackePHP Mysql database connection: Error 2002

Sometimes I do a few projects with Php (mostly with Cacke Php ) and use my Mac as a development platform. Recently I upgraded to OS X 10.9 Mavericks and couldn’t get CackePHP to talk to Mysql. The following error was reporting the problem:
Error: A Database connection using “Mysql” was missing or unable to connect. The database server returned this error: SQLSTATE[HY000] [2002] No such file or directory
Taking a look to the Php configuration line (the one you get using phpinfo();) you may notice the following option '--with-mysql-sock=/var/mysql/mysql.sock'. Php expects the mysql socket to be located at /var/mysql/mysql.sock but recently changed to /tmp/mysql.sock (probably not so recently).

Creating a symbolic link at the expected location solves the problem (at least temporarily):
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Or, you may modify php.ini and edit mysql.default_socket = /tmp/mysql.sock (avoiding to create a symlink).

If you look over the internet for the “Mysql osx php socket” you may find a many hits explaining this problem (including this one).
mysql osx php

Install Startssl certificate on CentOS 6

Recently I came across a (yet another) certificate problem with the java keystore. For some reason, the Startssl certificates are not in the keystore (at least in CentOS 6 with OracleJDK 7). I didn’t expect that at all (shouldn’t ssl authorities be included by default in the keystore?) and after a few hours of research I found workaround: Install the certificate by hand.

First, download the certificates (there are 5 certificates to install).

curl --silent --output ca.crt \
curl --silent --output \
curl --silent --output \
curl --silent --output \
curl --silent --output \

Now that we got the certificates, we will install them using the java keytool.
Notice that the java home (unix var $JAVA_HOME) may depend on your java installation. For example, OpenSDK vs OracleSDK, flavor of Linux, etc. On OSX 10.9 it will be /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home while in 10.8 it will be /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home.
By default the keystore password is changeit, if you changed it update the lines below accordingly.
#execute as root or preceded by sudo
#CentOS6 with OracleJDK

$JAVA_HOME/bin/keytool -import  -keystore \
	$JAVA_HOME/jre/lib/security/cacerts -storepass \
	changeit -noprompt -alias -file ca.crt
$JAVA_HOME/bin/keytool -import  -keystore \
	$JAVA_HOME/jre/lib/security/cacerts -storepass \
	changeit -noprompt -alias \
$JAVA_HOME/bin/keytool -import  -keystore \
	$JAVA_HOME/jre/lib/security/cacerts -storepass \
	changeit -noprompt -alias \
$JAVA_HOME/bin/keytool -import  -keystore \
	$JAVA_HOME/jre/lib/security/cacerts -storepass \
	changeit -noprompt -alias \
$JAVA_HOME/bin/keytool -import  -keystore \
	$JAVA_HOME/jre/lib/security/cacerts -storepass \
	changeit -noprompt -alias \
Finally, as a cleanup you may erase the certificates.
rm -f ca.crt \ \ \ \
These sources helped me a lot: JIRA and stackoverflow.
ssl linux java keystore javacert

This is why you shouldn't interrupt a programmer

Happened to me so many times! This is specially true on open spaces, where people seem to forget that others need to concentrate.


Most People Won't


From an interview with designer/artist/soul searcher Elle Luna:

So I was using Uber all the time in San Francisco, even though I hated the design. And then I went to the Crunchies awards ceremony and at a post-ceremony event, where I was in a ball gown, I saw the CEO of Uber, Travis…

Most people want to be fit, most people aren’t.
Most people want to build a successful business, most people won’t.
Most people want to be the best version of themselves, most people aren’t….

Most people won’t. Which means those that do change everything.


Yum: There are unfinished transactions remaining…

My problem (not really a problem) with Yum and CentOS 6 (and probable many other rpm base linux distributions) are the “unfinished transactions”. For whatever reason a transaction gets “cancelled”, it should rollback!

To solve this issue and continue your life normally, just clean the “unfinished transactions” with the following command line:
yum install yum-utils
yum clean all
/usr/sbin/yum-complete-transaction --cleanup-only
yum sysadmin linux centos

OSX 10.9 (mavericks) — -bash: mvn: command not found

Just updated to the fresh OSX 10.9 (early adopter anyone?). You may find that a few things are not there, this includes maven. You could install maven yourself (maven at apache) or you could install it with a package manager. I go with the package manager.
#install homebrew if you don't have it already
ruby -e "$(curl -fsSL"

#install maven
brew install maven
java maven mavericks osx developers

Alex's Tech Thoughts: Stop Trying To Force The Startup Life On Everyone (It Is Not For Everyone)



Last week I saw a tweet put out by a startup founder that was along the lines of disappointment that a bright developer chose to become a engineer at a bank rather than at a startup. While I understand the reasoning behind this person and others wanting more developer talent in the startup…


The pale blue dot

For a long time I have been a keen admirer of Carl Sagan. Yesterday I read this article about the Cassini spacecraft taking a picture earth for very far (1500 million km). I could only imagine Carl Sagan giving the news, reciting “the pale blue dot”, and reminding us how small we are compared to the greatness of the universe.

From this distant vantage point, the Earth might not seem of any particular interest. But for us, it’s different. Consider again that dot. That’s here. That’s home. That’s us. On it everyone you love, everyone you know, everyone you ever heard of, every human being who ever was, lived out their lives. The aggregate of our joy and suffering, thousands of confident religions, ideologies, and economic doctrines, every hunter and forager, every hero and coward, every creator and destroyer of civilization, every king and peasant, every young couple in love, every mother and father, hopeful child, inventor and explorer, every teacher of morals, every corrupt politician, every “superstar,” every “supreme leader,” every saint and sinner in the history of our species lived there – on a mote of dust suspended in a sunbeam.

The Earth is a very small stage in a vast cosmic arena. Think of the rivers of blood spilled by all those generals and emperors so that in glory and triumph they could become the momentary masters of a fraction of a dot. Think of the endless cruelties visited by the inhabitants of one corner of this pixel on the scarcely distinguishable inhabitants of some other corner. How frequent their misunderstandings, how eager they are to kill one another, how fervent their hatreds. Our posturings, our imagined self-importance, the delusion that we have some privileged position in the universe, are challenged by this point of pale light. Our planet is a lonely speck in the great enveloping cosmic dark. In our obscurity – in all this vastness – there is no hint that help will come from elsewhere to save us from ourselves.

The Earth is the only world known, so far, to harbor life. There is nowhere else, at least in the near future, to which our species could migrate. Visit, yes. Settle, not yet. Like it or not, for the moment, the Earth is where we make our stand. It has been said that astronomy is a humbling and character-building experience. There is perhaps no better demonstration of the folly of human conceits than this distant image of our tiny world. To me, it underscores our responsibility to deal more kindly with one another and to preserve and cherish the pale blue dot, the only home we’ve ever known.

Carl Sagan, Pale Blue Dot: A Vision of the Human Future in Space, 1997 reprint, pp. xv–xvi

This is the video with Sagan’s recitation. Enjoy!


Upgrading from spring 3.1.X to 3.2 missing tip

Not too long ago I migrated most of my software projects (personal and professional) to Spring 3.2.3. Why? because there are many new “handy” features in spring 3.2.3.

Well, migrating spring is typically straightforward (even trivial), but there are a few (really small) details that are worth knowing (the xml snippet below declares the spring version as a maven property).

You would not need cglib anymore

That’s it, the always present cglib dependency is not needed anymore.

Are you using spring security web?

You will need to upgrade to 3.1.4.RELEASE and exclude spring-asm (because spring 3.2.3 has its own and very different spring-asm). If you forget to exclude it you will get some ClassNotFoundExceptions (maven exclusion below).

Are you using “context support”?

Some “support” classes such as VelocitySupport and EHCache support where moved out of the core. To use them you will need to include the newly introduced spring-context-support (maven dependency below).
spring java maven migration 3.2.3 tips