Monday, May 23, 2011

C# library for accessing the REST APIs exposed by Redmine

I created a C# library for accessing the REST APIs exposed by Redmine, this is available at GitHub.

Here is some sample code to dump the first 100 issues of a project using this library.

RedmineClient rc = new RedmineClient("127.0.0.1", 80, "redmine", false, "api_key");
Projects projects = rc.getProjects(true);

// get all issues for project "test"
Issues issues = rc.getIssues(projects.getProjectByIdentifier("test"), 0);
issues.dump(project.name);

This library makes use of XmlSerializer to automatically translate C# objects to XML and XML to C# objects.

Friday, May 13, 2011

Charting the CPI-U since 1913 for USA

If you plot the chart for inflation data from 1913 to 2011 Apr, you would think that inflation is rampant and growing very fast as seen below.


Now take the same chart and make the Y axis logarithmic and you see that actually inflation is well under control since 1982.
ftp://ftp.bls.gov/pub/special.requests/cpi/cpiai.txt

Wednesday, March 30, 2011

Restarting Redmine without restarting Apache

If you are using Redmine with passenger, then you can use the following command.

$ sudo touch /usr/share/redmine/tmp/restart.txt

If the above file does not exist, then create it first and then touch it

$ cd /usr/share/redmine
$ sudo mkdir tmp
$ sudo bash

$ cd tmp
# echo restart > restart.txt
# exit
$ sudo touch /usr/share/redmine/tmp/restart.txt

Thursday, March 17, 2011

Installing Codelite on Ubuntu 10.04

Installing packages needed for Codelite

$ sudo apt-get install libwxgtk2.8-dev
$ sudo apt-get install libgtk2.0-dev


Downloading, building and installing Codelite

$ svn co https://codelite.svn.sourceforge.net/svnroot/codelite/trunk codelite
$ cd codelite/
$ ./configure
$ make
$ sudo make install

Wednesday, March 16, 2011

Configuring Redmine to use Gmail for Mail Delivery on Ubuntu

Configure Redmine for GMail

Create a "/etc/redmine/default/email.yml" file for your configuration as shown below.


production:
  delivery_method: :smtp

sendmail_settings:
    tls: true
    enable_starttls_auto: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "gmail.com"
    authentication: :plain
    user_name: "username@gmail.com"
    password: "password"


Redmine can also read incoming email on this account to apply comments to existing issues as well as create new issues. For this, you must configure a cron job to run the following command.


rake -f /usr/share/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com port=993 ssl=true username=username@gmail.com password=password

Friday, March 4, 2011

Configuring Bugzilla to use Gmail for Mail Delivery

The mail delivery method for your Bugzilla installation can be configured to send mails out using Gmail

Install Perl module for Gmail

$ sudo /usr/bin/perl -MCPAN -e 'install "Email::Send::Gmail"'


Once this module has been installed, logout from Bugzilla and login with your administrator password.

You should see "Gmail" as one of the drop down options in the "mail_delivery_method" in the Email administration page for Bugzilla.

Set the following parameters.

smtpserver : smtp.gmail.com
mailfrom : username@gmail.com
smtp_username : username@gmail.com
smtp_password : password


Save these changes.

Changes to Mailer.pm

$ sudo gedit /var/www/bugzilla/Bugzilla/Mailer.pm

Change the following line
    if ($method eq "SMTP") {
to
    if (($method eq "SMTP") || ($method eq "Gmail")) {


Now your emails from Bugzilla are configured to be delivered via the Gmail account that you setup.

Installing Bugzilla 4.0 on Ubuntu 10.04 with MySQL

These are quick steps to install Bugzilla 4.0 on Ubuntu 10.04, you can refer to The Official Bugzilla Docs for detailed steps if needed.

Install Perl

Check the version of Perl you have installed on your machine.
 
$ perl -v

Bugzilla runs with Perl 5.8.1 or higher. If you don't have Perl installed on your machine, install it.

$ sudo apt-get install perl

Install MySQL

Check the version of MySQL you have installed on your machine.

$ mysql --version

Bugzilla runs with MySQL 4.1.2 or higher. If you don't have MySQL installed on your machine, install it.

$ sudo apt-get install mysql-admin mysql-client mysql-server

Install Apache

Check if Apache web server is already installed.

$ apache2 -v

If you don't have Apache installed already, install it.

$ sudo apt-get install apache2

Download Bugzilla Tarball

Download the latest 4.0 tarball from the Bugzilla site into your download directory.

$ cd ~/Downloads
$ wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.0.tar.gz
$ sudo tar -xvf bugzilla-4.0.tar.gz


Move the Bugzilla directory to the default web server directory.

$ cd /var/www/
$ sudo mv /home/build03/Downloads/bugzilla-4.0 bugzilla


Install Perl modules needed for Bugzilla

Check if you have all the Perl modules required for Bugzilla. It is a good idea to install all the required as well as the optional modules.

$ cd /var/www/bugzilla/
$ sudo ./checksetup.pl --check-modules


A lot of the Perl modules might be missing, first try to install all of them in one command

$ sudo /usr/bin/perl install-module.pl --all


Run the check setup script again to see which modules still need to be installed.

$ sudo ./checksetup.pl --check-modules


Install mod_perl & Apache2::SizeLimit modules if they did not get installed.

$ sudo apt-get install libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-mod-perl2-doc
$ sudo /usr/bin/perl install-module.pl Apache2::SizeLimit


Once all the Perl modules have been installed, run checksetup.pl again, this time without the --check-modules switch, this will create a file called "localconfig".

$ sudo ./checksetup.pl


Check the /etc/apache2/envvars file for the value of APACHE_RUN_GROUP and set the webservergroup to that value.

$ sudo gedit localconfig
 

Change the following properties to
 

$webservergroup = 'www-data';
$db_pass = 'your password for bugs@localhost';


Create a User for Bugzilla for MySQL Access

Add the new user bugs@localhost with the same password that you entered in the localconfig file above.

$ sudo useradd -d /home/bugs -m bugs
$ sudo passwd bugs


Create the bugs database

The bugs database will be used by the 4.0 installation of Bugzilla.

$ sudo mysql -u root -p
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bugzilla3          |
| mysql              |
+--------------------+
3 rows in set (0.02 sec)

mysql> create database bugs;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bugs               |
| bugzilla3          |
| mysql              |
+--------------------+
4 rows in set (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY 'your password for bugs@localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye


Setup the Administrative User for Bugzilla

Rerun checksetup.pl. It reconfirms that all the modules are present, and notices the altered localconfig file, which it assumes you have edited to your satisfaction. It compiles the UI templates, connects to the database using the 'bugs' user you created and the password you defined, and creates the 'bugs' database and the tables therein.

If all goes well, it will ask you for an email for the Bugzilla Administrator account and the password for that account.

Configure Apache to server Bugzilla

Navigate to the Apache directory and edit the httpd.conf file

$ cd /etc/apache2/
$ sudo gedit httpd.conf


Add the following to the httpd.conf

<Directory "/var/www/bugzilla">
AddHandler cgi-script cgi
DirectoryIndex index.cgi
Options +Indexes +ExecCGI -MultiViews +SymLinksIfOwnerMatch +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>


Restart Apache web server.

$ sudo /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 start


Browse to http://localhost/bugzilla Your Bugzilla instance should be running now.


Login with the Bugzilla Administrator credentials that you setup earlier and configure your Bugzilla instance.