Archive for the ‘School’ Category

Behold the Glory that is Object-Oriented programming!

Wednesday, May 7th, 2008

So, for my final project in CS 365 (Databases), I’m designing a Wikipedia-style encyclopedia. Not very original, but it gets the job done. And it’s kind of fun to code.

Until today, however. Since this is finals week, I’ve been concentrating on other things until today. The project is due tomorrow. I already had a lot of it done (strange for me, I know, but I’m trying to get out of here), and had seen a lot of e-mails over the weekend about how the DB server we were using was going down and back up as it was fixed. I didn’t worry too much, because as of last night it was supposed to be up and strong.

Imagine my horror, then, as I logged on to the site to see what needed to be done, and got all sorts of errors, most of them involving the MySQL server’s refusal to connect. Some pages, mostly display pages, were still working. So I could browse to articles, list them, and so on, but I couldn’t create or edit them. I was understandably upset, because I also couldn’t implement the access controls or categorization features that my proposal said I would.

After some investigation, I determined that the problem arose when I requested more than one SQL connection at a time. In theory, I only needed one at a time, but my architecture was designed around a Database class, which you could have more than one of. One class for one connection. I also had some static classes for doing things like manipulating articles, categorizing them, linkifying them, and so on. All the edit pages would usually verify that the article in question exists, then call these static classes to do what they needed to do. So the calling page was creating a DB connection, then the static classes would, in order to do what they had to.

My options were looking pretty grim. Do I switch DB servers, and troubleshoot that nightmare? Do I change my whole engineering scheme with T-minus 20 hours and counting?

After some general freaking out, I realized that my pages revolved around a static call in the Database class called getConnection(), which returns a connection to the default database. The wheels in my head started turning, and I realized that since every one of my requests for a database connection go through this method, I could somehow use it to save the day.

The trick was to create a static class member called $working, which held the connection to one, and only one, database. So I changed my code. From this:

public static function getConnection ()  
{
   return new Database();  
}

To this:

public static function getConnection ()  
{
   if (self::$working == NULL)
    self::$working = new Database();
   return self::$working;  
}

Since I essentially had a factory method to get the database connections to begin with, I merely needed to change this method so that it created the first connection, but didn’t do so on subsequent connection requests. Instead, it returns the already-existing connection. Since all my pages use this method, it means that they all use one and only one server connection. I changed the code, uploaded, and… voila! It worked perfectly.

Imagine the trouble I’d be in if I hadn’t done this to begin with. This is why I love OO programming. Because if you start with well-engineered code, then a major change like this can fix everything, and break nothing. Long live Object-Oriented Programming!

Update:I would be remiss not to mention that this is the Singleton design pattern, which my buddy and classmate Dylan pointed out I had omitted from the original post.

Kudos to the University

Thursday, January 17th, 2008

Whenever I mention the University of Montana, I’m probably in rant mode. But this time, I’d like to take a moment to give them some mad props. What’s the opposite of a rant? That’s what this is.

First, a little history. I’m starting my twelfth semester here at UM, and for ten of those semesters, I’ve had trouble with the financial aid office. Now, sometimes the trouble has turned out to be my fault: late FAFSA, reaching my credit cap, and s on. But most other times, something’s gone wrong on the University’s end. I don’t know how it works, but each explanation in those instances has sound unnecessary to me.

But this year, they got it right. By the spring ’06 semester, I had learned to be a hardass about getting my financial aid done — including visiting the line and asking if everything was going okay. No exception this year. My RTA room award, Pell grant, and SMART grant left me with a refund coming. I even finalized in December, way ahead of time. But when I checked my account around the new year, CyberBear told me (surprise, surprise) that I owed the full amount.

I guess it turns out that once you finalize your bill, all the financial aid on it disappears until the money really comes in. This is strange behavior and bad design, but I’m really trying to be appreciative here so I’ll avoid pressing the issue further. So I hit up financial aid, and they explained it. I got a little worried because I was told that the aid would come in after the deadline for payment, but they reassured me that I had finalized so my classes were locked in. This is my last semester (and I’m taking some low-level requirements like Technical Writing), so I need all the classes I’ve registered for. The day rolled around, and my registration stuck.

Then I worried about the aforementioned refund. I’m not complaining about my financial state by any means, but I’ve definately been scraping by since New Year’s Day. Once the financial aid appeared (just yesterday), I clicked the ‘request a refund’ link, only to be rudely told that I can’t request one. So I called the cashier and they told me that it would be handled automatically. Suffering from the ‘fool me once, shame on you…’ mindset, I worried. But today I checked my account and it was at a $0 balance, with the refund check listed as a ‘charge.’ It might even get here on time on Friday, so I can have some popcorn while watching Cloverfield. All in all, a good alternative to the usual drama I must deal with to continue for another semester here.

So I did a lot of poking and prodding, but it was all needless. Everything went off without a hitch this semester, and I’m glad, because now I’m leaving the school on a high note. This definitely makes me feel better about maybe taking Grad School here someday.

Wickedpistia

Tuesday, February 6th, 2007

I constantly find reasons never, ever to trust technology enough to become an astronaut.

Reason #1: The iPod-cum-brick. Today, there was an Adobe User Group meeting. On the way across the oval (which has recently become an uncrossable sea thanks to constantly freezing and melting ice sheets which once were snow. It’s pretty neat, because your shoes simultaneously come into contact with 1) water 2) ice and 3) mud, which means that you can get your shoes muddy, soak your feet, and fall on your ass, all at the same time!), I was listening to it just fine. Full charge, no problems, no skipping, nada. I put it away for the meeting. On the way back, the damn thing wouldn’t do anything! No apple screen, no iPod-sticking-his-tongue-out, nothing. I tried to fix it at home, first plugging it into its power adapter. No dice. Then my laptop’s USB. Still, nothing. Reset, reset, reset — zilch. The ‘5 R’s’ yielded no results. So now I apparently have a dead iPod. The worst part is that this isn’t the first time this has happened! About a month ago, I actually had to call tech support. For some reason (and this is before I got through, so the tech-guy-gadget-fixing-auro wasn’t in effect yet), on my twentieth attempt at restarting it (hold-on, hold-off, Menu and Center pressed and held together), it started working. Oh, yeah, and this isn’t even my first iPod! My first one died one day for similarly inexplicable reasons. Gee, Apple, you’d think for a grand total of $650 dollars I could possibly not by an unreliable piece of crap… twice.

Reason #2: Retarded torrents. For some reason (possibly the alignment of the moons), every time I’m downloading sweet TV shows via BitTorrent, nothing works. Usually, setting my client’s encryption to forced or enabled (whichever it currently is not set to) cures the problem. Not tonight. I tried four or five times, then snagged a torrent I knew would have seeds, all to no avail. So I got started on Reason #3 (see below) and came back to it after half an hour when — voilà — it started downloading. Of course, my episode of Heroes was going at 100 k/sec last night, but now, with only a third left, it was going at 20 k/sec, despite having the same number of seeds.

Don’t you love that? It seems that, regardless of your method of illicit p2p download (BitTorrent, Gnutella, even ancient Napster), you always wind up having 5 minutes left on your download for at least an hour, often more time. I assume my seeders are all d-bags who coordinate their efforts to frustrate me just enough so that I come back for next week’s episode.

Reason #3: Tried to write a paper about Python (the language, not the aeronautical beast). Finished it. Tried to upload it with the shitty Blackboard upload applet (that’s right! Start the JVM to accomplish something that can be done with a plain old HTML form!). Guess what? FireFox crashed! Tried in IE — now the whole box crashes! And I’m not running a bunch of crap software, as far as I know. After the restart, it went right up. But I found it amusing that submitting the paper took about 3% of the entire time spent on the damn thing.

Wait. It wasn’t amusing. It PISSED ME OFF.

By the way, while writing this I must have clicked out of the form text area and tried to delete something, because I hit backspace and immediately navigated away from the page. My blood boiled for half a second as I realized I might have lost this entire rant. To Blogger’s credit, it did warn me. But I’m so used to irritating popup messages that I typically click through familiar ones without thinking them through. Thankfully, I’m paranoid enough to copy and paste (
just did it) after ever sentence as a poor man’s save.

And I was going to try to install Windows Vista on my computer tonight. With my tech karma right now, the setup would probably error out so immensely, so enormously that I’d wind up reformatting my Mac’s hard drive, too.

Back From the Bo-Zone / inside

Wednesday, January 17th, 2007

Just got back from Bozeman a few hours ago. Jesse, AJo, Andy, Cullen and I went there to check out how their ResNet program compares to our DirectConnect program. It was informative, despite the fact that we spent twice as long traveling (eight hours) as we did doing what we came there to do (four hours). They’ve got complete control of their network (we don’t), so they can do stuff like VLAN switching and bandwidth control much easier than we can. Their web-based tools aren’t as pretty as ours, however. This is a result of my design-first, code-second philosophy.

We stayed at the Western Heritage Inn, which sounds like a front for a white power group (“Free racist mint on every pillow!”). We all played Mario Kart 64 until the wee hours of the morn; this includes my boss Jesse, which pretty much makes him the coolest boss ever.

On an altogether unrelated note, last weekend I finished vocals for inside, the new record that I’ve been working on for two years. Tracks:

  1. I Miss You – slow, moody homesickness song.
  2. This Could Be Any Day – uptempo piano pop with strings.
  3. Fret – a worried dirge.
  4. Temperamental – frenetic song about changing moods at the drop of a hat.
  5. Mary’s Plea – A synth-folk number about abortion.
  6. Jenny Lewis Will Never Go Out With You – The name says it all. Power pop.
  7. Here There Be Monsters – A riff-heavy song with horns and strings.
  8. Let’s Get Away – Lolling folk about hitting the road, Jack.
  9. Written Off – An angry folk song about cowardly homophobes.
  10. Soap – A peppy song about a shower (more philosophical than prurient)
  11. Torn – A synthy yet rocky song with beats.
  12. Polarize – Quasi-raggae horn-infused polemic.
  13. Glut of Food – Synthy
  14. The Highway – Folk-rock about Interstate 90.

It sounds pretty good. I’ll probably have CDPrintExpress run up copies again, considering the fantastic job they did on Pick Your Poison. I also have plans in the works for an EP by Page Fault, my hardcore pet project. It’s an EP called Two Minute Hate.

But first, I plan to record some B-side vocals over the weekend while I’m visiting my parents. A country song about finding god (“Lifted Up”) is first on my list. I haven’t really found him (perhaps he’s hiding under the covers), but I find songs like it beautiful. I would also like to re-record the vocals for “Synth Pop” (not its final title), a former album cut for inside but now relegated to B-side status. I might also do a ‘stripped’ version of “Written Off”, with just vocals and acoustic guitar.

Missoula Sold Its Soul (For Adult Contemporary)

Friday, October 6th, 2006

Well, the Rolling Stones are finally gone, having sucked the life out of our great city Wednesday night. They turned our quiet little campus into a madhouse of 40-somethings looking to recapture that ineffable feeling of youth and 18-somethings screaming “I can’t get no sa-tis-fac-shun!” out of their dorm rooms and reminding those 40-somethings that, hey, it’s okay to be old. Everybody was grabbing for a piece of the pie, and nobody’s hands were greedier than our very own University. It’s not enough to wash our credibility down the drain by signing an exclusive contract with ‘Killer’ Coke, they now sell our campus down the drain, too, just so some geriatric old fucks can waltz in here, play a few songs they penned 40 years ago, and make off with all our money and most of our pride, to boot.

From what I can tell from the reviews I’ve read, the Stones managed to do what everyone expected — they played a lot of hits, one or two new songs to remind us that yes, they’re still making records, and fire off a lot of fireworks to distract us. From what? From the maddening realization that the Stones hadn’t written a song that was actually relevent in two score years. It was all part of the show, the six story stage, the roaring spotlights, the old chestnuts, not new to anybody’s ears in decades, and we all suspended disbelief. Where the hell was the emotion? Somehow, these dangerous boys, who had the gall to declare their Sympathy for the Devil, were nothing short of… familiar. It’s hard to seem dangerous when half your audience is made up of people who have to be up at 7:30 A.M. so they can drop their kids off at school.

The emotion died a long time ago, along with the danger. It’s been replaced with glitz, with 70 tractor trailers and a six-story stage. It’s been replaced with 20,000 screaming fans, not screaming because they might share a moment with Mick or Keef, but screaming for the sake of… screaming. Real rock ‘n roll died a long time ago, certainly before I was born, and even the fringes — punk rock and death metal, for example — are gasping for air. It’s not rebellious anymore. It’s packaged. It’s merchandised. It’s $80 tickets. It’s 70 tractor trailers. It’s withered old farts, appealing to something they helped create, but not letting sleeping dogs lie, making a joke of the very thing they helped to create.

Letter to the Kaimin

Saturday, September 30th, 2006

Note: The ‘scene’ I was referring to was an all-too-common one: idiots on both sides of a debate yelling at one another. In this case, it was an anti-abortion raving lunatic with a sign depicting a dead fetus on one side and ill-informed college kids on the other.

Dear Editor,

The scene outside the UC on Monday illustrates the sad state of public discourse today. The context of the confrontation – preachers with signs shouting at passersby, and vice-versa – demonstrates that too often, these issues boil down to one group of idiots yelling at another. The abortion debate is tough because it involves an ethical decision. Factions on either side of the divide scramble to find facts that support their position, but they come up empty-handed. Sadly, there is no way to logically prove that one side or another is correct. We choose based on our own gut feelings about the issue. We cannot resolve the debate cleanly because no solution exists that would satisfy both sides equally. So in the heat of the moment, the pro-choicers and pro-lifers cannot recall the arguments they have constructed, and are left screaming epithets and trite, meaningless catchphrases like “My body, my choice” and “every life has value” at each other. Clearly they are in the wrong frame of mind. A solution to the perceived problem involves negotiation and compromise, not cursing and covering one’s ears. These solutions are not limited to just the abortion issue, but every political debate we engage in. Unfortunately, name-calling and sloganeering often elicit more of a response in people than level-headed debate, which is why scenes like Monday’s are all too common.

Overdue Notice

Friday, March 10th, 2006


3/9/2006

Mansfield Library Information Center
UM-Missoula

Dear David Michael Short:

The following item(s) must be returned to the location(s) indicated below as soon as possible.

Location: UM-Missoula
Notification Number: 1
Title: Mythical man-month : essays on software engineering / Frederick P. Brooks, Jr.
Author: Brooks, Frederick P. (Frederick Phillips)
Item ID: 33342000497831
Call #: 001.6425 B873m

Due Date: 3/2/2006

Location: UM-Missoula
Notification Number: 1
Title: GUI bloopers : don’ts and dos for software developers and Web designers / Jeff Johnson.
Author: Johnson. Jeff, Ph.D.
Item ID: 33342014010828
Call #: 005.437 J67g

Due Date: 3/2/2006

If you are liable for overdue fines remember that the fine increases the longer you keep the item. You may also be charged for the replacement cost if the item is not returned.

If you have questions or need assistance contact us at:
Location: UM-Missoula
Phone: 406-243-6734

Notice how they’re due back on the 2nd, yet the message is dated 3/9/06. Thanks for sending the overdue notice a week late! But hey, it’s a quick way to make $14, right?

Gawd.

Serendipity

Wednesday, April 13th, 2005

It’s half past midnight on a Thursday. I’m brushing my teeth in the first-floor bathroom of Jesse Hall. As the mundane events of the day tumble through my brain like grains of sand in an hourglass, I hear something. It’s quiet, but unmistakeable. “Ode to Joy.” Beneath my feet. Someone’s playing fiddle in the music practice room. Not super-fancy music-major pyrotechnics. Just good, honest-to-God fiddle.

I like to record music, and since I’m the only person I work well with, I like to do it alone. Unfortunately, my music misses the instrumentation I can’t play myself — pretty much everything but guitar, bass, and keyboards. Here’s a chance to get a real instrument in one of my songs, a musician besides myself. Of course, I have to get the building’s master key (I’m on the staff) to get into the music room. Would that seem weird to the fiddler under my feet? “Hi, I’m Dave, and I like to record music. Care to work with me?”

Or I could just go to bed. It’s late. Work is early tomorrow morning. And my teeth are brushed. What if the mystery fiddler is an exchange student, and I somehow intimidate him or her? What if they say no?

Ultimately, time becomes the deciding factor. As suddenly as it had started, it stops. I spit out my toothpace, race to the office, and grab my master key. At the elevator, I press both the down and up button, in case I catch the fiddler on his way up. He should be pretty easy to see, right? The guy with the fiddle?

I get to the basement and the door of the music room. No fiddling. I open the door, and there’s Nick. He’s a student in my building. We say hi when we pass by each other. We’ve even had one or two philosophical conversations. There’s a fiddle at his feet.

“Hi,” I say. “Wanna make some music?” I don’t have a fiddle part written. I don’t even have a song written.

But there’s plenty of time.

Submitted For Your Approval: PodBragger

Tuesday, April 12th, 2005

podbragger. Noun. One who wears those white iPod headphone but feels the need to always be holding his iPod, too, so that everyone else knows he’s actually got one and is not fooling us with a CD player.

Speaking as one of the apparently billions of people on campus with an iPod, I try to hide the damn thing. Not that I’m afraid of being mugged or anything. I just don’t wan’t to look like a podbragger. I’m kind of ashamed, since iPods became this big status symbol thing.

Hosed By Papa John’s and CampusFood.com

Wednesday, March 23rd, 2005

You know, I’ve used CampusFood a few times with varying degrees of success. They lured me in with a ‘free’ offer, where during a trial period you could have one item delivered to your room for free (less the tip for the driver).

And it’s convenient. I hate talking to people, because people can screw up. With CampusFood, all I needed to do was pick what I wanted. I could see my order in an itemized list, and even pay by credit card so I could get my food without any hassle whatsoever. Each delivery has been prompt and accurate — just the way I like it.

Until tonight. Tonight, I ordered a medium cheese pizza (on sale for $5.99) and two soda ($.99 each) for a grand total of $8.97 (there’s a one-dollar delivery charge). I have to confirmation e-mail to back this up; I didn’t just halucinate this price. I ordered this meal at 7:00. Having recently acquired a used PC, I figured I would clean my room and set up the PC while waiting. And that’s what I did. I cleared my card table, went downstairs and got a keyboard and monitor from the storage room, and hooked it all up. By the time things were clean and cables were connected, it was 8:00 and there was no sign from Papa John’s.

I gave it another half an hour and called them, perfectly reasonable. I hate confrontations (as you’ll see below). I asked where my pizza was, explaining that I ordered over the Internet. The young man (very polite) on the other end told me the printer jammed and my order would be here in half an hour.

It finally came an hour later, at 9:30. And apparently they charge me for extra time, because I was told the total was $13.22. Now, I could’ve caused a scene, explained to the delivery man that I ordered it for a certain price and that his price was about four dollars off. But of all the agents responsible, he is probably the lowest on the totem. So I had to go back to my room (in my naïvity I assumed that I could write a check for the amount the website told me and be ready) and write another check, this time for $15.50. I could have written it for exactly the amount, but it’s not the delivery guy’s fault. Delivery people rely a lot on income from tips, and I didn’t wanna punish him for what his highers-up are responsible for.

But that’s the last friggin’ time I order from either CampusFood or Papa John’s again. Between the two-and-a-half-hour delivery time and my fleecing, they’ve the both of them lost my financial support. The problem with automating something so complicated (eyes rolled fully into sockets) as the delivery of vittles is that the only person I directly deal with is least responsible for any screw-ups, and the other parties can each finger the each other for the blame.