Archive for March, 2009

some things

March 29th 2009

Well I went and ported kfile_torrent to be a Strigi analyzer so that the .torrent info metadata is available in KDE 4 now. Unfortunately although KFileMetaInfo has apparently been ported to use Strigi no metadata shows up for me in Dolphin. Maybe it will when I enable Nepomuk perhaps, kind of unfortunate that a feature more or less from KDE 2 is still unavailable though :-/

In other news I’ve been trying to find a good reason to play the PS3 that our family got last fall. Most of the games I’ve tried so far have not warranted the annoying aspects of a super-whamodyne system.

For instance, the last game I tried was Uncharted: Drake’s Fortune, which was very well reviewed. But, I didn’t find it very entertaining.

Once the game came in the mail (from GameFly, since I refuse to end up with another $60 stinker), I tried it out. It told me it had a required update to install (for the PS3 itself). Awesome. So about 10-15 minutes later, I end up able to boot the game.

Whoops! The PS3 has “helpfully” detected a required patch to install for the game. Although the developers took pains to make the patchsize small (it was only around 10 MB or so) it still took another 10 minutes to download over a cable modem. So about 20-25 minutes after the adventure was supposed to begin, I was finally able to try and start the game.

What I get instead is a rotating gold coin for another minute or two, as the title screen loaded up from the disk. Now, let me just say that the music was fantastic. I was beginning to see what the reviewers were talking about with “production values”. Mind you, I would have rather had a much plainer screen if it meant the program loaded in 10 seconds instead of 90 seconds but whatever.

So I set the game to be “Easy” to give myself a chance to enjoy it (my threshold for getting ticked off at video games has been steadily decreasing over the years). And then I start the game… and wait another minute to get to the first level, some kind of tutorial.

I’m on some kind of boat, unlocking a treasure chest. Story seems good so far, graphics are good, voice acting is good. Great production values all around. And then the action starts. Like any self-respecting treasure hunter, I’ve got a fedora and a whip… er, well apparently this guy uses a gun instead. Even better, I’m familiar with shooting games.

So I start walking around, trying to take cover and dish out punishment to pirates trying to board the ship. Now luckily, games this cool have to have an EDGE to them, to keep pesky casual gamers from being able to enjoy their new $60 game. The EDGE in this case was that there was no auto-aim or lock-on to speak of whatsoever. Instead I was supposed to move my crosshairs around manually to target people.

Well, I tried, I really did try to enjoy going back 15 years in time, to an era before GoldenEye 007. But after getting shot for the 10th time or so trying to put my crosshairs over a guy (apparently the fine adjust controller sensitivity is not as sensitive as on DualShock 2 or the GameCube) I got fed up.

There’s only one excuse out there that I can think of to have no ability to aim at someone, and that’s if you’re using a keyboard/mouse combination (or Wii Remote I guess…) to easily aim. But on a controller system it’s just an invitation to annoyance. I think we can all agree that on a screen with 1 enemy near your crosshairs, that you probably meant to fire at that one enemy. But instead I guess to do it all myself (and this is supposed to be fun!). Do the game designers also want me to move Drake’s feet individually?

Now compare to GoldenEye 007. That game had no lock-on but instead if you pointed in the general vicinity of someone you would naturally start aiming right for the middle or so of their chest. You always had the option of aiming manually. This system worked well for expert players without annoying people who no longer have hours and hours every day to spend on video games.

In Zelda (Ocarina of Time) and Metroid Prime, they went even better and introduced a “lock on” feature, which makes perfect sense and makes the combat better as I can more fluidly think of dodging and getting better placement even while I attack. In Uncharted I was either peeking out behind cover trying to line up my shot or I was standing still asking to get picked off while trying to line up my shot.

Now we can compare all this to Battalion Wars 2 for Wii, which is the other game I had out from GameFly at the time. The voice acting is horrid, the graphics are acceptable but not “high definition” and the story is fairly contrived. But on the other hand, the actual game mechanics work (even this game had “lock on” for crying out loud). Not only that, but the game loaded up within seconds, without patching. (I have encountered Wii games that required patching the Wii so keep that in mind). Each individual level also loaded quickly. This must be Bizarro World, where fairly simplistic Wii games are more fun than PS3 extravaganzas.

So I’ll try Prince of Persia next for PS3 I suppose since I really enjoyed the GameCube trilogy. I’m just hoping that when they were so busy spending millions on making another $60 game that they stopped at some point to ensure that the finished product would be fun in addition to being flashy.

Posted by mpyne under KDE & Personal & Programming | 2 Comments »

Documentation KIOSlaves

March 15th 2009

KDE has long had a nice collection of useful kioslaves for viewing installed documentation, including viewers for manpages and info pages (used by GNU software).

For KDE 4.2 I had introduced another viewer, this time for Perl’s perldoc documentation, which used a look similar to the appearance at www.kde.org. At the same time I had ported kio_man, the manpage viewer to have a similar appearance.

Unfortunately I didn’t have time to also do likewise for kio_info, the info page viewer. That has now been rectified, as seen in the following image, which shows output from all 3 documentation filters:

Thumbnail view of 3 columns of webpage output

At the same time I factored out the CSS into a common docfilter CSS suite, so that any improvements should fix all the docfilter-type KIOSlaves at once.

Posted by mpyne under KDE | 3 Comments »

CMake prefix path

March 7th 2009

I remembered reading the discussion on kde-buildsystem about CMake 2.6′s CMAKE_PREFIX_PATH environment variable. I just forgot to add it to kdesvn-build.

Today it finally caught up with me: A build failure I was having ended up being due to not having CMAKE_PREFIX_PATH defined. Although adding it to the environment manually certainly works, it’s something that should have been in kdesvn-build. Well, it is now, at least in the /trunk version of kdesvn-build. It will also be in the next release of kdesvn-build.

My recommended workaround until then is simply to manually export CMAKE_PREFIX_PATH=/path/to/kde/install/prefix before running kdesvn-build (easiest would be to add to your .bashrc). Otherwise if you have a system KDE 4 (or the dependencies, like akonadi, strigi, etc.) then there is a good chance CMake will prefer the system installation to your kdesvn-build install and you’ll have build problems for modules expecting the trunk version of various dependencies.

Posted by mpyne under Computing Troubles & KDE & kdesvn-build | 4 Comments »

Yay, it’s been so long since an uninformed C++ rant.

March 3rd 2009

You may start by reading The Tailor, off of Planet GNOME.

Back? Good. Let’s deconstruct the points :) (Quotes are abridged and not direct quotes because I don’t feel like doing the copy-editing required)

  • Methods should be virtual by default so inheritance works. Well, inheritance at run-time, since inheritance still works just fine. To be honest this is probably one other thing that could have been different between class and struct, is class having all methods be virtual while you need to specify it with struct, so that you can still write simple classes with little to no overhead, such as QColor for instance. Then again, you could actually spend the 5 minutes it takes to understand non-virtual functions (hey wait, we already know how non-virtual functions work! :) and move on with your life. Also, this is snark’s most frustrating issue with C++… I don’t know if he’s referring to the same language I am but there’s about a half-million things more annoying than virtual in C++.
  • You need to have virtual base destructors in classes with virtual methods otherwise Bad Things Happen with no warning. Except that there is a warning. Fair argument though, I remember even Qt wasn’t immune when the warning was first introduced (or turned on with -Wall) by g++.
  • It’s annoying to use multiple inheritance because you have to be really careful. Then don’t use multiple inheritance, just like GTK+ and Java don’t use it.
  • Conversion constructors are annoying because they enable a type of bug, which the C++ guys thoughfully included a keyword for to avoid automatic conversion. If this kind of bug really trips you up, don’t use conversion constructors at all. Hey, less code to write!
  • C++ lets me do other unsafe things. True. So does C, Python, Perl, Ruby, and etc. etc. etc. Are we really supposed to pine for languages that put you in a straightjacket? If you don’t like features which are potentially unsafe, then don’t use features which are potentially unsafe.
  • Don’t respond that the language isn’t at fault because that proves you’re drinking the Kool-Aid No language is without fault, but it hardly seems sporting to say that C++ is bad because it gives you more options. If you want a more restrictive language then use Java or C#.

Or to put it another way, I don’t like spicy foods. At all. But you don’t see me blogging about how spicy food is horrible, OOHHHHH NOOOO HOW DO YOU EATZ SPICY FOOD????, etc. The reason I don’t is because I know that many people enjoy spicy food, and because I DON’T HAVE TO EAT IT IF I DON’T WANT TO.

On the same note here, most of these points against C++ are things that other programmers actually desire. I like implicit conversions in some cases (although I’d rather have an implicit keyword than explicit). I certainly like having the option to have simple classes that don’t necessarily have to have a vtable, even if that means I need to remember to make my methods and destructors virtual.

Worse yet, this is a rant with no solution. C++ can’t change now, and there are plenty of popular languages out there where this list of complaints don’t apply. So why the rant on C++ when you could be writing your Vala application? Or to bring back the tailor analogy, if you could tell that the suit didn’t fit when you put it on, why did you buy it anyways, when there were other perfectly good suits available, and other men fit into your poor-fitting suit just fine?

I suspect that snark has never actually used C++ for anything substantial. Or if he did, I’m very shocked that “templates” didn’t make his list at all…

Posted by mpyne under C++ & Personal | 26 Comments »

More programming tips

March 1st 2009

In the spirit of my series of programming tips articles I thought I would go ahead and throw out some more:

  • If you are using QAction, QCheckBox, QRadioButton, or similar classes, then you need to be wary of the differences between the toggled(bool) signal and the triggered(bool) (for QAction) or clicked(bool) (for button-like classes) signals.

    These two signals are used in two different situations. toggled(bool) is always for if the value of the action or button being checked changes, for any reason. This means that if an QRadioButton had not been checked, and it is set to being checked, it will then emit a toggled(true). You would use this signal if you needed to update your GUI based on whether an action is checked for instance.

    The other signal (triggered or clicked) are used when you need to perform an action based on a user action. For instance, if you had a "[ ] Show Wikipedia content" on your menu bar, you may want to bring up that window as soon as the user clicks on it. On the other hand, if you were changing the checked status of the action internally to your code but didn’t want the window to pop up, you’d want to use the triggered signal.

  • If you’re not continuing to study then you’re not going to get any better at programming. I’ll generally visit programming.reddit.com (and also the C++ and Perl sub-reddits) and sometimes you’ll catch a new technique that is neat. For instance:
  • From Mr. Edd’s C++ blog: You can use the not-well-known feature of C++ to give “pointers to member data” to allow for assigning a null pointer to smart pointer classes, while not allowing any other pointers to be assigned. His writeup covers everything so I’ll refer you to that but suffice to say that something like “smart_ptr service = 0 would work, while “smart_ptr service = &newService” would not. This is useful in basically any place where you want to allow a null pointer to be assigned by not any other kind of pointer.
  • Another interesting tidbit is the restrict keyword, available in C since the C99 revision. Sadly, it is not available in C++, not even the upcoming C++0x standard, except as a compiler extension. The use of the keyword is fairly low-level, and is explained in this article for Cell processor development.

Hopefully you’ve learned something neat (and useful and not merely contrived!)

Posted by mpyne under C++ & Programming & Useful Tricks | 1 Comment »