I love my asserts. I use them like crazy throughout my code and catch errors faster than you and your whole testing department. :> The computer does exactly what I ASK of it, which sometimes is not the same as what I EXPECT of it. So I wrap up my expectations with assert macros so my computer friend and I stay on the same page. Happy happy joy joy.

In Qt, we have the Q_ASSERT macro. Qt default behavior is to abort on any Q_ASSERT macro failure. This is weird to me (even if it is common). Almost universally, I want to SEE what’s going on when I hit an assert. Sometimes the assertion turns out to be wrong and may need adjusting. Even if it’s right, sometimes it’s helpful to check the effect of the failed assertion. And certainly, being able to walk back up the stack trace is critical to determine where things went wrong. I can kill the program easily if I WANT to, but I may want to continue – it should be my choice. It’s a no-brainer!

So I don’t use Q_ASSERT. Here’s my cross-platform C++ assert macro hackery. It’s not perfect but it’s getting me by so far… (continued…)

On my recent upgrade of php to 5.3, gentoo created a new slot so that people could run 5 and 5.3 in parallel. Gentoo is always giving you options (can you handle it? “ask yourself, do you feel lucky, punk?”). As usual, you must proceed with caution. And as usual, you will probably learn something along the way. This time around, the lesson is on php.ini defaults. (continued…)

I’m the last person to praise Microsoft – with the amount of money they bleed from the human race, there is no room to give them any slack. To their credit, corporations of their magnitude almost always decay into bureaucracy and inefficiency, and they could be worse. Case in point, Visual Studio. It kicks ass. Here’s a quick rundown of what it does for me when debugging my Qt app. This is in comparison to Qt Creator, which is awesomely streamlined and elegant. But when you are debugging, every bit of comfort is gold:

  • if you set things up as i did, you can step right through the Qt source with no pain
  • the watch window takes far fewer steps to manipulate
  • the debugger can dereference pointers better
  • the debugger can dereference iterators better
  • code completion in the editor can also handle dereferenced iterators
  • debugger can show long strings much better
  • you can step over a function back up to the caller without dropping to the next line of code in the call routine (for when multiple calls take place on one line)
  • debugger doesn’t head south when often browsing out of array bounds (inevitable if you are watching variables)

I’ll add to this list as seems fit. I should probably also start a list of the advantages of Qt Creator, it is really nice to work with on linux and Mac. Including Eclipse would round out the list nicely… but for now, back to teh coding. :> Check out this recent post for instructions on getting VS set up with Qt, it’s easy.

I could not live without this hack. Placing the Windows taskbar on the lefthand side, with auto-hide on, gives you more screen real estate AND more taskbar width when it pops out when needed, via Ctrl-Esc. I’ve been configuring Windows this way for decades. How can people stand that little strip at the bottom flashing at them all day? Seems like a little thing… but to me it’s huge. It actually determines who’s in charge – am I sitting at my computer to be told what I should do via little popup notifications, or am I there to get something done, checking on any notifications when I’m ready to address them? Sure, my friends can get annoyed that I take an hour to respond to an instant message, but I’m getting stuff done. Anyway, I’ve gotta keep this thing handy… (or just resist the urge to boot into Windows to play games…) :>

UPDATE: the original hack hasn’t kept pace with Explorer updates, and hasn’t been open sourced so others can do it. On page 17 of that forum post, another hack was provided that seems to be working.

Qt’s Phonon library has an awesome goal: abstract video and audio services to simplify cross-platform development. It has worked great for me out of the box using Qt 4.7 on linux and Mac OS X. Windows setup took a bit of elbow grease. Here are the cheatnotes to get you through it quickly.

NOTE: The Qt mingw setup worked fine for me when I was setting up my first Windows development environment, do not hesitate to go that route. All you need is the Qt SDK for Windows. Free is good!

But this time around, I opted for using Visual Studio 2010, since I already had it installed and I wanted to compare. I’ve read that there is no support for using the open-source-licensed Qt with Visual Studio, but the official Qt download page for the Visual Studio Add-In clears things up – it says the add-in “can be used for development together with all Qt licenses”. Let’s fire it up and try it out! (continued…)