tag:blogger.com,1999:blog-76070591568243903202024-02-19T03:45:38.218-08:00Andrew AultAndrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-7607059156824390320.post-21990445398171377282010-01-24T11:26:00.000-08:002010-01-24T11:27:04.247-08:00I've movedNew posts are at <a href="http://andrewault.net/">http://andrewault.net/</a>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-58773021982406185282009-04-26T11:34:00.000-07:002009-04-27T10:16:56.935-07:00Installing Trac and Subversion on Ubuntu Ibex<p>These are basically my notes from installing Trac and Subversion on an Ubuntu Intrepid Ibex server.</p>
<p style="font-weight:bold;">Install Software Packages</p>
<pre>
<code>
sudo aptitude install libapache2-mod-python libapache2-svn python-setuptools subversion python-subversion
sudo easy_install Trac
</code>
</pre>
<p style="font-weight:bold;">Create the Trac Environments Directory</p>
<code>
sudo mkdir /var/lib/trac
sudo chown www-data:www-data /var/lib/trac
</code>
<p style="font-weight:bold;">Setup Apache2</p>
<p>Using the default Ubuntu Apache virtual server setup, create a virtual server instance for
Trac. This single instance will be used for all Trac projects on the server.</p>
<code>
sudo vi /etc/apache2/sites-available/trac.websitename.com
</code>
<p>Your file will look a lot like the following. Use your website name instead of websitename.com and use a valid e-mail addressinstead of webmaster@websitename.com.</p>
<pre>
<code>
<VirtualHost *:80>
ServerAdmin webmaster@websitename.com
ServerName trac.websitename.com
DocumentRoot /motuit/var/www/trac.websitename.com/public
LogLevel warn
ErrorLog /motuit/var/www/trac.websitename.com/logs/error.log
CustomLog /motuit/var/www/trac.websitename.com/logs/combined.log combined
# DirectoryIndex index.html
<Location /projects>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /projects
PythonOption PYTHON_EGG_CACHE /tmp
</Location>
# use the following for one authorization for all projects
# (names containing "-" are not detected):
<LocationMatch "/projects/[[:alnum:]]+/login">
AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/htpassword.websitename.com
Require valid-user
</LocationMatch>
</VirtualHost>
</code>
</pre>
<p>Now, use the Debian/Ubuntu utility a2ensite to create a link in apache2/sites-enabled to the file you just created in apache2/sites-available. Then, reload apache2 to enable the new subdomain.</p>
<pre>
<code>
sudo a2ensite trac
sudo /etc/init.d/apache2 reload
</code>
</pre>
<p>You will also need to create a DNS A record to point to the server for this subdomain, but this is outside the scope of this blog entry.</p>
<p style="font-weight:bold;">Create Trac and Subversion Environments</p>
<p>Here we will make directories and create the Subversion repositories.</p>
<pre>
<code>
sudo mkdir /var/lib/svn
sudo mkdir /usr/share/trac
sudo svnadmin create /var/lib/svn/project1
sudo svnadmin create /var/lib/svn/project2
</code>
</pre>
<p style="font-weight:bold;">Set some permissions:</p>
<pre>
<code>
sudo chown -R www-data /var/lib/svn
sudo chown -R www-data /usr/share/trac
sudo /etc/init.d/apache2 reload
</code>
</pre>
<p style="font-weight:bold;">Set up Trac</p>
<pre>
<code>
sudo mkdir /var/lib/trac
</code>
</pre>
Initialize Trac for one of your projects.
<pre>
<code>
sudo trac-admin /var/lib/trac/project1 initenv
</code>
</pre>
<p style="font-weight:bold;">The utility will ask for:</p>
<p><span style="font-weight:bold;">Project Name [My Project]>:</span> project1<br />
<span style="font-weight:bold;">Database connection string [sqlite:db/trac.db]>:</span> <enter><br />
<span style="font-weight:bold;">Repository type [svn]>:</span> <enter><br />
<span style="font-weight:bold;">Path to repository [/path/to/repos]>:</span> /var/lib/svn/project1<br /></p>
<p style="font-weight:bold;">Repeat the above for the following, substituting the project code for each:</p>
<pre>
<code>
sudo trac-admin /var/lib/trac/project2 initenv
</code>
</pre>
<code>
sudo chown -R www-data /var/lib/trac
</code>
<p style="font-weight:bold;">Get Subversion Running</p>
<p>Modify /etc/apache2/mods-available/dav_svn.conf</p>
<pre>
<code>
sudo vi /etc/apache2/mods-available/dav_svn.conf
</code>
</pre>
<pre>
<code>
<Location /svn>
DAV svn
SVNParentPath /var/lib/svn
SVNListParentPath On
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/htpassword.websitename.com
# To enable authorization via mod_authz_svn
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
</code>
</pre>
<p style="font-weight:bold;">Install More aptitude packages for Trac plugins</p>
<p>Install some packages that will be needed.</p>
<pre>
<code>
sudo aptitude install build-essential graphviz
sudo aptitude install enscript
sudo aptitude install htmldoc
</code>
</pre>
<p style="font-weight:bold;">Using easy_install to Install more Trac Plugins</p>
<p>Because these are installed, you will be able to turn these on easily as Trac administrator.</p>
<pre>
<code>
sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/
sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11
sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10
sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11
sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11
sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/
sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11
sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11
sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11
sudo easy_install http://wikinotification.ufsoft.org/svn/trunk
</code>
</pre>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-82788609347552887732009-02-01T16:40:00.000-08:002009-02-01T20:16:35.045-08:00Ubuntu: Open Terminal from Nautilus<p>This will allow you to open a Terminal instance in context in Nautilus.</p>
<code bash>
sudo aptitude install nautilus-open-terminal
</code>
<p>You will need to restart Gnome for it to take effect. Note that all you user programs will be terminated...so save data first. Then either use <ctrl><alt><backspace>, or:</p>
<code bash>
sudo /etc/init.d/gdm restart
</code>
<p>And Bob's your uncle. Now you can right-click and open a Terminal.</p>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-54321611430892246722009-01-30T15:33:00.000-08:002009-02-01T20:18:09.910-08:00Basic Password Protection for Apache Webpage<p>This is the bare bones basics to protect a web page or series of pages on an Apache web server.</p>
<p>.htaccess file</p>
<code>
AuthName "SectionName"
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
Require valid-user
</code>
<p>Replace <b>SectionName</b> with the name of what you are protecting (in and below the directory that you are putting the .htaccess file in. Example: My Web Site</p>
<p>Replace <b>/full/path/to/.htpassword</b> with the actual full path to the .htpassword file you created.<br /></p>
<p>.htpassword file</p>
<code>
username:encryptedPassword
</code>
<p>Replace <b>encryptedPassword</b> with your choice of password encrypted with the <b>htpasswd</b> program that came with Apache. Use <b>man htpassword</b> for instructions.<br /></p>
<p>You can then access the page with the normal address...in which case it will ask for the username and password, or you can use this:</p>
<p>http://username:password@website.com/page</p>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-54655253964644376572009-01-05T10:34:00.000-08:002009-02-03T09:07:57.052-08:00Using Public/Private Key Pairs with SSH<p>This is one of those subjects that is a little difficult to convey clearly. It is a logical process and not difficult...but it is precise in the sense that certain files must be correct, be in the right places and have <span style="font-weight: bold;">correct permissions</span>. I've organized these instructions in three parts, key generation; local (client) side setup; remote(server) side setup.</p>
<p>For more information about public/private keys, <a href="http://en.wikipedia.org/wiki/Public-key_cryptography">see the Wikipedia article</a>.</p>
<p><span style="font-weight: bold;font-family:verdana;font-size:130%;" >1. Generating a Public/Private key Pair</span></p>
<p>The private key will be named whatever you specified and the public key will have that name appended with ".pub". These keys will be located in the ~.ssh directory. For example, using the default name for a dsa key pair, the files will be "id_dsa" and "id_dsa.pub". Always keep the private key private. The public key is not secret and can be put in unsecure locations.</p>
<p>You need to generate the correct type of key for the remote system you are dealing with. In this article, we are using a dsa type key as an example. If the remote system requires an rsa key pair, generate an rsa pair instead.</p>
<p>To generate dsa key pair:</p>
<code>
ssh-keygen -t dsa
</code>
<p>The program will ask a series of prompted questions. For our purposes, it is Ok to just keep pressing the enter key for the defaults. The generated keys will be stored in your ~/.ssh directory. See the generated keys with:</p>
<code>
ls -l ~/.ssh
</code>
<p><span style="font-weight: bold;font-family:verdana;font-size:130%;" >2. Setup on the Local Side</span></p>
<p><span style="font-weight: bold;font-family:verdana;" >Ensure Correct Permissions</span></p>
<code>
chmod 700 ~/.ssh<br />
chmod 600 ~/.ssh/*<br />
</code>
<p><span style="font-weight: bold; font-style: italic;">If directory or filename permissions are not correct, ssh will fail to use the keys.</span></p>
<p><span style="font-weight: bold;font-family:verdana;" >Create a config File</span></p>
<p>For each remote system, create a multi-line entry in the ~.ssh/config text file. You can create this file using your favorite editor, vi for example. File contents (one group per server, one group shown):</p>
<code>
Host friendly_server_name_here<br />
HostName ip_number_here<br />
IdentityFile ~/.ssh/id_dsa<br />
PasswordAuthentication no<br />
Port 22<br />
User your_username_on_remote_here<br />
</code>
<p>Of course, replace the three bolded items with your information for your accounts.</p>
<p>Give the config file the correct permissions:</p>
<code>
chmod 600 ~/.ssh/config
</code>
<p><span style="font-weight: bold;font-family:verdana;font-size:130%;" >3. Setup on the Remote Side</span></p>
<p>Copy the public key file you generated from your local machine to the remote machine's .ssh directory:</p>
<code>
scp ~/.ssh/id_dsa.pub username@servername:~/.ssh
</code>
<p>Log in the remote machine for the next operations:</p>
<code>
ssh username@servername
</code>
<p>Append the contents of your public key file to <span style="font-weight: bold;">~/.ssh/the authorized_keys</span> file:</p>
<code>
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
</code>
<p>Actually, the ~/.ssh/id_dsa.pub file does not need to be there, just appended to the ~/.ssh/authorized_keys file. It was just convenient to do it this way.
<span style="font-weight: bold;font-family:verdana;" >
Ensure Correct Permissions</span></p>
<code>
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
</code>
<p><span style=";font-family:verdana;font-size:130%;" ><span style="font-weight: bold;">Done!</span></span></p>
<p>Now you can login to the remote system with:</p>
<code>
ssh username@servername
</code>
<p>...and not need to enter a password!</p>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-36573865664600994902009-01-04T10:30:00.000-08:002009-02-02T10:31:58.171-08:00Padding a Numeric in Bash<p>I needed to pad a day of the month value to 2 places in a bash script.</p>
<p>This is made easy by the GNU program <span style="font-weight: bold;">printf</span>, which is part of standard distributions of Linux. In the following script snippet, the current day of the month is passed from the command invocation (or, if not specified, defaulted to the current day). It is then zero-padded with printf.</p>
<code>
TODAY=$(date +%d)
if [[ "$1" != "" ]]; then
TODAY=$1
fi
TODAY=$(printf "%02d" $TODAY) # Zero pad day.
</code>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com2tag:blogger.com,1999:blog-7607059156824390320.post-56080066686906173592008-12-26T09:50:00.000-08:002009-02-03T09:07:13.600-08:00Nautilus as Root in Ubuntu<p>Firstly, you can just run Nautilus as root from the command line with:</p>
<code bash>gksudo nautilus</code>
<p>The following procedure will add a root file browser to the Applications | System Tools menu.</p>
<p>I got this from <a href="http://ubuntuforums.org/archive/index.php/t-256998.html">http://ubuntuforums.org/archive/index.php/t-256998.html</a>.</p>
<p>Create a text file with:</p>
<code bash>
gksudo gedit /usr/share/applications/Nautilus-root.desktop
</code>
<p>Add these lines to the file:</p>
<code>
[Desktop Entry]<br />
Name=File Browser (Root)<br />
Comment=Browse the filesystem with the file manager<br />
Exec=gksudo "nautilus --browser %U"<br />
Icon=file-manager<br />
Terminal=false<br />
Type=Application<br />
Categories=Application;System;<br />
</code>
<p>Open Nautilus with: <span style="font-weight: bold; font-style: italic;">Applications -> System Tools -> File Browser (Root)</span></p>
<p><span style="font-size:130%;">An Alternative</span></p>
<p>This is from a comment by <span style="font-weight:bold;">Cerebrux</span> to this post:</p>
<p>1) Open Synaptic and install the "nautilus-gksu"</p>
<p>2) Logout- Login</p>
<p>3) And now do right-click on a folder and "open as administrator".</p>
<p>P.S. If you want the "open terminal here" in your right-click, then just install "nautilus-open-terminal"</p>Firstly, you can just run Nautilus as root from the command line with:</p>
<code bash>gksudo nautilus</code>
<p>The following procedure will add a root file browser to the Applications | System Tools menu.</p>
<p>I got this from <a href="http://ubuntuforums.org/archive/index.php/t-256998.html">http://ubuntuforums.org/archive/index.php/t-256998.html</a>.</p>
<p>Create a text file with:</p>
<code bash>
gksudo gedit /usr/share/applications/Nautilus-root.desktop
</code>
<p>Add these lines to the file:</p>
<code>
[Desktop Entry]<br />
Name=File Browser (Root)<br />
Comment=Browse the filesystem with the file manager<br />
Exec=gksudo "nautilus --browser %U"<br />
Icon=file-manager<br />
Terminal=false<br />
Type=Application<br />
Categories=Application;System;<br />
</code>
<p>Open Nautilus with: <span style="font-weight: bold; font-style: italic;">Applications -> System Tools -> File Browser (Root)</span></p>
<p><span style="font-size:130%;">An Alternative</span></p>
<p>This is from a comment by <span style="font-weight:bold;">Cerebrux</span> to this post:</p>
<p>1) Open Synaptic and install the "nautilus-gksu"</p>
<p>2) Logout- Login</p>
<p>3) And now do right-click on a folder and "open as administrator".</p>
<p>P.S. If you want the "open terminal here" in your right-click, then just install "nautilus-open-terminal"</p>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com2tag:blogger.com,1999:blog-7607059156824390320.post-6345404593814239812008-12-24T10:29:00.000-08:002009-02-02T10:35:39.662-08:00SQLyog on Ubuntu<p><a href="http://www.webyog.com/en/">SQLyog</a> is a popular MySQL GUI client that can be very convenient for certain operations like quickly dumping a database, schema changes. For operations that are awkward via the command line, it is useful.</p>
<p>I've installed SQLyog on my Ubuntu (Hardy Heron) laptop. It was very easy using <a href="http://www.winehq.org/">Wine</a>.</p>
<p><span style=";font-family:verdana;font-size:130%;" ><span style="font-weight: bold;">To install SQLyog with Wine</span></span></p>
<p>Install Wine on your Ubuntu system using the Synaptic Package Manager. As of this writing, version 1.0.0.1 was current. the exact version of Wine is probably not important.</p>
<p>Download SQLyog from <a href="http://www.webyog.com/en/downloads.php#sqlyog">here</a>. I use the community edition. It is not important where you download the installation (Windows EXE) to. Just save the program file someplace convenient that you can easily navigate to via bash in the Terminal.</p>
<p>Open a Terminal window and change to the directory where you stored the EXE installation file. Type:</p>
<code bash>
wine SQLyog714.exe</span>
</code>
<p>This is the exact filename that I downloaded. You will probably need to change it to the filename you downloaded.</p>
<p>Follow through the installation process using the standard SQLyog installer. Accept defaults. The program will be installed under a directory in your home directory called <span style="font-weight: bold;">.wine</span>.</p>
<p>At the end of the installation, the dialog will allow you to run the program. Go ahead and run it for the thrill of seeing a Windows program run on Linux. Wine is great!</p>
<p><span style=";font-family:verdana;font-size:130%;" ><span style="font-weight: bold;">Create a shortcut to run SQLyog in Terminal</span></span></p>
<p>I like to run SQLyog from the command line. I could change to the program's directory and start the program with <span style="font-weight: bold;">wine</span> <span style="font-weight: bold;">SQLyog.exe</span>. Like this:</p>
<p><span style="font-family: courier new; color: rgb(0, 0, 153);">cd ~/.wine/drive_c/Program\ Files/SQLyog\ Community</span><span style="font-family: courier new; color: rgb(0, 0, 153);"> </span><span style="font-family: courier new; color: rgb(0, 0, 153);">wine SQLyog.exe</span></p>
<p>For convenience, I created a script to start SQLyog just by typing <span style="font-weight: bold;">sqlyog</span>. I created a text file called <span style="font-weight: bold;">sqlyog</span> with the above two lines and made it executable with <span style="font-weight: bold;">chmod +x sqlyog</span>. I have a directory in my $PATH for scripts like this, so I can fire SQLyog from anywhere.</p>
<p>Adding SQLyog to the Ubuntu Applications menu</p>
<p>On my installation of SQLyog, an entry was not made in the Applications menu to launch SQLyog. I added it to <span style="font-weight: bold;">Applications | Wine</span> by right-clicking on <span style="font-weight: bold;">Applications</span> and selecting <span style="font-weight: bold;">Edit Menus</span>. I added a new menu item with the New Menu button. The command to run SQLyog is:</p>
<code bash>
env WINEPREFIX="/home/andrew/.wine" wine "C:\Program Files\SQLyog Community\SQLyog.exe"
</code>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com8tag:blogger.com,1999:blog-7607059156824390320.post-53859112484972341212008-12-23T14:29:00.000-08:002009-02-05T15:18:52.694-08:00Virtual Web Server Sandboxes on Ubuntu<p><span style="font-weight: bold;">Problem:</span> Multiple virtual web sites are needed on an Ubuntu machine.</p>
<p><span style="font-weight: bold;">Solution:</span> Set-up virtual servers in Apache and modify the <span style="font-weight: bold;">/etc/hosts</span> file so URLs of your choosing will resolve to the virtual sites that you create.</p>
<p>This procedure was tested using Ubuntu Hardy Heron.</p>
<p>For Apache's documentation about name based virtual hosting, see:
</p>
<p><a href="http://httpd.apache.org/docs/1.3/vhosts/name-based.html">http://httpd.apache.org/docs/1.3/vhosts/name-based.html</a>
</p>
<p><span style="font-size:130%;"><b>Step One: Modify the hosts File</b></span></p>
<p>The /etc/hosts text file is owned by root and allows a simple means to resolve a URL that your type into your web browser to an IP number. In this case we want our example URL of <b>my.example.com</b> to resolve to the IP address of the local machine, just like <b>localhost</b>. This is normally <b>127.0.0.1</b>. Edit the /etc/hosts file with:</p>
<code bash>
sudo vi /etc/hosts
</code>
<p>Find the line that reads:</p>
<code>
127.0.0.1 localhost
</code>
<p>On the same line, after localhost, add a space and the name of your virtual site:</p>
<code>
127.0.0.1 localhost my.example.com
</code>
<p>That's it for the hosts file. You do not need to restart anything.</p>
<p></p><p style="margin-bottom: 0in; font-weight: bold;font-family:verdana;"><span style="font-size:130%;">Step Two: Set-up a Virtual Website on Apache</span></p>
<p>Apache has the handy ability to discern the URL from a browser's address line and serve up the site that has been configured for it. This allows a server with a single IP address (like our 127.0.0.1) to host several sites at once.</p>
<p>For each virtual web site on the server, create a text file in the <span style="font-weight: bold;">/etc/apache2/sites-available</span> directory. Use the following template to create the file (called <span style="font-weight: bold;">my.example.com</span> in this example):</p>
<pre>
<code>
<VirtualHost *:80>
ServerAdmin username@localhost
ServerName my.example.com
DocumentRoot /home/username/public_html/my.example.com
CustomLog /var/log/apache2/my.example.com.log combined
</VirtualHost>
</code>
</pre>
<p>You will need to create this file as root, so:</p>
<code>
sudo vi /etc/apache2/sites-available/my.example.com</p><p>
</code>
<p>Now, you can use a Debian (Ubunto is a Debian variant) utility to easily create a link to this configuration file:</p>
<code>
sudo a2ensite my.example.com
</code>
<p>The above line simply creates a link to the <span style="font-weight: bold;">my.example.com</span> file in the <span style="font-weight: bold;">/etc/apache2/sites-available</span> directory. This allows you to enable and disable sites easily. The Debian disable counterpart to <span style="font-weight: bold;">a2ensite</span> is <span style="font-weight: bold;">a2dissite</span> (which just deletes the link).
</p>
<p>Lastly, reload Apache:</p>
<code>
sudo /etc/init.d/apache2 reload
</code>
<p>After ensuring that you have something to sever in the site's document directory, enter the URL you used in your browser's address field and try it out!</p>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-49233444510260644292008-04-22T10:08:00.000-07:002009-02-01T20:12:02.447-08:00Reading a File on the Internet with vi<p>Enter the fully qualified name of the file that you want to open in the current buffer, for example:</p>
<code>
http://andrewault.blogspot.com/
</code>
Place the cursor over the name somewhere. In Normal Mode (not Insert Mode) type:
<code>
gf
</code>
<p>vi will use the appropriate unix utility (in this case, wget) to download the file and then read it into a new buffer.</p>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-45220722701267510162008-04-21T18:48:00.000-07:002008-04-21T19:45:07.609-07:00New Blog DesignI grew tired of my blog's previous design. It was a little too green, plain and sort of depressing.
I've given it a bit of a makeover. I hope people this is attractive.Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-87110002900799832622008-04-21T18:43:00.000-07:002008-12-10T13:05:08.224-08:00vi Cheatsheet Work in Progress<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjt_r7kpDPaz1wl_veBOhbbjrg8NJwrzoR2Fp3yautQb5Z32Ttf832rzR1URtWaMT7ipmKJKULzCjeSTpkVl7_j0Q3-c72iGmo2Tqpm_mDWEnQYtbc838EyOB1a3QP0gh9aifrgDObGJJcA/s1600-h/vi+cheatsheet.png"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjt_r7kpDPaz1wl_veBOhbbjrg8NJwrzoR2Fp3yautQb5Z32Ttf832rzR1URtWaMT7ipmKJKULzCjeSTpkVl7_j0Q3-c72iGmo2Tqpm_mDWEnQYtbc838EyOB1a3QP0gh9aifrgDObGJJcA/s400/vi+cheatsheet.png" alt="" id="BLOGGER_PHOTO_ID_5191881967430558018" border="0" /></a><br />I've been working on a vi cheatsheet. This is still a work in progress. When it is done I want to make some coffee mugs wrapped with this graphic. Any comments or e-mail messages with suggestions are welcome.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_JaKvlYtFK_I/SA1DW0B0YTI/AAAAAAAAACY/0VFUjA11xig/s1600-h/vi+cheatsheet.png"><br /></a>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-37865566164436150942008-04-21T14:00:00.000-07:002008-04-21T13:54:59.230-07:00New Google GadgetThis is a new Google Gadget I developed for <a href="http://www.thecuriousdreamer.com/">The Curious Dreamer</a>. It is available <a href="http://gmodules.com/ig/creator?synd=open&url=http%3A//hosting.gmodules.com/ig/gadgets/file/114314600778586433990/tcd.xml&pt=%26context%3Dd%26synd%3Dig%26lang%3Den%26.lang%3Den%26country%3Dus%26.country%3Dus%26start%3D0%26num%3D1%26objs%3D&sn=&lang=en">here</a>.
<script src="http://gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/114314600778586433990/tcd.xml&synd=open&w=400&h=100&title=Dream+Dictionary&border=http%3A%2F%2Fgmodules.com%2Fig%2Fimages%2F&output=js"></script>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-2674170811091520102008-04-20T20:43:00.000-07:002008-04-20T21:38:06.796-07:00Healthcare Systems ComparedI love America! I am American through and through. Do I think the US is perfect? No,it is not. It is important to change and adapt as human capabilities increase and with the global marketplace. As a country we have pursued global competition the best available path for the well being of the United States and her citizens.
For all these reasons, we must study the very best systems and product in the world and improve upon the best and adapt it s our own. The US spends over 15 percent of GDP on healthcare, but does not cover every citizen in a systematic and rational fashion. The US is ranked 35th (!) in quality of care and coverage by the World Health Organization. The US is ranked 37th in infant mortality in the world.
Can we improve our healthcare?
<a href="http://www.pbs.org/wgbh/pages/frontline/">Frontline</a> (on PBS), this week has an excellent comparison of five top ranked healthcare systems from around the world in relation to the US. The show, <a href="http://www.pbs.org/wgbh/pages/frontline/sickaroundtheworld/">Sick Around the World</a>, is very well done and interesting. In particular, Switzerland is an interesting case, as it is one of the countries covered that is privately based.
It may be beneficial for us to dispassionately study the world marketplace and to adjust to new realities. Can GM compete with competitors that pay much less for healthcare? It is unfortunate that this is a political hot button, because it may very well be that we could improve overall health in the US at a lower cost.Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-8928643745107579842008-04-20T20:25:00.000-07:002008-04-21T19:43:59.909-07:00SNL on Mahmoud Ahmadinejad<p>Man, this video is <i>funny</i>!</p>
<object height="295" width="510"><param name="movie" value="http://www.hulu.com/embed/j7NtpFEKwTX7birk4jJL8A"><embed src="http://www.hulu.com/embed/j7NtpFEKwTX7birk4jJL8A" type="application/x-shockwave-flash" height="295" width="510"></embed></object>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-74584085626243116922008-04-17T19:25:00.000-07:002008-04-17T19:27:53.456-07:00Screen Capture on a MacIt took me a while to figure out how to capture the screen to an image file using OS/X. As is usual, the answer is simple once you know it: <span style="font-weight: bold;">Capture</span>. Just run Capture using Spotlight (Command-spacebar).Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com1tag:blogger.com,1999:blog-7607059156824390320.post-40806195973768036722008-04-14T16:34:00.000-07:002008-04-14T16:53:44.224-07:00Google GadgetsThis weekend I researched Google Gadgets, while looking for an alternative web widget framework to the one I used for The Curious Dreamer widget I created. I have been educating myself on these semi-autonomous chunks of code that can be dropped in other sites. I want to be able to offer the creation of such things in my freelance developer business.
I looked at the Microsoft version, but it is, as may be naturally expected, sort of tangled up with Windows and Microsoft development tools. At least the expectation is that you will use a Windows development system and do things the Microsoft way. There is nothing wrong with that, but I'm more comfortable in a Unix style environment, using vi as my editor and a combination of shell scripts and commands with Nautilus. Also, some research revealed that Google Gadgets can be repurposed as Microsoft widgets.
I delved into Google Gadgets with the thought that I would try to get a hello gadget working and start to understand the framework. Fortunately, my experience with Prototype was useful in my understanding of how Javascript is used in Google Gadgets. I started late Sunday morning, and my five o'clock I had a working prototype that duplicates the functionality of The Curious Dreamer web widget.
After I complete my current client project this week, I will flesh out the gadget I've created and test it. Google's framework is a pleasure to use and is really well designed and practical. I'm going to be able to finish this gadget and I'm keeping notes on some others that I think people will find to be useful. I want to be able to approach site owners and offer a service to create such work for others.Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-63444634041308878202008-03-29T14:28:00.000-07:002008-04-18T17:40:26.477-07:00New Version of Inkscape!After by last post, I checked to see if the new version of Inkscape was released yet.
It has been! Version 0.46 at <a href="http://www.inkscape.org/">http://www.inkscape.org/</a>. I installed Ubuntu Gutsy and checked some of my annoyances, which are...<span style="font-style: italic;">gone!</span> It is not perfect, but it is much better. It remembers file paths better and the Fill and Stroke dialog is now docked in the main program window. Everything I've tried has been a little bit better. Nice job Inkscape crew!Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-79824252075885619712008-03-29T12:54:00.000-07:002008-12-10T13:05:08.528-08:00New Banner Ad Created with InkscapeI just finished a new banner ad for my wife's dream interpretation site, MyDreamVisions.com.<br /><br />I did the ad using Inkspace under Ubuntu. Open source drawing programs have come a long way. The current version of Inkscape works pretty well. With a little thought, I can create just about any image I can imagine (the limiting factor, in my case). The next version is a major upgrade and is adding a whole bunch of new features. I hope they are going to improve the user interface, which is a bit of a hodgepodge. Things pretty much work, but there are odd bugs and inconsistencies throughout.<br /><br />But, like I said, it works well enough and it is possible to draw what I want to.<br /><br />Here is the banner ad I made:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuYs6wlRdJVQPNTfZQrtOPGfAPWvFkvM6yIr-Iz89AGJRPwfjq31Jcp7OVb4Hp3MlPbVKOySZHmMWac1gGagWlLuUY8GyNnhpR_pJ4XO5zwlIN1ayP7HdgFPJJua9btLEr0qfF-AFRDGnG/s1600-h/dv-500x50-banner.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuYs6wlRdJVQPNTfZQrtOPGfAPWvFkvM6yIr-Iz89AGJRPwfjq31Jcp7OVb4Hp3MlPbVKOySZHmMWac1gGagWlLuUY8GyNnhpR_pJ4XO5zwlIN1ayP7HdgFPJJua9btLEr0qfF-AFRDGnG/s400/dv-500x50-banner.png" alt="" id="BLOGGER_PHOTO_ID_5183257873726770770" border="0" /></a>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0tag:blogger.com,1999:blog-7607059156824390320.post-10404584310243988162008-03-27T17:24:00.000-07:002008-03-28T10:59:23.757-07:00Mac OS/X Bash ShellMost Mac users do not have an interest in the Unix shell (running in Terminal). The Mac was carefully an exhaustively developed so an Apple user would not require it. The question is, could a more advanced user <span style="font-style: italic; font-weight: bold;">enjoy</span> using the shell? I think, yes.
Most things are done very efficiently using the Mac's graphical interface. Searching for files, opening them, copying them...all easy and efficient. Spotlight works <span style="font-style: italic;">great</span>. But, what if you want to do something with every file found in a search? That is an example of when good old Unix shell commands or shell scripts (little programs written to run on the Bash shell) are extremely useful.
<span style="font-weight: bold;">How to Open Terminal</span>
Terminal is the program that the Unix shell runs in. <span style="font-weight: bold;">To open Terminal, use Spotlight</span>. Type command-spacebar (hold down the command key and press the spacebar) and enter "terminal" in Spotlight. Select Terminal from the results list. Note that the command key is the one that says "command" and has a cloverleaf looking icon - it is next to the spacebar.
Or, use Finder and locate Terminal in the directory: <span style="font-weight: bold;">/Applications/Utilities/</span>
<span style="font-weight: bold;">Groundwork </span>
Current Macs use a version of the Bash shell. This is the most common type of Unix shell. Most of what works generally in common versions of Unix, works on the Mac. So, when you want to use Google to find a command, or how to use a command, adding the word "unix" usually helps. <span style="font-style: italic;">If you are going to use less common parameters, make sure to also check out specific OS/X reference pages, because there are differences from one Unix to another.</span>
<span style="font-weight: bold;">Case is important.</span> Filenames, directories...just about everything is case sensitive. Therefore, you could have "photos" and "Photos" in the same directory. "ls" is the list files command. "LS" and "Ls" are not!
<span style="font-weight: bold;">Switches:</span> In Unix, switches are demarcated with a hyphen ("-"). In Windows/DOS a slash character is used ("/"). When more than one switch is selected, they can be strung together after the hyphen. For instance, with the "ls" (list files) command, if you wanted to use both the "-a" (all files, including hidden files) and "-l" (long listing format) switches, the command line would be:
<blockquote style="font-family: courier new; font-weight: bold;">ls -al</blockquote><span style="font-weight: bold;">Globing:</span> Globing is the term for Unix-style "wildcards". These are handled completely differently than they are in Windows/DOS. In Windows, the program being executed is responsible for expanding wildcard characters. In Unix,<span style="font-weight: bold;"> the shell expands</span> the filename specified. The Unix globing characters are:
<blockquote><span style="font-weight: bold;">?</span> Matches any one character in a filename.
<span style="font-weight: bold;">*</span> Matches any character or characters in a filename.
<span style="font-weight: bold;">[ ]</span> Matches a character within the brackets.
<span style="font-weight: bold;">-</span> A hyphen used within [ ] denotes a range of characters.
<span style="font-weight: bold;">~</span> A tilda at the beginning of a filename expands to be the user's home directory.
</blockquote>Note the absence of a "." period character. Unix does not have the equivalent of Windows-style filename extensions.
<span style="font-weight: bold;">A Starter Set of Commands</span>
Here are a few shell commands to start with.
<span style="font-weight: bold;"></span><blockquote><span style="font-weight: bold;">ls</span> List files. This is sort of like DIR in DOS.
<span style="font-weight: bold;">cd</span> Change directory.
<span style="font-weight: bold;">mkdir</span> Make directory.
<span style="font-weight: bold;">rmdir</span> Remove directory.
<span style="font-weight: bold;">cat</span> Concatenate file(s) to standard output. Can be used to display file contents.</blockquote>Jump in and get your feet wet. Next, I'll revisit this topic and expand on it a bit.Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com1tag:blogger.com,1999:blog-7607059156824390320.post-68589096267712373772008-03-27T12:14:00.000-07:002008-03-27T15:10:00.045-07:00Unix Equivalent of DOS COPY CONThis is an answer to a question I got by e-mail.
<blockquote style="font-style: italic;">"A lot of times I need to create a quick text file, like a script (like I used to create Batch files in DOS/Windows). I used to use COPY CON for this. How can I do this in Unix?"</blockquote>This is just as easy in Unix. Instead of COPY CON <span style="font-style: italic;">filename</span>, use <span style="font-weight: bold;">cat ></span><span style="font-style: italic; font-weight: bold;">filename</span>. As before enter the text for the file. Then close the file by hitting enter one more time and entering <span style="font-weight: bold;">control-D</span>.
Remember, if you are creating a shell script, make the file executable with <span style="font-weight: bold;">chmod +x </span><span style="font-style: italic;"><span style="font-weight: bold;">filename</span>.
</span>Also, to execute the script, remember to include the path to the script, even if you are in the same directory as the script, like this <span style="font-weight: bold;">./</span><span style="font-style: italic; font-weight: bold;">scriptname</span>.<span style="font-style: italic;">
</span>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com2tag:blogger.com,1999:blog-7607059156824390320.post-78666364442449761762008-03-27T10:27:00.000-07:002008-12-10T13:05:08.710-08:00Taxpayer Demands Competent Government<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXmxhhcyeVqIXShwCZ724SjWSae9rCkcREfokzFzUXwKj1nheGqUBwyFXp-pMRsx8-F9pPnd_0zz9IuZvJKHIJhesTKx9E3llS-yLZof8zgzKsHSqhT1EI7tuxajI-2OVFTxnS3JnltbBs/s1600-h/AADontTreadOnMe.png"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXmxhhcyeVqIXShwCZ724SjWSae9rCkcREfokzFzUXwKj1nheGqUBwyFXp-pMRsx8-F9pPnd_0zz9IuZvJKHIJhesTKx9E3llS-yLZof8zgzKsHSqhT1EI7tuxajI-2OVFTxnS3JnltbBs/s320/AADontTreadOnMe.png" alt="" id="BLOGGER_PHOTO_ID_5182474888303808034" border="0" /></a>It does not seem as though voting for one party or the other affects the basic competency of our government.<br /><br />Is it too much to ask for? No it is not.<br /><span style="font-style: italic;"></span><blockquote><span style="font-style: italic;">It is our duty to the next generation to leave a better world than the one we were born into.</span><br /><span style="font-style: italic;">The science of government it is my duty to study, more than all other sciences; the arts of legislation and administration and negotiation ought to take the place of, indeed exclude, in a manner, all other arts. I must study politics and war, that our sons may have liberty to study mathematics and philosophy. Our sons ought to study mathematics and philosophy, geography, natural history and naval architecture, navigation, commerce and agriculture in order to give their children a right to study painting, poetry, music, architecture, statuary, tapestry and porcelain. - <span style="font-weight: bold;">John Adams</span><br /></span></blockquote>I wish that it was not necessary to concern myself with government. I just want to live my life, love my wife, write what I like, play music, write some code and make things. But, my morning paper sickens me with my government meddling endlessly in my life, my rights, my peace of mind and doing things in my name, with my money, that are stupid and counter to American interests.<br /><br />The Adams quote I heard while watching the current HBO series. Embedded therein is the distaste for needing to understand and improve government, out of duty to his country and his children. Just a hard working and intelligent man, doing what he can in the face of loss of liberty and freedom.Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com1tag:blogger.com,1999:blog-7607059156824390320.post-9602764749540915622008-03-25T19:04:00.000-07:002009-01-17T11:48:45.972-08:00Something like XCOPY on the Mac?This is an answer to a question about <span style="font-weight: bold;">how to recursively copy newer files from one directory to another</span> with a Mac. By "recursively" I mean including sub directories. ...Oh, and this is using the Unix shell in Terminal. (Remember, the easy way to get to Terminal is Command-Spacebar to open Spotlight and then type <span style="font-weight: bold;">Terminal</span> and open it.
<code>
xcopy C:/source X:/destination /e/s/d/y
</code>
In Windows, the above command does this and does not prompt when overwriting files.
My first thought was "cp -fuRp * /destination" but there is no -u parameter in OS/X! Egad.
So, then I thought of "rsync" and that seems to do the job:
<code>
rsync -aruv * /destination
</code>
This example assumes the directory you are copying from is the working directory.
<blockquote><span style="font-weight: bold;">-a</span> Archive mode - retains file settings including dates
<span style="font-weight: bold;">-r</span> Recursive - subdirectories
<span style="font-weight: bold;">-u</span> Update - only copy newer files
<span style="font-weight: bold;">-v</span> Verbose</blockquote>Remember! Don't use "*.*" in unix. There are no Windows-style file name extensions.
Yes, it is different from Windows. Yes, it has to be learned to be used. Keep in mind that you had to expend effort to learn DOS/Windows commands and that Unix isn't going away - what you learn will continue to be useful are a long time.
<span style="font-weight: bold; font-style: italic;">One more thought:</span><span style="font-style: italic;"> Pop music is enjoyable right away, but grows tiresome quickly. Classical music can take effort to learn to enjoy, but grows more enjoyable in time. So it is with shell commands - they take effort to learn and enjoy, but continue to pay dividends forever.</span>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com1tag:blogger.com,1999:blog-7607059156824390320.post-8022023317359949362008-03-24T11:12:00.000-07:002008-03-27T20:38:45.953-07:00Mass File Renaming in Unix or LinuxHere's a quick script that you can use to rename a bunch of files. It will rename all of the files in the working directory that have certain text to something else that you specify. For example, when you have a group of photos from a digital camera with sequentially numbered files like "IMG1.JPG, IMG2.JPG, IMG3.JPG...etc." that your would like to be called "2008-feb-baseball-1.jpg, 2008-feb-baseball-2.jpg, 2008-feb-baseball-3.jpg...etc.".
<span style="font-size:130%;"><span style="font-family:verdana;">The Code</span></span>
Create a text file called <span style="font-weight: bold;">massren</span> with this as the content:
<blockquote style="font-family: courier new;">#!/bin/sh
for filename in *$1*
do
mv -fT "$filename" `echo $filename | sed -e "s/$1/$2/"`
done</blockquote>Then, make the file executable with:
<blockquote>chmod +x massren</blockquote><span style=";font-family:verdana;font-size:130%;" >Usage</span>
<blockquote><span style="font-weight: bold;"></span><span style="font-family:courier new;">masren </span><span style="font-style: italic;font-family:courier new;" >textfrom</span><span style="font-family:courier new;"> </span><span style="font-style: italic;font-family:courier new;" >textto</span>
<span style="font-weight: bold;">Where: </span><span style="font-style: italic;">textfrom</span> is the text to replace in each file name.
<span style="font-style: italic;">textto</span> is the new replacement text.</blockquote><span style=";font-family:verdana;font-size:130%;" >Example
</span>For example, to rename the files cited in the first paragraph:
<blockquote style="font-family: courier new;">./massren IMG 2008-feb-baseball-
./massren JPG jpeg
</blockquote>The first command replaces "IMG" in every file name to "2008-feb-baseball-". The second command replaces "JPG" in every file name to "jpeg". The reason I put "./" at the beginning pf each line is that on my system the working directory is not in the path. So, this addresses the script "massren" in the working directory explicitly...pretty normal in unix shells.
<span style=";font-family:verdana;font-size:130%;" >Examining the Code</span>
<blockquote><span style="color: rgb(255, 102, 102);">#!/bin/sh</span>
<span style="color: rgb(51, 204, 0);">for filename in *$1*</span>
<span style="color: rgb(51, 51, 255);">do</span>
<span style="color: rgb(102, 51, 51);"> mv -fT "$filename" `echo $filename | sed -e "s/$1/$2/"`</span>
<span style="color: rgb(51, 51, 255);">done</span></blockquote><span style="color: rgb(255, 102, 102);">This tells your unix shell where to file the program that executes this script. in this case, it is a Bach shell script and the program on my system is called "sh" and is in the "/bin/" directory. This line, in unix jargon is called the shebang line.</span>
<span style="color: rgb(51, 204, 0);">This creates a variable called "filename" in a loop (from "do" to "done on the following lines) for each file in the working directory (the current directly) for each file that has the "textfrom" text that you specified. The "$1" in "*$1*" is a variable that contains the first parameter (like "IMG" in the example). The asterisks surrounding it mean that any file with this text somewhere in the file name will be selected.</span>
<span style="color: rgb(51, 51, 255);">The "do" and "done" lines contain the loop. The code between them will be executed for every file matched on the <span style="color: rgb(0, 153, 0);">green</span> line.
<span style="color: rgb(102, 51, 0);">This line renames each file. In unix, "mv", the Move command is also used to rename files. The -fT parameters tell mv to go ahead and rename the file and that the file is being renamed and not being moved to another directory. You can see that we are using the <span style="font-weight: bold;">$filename</span> variable that was created on the <span style="color: rgb(0, 153, 0);">green</span> line - remember that this is a loop and will be run for every file that meets our criteria. <span style="font-weight: bold;">"$filename"</span> is enclosed in quotes in case the files being renamed has spaces in the name (in which case, the fromtext parameter would need to be quoted also.
The next part is where the new file name is created using the "sed" command. Note that it is enclosed in "`" characters, called back ticks in unix jargon. Everything enclosed in back ticks is executed and the results of that execution is substituted in the brown command line. So, the current file name (in the <span style="font-weight: bold;">$filename</span> variable) is echoed through the sed command. "echo" gets the file name, the "|" (called a pipe in unix jargon) takes that text (the file name) and pipes it into the sed command.
The sed command being used substitutes all of the <span style="font-style: italic;">fromtext</span> (in the <span style="font-weight: bold;">$1</span> variable) with the <span style="font-style: italic;">totext</span> (in the <span style="font-weight: bold;">$2</span> variable). Check out a reference for sed for details. You will see that the "s//" command does a simple substitution of one instance of text with another.
</span></span>
<span style="font-size:130%;"><span style="font-family:verdana;">Make your Own Command</span></span>
Take what you learn here and create your own mass file renaming script! Replace "*$1*" with a globing specification that selects the files you want to process.
Replace the sed command I used here with, for example a tr command. You could use tr to rename file from UPPERCASE to lowercase: <span style="font-weight: bold;">tr '[A-Z]' '[a-z]'</span>
You can easily debug your new script by inserting echo at the beginning of the <span style="color: rgb(102, 51, 51);">brown</span> line to just show the mv command line being created for each file instead of executing it. For example, for the new rename to lower case:
<blockquote style="font-family: courier new;">#!/bin/sh
for filename in *
do
echo mv -fT "$filename" `echo $filename | tr '[A-Z]' '[a-z]<span style="font-weight: bold;">'</span>`
done</blockquote>Note that the selection criteria went from "*$1*" (select files that contain specified text) to "*" (all files in the working directory).
<span style=";font-family:verdana;font-size:130%;" >Production Version</span>
<blockquote><pre>#!/bin/sh
#
# massren: Mass file rename utility
#
if [ $# -eq 2 ]
then
for filename in *$1*
do
mv -fT "$filename" `echo $filename | sed -e "s/$1/$2/"`
done
exit 0
else
echo "\nUsage:"
echo "masren textfrom textto"
echo "\nWhere:"
echo "textfrom is the text to replace in each file name."
echo "textto is the new replacement text.\n"
exit 1
fi</pre></blockquote>Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com1tag:blogger.com,1999:blog-7607059156824390320.post-80396254172058580842008-03-16T18:04:00.000-07:002008-03-16T18:08:17.194-07:00My Dream Visions UpdatedI just finished converting <a href="http://www.mydreamvisions.com/">My Dream Visions</a> to a database-driven, CSS-formatted website.
Part of the update is a streamlined <a href="http://www.mydreamvisions.com/order/">order processing system</a> for the site.Andrew Aulthttp://www.blogger.com/profile/14843701360883476253noreply@blogger.com0