Logitech C310 base – 3D printing blueprints

Posted: 1st February 2014 by Ammar Qammaz in Post

Hello I just 3D printed my first design ever a base for the logitech C310 cameras..
So i would like to attach the final version of the CAD file ( made with SCAD ) for anyone that might need it.
This is to be mounted on a 2CM metal bar to make a stereo camera setup

Regards! :)

STL File v0.6

SCAD File v0.6


Bracket for Logitech C310 using OpenSCAD

Posted: 17th January 2014 by Ammar Qammaz in Post


Logitech C310 bracket v.0



Making stereo cameras using Logitech C310 cameras on Linux

Posted: 17th January 2014 by Ammar Qammaz in Post

Haven’t updated my blog for a *LONG* time !!

I have 3 or 4 projects I wanted to add here but I never had the time to “document” them.

One of the things I ‘ve been doing lately is making a stereo camera setup to be mounted on top of my car..


The cameras I use are 2x Logitech C310 which produce images recorded using my RGBDAcquisition V4L2 stack..

I first came accross those cameras on a very cool project for AR-Rift

This is a nice application that uses the cameras to mediate reality with the help of Oculus Rift

I would like to post here the dimensions of the camera sensor after usncrewing the Logitech C310 sensor. You can see how to do that on the following video

I now have measured the dimensions of the board that I attach here



The next step is to make a CAD file 3D print it and re-attach the cameras with perfect parallel alignment..
To make the file I am planning to use the OpenSCAD software which I really like!

I will post my cad file when I have it!

I also have some .jps files captured with them and converted to .gif for reference here

Android and DHCP problems

Posted: 8th July 2013 by Ammar Qammaz in Post

Its been a long time since my last post.. Over the time I had a lot of stuff to write but not enough time to write them down :p

I would like to report some problems I’ve been having with my android phone and its DHCP/Wifi connectivity.
I have a Sony Ericsson Neo V with an unlocked bootloader ( click here if you want to unlock your Xperia bootloader ) , and running CyanogenMod 9.1.0 – haida with android 4.0.4

My problem is that after a few days the dhcp subsystem goes haywire and starts spawning more and more processes of the dhcp daemon which slowly make the system unusable

Android DHCP Problems

As you can see in this screenshot by opening a terminal emulator and issuing ps | grep dhcp i get 8 processes for dhcp and this gets worse and worse.. I could have waited for more but they wouldnt fit on the screenshot so why bother :P . My highscore of patience is having 20 dhcp daemons running at once on the background as an experiment before i went on and killed them..

Apparently it is not a fault of my phone or CyanogenMod but rather an Android thing ( google’s fault ;P ) and I am not the only one who has observed it as this Princeton bulletin describes ( http://www.net.princeton.edu/android/android-rapidly-repeats-dhcp-transactions-many-times-33590.html#issue ) , I also believe that “android avoid poor internet connection” reports have to do with this bug.

In order to kill them what I would do in my laptop would be to run : kill `ps | grep dhcp | awk ‘{ print $1 }’` but unfortunately I haven’t found an obvious way to execute a shell script as root (yet) , not that I have tried hard to find one

For now what i do is I execute the following from my PC ( connected to my android device )
sudo platform-tools/adb shell "su -c 'kill `ps | grep dhcp | awk '{ print $1 }'`'"
when the bug happens and things start to get messy

I will also probably have to delete the contents of data/misc/dhcp
, the files dhcpcd-wlan0.lease and dhcpcd-wlan0.pid since they would no longer be valid
probably by adding a sudo platform-tools/adb shell “su -c ‘rm /data/misc/dhcp/*’” to my script


COMMAND="kill `ps | grep dhcp | awk '{ print $1 }'`"

sudo platform-tools/adb shell "su -c '$COMMAND'"
sudo platform-tools/adb shell "su -c 'rm /data/misc/dhcp/*'"

exit 0

Of course all these do not combat the problem at its root (i.e. the settings manager that decides to spawn dhcp etc ) but rather trying to patch up the problem when it occurs so that everything behaves properly..

In any case I hope this helps someone somewhere facing the same problems as it does for me..
This is one of the first “bugs” in android i have encountered affecting serious functionality on my device ..
Also being a linux user and having played a little with the shell in my device I find everything very familiar but all the tools provided by busybox and the android team are cut down versions of the GNU utils and this sucks , so for example ps only supports 3 switches instead of the 30 in a regular GNU/Linux box .

Looking forward to the Ubuntu phone xD


I now have a script


while [ 1 ]
kill `ps | grep dhcp | awk '{ print $1 }'`
rm /data/misc/dhcp/*
sleep 10000
echo "Test"

exit 0

Inside of the device ( stored at /data/local ) and called ./monitorDHCP.sh
I will see how it behaves and maybe leave it running :D !
It can also be added to the startup of the device by editing /etc/init.d/90userinit and adding it there

URL Shortners , my take using AmmarServer

Posted: 19th April 2013 by Ammar Qammaz in Post

Hello World,
been quite a long time since my last post here.. :)

This blog post is about URL shortners and specifically my URL shortner (MyURL) based on the infrastructure of AmmarServer
For more information on AmmarServer you can read this

URL shortners are internet tools that take long and impossible to remember URL strings like http://www.youtube.com/watch?v=lR9mNuLIPBU and add an easier to remember (or a random) alias that makes it shorter..! :) like http://tinyurl.com/d69n5sr or http://myurl.ammar.gr/fadetoblack ..

This web-service of course is a pretty straightforward one since it is just a lookup table with aliases pointing to strings and thats about it ,on the server side.. Thats also the reason why it is one of the first “service applications” of AmmarServer..

The code itself is simple and at the time around 420LOC , though I would like to reduce them even more..

The whole server executable is around 90KB ( taking efficiency seriously ;P )
and apart from the server binary there is also a plain-text file called myurl.db which contains the aliases and real links. Literally these are the two things you need and you got yourself a URL shortner.
Of course the db file is read only one time on startup and it is written every time a new alias is added from a user.

Basically what we do is spawn an AmmarServer instance on port 8080 and use an apache proxy to redirect traffic going to myurl.ammar.gr to . This can be easily done by enabling mod_proxy ( sudo a2enable mod_proxy , sudo a2enable mod_proxy_http ) and by adding a virtual host like the next code segment

<VirtualHost *:80>
ServerName myurl.ammar.gr
<Proxy *>
Order deny,allow
Allow from all
ProxyPass /
ProxyPassReverse /

( Note : I would really like to make a proxy based on AmmarServer and probably will do to be able to get rid of apache completely )

Of course as I do with most things I tested MyURL against other popular URL Shortners , ( namely tinyurl.com , bit.ly , goo.gl , tr.im and ow.ly ) and found out a good performance advantage ..

As demonstrated below :

Task Shortening ->

time wget http://www.youtube.com/watch?v=lR9mNuLIPBU
2013-04-19 17:05:03 (840 KB/s) – `watch?v=lR9mNuLIPBU.1′ saved [232418]
real 0m0.755s
user 0m0.000s
sys 0m0.008s

time wget http://myurl.ammar.gr/fadetoblack
2013-04-19 17:50:19 (12.7 MB/s) – `fadetoblack.7′ saved [127/127]
real 0m0.066s
user 0m0.000s
sys 0m0.000s

time wget http://tinyurl.com/d69n5sr
2013-04-19 16:15:08 (815 KB/s) – `d69n5sr’ saved [232370]
real 0m1.082s
user 0m0.000s
sys 0m0.008s

time wget http://bit.ly/plIyZu
2013-04-19 16:18:03 (716 KB/s) – `plIyZu’ saved [232383]
real 0m1.038s
user 0m0.000s
sys 0m0.008s

time wget http://goo.gl/XAQqU
2013-04-19 16:19:22 (742 KB/s) – `XAQqU’ saved [232387]
real 0m0.825s
user 0m0.004s
sys 0m0.008s

time wget http://tr.im/42d2q
2013-04-19 16:23:29 (825 KB/s) – `42d2q’ saved [232693]
real 0m1.218s
user 0m0.000s
sys 0m0.012s

time wget http://ow.ly/kdVRX
2013-04-19 16:36:15 (806 KB/s) – `kdVRX’ saved [232907]
real 0m1.209s
user 0m0.004s
sys 0m0.008s

Of course this is not an accurate benchmark since myURL currently only has around 30 aliases while the other services have possibly millions , and also I am testing this from Crete , Greece , and the myURL server is in Athens Greece , while most of the others are on the US ( which implies a lot of “jet”lag ) , and network congestion might vary from time to time..

Then I took a look on the filesizes of the responses , which to my amazement was ~300KB .. Turns out that due to the Redirection using 301 headers wget was actually going on and retrieving the full youtube page so i then went on subtracting this time from each of the responses which yielded

myURL 0.066s <- myURL performance
tinyurl 0.327s
bit.ly 0.283s
goo.gl 0.07s <- this is also awesome
tr.im 0.463
ow.ly 0.454s

So that being said , considering my non-special hardware server , my plain DSL connection , my DynDNS DNS , my D-Link ADSL modem doing NAT and serving the data , myURL performance is overall superfast :) !

One question is how the f*$# is google going “as” fast ( and while providing a better service , analytics , user based “tracking” ;P etc ) and another one is how much faster could I go :) !
When running a test through a local loopback connection I get

time wget
2013-04-19 17:27:05 (5.55 MB/s) – `fadetoblack.1′ saved [127/127]
real 0m0.010s

which is the maximum throughput the server can go at ( it is 7 times less than google’s net time ) If I only knew a little bit about how fast goo.gl go from inside their LAN , or what their software architecture is like :)

You can find MyURL here -> http://myurl.ammar.gr/ , although it is in alpha stage and thus will probably not be always online ( as I am performing tests on it , recompiling ,restarting etc ) ..!
Also ammar.gr is not exactly a high-availiability site , mainly thanks to my ISP :P
Of course as mentioned above myurl.ammar.gr is the same as calling http://ammar.gr:8080 . Of course calling myurl.ammar.gr also adds an overhead for the proxy thing to take place but for now it will have todo , Also I might change ports in the future so myurl.ammar.gr will be the thing to remember..