<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>LoonSoft LLC</title><generator>Tumblr (3.0; @loonsoft)</generator><link>http://loonsoft.com/</link><item><title>Rvm &amp; Daemontools</title><description>&lt;p&gt;Any &lt;a href="http://beginrescueend.com"&gt;rvm&lt;/a&gt; prior to 1.8.3 can&amp;#8217;t be used in the 
     &amp;#8220;rvm exec&amp;#8221;
form inside &lt;a href="http://cr.yp.to/daemontools.html"&gt;daemontools&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The problem is that rvm leaves a bash wrapper around the ruby process, where daemontools requires that its managed processes exec away any wrappers.&lt;/p&gt;

&lt;p&gt;You know you have this problem when svc -dk doesn&amp;#8217;t actually kill your ruby process (but does kill the wrapper), causing daemontools to think the process is down (and thereby possibly spawn a new one, ad infinitum).&lt;/p&gt;

&lt;p&gt;Upgrading to the latest head version is a good fix for this problem, but if you can&amp;#8217;t do that, you can just set up your environment to use ruby directly in your daemontools run script thusly:
    #!/bin/bash&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;exec 2&amp;gt;&amp;amp;1
#load your ruby env
source /usr/local/rvm/scripts/rvm
rvm use yourruby@yourgemset
#exec normally
exec thin  -e production -c . -p 7400 start
&lt;/code&gt;&lt;/pre&gt;</description><link>http://loonsoft.com/post/10164508608</link><guid>http://loonsoft.com/post/10164508608</guid><pubDate>Tue, 13 Sep 2011 09:47:00 -0500</pubDate></item><item><title>Explicit ordering in mysql</title><description>&lt;p&gt;A client application receives record ids in a particular, and meaningful order. We need to fetch blobs out of MySQL in that same order using an IN clause. Problem is, order is not guaranteed, unless ORDER BY  is present, and our MySQL has no idea how the original order was concocted.&lt;/p&gt;
&lt;p&gt;Previously, the code selected out the target data, and re-ordered the resultset in memory. This is very, very costly for large numbers of results, which all have to be returned at once, whereas I would like to &amp;#8220;stream&amp;#8221; the result set (in order thanks), using &lt;a title="lazy enumerators" href="http://www.michaelharrison.ws/weblog/wp-trackback.php?p=163"&gt;lazy enumerators&lt;/a&gt; (and &lt;a title="more on lazy enumerators" href="http://railsillustrated.com/how-to-be-lazy-in-ruby-and-why-you-should.html"&gt;here&lt;/a&gt;).  &lt;/p&gt;
&lt;p&gt;What to do?&lt;/p&gt;
&lt;p&gt;The non-obvious solution, after much googling, is that we can use the MySQL function &lt;a title="find_in_set documentation" href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set"&gt;find_in_set&lt;/a&gt;. It looks like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;select x from y  where y.id in (a bunch of ids here) order by find_in_set(id, &amp;#8216;all my ids.join(,)&amp;#8217;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What we&amp;#8217;re doing with this, is ordering by a function, the input of which is the column name, and all the ids, concatenated, and comma delimited.  The function will find the position of each id in the string, and return an integer, which is used by the ORDER BY  clause for each row.&lt;/p&gt;
&lt;p&gt;The net result, is that you wind up with an explicit ordering of results, without having to do anything in application memory, and the ability to stream the result set.  We do this with 1000 ids at a time (a MySQL limit), and it&amp;#8217;s plenty fast for our needs.&lt;/p&gt;</description><link>http://loonsoft.com/post/5332841921</link><guid>http://loonsoft.com/post/5332841921</guid><pubDate>Mon, 09 May 2011 07:19:18 -0500</pubDate></item><item><title>Hand-rolling KCachegrind on Centos 5.5</title><description>&lt;p&gt;&lt;a title="KCacheGrind" href="http://kcachegrind.sourceforge.net/html/Home.html"&gt;KCachegrind&lt;/a&gt; is  a tool for generating and viewing &lt;a title="what's a call graph?" href="http://en.wikipedia.org/wiki/Call_graph"&gt;call-graphs&lt;/a&gt; for profiling code. Unfortunately, i&amp;#8217;ts not laying around in any package repositories I have configured (I&amp;#8217;ll write a heated screed on packaging systems at some point), so I decided to compile it myself.&lt;/p&gt;
&lt;p&gt;After much googling and random package installing (X, libx-devel, kdelibs-devel etc) and the like, i hit on the following:&lt;/p&gt;

&lt;p&gt;    &lt;em&gt;$  ./configure &amp;#8212;with-qt-dir=/usr/lib64/qt-3.3/lib &amp;#8212;with-extra-includes=/usr/include/kde3  &amp;#8212;with-qt-libraries=/usr/lib64/qt-3.3/lib &amp;#8212;enable-libsuffix=64&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Modify appropriately for your Qt and KDE library versions and locations. Interestingly, the libsuffix parameter &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=138925"&gt;fixes&lt;/a&gt; the&lt;/p&gt;
&lt;p&gt;&lt;em&gt;checking if UIC has KDE plugins available&amp;#8230; no&lt;/em&gt;&lt;br/&gt;&lt;em&gt;configure: error: you need to install kdelibs first.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;check during configure, a cause of much consternation.&lt;/p&gt;</description><link>http://loonsoft.com/post/3853401280</link><guid>http://loonsoft.com/post/3853401280</guid><pubDate>Mon, 14 Mar 2011 06:26:35 -0500</pubDate></item><item><title>Configuring splunkweb behind an ssl enabled reverse proxy</title><description>&lt;p&gt;&lt;a title="splunk" target="_blank" href="http://www.splunk.com"&gt;Splunk&lt;/a&gt; is an awesome tool.  Getting the web frontend (aka Splunkweb) working behind a reverse proxy with ssl enabled is &lt;strong&gt;not&lt;/strong&gt; awesome, and nearly totally undocumented.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s how I did it with &lt;a title="Lighttpd home" target="_blank" href="http://www.lighttpd.net/"&gt;Lighttpd&lt;/a&gt; (ymmv):&lt;/p&gt;
&lt;p&gt;Edit $splunk_home/etc/system/local/web.conf, and add the following directives:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SSOMode = permissive&lt;/p&gt;
&lt;p&gt;tools.proxy.on = True&lt;/p&gt;
&lt;p&gt;tools.proxy.base = https://&amp;lt;your splunk hostname&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Note that I&amp;#8217;m not using the Splunk single signon features (SSOMode)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The tools.proxy.base setting will cause &lt;a title="CherryPy doc" target="_blank" href="http://tools.cherrypy.org/wiki/BehindApache"&gt;Cherrypy&lt;/a&gt; to use the correct external hostname for redirects &amp;amp; such. Without this setting, you&amp;#8217;ll always be redirected to localhost.&lt;/p&gt;
&lt;p&gt;Inside lighttpd.conf, the following configuration did the trick:&lt;/p&gt;
&lt;p&gt;&lt;a title="lighttpd ssl config" target="_blank" href="http://redmine.lighttpd.net/wiki/1/Docs:SSL"&gt;Set up SSL&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$SERVER[&amp;#8220;socket&amp;#8221;] == &amp;#8220;0.0.0.0:443&amp;#8221; {&lt;/p&gt;
&lt;p&gt; ssl.engine                  = &amp;#8220;enable&amp;#8221;&lt;/p&gt;
&lt;p&gt; ssl.pemfile                 = &amp;#8220;/etc/ssl/your_ssl_cert.pem&amp;#8221;&lt;/p&gt;
&lt;p&gt; server.name                 = &amp;#8220;www.example.com&amp;#8221;&lt;/p&gt;
&lt;p&gt; server.document-root        = &amp;#8220;/srv/www/vhosts/example.com/www/&amp;#8221;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And then configure the reverse proxy:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;proxy.server = ( &amp;#8220;&amp;#8221; =&amp;gt;&lt;/p&gt;
&lt;p&gt;                 ( &amp;#8220;splunk&amp;#8221; =&amp;gt;&lt;/p&gt;
&lt;p&gt;                   (   &lt;/p&gt;
&lt;p&gt;                     &amp;#8220;host&amp;#8221; =&amp;gt; &amp;#8220;127.0.0.1&amp;#8221;,&lt;/p&gt;
&lt;p&gt;                     &amp;#8220;port&amp;#8221; =&amp;gt; 8000,&lt;/p&gt;
&lt;p&gt;                     &amp;#8220;fix-redirects&amp;#8221; =&amp;gt; 1&lt;/p&gt;
&lt;p&gt;                   )   &lt;/p&gt;
&lt;p&gt;                 )   &lt;/p&gt;
&lt;p&gt;               ) &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that this will serve Splunk from the root of the http space. If you want Splunk mounted somewhere else, you&amp;#8217;re on your own.&lt;/p&gt;</description><link>http://loonsoft.com/post/2762985077</link><guid>http://loonsoft.com/post/2762985077</guid><pubDate>Sat, 15 Jan 2011 12:24:00 -0600</pubDate><category>splunk</category><category>http</category><category>lighttpd</category></item><item><title>Inspect Mercurial Bundles</title><description>&lt;p&gt;The &lt;a href="http://mercurial.selenic.com/"&gt;Mercurial&lt;/a&gt; DSCCM system has the ability to create, read and apply &amp;#8220;&lt;a href="http://mercurial.selenic.com/wiki/Bundle"&gt;bundles&lt;/a&gt;&amp;#8221;. Bundles are files containing compressed Mercurial &lt;a href="http://mercurial.selenic.com/wiki/ChangeSet"&gt;changesets&lt;/a&gt; (including any binary content). Bundles are useful for transferring changesets between disconnected, or intermittently connected repositories.&lt;/p&gt;
&lt;p&gt;Often, it&amp;#8217;s a good idea to inspect the bundle contents before unbundling. Mercurial treats a bundle as a repository in and of itself, and therefore it&amp;#8217;s possible to see the log entries in a bundle thusly:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;hg -R ~/path/to_bundle.hg outgoing&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When executed from within a working copy, the command will show a summary of the changesets contained within the bundle, but not contained in the working copy.&lt;/p&gt;</description><link>http://loonsoft.com/post/2762663098</link><guid>http://loonsoft.com/post/2762663098</guid><pubDate>Mon, 08 Mar 2010 23:00:00 -0600</pubDate><category>mercurial</category><category>dsccm</category></item><item><title>Convert OSX DMG files to dd/img files</title><description>&lt;p&gt;osx .dmg files can be easily converted to raw disk dumps (for use with the venerable dd) thusly:&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;hdiutil convert  -format UDTO -o new.dd original.dmg&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;span&gt;Then you can &amp;#8216;burn&amp;#8217; the image onto a thumbdrive or the like:&lt;/span&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;span&gt;&lt;span&gt;    dd if=./new.dd of=/dev/disk2 bs=2m&lt;/span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;span&gt;Note that if you get the output file parameter wrong, you run the risk of overwriting something you might not want to, like your boot disk.&lt;/span&gt;&lt;/p&gt;</description><link>http://loonsoft.com/post/2762559030</link><guid>http://loonsoft.com/post/2762559030</guid><pubDate>Wed, 10 Feb 2010 23:00:00 -0600</pubDate><category>osx</category><category>cli</category><category>disk</category></item><item><title>Mount .iso images in osx</title><description>&lt;p&gt;For some reason, osx doesn&amp;#8217;t magically mount .iso images (i.e. dvd or cdrom backups).  Fortunately, you can use the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;/usr/libexec/vndevice attach /dev/vn0 image.iso &amp;amp;&amp;amp; mount_cd9660 /dev/vn0 /your/mountpoint&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You will find the contents of the iso image in /your/mountpoint&lt;/p&gt;</description><link>http://loonsoft.com/post/2762643736</link><guid>http://loonsoft.com/post/2762643736</guid><pubDate>Tue, 09 Feb 2010 23:00:00 -0600</pubDate><category>osx</category></item></channel></rss>

