How to print the Fibonacci Sequence in Python

The Fibonacci numbers are the sequence of numbers {F_n}_(n=1)^infty defined by the linear recurrence equation

 ![ F_n=F_(n-1)+F_(n-2) ](http://mathworld.wolfram.com/images/equations/FibonacciNumber/NumberedEquation1.gif)     with ![F_1=F_2=1](http://mathworld.wolfram.com/images/equations/FibonacciNumber/Inline2.gif) and ![F_0=0](http://mathworld.wolfram.com/images/equations/FibonacciNumber/Inline3.gif)

So in simple terms a method to compute fibonacci number for nth place looks like this

     if n == 0 or n ==1:
         return n
     else:
        return fibonacci(n-1)+fibonacci(n-2) 

here is quick test

    print i," : ",fibonacci(i)


#This will print
0  :  0
1  :  1
2  :  1
3  :  2
4  :  3
5  :  5
6  :  8
7  :  13
8  :  21
9  :  34

or an inline method like this print [fibonacci(i) for i in range(11)] will result

Read more →

Using ElasticSearch for Spatial Search tutorial

In this post I will demonstrate using ElasticSearch to spatially query records and filter them by attributes.

ElasticSearch is built on top of Lucence which in version 4.0 supports Spatial query features, for those interested here is an example and link to javadocs.

You will need to install ElasticSearch, read about installing it here, also install marvel plugin for configuration and testing.

For this demonstration I have used data from Geofabrik. I have used point.shp file from Great Britan but you can use data from any other country as well.

Read more →

CCS3 only Loading Icon

I generally have been using loading gifs in my work most of the time to inform the user that the resources are being fetched asynchronously from the server.

Ajaxload website is perhaps one of the most used site to download a suitable gif.

In this post I will demonstrate a css3 only way to create a nice loading simulation

Basic Code

We will use nested divs to create the loading animation control ```

Read more →