<?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>Brain Goo</title>
	<atom:link href="http://www.popmartian.com/tipsntricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.popmartian.com/tipsntricks</link>
	<description>Carpe Crap 'em</description>
	<lastBuildDate>Mon, 10 Oct 2011 14:42:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HOWTO Redirect Linux Console Without Reboot</title>
		<link>http://www.popmartian.com/tipsntricks/2011/10/03/howto-redirect-linux-console-without-reboot/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/10/03/howto-redirect-linux-console-without-reboot/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 14:38:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=225</guid>
		<description><![CDATA[You can re-apply your /etc/inittab file in real-time without rebooting your machine. This allows you to do a lot of neat things, such as redirect your system console to the serial port without a reboot. Edit your /etc/inittab file and add this line: S0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt102 Execute the following command: telinit q &#038;&#038; [...]]]></description>
			<content:encoded><![CDATA[<p>You can re-apply your /etc/inittab file in real-time without rebooting your machine.  This allows you to do a lot of neat things, such as redirect your system console to the serial port without a reboot.</p>
<ol>
<li>Edit your /etc/inittab file and add this line:
<ul>
<li><code>S0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt102</code></li>
</ul>
</li>
<li>Execute the following command:
<ul>
<li><code>telinit q &#038;&#038; telinit u</code></li>
</ul>
</li>
<li>Your primary console (ttyS0) should magically appear on the serial console!</li>
</ol>
<p>So what just happened?  The /etc/inittab file is read by the init system at boot.  If you added the line from step 1 and simply rebooted, you would have your console show up on the serial port right away.  We told init to re-read the <code>/etc/inittab</code> file (<code>telinit q</code>) and then to re-execute itself (<code>telinit u</code>) while preserving the init state.  Since the only change was the location of <code>ttyS0</code>, the console was redirected, but the system continued to run as though nothing else changed.</p>
<p>The reason we used the <code>&#038;&#038;</code> method was because we may loose our console before we get a chance to execute <code>telinit u</code>.  This way both commands are run and init is always executed after re-reading its config.</p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=225&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/10/03/howto-redirect-linux-console-without-reboot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW TO detect STDIN with Python</title>
		<link>http://www.popmartian.com/tipsntricks/2011/07/25/how-to-detect-stdin-with-python/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/07/25/how-to-detect-stdin-with-python/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 16:00:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=214</guid>
		<description><![CDATA[In Python, as with most languages, STDIN is treated like a file. You can read from it any time, but knowing what kind of file it is lets us know if someone passed us something via STDIN or if we are going to prompt them for it. import os, sys if os.isatty(file.fileno(sys.stdin)): &#160;&#160;&#160;&#160;print "Reading list [...]]]></description>
			<content:encoded><![CDATA[<p>In Python, as with most languages, STDIN is treated like a file.  You can read from it any time, but knowing what kind of file it is lets us know if someone passed us something via STDIN or if we are going to prompt them for it.</p>
<p><code>import os, sys</p>
<p>if os.isatty(file.fileno(sys.stdin)):<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Reading list from STDIN."<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Enter your list. Press ^D to continue, ^C to quit."<br />
&nbsp;&nbsp;&nbsp;&nbsp;my_list = sys.stdin.readlines()<br />
else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Thank you for passing me a list through a pipe."<br />
&nbsp;&nbsp;&nbsp;&nbsp;my_list = sys.stdin.readlines()</code></p>
<p>Now lets try it two ways:</p>
<p>First, pass it some stuff:<br />
<code>echo mother sister father brother | ./myapp.py</code></p>
<p>Then try it plain:<br />
<code>./myapp.py</code></p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=214&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/07/25/how-to-detect-stdin-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo Use an HTTP Proxy With Git</title>
		<link>http://www.popmartian.com/tipsntricks/2011/04/29/howto-use-an-http-proxy-with-git/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/04/29/howto-use-an-http-proxy-with-git/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:03:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[How Tos]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=210</guid>
		<description><![CDATA[git should use the environment variable $http_proxy so set that and you should be ok. If you don&#8217;t want to use the environment, set it statically like this: $ git config --global http.proxy http://proxy.example.com:8080 $ git config --get http.proxy http://proxy.example.com:8080]]></description>
			<content:encoded><![CDATA[<p>git should use the environment variable $http_proxy so set that and you should be ok.  If you don&#8217;t want to use the environment, set it statically like this:</p>
<p><code>$ git config --global http.proxy http://proxy.example.com:8080<br />
$ git config --get http.proxy</p>
<p>http://proxy.example.com:8080</code></p>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=210&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/04/29/howto-use-an-http-proxy-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux HOWTO Enable Miltucast Ping (ICMP) Replies (Echo)</title>
		<link>http://www.popmartian.com/tipsntricks/2011/04/21/linux-howto-enable-miltucast-ping-icmp-replies-echo/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/04/21/linux-howto-enable-miltucast-ping-icmp-replies-echo/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 17:50:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=206</guid>
		<description><![CDATA[The 2.6 Linux kernel does not respond to multicast ICMP Echo requests by default. This is a setting in /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts Test it: # cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 1 # Set it to 0 for ping replies: # echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts # cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 0 #]]></description>
			<content:encoded><![CDATA[<p>The 2.6 Linux kernel does not respond to multicast ICMP Echo requests by default.  This is a setting in /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts</p>
<p>Test it:</p>
<p># <code>cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts</code><br />
1<br />
#</p>
<p>Set it to 0 for ping replies:</p>
<p># <code>echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts</code><br />
# <code>cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts</code><br />
0<br />
#</p>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=206&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/04/21/linux-howto-enable-miltucast-ping-icmp-replies-echo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build A Custom PERL Installation</title>
		<link>http://www.popmartian.com/tipsntricks/2011/04/11/build-a-custom-perl-installation/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/04/11/build-a-custom-perl-installation/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 18:55:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=198</guid>
		<description><![CDATA[If you want to build a PERL installation that is separate from your standard PERL, you can compile one, complete with CPAN support. Just follow these steps: mkdir /custom/perl/ cd /custom/perl/ curl -O http://www.cpan.org/src/perl-5.12.3.tar.gz mkdir perl-5_12_3 gunzip perl-5.12.3.tar.gz tar -xf perl-5.12.3.tar cd perl-5.12.3 ./Configure -d -Dprefix=/custom/perl/perl-5_12_3 make make test make install /custom/perl/perl-5_12_3/bin/perl -v /custom/perl/perl-5_12_3/bin/perl -e [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to build a PERL installation that is separate from your standard PERL, you can compile one, complete with CPAN support.  Just follow these steps:</p>
<ol>
<li>mkdir /custom/perl/</li>
<li>cd /custom/perl/</li>
<li>curl -O http://www.cpan.org/src/perl-5.12.3.tar.gz</li>
<li>mkdir perl-5_12_3</li>
<li>gunzip perl-5.12.3.tar.gz</li>
<li>tar -xf perl-5.12.3.tar</li>
<li>cd perl-5.12.3</li>
<li>./Configure -d -Dprefix=/custom/perl/perl-5_12_3</li>
<li>make</li>
<li>make test</li>
<li>make install</li>
<li>/custom/perl/perl-5_12_3/bin/perl -v</li>
<li>/custom/perl/perl-5_12_3/bin/perl -e &#8216;print &#8220;hello world.\n&#8221;;&#8217;</li>
<li>/custom/perl/perl-5_12_3/bin/perl -MCPAN -e shell
<ul>
<li>Auto configure as much as possible.  Step 15 will edit it.</li>
</ul>
</li>
<li>Edit /custom/perl/perl-5_12_3/lib/5.12.3/CPAN/Config.pm
<ul>
<li>Change the following paths:</li>
<li>&#8216;cpan_home&#8217; =&gt; q[/custom/perl/perl-5_12_3/cpan/],</li>
<li>&#8216;build_dir&#8217; =&gt; q[/custom/perl/perl-5_12_3/cpan/build],</li>
<li>&#8216;histfile&#8217; =&gt; q[/custom/perl/perl-5_12_3/cpan/histfile],</li>
<li>&#8216;keep_source_where&#8217; =&gt; q[/custom/perl/perl-5_12_3/cpan/sources],</li>
<li>&#8221;prefs_dir&#8217; =&gt; q[/custom/perl/perl-5_12_3/cpan/prefs],</li>
<li>&#8221;urllist&#8217; =&gt; [q[ftp://my.cpan.mirror/pub/cpan/]],</li>
</ul>
</li>
<li>Run CPAN and install Bundle::CPAN Bundle::LWP and any required packages</li>
<li>tar -cvf /custom/perl/custom-perl5.12.13.tar /custom/perl/perl-5_12_3/*</li>
<li>gzip /custom/perl/custom-perl5.12.13.tar</li>
<li>Ship custom-perl5.12.13.tar.gz out to your matching architectures or mount it on a shared NAS.</li>
<li>Call it with #!/custom/perl/perl-5_12_3/bin/perl</li>
</ol>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=198&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/04/11/build-a-custom-perl-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Pass PERL Library Paths From The Environment</title>
		<link>http://www.popmartian.com/tipsntricks/2011/04/11/how-to-pass-perl-library-paths-from-the-environment/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/04/11/how-to-pass-perl-library-paths-from-the-environment/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 18:07:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=192</guid>
		<description><![CDATA[You can have PERL look in different places for libraries and modules using a number of methods. If you find yourself using a custom PERL module repository, you can make sure your PERL programs always reference it without touching the code. What we&#8217;re doing in a nutshell is telling PERL to push values on to [...]]]></description>
			<content:encoded><![CDATA[<p>You can have PERL look in different places for libraries and modules using a number of methods.  If you find yourself using a custom PERL module repository, you can make sure your PERL programs always reference it without touching the code.</p>
<p>What we&#8217;re doing in a nutshell is telling PERL to push values on to the @INC array before loading any modules.  You can do this on the command line, in your PERL code or with the environment variable <code>PERL5LIB</code>.</p>
<p><code>PERL5LIB</code> can contain more than one value.  Just set it in you .bashrc file or wherever you see fit.  This method works in bash:</p>
<p><code>export PERL5LIB=/first/path/to/libs"${PERL5LIB:+:$PERL5LIB}"<br />
export PERL5LIB=/second/path/to/libs"${PERL5LIB:+:$PERL5LIB}"<br />
export PERL5LIB=/third/path/to/libs"${PERL5LIB:+:$PERL5LIB}"</code></p>
<p>You can check what PERL is going to use by printing out the contents of @INC.  <a href="http://www.popmartian.com/tipsntricks/2009/02/06/perl-how-to-print-a-list-without-a-loop/">You can print an array without a loop using join() as I blogged about before</a>:</p>
<p><code>perl -e 'print join "\n", @INC;'</code></p>
<p>Let&#8217;s put it together:<br />
~$ <code>perl -e 'print join "\n", @INC;'</code><br />
<em>/etc/perl<br />
/usr/local/lib/perl/5.10.0<br />
/usr/local/share/perl/5.10.0<br />
/usr/lib/perl5<br />
/usr/share/perl5<br />
/usr/lib/perl/5.10<br />
/usr/share/perl/5.10<br />
/usr/local/lib/site_perl<br />
.</em></p>
<p>~$ <code>env|grep -i perl</code><br />
~$</p>
<p>~$ <code>export PERL5LIB=/first/path/to/libs"${PERL5LIB:+:$PERL5LIB}"</code><br />
~$ <code>export PERL5LIB=/second/path/to/libs"${PERL5LIB:+:$PERL5LIB}"</code><br />
~$ <code>export PERL5LIB=/third/path/to/libs"${PERL5LIB:+:$PERL5LIB}"</code></p>
<p>~$ <code>env|grep -i perl</code><br />
<em>PERL5LIB=/third/path/to/libs:/second/path/to/libs:/first/path/to/libs</em></p>
<p>~$ <code>perl -e 'print join "\n", @INC;'</code><br />
<em>/third/path/to/libs<br />
/second/path/to/libs<br />
/first/path/to/libs<br />
/etc/perl<br />
/usr/local/lib/perl/5.10.0<br />
/usr/local/share/perl/5.10.0<br />
/usr/lib/perl5<br />
/usr/share/perl5<br />
/usr/lib/perl/5.10<br />
/usr/share/perl/5.10<br />
/usr/local/lib/site_perl<br />
.</em></p>
<p>And there it is.  Your PERL apps will look in those locations starting from the top.</p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=192&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/04/11/how-to-pass-perl-library-paths-from-the-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Prevent A PERL Script From Running As Root</title>
		<link>http://www.popmartian.com/tipsntricks/2011/03/29/how-to-prevent-a-perl-script-from-running-as-root/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/03/29/how-to-prevent-a-perl-script-from-running-as-root/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 03:11:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=184</guid>
		<description><![CDATA[At or near the top of your app, before it executes anything sensitive, place the following code: if((getpwuid($]]></description>
			<content:encoded><![CDATA[<p>At or near the top of your app, before it executes anything sensitive, place the following code:</p>
<p><code>if((getpwuid($<) eq "root") || ($< == 0)){<br />
    print STDOUT "Cannot run as root!\n";<br />
    exit(1);<br />
}</code></p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=184&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/03/29/how-to-prevent-a-perl-script-from-running-as-root/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Calculate BTU from Watts</title>
		<link>http://www.popmartian.com/tipsntricks/2011/02/02/how-to-calculate-btu-from-watts/</link>
		<comments>http://www.popmartian.com/tipsntricks/2011/02/02/how-to-calculate-btu-from-watts/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 21:06:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=172</guid>
		<description><![CDATA[This post came about because I got a lot of hits from people looking for this information on the How To Calculate Server Heat post. 1 Watt will produce 3.412 BTU per hour To calculate the BTU/heat output of an electrical system, substitute BTUs for Watts and use the following equation: BTU/h = (V * [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>This post came about because I got a lot of hits from people looking for this information on the <a href="http://www.popmartian.com/tipsntricks/2008/07/28/calculate-server-btu-output/">How To Calculate Server Heat</a> post.</p></blockquote>
<p><strong>1 Watt will produce 3.412 BTU per hour</strong></p>
<p>To calculate the BTU/heat output of an electrical system, substitute BTUs for Watts and use the following equation:</p>
<p><strong><code>BTU/h = (V * I) * 3.412</code></strong></p>
<p>Where:<br />
<code>V = Volts</code><br />
<code>I = Amperes (Amps or Current)</code></p>
<p>Using the simple math above, we can calculate the heat produced by an appliance on a 120v (US Standard) system drawing 2 Amps for 60 minutes (1 hour).</p>
<p><strong><code>BTU/h = 3.412 * (120 * 2) = 818.88BTU</code></strong></p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=172&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2011/02/02/how-to-calculate-btu-from-watts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HOWTO Turn off Line Numbers in VI</title>
		<link>http://www.popmartian.com/tipsntricks/2010/05/20/howto-turn-off-line-numbers-in-vi/</link>
		<comments>http://www.popmartian.com/tipsntricks/2010/05/20/howto-turn-off-line-numbers-in-vi/#comments</comments>
		<pubDate>Thu, 20 May 2010 17:52:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=167</guid>
		<description><![CDATA[I always forget how to turn off line numbers in VI. The answer is: set nonumbers or set nonu. It&#8217;s all about the little things&#8230; Did you find this post useful or have questions or comments? Please let me know!]]></description>
			<content:encoded><![CDATA[<p>I always forget how to turn off line numbers in VI.  The answer is:  set nonumbers or set nonu.  It&#8217;s all about the little things&#8230;</p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=167&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2010/05/20/howto-turn-off-line-numbers-in-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python HOWTO Push a Dict on to a List (push a hash on to an array)</title>
		<link>http://www.popmartian.com/tipsntricks/2010/04/23/python-howto-push-a-dict-on-to-a-list-push-a-hash-on-to-an-array/</link>
		<comments>http://www.popmartian.com/tipsntricks/2010/04/23/python-howto-push-a-dict-on-to-a-list-push-a-hash-on-to-an-array/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 14:37:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How Tos]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.popmartian.com/tipsntricks/?p=159</guid>
		<description><![CDATA[One of my more popular posts is How to Push a Hash on to an Array in PERL, but how do you push a dict on to a list in Python? Lists are one-dimensional arrays and dicts are associative arrays or hash arrays.  This means we can do the same thing we do in other [...]]]></description>
			<content:encoded><![CDATA[<p>One of my more popular posts is <a href="http://www.popmartian.com/tipsntricks/2008/08/12/perl-howto-push-a-hash-onto-an-array/">How to Push a Hash on to an Array in PERL</a>, but how do you push a dict on to a list in Python?</p>
<p>Lists are one-dimensional arrays and dicts are associative arrays or hash arrays.  This means we can do the same thing we do in other languages, with syntax to match Python&#8217;s object-oriented data structures.</p>
<p><code>import pprint</code></p>
<p><code># Define the list<br />
somelist = []</code></p>
<p><code># Do add some elements to the list<br />
somelist.append({'key1':'value1', 'key2': 'value2'})<br />
somelist.append({'key1':'value1', 'key2': 'value2'})<br />
somelist.append({'key1':'value1', 'key2': 'value2'})</code></p>
<p><code># Print it out<br />
pp = pprint.PrettyPrinter(indent=4)<br />
pp.pprint(somelist)</code></p>
<p>Will give you:</p>
<p><code>[   {   'key1': 'value1', 'key2': 'value2'},<br />
{   'key1': 'value1', 'key2': 'value2'},<br />
{   'key1': 'value1', 'key2': 'value2'}]</code></p>
<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!</p></blockquote>
<img src="http://www.popmartian.com/tipsntricks/?ak_action=api_record_view&id=159&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.popmartian.com/tipsntricks/2010/04/23/python-howto-push-a-dict-on-to-a-list-push-a-hash-on-to-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

