<?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>Curtis Summers &#187; tech tips</title>
	<atom:link href="http://csummers.com/category/tech-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://csummers.com</link>
	<description>%w{life code ruby}.map { &#124;i&#124; "#{i} is awesome" }</description>
	<lastBuildDate>Sat, 31 Mar 2012 19:54:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>OpenDNS</title>
		<link>http://csummers.com/2006/11/06/opendns/</link>
		<comments>http://csummers.com/2006/11/06/opendns/#comments</comments>
		<pubDate>Mon, 06 Nov 2006 21:54:01 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/11/06/opendns/</guid>
		<description><![CDATA[Every so often our cable internet (Time Warner Road Runner) will go &#8220;out.&#8221; Only it&#8217;s not really &#8220;out&#8221;: the cable modem&#8217;s internet connection is still on and I can ping IP addresses. What&#8217;s really happening is Road Runner&#8217;s DNS servers stop responding to DNS queries. This doesn&#8217;t happen very often, and it is usually resolved [...]]]></description>
			<content:encoded><![CDATA[<p>Every so often our cable internet (Time Warner Road Runner) will go &#8220;out.&#8221;  Only it&#8217;s not really &#8220;out&#8221;:  the cable modem&#8217;s internet connection is still on and I can ping IP addresses.  What&#8217;s really happening is Road Runner&#8217;s DNS servers stop responding to DNS queries.  This doesn&#8217;t happen very often, and it is usually resolved in a few minutes, but that&#8217;s too long when I&#8217;m trying to work.</p>
<p>The solution:  <a href="http://www.opendns.com">OpenDNS</a>.  These guys run a top-notch DNS service.  It&#8217;s free, <a href="http://www.opendns.com/stats/">reliable</a>, fast, and supposedly <a href="http://www.opendns.com/what/">safer</a>.  The <a href="http://www.opendns.com/start/">Getting Started</a> page has detailed instructions for using OpenDNS&#8217;s servers in place of your ISP&#8217;s servers.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/11/06/opendns/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>productivity tools: screen</title>
		<link>http://csummers.com/2006/04/07/productivity-tools-screen/</link>
		<comments>http://csummers.com/2006/04/07/productivity-tools-screen/#comments</comments>
		<pubDate>Fri, 07 Apr 2006 12:43:52 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/04/07/productivity-tools-screen/</guid>
		<description><![CDATA[In my last post, I wrote about setting up ssh-agent to streamline your connectivity to SSH remote hosts. In this post, I&#8217;ll introduce screen, which I use in conjunction with ssh &#038; ssh-agent to further improve my connectivity productivity. screen is a console window manager that multiplexes between multiple terminals. If multiplexing was it&#8217;s only [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.csummers.org/index.php/2006/04/05/productivity-tools-ssh-agent/" title="productivity tools: ssh-agent">last post</a>, I wrote about setting up ssh-agent to streamline your connectivity to SSH remote hosts.  In this post, I&#8217;ll introduce <a href="http://www.gnu.org/software/screen/" title="GNU screen's home page">screen</a>, which I use in conjunction with ssh &#038; ssh-agent to further improve my connectivity productivity.</p>
<p><b>screen</b> is a console window manager that multiplexes between multiple terminals.  If multiplexing was it&#8217;s only feature, then it would not be anymore useful than any existing multiple-tab terminals available in a GUI environment.  What really sets screen apart is its ability to open a screen session, detach that session from your connection, and then reattach it later on.  In other words, if I&#8217;m using screen, I can completely lose my SSH connection, reconnect, and then reattach to the screen session&#8211;putting me right back to where I was previously working before the connection dropped.</p>
<p>You can read more in-depth at <a href="http://jmcpherson.org/screen.html">Jonathon McPherson&#8217;s article on screen</a>, but here&#8217;s a quick run down of GNU Screen commands to get started:<br />
<code><br />
$screen #start screen<br />
$screen -r #reattach to an existing screen process<br />
$screen -R #reattach if possible, or start new session<br />
</code><code><br />
#within screen:<br />
Ctrl+a, c  #create a new window<br />
Ctrl+a, n  #switch to next window<br />
Ctrl+a, p  #switch to previous window<br />
Ctrl+a, N  #switch to Nth window (0-9)<br />
Ctrl+a, "   #list windows, choose with arrow keys and Enter<br />
</code></p>
<p>In my <a href="http://www.csummers.org/index.php/2006/04/05/productivity-tools-ssh-agent/" title="productivity tools: ssh-agent">previous post</a>, I setup a launch script for each remote SSH connection so that I could ensure that my ID had been added to the ssh-agent.  I&#8217;m now going to tweak this script to launch screen upon connection to save me the trouble of typing &#8220;screen -R&#8221; everytime I reconnect:<br />
<code><br />
#!/bin/bash<br />
# ~/bin/sv1<br />
ssh-id-check<br />
ssh -t user@remotemachine.com "screen -R"<br />
</code></p>
<p>I&#8217;ve added two items to the script:</p>
<ol>
<li>the ssh -t option is necessary to force the correct terminal type.  The excerpt from the GNU screen manual page:<br />
<blockquote><p>
-t      Force pseudo-tty allocation.  This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g., when implementing menu services.  Multiple -t options force tty allocation, even if ssh has no local tty.
</p></blockquote>
</li>
<li>the &#8220;screen -R&#8221; command is appended to the ssh command and will execute on the remote machine after connection.  The -R option will connect to any existing screen session if possible or open a new one if not.</li>
</ol>
<p>Now when I lose my SSH connection, I need only type the two or three-letters for my launch script and I&#8217;m put right back to where I was before the connection dropped.  Nifty!</p>
<p><em>One additional tip:</em><br />
If you use xterm and your scrollbar is not working, then put this into your ~/.screenrc file on each of remote machines you&#8217;re using screen with:<br />
<code><br />
termcapinfo xterm ti@:te@<br />
</code><br />
<a href="http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html">see this info from the Screen FAQ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/04/07/productivity-tools-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>productivity tools: ssh-agent</title>
		<link>http://csummers.com/2006/04/05/productivity-tools-ssh-agent/</link>
		<comments>http://csummers.com/2006/04/05/productivity-tools-ssh-agent/#comments</comments>
		<pubDate>Wed, 05 Apr 2006 18:33:41 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/04/05/productivity-tools-ssh-agent/</guid>
		<description><![CDATA[I spend pretty much all day connected to remote machines via ssh. It&#8217;s key to my work and losing that connection for any reason is a big productivity vacuum. Lately I&#8217;ve been having some connection problems, which has prompted me to streamline how I connect to my remote machines. ssh-agent and screen are great tools [...]]]></description>
			<content:encoded><![CDATA[<p>I spend pretty much all day connected to remote machines via ssh.  It&#8217;s key to my work and losing that connection for any reason is a big productivity vacuum.  Lately I&#8217;ve been <a href="http://www.csummers.org/index.php/2006/03/31/wrt54g-version-5-is-junk/">having some connection problems</a>, which has prompted me to streamline how I connect to my remote machines.  ssh-agent and screen are great tools for improving my connectivity productivity.  I&#8217;ll talk about ssh-agent in this post, and screen in the <a href="http://www.csummers.org/index.php/2006/04/07/productivity-tools-screen/" title="productivity tools: screen">next one</a>.</p>
<p><b>ssh-agent</b> enables almost-password-free* logins to your remote machines.  This is accomplished via SSH keys.  You basically generate an encryption key pair on your local machine and then copy your public key out to each user on each remote machine.  ssh-agent runs in the background on your local machine.  You add your identity to the ssh-agent and supply a passphrase.  As long as you keep your session (X session/login session) open and ssh-agent running, you won&#8217;t need to enter a password when ssh&#8217;ing to a remote machine.  This can significantly reduce your password typing during a day.  Here&#8217;s how I set it up:<br />
<code><br />
$ssh-keygen -t rsa<br />
</code></p>
<p>Enter a passphrase when asked and remember it.  Two key files are generated: your private key and your public key.<br />
<code><br />
#key files generated on your local machine:<br />
/home/username/.ssh/id_rsa<br />
/home/username/.ssh/id_rsa.pub<br />
</code></p>
<p>You will need to copy the <em>contents</em> of your public key file (id_rsa.pub) to each remote user&#8217;s authorized_keys file.  If this file doesn&#8217;t exist, create it.<br />
<code><br />
#on each remote machine, copy your public key into this file:<br />
/home/username/.ssh/authorized_keys<br />
</code></p>
<p>Now make sure that ssh-agent is running on your local machine.  You want to run ssh-agent for your login or X session.  I&#8217;m using Gnome and GDM on Gentoo, and ssh-agent is already setup for each session.  If you need to add it manually, see this page: <a href="http://www.phy.bnl.gov/computing/gateway/ssh-agent.html">http://www.phy.bnl.gov/computing/gateway/ssh-agent.html</a></p>
<p>Now add your ID to the running ssh-agent:<br />
<code><br />
$ssh-add<br />
Enter passphrase for /home/username/.ssh/id_rsa:<br />
Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)<br />
</code></p>
<p>You can now SSH into your remote machines without having to enter a password.  Try it!</p>
<p>*So, the only password you must enter is the passphrase for the identity you&#8217;ve created for ssh-agent.  You will need to re-add this identity everytime ssh-agent is restarted (e.g., when you close your session).</p>
<p>In order to further streamline the password-entering, this script checks whether or not the ID has already been added and runs ssh-add if not:<br />
<code><br />
#!/bin/sh<br />
# ~/bin/ssh-id-check<br />
# If no ID has been added to ssh-agent, then run ssh-add.<br />
if [ -n "`ssh-add -l | grep has\ no\ identities`" ]; then<br />
  ssh-add<br />
fi<br />
</code></p>
<p>Then, each of my SSH connections gets its own launch script that looks like this:<br />
<code><br />
#!/bin/bash<br />
# ~/bin/sv1<br />
ssh-id-check<br />
ssh user@remotemachine.com<br />
</code></p>
<p>I got the ID-checking script from here:<br />
<a href="http://forums.gentoo.org/viewtopic-t-407440.html">http://forums.gentoo.org/viewtopic-t-407440.html</a></p>
<p>Also read my post about how I use <a href="http://www.csummers.org/index.php/2006/04/07/productivity-tools-screen/" title="productivity tools: screen">GNU screen</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/04/05/productivity-tools-ssh-agent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WRT54G version 5 is junk!</title>
		<link>http://csummers.com/2006/03/31/wrt54g-version-5-is-junk/</link>
		<comments>http://csummers.com/2006/03/31/wrt54g-version-5-is-junk/#comments</comments>
		<pubDate>Fri, 31 Mar 2006 14:34:38 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/03/31/wrt54g-version-5-is-junk/</guid>
		<description><![CDATA[My beloved Linksys WRT54G (version 1.0) wireless router gave up the ghost this past week (I think because of a power issue). I attempted to debrick it, but no dice. I went out to Wally World (Wal-Mart) and picked up the latest model without doing too much research. Mistake. Version 5 is piece of junk! [...]]]></description>
			<content:encoded><![CDATA[<p>My beloved Linksys WRT54G (version 1.0) wireless router gave up the ghost this past week (I think because of a power issue).  I attempted to <a href="http://www.linksysinfo.org/modules.php?name=Content&#038;pa=showpage&#038;pid=33">debrick it</a>, but no dice.</p>
<p>I went out to Wally World (Wal-Mart) and picked up the latest model without doing too much research.  Mistake.  <span style="background: #ffffcc">Version 5 is piece of junk!</span>  It keeps dropping my SSH connections every few minutes and sometimes completely freezes up and I have to unplug and re-plug to fix it.  Apparently, version 5 of the WRT54G contains vxWorks firmware instead of the Linux firmware found on older models.</p>
<p>The <em>solution</em> is to buy the <a href="http://www.linuxdevices.com/news/NS4729641740.html">Linux enthusiast&#8217;s version of the router, the WRT54G<b>L</b></a>, at a premium cost: ~$10 more.  I can&#8217;t work with version 5, so I&#8217;ve ordered a WRT54G<b>L</b> and it should be here today or tomorrow.</p>
<p>Linksys:  Did you really save that much more money by switching to vxWorks (+ less RAM)?  What has this move cost you in terms of reputation and support costs on such a piece of junk?</p>
<p><b>UPDATE 04/05/06:</b>I got the WRT54GL, and as expected, it ROCKS!  I swiftly voided my warranty by putting <a href="http://dd-wrt.org/">DD-WRT</a> on it.  <em>If you decide to do this, read the DD-WRT documentation carefully.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/03/31/wrt54g-version-5-is-junk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>undelete text files on Linux ext3 partition</title>
		<link>http://csummers.com/2005/12/20/undelete-text-files-on-linux-ext3-partition/</link>
		<comments>http://csummers.com/2005/12/20/undelete-text-files-on-linux-ext3-partition/#comments</comments>
		<pubDate>Wed, 21 Dec 2005 01:32:39 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/?p=33</guid>
		<description><![CDATA[Every once in a while I do something really, really stupid. Like, say, for instance, delete a whole directory of very important code that I&#8217;m working on and my last backup is a couple of weeks old (because of a server move and my failure to re-setup my cron backup). How did this happen? Well, [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while I do something really, really stupid.  Like, say, for instance, delete a whole directory of very important code that I&#8217;m working on and my last backup is a couple of weeks old (because of a server move and my failure to re-setup my cron backup).  How did this happen?  Well, for one, I was coding at about 5:30 a.m. before my caffeine had set in, and, secondly, I was rm -rf&#8217;ing with tab-completion.  Almost instantly after I pressed Enter I realized what I had done.  Tragedy.  Or so I thought&#8230;</p>
<p>In Linux, you can undelete files if you are using the ext2 file system.  A very handy tool called debugfs allows you to list files marked as deleted.  I&#8217;m using the ext3 file system (ext2&#8242;s successor), so I thought the debugfs solution would work.  Unfortunately, ext3 actually zeros out the block pointer (the pointer to the file&#8217;s data), so reconstructing the file becomes impossible with debugfs.</p>
<p>So, what to do?  I had seen some mailing list posts refering to &#8216;grepping&#8217; the data from the disk drive.  Most everything I lost was code (specifically, Ruby).  I attempted to use grep to search my hard disk device (/dev/sda7 in my case), but grep kept erroring out with &#8220;memory exhausted&#8221; errors.  Hrrm.</p>
<p>A rethink of the problem led me to the &#8216;strings&#8217; program, which extracts text from files, stdin, or even a disk device.  I dumped all text from the disk partition to a text file like so:</p>
<p><code><br />
#strings /dev/sda7 > /path/to/big_text_file<br />
</code></p>
<p><em>Note: It is probably a good idea to put the big text file on a separate partition.  Otherwise, you risk writing over some of your deleted files on the partition you are attempting to recover from.</em></p>
<p>I was now able to open the big_text_file in vim and recover all of my deleted code by searching for particular code snippets.  It&#8217;s not ideal, but I was able to recover everything.  Instead of losing several days worth of work, I only lost a couple of hours.</p>
<p>And, of course, my backup is re-setup.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/12/20/undelete-text-files-on-linux-ext3-partition/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>passing ORACLE_HOME to Apache environment for PHP oci8 module</title>
		<link>http://csummers.com/2005/08/09/passing-oracle_home-to-apache-environment-for-php-oci8-module/</link>
		<comments>http://csummers.com/2005/08/09/passing-oracle_home-to-apache-environment-for-php-oci8-module/#comments</comments>
		<pubDate>Tue, 09 Aug 2005 16:47:42 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/?p=25</guid>
		<description><![CDATA[A couple of weeks ago I was installing a development environment at work on CentOS with Apache 2, PHP, and the oci8 module. All configured, make&#8217;d, and installed, I was up and running with Apache, PHP, and the Oracle Client tools (sqlplus, etc.) in short order. Everything worked except the oci8 php library functions&#8211;they couldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I was installing a development environment at work on CentOS with Apache 2, PHP, and the oci8 module.  All configured, make&#8217;d, and installed, I was up and running with Apache, PHP, and the Oracle Client tools (sqlplus, etc.) in short order.  Everything worked except the oci8 php library functions&#8211;they couldn&#8217;t find my Oracle instances to connect.</p>
<p>I had covered all of the bases:</p>
<ul>
<li>I could connect with sqlplus to my instance, so the Oracle client worked</li>
<li>I had set the ORACLE_HOME with SetEnv in Apache&#8217;s configuration file and in bash&#8217;s system profile</li>
<li>phpinfo() showed the oci8 module as installed and the ORACLE_HOME environment variable as set</li>
</ul>
<p>This problem had me stumped a good part of an afternoon until I attempted to start Apache directly with apachectl instead of through the &#8216;service&#8217; command used in CentOS.  Suddenly, it worked!</p>
<p>A quick shuffle through the service script and I found that it was restricting the environment before calling the service like so:</p>
<p><code>env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}"</code></p>
<p>Hmm.  So, only LANG, PATH, and TERM are passed into any service environment: ORACLE_HOME is left out in the cold.  And, even though I set it in the httpd.conf file, this is apparently too late for it to make a difference in the php oci8 module.  A quick fix in the service script adds the requisite ORACLE_HOME:</p>
<p><code>env -i ORACLE_HOME=$ORACLE_HOME LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}"</code></p>
<p>The line above occurs a few times, so add to each occurance. Voila!  It works.</p>
<p><em>I&#8217;m content with this solution for now, but I don&#8217;t particularly like having to change the service script, so is there any other way to do this?</em></p>
<p><strong>Update:</strong><em>This is apparently a common issue:  <a href="http://lists.debian.org/debian-apache/2004/08/msg00135.html">Debian mailing list comment</a>, <a href="http://bugs.gentoo.org/show_bug.cgi?id=32364">Gentoo bug</a>, which is fixed with a white list of environment variables in a separate file.   I couldn&#8217;t find a similar RedHat/CentOS bug.  And, the SetEnv in the httpd.conf file is only effective for CGI PHP, which does not work for me because I&#8217;m using mod_php</em></p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/08/09/passing-oracle_home-to-apache-environment-for-php-oci8-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Update Grrr!</title>
		<link>http://csummers.com/2005/06/20/windows-update-grrr/</link>
		<comments>http://csummers.com/2005/06/20/windows-update-grrr/#comments</comments>
		<pubDate>Mon, 20 Jun 2005 17:01:53 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/?p=14</guid>
		<description><![CDATA[For about a week now Windows Update on my work machine has failed to download or install the latest security patches. I&#8217;ve tried Automatic Updates and going directly to the windowsupdate.microsoft.com site, but both methods start to download and then fail with no error messages. Perfect. So, I did some digging and found that the [...]]]></description>
			<content:encoded><![CDATA[<p>For about a week now Windows Update on my work machine has failed to download or install the latest security patches.  I&#8217;ve tried Automatic Updates and going directly to the windowsupdate.microsoft.com site, but both methods start to download and then fail with no error messages.  <em>Perfect.</em></p>
<p>So, I did some digging and found that the update log lives here (in default XP Pro): C:\Windows\SoftwareDistribution\ReportingEvents.log</p>
<p>Scrolling down through this text file I find the 9th column over to show the error number: 80264005</p>
<p>Google then brings up Ali&#8217;s helpful blog entry: <a href="http://www.alibutt.com/?p=195">Windows update gives a 80246005 error</a></p>
<p>Basic rundown: Stop the Automatic Updates service, delete the contents of C:\Windows\SoftwareDistribution\DataStore, restart the Automatic Update service and try the download/install of updates again.</p>
<p>Worked for me.  Thanks, Ali.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/06/20/windows-update-grrr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

