RSS Feed


Comments RSS

Linux Desktops, Xfce 4.8

Being able to select a desktop for your computer is a concept that is unfamiliar to the typical Windows user. Windows users can, of course, make a fairly wide selection of themes and configurations to their current desktop, but changing it out wholesale for a completely different desktop with its own set of default applications and functionalities is not part of their operating system experience. This is not true for users of Linux, or any of the other Unix-like operating systems. From the very beginning of the availability of graphical windowing systems in the Unix world with advent of X windowing system, development of new and innovative desktop environmnets has been the name of the game. Some of the available systems have been X11, CDE, GNOME, KDE, Fluxbox, WindowMaker, Englightenment, LXDE, and Xfce. There are many others, and surely I have inadvertantly omitted somebody’s favorite desktop environment. The main point here is that once you leave the world of Microsoft Windows, you enter a world full of choice when it comes to your operating system environment and particularly your graphical desktop environment. Today I would like to point out the Xfce dekstop, which recently came out with its latest release Xfce 4.8 has a nice “weekend project” article about Xfce:

Linux Celebrating 20 Years

Linux Mint, 2 thumbs up!

After facing so many frustrations with Ubuntu 11.04 and uncertainties as to where Ubuntu is going in the future, I finally decided to bite the bullet and try different distributions.  The latest two that I have tried I can give 2 big thumbs up.   These were Linux Mint 11 and Linux Mint Xfce.

Linux Mint 11 is based on Ubuntu 11.04, but the Linux Mint team chose to not include the Unity desktop.   This distribution is everything that I would have hoped Ubuntu 11.04 could have been.   In fact, the level of polish and completness in Linux Mint 11 exceeds that typical of most Ubuntu releases.   This is saying a lot, because most Ubuntu releases are quite good.   However, one thing still worries me – GNOME.   Linux Mint kept the GNOME 2.3x desktop, which I prefer, but I must wonder if they will it be forced into GNOME3 in the next release?  I like GNOME2 and am not looking for wholesale changes of my desktop.   This type of uncertainty about the future of the desktop has given me enough pause to cause me to explore other desktops, which leads me to my next big thumbs up.

Linux Mint Xfce is NOT based on the Ubuntu upstream package sources.   Instead, it is based on the upstream Debian Testing packages.   This is also a “rolling” distribution as it is continuously taking updates from Debian Testing rather than being locked in until the next big release.   In essence, there will not be a next big release, or need for a reinstall, or a major “upgrade”.   It will simply update right along with the Debian updates.    I like this!   Also, it is not a GNOME based distribution, it is Xfce.   I have long been a fan of Xfce as an alternative to GNOME.   Like GNOME, it is based on the GTK+ libraries, but is lighterweight in its resource usage.   This is turning out to be what I would consider to be an ideal Debian based distro and may be where I call home for a while.  Were there any issues?  Yes, but only a minor one.   Linux Mint Xfce does not include the jockey-gtk package that the GNOME based distribution does.   This package makes for easier installation of restricted hardware packages, such as the Broadcom STA wireless driver.   I would strongly urge the Linux Mint team to consider its inclusion in the future or provide their own alternative.   However, this was easily overcome once I found the instruction on the Debian site for installation and configuration of the WL package.  This was straightforward and simple.   Here is the link. Debian WL driver install. Also, this distribution came configured with the Linux 2.6.32 kernel.   This is understandable since it was the kernel used in Linux Mint 10, which this is essentially a continuous update of.   I chose to update the Linux 2.6.38 kernel and did so via the Synaptic Package Manager.   This upgraded flawlessly.  I do not know if the update system would have eventually provided the kernel update to me, but it was reported my system as up to date so I am guessing it was not going to do so.

I would recommend either of these offerings from Linux Mint as an alternative to Ubuntu.   For those simply wanting a good GNOME desktop experience with no hickups, go for Linux Mint 11.   For those wanting to try a different desktop altogether, but one similar to GNOME2, give Linux Mint Xfce a try.   I think you will enjoy either of these.   Remember, Linux is all about CHOICE.   You are not locked into any distribution or desktop system.   Don’t be afraid to try out new things.   If enough folks decide not to adopt Ubuntu 11.04 or its Unity desktop, they will get the message.

Ubuntu 11.04, another annoying “feature”

Yes, I am going to harsh on Ubuntu 11.04 some more.  Even once you have turned off Unity and returned to a classic Gnome desktop, all is not back to “normal”.  Ubuntu 11.04 introduces a really stupid feature know as the “overlay” scrollbar.   Basically, it is a scrollbar tab that replaces the traditional scrollbar found on a windowed item.   It hides when not in use and pops back up into view when the mouse is moved into its area at the edge of the window.   HOW STUPID!  Who really wants to be playing hide and seek with windowing elements on their screen?  Even worse, this “feature” is found by default in all the Ubuntu derivatives also based on 11.04 such as Xubuntu and Linux Mint.   I would encourage the providers of derivatives to NOT accept every new feature that might be foisted upon us by the Ubuntu developers.   Fortunately, there is a way to turn the overlay scrollbar off and return to a normal scrollbar.

  1. Go to a terminal.
  2. sudo to get administrative privs
  3. paste the following into the command line and hit enter (then reboot for the change to take effect)
  • echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars

I found this great tip here:

Another good article that addresses this issue and others in Ubuntu Unity.



Ubuntu 11.04 Alternatives

The Ubuntu 11.04 Unity desktop is horrible. Thank goodness that Gnome classic is still a desktop choice at log in. While I love Ubuntu generally, I do not like Unity at all. If a reasonable gnome desktop is eliminated from Ubuntu, then I will simply move to one of the derivatives such as Xubuntu or Lubuntu. I have tried out both of these for 11.04 and both are perfectly acceptable and feature what I consider a more standard type of desktop. I did try Kubuntu 11.04, but it was a failure as the Kubuntu build of KDE crashes my system system with a panic when it tries to load the desktop. However loading the kde-standard package for a desktop choice under Ubuntu or one of the derivatives works. So, the Kubuntu issue must be a tweak that was made to that derivative only.

A good article about the problems with Unity.

Ubuntu 11.04 – disapointing

Ubuntu 11.04 is out and, while I am glad to get a updated version of my favorite Linux distribution, I am disappointed in one of the new changes.  Ubuntu now ships with Unity as its default desktop.   I HATE Unity.  It is Linux for complete morons.  I use Ubuntu because I love that it is a nice, polished, Debian based distro.  For me that also means that it uses a mature desktop, such as GNOME or KDE or Xfce.  I am definitely not in the mood to have a newcomer, immature, idiot desktop like Unity thrust upon me.  I have been using Linux since 1996 and am way, Way, WAY beyond such a dumbed down desktop as Unity.  I would have been happy to give GNOME3 a try, but they did not even present that as an install option – WHY NOT???   So, on Ubuntu 11.04 I chose the GNOME Classic desktop (GNOME 2.32) and pretend the other does not even exist.  I am very disappointed in this and hope it is not the beginning of Canonical and Ubuntu moving away from me as a user.   I will be taking some time now to test out the current build of some of the other Ubuntu derivatives such as Xubuntu and Kubuntu.   I really do like good Debian based Linux distributions and Ubuntu has always been the best for me, but if they continue down this road and do not make sure they provide good options for the experienced power user class of folks, then I am not beyond changing to another Linux distribution and saying goodbye to Ubuntu.  I believe that Unity will prove to be a fundamentally bad move for Ubuntu as its main choice of desktop.

A geek celebration of Easter

def EasterDate(y):


# y is a 4 digit year 1583 to 4099
# d returns the day of the month of Easter
# m returns the month of Easter

# Easter Sunday is the Sunday following the Paschal Full Moon
# (PFM) date for the year

# This algorithm is an arithmetic interpretation of the 3 step
# Easter Dating Method developed by Ron Mallen 1985, as a vast
# improvement on the method described in the Common Prayer Book

# Because this algorithm is a direct translation of the
# official tables, it can be easily proved to be 100% correct

# This algorithm derives values by sequential inter-dependent

# The / operator may be unfamiliar – it means integer division
# for example, 30 / 7 = 4 (the remainder is ignored)

#The % operator is for the Modulus operation

# All variables are integer data types

# It’s free! Please do not modify code or comments!
# ==========================================================
#The following is a translation of the BASIC code for the calculation
#of Easter dates to Python 2x. The comments from that code and
#variable names have been preserved. The preceding comments
#have also been preserved with only slight modification and additions
#that are necessary for properly understanding this Python version
#of the program. I encourage the reader to visit following website
#and compare the original BASIC code with the Python code presented
#The original documentation and code may be found at:
#Many thanks to the Astronomical Society of South Australia for
#the information that made this possible.
#FirstDig, Remain19, temp are intermediate results
#tA, tB, tC, tD, tE are table A to E results

FirstDig = y / 100 #first 2 digits of year
Remain19 = y % 19 #remainder of year / 19

#calculate PFM date
temp = (FirstDig – 15)/2 + 202 -11 * Remain19

case1 = (21,24,25,27,28,29,30,31,32,34,35,38)
case2 = (33,36,37,39,40)

if FirstDig in case1:
temp = temp – 1
elif FirstDig in case2:
temp = temp – 2

temp = temp % 30

tA = temp + 21
if temp == 29:
tA = tA -1
if temp == 28 and Remain19 > 10:
tA = tA -1

tB = (tA -19) % 7

tC = (40 – FirstDig) % 4
if tC == 3:
tC = tC + 1
if tC > 1:
tC = tC + 1

temp = y % 100
tD = (temp + temp/4) % 7

tE = ((20 – tB – tC – tD) % 7) + 1
d = tA + tE

if d > 31:
d = d – 31
m = 4
m = 3

return (m,d)

#A simple program using the EasterDate funtcion
year = int(raw_input(“Find the date of Easter for which year(1582-4099)? “))
month_day = EasterDate(year)
months = (‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’, ‘July’,
‘August’, ‘September’, ‘October’, ‘November’, ‘December’)
print “For the year {0}, Easter will fall on {1} {2}”.format(year, months[month_day[0]-1],month_day[1])


a different kind of ham homebrewing

This little project just took on a life of its own this afternoon.  What started out as an experiment in writing a single program to read output data from my radio via the RS232 serial interface has turned into a full blown radio remote control program.

The current state of the program will let me control my rig from a remote PC across the local network at my QTH.

There are 4 separate programs involved in this.  Much of the code from my previous blog post comprises the heart of the system.

Here is how it all works. On the PC that is connected to the radio (we will call this the PC-Radio system) resides two programs – and   On the remote PC across the network (we will call this the PC-operator system) resides two other programs – and   On the PC-Radio system, the programs each have to communicate with both the network and the radio.   The program takes any output data from the radio and sends it out to the network to be received as feedback from the radio by the program on the PC-operator system. The program receives any data sent to it from across the network by the program on the PC-operator system and passes these as commands to the radio.  The radio takes the command, gives feedback, and cycle begins again.   As a diagram, it looks like this.[PC-operator system] —————-> [PC-Radio system] —>
^                   (operator)                    (network)                             (radio)                        |
|                                                                                                                                v

It was not as that this was all entirely necessary.  I could have downloaded software already designed to do this, and have used such in the past with my computers and radio.   However, for me, it is the difference between buying a radio and building a radio.  You can accomplish the very same thing in the end, e.g. communication.  Both ways are OK.  However, there are added benefits from building equipment such as the opportunity to learn, pride in the work one has done, the sense of accomplishment, etc.   The same is true for this type of homebrewing, the only difference is that it is homebrewed software rather than hardware.  The Python source code for the project is available.  This code is very minimalist and intended only to demonstrate the principles involved.  Please feel free to use, adapt, or modify it in any way you may wish.

NOTE:  The code from my previous blog post contains comments that explain how to take this Linux implementation of RS232 communications and adapt it for use on a Windows system.  Also note that there are hard coded IP addresses in the code that would need to be changed for implementation elsewhere.  Aside from those differences, this code should be fully cross-platform and usable anywhere as it pertains to the parts dealing with the serial and network communications.  The control codes and settings I am sending to my radio may not be applicable to your own, so please see the users or programming manual for your rig for appropriate codes, settings and methods for communicating and controlling it.   Additionally, the code found in this project that implements the network socket clients and servers are adaptations of code found at

Python Server to Client socket communications

I found a terrific little tutorial on the subject of programming network socket Server/Client communications in Python. Very clear and concise! The author did a nice job with this.

Socket Programming in Python @

Serial Communications using Python  by Bill Allen – WA5PB
#This is an experiment in communicating with an Amateur Radio transceiver
#via Python through RS232 serial communications.  Similar code could be used
#to communicate with any device supporting serial communications.

#This was written using Python 2.6.5, but I like using the new
#Python 3.x print function so we pull it in for use here.
from __future__ import print_function

#We will be using the PySerial library to provide RS232 serial communications.
#PySerial is a third party library module that can be found here:
import serial

#Configure the serial port to communicate with the Elecraft K2 xcvr.
#I am coding this on a Linux system, so the device string /dev/ttyS0
#works for the first serial port.  Your system my use a different serial
#port device.  For a Windows system, try COM1 for the first serial port.
ser = serial.Serial(‘/dev/ttyS0’, 4800, timeout=1)

#Sanity check for the K2 AutoInfo mode, turn it off.

#Now set the K2 AutoInfo mode to mode 1 and get some initial data.

#Read up to 150 bytes of returned data from the K2 and print it out.
K2_data =

#Now set the K2 AutoInfo mode to return the most data while it is being polled.
#Ctrl-C will be used to end the program.  End the program gracefully by trapping
#the Ctrl-C, turning off the K2 AutoInfo mode and closing the serial port prior
#to exiting.
while True:
        K2_data =
        if K2_data != “”:
    except KeyboardInterrupt:
        print(“\nOK, exiting…”)
        print(“Reseting K2 AutoInfo mode OFF”)
        print(“Closing Serial Port”)
        raise SystemExit(0)


Fldigi (Fast Light Digital Modem Application) is a cross-platform modem program that supports most of the digital modes used on the amateur radio bands.

Fldigi is a digital modem program for Linux, Free-BSD, OS X, Windows XP, W2K, and Vista (probably Win7).

Bill – WA5PB

PyFITS Cheat Sheet

PyFITS is a Python module to facilitate the reading, editing and creation of Flexible Image Transfer System (FITS) files.  FITS is a common data interchange medium in the astronomical community.

PyFITS Cheat Sheet, working with the FITS file Header Data Unit(HDU)

extracted from The PyFITS Handbook

see also:  A Primer on the FITS Data Format

#load the pyfits module into Python
import pyfits

#initialize a fits file object
hdulist =‘input.fits’)

#when finished close the file object

#get info from the fits file

#get the value of a particular keyword in the HDU

#get the value of a particular keyword index in the HDU

#assign new values to keywords or indexes in the HDU
prihdr = hdulist[0].header
prihdr[’targname’] = ’NGC121-a’
prihdr[27] = 99

#view the entire HDU contents
prihdr = hdulist[0].header

#update (add) the HDU with a new keyword and value
prihdr.update(’observer’, ’Edwin Hubble’)

#add history or comment records to HDU
prihdr.add_history(’I updated this file 2/26/09’)
prihdr.add_comment(’Edwin Hubble really knew his stuff’)

#access the HDU as Cards, display first three cards of HDU
print prihdr.ascardlist()[:3]
SIMPLE =    T / file does conform to FITS standard
BITPIX =    16 / number of bits per data pixel
NAXIS =     0 / number of data axes

#list all the keywords of the HDU

#write out the changes made to the in memory fits object

#saving changes to fits file using update mode
f =’original.fits’, mode=’update’)
… # making changes in data and/or header
f.flush() # changes are written back to original.fits

Python Dictionaries, a native Hash Table data type

All programming languages make data structures available for data storage.   These can be very simple and small as registers and memory byte, word, or multi-word variables as in various Assembly languages.  They can also be potentially large and complex as memory pointer linked lists or multidimensional arrays that are available in many high level languages.   Python provides for many types of data structures as well, the best known being its List type.   While this is definitely the workhorse of the language, Python also provides something even more flexible and powerful – Dictionaries.   In most programming languages, a dictionary would also be known as a “hash table”.   A hash table differs from an array or list in that it allows for the access of data by named indices that are defined by the programmer, rather than by integer indices only.   In most programming languages, these hash tables are cobbled to together by the programmer and often require a lot of hand coding and handling of pointer references.   Python makes dictionaries available as a base data type and one only has to create the dictionary variable and begin assigning data to it.  That’s it!  No additional coding is required to create the dictionary or maintain it aside form what ever operations are desired to add, delete, or otherwise maintain its contents – and native functions are provided such as, but not limited to, ‘del’, ‘keys’, ‘values’,  ‘items’, and ‘pop’.

Here is an example.  It is a nested dictionary, or dictionary of dictionaries, that contains a variety of data.

>>> my_dictionary = {‘3262812’: {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]}, ‘3231023’: {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}, ‘3257313’: {‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}}

First we create a dictionary called my_dictionary.   Notice that dictionaries use {} for their enclosing brackets, not [] used by lists.   However, dictionaries DO use [] for later reference and access to the dictionary as will be seen below.   For example, the first entry in our dictionary shown here is ‘3257313’: {‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}.   The components of this dictionary entry is a part number – ‘3257313’ which is a KEY to this dictionary and another dictionary with keys ‘SAP_state’, ‘REV’, and ‘SPECS’.  ‘SAP_state’ gives access to a string variable, ‘REV’ to a string variable, and ‘SPECS’ to a list variable that contains strings.

Access to data of the dictionary and had by one or more keys as shown.

>>> my_dictionary[‘3257313’]
{‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}
In this case, we accessed a main key, which yield all the dictionary contents for that key.

>>> my_dictionary[‘3257313’][‘REV’]
Here we access via the a main key and subkey ‘REV’.

>>> my_dictionary[‘3257313’][‘SAP_state’]
Here we access via the a main key and subkey ‘SAP_state’.

>>> my_dictionary[‘3257313’][‘SPECS’]
[‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]
Here we access via the a main key and subkey ‘SPECS’

>>> my_dictionary[‘3257313’][‘SPECS’][3]
Here we go three levels deep into the dictionary and access via the main key ‘3257313’, subkey ‘SPECS’ and then the index [3] of the list found in ‘SPECS’.

Here are examples of what is returned when the ‘keys’, ‘values’, and ‘items’ methods of the dictionary are used.

>>> my_dictionary.keys()
dict_keys([‘3257313’, ‘3231023’, ‘3262812’])

>>> my_dictionary.values()
dict_values([{‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}, {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}, {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]}])

>>> my_dictionary.items()
dict_items([(‘3257313’, {‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}), (‘3231023’, {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}), (‘3262812’, {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]})])

Another dictionary function that should be mentioned is ‘del’.  It is used as a procedural function to delete entries from the dictionary.  For instance, if the dictionary looks like this:
{‘3257313’: {‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}, ‘3231023’: {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}, ‘3262812’: {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]}}

Then del my_dictionary[‘3257313’] would delete the complete entry in the dictionary referenced by the key ‘3257313’, giving the following result:
>>> del my_dictionary[‘3257313’]
>>> my_dictionary
{‘3231023’: {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}, ‘3262812’: {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]}}

The same entry deletion operation could also be achieved by using the ‘pop’ method.   The difference is that pop will allow the removed items associated with the key to be assigned to another variable.
>>> my_dictionary
{‘3257313’: {‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}, ‘3231023’: {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}, ‘3262812’: {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]}}
>>> removed_item = my_dictionary.pop(‘3257313’)
>>> removed_item
{‘SAP_state’: ‘True’, ‘REV’: ‘O’, ‘SPECS’: [‘Q00021’, ‘Q00020’, ‘Q00025’, ‘M25070’, ‘Q50151’, ‘Q50153’]}
>>> my_dictionary
{‘3231023’: {‘SAP_state’: ‘True’, ‘REV’: ‘C’, ‘SPECS’: [‘Q00022’, ‘Q00026’, ‘Q00027’, ‘E50002’]}, ‘3262812’: {‘SAP_state’: ‘False’, ‘REV’: ‘B’, ‘SPECS’: [‘Q00021’, ‘Q00024’]}}

Dictionaries are highly flexible and very easily used hash tables in Python.  The advantage of Python dictionaries is direct access to data via named references without having to perform searches via a built in data type.   Just provide a valid key value and Python does the rest.

Hang 10!

As readers of the blog will know, I am a real Python programming enthusiast.  It is gratifying to discover that I am apparently riding quite a large wave of growth in popularity and usage of Python.   This article from Dr. Dobbs Journal discusses this and other interesting programming trends revealed by the Tiobe Programming Community Index.   The Rise and Fall of Languages in 2010

ASCII Mandelbrot Fractal – as a Python CGI

Here is an example of a Python CGI that I have running on my website.  It generates a ASCII Mandelbrot Fractal and allows for the user to change and zoom in the field of view.  Granted, it is very low resolution being ASCII, but the main purpose was to demonstrate the use of Python for CGI purposes on   (FOR FURTHER EXPLORATION):   Since the server Python package (v 2.6.5) has the PIL (Python Image Library) available, I can see no reason that true binary images of Mandelbrot fractals might not be produced and displayed on as pictures on the web page.  UPDATE:  As suspected, creating true graphical Mandelbrot fractals did in fact work out well.   Here is a link to a Python CGI that uses PIL to create the images.  Graphical Mandelbrot CGI

Ubuntu+XAMPP+Python part 1

Do you have Ubuntu running on a system at home or work?  Have you ever wanted to run your own local web server or at least have one available for development work?   Have you ever wanted to craft your own web CGI scripts?  If you answer yes to these, then here is a serials of tutorials on how to get an Apache web server running quickly and easily on your Ubuntu system and how use Python to craft CGI scripts to run on it.

First, let’s get an Apache web server up and running.   Since this is targeted at people running Ubuntu desktop, rather than Ubuntu server, the very simplest way to install Apache is to do it via XAMPP.   XAMPP is a bundled, self-contained Apache web server distribution provided by Apache Friends that is complete and robust.  It includes  features here as listed from the website:

The distribution for Linux systems (tested for SuSE, RedHat, Mandrake and Debian) contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.

The XAMPP distribution is designed simply to be downloaded, unpacked, and run from a self-contained directory.   It does not modify your Ubuntu system at all and can be removed simply by deleting the folder that contains the installation.    Now, follow this link to the Apache Friends website and follow the directions for downloading and installing the XAMPP distribution, after reading the notes I provide here.  You will notice there are also instructions on securing the installation.  This is particularly important if you are using this for anything other than development purposes running on your personal system.  If this will be exposed to others, or the world, be sure to follow the instructions on making XAMPP secure.  Note:  Since this is being targeted for Ubuntu do not use the su command as stated in the XAMPP installations instructions.  Instead, you should install using this single line.

sudo  tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt

XAMPP will be installed in the /opt/lampp folder.   To start it up, go to a shell prompt and type the following.  Again, sudo is required.

sudo /opt/lampp/lampp

Now, open you browser and give http://localhost as the address.  You will be presented with the default XAMPP webpage that is being served out by your local Apache web server.  I encourage you to play around with XAMPP for a while and explore your installation via the default page, then return here for the next installment of this series where we will look further at developing CGI scripts in Python.

Python – the new BASIC

I recently read a good blog on the subject of the Python programming language being the new BASIC, and that being a good thing. I very much agree, and it IS a good thing. I got my start in computing and programming just as the age of the home computer was coming to be, i.e. days of the Sinclair, Atari, TRS 80 type home systems. BASIC was the mainstay on these systems and usually came bundled in the system. In those days, home computer users were not looking to just surf the web (which did not exist yet as we know it) or other entirely enduser type activities that are so common today. Back in the day, late 70’s & early 80’s, home computer users were most difinately hobbyists and enthusiasts. Most folks were looking to discover just what they could do with this computer technology now that it was feasible to have it in the home without spending too much of a fortune. Part of this experience for most was learning the version of the BASIC programming language that was bundled, or built into, their computer. There was not much software available back then and the folks were willing and eager to write their own. I’ll never forget the very first computer that our family purchased and on which I first hacked out in BASIC a program. I was a Radio Shack TRS-80 Pocket Computer. It had a HUGE 8Kbytes of RAM! It plugged into and interface that let you print to adding machine roll paper and save programs to an external cassett tape. I learned BASIC and so did my Dad. Those were the days! BASIC was the gateway into programming because it had two fundamental features – it was simple and highly accessible. It came with nearly ALL home computing systems. BASIC spread like wildfire. Today, there is a great need for the same thing. A programming language that is both simple and accessible. While I have mastered several programming languages over the years, the only one that harkens me back to the good old days of BASIC is Python. This is a GOOD thing! Python is both totally free and available for most any computer system and it is simple to learn. It is interpreted and highly portable, just like BASIC was, yet is powerful. Any newbie programmer can pick it up and get it to spit out “Hello World” in just one simple line of code and then within mere days (maybe even hours) be creating useful Object Orientated code using the most modern programming paradigms (usually with even realizing it!). Also, it is not some toy programming language. There is a huge body of high end programs written in it which is growing everyday. Python is the NEW BASIC, without the design shortcomings of BASIC. It is what we have needed.

Linux games! (didn’t you know?)

Yes, Virginia, there are Linux games and good ones too!
You might not be much into gaming, but hey, you might get bored one evening. Here are some good Linux games of various sorts. All for FREE.

Cool list of 5 great Linux games in 2010 (various). BTW, Dedoimedo is a great blog!

For those who LOVE WWII and the battles! Computer version of the classic boardgame Axis & Allies. For all platforms, extract zip into a folder and run the OS appropriate OS triplea file.

Battle for Wesnoth. Turn based fantasy strategy game. Play the computer or others online.
Install version wesnoth-1.8 from the Ubuntu repostiory.

Ubuntu comes with some solitare type games already loaded, but if you want many more then install PySol from the repository.
Includes many, many types of games including Majong and others, really worth installing.

The opensource version of one of the best games of all time, Civilization, as FreeCiv.
Install freeciv from the Ubuntu repository.

Doug Hellmann – Code Interstices

I have come across a terrific Python resource in a blog. The blog Doug Hellmann – Code Interstices features a PyMOTW, Python Module Of The Week, that covers much of the Python Standard Library with discussion and examples. The discussion is cogent and the examples clear. Mr. Hellmann has put together an index of all his PyMOTW articles that in total is a very good Python reference. I highly recommend this resource and commend the author for sharing with the community.

Also, Doug Hellmann’s main website.

GIMP – a deskew plugin

GIMP (the GNU Image Manipulation Program) is a great product.  It provides many advanced image editing options and is available on both the Linux and Windows platforms.  Of course, it is FREE.  One capability that is noticed to be missing from its sizable suite of tools is a “deskew” function.   As the name suggests,  a deskew function straightens up a somewhat crooked picture.  This is often needed to straighten up a scanned image that did not pass through the scanner in a perfectly straight manner.   After quite a lot of searching on the web, I found that there is a plugin (an add-on) that provides this function for GIMP.   For the typical user, getting ones hands on the deskew plugin is not as easy nor is installing it intuitive, so I will provide links to both the Linux and Windows versions of the deskew plugin and instructions how to install each.

First download the plugin for your OS:

GIMP-deskew-plugin for Windows
GIMP-deskew-plugin for Linux

To install in the plugin into GIMP for Windows, unzip the plugin from the file you downloaded and place the deskew.exe file in the c:\program files\gimp\lib\2.0\lib\plug-ins\ folder.

To install the pluging into GIMP for Linux, simply place the pluging you downloaded, the deskew file, into the /usr/lib/gimp/2.0/plug-ins/ folder.

Now, either open GIMP or close and restart the program if you already had it open. You will now find a new entry in the Filters menu called Misc. The plugin is selected via the menu path Filters>Misc>Deskew.

NOTE: I did not write the GIMP deskew plugin, and thus cannot provide any support for it. I just want to make it easily available to other GIMP users since it took me some time to find both versions.