The Fabfile

Since a couple of projects I have been using a neat little tool to manage my deployments: Fabric
As the site states, Fabric is:

Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

It really does it’s job well, and with minimal setup effort. So now all I do is @fab deploy and my remote server pulls the latest version from my bitbucket git repo, restarts the upstart task and voila: new version online!

I think I should investigate Fabric a bit more, as I feel it has more power than just a mere deploy. Great stuff!

Am I a crafstman?

I am on the verge of building our own house. Or to be precise: to let other qualified people build my house. I am not that much of a ‘handy-man’ myself, so I put my trust in others to do the job – thoroughly – for me. But we (as in ‘us’, the so called unhandy) know that feeling every once in a while, when the tap is dripping or the closet just doesn’t close like it should. Or those times that stupid dishwasher just stopped working!

There will be plenty of people discouraging me to fix it myself since I’m not handy. All those years I have been hearing the same, not just for me, but for a lot of my fellow programmers, webdevelopers, nerds & geeks. We are not handy. And strangely, I just accepted and even believed that!

OK, truth to be told, I am really not good at masonry, carpentry or another traditional craft. But does that mean I am not a craftsman? Day in day out I make software by hand. I manually type in every character to created structures that the computer can understand. I am a web developer, and I make my sites by hand. I have no tool with a button that says ‘create site’.

Than is it not a true craft? Websites qualify to be called software, if you think otherwise, try building one with a backend system + authentication + database communication + automated e-mail + a picture gallery and a big (BIG) client logo. That will just about give you a basic website. Ok, fair enough, I use tools. I use other software that helps me get the job done quicker. But so does a carpenter. He doesn’t cut a plank in two by hand now does he?

I am a craftsman, and a damned good one. So are all of us geeks and programmers. We create complex things, by hand and a lot of times by heart. We even take it one step further sometimes, working without a manual and with technologies that change faster than McDonald’s brings out a new burger. So we should start being proud of our crafstmanship! But we aren’t proud, we just build it and move on to the next one. Cause that’s how we roll.

Pharao, create .phar files like a King

We have a small internal framework, which uses the Zend framework amongst other stuff. We chose Zend because it is well documented and widespread, and also feature rich. The basic framework (here I mean our framework) only includes some components of the Zend framework, but when we took a look at the amount of single files, we saw they were plenty!
This has it’s impact on svn checkouts and commits – time wise – rather than on disk usage.

Besides Zend there was also Limonade PHP, which was the basis of our ported version. Both are needed on load, but it would be easier if they could be combined into a single package. That’s when phar files come into place.

You can see them as a zip/tar/gzip archive that contains all of the library files. Because it was kind of a hassle to generate one, I had to find some bits and pieces on the net, so I thought I’d collect them into an executable.

You just do:
pharao -s SOURCE_DIR -p PHARNAME.phar

And the phar should be generated.

Credits

Big credits to Cal Evans and John Douglass for all the code!

Code

All is on GitHub and ready to be improved!

SSD Rocks!

So to be honest, I am far from a tech savvy computer hardware wiz, but I know one thing: SSD hard disks rock! To be more clear…

As a small ‘new years gift’ :) the IT department at work gave me a brand new SSD hard disk, as a test drive before upgrading all systems. Only a few months ago I already had performance improvement when I received a 4 GB RAM update, breing the total to 8GB. This was particularly useful when running VirtualBox images, as I saw the swap file increasing then. And as we know, swaps are costly.

But frankly, in day to day use, besides the VM’s, I find the SSD update much more rewarding. Maybe it’s a combination of both – I couldn’t say since I don’t have objective benchmarks – but that SSD really helped a lot. It even shows in the small things, such as opening Microsoft Word ***shiver***. I don’t do it often, as I don’t need it to work, but some info just comes as .doc sometimes, as it does as xls.

Before I always sighed ‘pffff another 10-20 seconds wasted’ What are 10 seconds you say? Well actually, a lot! For just a text document of 100 lines? Hell, I open a 10 000 lines text file in Vim in less than 5 seconds. So having those docs and xls’s opening in <5 secs is a blessing.

Than we have other more obvious performance boosts:

  • boot times reduced
  • Photoshop is on fire now!
  • What, Flash can be fast too ? ( besides the fact those stupid fonts still take too much time )
  • Getting file info inside Finder is a breeze

Moreover, I have the feeling I am even missing out on the details, those kind of details you only notice if you would go back to the old ‘slow’ hdd.

As far as space is concerned, it is still rather limited when you don’t want to spend € 300+, but for me 180GB is sufficient. And if I would run out of space, I can still place my personal music on an external HDD, it does not need to be fast, and in essence, it’s not needed for work.

To wrap it up, no benchmarks, but just a gut feeling: SSD rocks!

I’m a happy camper :)

Making the switch

After migrating to Posterous a while, I decided to give the Github Pages a try. We will see how this adventure goes.

Vim and Actionscript

Sometimes for small Flash projects, I don’t want to use the slow hog that is Flash Builder (aka Flex Builder), so I do my scripting, as always, in Vim. But by default there is no syntax file for actionscript. I found an excellent sample script by Abdul Qabiz, and mirrored it on github for easy of use and consistency. (I load all my bundles through Vundle and all bundles come from github).

Have fun!

Behat and PHP 5.3.5

Yesterday, I was trying to install behat, a nice BDD framework for PHP. But although following the instructions on their site, I got a “behat command not found” error when trying to run it. So the actual executable could not be found. My system was looking in /usr/local/lib, but not finding a symlink to my homebrew folder for behat specifically. So I just created it myself, and it worked perfectlly :). Here is the symlink:

ln -s /usr/local/Cellar/php/5.3.5/bin/behat /usr/local/bin/behat

Hope I can help someone else who has the same problem!

Rupa “Z” save time in terminal

Not a big post this time, but a timesaver for the terminal addicts out there. Almost every time (and I do mean almost each and every time) I use the cool z command in terminal followed by a folder name, I am again amazed and pleased with the result. Simply put, it is a script that allows you to jump to your recent folders (and “recent” actually can be long ago) by using part of a path or folder name. It also keeps a ranking for each folder, so if you were working in
/root/some/long/path/to/your/projects/SomeCrazyProjects
then you can just hit:
z crazy
And you’ll get there. For more info, just go to https://github.com/rupa/z and try it out!

Command-t, MacVim and RVM

Yesterday, I really wanted to try out the Vim command-t plugin to open files fast and smart. But you need a vim compiled with ruby support, which the default OSX vim lacks. A good option is to use MacVim, but I ran into a problem, something like:

command-t.vim could not load the C extension

After some digging, I found that RVM was causing the problems. As I found on the CommandT forums, CommandT should be build against exactly the same ruby version as MacVim is build against (which is 1.8.7 for MacVim Version 7.3). So here is what I did: