Fitness and weight loss: exercise

What does a tutor do over the summer?  Tutoring continues, but at a relaxed pace.  In the breathing space, the tutor pursues various topics of interest….

Given our culture’s focus on being slender and youthful, combined with the threat of weight gain that lurks in the lifestyles of many, exercise and/or weight loss have become “everyman” topics.  This tutor is right on board:  when you deal mainly with young, fit people, you’re best off to be youthful and fit yourself.

With family, work, and the pressure to stay fit, many find themselves squeezed from different sides.  Inevitably, the following question begs to be answered:

  • Assuming I can find some time for exercise, what are the best ones to do?

I’m definitely not a workout specialist; I can only contribute observations I’ve made from my own experience.  Generally, I’ve trended away from muscle building exercises, towards aerobic ones.  The year before this, I focused mainly on outdoor running, running up and down stairs, and riding the stationary bike. This past year, I’ve changed mainly to skipping.

I’ve mainly given up outdoor running for two reasons.  The first reason is injuries:  I never run on pavement, yet I still get injured running.  The second reason is crowding:  the fields I run in can be quite busy.  A serious runner needs space.

Running up and down the stairs is great.  For me, it’s indoors, so it doesn’t offer the advantage of fresh air.  Another drawback: it can’t be done when people might need to use the stairs.  Furthermore, I find it doesn’t build the calf muscles the way I like.

My stationary bike is outside, so it’s a fresh-air activity.  It truly is a great exercise; I find it to be injury-free.  From my point of view, its only drawback is that the musculature you get from it is quite disconnected from everyday life.  (I’m not a cyclist other than on the stationary bike.)

Why I like skipping, and some other observations about exercise in general, I’ll share in the  next post.  For now, let’s make the most of this perfect summer day, whatever we are doing:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

PERL: variables (or should we say $variables)?

When you tutor computer programming, you must explain the use of variables.  Such is the next step of our PERL summer project.

To a computer, a value needs a name.  Computers (at this level) aren’t capable of changing context the way humans can; they need to be told what to do, and what to do it to, at every stage.

Here’s an example of the difference between humans and computers.  Suppose, for instance, you tell a grade 6 student the numbers 11 and 29, then ask them for the average.  The student will add the numbers, divide the sum by 2, then spontaneously say “The average is 20.”  If you ask the student to tell the original two numbers, they can; however, they realize that what you really want is the answer.

On the other hand, a computer needs to “identify” a value before it can do an operation to it.  Therefore, a computer program to find the average of 11 and 29 might proceed like this:

get the value of the first number:  call it number1

get the value of the second number:  call it number2

add number1 and number2; call the sum number3

divide number3 by 2; call the result theaverage

print out “The average is ” theaverage

In traditional programming, you name a variable first, then give it a value.  When you want the computer to manipulate that value, you refer to it by its variable name.  Planning a program, you don’t wonder what the answer will be; rather, you wonder how to explain to the computer what to do in order to find the answer.  Specifically, you need to tell it what steps to perform to which variables.  Actually working with the numbers is easy for a computer, once it has clear instructions.

Commonly, variable names are written as one word, even if they indeed contain more than one.  Therefore, thirdnumber might be a likely name for the third number referenced in a program; on the other hand, you might call it number3.  Digits can be used in variable names, but usually aren’t allowed as the first character.

In PERL, variable names are commonly given a dollar sign prefix; therefore, if you wanted to call a variable number3, you’d call it $number3.  The dollar sign prefix increases program readability for humans; it’s easy to track what’s happening with the variables, since they all start with $.  There are other reasons, as well, for the $ prefix on PERL variable names.

Next post, we’ll see some variables in action.  Enjoy your day:)

Source: Robert’s Perl Tutorial, by Robert Pepper.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , , , , ,

PERL programming: the “shebang” line

Tutoring PERL beginnings, the details can be so important.  While the tutor now focuses to the Linux/Mac side, Windows users might do well to tune in.

Over my last few posts I’ve been discussing how to get started with PERL programming.  Of course, I’ve run parallel posts:  some have focused on Windows, others on Linux/Mac.  I hope you’ve all been successful in following the procedures I’ve offered.

Whichever world you reside in – assuming it is just one – knowing what’s going on in the other world often seems beneficial.  Therefore, I recommend the users of one operating system read the posts for the other, if only to realize how similar the procedures are.

Today’s emphasis is on the line


which is part of the script for Linux/Mac, but is conspicuously absent at the head of the script for Windows.

According to Robert Pepper’s Perl Tutorial, #!/usr/bin/perl is called the “shebang” line. (By the way: almost everything I know about PERL I learned from Robert Pepper.) He goes on to explain that under Unix systems (Linux is a derivative), the shebang line tells the file type so the computer knows how to execute it.

Windows, he continues, does not need a shebang line. However, a shebang line for the Windows script might look similar to this:


(The above shebang reveals the use of Strawberry Perl).

The line tells the location of the perl interpreter, which will execute the script. Once again, the line is not needed in Windows.

For Linux/Mac, however, you will see something like


at the head of a PERL script, and it is needed – on mine, anyway. Now you know why, whichever operating system you might use:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , , , , ,

Summer PERL programming: running first script for Linux & Mac users

In the context of tutoring, a lazy summer day might mean academic pursuits at a relaxed pace.  The tutor acknowledges the need to bring Linux and Mac users equal with Windows users:  in this installment, he offers instructions for Linux and Mac users to execute their first PERL script.

In my previous post I instructed Windows users through the execution of their first PERL script. Now, Linux and Mac users, it’s your turn.

Open your text editor and type in the following:


print “Hello, how are you?–from PERL!\n\n”;

Let’s imagine you call your file july101 and save it in your “My_perl_programs” folder. In my experience, you can save it as type “all files” or type “text files” – just as long as it’s actually plain text.

Now, open your terminal and go into your “My_perl_programs” directory. Enter the command ls to make sure your file july101 is listed. Assuming you see it, enter the following command:

perl july101

If the process works, the terminal should reply with

Hello, how are you?–from PERL!

If you receive that greeting, congratulations! You, Linux or Mac user, have successfully executed your first PERL script.

The next few posts, we’ll review what we did during this one and last one. To quote Phil Collins in his hit song Against All Odds:

“There’s so much I have to say to you/So many reasons why….”

We’ll get to it all, in the coming days:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: ,

PERL: the end of the first rainbow (for Windows users)

Summer tutoring continues.  Today, the tutor hopes, we get word back from PERL.

In the previous article I brought the Linux and (hopefully) Mac users on board with creating a text file, then finding it in the terminal. Earlier, I described how to do it under Windows. Now, I imagine, “everyone” knows how to, on their home system, create a text file, then find it in the terminal.

The goal of today’s article is to create a PERL script, find it in the terminal, and run it. Once again, there is a dichotomy between Windows and Linux/Mac.  This article will cover Windows; the next one, Linux/Mac.

Windows users:

In Notepad, open a new text file, then type the following:

print “Hello from PERL on Jun30, 2014!\n\n”;

Save the file. Let’s imagine you call it  myfirstperl  then save it to your folder (aka directory) “my perl programs” (or whatever you called the folder). Now, follow these steps:

  1. Open the terminal and go into the directory “my perl programs” (or, once again, whatever you happened to call it).
  2. Enter the command  dir to confirm your file  myfirstperl is indeed in the directory. If you called it  myfirstperl, it should show up as myfirstperl.txt
  3. Let’s assume you see your file myfirstperl.txt. Now, key in

    perl myfirstperl.txt

If it worked, the terminal should reply with

Hello from PERL on Jun30,2014!

Hopefully, the procedure worked for you.  If so, you have successfully begun programming with PERL:  congratulations!

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: ,

Perl programming: using the terminal in Linux (or Mac?)

Pursuing summer tutoring, we have embarked upon the PERL programming journey.  The tutor continues it:  soon, there might be no turning back.

In my previous article, I described how you might, in Windows, create a text file, save it, then find it in the terminal. Now, I’ll describe the corresponding procedure in Linux – which I believe will be the same for the Mac. Once again: I don’t have a Mac, so I can’t be sure. It’s my impression, however, that Linux and Mac, for this purpose, are similar.

First, to create the file, you’ll open the text editor. In my flavour of Linux, it’s called “text editor”. You might write down a grocery list or colour choices for your paint:

maroon, cappuccino, red granite, basalt

Now, you’ll save that file. For convenience, you might create a new folder for PERL activities, then save the file in there. Perhaps you create the folder
“My_ perl_programs”. (Unlike with Windows, the Linux terminal may not tolerate spaces in names). Maybe you save the file as colours.txt in your “My_perl_programs” folder.

Now, you open the terminal – which, in my flavour of Linux, is called “terminal”. It’s in with the apps.

When I open the terminal, it puts me in what I’d call my “home” directory. To see the contents of the directory, I enter the command


On my Linux terminal, ls displays the directories in blue, while the files are in white. From the terminal’s point of view, a folder is a directory. You (hopefully) see “My_perl_programs” – or whatever you called your PERL folder – among the items listed by the ls command. Maybe it’s even in blue.

Let’s assume you did call your PERL programs directory “My_perl_programs”. To go into it now, enter the command

cd My_perl_programs

Now, when you enter ls, you should see your text file colours.txt – or whatever you called it – listed. If you do see it, you have successfully created a text file, then found it in the terminal – which is, after all, the point of this article.

 Three observations:

  1. In Linux, the terminal doesn’t seem to tolerate names with spaces in between.  Windows users will notice this difference.
  2. The Linux terminal is case sensitive, whereas the Windows one is not.  Therefore, in Windows you can go into the “MeandMyself” directory using the command
    cd meandmyself, while in Linux, you can’t. You’d instead need to enter, literally, cd MeandMyself.
  3. In my Linux terminal, the dir command also works to list the contents of a directory, even though it’s the Windows command. However, you might not get the colour coding you might (in Linux) get using the Linux command ls.

To my knowledge, the Mac procedure for accomplishing the tasks above is very similar – if not virtually the same. Perhaps now “everyone” knows how to create a text file, then find it in the terminal. Next step: writing a PERL script, then (hopefully) running it!

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , ,

Programming with PERL: the terminal, continued

A summer tutoring project is under way; the tutor continues with its next installment.

As I mentioned in my previous article, developing familiarity with the terminal is key to running a PERL program. What the user really need be able to do is create a plain text file, then find it in the terminal environment.

On Windows, suppose you open Notepad and write a line or two. For now, maybe you just write a grocery list.

Windows has the directory “My Documents” or something similar (In Windows 7, it might just be “Documents”.) You might make a new folder in that directory called “my perl programs” or something like that. Next, you might save your grocery list file in there. Maybe you call it groclist.txt, for instance.

Now, you need to be able to find that file in the terminal. Under
All Programs→Accessories, you find Command Prompt, which is the terminal. When you click Command Prompt, a black window opens on the screen. There is the command line: a directory name in white print, with a blinking cursor.

In my experience, the terminal opens to the directory that contains My Documents. Therefore, if you key in

cd my documents

then press Enter, you should arrive there. If so, you’ll see “My Documents” tacked onto the end of the directory name. Windows 7 users might do the step above substituting documents instead of my documents.

If you made a new folder called “my perl programs” in “My Documents”, you’ll be able to find it now by typing in


then pressing Enter. Your folder should appear in the list.

To move into that folder, enter the command

cd my perl programs

Now, “my perl programs” should be tacked on the end of your present location. If you enter the command


you should see your file “groclist.txt” – or whatever you called it – listed.

The above instructions likely give you the tools to create a text file, then find it in the terminal. Such facility is key to creating and running a PERL script.

I apologize that this article covers Windows only. However, an article that covers the other operating systems as well would be too long for our easy summer pace. In the next article I’ll cover the Linux context. I’ll even try to extend to the Mac, though I don’t have one.

A Linux or Mac user who is unfamiliar with the terminal will still pick up valuable hints from this article. The reverse will be true as well: the Windows user will gain from reading the next article, even though its context will be Linux.

Jack or Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , , ,

Summer programming (with PERL): next step: the terminal

Tutoring through the summer, you tend to land in projects.  The tutor brings the PERL project to another early milestone.

In my previous post, I talked practically about what you need to get started with PERL, should you choose to embark. While Macs and Linux systems include PERL, a Windows user might have to download a PERL bundle, of which there are choices (Strawberry and ActiveState being two I’ve used).

Next concern: the text editor used to write the scripts. (For our purposes, a script is a little program). It must produce plain text. Under Windows, Notepad
(All Programs→Accessories→Notepad) will do fine; Linux users have many choices, but I use “text editor” under Apps. As I’ve mentioned, I don’t have a Mac, but I searched a bit yesterday how a Mac user might produce plain text. This article describes how the Mac’s text editor can convert content to plain text using a command under the “Format” menu.

There is a final issue one needs to confront before starting with PERL: getting familiar with the terminal – aka, the command line.

To my knowledge, every operating system has a terminal. One point of difference among operating systems is how much (or little) the terminal is in evidence. Linux users are likely familiar with the terminal. Older people (myself included) recall using MS-DOS on the terminal.

On Windows, the terminal is called Command Prompt, and is under
All Programs→Accessories.

In Linux (perhaps), the terminal is called “terminal”, and is under Apps. (There are many flavours of Linux, but this is true for Ubuntu, anyway.)

For the Mac, this article tells me to find the terminal under “Applications/Utilities”.

For the purposes of running a PERL program, you need to be able to arrive at the location (called the directory) of your script file. Here are the basic commands you need:


  • cd changes the directory you’re in.
  • dir tells the contents of the directory you’re in.

Linux or Mac:

  • cd changes the directory you’re in.
  • ls tells the contents of the directory you’re in.

In the next post, I’ll continue with some hints and examples of how to get around in the terminal to find a file. Until then, cheers:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , , , , , , ,

Summer programming: a little PERL

Tutoring over the summer?  Why not.  During the holidays, this tutor won’t necessarily work you too hard….

Back in March (see here and here), I opened the topic of programming with the language PERL. Today I’ll “start at the beginning.”

If you want to actually experiment with PERL, the question is, “Are you on Linux, Mac, or Windows?”

If you’re running Linux, you can run PERL programs right now. I know so, because I use Linux – specifically, Ubuntu.

If you’re running a Mac, I’m told that once again, PERL is native to your system, so you can run PERL programs already. However, the last time I used a MAC was the AppleIIcx in 1988; therefore, I don’t speak from experience.

If you’re using Windows, you’ll likely have to download a PERL compiler. Don’t worry; it’s free and I’ve done it before. There are several good bundles you can find on the internet. Some people like ActiveState, some people like Strawberry PERL…I’ve used both.

Going forward, your only other need is a text editor, which is a program that produces files in “plain text.” Document files are not plain text; a typical word processing program will not produce plain text unless specially ordered to (if that’s even possible).

If you’re running Linux, there are many plain text editors to choose from – including, under Ubuntu, one called “text editor”. Under Windows, there’s “Notepad”, which I’ve used faithfully for many years. I think you’ll find it under Accessories.

Once again: I don’t have a Mac. However, I’m sure it contains a text editor that’s easy to find, since Macs are good for stuff like that.

For today, we’ll leave it there. I’ll continue next time with writing a couple of lines of code in the text editor, then hopefully getting it to run:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , ,

Math: Simplifying a radical (aka root) expression

For this math tutor, the end-of-semester rush is about to end. Tutoring for exam prep, you tend to return to those “messy” problems students would rather avoid….

Radical expressions are among the most difficult topics in high school math. Let’s explore an example:


Most people would be uncomfortable about this question. It’s really not that hard, as long as you know the exponent law


where a, if not written, is meant to be 2.

We rewrite the expression as follows:


The law for multiplying expressions with the same base is to add the exponents. To add these fractional exponents, we need to get a common denominator as follows:

7/2 + 9/5 = 35/10 + 18/10 = 53/10

Therefore, we have


To simplify, we reverse the exponent law for mutliplication:


Reversing the radical-to-exponent law, we arrive at


The answer might seem surprising. In fact, for many, this process might need still further illumination. In future posts, I’ll revisit some of the ideas used in this one. Cheers:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , ,
%d bloggers like this: