## Wednesday, August 26, 2015

### Simple thing but difficult to find [ALSA wav file]

I was in need of ALSA and honestly, I'd just few testing style programming of it long before.

It need to take wav file as input and do a playback of that file using ALSA. However, I need to learn it form scratch, though to find any suitable example according how I can handle wav file to send as ALSA PCM playback, was difficult.

So I wish to write some explanation of it here, and will try to exclude those what you can find and learn by a short googling.

Below part, I presume you already know, or if you don't, I found -

http://www.linuxjournal.com/article/6735?page=0,0

is the best and most informative.

## Wednesday, August 12, 2015

### GEO-Search - Faster approch between two point

Previous post, I port the calculation and formula from Federico

My search bring me another solution, which is more faster than previous ->

Below it is, [This one calculate for Kilometre]
```  ```
struct arg_max_min_lo_lt

{
double min_long;

double min_lat;

double max_long;

double max_lat;
};

struct arg_max_min_lo_lt get_lo_lt_values()

{

struct arg_max_min_lo_lt m_lo_lt_ptr;

//each degree of lon or lat is approximately 69 miles or 111 kilometres difference

double denominator = cos(deg2rad(curr_lat)) * 111;

m_lo_lt_ptr.min_long = curr_long - (radius / denominator );

m_lo_lt_ptr.max_long = curr_long + (radius / denominator );

m_lo_lt_ptr.min_lat = curr_lat - (double)radius / 111;

m_lo_lt_ptr.max_lat = curr_lat + (double)radius / 111;

return m_lo_lt_ptr;

}``````

## Friday, August 7, 2015

### GEO-Search: The Haversine Equation

To calculate longitude & latitude of an area easiest way is to calculate The "Haversine Equation".
Implementation of this equation in various programming language was done at here ->

http://blog.fedecarg.com/2009/02/08/geo-proximity-search-the-haversine-equation/

I port it in basic C programming ->

`````` #include <stdio.h>
#include <math.h>
int main()
{
double curr_long=-2.708077,curr_lat = 53.754842;
double denominator = cos(deg2rad(curr_lat)) * 69;  // 69 as calculation in Mile
double min_long = curr_long - (radius / denominator );
double max_long = curr_long + (radius / denominator );
double min_lat = curr_lat - (double)radius / 69;
double max_lat = curr_lat + (double)radius / 69;
printf("Minimum Longitude :%1.9f\nMaximum Longitude: %1.9f\n",min_long,max_long);
printf("Minimum Latitude :%1.9f\nMaximum Latitude: %1.9f\n",min_lat,max_lat);
return 0;
}