Friday, 9 September 2016

Installing megatools on CentOS 6

In case you wanted to install the megatools command line client for and you've run into this error:

checking for GLIB - version >= 2.32.0... no
*** Could not run GLIB test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GLIB is incorrectly installed.
configure: error: Glib 2.32.0 or later is required to build megatools

this is what you need to do (kudos should go to: Mike Miao) :

1. Make sure you have all the dependencies needed for MegaTools installed:

yum install gcc make  libcurl-devel openssl-devel gmp-devel tar libffi-devel gettext-devel

2. Install the 2.32 version of the glib:

1:  mkdir glib-source  
2:  cd glib-source/  
3:  wget  
4:  tar zxf glib-2.32.4.tar.xz  
5:  cd glib-2.32.4/  
6:  ./configure --prefix=/usr/local/glib-2.32
8:  make  
9:  make install  

As you can see, I preferred to install Glib 2.32 all in one directory, to avoid any mixing with the main Glib version that is shipped with CentOS. So, all files belonging to this library were installed in /usr/local/glib-2.32

3. Then, retry configuring and installing megatools, as follows:

1:  cd megatools-source  
2:  export LD_LIBRARY_PATH=/usr/local/glib-2.32/lib/  
3:  export PKG_CONFIG_PATH=/usr/local/glib-2.32/lib/pkgconfig  
4:  ./configure  
5:  make  
6:  make check  
7:  make install  

You are all set !

More instructions in the help pages of the command tools or even on: Mike Miao's page that inspired this )

Tuesday, 23 February 2016

Ubuntu linux: how to restrict a graphic tablet to only one monitor (in a dual monitor setup ;)

I have 2 monitors that are placed on top of each other, like this:

My graphical tablet (Genius EasyPen i405X) is covering by default the entire (summed-up) area, which means that only about half of the tablet is usable for a MyPaint drawing that is opened only on the Benq monitor.

What I want to do is to restrict the tablet movement only to Benq, ie: tablet's physical margins should correspond to Benq ones.

Let's get the needed parameters. The monitors resolution and offset can be seen by launching xrandr in command line:

optimus:~$ xrandr
Screen 0: minimum 320 x 200, current ...
LVDS connected (normal left inverted right x axis y axis)
   1366x768      60.02 +
   1280x720      59.86 

480 x 1142, maximum 16384 x 16384HDMI-0 connected primary 1920x1080+338+1080 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080     60.00*+  50.00    59.94 
   1920x1080i    60.00    50.00    59.94 
   1680x1050     59.88 
VGA-0 connected 2560x1080+0+0 (normal left inverted right x axis y axis) 673mm x 284mm
   2560x1080     59.98*+
   1920x1080     60.00 
   1680x1050     59.95 
The first screen is laptop's one that is inactive. Then, each monitor can be found based on the cable/socket it's on. In my case Benq is on HDMI and AOC is on VGA.

Xrandr displays all possible resolutions for each monitor but we need only the one that is active, marked with * (btw, the "+" means it is the recommended resolution). I have trimmed many of those for brevity and in fact we need only the first line of each, the long one where we have the resolution and also the offset.
As you can see (see also the picture) AOC (on VGA) has a resolution of 2560x1080 and it has offset 0 and 0 (it's top left corner is in the zero of the axis system).
More interesting for me, BenQ has resolution of 1920x1080 and horizontal offset 338, while the vertical one is 1080, i.e. Benq is lower that the 0 axis point with exactly the height of AOC.
(There are some distances in reality between monitor margins, but obviously these are not taken into account.)

So, let's write all down:

TotalHsize: 2560 (i.e. the Horizontal resolution of AOC, that "includes" BenQ)
TotalVsize: 2160 (i.e. the summed up Vertical resolution of both, as they are stacked: 1080+1080)
BenqHsize: 1920
BenqVsize: 1080
BenqHoffset: 338
BenqVoffset: 1080

These are all the input data we need. Now, let's calculate the proportions (or relative values):

BenqRelHsize = BenqHsize / TotalHsize = 1920 / 2560 = 0.75
BenqRelVsize = BenqVsize / TotalVsize = 1080 / 2160 = 0.5
BenqRelHoffset = BenqHoffset / TotalHsize = 338 / 2560 = 0.13203125
BenqRelVoffset = BenqVoffset / TotalVsize = 1080 / 2160 = 0.5

So, finally, the command we should launch looks like this:

xinput set-prop "Tablet name as detected by xinput --list" --type=float "Coordinate Transformation Matrix" RelHsize 0 RelHoffset 0 RelVsize RelVoffset 0 0 1

which in my case, for Benq, is:

xinput set-prop "Genius EasyPen i405X" --type=float "Coordinate Transformation Matrix" 0.75 0 0.13203125 0 0.5 0.5 0 0 1

Launch it and it's working!

This will not survive a reboot so you should do something about it if you care. Personally, I have just added the above line in a script that I run each time I use the tablet (which is quite rare in my case).

For more info see the sources I used: 

Friday, 13 February 2015

Micro$oft's contribution to the world (the pictures are taken by me, the films are on youtube)

Everything started here:

... then, it spread throughout the world, because "Nobody was fired for buying Microsoft".

So now it is in tram stations (Bucharest, Romania)...

... ATMs (ING, Bucharest, Romania)...

 ... Ikea (Palo Alto, California) ...

... elevators (Palo Alto, California)....

... restaurants (Budapest, Hungary)...

... airports (Budapest, Hungary) ...

Then, another memorable moment when they launched their tablet:

But the marketing and brainwashing machine is working:

... so, happy windows-ing!

Tuesday, 21 October 2014

MAC based licensing in VMWare and cloud

The problem:

The requirement: To move a linux software product licensed by MAC, from the physical machine into the virtualized environment or the cloud and to have it still running.


1. Contact the software vendor and get a new license based on the new MAC address in the virtualized environment. 

That's the perfect solution in case the software vendor is NOT a mother-fu***r, as hungry for money as a fat kid for chocolate (this is not mine, it is from a song :)

In my case, I wasn't lucky and they asked for money for this operation "not covered by the license".
Just a small piece of info: the software I talk about costs ~20,000 euro and the support for it is "just" 16% from the cost, per year. Define greediness...

2. Change the MAC address of your main network card in VMWare

This can be done in Linux by adding (or modifying) the HWADDR=aa:bb:cc:... / MACADDR=aa:bb:cc:.. configuration options in /etc/sysconfig/network-scripts/ifcfg-eth0 as to indicate the new MAC address.

I added them both but in my VMWare Workstation 10 environment, this didn't work until I modified the advanced parameters of the network interface and put there the new MAC too.

On my Ubuntu host having VMWare 10 and CentOS as guest VM, this is done in:
VM Settings->Hardware->Network Adapter->Advanced->MAC Address

Then it worked perfect.

3. Create a dummy interface with the needed MAC address

Then I moved to the cloud, where things were not totally in my control. The cloud guys didn't know how (or didn't bother) to set the MAC for me, saying that OnApp virtualization doesn't accept this. Maybe they are actually right, but wat to do wat to do...

I followed this tutorial: but it doesn't work because it has some typos and wrong indications, so I thought I should re-publish it here, edited. So: how to create a dummy interface on your CentOS machine, just to use its MAC address for licensing purposes:


- you will create a new fake / dummy interface, named eth1 with MAC address: aa:bb:cc:dd:ee:ff . If you need another interface number, please modify in the code below. Also replace aa:bb:cc.... with your own MAC address you need to clone.

Step 1

Add the following lines to /etc/rc.d/init.d/network , on top if the file.
/sbin/modprobe dummy
/sbin/ip link set name eth1 dev dummy0
/sbin/ifconfig eth1 hw ether AA:BB:CC:DD:EE:FF


  • the tutorial linked above, indicates you should put this in /etc/rc.local to work, which is WRONG. /etc/rc.local is executed after /etc/rc.d/init.d/network, and so, you'll get an error at boot time, saying: device eth1 does not seem to be present, delaying initialization
  • I know that altering /etc/rc.d/init.d/network it is not ok in case of upgrades, etc. In my case it is ok because I have no intention to upgrade it ever (the software works anyway only on CentOS 5 so I need to keep it 5 and not upgraded it to the latest 7). Still, if you know about a script similar to /etc/rc.local that executes before the others in /etc/rc.d/init.d/, I'd like to hear from you!

Step 2

Add to /etc/sysconfig/network-scripts a new file named ifcfg-eht1. Actually, just copy ifcfg-eth0 with the new name, then edit the ifcfg-eth1:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

After editing it, my ifcfg-eth1 looks like:

So only a couple of things were mentioned: that is named eth1 and that it should be brought up when system starts. Nothing else, since it will be unused for networking; just to have it in the system with a MAC. The tutorial linked above, misses this step.

Step 3

Reboot the system or reload networking. Then, issue a ifconfig at command prompt and admire your new MAC faked interface.


  • If you follow the boot messages you'll see that there is a warning though when it tries to bring up eth1: RTNETLINK answers: no such device
    Fortunately, it is just a warning and the eth1 is present in ifconfig afterwards. Still, if anyone knows how to get rid of this warning too, I'd be happy to update this post.

4. Fake your MAC dynamically, per request

Instead of doing something definitive like creating a new network interface or so, what about reporting a fake MAC to those apps that are known to ask for it?

All are some type of wrappers that launch the executable and intercepts any calls to the SIOCGIFHWADDR (the low level C function returning the real MAC Address), replacing it with the one we want.

It happens that I've liked fakeuname that allows for faking also hostname, so that's the one I tried (not that the others are not ok!). To make it work you need to:

Step 1

Download the fakeuname.c file and save it somewhere.

Step 2

Compile the fakeuname.c program into a dynamic library, as instructed in the .c file itself:

gcc -o fakeuname.o -c -fPIC -Wall fakeuname.c
gcc -o -shared -W1,export-dynamic fakeuname.o -ldl

Step 3

Prepare the environment a bit, before launching your command that takes into account the MAC address, like this:

export LD_PRELOAD=/tmp/

Step 4

Launch your command and you'll see that magically it takes the new MAC address from the FAKEMACADDR environment variable.

Step 5

Make the exports of the above variable part of your bashrc, profile,... whatever init script you use for launching your server (automatically or manually). Maybe even the /etc/rc.local is now very good to be used for this.

Monday, 16 June 2014

Why elance sucks (and others too)

After two month of working with elance, one month as a "free", one month as a paid one, here are some of my thoughts:

- Their commission fee is indecently high.
They do nothing for the bidder or for the client, except to provide a meeting point for those clients that didn't think about searching google for technology specific meeting points (e.g. a PHP specialized forum or a Linux job list) where they could find someone knowledgeable on the subject.
So, why have elance (guru, odesk, others) take about 8.75% - 10% of your money when any other company that allows you, e.g., to buy goods over the net using your credit card, have a comission of just about 2%-4%? What is their added value?
Nothing I'd say, just tools that you'll never need. Milestones for example, can be easily replaced by a common sense email exchange between client and freelancer. They offer an "escrow" payment to make sure the money exists but this is only for some jobs and not for all (besides, if the client is really looking for a freebie, he can refuse payments anyway, escrow or not, invoking that the freelancer didn't do it in due time or not up to client's standards). So none of these justify the high commission rate or the crazy 10$ per month paid subscription (add 5$ more for any other field of activity).

- elance has become an IT moral sewer.
If you analyse the daily IT jobs coming from elance, you'll notice that more than half of it pertain to create sites similar to competition's, spamming others or collecting email addresses from certain sources and feed them back the lists with poor guys that'll be spammed subsequently. Sometimes the freelancer is required to break captchas, use anonymous proxies or ignore the site's terms of use that specifies clearly that any site scrapper activity is not allowed. This is a method for western clients to pass the responsibility to countries that are known for illicit activities.
It's also "interesting" to point out that these type of spam / spam support jobs, get the highest number of bids from the freelancers. 

So how can you urge me sign the childish "elance pledge" that stipulates "freelancer integrity", when you allow job posting that are clearly requesting illegal activities and would worsen the world's (already bad) spam situation?

- There is unfair competition.
This problem is caused by the costs of living in various countries versus the rates you can afford to ask in those countries, but this was largely discussed on other blogs & sites unhappy about these freelancing websites, so I don't insist on it. I completely agree that globalization is not good in these cases and, as long as the Asian guys can also provide quality work, the European and American freelancers are doomed.
It is still highly debatable if the quality is indeed the same, and both parties have their best interest to pretend differently. The moral answer will be probably that it cannot be judged globally, based on race and location, only on case by case basis.

- Many requests for bidding are racist.
I can accept that some guys had multiple bad experiences with certain races (Indians fill elance preponderantly indeed because they are so many in the world, anyway) and don't want to work with them anymore.
Still, elance is allowing racism and do not moderate the job posting in any way (for those money they take) and I find it unfair, despite the fact that my chances get better in these cases (cause I am white, by the way).
The system is wrong and I don't want to give them free solutions (but there are some I could think of ;)

- Many requests for quotations are badly formulated.
This is another subject present on many of elance's detractors blogs / websites and unfortunately is true. Non technical guys try to say what they want and how they want it and it takes hours and many emails exchanged that will clarify the things up, and finally the job could be got by someone else, indirectly benefiting on your work.
In conjunction with the badly formulated RFQs, it formed a special breed of freelancers that bid no matter if they understand what's requested or not, just to win it and probably pretending more money afterwards.

- Many requests for quotations are for non-existent jobs.
As some other sites pointed out, there are some freelancers that use elance to get an idea about their their market value, by posting a fake job that would need their own skills and then analysing the received bids' money.
The job will never happen and the bidding freelancers will suffer a time waste, whilst the faker will eventually come to the conclusion that the results are not relevant: The guys from Asia will always have prices much less than Europe and US, and placing yourself in these ranges might not work because you cannot afford it, or because you don't know the client's preferences in terms of money/quality and if he thinks that everything that's american is better than everything else. So... it's a lottery.

So, all in all, I decided to give up this system in which a freelancer might earn some money, a client might get happy, but in which, clearly, elance is a winner the more people try their "services". 

The only question remaining is: can I do it better? Or, better, can we? 

What about a similar website that could be launched to put together the clients with freelancers that will intervene less (if at all) in the circulated money but more in the quality of jobs and the freelancer's moral virtues? What about a website that could request just a bit of money (eg: a 5$ yearly subscription or even donations from freelancers/clients) to finance its hosting and to give complete liberty to freelancers and users to connect, discuss, negotiate and pay/getting paid directly?
Think about it as an opensource platform that could be a benefit for those that can further find jobs through it. 

Ok, I don't know all details now, but still, anyone interested in starting such a thing? If so, let me know.