Skipping! How could I forget the skipping?!

Hubris, I haz it

Hubris, I haz it

Mr. Noble is not the only one prone to hubris.1 After taking into account every post on ideal drawing robot pen holder criteria, I found one more post that I should have read first.  Dan Royer of MarginallyClever.com suggests2 as good pen holder should:

  1. A single cord convergence point.  “Have the two strings meet at a single point, or as close as possible.  The moment they separate the math gets really ugly.”
  2. Deal with friction.  “Friction causes the pen to drag and lean.  If I tell the robot to draw a square corner and it comes out rounded then I know my pen is dragging because it never reached the corner.  The pen has to stay at a right angle to the drawing surface.  So far I’ve found that having at least three points of contact is enough to eliminate the problem.  That’s why I tape my business card to an eye bolt on the bottom of the ring – the bottom edge of the card forms a large contact area with very little friction.”
  3. Be well balanced.  “If the pen is balanced wrong it may point up or down.  If it points up then it might go dry.  If it points down then it might have extra friction when moving downwards, causing the pen to skip and create a dotted line.”
  4. Have an easy way to switch pens.  “Not only should it be easy to replace a pen but every pen should “lock” into the pen holder at the same distance and angle from the drawing surface.  In order to simplify this problem I only use one kind of pen that comes in many colors.”
  5. Works on a slanted surface.  “Works on both vertical and slanted surfaces up to a maximum of 10 degrees.”

My own prior post on ideal characteristics in a pen holder took into account Dan’s number 1, 3, 4 and considered 5.  What I failed to consider was how friction can cause the pen to skip or stutter when the pen is mounted at an angle and the pen travels upwards.

Although I started diving into this consideration, but I’m putting all that over-pontification into its own post.  This post is really about (a) Dan considered a very important factor in pen holder construction which I neglected and (b) how awesome open source is.  My own pen holder would be a terribly complicated mess doomed to multiple revisions had I not had the benefit of being able to review a veritable legion of pen holders used by many many other people in their many many different kinds of vertical drawing robots.

So – Yay Dan!  Huzzah open source!

The next post will be about whether this consideration would cause me to change my existing pen holder design.

Default Series Title
  1. Photo courtesy of Markus Krispler []
  2. I’m keeping all of Dan’s words, but reformatting them []

Sweet PHP script, tragically terrible name

I’ve probably mentioned before how much of a PHP/MySQL/WordPress nerd I am.  If I haven’t so far, I’ve said so now.

One of the sites I operate requires numerous tables with about five million rows all together.  Automated backups are easy with any number of WordPress plugins.   But, what to do when you’ve got a HUGE SQL file and really small upload limits in phpMyAdmin and short server timeouts preventing a single script from reviving said huge file?

The brilliant scheme I came up with (I’m being sarcastic here) was to take those large files and split them up into smaller files of about 3MB each.  This approach was problematic for a number of reasons.  It required me to download a huge file and slice it up into small files between MySQL inserts.  Copying and pasting 25,000 rows at a time was giving my poor laptop fits.  It also meant I had to manipulate the full plaintext MySQL file, rather than a GZipped version.  On top of all of that, I was paranoid that I would accidentally omit a single row and have to start all over again.  In order to overcome the problem of server timeouts, I wrote a script that would load one small file, finish, then call itself again incrementing to the next file to be loaded, LRR.

There’s nothing good about this extremely time and labor intensive approach that was greatly error prone.

I wrote the above original serial-file-upload schema about a year and a half ago.  My PHP/MySQL kung fu is now much stronger.  Back then I never used scripts written by others – foolishly thinking that it would take me longer to understand how to integrate their scripts than it would be to build a serviceable script from scratch.  I went so far as to write my own AJAX library.  It was functional, but no where near the quality and reliability of jQuery.

Much humility and less hubris later, I’m more confident in my ability to read, understand, and interface with scripts written by others.  This now allows me to focus on only writing those things that are truly unique and critical to my projects, without having to re-invent the wheel.

What’s the name of this magnificent script I’m using for bulk uploads of really large MySQL databases?  Well, this is where the “tragically terrible name” bit from the subject line of this post.  The script is called <wince cringe>, “BigDump.”</wince cringe>  This script just automated a HUGE chunk of work for me.  Instead of struggling with more than 4 million lines of MySQL, I uploaded a SQL file, changed some variables in the BigDump script, and ran the script.

The total upload time is probably about the same as the script I was using.  The benefit is in not having to handle a ton of code before getting around to running the script