Hacker News new | past | comments | ask | show | jobs | submit login

How did you test such a script?

I always thought about doing this, but since class signups only opened twice a year (once per semester), and that was the same time I needed to actually sign up for the classes, I concluded there would never be a time to debug and refine such a script.




At my school the class signup system was open after the initial set had been loaded in to IIRC 2 weeks after class starts. This allowed students to shuffle classes around as needed, and it also gave me the opportunity to write a script against its interface.

In short, you gave the school a list of the classes you wanted to take. The school loaded everybody's information into the computer and had it make the first set of assignments. Then you got back the schedule and discovered that the computer had put you in classes at 7AM, 11AM, 4PM, and 6PM MWF and only one class on TTh so you had to go in and shuffle your classes around until you got a reasonable schedule. Or you would discover that all of your electives filled up before you had a chance so now you're in a fight to get into the classes.

It sounds all Mad Max, but the schedules were in such flux that it was usually possible to get the classes you wanted. I only remember getting screwed once, on a mandatory class with only two or three timeslots and one of which was highly undesirable (7AM MWF) and the other two timeslots never had an opening. Worse, the professor for that class had a heavy accent and tended to drone slowly in a monotone.


I've written a couple of scripts over the years to email me when certain things happen on things I don't own, and as long as you're cool with a few false positives, it's not too difficult.

Say you're waiting for something on a website to become available. I'd look for some language on the page about availability that's likely to change when available. I don't know what they're going to change it to, but I know that it'll (probably change). I set up a script to run every few minutes to check that particular spot on the page. If it changes, I get an email.

Maybe I got an email when it changed from 'unavailable' to 'available soon', but that's okay, that means it'll definitely work when it's available for real.

There's always a chance that it won't work, but if you can reasonably assert what is likely to change, it's very easy to monitor it.


I've written this type of script before - I didn't need too much in the way of debugging. Mine (similar to GP, it seems) didn't actually do the registration, just save the current state of known divs or even the whole page. Then it would send me an update if that changed.

So, I didn't need to debug what happens when the class shows "open" - I just saved the div that said "closed" and sent myself an email/text any time it didn't say exactly that.


You could test it by having it sign up for undesirable classes like underwater basket weaving that had plenty of openings. The terminal interface was kind of gross to script, but the underlying data was pretty easy.

You basically had to just send the correct number of arrow key presses to get the cursor to the correct field, send the digits, and then send the enter key. Parse the data that comes back, and add the routine to cursor over to the "add course" prompt when it says there is an availability. The script was totally gross looking but it worked.


When I was in school, I just had a python script that diffed the relevant part of the web page, and sent an email/SMS to my cell phone on any changes in the output. It didn't automatically do the registration though, which would have been slick.


Ah, sounds like your school's setup was different than mine. Our class signups opened once, at a set time and day, and it was just a matter of clicking the signup button fast enough. If people dropped, the spots would go to people on a waitlist, also determined at the original signup time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: