<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/"/>

<title>Jeff Epler's blog</title>
<modified>2012-03-07T15:42:39Z</modified>
<tagline>Photos, electronics, cnc, and more</tagline>
<author><name>Jeff Epler</name><email>jepler@unpythonic.net</email></author>
<entry>
<title>Cancellation error</title>
<issued>2012-03-07T15:42:39Z</issued>
<modified>2012-03-07T15:42:39Z</modified>
<id>http://emergent.unpythonic.net/01331134959</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01331134959"/>
<content type="text/html" mode="escaped">
I was recently reminded of the importance of choosing numeric algorithms that
don't behave catastrophically for certain inputs.  One example is the
calculation of 1-cos(θ) for small θ.  In this case, cos(θ) is very close to 1,
leading to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Loss_of_significance&quot;&gt;large
cancellation error&lt;/a&gt; in the subtraction step.

&lt;p&gt;&lt;img src=&quot;http://media.unpythonic.net/emergent-files/01331134959/cancelerr.png&quot;&gt;</content>
</entry>
<entry>
<title>csql: perform sql queries on csv data</title>
<issued>2011-10-16T15:31:28Z</issued>
<modified>2011-10-16T15:31:28Z</modified>
<id>http://emergent.unpythonic.net/01318779088</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01318779088"/>
<content type="text/html" mode="escaped">

The websites I operate are flat-file based, so when I want to store
data it's easiest to write it in csv format.  But it's not particularly easy
to make queries on this data without additional software.

&lt;p&gt;I'd rather not fire up Open Office or try to figure out how to make awk
parse a quoted excel-format file, so I wrote 'csql', which reads a csv
file into an in-memory sql database, performs a query, and then writes
the result also in csv format.

&lt;p&gt;A short example:

&lt;p&gt;rsvp.csv:
&lt;blockquote&gt;&lt;pre&gt;
Buffy Summers,false,0
Xander Harris,true,2
Willow Rosenberg,true,1
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;rsvp.cols:
&lt;blockquote&gt;&lt;pre&gt;
name text
attend boolean
count integer
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Performing queries:
&lt;blockquote&gt;&lt;pre&gt;
$ csql rsvp.csv 'select sum(count) from t where attend=&quot;true&quot;'
3
$ csql rsvp.csv 'select name from t where attend=&quot;true&quot;'
Xander Harris
Willow Rosenberg
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;p&gt;&lt;b&gt;Files currently attached to this page:&lt;/b&gt;
&lt;table cellpadding=5&gt;&lt;col&gt;&lt;col style=&quot;text-align: right&quot;&gt;&lt;tr bgcolor=#eeeeee&gt;&lt;td&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318779088/csql&quot;&gt;csql&lt;/a&gt;&lt;/td&gt;&lt;td&gt;3.4kB&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;

&lt;p&gt;</content>
</entry>
<entry>
<title>Focus Stacking Success</title>
<issued>2011-10-11T03:17:19Z</issued>
<modified>2011-10-11T03:17:19Z</modified>
<id>http://emergent.unpythonic.net/01318303039</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01318303039"/>
<content type="text/html" mode="escaped">

I've finally had success with focus stacking!

&lt;p&gt;Inspired by &lt;a href=&quot;http://www.circuitsathome.com/camera-control/focus-stacking-assistant-for-eos-cameras&quot;&gt;the focus stacking assistant&lt;/a&gt;,
I wrote a Python program using &lt;a href=&quot;http://code.google.com/p/pyptp/&quot;&gt;pyptp&lt;/a&gt; that does something similar with a Canon EOS tethered to a Linux PC.
(I intend to release this in a bit, but it's very much &amp;quot;under construction&amp;quot;
code at this time)

&lt;p&gt;I then aligned the images in hugin and stitched with enblend.

&lt;p&gt;There's still some tinkering to do with tunable parameters, but it looks pretty
good!  In the thumbnail you can see that all of the table cloth is in focus;
view the medium or large versions to see more detail.

&lt;p&gt;&lt;span class=&quot;album&quot;&gt;&lt;!-- IMG_7870-IMG_7955_fused.jpg--&gt;&lt;div class=albumouter style=width:306px id=x0&gt;&lt;div class=albumimage style=&quot;width:306px;margin-left:0px;&quot;&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/IMG_7870-IMG_7955_fused-medium.jpg&quot; class=&quot;thickbox&quot; rel=&quot;album&quot; title=&quot;Fused Image&quot;&gt;&lt;img src=&quot;http://media.unpythonic.net/emergent-files/01318303039/IMG_7870-IMG_7955_fused-small.jpg&quot; width=300 height=198&gt;&lt;/a&gt;&lt;div &gt;&lt;div style=&quot;float: right&quot; &gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/IMG_7870-IMG_7955_fused-medium.jpg&quot;&gt;(M)&lt;/a&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/IMG_7870-IMG_7955_fused.jpg&quot;&gt;(L)&lt;/a&gt;&lt;/div&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/IMG_7870-IMG_7955_fused.jpg&quot;&gt;Fused Image&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;!-- img_7925.jpg--&gt;&lt;div class=albumouter style=width:306px id=x1&gt;&lt;div class=albumimage style=&quot;width:306px;margin-left:0px;&quot;&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/img_7925-medium.jpg&quot; class=&quot;thickbox&quot; rel=&quot;album&quot; title=&quot;Typical input image&quot;&gt;&lt;img src=&quot;http://media.unpythonic.net/emergent-files/01318303039/img_7925-small.jpg&quot; width=300 height=200&gt;&lt;/a&gt;&lt;div &gt;&lt;div style=&quot;float: right&quot; &gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/img_7925-medium.jpg&quot;&gt;(M)&lt;/a&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/img_7925.jpg&quot;&gt;(L)&lt;/a&gt;&lt;/div&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01318303039/img_7925.jpg&quot;&gt;Typical input image&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/span&gt;


</content>
</entry>
<entry>
<title>tnef2mime: automatically extract parts from winmail.dat</title>
<issued>2011-09-20T18:49:42Z</issued>
<modified>2011-09-20T18:49:42Z</modified>
<id>http://emergent.unpythonic.net/01316544582</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01316544582"/>
<content type="text/html" mode="escaped">

In her professional life, my fiancée routinely gets emails with attachments in
the 'winmail.dat' aka application/ms-tnef format.  It does her no good to
berate these prisoners of proprietary software, so I set out to provide her
with an easy-to-use solution that would work on her end.  Now, prompted by
&lt;a href=&quot;http://www.carbon-project.org/TNEF_or_how_to_lock_up_your_e_mails.html&quot;&gt;this blog entry&lt;/a&gt; I am posting it for others to use.

&lt;p&gt;There are a number of programs that can rescue data from this proprietary
attachment format, but I was not aware of a program that would automatically
convert the winmail.dat attachment to (a series of) regular mime attachments.
(it appears that &lt;a href=&quot;http://freshmeat.net/projects/ytnef_smtpd_py&quot;&gt;ytnef_smtpd&lt;/a&gt; may be such a program)

&lt;p&gt;So I wrote one, &lt;a href=&quot;http://media.unpythonic.net/emergent-files/01316544582/tnef2mime.py&quot;&gt;tnef2mime.py&lt;/a&gt;.   tnef2mime reads a message on
standard input, combs it for ms-tnef attachments, and uses the tnef(1) program
to extract their contents.  Then it takes the extracted files, adds them
as new MIME parts, and prints the whole resulting message.

&lt;p&gt;This is suitable for use in e.g. procmail:
&lt;blockquote&gt;&lt;pre&gt;
:0fw
| tnef2mime
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Several steps are taken in order to minimize the chances for data loss:  Just
in case it did an imperfect job, it leaves the existing ms-tnef attachment
intact.  If any problem is encountered, the unmodified message is written.

&lt;p&gt;This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

&lt;p&gt;&lt;p&gt;&lt;b&gt;Files currently attached to this page:&lt;/b&gt;
&lt;table cellpadding=5&gt;&lt;col&gt;&lt;col style=&quot;text-align: right&quot;&gt;&lt;tr bgcolor=#eeeeee&gt;&lt;td&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01316544582/tnef2mime.py&quot;&gt;tnef2mime.py&lt;/a&gt;&lt;/td&gt;&lt;td&gt;3.1kB&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;
</content>
</entry>
<entry>
<title>Enabling caching of my blog...</title>
<issued>2011-08-28T22:49:33Z</issued>
<modified>2011-08-28T22:49:33Z</modified>
<id>http://emergent.unpythonic.net/01314571773</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01314571773"/>
<content type="text/html" mode="escaped">

A long time ago, I wrote but never deployed a filesystem-based cache for my
aether blog.  This weekend, I cleaned it up and it's now running live on my
blog.  I hope nothing weird pops up as a result.

&lt;p&gt;The ultimate goal of this is to try to get the websites that are running
on my home system onto a web hosting provider, where CPU and disk I/O are
at much more of a premium.  So far, it improves the time loading the front
page of my blog by about a factor of 360 (yes—not 360%, 360 times) on the
local network when a cached respones can be used , which should make it quite
fast enough to run even on a shared hosting system like dreamhost.

&lt;p&gt;URLs with query parts (&amp;quot;?…&amp;quot;) are never cached, so if you read me via rss, may I
suggest to use the URL &lt;a href=&quot;http://emergent.unpythonic.net/_atom&quot;&gt;http://emergent.unpythonic.net/_atom&lt;/a&gt; if you
are not already.

&lt;p&gt;If you spot any problems, drop me an e-mail.
</content>
</entry>
<entry>
<title>Towards my GPS LED Light Clock</title>
<issued>2011-06-22T20:19:10Z</issued>
<modified>2011-06-22T20:19:10Z</modified>
<id>http://emergent.unpythonic.net/01308773950</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01308773950"/>
<content type="text/html" mode="escaped">
A few years ago, I made a CCFL light clock using an Arduino with a custom
shield containing a transformer (to get a reliable 60Hz timebase) and a
triac (for solid-state switching of the lamp).  By having a simple 7-day alarm calendar (set at compile time), the clock seldom requires interaction except for the reading lamp function.

&lt;p&gt;However, the design has two main problems:</content>
</entry>
<entry>
<title>Mandelbulber fractals</title>
<issued>2011-05-31T12:39:44Z</issued>
<modified>2011-05-31T12:39:44Z</modified>
<id>http://emergent.unpythonic.net/01306845584</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01306845584"/>
<content type="text/html" mode="escaped">
&lt;div style=&quot;float:right;clear:right&quot;&gt;&lt;!-- floater.jpg--&gt;&lt;div class=albumouter style=width:306px id=&gt;&lt;div class=albumimage style=&quot;width:306px;margin-left:0px;&quot;&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01306845584/floater-medium.jpg&quot; class=&quot;thickbox&quot; rel=&quot;album&quot; title=&quot;Floater&quot;&gt;&lt;img src=&quot;http://media.unpythonic.net/emergent-files/01306845584/floater-small.jpg&quot; width=300 height=200&gt;&lt;/a&gt;&lt;div &gt;&lt;div style=&quot;float: right&quot; &gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01306845584/floater-medium.jpg&quot;&gt;(M)&lt;/a&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01306845584/floater.jpg&quot;&gt;(L)&lt;/a&gt;&lt;/div&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01306845584/floater.jpg&quot;&gt;Floater&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
After the &lt;a href=&quot;http://emergent.unpythonic.net/01303141378&quot;&gt;video&lt;/a&gt; a few weeks ago, I've continued
playing with &lt;a href=&quot;http://sites.google.com/site/mandelbulber/&quot;&gt;mandelbulber&lt;/a&gt;.  Here are a number of images I particularly liked.</content>
</entry>
<entry>
<title>hostmot2-firmware 0.6 released</title>
<issued>2010-05-03T14:27:18Z</issued>
<modified>2010-05-03T14:27:18Z</modified>
<id>http://emergent.unpythonic.net/01272896838</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01272896838"/>
<content type="text/html" mode="escaped">
The main improvement since 0.5 is a new experimental xml format for 
describing bit files.  There are no functional changes in the firmwares since
0.5.  Packages for Ubuntu Hardy are on the linuxcnc.org package server.  The
files attached to this page may be useful to people using other OS distributions.</content>
</entry>
</feed>

