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.
Big credits to Cal Evans and John Douglass for all the code!
All is on GitHub and ready to be improved!
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).
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!
MongoDB group by with Mongoose
I’m using Mongoose lately to connect to a MongoDB" from a node.js app, and along the way I needed an equivalent of the mysql ‘group by’ syntax. While the MongoDB documentation contained info about how to do a group by, I couldn’t get it to work with Mongoose. After a bit of trial and error I came up with this:
Hope that helps anyone else on the same quest!
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
then you can just hit:
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:
Nginx alongside Apache on OSX
The other day I wanted to experiment with the superfast nginx server on osx for static files, and to use the built-in apache webserver as power unit to process the dynamic content.
Although not very hard to setup, there are some thing you should bear in mind:
- for each server (aka virtualhost) you will add to nginx, you will need to add a virtualhost to apache (at least if the server you were adding will have dynamic content)
- nginx has a good base documentation on it’s site, but I still think of it as an underdog server. That is, for every article you will find on the web for an nginx problem/issue, there will be 100 to find for apache.
Anyhow, let’s get on with it. Please not that I did not come up with all this myself, I found a lot of information scattered through different tutorials, which will be listed below. All credits to those authors!
brew install nginx
Installation done! On to the configuration
First, let’s set up nginx so it uses the somewhat cleaner “sites-enabled/sites-available” structure. Some might already seen it on apache2 or somewhere else, and I find it cleaner than putting all your virtual hosts in one (or several) file. This way, for each site you add you create the config file in the sites-available folder, then symlink it in the sites-enabled folder and just have nginx to load all the files in the sites-enabled folder. That way, whenever you temporarly want do disable a virtual host, you can just remove the symlink, and not have to remove the actual config file (you might want to keep it for future reference).
- Go to your nginx config folder (when installed with homebrew, that will typically be in
- There create two folders, sites-enable and sites-available.
- open up
nginx.conf in your favorite text editor and update it to your likings. My file is listed below, you can play with the settings, but it is important you have the ‘include sites-enabled/’ line. That will make sure all your servers are loaded.
- go into the sites-available folder and create a server config file
- include the listing below (and change to your needs)
- now create a symlink to the file in the sites-enabled folder
- or to restart:
sudo nginx -s reload
- open httpd.conf, should be in
- update the port apache listens on to 127.0.0.1:8080 (since nginx will be running on port 80, apache should be on another port), around line
- add your virtualhost (or include and external vhost file and add it there). Note that you could go for the same sites-enabled/sites-available setup here, like I did
- note that your virtualhost should have the same ServerName as the one you used in nginx, and it should listen on port 8080!
Hosts & Go!
Now just update your hosts file ( /etc/hosts ) to include your newly created server:
And point your browser to http://dropbox.local. You should see the directory listing of all your folders, or if you planted a site there, it should run! If you do run into errors, first check out both the nginx and apache error logs in the Console, it might help you.
Big thanks to the following persons for their great articles and posts on forums: