<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://www.physics.drexel.edu/~wking/blog/styles/feed.css"?>
<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/">
<channel>
<title>unfolding disasters</title>
<link>http://www.physics.drexel.edu/~wking/blog/archives/linux/index.html</link>
<description>notes and ideas vaguely related to AFM force spectroscopy</description>
<dc:language>en-us</dc:language>
<dc:creator>Trevor</dc:creator>
<dc:date>2010-08-27T23:15:32-04:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2010/06/24/index.html#e2010-06-24T15_52_08.txt</link>
<title>SiteCorePy</title>
<dc:date>2010-06-24T15:52:08-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux</dc:subject>
<description>
<![CDATA[<p>As the Physics webmaster, I'm in charge of transitioning most of the
static department content into SiteCore, as the powers that be get
wise to the ways of version control.  Unfortunately, I'm not the
biggest fan of SiteCore.  Major gripes include:</p>

<ul>
<li>Poorly conceived versioning.  Some things are versioned, some things
aren't.  No tools (that I've found yet) for analyzing history except
on a per-page scope.  Also, can only commit changes at the page
level, which makes a single "I added alt tags to all my images"
commit impossible.</li>
<li>Browser-only interface.  That's right, no scriptable API short of
driving a browser through a script.  This one is so huge, I'm not
really sure what else to say.  Surely people occasionaly want to do
something that the designers hadn't planned for, like, oh, importing
data from a preexisting database.</li>
</ul>

<p>Anyhow, to overcome the major limitation, I'm <a href="http://www.physics.drexel.edu/~wking/code/git/git.php?p=sitecorepy.git">driving my browser
through a
script</a>.
Thanks to the magic of
<a href="http://code.google.com/p/selenium/wiki/GettingStarted">WebDriver/Selenium</a>
for making this possible.</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/10/21/index.html#e2009-10-21T10_00_56.txt</link>
<title>Website unittesting with Selenium</title>
<dc:date>2009-10-21T10:00:56-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux, Fun</dc:subject>
<description>
<![CDATA[<p>I just discovered <a href="http://seleniumhq.org/">Selenium</a>, which allows you
to drive browers programmatically.  This allows you to test the
effects of javascript on the browser's internal page representation.
Not very useful for the department website, since we don't use much
javascript, but I like its python interface, so I'm replacing my
traditional spider with a Selenium implementation.</p>

<p>Some bugs I've run into so far:</p>

<ul>
<li><a href="http://jira.openqa.org/browse/SRC-758">start() doesn't take any
args</a>.  Simple fix in
selenium.py.</li>
<li><a href="http://jira.openqa.org/browse/SRC-721">captureNetworkTraffic("xml") returns requestHeaders as
responseHeaders</a>.  Fixed in
source, but you'll need to compile your selenium-server.jar on your
own.  There's a nice, detailed explaination of building Selenium
with <a href="http://maven.apache.org/">Maven</a>
<a href="http://wiki.openqa.org/display/SRC/Developer%27s+Guide">here</a>, but
for the impatient, a simple <code>mvn install</code> in the svn root directory
should do it.</li>
<li><a href="http://jira.openqa.org/browse/SRC-759">captureNetworkTraffic("xml") captures invalid XML in URL's
(ampersand problem)</a>.
Another simple patch, but this one's just posted by me, so you'll
have to apply it by hand and recompile.
You get the feeling that people don't use the captureNetworkTraffic
side of Selenium very often ;).  Ah well, only 3 open bugs in that
area left to bump into ;).</li>
</ul>

<p>To keep the test suite easy to maintain, I build it on the fly using
<a href="http://somethingaboutorange.com/mrl/projects/nose/0.11.1/writing_tests.html#test-generators">nose
generators</a>,
which are awesome :).</p>

<p>More details to come...</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/10/05/index.html#e2009-10-05T09_01_49.txt</link>
<title>Elsevier and LaTeX</title>
<dc:date>2009-10-05T09:01:49-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux</dc:subject>
<description>
<![CDATA[<p>Recently I've been writing up an article for one of the
<a href="http://www.elsevier.com/">Elsevier</a> journals using their
<a href="http://www.elsevier.com/wps/find/authorsview.authors/elsarticle">elsarticle</a>
LaTeX package.  Unfortunately, their BibTeX style file,
elsarticle-num.bst (version 1.1, 2008-10-13), is a bit broken.  With
the help of Nicolas Markey's excellent <a href="http://www.ctan.org/tex-archive/info/bibtex/tamethebeast/">Tame the
BeaST</a>,
I've <a href="/~wking/tools/elsarticle/elsarticle-num.bst">fixed it up</a>, so it
runs without errors (!), works with
<a href="http://www.ctan.org/tex-archive/help/Catalogue/entries/natbib.html">natbib</a>'s
<code>\citet{}</code>, and conforms with the examples posted in the
<a href="http://www.elsevier.com/wps/find/journaldescription.cws_home/525446/authorinstructions#68000">International Journal of Biological Macromolecules' author
guide</a>.</p>

<p>Update: Oct. 6.  Turns out <a href="http://www.elsevier.com/wps/find/authorsview.authors/elsarticle">the code linked from
Elsevier</a>
is out of date.  Rishi over at
<a href="http://www.river-valley.com">River-Valley</a> (writers of the elsarticle
package) pointed me to some <a href="http://support.river-valley.com/wiki/index.php?title=Elsarticle.cls">more up to date documentation and
source</a>.
Version 1.2 fixes most of my problems (with elsarticle-num-names.bst),
but I'm still not sure why it doesn't replace elsarticle-num.bst
entirely...</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/07/18/index.html#e2009-07-18T17_25_18.txt</link>
<title>Email interface to bugs everywhere</title>
<dc:date>2009-07-18T17:25:18-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux, Fun</dc:subject>
<description>
<![CDATA[<p>I've been amusing myself over the past few days working up an email
interface for the distributed ugtracker <a href="http://bugseverywhere.org">Bugs
Everywhere</a>.  One of the things we've been
struggling with with BE is how end users should submit
bugs/comments/etc, since</p>

<pre><code>$ apt-get install bzr
$ bzr branch http://whatever/remote/repo local_repo
$ cd local_repo
$ be new "The demuxulizer is broken"
Created bug with ID 48f
$ be comment 48f
&lt;Describe bug&gt;
$ bzr send --mail-to "whatever-dev@fancyprojects.com"
</code></pre>

<p>mostly just raises eyebrows among non-devs ;).  My interface replaces
it with</p>

<pre><code>$ cat | mail -s "[be-bug] new" "whatever-dev@fancyprojects.com"
The demuxulizer is broken

&lt;describe bug&gt;
^D
</code></pre>

<p>Which will hopefully be more user friendly.  Of course, most non-devs
I know (and some devs) avoid the command line like the plague, so we
will still want a web-frontend.  Luckily, web frontends seem popular
with other devs, so I don't have to bother with that ;).</p>

<p>Curious parties can branch my public repo:</p>

<pre><code>$ bzr branch http://www.physics.drexel.edu/~wking/code/bzr/be-email be.email
</code></pre>

<p>As a nice side effect of this little project, my
<a href="/~wking/code/python/send_pgp_mime"><code>send_pgp_mime</code></a> is now much more
elegant.</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/05/08/index.html#e2009-05-08T10_56_46.txt</link>
<title>warning: Clock skew detected</title>
<dc:date>2009-05-08T10:56:46-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Linux</dc:subject>
<description>
<![CDATA[<p>I was running <code>make</code> to build <a href="http://www.comedi.org/">Comedi</a> against
the current Hardy kernel, and it died with</p>

<pre><code>...
make[1]: Warning: File `Makefile' has modification time 1.1e+02 s in the future
make[1]: Nothing to be done for `clean-am'.
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory `/thor/wking/src/lab/comedi/comedi-build'
make: warning:  Clock skew detected.  Your build may be incomplete.
</code></pre>

<p>“No problem,” thinks I, since I'd just rebooted into the new kernel,
but I'd pulled the source in under the old kernel.  I'll just <code>touch</code>
all the files to make sure their times are in the past.</p>

<p>Nope.  Same error.  Turns out my <code>touch</code> is from the future:</p>

<pre><code>$ date; ll include/Makefile; touch include/Makefile; ll include/Makefile; date
Fri May  8 10:48:35 EDT 2009
-rw-r--r-- 1 wking wking 15540 2009-05-08 10:48 include/Makefile
-rw-r--r-- 1 wking wking 15540 2009-05-08 10:50 include/Makefile
Fri May  8 10:48:35 EDT 2009
</code></pre>

<p>This is because my files are NFS mounted from another computer, and
the clocks were out of sync by two minutes.  Time to setup
<a href="http://www.ntp.org/">NTP</a> for the lab LAN ;).</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/03/31/index.html#e2009-03-31T18_21_54.txt</link>
<title>inotify</title>
<dc:date>2009-03-31T18:21:54-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux</dc:subject>
<description>
<![CDATA[<p>I just discovered <code>inotify</code> and it's command-line incarnation
<code>inotifywait</code> (in
<a href="http://packages.debian.org/lenny/inotify-tools">inotify-tools</a> on
Debian).  Now I can watch the data come in from home.  If only I had
the laser- and photodiode-alignment screws motorized...  Anyhow,
checkout <a href="/~wking/code/#monfold">my script</a>.</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/03/31/index.html#e2009-03-31T15_26_53.txt</link>
<title>In the Beginning was the Command Line</title>
<dc:date>2009-03-31T15:26:53-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Linux, Fun</dc:subject>
<description>
<![CDATA[<p>By Neal Stephenson.  <a href="http://www.cryptonomicon.com/beginning.html">Read it</a>.
It's a bit dated, obviously, after ten years (1999), but the basic ideas are
still on target.  Plus it's a lot of fun ;).</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2009/02/04/index.html#e2009-02-04T06_39_37.txt</link>
<title>Command line PGP/MIME</title>
<dc:date>2009-02-04T06:39:37-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux</dc:subject>
<description>
<![CDATA[<p>I've been scripting up a few things recently and my inability to send
nicely formatted PGP/MIME messages was starting to really bug me.  I
had been encrypting my logwatch output with gpg and just emailing the
raw gpg out to myself, but it's annoying to have to ESC-P every time I
want to decrypt a log.  The tipping point came while I was writing up
a script to automatically email grades out to my students (not that
any of the student's care about PGP, but it's the principle of the
thing ;), since there's no way I'm going to send them raw gpg output
(they would die) and there's also no way I'm going to hold Mutt's hand
while it signs the emails.  I dunno why Mutt doesn't have some --batch
mode options to support PGP, but there it is.</p>

<p>So I wrote my own.  Not very complicated really, just implementing the
<a href="http://www.ietf.org/rfc/rfc3156.txt">RFC 3156</a> specs.  There's
obviously room for improvement, but it works well enough to make me
happy at the momemt.  You're welcome to <a href="/~wking/code/python/send_pgp_mime">take a
look</a> and email me with
[encrypted!] feedback.</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2008/12/20/index.html#e2008-12-20T21_40_44.txt</link>
<title>Splittable **kwargs</title>
<dc:date>2008-12-20T21:40:44-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Linux</dc:subject>
<description>
<![CDATA[<p>Ah, it has been a while, but I am excited about a new python module I
wrote so I shall post again ;).  Actually, there has been a lot of
Python learning over the past two months.  It started out when I felt
the need to setup a bug-tracker to keep track of all the things going
wrong with my cantilever calibration software :p.  Since I'm using git
for versioning, I naturally wanted a 'distributed bugtracker'.
Luckily there are a number of nice ones out there.  I've been using
<a href="http://bugseverywhere.org/be/show/HomePage">Bugs Everywhere</a>.  My other
favorite is <a href="http://ditz.rubyforge.org/">Ditz</a>, but I like being able to
hack away on BE in my familiar Python.</p>

<p>Besides helping keep track of my bugs, I've enjoyed hacking away at
BE.  In the process I've learned some cool tricks such as <a href="http://www.python.org/dev/peps/pep-0318/">Python
decorators</a> (see <a href="http://adam.gomaa.us/blog/the-python-property-builtin/">this
tutorial</a> for
some really neat examples) and <a href="http://www.debian-administration.org/articles/317">Bash
autocompletion</a>.</p>

<p>Meanwhile, the calibration code developed, and I was getting tired of
keeping assorted keyword arguments default in sync (how many times do
I have to repeat minFreq=500?).  The way to avoid repeating yourself
in this situation is to use <a href="http://docs.python.org/tutorial/controlflow.html#keyword-arguments"><code>*args</code> or
<code>**kwargs</code></a>
(see <a href="http://wiki.wxpython.org/wxPython Style Guide#line-42">wxPython's endorsement</a>).
I don't trust myself to keep my code in sync enough to use <em>args, so
lets focus on *</em>kwargs.  Consider the following example:</p>

<pre><code>&gt;&gt;&gt; def A(a=1):
...     return a
&gt;&gt;&gt; def B(b=2):
...     return b
&gt;&gt;&gt; def C(**kwargs):
...     return A(**kwargs)+B(**kwargs)
&gt;&gt;&gt; C(a=3,b=4)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "&lt;stdin&gt;", line 2, in C
TypeError: A() got an unexpected keyword argument 'b'
</code></pre>

<p>Hmm, how to split the kwargs into those for <code>A</code> and those for <code>B</code>?  So
I wrote the <a href="/~wking/code/#splittable_kwargs">splittable_kwargs
module</a>.  See the docstrings
for some usage examples and more info.  With my module the above
example becomes</p>

<pre><code>&gt;&gt;&gt; from splittable_kwargs import splittableKwargsFunction
&gt;&gt;&gt; @splittableKwargsFunction()
... def A(a=1):
...     return a
&gt;&gt;&gt; @splittableKwargsFunction()
... def B(b=2):
...     return b
&gt;&gt;&gt; @splittableKwargsFunction(A,B)
&gt;&gt;&gt; def C(**kwargs):
...     akw,bkw = C._splitargs(C, kwargs)
...     return A(**bkw)+B(**akw)
&gt;&gt;&gt; C(a=3,b=4)
7
</code></pre>

<p>In other news, my current side project is a MySQL-based, multi-user,
archiving, command-line grade database.  Down with web-forms ;).
More information to come as the project progresses.</p>]]>
</description>
</item>
<item>
<link>http://www.physics.drexel.edu/~wking/blog/archives/2008/10/01/index.html#e2008-10-01T19_55_03.txt</link>
<title>PlotPick program</title>
<dc:date>2008-10-01T19:55:03-04:00</dc:date>
<dc:creator>Trevor</dc:creator>
<dc:subject>Programming, Theory, Linux</dc:subject>
<description>
<![CDATA[<p>While calibrating my photodiodes, some of my surface bumps went out of
the linear-response range.  Since I'm not confident in my ability to
set boundaries programmatically at the moment, I thought I'd write up
a little utility to record clicks on key data points, so I could pick
out the “good data”.</p>

<p>Enter
<a href="http://www.physics.drexel.edu/~wking/code/index.shtml#plotpick">plotpick.py</a>,
the raw-data version of
<a href="http://www.physics.drexel.edu/~wking/blog/archives/2008/09/05/index.html#e2008-09-05T20_20_30.txt">clicklock.tk</a>.
Hope you like it :).</p>]]>
</description>
</item>
</channel>
</rss>

