Monday, September 28, 2009

Greenstone on the Mac and Linux

Since the new version of Greenstone now includes the remote GLI client, we are keen to test out a server install and to use the client to connect to a portable server, either linux or osx based.

First we download the .dmg from http://www.greenstone.org and extract and run the 2.82 installer. This installs to /Users/gnickers/Greenstone and we select the core, imagemagick and ghostscript. We also enable the Admin pages checkbox with the usual password.

Click Install and away it goes, completing in 42 seconds. In the Greenstone folder we find a bunch of directories:

apache-httpd - the web server
gli - the librarian interface for building collections
bin - executables
collect - collections
image - CSS files and images

The greenstone server interface (GSI) is an application to start/stop the local library server. On Linux and OSX it uses the apache web server that comes with Greenstone.

I see the gs2-server.sh file is there and on linux this requires a trip to the terminal and the ./gs2-server.sh command but it's been years since i did much in the cli in osx. We try it out in terminal and it works. However, port 80 is in use or can't be assigned. (apache already running?) so it assigned port 8282 and pops up a dialog box. We click Enter Library and the server control panel starts up in the web browser. However Safari returns 'can't connect to server'.

Curious to see if localhost is running we try port 80 but nothing. So what's using port 80? We don't have skype installed...

Ubuntu Install

So we try the linux version. The installer program runs just the same. We open a shell and cd Greenstone and type:

./gs2-server.sh

and get the same message about 'port 80 in use or can't be assigned'. We click Enter Library but get the same 'Failed to Connect to locahost:8282

Time for some research....

Wednesday, September 23, 2009

HeidiSQL tool for mySQL

We have been using XAMPP on USB sticks for teaching for some time now. One of the problems has been the limited tools to manage the mySQL database server:

- phpmyadmin web interface
- mysql command line text-mode client

While the command line client is fast and has a lot of advantages it is somewhat an alien way of working for students. The web interface is more familiar but is slow and very old web like.

Of course you can use some of the great third-party tools for mySQL if they are installed but the general use labs only have the mySQL query browser. My favorite 2rd party tool is Navicat for OSX, I first purchased it years ago for a database project, it did everything well. But it is commercial (although they now have a free Lite version) so out of the student's reach. What we really wanted was a nice GUI tool that would run as a portable application.

Well, amazing enough such a creature exists and it is called HeidiSQL. Goto http://www.heidisql.com/ and have a look. There is a portable version that takes only 4.6 mb of space on a USB Stick.

Run the .exe installer and point it to the PortableApps folder on your USB stick. You don't have to install it there but if you do then it automatically gets added to the Portable Apps menu. Note that you don't actually have to have Portable Apps installed to run any portable application, you can just run the .exe file. However, having a nice menu system is a bonus that helps keep things organized.

When you run the program it brings up a connection manager for your session. Just fill in localhost for the IP, root for the User and click Connect! If you do not specify a database it will show you all the databases on the mySQL server, if you specify a database it only shows you that one.

For a light client it has lots of features, import/export of data and sql files, data search/edit etc, user account admin, SQL queries, database admin and it can even create views. What's not to like?

I think we have found a winner for class use. For more information goto:
http://code.google.com/p/heidisql/ which provide the following list of features:

With HeidiSQL you will be able to

We will know more by the end of term...

MARC Records into Greenstone

This was a test of getting MARC record imported in Greenstone digital library software and automatically filling in the Dublin Core metadata elements

The first step was to get the MARC records into a file. There are three ways to do this:

- save some records from a library OPAC
- find a file of marc records on the Internet
- use a Z39.50 client

We tested the first two methods. The library OPAC was straightforward, you do a search and tag or select the records you want and then view them. There are several options such as ProCite and MARC format, so we selected MARC and the local disk option and saved them to a file.

The downloaded file was called export.txt so we renamed it export.marc for importing into Greenstone.

Importing

1. We ran the GLI for greenstone and created a new collection
2. Click the Gather tab, expand the Local Filespace
3. Drag export.marc into the Collection window and ADD the MARCplugin
4. Right-click on export.marc in the Collection window and select Explode Metadata Database
5. Select Dublin Core from the metadata_set pulldown and click Explode
6. Click the Design tab
7. Select Marcplugin and click Remove Plugin

You can now build and preview the collection but the display will be all wrong. Remove the default search and browsing indexes. Now you have to create indexes based on the Dublin Core metadata set, for example an Author index:

1. Click Design, Browsing Classifiers
2. Select AZcompactlist from the Select Classifier pulldown menu
3. Click Add Classifier
4. Select dc.Creator from the metadata pulldown menu
5. Place a tickmark in the allvalues checkbox
6. Place a tickmark in the buttonmane checkbox and type in Authors as a menu label

Let's also add a Subject index:

1. Select AZcompactlist from the Select Classifier pulldown
2. Click Add Classifier
3. Select dc.Subject from the metadata pulldown
4. Tick the allvalues checkbox
5. Click OK

Build and preview to see the new indexes, but the display will still be a bit off. The next step is to change the formatting instructions for the web pages:

1. Click Format, Format Features
2. Delete the first and last lines in the HTML Format String box

Once the above two lines are deleted you can refresh the web pages - html or css changes do not require a rebuild. However, if you click on the icon to view the document no text is displayed and the document heading is wrong.

1. Click on Format, Format Features
2. Select DocumentHeading in the Choose Feature pulldown
3. Delete the text in the HTML Format String box

This gets red of the incorrect document header. Now to fix the 'no text' document:

1. Click Format, Format Features
2. Select DocumentText in the Choose Feature pulldown
3. Replace [text] with the following HTML code:



You can add a little inline CSS to pretty up the presentation but you get the idea. The final step is to remove the buttons as there is nothing to detach and highlighting makes no sense in a short bibliographic record:

1. Click Format, Format Features
2. Select Document Buttons
3. Delete the text in the HTML Format String box

You can now preview the collection. Obviously there is a lot more that could be done such as having the index nodes indicate how many records they contain using the [numleafdocs] variable and we could make a much nicer display by tweaking the external style sheet....

Appendix

I downloaded the Terry Reese's excellent MARCedit program to do a little experiment on the marc records files i have saved from the library OPAC. I wanted to test out converting MARC to Dublin Core. Here's what i did:

1. Renamed the export.marc file to export.mrc (marcdedit does not recognize .marc extension)
2. Ran MARCedit and selected MARCbreaker
3. Select MARC -> Dublin Core
4. Choose export.mrc as the input file
4. Choose an export file of weldon_dc.txt and clicked Execute

It created a plain text XML file that uses rdf:description and replaces all the MARC tags with Dublin Core tags. Here is a snippet of the file of records:

Accelerated SQL Server 2008 [electronic resource] /
Walters, Robert E.
Coles, Michael.
Farmer, Donald.
Ferracchiati, Fabio.
Rae, Robert.
SpringerLink (Online service)
text
Berkeley, CA : Robert Walters,
2008.
eng
Data structures (Computer science)
Springer eBooks.
http://dx.doi.org/10.1007/978-1-4302-0606-4


The problem is that i cannot get this file to explode in Greenstone, it imports as one file of one record using LOMplug. I'll have to do some research on this tomorrow...



Sunday, August 30, 2009

XAMPP on a CD

Xampp on a CD

The goal today is to produce a self-running cd-rom containing the XAMPP stack along with joomla so that students can burn their projects running on a USB stick to a CD-ROM.

Requirements:

  • USB stick running xampp with joomla installed
  • AMPstart software (replaces the xampp control panel)
  • autorun.inf file
  • autorun.bat file
  • ampstart.ini file
  • cd-rom burning software
The autorun.inf file consists of:

[autorun] open=autorun.bat icon=joomla.png Label=server

I created a small icon of 32x32 pixels. When ampstart is running the icon is in the windows system tray. Double-click on the icon to shut down the web server and unlock the cd tray.

The autorun.bat file consists of:

@echo off rem script to make auto-run xampp joomla lis 9710 cd rem creates a mysql data dir on c because mysql needs a writable folder mkdir c:\mysql\data xcopy xampp\mysql\data\ c:\mysql\data /E start AMPstart.exe

the ampstart.ini file consists of:

[database] overwrite=1 folder=c:\mysql\data [website] website=htdocs\joomla startup=index.php port= [cd] eject=1

The eject option ejects the cd when the web server is shut down. Will it work? Our previous attempts at running from a cd failed and this is when we started researching ampstart. There are some other options we might add later to the .ini file if this works.

[WEBSITE]
website=\path\to\web\app

You can also auto open firefox if it is not the default web browser with:

[WEBSITE]
ExtBrowser=\path\to\browser\executable\file

If you want to make the site seem more realistic in a demo (such as a real looking url instead of localhost) use:

[WEBSITE]
ServerName=somedomain
website=\path\to\web\app

To auto shut down the web server when the web apps ends use:

[WEBSITE]
ShutdownOnClose=1

And to set the duration for the ampstart splash screen use:

[LOGO]
duration=n_second
;default 0 (depending on loading time of web server)

Ok so here we go - burn the cd from the usb stick. Here is the folder structure. It suddenly occurs to me that we have been closing the disc so that it is read-only. What is we made the disc a multi-session? Could mysql then write to its data directory on the cd?

Might be worth trying if this test fails.

Ok and it fails because it could not copy the mysql data folder to the c: drive. Why? Let's step thru the command one by one in the windows shell. The mkdir command works as their is a c:\mysql\data folder. The xcopy fails with an invalid path error. Time to haul out the ms-dos manual...ahhh i'm using the /E switch but it requires the /S switch:

/S - Copies all files in the current directory and in any subdirectory within it.
/E - Copies subdirectories, even if they are empty. If you use this option, you must use the /S option also.

But that doesn't account for the 'path' error. If i change directories to xampp\mysql\data and end up with a pwd of \xampp\mysql\data then the xcopy command works perfectly. But when executed from the root of the usb stick it fails. Ok, this suggests a workaround - just cd into the data folder and then run the xcopy command, a hack but quicker than trying to recall how ms-dos works. So out new autorun.bat looks like:

@echo off
rem script to make auto-run xampp joomla cd
rem creates a mysql data dir on c because mysql needs it
mkdir c:\mysql\data
cd \xampp\mysql\data
xcopy *.* c:\mysql\data /E /S /C
cd \
start AMPstart.exe


Ok - time to burn another CD. This one fails too - mysql error 'could not make a copy' but it did make a copy. The webserver app then just tries to run and fails. Since ampstart is running maybe the error is from the ampstart.ini file. Let's change that to:

[database]
overwrite=0
folder=c:\mysql\data

[website]
website=htdocs\joomla
startup=index.php
port=

[cd]
eject=1

Ok burn another CD...which fails with 'cannot load mysql'. I went looking for the ampstart site but the domain name seems to have lapsed. But the search turned up Lampix, a bootable cd based on knoppix. See: http://lamppix.tinowagner.com/ But it hasn't been updated since 2007 and getting your files from the USB stick to the CD is more work than we want to do. There must be a solution somewhere...

Of course they could just hand in their projects on USB sticks but until they are less than $5 a gig this is not a realistic option...

Monday, August 24, 2009

Dell Mini 9 Ubuntu Update

I've been using the dell mini 9 for a month or so now and it's time to upgrade it to ubuntu 9. The rationale is:

  • the dell ubuntu install is version 8 so it is old
  • it uses the dell repositories so not many updates
  • samba was broken on install, which is unforgivable as we have to coexist with windows

So time to update to 9. The question is how - we have the 9 cd and a usb dvd so we could go that route or we could do the notebook remix route and use the USB key method which is appealing.

First we get a torrent and download ubuntu-9.04-netbooks-remix-i386.img which is an image to be burned to a usb stick. Next, off to the package manager to install usb-imagewriter version 0.1.3 from the repository. We put in a 2 gig spare stick and run the program using:

Applications, Accessories, Image Writer

It returns an error 'no target devices found'. So it did not find a USB stick. We note the mounted stick does not have the orange usb symbol on it so we unmount it and plug it into another usb port. We check and this is listed as /dev/sdb

Re-running image writer works. It asks us for an image. We select the netbook-remix img file and start writing it to the usb stick.

Ok now that it is done put it in the dell mini and boot it on up. We first select the try option to see how it will look and if samba networking is fixed. Up it comes we click on networking and //megatron and //mothra show up immediately. We can't mount mothra shares so we try megatron. No joy here. Networking works as we can get to the internet but not to my local network. On the plus side this is running pretty fast off the usb stick.

Also not sure i like the desktop - it is designed like all the netbook OS with a bunch of icons cluttering up your space. This is supposed to be better? We do have an inspiron 910 img we could try as well as the stock ubuntu 9 cd. Let's try the CD first.

Ok we plug in a usb and boot to the liveCD mode and try to browse the network shares. The machines show up but unable to mount their shares to see them. Internet works but not the local network. So we might as well keep the machine as is and if time permits do some samba troubleshooting. This has always been a weakness of Linux, imho - osx works perfectly well with windows shares and it is a multi-vendor world. I don't like windows but we have to co-exist with it so it should just work.

Sunday, August 2, 2009

VNC on the USB

Remote Access via the USB Stick

Last week while cleaning out the storage device i ran across an old vnc program. I had used this in class some years ago to connect to the Linux server i was running in my office. It got me thinking about adding VNC capabilities to the USB stick.

There is no listed VNC downloadable application at http://portableapps.com/apps but you can add non-installable programs to the environment. For example, I setup winamp for an internet radio on a usb stick demo some terms ago.

So off we go to http://www.tightvnc.com/ to grab the latest version of the viewer which is tightvnc-1.3.10_x86_viewer.zip from which we extract vncviewer.exe

Next we create a file folder called vnc in the /PortableApps folder on the USB stick and copy vncviewer.exe to that folder. From the Portable Apps menu we select Options, Refresh App Icons and the menu item TightVNC Win32 Viewer is added. You can do this for most applications that do not install but you have to create a folder for them else portable apps will not create a menu item.

VNC Server

The next step is to set up the VNC server. Since our portable server is a mac mini running osx server it already has a VNC server, we just have to turn it on. So over to the mac and select System Preferences, Sharing. We place a checkmark in the Screen Sharing box and set a password for the VNC viewer. This is for version 10.5, which has made some changes from the setup used in 10.4 but instructions for 10.4 can be found at http://www.dssw.co.uk/blog/2007/05/14/a-vnc-server-is-included-in-mac-os-x-104/.

Connecting

Backto the USB stick we run VNC viewer and enter the IP address of the osx server.

It makes the connection and the password box is shown. If we had not specified a password in the VNC server setup for osx then any vnc client could connect to and administer the osx server! We enter the password and the mac osx server desktop is displayed. Everything works but of course the screen refreshes are a bit slow as is usual with vnc. The idea behind this is to create a portable server that can be taken to class and used to demonstrate various technologies. The reasons behind this approach are:

- corporate IT is against users running servers from their offices
- if they install a server it is so locked down that students do not learn necessary skills
- most IT depts are windows-centric in a world where windows is rapidly becoming irrelvant

Why mac?

So why is the server running mac osx? Well, their are a number of reasons that make this the best choice for a portable server. Here are the criteria i developed:

- portability: the server must be portable which means light and small
- open source: the server must run common standard open source technologies such as perl, php, apache, ruby, mail, mysql etc.
- GUI: the server must have a gui interface for easy of use in a classroom. Doing lots of typing is a sure way to lose the interest of the students in a class....

So what are the options? The first choice would be a laptop and there are some nice laptops (i own 4) but all have compromises or limitations. My best laptop runs Ubuntu 9 and can be a portable server, in fact it runs a number of useful things as virtualbox vm's (windows, ubuntu server 9 with joomla, mac) but it is too heavy for lugging about. The 11" laptop is not quite light and portable but the battery last for less than 2 hours which makes it rather non-portable for class use. I am toying with the idea of making it into a full ubuntu server. The problem with ubuntu server is that there is no gui. I tried a long time ago (ver 6, 7?) to install the server and then install the desktop but it was a failure. May try again.

One neat possibility is the netbook which is a 2 gig DT atom 1.66 with 64 gig ssd with a battery life of 3.5 hours. This is running the dell netbook version of ubuntu (8). I'm thinking of moving this to the ubuntu netbook version of 9 to fix some issues (samba) that are needed. Right now it has Xampp running but it is a pain to maintain/administer due to it being installed in /opt instead of the user's home directory. This means you have to sudo everything when you want to do stuff - an unecessary annoyance, IMHO. It would be easier if it ran under the user account.

We could use the mac laptop but the consumer laptops cannot run osx server and also use desktop apps like iLife. The solution would be to put osx server on a portable drive and choose to boot from that. I may look at the macbook pro this fall.

Anyway the mac mini is small, runs standard os software with a nice gui on top and does all we want. What's not to like?

time for some lunch

Friday, July 24, 2009

USB Drive Speeds

Since we have been using USB sticks for lamp applications over the past few terms it has become clear that not all USB sticks are the same. They may all be 2.0 but the speeds are obviously different. I have been recommending students purchase sticks that are advertised as Windows Vista 'readyboost' capable on the assumption they have to meet a certification program for speed.

With Vista going the way of windows me we need another way of finding good usb sticks so we need to test the speed to answer the question of how different are they?

So off we go to http://mikelab.kiev.ua/index_en.php?page=PROGRAMS/programs_en and download check flash, a utility that performs read/write tests on a USB stick. This program has the advantage of not needing to be installed so you can keep it on your stick to test another stick anywhere. It runs in dos-mode (which may be a disadvantage to some)

So we download it and open a terminal in windows and type chkflsh and then select a currently mounted USB stick. There is a bit of a bug, you must select one of the NT based system choices and then select the Temporary File choice in the radio button menu before you can click START.

If you just leave it on Temporary File then START is greyed out. Of course you nornmally want the temporary file option as the other 2 options wipe the stick clean - destroying existing data.

USB Stick Speed Tests

Our first step is on a cheapo 1 gig GTX stick formatted as FAT32. READ speed is constant at 16.2 mb/s but the write speed is awful hitting a max of 5 mb/sec and frequently dropping down to 4 mb/sec.

Next up is a 1 gig Kingston DataTraveller formatted as FAT. The READ speed is 13.9 mb/s with a truly awful write speed of 1.2 mb/s probably due to the use of the slower FAT file system.

And the same model Kingston Data Traveller 1 gig formatted as FAT32. The READ speed is 13 mb/s with a write speed of 2.7 mb/s. The read speed is the same but the writes are twice as fast.

Next a Kingston Data Traveller 2 gig formatted as FAT. The READ speed is 13 mb/s with a write speed of 5 mb/s. This is much faster writing than the 1 gig model. I should backup and convert to FAT32.

Next a Kingston Data Traveller 2 gig formatted as FAT32. This is a more recent version that my white data traveller model. The READ speed is 16 mb/s with a write speed of 10 mb/s.

And a Patriot 2 Gig formatted as FAT32. The READ speed is an amazing 24 mb/s with a write speed of 3.2 mb/s. This is my daily XAMPP stick, might be time to change...

Finally, we have a Kingston Data Traveller 8 gig formatted as FAT32. The READ speed is 17 mb/s with a write speed of 7 mb/s.

This was my daily XAMPP stick until my foot sent it flying and broke the plastic case. Can't believe the ITS people bought computers in 2009 with the usb ports on the botttom of the case. Now the stick is held together with duct tape and it still works but it's retired from regular service.

We would like to compare with our portable 80gig SATA hard disk formatted as FAT32 and running off the usb port but chkflash 1.09 cannot handle this. So we downloaded HD_speed, another dos-based non-installable utility. The USB portable hd READ avg was 24.4 mb/s but we could not test the WRITE data rate without destroying the existing data.

We assume it is faster but it can't fit on a keychain, more of a shirt pocket item as it is about the size of an ipod touch, although a bit heavier. You will note the preponderance of Kingston USB Sticks. I've used them for years and found them quite reliable. Never had one die on me unlike sandisk and others.

Conclusions

  • Check the file format on your stick, if FAT back up the data and reformat as FAT32
  • Buy a new stick, it is probably faster than your old workhorse
  • Higher capacity sticks are probably faster than lower capacity ones

Latest test is on a maxell - one of the new thin sticks that looks like a piece of plastic with some gold 'finger' connectors. These sticks should be immune to the bending and eventually breaking that happens with the square USB connector on many sticks. We ran Check Flash 1.09 on it using the 'temporary file' setting and got a result of 15.5 mb/s for reads and 4.8 mb/s for writes so it is slower than my faster sticks.