Friday 14 December 2018

how to use the google elevation api








Below is a code written in python to send get requests to the google elevation api and then store
the results into an sqlite database.
Make appropriate changes to the code as mentioned in the comments before executing the code.


Go here to get your own api key




import requests
import sqlite3
import json

key = '<paste your google api key here>' #google api key
#sqlite connection
conn = sqlite3.connect('<path to your sqlite database>')
id = 1
#api end point
base_url = 'https://maps.googleapis.com/maps/api/elevation/json?'
number_of_coordinates = 4610
while (id < number_of_coordinates):    
   instanceOfRow = conn.execute("SELECT * from forlake WHERE Number=?",(id,))
   row = instanceOfRow.fetchall()
   latitude = row[0][2]
   longitude = row[0][3]
   url = base_url + 'locations=' + str(latitude) + ',' + str(longitude) + '&key=' + key #constructing api endpoint
   api_response = requests.get(url)
   data = api_response.json()
   conn.execute("UPDATE forlake SET elevation = ? WHERE Number = ?",(data["results"][0]['elevation'],id,))
   if id%100 == 0:
       conn.commit() #commit changes in the database after every 100 records
       print id
   id = id + 1

conn.commit()    
print 'done'



Friday 21 September 2018

Human eye

The eye is a cohesive organ: different tissues performing different functions but working together as a team to perform specific larger functions within an organism. In contrast, you're trying to draw a comparison about interactions between completely different macro organisms.
Now one can make the argument that these kind of definitions and distinctions are arbitrary, and then we could get into a pseudo-scientific, pseudo-philosophical discussion about whether individual cells are actually discrete organisms and whether an animal (i.e. human) organism is really an individual or simply a collection of individuals. But that wouldn't change the fact that organs and organisms are separate definitions implying specific purposes and functions and that when we are talking about words like waste and byproduct we are also talking about specific purpose and function. Since none of the functions of our cells have sentient intent, any purpose of function (or lack thereof) is described in terms of intent that we ascribe to the cellular life.
From a metabolic point of view, each cone and rod cell is it's own system with inputs and outputs. Let's say you are speaking of plants. We commonly say they produce O2, which is perfectly true. But one might also say, looking at only the plant itself as a system, that O2 is a byproduct of it's metabolism. Surely many animals would die without it, and it's necessary to the ecosystem as a whole, but not to the plant itself. The purpose was to make energy, and O2 is a waste product removed from the system.Tetrachromats can see colors that most people cannot — up to 100 million, estimates suggest, which is 100 times that of the average human. Most people have three cells, or receptors, in their retinas, but tetrachomats have a fourth receptor, which may be what allows for their heightened color perception. They are usually female, and it’s estimated that about 12 percent of women carry the gene for this fourth receptor.

Saturday 20 June 2015

SQLSTATE[42S02]: Base table or view not found : 1146 , laravel 5 errors while using git clone

I just wanted to write this short post to fix this error in  php artisan migrate, there may be a better way to fix this though.

Usually this error maybe given if


  • The migration parameters aren't set properly
  • One of the tables already exists and/or has a column name same as one of that defined in your migration file
  • The table doesn't exists!  

For a quick fix, you might just want to open up a database editor (phpmyadmin etc.) and make the missing table given in the error with a random column name (anything which doesn't exists in the migration file).

Go to the migration file of the table and change Schema::create to Schema::table , what this will do is accept that the table exists already and change the parameters accordingly.

Wednesday 16 July 2014

Xioami and Asus giving a tough fight to Motorola

Xioami (pronounced shao-me) forayed into the Indian smartphone market on 15th of July 2014 and Asus also announced a new range of phones dubbed the 'zen phone'. Whats common between these two companies is that both of them have launched phones with competitive price tags.


'For a quick comparison of the phones visit this link and this'

The Xioami Mi3, priced at Rs. 13,999 brings in a full HD 1080p display and a snapdragon 800 SOC unheard in this price segment which brings it along the likes of htc one m8 (which is more than triple the cost of Mi3). In-case you are wondering how does Xioami achieve this price point do have a look of my earlier post about the entry of Xioami in India . The specifications of this phone clearly trounces the Moto G in almost every respect.I would have loved stock android on this beast but users who don't want to flash custom roms on their devices would have to settle with MIUI.

Just to make it clear the Mi3 also trounces Motorola's flagship device the  Moto X in almost every respect. I should mention that the Moto X has some'unique' features such  as the always listening google now and active notifications, thanks to the amoled display.
image courtesy TOI :the zenphone 5

"Micromax,Lava,Xolo should be worried. A lot." 

Meanwhile Asus has also taken the route of competitively pricing their devices, and it showed with Asus selling a staggering 40,000 units of Zen Phones in just 4 days. Asus has done its homework and already got an A+. Both Xioami and Asus have pushed competition a notch higher with already slim profit Indian phone manufacturers should be worried because they don't have the brand image of Asus or the highly competitive pricing of Xioami. Micromax must be hoping that android one comes to it rescue. In just a span of 3 days Micromax's answer to the Moto E, the Micromax Unite 2 has been shruged off  with the likes of Xioami's Redmi 1S and Asus Zenphone. Oh i forgot even the Moto E!

Competition is reaching new heights, I am interested in the response from the likes of Micromax,Lava. 

Saturday 5 July 2014

Orkut, bidding adieu

Orkut named after its creator Orkut Büyükkökten , a former google employee, stagnating over years now google has finally laid it to rest for good. Having two social networks (Orkut and google+) was a really awkward product offering for google anyways.

image courtesy: ZDnet.com


back in 2005,  I fondly remember making a google account just to login to Orkut (obviously with my wrong age, hehe). Connecting with friends was a totally different experience when compared to facebook, the number of  scraps (small messages) were considered a measure of your social status, anyone could view them and make conclusions. Albeit what I did on orkut was pretty much the same I do on facebook (sharing lol pics,videos,supporting my team,and the occasional social awareness status) but Orkut had its own charm, it included the thrill that you were using an "adult" website. Oh! and how can i forget the gifs we used to scrap each other with, using power scrap. (a third party tool, an enhanced way to scrap other people)  

And Academy of hacking community which got me started to experiment with random scripts on my poor old laptop.
 A Big thankyou to AOH, even though I never became adept at hacking but the plagiarized (most of it was) content helped me in a lot anyways, running random scripts  here and there then trying to revert my laptop to a stable state, in all it was awesome!
I miss gifs on facebook!

Until facebook came along......
It literally annihilated Orkut and myspace, the UI was way better, the community was better, having no support for gifs, html codes actually benefited facebook, giving it a uncluttered user interface. To be honest even google+ hasn't managed to catch up to facebook (I hardly login to google+) but google has cleverly (or rudely?) managed to make google+ a "backbone" of its other products such as Android, Google Play and blogger (and YOUTUBE!) itself. Google+ has managed to justify its existence but I doubt it will be ever used as a direct competitor to facebook which it was primarily aimed to compete with.

To my readers who have fond memories of Orkut
A reminder to save all your memories
Orkut will be officially shut down on September 30, 2014. Until then, you can:

Goodbye Orkut, thanks   :")

Tuesday 1 July 2014

My thoughts on Android One and the impending launch of Xioami in India

Sundar Pichai, head of android and chrome recently gave us a sneak peak of android one, a partner program between google and manufacturers such as Micromax,spice and Karbonn. Google will provide direct OTA updates to phones which come under the android one program. Aimed at developing markets, Google essentially has a remote control over these manufacturers (Manmohan singh --> Sonia Gandhi). lel.

Pichai claimed that the phones will cost around 100 USD which is a remarkable feat, he also stressed that users will be able to delete preloaded apps which they don't like contrary to some other bigger manufacturers (hint: galaxy).


image courtesy The Verge
Enticing!
With google focusing on India centric features such as dual sim card, google has got it spot on but none other features were detailed. It is rumored that these phones will run on on MediaTek chipsets, the chipset manufacturer haf featured on almost all of micromax's smartphones.My remote control statement was a bit harsh because it is actually a win-win situation, most of the Indian manufacturers essentially rebrand other phones usually made by other Chinese companies like ZTE etc. and have a history of irregular updates with most of the times the phone being stuck on the same android version it shipped with.

But Xioami is here to spoil the party with rumors suggesting a july launch the chinese company has the products to shake up the Indian smartphone market in an even bigger way the Moto G and the Moto E. With the Xioami Mi3 rumored to be priced about 15,000 Rs. it definitely aces the Moto G and surprisingly matches htc one m8 and the galaxy S5 in terms of hardware. (Yes you read that right) The Xioami Red Mi which will be priced around 8000 Rs.  introduces an HD 720p screen in this price segment never seen before in the Indian market.

Running its own Custom MiUI ROM based on Android, Xioami is known to 'copy' apples design philosopy in many ways in its custom rom be it animations or folder but one point to note is that the company more or less does it right.

The Indian smartphone market is up for grabs and i predict either android one based smartphones or xioami  winning the battle (Sorry Nokia X, half the price and I still wont buy you). The Indian consumer is very sensitive to the price and always demands the best of specifications where Xioami will most probably ace android one based smartphones with its unique business model which helps it cut costs but android one will ensure faster updates directly from google. Competition is amazing!  
You might be interested in watching this video