Archive for August, 2006

QtRuby QApplication “limit of one” workaround for Unit Testing

So I’ve been working with QtRuby a lot the last few days. I’ve also been playing with unit testing thanks to drutro’s quick runthrough of it. The project I’m working on is a top-down view videogame, which at it’s base level requires loading up some images. The problem is using Qt::Pixmap requires that a QApplication exists. Now this in and of itself is annoying, but not a showstopper.

What becomes a showstopper is building a test suite when each test file has it’s own QApplication- you see, you can only have one QApplication at a time. So I thought “well, I’ll just build and destory the QApplication in the setup and teardown functions of the Unit Tests- then I found out that oh you can’t destroy a QApplication. They stick around and it’s like you never removed it. So I tried the Qt-4 ruby bindings and got the same result.

At this point I was getting damn frustrated. You couldn’t just put the QApplication in the suite or the test won’t work. you can’t put the QApplication in the tests or the suite won’t work… Then it occured to me that perhaps I should do both- so I found A LEGITIMATE USE FOR GLOBAL VARIABLES:

if ( ! defined?($qApp) )
    # Qt needs an application object to exist before loading a pixmap.
    $qApp = Qt::Application.new(ARGV)
end

I put that in the bottom of each test and in the suite as well and now it’s all happy. I hope people find this reference on google if they’re trying to do unit testing with QtRuby and find this problem. You can thank me by sending lots of money to paypal@ this domain 🙂

Update
after talking with rdale, it turns out that qtruby has a variable set aside for this called $qApp- I’ve changed the variable above to reflect this.

fun with forms

I recently signed up for a form with a bunk email address for something or other… for my name, I put in something amusing rather than my real name because, hell with them, I don’t want them sending me stuff. I even checked the little box so they wouldnt…

sure enough, they spammed me. how can I tell? well, the bogus account I used gave it away, but they addressed each message by the first name I gave them…

Udev + wacom on gentoo: dynamic links

I have a wacom drawing pad, and one thing that’s always bothered me was the whole way linux handled usb items- depending on the order they were plugged in, they would be given different names- sometimes my keyboard would be “/dev/input/event1”, sometimes my wacom or mouse.

Udev was made to get around these issues, but I’ve been to distracted to give it much thought. lately I’ve been getting the following error messages with my ruby projects:

X Error: BadDevice, invalid or uninitialized input device 165
  Major opcode:  147
  Minor opcode:  3
  Resource id:  0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 165
  Major opcode:  147
  Minor opcode:  3
  Resource id:  0x0
Failed to open device

and figure something screwy with my usb is the culprit. So with my sights set on an acceptable scapegoat, I delved into udev. I found a great walkthrough for writing udev rules that gave me exactly what I needed. 20 minutes later, I had the following gem:

BUS=="usb", DRIVER="wacom", SYMLINK+="wacom"

That’s it. Now my wacom will always be /dev/wacom, and I can configure X to always use it. not sure if this will fix my error, but I’ve been meaning to do this for a while, so I’m glad I finally got around to it.

Pissed off vs. Pissed on

Today I find myself a little of both.

I was called into the confrence room today and told that the company I was contracted to requested that today be my last day.

Yes, I am officially unemployed.

Fortunately I was laid off, not fired- turns out business wasn’t as good as they were hoping and they can’t afford someone to try and fix their broken infrastructure. Since they fired a developer a few weeks ago, and the lead developer put in his 1 week notice today, I can’t say it’s suprising- if they’re getting rid of me after losing two other people, they must be hemmoraging money pretty badly.

The worst part is, not only did I see this coming, but I worked my ass off there knowing it was coming. I was hoping they’d at least have the decency to give me some severance pay, but apparently since I’m just a contractor they don’t feel the need. They did however give me a nice 1 paragraph recommendation letter- I guess that makes up for laying off a guy with a kid on the way who they shouldn’t have hired if they knew they wouldn’t be able to afford him.

I’m pretty pissed off right now because I feel like I made a mistake coming back to michigan- I won’t be able to find work around here since I’m pretty specialized (michigan is Microsoft territory, and at this point I’m pretty specialized in linux) and the economy is crap to boot.

The worst part about all of this is jackie and I went so far into debt to move back and we still haven’t dug out. Now jackie’s pregnant and my hopes for employment are slim to none, and we couldn’t even afford to move somewhere else if we wanted to because our credit cards are maxed out from the last move.

I feel pretty bad for the other sysadmin because they’re gonna crap back on him again and he’s just gonna take it. The Devs are screwed because I did a lot to make their development environment more professional- seperate user accounts, testbeds, standardized development/beta/production servers, version control, etc- most of that will go down the shitter because it will all be neglected if it’s even kept at all. the other sys admin will probably either format them or ignore them.

It’s been a hell of a day, and I need to take a shower still after my walk- then I’m going to bed. If you know of anyone looking to hire a Linux Sys Admin or a perl/php/ruby developer (or some combination of either), send them my way.

Fatso walks continue

missed friday night and saturday due to being out of town, but I’m still walking. With the exception of those two days, it’s been every night for 2 weeks. we’ve settled on the big loop around the complex, the 3.15 mile one. I’ve been pretty lucky and found people to go every night- there’s about 6 or 7 of the guys that go with me, alternating on and off. I get home covered in sweat pretty much every night.

I still haven’t lost any weight.

stupid dell raid card..

so the devs are having a hell of a time with the new dev server- it’s constantly locking up on certain threads for 30-45 seconds. apache mainly, but occasionally grep and other things. It appears to be completely random. I’ve been pulling my hair out trying to find the problem, and I think I got it nailed down thanks to a post on the gentoo forums (http://forums.gentoo.org/viewtopic-t-189180-highlight-writethru.html) that said to change some settings in the raid card’s firmware… I tested this on the prod machine since it’s not in use yet(they’re both dell 2850’s with the lsi megaraid cards) and benchmarked before and after with bonnie++… here are the results(- is original, + is new):

 Version 1.93c       ------Sequential Output------ --Sequential Input- --Random-
 Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
 Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
-prod             7G   331  98 27139  10 17554   4  1156  99 65858   7 371.8   5
-Latency               104ms   41538ms     804ms   19824us   46554us     631ms
+prod             7G   335  98 54977  23 27923   7  1075  99 61596   6 342.9   4
+Latency             76755us     331ms     590ms   12104us   24805us     414ms

Notice the second column under Latency? 41538ms vs 331ms – a 40 second latency when using the dell default settings…

I think this is where my lag issue is coming from… here’s hoping.
I’ll report back when I make the change on dell and see if the devs are still having lag problems.

Update-
so I switched the write policy to ‘write-thru’ instead of write back and changed the readpolicy to normal rather than adaptive… changed the benchbark, but not the problematic behavior- well, actually now, ALL of the devs are locking up at the same time…

The Reign of Terror Continues…

I haven’t mentioned the fatso walks yet, so I thought I’d bring them up.
I found that if I can get my BMI down to a reasonable number, I can save $50 a month on my life insurance. All I have to do is attempt to lose 40-50 lbs.

I’ve decided to start walking around the block every night to see how long I can keep doing it without missing a night, camping trips and other trips aside. So far I started last wednesday, and have walked every day since.

My normal loop was about 1.9 miles, but the as of last night I’m switching to the 3.15 mile loop- it takes a little over an hour to complete walking in a group of 4 for the new loop.

I will continue this and eating grape nuts for breakfast until I can jog this path, then I’ll start running down to monk’s house on 84th. I must get unfat.

Coheed and Cambria, Screamcore and the monkey boy who wouldn’t quit

So I just got back from my first concert without jackie in a long long time- went with my friend phil to the orbit room to see Coheed and Cambria. The events are as followed:
* went and got dinner
* went to the orbit room, realized phil was the “old guy” there (actually 3 or 4 people ended up beating him for that title) We got a table in the back because, since we were 10-15 years older than 9/10ths of the crowd and needed the support.
* first band was named “three” I think. Very good- their keyboard player also played a second set of drums- him and the main drummer rocked out for a bit- very cool. the lead singer played an acoustic guitar. The whole thing sounded a lot like Coheed and was a hell of an opening act. Phil commented as much and I replied that I had had good luck with opening bands….

Rule # 1: Do not tempt Fate.

It turns out there was a second warmup band- I don’t know their name because they never introduced themselves. Besides looking 19 and acting 14, the lead singer sang like a 2 year old who was told he had to take a nap…
“IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII*gasp* DON’T WAAAAAAAAAAAAAAAAAAAAAAAAAAANT*gasp* AAAAAAAAAAAAAAAAA- NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPP!!!!!!”

This my friends is called screamcore, and has replaced rapcore as the most annoying rock spinoff. The lead singer alternated between yelling lyrics and screaming them. I didn’t think it got much worse than that. The only reason we didn’t walk out was because we had a nice table in the back and we wanted to sit for the opening acts.

* I found out that there was yet ANOTHER opener called “dillenger” something or other, and that they were a much better act than the nameless band. Well, I guess it depends on how you define “better”. See, as far as screamcore went, the nameless band was untalented because the lead screamer sometimes yelled instead of screaming. Apparently this is frowned upon, and Dillenger showed us how it was really done.

Just when we thought it couldn’t get any worse, Dillenger upped the Ante. Not only did they suck, but they were louder, more incoherent, and didn’t have any decernable rhythm. again, we didn’t walk out cause we wanted our damn seats.

Finally they stopped and I clapped, and phil and I talked about other concerts he’d been to and how he was bitten in the back by a rabid butthole surfer fan at a concert. Coheed and Cambria came out and after the abuse we took on the last 2 acts, the bar was set pretty high- we wanted our money’s worth damnit. The only thing I really have to say about them is the lead singer has got some hair going on.

yeah, except it’s longer and frizzier than that picture- it ran to his shoulders, but actually mushroomed past them by about 3 inches on each side. when he sang it looked like the shaggy dog was licking the mic.

The music was good tho- I liked it quite a bit. the last song was a 20 minute blues rock jamsession where the lead guitarists traded licks back and forth. very cool.

and before I head to bed, let me tell you about monkeyboy… there was a coheed fan sitting about 20 feet in front of us who was enjoying the music a bit much. where some people would play air guitar, this gentleman had all the bases covered-
– he played “air base drum” with his foot coming about 2 feet straight up then back down to the beat
– he played “air cymbals” with his t-rex type arms (elbows never leaving his sides) flailing to the cymbal smashing
– and finally, “air guitar.” during the parts where there wasn’t really any guitarpart that stuck out.

On top of all of this, he’d occasionally flail out in something that could only be described as “sub human”. Once he even got up and did a little jig of some sort- not sure where that came from, but it was defininitely unique.

Other memorable moments included seeing a girl come out of the crowd while dillenger was up there gushing blood from her nose. I’d laugh, but I actually felt sorry for her… let see… Phil’s story about how he got his junk x-rayed… and of course random monkeyboay outbursts during the entire thing.
ok, time for bed I think.

UPDATE: after looking it up, the opening bands listed are “The Dillinger Escape Plan, Chiodos, and 3”. so yeah, 3 is a crappy name for a band since I can’t google for them, but I did find 3’s CD on ubl.

mrtg

So we just got these shiny new Netgear GSM7224 layer two 24 port managed switches, and I went about setting up MRTG. mrtg and snmp are one of my weak areas- I’m not too good at networking stuff to begin with, and mrtg has always seemed just out of my reach. Well, between rewiring half of the serverroom and threatening mrtg with a stick, I got it all working! now I can finally monitor network traffic and figure out which one of these network cards is a chatty cathy.

perhaps now I’ll set up mrtg on my system at home and play around with it more.

Go to Top