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!
Software Development Blogs: Programming, Software Testing, Agile Project Management
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!
By Scott Knaster, Google Developers Blog Editor
By Andrew Jessup, Product Manager

<?php
$db = new PDO(
'mysql:unix_socket=/cloudsql/hello-php-gae:my-cloudsql-instance;dbname=demo_db;charset=utf8',
'demo_user',
'demo_password'
);
foreach($db->query('SELECT * FROM users') as $row) {
echo $row['username'].' '.$row['first_name']; //etc...
}
Methods such as query() work just as you’d expect with any MySQL database. This example uses the popular PDO library, although other libraries such as mysql and mysqli work just as well.
<?php
$handle = fopen('gs://hello-php-gae-files/prime_numbers.txt','w');
fwrite($handle, "2");
for($i = 3; $i <= 2000; $i = $i + 2) {
$j = 2;
while($i % $j != 0) {
if($j > sqrt($i)) {
fwrite($handle, ", ".$i);
break;
}
$j++;
}
}
fclose($handle);
The same fopen() and fwrite() commands are used just as if you were writing to a local file. The difference is we’ve specified a Google Cloud Storage URL instead of a local filepath. <?php
$primes = explode(",",
file_get_contents('gs://hello-php-gae-files/prime_numbers.txt')
);
if(isset($primes[100]))
echo "The 100th prime number is ".$primes[100];


import googledatastore as datastore def main() writeEntity() readEntity()Next include writeEntity() and readEntity() functions:
def WriteEntity():
req = datastore.BlindWriteRequest()
entity = req.mutation.upsert.add()
path = entity.key.path_element.add()
path.kind = 'Greeting'
path.name = 'foo'
message = entity.property.add()
message.name = 'message'
value = message.value.add()
value.string_value = 'to the cloud and beyond!'
try:
datastore.blind_write(req)
except datastore.RPCError as e:
# remember to do something useful with the exception pass
def ReadEntity():
req = datastore.LookupRequest()
key = req.key.add()
path = key.path_element.add()
path.kind = 'Greeting0'
path.name = 'foo0'
try:
resp = datastore.lookup(req)
return resp
except datastore.RPCError as e:
# remember to do something useful with the exception pass
First create a new file called “demo.py”. Inside demo.py, we’ll add code to write and then read an entity from the Cloud Datastore. Finally we can update main() to print out the property values within the fetched entity: def main()
writeEntity();
resp = readEntity();
entity = resp.found[0].entity
for p in entity.property:
print 'Entity property name: %s', p.name
v = p.value[0]
print 'Entity property value: %s', v.string_value
Before we can run this code we need to tell the SDK which Cloud Datastore instance we would like to use. This is done by exporting the following environment variable: ~$ export DATASTORE_DATASET cloud-datastore-demoFinally we’re able to run the application by simply issuing the following:
~$ python demo.pyBesides the output that we see in console window, we’re also able to monitor our interactions within the Cloud Console. By navigating back to Cloud Console, selecting our cloud-datastore-demo project, and then selecting the Cloud Datastore we’re taken to our instance’s dashboard page that includes number of entities, properties, and property types, as well as index management, ad-hoc query support and breakdown of stored data.


.png)

By Greg Hartrell, Lead Product Manager

By Michael Manoochehri, Developer Programs Engineer, Google Cloud Platform
By Ted Hamilton, YouTube Analytics

Fullscreen is building a global network of YouTube channels with content creators and brands. Fullscreen provides a full suite of end-to-end YouTube tools and uses the new API for internal, business-intelligence tools. 


We are not adding or subtracting anything, but only changing how we display this information to make it easier to locate and understand. This change will be fully rolled out in the coming weeks. Please refer to each API or service’s terms of service for more information. We hope this will make your life easier so you get back to your code sooner!
By Mark Scott, Product Manager, Chrome
By Nicolas Garnier, Developer Relations
Saving an ebook to Google Drive from the O’Reilly website
Credit: Krzysztof P. Jasiutowicz<script src="https://apis.google.com/js/plusone.js"></script> <div class="g-savetodrive" data-filename="My Statement.pdf" data-sitename="My Company Name" data-src="/path/to/myfile.pdf"> </div>You can also use the Save to Drive button’s JavaScript API, which allows programmatic and flexible control of the creation of Save to Drive buttons in your web pages.
Saving a dental statement from Delta Dental
Saving your physical mail to Drive from your Outbox account
By Mike Winton, Director of Developer Relations
By Louis Ryan, Software Engineer
By Raziel Alvarez, Google Fonts Team
By Scott Knaster, Google Developers Blog Editor
Government removal requests are probably the best known part of the Transparency Report, but there’s plenty of other fascinating and useful data. For example, you can see information about removal requests for specific URLs from copyright owners, or read about the legal process that takes place when a government organization or court requests information about a user. You can learn a lot by spending some time with the Transparency Report.
After three months of alpha testing on hundreds of sites, ngx_pagespeed has proven its ability to serve production traffic. It's ready for beta, and it's ready for you to start using it on your site.
By Seth Ladd, Developer Advocate