Thursday, February 24, 2011

The perils of using Wifi for Mobile Geographic Positioning

It is pretty well known that the Google StreetView cars that capture the images used for Google Street also collect information about Wifi networks in the area, to improve its location based services. In the past, Google has been known to have been collection too much information on private Wifi networks. That aside, it is a pretty cool concept- if your mobile device, such as an ipod touch, lacks GPS capabilities, it can still find where you are based on the Wifi networks around you.


The ingenuity of their system is also their crux. Take for example what I learned today. I recently made the jump to a smartphone, an HTC Evo. I LOVE the phone and 4G, one of the primary reasons I opted for the phone was for its location-based capabilities. This weekend, I am down at the family beach house enjoying a week away from work and getting in some riding/hiking/sleeping time. However I've noticed recently that when in the house, the phone's weather report is mapping Athens, GA as my current location, although I am 250+ miles south. I wrote this inaccuracy off as a glitch in Sprint's towers or something along those lines, that is until I took a closer look at Google Maps on my phone today.


I found it curious that the phone was putting me in Athens, which is where I attended the University of Georgia for four years. Out of curiosity I wanted to see where in Athens it was putting me, as I'm pretty familiar with the city and its streets. After zooming in a bit, I noticed that it was mapping me near the intersection of Baxter and Milledge ave. After zooming in all the way (which is not as far as I've been able to do when GPS is turned on), I realized where my phone was pinpointing me- off of Springdale Street, which is where I lived for two years while at the University. Sure enough, my phone was using Google's massive database of Wifi data (MAC, SSID, etc) to locate me, the same place where it had captured the router's MAC 3-4 years ago. Although the SSID of the router has changed (as well as the encryption key, etc), it is obvious that Google maps is using the MAC (media access control) address of the router as its primary identifier- it makes sense, as the primary purpose of MAC addresses is to be a unique identifier. So although I am not really near Athens at all, I am near the router that was in Athens at the time Google captured its MAC.


This presents somewhat of a quandry using Google maps. I guess Google just didn't count on people moving very often, or they figured they update their database frequently enough to mitigate this problem (note that it has been 3 years since the router as resided at that location, it has since changed geographies twice). It begs the question; is there somewhere I can go to update their database to reflect the router's new location? Also, would this occur no matter where in the world the router was located, so long as there were not any indexed networks nearby? Regardless, it is an illustrative example of how Google Maps works using Wifi data and how this clever system also has its limitations.

Sunday, February 13, 2011

Gnome Wallpaper Changer

One feature I really liked about Windows 7 that is lacking on F13 Gnome is the ability to automatically rotate desktop wallpapers. This minor aesthetic functionality is easily implemented using crontab and a simple python script. I set the script to run every 15 minutes using crontab and to read from a specific folder of wallpapers (.backgrounds/dual). I used Davyd's Madeley's python script:


#!/usr/bin/python
#
# change-background.py
#
# A script to change to a random background image
#
# (c) 2004, Davyd Madeley
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

backgrounds = ".backgrounds/dual"

import gconf
import os
import random
import mimetypes

class GConfClient:
def __init__ (self):
self.__client__ = gconf.client_get_default ()
def get_background (self):
return self.__client__.get_string ("/desktop/gnome/background/picture_filename")
def set_background (self, background):
self.__client__.set_string ("/desktop/gnome/background/picture_filename", background)

client = GConfClient ()


dir_items = os.listdir (os.path.join (os.environ["HOME"], backgrounds))
items = []

for item in dir_items:
mimetype = mimetypes.guess_type (item)[0]
if mimetype and mimetype.split ('/')[0] == "image":
items.append (item)

item = random.randint (0, len (items) - 1)
current_bg = client.get_background ()

while (items[item] == current_bg):
item = random.randint (0, len (items) - 1)

client.set_background (os.path.join (os.environ["HOME"], backgrounds, items[item]))



The crontab file is set as:


*/15 * * * * DISPLAY=:0.0 /usr/local/bin/change-background.py