Saturday, May 31, 2008

Selecting by id in Google's Datastore API

While developing a Google App, I have found some difficulty while trying to retrieve data by id. The method is very simple, and below is the Phyton code:
objectname = ModelName.get_by_id(longIntegerId)
This is how to select by id from Google's Datastore API

Thanks to:

Wednesday, May 28, 2008

Google Maps Polyline Encoder and Drawing Tool

or: "How to draw encoded polylines?"
or: "2 Steps for polylines encoding for GMaps"

Out there are some sites that allows you to draw and/or encode polylines, like these:
  1. Encoder javascript
  2. Polyline and polygons drawing tool
  3. Google's encoder
I decided to join them in one single mashup:

Friday, May 16, 2008

Ideas for StreetSize

Yesterday I sent two e-mails to Matt from

-------Email 1----------

Hello Matt,

Thank you for your wonderfull site. I think I'm the first Brazilian user, and I have invited my coworkers to join. I think that you'll achieve great success while you respect your users privacy. I'm also a Google Maps mashups developer.


+ Let me change my public name. I have my login name, and my real name, but I wanna choose which one users will see when they find me on the map.
+ The GMarker should be smaller and with a darker colour to distinguish itself from the background

I have more sugestions that demands much more time from you than the simple ones above. Ask me if you wanna hear.

-----Email 2 ----

Hello again Matt,

I don't know what you have in mind for your site when it gets real crowded. You don't have to share with me your plans, I just wanna be able someday to meet a neighbor, with the help of your site, without knocking his door. It seems that for now you use the Keep It Simple motto, but following are some ideas that may help, if you want to add some complexity to it:

+ Like a social site, instead of location-based-only relationships, friends should be able to track themselves through a contact list.
- With a contact list, the user should be able to filter the map to only see his contacts on it.
- With a contact list, the user should be able to add contacts automaticaly with a Gmail/Yahoo/Hotmail crawler.
+ Users should be able to input where they will be in the future, this feature should be used to schedule parties and meetings
+ Users should be able to update continuosly their location through GPS equiped mobile phones.
+ Users should be able to maintain a history of previous locations, and they could even store whole tracks.

+ If you don't know, Fire Eagle (at seems to be a service that will share his users location with a limited number of websites that each user will choose. Your Street Size could explore this opportunity also by providing an API to webdevelopers.

Thank you for your time, I hope it's worth reading and good luck!

Wednesday, May 14, 2008

Opening Google Earth (*.kmz) files with the browser

I already knew that Google Maps shows KML file content at its website. You only need to put the KML's URL at the following site search textbox:
then execute the search. But I was unaware that the same applies to Google Earth's KMZ files. They seem unreadable without Google Earth, but you can use the same method above or use the following one:

Example KMZ file:
Append at the beginning of the above URL:
The result is:

Open it in your browser.

Saturday, May 10, 2008

Best Google Maps Mashups

Following are my favorite Google Maps Mashups:

1. Amsterdam Helicopter Game - I'm making my own javascript version, click here to see it.
2. Twitter Spy - See where people are microblogging. It should have geographic boundaries, I could do it myself, but I would have to study Twitter's API.
3. Street View Immersive Videos - Like Google Maps Street View but now as a Video, use the mouse to rotate the view.
4. Free real state mashup - find houses and apartments for sale in Brazil, search by size, location or price, for free.
5. Geolocated voice messages - I think that is a great Idea, but it has to be specific to achieve greater success.
6. Paris user contributed map - better than Wikimapia because markers are simpler than polygons, categorization is good for searching and the side bar is easier to locate.
7. London Profiler - Nice looking data viewing!
8. WikiCrime - A wiki for crime reporting and locating.

Google Maps Javascript Helicopter Game

Click the following textbox to start to play:

Use keyboard arrows < ^ > to navigate and + - for zooming

To Do list:
  1. Integrate with Google Adsense to estabilish goals that the user will have to find, with or without the help of address or pointers.
  2. Alternative: Use a categorized list of known places (ex: night clubs) to put the player under a known places knowledge test.
  3. Use FireEagle to open the map rightly above the user real location.
  4. Change the Helicopter gif for one that changes with the inputed commands.
  5. Change the aerial mode for a terrestrial one that limits the movement to the streets.
  6. The API method "panTo" is smoother, but I couldn't make it load new images as you reach the map's edges. Currently I'm using "setCenter" and this method makes map blink.

Monday, May 5, 2008

Website Performance

Or "How to make my website faster?"
Steve Souders says that he is the YSlow creator, which is a Firefox's and Firebug's extension that calcs the conformity degree of a site with th rules for high performance websites. Now he says he got "14" new rules but lists only 10. Now I will list the current 34 YDN rules plus the 10 "new" ones:
  1. Make Fewer HTTP Requests
  2. Use a Content Delivery Network
  3. Add an Expires or a Cache-Control Header
  4. Gzip Components
  5. Put Stylesheets at the Top
  6. Put Scripts at the Bottom
  7. Avoid CSS Expressions
  8. Make JavaScript and CSS External
  9. Reduce DNS Lookups
  10. Minify JavaScript and CSS
  11. Avoid Redirects
  12. Remove Duplicate Scripts
  13. Configure ETags
  14. Make Ajax Cacheable
  15. Flush the Buffer Early
  16. Use GET for AJAX Requests
  17. Post-load Components
  18. Preload Components
  19. Reduce the Number of DOM Elements
  20. Split Components Across Domains
  21. Minimize the Number of iframes
  22. No 404s
  23. Reduce Cookie Size
  24. Use Cookie-free Domains for Components
  25. Minimize DOM Access
  26. Develop Smart Event Handlers
  27. Choose <link> over @import
  28. Avoid Filters
  29. Optimize Images
  30. Optimize CSS Sprites
  31. Don't Scale Images in HTML
  32. Make favicon.ico Small and Cacheable
  33. Keep Components under 25K
  34. Pack Components into a Multipart Document
  1. Split the initial payload
  2. Load scripts without blocking
  3. Don’t scatter scripts
  4. Split dominant content domains
  5. Make static content cookie-free, repeated
  6. Reduce cookie weight, repeated
  7. Minify CSS, repeated
  8. Optimize images, repeated
  9. Use iframes sparingly, repeated
  10. To www or not to www
I would like to add 2 rules that I readed elsewhere:
  1. Optimize inner loops
  2. Make XHTML web pages
The first one is explainable from the programmer's point of view: the inner loops are the greatest time consumers, and by optimizing them you gain computational time. For articles dealing with how to do that with JS read this and this too.

The second rule applies to mobile web development, where hardware resources are fewer, and complete browsers slowers than browsers that read only XHTML. Visit to validate your website.

Yet another post about Firefox plugins

I can't understand people that like Internet Explorer (IE) better than Mozilla Firefox (FF). Benchmarks like this and the plurality of add-ons are my arguments against those people. Following there are some of the essential FF extensions that I know:
  1. IE Tab - some web pages (like .mht) just open in IE, you can open them inside FF with this trick.
  2. Customize Google - removes Google Ads from all websites, also improves security and privacy at any Google website, customize the number of Google's results and makes image results point directly to images.
  3. Ad Block Plus - Remove all Ads from any Website.
  4. Downloads in Tab - The annoying little download window will be a tab.
  5. No Script - this is what makes FF safer than any other browser.
  6. PDF Download - now you can choose what will happen when you click on a PDF link.
  7. Table2Clipboard - copy HTML tables content to you spreadsheet editor.
  8. Gmail Manager - checks for new mail at your(s) Gmail account(s)!
  9. GSpace - turns your Gmail account into a remote drive
  10. PermaTabs - turns a selected tab into a permanent (unclosable) one, useful to people who uses iGoogle or Google Reader.
  11. Tabs Open Relative - new tabs will be open next to current one, not at the end anymore.
  12. Firebug + DOM Inspector - essential for every Web developer: javascript debugger, complete HTML, DOM, style, traffic analysis

Saturday, May 3, 2008

Globalization Tips for Web Programmers (ASP.NET)

The most important thing when you develop an ASP.NET website which interface language is portuguese, is to use the following Web.Config entry:
<globalization uiculture="pt-BR" culture="pt-BR" fileencoding="iso-8859-1" responseencoding="utf-8" requestencoding="utf-8">
The newbiest programmers usualy forget the that his application users could insert special characters into a form. When sending parameter via QueryString the browsers always convert those special characters in an encoded form via one of these functions below:
  1. escape(), example: @ is escaped to %7E
  2. encodeURI(), example: % is encoded to %25
  3. encodeURIComponent(), example: @ is encoded to %40
I strongly recommend to use explicitly EncodeURIComponent() when passing parameters via URL. If you do as I say, the ASP.NET will implictly decode it when you call:
Request.Params["parameter's name"];
But if you forget the explict encode, none of the functions below will be able to retrieve correctly those special chars:
  1. Microsoft.JScript.GlobalObject.unescape(), complemented by escape()
  2. Microsoft.JScript.GlobalObject.decodeURI(), complemented by encodeURI()
  3. Microsoft.JScript.GlobalObject.decodeURIComponent(), complemented by encodeURIComponent()
  4. Server.UrlDecode(), complemented by Server.UrlEncode()
Nota: In order to use Microsoft.JScript at MS Visual Studio, you must manually Add Reference.

Javascript (and also JScript) also has
escape(), encodeURI() and encodeURIComponent() and their complementary functions, that have a slightly different results from ASP.NET ones.