Skip to content

{ Category Archives } Software

When Ants Come to Your Picnic

Since I posted my “Sling Blade Runner” answer, I’ve been in discussion with Benjamin Meyer about the puzzle, my solution, and other general topics. During this discussion, he shared his solution with me, and as a collaboration, we found a set of movie titles that is 326 movies long. The original list of [...]

Sling Blade Runner

Lately, I’ve been without a project to keep me busy at nights (hence all my blog posts). I’m learning python, but since my main gig is C/C++, I like to keep those skills sharp with little puzzles. While looking for interesting coding puzzles, I stumbled across a page at ITA Software that asks [...]

Beautiful Code

Recently, my wife and I went to the local Borders, and I saw O’Reilly’s Beautiful Code. Since the book has sat in my Amazon queue for months, I was excited to get a chance to peruse it. So, I gleefully sat down, cracked the cover, and proceeded to read a number of chapters.
I’ll [...]

Safe Mutex Management

Recently, I’ve been writing a fair amount of threaded C++ POSIX code, and (as I often do), I decided to wrap the POSIX mutexes in a convenient little wrapper class:
 
class Mutex
{
pthread_mutex_t mMutex;
public:
Mutex() { pthread_mutex_init(&mMutex, NULL); }
~Mutex() { pthread_mutex_destroy(&mMutex); }
 
void [...]

Escaping the MTRX

Embedded developers have it harder than most. Often we don’t have library options most other developers do. For example, the library might depend on file I/O, or it might require easy access to a large heap, or it even might require floating point arithmetic that our part is no good at implementing in [...]

A line in the sand

The other day, someone (who shall remain nameless to protect their identity) asked me the following:

I have a set of data points, (X,Y), and I know they are related through a simple function:

How do I determine m, and b?

Now, there are many ways to determine values for m and b; but, right now I’d like [...]

Is an NSPoint in an NSBezierPath?

There’s a shortcoming in NSBezierPath that bugged me for years — there is no easy way to tell if an NSPoint is in the bezier path. Fear not, here is a category on NSBezierPath that supplies a function for finding whether or not a point is in an NSBezierPath.
 
{
if([myBezierPath pointInStroke:thePoint])
[...]

Tricky Trig

Recently, I needed to generate sine and cosine values at a rapid rate. I couldn’t use C’s sin and cos functions as they took too much processing power. Additionally, since I needed phase angle resolution of 16 bits precision, a lookup table would have required 2^16=65,536 word sized entries — an impossible requirement [...]

A Misunderstood Beast

I don’t want my blog to become a C++ lovefest, but I just seem to keep running into possible topics within the language to post about.
Recently, I ran across an article on embedded.com by Alan Anderson. I love everything he says in the article, save one paragraph:

Given the drawbacks to all of these approaches, [...]

The Ties That Divide

Recently, I have been working on a project with the Make Controller. The Make Controller has been a handy platform for me to explore the ARM architecture, and the libraries distributed by MakingThings make it easy. While screwing around with the build of FreeRTOS included with the software, I stumbled across a piece [...]