Problems with PHP’s get_browser() on openSUSE 11.2

I just spent way too much time trying to debug PHP’s get_browser() on an openSUSE 11.2 server. All I wanted to do was display a funny little note about what web browser a user was surfing with, as in, “You are using Opera… AWESOME! :-D”, or “You are using Firefox… good :-)”, or even, “You are using IE… that’s sad :-(“.

I had this working just fine on openSUSE 10.3 and openSUSE 11.0, but the 11.2 server was giving me “Default Browser” for any browser I used. I debugged and looked over the configuration/logs again and again, but for some reason it appeared that while get_browser() was seeing the correct php_browscap.ini file, something was going awry.

I finally stopped the debugging process when a Google search landed me on Jonathan Stoppani’s Browscap PHP Project. I made a few minor modifications to my code in order to use his class, and now my browser detection is working great – even on the stubborn openSUSE 11.2 server. Thanks Jonathan!

Posted in Linux, Programming | Leave a comment

Image resolution in pixels vs DPI

When working with the print shop to create a poster out of a 3174 x 2153 pixel digital photo, I managed to get completely confused about DPI (dots per inch). I read a blog post called The Myth of DPI to educate myself, but that seemed to muddy the water even more for me. I must have been having a bad week because now the relation between pixel resolution and DPI is crystal clear:

pixels = inches * dpi

I wanted to print a poster that was 36″ wide, meaning that the DPI of the printout would be 88 (dpi = 3174 / 36 = 88).

Obviously, the more ink dots per inch you have, the crisper the image will look on a printed page. The printer recommended that I have 300 dpi to retain the quality of the image. What they didn’t make clear to me was that in order to have a 36″ wide poster at 300 dpi, I would need an image that was 10800 x 7200 pixels.

Adding to my confusion is that DPI is apparently part of the JPEG metadata. This means that you can change the DPI to whatever value you want. The key point is that raising the DPI reduces the printable image size, and lowering the DPI increases the printable image size.

All of this is spelled out in the The Myth of DPI, but for whatever reason I wasn’t getting it. Once I finally understood, I decided to bite the bullet and print the size I wanted, meaning that I would have to deal with 88 dpi. I think the resulting poster looks great. I mean, you wouldn’t put it up in an Ansel Adams gallery, but I don’t see any pixelation and it will be viewed mostly from afar. Time to frame this puppy and call this project done!

Posted in HOW-TOs | Leave a comment

My favorite technology of the aughts

The 2000s have been the first decade where I’ve actually had some serious purchasing power. While I rarely splurge, I have managed to accumulate some excellent technology over the past ten years. Here are my favorites from each year:

2009… Synology DS209j NAS (two 640 GB drives in RAID1)

Like the DreamHost of file servers, this network attached storage (NAS) device provides an intuitive, clean interface to most of the things you’d want to do with a Linux file server. No need to install software, tweak config files, or make sure that services start on boot – the Synology pretty much Just Works. I bought the DS209j and (separately) two 640 GB drives for a reasonable total of $360. I have a similar model that I use on the job and absolutely love it for that purpose.

2008… Apple MacBook Pro (15″ screen, 2.4 GHz Core 2 Duo, 2 GB RAM)

I have never been happier with any computer. Of course I’ve never spent more on any computer… this one cost me a grand total of $2,150. I later upgraded to 4 GB of RAM for a trivial sum. In terms of my computing history, I ran Windows all the way through my undergrad, then switched to Linux for the next seven or so years. Now that I’m using OS X, I have all the polish of an Apple product, with the stability and hackability of a UNIX system.

2007… Panasonic TH-50PX77U (50″ plasma, 720p)

I researched this purchase exhaustively in the AVS Forums and wound up with a good deal on an awesome television – $1,900 including shipping. Of course, these days I could get a 1080p set for less, but let’s not think about that. I expect this plasma to act as my primary television for years to come.

2006… Nintendo DS Lite

As you can see from Part I and Part II of my Nintendo DS Roundup series, I have logged many hours on this slick handheld. I love the dual screens, even for games that have no touchscreen functionality at all. The battery life is awesome, the suspend/hibernate mode works flawlessly every time I close and re-open the clamshell, and the two speakers do actually provide a decent audio experience. It’s difficult to imagine a better portable gaming system than this.

2005… PlayStation 2 (slimline)

Yes, I was certainly a latecomer to the PS2. The positive of this was that I could sift through the huge library of existing games to pull out the gems:

I didn’t pour my soul into this system like I did with the Gamecube, but the PS2 provided a reliable, quality console experience while also serving as a DVD player for my second television.

2004… Game Boy Advance SP

This little clamshell was a fitting ancestor to the DS. A few of my favorite games for the system:

  • Mario Golf
  • Advance Wars
  • The Lord of the Rings: The Third Age

2003… TBD

2002… Nintendo Gamecube

I doubt that I will ever get more mileage out of a gaming system than I did with the Gamecube. Looking back at my reviews, I see a slew of great games that held me captive:

  • Super Smash Bros Melee
  • Eternal Darkness
  • Metroid Prime
  • Super Mario Sunshine
  • Gladius
  • Resident Evil
  • Skies of Arcadia Legends
  • The Legend of Zelda: the Wind Waker
  • XIII
  • Beyond Good & Evil
  • Prince of Persia: The Sands of Time
  • Paper Mario: The Thousand-Year Door

Hell, I even wrote a research paper on the Gamecube’s CPU for a computer architecture class in grad school. The wireless wavebird controllers were a brilliant innovation – especially for a cat owner. The Gamecube was there for me at a point in my life when I needed a lot of distance from certain personal matters; this is technology that has special meaning.

2001… Toyota Camry

Although I bought the car used in 2002, the Camry itself is a 2001 model. With only 24,000 miles on the odometer, I felt that the total cost of $15,200 was a great deal; my interest rate was pretty good, but let’s not think about the extra I paid to the bank. Anyway, this car is never going to get me any chicks, but it does work flawlessly, doesn’t leave me stranded, and has been very reasonable in terms of maintenance costs. I’m not a car guy, but when a machine with that many moving parts functions so reliably, you know you’re dealing with quality engineering.

2000… TBD

You might have noticed that there are no cell phones on here; having owned a Palm Pilot, Treo 650, and Centro, I’ve felt underwhelmed in that department. However, I am hoping that the Droid will find a home on my list for the next decade…

Posted in Fun, Hardware | 1 Comment

Across Realtime by Vernor Vinge

Across Realtime encompasses two stories: The Peace War and Marooned in Realtime. As you might guess from the titles, the latter is much cooler than the former. Having read Marooned in Realtime first as a separate paperback, I already knew most of the big technological reveals in The Peace War. In fact, after about 200 pages I just couldn’t finish the The Peace War; I didn’t care about the characters or the plot enough to make it through the climax and denouement.

However, Marooned in Realtime is certainly worth a read – both for the overview of the “bobble” technology, as well for an engaging story. Throw in a murder mystery and some allusions to big scifi ideas, and you’ve got a great novel. Still, I think Vinge shines brightest when he puts us in the Qeng Ho universe. Starting with the best, I’d sort his novels (the ones I’ve read, anyway) as follows:

  1. A Fire Upon the Deep
  2. A Deepness in the Sky
  3. Marooned in Realtime
  4. Rainbow’s End
  5. Tatja Grimm’s World
  6. The Peace War
Posted in Books | Leave a comment

Fantasy football lessons learned in 2009

Last year I wrote Fantasy football non-lessons learned in 2008 so maybe this is becoming an annual tradition. My sorry draft this season has hopefully taught me a few lessons that I can learn from going forward:

Avoid one-hit wonders

RB Matt Forte exploded out of nowhere in 2008 and has comparatively disappeared in 2009. I was a little scared of a “sophomore slump”, but I bought into the hype that Forte could be even better with Jay Cutler at the helm. In the end, I chased after a one-hit wonder instead of using my 7th overall pick for a reliable stud (e.g., QB Drew Brees).

Don’t bank on wide receivers

Starting with the second round, I went Andre Johnson, Greg Jennings, and Jason Witten. Johnson has produced, but Jennings and Witten have both fallen well short of expectations. The WR position in general lacks consistency, so basing your team around a core of receivers isn’t necessarily the best idea. I think it might be better to go after the late-rounders or free agents who invariably wind up rising to the top (e.g., Miles Austin, Mike Sims-Walker, Sidney Rice, the Giants’ Steve Smith).

Two upside quarterbacks do not equal one stud

Last year I had an injury prone Matt Schaub and an inconsistent Jake Delhomme. This year, my QB corps of Carson Palmer and Matt Cassel (later traded for Matt Hasselbeck) is not much of an improvement. Since his bye week, Palmer’s FP production has been a pathetic {15, 7, 16, 11, 9}. Those performances from Palmer are a big reason why I’m out of playoff contention.

Don’t break strong RB monopolies

I had the RBs for the defending Superbowl champs in Willie Parker, Mewelde Moore, and Rashard Mendenhall. The second it looked like I had a three-headed RB monster on my hands, I started dropping these guys. Currently Mendenhall is playing for another team and has more fantasy points than Matt Forte or any of my other crummy backs. I need to think very carefully in the future before I give up an RB monopoly on a good team. Though with the way the Steelers have been playing lately, I’m not sure that we can call them “good”…

Next season I am almost certainly going to take a QB in the first round. After two straight seasons of flaky QBs and 1st round busts, I want some reliable production. Aaron Rodgers, say hello to your new team for 2010: the Shambling Corpses!

Posted in Fantasy Football | Leave a comment

How to compile bandwidthd 2.0.1 on OpenBSD 4.3

I ran into numerous problems when trying to compile bandwidthd 2.0.1 on OpenBSD 4.3. The first problem was that, even though I had installed all the dependencies via ports, ./configure was still erroring out with:

checking for png_read_info in -lpng... no
configure: error: Bandwidthd requires but cannot libpng

Hunting around the web, I managed to get past that error, but then ran into this:

checking for gdImageCreate in -lgd... no
configure: error: Bandwidthd requires but cannot find libgd

The solution to both of these problems is this:

./configure LDFLAGS=-lz -x-libraries=/usr/X11R6/lib

I thought I was good to go at that point, but a make resulted in this problem:

Graph cycles through conf.l.c

`all' not remade because of errors.

I banged my head on this for some time before turning to the OpenBSD misc mailing list. Philip Guenther pointed me in the right direction:

The makefile is either buggy or assumes a non-POSIX make. Try it again with ‘gmake’. If you still get errors, yell at the bandwidthd authors.

I grabbed gmake from ports and voilà, success!

Posted in HOW-TOs | Leave a comment

OS X for the Linux user

About 1.5 years ago, I made the switch from SuSE Linux to a MacBook Pro running OS X 10.5. Here are some brief notes I made regarding the transition:

  • OS X’s Spaces gives you virtual desktop functionality. I don’t think it offers the same depth of customization, but it works just fine for my needs. One feature I like is to left-click and grab a window, then use ctrl-[1-8] to move the window to one of my eight “spaces”. On my Linux system, I had to navigate a menu to accomplish the same thing.
  • The program that I replaced Gaim/Pidgin with is Adium. However, I now see that Pidgin appears to have an OS X client…
  • I miss being able to copy text by highlighting, and paste via the middle mouse button. With OS X you need to do command-c for copy and command-v for paste.
  • Speaking of the command key, it annoys me. I’ve been trained my entire life to use ctrl, but OS X makes you move one or two keys over to use a different key. Which brings me to the next topic…
  • The home and end keys have the obnoxious behavior of jumping you to the top and bottom of a window, as opposed to the start or end of a single line. You can change the behavior in Cocoa apps (more succinct info), but all 3rd party applications (Eclipse, Firefox, etc) seem to require individual adjustment via other means.
  • Not having focus-follows-mouse is incredibly painful; Steve Yeggae agrees.
  • Quick notes on the hardware:
    • Two fingers to scroll, pinch to zoom out, un-pinch to zoom in – I like the multi-touch pad, even though trackballs are typically “how I roll”.
    • The auto-dim/brighten of the display and the backlit keyboard is really cool.
    • The display is gorgeous.
    • The case gets uncomfortably hot for a device that theoretically sits in your lap.
    • The only way to access the alt key is via the fn key.
  • If you have more than one user, do yourself a favor and Preferences -> Accounts -> Login Options -> Show fast user switching menu
  • iTunes is disappointing in that it has no native FLAC or OGG support. Additionally, iTunes servers are apparently “listen-only”; you can’t copy files!

While OS X certainly has a proprietary, somewhat locked-down feel to it, the slick and user-friendly interface more than makes up for it. This is the same reason why I usually run Opera instead of Firefox – I prefer a high-quality computing experience.

Posted in Linux, OS X | 3 Comments

Valkyria Chronicles vs Eurogamer

After being amazed by Valkyria Chronicles on the PS3, I was surprised to read this somewhat critical review on Eurogamer. The review starts out promisingly, but ends with a list of grievances about the combat system. Having loved the game so much, I’d like to examine them:

The AI is far from stellar…

The Valkyria Chronicles I played is not about outsmarting the AI, it’s about finding a way to get an “A” score on each mission. Certainly, the AI is a piece of garbage. It’s horrible. But forget the AI – the real challenge in this game is to find a way through the enemy’s larger numbers and stalwart defenses in the fewest number of turns possible.

If you want the game to be about defeating the computer in tactical combat, then yes, you will be very disappointed. The computer isn’t going to defeat anyone despite it’s massive advantages in equipment and personnel. And yes, I was initially disappointed by this. But once you realize that each mission is more of a puzzle, not a battle, you begin to really enjoy yourself.

With absolutely no multiplayer options, experienced strategists will be less than satisfied.

Admittedly, I am disappointed by the lack of multiplayer. A human opponent would certainly give this game an exciting new flavor.

Having an enemy break through your lines because your line of defence was too busy shooting a wall as they ran past is frustratingly common.

In my experience this was certainly not “frustratingly common”. As long as they were facing the right way, my soldiers generally did a decent job with their opportunity attacks while on defense.

And then there’s the strangely inconsistent damage model, with splash damage from explosions proving particularly flaky. Sometimes this works in your favour – magically shielding one of your soldiers from harm – but it’s incredibly annoying to waste both Action and Command Points on a grenade attack that seems to have no effect.

The author might be missing the fact that some enemies with high/enhanced evasion will hit the deck when a grenade explodes. It’s kind of subtle, but you can see them do it sometimes. This might account for the inconsistencies that the reviewer is seeing – I’ve assumed he already took into account that units behind cover have more protection, and Lancers are particularly immune to explosions.

The game often seems too rigidly tied to its rock-paper-scissors attack formula, since a tank shell needs to hit a soldier dead centre to cause any damage purely because it’s meant for other tanks, yet a mortar shell landing in the exact same place can kill several soldiers at once.

This is where I start to see another fundamental difference in the way the author and I view Valkyria Chronicles. To me this game feels like a close translation of a tabletop game with a GURPS-like rule set. The rules are rigidly defined and that can lead to situations that don’t reflect reality.

For example, why can I walk up to an enemy lying in the grass, stop one inch away, empty a machine gun clip into his face, and find that I’ve barely knocked off 1/5 of his life? Well, because whatever defensive bonus he gets from being in the grass happens to outweigh whatever accuracy bonus I get from being right in his face.

In the end, Valkyria Chronicles is more more like a tabletop RPG than a gritty, true-to-life, WWII sim.

Why can’t you duck behind a stone bench, for example? Or that pile of crates? Or that low wall? Or all the other environmental details littering the otherwise well designed levels?

I understand this complaint, but allowing you to duck behind every object in the game would result in all units being in a defensive “crouching” or “crawling” state the entire time. Allowing that defensive boost only in certain contexts creates a more textured experience.

… only the scout class has any real movement range…

The scout and the engineer both have solid movement range. If the other classes had that kind of range, then the game would go out of balance.

This shortlist of fairly fundamental flaws is sadly just enough to prevent the game from reaching the upper echelons of greatness.

Well, either that or one of the best console games I’ve played in a long time. Granted, the story, music, and visuals added a lot for me. I’ll go ahead and give this one 8.5/10.

Posted in Video Games | Leave a comment

Group think among fantasy football experts

In my last post, I talked about grading the rankings of fantasy football experts using the root mean square error (RMSE), and listed some results for Week 9. This time, I took the data from ten analysts and examined their performance for weeks 1-9. The numbers seem to imply a certain amount of group think:

Analyst QB RB WR TE K DST
FFToolBox.com 8 14.5 21.1 6.7 7 6.9
FFToday.com 7.8 15.2 20.8 7.3 7 n/a
(Yahoo) B. Funston 7.7 14.9 21.4 7.2 7.3 6.6
(Yahoo) A. Behrens 7.5 14.6 20.9 7.1 7.6 6.6
(Yahoo) B. Evans 7.8 14.6 21 7 7.4 6.5
(Yahoo) S. Pianowski 7.8 14.6 20.7 6.9 6.8 6.5
(ESPN) M. Berry 7.9 14.8 21.8 7.6 7.6 6.4
(ESPN) C. Harris 7.7 15.2 21.5 7 7.5 6.8
(ESPN) E. Karabell 8 14.9 21.2 6.8 7.7 6.5
(ESPN) E. Kuselias 7.9 15 21.2 7.1 6.8 6.3

The results are pretty discouraging… all the analysts are basically the same! The biggest difference is 1.1 between the WR performance of ESPN’s Matthew Berry and Yahoo’s Scott Pianowski. So if Pianowski tells you that Randy Moss is the #1 WR for the week, then Moss is pretty much guaranteed to be in the top 21; if Berry tells you that Andre Johnson is the #1 WR for the week, then Johnson will fall somewhere in the top 22. Is that a big enough difference to say that Pianowski is a better analyst than Berry?

Amusingly, if you sum up the errors for each analyst, you’ll find that Matthew Berry, face of ESPN’s fantasy football team, is the worst. Still, they are all so close that being best or worst doesn’t have much meaning.

All this homogeneity had me wondering if there was a bug somewhere in my code. As a sanity check, I decided to see how different the rankings of the analysts were from one another. To do this, I took the average of the standard deviation of the rankings for each player. The result:

Analysts Avg(StdDev)
All 3.90563914
ESPN 2.99869145
Yahoo 2.96695123
ESPN+Yahoo 3.44933692

So you end up with an average standard deviation of about 4 for each player ranking. That is a pretty small number when you consider that each of these analysts is ranking 40 running backs and 50 wide receivers. If you include only rankings in the top 10, then the number plummets to 1.42704758.

Even more interesting is the very clear illustration of group think. The ESPN guys have an average deviation of about 3 amongst themselves, as do the Yahoo guys. But combining the two groups, the number increases by about 15%. It’s all very fascinating; the conclusion I draw is that these analysts are not significantly different from one another.

Notes about methodology

When calculating the RMSE table, I leveled the playing field by using the top N rankings from each position; see the table below:

Position Players ranked
QB top 20
RB top 40
WR top 50
TE top 15
K top 15
DST top 15

The other thing to note about the scoring is that I capped the maximum error for situations where a player’s actual output put them outside the top N rankings. If they were outside of N, then I squashed their ranking to N+1. This was to avoid the situation where a player posts a goose egg and therefore winds up amongst the hundreds of other players with zeros.

Was it worth it?

I had fun doing this as a hobby project, but I was disappointed not to uncover a “super analyst”. All these guys are doing better than if you were to draw names out of a hat, but I wonder how much better they are than the average Joe Football. I am half-tempted to try ranking players myself and see if an amateur can compete with the experts.

Posted in Fantasy Football | 1 Comment

Grading fantasy football analysts with the root mean square

UPDATE: added the ESPN guys.

Last year I considered writing some code that would grade the performance of fantasy football analysts. This year I’ve actually finished up the code and can post a few results. What I am doing is very simple:

  1. Download an analyst’s weekly rankings.
  2. Download the actual player rankings (based on fantasy point production).
  3. Compare the two for each position using the root mean square error (RMSE).

The following table shows the RMSE of CBS Sports’ Jamey Eisenberg and Dave Richard for Week 9. Similar to the Netflix Prize, the lower the number the better. In this case, the RMSE tells you how many rankings off the mark the analyst tends to be.

EXAMPLE: Using the table below, we see that Dave Richard’s RMSE for quarterbacks is about 8. So if he says that a QB is going to be ranked #10, then you can be pretty confident that the QB’s actual rank will be between #2 and #18. That may seem like a large error, but keep in mind the random, uncertain nature of pro football: Tampa Bay beat Green Bay last week; Cedric Benson is the 7th top RB; Smith Smith of the Giants is the 7th top WR; the Titans are 2-6. Predicting this stuff is nearly impossible, but I have a hunch that some analysts will be better than others.

Position Eisenbergc Richardc Berrye Harrise Karabelle Kuseliase
QB 8.5 7.8 8.3 8.2 8.3 7.5
RB 13.2 12.4 13.3 13.6 13.3 12.6
WR 20.6 19.6 19.8 18.9 19.9 19.5
TE 8.1 7.7 8.6 7.8 7.3 7.9
K 6.2 6.4 6.7 7.2 8.1 5.9
DST 9.4 8.4 10.1 10.0 9.3 10.0
  • C = CBS Sports
  • E = ESPN

I will look to post data covering more analysts later this week!

Posted in Fantasy Football | 1 Comment