Computing, Education, and Computing Education
RSS

Mod to wp-quotes plugin

January 4th, 2008   Posted by John in website | No Comments » speech bubble

The random quote that appears in the sidebar is powered by the wp-quotes Wordpress plugin. The full set of quotes from which it draws are listed on the quotes page.

As written, the plugin used only one field for the author name, which hampered flexibility. So I modified the database and the code to separate the first and last name of the author and added an author “note” field to accommodate second authors, dates, or affiliations. The quotes page is now sorted by author’s last name.

This collection of quotes pertains to computing, pedagogy, and technology in general. One of my favorites:

Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live.
– Martin Golding

Calendar problem revisited

January 3rd, 2008   Posted by John in assignments, cs1 | No Comments » calendar

Here’s a twist on the classic “What day of the week does a particular date fall on?” problem. A programming solution using the following approach would use several simple lookup tables, probably implemented as arrays, lists, or hash maps. I’ve translated the basic idea that I found here (via reddit) into something more appropriate for programming instructors and students.

The result can be calculated using the following formula:

dayOfWeek = (yearCode + monthCode + day) % 7

The result is an integer in the range 0 to 6, interpreted as follows:

ResultDay
0Saturday
1Sunday
2Monday
3Tuesday
4Wednesday
5Thursday
6Friday

As usual, leap year needs to be accounted for. If the date in question is in a leap year, the result should be decremented by one for the months of January and February.

The month code is a non-intuitive integer as follows:

MonthCode
January1
February4
March4
April0
May2
June5
July0
August3
September6
October1
November4
December6

The year code can also be determined using a lookup table, such as:

YearCode
20055
20066
20070
20082
20093
20104

Or the year code can be computed using the following formula:

yearCode = (centuryCode + twoDigitYear + (twoDigitYear / 4)) % 7

The two digit year value is the last two digits of the year (84 for 1984). The century code follows the 6-4-2-0 pattern below and applies only to dates in the Gregorian calendar.

CenturyCode
1600s6
1700s4
1800s2
1900s0
2000s6
2100s4
2200s2
2300s0

Happy programming.

What’s in a name?

January 2nd, 2008   Posted by John in website | No Comments » white rose

One of the best things about a life in academia is that it begins fresh every few months. Each semester there are new courses, new students, and new pedagogical challenges. And when your focus is computing, your topic is a moving target. So while we are guided by certain core principles, we must also continually evolve our knowledge and the strategies for communicating that knowledge to students. I suspect that all computing educators worthy of the name make changes to their courses almost every time they are offered. Thus the name New Syllabus.

That, and I was trying to find a decent URL and something that would pass a corporate name search.

I think I’ll add a version of this post to the new About page (sticking with the pedagogical slant).

Welcome

January 1st, 2008   Posted by John in website | Comments Off sun burstI’m finally getting around to creating a permanent web presence after moving to Virginia.I had glorious plans to get it set up right away, of course, which quickly fell apart as I gotswamped with a new house, new schools (I teach at two now!), and getting the family settled.More on the transition, and the reasons for it, later. Plus there have been some big projectsin the works. Somehow after giving up my “real job” I’m busier than I’ve ever been.I’ll use this site to post information about textbook revisions and supplements, and as avehicle for fleshing out ideas for new projects. I’ll also use it to manage course materials,though I’ll probably rely more on the web resources at the appropriate school for detailed courseinformation.Questions and comments are always welcome.