Author PhotoBy +Scott Knaster, Google Developers Blog Editor

Google Code Jam is a time-honored tradition in which coders around the world solve programming problems for glory and cash prizes. The 10th annual Code Jam finals took place last week in London, and when the dust settled and the flying fingers stopped typing, the winner of the coveted title Code Jam Champion 2013 was Ivan Miatselski. The champion (also known as mystic) bested 45,000 entrants to win the competition.

Code Jam participants get to use whichever programming language they want, and they chose dozens, including Python, Java, C++, and even COBOL, Fortran, Smalltalk, and Mathematica. This year’s devilish final round involved solving five challenges in four hours, including puzzles about driving around a traffic circle backwards and finding a drummer for your band. If you missed it, don’t worry: Code Jam 2014 is on the way.

As we switch from enigmatic problems to mysterious celestial bodies, there’s news that Saturn’s moon Titan is continuing its shady ways. According to new research, Titan could have a thick crust of ice, very different from previous theories. Geophysicist Doug Hemingway of UC Santa Cruz says “Already things on Titan were hard to explain. This makes it even worse.” Indeed, Titan is a pretty weird place, with its methane atmosphere that comes down in rain and forms lakes.

Finally, would you like to meet a restaurant waiter who remembers you across visits, even if they’re years apart? That’s the story of Julian Lim, a super recognizer who recalls almost every face he’s ever seen. This superpower even works across many years, as super recognizers can pick out people who have grown up and changed substantially. Researchers studying this phenomenon have found more than 20 super recognizers so far. Some of them didn’t realize they had a special ability and assumed everyone else could do it too.

On Fridaygram, scientists are heroes, space news is amazing, nature never ceases to surprise, and fun is important. We hope your weekend is filled with wonder and general cool stuff.

Author PhotoBy +Scott Knaster, Google Developers Blog Editor

In 2011 Points of Light and Google got together and started HandsOn Tech, an organization designed to help US nonprofits learn to use technology in their work. HandsOn Tech connects nonprofits with expert volunteers who really want to help make the world better.

Devin Rucker and Marcia Webb-Hayes at a HandsOn Tech training

HandsOn Tech helps with all kinds of programs, including improving literacy and making information accessible. This fall, HandsOn Tech starts its third year of programs. Want to volunteer? You can apply to join the team until August 31. If you’re selected, you’ll receive a week of training here at Google in Mountain View, California. If you make it, let us know when you’re in town by sharing a post with +Google Developers.

You could do a lot of good if you lived forever. While that might not be feasible yet, scientists are on it with research into Hydractinia echinata, an Irish sea creature that doesn’t age and can regenerate any part of its body. Dr. Uri Frank of NUI Galway says the marine animal is “perfect for understanding the role of stem cells in development, aging and disease”. Humans are probably too complex to regenerate body parts this way, according to Dr. Frank, but there’s lots to be learned from humble Hydractinia.

Finally, here’s a sight that previous generations could only dream of viewing: Phobos crossing in front of Deimos, as seen from the surface of Mars. The video, poetically titled “Two moons passing in the Martian night”, was shot from Mars by the Curiosity rover. It’s short, so you can enjoy it over and over again.

This week Fridaygram notes a couple of spacey milestones: happy 5 years in low-earth orbit to the Fermi Space Telescope, and congratulations to NASA’s Juno spacecraft, which passed the halfway point on its journey to Jupiter: 1,415,794,248 kilometers down, 1,415,794,248 kilometers to go.

Author PhotoBy Monica Tran, Google Maps API Team

Cross-posted from the Google Geo Developers Blog

In this post, we hear from Monika Szymanski and Mike Kelley of the Orbitz Android engineering team, who recently migrated from version 1 to version 2 of the Google Maps Android API

About Orbitz

Nearly 30% of hotel bookings are now made via mobile devices, fueled in part by the growth of the Android platform. The recently released 3rd-generation update of the Orbitz - Flights, Hotels, Cars app for Android brings major speed and ease of use improvements along with the latest Android UI design patterns to the app. The Google Maps Android API v2 is also integrated into the hotel search experience. Read on to find out how we did it, with tips and sample code along the way.

Migrating from v1 to v2 of the Google Maps Android API 

While users of the Android app will notice some changes to the app’s user interface for maps, the changes to our code are more than skin deep. New classes offered in v2 of the Google Maps Android API like MapFragment and SupportMapFragment, the transition from ItemizedOverlays to Markers, and the addition of a well-supported info window pattern have made including a Google Map in an Android app much easier.

Say hello to the 3rd generation of Orbitz - Flights, Hotels, Cars app, using the Google Maps Android API v2

Featuring Fragments 

Prior to the introduction of MapFragment (and SupportMapFragment)  in v2, we had to write a lot of code to manually show/hide the map view in our app. Only one instance of MapView could be created per activity, so we had to be overly clever about persisting that instance in our Activity. Lack of proper Fragment support was a common pain point for developers integrating v1 of the Google Maps Android API in their application.

When Fragment support was added in v2, we essentially rewrote our map code to take advantage of the new features of MapFragment. Let’s start by taking a look at our hotel results Activity layout:

You’ll notice that we’re not including the actual fragment in the layout - we add the fragment at runtime, because we don’t want to pay the cost of the fragment transaction and add all the markers on the map, unless the user requests it.

You’ll also notice a bit of a hack at the bottom of the layout. In testing, we found that the MapFragment would leave a black box artifact on the screen on certain devices when the user opened our sliding menu navigation. Adding a simple FrameLayout “above” the map seems to fix the problem.

Extending SupportMapFragment makes it much easier to separate the map display logic from our Activity and list fragment. Our SupportMapFragment (and its inner classes) is responsible for:
  • Adding markers representing each available hotel 
  • Customizing the GoogleMap UI options 
  • Centering and animating the map to show the added markers 
  • Showing an info window when a marker is clicked 
  • Launching an Intent to display more details when an info window is clicked 
Next up, we’ll talk about how we add markers to the map and keep memory usage down.

Managing Markers 

One of the challenges in migrating from v1 to v2 of the Google Maps Android API was figuring out the best way to know which hotel’s info to display when a marker is tapped. To solve this, we place each <Marker, Hotel> pair in a HashMap when adding the markers to the Google Map. Later, we can use this HashMap to look up a marker's corresponding hotel info.

The code snippets below illustrate how we do it.

This HashMap allows us to look up the selected hotel in our InfoWindowAdapter, enabling us to display more information about it.

We place quite a few markers on the map for hotel results and each marker can have a different custom image. It's really easy to run out of memory and we were getting quite a few OutOfMemoryExceptions early in development. To manage memory more effectively, we made sure we didn't create a new new Bitmap and BitmapDescriptor for every marker placed on the map. We also ensured that the resources were recycled after we were done with them.

When the user taps a marker, we want to show more information; that’s where info windows come in handy. 

Introducing Info Windows 

Aside from simply viewing the location of all available hotels on a map, users are typically interested in the name and price of the hotel. The architecture for implementing this information window changed considerably from version 1 to version 2 of the Google Maps Android API. 

Before: Info windows in the Google Maps Android API v1
When using v1 of the Google Maps Android API, our app displayed more detailed hotel information in a custom info view when the user tapped on a hotel marker. That custom view displayed the hotel name and price, and triggered a custom animation when the view was added to the screen. This animation made it appear that the view was growing from inside the pin on the map.

We achieved this effect by setting the LayoutParams to MapView.LayoutParams.BOTTOM_CENTER and MapView.LayoutParams.MODE_MAP, which centered the bottom of the custom view on top of the tapped hotel marker.

With the introduction of the Google Maps Android API v2, MapView.LayoutParams.MODE_MAP was removed, so we explored alternative treatments to show the hotel information when the user clicks on a result. For our purposes, the best alternative was to use the new info window interface. 

After: Info windows in the Google Maps Android API v2
Creating an InfoWindowAdapter is pretty straightforward. The API provides two ways to populate the info window; either by supplying the contents of the info window (shown in the default window stylec) or creating a full View. Because we wanted to have a custom window background, loaded from a 9-patch, we opted to build a complete View for the info window by overriding the getInfoContents() method to return null, and by returning a custom View from getInfoWindow().

Here’s a sample of our code:

We could further simplify this code by having our HotelView take a Hotel model as a parameter in the constructor. 

A caveat with info windows is that even though they are populated by the returned View, the info window is not treated like a *live* View object. The system will call the view’s draw() method only once, then use that cached rendering as the user continues to interact with the map. Our existing animation didn’t work in the Google Maps Android API v2, but we decided to be consistent with the platform and remove the animation rather than try to hack around this limitation.

We <3 Google Maps Android API v2

Upgrading from version 1 to version 2 of the Google Maps Android API was virtually painless and fun to do! The introduction of MapFragment helped us separate the map display logic from the rest of the code and made code reuse much easier. Using custom info views was very straightforward with the new info window interface. We look forward to adding even more Google Map features to our app.

Monika Szymanski is a Lead Engineer on the Android team at Orbitz, where she works on apps that are friendly, fast, and easy to use. In her free time, she enjoys outdoors, running, red wine, and anything chocolate.

Mike Kelley is a Software Engineer at Orbitz, where he works on Android travel tools to help people travel smarter. He's a Michigan grad, transportation and technology enthusiast and craft beer buff. Some of Mike's ideas and projects live online at

Monica Tran joins us from our Google Maps API team in Sydney, where she helps developers tell stories and build businesses with maps.

Orbitz Worldwide (NYSE: OWW) is a leading global online travel company that uses innovative technology to enable leisure and business travelers to search for, plan and book a broad range of travel products and services including airline tickets, hotels, car rentals, cruises, and vacation packages.

Posted by Scott Knaster, Editor

Author Photo By Nick Mihailovski, Google Analytics API team

Cross-posted from the Google Analytics Blog

Google Analytics users can use the Core Reporting API to save time by building dashboards and automating complex reporting tasks. This API exposes over 250 data points (dimensions and metrics), and new data is added every few months. For many developers, it can be difficult to keep their applications up to date with all the latest data.

To make things easier, today we are launching the new Google Analytics Metadata API to simplify data discovery. The Metadata API contains all the queryable dimensions and metrics included in the Core Reporting API. We’ve also added attributes for each dimension and metric, such as the web or app name, full text description, grouping, metric calculations, deprecation status, and whether the data is queryable in segments. You can check out at a live Metadata API response here.

You now have programmatic access to generate the same list of dimensions and metrics we use to generate our public documentation.

You can now create this list using the Metadata API.

Saving developers time

When you create tools to query the Core Reporting API, you can use the Metadata API to automatically update your user interfaces. For example, Analytics Canvas, a popular third-party Google Analytics data extraction tool, uses the Metadata API to keep its query building interface up to date.

Analytics Canvas uses the Metadata API to power its query builder.

According to James Standen, founder of Analytics Canvas, "In the past, keeping Analytics Canvas up to date with the Google Analytics API dimensions and metrics required a lot of manual updating to our application. The new Metadata API automates this process, saving us time, and giving our users direct access to all the great new data the instant it's available. Users love it!"

New deprecation policy

To increase data transparency, we’ve also published a new data deprecation policy for dimensions and metrics. New data we release will be announced on our changelogs and automatically added to the Metadata API. Data we decide to remove will be marked as deprecated in the Metadata API, allowing developers to gracefully remove these values from their tools.

Get started today

Our goal was to make this API super easy to use. To get started, take a look at our resources:

Questions? Comments? Simply want to share in the excitement? Join the analytics developer community in our Reporting API Developer forum.

Nick Mihailovski oversees the Google Analytics APIs. In his spare time, he likes to travel around the world.

Posted by Scott Knaster, Editor

Author PhotoBy +Scott Knaster, Google Developers Blog Editor

Every year the Google RISE (Roots in Science and Engineering) Awards are given to non-profit educational programs around the world. The awards help open up access to programs in computer science and technology for underrepresented groups in K-12.

Last year, 30 RISE Awards were granted to organizations in Nigeria, Argentina, New Zealand, Germany, Liberia, and many more locations. Applications for this year’s awards are open until September 30th. If you’re involved with an educational group, you might want to look into it. An award could inspire someone and help change lives.

From RISE awards to the ocean’s rise, scientists have studied why wooden shipwrecks off western Antarctica seem much better preserved than those in most other areas. The answer may be that shipworms that devour wooden ships don’t like it there. A strong current plus a confluence of cold and warm waters seem to discourage the ship-eaters. A Swedish team tested this by placing wooden planks and whale bones underwater for more than a year. The wood was well-preserved, while some other really cool-looking worms feasted on the whale bones. Following this research, scientists now hope they can find a long-sought shipwreck in the area.

Finally, we want to tell you about (yet another) small, cool, handy feature in Google Search you might not have noticed: it’s a timer. If you need to count down time, just go to a Google Search box and type timer 60 seconds or something similar. You’ll see a timer that you can stop and restart, and even an optional alarm. Now you can remember that it’s time to do that thing, even if you forgot what it was.

Fridaygram always shows up on Friday, so reading old ones feels a little like time travel, although there is no Google Time Machine yet. And speaking of time, we wish Debian a happy 20th birthday today.

Author Picture By Greg DeMichillie, Google Cloud Platform team

Cross-posted from the Google Cloud Platform blog

Today’s updates to Google Cloud Platform bring lots of new enhancements complementing features we first shared at I/O. Check out the latest additions: Load balancing now available on Google Compute Engine
We’ve now added layer 3 load balancing to Compute Engine, which delivers Google-scale throughput and fault tolerance to manage Internet applications. Load balancing is critical in any highly scalable system, allowing you to automatically and intelligently route traffic across a collection of servers.

With the load balancing service, you can:
  • Load-balance ingress network TCP/UDP traffic over a specific set of Compute Engine virtual machines (VMs) within the same region
  • Ensure that only healthy VMs are used to serve Internet requests through the use of HTTP-based health checks
  • Easily handle spikes in load without pre-warming
  • Configure the load balancer via command line interface (CLI) and a programmatic RESTful API
This initial release provides Layer 3 support and we’ll continue to expand its capabilities on a regular basis. We’re pleased to offer the load balancing feature at no cost through the end of 2013, after which we’ll charge the rates outlined on our pricing page.

Improved developer experience for Google Cloud Datastore
Cloud development tools should enhance developer productivity, and that’s what we focused on with the latest update to Cloud Datastore.

Google Query Language (GQL) Support
Being able to search for data lies at the heart of all data-driven applications, and we’ve made that easier by adding GQL support — a SQL-like language for retrieving entities or keys from Cloud Datastore.

Metadata queries
You can now access Metadata Queries that allow you to retrieve statistics on their underlying data. This is useful when building your internal administration consoles, performing custom analysis or simply debugging an application.

Local SDK improvements
Part of providing great developer experiences is allowing developers to make changes in a fast, efficient and cost-effective way. That’s why we’ve made numerous enhancements to the command line tool. Separately, we’ve also included support for those of you who use Microsoft Windows.

Getting started with Ruby
If there is one thing that developers are passionate about (us included) it’s languages. The initial release of Cloud Datastore included code snippets and samples for getting up and running with Java, Python and Node. With the latest release, we’ve included the same Cloud Datastore support for Ruby developers — allowing you to easily spin up Ruby applications that rely on a managed NoSQL datastore.

Updates to the PHP runtime in Google App Engine 1.8.3
We’ve been listening to feedback from early developers using the PHP runtime, so our latest App Engine release is dedicated to PHP. But there are still a few new goodies for those of you not using PHP, which you can find in the release notes.

Our integration with Google Cloud Storage for reading and writing files has proven to be popular, so we expanded this in 1.8.3. Our latest update includes:
  • improved support for working with directories in Google Cloud Storage — allowing you to call functions such as opendir() or writedir() directly on Cloud Storage buckets
  • support for functions related to stat()-ing files, such as is_readable() and is_file()
  • the ability to write metadata to Cloud Storage files
  • substantial performance improvements through memcache-backed optimistic read caching — this improves the performance of applications that need to read frequently from the same Cloud Storage file
  • numerous bug fixes
We’ve also improved support for task queues, including the ability to set headers on push tasks and to add tasks to queues efficiently in bulk using the new PushTask:addTasks() method.

We hope you enjoy the new Cloud Platform features!

Greg DeMichillie has spent his entire career working on developer platforms for web, mobile, and the cloud. He started as a software engineer before making the jump to Product Management. When not coding, he's an avid photographer and gadget geek.

Posted by Ashleigh Rentz, Editor Emerita

Author Photo
By Vsevolod Vlasov, DevTools Software Engineer and Workspace Ninja

Cross-posted from the Chromium Blog

With Chrome DevTools our goal is to make your experience as a web developer as productive as possible. In the most recent version of Chrome we've added three major new features that will improve your authoring experience more than ever before.

Workspaces allows you to live-edit source files within DevTools with bidirectional disk persistence. CSS preprocessor mapping supports Sass file live-editing in the DevTools, allowing you to instantly see your changes. Finally snippets lets you create, edit, save and execute custom JavaScript snippets.


Within Workspaces you can load complete local filesystem folders (including back-end files such as scripts and build/deployment files) into the DevTools editor and map these to network resources. This enables you to author and tweak your scripts and styles, instantly see those changes reflected in the browser and have them transparently persist to disk — no more switching back and forth between browser and editor. The editor now supports syntax highlighting for a number of languages including PHP, Python, Java, CSS, HTML and of course JavaScript.

CSS preprocessor mapping

CSS preprocessors like Sass make it easier to organize your CSS, but until now tweaking your styles required switching to another program and refreshing Chrome. CSS preprocessor mapping enables live-editing of these sources directly within the Sources panel. To see it in action, just map the .scss file, then Ctrl-click on a property or value to jump to the variable, mixin or function that defined it. Support for other pre-processors such as Less, Stylus and Compass is in the works. Refer to the improved DevTools css-preprocessor documentation for more details and setup instructions.


There are times when you want to be able to save smaller scripts, bookmarklets and utilities so that you always have them available while debugging in the browser. Snippets is a new DevTools feature that makes it possible. It allows you to create, store and run JavaScript within the Sources tab. It gives you a multi-line console with syntax-highlight and persistence, making it convenient for prototyping code that is more than a one-liner. There's also a community-curated repository of snippets for developers that contains useful snippets such as color pickers, CSS prettyfiers, logging helpers and much more.

Today’s new features should help make web developers even more productive with DevTools. Please follow us on Google+ at Google Chrome Developers or on Twitter at @ChromiumDev and send feedback at

Vsevolod Vlasov is a Software Engineer on the Chrome DevTools team in Saint Petersburg, Russia.
His current work focuses on improving web developers authoring workflow.

Posted by Ashleigh Rentz, Editor Emerita

Author Photo
This guest post was written by Keith Casey, Sr. Developer Evangelist for Twilio

Cross-posted from the Google Cloud Platform Blog

I’ve wanted to explore Google App Engine for years. Between its SLA, automatic scaling, and queuing system, it has always been compelling. Unfortunately, since my Python skills are somewhere between “Hello World” and “OMG What did I just do!?” I decided to save myself the embarrassment. When Google announced PHP support for App Engine, I was both ecstatic and intrigued about what might be possible. To get something running in just a few minutes, I decided to use our Twilio PHP helper.

When experimenting with a new Platform as a Service, there are nuances of which you should be aware like dealing with a virtualized file system and needing a separate service for email. However, the remaining nuances are usually pretty minimal and required only the “tweaking of my module” rather than a heavy “rebuilding of my app”.

Knowing that up front, let’s dig in.

Set up the PHP on App Engine environment

First, check out and follow Google’s Getting started with PHP on Google App Engine to set up your local environment. Their instructions will cover setting up the SDK, connecting to your account, and some details on debugging. It should set up your environment under http://localhost:8080/ which serves as the root of your application.

Upgrade your Twilio Helper library

Next, with respect to Twilio’s PHP Helper library, we’ve taken care of the nuances for you, the most important one of which involved falling back to PHP’s Streams when cUrl isn’t available. In your case, simply upgrade the library to v3.11+ or install it for the first time. You can use the library to send text messages and make phone calls exactly as you would in any other PHP environment:

// Include the Twilio PHP library
require "Services/Twilio.php";
// Set your AccountSid and AuthToken from
// Instantiate a new Twilio Rest Client
$client = new Services_Twilio($AccountSid, $AuthToken);
// Make an array of people we know, to send them a message:
$people = array(
    "+14158675309" => "Curious George",
    "+14158675310" => "Boots",
    "+14158675311" => "Virgil",
// Loop over all our friends:
foreach ($people as $number => $name) {
    $sms = $client->account->sms_messages->create(
        "YYY-YYY-YYYY",     // Change the 'From' number to a Twilio number you've purchased
        $number,            // the number we are sending to - Any phone number
        "Hey $name, Monkey Party at 6PM. Bring Bananas!"  // the sms body
    echo "Sent message to $name";        // Display a confirmation message

If you’re interested in the the specific changes for our library, you can explore the relevant pull requests here and here. I also have an article called “Preparing your PHP for App Engine” in next month’s php|architect magazine.

URL Routing in PHP

Within App Engine, the entire routing system is powered by the app.yaml file. If you’re familiar with development using frameworks like Zend or Symfony, defining your routes will come naturally and may be marginally more difficult than copy/paste. If you’re only familiar with doing non-framework development in PHP, you’ll have to define a route for each and every PHP file the user accesses. In Google’s example “hello world” app, your app.yaml file should should begin with something like this:

application: examplehelloworld
version: 1
runtime: php
api_version: 1
threadsafe: true
- url: .*
  script: main.php

The request handlers are the important part. If you’re using an MVC framework or OpenVBX, you’ll most likely have one primary element mapping your index.php file and a set of elements for static assets like JavaScript, CSS, and images.

Alternatively, if you’re not using a using a framework, app.yaml will map different URL patterns to individual PHP scripts, like this:
application: examplehelloworld
version: 1
runtime: php
api_version: 1
threadsafe: true
- url: /images
  static_dir: images
- url: /send-sms
  script: send-sms.php
- url: /make-call
  script: make-call.php
- url: .*
  script: index.php

Within those individual PHP scripts, no changes are necessary, so our make-call.php is straightforward and identical to our quickstart:
require 'Services/Twilio.php';
include 'credentials.php';
$client = new Services_Twilio($AccountSid, $AuthToken);
$call = $client->account->calls->create(
    '1512-555-1212', // From this number
    '17035551212',   // Send to this number
print $call->sid;

Also, the send-sms.php can be the same as our normal quickstart:
require 'Services/Twilio.php';
include 'credentials.php';
$client = new Services_Twilio($AccountSid, $AuthToken);
$call = $client->account->sms_messages->create(
    '1512-555-1212', // From this number
    '17035551212',   // Send to this number
    'Hello monkey!!'
print $call->sid;

Now you can access your scripts via http://localhost:8080/make-call.php and http://localhost:8080/send-sms.php respectively. If the file is one that doesn’t need to be accessible publicly, such as your credentials.php file, it shouldn’t have a listing.

Voila. You now have your first PHP application on Google App Engine!

I hope this is helpful as you test and deploy your PHP applications on Google App Engine. If you have any tips, feedback, suggestions, or just a good joke please let me know via email or Twitter: @CaseySoftware.

Keith Casey currently serves as a Developer Evangelist for Twilio to get good tools to good developers so they can change how businesses communicate. In his spare time, he is a core contributor to web2project, works to build and support the Austin technology community, blogs occasionally at and is completely fascinated by monkeys.

Posted by Ashleigh Rentz, Editor Emerita

Author PhotoBy +Scott Knaster, Google Developers Blog Editor

This week we launched Google Maps Views, a site where you can see and share photo spheres of your favorite places. You can enjoy photo spheres of beautiful and amazing locations, such as the Northwest Territories, Canada and Masvingo, Zimbabwe.

photos of Nimes, France

Photo Spheres displayed on the Views site include a handy “View on Google Maps” link, which enables you to see the photo sphere’s location displayed on a large map. And because Views is a community site, we encourage you to contribute your own photo spheres, which you can create using an Android phone or DSLR camera.

Our phones and cameras run on batteries, but it’s hard to get by without electric power in the wall. Power system engineers have studied the massive U.S. power blackout of 2003 and are working to prevent similar failures from happening again. Their primary tool is using phasor measurement units to monitor the interconnected power grid. These devices give early warning when something isn’t right, such as when a generating plant starts to fail. This gives operators time to take action before cascading problems can cause catastrophic failures, as in 2003. So your local power might be out, but at least it won’t knock out the lights for the next 10 cities down the road.

Finally, if you want to contemplate what’s beyond the bounds of Earth, take a look at some of the amazing photos submitted in the 2013 Astronomy Photographer of the Year competition. If you really love astronomy photos, you can see all 13,000 photos sent in since 2008. That should give you something to look at while you take a break from coding this weekend.

We’ll share anything nerdy here on Fridaygram. For example, if astronomy photos aren’t your thing, visit these simple animated GIFs that show how machines work. You might get inspired to build something of your own!