This blog no longer exists.
You will be redirected to something cool.

Friday, November 30, 2012

The Course Schedule Program

My school lists the course schedule as pictured. The search functionality is deficient in that it offers little customization in the "advanced search."

I would like to "pull" the entire schedule and do the following things to help me choose classes:

1.) Have an option to compare it to a list of classes I'm required to take, classes I HAVE taken, and any classes I'm currently schedule to take in order to finish school and return ONLY those that,
  a.) I haven't yet taken.
  b.) count toward major.
  c.) fit within my current schedule in terms of times and dates
  d.) I'm qualified to take. (In terms of pre-reqs.)

2.) Have functionality that allows me to see the maximum number of classes I can take during a semester. Preferably order combinations of classes in such a way that the schedule combo with the highest number of credit hours in listed first and the one with the least is (obviously) listed last. This would prevent crappy schedules that have weird times slots that make finding other required classes difficult.

3.) Allow me to see the professor score for a class section as reported by ( I won't need this to be searchable, but it would be nice to be able to see that data.

4.) Have functionality that allows me to prevent certain classes from showing up. For example, if I don't want to take AD 123 (even if it DID count toward my major), I would like to prevent it from showing up.

5.) Functionality to ignore the requirement that a class should count toward my major. This would be particularly helpful if I couldn't find a course within my major that would properly fit in my schedule.

(Perhaps this functionality would be the default behavior of the program and it the program would score class combinations based on relevance to requirements. In order to keep things from getting weird, create a credit hour limit for schedules of 19 credit hours.)

6.) Functionality to consider a "must-have" class (or two or three...) into the schedule. If I HAVE to take Awesome 101, section 4, with Professor Cool, I want to see potential schedules built around this.

7.) If I don't care for a professor, I would like to exclude him/her from my potential schedule.

How would I best achieve this?

I'm considering using Ruby (since that's what I'm most comfortable with), but I'm open to whatever (even Perl.)

My first instinct is to programmatically open the schedule with something like open-uri, and pull all course data. I was thinking of using nokogiri to search the data, but I think that throwing everything into a database and then querying the database would be a MUCH faster and MUCH better option.

My question is this:
What technologies would be best suited for this project? I literally have zero experience with databases except for a tiny bit of relational algebra (not enough to help me out in any way.)

It's probably also important to note that I would like to make this available for use on CodeGurl (mainly as a 'look ma, no friends' type thing), where a student can upload a spreadsheet containing classes they've already taken, classes they're required, and any must-haves, so any technologies related to deploying this would be helpful too. I've never deployed or packaged anything.

I basically need help with figuring out which direction to go with this. I beg you guys not to do the project for me (what would I learn? Nothing. And I'd feel like dirt.) However, any links, lists of technologies (and what problem they solve) would be GREATLY appreciated. Any technologies that are beginner friendly (have a LOT of beginners guides) would be FAB!


Sunday, November 4, 2012

Checking for Primes

I'm writing a script that will check whether or not a number is prime and I'm having some issues on how to do this.

If I take a number, lets say 100, and I want to check and see if it's prime I could do this:
-Divide it by all numbers 2..99 to see whether or not 100 is divisible by them. If not, it passes (it's prime.)
-Check whether it's divisible by 2. If so, it fails (composite.) If its not di
visible, truncate the result of dividing by 2 and check all numbers 2..the_result of dividing by two. This would significantly reduce the pool of numbers I would have to check, BUT I run into another issue...

If I choose to check whether it's divisible by 2, then, if it's not, move onto 3... and THEN if its not divisible by 3, I could really bring the size of the pool of numbers down to ~1/3rd of its original size...

However, when do I stop? At the 1/4 size? 1/8 size?

Optimally, I'd like to do as few operations as possible.

The code that produces the array is as follows: