Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Monday, March 26, 2012

Think Complexity by Allen B. Downey


Yesterday I picked up a physical copy of Allen Downey's new Python book Think Complexity.  Allen does a great job on both fronts in this book, presenting key topics in Complexity Science and also clear Python code.  

Last year some students and I worked on a Genetic Algorithms case study that was inspired by Melanie Mitchell's book Complexity.  Our work on the case study was NOT for any course and NOT for pay or credit in any way.  It was "just for fun", and we learned a lot together.  But... since Allen is looking for Case Study submissions, we just may be resurrecting the Python code we wrote and submitting a new chapter for the next edition of this great little book.

Saturday, January 21, 2012

On Choosing a Web Application Framework



The Skyline MAD Team (Mobile Apps Development) has produced 3 working apps from scratch, using HTML5, CSS3, a little JavaScript and some PHP.  During the process, students noticed that we could re-use certain parts of our code between the apps.  Of course this meant that we did a LOT of copying and pasting of code from computer to computer--not the best development situation by any means.

We had looked briefly at a form-based web application framework that we experimented with.  To their credit, my students felt uncomfortable NOT being able to see all the parts of the framework.  We also had little knowledge about which database was being used, etc.

So it didn't take long for some of my Python hackers to write up a couple helper scripts that would lead the user through making HTML forms.  Python did all the work pasting the proper tags around the content.  The only problem was that we found ourselves having to tweak the HTML later on because we were using JQuery Touch or some other toolset.

We like PHP, but it is not our go-to language for scripting--that would be Python.  Although I'm not currently teaching a Python course at Skyline, Python is still the most popular language choice from my top programmers.  So, with 10 minutes to go before I had to leave for an eCSite meeting in Boulder, one of my students, tritan67, asked if we could update our server's Python installation to include something newer than the 2.4 that CentOS uses internally.  I started to say, "no, I gotta go, so maybe tomorrow...", but when it comes to Computer Science, I almost never take that approach.  So instead I said, "What the hell, let's do it!"  The next 10 minutes saw us googling stuff, downloading Python source code, and finally installing Python 2.6 alongside the 2.4 version on the server--compiling it from source.  After all the recent debugging frustrations with the MAD Team, it was like going home again when the Python installation "just worked."

I'm still a bit surprised how easy it was.  Not only did we get 2.6 installed from source, but tritan67 jumped onto a terminal, wrote up a helloWebWorld.py and we confirmed that it was all working.

That was such a good feeling, that we started to immediately look for ways we could write our own framework using Python CGI scripts.  But--since there are more Python web frameworks than there are programmers--we figured we'd look into something like web2py or Django.

Haven't decided yet what we'll settle on, but it looks like either Django or the Google App Engine will be where we take this.  Of course I'd just prefer Django on our own server, but there's something to be said for the Google App Engine as a platform for teaching students how to make web apps.

Back to coding.  Python, we missed you a LOT.

Thursday, July 22, 2010

MacBook Pro Report Day One....

Today I got a brand new MacBook Pro that I will be using to teach Computer Science with.  For the last several years I have been exclusively using Linux, as it is my preferred OS.  However, I pushed for and got a new Mac lab approved for this coming year.  Although Linux was my home choice, the labs at school were all running Windows, and not running it very well. 

So after LMAOing for a while using Photo Booth's special effects, I got to work.  This puppy is gonna hafta be a strong programming machine, and what I learn on here will transfer to the new lab.

Earlier today I was visiting two of my students that have a summer internship with a local high tech firm.  One was writing some Python code on a Mac and commented about the default 8 space tabs.  Well, my first priority in setting up my MBPro, then, would be to get Vim configured correctly.

After struggling a little with those pesky End Of Line errors you get whenever going between Macs, Linux and Windows, I got Vim to do all the syntax highlighting and code completion that I have it do on Linux.  I posted my workaround to our programming forums, and called it a day.

Next step: install and configure Eclipse, Scratch, Alice, and so on....

Saturday, April 24, 2010

Chaos in the Classroom

 
 
The classroom can be chaotic at times, especially as Summer approaches, but this time it was all on-topic.  Well, actually it was off-topic, as we were supposed to be working on the Graphical Interfaces for our Spring Semester projects.  Nonetheless, I had been reading about chaos the night before and took the opportunity to show my class the basics of attractors in chaos theory.

I had thrown together a quick Python program that allowed the user to choose values to iterate through a chaotic function.  I pulled up a great image from wikipedia and showed how the numbers produced were just where they should be, according to the image.  One of my students said, "...now I want to make that graph!"  I said, "yeah, go for it." 

That night I did what I often do: code some of the same projects that my students are working on, just to keep sharp.  I used John Zelle's graphics module and produced the above image.  Not bad. 

Of course Josh--my best Java programmer--threw together a Swing version that has about ten times the resolution....