But what if you got a second chance? That’s the premise of Richard Linklater‘s film Before Sunset, a 9 year later followup to Before Sunrise. I won’t repeat the plot here, since that’s readily available on the IMDB pages I just linked to. Before Sunset has a mere handful of sets, with most of the film taking place on the streets of Paris as Jesse & amp; Celine wander around catching on their lives. What’s more the entire film takes place almost in real-time – a mere hour and 20 minutes & shows you don’t need to span a whole 24 hours to build a really entrancing story.
Its nice to see the BBC taking a stand against the extortionist licensing model of RealMedia (and other commercial media streaming companies) by pushing ahead with development of its own Open Source standard. Its also interesting to note that since the design & implementation can be based on technical merit rather than potential commercial benefits, Dirac could feasibly turn out to be faster than existing codecs.
Borer believes Dirac could turn out to be more efficient than standards based on commercial patents, even though it has to use technology more than 20 years old to avoid breaking patents.
Many of the techniques were published by academics long before they were used commercially, and some are relatively new in being applied to video compression. ‘Wavelets [exotic waveforms used to map changes] have been around for 20 years now
…snip…
Efficiency depends on how techniques are used as much as on the techniques themselves. Commercial organisations trying to agree a standard currently fight to get their own intellectual property included, which makes for complexity and does not necessarily lead to the adoption of the best of breed. ‘We have tried to make our codec as simple as we can so it is easy to understand and easy to implement efficiently,’ said Borer.
The Perl DBI module provides a uniform API to access relational databases. Thanks to Perl’s data type model using it is considerably easier than, say JDBC in the Java world. In common with most database access APIs, the code is split into two bits, the generic infrastructure is in the DBI module, while backends for each database are in the various DBD modules:
The first task in any program is to connect to the server. This is done with the DBI->connect method. To simplify error handling, its good practice to turn on ‘RaiseError’ option, and turn off ‘PrintError’ and ‘AutoCommit’. Then by wrapping the entire unit of work in an eval we get safe transaction commit/rollback without the need to check method return status on each DBI call.
use DBI;
my $db;
eval {
$db = DBI->connect("DBI:Pg:dbname=mydb;host=myhost",
$username, $password, {
RaiseError => 1,
PrintError => 0,
AutoCommit => 0
});
...do some work with the db...
};
if ($@) {
if ($db) {
$db->rollback;
}
die $@;
}
$db->commit;
$db->disconnect;
The next task is issue statements to the DB. Following common practice DBI allows placeholders to be used in SQL, which are substituted with real values at execution time. If the underlying DB doesn’t support placeholders, DBI will emulate them. For maximum performance its advisable to use prepared statement handles, and again DBI will emulate this feature if the underlying driver does not support it.
my $sth1 = $db->prepare_cached("INSERT INTO foo (bar) values (?)");
$sth1->execute($bar);
my $sth2 = $db->prepare_cached("UPDATE foo SET bar = ? WHERE wizz = ?");
$sth2->execute($bar, $wizz);
my $sth3 = $db->prepare_cached("DELETE foo WHERE bar LIKE ?");
$sth3->execute($bar);
The final common task is retrieving data from the DB. There are a number of ways to get data back, but the simplest to code is to bind variables to each return parameter and then call ‘fetchrow’.
my $sth4 = $db->prepare_cached("SELECT bar, wizz FROM foo where bar > ?");
$sth4->execute(20);
my ($bar, $wizz);
$sth4->bind_columns(\$bar, \$wizz);
while ($sth4>fetchrow) {
print "Got $bar $wizz\n";
}
Putting this together a complete example looks like
use DBI;
my $db;
eval {
$db = DBI->connect("DBI:Pg:dbname=mydb;host=myhost",
$username, $password, {
RaiseError => 1,
PrintError => 0,
AutoCommit => 0
});
my $sth1 = $db->prepare_cached("INSERT INTO foo (bar) values (?)");
$sth1->execute($bar);
my $sth2 = $db->prepare_cached("UPDATE foo SET bar = ? WHERE wizz = ?");
$sth2->execute($bar, $wizz);
my $sth3 = $db->prepare_cached("DELETE foo WHERE bar LIKE ?");
$sth3->execute($bar);
my $sth4 = $db->prepare_cached("SELECT bar, wizz FROM foo where bar > ?");
$sth4->execute(20);
my ($bar, $wizz);
$sth4->bind_columns(\$bar, \$wizz);
while ($sth4->fetchrow) {
print "Got $bar $wizz\n";
}
};
if ($@) {
if ($db) {
$db->rollback;
}
die $@;
}
$db->commit;
$db->disconnect;
Its that time of year again when Privacy International hands out the UK Big Brother Awards. Amongst the categories are
Worst Public Servant, Most Invasive Company, Most Appalling Project, Most Heinous Government Organization and Lifetime Menace. This being the UK there is strong competition and the winners don’t disappoint
Most Appalling Project was awarded to Britain’s National Health Service electronic medical records program, which aims to computerize patient records in a way that some have protested is insecure and will compromise patient privacy.
Most Heinous Government Organization was won by The Office of National Statistics for its development of the Citizen Information Project, which will collect, collate and share U.K. citizens’ data with other government agencies.
Its all summed up nicely by the quote
“We are seeing a race to the bottom, where government and private sector alike compete to provide the most intrusive services in the most unstable environment for privacy,” said Davies. “The proclaimed need for protection of children and the fight against terrorism is often shamelessly used as the pretext for privacy invasion.”
Reading Brian’s blog I came across his posting on Real Ultimate Power
Facts:
1. Ninjas are mammals.
2. Ninjas fight ALL the time.
3. The purpose of the ninja is to flip out and kill people.
…I finally realized what the George Bush and Michael Moore sites where parodying
Facts:
1. George W Bush is a mammal.
2. George W Bush fights Terrorists ALL the time.
3. The purpose of George W Bush is to flip out
and kill terrorists.
Facts:
1. Michael Moore is a mammal.
2. Michael Moore makes documentaries ALL the time.
3. The purpose of Michael Moore is to flip out
and bash right-wing conservatives.