<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>david rasch - making stuff work &#187; code</title>
	<atom:link href="http://www.davidrasch.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidrasch.com</link>
	<description></description>
	<lastBuildDate>Mon, 04 Apr 2011 00:53:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>New 401(k) doesn&#8217;t even support QIF</title>
		<link>http://www.davidrasch.com/2008/07/04/new-401k-doesnt-even-support-qif/</link>
		<comments>http://www.davidrasch.com/2008/07/04/new-401k-doesnt-even-support-qif/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 14:18:48 +0000</pubDate>
		<dc:creator>drasch</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[401k]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[investments]]></category>
		<category><![CDATA[mvp]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[qif]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.davidrasch.com/2008/07/04/new-401k-doesnt-even-support-qif/</guid>
		<description><![CDATA[<p>The 401(k) program we switched to this year happens to have been a step backward as far as support for exporting transactions. In talking with Alan about it, he said he&#8217;d downloaded a program to convert the CSV they export into a QIF. In looking at the QIF format, I just decided to whip <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.davidrasch.com/2008/07/04/new-401k-doesnt-even-support-qif/">New 401(k) doesn&#8217;t even support QIF</a></span>]]></description>
			<content:encoded><![CDATA[<p>The 401(k) program we switched to this year happens to have been a step backward as far as support for exporting transactions.  In talking with Alan about it, he said he&#8217;d downloaded a program to convert the CSV they export into a QIF.  In looking at the <a href="http://en.wikipedia.org/wiki/QIF">QIF format</a>, I just decided to whip up something to do the conversion for me.  This converts the export from <a href="http://www.mvpplanadmin.com/">MVP Plan Administrators</a> to QIF and imports successfully into Quicken for Mac 2007.</p>
<pre class="brush: ruby; title: ;">
#!/usr/bin/perl

#based on: http://en.wikipedia.org/wiki/QIF

open(INH, &quot;&lt; &quot;. $ARGV[0]);
open(OUTH, &quot;&gt;&quot;. $ARGV[0]. &quot;.qif&quot;);

print OUTH '!Account
NDavid\'s New 401k
TInvst
^
!Type:Invst
';

&lt;INH&gt;

while (&lt;INH&gt;) {
        chop;
        chop;
        s/\$//g;
        @vals = split /,/;

        if ($vals[3] eq 'RECEIVABL') {
                next;
        }
        print OUTH &quot;D&quot; . $vals[0] . &quot;\n&quot;;
        print OUTH &quot;N&quot; . $vals[5] . &quot;\n&quot;;
        print OUTH &quot;Y&quot; . $vals[4] . &quot;\n&quot;;
        print OUTH &quot;T&quot; . $vals[9] . &quot;\n&quot;;
        print OUTH &quot;I&quot; . $vals[8] . &quot;\n&quot;;
        print OUTH &quot;Q&quot; . $vals[7] . &quot;\n&quot;;
        print OUTH &quot;M&quot; . $vals[6] . &quot;\n&quot;;
        print OUTH &quot;^\n&quot;;
}

close OUTH;
</pre>
<p>Known issues:</p>
<ul>
<li>You still need to go through and mark Dividend transactions as such.</li>
<li>Doesn&#8217;t handle Sells very well, especially when these are to cover fund fees</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.davidrasch.com/2008/07/04/new-401k-doesnt-even-support-qif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2007 iContact and personal redux</title>
		<link>http://www.davidrasch.com/2007/12/24/2007-icontact-and-personal-redux/</link>
		<comments>http://www.davidrasch.com/2007/12/24/2007-icontact-and-personal-redux/#comments</comments>
		<pubDate>Tue, 25 Dec 2007 01:24:04 +0000</pubDate>
		<dc:creator>drasch</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[accomplishments]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iContact]]></category>

		<guid isPermaLink="false">http://www.davidrasch.com/2007/12/24/2007-redux/</guid>
		<description><![CDATA[<p>iContact Accomplishments</p> Team grew from 10 to 22 Down from 12 mail servers to 10! From Four database clusters to six Built and launched a Community From 50-80+servers Created and Grew Infrastructure team from 2 people to 9 people under Carl&#8217;s leadership Alan and Geoff reoriented our development teams to create the Middleware and <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.davidrasch.com/2007/12/24/2007-icontact-and-personal-redux/">2007 iContact and personal redux</a></span>]]></description>
			<content:encoded><![CDATA[<p>iContact Accomplishments</p>
<ul>
<li>Team grew from 10 to 22</li>
<li>Down from 12 mail servers to 10!</li>
<li>From Four database clusters to six</li>
<li>Built and launched a Community</li>
<li>From 50-80+servers</li>
<li>Created and Grew Infrastructure team from 2 people to 9 people under Carl&#8217;s leadership</li>
<li>Alan and Geoff reoriented our development teams to create the Middleware and User-experience teams</li>
<li>Fixed 1048 bugs, (of 1683 total resolved)</li>
<li>3102 logged hours of development time vs. 2255 hours of development time in 2006</li>
<li>2393 Maint Tickets vs. 1194 in 2006</li>
<li>1141 Systems/Helpdesk Tickets vs. 1137  in 2006 (amazing, a difference of only 4 tickets)</li>
<li>33k lines of code added to the Publisher (170k lines of core code of the Publisher vs 147k at the end of 2006)<!-- find  lib/core/ lib/classes/ *.php backend/ tests/unittests/ -type f | grep -v ".svn" | xargs wc -l  --></li>
<li>71k LOC created in the Community (71k LOC in the Community vs. 266 at the end of 2006)</li>
<li>1778 commits to the Publisher tool (that&#8217;s a lot of code reviews)</li>
</ul>
<p>At home</p>
<ul>
<li>We&#8217;ve taken 3001 photos totaling 3.6 GB</li>
<li>We&#8217;ve taken 327 movies totaling 9.4 GB</li>
<li>I&#8217;ve archived 1180 emails totaling 263 MB (theoretically, I read most of these)</li>
<li>I&#8217;ve Traded 9191 Instant messages</li>
<li>I&#8217;ve written 25 blog entries (up until this one)</li>
<li>We&#8217;ve helped at least 22 dogs find new homes (probably many more, but I&#8217;m counting those I have photos of)</li>
<li>DRNA spent over $8,528 vetting these dogs</li>
<li>Rented 103 movies from Netflix (approximately 200 hours of our year)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.davidrasch.com/2007/12/24/2007-icontact-and-personal-redux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>code is a mass noun</title>
		<link>http://www.davidrasch.com/2007/11/13/code-is-a-mass-noun/</link>
		<comments>http://www.davidrasch.com/2007/11/13/code-is-a-mass-noun/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 04:24:04 +0000</pubDate>
		<dc:creator>drasch</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[grammar]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://www.davidrasch.com/2007/11/13/code-is-a-mass-noun/</guid>
		<description><![CDATA[<p>During the Marketplace Morning Report on 11/13, there was a segment covering Google&#8217;s recent release of software and a bounty surrounding Cell phones. During this segment, the use of the word &#8220;code&#8221; followed conventions that aren&#8217;t preferred in the Computer Science community&#8211;academic or commercial. </p> <p>During the segment they refer to &#8220;based on a <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.davidrasch.com/2007/11/13/code-is-a-mass-noun/">code is a mass noun</a></span>]]></description>
			<content:encoded><![CDATA[<p>During the <a href="http://marketplace.publicradio.org/episodes/show_rundown.php?show_id=15">Marketplace Morning Report</a> on 11/13, there was a segment covering Google&#8217;s recent release of software  and a bounty surrounding Cell phones.  During this segment, the use of the word &#8220;code&#8221; followed conventions that aren&#8217;t preferred in the Computer Science community&#8211;academic or commercial.  </p>
<blockquote><p>During the segment they refer to &#8220;based on a code that&#8217;s open&#8221;.  When code is used in this context, it&#8217;s collective and should be used without an indefinite article.  While, &#8220;based on code that&#8217;s open&#8221; would be correct.</p>
<p>Other appropriate uses:<br />
1. code<br />
2. source code<br />
3. the source code<br />
4. some source code (usually a part of a program)<br />
5. line of code (a single line of a program)<br />
6. a piece of code </p>
<p>The usage of &#8220;code&#8221; very much follows other words like &#8220;stuff&#8221; and &#8220;water&#8221;.  &#8220;code&#8221; is a <a href="http://en.wikipedia.org/wiki/Mass_noun">mass noun</a> in the English language and thus cannot be preceded by numerals like &#8220;one code&#8221; (when the semantics refer to computer software).  As a result, it&#8217;s not used with the indefinite article a or an.</p>
<p>Improper uses (in all below, you can simply remove the &#8220;a&#8221; or &#8220;an&#8221; for a proper usage):<br />
I downloaded a code to solve that problem.<br />
Google released a source-code to mobile manufacturers.<br />
An open-source code would encourage developers.
</p></blockquote>
<p>All of the above reflects my opinion.  My wife, however will often say things such as &#8220;I am trying to debug a code that I wrote a few months ago.&#8221;  It also seems that in the non-CS/EE/CE fields of scientific research that this usage is quite common.  One of the libraries she uses in building her programs (not codes) is <a href="http://www.fftw.org/">FFTW</a> has a statement on their home page </p>
<blockquote><p>Our benchmarks, performed on on a variety of platforms, show that FFTW&#8217;s performance is typically superior to that of other publicly available FFT software, and is even competitive with vendor-tuned codes.</p></blockquote>
<p>This too uses code as a <a href="http://en.wikipedia.org/wiki/Count_noun">count noun</a> incorrectly. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidrasch.com/2007/11/13/code-is-a-mass-noun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gallery 2.2&#8211;Multisite and Multiroot</title>
		<link>http://www.davidrasch.com/2007/09/24/gallery-22-multisite-and-multiroot/</link>
		<comments>http://www.davidrasch.com/2007/09/24/gallery-22-multisite-and-multiroot/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 02:48:54 +0000</pubDate>
		<dc:creator>drasch</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dachshund]]></category>
		<category><![CDATA[drna]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.davidrasch.com/2007/09/24/gallery-22-multisite-and-multiroot/</guid>
		<description><![CDATA[<p>Recently I tried to use the Gallery Multiroot module/plugin to setup a new site based upon an existing Album in our gallery. Since we started sorting albums chronologically, we wanted to sort out the Dachshund photos separately. To do this, I used the Multiroot feature. Unfortunately, I couldn&#8217;t get this to work as I&#8217;m <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.davidrasch.com/2007/09/24/gallery-22-multisite-and-multiroot/">Gallery 2.2&#8211;Multisite and Multiroot</a></span>]]></description>
			<content:encoded><![CDATA[<p>Recently I tried to use the <a href="http://gallery.raschnet.com">Gallery</a> Multiroot module/plugin to setup a new site based upon an existing Album in our gallery.  Since we started sorting albums chronologically, we wanted to sort out the Dachshund photos separately.  To do this, I used the <a href="http://codex.gallery2.org/Gallery2:Modules:multiroot">Multiroot</a> feature.  Unfortunately, I couldn&#8217;t get this to work as I&#8217;m already using the Multisite plugin to host several Galleries off of my web server.  The magic touch was to use the following file, the first line is key and had to be added to make things work in the Multisite configuration.  </p>
<pre class="brush: php; title: ;">
define('GALLERY_CONFIG_DIR', &quot;/var/virtualwww/gallery.raschnet.com&quot;);  //I had to add this line

require('/usr/local/share/gallery2/embed.php');
$ret = GalleryEmbed::init(
    array('embedUri' =&gt; '/',
          'g2Uri' =&gt; 'http://gallery.raschnet.com/',
          'apiVersion' =&gt; array(1, 2)
    ));

if ($ret) {
    print '&lt;body&gt;' . $ret-&gt;getAsHtml() . '&lt;/body&gt;';
    return;
}

$gallery-&gt;setConfig('login', true);
$gallery-&gt;setConfig('defaultAlbumId', 28426);
$gallery-&gt;setConfig('breadcrumbRootId', 28426);

GalleryMain();
</pre>
<p>Now live: <a href="http://drna.raschnet.com">DRNA Gallery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidrasch.com/2007/09/24/gallery-22-multisite-and-multiroot/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP on the Backend</title>
		<link>http://www.davidrasch.com/2007/05/07/php-on-the-backend/</link>
		<comments>http://www.davidrasch.com/2007/05/07/php-on-the-backend/#comments</comments>
		<pubDate>Tue, 08 May 2007 00:55:39 +0000</pubDate>
		<dc:creator>drasch</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[daemon]]></category>

		<guid isPermaLink="false">http://www.davidrasch.com/2007/05/07/php-on-the-backend/</guid>
		<description><![CDATA[<p>PHP (or any language for that matter) can just as easily be used as a daemon as on the web. This can be especially useful when solving problems that can&#8217;t &#8220;complete&#8221; in less than 500 ms which one shoots for on the web. As you write an application to handle things such as those <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.davidrasch.com/2007/05/07/php-on-the-backend/">PHP on the Backend</a></span>]]></description>
			<content:encoded><![CDATA[<p>PHP (or any language for that matter) can just as easily be used as a daemon as on the web.  This can be especially useful when solving problems that can&#8217;t &#8220;complete&#8221; in less than 500 ms which one shoots for on the web.   As you write an application to handle things such as those mentioned below, be sensitive to the processing, disk space, and time needed to process these requests in planning how to handle these.  As an example jobs of a small size might be handled inline by the code that handles the form submission, but for larger jobs it queues them for background processing.  </p>
<p>great for background/async processing of:</p>
<ul>
<li>photos</li>
<li>movies</li>
<li>reports</li>
<li>imports of data</li>
</ul>
<p>advantages: </p>
<ul>
<li>use the same codebase as your app</li>
<li>use the same expertise on your team of programmers</li>
</ul>
<p>challenges:</p>
<ul>
<li>signals</li>
<li>one thread</li>
<li>memory (this will have to be a whole separate article)</li>
<li>starting and stopping</li>
</ul>
<p>A typical Daemon class I use:</p>
<pre>
abstract class Daemon {
    protected $done = false;

    public function __construct($argv) {
    }
    public function init() {
        pnctl_signal(SIGTERM, array($this, "onSignal"));
        pnctl_signal(SIGINT, array($this, "onSignal"));

    }
    abstract public function run();
    public function shutdown() {}
    public function isDone() {
        return $this->done;
    }
    public onSignal($signal){
        switch ($signal) {
             case SIGTERM:
             case SIGINT:
                $this->done = true;
                 break;
             default:
                 // handle all other signals
        }
    }
}</pre>
<p>As you can see, we&#8217;ve started to tackle some of the challenges here.  The idea is to handle signals, specifically I usually care about SIGTERM (default when using &#8216;kill&#8217; on *nix) and SIGINT (from pressing Ctrl-C).  Both will cause the program to exit gracefully.</p>
<p>I&#8217;ll be posting the class I use to run Daemon&#8217;s tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidrasch.com/2007/05/07/php-on-the-backend/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

