Saturday 16 March 2013

Accessing the Command Line in Puppy Linux

Weirdly, the menu system does not seem to have a way to start up the command-line interface.

There IS an icon on the desktop for it, "Console"


Accessing WD NAS from Puppy

Finally got a SAMBA package to work:

lameSMBqmount

(Info on the settings to get it working to follow)

Friday 15 March 2013

SSH - Secure Shell remote log-in to the Puppy Linux machine from Windows

Here is the way to do it:

You require a Secure Shell daemon (or server) running on the Puppy Linux box.

For some reason, this seems to be quite immature on Puppy, but here is one:
   http://murga-linux.com/puppy/viewtopic.php?mode=attach&id=12005

There is an ssh-gui package in the pet repository, but it does not state anywhere if it is a client or a server or both.   It's set-up options do not make it any clearer.


On the Windows machine, this is then accessed using an SSH client, the preeminent one being PuTTY, available as a free download from  www.putty.org

The initial PuTTY window lets you set up the remote device's IP address, etc.  then brings up the terminal window.

Once the terminal window is open, there seems to be no dialogue box or menu option to change that setting, barring close the PuTTY ssh client app and re-start it.



  

Sunday 17 February 2013

Fujitsu Futro S100 Linux drivers

The driver for the VIA Chrome 9 graphics chipset which makes up part of the VIA VX800 combined NorthBridge, SouthBridge and Graphics Adaptor is the Linux Kernel driver CONFIG_FB_VIA

The driver for the VIA VT6115 ethernet controller chip is via-rhine.

Friday 15 February 2013

Fujitsu Futro S100 - boot from Network using PXE

Well, I've almost got my head around the network boot business.

There is a standard for BIOS boot from network - called PXE (for Preboot eXecution Environment), and apparently aka "pixie", and originally created by Intel for 32bit systems.

It makes use of a protocol that combines and extends DHCP and TFTP

The device booting up gets itself an IP address (either static or from the DHCP server)


Some useful links:

Windows software to serve the DHCP extensions and TFTP the boot files
http://www.vercot.com/~serva/an/NonWindowsPXE3.html

A good tutorial:
http://osdev.berlios.de/netboot.html

The wikipedia page
http://en.wikipedia.org/wiki/Preboot_Execution_Environment

The PXE spec
http://quimby.gnus.org/internet-drafts/draft-henry-remote-boot-protocol-00.txt
and v2.1
ftp://download.intel.com/design/archives/wfm/downloads/pxespec.pdf

PXELINUX
http://www.syslinux.org/wiki/index.php/PXELINUX

An interesting thread, though I'm still digesting it:
http://reboot.pro/topic/2936-is-it-possible-to-boot-any-bootable-iso-file-off-the-network/

Articles about tinyCore:
http://sirlagz.net/2011/05/16/how-to-pxe-boot-tiny-core-linux/

and Puppy
http://minipc.org/pxe/1-netbooting-readme.txt
http://puppylinux.org/wikka/PXELINUX
https://docs.google.com/document/d/1bkMJ-2wjAAC8HVZZTZBFxBELbojoGctLMg27KazqvRw/edit?hl=en&pli=1#
http://sirlagz.net/2011/06/13/how-to-boot-puppy-5-2-5-over-pxe/
and a thread
http://murga-linux.com/puppy/viewtopic.php?t=23615

Some ready-made netboot files (for Breeezy)
http://minipc.org/pxe/


Nitty-gritties of PXE
http://wiki.osdev.org/PXE#Files.2C_via_TFTP

Fujitsu Futro S100 Heat management

Fujitsu Futro S100 on stand


The Futro manual warns that if you want to stand the Futro on it's side as a pico-tower, then you must use it's stand.

The bottom side, hidden in this photo, is just as perforated as the visible upper side.

So I'm guessing that the key issue for a stand is to raise the perforated section of the underside up off the surface by...  it looks like 6 to 10mm.

I'm now toying with  creating a couple of U-shaped supports out of some 20mm veneered chipboard.

Linux VIA Rhine III ethernet driver and the VIA VT6115 chip

Wary Puppy picks up the via-rhine Linux driver module all by itself.

One of the interesting* things, is that the VIA VT6115 chip used in the Fujitsu Futro S100 isn't in the list of chips supported by via-rhine linux driver.


* for particular values of the word "interesting"

Fujitsu Futro S100 - Step 2 - set the frame buffer size


By default, the Futro's BIOS is set to reserve 128MB of the RAM as a video frame buffer.

The Futro is capable of displaying video at 1920 x 1200, but I'm using an old LCD screen with a maximum display of 1280 x 1024 LCD monitor I have.

I like as much screen real-estate as possible, but I don't need much in the way of colour, so I used my patent frame buffer sizing formula and came up with 16MB.  At that setting, Xorg allows me to select 1280x1024 at 16bit colour depth.  I'd be happy to run with about 8 bits of colour depth, but Xorg doesn't offer that.  And if I want the 24bit option that Xorg offers, all I have to do is set the frame buffer to 32MB.

This frees up an extra 112MB of RAM!

Setting VGA Frame Buffer sizes


The formula for calculating frame buffer sizing :

First of all, you need the size of one screenful:
     multiply the horizontal resolution by the vertical resolution by the colour depth : this is the size in bits (b)
then

     divide by 8  : this is now the size in Bytes (B)
then
     divide by 1024 : this is now the size in KiloBytes (KB)
then
     divide by 1024 again : this is now the size in MegaBytes (MB)

To go straight in one stage -
(horizontal resolution * vertical resolution * colour depth )  / ( 8 x 1024 x1024) = size of 1 screen in MB

Then, depending on how many frames you need to buffer to avoid flicker, you need to multiply the size in MB by the number of frames you need.

Incidentally, if you know the screen frequency - which is the same as the number of frames in one second -
then one second of video = size of 1 screen * screen frequency.

Fujitsu Futro S100 - Step 1 - Boot up

The replacement Fujitsu Futro S100 has arrived from the excellent people at scrumpymacs.

It's just as lovely a piece of kit as the first one, but behaves much better.

Step 1: Get it booting - first of all, I put the latest Wary version of Puppy Linux on an old Kingston Technologies 1GB USB memory stick.  I think I used ISOrecorder, I can't remember.

I bought a big Compact Flash card off of eBay - a Sandisk 2GB card - and used Rufus to format it as a bootable Wary Puppy Linux disk.

Fujitsu Futro S100 has arrived

The thin client arrived, and is a lovely solid lump of satisfying thing.

But the first one behaved erratically - not booting by itself, with the network socket sometimes responding, and sometimes not, and buzzing very loudly during the POST memory test.

The good people at scrumpymacs replaced it promptly and quickly, and the new Fujitsu Futro S100 is purring like a dream.

Sunday 10 February 2013

Setting up a home microserver - choosing a device

There are two main options:

1) Raspberry Pi Model B
   Uncased (but cases are now available and there are active threads on making your own case)
   Power consumption  : 2W
   Power cost per annum: approx. £2.50 (assuming always on, and £0.125p per KWhr)
   Clock speed : 700MHz, user can set up to 1GHz .
   RAM : 512MB, (including onboard video ?)
   Storage: SDHC Flash card (up to ... ?)
   Ethernet: 10/100Mbps wired

   USB ports : 2
   Other ports:
      HDMI out
      Micro USB power in

   Linux support:  getting better by the fortnight.
   Price not including case or power supply


2) Re-purposing a thin client device as a Linux server.

There are lots of thin clients available second-hand on eBay:
   e.g. Sun Sunray (aka Sunray 1) : very cheap - but no-one has ever re-purposed one.

         Igel 1/2 (aka Igel 2110) : currently £20 (inc. delivery) on eBay, with 256MB RAM.

After a lot of research, and reading almost every word written at "Repurposing Thin Clients" (parkytowers.me.uk/thin/), I went with one of the machines they *didn't* mention : - the Fujitsu Futro S100


Fujitsu Futro S100

Fujitsu Futro S100 with flash drive in a front USB port, beside a Compact Flash card
   Cased
   Power consumption  : 11W
   Power cost per annum: approx. £13.75 (assuming always on, and £0.125p per KWhr)
   Clock speed : 500MHz?
   Chipset: VIA Eden processor,
                VX800 (combined North & Southbridge),
                VIA VT6115 (Rhine III ethernet controller)
   RAM: up to 1GB, (including onboard video)
   Storage: internal Compact Flash socket (up to 2GB?)
   Ethernet: 10/100Mbps wired
   USB ports : 4 (2 at the front, 2 at the back)
   Other ports:
Fujitsu Futro S100, rear view showing ports and connectors
     PS/2 Mouse, PS/2 Keyboard
     Audio out
     Mic in
     VGA out
     9-pin Serial I/O
     Kensington lock socket
     12V power in

I got mine from the good people at scrumpymacs, for £30 + £5 p&p, with 1GB of CF ROM and 1GB or RAM, Unlike the Pi, it comes with case and power supply.  And an audio-out cable (3.5mm stereo jackplug at both ends).  Their customer service is excellent, with the device arriving very quickly.

Linux support:  should be good, though I'm a little nervous in case it's not!

Ultimately, my plan is to attempt to get the power bill down by using Wake On LAN to ensure it's only powered up on demand

The chipset is the VIA Eden CPU (low-power x86 compatible) at a 500MHz clock speed.
At time of writing, for Linux it's apparently important not to use the Nehelim versions of Eden.
Here is the chart of which Edens have which core

It also uses the VX800 combined North and South Bridge, and the VT6115 wired 10/100Mbps ethernet controller chip. 
----------------

Once it's running, the plan is to run:

nginx, Seaside, the fencing competition app, and PaFF and FiF domains, plus give friends access to my photo library on the microserver.



Attempting to create a class and two subclasses

Attempt 1 - Squeak 3.0.6

Action-click the desktop -> Browser
Select a package
Amend the code in the lower pane, to change the #NameOfClass and the package name

Object subclass: #Person
    instanceVariableNames: 'forenames surname'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'MyNewApp'



To create the accessors automagically:

Select the class, and action-click, then : Refactor class > Accessors

This seems to work








Tuesday 5 February 2013

Stage 3 - Setup Multiple Virtual Hosts on NginX

This configuration works with multiple virtual hosts, and allows the images for all pages to be in an images directory.

worker_processes  2;    # One for each CPU core
error_log logs/main_error.log;
pid        logs/nginx.pid;
events { worker_connections 1024; }

http 
 { include        mime.types;  
   # i.e. On Windows, [<nginx>/conf/]mime.types
   # i.e. the mime.types file in the conf dir in the nginx's directory

   default_type   application/octet-stream;

   index index.htm index.html index.st index.php;
   # the file provided when a client asks for a directory

   server    #default
    { server_name :80;
      access_log logs/catchall.access.log;
      error_log logs/catchall.error.log;
      root html\catchall;
    }

   server    #Server_1
    { server_name
Server_1.uk.to ; # *.Server_1.uk.to;
      access_log logs/
Server_1.access.log;
      error_log logs/
Server_1.error.log;
      root html/
Server_1/currentSite;
      location ^~ /images/ { alias html/
Server_1/images/; }
    }

   server    #
Server_2
    { server_name Server_2.uk.to ; # *.Server_2.uk.to;
      access_log logs/
Server_2.access.log;
      error_log logs/
Server_2.error.log;
      root html/
Server_2/currentSite;
      location ^~ /images/ { alias html/
Server_2/images/; }
    }
 }



Thursday 31 January 2013

Stage 2 - Discover nginx data must be in a subdirectory of nginxSet up nginx on Windows virtual hosts for multiple domain names

I next put in multiple virtual hosts.

I made the mistake of referring to the files off in absolute paths elsewhere in the PC

It seemed to work - but only sometimes...   The pictures would not appear - or would only appear on the first call.  Further web-page requests after that might be text-only, or might just hang forever.

Returning the locations to be subdirectories of the <nginx>/html directory fixed all the problems.

Stage 1 - Set up nginx on Windows, with ZoneAlarm

Ultimately, my plan is to use nginx to serve the static web pages for multiple domain names, and for it to act as a reverse-proxy to the Seaside web-apps.

Stage 1 - get nginx working, and visible from the internet.

Step 1 - get nginx (pronounced "Engine X") working on Windows.

             At the Command Line (Run cmd from Start Menu),     cd <the folder containing the application app>
             type nginx
      
             On Vista, it works with three processes, all called "nginx" with Process Ids (PIDs) listed by:
              tasklist /FI "IMAGENAME eq nginx*"

             Notes:  It sets up using the parameters contained in the nginx.conf file held in
             <the folder containing the nginx application> /conf

     This nginx.conf file provides a webserver on port 80.

worker_processes  2;    # One for each CPU core
error_log logs/main_error.log;
pid        logs/nginx.pid;
events { worker_connections 1024; }

http 
 { include        mime.types;  
   # On Windows, this goes to [<nginx>/conf/]mime.types
   # i.e. the mime.types file in the conf dir in the nginx's directory

   default_type   application/octet-stream;

   index index.htm index.html index.st index.php;

   server    #default
    { server_name :80;
      access_log logs/catchall.access.log;
      error_log logs/catchall.error.log;
      root html\catchall;
    }

 }

Step 2 - close down nginx on Windows

            run cmd from Start Menu again, to bring up a second Command Line
                  (As the cmd window opened in step 1 gets taken over by nginx, so cannot be used)

            nginx -s stop

            If nginx has had a problem with the configuration file, this sometimes might not work.

            First alternative:
            nginx -s quit

            If this also does not work, the second alternative:
            Find the PIDs for the principal nginx process on Window
             tasklist /FI "IMAGENAME eq nginx*"
           Kill the processes
      taskkill /PID <number in the nginx.pid file>
            
Step 3  get nginx visible through the router's firewall.

           Make sure the PC running nginx has a static IP address.
           Log into the router, and use port-forwarding for HTTP on port 80, to the PC.

Step 4 Get nginx working through ZoneAlarm Free firewall

Check if the server is accessible from outside your local network.  (A good way is to switch off wifi on your phone, and then use the phone's browser to access the website via the website's domain name).

If it works, that's great.

If it doesn't work however...

Switch off ZoneAlarm Free Firewall.
Check if the server is accessible from outside your local network.


If it still doesn't work ...
Re-check that the web-server is running: tasklist /FI "IMAGENAME eq nginx*"
Re-check what IP address the PC is on, and that it matches the IP being used on the router's port-forward.  (Also check that it matches the static IP address that you want the PC to use).

If the server is accessible, switch ZoneAlarm back on.

Delete nginx from the list of programmes in ZoneAlarm 

Try to access the webserver via localhost
and try to access the webserver from another local device via the IP address.

Zonealarm will pop up a window asking if nginx should be allowed to provide local access.


Check if the server is accessible from outside.
Zonealarm will pop up a window asking if nginx should be allowed to provide access to the internet.

Sunday 20 January 2013

Problems moving Seaside to port 80 on Windows

I booted up my Windows PC, and started Seaside, which defaults to running the web-server on port 8080.

I stopped the process, and changed the port number, (action-clicking on the the top pane of the Seaside control panel, then selecting 'Port...' from the menu), then re-starting, and got an error message.

I inferred from the error that port 80 was already in use.


So, at the  Windows command prompt  (Windows Start Menu, "cmd", or "cmd" and Shift-Control-Enter from an administrator account, to run with Administrator privileges)

NETSTAT -p tcp -ano

List all (-a) the ports using the TCP protocol  (-p tcp) in numerical form (-n), and display the process id (PID) for the owning process (-o).

This was good, but it gave a PID of 4112 - which was not appearing on the list of processes and services in Windows Task Manager.

I then ran :

tasklist /FI  "PID eq 4112" /FO table

Which lists the active tasks and processes /FIlterered by process Id equal to "4112", in the /FOrmat of a table  (can also be a list or a csv).

It turned out to be Skype that had control of port 80.  I killed Skype, and everything was ticketty-boo.



Saturday 12 January 2013

File In and File Out

To store a new package to a file, which will be stored in the Contents\Resources subfolder of the Smalltalk folder:

Right-click the package in the class browser, > various > file out (o)


To load the package back in to a fresh image:

Left-click the world, Tools > File Browser

Accessors: getters and setters

Smalltalk accessors are always named after the variable they access.

If a variable is called xVal then the getter is also called xVal and the setter is called xVal:

Copy and Paste tips from Pharo By Example

When you c'n'p from PBE,  beware:  PBE uses  − instead of - (i.e. an m dash instead of a minus sign), so any expression including a - operator will not compile until the m dashes are replaced with minus signs.

Create a new Class in Pharo Smalltalk

Amend the package's sample code - changing "Object" to the class you want to sub-class, and  put the name of the new class, prefixed by #   (The subclass message gets sent to the object you specified, with a parameter of the name you want to give to the new sub-class).

Action-click, then accept (Cmd-s)

On accept, the system, executes the code.

By convention, if a class defines a method named initialize, it will be called right after the object is created.

The first message to send in an initialize method is generally to call the parent class's initialize method, via super initialize.


Open a workspace, and type myNewClassName new    Select it, and inspect it 

The inspector has three panes - the left pane lists the instance variables, and the bottom-right pane is a workspace who's self is bound to the object selected in the browser.
 


Create a new Package in Pharo Smalltalk

In the Class browser, action-click (in Windows, right-click) on the Packages pane (the left-most pane).

The browser automatically generates the code to create the new sub-class of object, with the 'category' set to the Package name.

Packages should have a two or three letter abbreviation at the start of their name.

(Categories and packages are not entirely the same thing:  categories have existed at least since the dawn of Smalltalk-80, and are simply a collections of related classes in a Smalltalk image. A package is a collection of related classes and extension methods that may be versioned using the Monticello versioning tool.)

Creating a method in Pharo Smalltalk

In the Class browser, navigate to the protocol group of the class of the package that you want.

By convention, for Test Driven Development, you first create a test method for your method .

Also by convention, the test for the Shout method of class String in Package Collections-Text is going to be called testShout in StringTest in CollectionsTest-Text.

The test browser is going to refer to this as StringTest>>#testShout  - i.e. the testShout method of class StringTest.


When you run the test, failed tests appear with a  Red background, passed tests appear with a Green background


Friday 11 January 2013

Browser tips in Smalltalk

To bring up a Class browser, aka System browser, type
    aClassName browse 
and do it or (Alt-d)

or World > Class browser (or World > System browser)

The four panes across the browser are (from left to right) Package    Class    Protocol group   Method

The ? button at the bottom of the class pane displays the class comment.



To find an object, focus on the package pane, and Alt-f, or left-click and find class
     
To find a method, World > Tools > Method finder and type the method name in the top left pane
You can find by name, you can QuickPick through the list of names that match the search substring, or search by the method's effects!  (e.g. search 'eureka' . 'EUREKA' and it will return eureka asUppercase --> 'EUREKA' and list the various Classes that implement an asUppercase method in the right-hand pane.

In Pharo 1.4, use the Finder ( World > Finder ).

Thursday 10 January 2013

How to Meta-Click in Pharo and Squeak on Windows

How to Meta-Click
In Squeak and Pharo, on Windows, the default method to Meta-Click is to Shift+Alt+left-click
i.e. click : left-click
      action-click :  right-click
      meta-click: Shift+Alt+left-click


To change the behaviour in Pharo 1.4, use
    System > Settings > Settings Browser, then
    System > Keyboard > Control and Alt Keys.

Where Image files are stored
In both Squeak and Pharo, the image files are stored in  
   ..\Contents\Resources\*.image  (or *.ima)


The other default behaviour I have found, with Seaside On Squeak (3.0.6 on 4.3), is:
   click : left-click

   action-click :  Alt+left-click

   meta-click: right-click

Smalltalk

I've started Smalltalking again.

The plan is to use Smalltalk, and probably Seaside, to create the Fencing Competition App.

Ultimately, the app will work with intelligent clients, but initially, it'll all run on the server.

So I've started working through Pharo By Example Volume 1.



Fencing Competition App - Requirements

Round 1 functionality
  1. The Directoire's computer can cope with one competition format : either the format used in PaFF's 1 to 7, or the evolutions of the PaFF-MacMahon system.
  2. Initial seeding done manually 
  3. Directoire can tweak rankings for second and subsequent rounds, to avoid bouts between classmates.  
  4. Directoire's computer can cope with late arrivals
Round 2 functionality
  1. The Directoire's computer can give the referee's handheld the full set of bouts for the next round.
  2. Referees have the pool information on a handheld device
  3. The referee's handheld copes with pools of 5 or pools of 6, or else PaFF-MacMahon rounds of 3 bouts
  4. The handheld records the results as they referee, 
  5. The handheld returns the whole round's results to the directoire's computer with no additional manual data-entry. 
  6. The system keeps records of which referees are parents of which fencers, and assigns makes sure never to assign a referee to a pool his/her child is fencing in.
Round 3 functionality
  1. The Directoire's computer can cope with various competition formats, including the format used in PaFF's 1 to 7, and the evolutions of the PaFF-MacMahon system.
  2. Referees can choose from a variety of handheld devices
  3. Initial seeding done algorithmically, from age, grade, class coach's assessment of rank-in-own-class and previous competition results
  4. System can tweak rankings for second and subsequent rounds, to avoid bouts between classmates.
  5. Referee's device can cope with a late arrival
  6. The directoire's computer can serve the interim results as poolsheet web pages, or transfer the results to a device which can serve the interim results as local poolsheet web pages.
  7. The directoire's computer can publish the finalised results to a website
Round 4 functionality
  1. The Directoire's computer can display results on a projector, or transfer the results to a device which can display the results on a projector.

Other requirements:
Carry out check-in (Round 1 or Round 2)
Store results in a persistent results database, to provide rankings for future competitions.

The Fencing Competition App - Background

I've been running some fencing competitions in the past few years.

There are a couple of issues that are starting to need to be addressed.

1) We've been running them by hand until now - using small cardboard seeding cards, and totting up the scores from the poolsheets by hand.


The competition has moved from just over a dozen entrants, to over 40 entrants.  So the time taken to process the sheets and determine the winners has moved from 5 minutes to about 25 minutes.  Each round.

Time to automate the process.

The problems remain:  with automation, you simply exchange the time spent totting-up scores for time spent re-typing scores, and (unless you have a printer on-site) you still have to write out the pool sheets.  Plus typing scores from pool-sheet to computer is an error-prone business.  And when the errors so back out on the next round's poolsheet, it becomes a bigger problem...

So what's needed is a system that fills out the poolsheet automatically, and captures the results automatically.

2) For the first 10 fights or so, the pools are mixed ability, so we can stream the fencers together into groups of similar ability for the final round of 5 fights.

So the youngest and the least-skilled spend more than half their time in fights with better or much-better fencers.

What I want is a higher proportion of fights with fencers of your own ability level, as well as results that reflect who fences the best.

Wednesday 9 January 2013

Heat Management issues with HP Pavilion laptops

Well, it's now going on 5 years in to my time with my HP Pavilion dv-6 laptop.

The first one died a death due to heat management issues.

The second one died a death due to heat management issues.

It's safe to say, they have heat management issues.


So, here are some vital pieces of information to know about HP Pavilion laptops, if you want yours to stay alive.

Most important of all:  they are designed to work on a flat level surface.
 - they will overheat if there is too much space between the base of the unit and the flat surface.
 - they will overheat if there is not enough space between the base of the unit and the flat surface.

So do not make a bigger gap - like USB under-laptop fan units, or by putting small spacers under the rear feet of the laptop.  Or it will overheat.

If the little rubber feet fall off (and they fall off easily - the glue is weak, and is weakened more by heat; the plastic they are glued to has been left with a high-gloss finish, and provides a very poor key for the glue) of the bottom of the base, stick them back on immediately!  Or it will overheat.

If you're replacing the feet, it's a very good idea to rough up the surface of the base with sandpaper, just where you'll glue them back on.  This will help them stay on longer.


Remember: HP do not refer to the device as a laptop they call it a 'notebook'.   Using it on your lap is a good way to see it overheat.


The best way to use it as a laptop is to get a solid board with pillow full of foam beads attached underneath it.

AVOID the ones from Ikea - they look a bit like a crescent moon, and the 'solid board' is a thin piece of plastic.  The plastic warps from the heat and from the weight of the laptop, or from the force of your fingers pushing on the keyboard and ...  your laptop will overheat.

They cost £9.99 and are completely useless.


If you've got a suitable bit of MDF or plywood, then you can just sit that under the laptop, on top of a cushion.  (I'd suggest 6mm or 8mm thick)





The one I use came from Aldi or Lidl or somesuch, and is very good.  The board is  nice and thick - I suspect it's veneered plywood - and retains it's essential flatness very well.  The pillow is comfortable and conforms well to whatever position I'm sitting in.