Connecting India is a Pune based NGO dedicated to suicide prevention in youth. Its team of dedicated volunteers and concerned citizens are dedicated to serve the community through its various programs, seminars and especially through its Suicide Prevention Helpline to support individuals dealing with emotional stress.
Connecting India was starting a number of new initiatives and wanted a new website which would reflect the dynamism in the organization. We working in collaboration with Stradicate to help create the new design and interface. Stradicate worked on the design and we developed and hosted the website.
If you would like to make a difference, and you are above 21 years of age, please get in touch with Connecting India on +91-20-26333044. Their helpline operates from 2pm to 8pm and they also provide training to volunteers who qualify for the program.
If you are an NGO and are looking for a similar solution, do get in touch with us.
Our second iPhone application is now live at the App Store. We worked with Iterating on this one, and after a few months of hard work, it has finally reached the AppStore.
More details are available on the Iterating Blog and it can also be seen on the App Store.
Even though the app is free, the only catch is that you need to own a few vineyards to actually use this application!
We have been using SVN for a couple of years for all of our projects. Initially we were hosting them at Springloops.com for almost a year, when we decided to start hosting them on our own server.
It all sounded really good, till we realized that code reviews became a real problem. Springloops had a stunning interface to compare the diffs and get all the related information, which we really missed.
So we decided to use the post-commit hooks in SVN to email us as soon as a commit was made.
If you would like to implement the same for your server, here is a quick and dirty guide on how to do that.
First, the details about our server
# svn --version
svn, version 1.5.1 (r32289)
compiled Jul 31 2008, 09:45:20
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.10
Release: 8.10
Codename: intrepid
Okay, so let us get started. The first thing that you should know is that inside your repository, SVN creates a folder called hooks. This folder initially contains template files for all the hooks that can be called via SVN. The hook that we are after today, is called post-commit.tmpl
Since our language of preference is PHP, we decided to call a php script as soon as a commit was done on that repository. Here is how we did it
# cd /path/to/repo/hooks
# mv post-commit.tmpl post-commit
# chmod 755 post-commit
# vi post-commit
The post-commit file contains the following
#!/bin/sh
REPOS="$1"
REV="$2"
php /svn/scripts/postCommitHook.php $REPOS $REV
The above steps can also be automated by writing another php script which would copy all our hooks from a base directory into the respective directories in the repositories. Here is what our script looks like
$hooks_dir = '/svn/hooks/';
$repos_dir = '/svn/svn.localhost/';
$repo_hook_dir = $repos_dir . '__REPO__/hooks/';
if($hooks = opendir($hooks_dir)) {
while(($hook = readdir($hooks)) !== false) {
$unwanted = array('.', '..');
if(!in_array($hook, $unwanted)) {
if($repos = opendir($repos_dir)) {
while(($repo = readdir($repos)) !== false) {
if(!in_array($repo, $unwanted) && is_dir(repoPath($repo))) {
if(!copy($hooks_dir . $hook, repoPath($repo) . $hook)) {
echo "Could not copy " . $hooks_dir . $hook . " to " . repoPath($repo) . "\n";
}
if(!chmod(repoPath($repo) . $hook, 0755)) {
echo "Could not chmod " . repoPath($repo) . $repo . "\n";
}
}
}
closedir($hooks);
}
}
}
closedir($hooks);
}
function repoPath($repo) {
global $repo_hook_dir;
return str_replace('__REPO__', $repo, $repo_hook_dir);
}
Finally, we need to create the file postCommitHook.php which will find out all the relevant information and mail you the details. We have used svnlook and phpmailer to get all the information. Here is what our postCommitHook.php looks like
function getRepoName($repo) {
return strtoupper(str_replace('/', '', str_replace('/svn/svn.localhost/', '', $repo)));
}
require_once('phpmail/class.phpmailer.php');
$repository = isset($argv[1]) ? $argv[1] : '';
$revision = isset($argv[2]) ? $argv[2] : '';
$author = strtoupper(exec('svnlook author ' . $repository));
$changed = exec('svnlook changed ' . $repository);
$comments = exec('svnlook log ' . $repository);
$diff = '';
$fp = popen('svnlook diff ' . $repository, "r");
while(!feof($fp)) {
$diff .= fread($fp, 1024);
flush();
}
pclose($fp);
$body = "Hi,\n\n$author has just committed revision $revision in " . getRepoName($repository) . " and said \n\n$comments.\n\n\n\nThe following files have changed :\n\n$changed \n\n\n\nThe changelog is given below $diff";
$mail = new PHPMailer();
$mail->From = 'svn@localhost';
$mail->FromName = 'SVN Server';
$mail->AddAddress('repo.admin@localhost', 'Repo Admin');
$mail->Subject = 'SVN Commit - ' . getRepoName($repository) . ' - Revision ' . $revision;
$mail->Body = $body;
if(!$mail->Send()) {
echo "Error sending: " . $mail->ErrorInfo;;
}
And that is it!
Once the scripts are in place, just run copyHooks.php once and then whenever anybody commits on any of your repositories, you will get an elaborate email with the diff.
While iterating through the archives of Daring Fireball, I came across an interesting policy from the WebKit team.
The way to make a program faster is to never let it get slower.
We have a zero-tolerance policy for performance regressions. If a patch lands that regresses performance according to our benchmarks, then the person responsible must either back the patch out of the tree or drop everything immediately and fix the regression.
Common excuses people give when they regress performance are, “But the new way is cleaner!” or “The new way is more correct.” We don’t care. No performance regressions are allowed, regardless of the reason. There is no justification for regressing performance. None.
I hope someday the Firefox dev-team working on Linux also gets to fixing their performance issues. There is not one decent web browser for Linux and I don’t see any company coming out with anything interesting with it.