std::vector and std::remove

You might have known this but I just found this out yesterday.

I knew std::remove doesn’t actually remove anything. The way it is used goes something like this.

std::vector int_array;

int_array.push_back(1);
int_array.push_back(1);
int_array.push_back(1);
int_array.push_back(2);
int_array.push_back(3);
int_array.push_back(4);

// call remove to remove all the elements that equal 1
// remove reorders all elements so that the things you
// want removed are at the end of the vector
std::vector::iterator erase_from = std:remove(int_array.begin(),
                                                   int_array.end(),
                                                   1);

 (more…)

Stop Pasting Code

This topic seems almost too basic to even discuss but I’ve run into these issues fairly often so appearently they do need discussion

When coding somethings to keep in mind, how can we code both efficiently and defensively. In other words, how can we get things done faster and with less bugs.

Here’s a few ideas. They might seem obvious but like I said, I see lots of code that doesn’t follow these ideas and so I’m bringing them up.

#1) If you do something a lot, figure out a way to make it easier to do.

Here’s two examples from my own experience. I have a library to read .ini files. .Ini files are something that Windows first introduced me to. They are a very simple text based format that look something like this

(more…)

Private / Semi Private Offices vs Team Spaces

What’s your experience? Lots of management books etc say that private offices are super important for software engineers. The basic argument usually goes that engineers need to concentrate and be uninterrupted. That it takes them 30-45 minutes to get “in the zone”. If they are interrupted for anything (phone call, conversation, question, distraction from the cube next to them, someone else’s cell phone ringing) they don’t just lose the 5 to 10 minutes for the interruption, they instead need another 30-45 minutes to get back into “the zone”. To get their mind back around the problem they were solving. So, if they are constantly or even often interrupted they will never get in the zone and never really get any real work done.

(more…)

RockBand woes

There are some seriously bad issues with setting up RockBand. If you want to continue with your band apparently you have to plug in the exact same instruments into the same USB ports you original had them. Each instrument has to be assigned to the same xbox live profile. Get even one thing wrong and RockBand will not let you play your saved game.

You even have to make sure all the instruments are plugged in BEFORE you turn on the 360. If you turn on your 360 with just one or two plugged in then later plug the rest in the 360 may assign the instruments to different players. In other words player 1 might be the drums instead of the mic even if you assign the drums and the mic to the correct profiles RockBand will refuse to let you play.

(more…)