All posts by admin

Why to choose nfs over vboxsf for mounting host folders inside a VirtualBox VM!

Simple answer: SPEED

Long answer:

Most projects I work on a the moment are web related and I like my development environment to be as close to production as possible.

Therefore I set up a Debian Jessie some time ago and mounted my whole /Users/cb0/Sites directory into the VM. So I configured the shared folders inside the VirtualBox and used this code inside /etc/fstab inside the Debian.

Sites /Users/cb0/Sites vboxsf defaults,rw,uid=33,gid=33 0 0

This worked fine for custom php apps and even for symfony 1.4. Now I’m working on a symfony 2 project which seems to generate a whole bunch of cache files before starting to deliver the webpage.

This resulted in an average load time of 45s (yes seconds) which I could not bear for more than 2 pageloads. So I search for the bottleneck and found out that the creation of the cache files took too long. After reading some documentations I decided to try to mount the share over nfs instead of the vboxsf.

Here’s how to do it:

1. [Host] Create or open the file “/etc/nfs.conf” and insert the following line:

nfs.server.mount.require_resv_port = 0

2. [Host] Edit the /etc/exports file and configure your desired share folder like this:

/Users/cb0/Sites -mapall=501:20 -network -mask

Replace “192.168.56″ with the address you have chosen for your Host-only Adapter.

3. [Host] Run the following 3 commands:

> sudo nfsd update
> sudo nfsd checkexports
> showmount -e

The ‘showmount’ command will output something like this if everything went fine:

# Exports list on localhost:

4. [GUEST] Install necessary software. (As mentioned I use debian jessie)

sudo apt-get install nfs-common

5. [GUEST] Add the mount infos into the file /etc/fstab /Users/cb0/Sites nfs soft,intr,rsize=8192,wsize=8192 0 0

This tells debian to mount the directory /Users/cb0/Sites located on my host machine into the exactly same directory on my linux. (Note: You have to create the folder inside the guest first.) I do this for convenience, you could mount it somewhere else.

6. [GUEST] Now mount this share.

sudo mount /Users/cb0/Sites

and you are done.

After these simple steps and no other tuning my sf2 web project load in about 580ms. This is more than 70times faster than before.
I also noticed a small speedup in my other web apps. Now I can relax, sit back and continue my work on this project.


FOSUserBundle customization notes


I’ve been busy creating a new project in which I use symfony2 for the first time. Working with symfony1.x for nearly 3 years I really like some of the ideas of symfony2. However there are also some things I dislike, or just don’t fully understand yet.

Here are some quick notes I took while reading the FOSBundle Documentation.


Default Templates

The easy and quick way:

  • Basically override the FOS Template by creating a file under ‘./app/Resources/FOSUserBundle/views/layout.html.twig’
  • Be sure to include this block, which will hold the FOSUserBundle Content. 
{% block fos_user_content %}
{% endblock fos_user_content %}

2. The more complicated way

Create symlinks inside a VirtualBox shared folder

While working inside debian, which is installed inside a VirtualBox and shares a folder with it’s host machine, I repeatingly got errors while creating symlinks. (I use “os x 10.7″ as host and “debian wheezy” as guest os.)

Until now I accepted it but today I got tired of creating these symlink in the host system.

Here’s the solution I found:

1. Shut down the virtual machine. Debian in my case.
2. You need to close the VirtualBox GUI.
3. Type this into your preferred command line.

VBoxManage setextradata DEBIAN VBoxInternal2/SharedFoldersEnableSymlinksCreate/FOLDER_SHARE 1

4. Reboot your virtual machine.
5. Enjoy the stunning power of symlinks again*

* You ask why again ? Because this was possible by default prior to VirtualBox 4.1.8. It has been added for additional security.

nmh, mh-e and emacs on OS X 10.7

Hi there,
I haven’t posted in a while. But this short post should proof im still alive ;)

I’ve been doing a lot emacs lately and decided to give nmh a try. Unfortunately the script that ships with it, to automatically build and install nmh, won’t work on my Macbook running OS X 10.7. It just gives me this output:

make[2]: *** [check-TESTS] Error 1
make[1]: *** [check-am] Error 2
make: *** [check] Error 2
build failed!
build log is in build_nmh.log

The build_nmh.log is full of messages that tell me to go away.

Here’s what I did to manually install it.

$ cd nmh
$ autoconf
$ autoheader
$ configure --enable-debug --enable-pop --with-editor=emacs --prefix=$HOME/nmh
$ make
$ sudo make install

This installed nmh binaries into the “~/nmh” which is ok for now because I’ll just want to try out.

After that you need to got to emacs which includes mh-e since emacs 18. So this should apply to my nightly build version from EmacsForMacOsX.

Now you need to configure the variable ‘mh-path’ so emacs will know where to find the executable.
I did this through calling ‘M-x customize-variable mh-path’ and entered “User/cb0/nmh/bin”
This will set this variable in you .emacs file

(custom-set-variables '(mh-path (quote ("/Users/cb0/nmh/bin"))))

After this run “M-x install-mh” to install and “M-x mh-version” to check if everything is installed correctly.

MH-E 8.5

MH-E compilation details:
 Byte compiled:		yes
 Gnus (compile-time):	Gnus v5.13
 Gnus (run-time):	Gnus v5.13

GNU Emacs (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2013-03-28 on

nmh 1.5+dev
 mh-progs:	/Users/cb0/nmh/bin
 mh-lib:	/Users/cb0/nmh/etc
 mh-lib-progs:	/Users/cb0/nmh/lib

Darwin snowball.lan 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:26:45 PDT 2012; root:xnu-1699.32.7~1/RELEASE_I386 i386

I also installed the manual so I dont have to leave emacs for a straight start.

Now I’m excited to see nmh live and inside emacs.

Port Forwarding to a VirtualBox Debian

Set up port forwarding:

VBoxManage modifyvm "VM name" --natpf1 "to_ssh,tcp,,22,<GUEST IP>,22"
VBoxManage modifyvm "VM name" --natpf1 "to_http,tcp,,80,<GUEST IP>,80"
VBoxManage modifyvm "VM name" --natpf1 "to_https,tcp,,443,<GUEST IP>,443"

Replace “VM name” and <GUEST IP> with your desired configuration. If your guest OS use DHCP then can be omitted. natpf1 stands is the network interface to use. In my case NAT is Network Adapter 1.

To remove them again:

VBoxManage modifyvm "VM name" --natpf1 delete "to_ssh"

‘VBoxManage’ should be installed on your host os by the VirtualBox installer.

Symfony 1.4, forward to a filtered list view

Today I wrote a new symfony module which needed to use the view of an old model as a detail view.
So the only thing thats missing is a call to the old module’s ‘list’ action with a preset filter value.
However the described


didn’t worked out, because it seems that you can’t set a filter for a different module.
So I analysed the user settings ( see “debug bar”) and came up with this solution:

$this->getUser()->setAttribute('myOldModule.filters', array('filter_att' => array('text' => intval($request->getParameter('id')))), 'admin_module');
$this->forward('myOldModule', 'index');

“myOldModule” = Model Name of backend module.

“filter_att” = The name of the model column you want to filter.


Ultimaker – a box full of fun

Hello fellow friends,

today I have some time and I’ll try to write about my UM experience.
So you could ask, what’s an Ultimaker?

In my opinion it’s one of the greatest things that has arised from the open source community. A 3D printer.
If you want to read more about the history of the community I advice you to read this. Without the initial development of the RepRap community this would not have been possible. In this spirit: “Thanks you sooooo much, all of you are awesome”.

So here’s my short history with 3D printers.
I got to know these things about 2 to 3 years ago when the first people wrote about the development.
At this time I did plan to build one on my own. This thought was rejected by myself after I read about, what parts are needed and how this whole thing can be assembled.
I didn’t believed that I can do it without spending months of research for the parts, assembling and tuning. So for the next 3 years I almost forgot about this great technology.


When 2011 was running out I first read about the MakerBot community and got a first view a thingverse.
I was blown away about the scope and wide range of great things that other people already created.
2 weeks of surfing across hundreds of sites, comparing different models and checking my budget my decision was clear. I ‘ll buy an Ultimaker. So I placed the order on 12th of december and after the order was processed through a payment provider the great waiting started :)
Estimated shipping time is 4-6 weeks. On the 31st of january the mail that made my day arrived.
Subject: ‘Order Update’, Content: ‘Preparing shipment’
On 3rd feburary the package was delivered. Unfortunately I wasn’t at home so I had to call the service and arrange a new delivery date. Tomorrow will be the day!

So the day came and I was so happy when the door bell rang.

Continue reading

PDF Sam command line on OS X

Today I struggled with the usage of PDFSam on my Mac.
I just needed the command line tool, not the gui. On Linux it was

apt-get install pdfsam

On my OS X I dowloaded the .dmg from and created this tiny ‘alias’ in my ~/.profile.

alias pdfsam='java -Dlog4j.configuration=console-log4j.xml \ 
-classpath /Applications/\ 
/Java/pdfsam-2.2.1.jar org.pdfsam.console.ConsoleClient "$@"'

On command line I can now use it like I use it on Linux.

running parallel bash tasks on OS X

How often did you needed to process huge amounts of small files, where a single task uses only a small amount of cpu and memory?
However, today I need a script which does exactly this.

I have a mysql table which contains the filenames located on my hard drive.
Now I created a little script which processes a single file in under 3 seconds. Unfortunately for 10.000+ files this would take more than 8 hours.

So what if I could run them in parallel with a maximum of 10 parallel task’s being executed? This would really speed up the computation!

Luckily in 2005 Ole Tange from GNU merged the command line tools xxargs and parallel into the a single tool ‘parallel‘.
With this great tool there is no need to write any complicated script to accomplish such tasks.
First you need to install it using homebrew.

brew install parallel

After that i had to add the path to my .profile


Here’s the basic usage:

 $> echo -ne "1\n2\n3\n" | parallel -j2 "echo the number is {.}"

This would echo the numbers 1, 2, 3 to the stdout with a maximum of 2 parallel running echo’s.
Here’s the output:

the number is 1
the number is 3
the number is 2

As you can see printing a 3 outspeeds printing a 2 ;)

So here is my 1 liner to process all my files:

 $> mysql -uroot -p[secretPW] my_database < \ 
    <(echo "SELECT filename FROM files")\ 
    | grep -v 'filename' | parallel -j10 "./ {.}"

After using this it took only 37min to process my 10000+ files :)