Thursday, April 28, 2005

Why Must I be Easily Distr...Oh Look At the Pretty flowers

It has recently come to my attention that I get distracted too easily. This week especially has been difficult due to the massive distractions that have taken me away from my studying. For example, Sunday I planned on spending all day studying for my bio test. Unfortunately, my computer was sitting on my lap, and I had a sudden desire to read on on Qt for embedded devices. Specifically, I wanted to see if Qt had been ported to my MediaMVP, which it had. Then I decided I wanted to build the toolkit for the MediaMVP so I could hack on the firmware I used for it. This took more time. Then Catherine, Jerry, and Forrest came over to watch CSI, which took even more time. Eventually the clock struck midnight, and I hadn't really studied at all for the test at 9:00. I ended up studying until 3:00 am, at which point I gave up and went to bed. I'm pretty sure that I failed the test unless my guesses were more accurate than I think they were.

A similar thing happened on Tuesday night. I was supposed to be working on my OS lab. Instead, I was adding wraparound menus to my MediaMVP's firmware. It was really pissing me off that the file browser provided by the firmware would only let me scroll down when I was at the very top of the menu and wanted to reach something at the very bottom. I wanted a way to press up at the top of the menu and reach the bottom of it. So I did. It works pretty well.

As an aside (or distraction), the code I was working on was pretty awful. I use the MediaMVP Media Center firmware, which has some very cool features. I appreciate the hard work that I'm sure goes into the firmware, but I also get the feeling that the UI gets neglected in favor of working on the cooler hardware aspects of the firmware. Which is fine, as I'd rather people do that instead, especially since I know how to code GUI's and am not as fluent in the language of communication with hardware. But here's an example of the bad code I was working on.

static void key(mvp_widget_t *widget, char c) { int i, j; void *k; char *str; switch (c) { /*...*/ case MVPW_KEY_CHAN_UP: if (widget->data.menu.current > 0) { i = widget->data.menu.current; /**/ if (widget->data.menu.current < 0) widget->data.menu.current = 0; i = widget->data.menu.current; /*...*/ } break; /*...*/ case MVPW_KEY_CHAN_DOWN: if (widget->data.menu.current < (widget->data.menu.nitems-1)) { i = widget->data.menu.current; /*...*/ } break; /*In a different file*/ #IFDEF 1 /*do something*/ #ENDIF

You get the idea. In every single case statement, i gets set to the exact same thing. Why did they do it that way? I don't know. In this particular case the coding style's just very redundant and ugly, not necessarily horrible, though the #IFDEF 1 still confuses me. I spent Wednesday night trying to add a popup error message show up when the user tries to play a file they don't have permission to open when I should have been studying for my algorithms midterm today, and I should be studying for my OS midterm instead of writing all this. When will I learn?

2 Comments:

Blogger Arthaey said...

Oh my god, that dog has a poofy tail!

4/28/2005 10:38 PM  
Blogger Arthaey said...

But seriously. We should band together to keep from being distracted. ...like not doing this whole blog thing... Hrm. Drat... Poofy tail!

4/28/2005 10:40 PM  

Post a Comment

<< Home