Skip to content

Software Development Blogs: Programming, Software Testing, Agile Project Management

Methods & Tools

Subscribe to Methods & Tools
if you are not afraid to read more than one page to be a smarter software developer, software tester or project manager!

Google Code Blog
Syndicate content
News and insights on Google platforms, tools and eventsewoodhttp://www.blogger.com/profile/12341551220176883769noreply@blogger.comBlogger1406125
Updated: 1 week 9 hours ago

Google Analytics Demos & Tools

Thu, 11/20/2014 - 18:05
As a member of the Google Analytics Developer Relations team, I often hear from our community that they want to do more with GA but don't always know how. They know the basics but want to see full examples and demos that show how things should be built.

Well, we've been listening, and today I'm proud to announce the launch of Google Analytics Demos & Tools, a new website geared toward helping Google Analytics developers tackle the challenges they face most often.

The site aims to make experienced developers more productive (we use it internally all the time) and to show new users what's possible and inspire them to leverage the platform to improve their business through advanced measurement and analysis.

Google Analytics Developers Image
Some highlights of the site include a full-featured Enhanced Ecommerce demo with code samples for both Google Analytics and Google Tag Manager, a new Account Explorer tool to help you quickly find the IDs you need for various Google Analytics services and 3rd party integrations, several examples of easy-to-build custom dashboards, and some old favorites like the Query Explorer.

Google Analytics Demos & Tools not only shows off Google Analytics technologies, it also uses them under the hood. All pages that require authorization use the Embed API to log users in, and usage statistics, including outbound link clicks, authorization status, client-side exceptions, and numerous other user interaction events are measured using analytics.js.

Every page that makes use of a Google Analytics technology lists that information in the footer, making it easy for developers to see how all the pieces fit together. In addition, the entire site is open sourced and available on Github, so you can dive in and see exactly how everything works.

Feedback is welcome and appreciated!

Posted By Philip Walton, Developer Programs Engineer
Categories: Programming

Launchpad Online for developers: Getting Started with Google APIs

Wed, 11/19/2014 - 19:00
Google APIs give you the power to build rich integrations with our most popular applications, including Google Maps, YouTube, Gmail, Google Drive and more. If you are new to our developer features, we want to give you a quick jumpstart on how to use them effectively and build amazing things.

As you saw last week, we’re excited to partner with the Startup Launch team to create the “Launchpad Online”, a new video series for a global audience that joins their cadre which already includes the established “Root Access” and “How I:” series, as well as a “Global Spotlight” series on some of the startups that have benefitted from the Startup Launch program. This new series focuses on developers who are beginners to one or more Google APIs. Each episode helps get new users off the ground with the basics, shows experienced developers more advanced techniques, or introduces new API features, all in as few lines of code as possible.

The series assumes you have some experience developing software and are comfortable using languages like Javascript and Python. Be inspired by a short working example that you can drop into your own app and customize as desired, letting you “take off” with that great idea. Hopefully you had a chance to view our intro video last week and are ready for more!

Once you’ve got your developers ready to get started, learn how to use the Google Developers Console to set up a project (see video to the right), and walk through common security code required for your app to access Google APIs. When you’ve got this “foundation” under your belt, you’ll be ready to build your first app… listing your files on Google Drive. You’ll learn something new and see some code that makes it happen in each future episode… we look forward to having you join us soon on Launchpad Online!

Posted by Wesley Chun, Developer Advocate, Google

+Wesley Chun (@wescpy) is an engineer, author of the bestselling Core Python books, and a Developer Advocate at Google, specializing in Google Drive, Google Apps Script, Gmail, Google Apps, cloud computing, developer training, and academia. He loves traveling worldwide to meet Google users everywhere, whether at a developers conference, user group meeting, or on a university campus!
Categories: Programming

You’re invited to submit an app to the Google Fit Developer Challenge

Tue, 11/18/2014 - 18:00
With the recent launch of the Google Fit platform, we hope to spur innovation in the world of fitness apps and devices that encourage users to have a more active lifestyle. To expand the ecosystem and help users get a more comprehensive view of their fitness, we’re excited to announce the Google Fit Developer Challenge in partnership with adidas, Polar, and Withings.
We’re inviting you to create and showcase an app, or update an existing app, that integrates with Google Fit. The submission deadline is February 17, 2015. Our selected judges will choose up to six new apps and six existing apps for Fit, as the winners. The judges are looking for fitness apps that are innovative, fun to use, keep users coming back, offer users real benefit, and meet the Android design and quality guidelines.

Challenge winners will be featured on Google Play in front of Android users around the world. Runners-ups will also receive prizes, in the form of smart devices from Google, adidas, Polar, and Withings, so that they can continue to tinker and improve their fitness apps with the latest hardware.

Check out the challenge website to find out how to enter*. You will also find some helpful resources to find inspiration. We encourage you to join the Google Fit Developer Community on Google+ to discuss your ideas and the challenge.

* The challenge is open to registered Google Play developers in the US, UK, France, Germany, India, Israel, Hong Kong, Singapore, South Korea, Japan, and Taiwan who are over the age of 18 (or the age of majority in their country). For the full terms and conditions, read the official rules.

Posted by Angana Ghosh, Product Manager, Google Fit
Categories: Programming

Building Games with Google Cast is Easy and Powerful

Fri, 11/14/2014 - 20:03
By Nathan Camarillo, Chromecast Product Manager for Games

This week, we announced several Google Cast games that were built with the Google Cast SDK. With a Google Cast endpoint like a Chromecast or Android TV, developers can now use Google Cast to bring a whole new style of multi-screen social gaming experiences to the living room.
What makes a Google Cast game unique? It enables multi-screen gameplay between mobile devices and a television, and it transforms users’ mobile devices into amazing game controllers. Anyone with a compatible Android or iOS phone or tablet can join the game. There’s no hassle or expense with extra controllers or peripherals; your very own iPhone or Android phone simply works and everyone can join in.

The innovative part of creating a Google Cast game is all the ways you can use mobile devices to create a variety of controls with the television as a shared screen. The Accelerometer can be used for motion controls ranging from subtle, to dramatic, to rhythmic. No-Look Controls and virtual controllers can allow you to focus on the television as you compete against friends. Direct target manipulation through touch controls can create intense gameplay moments that temporarily focus on the mobile device and then return the focus to the television where all players can share and compare the results. You can even use the microphone or other input methods to create games for everyone in the home. Whether cooperative or competitive, Google Cast enables you to create fun moments for everyone using the devices they already have and know how to use.

Now it’s your turn! Go make something fun with the Google Cast Design Principles. The experiences you create using Google Cast will entertain gamers and inspire a whole community of developers embracing a new revolution in multi-screen gaming.

Categories: Programming

Accelerate business growth with Startup Launch & Launchpad Online

Thu, 11/13/2014 - 21:08
Last June, we launched Startup Launch, a program to help tech startups at all stages become successful on the Google Developers platform and open-source technologies. So far, we’ve helped more than 3,000 entrepreneurs transform their ideas into burgeoning websites, services, apps, and products in 150 countries. Hear some of their stories from the Czech Republic, Poland, Kenya, Brazil and Mexico in our Global Spotlight playlist.

Launchpad OnlineToday, we’re bringing the program to a wider audience with a new web series called Launchpad Online, to share knowledge based on questions we’ve had from entrepreneurs using our products. The series kicks off with technical instruction from Developer Advocate Wesley Chun on getting started with Google developer tools and APIs and over time will expand to include topics covering design and distribution.
This show accompanies our established "Root Access" and “How I:” series, which bring perspective and best practices to developers and entrepreneurs on a weekly basis.

Launchpad EventsLaunchpad Online follows the curriculum set out by our ongoing Launchpad events, week-long bootcamps for startups in select cities. In 2014, over 200 startups participated in events in Tel Aviv, London, Rio de Janeiro, Berlin, and Paris, which consisted of workshops on product strategy, UX/UI, engineering, digital marketing and presentation skills. Check out our videos covering recent events in Paris and Berlin here.

You’re invitedIn addition to events and online content, the program offers product credits to participants, from $500 of Cloud Platform and AdWords credits to startups who are just starting off, up to Google’s Cloud Platform startup offer of $100,000 USD in Cloud Credit offerings to startups ready to scale their business. You can apply for these benefits, and to be selected for future Launchpad events, at g.co/launch. Startup Launch runs in conjunction with our Google Business Groups and Google Developer Groups on the ground. Together, these communities have hosted more than 5,000 events in 543 cities and 104 countries this year, helping startups connect with other developers and entrepreneurs. Attend an upcoming business or developer event near you. We hope to see you there!

Posted by Amir Shevat, Global Startup Outreach Program Manager, Google Developer Relations
Categories: Programming

Geometry Math Library for C++ Game Developers: MathFu

Thu, 11/13/2014 - 18:45
Today we're announcing the 1.0 release of MathFu, a cross-platform geometry math library for C++ game developers. MathFu is a C++ math library developed primarily for games focused on simplicity and efficiency.

It provides a suite of vector, matrix and quaternion classes to perform basic geometry suitable for game developers. This functionality can be used to construct geometry for graphics libraries like OpenGL or perform calculations for animation or physics systems.

The library is written in portable C++ with SIMD compiler intrinsics and has been tested on Android, Linux, OS X and Windows.

You can download the latest open source release from our GitHub page. We invite you to contribute to the project and join our discussion list!

By Stewart Miles, Fun Propulsion Labs at Google*

*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.
Categories: Programming

"I can get another if I break it": Announcing Noto Nastaliq Urdu

Tue, 11/11/2014 - 05:00
Today, we are excited to release an early version of Noto Nastaliq Urdu.

Nastaliq’s rich typographic tradition presents particular challenges to computerized typography. We’ve been working over a year to solve technical and design issues for an Urdu Nastaliq (aka Nastaleeq) font. This early version is by no means complete and perfect. We expect to work closely with the community to incorporate comments and suggestions.

This preview font can be downloaded from the Noto homepage or the Noto repository, and is also available as a webfont on Google Fonts Early Access.

This is a sample web page to showcase Noto Nastaliq Urdu as a webfont. Go ahead open it. If your browser renders it correctly, you will see something like this:


Text in the image is from a poem by Urdu poet Mirza Ghalib. It means “I can get another if I break it / so a clay cup trumps a grail.” This font can be challenging to the current generation of browsers and font renderers. It partially broke a few of them; we have been working with browser manufacturers to fix all those issues.

We are looking forward to your feedback and bug reports. Please contact us through https://code.google.com/p/noto/issues/entry. Known issues can be found here.

Posted by Behdad Esfahbod, Software Engineer, Fonts & Text Rendering, Google Internationalization Engineering
Categories: Programming

Subject: Changes to the Google APIs Terms of Service

Wed, 11/05/2014 - 22:59
We'd like to inform you about some changes we're making to our Google APIs Terms of Service.

You’ll find the new terms at the same location as always, and we’ve also posted a summary of the main changes.

Some of the bigger changes include:
  • On the subject of Data Portability: we are making it clear that your obligation to abide by the Data Portability requirements continues for as long as you use or store user data obtained through the APIs (whether or not you are still using our APIs) and that you agree you won’t make that data available to third parties who don’t also abide by this obligation. In other words: we value end users’ control over their data; if you’d like to use our APIs, you should, too.
  • We are requiring developers to not violate any other Google terms of service.
  • We need to make our APIs better, and we may sometimes do that by using content submitted through the APIs. We reserve the right to do this, but we will only do this to provide, secure and improve the APIs (and related service(s)) and only in accordance with our privacy policies.

And some of the smaller changes include:
  • We are asking developers who use our services to keep us up-to-date on how to contact them.
  • Making it clear that the APIs should not be used for high risk activities, with ITAR data, or with HIPAA protected health information (unless Google agrees in writing).
  • Asking developers to make reasonable efforts to keep their private keys private and not embed them in open source projects.
  • We are reminding you that we set limits on your usage of our APIs; if you need more, you need to obtain our consent.
  • Most changes to the Terms of Service may go into effect 30 days after posting (rather than the prior 7 days)
The updated terms will go into effect on December 5, 2014.

Posted by Dan Ciruli, Product Manager
Categories: Programming

Material Design Gets More Material

Mon, 11/03/2014 - 20:32

A few weeks ago, we published our first significant update to the material design guidelines. Today, we’re addressing even more of the comments and suggestions you’ve provided with another major update to the spec. Check out some of the highlights below.

  • Links to Android developer docs. One of the biggest requests we’ve heard from developers and designers is that the guidelines should offer quicker access to related developer documentation. We’ve started to add key links for Android developers, and we’re committed to more tightly integrating the spec with both the Polymer and Android docs.
  • A new What is Material? section. While the introduction offers a succinct bird’s-eye-view of material design, it left open some questions that were previously only answered in video content (the Google I/O videos and DesignBytes). This new sections dives deeper into the environment established by material design, including material properties and how we work with objects in 3D space.
  • A What’s New section. We view the material design spec as a living document, meaning we’ll be continually adding and refining content. The What’s New section, which was a highly requested feature, should help designers track the spec’s evolution.

In addition to these major new features and sections, there’s even more in today’s update, including:

Stay tuned for even more updates as we continue to integrate the relevant developer docs, refine existing spec sections, and expand the spec to cover more ground. And as always, remember to leave your suggestions on Google+!

Posted by Roman Nurik, Design Advocate
Categories: Programming

Better search on developers.google.com

Fri, 10/31/2014 - 18:56
Posted by Aaron Karp, Product Manager, developers.google.com

We recently launched a major upgrade for the search box on developers.google.com: it now provides clickable suggestions as you type.
We hope this becomes your new favorite way to navigate developers.google.com, and to make things even easier we enabled “/” as a shortcut key for accessing the search field on any page.

If you have any feedback on this new feature, please let us know by leaving a comment below. And we have more exciting upgrades coming soon, so stay tuned!

Categories: Programming

Make your emails stand out in Inbox

Thu, 10/30/2014 - 19:30
Originally posted on the Google Apps Developers Blog

As we announced last week, Inbox is a whole new take on, well, the inbox. It’s built by the Gmail team, but it’s not Gmail—it’s a new product designed to help users succeed in today’s world of email overload and multiple devices. At the same time, Inbox can also help you as a sender by offering new tools to make your emails more interactive!

Specifically, you can now take advantage of a new feature called Highlights.

Exactly like it sounds, Highlights “highlight” or surface key information and actions from an email and display them as easy-to-see chips in the inbox. For example, if you’re an airline that sends flight confirmation emails, Highlights can surface the “Check-in for your flight” action and display live flight status information for recipients right in the user’s main list. The same can apply if you send customers hotel reservations, event details, event invitations, restaurant reservations, purchases, or other tickets. Highlights help ensure that your recipients see your messages and the important details at a glance.

To take advantage of Highlights, you can mark up your email messages to specify which details you want surfaced for your customers. This will make it possible for not only Inbox, but also Gmail, Google Now, Google Search, and Maps to interact more easily with your messages and give your recipients the best possible experience across Android, iOS and the web.

As an example, the following JSON-LD markup can be used by restaurants to send reservation confirmations to their users/customers:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "FoodEstablishmentReservation",
"reservationNumber": "WTA1EK",
"reservationStatus": "http://schema.org/Confirmed",
. . . information about dining customer . . .
"reservationFor": {
"@type": "FoodEstablishment",
"name": "Charlie’s Cafe",
"address": {
"@type": "PostalAddress",
"streetAddress": "1600 Amphitheatre Parkway",
"addressLocality": "Mountain View",
"addressRegion": "CA",
"postalCode": "94043",
"addressCountry": "United States"
},
"telephone": "+1 650 253 0000"
},
"startTime": "2015-01-01T19:30:00-07:00",
"partySize": "2"
}
</script>

When your confirmation is received, users will see a convenient Highlight with the pertinents at the top of their Inbox, then can open the message to obtain the full details of their reservation as shown above.

Getting started is simple: read about email markup, check out more markup examples, then register at developers.google.com/gmail/markup and follow the instructions from there!


by Shalini Agarwal, Product Management, Inbox by Gmail
Categories: Programming

No map is an island: Introducing a connected JavaScript Maps API experience

Wed, 10/29/2014 - 17:52
Cross-posted from the Google Geo Developers blog

Our digital lives are increasingly connected. We research on our laptops, look up directions on our phones and even navigate with our watches. And by creating maps unique to each user and offering features such as saved places, Google Maps has been making it easier to continue these tasks as we move from device to device.

However, although maps embedded from Google Maps are now built uniquely for every Google user, most of the now two million active sites and apps using the Maps APIs are still islands. When I look for a place to eat on Zagat, I can’t see how far away it is from work. When I look at a travel map in the New York Times, I can’t save those places in order to navigate to them later.

Today we’re taking a step towards connecting these two million sites and apps by introducing a signed-in JavaScript Maps API experience and a feature called attributed save. To help illustrate, we’ve partnered with the New York Times to bring this experience to their 36 hours travel column.

A connected JavaScript Maps API

When you add &signed_in=true to the Google Maps JavaScript API source url, your end users will have the option to sign into the map with their Google account. When they do so, your users will receive a map built for them, in the context of your app. Their saved places — including home and work addresses (if set by the end user) as well as other relevant places — will appear automatically on their map, providing a layer of context that anchors your content and makes it stand out even more.

Attributed save

Once users are signed into the Google Maps in your app, we can together create an integrated experience between your map content and Google Maps. With attributed save, signed-in users can save places from your app to be accessed later, with attribution and linkbacks, on Google Maps for the web, Android and iOS.

What’s more, you can also enable deep links into your mobile applications. For instance, users can save a place from your desktop app (such as Zagat.com), open up the place on Google Maps on their Android device, and deep link directly into your Android app.

Enabling attributed save is easy — just specify your app name, a link and a place search string or place ID when creating a marker and info window. Or use our SaveWidget to enable attributed save in your own custom info window.

In addition, we’re also launching attributed save across all embedded maps today. Attribution and linkback parameter will be inferred automatically from the domain and referrer of the host site, so if you’re using our embedded maps, you don’t need to do anything! If you’re using the Google Maps Embed API, you may customize the source and link back parameters yourself.

One final point: we’ve stated in the past that the JavaScript Maps API is cookieless if loaded from maps.googleapis.com. As of today, to enable the signed in maps experience on sites across the web, the signed-in version of the JavaScript Maps API now does rely on cookies to detect the end user’s signed-in state. Please review our documentation for further details.

That’s all for now. Go try it out. And remember, no map is an island, entire of itself...

Posted by Ken Hoetmer, Product Manager, Google Maps APIs
Categories: Programming

Google Fit SDK available now

Tue, 10/28/2014 - 18:13

After previewing it earlier this summer, today the Google Fit APIs are fully available on Android, Android Wear and the web so that you can build and publish apps for users on Google Play. Head to developers.google.com/fit to learn more.

The Google Fit platform gives the user one place to keep all their fitness activities. With the user’s permission, any developer can store or read the user’s data from Google Fit and use it to build powerful and useful fitness experiences for their users.

For users, we’re also launching the Google Fit app on Google Play for smartphones, tablets, Wear, and on the web at google.com/fit. The Google Fit app provides users with effortless, all-day activity tracking, as well as displaying key fitness data that our partners have stored in the platform. This app will also provide an opportunity for users to discover apps that help them track their fitness goals using Google Fit.

To get a quick introduction to the Fit APIs, check out the Dev Byte videos below.


A number of partners from around the fitness industry have been hard at work preparing their apps for Google Fit. In the coming weeks, our previously-announced launch partners, Nike+ Running, Withings HealthMate, Runkeeper, Runtastic, and Noom Coach, will launch their Google Fit integrations. We’re also happy to announce 6 new Google Fit partners: Strava, MapMyRun, LynxFit, LifeSum, FatSecret, and Azumio. These new partners are also preparing great experiences that will launch soon.

Please join the Google Fit Developer Community to share ideas and get inspired. We can’t wait to see what you come up with!

Posted by Angana Ghosh, Product Manager, Google Fit

Categories: Programming

Recap of the 2014 Google Cloud Platform Roadshows

Thu, 10/23/2014 - 17:00
We just wrapped up the Google Cloud Platform Roadshows, a series of developer events in 35 cities worldwide, where we reached nearly 4,500 developers spanning the globe, from Texas to Tel Aviv to Tokyo.

Now that the series is finished, we wanted to thank everyone for coming and share with you the slides and live recording of the talks from our New York City event:


The Roadshow team sends huge thanks to everyone who attended and looks forward to seeing you next year. We'd love to hear from you in the meantime:


Posted by Tom Van Waardhuizen, Program Manager
Categories: Programming

Welcome Firebase to the Google Cloud Platform Team

Tue, 10/21/2014 - 18:31
Today we extend a warm welcome to Firebase, who is joining the Google Cloud Platform team. Firebase makes it very easy for developers to build mobile and web apps that store and sync data in realtime.

Mobile is one of the fastest-growing categories of app development, but it’s also still too hard for most developers. With Firebase, developers are able to easily sync data across web and mobile apps without having to manage connections or write complex sync logic. Firebase makes it easy to build applications that work offline and has full-featured libraries for all major web and mobile platforms, including Android and iOS.

By combining Firebase with Google Cloud Platform, we’ll be able to build the best end-to-end platform for mobile application development. If you’re already a Firebase developer, you’ll start seeing improvements right away and if you’re a Google Cloud Platform customer, you’ll find it even easier to create great mobile and web apps. The entire Firebase team is joining Google and, under the leadership of Firebase co-founders James Tamplin and Andrew Lee, will be working hard to bring you great new features. Not only will the products you already love continue to get better, but you’ll also gain access to the full power of Google Cloud Platform.

At Google Cloud Platform Live on November 4, we’ll be demonstrating new Firebase features and integrations with Cloud Platform. You can join us there in person or you can register to stream online for free.

If you are looking for more info check out the Firebase blog. We can’t wait to see what applications you build!

Greg DeMichillie, Director of Product Management
Categories: Programming

Updated Material Design Guidelines and Resources

Fri, 10/17/2014 - 18:00

When we first published the Material Design guidelines back in June, we set out to create a living document that would grow with feedback from the community. In that time, we’ve seen some great work from the community in augmenting the guidelines with things like Sketch templates, icon downloads and screens upon screens of inspiring visual and motion design ideas. We’ve also received a lot of feedback around what resources we can provide to make using Material Design in your projects easier.

So today, in addition to publishing the final Android 5.0 SDK for developers, we’re publishing our first significant update to the Material Design guidelines, with additional resources including:

  • Updated sticker sheets in PSD, AI and Sketch formats
  • A new icon library ZIP download
  • Updated color swatch downloads
  • Updated whiteframe downloads, including better baseline grid text alignment and other miscellaneous fixes

The sticker sheets have been updated to reflect the latest refinements to the components and integrated into a single, comprehensive sticker sheet that should be easier to use. An aggregated sticker sheet is also newly available for Adobe Photoshop and Sketch—two hugely popular requests. In the sticker sheet, you can find various elements that make up layouts, including light and dark symbols for the status bar, app bar, bottom toolbar, cards, dropdowns, search fields, dividers, navigation drawers, dialogs, the floating action button, and other components. The sticker sheets now also include explanatory text for elements.

Note that the images in the Components section of the guidelines haven't yet been updated (that’s coming soon!), so you can consider the sticker sheets to be the most up-to-date version of the components.

Also, the new system icons sticker sheet contains icons commonly used in Android across different apps, such as icons used for media playback, communication, content editing, connectivity, and so on.

Stay tuned for more enhancements as we incorporate more of your feedback—remember to share your suggestions on Google+! We’re excited to continue evolving this living document with you!

For more on Material Design, check out these videos and the new getting started guide for Android developers.

Posted by Roman Nurik, Design Advocate
Categories: Programming

Componentize the web, with Polycasts!

Fri, 10/03/2014 - 18:58
Today at Google, we’re excited to announce the launch of Polycasts, a new video series to get developers up and running with Polymer and Web Components.

Web Components usher in a new era of web development, allowing developers to create encapsulated, interoperable elements that extend HTML itself. Built atop these new standards, Polymer makes it easier and faster to build Web Components, while also adding polyfill support so they work across all modern browsers.

Because Polymer and Web Components are such big changes for the platform, there’s a lot to learn, and it can be easy to get lost in the complexity. For that reason, we created Polycasts.

Polycasts are designed to be bite sized, and to teach one concept at a time. Along the way we plan to highlight best practices for not only working with Polymer, but also using the DevTools to make sure your code is performant.

We’ll be releasing new videos often over the coming weeks, initially focusing on core elements and layout. These episodes will also be embedded throughout the Polymer site, helping to augment the existing documentation. Because there’s so much to cover in the Polymer universe, we want to hear from you! What would you like to see? Feel free to shoot a tweet to @rob_dodson, if you have an idea for a show, and be sure to subscribe to our YouTube channel so you’re notified when new episodes are released.

Posted by Rob Dodson, Developer Advocate
Categories: Programming

Promises in the Google APIs JavaScript Client Library

Thu, 10/02/2014 - 21:28
The JavaScript Client Library for Google APIs is now Promises/A+-conformant. Requests made using gapi.client.request, gapi.client.newBatch, and from generated API methods like gapi.client.plus.people.search are also promises. You can pass in response and error handlers through their then methods.

Requests can be made using the then syntax provided by Promises:
gapi.client.load(‘plus’, ‘v1’).then(function () { 
gapi.client.plus.people.search({query: ‘John’}).then(function(res) {
console.log(res.result.items);
}, function(err) {
console.error(err.result);
});
})
All fulfilled responses and rejected application errors passed to the handlers will have these fields:
{
result: *, // JSON-parsed body or boolean false if not JSON-parseable
body: string,
headers: (Object.),
status: (?number),
statusText: (?string)
}
The promises can also be chained, making your code more readable:
gapi.client.youtube.playlistItems.list({
playlistId: 'PLOU2XLYxmsIIwGK7v7jg3gQvIAWJzdat_',
part: 'snippet'
}).then(function(res) {
return res.result.items.map(function(item) {
return item.snippet.resourceId.videoId;
});
}).then(function(videoIds) {
return gapi.client.youtube.videos.list({
id: videoIds.join(','),
part: 'snippet,contentDetails'
});
}).then(function(res) {
res.result.items.forEach(function(item) {
console.log(item);
});
}, function(err) {
console.error(error.result);
});
Using promises makes it easy to handle results of API requests and offer elegant error propagation.

To learn more about promises in the library and about converting from callbacks to promises, visit Using Promises and check out our latest API reference.

Posted by Jane Park, Software Engineer
Categories: Programming

Sudoku, Linear Optimization, and the Ten Cent Diet

Tue, 09/30/2014 - 17:12
Originally posted on the Google Research blog. Cross posted on the Google Apps Developers blog

In 1945, future Nobel laureate George Stigler wrote an essay in the Journal of Farm Economics titled The Cost of Subsistence about a seemingly simple problem: how could a soldier be fed for as little money as possible?

The “Stigler Diet” became a classic problem in the then-new field of linear optimization, which is used today in many areas of science and engineering. Any time you have a set of linear constraints such as “at least 50 square meters of solar panels” or “the amount of paint should equal the amount of primer” along with a linear goal (e.g., “minimize cost” or “maximize customers served”), that’s a linear optimization problem.

At Google, our engineers work on plenty of optimization problems. One example is our YouTube video stabilization system, which uses linear optimization to eliminate the shakiness of handheld cameras. A more lighthearted example is in the Google Docs Sudoku add-on, which instantaneously generates and solves Sudoku puzzles inside a Google Sheet, using the SCIP mixed integer programming solver to compute the solution.
Today we’re proud to announce two new ways for everyone to solve linear optimization problems. First, you can now solve linear optimization problems in Google Sheets with the Linear Optimization add-on written by Google Software Engineer Mihai Amarandei-Stavila. The add-on uses Google Apps Script to send optimization problems to Google servers. The solutions are displayed inside the spreadsheet. For developers who want to create their own applications on top of Google Apps, we also provide an API to let you call our linear solver directly.
Second, we’re open-sourcing the linear solver underlying the add-on: Glop (the Google Linear Optimization Package), created by Bruno de Backer with other members of the Google Optimization team. It’s available as part of the or-tools suite and we provide a few examples to get you started. On that page, you’ll find the Glop solution to the Stigler diet problem. (A Google Sheets file that uses Glop and the Linear Optimization add-on to solve the Stigler diet problem is available here. You’ll need to install the add-on first.)

Stigler posed his problem as follows: given nine nutrients (calories, protein, Vitamin C, and so on) and 77 candidate foods, find the foods that could sustain soldiers at minimum cost.

The Simplex algorithm for linear optimization was two years away from being invented, so Stigler had to do his best, arriving at a diet that cost $39.93 per year (in 1939 dollars), or just over ten cents per day. Even that wasn’t the cheapest diet. In 1947, Jack Laderman used Simplex, nine calculator-wielding clerks, and 120 person-days to arrive at the optimal solution.

Glop’s Simplex implementation solves the problem in 300 milliseconds. Unfortunately, Stigler didn’t include taste as a constraint, and so the poor hypothetical soldiers will eat nothing but the following, ever:

  • Enriched wheat flour
  • Liver
  • Cabbage
  • Spinach
  • Navy beans

Is it possible to create an appealing dish out of these five ingredients? Google Chef Anthony Marco took it as a challenge, and we’re calling the result Foie Linéaire à la Stigler:
This optimal meal consists of seared calf liver dredged in flour, atop a navy bean purée with marinated cabbage and a spinach pesto.

Chef Marco reported that the most difficult constraint was making the dish tasty without butter or cream. That said, I had the opportunity to taste our linear optimization solution, and it was delicious.

Posted by Jon Orwant, Engineering Manager
Categories: Programming

Tell us about your experience building on Google, and raise money for educational organizations!

Thu, 09/25/2014 - 22:16
Here at Google, we always put the user first, and for the Developer Platform team, our developers are our users. We want to create the best development platform and provide the support you need to build world-changing apps, but we need to hear from you, our users, on a regular basis so we can see what’s working and what needs to change.

That's why we're launching our developer survey -- we want to hear about how you are using our APIs and platforms, and what your experience is using our developer products and services. We'll use your responses to identify how we can support you better in your development efforts.
Photo Credit: Google I/O 2014

The survey should only take 10 to 15 minutes of your time, and in addition to helping us improve our products, you can also help raise money to educate children around the globe. For every developer who completes the survey, we will donate $10 USD (up to a maximum amount of $20,000USD total) to your choice of one of these six education-focused organizations: Khan Academy, World Fund, Donors Choose, Girl Rising, Raspberry Pi, and Agastya.

The survey is live now and will be live until 11:59PM Pacific Time on October 15, 2014. We are excited to hear what you have to tell us!

Posted by Neel Kshetramade, Program Manager, Developer Platform
Categories: Programming