Showing posts with label API. Show all posts
Showing posts with label API. Show all posts

Wednesday, February 4, 2015

Google Maps Javascript API Tutorial is Rubbish

I am working on creating a Google-maps based project. As such, I was using the Google Maps Javascript API Tutorial to activate an API key and create a 'Hello World' style test script.

I continuously received one of the following errors:

Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: https://developers.google.com/maps/documentation/javascript/tutorial#api_key

Google has disabled use of the Maps API for this application. See the Terms of Service for more information: http://www.google.com/intl/en-US_US/help/terms_maps.html.

Having not used the API to make a single call, the notion that I had somehow violated the Google TOS was particularly infuriating, as was the notion that I had not enabled the Google Maps API, which I had done, as outlined in the API Tutorial:


The issue, at least in my case, turned out to be the sample code that Google provides in the same tutorial. The sample is as follows:


<html>
  <head>
    <style type="text/css">
      html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?key=API_KEY" type="text/javascript">
    </script>
    <script type="text/javascript">
      function initialize() {
        var mapOptions = {
          center: { lat: -34.397, lng: 150.644},
          zoom: 8
        };
        var map = new google.maps.Map(document.getElementById('map-canvas'),
            mapOptions);
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body>
<div id="map-canvas">
</div>
</body>
</html>

In the script above, the developer is prompted to replace API_KEY with their actual API Key. However, this will cause a TOS violation if you have followed the Tutorial. To resolve the issue, add the following to your API Key:

&sensor=false
So the entire line of script, with an actual API Key, would look something like this:

<script src="https://maps.googleapis.com/maps/api/js?key=21a300d4a9a2cf55e4ffac1750acbc01
&sensor=false" type="text/javascript"> 
This will allow the map to render as described in the tutorial.

Thursday, October 16, 2014

Learn OpenStack with TryStack

Getting an opportunity to play with OpenStack effectively can be cost-prohibitive. Particularly for developers looking to integrate Keystone API functionality into their applications - you shouldn't have to build your own OpenStack deployment, or cough up boku bucks. Even if you have the resources, time is irreplaceable.

That's where TryStack can come into play. To get going, start by joining the TryStack Facebook group. This is the only down-side to TryStack to my mind. I absolutely *despise* Facebook and everything it stands for. Still, even I managed to reset my long-unused F-Book login to join (they should be rolling out other auth capabilities soon - GitHub is supposed to be next).

Within a day Dan Radez with Red Hat had activated my account, and I was able to spin up a couple of servers and got them routing out to the big bad world. Dan has put together a very easy-to-understand instructional video to help with new users:


I should make clear that this is only a testing environment - as a result, instances only stay live for 24 hours before getting wiped. Still, this is more than enough time to confirm functionality using Keystone before, say, pushing a new feature out to your production system.

Enjoy.

RAT Bastard

Earlier this week, several servers I maintain were targeted by automated attempts to upload a remote access trojan (RAT). The RAT is a simpl...