Appropriate thing to say


Posted by Jaime | Posted in Funny | Posted on 29-10-2010

Tags: ,

I was at a funeral for my wife’s great uncle. Sitting in front of us were his grandchildren and my mother-in-law recognized one of the boys and said, “I remember you. I was at your bris”

“Ah… awkward…”, he replied.

I tried to lighten the moment by saying, “You don’t normally hear that at a funeral”, though I thought his response was better than mine.

Now I shared this story with my co-worker and he said, “You know, it would have been more appropriate to say, ‘I remember when you were born'”

“But then, what would have been the appropriate thing to say to something that is inappropriate? ‘Oh yeah! It healed up fine. Do you wanna see?'”

Getting rid of the Boost warnings


Posted by Jaime | Posted in Coding | Posted on 29-10-2010

Tags: , , ,

Ever since I started to do 64-bit development, I had a problem with the Boost headers producing a ton of implicit conversion warnings in Xcode.
This is due to the fact that I am compiling with the following flag:


I got this idea from both Herb Sutter and the Viva 64 website, where you should be compiling cleanly with the highest warning level turned on.
Well, with that warning turned on, I was getting well over 1000 warnings with the same message:

warning: implicit conversion shortens 64-bit value into a 32-bit value

I let this go for a while because Xcode doesn’t support the warning suppression flag available in GCC and I really don’t have too much control over the files that were causing the warning.
Well, I finally had to fix the problem: the continuous build system I’m using was spitting out a ton of warnings from some projects and finding the errors in a sea of warnings was making me miss the important stuff.
By accident, it dawned on me that warnings in system headers are ignored, so, it would seem logical to have the boost headers included with the system header search path:

OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS) -isystem\Users\jaimerios\Development\Blah\boost\boost_1_41

I saw a lot of other posts where people complained about this same issue, but no one had a solution to this.
So far, this is working for me, and hopefully, this will work for you too if you have this problem.

Creating a Tag with Subversion


Posted by Jaime | Posted in Coding | Posted on 27-10-2010

Tags: , , ,

If you have the need to create a tag from your current source code, you can use the copy command from the shell of your preference:

$ svn copy
-m "Creating 2.0 release of the 'MineMineItsMine' project."

Dr. McNinja


Posted by Jaime | Posted in Not-so-funny | Posted on 27-10-2010

Tags: ,

So, what’s going on with Dr. McNinja?

Chris Hastings hasn’t updated the site since last Friday.

This is one of my favorite web comics and I’m left wondering, “what happens next?”.

What gives? 😐

I made a Widget!


Posted by Jaime | Posted in Coding | Posted on 27-10-2010

Tags: , ,

In the course of the day, I actually open several web pages related to the work I do. The browser, for better or for worse, has become part of my workflow.

After a while, it can get annoying to constantly have to log in to separate pages to see all of the data I need for work.

Well, why not use Dashboard? I could use some of the Widgets that are already out there, but then there would be a security issue.

So, time to break out Dashcode.

Authoring Widgets couldn't get easier

To my surprise, it was really easy creating a Widget using Dashcode. For my needs, I needed to create a custom RSS reader and a template for one was already supplied with the IDE.

The whole process involves working down a checklist of items the IDE requires for making the Widget work.

For any custom control you add to the interface, the IDE nicely displays all of the messages the control can respond to and easily places you in the JavaScript code so that you can edit your custom handler.

The only part that I had to dig around for was how to save out the Widget preferences.

After some digging around, I found the sync() function which actually makes a call to the preferenceForKey() function. This, along with the setPreferenceForKey() function was how I was able to get and set the preferences for my custom Widget.

So, I only created one text field to hold my URL, a button to set the preferences and within that same function, the call to bring the front of the Widget back around.

Not bad!

Saving energy on a FreeBSD server


Posted by Jaime | Posted in Review | Posted on 25-10-2010

Tags: , , ,

FreeBSD is an awesome operating system, but if your machine is set up like mine… the drives spin all the time and can actually suck up some juice.

A month later, opening the electric bill made my eyes open wider than they usually do at a bill when I see the bigger bill.

Okay. I think we can solve this.

There’s a utility for spinning down the drives, named ataidle, and I found information about this nifty binary at

It also happens to be installed in the ports directory: /usr/ports/sysutils/ataidle

So, if you want to save some green and go green too, check out this app and install it on your own FreeBSD machine.

The only thing about an utility like this is that certain programs, database programs for example, may be very sensitive to the drives spinning down for no apparent reason. So consider what programs are running on your system before you install this program.

Symbol visibility in Mac OS libraries


Posted by Jaime | Posted in Coding | Posted on 22-10-2010

Tags: , , ,

I was having a nice coding day. Xcode was behaving nicely and all of my code seem to behave like I wanted to … then …

Crash. Okay. I can handle a crash. But. Looking at the call stack from the crash, something didn’t look right.

In the call stack there was a reference to the std::string class. But the function where the crash is happening doesn’t have any references to std::string.

What. Is. Going. On?

Okay. Time to pull up the debugging console and see what is going on.

I type “bt” in the GDB console… nothing unusual… other than the call to the phantom std::string.

So now I switch the debugger display to show both the source code and assembly code.

Nothing looks unusual stepping through the code… but… I don’t understand how std::string is being called.

I copied the Hex address where the crash is happening and back to the GDB debugger and I typed:

info shared 0X0SOMELONGHEX

To my surprise, the code had jumped to some other library that had nothing to do with my function.

Hold on here. Is this doing what I think it’s doing?

It seemed that during my application startup, one of the other dylibs that was loaded first had a reference to the same function my dylib was using, but an earlier version of the code. Both dylibs had the code statically linked in, but, they were both exposed.


Well, that shouldn’t be too hard to fix. Just set the symbols to hidden:


Well that should have fixed my problems but I still had a lot of cleaning up to do. RTTI information was no longer easily accessible and libraries that depended on that accessible code no longer saw the symbols during the linker portion of compiling.

So, it seems that if you don’t hide your symbols, on the Mac that is, the dlopen app will match up symbols from two different libraries and pick the first one, even if they are private to the file and not exposed in any headers, causing a nice crash that produces a call stack that doesn’t make sense.

Oh. Kay. Lesson learned.

Getting GDB to stop on a conditional breakpoint


Posted by Jaime | Posted in Coding | Posted on 20-10-2010

Tags: , ,

One of the cool things about Xcode and GDB is that you can create custom breakpoints that could be set up by calling a function within your own project.

GDB supports C functionality in their conditional checks, but for me, I found this functionality to be particularly helpful when paired with convenience variables.

So, let’s say you have a string in your function and you want your breakpoint to only be triggered when the string matches a particular pattern. What you could do is the following:

  1. Set up a convenience variable and set that to the result of a strstr call
  2. Create another breakpoint where it breaks on the new convenience variable

In a breakpoint, set the following in the command:
set $myRes = (char*)strstr(myCharPtr, “My search string”)

For this particular breakpoint, you can actually set it to continue since you don’t want to stop every time GDB gets to that point.

Now in a new breakpoint, set the condition for that breakpoint to $myRes

One problem I see with this is that you might break on a line of code that doesn’t make sense if the same variable was modified by another thread.

In this case, you might want to reset the variable or have another condition to check the thread id too!

How to detect what SDK you are building for in Xcode


Posted by Jaime | Posted in Coding | Posted on 18-10-2010

Tags: , , ,

I recently had to build a file for multiple operating systems and had to figure out a way to enable a feature that is only available on Mac OS X 10.5 and greater, and Windows.

Here’s how I did it:

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) || defined (_WIN32)
   #include <omp.h>

Now, technically there is no harm with including omp.h with your Mac project, I’d like using that as an example as opposed to using Cocoa.h/Afx.h.

The Social Network


Posted by Jaime | Posted in What's New | Posted on 17-10-2010


I just saw “The Social Network” with my wife.

I liked the movie and so did my lady. A couple of things I came away with after the movie:

1. I remember why I became a programmer: because it’s cool 😉 No, that’s not being sarcastic.

2. My didn’t my college have programming drinking games. Why not?

3. How much truth was there to that movie?

I feel a great need to code, even with my belly filled with nasty tasty popcorn, junior mints and diet cola.

Coding is cool… Yeah!