Friday, March 31, 2017

AP Computer Science 2016-2017: More Arrays and AP Pep Talk (March)

AP Computer Science 2016-2017:
More Arrays and AP Pep Talk

Believe it or not, we spent most of March on ArrayLists! So last month's posting, repeated below, still applies. However, this month I would like to share a bit of a pep talk that I gave my AP Computer Science students on Edmodo, enjoy!

AP CompSci Pep Talk 2017
The best way to learn how to code is to watch someone else code and try to do some coding yourself everyday! That's what I try to provide for you in class.

Also, the best way to succeed on the AP CompSci Exam is to read and write code everyday even at home! You should be playing around with everyday now that we have a server we can use in class and at home! 

You also need to get the latest Barron's Review book and read and write a little code in there everyday. You should be reading our textbook power points and trying our lab pdfs everyday! 

Just a little advice from your friendly neighborhood CompSci teacher who's been coding for over 40 years!

Ever since Linux came out (1995?), I have always provided my students with a sftp/ssh server they could log into in class and from home. This was a great solution for us as students could work on labs in class, in extra help, in the library and at home. This made our workflow very efficient so that we could do a lot of programming assignments in a short amount of time. I'm used to giving my students a lot of lab time and coding practice everyday!

In recent years, my district has hired out our tech services to some off campus "experts" in IT and Cyber Security. This new "Tech Dept" has found fit, in its infinite wisdom, to change the school's internet firewall in such a way so as not to permit ssh tunnels in or out. My pleas to the contrary falling on deaf ears. So, now my students cannot login from home. I've been struggling with alternate solutions involving Teamviewer, SplashTop and Chrome Remote Desktop just to name a few. These experiments have had varrying degrees of success but still no joy.

This semester I started playing around wih online java IDEs. I tried many and found Cloud9 actually provided an online Ubuntu terminal very much like what we use in class. However, javac is no longer installed and customer service is not very helpful....

cloud9 is free. However, if you want to setup a teacher account, it costs a modest $1 per month.

Why would you pay if it's free? The problem with cloud9 is the registration process. They require a credit card for identification purposes.

Students can join your Team without a credit card if you have a Teacher Account.

Regarding the APCS Labs (Magpie, etc), I still have my local sftp linux server in class for GUI and graphical work.

Most of the work we do all year is more text based, so using or would be fine.

Also, if we want to play with graphics we could use

I'm sticking with for now as my students are doing well with it and it's easy to share code on my SmartBoard as I teach.

c9 is hard to see on the SmartBoard. You can increase font size in the text editor but not in the terminal???

Actually, you can install default-jdk (openjdk) from the commandline much as you do in a standard Ubuntu terminal with apt-get. Here's an example of some coding I did,

If you want to play with c9 you can make one workspace for the whole year, just make a new directory (aka folder) for each project,

Also, make a "custom workspace" by clicking on the Ubuntu icon. They have different workspaces for c++, python, html website dev, etc.

Your Custom Workspace is basically a plain vanilla install of Ubuntu (virtual machine like Harvard's CS50 uses) that works over a web interface.

So, jdk is not installed. Do this once in the terminal (aka commandline):

sudo apt-get update

sudo apt-get install default-jdk

This installs the latest version of openjdk from the debian repositories which is fine for text based work.

However, we did play around with and found it very useful. Students get their own free accounts. Students can store their work with revision histories. Students get a text editor with syntax completion and syntax color highlights (simple java IDE). Students get an ASCII terminal for output. You can use a variety of programming languages too. 

Teachers can get a teacher account where they can set up online classrooms and assignments but I haven't done that. I'm using my account as the students do. Each new project is saved as a separate session. Each session can have multiple files and classes. One thing to watch out for is that the main method has to be in in the Main class. 

Last, but not least, you can share a live instance of any particular revision of any session you want complete with editor, terminal and runner. Here's an example,

Last Month's Post
(NEW: YouTube Wednesday)

Finally, we are ready for Static Arrays and ArrayLists! We started with list traversals using for loops. Our introductory project was Rot13a where we traversed a String as an array of char and ran a Caesar Cypher. Rot13b did the same thing with static int[] arrays. Then we tried Rot13c with dynamic arrays aka ArrayLists!

YouTube Wednesday: Watson on Jeopardy!

Teaching With Technology,

Well, that's all folks,
A. Jorge Garcia

 Applied Math, Physics and CS
2017 NYS Secondary Math PAEMST Nominee

Sage Ebay

Thursday, March 30, 2017

AP Calculus BC 2016-2017: Power Series (March)

AP Calculus BC 2016-2017:
Power Series

UNIT 11 
In our penultimte unit, we use what we learned about series of constants to find where power series converge. The difference here is that a sequence of constants may converge to a number, while a power series may converge to a function!

YouTube Wednesday: Was it Archimedes?

Teaching With Technology,

Wednesday, March 29, 2017

preCalculus 2016-2017: Conic Sections (March)

preCalculus 2016-2017:
Conic Sections

Chapter 10 was great fun. It was about Conic Sections! We learned about the graphs of Parabolas, Ellipses and Ellipses in General Form and in Standard Form. We played with planet orbits and whisper gardens. We found out about degenerate conics and used polar notation to graph Twisted Conics too!
YouTube Wednesday: Was it Archimedes?

Teaching With Technology,

Wednesday, March 15, 2017

CIS(theta), 2016-2017: March Meeting: MPI4PY +!

CIS(theta), 2016-2017: 
March Meeting: MPI4PY +!

Before going on to 
Step 7: Coding 1 - Quadrature, 
we decided to install mpi4py and to write the programs and to test the cluster using python! 

So we added a new
Step 6: Software Stack III - MPI4PY
(see below).

InstantCluster Step 1: 
Infrastructure - Power, Wiring and AC

InstantCluster Step 2: 
Hardware - PCs

InstantCluster Step 3: 
Firmware - Ubuntu

InstantCluster Step 4: 
Software Stack I - openSSH:

01) Install openSSH-server from USC or

02) Create a the same new user on every box of the cluster

03) login as the new user, we used 
userid: jaeger, passwd: galaga

04) If you have no .ssh directory in your home directory, ssh to some other machine in the lab; then Ctrl-d to close the connection, creating .ssh and some related files. 

05) From your home directory, make .ssh secure by entering:
chmod 700 .ssh

06) Next, make .ssh your working directory by entering:
cd .ssh

07) To list/view the contents of the directory, enter:
ls -a [we used ls -l]

08) To generate your public and private keys, enter:
ssh-keygen -t rsa

The first prompt is for the name of the file in which your private key will be stored; press Enter to accept the default name (id_rsa).The next two prompts are for the password you want, and since we are trying to avoid entering passwords, just press Enter at both prompts, returning you to the system prompt.

09) To compare the previous output of ls and see what new files have been created, enter:
ls -a [we used ls -l]
You should see id_rsa containing your private key, and containing your public key.

10) To make your public key the only thing needed for you to ssh to a different machine, enter:
cat >> authorized_keys

NOTE: The Linux boxes on our LAN, soon to be cluster, have IPs ranging from to So, we copied each file to temp01-temp24 and uploaded these files via ssh to the teacher station. Then we just ran cat tempnn >> authorized_keys for each temp file to generate one master authorized_keys file for all nodes that we could just download to each node's .ssh dir.

[optional] To make it so that only you can read or write the file containing your private key, enter:
chmod 600 id_rsa 

[optional] To make it so that only you can read or write the file containing your authorized keys, enter: 
chmod 600 authorized_keys

InstantCluster Step 5: 
Software Stack II - openMPI

We finally have openSSH installed with public key authentication on We tested that today.
Today we also installed openmpi-bin, libopenmpi-dev and gfortran on the same machines: 

sudo apt-get install openmpi-bin
sudo apt-get install libopenmpi-dev
sudo apt-get install gfortran

Then we compiled flops.f:

mpif77 -o flops flops.f

Then we ran flops on our quadcores:

mpirun -np 4 flops

We got about 8 GFLOPS! So, we have multicore working on individual PCs now it's time scale our job over the cluster! 

mpirun -np 16 --hostfile machines flops

We got up to nearly 32GFLOPS! We made sure all four PCs are identical COTS, have identical firmware, have public key authenticated ssh for the user jaeger, and have these 3 files:


The /home/jaeger/machines file is a txt file that looks like this:

InstantCluster Step 6: 
Software Stack III - MPI4PY +

python is a very easy language to learn. It's an interpreted language, so all you have to do is write a text file and run it through the python interpreter as long as it's installed (we have it in unbuntu). is just one line (unlike java): print "hello!" 

Save this line to a file called with your fave text editor and that's it! Or you could call it since it's a sequential, not a MPI, script. 

To run it, open a shell and type:


Alternatively, you could add a line at the top of #!/usr/bin/python or whatever path points to your installation of python. Then make the file executable and run it from the commandline as the super user in a terminal:

chmod 755

Then we installed "python-mpi4py" as the main user from 

Make sure to install that package on every linux box in the cluster. Our looks like this:

import sys
from mpi4py import MPI

id = comm.Get_rank()
name = MPI.Get_processor_name()

if id==0:
  print "This is id=0, I am the Master Process!"
  print "HELLO_MPI: there are ", p, " MPI processes running."
print "Hello World, from process: ", id
print "Hello World, my name is ", name

The first line is probably optional as you are going to run this file using mpirun on one PC (quadcore):

mpirun -np 4 python

or on the whole cluster (4 quadcores):

mpirun -np 16 --hostfile machines python

After you edit and save, before running mpirun, make sure to:

scp jaeger@10.5.129.XXX:/

making an identical copy of the file in the home folder of every PC in the cluster. That's it, you have a working MPI cluster using python!

We are also studying sample MPI code:

InstantCluster Step 7: 
Coding I - Quadrature

InstantCluster Step 8: 
Coding II - Mandelbrot

InstantCluster Step 9: 
Coding III - Mandel Zoom

InstantCluster Step 10: 
Coding IV - POVRay

InstantCluster Step 11: 
Coding V - Blender

InstantCluster Step 12: 
Coding VI - 3D Animation

09/14/2016 (organizational meeting)
10/26/2016 (installing Ubuntu 16.10 64bit)
11/09/2016 (installing Ubuntu 16.10 64bit)
12/14/2016 (Pelican HPC DVD)
01/11/2017 (openSSH Public Keys)
02/08/2017 (openMPI Software Stack)
03/08/2017 (Quadrature)
03/22/2017 (Fractal Plots + Zoom Movie)
(03/29/2017 is a make up day)
04/26/2017 (POVRAY 3D Stills + Animation)
05/10/2017 (Blender 3D Animation)
(05/24/2017 is a make up day)

So, what's all this good for aside from making a Fractal Zoom or Shrek Movie?

SETI Search
Protein Folding
Beal Conjecture
Scientific Computing
Computational Physics
Mersenne Prime Search
Computational Chemistry
Computational Astronomy
Computer Aided Design (CAD)
Computer Algebra Systems (CAS)

These are but a few examples of using Computer Science to solve problems in Mathematics and the Sciences (STEAM). In fact, many of these applications fall under the heading of Cluster Programming or Super Computing. These problems typically take too long to process on a single PC, so we need a lot more horse power. Next time, maybe we'll just use Titan!


Membership (alphabetic by first name):
CIS(theta) 2016-2017: 
DanielD(12), JevanyI(12), JuliaL(12), MichaelC(12) , MichaelS(12), YaminiN(12)

CIS(theta) 2015-2016: 
BenR(11), BrandonL(12), DavidZ(12), GabeT(12), HarrisonD(11), HunterS(12), JacksonC(11), SafirT(12), TimL(12)

CIS(theta) 2014-2015: 
BryceB(12), CheyenneC(12), CliffordD(12), DanielP(12), DavidZ(12), GabeT(11), KeyhanV(11), NoelS(12), SafirT(11)

CIS(theta) 2013-2014: 
BryanS(12), CheyenneC(11), DanielG(12), HarineeN(12), RichardH(12), RyanW(12), TatianaR(12), TylerK(12)

CIS(theta) 2012-2013: 
Kyle Seipp(12)

CIS(theta) 2011-2012: 
Graham Smith(12), George Abreu(12), Kenny Krug(12), LucasEager-Leavitt(12)

CIS(theta) 2010-2011: 
David Gonzalez(12), Herbert Kwok(12), Jay Wong(12), Josh Granoff(12), Ryan Hothan(12)

CIS(theta) 2009-2010: 
Arthur Dysart(12), Devin Bramble(12), Jeremy Agostino(12), Steve Beller(12)

CIS(theta) 2008-2009: 
Marc Aldorasi(12), Mitchel Wong(12)

CIS(theta) 2007-2008: 
Chris Rai(12), Frank Kotarski(12), Nathaniel Roman(12)

CIS(theta) 1988-2007: 
A. Jorge Garcia, Gabriel Garcia, James McLurkin, Joe Bernstein, ... too many to mention here!

Well, that's all folks,
A. Jorge Garcia

 Applied Math, Physics and CS
2017 NYS Secondary Math PAEMST Nominee

Sage Ebay

Wednesday, March 1, 2017

LIMACON 2017 SUNY Old Wesbury?

UPDATE: LIMACON 2017 SUNY Old Wesbury?

If it's March it's gotta be LIMACON, right? Nope, not this year. I was not invited as a guest speaker, something about new blood and new ideas? Anyway, I can speak every other year, so I'll go again next year. I was thinking of going just as an attendee, but I didn't see any new blood that was of interest, sorry. I usually give my talk and then go to the rest of the conference for free. 

FYI, here's what I spoke about last year:

Confessions Of A Presenter At
Houston We Had A Problem!

You know I'm meticulous about my tech! So I got to my room half an hour early and had everything working. I set up my PC and Projector, Media Center and Projection Screen, my mic, my screencasting software, my pdfs and my mp4s, ... everything! 

Then, right after I started my session, everything fell to pieces! The PC couldn't handle rendering my video as it ran out of hard drive space after only 5 minutes of recording. When I tried to show a video from YouTube, the speakers died! I tested all this stuff before the attendees arrived. I was good to go. IDK what happened!

Not to worry, I covered everything I had to cover in my presentation and then some! In fact, I think the presentation was a great success. I just wanted to record it for YouTube and I wanted to jazz up the presentation with some Calculus Filks. 

Maybe I'll rerecord it sometime this week (I did, see videos above). 

The irony of the situation is that I had my brand new Samsung Galaxy NotePro 12.2" Droid Tablet with me (instead of my laptop). Given enough time, I could have mirrored the PC Desktop to my Tablet over WiFi controlling everything from my Tablet like a remote SmartBoard and recorded the whole thing right on the Tablet. 

However, I did not want to waste the attendees' time with all that, so I skipped all the tech except for my primary focus: teaching Calculus with 

I even sang when the audio went out. 

In retrospect, I should have set up the Tablet in the first place.

BTW, I've been attending LIMACON at SUNY Old Westbury since 1988 and presenting since 2010.

Here's some related talks

Here's my SAGECELLs

Here's my Handouts

Here's the FILKs and YouTube Videos!

Well, that's all folks,
A. Jorge Garcia
Applied Math, Physics and CS
2015 NYS Secondary Math PAEMST Nominee

Teaching with Technology, 
PasteBin SlideShare 
Sage Ebay