Port Forwarding to a VirtualBox Debian

Set up port forwarding:

VBoxManage modifyvm "VM name" --natpf1 "to_ssh,tcp,,22,,22"
VBoxManage modifyvm "VM name" --natpf1 "to_http,tcp,,80,,80"
VBoxManage modifyvm "VM name" --natpf1 "to_https,tcp,,443,,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

setFilter()

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 “Ultimaker – a box full of fun”

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 www.pdfsam.org and created this tiny ‘alias’ in my ~/.profile.

alias pdfsam='java -Dlog4j.configuration=console-log4j.xml \ 
-classpath /Applications/pdfsam-2.2.1.app/Contents/Resources\ 
/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

PATH=$PATH:/usr/local/Cellar/parallel/20110822/bin

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 "./processFile.sh {.}"

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

Netbeans 7 and the missing JAX-RPC plugin

I haven’t used Netbeans JAX binding for over a year.
And the last time I used it, it was easy to find in the plugin menu of Netbeans 6.
Now I’ve upgraded to Netbeans 7 and wasn’t able to find the plugin.
Happily I found a page that advised me to add

http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz

to the Update Center.
After that I got a huge list of updates, and my missing JAX-RPC.
Now just: install, restart, update-again.
Et voila, there is the missing “JAXB Binding” menu point that was searching for.

Tomcat java.net.BindException: Cannot assign requested address – made me crazy

Today I migrated a Tomcat Server to a new host. Everything was in place but it won’t start showing me the following error:

Tomcat java.net.BindException: Cannot assign requested address

I’m happy ‘Nir Levy‘ had nearly the same problem 4 years ago. Here he describes what went wrong with his /etc/hosts configuration.
My problem was that I did not update the host name in the configuration for my module
“/webapps/WEB-INF/classes/Configuration.properties”
After that everything was fine 🙂
I *heart* blogs !

mcrypt and PHP, on Mac OS X Snow Leopard 10.6.4

I found this great tutorial on how to install mcrypt into php under OS X 10.6.1
http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/
Works like charming with OS X 10.6.4 and PHP Version 5.3.2.

#!/bin/bash
mkdir src
cd src
wget http://museum.php.net/php5/php-5.3.2.tar.bz2
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&ts=1306411641&use_mirror=ignum
tar xzvf php-5.3.2.tar.bz2
tar xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking && make -j6 && sudo make install
cd ../php-5.3.2/ext/mcrypt
/usr/bin/phpize
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Developer/SDKs/MacOSX10.6.sdk/usr/bin/php-config && make -j6 && sudo make install
echo "Completed install, now make sure to edit your php.ini"
echo "and check for \"enable_dl = On\" and add \"extension=mcrypt.so\"" to the dynamic extentions"

This is the little bash script I wrote according to his tutorial. This comes without any warranty!!!
Be aware that you have to enter your root password twice while installing this script.

Big Thanks to Michael Gracie

iTunes Sharing over ssh

Today I realized that I had not a single song on my notebook hard disk. Thanks to Last.FM 🙂
Unfortunately “Simplify Media” has been adopted by Google Inc. and they do not offer a similar service yet. So I needed a solution to stream my iTunes from home to the office. If found a great solution by “Robert Harder” which works like charm. (source).
This is the bash script:

#!/bin/sh
dns-sd -P "Home iTunes" _daap._tcp local 3689 localhost.local. \ 
127.0.0.1 "Arbitrary text record" &
PID=$!
ssh -C -N -L 3689:localhost:3689 username@dyndns_name.dyndns.org
kill $PID

LE Mensa

This week I released my first OS X Dashboard Widget.
It’s called ‘LE Mensa’ and it displays all menues for all cafeterias in Leipzig, which are part of the student union.
If you want to give it a try then visit the project page: http://stinfwww.informatik.uni-leipzig.de/~mai03fln/leMensa/
Today I updated it to version 0.15 !!

It works this way:
1. I wrote a python script which extracts information from the student union homepage and transform it into xml.
2. A .php script can call this .py script and give back those infos.
3. The widget was written in Dashcode with jQuery as an additional package. So it’s mainly javascript, some html and css. The widget now calls this php script, retrieves the xml and displays it in a (hopefully) pretty way.

This is how it looks:
Front View