Posts in blog

SVN hook to create a new job in Jenkins not working with Eclipse

Mar 18, 2013 in eclipse, jenkins, subversion | blog

We had prepared a build pipeline using SVN, hooks and Jenkins. Besides the traditional hook to trigger jobs in Jenkins, we had created a hook to create new jobs in Jenkins, based on a Groovy template for every new branch. Basically, it was matching the Subversion commit log against “^A new branch”. It was working nice, except for Eclipse developers. New branches created with Eclipse weren’t triggering the hook correctly. After a little debug, we found out that Eclipse uses different commands to create a new branch.

In case you are creating similar pipeline, you’ll be forced to either use different expressions or ask the developers to use the command line to create new branches.

Fixing "XMLHttpRequest Origin is not allowed by Access-Control-Allow-Origin" in PHP and CodeIgniter

Mar 16, 2013 in blog, csrf, javascript, php, speak-like-a-brazilian | blog

Since it has been released, Speak Like A Brazilian had a bug when users voted, but had accessed the site via speaklikeabrazilian.com, and not www.speaklikeabrazilian.com (the latter is the base_url in application/config/config.php).

Looking at the developer console in Chrome, you could see that XMLHttpRequest was having trouble by, what looked in principle, like a security bug. Maybe a cross-domain issue.

After searching the Internet, we’ve found what was causing this issue. Unfortunately I lost the link, but in a StackOverFlow discussion, one user said it had something to do with the CSRF check.

A quick test, where we disabled the CSRF token verification, showed that he was right. But we couldn’t simply disable CSRF everywhere. So if you are facing similar issue, here’s the trick: Create a hook that disables CSRF verification only for a certain URL.

It’s not a very nice approach, but as in Speak Like A Brazilian the votes are linked by IP, there’s no need to keep the CSRF token. Here’s the solution that worked for us.

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
* Security Class
*
* @package hooks
* @description Disables CSRF token for certain pages.
*/

class DisableCSRF
{

function disable_if_callback()
{
if(stripos($_SERVER["REQUEST_URI"],'/rating/expression') !== FALSE)
{
$CFG =& load_class('Config', 'core');
$CFG->set_item('csrf_protection', FALSE);
}
}

}

And as a side note, we are still in honey moon with CodeIgniter. We have just finished another project with it, and so far we haven’t been let down by this amazing framework. Hope it helps you, in case you have similar error.

Happy St. Patricks Day! And happy coding!

Exporting data in R format

Feb 09, 2013 in jenkins, r, ideas | blog

Quandl has now a feature that lets users export data as an R matrix, this way the data can be easily loaded into R. Damn awesome righto? Kudos to the guys from Quandl!

read.csv('http://www.quandl.com/api/v1/datasets/OFDP/ALUMINIUM_21.csv?&utf8=✓&trim_start=2012-01-03&trim_end=2013-02-07&sort_order=desc', colClasses=c('Date'='Date'))

r_quandl

Today’s idea is use Quandl approach in other applications. Jenkins exports some of its objects to its external JSON API. And there are stats being collected from plug-ins (like the download statistics). I am curious to know if there would have any gain in exporting parts of this data as R matrices and processing it directly with R.

This could be used in a lot of different applications, perhaps even using Hadoop and R. Instead of writing collectors to consume an RESTful service, you would simply write one R line to get the job done.

R does very fine in plotting too, so I wouldn’t be surprised to at least see some prettier charts :o)

Study if it's doable to parallelize PacBioToCA

Feb 05, 2013 in bioinformatics, ideas | blog

Homolog.us is an amazing site. The content is clear, rich and very entertaining (at least for those who like biology and technology). They have an active Twitter account, they answer comments, they are on reddit too. These guys rock!

Recently they wrote about PacBioToCA, pointing out its lengthy execution. It’s common in biotechnology parallel execution with OpenMPI, OpenMP or other method like MapReduce.

One idea would be review the code, check if it’s doable some kind of parallelism and write about it. Perhaps rewriting it. They already wrote about another tool that competes with PacBioToCA. I told you that Homolog.us is amazing.

Treinamentos Jenkins na TupiLabs em 2013!

Dec 17, 2012 in jenkins, training, news | blog

A TupiLabs, após apoiar o evento Jenkins Meetup São Paulo 2012, agora busca divulgar ainda mais essa ferramenta de Integração Contínua por aqui no Brasil, oferecendo dois cursos. O primeiro é um curso completo de integração contínua com o Jenkins. E o outro um curso que ensina como desenvolver plug-ins para estender o Jenkins. Seguindo esses dois treinamentos, de um dia inteiro cada um, você conseguirá facilmente montar um ambiente de integração contínua na sua empresa.

Confira mais sobre os treinamentos na nossa página de Treinamentos de Jenkins.

Os treinamentos são sujeitos à formação de turma, e podem ser ministrados in-company também. Entre em contato para maiores informações.