Saturday, March 14, 2015

Clone That Puppy

If you read my previous post on the Live USB Puppy for Python education, you may have noticed at least two problems with it. I will address them here.


The first is that the Python graphics package Tkinter is not designed to deal with animation. I tried anyway, it was awkward, and I abandonned the idea. I installed the Pygame package and have been working happily with that instead. Since I believe that writing simple games and animation are the best way to teach programming to youngsters, something like Pygame is essential. There's a .deb package available for download here. And there is a pretty good introductory tutorial here. Pygame can be installed on Puppy clicking on the .deb file, same as outlined for the other packages in the previous post.

The second problem lies in using the USB in the classroom rather than anything to do with the USB itself. It takes about 25 minutes at least to prepare a USB in the manner I outlined. For a class of 10 students, that means the teacher is facing hours of tedious and attention demanding time at the terminal, if each student is to get their own USB. Intuitively, I'd just like to simply copy whatever is on the Puppy and paste it onto an empty USB. However, this doesn't work. I have something else in mind. Something that works. I found that I can cut down the time it takes to reproduce a USB to around 7 minutes. Still tedious and attention demanding, and fraught with the dangers of destroying valuable data at just about every step, but I managed to get the hang of it after only a couple of false starts. What we want to do is called cloning a drive or partition. You can also make an image of the USB and go from there, but it seems cloning is a little easier and no slower than going down the image route.

Download Clonezilla, (~160MB) and put it on a USB following these instructions. I followed the GNU/Linux method B and found it surprisingly easy. Prepare a target USB stick, where you intend to put the cloned copy. The source will be the 'original' USB created following the instructions in the previous post. Once Clonezilla is booted, I inserted the other two sticks. It's important to know which is the source with your Puppy on it and which is the target which should be empty. You also need to know how to identify the USB with Clonezilla on it, and also the hard drive and the partitions on it. I'm leery about altering my hard drive in any way, so my method only involves USB sticks. On this Toshiba laptop, that means every USB slot (all 3) is in use. Still the possiblilty exists of doing damage to data on the hard drives, so take care to identify them when presented with the chance. Here is an accurate walk-through of the cloning process. As I say, it takes around 7 minutes. Good luck and take care.

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)

Sunday, October 26, 2014

Time for smut

This morning I woke up to discover that during the night the clocks had been set back an hour back to standard time. This gave me an extra hour. Why not share my latest adventures in cuisine? I bought some huitlcoche yesterday. At 20 peso an ear it's not cheap and its nickname is Mexican truffles. More properly it's called corn smut. It's a kind of fungus that infests corn. I'd read of huitlacoche but I don't believe I'd seen it in the market place and certainly never eaten it. Here it is:


I fried the huitlacoche into a hastily improvised salsa and enjoyed with tortilla chips. Unfortunately, neither my wife nor my dogs were willing to do much more than sniff at the results.


Monday, February 10, 2014

Libertarianism, Children and Smoking

I follow, with increasingly less interest, a libertarian website called Reason.com. Libertarians believe that people should be free to do as they choose as long as they don't hurt anyone. A laudable principle, I think.



So Brendan O'Neill, a libertarian writer who posts at Reason.com, posts this article recently about the Totalitarian Crusade Against Second Hand Smoke. It's all about the attempts to ban smoking in cars where children are present. Brendan argues these attempts "show what shockingly low esteem the ideal of autonomy is held in these days, so that anyone who stands up and says "I think adults should be free to choose what vices to indulge in and pleasures to pursue" is either laughed at for being naive or branded a wicked stooge for Big Tobacco."

Brendan also derides the 'Nanny State' and questions the sincerity of anyone who would speak on behalf of the children. Those commenting on the article take up this line of, let's be generous, argument and we find those disagreeing with Brendan mocked with  cries of "IT'S FOW DA CHILLDRUUUUNZ!"

What I found noteworthy in this exchange is how it squares with Libertarian ethics. Libertarians base their ethics on the sanctity of people to do as they choose, and the honouring of contracts freely entered into by parties who enjoy equal standing before the law. On the surface, it's fairly compelling, but for the fact that children are overwhelming the largest class of society that is systematically, legally prohibited from entering into contracts and fully taking part in society. IT'S FOW DA CHILLDRUUUUNZ only makes sense when one accepts the second class nature of children's participation in society.

Not only do most self-styled libertarians seem to accept this state of affairs, they revel in it. Why are children and the causes that benefit children treated with such contempt? To me, this illustrates the underside of Libertarianism. On the surface, it's all about reason and freedom. Only on the underside does it show its ugly nature: bullying, smugness, cheap-jack cynicism and spite. Children are society's weakest members, legally only a few steps away from a woman's or a slave's position a couple hundred years back. Rather than try to draw children into the circle of freely choosing people that constitutes a Libertarian society, libertarians seem content to kick a man (even better a child) while he's down.

Thursday, January 30, 2014

A Visit to Potaltik

Last Sunday, we enjoyed a visit to Potaltik, a large garden/nature reserve on the outskirts of Comitan, Chiapas, not far from the border with Guatemala. It was not the best season for viewing flowers as the garden was in a quiet period, but I look forward to another visit in a few months when the plants are blossoming. The owners of the garden, Ceci and Jorge, are especially interested in orchids and bromeliads, and they are dedicated to preserving and promoting these plants more than anything else.

http://lagaleriadelcorazonabierto.blogspot.mx/2013/08/el-paraiso-de-potaltik.html


Jorge is proud of his garden, gave us a tour and told us about the orchids. I'd come across the orchid/wasp mimickry in A Thousand Plateaus by Deleuze and Guattari. They use this example of the orchid relying on the wasp, (or with other varieties, other insects and spiders etc) to illustrate their key notions of rhizome and territorialization. (Becoming-Intense, Becoming-Animal) An interesting read but apparently these authors don't nearly do justice to the bizarre complexity of orchid sexuality. I learned from Jorge that orchids can't reproduce without the presence of a certain fungus, and wikipedia backs him up. The orchid's parasitism on the fungi is critical to germination.

It's important to note, that unlike the honey bee, the wasp doesn't feed off the orchid. His attraction is purely sexual, and it is often the case that the visiting wasp will actually ejaculate into the orchid. He'll be fooled again by another orchid and spread pollen in the attempt to find a true female wasp. Another parasitic relationship.

Despite all the fuss and bother, human sexuality is a surprisingly simple affair. Typically, a male and female of the same species get together and they produce offspring.

Orchid sexuality is anything but simple. Life on earth is divided into kingdoms. For those of us without microscopes, there are three kingdoms: plants, animals and fungi. What's significant to me about the orchid's sexuality is that it involves a collaboration spread across three taxonomic kingdoms. I wonder if there is any other living thing, so beautiful and close to us, that enjoys a sexuality so heterogeneous, wide-ranging and dispersed.

Sunday, January 19, 2014

Malcolm, Maya and Me


Just a few loosely connected items I want to bring up in this post, the first being the recent biography of Malcolm X by Manning Marable. I'd bought the original autobiography years ago but never got around to reading it. My knowledge of Malcolm came from watching videos of his speeches and the Spike Lee film. What surprised me about his life is the role of his family. His father was a dedicated political activist for Marcus Garvey, a conservative black separatist. Malcolm's conversion to Islam came about from the suggestion of another family member, one of his brothers, who told Malcolm that if he stopped smoking and eating pork, he would get out of prison. Not sure why his family playing such an important role in shaping his career should surprise me; perhaps its due to the heroic myth making that surrounds him.

Maya is the name of the 13th Mint Linux release. Number one was given a name starting with 'a', two 'b' etc. But before I go further, I have to bring up a problem I had with Windows.  Anyone not interested in a slightly technical discussion, or those who have not monkeyed around with the factory installed partitions on a Toshiba laptop may wish to skip the following paragraph.

I have a dual boot system, and my Windows partition was functioning extremely slowly. Even installation was painfully slow, and installing the automatic updates on shutdown took hours. At first I thought it was malware that I'd picked up along the way, but this couldn't have been the case. Then I discovered in the Linux disk utility programme that my Windows partition was misaligned. Never heard of that problem so I checked the forums, and indeed this is an issue that Toshiba hard disks are prone to, as well as a few others.  The terminal command "sudo fdisk -lu" will show if there is any problem with a misaligned partition. The forums didn't really give me any solutions, so I came up with my own. Very easy and quick once data is backed up. Using Gparted, delete the partition, and create it again, only this time, in the tab at the bottom of the page where the choice of align to CYLINDER, MB, or NONE is given, choose NONE, not the default option it should be noted. Run fdisk again to check the partition is properly aligned once Gparted has done its thing. If everything looks good, install Windows again. I did and the installation and all other read/write operations are some three or four times the previous speed.

Maya comes in to this because in the course of all this bother, I needed to reinstall the Linux. I'd lost the original Olivia 15 files in the shuffle, and decided to try the latest: Mint Linux Petra 16 KDE. (I was also keen to create a third partition, for data, accessible to both Windows and Linux.)  I found Petra a very unsatisfactory choice, and I decided a 'downgrade' was needed. It's not possible to downgrade a Linux version to a previous version. A clean start is necessary. The forums pointed to Maya, number 13, the most recent Long Term Release, where support will be continued for some years into the future. Not partition alignment, but some cosmic alignment issues also seemed to point in that direction, what with me living in the heart of the ancient Mayan civilization, as well as coinciding with my reading of Malcolm X's biography. 'mx' has long been my user name when dealing with Linux. Originally it had been simply 'm' but somewhere along the way, I ran into a release that insisted on my using at least two characters. I've been mx ever since. Malcolm X played no part in the choice, but it is noteworthy that he was shot and killed on my birthday and he was born on my sister's birthday. I hope these alignments make my choice an auspicious one. So far I am pleased.

Tuesday, December 31, 2013

The New Luddites



I thought I'd close of the old year with some thoughts about what I think of as the new Luddism. In the popular mind, Luddites are anti-technology. I think this misrepresents the purpose of the original Luddites who make their mark in England some two hundred years ago when industrial techniques were first introduced.

The original Luddites were craftsmen such as weavers etc who broke the power looms that were dispossessing them of their livelihood. They were opposed by the powerful and slandered as being haters of technology and Bonapartist spies. Over the years, the Napoleon calumny has died away, but the notion of them being anti-technology lives on.

In fact these craftsmen couldn't have been anti-technology. They used technology in their daily lives and their work. They often constructed and maintained their own equipment and indeed were probably more technically adept than their contemporaries. What motivated them was the issue of who was in control of technology. They wanted to maintain control of their work and its organization and realized that with the introduction of industrialization, they would lose this control.

So who are the new Luddites? It's not those who oppose technology but the hackers who dedicate themselves to making devices such as smart phones do their bidding rather than remaining under the control of their manufacturers. 'Jail breaking' is the term used and it often comes up in the press. Here's an announcement of the successful jail break of an Apple device.

I'm sure there are people who explicitly identify these hackers with the Luddites of old, but they seem to be extremely rare. Yet the Luddites of old and the hackers share the same motives: keeping the control of technology from slipping into the hands of others.