Friday, August 2, 2013

Creative use of google maps API


Google maps API provides an amazing api with great features web developers can build on to.
Here I'll present an idea I've used to build site tara smestaj mainly using google map api.

Tara smestaj is site oriented towards accommodation advertising but in a rather creative way. First of all my region is well know by tourism, it has some wonderful places to visit and enjoy in. I'm from Bajina Basta a city under mountain Tara separated from Bosnia by a river Drina, our most treasured river. (if you ever come here, try fly fishing). So the point here is that this is a place with a lot of natural wonders (see the picture bellow)

A view from one of many sites-seeing places on mountain Tara,
you can see Drina River in background.
Given we have all of this natural wonders it would be naive just to advertise accommodation in no reference to other places you can see. So the main idea is to build site which will promote tourism of Bajina Basta, but provide information for tourist not only of accommodation but also of places and sites they could visit along the way. The whole google map is integrated in site background and visitors while crawling the site can see all other attractive location relative to a position on a map.

In this way if a tourist (first timers) stumble upon a site they can explore more of a places they could see, for instance if someone chooses one accommodation over other, that could be because they know a sport fields is near the place they are staying or other could look for something else based on their on interest.

I'll share with you another interesting thing that happened just another day, my city (or town to be more precise since it has a population around 15k people) is famous by a house built on a rock of River Drina.

A house built upon a rock on river Drina. Amazing idea.
And since there is a marker of this house on tara smestaj site, a journalist from national tv called me and said that he had seen a site and is interested in doing an interview with an owner of the house. I was amazed how he stumbled upon my site since it is active somewhat over a month, but it seams that the information provided on site (about accommodation) is easy to navigate and trustworthy. (Actually he mentioned something of that kind). Of course I've gave the information of the owner (after contacting the owner) to the journalist and hopefully they'll mange to work out the interview. Anyways it's amazing yet unexpected thing that happened but all due to idea that didn't focus only to accommodation advertising...

Feel free to explore Tara smestaj and in some other post I'll add some programming details of how it all works.

Fork bomb - DoS attack


A form of DoS attack under unix-like systems called fork bomb, is simple yet effective (if no user resource limit is set) attack which is mainly interesting by it's short implementation.

Forking the process (man 2 fork) means creating a child process which is exact duplicate of it's parent with some key points.

Forked process has it's on process ID, it's own memory for stack, child doesn't inherit parents memory locks and some other not so important (at this point) details unique to child processes.

Key point is that by forking a process we have exact copy of parent process, this is useful for many things like server-client communication and so on ... Another important thing to know under unix-like systems is piping (pipe - used for process communication)

example: (pipe)

cat text.txt | grep "crawl"

This simple command means: execute cat command and pipe it through grep (send cat output as grep input and execute grep "crawl".

So let's get back to our simple fork bomb:

:(){ :|:& };:

Where ":" is function name, and :|: means we are piping : to itself and & means to do it in background.
Last ":" mans start execution of this simple function.

Note that if you try to execute this simple function it will freeze your machine probably in less then a second depending on memory available (if no user memory limit is set).

For those interested in linux programming, there is a great book know as APUE (advanced programming in the unix environment)