Saturday, December 29, 2012

I recently installed RhodeCode onto Simpson's server. Awesome program, but setup isn't quite as easy as I'd like. So here are my notes, in case anyone else is interested.
I relied heavily on the following sites for information:
Installation was done on a Debian Wheezy system.
First, become superuser.
sudo bash
Install pre-requisites.
apt-get install python-all-dev python-pip python-mysqldb rabbitmq-server python-virtualenv libmysqlclient-dev
easy_install -U distribute
pip install mysql-python
pip install virtualenv
Set up the message queue system.
rabbitmqctl add_user rhodeuser mypassword
rabbitmqctl add_vhost rhodevhost
rabbitmqctl set_permissions -p rhodevhost rhodeuser ".*" ".*" ".*"
I prefer mysql for the database. Set this up.
mysql -u root -p

create database rhodecode character set utf8; 
create user 'rhodecode'@'localhost' identified by 'mypassword';
grant all privileges on rhodecode.* to 'rhodecode'@'localhost';
flush privileges; 
exit
Create a directory for installation
cd /var
mkdir rhode
chown www-data rhode
cd rhode

virtualenv --no-site-packages /var/rhode/venv
cd /var/rhode/venv/bin
source activate

cd /
pip install pastescript
pip install rhodecode

cd /var/rhode/venv/bin/
wget http://ncu.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz
tar -zxf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
python setup.py build
cd ..

paster make-config RhodeCode production.ini
Edit production.ini so it looks like this:
vim production.ini
# -----
use_celery = true
# broker.host = localhost
broker.vhost = rhodevhost
broker.port = 5672
broker.user = rhodeuser
broker.password = mypassword

# Find this line and change to:
sqlalchemy.db1.url = mysql://rhodecode:mypassword@localhost/rhodecode
paster setup-rhodecode production.ini --user=rhodeuser --password=mypassword --email=paul@cravenfamily.com --repos=/mnt/hg_repos
/etc/init.d/rabbitmq-server start
See if celery works and hooks up to the message queue. If it does, hit ctrl-c and go to the next step. If it doesn't, debug before continuing.
paster celeryd production.ini
Start running. Then see if it works.
paster celeryd production.ini &
paster serve production.ini
I really wanted to use wsgi to serve stuff up. But I couldn't get authentication working. I am sad.
vim apache.conf
----
    WSGIScriptAlias /repo /var/rhode/venv/dispatch.wsgi
    WSGIPassAuthorization On
    WSGIDaemonProcess rhodecode user=www-data group=www-data threads=1 processes=10
    WSGIDaemonProcess pylons \
        threads=4 \
        python-path=/var/rhode/venv/lib/python2.6/site-packages

More wsgi stuff I didn't get working.
vim /var/rhode/venv/dispatch.wsgi
------
import os
os.environ["HGENCODING"] = "UTF-8"
os.environ['PYTHON_EGG_CACHE'] = '/var/rhode/venv/.egg-cache'

os.chdir('/var/rhode/venv')

import site
site.addsitedir("/var/rhode/pyenv/lib/python2.6/site-packages")

from paste.deploy import loadapp
from paste.script.util.logging_config import fileConfig

fileConfig('/var/rhode/venv/bin/production.ini')
application = loadapp('config:/var/rhode/venv/bin/production.ini')

To get the pass-through proxy working, this is what I did. First, enable the proxy mods:
a2enmod proxy_http
a2enmod proxy
a2enmod mod_headers
And some other stuff. I'll finish my notes later.













Thursday, October 4, 2012

Computer Science – Simpson College

Rather pleased with the customization we've done four our website: Computer Science – Simpson College

Friday, September 21, 2012

Flipped Classroom

A "flipped classroom" is one where students watch lectures at home and do their homework in class. The Kahn Academy has done wonders in helping instructors with flipped classes.

I decided to try it with my class that introduces computer programming. My hypothesis: I could get more students to post excellent grades with this method than the traditional method.

Over the summer I worked on this website.

I put the lectures on-line. A total of 55 videos, over 6 hours of run time. Most videos are short. I used a graphics tablet to mark up the screen during the video. I got a good microphone and edited the videos to remove annoying sounds, mistakes, or other distractions.

The full text of the book is on-line. There are code examples and JavaScript animations that animate the code to visualize what is happening.

I created a multiple-choice quiz engine to test the students on-line. That helps make sure they actually went through the material.

The website got a lot of positive feedback from the community-at-large, I was helping more students learn programming on-line than I was in the classroom.

It seemed like everything ready for a full test of a "flipped" class this semester. The first real results would be from Test 1.

I started getting worried when there were students doing worksheets in class that had clearly not watched the lectures or gone over the material first. Plus my "draw a picture" lab had fewer images that really showed off the creativity of what students were able to do.

The results of Test 1 confirmed my worries. It showed a noticeable down-tick in grades compared to prior years. Was it terrible? No, there were still a lot of "A" grades. However there were more students on the C-F range than what I normally get. It seemed like a "flipped" class was allowing more students to slip through the cracks than before.

My conclusion, the data did not support my hypothesis.

Here are more hypotheses I have:

  • Students who don't want to do work outside of class still don't. They gain more from having the traditional lecture in-class and not doing the homework. In a flipped class they skip watching the lecture and just copy worksheets resulting in even less comprehension.
  • Fewer students will become inspired by the material and want to explore a career in that area. Students that aren't willing to ask questions about worksheets have little interaction with the instructor. Those students are less likely to be inspired by the instructor because they don't get to regularly see how excited he/she is about the material.
  • A flipped class will work well in an evening class. Evening classes with working adults have a high drop-out rate for an introductory computer science course. I think that teaching in a 'flipped' manner will result in higher scores for these students even if they result in lower scores for day students. Meeting four times a day, is better than a flipped class, which itself is better than meeting one time a week. 
  • The 'flipped' class scales well. It will still perform 'well' with an average instructor and will involve little work on the instructor's part if the material is already created. e.g., a teacher that doesn't understand calculus well can still do a good job teaching calculus with help from the Kahn academy. Or a teacher can have more students in a class and still teach them. But neither can match a great teacher in a small class.
At some point I'll do a survey and see if I can't get more information from the class. I'm going back to my traditional methods for now.

I am still reaching a lot of students who have never set foot at Simpson. So I don't think the effort spend on the website is a waste. But I'm not improving the scores of my class doing this.

Wednesday, September 12, 2012

Prototyping an Arduino and Nixie Tube clock

I finally got an Arduino I could dedicate towards my steampunk clock project. I have an LCD display and Nixie Tubes to pair up. Here's a video of what I have working as of tonight:

You can see that on the lower left are my four Nixie Tubes showing minutes and seconds. Eventually it will just be minutes and hours, but that doesn't make for a good demo video. On the right is the Arduino and LCD shield hooked up to a Chronodot. The Chronodot also has a thermometer.

In the background is the power supply. The project is pulling 0.38 amps at 12.1 volts.

I like the LCD shield from Adafruit. I had to solder the LCD shield together, which I wasn't big on, but I like the ability to change colors and the integrated buttons:


The circuit layout is pretty simple, courtesy of Fritzing:

The software uses this Nixie Tube library, and also this Chronodot library.


Thursday, September 6, 2012

Arduino Nixie Tube

Update: See the finished project here.

The Nixie Tube [link] from DFRobot.com was ordered Monday night. It was shipped Tuesday from Shanghai, China and arrived here in Iowa two days later on Thursday!!!

Opening the package revealed a DFRobot package.

Looks nicely packed with foam. Also included a pre-drilled plexiglass board for the four tubes I ordered. Cool, didn't ask or expect that.

Foam removed.


I downloaded the sample code and looked at the Wiki. Managed to hook up one module to power and do hit the test button with no issues. I hit the test button with a stick since it cautions the on-board voltage can be up to 170 volts.

Hooked it up to the Arduino and ran the breathSample from the code examples and got:
My plan is to create a steam-punk style alarm clock with these as a personal art project.

Thursday, August 23, 2012

Getting the CMPS03 compass to work with the Arduino

Code for testing a digital compass using Arduino UNO

/*
CMPS03 with arduino I2C example

This will display a value of 0 - 359 for a full rotation of the compass.

The SDA line is on analog pin 4 of the arduino and is connected to pin 3 of the CMPS03.
The SCL line is on analog pin 5 of the arduino and is conected to pin 2 of the CMPS03.
Both SDA and SCL are also connected to the +5v via a couple of 1k8 resistors.
A switch to callibrate the CMPS03 can be connected between pin 6 of the CMPS03 and the ground.


*/
#include 

#define address 0x60 //defines address of compass

void setup(){
  Wire.begin(); //conects I2C
  Serial.begin(9600);
}

void loop(){
  byte highByte;
  byte lowByte;
  
   Wire.beginTransmission(address);      //starts communication with cmps03
   Wire.write(2);                         //Sends the register we wish to read
   Wire.endTransmission();

   Wire.requestFrom(address, 2);        //requests high byte
   while(Wire.available() < 2);         //while there is a byte to receive
   highByte = Wire.read();           //reads the byte as an integer
   lowByte = Wire.read();
   int bearing = ((highByte<<8)+lowByte)/10; 
   
   Serial.println(bearing);
   delay(100);
}

Thursday, August 16, 2012

Getting started with Arduino robots

The Arduino microcontroller has finally made robotics work fun. I've worked with other microcontrollers such as RoBoard, Freescale, Parallax, and found them to be more frustrating than fun. The Arduino has changed all that in my case. This shows what I've been able to do with just a few evenings.

In the first evening, I was able to get an Arduino board to drive some LEDs within just a few minutes.


A little more work, an I have motors and servos working. By the third evening, I had my first autonomous robot using one ultrasonic sensor for obstacle avoidance:


I made version 2.0 of my robot, so that I could have more breadboard space, giving me an LCD display and two ultrasonic sensors:


The ultrasonic sensors had to be polled separately so they did not confuse each other. A bigger issue was the the robot no longer turned well. The front wheel does not turn, and the robot was now heavy enough that the front wheel no longer easily skidded sideways, like it did in version 1.0 of my robot.

Yesterday in the mail I got a different wheel I ordered that solves this problem, by having small rollers on the wheel allowing it to slide sideways. So here is version 2.1 of my robot:


I'll be adding a magnetic compass soon, and eventually starting version 3.0 of my robot.