Archive for the ‘Software Development’ Category

Computer Glasses—Desktop or Laptop?

Tuesday, May 7th, 2013

I have a pair of prescription glasses just for the computer. But I notice I don’t wear them anymore, preferring a pair of progressive bifocals. So I tried to figure out why. Well, the computer glasses don’t focus properly unless I hold the laptop at arm’s length. While I was paying attention, I looked at how the progressives worked. The laptop is too far for the near part and too close for the far part. But between the two parts it progresses. If I hold my head just right, I can see a few lines clearly. Holding my head rigidly for a couple hours is not conducive to good health, eyes or neck and shoulder muscles.

So I’ll be asking for a pair of laptop lenses next visit to the eye doctor.

Too Clever by Half

Saturday, March 30th, 2013

My first cut at ZAML tried to minimize Amazon S3 (cloud storage) costs. There was just one full HTML page with a fragment stored for each quote. Javascript fetched the quote and inserted it into the page—a very simple, one page app, all in S3 with no server.

ZAML 2.0 added permalinks, a URL for each ZAML that could be copied into an e-mail or another Website.  I tried several things: bare URL with an anchor (e.g., http://zaml.us/#AbcD89) or a query parameter (e.g., http://zaml.us/?AbcD89). Neither played well with Google Analytics (GA) and with no server, that was the easiest way to track traffic.

Amazon S3 allows specifying an error document for a Website. This catches all missing pages and other errors. Ruby classes have something similar, a method_missing method. A common practice is to use it to extend a class at runtime, based on runtime information, e.g. dynamic find methods that search by a column in the database. Think of it as lazy evaluation of infrequently used methods.

With this insight, I could use the usual URL form, (e.g., http://zaml.us/AbcD89.html) and have Javascript in the error document extract the ZAML fragment name, fetch it, and insert it into the page. Clever!

But search engines don’t run Javascript normally and probably ignore 404 errors (Page Not Found). So ZAML works, but is not searchable. Not a good practice if I want people to find the site.

Amazon S3 is ridiculously cheap. You can store gigabytes for the cost of the smallest EC2 server. I was optimizing the wrong thing. So ZAML 3.0 has a full HTML page for each quote. I expect Google and the other search engines to start indexing ZAML soon. To play even better with the search engines, ZAML 3.1 will include a sitemap.xml file.

ZAML – Side Project Launch

Monday, February 4th, 2013

Today I’m publicly launching a side project, ZAML.  It’s like a bowl of fortune cookies with a daily featured fortune.  If you don’t like today’s fortune, take another.  And another.  There are hundreds.

ZAML (rhymes with camel) started out as a collection of quotes from Zen and the Art of Making a Living.  It has since expanded considerably with the weaker quotes replaced by stronger ones.  The quotes are mostly from creatives and mystics.  (Is Yogi Berra a creative?  Or a mystic?  Or something else?)  It is still growing, anything suitably short that speaks to me.

That is the “What is ZAML”.  The “How” is interesting in a technical way.  ZAML is a server-less Website.  In the last year, Amazon has added some features to its Simple Storage System (S3) in the cloud to make it possible to host a static Website (no server side logic).  It’s very reliable, massively scalable, and dirt cheap.  The little bit of logic in ZAML (picking a random quote) can be done in the browser in Javascript.

I would have liked to make it really small and simple, just a couple dozen lines of custom Javascript.  The first cut was small but making it work on all browsers wasn’t simple. There is too much variation in browser’s standards adherence (I’m looking a you Internet Explorer).  So I used the jQuery core library to deals with this.  It’s still relative small (jQuery is 32kB of Javascript) and only a dozen lines of custom Javascript.

It has been an interesting learning experience shifting from server-side to client-side logic.  ZAML isn’t yet feature-complete. Additional features and feedback are welcome at jeff dot taylor at IEEE dot org.

10 Minute Test Plan

Thursday, December 27th, 2012

A very good article on writing test plans in the IEEE Software magazine, 10-Minute Test Plan.  I can get behind this, it is a size and scale appropriate to the software I write, non-life critical, small to medium size organizations.  Too much of what is advocated is appropriate for life or health critical, enterprise systems.

A Rant on 42

Monday, November 26th, 2012

My IEEE card came in the mail today—Senior Member, valued member for 42 years.  Huh.  That’s a while.  Maybe it’s not time to join a startup.  The song playing in the coffee house is older than most people here.  And I heard it when it was first out.

There are people in the startup scene with naturally gray hair.  But they are mentors and angels.  And there’s the rub, I don’t feel up to these either.

I have taught and mentored people across two decades and at least two subject areas.  But now?  I’m stumbling about in Ruby on Rails for seven years and am still decidedly non-fluent.  I hack and slash the code until it doesn’t break so often.  It’s ugly and after a few months I can’t read it.  Where is the deep knowledge and simple elegance I once had?  I stopped caring enough to learn deep.  And maybe there is too much for one person to learn it all.  It shows in my work.  And in my workplace—it’s a mess of things to be completed stacked on top of tasks long past due.  If I missed a turnoff, it’s so far  back I can’t retrace my (mis)steps.

As Dante said, “At mid-life, I came again to a dark place in the woods where there was no road.”

 

I Thought It Was Just Me

Friday, November 23rd, 2012

Lately I have been moving away from programming, a career I’ve been doing for over forty years. It’s been my only career, so it’s not easy. In fact, it’s bewildering. Yesterday I wrote an little rant for myself about why. Today I encountered Do You Really Want to be Doing This When You’re 50?. The writer just lays out the reasons why he isn’t programming much any more. Huh, I thought it was just me.

Tomorrow I’ll put my more poetical and less conscious take on the subject into this blog.

Non-Interactive RVM Installation, Improved

Monday, November 19th, 2012

In my previous post on Non-Interactive RVM Installation, I described a problem (RVM in a script prompting for input) and a solution (redirect output to the null device).  It wasn’t elegant, but it worked.  To quote the TV detective Columbo, “This bothers me.”  It’s ugly and ugly solutions are often brittle.  In the RVM IRC channel, mpapis worked with me.  It required some reading, learning more about Bash, and understanding what I was being told to find a more elegant solution.

First, some jargon.  “rvm as a function” means a Bash function named rvm is defined and when Bash processes a line that starts with “rvm” the rest of the line is passed to the function, not to an executable named rvm.  To check which, type “type rvm | head -1“.  Typical responses are:

  • rvm is a function
  • rvm is /home/jeff/.rvm/bin/rvm
  • -bash: type: rvm: not found

The first two cases behave similarly, but not identically.  In my case, I want to force the second.  Bash has a built-in to do this, command.  So the solution is the following line:

command rvm install 1.9.2 -C \
--with-openssl-dir=$rvm_path/usr

According to the documentation, it should behave the same without the “-C” option, but doesn’t.  This solution doesn’t involve any hacks and will likely not be broken by rvm updates.

 

The Presidential Tech Teams

Monday, November 19th, 2012

The Obama and Romney campaigns’ technology teams are interesting reflections of the candidates themselves. I’m not sure they were the difference between winning and losing, but I am sure they contributed to the margin of victory.

The Obama tech campaign was modeled on the Lean Startup and Agile Development technologies and drew people from the biggest of the Internet companies: Google, Twitter, and Facebook.

The Obama team worked hard and smart.  They already knew how to scale. They and their massive product were prepared for Election Day.  Hip talent at its best.

The Romney campaign described Orca, their get-out-the-vote app, as a Narwhal-killer. But as one observer said, “That’s like calling the iPad a Facebook killer.” Orca is an app. The Obama team built an enterprise class ecosystem of apps, databases, and analysis tools. Orca was a “secret” weapon, but detail are emerging from campaign finance records.

Orca automated an existing, paper process.  It was a mild improvement, not a gamechanger.  It did not scale. And it was like Romney, crony capitalism.

Non-interactive RVM Install

Wednesday, October 31st, 2012

I’m setting up scripts to start up a Web app on an Amazon Web Services instance in the cloud. I’m starting with the latest Ubuntu image. Ideally, I could just launch an instance with the proper user data and it would start, install the necessary packages, and start the server. I’ve spent several weeks getting to the point where this works. The big stumbling block turned out to be installing Ruby with the Ruby Version Manager (RVM). RVM is a wonderful package that allows installing specific versions of Ruby. The Web app I’m installing needs Ruby 1.9.2. Ruby 1.9.1 does not work. Ubuntu defaults to Ruby 1.8 with incomplete support for 1.9. Hence the need for RVM.

The install instructions for RVM work beautifully. I’m very impressed. But on the first install of a Ruby, it spits out several pages of requirements and notes. Bash politely pages it (like more or less programs) and waits for you to read it and hit ‘q‘. Fine at the terminal and it doesn’t work from an unattended script. I tried using echo pass ‘q‘ to the standard input of rvm. Doesn’t work. I asked on the freenode.net #rvm IRC channel. Received some suggestions, mostly updating to newer versions. Didn’t work.

So I used the source, RVM is mostly Bash scripts. First I tried to figure out how RVM knows that a Ruby has already been installed. I didn’t succeed, there is just too much unfamiliar code. But I did note that the various notes and requirements printouts are from printf(), a Bash function. Nothing in the Bash man pages mentions the paging behavior, but only the requirements, the longest printout, is paged. So something knows how big the terminal is. What if there was no terminal? Redirecting standard error and standard output to /dev/null seemed a possibility. I tried it and it worked. So this is the line from the script that works:

rvm install 1.9.2 &> /dev/null

Marzipan

Monday, July 9th, 2012

Someone described reading Edsgar Dijkstra like eating marzipan, you should take small bites and chew thoroughly before swallowing.  When I first started writing technical articles, they were too dense to be easily understood – too much like technical standards, everything was stated only once, as unambiguously as possible.  For easy reading, they need to be twice as long with a certain amount of redundancy so any miscommunications were subsequently corrected.

One of my co-workers once observed that, “You can get more out of a line of code than anyone I know.”  On bad days I think this was a criticism.  On good days, I think it was a complement.  I think his statement is correct and maybe it’s just an observation.  In any case, do I need to change how I code?

Code needs to be poetry, documentation needs to be prose.
– Alex Yule (@yuletide)

Good poetry is dense, has multiple levels of meaning, words are chosen carefully – whether for a single meaning or a deliberate double entendre.  It is expected to require/reward extended study.  Should the same be expected of code?

And can bad code hide behind the same excuse just like bad poetry hiding behind impenetrability pretending to be depth?