Returning Pointers From Functions

This is something that was not entirely obvious to me. My problem was that I wanted to return a character pointer to a string of characters in a safe and easy way. The following listing is a simple C++ program that will compile, but contains a couple semantic errors.

Programming Interview Question: Vector

Look at the following program written in C++ and see if you can spot the error. Assume that populate_vector() is a function that returns a vector. (Note: This program will compile.)

#include <vector>
 
int main() {
   const int x = 5;
 
   std::vector<int> myvector = populate_vector();
 
   int size = myvector.size();
 
   for(int i = 0; i < size; i++){
      if(myvector.at(i) == x) {
         myvector.erase(myvector.begin()+i);
      }
   }
   return 0;
}

To view the solution click read more.

Three Years of Seti@home

Yesterday marks my 3rd year anniversary of contributing to seti@home, a project that analyzes radio signals to search for signs of extraterrestrial life. From their site you can download and install a client program, boinc, that downloads and analyzes radio data. By running the following command on ubuntu (possibly other distributions) you can install the boinc manager from the repositories.

sudo apt-get install boinc-*

Southern Vales Linux Users Group has a great tutorial that I found on installing boinc on a linux server without a GUI.

My stats for seti@home can be found here.

Math Art: Latin Square

According to Wikipedia: "A Latin square is an n × n table filled with n different symbols in such a way that each symbol occurs exactly once in each row and exactly once in each column." It is like a Sudoku board, but disregarding the nine 3 × 3 squares.

7 Job Search Suggestions

After 5 long months of job searching I have finally landed a job in my field, Software Development. For the benefit anyone out there still searching for a job, I have compiled a list of suggestions that I did during my time off that may help. Understand that I am no expert, but if any of these suggestions can help please take advantage of them.