Happy Thanksgiving!

The goal of this guide is to show you how to install and run the example Python script for cssutils from start to finsih. This was created while running Ubuntu, but can be applied and modified to any distribution. Open up a terminal and let’s get to it!
The easy_install binary is a Python package manager that makes it easy to install cssutils. The following steps will get this installed:
sudo apt-get install curl curl -O http://python-distribute.org/distribute_setup.py sudo python distribute_setup.py
Now we’ll install the cssutils package for Python using easy_install.
sudo easy_install cssutils
Next, you can copy/paste the following example into your favorite text editor and save it (I saved it as cssutils_test.py).
import cssutils
css = u'''/* a comment with umlaut � */
@namespace html "http://www.w3.org/1999/xhtml";
@variables { BG: #fff }
html|a { color:red; background: var(BG) }'''
sheet = cssutils.parseString(css)
for rule in sheet:
if rule.type == rule.STYLE_RULE:
# find property
for property in rule.style:
if property.name == 'color':
property.value = 'green'
property.priority = 'IMPORTANT'
break
# or simply:
rule.style['margin'] = '01.0eM' # or: ('1em', 'important')
sheet.encoding = 'ascii'
sheet.namespaces['xhtml'] = 'http://www.w3.org/1999/xhtml'
sheet.namespaces['atom'] = 'http://www.w3.org/2005/Atom'
sheet.add('atom|title {color: #000000 !important}')
sheet.add('@import "sheets/import.css";')
# cssutils.ser.prefs.resolveVariables == True since 0.9.7b2
print sheet.cssText
Finally, we can run the example.
python cssutils_test.py
I’m hoping this guide met the goal of teaching you how to install cssutils and run an example Python script to demonstrate some capabilities of cssutils. Feedback is welcomed and appreciated.
To my subscribers: I’m not dead. I’m just really busy livin’ part of life. I’ve gotten some material saved up, so now it’s just a matter of getting it polished for public consumption. I’ll get back in the game soon.
Just a quick note to all of the subscribers to this blog: I’m actually going through some life changes right now (new job, new location) and I haven’t had the time for a while to update the blog as regularly as I would like to. I felt as if dropping this line would be a courtesy. I’ll be back on the bandwagon within the next week or two.
I’d like to take a break from our regular content to (re)introduce the Cardiac Computer. This is an old school cardboard computer that taught how CPUs/computers actually function. I’d really enjoy getting my hands on one of these (apparently, you can still buy them)! Be sure to check out the wiki page for more information.

More pictures here:
http://www.porticus.org/bell/belllabs_kits_cardiac.html
Somebody over at the linuxconfig.org website posted a really good countdown script that I’d like to share with you. Specify a date and time and the script will start and display the countdown. Take a look here:
http://www.linuxconfig.org/time-countdown-bash-script-example
Here’s a method for embedding code in an HTML page using a quick and painless tool called code2html. code2html is available in most distribution repositories, so installing it is just a matter of calling your package manager like yum install code2html. After installing it, here’s an example of how to use it:
code2html -l plain -o html-nocolor myprogram.c > myprogram.c.html
OR
cat myprogram.c | code2html -l plain -o html-nocolor - > myprogram.c.html
When finished, you can then copy/paste the contents into another webpage. In my example, I chose to have a plain conversion and no colors so that I can use the <pre> tag to make my output look like I want it to.
Be sure to check out the code2html man page for plenty of other examples and usage information.