Google Maps Tutorial - Preliminary
I've been playing around with Google Maps for fun lately. In order to teach myself the basics I assigned myself a simple project. I'm going to develop a Google Maps taxi application. Here are the requirements:
- Text box: where you can enter an address you want to center on
- Left click: will place markers on the map that indicate boundary points
- Boundary: you can click as many markers as you want. If you click back to the original marker the boundary region will close.
- Reshape: you can reshape the boundary region by moving the markers.
- Place taxi: right clicking on the map will place a taxi.
- Reverse geocoding: a text bubble will pop up that indicates the actual address of the taxi (e.g. 123 Main street).
- Inside/Outside: the marker indicating the taxi will change color depending on whether it is inside or outside the region specified by the boundary.
That's it!
The purpose of this application is for a taxi operator to be able to specify boundary regions for different taxis on the map, which the taxi operators can use to see if they are inside or outside their regions. I guess to make this more useful the application should be able to get the boundary points from a database sitting on some server, but that would make the google maps part of the problem simpler, while making it more of a AJAX problem, so I wont go there.
Google maps exposes a nice Javascript API, so we can do all of the things I mentioned above with client side Javascript code.
So lets get started.
API Key. First step is to get the Google Maps API key from Google: http://code.google.com/apis/maps/
Generate First Map. To create to create a map you need to create a GMap2 object, and then using the "setCenter" method you can specify the center and zoom as in the code snippet below.
-
zoom = 15;
-
map = new GMap2(document.getElementById("map_canvas"));
-
var center = new GLatLng(37.4419, -122.1419);
-
map.setCenter(center, zoom);
See the end result in this sample web page. Use view source feature of you web browser to see the full source code.
N.B. If you are going to use the above source you need to modify the "key=<put your key here>"
I anticipate each of the 7 items listed above will be a separate post. The first post coming soon will be adding a text box to specify the map center.
Using Technology To Get Out Youth Vote
There's an interesting article from Bloomberg about how Barack Obama's campaign is using text messages to get out the vote, especially among the young and African Americans.
The young are notorious for not voting. The last presidential election only 45% of eligible voters below the age of 30 voted. Even though they make up 25% of the electorate, they were only 16% of the electorate that voted.
One thing that young people are good at is using technology, hence the text messaging drive. Obama's campaign has been collecting people's cell phone numbers for over a year, using enticements as promising those that give their cell phone numbers would be the first to be notified of the Vice Presidential nominee.
Using text messaging to get out the vote has been shown to be effective in the 2006 midterm elections. It caused a 4% increase in voter turnout, as opposed to the 1.3% increase from using traditional flyers.
Text messaging is also relatively cheap, costing $1.56 per vote compared to $32 for leafleting.
Linux Kernel Development
There's a very interesting article from Jonathan Corbet of Linux Weekly News that offers tips for people who are just getting started with Linux Kernel development.
As a Kernel newbie myself, I found the article highly informative, and even though it is a bit on the long side it is definitely worth a full read.
For me some key takeaways were:
- Get the staging trees "-mm" (Andrew Morton's tree) and "linux-next" (where the mainline kernel is going in the near future). According to the article the above staging trees will most likely have very noticeable bugs, and may not even compile. So, this is a good starting point for people who want to get their feet wet.
- Look at the MAINTAINERS file in the Linux source tree, and figure out who the maintainer is for the section of the Kernel you are interested in. You will need to build a relationship with that maintainer if your code is going to go anywhere.
- Try to split your patches into manageable chunks. Communicate early and often on what you are trying to do, and be clear on what problem your patch is solving. Sections 5.4 and 5.5 have a step-by-step guide on the mechanics of submitting patches which can pretty much be followed in cookbook fashion.
- Code checking. Two common gotachas in kernel development is writing code for multiple processors, and writing code that will work over a variety of different CPU architectures. Section 4.5 has a lots of good advice on compiler flags and tools that will spot some of these problems.
Vote: Presidential Election
Below is a gadget that will help you find your local polling station (N.B. you must be registered to vote before already before going to the polling station).
Also check out Google's voter info site for more election related information.
Career Planning
I read a interesting couple of blogs by Marc Andreessen of Netscape fame on career planning. I definitely recommend reading Marc's blog posts in their entirety.
Here are a couple of my takeaways that I found:
Relentlessly expand your skills.
Try to work in growing companies, where you can quickly expand your skills.
Don't neglect skills that seem orthogonal to your current job.
Some skills that are relevant for a lot of different jobs: communication skills, management skills, sales skills, finance skills.
Scott Adams (Dilbert fame) points out that there are 2 ways to be successful:
- Become the best at one specific thing.
- Become very good (top 25%) at two or more things.
Of these two things the first one is extremely difficult. The second is not that hard. Very few people take the initiative to be good at different things, they only focus on the one think that their job currently dictates.
Take (calculated) risks.
All substantial opportunities come with some risk.
Look at your job in the same way as buying stocks. Try to carefully calculate the risk and rewards of each job opportunity.
In general people underestimate opportunity cost, that is the cost of a missed opportunity because they are doing something else.
In general people overestimate the cost of failure. If you are good, and have developed a lot of marketable skills, then the cost of failure (especially early in your career) is not very high.
Programming Algorithms for Web 2.0
I just got a copy of a very interesting book: "Programming Collective Intelligence".
Admittedly the gratuitous use of "Web 2.0" in the title is a bit misleading, the topic of the book is much more broad than that. It is really about programming techniques and algorithms that have to deal with analyzing data.
With so much data out there on the internet, the ability to analyze and categorize that data becomes a very interesting problem. Indeed there are entire companies that are devoted to doing just that. The book combines a lot of practical tools, and has a lot of sample source code, as well a discussion of some very important algorithms in this space: clustering, machine learning, bayesian classification.
Validating Web Pages and Feeds
A good thing to do after publish a web page is to check it's validity using an online tool. A lot of browsers will workaround incorrect HTML, so just because it shows up correctly on the browser you are using, it does not mean that it will show up correctly on all browsers.
You can also validate your atom or RSS feeds using this feed validator.
GStreamer
Briefly, GStreamer is an open source multimedia application framework that works on a variety of OSs. An application framework allows you to build multimedia applications - audio and video - using the plethora of codes that are currently available (e.g. audio: mp3, ogg-vorbis, aac,... video: VC1, WMV, AVI, Flash, H.264, etc.)
GStreamer is an alternative to Microsoft's DirectShow.
Embedded Systems
With the increasing sophistication of embeded systems there is a desire to support enhanced functionality like multimedia playback on those systems. TI for example, is known as a major supplier of embedded DSPs for the mobile device market (e.g. cell phones). I have talked to some people at TI who are part of the team porting GStreamer on TI DSPs.
wxPython + GStreamer
On the practical side, if you actually want to create applications that uses GStreamer as the multimedia framework, I found this awesome tutorial about how to write a wxPython video applicaiton using GStreamer. If anyone is unfamiliar with wxPython, I can definitely recommend it. From what I have read about wxPython, the designers made an effort to call the native API of whatever platform the application is running on, so the GUI actually looks like a native application across windows, linux and mac os x.
World Chess Champoinship 2008
We're at the half way point of the world chess championship between India's Vishwanathan Anand and Russia's Vladimir Kramnik. After 6 games the score now is 4 1/2 to 1 1/2 in favor of Anand.
Here are some useful links.
- Video highlights and post match press conference of the last game.
- Official website. From the sponsors of the 1.5 M euro event.
- The week in chess. Has commentary.
- Chessvibes. Has live reports.
- Chess blog of Mig Greengard
- Chess blog of Susan Polgar
You can analyze the games on your own with computer help of course. The strongest chess computer at the moment is Rybka, which both Anand and Kramnik have said they use in their analysis.
You can download Rybka 2.2 (current version is 3.0). Rybka 2.2 is still stronger than all human players. If you are interested in computer chess you can obtain the source code for Strelka, reputedly a reverse engineered clone of Rybka.
802.11n Chip
Quantenna launched a chip that supports the latest wi-fi standard, 802.11n. According to the wikipedia article, the 802.11n standard is set to be finalized in Nov 2009, and can support up to 600Mbps. Currently popular wi-fi chips can support 54Mbps. Even that is somewhat patchy due to the presense of physical obstacles likek walls.
The technologies that enable the significant gain from previous wi-fi solutions are
- 4x4 MIMO: 4 transmit and 4 receive antennas.
- Beamforming: This enables directional transmission so that the transmitter can zero in on the receiver. This technique is also used for noise reduction on cell phones, so that you can filter out background noise and focus on the person talking on the cell phone. For example: Forte Media
- Concurrent dual band support: 5Ghz for video and 2.4 Ghz for data.
Some more infomation at GigaOM


