Re: Google Releases Mac Management Tools
Michael_google gmail_Gersten <[email protected]> Wed, 28 Dec 2011 08:12:13 -0800
| Newsgroups | gmane.comp.macosx.admin |
|---|---|
| Message-ID | <CADrOy6jjPGoNYuyTBxum9RvczJS+3CZnof5KLKsH0pr45iwgEA@mail.gmail.com> |
> http://www.readwriteweb.com/hack/2011/12/google-releases-mac-management.php
Interesting. Is there now a Python-Objective C bridge?
Any guesses as to how long it lasts?
I found this snippet of code especially interesting. I'd trust that
Google knows better than this:
# this looks weird, but it's the simplest way to do an update or insert
# operation in sqlite, and atomically update number_times, that I could
# figure out. plus we avoid using transactions and multiple SQL
# statements in most cases.
v = (app_version, app_path, now, event, bundle_id)
q = conn.execute(APPLICATION_USAGE_TABLE_UPDATE, v)
if q.rowcount == 0:
number_times = 1
v = (event, bundle_id, app_version, app_path, now, number_times)
conn.execute(APPLICATION_USAGE_TABLE_INSERT, v)
If you don't see the bug: If there is no entry for the application,
then a new entry for the application is NON-ATOMICALLY added. Just
imagine a second copy of this program running after the first update
fails.
--
Political and economic blog of a strict constitutionalist
http://StrictConstitution.BlogSpot.com
This message may have been spell checked by a laptop kitten.