My favorites | Sign in
Project Logo
                
Search
for
Updated Jul 12, 2008 by michael.ogawa
Prototype  
Notes on the original Processing sketch in /tags/prototype/code_swarm.

The Processing prototype will not be developed or supported by this project. It is kept in tags for historical reference. Use at your own risk.

Go to http://processing.org/learning for help with the Processing language.

Source Files

So far only code_swarm.pde has been cleaned (mildly) and commented.

Data

The files I use as input, which contain the commit events, are in event format.

There are other formats supported in the prototype, but these are deprecated.

Configuring code_swarm.pde

You will need to make a few changes inside code_swarm.pde in order to suit your program :

Executing code_swarm

Once you are ready, just click the "play/run" button and wait. This operation could take up to several hours for large activity logs. To give a rough idea, it takes 2 hours using one processor of a dual-core 1.3GHz for an activity log of about 15000 commits (spread over 4 years).

Executing for PHP project

For PHP projects (or any language that is not currently supported) you will need to:

  1. add a phpColors(); call to the initColors() function (around line 110) and comment out the current eclipseColors(); call
  2. create a phpColors() function that will look like this:
  3.   void phpColors() {
        //code (red)
        colorAssigner.addRule( ".*\\.php", color(0,255,255), color(15,255,255) );
    
        //documentation (blue)
        colorAssigner.addRule( ".*/documentation/.*|.*/lang/.*|.*\\.html|.*\\.htm", color(150,255,255), color(170,255,255) );
    
        //media (turquoise)
        colorAssigner.addRule( ".*\\.gif|.*\\.jpg|.*\\.jpeg|.*\\.png|.*\\.css|.*\\.swf", color(120,255,255), color(135,255,255) );
    
        //alternative code (orange)
        colorAssigner.addRule( ".*\\.js|.*\\.jar|.*\\.war|.*\\.java|.*\\.class|.*\\.lzx", color(25,255,255), color(40,255,255) );
    
        //anything else (purple)
        colorAssigner.addRule( ".*", color(200,255,255), color(215,255,255) );
      }

Be careful that the color code is very tricky. We might need more information here, but the basic idea is that it's not a normal RGB code and it's not either a RGB color code mask. I added comments before every line so you can get an idea of what to use for at least five colors.

Assigning Colors

The ColorAssigner object is created at construction time and is a flexible way to color your file nodes. It's addRule() method takes one regular expression and two colors, essentially defining a map of file path to color range. During the event loop, when files are introduced to the system, the ColorAssigner.getColor() method looks at the files's path and tries to match it with a regular expression in its list. The getColor() method then returns a randomly chosen color from a linear interpolation of the range (in RGB space). Caveats:

Running

Download and run the Processing IDE from http://processing.org. Open code_swarm.pde.


Comment by proppy, Jun 19, 2008

looking at void loadRepository( XMLElement xml, String path, String filename ) could help figure out the format of postgres-repository.xml

Comment by henhiskan, Jun 20, 2008

Exists any tool to get the XML structure from a subversion repository? BTW, very impressive the result of your project, congratulations

Comment by nawglan, Jun 20, 2008

try: svn log -v --xml > my_repo_log.xml

Comment by notverysmart, Jun 21, 2008

Here's a script I wrote to construct an event-formatted file (use loadRepEvents, not loadRepository) from a git repository: http://methlab42.itee.uq.edu.au/~jonathan/git-code-swarm.pl

I've tested this with a couple of projects and it seems to work.

Comment by nawglan, Jun 23, 2008

Here is a nice and easy way to make a movie with mencoder:

mencoder "mf://*.png" -mf fps=30 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4
Comment by nawglan, Jun 24, 2008

And for a better quality movie:

mencoder "mf://*.png" -mf fps=30 -ovc xvid -xvidencopts pass=1 -o tmp.out
mencoder "mf://*.png" -mf fps=30 -ovc xvid -xvidencopts pass=2:bitrate=-30000 -o output2.avi

After this is done, it is safe to delete the divx2pass.log and tmp.out files. The bitrate value is the final size of the movie you want. Make sure it's a negative value. Mencoder will use that value to calculate the bitrate needed to produce a movie of that size.

Comment by nawglan, Jun 24, 2008

What does the Frame Rate actually do? One thing I was thinking was:

int FRAME_RATE = 30;
int FRAMES_PER_DAY = 30;
// 6 hours or 4 frames / day
//long dateSkipper = 6 * 60 * 60 * 1000;  // period in ms

long dateSkipper = (86400000 / FRAMES_PER_DAY);

Which would allow you to specify how many snapshots / day. Wasn't sure how FRAME_RATE was being used, so created a new variable.

Another thing I saw had to do with the histogram. Might want to do:

  // restrict history to drawable area
  while ( history.size() > (WIDTH / 2) )
    history.remove();

Which would allow the histogram to scale to larger resolution sizes.

Comment by mshuler, Jun 30, 2008

Re: Comment by notverysmart, Jun 21, 2008

The git-log line in your perl script should be the author name, not the committer. The committer may be the person that merged the change into the canonical repository and may not have written the code.

git-log --numstat --pretty=format:%ct%n%an

Kind Regards.


Sign in to add a comment
Hosted by Google Code