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 :

Past few days (including mukti09)

Last few days were hectic to me as there was lot of things that was happening around me .

6th Feb : It was Mukti 09 day ,  a national level tech fest on opensource at NIT Durgapur . Me and Arindam had to do a talk cum workshop there .Our Pre Mukti talk was canceled due to bandh and got 3 hr slot , It was scheduled at 5:00 PM .

However we decided to go a little earlier because we along with Indranil Das Gupta and Yu Yu Din were suppose to go and visit Bijra High School .It was at around  12:30 PM when we reached there ,met with Indranil Das Gupta and Yu Yu Din and started for Bijra ,but before we left the campus we called Pradeepto and took him too .At around 1:51 PM Debayan called us up  for setup at fedora stall as they are lacking volunteers but we were already on our way to Bijra .

In Bijra , there were lots of stuff that were happening , Bijra school is getting lot of aids from different section of society and they are utlizing it for a good cause .Both Yu Yu and Pradeepto liked it very much . and lot more things were discussed .

We returned to NIT campus at around 4:30 PM and headed toward IT department where our ” A day with fedora ” were suppose to be done .We started a 30 min  late at around 5:35 PM .Satya came along but she was too tired as she just finished a talk .

There were some 50+ DVD’s that were distributed along with registration kits , I asked Debayan for 15 more DVD’s to distribute in the event just as we were on the start , Nevertheless we started with Arindam’s introductory talk on “Introduction to Fedora” , He had some cool slides where  he showed ” Freedom | Friends | Features | First ” of fedora project .He also showed some cool videos like ‘Truth Happens ‘ , A video showing new features of F10 ,starring stickster and gergdek .Next was my turn , I gave talk on “Myths about Linux ,Busted with fedora ” where i showed basic misconceptions on usage of Linux . A video on ” Why fedora ” by gregdek is shown along with the talk .

Finally we conducted a small workshop on ” How to create bootable live usb for easy use ”  . The local mirror of NIT was b0rked and Debayan mailed us regarding that a day before , anyways we continued with as much we can , and finally got 8 machine getting all that we need . Arindam hosted his local FTP server so that people find it easier to download .The workshop went alone and was quite successful .We faced a lot of questions , a guy from NIT agartala said the workshop was useful as  he can now got a solution to their connectivity problems . Finally we ended with the “Choice” video .

We had dinner there and finally returned home at around midnight .

7th Feb : Me along with Arindam ,Indranil Das Gupta and Yu Yu Din boarded the 6:14 AM train and went to Kolkata where IDG had to give talk . We went to IDG’s office and waited and finally went to Science City where talks were held . M Arulraj gave a talk on Open GIS . IDG gave his talk , I don’t remember the tittle of talk though . and one talk was on FOSS in bio informatics by Mr. Sudip Kundu .

Finally we all went to kafuluk at china town and had our lunch cum dinner there ./me and Arindam went to my house at sontosepur .

8th Feb : Woke up early and came back to Durgapur by taking 7:30 AM bus . It was “brigade cholo ” day , the bus we took was the last bus available as most buses were hijacked to bring in people . Reached Durgapur at around 10:30 AM and went back to NIT Durgapur at around 12 noon , On way to IDG’s talk ,we went where stalls were hosted , apart from Dominos and CCD rest were empty .IDG’s talk on “Indian FOSS Community was superb ” and at it was the last talk of mukti 09 .

NIT Lug guys did a superb organizational effort to bring up such a event and overall it was awesome to see so much participation .

Fedora Event pics are here .

Random Scriblings

Theres quite lot to  say :

1. Gave one more talk on OSM at mukti 09

2. Visited Kolkata Book Fair and help folks at IOTA stall .It was awesome .Detailed blog coming up

3. Fedora talk at mukti 09 on 6th .Event page up (need suggestions)

4.Visited bijra today and had lot of feedback (complaints) from them .

5. Got a lit of petrol almost decades after recent price cut for RS 50.

6. Harman Baweja still cant act .

7. Sign of twitter becoming mainstream in India .Read here.

First Barcamp and Tweetup at Kolkata

At last kolkata got its way to barcamp and tweetup , Though situation of the city made its presence on the people attending the barcamp.

I reached barcamp venue at IITKGP EXT center at around 10:15 AM .The preparation were still going on , However people started coming only after 11 . However organiser decided to wait for a little long for some more people to come up .

At around 11:30 AM things started , Sessions were superb , the timeline can be found here .

I did a session named “fun with JOSM” in which i introduced OpenStreetMap and JOSM and it did  earned some attention .

Some of the interesting session were by Shwetank Dixit , Amitabh Choudhary,YuYu Din,etc .

At around 6Pm things packed up .

on the note : IIT KGP guys did a good organising on there part ,wifi were working ,and food was good .

The Barcamp twitter followup can be found under hashtag #bckol ,

And hey #bckol is a trend in twitter : see here .

After Barcamp we decided to had a tweetup , There was a little confusion over the place but we decided to move to Mani Square for the Tweetup .There were seven people ,@subhodip,@aritra_m ,@indradg,@imba ,@epandu ,@yuyudin and @tathagata .

The tweetup followup can be searched under hashtag #tweetupkol

Indradg wasnt a twitter user but after the tweetup he is :)

The tweetup was superb as we come to know many people and it was fun .

Group Photo

So , The barcamp has finally started in kolkata and its our turn to keep the momentum up .

Fedora on mac ..rocks

It has been two months since i bought my macbook .I mostly use my desktop for daily work and mac OSX was serving me well . However due to need i started setting fedora on my mac . Arindam did that previously and his fedora installation was fine .

After installation , i found that apart from common issues like wifi and touchpad , sound was missing as well .

So decided on a google search ,which reaveled some post from forums . I tried them and everythings is working good .

Here is a small compilation of those methods .

1. Wifi and sound

these four are needed

kmod-ndiswrapper-1.52-30.lvn9.i686.rpm
kmod-ndiswrapper-2.6.25-14.fc9.i686-1.52-30.lvn9.i686.rpm
ndiswrapper-1.52-1.lvn9.i386.rpm
R151517.EXE

P.S : Well , rpmfusion.org is finally here and all these packages are transferred to rpmfusion.org . Please use

yum install rpmfusion-free-release rpmfusion-nonfree-release

and search for above packages . Plus with rpmfusion its better for updating .

Thanks to Thorsten for pointing me out .

now

mkdir wifidriver
unzip -a R151517.EXE -d wifidriver/
cd wifidriver/DRIVER/
su
# install ndiswrapper and the wifi driver
rpm -Uhv *ndiswrapper*rpm && rm -i *ndiswrapper*rpm
/sbin/modprobe ndiswrapper
ndiswrapper -i bcmwl5.inf && rm -rf wifidriver && rm -i R151517.EXE
echo "options snd_hda_intel model=mbp3" >> /etc/modprobe.d/soundcard
echo "blacklist bcm43xx" >> /etc/modprobe.d/blacklist
echo "blacklist ssb" >> /etc/modprobe.d/blacklist
echo "blacklist b43" >> /etc/modprobe.d/blacklist
# ndiswrapper is used for wlan0
echo "modprobe ndiswrapper" >> /etc/rc.d/rc.local
echo "alias wlan0 ndiswrapper" >> /etc/modprobe.d/ndiswrapper
/sbin/service NetworkManager restart

and reboot the mac .

Pommed helps in  controling the LED and keyboard backlight, soundcard, infrared remote and more. :

wget http://downloads.diffingo.com/diffingo-repo/diffingo.repo -O \
/etc/yum.repos.d/diffingo.repo
yum install pommed

pommed starts as a startup service .

For touchpad its synaptic that comes to the rescue .
The xorg.conf as of my machine is here :xorgconf




However after an update to 2.6.26-6 kernel , and subsequent update of ndiswrapper , even though wireless was working ,my sound got muted in kde  which was fixed soon .
And on KDE4, a red light appears from the headphone jack . It indicates that digital audio got enabled instead of analog .This happens if IEC958 module gets enabled . So sometimes it ignores a headphone plugged it . 
It can be switched off by :

 volume control > switches > IEC958 (dechecked ) . 

or It can be reset with a toothpick though if it remains on even while using mac osx ,better to do a google search for this or post in a mac forum 
Enjoying my mac :p