Owncloud updates on Rasberry pi: version 6 —> 8


Update was from version 6 to 8 so there were some hitches.

For one thing the root directory of the installation was changed to




The automatic update procedure didn’t work but a fresh download followed by resynching worked. Otherwise one was presented with a screen that purported to update the apps but that didn’t work given a claimed csfk (or something) error.  There was a command line alternative  (./occ) that did not complete either, claiming that multiple version updates were not supported.

The main source of inspiration was this: https://pimylifeup.com/raspberry-pi-owncloud/

SSL Certificate

This time I wanted to use https to connect. The instructions for creating the certificate were this

sudo openssl req $@ -new -x509 -days 730 -nodes -out /etc/nginx/cert.pem -keyout /etc/nginx/cert.key

It looks like the certificate will expire in 730 days so it will expire on July 14, 2018.

This certificate does work, but since it’s self-signed one gets lots of scary warnings when first accessing the site.

Will explore ways of getting trusted certificates for free. For example there’s “Let’s Encrypt

nginx Configuration

The nginx webserver configuration files are




The nginx.conf file doesn’t need to be modified but it will include all the files in the sites-enabled directory. The owncloud.vhost is the one of interest.


upstream php-handler {
# server unix:/var/run/php5-fpm.sock;
server {
listen 8080;
server_name alberding.mooo.com;
return 301 https://$server_name$request_uri; # enforce https
server {
listen 4433 ssl;
server_name alberding.mooo.com “”;
ssl_certificate /etc/nginx/cert.pem;
ssl_certificate_key /etc/nginx/cert.key;
# Path to the root of your installation
root /var/www/owncloud;
client_max_body_size 1000M; # set max upload size
fastcgi_buffers 64 4K;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
deny all;
location / {
# The following 2 rules are only needed with webfinger
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
: include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_pass php-handler;
# Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don’t log access to assets
access_log off;

Because my Telus isp does not permit NAT loopback I have to access the server from when at home and alberding.mooo.com:4433 elsewhere. So both urls are listed after the listen 433 line.


ownCloud configuration

The main thing here is to insert the trusted domain names from which the server will be accessed. Here’s the file:

$CONFIG = array (
  'instanceid' => 'ocxoi546wkre',
  'passwordsalt' => 'asdfabafbsdfasdf',
  'secret' => 'a[sdvojaoisdjfoijasidjf',
  'trusted_domains' =>
  array (
    0 => '',
    1 => 'alberding.mooo.com:4433',
  'datadirectory' => '/var/www/owncloud/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'sqlite3',
  'version' => '',
  'logtimezone' => 'UTC',
  'installed' => true,
  'mail_from_address' => 'alberding',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'gmail.com',
  'mail_smtphost' => 'smtp.gmail.com',
  'theme' => '',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'ssl',

Opening up the Modem Port

The last thing one should not forget is to open up port 4433 so that one can access the server via https from outside.

  • PortForward


 ioLab Startup and Pairing

The ioLab uses a radio frequency connection to your computer. It is not Bluetooth, but uses a dongle that plugs in your usb port. The dongle resides in the back of the ioLab unit. To remove the dongle, just press down on the metal end and it will tilt up so you can grab it and take it out.

Front panel of the ioLab showing on/off switch and button to pair a 2nd remote.
Front panel of the ioLab showing on/off switch and button to pair a 2nd remote.

Initial Startup

Follow the instructions for your system that are written at http;//www.iolab.science. Except for the basic start-up process, the documentation is mainly through the youtube videos.  Some of the notes below derive from watching those videos.

Start Button:

  • short press = on (less than 1 second)
  • long press = off (about 2 seconds)

Flashing lights:

  • if flashing alternately, then the unit is paired
  • If flashing simultaneously, then the unit is unpaired

After you start the iolab application, plug in the dongle.  Make sure the Dongle ID icon at the top of the application screen lights up when you plug in the dongle.  Then press the start button   (the right-hand one) on the top of the iolab,  the side with the wheels. If the lights beside the buttons blink simultaneously, then the connection is not working.  When the connection is ok, then the lights will blink alternately and you’re “paired.” The Remote 1 icon on the ioLab application should light up and say “Paired.”


The first thing you should do after you pair is to calibrate.  Before you can calibrate you have to press the Start or the Reset button.  Then click the Gear Icon  and then …Calibrate Force. Follow the instructions that are displayed. When you do this you’ll have to turn the unit and set it on a table with  y direction up. Then hang it from the force probe for a couple of seconds, holding it by the spring or bumper. The force probe caiibrates assuming that the unit’s mass is about 200 grams and that it is on earth where the gravitational field strength is  g = 9.8 N/kg.  I am not sure how the other sensors calibrate, but I suspect that the quantitative outputs may not be entirely accurate. (I found that the gyroscope only measures 5.4 radians when one integrates the omega of a complete 360 deg rotation, instead of 2π= 6.28 radians).

Force Calibration:

  1. set on the unit’s head
  2. hang from the force probe.


To make measurements, choose the  sensors which are to be used and then start the data collection by pressing “Record.”   Let it run as long as you need and then press  “Stop.”  The data will accumulate at the rate indicated at the top of the graph. There is no way to modify the data rate

Pairing a second remote

You can pair a second remote unit with the same dongle so that mutual forces can be measured during a collision.

  • Plug in dongle and pair the first unit, if not already done.
  • Turn on 2nd unit and unpair the second remote unit from its dongle if necessary.
    • To unpair  press the “ON” button while still holding + down for a short time (less than 1 second.)
    • Keep holding the + button until the light beside the + button flashes 3 times quickly in succession.
    • Now cllick on the Remote 2 on the top of the IOLab app and a dialog should appear with a button that says “Find Remote”. If the 2nd remote is flashing with a series of 3 quick flashes then it should be found
    • Then choose “Pair Remote” and the second remote should be paired.
  • Now both units are paired with the same dongle.
  • Here’s a video on pairing 2 remotes that shows the process:

Active Learning Experiments

This series of mechanics experiments is designed to help overcome common misconceptions of beginning physics students.

  1. Position, velocity and acceleration: when is acceleration positive, negative and zero?
  2. Force and its relation to motion.  Does force correlate with velocity or acceleration?
  3. Friction, sliding and rolling. How does one quantify friction? What factors does friction depend on?
  4. Momentum change and force. Impulse-momentum.
  5. Mutual forces during collisions
  6. Simple Harmonic Motion
  7. Torsion Pendulum: moment of inertia and effect on oscillations.

Position, Velocity and Acceleration

Make a small ramp to run the ioLab up and down on its wheels. A board is good, or even a large book could be used.  Make the angle so that when you give a push on the ioLab while sitting on the ramp with its wheels down that it runs up the ramp and comes back down again.

Determine ramp slope using the accelerometer

startup and verifing calibration

Start the software, turn the ioLab on and make sure that the ioLab is correctly paired. Click the box to turn the “acceleration” sensor on. Record a few seconds of data. Check that when sitting on the table a_z is about 9.8 m/s/s. Then check that a_x and a_y is about zero/ Discepancies of around 0.02 m/s/s can be ignored, but if the variation from expected values of 9.8 m/s/s and 0 m/s/s are greater than 0.05 m/s/s then go through the calibration procedures.

The z component of acceleration will read 9.8 m/s/s when the unit is held horizontally because of the pull of gravity on the acceleration detector. The value of 9.8 m/s/s does not mean that the unit is accelerating physically, but that the sensor feels as if it were in outer space, away from any gravitational field, and is accelerating in the z direction. There is no physical way that the sensor can distinguish between a gravitational field of 9.8 N/kg and and acceleration in space of 9.8 m/s/s.

Measure a_y on ramp while cart is not moving

Reset the data — press reset once — and record one data for one second with the ioLab on the table and then on the ramp with the y direction pointing up the ramp and the wheels on top. The y component of acceleration should now be non-zero. The tilt angle of the ramp is given by θ = a_y/9.8 in radians.

Now measure the tilt with a ruler, θ=arcsine(rise/length), and compare the value from the accelerometer.

If the values you got from the two methods are very different, try to estimate whether the difference is because of the random uncertainties of the measurements, or an error in procedure. Discuss and justify your conclusion.

Record position, velocity and acceleration while moving

Now we are going to record the position, and velocity using the wheel encoder. Reset the softward by pressing reset twice.  Now choose the “wheel” option in the software.

Start recording and then gently push the cart uphill.  It should go up, momentarily stop and then roll back down hill. Catch the cart and then stop the recording.  Below is a sample chart of that motion.

You need to display only the y components of the position, velocity and acceleration.. The zero of position is set when you start the recording.  As the cart rolls up and down the ramp there is a curved line, almost parabolic  When the slope of the position vs time graph is zero, notice what the velocity is. What is the acceleration when the velocity is zero?  (To make the velocity graph less ugly, choose a smoothing of about 10 points.)

Look at the region of the graph where the cart is rolling freely after it leaves your hand and before you catch it. You’ll notice that the acceleration as measured by the wheel is noisy because of the surface roughness. Another thing that is interesting about the acceleration is that the value is different when it is going uphill and when it is going downhill.  This change is due to friction. When the cart is going uphill the friction force is pointing downhill, helping the force of gravity to slow the cart down. When the cart is going downhill friction is  in the opposite direction and retards the force of gravity that is causing the cart to speed up.

The statistics displayed on the graph pertain to the shaded area selected.

  • µ: Mean value
  • σ: standard deviation about the mean
  • a: area between the curve and the zero axis
  • s: average slope over the interval
ioLab chart showing position, velocity and acceleration.
ioLab chart showing position, velocity and acceleration.








Smartphone Spectrometer

Making a Spectrometer from a Smartphone Camera

If one puts a diffraction grating in front of the lens of a smartphone the photograph will show the spectrum of a light source. This works best in a dark environment where the spectral lines show up on top of a dark background.  The following picture was taken from about 1 m away from a hydrogen lamp. The  spectral lines of the Balmer series are clearly visible. One can also see the spectrum of the neon pilot lamp below and to the right of the hydrogen lines. (Photo taken in SFU Phys131 lab, March 10, 2015)

Hydrogen Balmer Series

Hydrogen Spectrum made with a smartphone and diffraction grating. Note the little neon spectrum too.
Hydrogen Spectrum made with a smartphone and diffraction grating. Note the little neon spectrum too.
Hydrogen Balmer Spectrum
Colour Actual λ(nm); Measured λ(nm) ni nf
red 656.3 654.4 3 2
bluegreen 486.1 487.7 4 2
violet 434.1 435.7 5 2
violet 410 6 2

The wavelengths were derived my photo-analysis using LoggerPro and calibrated on the red Balmer line.  I assumed a linear relationship between wavelength and distance from the lamp. The second order bluegreen line is visible and its wavelength would be 997/2 nm  = 498.5 nm using the linear relationship between wavelength and distance.


See http://spectralworkbench.org and this  for a home made spectrometer using a DVD diffraction grating.

Linux on an iMac G5

Making a dual-boot Mac OS X 10.4.11/Xubuntu 14.04

    1. Use DiskUtility to partition the 160GB drive into two 80 GB HFS+ partitions.  The second one is going to be deleted, but that’s what I did.
    2. Had to install 10.3 on the partition because that was the version that came with the machine.  The 10.4 disks from another iMac didn’t work.  The I found a version of 10.4 that would install and upgraded to 10.4.11.
    3. 10.4.11 can be made more useful by downloading 10.4-Fox browser and LibreOffice, both have PPC binaries.
    4. Follow the instructions for getting the linux installation files and copy them to the root:  https://help.ubuntu.com/12.04/installation-guide/en.powerpc/ch04s03.html#files-newworld
      The main resource for finding the files for either netboot or live dvd images is here: http://cdimage.ubuntu.com/
    5. Reboot into the open-firmware: hold down  cmd-option-o-f after the chime.  Then type in
           boot hd:3,yaboot

      where the number 3 depends on your partitioning. Use pdisk to find the partition number of the HFS+ partition where the Mac OS is.

    6. At this point you can type install and the installation should proceed.
    7. In order to read/write the HFS+ partition, make it unjournaled and then edit the uid of your linux user to correspond to that of mac
    8. In order to read/write the HFS+ partition, make it unjournaled and then edit the uid of your linux user to correspond to that of mac:
  • Finally got the os x files shared with the linux. First of all, when in the os x system, type

    in the terminal. In my case I got the the uid=501 and gid=501. Then boot into the linux system, login is as root, and use moduser to change the numbers

    moduser -u 501 -g 501 neilx

    The other thing I had to do was to make sure that the hfs+ volume was not journaled. (The little lock icons that the linux file manager showed on the directories indicated read-only.) In fact it was journaled and using the disk utility it was possible to make it unjournaled. The option was under the “File” menu. On some versions of diskutility, you have to hold down the “Option” key to disable journaling.


First-year laboratory equipment

Comments on 1st year lab equipment options.

If one wants to emulate scope and function generator (f.g.) with Labview then sensorDAQ is not adequate. One needs NI myDAQ.
In order to use Vernier’s plug-in sensors then the Vernier myDAQ attachment is also needed to plug in to it.
* 20 kHz max freq
* 0.5 W max total power output for all ports (e.g., 10V, 50 mA)
* only 1 digital and 2 analog inputs for Vernier sensor plugs.
* using the Vernier power amplifier ($247) will allow the computer to serve as a f.g. up to 15 kHz with ±10V, 1A using the computer’s sound card. http://www.vernier.com/products/sensors/pamp/


Don’t know how well the virtual system will work with both f.g. and oscilloscope emulation vi’s being used at the same time.

Compared to stand-alone
* oscilloscope: 50 MHz or greater bandwidth (http://www.tek.com/oscilloscope/tbs1000b-edu-digital-storage-oscilloscope)
* f.g. max freq several MHz and about 5 to 10 W power output depending on model.

It is possible to design most of our experiments to work in the audio range in most cases, but we do use the max power output of our current function generators. For example in the slinky induction lab we go up to 1 kHz but the pick-up signal is small and we put the f.g. on max output. (https://wiki.sfu.ca/departments/phys-studio/index.php/U26s3)

If we use a stand-alone f.g. then we might consider the Labquest mini. The labquest mini has 3 analog and 2 digital ports. It can be accessed with Labview and voltage signals can be input through mini grappler plugs into any or all of the analog ports — no need for tiny screw drivers.


The Pastrack is a plastic multi-segment track It is composed of 50 cm segments that have to be put together. (http://www.pasco.com/prodCatalog/ME/ME-6960_pastrack/index.cfm)
This design causes glitches in data when the carts pass over the junction. The FIC instructors don’t like them and have ordered one-piece Al replacements.

The tables work with 1.2 m track lengths, 2m (as shown in Dave’s presentation) would be too long.
The Vernier 1.2 m track is about the same price as Pasco’s ($150) but includes better options for brackets and mounting and include the feet. It allows for a bracket to mount the go-motion so that glitch-free data are usually collected compared to using the pasco tracks without the bracket. (http://www.vernier.com/products/accessories/track/) End stops are $10 extra. (http://www.vernier.com/products/accessories/as-vds/)

The optics kit designed to fit on on Pasco’s dynamics track is not comparable to the Pasco introductory optics kits we now hove. (http://www.pasco.com/prodCatalog/OS/OS-8500_introductory-optics-system/index.cfm)
There are only light source, screen and two lenses.
The lenses are demountable from the holders with fussy 3-screw mounts that will give problems in a first-year lab environment.

The main bulk of the box of the basic Pasco optics kit we now have is the foam rubber cutouts that allows one to quickly verify the many items that are included in the kit. The extra encumbrance of the optics bench only adds about 2 cm to the box width.































Radiation Hazard Estimates

Goffman, John

Poisoned Power, Forward

$$R \times h \times \frac{N}{300~\mbox { person-rems}} \times {\rm 1~death} = D$$

$R$ is the number of rems per hour,
$h$ the number of hours exposed
$N$ Number of persons exposed
$D$ number of deaths which will occur later.

From the BEIR VII

Analysis of Hiroshima survivors shows (Figure ES-1) that when the estimate dose was 2 Sv the Estimated Relative Risk of dying by cancer was 1. This means that this dosage resulted in twice as many cancer deaths as in the rest of the Japanese populate.  The data assumed that exposure was at age 30 and counted deaths up to age 60.

In order to relate these statistics to the formula given by Goffman we assume that 22% (22 000 out of 100 000) of the population dies from cancer. An ERR of 1 would imply 44% would die from cancer (not including leukaemia). Thus the 300 person-rem number in the first equation would be different from this analysis.

Let $\rho$ be the “person-rems/death” figure which was equal to 300 person-rems in the first equation. In order to determine the value of $\rho$ one can solve the equation as follows:

$$ R \times h \frac{100000}{\rho} = 22000$$

$$ \rho = R \times h \frac{100000}{22000} = \frac{ 2{\rm~Sv}}{0.22}= 9~  \mbox{person-Sv} = 900~ \mbox{person-rem}$$

There are a number of reasons this may be an over estimate of the dose required for 1 death:

  1. The age restriction is 30 to 60. Younger people are much more sensitive to radiation and people who died from cancer after 60 are not counted.
  2. Leukaemia cases are not counted.
  3. The dosage estimates are determined by comparison with bomb  tests in the US and not by direct measurement at the site (of course). There is some discussion whether these are correct

Gunderson, Arnie


“That is what BEIR says, it is called the L.N.T., Linear No Threshold approach. Now what that means in BEIR is this: if somebody is exposed to 100 rem, that is one sievert, the chances of getting cancer are 1 in 10.”…

Notice that this is 6.7 times less sensitivity than Goffman’s estimation because the estimation is for getting cancer not dying from cancer.

“Now in Japan, the Japanese government is allowing people to go back into these radiation zones, when the radiation exposure is 2 rem. What that means is that they are willing to say that your chances of getting cancer are 1 in 500 if you go back into these areas that are presently off limits, and the exposure levels are 2 rem or 20 milisieverts in a year.”

(2 rem) x (500 persons)/$\rho$ x 2s deaths/cancer = 1 death

$\rho$ = 2000 person- rems = 20 person-Sv

Note that this is talking about “getting cancer” not dying from cancer. There’s a factor of 2 between getting and dying. 2 rem per year for 50 years is 100 rem.

“So if you go into the BIER Report and you look at Table 12-D, you will see that young women have a 5 times that number chance of getting cancer than the population as a whole. So young girls in the Fukushima Prefecture are going to get 5 times the exposure they would get from 2 rem. That means that about one in 100 young girls is going to get cancer as a result of the exposure in Fukushima Prefecture. And that is for every year they are in that radiation zone. If you are in there for 5 years, it is 5 out of 100 young girls will get cancer.”

This implies for young girls $\rho$ = 2000/5 = 400 person-rem


These estimates are not complete in agreement, but are of the same order of magnitude. They do agree in that the model to use is the linear, no-threshold dose-response model. In other words, any exposure to radiation increases the cancer risk and there is no absolutely “safe” dose.  The moral from this is that any increase in radiation exposure must be justified. The assertion that additional radiation exposure is safe because it is small or comparable to background radiation, medical x-rays, cosmic-rays from airplane trips is not relevant. All of these sources are unfortunately harmful.

In terms of epidemiology the exposure of thousands or millions of residents to an additional dose of radiation is certainly going to cause an increased number of cancers and  cancer deaths.  On the other hand, the increase in probabilitly of dying from cancer for any individual person could be considered small and, given informed consent, might be judged by the patient to be a worthwhile risk.

Exposing a large population could occur when a nuclear power plant is operating and is not performing to spec. Mass screenings such as mammography would also increase the incidence of cancer when applied to a large number of patients. For example, a typical mammogram exposure is 0.4 mSv (http://www.radiologyinfo.org/en/safety/?pg=sfty_xray)

Number of cancer deaths when mammogramming 1 million women would be in the best case given the above numbers would be

(0.4 mSv) x (1 Sv/1000 mSv) x( 1 000 000 persons/20 person-Sv) = 20 deaths

If the mammography is repeated every 2 years for 20 years then one should multiply by 10, or perhaps less due to the aging of the subjects.

Likewise, there would be 40 extra cases of cancer in the million women by these numbers. In fact, since breast tissue seems to be more sensitive to radiation and women are also more sensitive, one could estimate up to perhaps 100 cases of cancer without exceeding reasonable limits of uncertaintty. This may be a risk that’s worth taking since early detection of cancer saves lives. The number I have heard is that the routine mamographic screening of  about 150 women  can save one life due to early detection. In the one million women examined by mammography, nearly 7 000 lives could be saved due to early treatment compared to the 20 extra cancer deaths. (from this article http://www.nlm.nih.gov/medlineplus/podcast/transcript022414.html one can calculate that in the cited study 7 deaths/1000 screenings or 143  subjects being examined routinely. The error on this estimate is large– about ± 20 out of 500 in each sample so the difference would have an error of ±30 at a 68% confidence interval.)



iPad stand from an egg carton

Telus Optik recently dropped RT from the channels included in their basic package.  So I am relegated to watching on an iPad to hear the other side of the Ukrainian situation. Unfortunately, we don’t have a convenient stand or one of those Magic Cases that allow it to sit upright so  it can be viewed from a relaxed position.

XS Cargo had advertised an iPad stand for $\$1.98$ but when I got there all they had left were stands and cases ranging from $\$9.98$ to $\$14.98$.

Disappointed, I decided that one could easily make a stand from a stiff piece of cardboard or plastic. A little rummaging  turned up an 18-egg cardboard egg carton that supports the iPad upright at an angle. If one puts the iPad in landscape orientation and inserts it into the front row of egg indentations and leans it back against the inter-egg pillars. It is stable,. However, for added stability and security I folded back the flap and stapled it in place. The top of the carton folded down to touch the top of the iPad and that seemed to enhance the sound output.

Below are pictures of the assembly.

Solution found!
Solution found!
iPad sits firmly in the first row of egg depressions.
iPad sits firmly in the first row of egg depressions.
The front flap is loose and can be used to stabilize the iPad.
The front flap is loose and can be used to stabilize the iPad.

Hefty staples could be used to secure the flap, but I used slide clips, a Japanese version of Bulldog Clips without handles.

Slide clips hold the flap in a position to stabilize the iPad.
Slide clips hold the flap in a position to stabilize the iPad.
The portable stand can be easily carried to the smallest room in the house for convenient viewing from the throne.
The portable stand can be easily carried to the smallest room in the house for convenient viewing from the throne.



The voltmeter measures the current through a 1Ω resistor by displaying the voltage.  Thus 0.8 A will display as 0.8. A 1 watt resistor should be sufficient.
The voltmeter measures the current through a 1Ω resistor by displaying the voltage. Thus 0.8 A will display as 0.8. A 1 watt resistor should be sufficient.