merge two sorted arrays in python

Here is a quick code snippet to merge two sorted arrays in python merged = [] l = 0 r = 0 for i in range(len(a)+len(b) ): lval = None rval = None if l < len(a): lval = a[l] if r < len(b): rval = b[r] if (lval < rval and rval and lval) or rval == None: merged.append(lval) l+=1 elif (lval >= rval and rval and lval)or lval == None: merged.
Read more →

Update the locate DB on OS X

Read more →

How to print the Fibonacci Sequence in Python

The Fibonacci numbers are the sequence of numbers defined by the linear recurrence equation  F_n=F_(n-1)+F_(n-2) with F_1=F_2=1 and F_0=0 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.
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 →