After a break

It has been long time since I blogged last. Well, partly because now a days one liner in social networking takes most of the bandwidth and mostly because my job role now demands lot of hours. It is kind of exciting to work where there is full freedom to decide what kind of software stack to use, how to design and finally code something that people actually use.  

This also means that in almost last 10 months I haven’t done anything with my photography or pending projects, which is shameful.

I hope to take some time out and finish long pending projects et.al. 

Droid/Tux/Web

A close friend of mine bought an android phone.However much of her excitement went down the drain when she was unable to connect to the internet using her ad hoc sharing of Ethernet.

if you are in a similar situation and use linux/fedora and wanted to connect to the internet, here is a small way of doing so. If you use windows 7+ however, you can use an application called connectify. :

Step 1.

$sudo yum install hostapd

Step 2.
Configure hostapd with few lines, there are many options feel free to explore

interface=wlan0
hw_mode=g
channel=6
ssid=Yourssidhere

macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=yourssidpasshere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Step 3.
Stop the hostapd service if it is running:

$sudo service hostapd stop

or

$sudo systemctl stop hostapd.service

Step 4.
Go to your network manager, wireless and turn on the hotspot.
Step 5.
Restart the hosapd service

$sudo service hostapd start

or

$sudo systemctl start hostapd.service

Done

There is a better way of doing this with bridge-utils, dnsmasq, and hostapd, I will blog about that later.

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.

Ouch! My Bad

JavaScript is powerful and Backbone.js is a nice small utility that makes it even more powerful. I was playing with Backbone and Open layers thrown over a Django system.
However there is something weird that I faced and took a good amount of my time to figure out the problem.
This blog post is kind of self note so that I notice this the first place when I face such problem again.

What was I trying to do : Write a small backbone code to display Open layers(OSM) Map.
How was I trying to do :

(function($) {
var Map = Backbone.Model.extend({});

var MapView = Backbone.View.extend({

initialize: function() {
_.bindAll(this, 'initMap');
this.initMap();
},

initMap: function() {
// Initialize Basic Openlayers;
var center = new OpenLayers.LonLat(8110203.9998955, 2170000.4068373);
map = new OpenLayers.Map(this.el, {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
var layers = [];
layers[0] = new OpenLayers.Layer.OSM(); //some more layer will go here
map.addLayers(layers);
map.setCenter(center, 12);

}
});
var map_view = new MapView({ el: $("#mapCol") });
})(jQuery);

The problem faced here was I am trying to access the DOM element even before it is ready.
Result : A webpage which shows the HTML elements, shows some access to Openlayers but no map.

Solution : I modified my code to this

(function($) {
var Map = Backbone.Model.extend({});

var MapView = Backbone.View.extend({
el: '#mapCol',

initialize: function() {
_.bindAll(this, 'initMap');
this.initMap();

},

initMap: function() {
// Initialize Basic Openlayers;
var center = new OpenLayers.LonLat(8110203.9998955, 2170000.4068373);
//alert("you are here");
map = new OpenLayers.Map(this.el, {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
});

var layers = [];
layers[0] = new OpenLayers.Layer.OSM(); //some more layer will go here
//$(this.el).html(map);
map.addLayers(layers);
map.setCenter(center, 12);

}
});
$(function() {
var map_view = new MapView();

});
})(jQuery);

Here mapCol is the div element where I want my Openlayers map to be displayed. For more details on Backbone and el, there is a beautiful blog post here.

P.S : There may be certain errors in the codes above. please feel free to correct me anytime.

My first birdwatching trip

Last weekend (Nov 4 -6) was amazing and it was my first bird watching/photographing trip. Before I start with the trip itself, remember I spoke about my confusion on my gears(what to buy and what not to buy). Well, I finally settled with an used Canon EOS 40D and just before the trip I got myself a Sigma 150 500 APO HSM OS lens.This combination is awesome as 40D has some amazing ISO performance even at 1000+.

So, Now the trip.

Rather than a normal travelogue like boarding a bus, getting down there, boarding a car, getting wooed out by the sight and sounds of the jungle and reaching the resort…oops I mentioned all of them. This more of a note that I am writing about my first birding trip.

If you are still guessing, well…I went to Ganeshgudi, a beautiful jungle near the city of Belgaum in Karnataka.

Three days of ultimate awesomeness with some medium weighing gears and 12 hours of continuous walking, looking and photographing birds. I managed to record some 24 species of birds including some rare species like Malabar Trogon, Crested Goshawks and Great Horn bill(this was not recorded, all I could hear was the sound of its wing flaps..gives goose bump). My 40D went b0rked in the middle of the trip with its exposure and metering not working properly. So most of my photos were taken with an exposure compensation of -2.

Still some photos came out good and they are here

The only mammal I was able to spot and photograph was Malabar Giant Squirrel. the photo is here

So, my first birding trip with my new gear and some unexpected challenges that came out with it. I guess I am learning a lot more that I expected.

P.S : Please ignore grammatical errors and other minor mistakes.

Ranthambhore Diaries #1

June 17 to June 20 was an amazing weekend. I went to Ranthambhore again, mainly because it was raining tigers in INW and I needed more experience with wildlife photography.

But what happened on the trip was marvelous, We heard from some fellow visitors that T39(A 3 and half year old Tigress) had killed a big male Blue Bull (Nil gai) and seen near it and is expected to be there for next two three days.

Saturday was test on us as we got completely drenched in rain(No photos, cameras were kept safe).

Sunday afternoon we had superb time with T39 sitting just some feet away from us in the water but Monday morning was even better as she was sleeping when we reached the place, as time flies by she woke up, answered nature’s call, slept again, sat for some time, came down to have breakfast and like previous day went again to sit in the water.

It was a complete six hour fiesta between her and us(Photographers).

Here are two snap from the whole fiesta. More to come soon…..

T39 having water post breakfast :
Princess of Ranthambhore #2

T39 Relaxing in water after breakfast :
Thanda Thanda Cool Cool - Princess of Ranthambhore  #3