Sunday, October 5, 2014

Server Side Includes

I have a fantastic group of students in my afternoon Advanced Topics in Information Technology class this year.  Its been a long time since I've had a group with this level of skill, self-motivation, and interest.  It is going to be a fun year!

Two students are studying web page design.  They have already completed both the GDW HTML and GDW CSS tutorials, and now they are working on projects to apply what they have learned to their own website.  One of the two students, Jack, has been working on a menu bar that highlights the current page using CSS.  This led us to a discussion of the need to be able to dynamically include standard parts your website (headers, footers, etc.) across multiple pages, so that changes to these cross page components can be made in only one place. This was a great time to introduce the DRY principal in software development.

Another student in the class, Sam, who is studying The C Programming Language this semester, is also interested in system administration, and on overhearing Jack and me discussing the problem, pointed out Server Side Includes to us. I'm surprised that I've never heard of this technology before, since it provides just the kind of solution I'm looking for in terms of motivating a deeper understanding of web technologies step-by-step.  I don't want to jump into a Python web framework (even a micro framework like bottle) at this point.  I'm not a fan of PHP, though I realize that it is not a bad fit for what I'm looking for. SSI looks to be better.

Sam volunteered to explore setting up and documenting SSI.  I told him to setup an Ubuntu server with VirtualBox.  He will be delayed in doing that because he only has 32 bit Ubuntu on his laptop, so while we wait for Sam to reinstall with 64 bit Ubuntu this weekend, I decided to go ahead and document as much of this process as I could.

Setting Up Ubuntu Server in VirtualBox

Here is a screen shot showing the first stage of the Ubuntu server setup using VirtualBox:


I used 1 Gig of RAM and a 20 Gig virtual hard drive (the first option in the menu of virtual hard drive choices, VDI). I then changed the network setting to use a "Bridged Adapter", which gives the virtual machine its own network address on the host network, instead of putting it behind NAT on a 10.x.x.x. network. This makes it easy for me to ssh into the virtual server from my desktop, and for others (students, say, in a classroom setting), to ssh into it from their machines.

During the installation of Ubuntu Server, the only software package option I picked was "Open SSH Server".  I plan to install everything else I want piece by piece.

The next task is to install apache on the server:
$ sudo aptitude install apache2
As soon as that completes, I can point the browser from my desktop at the IP address of the server running inside a virtual machine that it is hosting (I don't care how many times I've done this, I always think it is cool! ;-)


 
My host machine (desktop) in this case has IP address 192.168.1.4, and the server running inside the virtualbox has IP address 192.168.1.11, so my the browser running on my desktop is connecting to the web server running on the virtual machine.

Enabling SSI

Now to get server side includes working, I followed Sam's instructions:
# a2enmod userdir
# a2enmod include
# vi /etc/apache2/mods-availiable/userdir.conf
   change "IncludesNoExec" to "Includes"
# vi /etc/apache2/mods-available/dir.conf
   add "index.shtml" (immediately after "DirectoryIndex"
     and before "index.html")
# service apache2 restart
We now have user local directories and SSI enabled (we hope ;-).  Let's try it out. I created a public_html subdirectory in my home directory, and put two files in it, index.shtml:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SSI Test Page</title>
</head>
<body>
<h1>SSI Test Page</h1>

<!--#include file="success_message.inc" -->

</body>
</html>
and success_message.inc:
<p>
If you are reading this message, SSI is working... Yeah!
</p>
Now I point my web browser at: 192.168.1.11/~jelkner and:

One last thing to note is that the SSI_PSPserver.vdi virtual hard drive file can easily be copied from machine to machine, bringing all the setup with it.

I talked to Sam about what my educational motivation was for wanting to use SSI.  He quoted Nietzsche on his blog post for that day to let me know he totally understood what I was getting at:
"He who would learn to fly one day must first learn to stand and walk and run and climb and dance; one cannot fly into flying."
-Friedrich Nietzsche
I'll say it again, this is going to be a fun year!

Tuesday, May 6, 2014

Python 3 Django 1.7 on Ubuntu 14.04 - Day 1

It's time to dive into learning Django.  I've been waiting until I could use Django with Python 3, and that time has now come. I'll be working on Ubuntu 14.04.  There is no python3-django package yet, so I'll give pip a try.  I also want to start with Django 1.7, so that I can learn the new built-in migrations instead of using South to update the data model.

Here is what I did to get started:
  • $ sudo aptitude install python3-pip
  • $ pip3 install --user https://www.djangoproject.com/download/1.7b3/tarball/
This created .local/lib/python3.4/site-packages and .local/bin directories in my $HOME and installed the Django egg in the .local site-packages directory and django-admin and django-admin.py in the .local/bin directory (see PEP 370).

Next I did:
  • $ python3
  • >>> import django
  • >>> print(django.get_version())
When the last statement returned 1.7b3 I knew I was in business. Trying to run django-admin, I realized that .local/bin was not in my PATH, so I added the following to the bottom of my .bashrc file:

PATH=$HOME/.local/bin:$PATH

export PATH

I also added the following to my .bash_aliases:

alias python='python3'

since Python 3 is what I use all the time now.

Starting a Django Project 

  • $ django-admin startproject checkitout
  • $ cd checkitout 
  • $ python3 manage.py runserver 0.0.0.0:8080
Running this last step created a db.sqlite3 file in the checkitout directory - something new in Django 1.7 I believe.

At this point I created a bzr repository of this so that each step in the process from here on out can be easily rewound.  Each of these commands were run inside the top level checkitout directory:
  • bzr init
  • bzr add *
  • bzr ci -m "initial commit"
Next I setup a project on launchpad: https://launchpad.net/checkitout, and pushed up the initial commit:
  • bzr push lp:~jelkner/checkitout/trunk

Next Steps

  • $ django-admin startapp cioapp
  • edit cioapp/models.py
  • bzr add *
  • bzr ci -m "added app and first models"
  • bzr push lp:checkitout
  • edit checkitout/settings.py and added cioapp to INSTALLED_APPS
  • edit cioapp/admin.py and import and register models
  •  python3 manage.py migrate
This created the database tables and setup a superuser. I started the server again with:
  •  $ python3 manage.py runserver 0.0.0.0:8080
pointed my browser at localhost:8080/admin and was able to login and see the tables. This brought me back to the point where my Django tutor, Chris Hedrick, left me off this afternoon, only now I've got Django 1.7 instead of the 1.6 we used earlier and I ran migrate instead of the syncdb from South. I'll finish by checking these last changes in, but I wonder what needs to get ignored by bzr to keep the database superuser info from being part of the repo? I'll have to start by asking Chris that tomorrow. A fine and productive day!

Wednesday, April 30, 2014

End of Course Reflection

Throughout my Higher Education in the Digital Age course I have maintained that a useful evaluation of the role technology plays in higher education can not be removed from the broader social and political context in which the technology is used. Without critical evaluation of the goals behind introducing any new technology into what we call "Higher Ed", no meaningful conclusions can be drawn as to the new technology's effectiveness and social impact.  At its root, this is a discussion about what role higher education plays in our society.  Who is it for and what are its aims? I see two contrasting goals for higher education with very different uses for new technologies associated with each.  In one view, associated with quest for a more egalitarian society with a broader and deeper role for democratic participation of its members, the World Wide Web offers a promise of greatly expanded access to information, communication, and participation.  In an opposing view, the new technologies will be used as a weapon by the Corporatocracy for increased social control and enforcement of labor discipline in the service of maximizing corporate profits. The outcome of the struggle between these two positions is no small matter, since only the former offers humanity a way out of the self-destructive morass in which it finds itself in the 21st century.

A dear friend of mine from Porto Alegre, who is involved in progressive politics with me, related recently what brought her "into the struggle".  In Brazil the national public universities are free.  Students who attend them don't pay tuition, but entrance into the universities requires scoring high on a competitive entrance exam.  In practice, this means the available seats in the public universities are mostly taken up by the well-to-do, who have the resources to out compete their lower income compatriots in preparing for the exam.  This leads to the ironic situation where the free, public, and highest quality opportunities for higher education go to the rich, while the poor are limited to paying for private, lower quality education.  When my friend was in high school, Porto Alegre was engaged in pioneering a wonderful new "technology" - a participatory budgeting process through which the members of her community worked to create a new, public university that was specifically targetted at and open to local community folks with limited access to financial resources.  My friend attended this new unversity and became active in the struggle to defend it from continual right wing attack.  The new technology in this story, the participatory budgeting process, has since been taken away from the citizens of Porto Alegre, but the educational institution that it birthed is still in existance and still serving those who would not otherwise be served.

So, what about the many new technologies we studied this semester -- the moocs, games, social networking apps, etc.?  Which of the two futures for higher education do they serve? While I optimistically like to imagine that the massive peer-to-peer communication enabled by the Internet points toward participation and democracy, nothing inherent in any of the new tech tools leads inevitably that way.  Instead, it will depend on the outcomes of the struggles for social control of our collective future, and whether the decisions about that future are going to be made by the many or the few.

Tuesday, April 22, 2014

Khan Academy Promotes Women in Computer Programming

I have been using Khan Academy with my math students with limited success for the past three years.  The videos on Khan Academy are not useful with my English language learner (ELL) students, and the frequent inclusion of word problems in the practice exercises is likewise inappropriate for my students. So while I saw promise in Khan Academy and was delighted that the materials on it were free to use and modify in an educational setting, I did not think it appropriate to use extensively in my classroom.

All that changed on March 18, 2014, when I received an email from Khan Academy that began with the following:
Dear jeff.elkner,

Did you know that just 18% of computer science college graduates are women? That's crazy when you consider that by 2020, the demand for graduates in computer science will be double the available workforce.

But together we can introduce all our students to coding and ensure that female students don't get left behind.

Thanks to Google, U.S. public high school teachers can now earn over $1,000 in DonorsChoose.org funding when their female students complete our Khan Academy coding lesson.
...
For every female U.S. public high school student that completes the tutorial, DonorsChoose.org will send you a $100 giftcode for your classroom. As an extra bonus, they’ll also send you a $500 gift code when four of them are done!
Excited by the generous offer, I logged into Khan Academy to explore the new curriculum (Intro to JS, 2014). I found a new introductory programming course that is interactive, visual, and multilingual, available in English, Spanish, and Portuguese. The videos that accompany the tutorial are narrated by young, hip sounding female voices, a plesant change from the old white men that have almost exclusively been the faces of programming education in the past.

I had one student in my afternoon web application development class who was the obvious choice to begin exploring the curriculum, since she was already studying the JavaScript that was the focus of the Khan course.  I wanted to go for the $500 bonus, so I still needed to find three other female students willing to do the course.  Asking around, I found the three students - one independent study student, one student aid, and one geometry student willing to come in during lunch to work on the curriculum.

This afternoon, Mayra, the web development student, will complete the curriculum. Yanina and Daniela, the independent study student and student aid, are working together each day as they make their way forward. They are each about half way finished. Carmen, my geometry student, will take longer, since she doesn't have regular class time to work on it.

I've been watching the conversations, and laughs (like when Daniela used JavaScript to put a cat on her plate for breakfast) that Yanina and Daniela have each day as the work through the material.  It is apparent they are enjoying it, and from the quality of the questions they ask me I can tell they are learning. Daniela and Carmen are doing the course in Spanish.  Without this language support, they would not be able to complete it.

Well aware of the disparity between male and female students in computer programming, I've made conscious effort to take affirmative action to get more women into our web development program.  This has resulted in some success, with a dual-enrolled college program the Summer before last with half female students. Last Summer, with less sustained effort, the percentage of women in the Summer program dropped. The difficulties women have in getting into this field are well documented (Margolis, J., & Fisher, A., 2002), and I am committed to doing whatever I can to help make my computer programming classes available and welcoming to underrepresented students.

It is great to see Khan Academy developing what appears to me to be a very successful strategy to begin addressing the issue head on. Our school will now have a group of four female students who have been made to feel special because they introduced themselves to computer programming.  The are quick becoming a "team", sharing stories and supporting each other in learning. I am truly grateful to Khan Academy for making this happen!

References

Intro to JS: Drawing & Animation. (2014). Khan Academy. Retrieved April 22, 2014, from https://www.khanacademy.org/computing/cs/programming

Margolis, J., & Fisher, A. (2002). Unlocking the Clubhouse: Women in Computing. Cambridge: MIT Press.

Sunday, April 20, 2014

How to Think Like a Computer Scientist

In this blog post I want to explore the value of sharing educational resources by looking at the continuing benefits each of the contributors to "How to Think Like a Computer Scientist" have received from their efforts.

Fifteen years ago I began work on an open textbook called "How to Think Like a Computer Scientist".  Having worked on Summer curriculum projects in 1993 and 1994 organized by the visionary supervisor of Mathematics in Prince George's County Public Schools, Dr. Martha A. Brown, I had already seen both the power of collaborative educational materials creation as well as the show stopping limitations caused by the inability to effectively reproduce and distribute the end products of such effort. The World Wide Web was just beginning to appear at that time, and I began dreaming of the day when educators would be able to use it to create and share educational resources. The non-hierarchical nature of such collaboration would be liberating, I imagined, freeing the creative spirit within teachers who participated and providing direct educational benefits to the whole world. About 6 years later I had the opportunity to test this idea in practice, and now about 15 years after that I can look back and describe how it worked. 

I've just returned from Pycon 2014, the 12th annual community sponsored conference of the international Python community.  I attended the the 2nd annual education summit this year, and inspired by both the summit and the graduate class I'm taking this semester, I spent some time online researching the availability of open textbooks and other open educational resources, which appear to be proliferating at a sizable rate of late (Open educational resources, n.d.). 

While poking around these materials I came across a new interactive version of How to Think Like a Computer Scientist (Miller, B., Ranum, D., Elkner, J., Wentworth, P., Downey, A., & Meyers, C. 2013). I was aware this existed since Brad Miller emailed me when he started working on it back in May of 2011.  Unfortunately, I haven't been teaching Python during the regular school day for the last 5 years, so I didn't have time to get involved with this project, and it slipped from my mind. Rediscovering it now, I was amazed. As the overview page for the tools that Brad and David are developing illustrates, they are extending the document publishing tool we use in the Python community to include sophisticated assessment item types as well as visualization tools (Miller, B., & Ranum, D., 2013). They have packaged their work into a project called The Runestone Interactive Library (2014), and have a collection of books already using their tools. With the prospect of the STEM program for which I changed jobs 5 years ago finally emerging, it is time for me to get back into working on Python resources, and I am delighted to see how much progress has been made developing and enhancing the free tools to do this while I was away.

Looking back, I am struck by how much I have benefited from contributing to How to Think Like a Computer Scientist. I suspect that most of the other contributors would echo this sentiment. Here are some of the different versions of the book together with the people who worked on them:

1998: Original Java version by Allen Downey

1999 - 2002: First edition of the Python version translated from Java to Python by Jeff Elkner.  Professional Python programmer Chris Meyers joined shortly thereafter. Allen published this version of the book through Green Tea Press  (Downey, A., Elkner, J., & Meyer, C., 2002).

2002 - 2012: 2nd edition of the Python version, rewritten to be more "Pythonic" by Jeff and Chris (Elkner, J., Downey, A., & Meyers, C., 2012, April 12).

2012: Prof. Peter Wentworth creates the third edition of the Python book using Python 3.   (Wentworth, P., Elkner, J., Downey, A., & Meyers, C., 2012, October 1). He has since created a version of the text using C#  (Wentworth, P., 2014, March 7).

2013 - Present: Brad Miller and David Ranum create tools to make an interactive version of the book (Miller, B., Ranum, D., Elkner, J., Wentworth, P., Downey, A., & Meyers, C., 2013).

Without Allen Downey's original version of the book using Java, I would not have been able to make the switch to Python in my classroom back in 1999.  Because I did, Allen was introduced to Python (by "reading his own book" as he said in a preface to a later work).  Allen is now a regular author of books published by O'Reilly but still available as free textbooks, including his "Think" series.  Several of the books in this series, including Think Python, Think Complexity, and Think Bayes, use Python. When Peter Wentworth wanted to try Python in 2012, he benefitted by having a free book to start with together with the right to modify it to suit his purposes and the tools to make it easy for him to do this.  When he wanted a C# book a few years later, he could use these same tools and his own early book as a foundation to start from. When Brad Miller and David Ranum wanted to experiment with building new tools to make textbooks more interactive, they were aided by having a free textbook to which they could apply their work.

As I prepare to return to teaching computer programming and start working on a new textbook aimed at aspiring web developers (2014) , I will borrow from and build on the work and ideas of each of the other contributors to this project.  This blog post has actually only scratched the surface of documenting how and where this book has been used. It has been translated into many other languages, both natural and programming.  It has been read by people all over the world. I've received emails from people as far away as Korea telling me how much they appreciate this book being available to them online.  I'm glad for this opportunity to write some of this history down, and wish I had the time to dig further, but it is more important now to get back to work on the book.

References

Downey, A., Elkner, J., & Meyer, C. (2002). How to think like a computer scientist: learning with Python. Wellsley, Mass.: Green Tea Press.

Elkner, J., Downey, A., & Meyers, C. (2012, April 12). How to Think Like a Computer Scientist: Learning with Python 2nd Edition. Retrieved April 18, 2014, from http://openbookproject.net/thinkcs/python/english2e/

Elkner, J. (2014). Beginning Python Programming for Aspiring Web Developers. Retrieved April 18, 2014, from http://www.openbookproject.net/books/bpp4awd/

Miller, B., & Ranum, D. (2013). An Overview of Runestone Interactive. Retrieved April 18, 2014, from http://interactivepython.org/runestone/static/overview/overview.html

Miller, B., Ranum, D., Elkner, J., Wentworth, P., Downey, A., & Meyers, C. (2013). How to Think like a Computer Scientist: Interactive Edition. Retrieved April 18, 2014, from http://interactivepython.org/courselib/static/thinkcspy/index.html

Open educational resources. (n.d.). Wikipedia. Retrieved April 18, 2014, from http://en.wikipedia.org/wiki/Open_educational_resources

The Runestone Interactive Library. (2014). Runestone Interactive. Retrieved April 18, 2014, from http://runestoneinteractive.org/

Wentworth, P., Elkner, J., Downey, A., & Meyers, C. (2012, October 1). How to Think Like a Computer Scientist: Learning with Python 3. Retrieved April 18, 2014, from http://openbookproject.net/thinkcs/python/english3e/

Wentworth, P. (2014, March 7). Think Sharply with C#: How to Think like a Computer Scientist. Retrieved April 18, 2014, from http://www.ict.ru.ac.za/Resources/ThinkSharply/ThinkSharply/index.html

Friday, April 18, 2014

Senate Support for Free Textbooks

In a blog post on the Care2 website, Kevin Matthews writes about a bill introduced in the U.S. Senate last November which would help fund the creation of open textbooks (2013). The Affordable College Textbook Act, introduced by Senators Dick Durbin and Al Franken, aims to help address the skyrocketing cost of education by greatly reducing the amount that students have to pay for textbooks (Bill Text, 2013).

This bill strikes at the heart of the key question facing our society as we move through the 21st century - will we as a species be able to transition from the self-destructive organization of society around production for exchange toward the more rational and hopefully planet saving organization around production for use based on need?  It will not be easy even in this simple case to make the transition. As Mr. Matthews correctly points out,
Inevitably, the Affordable College Textbook Act will face criticism from people asking whether the government should get into the textbook industry at all and to leave the cost up to the "free market" (2013). 
The textbook industry will certainly use whatever lobbying power it can muster to make this argument, but as Mr. Matthews also points out, lack of student choice in which textbook to purchase make textbooks a very poor example of a "free market". Mr. Matthews also describes the process that textbook publishers have traditionally used to keep the used textbook market from providing any solution to the skyrocketing textbook costs - releasing new editions every few years to keep used textbooks from being usable.

Open textbooks can be read for free on the Internet or printed for a tiny fraction of the cost of traditional textbooks.This makes open textbooks a pretty compelling case of openly shared resources being of direct benefit to society.

By making the reproduction and distribution of open textbooks so inexpensive, the Internet opens the possibility of global access to educational resources on a scale never before imagined in human history. The only thing standing in the way of this access is the insuppressible urge on the part of the greedy to accumulate ever more at the expense of everyone else and regardless of the broader consequences. In his keynote address at Pycon 2014 in Montreal this past week, "Internet elder" John Perry Barlow summed up both the promise and the threat this way:
I felt there was something so naturally liberating about the Internet. That it was about connection; it wasn't about separation, which broadcast media obviously were. It was about a conversation, it wasn't about the channel. It wasn't about content, which is a word only recently derived when the containers went away. Note that. It's a code word for "We're a large corporation and we own all human expression and we call it content" (2014, 6:02).

References

Barlow, J. P. (2014, April 12). Keynote. pyvideo.org - Keynote - John Perry Barlow. Retrieved April 17, 2014, from http://pyvideo.org/video/2587/keynote-john-perry-barlow

Bill Text 113th Congress (2013-2014)S.1704.IS. (2013, November 4). Bill Text. Retrieved April 18, 2014, from http://thomas.loc.gov/cgi-bin/query/z?c113:S.1704:

Matthews, K. (2013, November 30). Will Congress Make College Textbooks Free?. Care2. Retrieved April 18, 2014, from http://www.care2.com/causes/will-congress-make-college-textbooks-free.html

Monday, April 14, 2014

eLearning 1

For the last several weeks of my Higher Education in the Digital Age course, I have been tasked with investigating and writing about a current topic (or a set of current topics) within the course purview. As a math / information and communication technology (ICT) teacher, I wanted to chose a topic that would be directly relevant to what I do in the classroom. Inspired by our investigations in class, I've been using several online resources this Spring with my students, including Code Academy and Khan Academy. I've also been maintaining my own online educational resources on ibiblio.org since 1999. Since the start of school this year, I have been hearing about flipped classrooms in professional development and staff meetings at work. At the Education Summit I attended at Pycon last Thursday, I learned that the MOOC platform edX runs on a completely free software stack, which has been released as a project called Open edX. This greatly increases my level of interest in exploring MOOCs, since I can do so without violating my commitment to software freedom.

My goal for our end of course investigations will be to some how tie all these things together, to look at how they relate to each other, and to develop a short to medium term plan for how to use these tools in my work as a teacher.  I'll also use this opportunity to jot down some thoughts on what a longer term plan might look like.

The first thing to do is to figure out if there is a single term that can be used to refer to all these differing tools and technologies, which have in common only that they make use of the World Wide Web. After poking around on Wikipedia, it seems that the best fit is the term eLearning.  Specifically, what I'm interested in is web eLearning. So for my current topics investigation I plan to explore how I can use web eLearning in my teaching.