Création des Logiciels de gestion d'Entreprise, Création et référencement des sites web, Réseaux et Maintenance, Conception
Création des Logiciels de gestion d'Entreprise, Création et référencement des sites web, Réseaux et Maintenance, Conception
<?phpMethods 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.
$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...
}
<?phpThe 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.
$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);
<?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];
I've always hoped that I could release Mondrian as open source, but it was not to be: due to its popularity inside Google, it became more and more tied to proprietary Google infrastructure like Bigtable, and it remained limited to Perforce, the commercial revision control system most used at Google.
What I'm announcing now is the next best thing: an code review tool for use with Subversion, inspired by Mondrian and (soon to be) released as open source. Some of the code is even directly derived from Mondrian. Most of the code is new though, written using Django and running on Google App Engine.
I'm inviting the Python developer community to try out the tool on the web for code reviews. I've added a few code reviews already, but I'm hoping that more developers will upload at least one patch for review and invite a reviewer to try it out.
Deferred
, which allows easy task definition and deployment. We defined a new Task
abstraction, which implements an extended Deferrable
and requires that every Task implement an onFailure
method. Our extension of Deferred
then terminates a Task permanently if it exceeds a threshold on retries, and calls its onFailure
method.appengine-mapreduce
is of great utility. However, we often want to map over a filtered subset of Datastore entities, and our map implementations are JDO-based (to enforce consistent application semantics), so we don’t need low-level Entities prefetched.
So, we made two extensions to the mapper libraries. First, we support the specification of filters on the mapper’s Datastore sharding and fetch queries, so that a job need not iterate over all the entities of a Kind. Second, our mapper fetch does a keys-only Datastore query; only the keys are provided to the map method, then the full data objects are obtained via JDO. These changes let us run large JDO-based mapreduce jobs with much greater efficiency.Task
abstraction above is used to identify cases where a transactional task does not succeed). All Datastore-related application actions – both in RPC methods and "offline" activities like mapreduce – use this framework. This approach has helped to make our application robust, by enforcing application-wide consistency in transaction semantics, and in the process, standardizing the events and logging which feed the app’s workflow systems.Ticket
includes a list of associated Tag
IDs, and Tag
objects include a list of Ticket
IDs they’re used with. This lets us very efficiently fetch, for example, all Tickets
tagged with a conjunction of keywords, or any Tags that a set of tickets has in common. (We have found the use of "index entities" to be effective in this context). We also store derived counts and categorizations in order to sidestep Datastore restrictions on query formulation.Mike |
Fred |