By Ben Nitkin on
It's been a long time since I've written here. Nine weeks interning, two weeks in Colorado and three weeks camping put me away from this site for a while. I've made many things between then and now, and now I can write about it! On to the projects.
As the school year began, I found myself frustrated with scheduling. My schedule is simple enough. I plugged it into my calendar, memorized it, and voila. (Except that I keep going to the wrong room. Someone put one of my SparkE classes on the CivE floor.)
But, I'm living in a house with a few others and want to keep track of their schedules, too. I want to know when they'll be free for events and whatnot.
Everything I've seen for schedules is designed as a calendar. That is, they draw schedules for weeks at a time, with an emphasis on planning every day. They're very pretty, colorful, and have tons of features. They don't excel at producing a simple, readable schedule, and their data entry usually takes forever.
So I made a weekly calendar! In processing, of course. Always processing for graphics. It's so simple!
The little program I wrote draws a schedule showing either a 5- or 7-day schedule. It'll plot days from any start time to any end time, and notate it with either 12- or 24-hour time.
When the program opens, it prompts you for a calendar file. That's a simple tab-delimited file, formatted as follows:
Classname Location Days Start_Time End_Time
Electromagnetics AEC327 MWF 1:10p 2p
Solid State AEC430 TR 11 12:15p
It's only sensitive to tabs, so class names and locations can have spaces and other weird formatting. SMTWHFA are all valid days. (I couldn't find shorthand for Sunday and Saturday, so I picked S and A, respectively.) It'll parse almost any time format: with or without a colon, military time, am & a, pm & p, and it isn't case sensitive.
Internally, time processing begins by looking for an 'a' or 'p'. If a 'p' is found, the program sets a +12 hour flag. Any text following the 'a' or 'p' are stripped, then the time is searched for a colon. If found, it's split about the colon, and the minutes are converted to an integer, then divided by 60. Internally, times are stored as fractional hours. Finally, the time offset is added back in.
Colors are supported, but disabled internally. I'll be printing this on a greyscale laser printer, and anything besides a light grey would munge the text.
The program reads its input text file once a second, updating any changes. Internally, each line is stored as an object; all Class objects are stored in a list. As soon as the program finishes parsing, it draws up a calendar.
Keys are bound for loading and saving calendars. 'l' loads a calendar file; 's' saves a screenshot of the screen.
I built up a schedule for each of my housemates and my advisor. The fileformat makes entering events really, really easy. Next, I'll take these files and assemble them into an 8.5x11 page to hang on the fridge.
As always, source code below. Enjoy!