Friday, March 6, 2015

A Puppy in the Classroom

I've been quite busy over the past few months working with my computer. Something I'd like to present here is an arrangement (dare I say an invention) for teaching computer programming to young students. The classroom I have in mind has only one computer, that of the teacher. In my case, I have a Raspberry Pi connected to a large television set. The students have pens and notebooks and a USB memory stick prepared by the teacher.



This article is about the memory stick and how to make your own.

My goal is to teach elementary programming skills with the Python language, and the Tkinter modules for graphical user interface - buttons and menus etc. The Idle integrated development environment is included for convenience. A text editor like Notepad is all that is necessary, but Idle will help the programmer with tasks like indentation, parentheses balancing and identifying syntax errors. I'm using the Python 2.7 version, which is still pretty ubiquitous, rather than the newer and incompatible Python 3. Other languages are also possible.

I suppose each student could have their own laptop with them in class, but I don't believe this solution is practical, desirable, or necessary. Laptops are expensive and not every family has one. Those that do may well be reluctant to pack it up and allow their 12 year old child to take it back and forth to class. Every student with their own laptop in class would also create a lot of avoidable distraction and classroom clutter, never a good thing.

My solution is the Raspberry Pi with screen suitable for classroom use, and equipping each student with a USB memory stick. These memory sticks can be used in the classroom and at home, or anywhere else there's a computer, whether it's Windows, Apple or Linux. My design should also be reasonably easy to use and prepare and as safe as can be expected. If they are lost, they can easily be replaced in about 20 minutes. Technically, I think the most difficult task might be the changing of the booting sequence in BIOS at startup. This page should help in that regard.

Getting down to specifics, what I'm proposing here is putting an operating system on a USB memory stick. It can be installed on a stick as small as 1 GB, or even less, and to access the data therein, booted or simply be plugged into an already running system, whether it's Windows or whatever. The Live CD or Live USB that many linux distributions make available seem only meant as a test drive vehicle and not something permanent. A USB that holds an operating system with persistence, ie permanently saves any data files, WIFI passwords etc, created during the session is rare. The technical name for this is a persistent live USB. It's also possible to install an operation system onto a USB as though it were a hard disk drive, but I found these installs slow and prone to problems. All the software necessary is listed down below. No alteration to the parent's computer is needed except for the change to the BIOS booting sequence.

I must have tried out at least 10 different Linux distributions before settling on Puppy Linux. Lubuntu was a runner up and had some advantages over Puppy, more up-to-date for one, but Puppy did everything I wanted without any fuss. I've used Puppy for years now on my older computers, installed on the hard drive. It's fast and stable. At about 150 MB it's extremely light weight, yet requires very little extra software for my intended use. I have listed all the necessary downloads below, in total well under half a gigabyte, about half the size of the Lubuntu .iso file.

I will explain here how a teacher with any computer can prepare the student's USB. First, might as well download all 9 files listed below. Keep them together in a safe place. Then, using the windows .exe file Universal USB Installer, create a bootable thumbdrive by loading the file 'precise-5.7.1.iso.' There's a menu and there's an entry for 'precise' under the Puppy heading.  Preparing the USB will take a couple of minutes.

Once complete, reboot with the USB in place. To boot from the thumbdrive, you may need to change the booting sequence of the computer. On switching the computer on, press the F2 key and this should bring up the BIOS screen which allows the user to change the booting priorities among other things. Different computers may use a different key than F2. Look carefully and quickly at the messages at the bottom of the screen for instructions before the Windows starts to boot. It's all covered in the link I provided above. Booting from USB should be given top priority so that an inserted USB rather than the DVD or hard disk will be booted. This setting can be kept without any inconvenience to normal usage of the computer as long as you are aware that the computer will always attempt to boot whatever is in the USB slot on startup. For normal use, it's best to remove anything from the USB slots on startup. Attempting to boot a non-bootable (ie normal) thumbdrive may result in an error and necessitate a power down and restart.

Now you should have booted the Puppy Linux. You can connect to internet and make any adjustments in time and date if you want.  This is not necessary for the usage I have in mind. Maybe leave it to the more curious students to further explore the system. Beware it is possible to do real harm to the host computer such as formatting the hard drive using a programme like Gparted but that kind of risk remains with any system.

At the root of the USB drive, accessed by single clicking one of the drive icons at the bottom left of the Puppy Linux desktop screen, probably the one labelled 'sdb1,' create a folder called 'homework,' or whatever and copy any of your working files into it. This is done by right-clicking on the desired location and following the instructions to create a new folder. There will also be another folder, probably called 'UUI.' The new homework folder should appear beside 'UUI.' In my homework folder I have some pdf tutorials and other documentation and some projects both complete and incomplete. Also into the USB root, beside 'homework' and 'UUI,' copy the previously downloaded "devx_precise_5.7.1.sfs" file.

 Now single click on menu button, bottom left corner of the desktop, then choose 'Setup' then 'SFS-Load on-the-fly.' Follow the dialogue to load the 'devx_precise_5.7.1.sfs' file just copied to the USB root.The python language modules will now be ready.

The biggest challenge I faced designing the USB was to allow users to access data on the stick without booting, simply by plugging into an already running system, probably Windows. Here is my solution, Single click on the 'File' icon, top left hand corner of the desktop screen. This takes you to the Puppy home folder. Keep the 'Choices' and 'Startup' folders, the rest can be optionally deleted. Less clutter, more clarity is my mantra. Create a folder here, again right-clicking and following the instructions, called 'homework,' exactly like the one created a couple of paragraphs ago. There will now be a 'homework' folder in the USB root and one in the Puppy home.

Copy the following:

#!/bin/bash
# my start up

mv /mnt/home/homework/* ~/homework/

# put following in /etc/rc.d/rc.shutdown (at end)
# mv ~/homework/* /mnt/home/homework/


into a new text file and call it 'my_startup.' Again right-clicking and following instructions to create a file this time. In scripts like this lines beginning with # are comments and not executed. The action is all in the third line which on startup moves the homework folder in the USB root to the homework folder in the Puppy home. Save and store the 'my_startup' file in the 'Startup' folder. To take care of the shut down, navigate to the 'etc' folder. This can be found in the next level up from your present location in 'home.' Click on the up arrow of the file manager. From 'etc' enter the 'rc.d' folder then find the file (not folder) called 'rc.shutdown.' Edit this file by adding the following line to the end:

mv ~/homework/* /mnt/home/homework/

Save the changes. On shutdown now, the contents of the 'homework' folder in the Puppy 'home' will be moved to the 'homework' folder in the USB root. The data on the USB will be easily accessible from any computer.

Almost finished now. Click on the partition icon at bottom left of desktop screen. The icon should be 'sda1' or something like this and navigate to where you stored the 6 smallish '.deb' files downloaded earlier. Click (not double click) on one, (the order doesn't seem to matter) and follow the brief dialogue to install. Continue with the other five. Tkinter and Idle are now installed.

Go to the Menu => Desktop => Desktop drive icons manager. Untick the boxes, This removes the icons from the desktop that give easy access to the hard drive. This amounts to 'child proofing' the system and ideally, I'd like to go further, also removing potentially dangerous software, but I want to do this as quickly and easily as possible.While you are at it, you can optionally remove as many of the desktop icons as you wish. None of them are necessary.

You can also put an 'Idle' icon on the desktop. Go to Menu => File System => 'ROX-Filer file manager,' Navigate to 'usr' at the Puppy root then 'share' then 'applications.' Simply find the 'idle.desktop' icon file and drag and drop it to the desktop.

That's about it. If you want to connect to the internet or adjust time and locality setting etc, it's possible. I typically change the desktop background picture and remove superfluous icons from the desktop. Note that Puppy is a complete system and it's possible to surf the web, watch and download videos, and do whatever is normally done with computers.

When ready, go to the menu to shut down. On shutting down for the first time, you must create a save file. It takes a couple of minutes. My own is a fairly modest-sized 128 MB. I don't need any bigger and the larger the file, the longer the booting time.

That's it. For now, anyways.

from here:
download "precise-5.7.1.iso"  (156 MB)
AND from same place download "devx_precise_5.7.1.sfs"   (148 MB)

from here:
download the following: "blt_2.4z-4.2ubuntu1_i386.deb" (1.5 MB)

from here:
download the following: "idle_2.7.3-0ubuntu2.2_all.deb" (3 KB)

from here:
download the following:"idle-python2.7_2.7.3-0ubuntu3.5_all.deb"   (254 KB)

from here:
download the following:"python-tk_2.7.3-1_i386.deb"  (27 KB)

from here:
download the following:"tcl8.5_8.5.11-1ubuntu1_i386.deb" (1.1 MB)

from here:
download the following:"tk8.5_8.5.11-1_i386.deb" (1 MB)

finally from here:
download the following:"Universal-USB-Installer-1.9.5.9.exe"   (1 MB)

No comments:

Post a Comment