Making use of pydoc web server

Just a reminder here of pydoc, the python documentation tool which comes with python.  You can access documentation on any keyword, topic, function, or module file typing:

pydoc <name>

However, my favorite use, and its most powerful feature is the builtin http server.  This makes all of the python documentation easily accessible using your web browser.  To open an http server on your local machine port 9999:

pydoc -p 9999

Then just open your web browser to http://localhost:9999/

Screenshot from 2013-01-28 17:09:09

This is a helpful resource when you are working in python.

Fedora 16 missing H.264 decoder plugin (fixed)

If you installed Fedora 16 and added the RPM fusion repositories and you still can’t watch .mkv videos because of a missing H.264 decoder plugin.

Totem Movie Player gives you this error message

Here is how to fix it.

You are still missing a required package.  Add the following package…and you should be good to go.

sudo yum install gstreamer-ffmpeg

However, If you need full instructions for enabling the RPM fusion repositories here they are also.   The first two lines add the necessary repositories.  The last line installs the necessary plugins for variety of video formats as well as viewing DVDs.

sudo yum localinstall --nogpgcheck

sudo yum localinstall --nogpgcheck

sudo yum install gstreamer gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg libdvdread libdvdnav lsdvd


Alternatively, you can also install and use vlc or smplayer to view mkv videos–both can decode H.254 .

Using sqlite3

An sqlite database is an entire database that is contained in a single cross platform file.  It is used by many applications to store data and state information.  I’ll show you a few things to get you started using sqlite databases.

The Fedora software update tool,  yum, uses sqlite databases to store package information locally  from the yum repository.  I’ll be using my Fedora 12 server for this example.

First I’ll get some fresh data.

yum clean all
yum check-update

The fresh data will be found in /var/cache/yum.   I’m interested in files named *.sqlite.

find /var/cache/yum -name "*.sqlite"


The long filename is a bit unwieldy so I’ll copy it to a file that is easier to handle.

cp /var/cache/yum/updates/1793ed5dc6773763df84b55d5515f96add374ca115e0e4151a70378f6ed323c8-primary.sqlite /tmp/primary.sqlite

Now lets see a list of database tables.

sqlite3 /tmp/primary.sqlite .tables

conflicts  db_info    files      obsoletes  packages   provides   requires

Now lets dump the database to another file.

sqlite3 /tmp/primary.sqlite .dump > /tmp/primary.dump

Lets examine the dumpfile.  I want to see the column names from the packages table.

egrep "CREATE TABLE packages" /tmp/primary.dump
CREATE TABLE packages (  pkgKey INTEGER PRIMARY KEY,  pkgId TEXT,  name TEXT,  arch TEXT,  version TEXT,  epoch TEXT,  release TEXT,  summary TEXT,  description TEXT,  url TEXT,  time_file INTEGER,  time_build INTEGER,  rpm_license TEXT,  rpm_vendor TEXT,  rpm_group TEXT,  rpm_buildhost TEXT,  rpm_sourcerpm TEXT,  rpm_header_start INTEGER,  rpm_header_end INTEGER,  rpm_packager TEXT,  size_package INTEGER,  size_installed INTEGER,  size_archive INTEGER,  location_href TEXT,  location_base TEXT,  checksum_type TEXT);

Lets extract some data.

sqlite3 /tmp/primary.sqlite "select name, time_build, location_href from packages" | less


As you can see sqlite is using the ‘|’ as a column separator.

Now lets do the same thing but with a perl program.  You’ll need the following two modules DBI and DBD::SQLite.

yum install perl-DBI perl-DBD-SQLite

use DBI;


my $db = DBI->connect("dbi:SQLite:dbname=$file", { PrintError => 0,
RaiseError => 0 });

my $sth = $db->prepare("select name, time_build, location_href from packages");

my @row;
while ( @row = $sth->fetchrow_array() ) {
my ( $name, $time_build, $location_href ) = @row;
print "$name $time_build $location_href\n";
warn "Data fetching terminated early by error: $DBI::errstr\n"
if $DBI::err;

or warn "Error disconnecting: $DBI::errstr\n";


I hope you found this useful and it will inspire you to do more.

Googlenope: The frontier of thought

A “googlenope” is a quoted phrase that returns no hits when “googled”.  This term was coined by Gene Weingarten of the Washington Post.

Alas, Googlenopes are getting harder to find; the explosion of the Web, with its indiscriminate tastes, is herding the noble Googlenope toward extinction.

A Place Called Nope: Gene Weingarten on Googlenopes and Googleyups

Remember When: The birth of micro blogging

Before there was Facebook, Twitter, and Tumblr, there was the finger protocol and the finger cmd.  The finger cmd was created in 1971 and an RFC (742) came later in 1977.  You provided your status updates using a .project or a .plan file in your home dir.  The contents of those files could be queried by other users.  The origin of the finger cmd is best explained by this posting to the newsgroup alt.folklore.computers from 1990 .  Was this the birth of micro blogging?

Make You Own QR Codes

QR codes are also known as “Quick Response” codes.  It is  a 2D matrix type of bar code.  The QR code was originally  invented by a subsidiary of Toyota to manage automobile parts.  The QR code is now public domain and you have probably seen them a number of places, on product packaging, bill boards, in magazine ads, and on-line.  The most common use for them now days is to encode URLs, and addresses.  They are meant to be quickly scanned and read by the camera in your cell phone.  If you have an Android, or an Iphone you have a built-in bar-code scanner that can process the URL stored in these QR codes.

The image below is a QR code that encodes the URL of this website.  If you scan it with the camera in your smart-phone, it should recognize the encoded URL and offer you the option of opening your browser to take you there.

QR code for this website

My QR code was created using the following URL:×100&cht=qr&chl=

You can create your own QR code using the  Google charts tool.   Google charts are an API which allow you dynamically generate charts using a URL and embed them into your web pages.  Use the Google chart URL shown above.  The parameter cht=qr, indicates that this is to be a QR code.  The parameter chs=100×100 is the size.  Change it if you want to change the size.  Use the chl= parameter to indicate the URL that you want to encode.

Google charts is a very powerful tool.  Although  my example demonstrated only  how to create a QR code chart, the number of different types of charts you can create using the Google API is very impressive.   I encourage you to check out the Google charts playground tool and experiment with creating different types of charts.