<?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>guylichtman.com &#187; utilities</title>
	<atom:link href="http://guylichtman.com/wordpress/category/utilities/feed/" rel="self" type="application/rss+xml" />
	<link>http://guylichtman.com/wordpress</link>
	<description>What's on my mind?</description>
	<lastBuildDate>Sat, 12 Dec 2009 22:39:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Virtual Shell</title>
		<link>http://guylichtman.com/wordpress/2008/05/26/php-virtual-shell/</link>
		<comments>http://guylichtman.com/wordpress/2008/05/26/php-virtual-shell/#comments</comments>
		<pubDate>Mon, 26 May 2008 19:07:23 +0000</pubDate>
		<dc:creator>Guy Lichtman</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://guylichtman.com/wordpress/?p=17</guid>
		<description><![CDATA[Well its been a while since I&#8217;ve posted something with a technical nature. So, I decided to write about this small php script I&#8217;ve been using to get around hosting limitation regarding ssh access. As I&#8217;ve encountered some popular shared hosting providers (such as godaddy) do not provide ssh access. I am not sure why [...]]]></description>
			<content:encoded><![CDATA[<p>Well its been a while since I&#8217;ve posted something with a technical nature. So, I decided to write about this small php script I&#8217;ve been using to get around hosting limitation regarding ssh access. As I&#8217;ve encountered some popular shared hosting providers (such as godaddy) do not provide ssh access. I am not sure why this practice is so common. I am assuming it is more of a support issue than security, as it is possible to execute system commands via php.</p>
<p>This leads me to introduce my php virtual shell. It is basically a simple php script which receives input from the user and executes the command and displays the result. The added bonus is that this script also keeps a history of the commands and supports <strong>automatic history completion</strong>. I love the history and simple command search of modern shells, so I decided to add this to my virtual shell. </p>
<p>I used a javascript auto complete control which I found <a href="http://www.codeproject.com/KB/scripting/jsactb.aspx" target="_blank">here</a> . The script basically stores a history of the  commands in a file: .vshellhist, and every time the script is executed this file is used to build a javascript array containing all previous commands. From there on, the auto complete control goes into affect. For more details simply look at the code. It is pretty straight forward.  </p>
<p>The php code and relevant javascript files can be dowloaded here:  <a href='http://guylichtman.com/wordpress/wp-content/uploads/2008/05/php-vshell.zip'>php-vshell.zip</a>. To use this script first change the password in the script file. I put the password just for general protection against misuse. I recommend to also change the script file name. Note that the password is kept on file in the clear. For better protection, I would use a form of password authentication which at least keeps the password encrypted on disk. Probably easiest is to use Apache&#8217;s authentication mechanism through the use of a .htaccess file. Once the password is set simply upload the php and javascript files (all to the same directory) and start testing out your new shell.    </p>
]]></content:encoded>
			<wfw:commentRss>http://guylichtman.com/wordpress/2008/05/26/php-virtual-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cool utility: rlwrap</title>
		<link>http://guylichtman.com/wordpress/2007/09/15/cool-utility-rlwrap/</link>
		<comments>http://guylichtman.com/wordpress/2007/09/15/cool-utility-rlwrap/#comments</comments>
		<pubDate>Sat, 15 Sep 2007 15:34:40 +0000</pubDate>
		<dc:creator>Guy Lichtman</dc:creator>
				<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://guylichtman.com/wordpress/2007/09/15/cool-utility-rlwrap/</guid>
		<description><![CDATA[I came across rlwrap, while searching on how to enable history for sqlplus on linux. It turns out that sqlplus does not support command line history on linux. This fact itself I found surprising. I was sure all this time that I had some configuration problem with sqlplus on linux, but it turns out that [...]]]></description>
			<content:encoded><![CDATA[<p>I came across <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/">rlwrap</a>, while searching on how to enable history for sqlplus on linux. It turns out that sqlplus does not support command line history on linux. This fact itself I found surprising. I was sure all this time that I had some configuration problem with sqlplus on linux, but it turns out that sqlplus simply doesn&#8217;t support command line history on linux. I found rlwrap to be an excellent option for providing command line history for tools such as sqlplus. It not only supports the up arrow for history, but also supports the backwards search option using Ctrl+r. Additionally, the tool support completion suggestions either based upon the names of files or using a list of words found in a file. While using rlwrap with sqlplus, for example, I can create a file with a list of the table names I use, and then when by pressing tab receive completion suggestions (based on typed prefix) for possible table names.</p>
<p>rlwrap is very easy to use. You simply prefix the command you want to use with <code>rlwrap</code>. For example: <code>rlwrap sqlplus</code></p>
<p>I was very impressed with this tool, so I also installed rlwrap on cygwin. For some reason on cygwin I needed to set the environment variable: <code>RLWRAP_HOME</code> to get the command history to work. I simply set this variable to point to a directory named <code>.rlwrap</code> in my home directory and then everything worked great.</p>
<p>I really liked the completion option via a file with completion suggestions. What I did find missing was a way to add context sensitivity to these suggestions. Adding an <strong>easy</strong> (and the emphasize here is on easy) option to customize the suggestions based on the context of the line would be a big functional boost for me. Possible options for specifying such context sensitivity might be via regular expression matching or executing some kind of script action. Bash has support for &#8220;Programmable Completion&#8221; and it might be possible to take some concepts from there.</p>
]]></content:encoded>
			<wfw:commentRss>http://guylichtman.com/wordpress/2007/09/15/cool-utility-rlwrap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
