Monday, December 22, 2008

Joomla on XAMPP

Joomla Installation on a USB stick

These are some quick notes before i forget what i've done.

Goto:http://www.joomla.org/
Download the English 1.5.8 Full Package and save it
Double-click the downloaded Joomla_1.5.8-Stable-Full_Package.zip file
Extract the files to your USB stick in the xampp\htdocs folder into a folder called joomla

If the folder does not exist then create it (about 24mb of space is needed). When finished you should have a file \xampp\htdocs\joomla\index.php on your USB stick

Run the portableapps Xampp control panel and start the mysql and apache servers
Open a web browser and goto http://localhost
Under Tools click on phpMyAdmin
Select Databases
In the Create a database text box type joomla
Select utf8_unicode_ci from the pulldown menu
Click Create

Select the Privileges tab
Click Open new phpMyAdmin window
Click Add a New User
Select Use Text field in the User name: drop down menu
In the User name: text box type in joomla
Select Local in the Host: drop down menu
Select Use text Field in the Password drop down menu
Type joomla in the Password: text box
Type joomla in the Re-type: text box
Scroll down to the Database-specific priviledges
Select joomla From the Add Privileges on the Following database pulldown menu
Add tickmarks to all the boxes in the database specific privileges
Click GO
Close the extra phpmyadmin window
Goto http://localhost/joomla

It takes a minute to load the setup program and then the Joomla Installation page is displayed. The pre-installation check is run. All items should be in GREEN. The default XAMPP install has PHP Display Errors set to ON. This tells PHP to send any errors to the browser so you can see them. For a production site, this option should be off since an error message could give information about your system, a potential security risk. For development purposes, however, this option is useful. You have to edit php.ini and change the line with display_errors to On: (line 292?) to be:

display_errors = Off

Make sure to shutdown and then restart the servers when making this change. It may also be possible to override this on a directory basis with a .htaccess file using the directive:

php_value display_errors on

But i will have to test this sometime later. Anyway, we continue with the install as the error is not fatal.

Click NEXT
Read the license and click Next
The Database Configuration screen is shown
Select mySQL as the database type
hostname: localhost
username: joomla
password: joomla
database name: joomla
click NEXT

The FTP configuration page is shown. Since we will be copying files directly to the USB stick this is not needed.

Click NEXT
Enter your uwo username as the Site Name (ie gnickers)
Add your email address
Enter joomla as the admin password
Enter joomla as the Confirm admin password
Click INSTALL SAMPLE DATA
click NEXT

After setup is complete, you are prompted to delete the installation folder (for security reasons); in fact, Joomla itself won’t run until it detects the installation folder is gone.

Goto your USB stick and delete the xampp\htdocs\joomla\installation folder
Return to the web browser and click on the Site icon
If successful the Joomla home page is displayed
Scroll down to the LOGIN section and login
username admin
password joomla

And the joomla home page is displayed. Now we have to figure out how to create custom sites.

Joomla Administrator

We go to http://localhost/joomla/administrator and the login page appears. We enter admin as the username and joomla as the password and the administration screen appears. There are 3 types of administrative users:

  • super admins - access to everything (the admin user we just logged in as)
  • admins - can access the backend but cannot install extensions or modify super admin accounts
  • managers - can access the backend but are limited to media, content, components and the main menu
Users are created from the control panel using Site, User Manager. Let's create a user with content priviledges as this will allow us to see how a regular user might use the system.

Select Site, User Manager
Click the New icon
Fill in the details for the user
Set the language to english
Set the user editor to TinyMCE
Set the time zone to Eastern Time
Select the Author, Editor or Publisher group - we decide to select Editor
Click the Apply icon

TinyMCE is a platform independent open source web based Javascript HTML WYSIWYG editor that can easily be integrated into content management systems.
See: http://tinymce.moxiecode.com/

The 3 groups of contributors have different priviledges.

  • An author can contribute content to locations defined by the administrator and modify their account information
  • An editor has all the priviledges of an author and is able to edit content written by an author
  • A publisher has editor priviledges and is able to publish content to the site if you have restricted publishing to publishers only
Odd - when we hit apply it kicked up back to the login screen and when we logged back in and looked for the new gnickers user it was not there. Did the session time-out because we took too long to add the user?

We add it again and when we go to save we see the problem. It cannot save the gnickers user because we gave it our email address which is the same as the administrator. We either need to add a different email or set the user not to receive any email - which might be the better option.

I problably should have made the gnicker user a member of the super admin group and created an editor with a different name with no email.

New - solved problem with installing extensions

When i went to install an extension i got the following error message:

* JFolder::create: Infinite loop detected
* Warning! Failed to move file.

The problem is caused not being able to find the tmp and log folders which are hard-coded to a drive letter. The problem is when you move your USB stick from machine to machine the drive letter changes.

  1. Select Site, Global Configurations
  2. Click SERVER
  3. I see the path to temp-folder is hard-coded to J:\xampp\htdocs\joomla\tmp
  4. Click SYSTEM
  5. I see the path to log folder is also hard-coded J:\xampp\htdocs\joomla\logs
I remove the J: from both places and click SAVE. Now when i load an extension the error message is gone. However, their is some debate on the forums as to the desirability of making other changes to configuration files.

The first extension i tried to install timed out when this error:

Fatal error: Maximum execution time of 60 seconds exceeded
in F:\xampp\htdocs\joomla\libraries\joomla\filesystem\folder.php on line 395

We open folder.php and see that the section being referenced in the one that reads the source directory:

$handle = opendir($path);
while (($file = readdir($handle)) !== false)
{
$dir = $path.DS.$file;
$isDir = is_dir($dir);
if (($file != '.') && ($file != '..')
&& (!in_array($file, $exclude))) {



The offending line looks to be the isDir function - if the directory name is not correct then the program is probably spinning it's wheels and then times out. We decide to change the line to be:

$isDir = is_dir($dir.'/' );

and save the file, exit Joomla and restart Joomla. Now we try to load the extension again.

  1. Select Extensions, Install/unistall
  2. Click Browse
  3. Select com_joomlaexploter_1.6.3.zip
  4. Click Upload File & Install
result - no joy so i went back to the file and discovered the same code segment so i changed line 457 and save the file.

Try again - same result - the spinner spins for a while and then the screen goes white. More research is needed.

We check the file structure on the USB stick. First the joomla global configuration settings:

xampp\htdocs\joomla\tmp

Folder exists and has files! In fact the .zip extension we tried to install is in this folder.
There are folders for each install appempt.
Each install attempt folder contains 2 folders, scripts and style
The .zip extenstion archive has 6 folders

xampp\htdocs\joomla\logs

Folder exists but only has a blank index.html file with an old creation date

Next we check the php configuration by going to Help, System Information, Php settings. We find:

upload_tmp_dir \xampp\tmp \xampp\tmp
open_basedir no value no value

Could this be the problem? We check and xampp\tmp - exists but it contains a bunch of files that were just created but with 0 bytes and are empty. Is there a conflict between the joomla global configuration and the php.ini settings?

We search php.ini for open_basedir and find:

; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =

Looks like it is not set which confirms the global settings. Joomla has set this to:

\xampp\htdocs\joomla\tmp

But that path is inthe format of a local path. The php.ini setting would be a relative path for the web server i would think. Maybe this local path should be changed to a relative path?

The path of the web server root is \xampp\htdocs so the tmp folder should be \xampp\htdocs\tmp but there is no such folder. Perhaps \xampp\htdocs\joomla\tmp is correct but that is exactly what we have in the global configuration. I think the php basedir is more likely, can we do something like:
open_basedir = /xampp/htdocs/joomla/tmp

The change is made and we restart. Same result - no joy.
I must say the Joomla wiki entry on this VERY common problem is vague and little help.

Saturday, December 20, 2008

Ghosting Ubuntu to a different Hard Drive

Cloning a Hard Disk

When we originally set up Godzilla, the dual Xeon Evo 6000 it had plenty of disk space, a 73 gig boot drive and an 18 gig drive for storing junk. However, over the year it has had vmware installed to do virtual machine, transmission for getting torrents and a raft of video conversion tools. The plus is the machine is very useful, the downside is that it is filling up. A temporary solution was to plug in an old external USB 80 gig drive. But now that the term is over we need a longer term solution.

The first goal of the project is to get more disk space without re-installing the OS. With a simple machine consisting of a single IDE drive this can be easily accomplished by cloning or 'ghosting' the smaller drive to the larger. We have used Norton Ghost to do this successfully for many years. Put in the new larger drive on the 2nd IDE controller, boot to a ghost floppy and start the clone. Remove the first drive and put the new drive on the primary controller and boot away.

However, the situation gets more complicated if you use multiple drive types such as IDE, SCSI and SATA. Windows has rules about the order in which drive letters are assigned- it is possible to clone a SCSI to an IDE or vice-versa but a system with multiple scsi and ide drives is more difficult. Linux has a similar problem - a simple clone from ide to ide can be done but what if your needs are more complex?

In our case the system has 2 SCSI drives and 1 external IDE mounted in a USB case. We want to clone to scsi boot disk to a old 320 gig IDE disk and maybe later clone that to a 1 terabyte SATA disk.

The first step is to find out exactly what the disk are labelled. We open a terminal window get the following:

gnickers@godzilla:~$ sudo fdisk -l
[sudo] password for gnickers:

Disk /dev/sda: 18.2 GB, 18209792000 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00006694

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2213 17775891 b W95 FAT32

Disk /dev/sdb: 73.4 GB, 73407868928 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00045a17

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 8555 68718006 83 Linux
/dev/sdb2 8556 8924 2963992+ 5 Extended
/dev/sdb5 8556 8924 2963961 82 Linux swap / Solaris

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'!
The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdc1 1 9730 78150743+ ee EFI GPT

We decide to use a couple of other methods to check our results.

gnickers@godzilla:~$ sudo cfdisk -P s /dev/sda
[sudo] password for gnickers:
Partition Table for /dev/sda

First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
1 Primary 0 35551844 63 35551845 W95 FAT32(0B) Boot

and

gnickers@godzilla:~$ sudo tune2fs -l /dev/sda1 | grep UUID
tune2fs: Bad magic number in super-block while trying to open /dev/sda1
Couldn't find valid filesystem superblock.

Which gives an error message. I'm thinking we could simplify matters by disconnecting the external USB disk and the 18 gig internal scsi drive. We probably should reboot the system anyway as it has been up all term and probably needs to fsck the filesystem anyway.

Reboot - nothing. It does not come up to sdb1. Check connections and ensure adaptec scsi controller is set to boot the hd with id = 1. Reboot. no joy. So let's put the 18gig scsi back in and reboot again. The GRUB boot loader appears but lists Error 21 which means it cannot find the disk. We go into the scsi bios and see the 18gig is ID = 0 but the 73 gig has disappeared. A loose power connector. Fix and restart. no boot. So i undo the only other changes and set the scsi bios to boot to id0 which is the 18 gig and it works.

We need to take a closer look at this.

Sunday, November 16, 2008

Portable Xampp

Running LAMP on a USB stick

Last year we decided to stop using IT services and teach programming by having students run LAMP from a usb stick using server2go. It was successful enough (despite some new technology problems) that we want use the same approach again. With larger and faster usb drives like the excellent Corsair Flash Voyager GT series this is now a useful option.

We had downloaded and installed the XAMPP stack on our linux laptop and were quite impressed by the excellent job done by the project team. The next step was to try running it on a usb stick using the portable apps project.

The portable apps web page has an installable XAMPP control panel which we added to our stick and then:

  1. Double click StartPortableApps.exe
  2. Click the portable apps icon on the taskbar
  3. Scroll down and click on Xampp control panel
  4. Place tickmarks in the Apache and mySQL services
  5. Click the start button for each service to start them
  6. Goto http://127.0.0.1/ Which laods the xampp/index.php (be sure to allow 127.0.0.1)
  7. The status menu item will let you know what is running.
On my first attempt mysql was not running so none of the demos worked.

The problem was that i had been running wampserver off the desktop the usb was plugged into. Although i had shutdown wampserver the apache webserver was still running which prevented xampp from operating correctly.

The solution was to go to control panel, administration, services and to change the wampapache service properties to manual and to shut down the service.

I then re-ran the xampp control panel from the portable apps menu and when we clicked on the status menu item we see mysql is running correctly on port 3306 and apache is running on port 80.

We try out the demo apps and they all work. The next task is to port some of my examples from the server to the usb stick. This involves:

- exporting the mysql database into a backup .sql file
- creating the users on the mysql usb database
- restoring the database from the backup.sql file
- copying the .php .css .htm and .jpg files from the application's folder to the usb stick

Sunday, November 9, 2008

Virtualbox Win95

Windows 95 on VirtualBox

I wanted to play an old game - Axis and Allies but it does not run on XP and the company has never released an updated version or even fixed the bugs. Hasbro has a habit of buying up the IP rights to classic board games and then releasing terrible computer games based on them (while preventing anyone else from releasing a good game!)

Anyway i decided as a test to install win95 on vb to see how it goes. The vb version is the closed one version 2.0.4

  1. Click New
  2. Give it a Name of Win95
  3. Select Windows 95 from the OS Type pulldown menu
  4. Allocate 128 mb of ram memory
  5. Click New in the Boot Hard Disk dialog box
  6. Choose Fixed Sized Image
  7. Make it 1 gig in size
  8. Click Finish

Note to self: The removal of the previous virtual box left the xp virtual machine as xp.vi in /home/gnickers/.VirtualBox/VDI - test and see if we can use this later!)

Click Start
Delect CD/DVD-ROM device abd Host Drive
Click Finish
We get 'no bootable medium found . System halted'
Insert the win95 install cd
We select Reset and press F12 and select CD-ROM

The error: 'Fatal: could not read from boot medium. System halted'
We shutdown the vm and restart with no change.

We try clicking on setup.exe from the cdrom0 window which runs the install program, but it says you cannot 'run setup from within windows NT'. This looks like it is running the install program - perhaps using Wine!

I seem to recall having the same problems last time i tried virtualbox - while setting up and installing vmware was more difficult, creating virtual machines seemed easier and more obvious using vmware than virtualbox.

Let's try to recover the old xp vm

  1. Select New
  2. Select Windows xp as the os type and call it xp
  3. Assign 512mb of ram
  4. Select the old xp.vdi as the boot hard disk
  5. Click Finish
  6. Click Start

Turns out the image does not work - xp starts to run but generates a bunch of errors. Expected really so we deleted the xp vm. Best check the xp.vdi to make sure the 10gig file gets deleted too!

Ok - now i remember the problem - the boot order is set to floppy drive (remember those?) and then to cd/dvd and the last time we did this we had the same problem.

  1. Click Settings, General
  2. Select the Advanced tab
  3. Untick the Floppy box (since we have no floppy drive...)
  4. We also do cd/dvd-rom and place a tick in Mount CD-DVD drive and also Audio, enable audio and set the audio to use the ALSA audio driver.

One annoyance is that an error message about 'usb services' comes up. We had the same problem with virtualbox 1.5.0 ose and the fix rather technical.

BTW - we notice that snapshots are stored in /home/gnickers.VirtualBox/Machines/Win95/snapshots for this vm.

Ok we put in the win95 cd and start up the vm. No joy. A complete waste of time so far. Probably because i forgot that windows 95 is so ancient it requires booting from a floppy before you can run the install. I wonder if i can install it by booting up a freedos vm and then running setup.exe. Maybe later.

Let's see if the XP install that worked before will still work again.

Installing XP on VirtualBox

First - Follow the instructions on enabling USB support BEFORE starting virtualbox

  1. Click New
  2. Set the memory (we have 4 gig so we gave xp 512k)
  3. Click New to create a virtual hard disk (10 gig is fine for a test install)
  4. Click Settings (If you get an error message about USB see below)
  5. Adjust the video memory size (16 or 32mb)
  6. Click the Advanced Tab and untick the floppy in Boot Order
  7. Click CD/DVD-Rom and select the mount cd/dvd radio button
  8. Select Audio and tick Enable Audio and select the ALSA Audio Driver
  9. Click USB and place a tick in the enable USB controller
Ok now we are ready to run the XP vm and install xp from the cd.

  1. Start the xp vm
  2. Put in the xp cd
  3. We see the message - press a key to boot from the CD
  4. We press a key and the xp installer runs
The rest is the boring xp install. However once the installer has run there are some housekeeping chores to do such as turning off the automatic updates, and security center, the remote access and all that other junk.


Virtualbox USB Fix

Select Applications, Accessories, terminal and enter:

sudo gedit /etc/init.d/mountdevsubfs.sh

Go to the lines as shown below:

#
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs «» /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount --rbind /dev/bus/usb /proc/bus/usb

Uncomment the last 4 lines by deleting the # marks to make it look like below:

#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs «» /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount --rbind /dev/bus/usb /proc/bus/usb

Click SAVE
Select File, Quit

Now type this in terminal:

gksudo gedit /etc/udev/rules.d/40-permissions.rules

We then commented out the following system line by placing a # mark before it and added a # comment line saying when and why we made the change. We then copied the following line and edited out the # mark and did the following. Change:

SUBSYSTEM==»usb_device», MODE=»0664»

to

SUBSYSTEM==»usb_device», MODE=»0666»

We then did File, Save and exited the text editor.
And then rebooted the system

Now we Rerun virtualbox and when we click on SETTINGS there is no error message about USB.

Running VirtualBox

We were running virtualbox from the command line after the install by type VirtualBox which was a real annoyance. We wondered why the install did not add an entry to the system tools menu. As it turns out we were wrong - it DOES add a Sun xVM VirtualBox entry but NOT until you reboot!

Vritualbox on Ubuntu - update

VirtualBox Update

We went to run XP under virtualbox and found it was broken. Since we've been using ubuntu on the laptop we installed xp for those times we needed it, which has turned out to be not very much - so far we have not found anything we did on windows that we can't do on ubuntu. Since the summer there have been numerouse updates to the os but we have not run xp...

Anyway when starting up the xp virtual machine we got an error.

"virtualbox kernetl driver not installed.' The vboxdrv kernel module was either not loaded or /dev/vboxdrv was not created for some reason. Please install the virtualbox-ose-modules package for your kernet and execute /etc/init.d/vboxdrv start as root."

So off to the package manager we go to do a search for virtualbox. And we see that in fact we had installed the virtual-box-ose-module so maybe one of the updates broke this. Time to test out starting the vboxdrv module.

Off to Applications, Accessories, Terminal. Since starting the vboxdrv requires root priviledges we will use the sudo command.

barugon:~$ sudo /etc/init.d/vboxdrv start

Which gives us an error message about 'module vboxdrv not found'. Since modprobe (module probe) will not load a module unless it is installed first it looks like vboxdrv is not installed anymore. Should be re-install?

From the virtualbox help, about screen we see that we are using verison 1.5.0 and maybe the vbpxdrv module does not match my current linux kernel. Do we upgrade to 1.6.0 - but will upgrading destroy existing virtual machines? One would think not!

We go to the virtualbox downloads and see that it is at version 2.0.4 so we click to download the i386 version for Ubuntu 7.10 which automatically opens in the gDebi package manager. However, we get an error message: 'conflicts with teh installed package virtualbox-ose'.

Looks like we cannot do this directly. There is a note on the virtualbox web site that ubuntu users need to install the dkms package to ensure that the virtualbox host kernel module (vboxdrv) is properly updated if the linux kernel version changes during upgrades.

It seems likely this is what happened to us. Would have been useful it when installing virtualbox on ubunutu the package saw dkms as a 'dependency' and installed it. Will it work retroactively or do we have to remove the current version of virtualbox and reinstall the xp vm?

Back to the package manager to search for dkms which turns out to be the dynamic kernel module support framework and it was not installed. So we install it.

Now we retry the virtualbox-2.0 package but it gives the same error message. Oh well, let's deleted the existing vm's and remove the existing virtualbox installation and install the version 2 and then show how to install xp in class next week as a demo of a virtual machine installation.

We run virtualbox , select the xp vm and click Delete. We then run the package manager, search for virtualbox and mark the packages for removal.

Back to the virtualbox 2.0 download (just click the downloaded file in the firefox downloads window) and we click Install Package. It notes that "users of virtualbox must be members of the virtualbox group and host network interfaces will be assigned to that group."

A couple of Forwar clicks and the program installs itself.

Now we have to do the administrative tasks. Linux uses a different security model than windows (XP and lower) where everything basically has to have administrative rights. In Linux you can

We go to:

  1. System, administration, users and groups.
  2. Click on Manage Groups
  3. Select vboxusers
  4. Click properties
  5. Ensure the current user has a tick mark
  6. Click OK


One annoying thing it that the install did not add virtualbox to the applications, system menu. This is a long-standing annoyance with many linux installs - they seem to assume you know exactly where it installed...why? There are lots of places programs can install themselves to. Why i don't like the windows installer's habit of strewing icons across your desktop, the better installs ASK if you want an icon added to the menu and/or the desktop. Many linux installs do even do that. Why force people to have to hunt around the system trying to find out where the damn program is located so you can run it?



So how do you run it?

1. Run terminal (Applications, Accessories, Terminal)
2. VirtualBox

Note the capitalization of VirtualBox, you must type it exactly, else it the program will not be found. Linux is case-sensitive (unlike Windows) so that VirtualBox and virtualbox are different programs.

Once the program runs you have to agree to the EULA and register.


Next Step

Create a menu icon for VirtualBox so we don't have to run it from the terminal. But lunch first!



Appendix

Seeing how the version in the ubuntu repository is rather old, because there are two versions of Virtualbox, the open source one (ose) that gets included in distributions, and the more up to date closed version, which does not - so how do you keep up to date with virtualbox updates etc?
You have to add it to your list of repository sources.

Goto: http://www.virtualbox.org/wiki/Linux_Downloads
The easiest way seems to be to copy the following text from the web site and to open a terminal and paste it in:

wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -

To get some pre-built virtual machines for virtualbox goto:

http://virtualbox.wordpress.com/images/

Friday, October 17, 2008

Internet Radio 3

Testing in the Lab

We brought the labtop to the computer lab to test it out. First we had to register the mac address of the laptop in the DNS. We plugged into the free Z port near the instructor workstation and booted up. We then ran cmd and at the > prompt typed ipconfig /all to determine our IP address which was 129.100.35.254 today.

All the MP3 files are in a file called CONTENT in the Winamp directory although they could be anywhere.

We ran Winamp and clicked the ADD button and added that folder into a playlist. We can now arrange the content into the desired order - mixing longer speeches or music with short adverts or sound effects or canned carts like 'You're listenting to Bill and Marty on KBBL'. This allows the producer or DJ to design their own show. We saved this to a playlist file called playlist.M3U and started the show playing.

Next we ran the win32 version of icecast. (maybe we should do this first before playing the list!) which started streaming the audio.

We then fired up one of the lab machines and tested out the web interface by going to http://129.100.35.254:8000 and the web screen is displayed with the menu options of Administration | Server Status | Version. We clicked on the Administration menu option and verified it requires a username and password (which we had set up in the icecast.xml file) to log in.

We start the stream playing and the status menu shows up we are listening to the Giants of Philosophy series. So far so good. The only negative is it is playing in the horrid Windows Media Player but that is the default on windows machines so what can you do...

Next we fired up another lab workstation and ran Internet Explorer and went to http://129.100.35.254:8000 but got cannot display the web page and in Firefox we got a network timeout.

The problem is likely that our server is only accepting 1 connection? We changed some of the defaults in icecast.xml so we need to look at that, make some changes and try again.

Also we had logged in as ourselves on two workstations although that should not really make a difference.

Time for some lunch...and maybe we should look at the documentation...where we see:

"A mountpoint is a resource on the icecast server that represents a single broadcast stream. Mountpoints are named similar to files (/mystream.ogg, /mymp3stream). When listeners connect to icecast2, they must specify the mountpoint in the request (i.e. http://192.168.1.10:8000/mystream.ogg)"

I think we used a mountpoint the first time we did this so we try http://129.100.35.254:8000/stream.mp3 and it loads the Quicktime player. The spinner is going and going..

We go to the admin interface and log in and looks like we need to spend some more time in the config and documentation.

More tomorrow...



Monday, October 13, 2008

Internet Radio Station Part II

Internet Radio Broadcasting

The problem for our students will be they can't do anything in the computer labs as the machines only run Windows. I got the IT staff to install VirtualBox hoping that each student could create a VM but the IT dept won't let them do this - they can only define a VM to boot a livecd with. So how to do broadcasting when you can't set up anything?

The answer of course is open source to the rescue - having access to the source code means you can innovate and come up with solutions to problems. Can't install? - then run the application you want from a USB stick. They are now large enough and fast enough to be useful for this purpose. And while booting Linux from a USB would be the best solution - the lab locks down the BIOS so this is not possible. They should really provide a lab of diskless machines that boot from USB.

Apps that don't need installing are called portable applications and while it is possible to write windows apps that do this (remember the old .com executables?), it is not common because most window apps need to be in the registry and use windows system DLLs. However, many open source apps can be modified to run under windows without being installed. A list can be found at:
http://portableapps.com/support and there is also a large list linked from the wikipedia article.

The download site offers a choice of just the platform or the platform and applications. You can get a full suite of software that will run on a 512k stick.

Download PortableApps.com Suite and Platform

Get all the apps you need at once or add only the apps you want. Pick the download that's right for you:

Platform Only Suite Light Suite Standard
Download PortableApps.com Platform (Do Not Right-Click) Download PortableApps.com Suite Light (Do Not Right-Click) Download PortableApps.com Suite (Do Not Right-Click)
Download Size1MB download35MB download113MB download
Free Space Needed1.2MB installed100MB installed350MB installed
Recommended DeviceAll devices256MB+ devices512MB+ devices
Supported LanguageMultilingualEnglishEnglish
PortableApps.com Platform
PortableApps.com MenuXXX
PortableApps.com BackupXXX
Custom Folders, Icons & AutorunXXX
Bundled Apps
Mozilla Firefox, Portable Edition (web browser)
XX
Mozilla Thunderbird, Portable Edition (email)
XX
Mozilla Sunbird, Portable Edition (calendar/tasks)
XX
ClamWin Portable (antivirus)
XX
Pidgin Portable (instant messaging)
XX
Sumatra PDF Portable (PDF reader)
XX
KeePass Portable (password manager)
XX
Sudoku Portable (game)
XX
Mines-Perfect Portable (game)
XX
CoolPlayer+ Portable (audio player)
XX
OpenOffice.org Portable (office suite)
- Writer (word processor)
- Calc (spreadsheet)
- Impress (presentations)
- Base (database utility)
- Draw (drawing)


X
AbiWord Portable (word processor)
X


We decide to take only the platform as we want to add our own applications, the VLC media player and the Audacity sound editor in particular. VLC can stream audio so we want to see if it can work over a USB stick as a pirate Internet radio station.

Step 1 - Plug in a USB stick.
Step 2 - Download and save the portable apps platform software to your USB stick
Step 3 - Run the portableappscomplatformsetup_1.1.exe installer from your USB stick
Step 4 - Type in the drive letter of your USB stick and click OK
Step 5 - When the install is finished double-click the StartPortableApps.exe file

The menu appears. It can also be minimized to the taskbar. Right now the menu is empty as we just downloaded the platform. Now we need to get some portable apps so off to http://portableapps.com/apps/ we go.

We select Audacity which the site says "Audacity Portable is the popular Audacity audio editor packaged as a portable app, so you can take your audio files along with everything you need to edit and record on the go". We also grab coolplayer, a light audio player that does streaming and the popular and excellent VLC media player.

We first installed Audacity by running the installer and it selected its install folder on the USB drive. We then added MP3 support by copying lame_enc.dll from the winamp folder we had already installed it in to the AudacityPortable\App\LAME directory.

Finally we installed the VLC media player to the USB stick.

The next step was to add the newly installed applications to the portable apps menu. At this point we find out we should have installed from within the portable apps menu and it would have automatically added the apps to the menu. No problem - we quit the p-apps platform and run it again and the new programs are on the menu.

Now to set up VLC as a streaming audio server. First we copy over some content as we want to run both content and server off the USB stick as a test. We then run VLC and set the downloading of album art to manual and turn off the update checking.

Now that the program is running we select Media, File Open and choose a bunch of files. The first file starts playing so we stop it.

We select Audio, Audio Device, Mono from the menu
We select Playlist, Show Playlist from the menu to display our selections
We highlight the selections and right-click and select Stream from the menu

This brings up the Stream Output dialog box. Check the box next to Play Locally under Outputs. When streaming to another system we would not play the file on the server, but this option is useful for testing that our audio plays ok.

We have a number of options under outputs. We can use check the HTTP box and add the IP address of the machine VLC is running on. This should give us access using a web browser - of course the web browser needs to have the proper extensions or plug-ins to play audio files. Since we are using Firefox on Ubuntu the firefox mplayer extension does the job, however users of IE may be out of luck. There is also an icecast option - actually this would be good!

The other option is to click the RTP box which ungreys the UDP box. Either one should work and stream the audio so it could be picked up by another VLC client running on a second comptuer.

Let's try the HTTP option first. We add 191.168.1.108 as the address and the service is running on port 8000.

We also turn on VLC's web interface by selecting Tools, Add Interface, Web Interface from the menu. This seems to do nothing and we cannot connect to port 8080.

Under the Profile section we click the Audio Codec tab and select MPEG audio as the codec with a bitrate of 96bps and 1 channel.

We click Stream to start the audio server playing. Now off to the second computer and run firefox and goto http://192.168.1.108:8000 and all we get is a spinning loading. We can hear the file playing locally. So we return to the Stream Output dialog box and change the setting to RTP with the same address and fire up VLC on the second computer.

Select File, Open Network Stream. UDP is selected so we click OK and VLC should start playing, but it does not. We change to udp/multicast and enter in the ip address of 192.168.1.108 but this returns an 'unable to open' error message. It looks like our laptop is not streaming at all.

Perhaps download a portable version of icecast? WE do but it is in .rar format so we also download the excellent 7-zip portable app and add it to our keychain usb stick. Once we extract we find a portable icecast.exe file in an icecast folder. Do we run this - is it an installer or is it the executable? It does not look to be in paf format. We decide to copy the icecast folder to the portableapps directory on the USB stick as well as our working icecast.xml file.

When we run the program it asks for the location of the M3U file to stream. M3U is a winamp file that stores playlists. It is actually a text file that looks something like this:

#EXTM3U
#EXTINF:134,Have A Holly Jolly Christmas - A Holly Jolly Christmas
\xmasprogram\Burl Ives\Have A Holly Jolly Christmas\A Holly Jolly Christmas.mp3

M3U files are now used as a single entry point for streaming content over the internet.

Each location is placed on a new line. The 134 indicates the length in seconds, although a value of -1 should be used when the media file is a streaming file. Next comes the display title. The next line indicates the location of the content. The location can be either an absolute or relative path pathnames (e.g., "E:\ives\holly.mp3" or "\ives\holly.mp3") or they can be URLs. The file can also include comments, prefaced by the "#" character. For portability reason it would be best to use relative paths.

Probably the easiest thing to do would be to put all the content into a folder and then place the folder path into the M3U file so that when the media player starts it plays all the content which then gets streamed. Here is an example from Wikipedia:

#EXTM3U

#EXTINF:123,Sample title
Sample.mp3

#EXTINF:321,Example title
Greatest Hits\Example.ogg
So first step is to move all the content on the flash drive to a folder and edit the M3U file. So we created a content folder on the flash drive. Instead of hand-coding the M3U file we ran winamp and right-clicked and choose Playlist Editor from the menu, removed the existing entries in the playlist and pointed winamp to the content folder on the USB drive. We then re-arranged the content in the desired sequence and clicked the List Opts button and saved the list to the USB stick as playlist.m3u.

Ok now we are almost ready to try again. We did notice during the last attempt that the IP address of the portable icecast was incorrect. This could be due to the configuration so we check the icecast folder on the USB stick. We had copied our working icecast.xml file to the stick but let's take a look:

ezstream_mp3.xml is a configuration file - uses localhost:8000 and it looks for a m3u filename but it is currently set to look in c:\program files\winamp\winamp.m3u

This could be a problem as what if the computer you are running the pirate internet radio station on does not have winamp but something useless like windows media player? There was no portable winamp listed on the portableapps site but since winamp doesn't really hook into windows it should be portable. Let's search. Ok there is a :

Portable Winamp 5.35:

So we switch to the windows laptop and download. We start up the portable apps environment and select Options, Install a New App. However, the winamp.exe is not in the portable applications (paf) exe format. So we have to do it by hand. We create a folder in the Portable Apps directory on the USB stick. Run the winamp install and select the folder and click install.

It's writing tons of crap to the stick - all sorts of stuff we don't want. It is the FULL version - 33mb of stuff is installed. We don't need no stinkin visualizations of skins or dsp effects for streaming audio! So don't use the softpedia download. I now either have to prune it manually or uninstall and find a portable lite version. What we need to find is the portable winamp lite 5.1

No joy yet - there is on out there but either you end up at scary sites or get the redirect runaround. Too dangerous to take a windows machine. Let's try installing the non-portable lite version to the USB stick first and removing things like file associations etc.

Run the winamplite installer and choose the minimal version which takes 2.7mb of space. We deselect all associations or icons or other hooks with a custom install and then choose a destination of d:\portableapps\winamp. We select shared settings for all users but choose NOT to copy them to the c:\program files\winamp folder. No downloading of codecs and we click install. We untick the anon stats and tick the do not ask again until the next install in case it has a nag setting.

Next we examine the winamp configuration settings in install.ini and see that everything is pretty much set to =0 but we change the associate with m3u playlist files to =1 and add the line no_registry=1

Since there is no need to unininstall or to run the winamp agent we delele the uninstallwa.exe file and the winampa.exe file. We also run winamp from the USB Stick and right click and select Preferences. We untick the check for new instances and the show winamp in systray stuff and untick the show winamp in windows folders, and untick restore file associations. Not sure about disabling the 3 default plugins - we leave them alone for now.

Next we want to add winamp to the portableapps menu and test it out on a computer without winamp installed.

First we run portableapps and the winamp icon is displayed in our list. If it was not we would select Options, Refresh Apps Icons from the menu.

When we run the portableicecast and feed it our playlist.M3U file we get the message:

"your stream is on: http://172.33.16.23:8000/stream.m3u" which should not be as the ip address of the machine is 192.168.1.110. Could it be the person who created this version hard-coded the server ip? There are no notes with the file.

Ok for now looks like we will have to come back later to the idea of running a portable pirate radio station from USB and work on running it from the laptop.

Internet Radio Station

Internet Radio

Today we want to take a first look at Internet broadcasting, but not necessarily the creation of podcasts, which when you strip away the jargon are just recorded audio files - usually just some talking head. Good for listening to lectures on the bus possibly but pretty boring most of the time. What is more interesting is the concept of replacing amplitude modulation or frequency modulation transmission methods for radio with broadcasting over tcp/ip. A mac server using the included quicktime broadcaster would be a good way of proceeding but let's see if we can do this on the cheap.

Looking through the storage bins we came up with a bag full of old mac microphones - the ones that also work on PC's. So we can set up the class with mics for recording their voice-overs and carts. We also have a bunch of audio content already in MP3 format as the test files for the web class - including songs, speeches, sound effects etc. All we have to do is set up a steaming audio server and design our show.

We are going to start with Windows first and then see how it can be done on Linux. The first requirement is something to steam audio in MP3 format.

So we head off to http://www.icecast.org/ the home of the open source Icecast project. Their home page says "Icecast, the project, is a collection of programs and libraries for streaming audio over the Internet". This includes:
  • icecast, a program that streams audio data to listeners
  • libshout, a library for communicating with Icecast servers
  • IceS, a program that sends audio data to Icecast servers
They have download versions for windows, red hat (.rpm) and a generic tarball which would what we will use later with Ubuntu. I see there is some user-contribute howtos that will be usedful later such as the ogg vorbis howto and a long article by Kerry Cox on open source audio streaming.

For now we download and install the Windows version which installs itself as a windows service. This means you can administer the service through the control panel, administrative tools, services applet. The default is to set the icecast service to automatic which makes sense for a server. Since this is running on my sub-notebook we change this to manual for now. If you do this you have to tick the checkbox Start Server on Application Startup in Icecast.

The program installs itself to C:\Program Files\Icecast2 Win32 which contains the configuraion file called icecast.xml which we open in the Notepad text editor. For doing a demonstration we problably want to 'lighten' the load on the mini book.

For example, i've reduced the number of clients from the default of 100 down to 10 and made some other changes. Also enabled burst mode, changed the source/relay passwords and setup the admin user password. I left the directory listings commented so that functionality is disabled for now. Port 8000 was set up for multiple connections.

After we save the file we run Icecast. Since we had set the service to manual we had to click the Start Service button which immediate brings up a windows security alert from the windows firewall. Click Unblock to allow Icecast to proceed. You can actually edit your configuration inside the program.

Once we verified the icecast server program is running ok we n0w need some broadcasting tools for the audio. The idea is to play the audio and send it to the icecast server for streaming. We don't want to a bloated program like windows media player (which we disabled anyway) because we prefer Winamp, especially the lite version on Windows with the dumb visualizations turned off.

There was a neat plug-in called oddcast. So off to http://www.oddsock.org/tools/edcast/ we go. The web site says:

"Edcast is a broadcasting application targeted to the small station owner. There are three different flavors, a Winamp plugin, a Foobar plugin, and a standalone broadcaster".

This give us some choices. Since we already have winamp lite version 5.xx we can try the old oddcast plugin and see how it goes - and if that is no good then try the standalone edcast program. So we install oddcast version 3.xx and choose the default install. Note that this comes with an option for the Lame mp3 encoder but that it cannot be included for legal reasons.

We right click on winamp and select Options, Preferences from the menu. In the plug-in section we select DSP/effect and choose Oddcast. The configuration dialog box for the plug-in appears.

The problem here is that only the ogg vorbis encoder appears so that all audio will be streamed in that format. Since all our content is in MP3 format that is no good. Looks like we have to install the lame MP3 encoder.

So we need to reinstall oddcast. First we search the web and download out_lame162 which is a lame encoder plug-in for winamp and install. The installer works but returns a warning:

Quality value setting is broken in 3.96.1. Use presets to set quality of use 3.97.4

Let's see if we can use presets to get an acceptably low bitrate for streaming. If not we have to get the newer version. However, it doesn't even turnup as a plugin in winamp s o we go back to the oddcast and select lamp this time. We download the lam_enc.dll and copy it to the winamp program directory.

Now we run winamp again and right click and select Options, Preferences from the menu
Then we click on the oddcast dsp.
You have to move to (none) and then back to Oddcast to bring up the configuration box
Clicking the Configure active plug-in button did nothing
Select the encoder setting and right click. Select Configure from the menu

We select the existing encoder entry (ogg vorbis) and right click to bring up the properties. For encoder type we select MP3 instead of ogg or flac. As warned the quality box is greyed out so we manually select a bitrate of 96 with a mono channel with a sampling rate of 22050 about half of the normal rate.

5512 Capable of telephone quality audio
11025 Capable of radio quality audio
22050 Reasonable fidelity
44100 CD quality

The idea was to get it working first and then see about optimizing the sound. The oddcast panel also has a live recording feature so you can broadcast voiceovers or commericals or 'radio personality' chit-chat. We hooked up a gooseneck clarad mic to the mic input jack on the laptop.

Once confusing item is the mount point of /stream.ogg - it is not clear what this refers to. I changed it to /stream.mp3 and clicked ok.

Ooops- better figure out the IP address of the laptop. Drop to DOS and type ipconfig and see it is running on 192.168.1.110 on the wireless and 192.168.1.108 on the wired. Will we be broadcasting on both? Stay tuned...Best load up some content - we goto winamp and load the classic 'green eggs and ham'.

We now click the Connect button and goto the linux box and type:
http://192.168.1.108:8000/stream.mp3

Success!

We can hear the bedtime story. It buffers the audio and actually sounds quite good. Will have to test with some music later - load up the laptop with tunes. We also want to test the connection with a number of different machines listening to see the load on a light laptop.

Interesting to see how the streaming works. I stopped playing the file on the laptop and it was eerie to still hear it playing on the desktop next to it. I then used the live recording function with the mic to create a short promo. The neat thing is the promo is not heard by the client until the green eggs and ham story was finished. Streaming means there is a steam of data being sent out. Obviously this affects how you setup your show. Do you record everything at once or combine bits into a single audio file or more likely set up a playlist in winamp or even do a random shuffle (with repeats or no repeats) of MP3 files in a directory. Takes me back to Acadia radio in college.

More later - time for some dinner

Weird thing - i decided to switch laptops to use the full-size machine. Icecast installed but winamp crashed on install a couple of times. I only got it to install by delselecting all the options. I then installed and configured oddcast and setup a playlist. Everything looks ok but the web browser could not find the mount point file of /stream.mp3 that i had specified in oddcast.

Checking the oddcast configuration in winamp i noticed it was constantly disconnecting and reconnecting. If winamp was stopped it connected but when the playlist was playing it kept timing out and trying to reconnect. Nothing seemed to solve the problem - i checked the config settings for everything against the working version. Then i copied the plugin directory from the working mininote and ran winamp again. An error message of libsnd.dll not found was displayed but the program ran and oddcast connected and the mp3 stream was ok. The web browser now connected and found the mount point. There was funny business with quicktime, the app associsted with the stream on the client - it would only play a few seconds and i could not get two clients to connect.

Saturday, October 4, 2008

Creating Audio CD's

Creating a regular CD from MPs

Sometimes you want to create a legacy cd from a collection of mp3 files - perhaps for someone who has only a cd player or for long trips in cars that have older equipment. Commercial programs like Roxio offer this capability so we were curious to know how easy it is to do under Ubuntu.

We fired up the Brasero disc burning program and selected Create an Audio Disc. We then dragged a bunch on MP3 files into the disc project. Each MP3 file took a little time to process but in a minute or so we were ready to burn.

We click BURN and it starts creating the audio disc.

One thing about this - since it is recreating cd audio from the mp3 lossy format the quality should vary depending on the amount of compression . A 128bit file should sound worse as an audio cd than a 256bit file. The test would be to burn the same file at different bit rates and compare. While audiophiles decry any loss of data as a horror, in fact it can, in some cases, improve the sound. Before CSNY 4 Way Street came out on CD, i had downloaded an mp3 version ripped from the vinyl from Napster. And frankly, after comparing the sound of the two - i preferred listening to the 'lower quality' mp3 as it was more 'listenable'. Not scientific to be sure but similar to hearing a song on the radio and liking it and then buying the CD and hating it. Compression does change the sound but not always for the worse...otherwise why do some people prefer vinyl records with their oddball compression schemes and restricted audio bandwidth?

Ah - cd is finished. Let's test it out...sounds fine to me - of course these speakers are little jbl's so lets move it on upstairs to the psb status goldi's and see how it sounds..

Update

Some pople package their audio into bin/cue files which can be a problem. So i installed the bchunk package which converts a CD image in a .bin/.cue format (sometimes .raw/.cue) into
a set of .iso and .cdr/.wav tracks. The .bin/.cue format is used by some non-UNIX CD-writing software, but is not supported on most other CD-writing programs. Hopefully, this solves the problem.

Wednesday, October 1, 2008

Open Source to the Rescue

Saved by firefox and Ubuntu

One of the dangers and annoyances of using windows is the ever present threat of viruses, malware, spyware and such junk. And I manage to get one every 6 months or so. This time i had to use IE for a web site and it managed to get a very clever virus on the machine. The trend av software can point to the DLL but can't remove it or quarantine it. And of course you can't remove it manually, even in safe mode command prompt. I couldn't even unregister the DLL. Removing most of the entries in the registry is easy but some keep coming back and i've combed through and can't find where it is hiding the re-entry point - it seems to have attached itself to windows logon, a process that can't be shut down without rebooting.

I can take the process out of the registry startup list and remove the notify entry from the windows NT logon entry but the thing keeps recreating helpers all over the place. Clever but evil.

I removed the machine from the network while it stews. Kind of funny to watch the anti virus software keep spinning and reporting i have a virus while suggesting i delete the file! dumb and dumber, and me dumb for paying $$$ for anti virus software in the first place...

Anyway this is not a disaster as all the files are not stored on the machine, just the OS - which can be re-installed (the usual xp fix). However, the most useful stuff these days is in the web browser but since i use firefox with the FEBE extension i just exported all my data out to a usb stick and brought it to the old compaq evo dual p3 machine that used to be a server. Restored the data to firefox and we are productive again.

However, the loss to time to windows folly is very annoying - if i did not have to keep a windows machine around for work-related tasks it would be gone immediately.

The solution to the very pesky virus was to pull the hard drive out of the machine, put in in a portable drive case and hook it to the Ubuntu machine. It mounted the NTFS partition on the desktop and i went in and deleted the offending .DLL that was attached to winlogon and then deleted the copies it placed in the system restore folders (which windows let it do - but would not let me delete) and deleted the files in placed in a .username hidden folder. Once everything was deleted i returned the drive to the original machine and restarted up in safe mode and ran regedit and deleted the last remaining entries.

Open Office Annoyances


Impress insert picture problem

While i mainly hate Microsoft Office 2007 for lots of good reasons such as the giant, non-movable menu that takes all the screen real estate and the fact that drop down menus obscure the content under them -but open office also has some annoying habits.

twitter = someone just told me to right click on the ribbon and it can be minimized. This point out the other problem with 2007 - 10 years of word knowledge down the drain...i used the program for an hour before discovering the 'office button' which looks like a decoration is in fact a control and can be clicked. The control has no affordance to indicate it can be clicked - you learn by trial and error with 2007.

The first Open Office annoyance was the default box around the page - so 1990's but easy to turn off once you know where.

Today i discovered that the default behaviour of Impress is to put a link to a graphic into the presentation. This may be done to keep down the size of the presentation but it is a HUGE inconvenience when you upload presentations to make them available as suddenly //gnickers/home/documents/presentations/sept 30/images/stock prices.jpg is not displayed in the presentation but only a link to a file that Impress cannot find. I had been inserting images from files and while this works on your computer it fails when you move the presentation to the classroom.

What i've been doing as a workaround is opening the image in the GIMP and doing a copy and paste into the Impress slide. This embeds the image so that the presentation works as you would expect.

At least powerpoint embeds the image in the presentation - ok it make the presentation 6 mb in size but that is a small one these days. Hell, people send 4mb e-mails without thinking.

The OO wiki notes "Also, with many large images, OpenOffice.org consumes more memory and may crash."

The setting probably can be changed. Let's see how easy it is to find...ah from the oo wiki the answer appears:

Notice in the Insert picture dialog the two checkboxes called Link and Preview. Their position is determined by the operating system, but they are normally in the bottom part of the dialog.

If Preview is checked a thumbnail of the selected image shows in the preview area on the right.

Select the Link checkbox to insert the picture as a link to the file rather than embedding the file itself. In general it is preferable to embed images so that the presentation can be copied to other computers, however on some occasions it makes sense to link the image rather than embed it:

  • When the image file is quite large (linking rather than embedding will dramatically reduce the size of the presentation file)
  • When the same image file is used in many presentations (for example when using the same background image for all the presentations created)
  • When the linked file will be available when loading the presentation (for example if the presentation is a slide show of holiday pictures)

Test

So we select Insert picture from a USB stick and in the dialog box are the two checkboxes and neither of them are checked so the default if you do nothing is to LINK. Personally, i think this is bad default choice. I select PREVIEW and it works. We unmount the USB and the picture is still there - whereas before just the URL would show.

Problem solved....Time for some tea

Latest annoyance is the Fonts menu display. Instead of just showing a list of fonts and what they look like it has a blue A and and up and down arrow at the start of each font which is really annoying. The question is why? Do they have some meaning? If i install some postscript type 1 fonts will they have s different prefix in the list - perhaps a blue P? Don't know but i would like to get rid of the blue letter and red arrows!

One



Tuesday, September 30, 2008

Printing

The old mac G4 server died and it handled the printing for the linux machines, operating as a print server over ethernet. I was tempted by a mac mini but decided to hold off a bit. This meant we had to do something about the printing. I was able to set up Ubuntu to go to the HP jetdirect printer server which drives an ancient apple laserwriter 360 which is the printer for the windoze machines. It works fine but the 360 is very old and when the cartridge runs out it's off to the curb. So i need a better solution for Godzilla, the dual xeon desktop. Which was upgraded this fall to 2 gig of ram, a usb 2.0 card and an nvidia 7600GT video card. The 320 hard disk is sitting there waiting for install...real soon now.

Anyway - our first attempt was to uplug the ethernet from the printer and switch it to parallel.
The printer is an Apple Laserwriter 630 pro, a nice black and white postscript beast. Hauled out an lpt cable from the box and connected it up.

Installation is easy, select system, administration, printing. Choose local printer and select lpt1 port and apple and the model. However, when i printed a test page the postscipt caused an error right after the settings code was sent, right after the %%Title: PPR test page and it printed blank sheets.

The ports are auto configuring but the setup was done using the osx server printer utility - which i no longer have up and running. I could try hooking up one of the many macs lying around and use the localtalk connection and the os9 printer utility to see if the settings can be changed.....or use Plan Z.

Plan Z is to use the NEC 1800 postscript laser printer that has been sitting around gathering dust. Nice printer. So we connect it up with the parallel cable. Of course the rest of the apple test page spits out 4 pages of postsript code until we get an %EOF.

We goto into the printer administration control panel and select lpt1, NEC, 1800 and print out a test page. The Ubuntu Ghostscript version 3010 revision 861 test page comes out. Very nice. We could set this printer up as a share for a backup to the HP jetdirect if the apple 360 dies suddenly. Would be interesting to see if the windoze systems can see it. The printer has an ethernet port but when i put it on the network before the XP boxes could not print to it.

Now we have to put the apple 630 to use - perhaps as a mac os9 printer...

Friday, September 26, 2008

Open Source Portable Applications

One of the problems in evaluating open source is that all computer labs and most work environments do not allow you to install anything. So how do you try something new?

The answer is portable applications - programs that do not have to be installed to run. Because open source is open, people have been able to modify the programs to make them run without needing installation. This means you can keep them on your USB stick until needed. And since open source is platform agnostic there are even windows versions.

We ran into the usual IT dept roadblock a few terms ago when we wanted to teach LAMP. They finally put up a server but restricted access so severely that there was no point. The solution was to run a portable LAMP stack called server2go. (Hong Cui; Nickerson, Gordon. Journal of Education for Library & Information Science. September, 2007. )

Since then, the number of portable applications has exploded as they provided a real solution to the 'locked-down' windows-only computers in most organizations.

The wikipedia entry at http://en.wikipedia.org/wiki/List_of_portable_software is not exhaustive but lists a large variety of software suitable for your USB stick. Most are packaged in PortableApps.com format which uses a PortableApps launcher (either embedded or standalone) and are for Windows. A list of mac portable apps is at: http://www.freesmug.org/portableapps/
although macs have always had 'portable' apps because you can run many programs from CD or disk images.

Graphics

GIMP portable - graphics program for windows and osx
GIMPshop - photoshop like version.
There is also X-inkscape a vector graphics program at http://www.portablefreeware.com/?id=657 and copies of Tuxpaint and Zpaint.

Word Processing

Portable Abiword is at http://abiword-portable.en.softonic.com/ and portable open office is at https://sourceforge.net/projects/portableoo/and even the desktop publishing scribus software is portable. See https://sourceforge.net/projects/portablescribus/

There are lots of other stuff i can't wait to try including bittorrent clients and Mojopac, a portable chopped down copy of windows that you create.

The growth in portable apps shows once again the amount of innovation that occurs when people have access to the source code!

October Update - we finally got around to building the USB key of open source apps and it is working well. What we need now is to figure out which are the fastest USB keys on the market and go buy a big one. The next step is to move the XAMPP stack off the computer and onto the USB, i read that it can be done and integrated into the portableapps menu - perfect for the January term. What i am wondering about now is producing a class set of pre-configured USB keys ready to go. This would save a lot of time and problems. There are hardware-based USB duplicators but they are expensive. Since many computers have 6 or more USB slots running off several buses a software duplicator like Ghost might be the answer. You can always back up and restore the sticks from the portableapps menu - need to test this out. The menu also allows the user to change the name on the stick to their own name. The idea here is to create a total environment with all the tools they need including firefox extensions and favorites and just clone the master image.

PS - the other kicker in this is we could get network games like doom and quake to run and have a fragfest in the lab without the windows IT guys having a fit...we did this a few years ago with a linux live games cd but i haven't been able to find a copy since...

Wednesday, August 20, 2008

LAMP

I had been looking at setting up a LAMP development environment on Ubuntu as i use Wampserver on windows. Setting up lamp on the desktop version turned out to be more complicated than i imagined as there is no 'lamp' package. The server version has lamp running but getting the GUI installed was also more complicated than anticipated.

I did get xampp running on the Ubuntu desktop but then decided to rethink this a bit. I'm teaching a course in the winter and want to use LAMP but the IT department has made it difficult, so i've been researching wamp stacks that can run without being installed. Although the number of mac and linux students has gone up most students are using windows and the lab computers run only windows.

The other problem is i need to do some maintenance on an old application written for php4 and mysql4 that does not run on php5 so i need a lamp stack that can be 'downgraded' (sort of like vista). Xampp does this but the windows version has an installer. I do like the stuff it bundles such as webalizer but the security settings on the computers will not allow students to install. Hmnn - the Zip version does not seem to require an install - you just unzip and run a batch file. Let's try this out.

We go to the XAMPP home page at :
http://www.apachefriends.org/en/xampp-windows.html#641
and find the windows zip download which is about 88 mb.

Basically it looks like you unzip the files to a folder of your choice. This means it can be on an external drive, internal hd or a usb stick. If this works then our windows and linux development environments would be similar.

Once downloaded we extract the XAMPP folder from the archive to our E:\ drive which happens to be an external HD. We also copy the XAMPP folder to a USB stick.

The next step is to change to the XAMPP folder and run the setup_xampp.bat script which updates the configuration files with the path of the current location.

For the external hd that would be e:\xampp - the question is what about the USB stick? Since windows uses drive letters as mount points and assigns them based on the hardware in the machine the USB stick is mounted as drive G: in my configuration but will be drive E: or F: depending on which computer lab the students are in. We will have to see if this causes a problem - they may have to run setup_xampp.bat for each location change.

To test we will run the setup on G: and then move the stick to another machine and test if out there.

For now we open a terminal session by going to Start,Run and typing:

cmd
cd \xampp
dir *.bat

and we see the setup_xampp.bat file so we type the filename to run it. It generates a couple of messages and we are done.

Testing it Out

Back in the windows GUI we first run the port checking utility called xampp-portcheck.exe which shows if your port are free and we see the http ports 80,81 and 443 are free along with the mysql 3306 and ftp at 21 and the email ports of 25,110 and 143.

Next we run the xampp-control.exe utility which is the XAMPP Control Panel. This lists the current directory as c:\xampp but warns that there is a directory mismatch with the install directory. Not sure - will investigate later.

We click START to get Apache running. Green text indicates it is up. Next we START mysql. We do not start the filezilla FTP server or Mercury email.

Runing Firefox we goto http://localhost first and get the XAMPP splash screen. We click on English and the home page is displayed.

The Status menu item shows what is running and the standard phpinfo() entry shows that PHP version 5.2.6 is running. We have to figure out how to 'downgrade' to version 4.

One of the neat things about XAMPP vs other standalone stacks is that it ships with a number of demo applications such as a CD Collection app which can output the record list as a PDF document.

The next step is to bring over the files from our application which raises the question of where it should go. Looks like all content goes into XAMPP\htdocs so we will copy our folder to there.

We then stop and restart Apache just in clase, although we probably could have just entered the http://localhost/folder where folder is the one we just copied over. We run update.php and the application is displayed - of course most of the objects don't work as the database tables are missing. So our next step is to export the mysql tables and data from the old app and re-create it here. This gives us an idea. We are big fans of Navicat (http://www.navicat.com/) as a gui tool for mysql so we fire it up and create a connection using localhost as the IP address with a username of root and no password as this is the default insecure XAMPP setup.

The connect runs and we are able to see the databasees and tables. We create a new database as the target for our sql data transfer. One of the neat things about mysql and other sql databases is that you can replicate them with ease.

First we open a VPN connection to the server. This is not required by mysql but our IT folks don't allow any connection from the big, bad internet. Now we open a mysql connection to the mysql server and start to transfer some databases.

In Navicat this is as easy a creating a blank target database on your machine and then selecting Tools, Data Transfer from the menu and choosing what tables to bring over.

Unfortunately the data transfers fail. Why? We have done this a hundred times but not with the new VPN. Let's try another server that is not behind a security blanket. Of course it works like a charm. Is the server the problem or is it that fact the one server is running the latest version of mysql (5.x) while the other is running 4.x? and i am running an older version of the navicat tool? WE could test this out by downing a trial version of the latest client and trying a data transfer.

We do see a timeout on the server behind the firewall - we get a cannot connect message (nothing to do with a torrent of traffic...:) - in fact our transfers of the wordpress and wiki databases go really quickly so it is not a bandwidth issue. Error message is

"2003 - can't connect to mysql server on host (10060)"

We goto the navicat home page and download a 30 day trial of the new client. And that solves the problem - the move to mysql 5 breaks some older sql tools. We were able to transfer the databases with ease, even the large AOL queries database.

The server is 5.1.22 while the working one is verions 4.0.20. At least we were able to get the tables and data transferred over to the laptop. Now we have to set up the user for the database so the pages can connect.

We then use the updated client to data transfer the databases to the older machine and we are ready to get to work.

Ok we added the username for this database along with a password and restricted it to localhost and tested the app and it can read the database. So now it's maintenance time!

Just discovered something neat about WAMPserver - you can select PHP or MYSQL while it is running and choose Version, Get More and download older versions such as php4 or mysql4 and then choose then when you start up the service. Of course, you also have to 'downgrade' apache as the latest version does not work with php4.

Excellent! I can do the changes to the appz without having to figure out where they need to be updated for 5!

As usual it is a little more complicated than that as the versions i selected did not work together so i decided to replicate the existing environment as closely as possible using:

Apache 2.0.49
PHP 4.1.2
mySQL 4.1.20

Ok and we run wampserver again and the services start this time but the page gives errors - probably the modifications i was doing. Let's undo and see.

Nope - its the change in mysql - all the databases are not there in the other version. So we either have to replicate them between versions or....let's restore ver 5 and see what happens.

Cool - we closed the sql connection to localhost and changed to ver 5 in the wamp control panel and re-opened the mysql connection and all the databases are there. This lets us run a quick test.... the login page returns database errors:

Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\wamp\www\perl\login.php on line 17

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\perl\login.php on line 21

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\wamp\www\perl\login.php on line 21

So lets try another test by changing the php version back to 5 and reload the page. Now it loads the page correctly but the data is not read and displayed from the database. However, that was with mysql 5 and php 5 so now we test by backing off mysql to ver 4.1.22 which results in the same errors.

So we need to change mysql version to 4.1.20 and those error messages go away. So let's replicate the database.

The problem was the Navicat tool we purchased back in 2004 cannot do a data transfer between a mysql 5 database server and a mysql 4 database server. The solution was to goto to the mysql 5 server and to dump each table to an SQL file over the network to the mysql 4 server and then to execute the .sql file to recreate the tables and load the data. This is basically the same method you can use to do a backup or a data transfer. SQL is so flexible and since the files are ASCII text you can even edit them or send them by email or whatever. It looks like this:

/*
MySQL Backup
Source Host: localhost
Source Server Version: 5.0.51b-community
Source Database: perl
Date: 2008/08/21 14:15:22
*/

use perl;
SET FOREIGN_KEY_CHECKS=0;
#----------------------------
# Table structure for authors
#----------------------------
CREATE TABLE `authors` (
`Author_ID` int(11) NOT NULL auto_increment,
`Fname` varchar(20) NOT NULL default '',
`Lname` varchar(40) NOT NULL default '',
PRIMARY KEY (`Author_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
#----------------------------
# Records for table authors
#----------------------------

insert into authors values
...

Ok - let's see how it works - no joy here. No errors - we connect to the database ok but the data is not read and displayed from the table. Why?

We decide this is the long way around so we find the old windows server which used to run things and plug it in. RODAN comes up fine for an ancient dual PII/512mb/scsi box. The old username and password gets us into the database but of course the version is too old for a direct data transfer from Navicat. We try to run the batch .sql files we used earlier but they also contain newer sql so we edit them to delete the charset statement. We then run the sql files and to create the database tables and insert the records. We now have the database and we create the user and copy over the files.

Now to test - we open Firefox and goto Rodan and run the application and viola! - finally some joy - the application gets it data from the database and displays it. WE figured it would work as this is the machine we developed the application on originally. The working versions are:

Apache 2.0.52
mySQL 4.0.18
PHP 4.3.9

These are not far off what we were trying to do on the desktop with Apache 2.0.49, PHP 4.1.2 and mySQL 4.1.20 so why the database does not work there remains a mystery.

At least a matching dev environment is up and running so the maintenance can begin...but after lunch.