<?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>linsec.ca blog &#187; Programming</title>
	<atom:link href="http://linsec.ca/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://linsec.ca/blog</link>
	<description>You can have it right, or you can have it now.  But you can't have it right now.</description>
	<lastBuildDate>Tue, 27 Jul 2010 21:41:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Learning Python: module import issues</title>
		<link>http://linsec.ca/blog/2009/03/08/learning-python-module-import-issues/</link>
		<comments>http://linsec.ca/blog/2009/03/08/learning-python-module-import-issues/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 20:28:34 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=424</guid>
		<description><![CDATA[So I&#8217;ve taken it upon myself to learn Python, which is something I&#8217;ve wanted to do for a while. I usually write code in PHP or shellscript, with the odd thing in Perl every once in a while (but I&#8217;m not a real big fan of perl and I don&#8217;t have the desire to dig [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve taken it upon myself to learn Python, which is something I&#8217;ve wanted to do for a while.  I usually write code in PHP or shellscript, with the odd thing in Perl every once in a while (but I&#8217;m not a real big fan of perl and I don&#8217;t have the desire to dig into it more).  A lot of my more sophisticated projects that can&#8217;t be done in shellscript are usually done with CLI PHP.  But Python is something I&#8217;ve wanted to learn, so I&#8217;ve started digging into it and my first dive is rewriting a CLI PHP program &#8220;suite&#8221; that creates and scours a database for RPM information (dependencies, requires, files, etc.).</p>
<p>I&#8217;ve been at it for about 2 weeks now with what little time I have and the original suite consists of two programs: rqp and rqs.  These two programs were a result of a rewrite of the &#8220;srpm&#8221; PHP program that Stew Benedict wrote years ago for the Mandriva secteam (and which has proven invaluable of the years).  It handled only src.rpm files, so I rewrote and extended it to handle binary and source rpm files (rqp and rqs respectively).  It was a quick-n-dirty extension that was used for a few years on the Mandriva secteam and worked really well (and probably is still working well for them).</p>
<p>I&#8217;ve gotten rqp converted to Python and it&#8217;s working quite well.  Because rqp and rqs share a *lot* of functions, I wanted to write rqp.py and rqs.py and have a shared module between them (rq.py) and this is where I&#8217;m having issues.  Does anyone know how to have a module get access to an object from the calling program?  For instance, rqp uses the optparse module to nicely handle the commandline arguments, but a lot of the modules use options.foo to look up arguments that were passed.  The functions in rq.py (the module) can&#8217;t seem to get the value of options, and while I could put the optparse stuff in the module, it would leave the actual rqp and rqs programs really really small (and I&#8217;d have to either put in two functions because the two programs use different syntax).  So I&#8217;ve got in rqp.py:</p>
<pre>
import rq
</pre>
<p>which works ok, but if rq.db_connect() requires options.database (for instance), it can&#8217;t get it.  So in rq.py, I tried doing a circular import or whatever it&#8217;s called by doing:</p>
<pre>
import options from rqp
</pre>
<p>But this doesn&#8217;t want to work either.  The output looks quite sad:</p>
<pre>
% ./rqp.py -d
rqp 0.2 ($Id: rqp 275 2009-03-07 22:34:15Z vdanen $)

Traceback (most recent call last):
  File "./rqp.py", line 548, in <module>
    import rq
  File "/Users/vdanen/svn/scripts/rq/trunk/rq.py", line 11, in <module>
    from rqp import options
ImportError: cannot import name options
</pre>
<p>There has to be a way to make the options variable (and one or two others I think) accessible to the module, but I haven&#8217;t been able to find a way to do it.  Does anyone know how this can be accomplished?</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2009/03/08/learning-python-module-import-issues/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Check out subversion repositories with ViewVC</title>
		<link>http://linsec.ca/blog/2009/02/10/check-out-subversion-repositories-with-viewvc/</link>
		<comments>http://linsec.ca/blog/2009/02/10/check-out-subversion-repositories-with-viewvc/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 21:18:06 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[techmail]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=409</guid>
		<description><![CDATA[This week&#8217;s TechMail is Check out subversion repositories with ViewVC which is pretty much just about installing and configuring the ViewVC web-based tool to view subversion repositories (works with cvs too).]]></description>
			<content:encoded><![CDATA[<p>This week&#8217;s TechMail is <a href="http://blogs.techrepublic.com.com/opensource/?p=364">Check out subversion repositories with ViewVC</a> which is pretty much just about installing and configuring the ViewVC web-based tool to view subversion repositories (works with cvs too).</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2009/02/10/check-out-subversion-repositories-with-viewvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If programming languages were religions&#8230;</title>
		<link>http://linsec.ca/blog/2008/12/17/if-programming-languages-were-religions/</link>
		<comments>http://linsec.ca/blog/2008/12/17/if-programming-languages-were-religions/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 15:34:56 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[humour]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=347</guid>
		<description><![CDATA[Found this really cute/funny blog post today about programming languages being religions, or the comparison of programming languages to religions (i.e. C being Judaism, Visual Basic being Satanism, etc.). Quite funny. Here&#8217;s the link: If programming languages were religions&#8230;.]]></description>
			<content:encoded><![CDATA[<p>Found this really cute/funny blog post today about programming languages being religions, or the comparison of programming languages to religions (i.e. C being Judaism, Visual Basic being Satanism, etc.).  Quite funny.</p>
<p>Here&#8217;s the link: <a href="http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html">If programming languages were religions&#8230;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/12/17/if-programming-languages-were-religions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Is the new Komodo 5 toolset worth the upgrade?</title>
		<link>http://linsec.ca/blog/2008/12/02/is-the-new-komodo-5-toolset-worth-the-upgrade/</link>
		<comments>http://linsec.ca/blog/2008/12/02/is-the-new-komodo-5-toolset-worth-the-upgrade/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 03:50:56 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[komodo]]></category>
		<category><![CDATA[techmail]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=334</guid>
		<description><![CDATA[This week&#8217;s Techmail looks at some of the new features of ActiveState&#8217;s Komodo IDE and asks Is the new Komodo 5 toolset worth the upgrade?. Personally, I think it was. Others may or may not agree&#8230; someone else has already posted about using a &#8220;real&#8221; IDE (Eclipse). Gag me with a spoon.]]></description>
			<content:encoded><![CDATA[<p>This week&#8217;s Techmail looks at some of the new features of <a href="http://www.activestate.com/products/komodo/">ActiveState&#8217;s Komodo IDE</a> and asks <a href="http://blogs.techrepublic.com.com/opensource/?p=303">Is the new Komodo 5 toolset worth the upgrade?</a>.  Personally, I think it was.  Others may or may not agree&#8230; someone else has already posted about using a &#8220;real&#8221; IDE (Eclipse).  Gag me with a spoon.</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/12/02/is-the-new-komodo-5-toolset-worth-the-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zsh tab completion with subversion 1.5</title>
		<link>http://linsec.ca/blog/2008/11/08/zsh-tab-completion-with-subversion-15/</link>
		<comments>http://linsec.ca/blog/2008/11/08/zsh-tab-completion-with-subversion-15/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 17:13:03 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=310</guid>
		<description><![CDATA[This has ticked me off for a bit, and I finally decided to find out why. Tab completion in zsh was returning the following every time I tried to use it, after upgrading to subversion 1.5: _arguments:comparguments:303: invalid argument: ARG Looks like the reason is that the subversion developers changed &#8220;arg&#8221; to &#8220;ARG&#8221;. So when [...]]]></description>
			<content:encoded><![CDATA[<p>This has ticked me off for a bit, and I finally decided to find out why.  Tab completion in zsh was returning the following every time I tried to use it, after upgrading to subversion 1.5:</p>
<p><code>_arguments:comparguments:303: invalid argument: ARG</code></p>
<p>Looks like the reason is that the subversion developers changed &#8220;arg&#8221; to &#8220;ARG&#8221;.  So when I googled I found this helpful post:</p>
<p><a href="http://mkoga.com/zsh-tab-completion-fix-for-subversion-1-5">ZSH Tab Completion Fix for Subversion 1.5</a> which basically points to this <a href="http://gvn.googlecode.com/svn/trunk/contrib/zsh/_subversion">new _subversion functions file</a> to be plopped into the zsh functions directory (/usr/share/zsh/4.3.4/functions; change the version to suit of course &#8212; the directory may also be slightly different on Linux vs OS X).</p>
<p>Now tab completion works properly and life is good.  =)</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/11/08/zsh-tab-completion-with-subversion-15/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Subversion 1.5.x upgrade oddities</title>
		<link>http://linsec.ca/blog/2008/10/07/subversion-15x-upgrade-oddities/</link>
		<comments>http://linsec.ca/blog/2008/10/07/subversion-15x-upgrade-oddities/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 00:07:29 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=287</guid>
		<description><![CDATA[Found some weirdness with subversion 1.5 today. I had previously upgraded to 1.5.1 when it came out (from 1.4.x) and found I couldn&#8217;t commit to svn+ssh urls. 1.5.2 fixes that, but has a naughty habbit of upgrading the repository format behind your back. So, if you have a working copy you checked out with 1.4.x [...]]]></description>
			<content:encoded><![CDATA[<p>Found some weirdness with subversion 1.5 today.  I had previously upgraded to 1.5.1 when it came out (from 1.4.x) and found I couldn&#8217;t commit to svn+ssh urls.  1.5.2 fixes that, but has a naughty habbit of upgrading the repository format behind your back.  So, if you have a working copy you checked out with 1.4.x and then do anything in that working copy it upgrades it to the new format for 1.5.x.  Sadly, it doesn&#8217;t tell you it&#8217;s doing this and as a result, those working copies are essentially useless if you need to back out to 1.4.x for whatever reason.</p>
<p>Not only that, however, but subversion will upgrade parts of your working copy piecemeal.  For instance, I keep all my web development stuff in ~/svn/websites/.  So after upgrading to 1.5.2 today I did some work in ~/svn/websites/intranet/ and that directory, and it&#8217;s subdirectories, were upgraded to the new format.  The top-level directory, however, and the rest of the working copy, were not (they were still using format 8 rather than format 9).</p>
<p>I guess with a CLI client this might not matter so much, but it caused me some grief using <a href="http://www.zennaware.com/cornerstone/">Cornerstone</a>, a commercial svn client.  Fortunately, the author is super-responsive and pointed me to <a href="http://svn.collab.net/repos/svn/trunk/tools/client-side/change-svn-wc-format.py">this change-svn-wc-format.py script</a> which I can use to update all my working copies (I&#8217;m not trusting subversion to do it properly for me right now).</p>
<p>Anyways, if anyone else gets in this same boat, here&#8217;s some info on how to resolve it.  I like using Cornerstone on my mac (it&#8217;s about the only GUI svn client I can stand); otherwise I&#8217;d be using the CLI client and probably never would have found this.</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/10/07/subversion-15x-upgrade-oddities/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Try command-line looping for added efficiency</title>
		<link>http://linsec.ca/blog/2008/09/22/try-command-line-looping-for-added-efficiency/</link>
		<comments>http://linsec.ca/blog/2008/09/22/try-command-line-looping-for-added-efficiency/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 15:01:47 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=274</guid>
		<description><![CDATA[Last week&#8217;s TechMail was Try command-line looping for added efficiency which discusses using loops in the shell to iterate over a number of items while using particular commands (i.e. for loops in the shell). Extremely useful stuff if you&#8217;ve ever needed to repeat something without wanting to hit the up arrow to change one thing [...]]]></description>
			<content:encoded><![CDATA[<p>Last week&#8217;s TechMail was <a href="http://blogs.techrepublic.com.com/opensource/?p=270">Try command-line looping for added efficiency</a> which discusses using loops in the shell to iterate over a number of items while using particular commands (i.e. for loops in the shell).  Extremely useful stuff if you&#8217;ve ever needed to repeat something without wanting to hit the up arrow to change one thing in the previous command.</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/09/22/try-command-line-looping-for-added-efficiency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress and bad from address handling for email</title>
		<link>http://linsec.ca/blog/2008/07/25/wordpress-and-bad-from-address-handling-for-email/</link>
		<comments>http://linsec.ca/blog/2008/07/25/wordpress-and-bad-from-address-handling-for-email/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 20:22:10 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/?p=247</guid>
		<description><![CDATA[If there&#8217;s one thing that irked me about WordPress, which I more or less ignored for months, was the inability to change the &#8220;From&#8221; address on emails it sent. It&#8217;s hard-coded to &#8220;wordpress@${sitename}&#8221; and when you have some&#8230; weird&#8230; domain hosters, this can cause problems. I haven&#8217;t received comment notification for a few months now [...]]]></description>
			<content:encoded><![CDATA[<p>If there&#8217;s one thing that irked me about WordPress, which I more or less ignored for months, was the inability to change the &#8220;From&#8221; address on emails it sent.  It&#8217;s hard-coded to &#8220;wordpress@${sitename}&#8221; and when you have some&#8230; weird&#8230; domain hosters, this can cause problems.  I haven&#8217;t received comment notification for a few months now as a result.</p>
<p>The problem, in my particular case, is that my hoster is extremely anal about mail relays.  If the from address isn&#8217;t locally-deliverable, it punts the message with a &#8220;relay not permitted&#8221;.  This is simply foolish, and I&#8217;ve already complained, but I have my doubts they&#8217;ll change anything.  <sigh>  In my case, the linsec.ca site is hosted at my domain hoster, but the mail for linsec.ca is handled by Google.  So when a message goes out from wordpress@linsec.ca (regardless of whether it&#8217;s a deliverable address or not, regardless of whether I define an email address on the domain server (that would never really get mail, but I was hoping it would trick exim somewhat)), it gets punted as a relayed address because the MX records for linsec.ca don&#8217;t point to the server.</p>
<p>This could all be extremely easily avoided by letting people change the From address in WordPress.  And it&#8217;s such a stupidly simple hack.  So when I upgraded to the latest WordPress and found it *still* didn&#8217;t allow it, I finally implemented a quick fix and am putting it here for others who face the same irritation.</p>
<p><code><br />
Index: wp-config.php<br />
===================================================================<br />
--- wp-config.php	(revision 1109)<br />
+++ wp-config.php	(working copy)<br />
@@ -23,6 +23,9 @@<br />
 // to enable German language support.<br />
 define ('WPLANG', '');</p>
<p>+// set the from address for mail<br />
+define ('WPFROMADR', 'wordpress@annvix.ca');<br />
+<br />
 /* That's all, stop editing! Happy blogging. */</p>
<p> if ( !defined('ABSPATH') )<br />
Index: wp-includes/pluggable.php<br />
===================================================================<br />
--- wp-includes/pluggable.php	(revision 1109)<br />
+++ wp-includes/pluggable.php	(working copy)<br />
@@ -346,8 +346,9 @@<br />
 		if ( substr( $sitename, 0, 4 ) == 'www.' ) {<br />
 			$sitename = substr( $sitename, 4 );<br />
 		}<br />
-<br />
-		$from_email = 'wordpress@' . $sitename;<br />
+// why this is hardcoded is beyond me so we'll let it be defined in wp-config.php<br />
+//		$from_email = 'wordpress@' . $sitename;<br />
+		$from_email = WPFROMADR;<br />
 	}</p>
<p> 	// Set the from name and email<br />
@@ -1562,4 +1563,4 @@<br />
 }<br />
 endif;</p>
<p>-?><br />
\ No newline at end of file<br />
+?><br />
</code></p>
<p>And that&#8217;s it.  This would be so easy to have implemented upstream, I&#8217;m not sure why they haven&#8217;t done it already.  Now I can set the from domain to something that is hosted on that machine and mails are delivered.</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/07/25/wordpress-and-bad-from-address-handling-for-email/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>GUI scripting with Zenity</title>
		<link>http://linsec.ca/blog/2008/07/12/gui-scripting-with-zenity/</link>
		<comments>http://linsec.ca/blog/2008/07/12/gui-scripting-with-zenity/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 15:47:18 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[techmail]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/2008/07/12/gui-scripting-with-zenity/</guid>
		<description><![CDATA[Last week&#8217;s Techmail was GUI scripting with Zenity which discusses using Zenity to display GUI widgets from scripts. I&#8217;ve used such things for a full blown menu driven CLI app before, but Zenity is quite cool in that you get all the power of a shell script with a nice GUI frontend.]]></description>
			<content:encoded><![CDATA[<p>Last week&#8217;s Techmail was <a href="http://blogs.techrepublic.com.com/opensource/?p=235">GUI scripting with Zenity</a> which discusses using Zenity to display GUI widgets from scripts.  I&#8217;ve used such things for a full blown menu driven CLI app before, but Zenity is quite cool in that you get all the power of a shell script with a nice GUI frontend.</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/07/12/gui-scripting-with-zenity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some pretty cool cheatsheets</title>
		<link>http://linsec.ca/blog/2008/02/11/some-pretty-cool-cheatsheets/</link>
		<comments>http://linsec.ca/blog/2008/02/11/some-pretty-cool-cheatsheets/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 16:41:56 +0000</pubDate>
		<dc:creator>vdanen</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://linsec.ca/blog/2008/02/11/some-pretty-cool-cheatsheets/</guid>
		<description><![CDATA[Found this link this morning, to a site with some nice cheatsheets that might be of interest to some people. There are cheetsheats for regexps, PHP, MySQL, CSS, HTML, etc. Single-page cheetsheats that can be used for easy reference. Found them on ilovejackdaniels.com. Might be worth checking out for some of you (I&#8217;ve already printed [...]]]></description>
			<content:encoded><![CDATA[<p>Found this link this morning, to a site with some nice cheatsheets that might be of interest to some people.  There are cheetsheats for regexps, PHP, MySQL, CSS, HTML, etc.  Single-page cheetsheats that can be used for easy reference.  Found them on <a href="http://www.ilovejackdaniels.com/cheat-sheets/">ilovejackdaniels.com</a>.  Might be worth checking out for some of you (I&#8217;ve already printed out a few of them).</p>
]]></content:encoded>
			<wfw:commentRss>http://linsec.ca/blog/2008/02/11/some-pretty-cool-cheatsheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
