Possibly the best Linux find command examples

If you have been looking for a file on Mac OS X or Linux or Unix, you want to use the “find” command. The problem with the find command is that the usage information at the command line is just terrible. The solution is to bookmark this awesome website:

Here are some of my favorites:

Find a file by name in any directory starting with the root path

find / -name passwd

Find a file by name (case-insensitive) starting at the current directory and then run the command md5sum on each file that matches.

find -iname "MyCProgram.c" -exec md5sum {} \;

Find files starting in your home directory that are larger than 100 megatbytes.

find ~ -size +100M

And last, but not least, create an alias for a find command that will remove all files named “a.out” starting from the current directory

alias rmao="find . -iname a.out -exec rm {} \;"

Happy Hunting!

How to make Mac OS X and MySQL happy with Qt

Using shared libraries on Mac OS X is one of the things that is actually a lot harder than on Windows.  For example, you cannot just put the shared library for MySQL into your path or into the working directory. You have to change the plugin file itself to make it look in the correct location. You find the current value using the command “otool” and change the value using the command “install_name_tool”. Here is an example:

cd Qt/5.4/clang_64/plugins/sqldrivers/

otool -L libqsqlmysql.dylib 

libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)

install_name_tool -change /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.20.dylib ./libqsqlmysql.dylib 

otool -L libqsqlmysql.dylib 

libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/mysql/lib/libmysqlclient.20.dylib (compatibility version 18.0.0, current version 18.0.0)

Organized C code – Part 1 – The Headers

This is a step-by-step guide to writing code in C and keeping it organized as you go.  It will help you write code that can be reused on multiple projects and hardware platforms.  I will explain some of the finer details along the way so, technically, you don’t even need to know how to program in C to use this guide.

This first part will just go through some templates that every set of C header files will start with.  These header files are used to pre-define the C code you will be writing in a future part of this guide.  That is it for the introductions, now on to your first step writing organized C code!

Step 1

Create a directory for your files with two subdirectories: include and src.  For example, my directory structure looks like this:

directory structure


The include directory will store all of your header (.h) files and the src directory will store all of your source (.c) files.  These are the files that the C compiler will use to generate machine code (binary language) for your computer.  The C compiler has a “preprocessor” that will look through the code and make changes before attempting to generate machine code.  The C preprocessor is your friend and I will refer to it often.

Step 2

If you need a program to write files, I suggest Microsoft’s Visual Studio Code available here.

Create a text file for the public header that ends with .h to indicate it is a header file.  Save this file in your include directory. For example, the path to my file is:



Paste the following code into your file.  This is the code needed for every header file.  Each time you use this code, replace “ORGANIZED_H” with something that matches your file name.  The only requirement is that you make it unique.  The same name cannot be defined by any other code within a project that uses this header file and I will explain why below.

#ifdef __cplusplus
extern "C" {
// public header code goes here
#ifdef __cplusplus
#endif // ORGANIZED_H
// empty line

Here are details on this template line by line:

  1. #ifndef is a command used by the C preprocessor that means “If not defined”.  It is used here to check for the name that uniquely identifies this header file so that the entire file can be skipped if it has already been included in the project.  There are other ways to do this, but this method is the only one that is supported by ALL C compilers.
  2. #define is a command used by the C preprocessor that means “Define this value”.  It is used here to define the name you have chosen, which means the next time this header file is included somewhere in the project, the name will already be defined.
  3. #ifdef is a command used by the C preprocessor that means “If defined”.  It is used here to check if the compiler is actually a C++ compiler.  A C++ compiler can do everything a C compiler can do (and more), but it likes to keep things separate.  That is why we will add some code only if this is a C++ compiler.
  4. extern is a keyword that tells the compiler the following code should be made available throughout the program and not just to this file.  It is used here because a C++ compiler was detected at line 3 and we want all of our header code to be made available to C and C++ alike.  The { open brace starts a group of code (code block) that will be made accessible because of the extern keyword.
  5. #endif is a command used by the C preprocessor that means “End if”.  It is used here to end the #ifdef statement from line 3.  Every #if statement requires a matching #endif
  6. // is a single line comment.  Almost all C compilers support this.  If you want to be extra careful that your code will be portable (supported by ALL C compilers), you should write all comments like this instead:
    /* public header code goes here */
  7. #ifdef is here again to ensure we only write the code below it if this is a C++ compiler
  8. } is a closed brace that ends the extern group started at line 4
  9. #endif ends the #ifdef at line 7
  10. #endif ends the #ifndef at line 1.  The single line comment // to the side of the #endif makes it easy to find the #if statement that is being ended here.  This is because there could be hundreds of lines of code between the #if and #endif so it is not easy to read without the extra comment.
  11. This line should be empty.  This webpage won’t let me show it, but this should be an empty line.  If the last line in your file is not empty, the preprocessor could accidentally put code right next to it without any indication that it should have been separate.  If any of your .h or .c files do not have an empty line at the end, go add them now.

Step 3

Create a text file for the private header that ends with .h to indicate it is a header file.  Save this file in your include directory.  For example, the path to my file is:


Paste the header template code into your file and change the #define name and the comment to indicate this is your private header.  For example, I have changed lines 1,2,6,and 10:

#ifdef __cplusplus
extern "C" {
// private header code goes here
#ifdef __cplusplus
// empty line

That is it for Part 1.  You can download the sample code here.

In the next part we will start to fill-in the public header file.

Google Gmail access via POP3 gives ERR [SYS/TEMP]

Have you ever received this error from pop.gmail.com?

-ERR [SYS/TEMP] Temporary system problem. Please try again later.

I did.  It turns out that if you try to use SSL on port 995 and login using the USER and PASS commands, you will receive this error if you either: 1. tried to base64 encode your user/password data or 2. you did not setup an “App password” and use it instead of your normal password.

You can setup an “App password” here

That’s it for now.  Good luck!


Skreens review

My first impression of Skreens is positive, but it is very rough around the edges because it strives to do so much in it’s first major release.

It was super easy to setup!  I connected Skreens to a switch that is connected to my wifi router.  My iPhone found the device immediately.

I rotated the phone to landscape mode and could see the layout of the HDMI sources.

The virtual track pad works, but it was not obvious for what purpose until later when I was able to open the web browser interface and add a web window.  The iPhone app cannot do as much as the web interface yet.

Here you can select the HDMI source to use for audio. I am not sure how to mix sources yet.

Here you can see my Windows PC and Wii U are on Inputs 1 and 2.  I don’t have anything to connect for inputs 3 and 4 yet.

From the settings in the web interface you can choose to do an automatic firmware update.  The message is a little unprofessional looking but the process itself worked.

I started moving things around.  It works wells but is difficult to resize windows that overlap, especially on the iPhone.

I do think it’s great I can save layouts, capture the low-level descriptor, and even get layouts shared online.  It all works really well!

Here is part of the settings window.  You can see the Skreens device on the cabinet below.

I can’t figure out how to make the device output 1080P60.  My Panasonic AE8000U is reporting only 720P.  Honestly, it still looks really good.  I can’t wait to get the full 1080P and see how much more amazing it can get!

The box has a very bright green light that changes to blue sometimes but I am not sure why.  I hope that means they can add a software feature to disable the light ::hint hint nudge nudge::

The fan is quieter than my media center PC but not just a whisper.  Although I could not tell during the unboxing, the device does have an air vent on the top.  It is not warm at this location so it must be there to pull in cool air.

If you cover this vent the noise level drops significantly to an almost imperceptible level.  The device has 2 side vents so I don’t see why this one is necessary.  Don’t worry, I am not going to keep it covered, that would probably be a bad idea 😉

Overall I am happy with Skreens.  I look forward to future firmware updates!

Add minutes using Excel

This came up at work today.  How do you add minutes to a time using Excel?  The video below shows a quick solution without all the extra math you may be seeing from people who know the intimate details of how Excel stores date/time values.

…And while I am at it, remember that to “lock” a cell reference in a formula use the $ symbol.

Pool project completed 

This is a follow-up to our pool construction story

I can finally say that the pool project is done!  The pictures look great and it is almost exactly what we wanted.

Here are some pros and cons off the top of my head:


  • Great for swimming laps
  • Not too big to heat to a nice temperature
  • Salt chlorinator, automation system, in-floor cleaning, and screen enclosure make it easier to maintain
  • Spa gets hot quickly and is conveniently located near the house
  • Deck jets are pretty and fun for the kids and provide nice warm spots when the pool is still heating
  • The tile is beautiful!
  • Safety fence keeps the kids away from the pool so we can still just play outside without worry


  • Deck pavers allow a lot of dirt to build up and allow bugs to burrow between
  • Pool edge (coping) is slippery when wet
  • Pool lights are too bright and cannot be dimmed
  • Autofill is nothing more than a toilet fill valve.  Autodrain is nothing more than a hole in the strainer.  These work poorly at best.
  • Quartz surface is sloppy with many imperfections and blemishes that distract from the simplicity of the pool’s design and irreversible discoloration of the coping and tile grout
  • Safety fence is installed on or near paver edges causing weakness and potential for cracks
  • Foam accents are not the stucco pillars that were promised
  • Cleaning system automated valve and 2 cleaning heads already need slight adjustment
  • It would have been nicer to have just 2 steps into the pool but it would have been against code
  • Took 8 months longer than promised and required a lot of hand holding to avoid incredibly sloppy work and, in some cases, being completely ignored

Would I do it again?  Maybe.  But I would need to put a lot of thought into how I could avoid all of the stress it has caused me.  Considering the amount of pre-planning I put in, I was extremely disappointed with how often the work was done poorly, incorrectly, or late.  Only the tile installers were able to continually impress me.  I wish everyone would take as much pride in their work as they did.

Here are a few more pictures of the end result 🙂

Skreens unboxing

I am so excited to receive the Kickstarter edition of Skreens!  The package arrived in the mail today, a short 10 months since the project was funded.  Huge congratulations to Team Skreens!

Here is what we got:

1. Nice, simple box

2.  Power supply and quick start guide on top

3.  Here is everything taken out of the box

My first impression is that this is a well thought out package.  It includes everything needed to install the device and begin using it with existing equipment: HDMI cable, power supply, power cord, and the device itself.

I am a little disappointed that the device itself is in a plastic housing, with no standard mounting options, and a strange unlabeled button in the front.  But since this is a Kickstarter edition, I am also impressed at how much this already feels like a retail product.

Here are some more details:

The device itself is 8 inches wide. There are air vents on both sides so you’ll need at least 12 inches of width to keep the air flowing smoothly.

It is 4 inches deep, but watch out for that tiny white button on the front.  It is easy to bump it so I’d suggest giving the front a good half-inch more space and the back is where the wires go, which I always leave a minimum of 3 inches.  I’d recommend at least 8 inches of depth to allow for all of the wires and space in front to avoid any accidental button press.

The heighest point in the curved face of the unit is just shy of 2 inches.  If you are really tight in space I would allow for 1 and 7/8 inches.  There is no need for any additional height.
As for the power supply.  It is a typical power brick, but it is nice that this switching supply supports a large input range for those of you outside the USA.  This one has an output rated for 5V up to 4Amps, which means you won’t be powering this off a USB port.

That’s it for now.  Here is a quick look at the quick start guide.  I plan to install and test everything as soon as possible and will report my findings in the next post.

Oh, and here is a screenshot of the Skreens app before I have the device connected.

Our pool construction story

May 1st, 2015.  We loved our little backyard.  It was perfect except for the holly tree and lack of a pool.  Here is the story of how we started out with two kids and no pool, hired a pool company, and ended up with three kids and one pool.

IMG_6572I have a background in Digital Arts and have done a few other construction projects myself so we began working on designs.  We already had the property survey, we knew the setbacks and easements, and it was not long before we started to visualize what we wanted to build.

June 27th, 2015. We were down to three, very similar, design options.  It was time to find a pool company to help with the final details and begin the project.


July 6th, 2015. This was our first meeting with Atlas Pools.  We came prepared with our designs!  We picked out the tile, deck, pool equipment, and signed on the dotted line.


Here are the tile and deck pavers we chose.

IMG_5349August 14th, 2015.  My wife is now pregnant with baby Jasper.  That means in roughly 9 months we will have a newborn.  The pool hasn’t been started yet because we are working out some details with the HOA over landscaping, screen enclosure, etc.  We have a beautiful neighborhood and the extra scrutiny by the HOA was both expected and appreciated.  In the end, we were able to come to an agreement by adding an additional row of plants for privacy and ensuring the proper “architectural foam” was used for the screen enclosure.

October 1st, 2015. Everything is finally ready to go.  I removed the white picket fence and carefully stored it in my garage.  The pool company had the top layer of grass removed before they layout the pool.

IMG_8618October 2nd, 2015.  The pool layout is framed out so that digging can begin.  Notice that they left some sprinklers?  No worries, we had those zones capped off already so it’s ok.  The digger ends up ripping most of them out.

IMG_8627October 7th, 2015.  The dig is complete.  They did a pretty good job except that the pool company did not give them the most up-to-date drawing so they didn’t dig it quite as deep as it was suppose to be (more on this later).  I was told this is the official “start” of the pool build process and the entire thing will be done in 10-12 weeks.  That means we should be swimming by December 30th.  I can’t wait!

IMG_8649October 13th, 2015.  The rough plumbing is done for the in-floor cleaning system, returns, and drains.  The rebar for the gunite shell is also installed.

IMG_8683October 16th, 2015.  It is a good thing that I checked the depth and slope because both were way off.  The lowest point of the pool needed to be 6 inches lower and the “gradual” slope of the pool would have been more like a water slide.  In the picture below, the Atlas Pools salesman and project manager work to lower the main drain and later straighten out the slope.  It still is not perfect but it is much better than if I had said nothing.

IMG_8708October 21st, 2015. The pool is taking shape, but get used to the view because it will be like this for another two weeks.  In the mean time, additional plumbing is done and most of the pool equipment is installed.




November 9th, 2015.  The tile is installed and looks incredible!  Most of the ground has been back-filled so the deck can be started soon.

IMG_6721November 17th, 2015.  The forms for the retaining wall and coping around the pool are put in place along with some rebar for additional strength.  The screen enclosure will be going in around the entire deck once it has been laid.


IMG_9263November 19th, 2015.  The retaining wall for the deck and the coping have now been poured.  It will be another week before they start laying down the deck pavers.  Considering we were promised the pool would be finished by around Christmas, this project is going extremely slow.

IMG_9336November 26th, 2015.  The deck pavers are finally installed and look great in pictures.  The problem is that the paver installer did a sloppy job.  They didn’t make sure that the rows were perpendicular to the pool edge and left some tiny (less than 1″) columns right next to the spa.  There were also a few spots that were obvious tripping hazards that would need to be adjusted and they completely forgot one of the door pads.


IMG_7075As you can see, our yorkie is pretty happy with the work done so far.  Unfortunately, this is all that will be done for the next 4 weeks.

December 28th, 2015.  The screen enclosure was completed but, and this is a big one, they didn’t build it to the specifications approved by the HOA.  In fact, the entire enclosure was changed such that the architectural foam would end up being too large in some places and missing entirely in others.  The project should have been done by now, but what we didn’t know is that this mistake would push the project months past the originally promised date.  In hind-sight, they could have torn the entire structure down and rebuilt it to the original specification in a shorter amount of time.

IMG_0204IMG_0186January 12th, 2016.  Happy New Year!  The safety fence is now installed so that’s something.


January 25th, 2016. The foam accents are being installed.  They aren’t quite right but are pretty close to what we expected.  You can see the corner is about 6″ wider than it should be and they installed little booties on all the columns.  We had asked for a very modern look with no accents, but that was somehow lost.  The worst is yet to come, and we don’t even know it.IMG_8008

When all was said and done, the foam install looked awful.  We left in the morning and when we came back, the deed was done.  They added art-deco accents along the tops, they completely forgot the two new columns at the end of the deck, and the booties were floating off the ground around the entire enclosure.


Months go by with no action.  The foam company has lost employees and is saying it will not be able to fix anything till the end of March.  Make that the end of May.  I was tired of waiting to get my garage and yard back so I decided to install the fence.  They would just have to work around it.

April 3rd, 2016.  The fence is being installed.  I hired an expert and worked on the project myself as his assistant.  The install went perfectly and was completed in one day.  Thank you 🙂


May 13th, 2016.  I am tired of waiting to use the pool.  It is now super hot outside and we are over 5 months past the original project deadline.  I asked for the pool to be finished while we wait for the new foam.  The installers of the quartz finish were about as sloppy as the deck pavers.  Again, it looks good in pictures, but it has many obvious flaws including an unclean finish, sloppy edges along the stairs and spa seating, over-spray into the tile grout, and trowel marks throughout the bottom.

IMG_1701May 16th, 2016.  Remember my wife was pregnant?  Well, not anymore!  Jasper was born today and he is a super awesome baby.  My wife made an entire person before the pool company could build a pool…pretty sad.  But it isn’t entirely their fault, the foam people are still holding things up.  I can’t keep waiting for them so the landscaping is going in pronto, if only the garbage truck would stop breaking the irrigation.

IMG_1938June 13th, 2016.  The pool auto filler is connected (sort of).  It is at this time that I learn of a mistake that was made early on in the project.  Unfortunately, it is too late for the separate valve to the outdoor shower to be installed.  I had asked for the separate valve early on to make sure I could control the connection to the auto-fill and shower separately, but I guess they forgot.  It’s a pain, but something I can address myself in the future.


June 30th, 2016.  The foam install has restarted.  They didn’t paint anything correctly and forgot some pieces.  It has been so long now that I am starting to feel defeated.  I will just keep pointing out the errors and hopefully it will all be done someday.

IMG_2375 IMG_2377 July 8th, 2016.  I am still waiting for the deck jets to be fixed.  There was a leak in one of the them that had to be repaired first.  They also stick out of the deck and pose a tripping hazard.  This is something I pointed out a few months ago to the pool company and they are finally going to take care of it.  In fact, they did a really great job making these look better and the final result is much safer and lots of fun 🙂


It is now August, 2016, and the foam people still have a few things to finish and repair.  The in-floor cleaning system has finally been added into the automation system.  I just got the remote controls working from my iPhone and am very happy that it was easy to setup myself.  I did have to update the firmware on the protocol adapter myself, but my background in Software Engineering made that a piece of cake.

I promise the next post will have a lot less complaining and a lot more pretty pictures of the finished project…when it is done.

The project is done.  Find out more here!