Skip to Content

develCuy's blog

by Fernando Paredes García


Ophal installer

Ophal is not based on traditional web technology, but it should not be a limitation. RoR and Django know it well!

Following the specification of Ophal installer a.k.a install.cgi:


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');
            }
        }
    }
}

Transforming the energy from Drupalcon Sao Paulo

It was August 2008 when I proposed an international "Drupalers Meet Up at Machu Pichu (Perú)", and still have that dream coming to my mind, fueling my passion for the freedom of software.

Getting back to the cancellation of Drupalcon Sao Paulo 2012, remembered that "energy never dies, it just changes form", and dude we are fully charged of energies!

Yeah! Drupal community has some dark historic episodes, including a server downtime (2005), a volcano in Iceland during Drupalcon San Francisco (2010) and a Drupalcon being cancelled, but wait! Remember... , we never give up! never!

The Drupal Latino community got great momentum and keeps moving forward! So, where all those energies moved? some were already there, others are getting extra batteries, and some are transforming into more Drupalcamps:


Ophal 0.1-alpha9 released!

What is Ophal?

Ophal is highly scalable web platform, which aims to be easy to maintain,
learn, extend and is open to improvements. Developers can create modules to
alter and extend Ophal's core capabilities and add new features or customize
Ophal's behavior and appearance. Zophin and DBA are examples of that.
Ophal core supports themes, which customize the "look and feel" of Ophal sites.

Download here!


A future without Flash, Javascript, and PHP, possible?

With that in mind, let's imagine it is 2022, there is no Flash, no Javascript, nor PHP around. How most web developers would face their projects? Ruby, Python, ASP.net and other alternatives might come to our minds when trying to replace PHP. And perhaps you don't mind about Flash because it just quietly disappeared the past decade, being replaced by the amazing HTML5. Now what about Javascript? that is hard to imagine, perhaps Google Dart is being used along with some other alternatives.


Session handling approaches and the future of Ophal

Over the past 18 months I've been working on making Ophal perform well at the front-end and have a minimal server-side load, making it quickly evolve as a playground framework (i.e: MeQuejo.PE!, Zophin and develCuy's blog search engine). Now is time to work on more complex stuff that involves the 3 functions left before a first Ophal beta release:

  • Browser's cache support (partially implemented)
  • Session handler (under development)
  • File Uploads (a long history above)

Browser's cache


HOWTO Debug Lua extensions with GDB

The last time I've used an interactive debugger was in the school, Visual Basic 6.0 used to have a nice one. That was 8 years ago, then I went to scripting and web development so debugging changed dramatically for me. So in PHP is different process, it was a bit tricky to get used to "print_r" debugging style instead of using breakpoints!

So, in the last few days, while struggling with lua-cgic (my first ever Lua extension yet to be completed), I found an I/O bug that forced me to remember: the use of breakpoints, C programming and learn GDB. All those three in a row!

GDB is an interactive debugger, basically you load a program, set breakpoints, run it and wait for the program to stop at some breakpoint. That is obvious for some people, and awesome for others like me :), just have to clarify that everything happens into a console, if you miss the graphic interface, try the GDB GUI called Insight.


Don't fool me Linode!

It has been 6 years since I have decided to move off shared hosting like Dreamhost and Hostmonster. But never minded that Linode, the VPS suggested by many, would try to fool me like them.

So, what happened? Well, I have deployed a new profile in my ex-linode with Ubuntu Server 12 LTS 64-bits, reinstalled everything from scratch, and rebooted to start fresh. Is a nice feeling, you know? The expectation of a fresh LAMP barbeque after being cooking for a couple of hours. But unfortunately I got a cold pizza! It rebooted with a terrible kernel panic... so decided to contact support, willing to get good feedback. But this was the answer:

Linode says: "It seems that an OS update between then and now has caused this issue. At this point, I would suggest redeploying your Linode and copying over any files you need.
If you wish to continue to troubleshoot this issue, you may want to reach out to our active user community."

Man, I did that already, the old Ubuntu 10 profile was dead, why should I cook a new one if there lots of nicer things to do?... so I highlighted that, but the answer was hilarious:


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!



Syndicate content