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 (ratemyprofessors.com.) 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!

-Melanie

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:

Saturday, October 20, 2012

My Sorting Algorithm: Melsort

A friend challenged me to a little algorithm writing contest and I'd never written an algorithm before (this was about a year and a half ago) and had little knowledge of algorithms.

Specs:
Write code that sorts an array of numbers from lowest to highest.
Use this array: [5, 2, 8, 0, 9, 3, 1]
Don't look up sorting algorithms.

It goes without saying that I was not allowed to Ruby's built-in sort method on the array => array.sort!
That would be cheating as the point is to create the code that sorts the array.

I thought of a number of ways to do this (I had a bubble sort-like piece of code that I never finished), but the quickest code I whipped up was this:


If the code is a bit hard to read, it does this:
I have two arrays. The original array containing unsorted numbers and an empty array where the sorted numbers will go.

Starting from zero, I count up one number at a time, checking each time if the number I just counted is in my unsorted array. If it does appear in the unsorted array, I add that number to the empty array. I stop counting when both arrays area equal (contain the same elements.)


There are two major problems with this:
1.) The code is unable to sort numbers with decimals.
2.) The code would be incredibly slow if the unsorted numbers were larger. For example, if the array contained 15 and the next highest number was 1587932057693576, the algorithm would count all the numbers in between 15 and 1587932057693576 before it could tell that 1587932057693576 was the next item to appear in the sorted array.

I won the contest as my sorting algorithm sorted the array faster than my friend's code did. However, considering the above problems, his code was far superior.

Spatial Skills on Facebook?

I recently took one of those Facebook feed reader quizzes where you let something read through your Facebook posts and it gives you some scores -- basically what kind of person you supposedly are. This isn't something I usually do, but I wanted to kind of play around with it and maybe come up with an analysis (and I did and it is as follows):

"Melanie is more spatial than 97% of people."

I can't agree with this. First of all, what does it mean to "be spatial"? Am I physically larger than 97% of people? Do I take up more space? Despite the ambiguity in the statement, I believe I know the intention: spatial reasoning skills.

I don't think there is a good way to determine, through my posts on social networks, what my spatial skills are.

I'll take the compliment, I suppose. I DO, in fact have a fairly 
high (in comparison to the general population:high; in comparison to a "genius": I'm an idiot, to be sure) visual-spatial ability, which is especially interesting given my gender (there was a study(1) that whose results showed that the more sexist a society is (toward women), the lower that females of said society score in a visual-spatial ability area of a cognitive test and that there is no known society where women regularly score higher than men. With this in mind, I highly doubt that I score higher than 97% of the population.(2.)

But, you do have to consider that this is a "facebook feed" test and that it's very possible that its results are wildly inaccurate. With this consideration in mind, you'd have to wonder why the test gives a spatial result. This result alone brings possible inaccuracies to the forefront given the formal nature of accurate(2) psychological testing.

1: I only know this because I dated a really sexist guy a bit back who provided this research as "proof" that men were somehow better than women. I took the research as proof that he was a dick. The study actually was fascinating, though.

2: There are some problems with this.
a.) It's likely they only compare you to people who have also taken the test. It was a Facebook app and as most apps go, they're a distant relative of glitter graphics. I was bored and decided to temporarily give my Facebook profile rabies so I could see what results this "test" gave me. Am I BETTER than everyone who installs an app? No, I install apps. Am I better than glitter graphics lovers. Probably. I'd need some empirical data to prove it, though, which definitely won't happen.
b.) Who says my posts are my own? I often share interesting things I find or maybe I'll post an interesting quote. In addition to this, my tweets are also posted to my Facebook feed and I often manually retweet things (copy and paste vs hitting the retweet button) which will cause it to show up on my feed.