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



Tips de supervivencia para empezar a usar la XO de OLPC

Todo empezó con las actividades de mi tesis, en las que incluí realizar pruebas en equipos de bajo rendimiento para tener una aproximación realística a los resultados de mejorar el rendimiento de Drupal. Es simplemente saber "como se siente".


Jugando con Software Libre

Publicado en: Revista Cliché, Año IV Edición 15 Abril

Desde hace un par de años se ha desterrado el mito de que Linux y el Software Libre(1) es aburrido. Y eso tuvo mucho que ver con los gamers. A continuación 3 juegos de plataformas dedicados a ellos:

Yo Frankie!

http://www.yofrankie.org/download/



Distribuir contenido