# Arduino libraries

I’ve been working on a few Arduino libraries lately. Since there is no package manager for Arduino1 you have to install libraries manually. Generally, this is not a big deal as you just need to plop the library in your `/Arduino/libraries/` folder. If you are writing a library, spend the extra effort and make the library conform to the Arduino IDE 1.5 Library Specification. This will make it even easier to plop libraries in that folder and plus, your library and examples, will nicely display in the IDE.

However, the documentation is very sparse about what keywords are. Basically, keywords are used by the IDE to perform syntax highlighting and thankfully, this post provides some clarification. I also submitted an issue so hopefully they improve that page. I guess I could have edited the wiki directly, but I couldn’t find a link to the actual keyword definitions.

Lastly, if you do create an Arduino library, pretty please, with sugar on top, pick an OSI Approved License. It may be fun to pick something else, but consider that there may be somebody who wants to seriously use your library and unless you pick a clear license, it will be unclear how to incorporate your library with their larger work.

Enjoy the snow while it lasts.

1. Feel free to run off with this good idea.

# Heinlein the Software Engineer

Despite dropping-sideways from my Coursera course, I still can’t help but to pick up books lying around.  In fact, I’ve made this act easier for myself by dedicating a bookshelf completely to books that I haven’t finished. Time Enough for Love, by Robert A. Heinlein (RAH) was on the shelf and still being in the science fiction mood, I took it with me on my trip to San Francisco.

Even though I read Stranger in a Strange Land in High School, it wasn’t until well after I graduated college that I re-discover RAH and The Moon is a Harsh Mistress won me over.  I failed to appreciate RAH during college, which is a shame since RAH is a fellow alum from the U.S. Naval Academy.  Which is why the contrast of his counter-culture futuristic societies is even more drastic when I take into account his experience in the rigid social structure of the Naval Academy and the Navy.

But what does this have to do with software development?  Heinlein appreciated the virtue of laziness.  Certainly, this trait is not listed in Qualifications of Naval Officer (see below) but it is an especially important one in the software industry.

There is a chapter in Time Enough for Love, entitled “The Tale of the Man who was too Lazy to Fail,” that recaps the Naval career of David Lamb.  This character despised manual labor and was constantly looking for shortcuts, probably much to the chagrin of Jones.  At the academy, upper classmen force the freshmen (plebes) to memorize all sorts of silly useful things.  One statistic, on the forefront of a 1st classman’s (senior) mind is the number of days until graduation.  A particular evil firstie (as they were called), could require the number of seconds until graduation.  At any point, a firstie can require a plebe to provide the days/number of seconds until graduation and if not known, suffer unspeakable consequences.  So, David simply converted periods of time into 10,000 second increments and wore a watch divided in decimal partitions vice the normal hours and minutes.  When demanded, David produced a reasonably accurate time that was easy, for him, to calculate.  That chapter is filled with other anecdotes of a naval career that are accurate even today, like choosing to fly fixed wing aircraft to avoid the difficulties of landing on a carrier…

The moral for developers is to avoid “honest-work” like David and automate and invent quicker systems for performing mundane and repetitive tasks.  I stumbled upon this presentation by a GitHub employee on how to “unsuck your development environment.”  They have an impressive goal at GitHub to get a new employee to make a significant code contribution to a project in one week.  With the complex server and tool chain environments these days, that is quite an accomplishment, one that requires effort to make the first time installation effortless.  Setting up a development can be very frustrating and not very fun.  It’s like trying to paint, but realizing that first you have to make the brush from scratch.  Sure, some purists enjoy this kind of thing, more power to them, others would rather just paint.

Hackers are very good at asking the question, “Why am I wasting time on this and why can’t this be automated?!?!”  This is a good thing.  If it’s automated it should be repeatable and consistent and allow people to get back to creative work vice building scaffolding.  David Lamb has a certain Yossarian-like quality to him and while this quality may not have been respected in my past line of work, fortunately it’s useful now.

# I dropped-sideways from Coursera

My future potential will be forever blemished by my lack of completion in Coursera’s Fantasy and Science Fiction class.  So, it’s a good thing it’s not on any permanent records 😉 The class was well-organized and by-far one of the best English-literature classes I’ve taken.  The professor’s video lectures alone are worth signing up just to see.  In fact, his lecture on interpretation is a great explanation of why readers have different views of a book and why some are wrong.

Honestly, the timing of this class was not very convenient.  It came smack in the middle of my Database final, leaving the military (for good this time), and moving back home.  But, I still found time to go to the Philadelphia’s Linux User Group (PLUG) and hear some anecdotes by Eric Raymond.

There was about 20 Penguin-heads in attendance and after an hour of lively discussion from Virtual Machine hosting to the Carrington event, ESR took the podium.  He told of several anecdotes, some which I intend to post about in the near future, but the one that fits well with my Coursera experience was his tale of Culture Hacking.

On his blog, ESR advocates the creation of a “ground truth” document by software engineers, who find themselves working on hardware, or a system, with less than adequate documentation.  Simply put, it is the process of document assumptions about how the system works prior to writing any code.  Some enlightened commenters expressed thanks to ESR for naming a practice for which they’ve routinely performed. Culture. Hacked. This practice now has a name to which others can refer and spread.  While it may not be the catchiest name, the fact that the idea is now named gives it weight.  In fact, this is one of the few things that stuck with me from Gravity’s Rainbow (that and I want a banana greenhouse on my rooftop):

“Names by themselves may be empty, but the act of naming…”

So, in the spirit of a new J.J. Abrams show, I officially bestow this name: Drop Sideways: The act of no longer attending a MOOC.  I would call it pulling a “datko” but something tells me that thousands of others are doing the same thing.  Besides, at my last job, I’ve heard some shout “datko!” when there was just enough coffee in the pot, for a half cup :p

# Emacs and PostgreSQL

One of the nice things about going to grad school, is that I really get to refine my Emacs fu.  I’m taking this database class where we are using PostgreSQL and I’m using Emacs’ minor sql modes and I’m very impressed.  Now, I’m no emacs knight, nor do I have the Emacs-fu of the emacs rocks guy, but like any good student of zen, I’m maintaining a beginner’s mind (which is pretty easy to do with Emacs since it does pretty much everything).

So, with the setup in the screenshot and working in the SQL minor mode, once I’ve written my query, I can shoot it over to the SQL Interpreter with at quick ^C-^C, which then runs the query and outputs the results, meanwhile the point stays right where I left it!  Logging into the database is easy by firing off $\texttt{M-x sql-postgres}$ and entering your credentials.  This mode is even more essential when SSHing in the department CS machines, where I then must connect to a remote DB server, only accessible from another CS department machine.  Since this all is done in Emacs, in one screen, I have a complete SQL IDE, which is great.

This may seem a bit archaic to some to still use Emacs when there are other, more intuitive interfaces out there.  But even those vim users can appreciate that there is much to be had for learning the same tool and using it everywhere.  Admittedly, in this area I need some attention since I’m writing this post now in WordPress’ online editor, and I actually like Eclipse’s intellisense, and I’m tied to a proprietary editor at my day job.  But besides WordPress, Eclipse, Mail, roads, public order and sanitation, what has Emacs done for us!?!  Brought peace?!

Areas where I think I can realistically incorporate Emacs:

1. First draft of blog posts.  100% integration looks a bit wonky with WordPress and I’m still in that baby-blogger phase where I bounce back and forth from the preview to the  edit screen and make tweeks.  But the main draft can (and should) be authored from Emacs.
2. Code more in Emacs.  For any of the scripting languages this is easy.  For C and C++, this isn’t too hard for me either since I never really grew up on Visual Studios, but for Java… Typing $\texttt{this.}$ and then seeing a list of options is very handy.  Except when I had this kick where I was over-using reflection, then Eclipse can’t really keep up…
3. Email.  I checked out gnus the other day and while I see how an Emacs only mail client can be done, with so much inline html these days, I’m not sure if its worth it.  But I’m poking a stick at this bear and I’ll probably come back to it.
4. $\LaTeX$.  I love $\LaTeX$.  Once I learned WordPress supported this, I was even more addicted to WordPress.  My résumé, presentations, papers, letters (when I must actually print one out), are all done in lovable $\LaTeX$.  If you find yourself cursing at M\$ Word, take the red pill my friend.  And then you’ll start cursing weird compile errors, but worry about that after you take the pill…  Many thanks to Brent over at The Math Less Traveled for showing me this!

Well, that’ll keep me busy for a while 🙂