Skip to Content

develCuy's blog

by Fernando Paredes García


Linux

HOWTO Install Percona in Debian

Percona is a drop-in replacement for MySQL server, it comes with built-in improved performance that will make your server fly a bit faster (or perhaps a lot!).

Before using the repository, you should add the key to apt

$ gpg --keyserver  hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
... [some output removed] ...
gpg:               imported: 1

$ gpg -a --export CD2EFD2A | sudo apt-key add -

Add Percona repository

deb http://repo.percona.com/apt squeeze main
deb-src http://repo.percona.com/apt squeeze main

Remember to update the local cache

$ apt-get update

After that you can install the server and client packages

# apt-get install percona-server-server-5.5 percona-server-client-5.5

Test browser CSS hover on Linux with Sahi and xdotool

Sahi is an alternative to Selenium(http://seleniumhq.org/) for web automation. But none of them support real mouse hover (a.k.a CSS hover), but thanks to the powerful XTEST library and xdotool, a command line tool that emulates fake keyboard and mouse, the missing feature can be implemented.

Following an example:

class ClientContext extends BehatContext implements MinkAwareInterface
{

   ...

    /**
     * @Then /^I should see a color change for menu "([^"]*)"$/
     */
    public function iShouldSeeAColorChangeForMenu($menuName)
    {
        /** @var $session \Behat\Mink\Session */
        $session = $this->mink->getSession();

        /** @var $page \Behat\Mink\Element\DocumentElement() */
        $page = $session->getPage();
        $links = $page->findAll('css', 'ul.nice-menu li a');

        /** @var $link \Behat\Mink\Element\NodeElement */
        foreach ($links as $link) {
            if ($link->getText() == $menuName) {
                $jquery = <<< EOF
(jQuery("ul.nice-menu li a:first").offset().top)
EOF;
                $top = $session->evaluateScript($jquery) + 130;
                $jquery = <<< EOF
(jQuery("ul.nice-menu li a:first").offset().left)
EOF;
                $left = $session->evaluateScript($jquery) + 100;
                system('xdotool mousemove ' . $left . ' ' . $top);
                $session->wait(1000);
                $jquery = <<< EOF
(-1 !== jQuery("ul.nice-menu li a:first").css('color').search('255'))
EOF;
                assertSame($session->evaluateScript($jquery), 'true');
            }
        }
    }
}

HOWTO lossy compress PDF files in Linux

Image Magick is an awesome tool that also does a great work compressing PDF files.

Just run the following command:

$ convert -compress jpeg -density 150 file.pdf file-compressed.pdf

Notice that -compress is the compression type, and -density is the image quality. Also, JPEG compression is lossy, and reduction of DPI usually is lossy. But I managed to have good compression quality with these settings.

There are more details in the Image Magick manual.

Blessings!


HOWTO Install XHProf in Ubuntu and HOWTO use in Drupal 6.x and 7.x

1. Install dependencies

# apt-get install php5-dev

2. Download xhprof source

$ cd /tmp
$ git clone git://github.com/facebook/xhprof.git

3. Install xhprof PHP extension

$ cd xhprof/extension
$ phpize
$ ./configure
$ make
# make install
# echo "extension=xhprof.so" > /etc/php5/conf.d/xhprof.ini
# echo "xhprof.output_dir=/tmp" >> /etc/php5/conf.d/xhprof.ini
# service apache2 restart

4. Install XHProf module in Drupal

a. Install in Drupal 6.x
# cp -a /tmp/xhprof/xhprof_* /var/www/
$ cd myproject


Howto install Titanium Appcelerator in Ubuntu 10.04

UPDATE 2011-07-19: Following instructions also work with Ubuntu 11.04 Natty Narwhal.

Programming for mobile in Linux was a pain in the neck 6 years ago and it is still a pain in 2011. The following articles may help you in your journey:

  1. http://dalibornasevic.com/posts/14-how-to-install-titanium-and-android-s...
  2. http://developer.appcelerator.com/question/118186/kitchen-sink-not-worki...
  3. http://developer.appcelerator.com/question/35751/error-failed-installing...

If you survive let me know :)


HOWTO Apache 2 + Lua 5.1 + FastCGI in Ubuntu

Install basement

$ sudo apt-get install apache2-mpm-worker liblua5.1-0-dev
$ sudo apt-get install libfcgi-dev libapache2-mod-fcgid

Install Luarocks

Download latest version from: http://luarocks.org/releases/, extract it, open a terminal and do a "cd" into its directory, then:

$ ./configure --with-lua-include=/usr/include/lua5.1/
$ make
$ sudo make install

Install WSAPI

$ sudo luarocks install wsapi-fcgi

Configure Apache


HOWTO recordmydesktop+jack in Ubuntu Karmic

If you are an screencaster, for sure you know that there are not much options to grab your desktop + microphone at the same time. Perhaps you have tried some java programs, or simply switched back to windows and used a virtual machine. Too complicated!

Hopefully, there is still an opportunity: recordmydesktop+jack. I will not describe how to install jack here, sorry, google is your friend :)
But once you have jack up & running, do the following:

Download sources
$ apt-get source recordmydesktop

Install development dependencies
$ sudo apt-get build-dep


EXA, XAA, Xorg and Firefox memory leak

One month ago I was experiencing memory leaks with Firefox.
I did a fast check with "top" command and seen that when Firefox was running it started to overcharge Xorg, making it to use more and more CPU and Memory resources, near 95%!!!!!!!!
So I've decided to use Opera. That was a nice experience to use that super-fast browser. The problem is that Firefox is a key tool for my working day (I'm web developer).
Today I've launched Opera from the command line, and noticed this warning:
"opera: X Shared memory extension is not available. ZPixmap not supported"


Access Visual Foxpro Tables(Vfp Dbf) from Linux

It is one of my first posts in english(recovered from: http://www.linuxforum.com/forums/index.php/topic,137025.0.html): I don't know if it is new, but today, alfer a large week of intensive research, finally i had discover a way to access visual foxpro databases directly from linux. What do you need? download, compile and install CLIP from http://sourceforge.net/projects/clip-itk/ then put the vfp table into the same directory of the next script:

file: testdbf.prg

use dbftable
list columnname


GLX fix for i915, benefits for OpenGL applications on many Intel Graphics chipsets

Today I decided to upgrade my debian(leny) box. The process was a classic/easy:

# apt-get dist-upgrade

Then I restarted my computer and Oh! my God!!! there seems to be something diferent, my hearth speed up and then I decided to test compiz-fusion.... Great! this is finally working!!!

Please forgive me, I've forget to explain that I use a relative old HP laptop: Compaq nx9030, that comes with i915 compatible Intel Graphics chipset:

# lspci



Syndicate content