Thought For The Day

“Every mathematician worthy of the name has experienced... the state of lucid exaltation in which one thought succeeds another as if miraculously... this feeling may last for hours at a time, even for days. Once you have experienced it, you are eager to repeat it but unable to do it at will, unless perhaps by dogged work....”

Andre Weil


C++ Programming: Debugging and Common Mistakes

Today we are going to talk about something a little different than what we have talked about so far in our object-oriented programming series.  We will discuss some common mistakes programmers make when writing C++ programs, where to look when your program isn't working correctly (or isn't working at all), and how to use some of the debugging tools available in most IDEs.  Before we begin, it should be clear that every problem is specific, and there are no universal rules or ways to debug your program.  However, if we consider the usual, object-oriented structure of a C++ program, we can implement some basic strategies for identifying and fixing errors in our program.

First, let's make a distinction between various types of errors which can occur:

  • Compiler errors: These errors (and sometimes warnings) are detected by the compiler.  They prevent the program from being compiled.  Since today's compilers are extremely complex, they can detect a large variety of mistakes, including syntax errors, wrong number of arguments to a function, undefined references etc.
  • Linker errors: These are errors generated when the executable of the program cannot be generated.  This may be due to wrong function prototyping or incorrect header files.
  • Execution errors: This is a large class of various errors which went undetected by the compiler.  In C++, you will often get errors like segmentation faults, which mean that the program tried to access a part of memory which didn't "belong" to it.  This is due to the nature of C++: constant dealing with pointers and references and being responsible for memory management yourself.
This leads to some common mistakes, such as:
  • Not freeing all of the dynamically allocated memory
  • Using delete instead of delete[]
  • Returning local objects by reference
  • Using references to deleted resources
This list is just something which should be checked when debugging your programs; these mistakes are easily made, and sometimes they can be difficult to find.


Now, we will talk about debuggers: collections of very powerful tools which IDEs offer to the programmer.  The debugger enables you to follow the execution path of your program, and examine the value of variables as you step through your code.  This is extremely valuable when you are trying to determine why your program doesn't work.

The most significant technique for debugging is strategically placing breakpoints: this enables the programmer to intentionally pause the execution of the program, in order to inspect variables, memory, logs, files etc.  Placing breakpoints at key points in the program is a good strategy for locating an error.  Here is an example of debugging a program in C++, using Visual Studio (most IDEs have very similar ways of placing breakpoints, inspecting memory etc). debugging example


Note that you have to set your program to "debug" mode in order for this to work.  As you can see in the picture, after you've placed a breakpoint and ran the program, you can inspect values of variables simply by hovering over them.  You can also use the "Immediate Window" to evaluate expressions during debugging. debugging example

Social Media Isn’t Just for B2C: 3 B2B Marketing Tips

Many B2B companies are reluctant to devote time and money to social media initiatives, because they think that this type of marketing only applies for B2C organizations.  However, that isn’t the case.  Any company can benefit from social media marketing.

Consider the data.  According to the Weidert Group, over half of B2B marketers say that they’ve generated leads from the use of social media; they also report that social media has improved customer experience and brand health, with nearly a quarter seeing an increase in revenue.  Furthermore, 78% of B2B marketers said they saw increased traffic with as little as 6 hours a week invested in social media marketing.

With those figures in mind, here are some tips for using social media to promote your B2B company:

  1. Leverage Creative Content.  As a B2B marketer, there are a number of interesting ways you can engage with your target audience.  We recommend that you consider using white papers, webinars, eBooks, and case studies.  In fact, case studies are one of the most effective ways for B2B marketers to generate leads.

  2. Focus on LinkedIn.  If you only have the time to devote to marketing on one social media platform, make it LinkedIn.  Statistics show that 80.33% of B2B social media-generated leads come from LinkedIn.  By comparison, Twitter—the 2nd most successful social media platform for generating B2B leads—offers a mere 12.7%.

  3. Feature a Real Person.  One problem that B2B marketers run up against is that without a real person representing their company, their brand can seem remote and less personable.  To get around this, Kissmetrics recommends that businesses humanize their company by using a brand front person to tweet, post updates, and write articles in the first person.  

Thought For The Day

“The worse my drawings were, the more beautiful did the originals appear.”

John James Audubon


3 Strategies for Overcoming Social Anxiety

For the 3.3 million Americans who suffer from social anxiety, certain work responsibilities—like giving presentations and meeting new clients—can be challenging.  These activities can even be difficult for shy people who may not have a clinical diagnosis of social anxiety.

If you’re shy or suffer from social anxiety, here are some strategies to help you navigate your work place with greater ease:

  1. Try “Implosion.”  Psychology Today describes this as tackling a challenge that you find so intimidating that your original goal (to feel more comfortable in social situations) no longer fazes you.  For instance, psychologist Albert Ellis once decided to approach every woman sitting alone on a bench at the New York Botanical Garden.  While he experienced discomfort, he learned that he wouldn’t die from it and eventually found that approaching women became much easier.  He said that of the first 130 women he went up to, he only got 1 date but later, he became “one of the best picker-uppers of women in the United States.”

  2. Ask Questions.  One thing that makes people with social anxiety particularly uncomfortable is having the focus on them.  By asking questions, you can direct your attention outward and feel more relaxed in social situations.  Try asking open-ended questions (rather than yes/no ones) and use the information you gleaned to deepen your connection with others.  Most people are quite happy to talk about themselves and will appreciate your interest.

  3. Avoid Catastrophizing.  It’s not uncommon for people who fear social situations to imagine the worst (“I’m going to bomb this speech,” or “I’m terrible with small talk.”).  Rather than allowing your mind to dwell on imagined negatives, think supportive thoughts that will pave the way for new and better experiences.  For instance, you might tell yourself things like, “I’ve never bombed a speech before, because I’m always well-prepared,” or “While I prefer more intimate conversations, I do fine with small talk and had a great experience talking to John at the company picnic last week.”