Streaming Video: A Rant From Twitter

August 7th, 2009

Why can’t streaming video player programmers EVER get their buffer size prediction algorithms correct? Or, failing that, just make them more fault-tolerant so they buffer more than is necessary to start playing? I’m watching Amazon video on demand, and golly gee, it would be nice if I had control to buffer as much as I wanted, instead of what the moronic algorithm programmed into it thinks is enough.

Other irksome things: When it has to re-buffer, it takes away the progress indicator. This is because during 33% of rebuffers, the connection cuts. This way, I have to guess where I was on the movie when I re-load the page. Amazon, I know you’re trying to idiot-proof your software, but can you please put up something so we have some semblance of control? All I want is a truthful indicator of the connection status, and control over the buffer… is that too much to ask?

Oh, one more thing: If I pause, that’s your opportunity to LOAD AS MUCH BUFFER AS POSSIBLE. I’m hoping some progress has been made since this rant started, but I highly doubt that.

Cut-Off Point

August 6th, 2009

I’ve moved this blog from its 6-year (!) home at Blogger.com to my own domain. I’m running the blog on WordPress now, and it has some features and options for customization that Blogger’s hosted account simply lacked. I’ve gone through and done a cursory tagging and categorization of old pages, but anything before this post will not be as shiny as newer content.

I also had to do some thinking about what exactly I want this blog to present. Going through my old posts, it was clear that the me from six years ago was very different from the me of today. As this blog is part of my website, which I present as part of my professional face, I’ve decided to bowdlerize some of the early entries. I took a lot of frankly emo content that was probably uninteresting to read anyway (well, more uninteresting than this blog’s standard, anyway!). I realize this material offers a glimpse into how I became the person I am today, but I have changed a lot since then. Some of the earlier content is more private than I would have admitted. I have also excised some of the self-righteous political rants, as well as some posts full of ‘offensive’ language and some content that paints my early-college character in a… less-than-stellar light.

In any case, since this stuff was posted on the web for years, it’s probably accessible somewhere. I realize I can’t pull a CIA-black-marker on my past, but I can try! What I censored wasn’t terrible; it was personal and often immature, and I’d like to present a better face to the world. So don’t think of this as a re-writing of my past, think of it as a promise to make future content even better.

Gay Marriage

October 2nd, 2008

According to both Biden and Palin in the VP debates, neither McCain nor Obama support allowing homosexual couples the right to marry. Someday, one or both candidates (or more candidates, God forbid there be third parties) will support this idea, which isn’t quaint, isn’t harmful to anyone, and essentially verifies our dedication to universal human rights, regardless of race, religion, or sexual preference. Hopefully, that time will come within our lifetime… but I’m not hedging my bets. Which sadly says a lot about the hatred that still bubbles below the surface of our society.

Code Monkey (Jonathan Coulton cover)

May 21st, 2008

This is a bare-bones acoustic cover of Jonathan Coulton’s song, “Code Monkey.” The cover’s nothing special, just something I did in between packing stuff. I recorded it live with my Mac’s mic, with very little processing: a little noise reduction here, a little bass reduction there. The hardest part was keeping quiet, since it is technically quiet hours in my dorm. Enjoy!

Download MP3 here.

Behold the Glory that is Object-Oriented programming!

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.

Smash Bros Brawl Has a Broken AI

May 6th, 2008

Try this experiment:

  1. Start a game of Smash Bros Brawl on Free For All. Use stock mode.
  2. Just play with one player, set the rest to CPUs on level 9.
  3. Start the game, and time how long it takes for the game to end.
  4. Now, replace yourself with another computer on level 9, and time that match.

Which game took longer? Nine times out of ten, it will probably be the all-computer match. Does the first game end quickly because the AI on Smash Bros Brawl is just that good, that three of them can usually beat a human player? Does the second game take longer because the computers are excelent players?

No, it’s because the AI is biased against humans. In FFA matches, the computers actually target the human players, leaving each other alone relatively. If you need proof of this, play FFA with two humans and two CPUs. If you and your friend are halfway decent and unbiased, you will probably be the last two standing. You can also try a 1v1 in FFA, you against a computer. It’s a lot easier. Even 1v1v1 is better. But when you get three computer players all ganging up on the one human, the game becomes a lot harder.

Need some examples of this bias? Read on. From what I’ve seen, Free-for-All with 3 CPUs is really a team match, human vs. 3 computers. The game has been kind enough to activate team damage, so every once in a while they’ll hurt each other. Here are some examples:

Final Smashes

This is where it gets ridiculous. They computer will, without fail, target the human players. If you happen to die right before a CPU gets the Smash Ball, that player will wait until you have come back to use it. If you wait up on your platform while you’re invincible, so will the CPU. He will not even consider using his Final Smash on his teammates. The other CPUs will not even consider trying to take it from him. The most ridiculous cases are Lucas or Ness. It looks like the programmers gave each character a final smash AI, so they know how to use it. A lot of characters (Captain Falcon, Meta Knight) need to be close to use their smash. Ness and Lucas don’t, however. Their final smash is screen-wide. But they usually try to get near the human player before they deploy it.

Even worse are the Final Smashes that involve controlling direction. For example, the Star Fox characters use their big, stupid tanks. Sonic flies around the stage, as does Pikachu. It’s especially fun to get into a corner where Fox’s tank can’t reach, or to lead him somewhere he’ll get stuck. If you stand still, he’ll try to get at you but not go anywhere, even if the other CPUs are easily accessible. Similarly, Super Sonic or Pikachu will try and hammer you. They might hit another CPU in passing, but they’re not fooling anybody.

Dragoon

This is the most infuriating. True, you can dodge it, but you need split-second timing. If one CPU gets this, he will target you mercilessly. Even if the other two CPUs are standing in a tempting cluster, the CPU will prefer hitting the human player for one kill over getting the other two computers for two. Like with the Final Smash, if you die just before they get it and wait to come out, the CPU will wait until your invincibility wears off before attacking you.

The Chase

Try playing a large stage, like the Zelda Castle or the custom ‘Maze’ stage. Right at the start of the match, run from the CPUs (all three will immediately begin chasing you when the match begins). You can lead the other three CPUs on a chase, round and round the stage. They will occasionally take swipes at each other, but they’re only love taps.

No unbiased person can argue that the CPU itself is unbiased. They hate human players. They even taunt the humans after they’ve killed them — but not other computers. Way to rub it in, guys.

So what can you do? Well, you can always play with at least one other human. People may develop grudges from time to time, but they usually mix it up after they’re told to piss off and stop targeting one person. You can’t do that for the AI. Unfortunately, if you just want a quick game by yourself, you’re SOL.

I’ve tried playing 1v1v1 in team mode, with me on one team and the other two players on different team. It seems to end up the same way.

For now, I guess we’ll just have to treat FFA like a team match, humans vs. robots. The Smash Bros Brawl AI is not the hardest alone, but with three ganging up on you, the sheer force of the numbers is enough to trip you up. The only upside to this situation is that if you keep practicing, you’ll probably get really good against other humans.

I shook hands with the next President of the United States

April 5th, 2008

Went to the Missoula Obama rally at the University today. Lots of people getting signatures in the line, which stretched at least as far back as the Music Building, and probably much farther than that.

What can I say? The rally was bitchin’. There was a bit too much buildup, but it was worth it. Obama is just as eloquent a speaker as he’s made out to be. He couldn’t have picked a better town, since we tend to lean so far to the left here. He managed to tailor his speech to Montana without it feeling forced. Probably the biggest reaction he got was when he mentioned that no matter what, George W. Bush would not be on the ballot here. We Missoulians really, really don’t like the guy.

Now, I’d prefer someone like Gravel as president, but he obviously won’t be (he’s kind of behind in the delegate count). I consider myself a libertarian, but I lean to the left, so that’s where I tend to vote. And I’d rather not see McCain in office, because I’ve become rather fond of my civil liberties (those I have left, that is), and it’s pretty clear he’s just a Business as Usual type of guy.

As far as the Democrats go, Hillary’s just dragging her heels along the slow path to irrelevance. Every day she finds a new way to prove that she’ll do or say anything to become president. When you get down to it, it all comes down to attitude. They have fairly similar politics. Obama’s is one of support, of doing something for the American people. Hillary’s, on the other hand, is one of ambition, of doing anything to become the first woman president.

Plus, I really don’t want to see our line of political succession go Bush, Clinton, Bush, Clinton. Then, Jeb Bush could run, and after him, Chelsea! Blahh 😛

Democrats grow temporary spine…

March 15th, 2008

Kudos to the House for blocking retroactive immunity to the telecoms for being complicit in the wiretapping of Americans. I considered this issue important enough to write Denny Rehberg about, and I got a response — straight along party lines. I don’t have the original letter I wrote, but I essentially took the standpoint that Montanans have been steamrolled by large corporations enough as it is, so as a Montanan Rehberg should realize that giving any sort of immunity to a corporation for any reason is a bad idea. His response?

The Protect America Act brings the outdated Foreign Intelligence Surveillance Act (FISA) of 1978 into line with current technological capabilities while adding appropriate liability protections for patriotic third parties who have helped defend our country.

The House of Representatives must pass this critical legislation without delay to ensure that Americans are protected from those who want to do us harm. I will do everything I can to ensure that these important protections are reinstated.

Sorry, Dave, the national agenda of the Republican Party trumps any obligation you may think I have to my constituents.

He lost in the end, as the house passed a bill refusing such retroactive immunity. This is actually a good, good thing. Bush and his cronies are trying to play the fear card. In the NY Times article, Bush is quoted as saying, “Companies that may have helped us save lives should be thanked for their patriotic service, not subjected to billion-dollar lawsuits that will make them less willing to help in the future. The House bill may be good for class action trial lawyers, but it would be terrible for the United States.”

This is bad logic, and it’s not very difficult to see why. I’m not surprised that you have no grasp of how our government works, Mr. President, but the scenario you described is not sufficient to change it. We have these things called checks and balances to prevent any one branch of the government (there are three, by the way) from overstepping its bounds. It’s also why you can’t declare war any time you want… oh, wait, scratch that one.

Anyway, the decision to take away Americans’ right to file suit against the telecoms for breaching their civil liberties is not Congress’s to make. All companies should be subject to “billion-dollar lawsuits” all the time because, let’s be frank, corporations don’t really care about the people they may hurt. The decision about whether the telecoms were complicit in violating Americans’ rights belongs to the judicial branch alone, and should be decided on a case-by-case basis. The legislative branch should never, ever preempt the courts’ ability to provide a path to justice for American citizens.

Taking away our ability to defend our rights and seek justice is a bad, bad idea. It essentially sends the telecoms the message that it’s okay to allow this kind of paranoid eavesdropping, and to go ahead and continue doing so, without fear of reprisal. Retroactive immunity is never a good idea. When you grant it, you acknowledge that those given immunity did in fact do something wrong, while at the same time declaring that nothing should be done about it.

Of course, Bush will veto any bill that attempts to seek justice the moment it arrives at his desk. But he’s on his way out. And there may be someone else in the White House soon enough to undo a lot of damage done by the president. That’s a good thing to think of (actually, there is more than one person who would probably do that, but I’m talking about the guy who will actually make it to the White House).

Bad Vista UI! Bad!

February 11th, 2008

We all get to a point where our open window account in Explorer skyrockets. I use the ‘Run’ dialog to get to a lot of places, which opens each directory in a new window. So I often find myself with all my Explorer windows grouped together on the taskbar, and something like 16 or more directories in the listing. It’s natural to just want to ‘reset’ things and close them all.

But beware! The Explorer group includes not only your directory windows, but also any copy jobs going on. If you right-click and choose ‘Close Group’ when you are copying, your job in unceremoniously canceled (which itself could take a while, depending on how cranky the Vista copy routines are that day). God help you if you happen to be copying many gigabytes of files.

This is bad user interface design. Directory windows and copy windows should not be grouped together. A directory window displays information, while a copy windows displays a process. Yes, they run in the same program (Explorer), but they are two absolutely different things, and should be grouped together into two separate groups on the taskbar. A less-correct alternative, but probably easier to implement in software, would be to close all the directory windows, then ask the user — for each copy job — whether or not the copy should be canceled.

Kudos to the University

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.