Migrating from Bzr to Git (Single branch)

We migrated the ChaloBEST Repository from bzr to git. While migration is not a rocket science any more and there are a lot of blogs and threads about this. This post is a simple step as how to and also as self note.

Step 1. Branch out your bzr repo.

<code> $ bzr branch "url to your bzr repo"</code>

Step 2.cd into your new branch and do the following

<code> $ git init </code>
<code> $ git remote add origin "url to git report" </code>
<code> $ bzr fast-export `something`|git fast-import</code>

Step 3. In case your original git repo is not empty, please do a

<code> $ git pull </code>

Step 4.  Now do a

<code>$ git reset --hard  HEAD</code>

Step 5. Now commit the changes using

<code> $git commit -m "some message"</code>

Step 6.  Push the changes

<code> $git push </code>

Here are some links that helps out with migrating both branches and master.

To the south, sir!

It has been sometime while playing with Django. One problem that I face mostly is making changes in the model and expect the change to reflect itself on the fly. Django, however does not like this idea and does not let you do so. In most case if you are making a model and want to create the DB schema you will do something like this:

python manage.py syncdb

This will create your model, however once created and then if you want to make changes in the schema, you are not going anywhere. So this is where we need to go south.
Django south generally works in this way:

python manage.py schemamigration <appname> --initial

Then you do a

python manage.py migrate <appname>

This is enough to create a migration directory and track changes to your model based in the appname you are using.
So now if you are making changes to the column, you will be using south. The next few lines will deal with screwing thing inside south as well as making you model change successful. One piece of caution though, this will/may delete your existing data, so be careful.
Let say, you end up with an error like this while migrating using south.

! These migrations are in the database but not on disk:
some migrations here
! I’m not trusting myself; either fix this yourself by fiddling
! with the south_migrationhistory table, or pass –delete-ghost-migrations
! to South to have it delete ALL of these records (this may not be good).

This happens because there is conflict in the original model and the model you are trying to implement.

The following steps will help:

Undo changes in the model.py intended to have the change and delete the migration folder in the folder, then run

python manage.py migrate <appname> --delete-ghost-migration

This step will delete all the migrations that has not trickled down properly.
If your app is already managed by south then run the next step, else if your app was previously managed by syncdb only, use this command first:

python manage.py convert_to_south <appname>

Coming back to our steps:


python manage.py schemamigration <appname> --init


python manage.py migrate <appname> --fake

The argument –fake will record the changes but will not write it to the DB.
Now redo the changes in the model.py

python manage.py schemamigration <appname> --auto

The argument –auto will keep track of the changes happening over the initial change/previous changes.

python manage.py migrate <appname>

And that’s it, you are done and your changes has flown to the DB.
Please read south documentation for more details, it can be found here.

API parsing with Backbone.js

The next part of the self note series, this time I have to parse JSON using backbone.js.
So in order to parse an API that returns result in JSON you can do the following(not necessarily the best way but it works for me)

(function($) {
var API_BASE = 'your url here';

var parser = Backbone.Model.extend({});

var apiColl = Backbone.Collection.extend({
model: parser,
url: 'form your url here'

});
var apiView = Backbone.View.extend({
el: $('#collection'),
initialize: function() {
_.bindAll(this, "render");
this.collection.bind("all", this.count);

},
render: function() {
$(this.el).html(this.counter = this.collection.length);
return this;

}
}),
events = new apiColl(),
eventView = new apiView({

collection: events

});
events.fetch({
success: function() {
console.log(events.length);
}
});
})(jQuery);

and yes, my ultimate target will be to parse the API and integrate with some open maps.

Even though Backbone’s code is pretty well explained, the main help if stuck comes from stack overflow. So really appreciate the help that I got.

GSOC 2011/OpenStreetMap/Projects

Like every year this years mentoring organizations for Google Summer of Code 2011 has been announced and OpenStreetMap is in this years list as well.

Now as a lot of cheap phones has the capability to click pictures in high resolution,make GPS traces,shoot videos and have a internet connection via WIFI/GPRS or mobile broadband connection. I would really love to see a mobile based OSM mapping application that can utilize this facility and able to do photo tag/Video tag with GPS traces,upload to OSM/Flickr/Youtube, create and edit basic maps.

The idea by Zhijie Shen is here. So in case if you are interested in developing such an application do get in touch with the OSM community.

Apart from this you can find a lot of interesting project ideas here.

Student application for GSOC 2011 starts from March 29th.

Mapping party in Kolkata_Aug 2009

On August 9th,2009(Sunday) we are having a mini mapping party in Sontoshpur/Jadavpur area of Kolkata.Its a 8hr mapping spree with socializing afterward.

Check http://wiki.openstreetmap.org/wiki/Kolkata_Mini_Mapping_Party_August_2009

So If you are in Kolkata at that time and have interest in OSM, Please do join the party

Fedora Activity Day@BCREC by dgplug

So finally the Fedora Activity Day which was supposed to be held during Horizon’09 in April was held over two in 14th and 15th May,2009. The reason was that horizon got canceled due to some reason.

Here is a complete jot down of the whole two day experience

Day 1 :

We started a little late.At around 12 noon because of the projector was not working laptops.With  audience size was around 30 we started.

Arindam started by introducing the fedora project to the students. he introduced the Four F’s of the fedora project along with the community as well. He in fact introduce all  bits of the project.

Next was Kishan and Me , we tried to bust most of the misconceptions about linux/fedora in general.

Next we decided to actually give the students a demo of what the busted few minutes ago. Debashree, Amrita, Arpita showed them inkscape and gimp. Rangeen, me and arindam showed them video and music in Fedora.Along with Rangeen showing them KDE 4.2 and it attracted attention. Every machine in the Lab was running FEL live cd since there was no persmission to install Fedora in those machines[:(].

Whole of this continued till 2:10 and we decided to take a break.

After break we continued, this time 15 more students from electronics and communication branch came and joined us.

We introduced IRC to students and gave them a brief demo of it.

Then Rangeen started with FEL. He introduced GNUSim8085 and Ktechlabs which attracted most interest. There was power cut and outside was cloudy, so it was dark. but somehow even with UPS ans trailing machines rangeen continued.After the UPS gave up. We formed small groups of 8-9 and used out 5 laptops to demonstrated FEL. The session went along over 2 hours.It was a comprehensive demonstration and was a good one.

Due to lack of power, we decided to call it a day and gained permission to continued over the next day.

Day 2 :

We started day 2 with Some basic commands by Harsh Verma (a new fedora ambassador from dgplug). He showed them efficiently. Even showed the use of man and info pages. Me and Arindam  helped Harsh with this session. We showed them chmod , file permissions and a word of caution”not to login as root in GUI”.

The next session was vi by Dibyanshu. He gave a very good session on vi and showed most of the cool stuffs. I, personally liked the session very much.This guy is very new to dgplug but is showing great enthusiasm.

We took a break of 20 min and returned . Ratnadeep started with his GCC session. We decided to take on small assignments and started doing them using GCC. Ratnadeep did gave a comphensive demo of GCC and did well. Arindam decided to help them using Anjuta IDE and the same assignments were done using that.

This went till almost 5pm, power went out again. But I took my java session in my laptop. Showed them openjdk, the difference between openjdk and sun jdk. And how to install sun jdk in fedora using alternatives. This went on till 5:45pm and decided to call it a day.

The feedback was good. event though number of audince was less but it showed enthusiasm. Hope to get good contributors from this pack. There will be a post FAD session after the semester exams to keep nurturing this enthusiasm.

Over and all the session was successful and a good one.

With this session we  gained permission to install fedora in a machine. And me and Arindam decided to use this as a local mirror for the labs and students. Need to sort out some techical difficulties though. It currently behaves like a mirror in a box.More on this soon.

My cam’s battery gave up in mid ways so didnt clicked much , anyways pics are here :