BeezNest Open-Source specialists

November 17, 2009

OpenERP to become AGPL

Filed under: Development projects, Misc, OSS Solutions — ywarnier @ 2:06 am
Tags: ,

Apparently, the next versions of OpenERP will be AGPL. I could not approve this change enough. The current world is crippled by companies (coined as ‘evil’ by Fabien Pinckaers) who use and modify the software for their own customers without ever contributing a bit of code. This actually makes them parasites of GPL software, instead of symbiotic organisms. We had the same type of problem with Dokeos in the past, and decided to go for AGPL with OpenC2C.

A recent discussion with a FSF group in Chile made me realized that I wasn’t really the only one worried about the parasiting of GPL by ethicless companies, and that even large companies (like celular phones companies) were adopting it to avoid the work made for them by third parties to be disowned from them later on.

An interesting development, if you ask me.

November 8, 2009

Measuring memory usage with XDebug no longer possible (as of 2.0.0 RC4)

Filed under: Tech Crunch — ywarnier @ 8:06 pm
Tags: ,

For those like me who remember being able to see memory usage in KCacheGrind using Xdebug, well… that’s not possible anymore.

Following the Xdebug’s changelog, the memory profiling has been removed (“Removed support for Memory profiling as that didn’t work properly.”) in 2.0.0 RC4 ([2007-05-17]). Although there’s been a bunch of comments on that feature loss (like here and on the bug tracking system), it doesn’t seem like there’s been any applied patch to fix it. This being said, you might try the proposed patch yourself, if you manage to extract the proposed files (which seem to have disappeared).

You could also using the “trace” feature of Xdebug, but that doesn’t help you see it visually in KCacheGrind.

Well, too sad for all of us who will have to play with memory_get_usage() and memory_get_peak_usage() manually again). Any hope for a fix soon?

Using Ohloh’s PHP API

Filed under: Development projects, Tech Crunch — ywarnier @ 6:05 am
Tags: ,

I was trying to find out the total contributions to the Dokeos code, by contributor, between two dates, and thought I could do that with the PHP API from Ohloh, given the fact that it already provides nice analysis about the contributions in open-source projects.

Apparently, there is no way, currently, to get the total list of contributors (mostly because it is divided per page on the Ohloh website), so I built an additional function to do that (see below), but then realized that it was impossible to actually get the total commits per user between two date with the contributor idea.

Added code:

/**
 * Get all project contributors
 *
 * This function queries various pages of the API, so it might take a
 * while to return results for projects with many contributors
 *
 * @return object  simpleXMLObject
 * @access public
 */
 public function getAllContributors() {
 $contributors_on_page = 10;
 $current_page = 1;
 $contributors = array();
 do {
   $url = 'http://www.ohloh.net/projects/'.$this->projectID.'/contributors.xml?page='.$current_page.'&api_key='.
          $this->apiKey.'&v='.$this->version;
   $response = $this->_process($url);
   $contributors_on_page = 0;
   foreach ($response->contributor_fact as $id => $contributor) {
     $contributors[] = $contributor;
     $contributors_on_page ++;
   }
   $current_page++;
}
while ($contributors_on_page == 10);
return $contributors;
}

In the end it was far easier directly using Mercurial or Subversion on the command line:

$ hg log -d "2008-06-13 to 2009-06-01" |grep ^user > /tmp/users.txt

and then parse the file with a small PHP script that would use an array of names and count the number of items:

<?php
$commits = 0;
$users = array();
$file = file('/tmp/users.txt');
foreach ($file as $line) {
 $line = trim(substr($line,0,14));
 if (isset($users[$line])) {
   $users[$line]++;
 } else {
   $users[$line] = 1;
 }
 $commits++;
}
foreach ($users as $user) {
  echo $user.": ".$users[$user]." (".number_format(($users[$user]/$commits)*100,2).")\n";
}

Then just execute the PHP script with the php command on the command-line, and you get a beautiful list of users with the number of commits for each one of them. You would still have to order them by number of commits and possibly remove a few duplicates, but that’s just a minor piece of work now…

Blog at WordPress.com.