Blog

Hello and welcome to my blog, which will deal with programming and other silly hobbies of mine.

This page has a feed that you can track (if you use Firefox, you may see the feed icon in the location bar)

Trip

by hrjhrj 1255845433|%O ago (%e %b %Y, %H:%M %Z)

As trekkers, in what seems like another lifetime, my wife and I had been eager to go out on a trip/trek for the last 2 years. We were also eager to take our year-old kid along, and so we had to strike a good balance between fun, comfort & safety.

The sunny day started on a lazy note. We had planned to start at 7am, but the taxi arrived much later, and we waved our good-byes only at 8am. By this time we were feeling hungry and had to stop for breakfast. After nibbling on Poori-bhaji, Upma and Idli-wada in the The New Grand hotel, we steered into the Pune-Bangalore highway.

Our first halt was at the Hidkal dam, constructed on the Ghataprabha, a tributary of the Krishna. The actual dam was not visible because of recent restrictions to visitors, but the view of the catchment area was nice. The circuit house has a largish 3D model of North Karnataka terrain, including Malaprabha, Ghataprabha, Krishna and the several dams constructed on them.

We next went to Gokak falls. This was supposed to be the highlight of the trip, but the water flow wasn't at its heaviest. We did have some fun while crossing the hanging bridge on top of the falls and clambering down to the waterfall edge.

The young one was enjoying the trip, but the heat had exhausted us and the music playing in the taxi had a mildly nauseating effect. We hadn't much hope left on our next destination, Hooli, a remote little village near Saundatti. This was a complete blind shot, based only on Uday's blog post.

Given our weak spirits, the PanchlIngEshwara temple in Hooli was a pleasant surprise. It was pretty well maintained by the Archaeological department. The person in charge of maintenance told us that this site seemed like a former Jain-basathi which was converted into a Shiva temple by establishing 5 Shiva-lingams there. There was a shed in the temple premises which was used as a temporary godown for artefacts. Apparently, these were found in the site vicinity by villagers when they dug the ground for construction. There are many other ruins nearby but he advised us not to go there as they weren't being maintained as well as this one.

Our next destination was the Kittur fort. The road from Hooli to Kittur was terrible, the driver was cursing and it was 7.30pm by the time we reached Kittur. The late time of our arrival turned out to be a boon in disguise; there were very few visitors there and we got a special favour from the museum maintainer. There was this new collection of antique armour and weaponry which had been brought to the museum, but wasn't on display yet. We got to not only look at them but also brandished the swords, maces, shields and other devices of violence. Some of the sculptures in the museum were dated circa 2AD and were enticing to watch.

We couldn't see the actual fort because it was too dark to take the kid along.

We took the highway back to Belgaum and were in time for dinner, after a day well spent.

tags:

Launching Twinkler.in

by hrjhrj 1255753625|%O ago (%e %b %Y, %H:%M %Z)

If you are a Twitter user, do checkout Twinkler.in

It's my newest pet project, a dynamic visualisation of Twitter contacts. There also suggestions offered about new contacts which might be of interest to you.

Screenshot

snapshot.png

tags:

Pythagoras Tree

by hrjhrj 1243779909|%O ago (%e %b %Y, %H:%M %Z)

While casually browsing the net I came across this implementation of Pythagoras tree in F#. Just for fun, I have recreated this in Scala.

The Pythagoras Tree is a fractal constructed by geometric methods. It is rather easy to program since no substitution is involved. You can just pile on the newly created squares onto the existing ones, since they don't overlap immediately.

Eye candy

Here is the output of my Scala script:

Depth=10, No Skew

tree10.png

Depth=14, Skew = 0.8

tree14.png

The source code

Conclusion

This script is a bit more configurable than the F# one linked above, and hence is a bit more lengthy. I was quite happy with the script and the end result.

tags: fun pythagoras scala script tree

Launching UpRoot.in

by hrjhrj 1243188072|%O ago (%e %b %Y, %H:%M %Z)

uprootinLogo.png

After several weeks of development and alpha testing by friends and family, we are releasing a stable version of a website I have been working on recently.

Ladies and gentlemen, please point your browsers to
http://uproot.in

What is UpRoot.in ?

A simple website to post classifieds online for free. It has been exclusively created for Indian users, and covers all districts in the country (600+).

Everything about the site is geared towards simplicity, including:

  • the look — very few graphics + dynamic interface
  • the operational model — zero intervention between seller and buyer is our policy.

What is it not ?

While making the site, one path we have not treaded (nor intend to tread) is social networking. We will likely add more features in the future to facilitate collaboration between groups of users. But we don't expect it to become a core feature of the site.

The reason is — to keep things simple for everyone, especially novice internet users.

A brief walk-through of UpRoot.in

Here are some of the features of UpRoot.in

Categories

category.png

Every Ad has to be given a category at creation. This helps viewers to easily find what they need.

Ads that offer and Ads that want

adType.png

Broadly speaking, every Ad has either something to offer to the viewer, or wants something from the viewer. This too is specified at creation time of the Ad, and helps viewers to find exactly what they need.

Specifying the location

location.png

Viewers can choose to filter their Ads

  • by city
  • or by state

They may also see results for All Locations in India.

Privacy

reply.png

We are very concerned about the privacy of users of our site.

There is a built-in method to contact users, without needing to divulge either the seller's or buyer's contact information until each party voluntarily chooses to do so.

Membership

While viewing the website is possible for all, membership is needed to post a new Ad.

Membership is free, and to become a member you just need to confirm your email address and choose a profile-name.

Stay tuned

Thanks for reading through!

Please use the site whenever you need to buy / sell anything, and send us your feedback!

We will stay tuned :)

tags:

Howto Redmine on Fedora with Postgresql DB

by hrjhrj 1242554081|%O ago (%e %b %Y, %H:%M %Z)

Motivation

I have been using Trac for my last two projects. It works mostly as expected and the integration of Wiki+Ticketing+Subversion saves a lot of time. I have been fairly satisfied with it.

Satisfied, that is, until now.

As our projects started growing, it became tedious to install and use a different version of Trac for every new project.

So, I decided to try out Redmine, which is an application very similar to Trac, but boasts of several more features, prominent among them being:

  • Support for multiple projects
  • Role based access system
  • Project Scheduling (Gantt charts, etc)
  • Ajax interface

The catch: It is written in Ruby, and most distributions don't have ready-made bundles for it (Redmine).

Nevertheless, I decided I would be brave and go where all wise men have been before. To search on Google.com. The search yielded an excellent tutorial

The Howto

The Howto linked above was written for CentOs5 / RHEL5, but I found it equally valid on Fedora Core 10. Further, that Howto suggests the use of MySQL, but I altered some steps to make it work for Postgresql DB.

Here is the modified version.

Notes

  • This HOWTO is written for Fedora core 10 (might also work on CentOS and RHEL)
  • Replace [FQDN] with either your IP address or the hostname (or FQDN) which you’ll be using to access the interface.
  • Replace [user] with the username under whose home directory the Subversion repository database will be located. e.g. /home/[user]/svn-repos
  • This HOWTO will make the following assumptions:
    • You already have the “httpd” (apache) package installed
    • You will be running apache as the user ‘apache’
    • The subversion repository root folder will be under /home/[user]/subversion/
    • The vhost’s folder locationg will be /var/www/svn
    • The subversion repository to be created will be called ‘example-repo’

Install and setup Subversion

Strictly speaking, this step is optional, since many features of Redmine don't require integration with an SCM. However, I am assuming that in most cases, users would want SCM integration.

yum install mod_dav_svn subversion

Add the group [user] to the user apache and make the subversion base URL readable and writable…

usermod -aG [user] apache
chmod g+x /home/[user]
mkdir /home/[user]/subversion
chmod g+rwx /home/[user]/subversion
chown -R [user]:[user] /home/[user]/subversion

Make the web directory:

mkdir /var/www/svn
chown apache.apache /var/www/svn

Put the following into /etc/httpd/conf.d/svn.conf (this is for a subversion repository called ‘example-repo’)

NameVirtualHost *:80
<VirtualHost *:80>
        DocumentRoot "/var/www/svn"
        ServerName [FQDN]
        <Location /example-repo>
                DAV svn
                SVNPath /home/[user]/subversion/example-repo
                AuthType Basic
                AuthName "Subversion repo"
                AuthUserFile /var/www/passwd
                Require valid-user
        </Location>

        <Directory "/var/www/svn">
        allow from all
        Options +Indexes
        </Directory>
</VirtualHost>

Add an HTTP auth user…

htpasswd -cm /var/www/passwd [user]

Create a proper SVN repository

cd /home/[user]/subversion
su [user] -c "svnadmin create example-repo"

(This creates a blank repository, which is enough for the purpose of this tutorial)

Install Ruby on Rails

Let’s get Ruby up and running first. The original Howto recommends disabling SELinux.

yum install httpd httpd-devel apr make gcc-c++ postgresql postgresql-server ruby-postgres ruby ruby-devel ruby-docs ruby-ri \
ruby-libs ruby-mode ruby-tcltk ruby-irb ruby-rdoc fcgi fcgi-devel mod_fcgid rubygems subversion-ruby

Now we’ll install passenger (aka mod_rails)

gem install passenger
passenger-install-apache2-module

Create and insert this text into /etc/httpd/conf.d/rails.conf (or alternatively edit the existing svn.conf created when we set up subversion)

The below configuration is specific to the installation of redmine (hence the DocumentRoot)

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
   PassengerRuby /usr/bin/ruby

NameVirtualHost *:80

   <VirtualHost *:80>
     ServerName 192.168.10.17
     DocumentRoot /var/www/rails/redmine/public
   </VirtualHost>

Now on to Redmine itself

Get Redmine 0.8.x from here

Assuming you downloaded the Redmine package into ~/Dowload/redmin-0.8.x.tar.gz

mkdir /var/www/rails/
cd /var/www/rails/
tar xzf ~/Download/redmine-0.8.x.tar.gz
mv redmine-0.8.x redmine
chown -R apache.apache redmine
cd redmine

If this is the first time you have installed Postgresql, initialise the database:

service postgresql initdb

You should now setup the password for user 'postgres'. The exact steps depend on how you want to setup authentication. I found this link useful.

Now start postgresql

service postgresql restart

Before proceeding, check if you are able to login to postgres server with user-name=postgres and your chosen password.

psql -U postgres

Now, create a database for redmine:

psql -U postgres
create database redmine;
create user redmine;
grant all on database redmine to redmine;
alter user redmine with password 'red';
\q

Copy the example database file to the “live” location

cd /var/www/rails/redmine
cp config/database.yml.example config/database.yml

Enter the appropriate settings for the [production] section ensuring that host is set to 127.0.0.1

vim /var/www/rails/redmine/config/database.yml

Set up email

cd /var/www/rails/redmine
cp config/email.yml.example config/email.yml

Enter the appropriate settings for the [production] section ensuring that “address” is set to the IP address of the SMTP host
vim /var/www/rails/redmine/config/email.yml

Install rails and postgresql connector for redmine using gem…

cd /var/www/rails/redmine/app/
gem install -v=2.1.2 rails
gem install activerecord-postgresql-adapter

Import the redmine database into the live database specified in the above config file

cd /var/www/rails/redmine/app/
rake db:migrate RAILS_ENV="production"

Install default configuration data in database (this is entirely optional, but recommended).

cd /var/www/rails/redmine/app/
rake redmine:load_default_data RAILS_ENV="production"

Bring up the testing webserver, once loaded check your config by browsing to http://[FQDN]:3000
cd /var/www/rails/redmine/
ruby script/server -e production

Make sure your apache config file edits are ok and that the services will start at boot by doing:

service httpd configtest
service httpd restart
chkconfig httpd on
chkconfig mysqld on

Taking Backups (entirely optional)

Add the following to your crontab which will create a database backup in the /home/[user] directory

pg_dump -i -h 127.0.0.1 -p 5432 -U postgres --format=plain -C -D -v "redmine" | gzip > /home/[user]/redmine_`date +%y_%m_%d`.gz

Email using Gmail and other secure servers

Out of the box, Redmine doesn't support Gmail's SMTP server (or any other secure SMTP server with TLS).

A workaround is here.

I am paraphrasing those tips here.

Install the action_mailer_optional_tls plugin

The action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.

To install this plugin, use the script/plugin command in your Redmine directory:

cd /var/www/rails/redmine/
ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

If you don't have GIT, don't fret:

cd /var/www/rails/redmine/
./script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls

Configure your email.yml

It should now look something like this (note the tls and authentication options)

# File: config/email.yml
production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "smtp.gmail.com"
    authentication: :plain
    user_name: "your_email@gmail.com"
    password: "your_password"

That's it. You are done. Congratulations!

Do let me know via comments, how it worked for you.

tags: fedora howto postgresql redmine trac

Laptop Hard disks are (gonna be) seriously broken

by hrjhrj 1240501040|%O ago (%e %b %Y, %H:%M %Z)

This is a rather technical post; non-techy readers can skip/skim. Also, my knowledge might be half-baked, since I haven't RTFC; just culled the info from mailing lists. You have been warned!

Power saving

It all started with a simple wish: to save power on a server system I am building, by spinning down the HDD when the server has a prolonged idle time.

A quick googling revealed that "hdparm -S" was my friend. It helps set a timeout parameter for the disk to spin down and thus save power. So, I quickly setup a bootup script which does this, and that would have been the end of it, had it worked as expected.

Paradox

I observed that the option does work for very small timeouts (5 to 10 seconds). But beyond that there is always some activity happening in the system that prevents the disk from spinning down, which was evidently a software configuration problem.

So, I started digging more on this topic, and figured a couple of tools to help pin down what are the exact applications that cause this background activity. (See for example, the Spinup Debugging section here)

But that is a different story. The real story is that I learnt that frequent spinning down was actually bad for the disk, and it was happening by default, without user intervention, on most Linux (and possibly Windoze) systems, on most Hard Drives !!!

The problem

Frequent spin ups & spin downs are bad because they cause wear & tear of the disk head mechanism, which is more than the wear & tear that happens while the disk is spinning.

Some numbers

To find out how many times the drives has been loaded (and hence spun up/down), use the smartctl command:

smartctl  --all /dev/sda | grep Load_Cycle

On my laptop the output was,

smartctl  --all /dev/sda | grep Load_Cycle
193 Load_Cycle_Count        0x0012   066   066   000    Old_age   Always       -       343830

The last number, 343830, gives the number of times my HDD was loaded, and that's a huge number given that it is only 1.5 years old. Typical maximum loads for a laptop HDD are about 600k.

The power on time for my disk is

smartctl  --all /dev/sda | grep Hour
  9 Power_On_Hours          0x0012   093   093   000    Old_age   Always       -       3409

What gives..

The official answer is on the known issues page of the Linux ATA driver website. But this is a rather conservative assessment, IMO.

From my own experience and from what I have seen on various forums, there are many users with various different HDD makes, that are affected by this problem.

The cause for this high number of disk loads, AFAICT, is that most laptop HDDs have factory defaults that maximise power savings (to give longer battery life times). The aggressive power saving settings, however, cause frequent spin downs. And most linux distributions (and perhaps Windozers) don't change the factory settings unless instructed (which is a wise decision IMO).

The ways for avoiding this are also poorly documented.

The end result is that, by default most laptop disks could wear out in about 3 years of regular use.

Possible Solution

One way to reduce the frequency of HDD loads is to use the "hdparm -B" option. A high number for the parameters value will tend to reduce the number of spin downs (and also consequently increase power consumption).

The exact way to do this on your distribution may vary. On my Fedora Box, I modified "/etc/rc.local" and stuck in this:

# prevent aggressive power management (-B 254)
# set spin down timeout to 30 minutes of idle time (-S 241)
hdparm -B 254 -S 241 /dev/sda

This has certainly reduced the number of spin downs for me.

Do let me know via comments if it works for you too.

tags: broken hdd laptop linux technology

Firing up Focault

by hrjhrj 1238307816|%O ago (%e %b %Y, %H:%M %Z)

I finally got off my lazy hind and built a Focault tester.

The mirror holder was the only new thing I had to build. I had a slit and knife edge ready from a previous attempt.

After gazing at the myriad plywood pieces lying around in my balcony, I hit upon an innovative design for the mirror holder. The triangle pieces cut-off for the Dobsonian cradle came in very handy.

29032009473.jpg25032009469.jpg

The actual Focault test was fun too. Here is a view of the image, with the 50% region at null.

focault_28March09.png

With explanations:

focault_28MarchExplain.png

Both the turned-down edge and the central hill don't bother me too much. I have some mirron-on-top polishing to do which should even out those areas.

What really bothers me is the number of scratch marks my mirror is accumulating due to prolonged polishing :(

Anywho, the focault test is a good guide for knowing when to stop polishing!

tags: focault telescope

lolcatz: Ish more coming?

by hrjhrj 1233633780|%O ago (%e %b %Y, %H:%M %Z)

funny-pictures-cat-will-kill-dog.jpg

've been tripping on lolcats these last few days. I Can Has Cheezburger is the perfect way to unwind after a tiring day.

I wonder how this lolcatz movement originated. The wikipedia article doesn't pin it down; just describes it as a parody of internet grammar (or rather the lack of it).

But I have seen something similar in Terry Pratchett's novels. For example, in Moving Pictures (1990) when a bunch of animals, who happen to be on the magical hills of 'Holy-Wood' suddenly start speaking English. The entire scene is gut-aching hillarious. And the cats speak exactly like these lolcatz!

tags:

Fun With Inkscape

by hrjhrj 1231955255|%O ago (%e %b %Y, %H:%M %Z)

A fun image done with inkscape.
Squint your eyes or stand away from the screen (or simply remove your specs, if you are myopic like me) to see the author of this blog.

fun.png

tags: art fun

Winstone : A minimal servlet container

by hrjhrj 1231759943|%O ago (%e %b %Y, %H:%M %Z)

When I am learning something new, I like to start with basic, simple tools and ideas. When learning servlets, I was quite intimidated by the size of Tomcat and Jetty containers (both the download size and the number of configuration options).

By contrast Winstone's design goal is to be simple and minimal, and it lives up to its promise. The download is about 150kb and I had configured and used it within a few seconds.

Compare that with

  • Tomcat 7Mb
  • Jetty 24Mb

Before you start using it, some caveats:

  • Given Winstone's design goals, there are some limitations in its feature list, and they are listed very diligently on its homepage.
  • The lastest release date is Jan 2008. That either means that the product has matured enough not to require updates, or that development has stalled.

tags: servlet web

page 1 of 3123next »

Add a new comment
page_revision: 4, last_edited: 1238135193|%e %b %Y, %H:%M %Z (%O ago)