I’m still not 100% sure how I came to hang a barn door in my living room. I think maybe my wife and I were playing chicken with each other. Neither of us blinked, and now I have a barn door, which I love and had a great time making, hanging in my living room. Woo!
Monthly Archives: November 2011
Abusing a Character Display
One of the first things I bought to use with my arduino was a 2×16 character display, specifically this one from Adafruit. Playing with it was fine, but after looking at the interface to the LiquidCrystal library I decided to see if I could abuse it by making it into a cheap-o Etch-a-Sketch.
Stage 1 of this project worked fine, and was actually a bit of fun (although it was kind of cheating – I’m supposed to be challenging myself with hardware, and this was really all just programming). I knocked up a couple of trimmers to use as the knobs, whipped up some modulo arithmetic, and I turned my 16×2 character display into a 80×16 pixel display.
Here’s a not-great video of the result:
Next I wanted to make drawing persistent, to be able to actually draw. Seemed simple enough – I had been building custom characters on every update, with the current x,y bit turned on, then writing that char to the correct x,y character position. All I should have to do it maintain an array of characters. Then on each iteration when I set the x,y position, it’s an update, not an entirely new character. Then when I write the character out, I’ll get the entire state for the board.
Unfortunately, this exposed a pretty fundamental misunderstanding I had of the character displays. I assumed that since I was only updating a single “character” at each loop, all the characters I wasn’t touching would just stay put. However, when I re-create the custom character at each loop, that also updates every place on the display that was showing that “character”. It actually looks fairly interesting as, over time, multiple characters on the screen start to come to life and start changing in sympathy with each other. Cool, but not at all what I wanted.
This failure completely makes sense as I think about it. Since the LiquidCrystal library only supports 8 unique custom characters I can’t make use of the whole screen just through the standard library. It’s possible that the 8 character limitation is arbitrary and that I could raise it by mucking around in the library, but that doesn’t sound like that much fun.
There are a couple of possible next steps I could take here:
- Just to show the core of what I wanted to do, use the 8 custom characters I get from the LiquidCrystal library to make a 2×4 character (16×20 pixel) display. I will probably do this and take a video of it just to have done it. One of the original goals in this project was to just make anything that I wasn’t copying from someone else. Ideas include a write/erase function, “status” lights, an “invert” button, a non-state-changing cursor, basically anything to take up a pin on the Arduino. Now that I write this down and remember what my goal was, I’ll probably do this no matter what
- I could track down the LiquidCrystal library and understand what the root of the 8-custom-character limit is. If it’s an arbitrary software limit, maybe raise it and recompile. If it’s not arbitrary but due to memory, maybe make a custom version of the library in which some standard characters are missing, allowing me to use their memory space for more custom chars. I doubt I do this anytime soon, but if I decide to play around more with Arduino libraries, this might be a fun platform to learn more about them.
- If the limit on the number of custom characters turned out (somehow) to be hardware based, then I could skip the LiquidCrystal library altogether and see if I could somehow force the hardware to do what I want if I give up on the need for standard characters. I think the only way I would do this is if I actively needed to learn about the LCD chipset’s low level use for some other reason.
- There’s a strong possibility that I may bag everything above because I had an idea for a new project that I want to get working using my Arduino. Since this is the most interesting thing I’ve made that I haven’t copied form someone else, I should take this opportunity to think about how I will store project information. I’m not fond of the Arduino dev environment’s file system layout requirements and concessions I have to make to it to use SVN, but I do have this sketch in SVN. Need to lean more about creating and storing schematics. Can I store them with the Arduino sketch without the Arduino software complaining? What’s the best software to use? Right now I just want to sketch something out that I can use to recreate the circuit later, and that I can put in version control. ASCII art would work right now, but I wonder if there’s an advantage to finding more specific software this early in my learning cycle…
Right. Disappointed that my original idea didn’t work, but still plenty to learn in that list above. I wonder if I can get 1 and 4 done while waiting for parts for NewProjectIdea?
UI Improvements for TestLink’s Vertical Step Layout
I have previous posts on several improvements which drastically improved my team’s ability to use TestLink:
- Alternating Test Step Row Colors in TestLink
- Better Copy/Paste When Editing Test Steps in TestLink
- Setting Default Font in TestLink
As we began really testing in earnest, we found that the “horizontal” test case layout we had been using was limiting in several ways. First, when the expected results was a collection of logs rather than a text description of behavior, it became a labor to find the relevant bits in the long log lines. Second, some types of expected results would cause the results cell to take up as much horizontal space as possible, which squashed the “actions” cell. On more than one occasion I had to copy the actions to a text file so that I could read them in a meaningful manner.
Update 2012-05-08: There is a usable-with-the-patch-command patch available that incorporates all of these changes and more. See the README at the base of the github repo for more details on what’s in that patch.
Fortunately there is also a “vertical” test case layout. We recently switched to using this and so far it solves our problem. Unfortunately I had to reimplement all of the items from the links above. The diffs below are the changes I made to our files to get the desired changes. Possible items of interest:
- The diffs below assume that the changes from the previous blog posts have been made. This affects the line numbers in the diffs, as well as things like the existence of the CSS file and its contents.
- I never really liked the alternating BG color behind the steps, but it was the best solution in the horizontal view. In the vertical view I alternated the colors in the empty gutter cells to the left of the action/result rows. Since there’s no text in those cells, it allowed me to use darker, more contrasting colors.
Index: gui/themes/default/css/custom.css
===================================================================
--- gui/themes/default/css/custom.css (revision 241)
+++ gui/themes/default/css/custom.css (revision 242)
@@ -6,6 +6,14 @@
background-color: #CCCCCC;
}
+.row_color_3 {
+ background-color: #555555;
+}
+
+.row_color_4 {
+ background-color: #AAAAAA;
+}
+
div.c_actions, div.c_expected_results {
font-family: 'Courier New', Courier, monospace;
}
Index: gui/templates/testcases/inc_steps.tpl
===================================================================
--- gui/templates/testcases/inc_steps.tpl (revision 241)
+++ gui/templates/testcases/inc_steps.tpl (revision 242)
@@ -91,14 +91,16 @@
{/if}
{foreach from=$steps item=step_info}
<tr>
- <th width="25px"><nobr>{$inc_steps_labels.step_number}
+ <th width="25px"><nobr>
<span class="order_info" style='display:none'>
<input type="text" name="step_set[{$step_info.id}]" id="step_set_{$step_info.id}"
value="{$step_info.step_number}"
size="{#STEP_NUMBER_SIZE#}"
maxlength="{#STEP_NUMBER_MAXLEN#}">
{include file="error_icon.tpl" field="step_number"}
- </span>{$step_info.step_number}</nobr></th>
+ </span><span {if $edit_enabled} style="cursor:pointer;"
+ onclick="launchEditStep({$step_info.id})"{/if}
+ >{$inc_steps_labels.step_number} {$step_info.step_number}</span></nobr></th>
<th>{$inc_steps_labels.step_actions}</th>
{if $session['testprojectOptions']->automationEnabled}
<th>{$inc_steps_labels.execution_type_short_descr}:
@@ -111,10 +113,8 @@
{/if}
</tr>
<tr>
- <td> </td>
- <td colspan="2" {if $edit_enabled} style="cursor:pointer;"
- onclick="launchEditStep({$step_info.id})"{/if}
- style="padding: 0.5em">{$step_info.actions}</td>
+ <td class="{cycle values="row_color_3,row_color_3,row_color_3,row_color_4,row_color_4,row_color_4"}"> </td>
+ <td colspan="2" style="padding: 0.5em"><div>{$step_info.actions}</div></td>
{if $edit_enabled}
<td class="clickable_icon">
<img style="border:none;cursor: pointer;"
@@ -133,13 +133,13 @@
{/if}
</tr>
<tr>
- <th style="background: transparent; border: none"></th>
+ <td class="{cycle values="row_color_3,row_color_3,row_color_3,row_color_4,row_color_4,row_color_4"}"></td>
<th colspan="2">{$inc_steps_labels.expected_results}</th>
</tr>
- <tr {if $edit_enabled} style="cursor:pointer;"
- onclick="launchEditStep({$step_info.id})"{/if}>
- <td> </td>
- <td colspan="2" style="padding: 0.5em 0.5em 2em 0.5em">{$step_info.expected_results}</td>
+ <tr>
+ <td class="{cycle values="row_color_3,row_color_3,row_color_3,row_color_4,row_color_4,row_color_4"}"> </td>
+ <td colspan="2" style="padding: 0.5em 0.5em 2em 0.5em">
+ <div>{$step_info.expected_results}</div></td>
</tr>
{/foreach}
{/if}
Index: gui/templates/testcases/tcStepEdit.tpl
===================================================================
--- gui/templates/testcases/tcStepEdit.tpl (revision 241)
+++ gui/templates/testcases/tcStepEdit.tpl (revision 242)
@@ -223,7 +223,7 @@
{else} {* Vertical layout *}
{foreach from=$gui->tcaseSteps item=step_info}
<tr id="step_row_{$step_info.step_number}">
- <th width="20">{$args_labels.step_number} {$step_info.step_number}</th>
+ <th width="20"><a href="{$hrefEditStep}{$step_info.id}">{$args_labels.step_number} {$step_info.step_number}</a></th>
<th>{$labels.step_actions}</th>
{if $session['testprojectOptions']->automationEnabled}
{if $step_info.step_number == $gui->step_number}
@@ -244,24 +244,24 @@
{/if}
</tr>
<tr>
- <td> </td>
+ <td class="{cycle values="row_color_3,row_color_3,row_color_3,row_color_4,row_color_4,row_color_4"}"> </td>
{if $step_info.step_number == $gui->step_number}
<td colspan="2">{$steps}</td>
{else}
- <td colspan="2"><a href="{$hrefEditStep}{$step_info.id}">{$step_info.actions}</a></td>
+ <td colspan="2"><div>{$step_info.actions}</div></td>
{/if}
</tr>
<tr>
- <th style="background: transparent; border: none"></th>
+ <td class="{cycle values="row_color_3,row_color_3,row_color_3,row_color_4,row_color_4,row_color_4"}"></td>
<th colspan="2">{$labels.expected_results}</th>
</tr>
<tr>
- <td> </td>
+ <td class="{cycle values="row_color_3,row_color_3,row_color_3,row_color_4,row_color_4,row_color_4"}"> </td>
{if $step_info.step_number == $gui->step_number}
<td colspan="2">{$expected_results}</td>
{else}
<td colspan="2" style="padding: 0.5em 0.5em 2em 0.5em">
- <a href="{$hrefEditStep}{$step_info.id}">{$step_info.expected_results}</a></td>
+ <div>{$step_info.expected_results}</div></td>
{/if}
</tr>
{/foreach}
The Unfortunate George Foster
I was listening to the Stuff You Missed in History Class podcast tonight titled “Who was the real Dr. Frankenstein?“. The podcast was ok, was familiar with the popularity of “let’s shock dead things and see what happens” experiments in the early 19th century, and that the discussion of these had most likely sparked the idea of Dr. Frankenstein and his monster in Mary Shelley.
One specific detail really grabbed me. While there was a fad, the original idea seems to have been largely conceived of by Luigi Galvani and popularized and refined as a road show by his nephew Giovanni Aldini. I certainly don’t want to give these guys short shrift as they were clearly serious scholars. Galvini gave his name to the process of galvanizing metals, among other achievements, and Aldini is the direct father of electro-shock therapy and the removed ancestor of the defibrillation process. But, without quite so much academic detachment, what you basically had was a guy shocking a corpse in front of a live studio audience (don’t forget to tip your waitress!).
On January 18, 1803, George Foster was hung as the convicted murderer of his wife and youngest child. After he was dead he was cut down and taken to the Royal College of Surgeons, where he was to be the main exhibit for Aldini’s performance that evening. Aldini applied direct current to the face, causing muscles to clench and Foster’s left eye to open. The show-stopper, though, was the application of the current to Foster’s rectum, resulting in convulsions in the entire body, including his arms being thrown into the air and his back arching as if he were taking a gasping breath.
Good times, good times.
After all this, the whole reason this really captured my interested was a statement made in the podcast that even if Aldini had “reanimated” Foster. The exact words in the podcast were something like “police had a plan – if Foster had been reanimated he would have been re-executed”.
This strikes me as kind of a raw deal. Not that I’m a big fan of murder, but, come on, being killed once should be enough. I decided to track down this statement in the podcast and see if it had any basis in fact.
The first hit is George Foster’s wikipedia page, always a good place to start research (though a poor place to finish it, of course). That page states that “[t]he Newgate Calendar reports that even if this had been so, he would have been re-executed since his sentence was to ‘hang until he be dead’”. Nice.
The Newgate Calendar is two things. First, it was a monthly summary of executions at Newgate Prison. Secondly, it was very popular collection of stories of the various crimes committed and punishments received. As I read it, in 1825 the parents in a family would have this book in the home to “scare straight” the kids. It also appears to be fairly entertaining reading, in much the same way a horror movie can be entertaining. But more on that in a minute.
I found two very good sources for the Newgate Calendar’s entry on George Foster. The easiest to read is at a very interesting site I just found tonight called “The Ex-Classics Website“. There is a page dedicated to George Foster’s entry. Since I don’t know the reputation of Ex-Classics, I also found the entry on Google Books. The Google Books entry corroborates the Ex-Classics page but is harder to read. It’s worth it though because it provides the original layout – some context was lost in the Ex-Classics page.
Here’s the specific entry I’m curious about, the one regarding re-executing Foster (the line’s in a footnote, including the footnoted body text also for context):
[...] On the first application of the process to the face, the jaws of the deceased criminal began to quiver, and the adjoining muscles were horribly contorted, and one eye was actually opened. In the subsequent part of the process the right hand was raised and clenched, and the legs and thighs were set in motion. *[...]
* An experiment was made on a convict named Patrick Redmond, who was hanged for a street robbery, on the 24th of February, 1767, in order to bring him to life. It appeared that the sufferer had hung twenty-eight minutes when the mob rescued the body and carried it to an appointed place, where a surgeon was in attendance to try the experiment bronchotomy, which is an incision in the windpipe, and which in less than six hours produced the desired effect. A collection was made for the poor fellow, and interest made to obtain his pardon, for it will be remembered that the law says the condemned shall hang until he be dead; consequently men who, like Redmond, recovered, were liable to be again hanged up until they were dead.
This isn’t really what I was hoping for. I imagined a court decree and armed guards around the building. Instead we get this footnote, and here begins my real concern with the historical accuracy. Because the popular Newgate Calendar essentially justified its existence by editorializing the crimes, this footnote basically reads to me as “Hey you kids, don’t think just because you might get resurrected that you can escape the fate that awaits you should you slip into a life of sin”. So it appears that I have a contemporary source for the statement, but the source isn’t reliable.
I did have fun looking through this tonight even if the final stop isn’t the most satisfying. I’ll end this with a great sentence, from George Foster’s entry in the Newgate Calendar
[T]he cap was pulled over his eyes, when the stage falling from under him, he was launched into eternity.
Sources:
- http://www.executedtoday.com/2009/01/18/1803-george-foster-giovanni-aldini-galvanic-reanimation/
- http://en.wikipedia.org/wiki/The_Newgate_Calendar
- http://en.wikipedia.org/wiki/George_Forster_(murderer)
- http://www.guardian.co.uk/education/2004/oct/07/research.highereducation1
- http://en.wikipedia.org/wiki/Giovanni_Aldini
- http://en.wikipedia.org/wiki/Luigi_Galvani
- http://www.exclassics.com/newgate/ng464.htm
- http://entertainment.howstuffworks.com/hsw-shows/stuff-you-missed-in-history-class-podcast.htm
- http://podcasts.howstuffworks.com/hsw/podcasts/symhc/2011-10-19-symhc-frankenstein.mp3
- http://books.google.com/books?id=_bJIAAAAYAAJ&pg=PA314#v=onepage&q&f=false
