<?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>edsalisbury.net &#187; Linux</title>
	<atom:link href="http://edsalisbury.net/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://edsalisbury.net</link>
	<description>your guide to user-friendly entertainment</description>
	<lastBuildDate>Thu, 01 Dec 2011 22:08:17 +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>Cool Tools: VIM</title>
		<link>http://edsalisbury.net/cool-tools-vim/</link>
		<comments>http://edsalisbury.net/cool-tools-vim/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 02:23:50 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=292</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/cool-tools-vim/" title="Cool Tools: VIM"></a>One thing that I cannot live without is a text editor, namely VIM.  VIM was first released as free and extended version of the VI program found on all Unix machines.  I first cut my teeth on VI when I &#8230;<p class="read-more"><a href="http://edsalisbury.net/cool-tools-vim/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/cool-tools-vim/" title="Cool Tools: VIM"></a><p><a href="http://vim.org"><img class="alignright size-thumbnail wp-image-583" title="VIM" src="http://edsalisbury.net/wp-content/uploads/2011/11/vim-editor_logo-150x150.png" alt="" width="150" height="150" /></a>One thing that I cannot live without is a text editor, namely VIM.  VIM was first released as free and extended version of the VI program found on all Unix machines.  I first cut my teeth on VI when I started my sysadmin career, and switched to VIM a couple of years later.  VIM by default works mostly like VI, but i&#8217;ts highly configurable, and has a lot of power, especially when you start working with your .vimrc.  Since starting with the editor, I&#8217;ve carried my .vimrc from machine to machine, and company to company.  I&#8217;m continually updating it, and while there&#8217;s not a ton of stuff here, I thought I&#8217;d share it in case someone gets some value:</p>
<pre>" Ed Salisbury's .vimrc
" Last Modified: 11/17/11

" Make VIM act like VIM, not VI
set nocompatible

" Set up TABs
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set autoindent
set smartindent

" Set up syntax highlighting
syntax on
filetype plugin on
filetype indent on
set formatoptions=qroc
set cindent

" Misc settings
set number       " Print line numbers
set background=dark
set pastetoggle=&lt;F2&gt;</pre>
<p>I&#8217;d consider these settings a starting point for doing code/web development. Of course, there are tons of more complicated .vimrc files out there, but this should be good for starters. If you&#8217;re interested as to what each of these settings do, you can type :helpin VIM and it will display the help file.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/cool-tools-vim/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Set Up Virtual Web Hosting with Apache</title>
		<link>http://edsalisbury.net/how-to-set-up-virtual-web-hosting-with-apache/</link>
		<comments>http://edsalisbury.net/how-to-set-up-virtual-web-hosting-with-apache/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 15:58:50 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=419</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/how-to-set-up-virtual-web-hosting-with-apache/" title="How to Set Up Virtual Web Hosting with Apache"></a>Up until a couple of years ago, I used shared web hosting for serving up my various sites. I went through several of them because for whatever reason, they turned out to not be what I wanted. I finally came &#8230;<p class="read-more"><a href="http://edsalisbury.net/how-to-set-up-virtual-web-hosting-with-apache/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/how-to-set-up-virtual-web-hosting-with-apache/" title="How to Set Up Virtual Web Hosting with Apache"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2009/08/apache_logo.png" alt="Apache" title="Apache" width="150" height="149" class="alignright size-full wp-image-430" /><br />
Up until a couple of years ago, I used shared web hosting for serving up my various sites.  I went through several of them because for whatever reason, they turned out to not be what I wanted.  I finally came to the realization that I needed to get my own dedicated host.  I found a good provider (<a href="http://www.shareasale.com/r.cfm?B=106084&#038;U=369672&#038;M=15362">The Planet</a>), and started migrating over my websites (along with my friend Chris&#8217; sites).  Something I knew I would have to learn is how to set up Apache to be able to do virtual hosting.  In this guide, I&#8217;ll show you how I did it, and the script I created to make things easier.<br />
<span id="more-419"></span><br />
The first thing to do is to set up a logical directory structure &#8212; I hate putting web docs in some silly folder like /usr/local/apache2/htdocs &#8212; that&#8217;s always seemed like such a weird place to put things (I guess it goes against my feelings that anything in /usr shouldn&#8217;t be writable by users)   Since this is a webserver, I wanted something closer to the root, like /www/&lt;domain&gt;.  I also wanted to have a different directory structure and logging for each virtual host, I chose /www/logs/&lt;domain&gt;.</p>
<p>The next thing is to set up the apache config file to be able to include a separate file just for vhosts.  Add this section somewhere in your httpd.conf file:</p>
<pre>
# Virtual Hosts
NameVirtualHost *
Include etc/httpd-vhosts.conf
</pre>
<p>Now, create httpd-vhosts.conf in the apache config dir, and create a manual entry to make sure it works:</p>
<pre>
<VirtualHost *>
    ServerName      www.mydomain.com
    ServerAdmin     webmaster@mydomain.com
    ServerAlias     mydomain.com
    DocumentRoot    /www/mydomain.com/docs
    DirectoryIndex  index.html index.php
    AccessFileName  .htaccess
    HostnameLookups Off
    ErrorLog        /www/logs/mydomain.com/error.log
    LogLevel        warn
    CustomLog       /www/logs/mydomain.com/access.log combined
</VirtualHost>
</pre>
<p>(Be sure to change &#8220;mydomain.com&#8221; to your domain)</p>
<p>Create /www/&lt;domain.com&gt; and log files, as well as change ownerships properly:</p>
<pre>
# mkdir /www/logs/&lt;domain.com&gt;
# mkdir /www/&lt;domain.com&gt;
# chmod g+w /www/&lt;domain.com&gt;
# chown nobody:nobody /www/&lt;domain.com&gt;
# chown nobody:nobody /www/logs/&lt;domain.com&gt;
</pre>
<p>Next, create some sort of test file (like index.html) in the new doc directory.</p>
<p>When you&#8217;re ready, restart the webserver (usually just by running apachectl graceful)  With any luck, you should be seeing the webpage you created when you go do www.&lt;domain.com&gt;.  If not, look at the apache config for errors, and verify that the DNS entries are correct.</p>
<p>Now, as you were expecting, I have a script to be able to automate this.  It&#8217;s pretty simple, but handy.  I call it &#8220;add_vhost&#8221; and I put it into /usr/local/bin:</p>
<pre class="brush:perl; gutter: false; wrap-lines: true; ruler: false">
#!/usr/bin/perl -w
# AddVhost
# Add Virtual Host Configs for Apache
# by Ed Salisbury (ed@edsalisbury.net)
# http://www.edsalisbury.net
# (c)2009 Ed Salisbury, Some Rights Reserved
#
# License:
# Except where otherwise noted, this work is licensed under Creative Commons
#   Attribution ShareAlike 3.0.
#
# You are free:
#   * to Share -- to copy, distribute and transmit the work
#   * to Remix -- to adapt the work
#
# Under the following conditions:
#   * Attribution. You must attribute the work in the manner specified by the
#     author or licensor (but not in any way that suggests that they endorse
#     you or your use of the work).
#   * Share Alike. If you alter, transform, or build upon this work, you may
#     distribute the resulting work only under the same, similar or a
#     compatible license.
#   * For any reuse or distribution, you must make clear to others the license
#     terms of this work. The best way to do this is with a link to the
#     license's web page (http://creativecommons.org/licenses/by-sa/3.0/)
#   * Any of the above conditions can be waived if you get permission from the
#     copyright holder.
#   * Nothing in this license impairs or restricts the author's moral rights.

use strict;

my $DOCROOT = '/www';
my $LOGDIR = '/www/logs';
my $USER = 'nobody';
my $GROUP = 'nobody';
my $VHOST_CFG = &quot;/usr/local/apache2/etc/httpd-vhosts.conf&quot;;

my $domain = $ARGV[0];

if (!$domain)
{
    print &quot;Error: No domain specified!n&quot;;
    exit(1);
}
open (OUT, &quot;&gt;&gt; $VHOST_CFG&quot;);
print OUT &quot;n&quot;;
print OUT &quot;&lt;VirtualHost *&gt;n&quot;;
print OUT &quot;tServerName      www.$domainn&quot;;
print OUT &quot;tServerAdmin     webmaster@$domainn&quot;;
print OUT &quot;tServerAlias     $domainn&quot;;
print OUT &quot;tDocumentRoot    $DOCROOT/$domainn&quot;;
print OUT &quot;tDirectoryIndex  index.html index.phpn&quot;;
print OUT &quot;tAccessFileName  .htaccessn&quot;;
print OUT &quot;tHostnameLookups Offn&quot;;
print OUT &quot;tErrorLog        $LOGDIR/$domain/error.logn&quot;;
print OUT &quot;tLogLevel        warnn&quot;;
print OUT &quot;tCustomLog       $LOGDIR/$domain/access.log combinedn&quot;;
print OUT &quot;&lt;/VirtualHost&gt;n&quot;;
close (OUT);

system(&quot;mkdir $LOGDIR/$domain&quot;);
system(&quot;mkdir $DOCROOT/$domain&quot;);
system(&quot;chmod g+w $DOCROOT/$domain&quot;);
system(&quot;chown $USER:$GROUP $DOCROOT/$domain&quot;);
system(&quot;chown $USER:$GROUP $LOGDIR/$domain&quot;);
</pre>
<p>Be sure to change the config variables to suit your environment.  When you want to add a virtual host, simply run:</p>
<pre>
% sudo add_vhost domain.com
</pre>
<p>It will create the config and set everything up for you.  All you need to do then is to restart the webserver, and you&#8217;re good to go!</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/how-to-set-up-virtual-web-hosting-with-apache/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Linux RetroGaming: Atari 8-Bit</title>
		<link>http://edsalisbury.net/linux-retrogaming-atari-8-bit/</link>
		<comments>http://edsalisbury.net/linux-retrogaming-atari-8-bit/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 20:19:56 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Atari]]></category>
		<category><![CDATA[atari800]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Wico]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=363</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/linux-retrogaming-atari-8-bit/" title="Linux RetroGaming: Atari 8-Bit"></a>I&#8217;ve been into emulation again lately, and I started with my first favorite system of all time, the Atari 8-bit computer. When I was growing up, I had 2 different 8-bit machines: The Atari 400: and later the Atari 130XE: &#8230;<p class="read-more"><a href="http://edsalisbury.net/linux-retrogaming-atari-8-bit/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/linux-retrogaming-atari-8-bit/" title="Linux RetroGaming: Atari 8-Bit"></a><p>I&#8217;ve been into emulation again lately, and I started with my first favorite system of all time, the Atari 8-bit computer.  When I was growing up, I had 2 different 8-bit machines:</p>
<p>The <strong>Atari 400:</strong><br />
<img src="http://www.edsalisbury.net/wp-content/uploads/2009/07/atari400open-300x201.jpg" alt="Atari 400" title="Atari 400" width="300" height="201" class="alignnone size-medium wp-image-364" /></p>
<p><span id="more-363"></span><br />
and later the <strong>Atari 130XE:</strong><br />
<img src="http://www.edsalisbury.net/wp-content/uploads/2009/07/Atari_130xe-300x196.jpg" alt="Atari 130 XE" title="Atari 130 XE" width="300" height="196" class="alignnone size-medium wp-image-365" /></p>
<p>I did a lot of things on these machines, including learn BASIC, type in programs from magazines, and of course&#8230; play games!   In order to play these games, I had a great joystick &#8211;</p>
<p>the <strong>Wico Command Control</strong> joystick:<br />
<a href="http://www.flickr.com/photos/fredf78/3681756098/"><img src="http://www.edsalisbury.net/wp-content/uploads/2009/08/www_flickr_com_photos_fredf78_3681756098-300x199.jpg" alt="Wico Command Control" title="Wico Command Control" width="300" height="199" class="alignnone size-medium wp-image-395" /></a></p>
<p>My goal is to have as close as an experience as possible to the real thing with modern hardware, through emulation.  To purists, this is considered sacrilege &#8212; they want the physical hardware, and emulation for them just doesn&#8217;t cut it.   I guess I&#8217;m not a purist &#8212; I just like being able to play the old games!  Since I&#8217;m now running Linux, the goal will be to get a working emulator going and everything working properly.  Here&#8217;s what I mean by a proper emulator setup:</p>
<ul>
<li>Emulator should run in fullscreen mode, with no window elements showing</li>
<li>2 joysticks should work</li>
<li>Everything should be able to be specified via the command line</li>
<li>It should handle multiple disk programs as painless as possible</li>
<li>It should have a standard method for exiting the emulator</li>
</ul>
<p>The emulator I&#8217;ll be using for the Atari 8-Bit computers is <a href="http://atari800.sourceforge.net">atari800</a>.  In my opinion, it is the best emulator for the 8-bits, and will work for us just fine, with a few modifications.  As a part of this project, I am also going to use the original joysticks that were used for the system.  </p>
<h5>Controllers:</h5>
<p>For this project, I&#8217;m using the Wico Command Control joystick (see photo above).  I used to use the Logitech gamepads that look like PS2 controllers, but after switching to the right controller, there&#8217;s no going back!  The issue is, I need a way to convert them to USB to be able to use them on modern machines.  After doing some searching, I found just the adapter, from a company called <a href="http://www.retrousb.com">RetroZone</a>.  I bought the joystick and adapter off of eBay, and I couldn&#8217;t wait to plug it in and try it out!  It seemed to work, but I noticed something odd &#8211; the fire button was being pressed every time I moved the joystick.  I thought that it might be a linux thing, so I plugged it into my Windows laptop, and sure enough, it presses a different button every time I move the joystick.  This wouldn&#8217;t be a problem normally, if the emulator I&#8217;m using didn&#8217;t allow you to use any button as the fire button.  I have a fix for this issue though, which I&#8217;ll get to later.</p>
<h5>Installation:</h5>
<p>To install the standard version of the emulator (atari800), simply run the following (in Ubuntu):</p>
<pre>
% sudo apt-get install atari800
</pre>
<p>Then before you can actually run it, you&#8217;ll need a couple of things:</p>
<ul>
<li>ROM files</li>
<li>Disk / Cartridge Images</li>
</ul>
<p>The ROM files are dumps from the actual ROM chips found in the original hardware.  There&#8217;s a few of them out there on the internet, and one place I&#8217;ve found that has them is <a href="http://www.theoldcomputer.com/Libarary%27s/Emulation/atari_8bit/roms/os/atari_8bit_roms_os.htm">TheOldComputer.com</a>.  All you really need are the following ROMs:</p>
<ul>
<li>Atari Rev B (400/800) NTSC</li>
<li>Atari XL or XE NTSC</li>
</ul>
<p>You&#8217;ll also need disk images or cartridge images.  One cool site that I use frequently is called <a href="http://www.atarimania.com">AtariMania.com</a>.  They have images and also artwork scans from the boxes/disks/manuals etc.</p>
<p>Now would be a good time to talk about how you&#8217;re planning on organizing your emulator directories.  I personally use the following directory structure, but you&#8217;re welcome to use whatever you like:</p>
<pre>
/data/Software/Retro/Atari 8-Bit/roms
/data/Software/Retro/Atari 8-Bit/disks
/data/Software/Retro/Atari 8-Bit/carts
/data/Software/Retro/Atari 8-Bit/art_front
/data/Software/Retro/Atari 8-Bit/art_back
/data/Software/Retro/Atari 8-Bit/snap
/data/Software/Retro/Atari 8-Bit/titles
</pre>
<p>The last 4 directories are useful when running the emulator from a front-end, which I highly recommend.  I&#8217;ll talk more about front-ends in a future blog posting.</p>
<p>To run the emulator, simply run the following:</p>
<pre>% atari800</pre>
<p>This will probably give you an error saying that it can&#8217;t find the ROM files.  You will need to set up the configuration so that it can find your ROMs.  To do this from within the emulator, hit F1, and go to &#8220;Emulator Configuration&#8221;.  From there you can select the different ROMs and configure things how you like.  To exit the emulator, press F9.</p>
<p>After it can find your roms, you&#8217;ll need to load a disk image.  To do this from the command line, simply run:</p>
<pre>
% atari800 &lt;name of the disk image&gt;
</pre>
<p>(If there are spaces in the diskname, be sure to either put double quotes around the filename or use backslashes in front of the spaces or other special characters)</p>
<p>A couple of keys to get you started:</p>
<ul>
<li>F1 &#8211; Configuration Mode</li>
<li>F2 &#8211; Option</li>
<li>F3 &#8211; Select</li>
<li>F4 &#8211; Start</li>
<li>F5 &#8211; Reset</li>
<li>F9 &#8211; Quit the Emulator</li>
</ul>
<p>With any luck, you&#8217;re now able to play some games!   A couple of issues you might be having:  It&#8217;s windowed and small, and you want it to be fullscreen and big!  It took a little bit of effort to get this going for me, but here&#8217;s how I achieved this.  If you are running with more than one monitor, please see my <a href="http://www.edsalisbury.net/linux/gaming-in-linux/">guide</a> on how to set up MetaModes to fix fullscreen issues.</p>
<p>First off, you will want to turn on NTSC mode.  To do this, either do it in the emulator itself (hit F1, etc.) or by editing the config file.  If you&#8217;re editing the config file, just set this line in ~/.atari800.cfg:</p>
<pre>
DEFAULT_TV_MODE=NTSC
</pre>
<p>If you&#8217;re like me, you want your gaming to be in fullscreen mode, not a window.  One way of doing this is to create an alias that sets the resolution:</p>
<pre>
alias atari800='atari800 -width 1280 -height 1024'
</pre>
<p>Add this line to your .bashrc, and you&#8217;ll be in fullscreen gaming heaven!  (Be sure to change the height and width as necessary for your monitor)</p>
<h5>Customization:</h5>
<p>At first, I just used the standard distribution version of atari800 &#8211; this worked well, but I had a couple of issues.  First, the emulator treats every joystick button as the fire button.  This was an issue with the joystick adapter I&#8217;m using, which sends a different button press for each direction (by design).  Another issue I had was the fact that there needed to be an easy way to swap disks in a multi-disk set &#8212; I would like to be able to hit a function key for this.</p>
<p>I figured the easiest way to get these things fixed would be to compile from source.  I started by downloading the source from <a href="http://sourceforge.net/scm/?type=cvs&#038;group_id=40606">CVS</a>, and started working on compiling.  (For my examples, I used version  2.1.0. To compile it, you&#8217;ll also need to get the <a href="http://www.libsdl.org/">SDL</a> development libraries, which can easily by installed via Synaptic Package Manager (search for SDL). There&#8217;s lots of guides on compiling from source out there, but the simple method is:</p>
<pre>
cd &lt;source dir&gt;
./configure
make
</pre>
<p>Before I do any source code hacking, I always make sure that the source compiles first, that way I know it works before I start breaking stuff!  Another thing to do is to always keep a backup copy of the source file you are editing.  You want to be able to back out of any changes you make.  On that note, let the hacking begin!</p>
<p>To fix the trigger issue, edit atari_sdl.c:<br />
In the get_platform_TRIG() function, change the following lines:</p>
<pre>int trig0, trig1, i;</pre>
<p>to:</p>
<pre>int trig0, trig1;</pre>
<p>and:</p>
<pre>
for (i = 0; i < joystick0_nbuttons; i++) {
    if (SDL_JoystickGetButton(joystick0, i)) {
        trig0 = 0;
        break;
    }
}
</pre>
<p>to simply:</p>
<pre>
if (SDL_JoystickGetButton(joystick0, 0))
    trig0 = 0;
</pre>
<p>And do the same for joystick1 -- convert:</p>
<pre>
for (i = 0; i < joystick1_nbuttons; i++) {
    if (SDL_JoystickGetButton(joystick1, i)) {
        trig1 = 0;
        break;
    }
}
</pre>
<p>to:</p>
<pre>
if (SDL_JoystickGetButton(joystick1, 0))
    trig1 = 0;
</pre>
<p>To map the Rotate Disk function to F11, edit atari_sdl.c:</p>
<p>Add the following into the #include section:</p>
<pre>#include "sio.h"</pre>
<p>Then do a search for "F10", and add the following after the SDLK_F10 case:</p>
<pre>
case SDLK_F11:
    key_pressed = 0;
    SIO_RotateDisks();
    return AKEY_NONE;
</pre>
<p>After making either or both of these changes, run make again, and test.  There's still one more change I'd like to make, but it will have to be at another time.  I like to have the Escape key exit from all of my emulators.  The idea is, any one should be able to run these, and having to remember which function key does what is a pain.  I'll be sure to update this post when I make my change so that you can see how I did it.</p>
<h5>Conclusion:</h5>
<p>Hopefully this guide has been helpful to people interested in RetroGaming on Linux.  Please feel free to share your experiences or issues -- I'm always interested to hear other people's thoughts and ideas.  Have a system you'd like me to cover?  Let me know and I'll do my best to accommodate you.  I enjoy working with all gaming and computer platforms, albeit some of them are not quite as easy to set up.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/linux-retrogaming-atari-8-bit/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Gaming in Linux</title>
		<link>http://edsalisbury.net/gaming-in-linux/</link>
		<comments>http://edsalisbury.net/gaming-in-linux/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 00:23:14 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[wine]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=383</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/gaming-in-linux/" title="Gaming in Linux"></a>One of the reasons people have a hard time making the jump to Linux is the fact that they have a hard time leaving the games they play in Windows. In this article, I&#8217;m going to describe some methods of &#8230;<p class="read-more"><a href="http://edsalisbury.net/gaming-in-linux/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/gaming-in-linux/" title="Gaming in Linux"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2009/08/retromenu-150x150.png" alt="Gaming" title="Gaming" width="150" height="150" class="alignleft size-thumbnail wp-image-384" />One of the reasons people have a hard time making the jump to Linux is the fact that they have a hard time leaving the games they play in Windows.  In this article, I&#8217;m going to describe some methods of getting around this hurdle, and make the transition to Linux easier.  I&#8217;m not going to promise that your favorite game will work, but will give you the tools to be able to try.  I&#8217;m also not going to be talking about native linux apps &#8211; those are pretty straightforward.  This article will focus on Windows apps in Linux.<br />
<span id="more-383"></span><br />
The first tool in the linux gamer&#8217;s arsenal is a utility called WINE.  WINE stands for &#8220;Wine Is Not an Emulator&#8221;, in true unix style recursive acronyms.  It&#8217;s job is to make your system look like Windows to your Win apps, giving users the ability to run programs, and for our purposes, games.  The first step to running a windows program in linux is to install WINE (use apt-get / yum to install from the standard repositories), and then simply run &#8216;wine &lt;name of the program.exe&gt;&#8217; &#8211; there&#8217;s a good chance that it will just run.  I have noticed that for some reason game installers tend to be a little temperamental, so one way to get around this is to install on a Windows box and then copy the files to your unix machine over the network.</p>
<p>Another tool is called <a href="http://www.codeweavers.com/products/cxgames/">CrossOver Games</a>, which is a commercially-supported version of WINE.  If you don&#8217;t feel like messing with config files, this may be your best bet.  I haven&#8217;t needed anything but the basic WINE installation, but I&#8217;ve heard good things about this product.</p>
<p>The games that I like are traditionally MMORPGs and emulated games.  I&#8217;ve gotten both Star Wars Galaxies and World of Warcraft running, and Atari800, Stella, and MAME running so far.  Also, I&#8217;ve gotten Spore to run.  I really haven&#8217;t found the need to run much else in the gaming dept, so I&#8217;m set!  The main issues that I&#8217;ve found with running games in linux are:</p>
<ul>
<li>Dual-Screen Issues</li>
<li>Screen Resolution</li>
<li>Keyboard Repeat Issues</li>
</ul>
<h5>Dual-Screen Issues</h5>
<p>First off, I like to do gaming in full screen.  I hate window elements on my game screen.  The issue is when you have a dual monitor set up.  The issue is, Xwindows handles resolutions differently than windows (one big screen vs. 2 smaller screens).  This can be an issue since games will try to use the entire surface, and probably centering the content, making it completely unplayable (half on one screen, half on the other).  In doing some searching, I found a solution to this problem &#8212; it&#8217;s called MetaModes.  Note: I&#8217;m using an Nvidia chipset &#8211; not sure what to do if you&#8217;re using ATI.  To enable MetaModes with TwinView, do the following:</p>
<pre>
# sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
# sudo vi /etc/X11/xorg.conf
</pre>
<p>Add the following line in the &#8220;Screen&#8221; Section:</p>
<pre>
Option "metamodes" "1280x1024,1280x1024; 1280x1024,NULL"
</pre>
<p>(This assumes you have 1280&#215;1024 monitors &#8212; change as needed)</p>
<p>Restart your X server &#8212; I usually close all my apps, hit CTRL-ALT-F1, log in, and run:</p>
<pre>
# sudo /etc/init.d/gdm restart
</pre>
<p>This shouldn&#8217;t change anything with your normal desktop, but if you run a fullscreen app, it should only use the first monitor, and turn off the second.  When the app is done, it will go back to the normal 2-screen layout. This setup works pretty well for me.</p>
<h5>Screen Resolutions</h5>
<p>One of the things you&#8217;ll find is that configuration apps written for windows won&#8217;t detect available resolutions correctly when running in Linux.  Since most people run with LCDs lately (which look crap if you don&#8217;t run in the correct resolution), this can be a pain.  Don&#8217;t expect the application to be able to find your ideal resolution.  What I usually do is run the program and let it do it&#8217;s thing with the default res.  Then I quit the program and look for a config file.  Most games have a config file somewhere that states what resolution to run in.  Edit the file manually and re-run the game.  This should fix things so that it runs the way you want.</p>
<h5>Keyboard Repeat Issues</h5>
<p>Lately I&#8217;ve noticed an odd issue with keyboard repeating.  It seems that there is an issue with the latest Xorg version and wine not playing nicely with keyboard repeats.  If you do run into something like this, try disabling keyboard repeating from System->Preferences->Keyboard (in Ubuntu).</p>
<p>One really nice thing about gaming on Linux is the fact that you can keep your software on an NFS mounted filesystem.  If you&#8217;re sharing an installation of WoW, for instance, only one person has to update it, and then it&#8217;s updated for everyone.  It can take a little longer to load from the network, but I haven&#8217;t noticed many issues here.  Another good thing here is the registry.  While I usually try to stay away from games that use the registry, having it in linux is helpful because it&#8217;s not tied to one machine.  You can put it on a remote drive, and it encapsulates the registry so that it could then run on other machines, making it a lot more portable.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/gaming-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Convert DVDs and TiVo MPEG2 Videos to H.264</title>
		<link>http://edsalisbury.net/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/</link>
		<comments>http://edsalisbury.net/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 02:31:52 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[mpeg2]]></category>
		<category><![CDATA[TiVo]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=353</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/" title="How to Convert DVDs and TiVo MPEG2 Videos to H.264"></a>Previously, I have showed you how to set up software to be able to rip DVDs to your hard drive, and I&#8217;ve also shown you how to copy your TiVo videos nightly. I&#8217;ve described the method I use to transcode &#8230;<p class="read-more"><a href="http://edsalisbury.net/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/" title="How to Convert DVDs and TiVo MPEG2 Videos to H.264"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2009/07/Sony-H_264-compress-250-150x150.jpg" alt="H.264" title="H.264" width="150" height="150" class="alignright size-thumbnail wp-image-357" /><br />
Previously, I have showed you how to set up software to be able to <a href="http://www.edsalisbury.net/linux/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/">rip DVDs</a> to your hard drive, and I&#8217;ve also shown you how to <a href="http://www.edsalisbury.net/linux/how-to-copy-videos-from-a-series-3-tivo-to-ubuntu-linux/">copy your TiVo videos</a> nightly.  I&#8217;ve described the method I use to <a href="http://www.edsalisbury.net/linux/how-to-convert-tivo-mpeg2-videos-to-h264/">transcode</a> the videos, but haven&#8217;t provided the script&#8230; Until now.  After months of using and tweaking, here&#8217;s what I use.  I call it VidProc.</p>
<p><span id="more-353"></span></p>
<pre class="brush:perl; gutter: false; wrap-lines: true; ruler: false">
#!/usr/bin/perl
# VidProc
# Transcode videos that have been either ripped by ripper or copied from a TiVo
#    to H.264 format
# by Ed Salisbury (ed@edsalisbury.net)
# http://www.edsalisbury.net
# (c)2009 Ed Salisbury, Some Rights Reserved
#
# External Utilities Required:
# * HandBrakeCLI
# * MPlayer/Mencoder
#
# Notes:
# * Settings for HandBrake and mencoder are what I have come up with after
#   doing a fair bit of research, and seem to work pretty well - if you have
#   any concrete suggestions on *better* general-purpose settings, let me know.
#
# License:
# Except where otherwise noted, this work is licensed under Creative Commons
#   Attribution ShareAlike 3.0.
#
# You are free:
#   * to Share -- to copy, distribute and transmit the work
#   * to Remix -- to adapt the work
#
# Under the following conditions:
#   * Attribution. You must attribute the work in the manner specified by the
#     author or licensor (but not in any way that suggests that they endorse
#     you or your use of the work).
#   * Share Alike. If you alter, transform, or build upon this work, you may
#     distribute the resulting work only under the same, similar or a
#     compatible license.
#   * For any reuse or distribution, you must make clear to others the license
#     terms of this work. The best way to do this is with a link to the
#     license's web page (http://creativecommons.org/licenses/by-sa/3.0/)
#   * Any of the above conditions can be waived if you get permission from the
#     copyright holder.
#   * Nothing in this license impairs or restricts the author's moral rights.

use warnings;
use strict;
use File::Copy;
use File::Basename;

sub system_int($);

# Locations
my $DEST = &quot;/path/to/destdir&quot;;
my $QUEUE = &quot;/path/to/queue.txt&quot;;

# Encoding Options
my $DEINT = &quot;pp=md&quot;;    # Deinterlacer
my $VBITRATE = 1000;    # Video Bitrate
my $SAMPLE_RATE = 44.1; # Audio Sample Rate
my $ABITRATE = 192;     # Audio Bitrate
my $OVERSCAN = 6;       # Overscan size (# of lines)

# File Extensions
my $SRC_EXT = &quot;mpg&quot;;
my $DEST_EXT = &quot;mp4&quot;;

# External Utilities
my $HANDBRAKE = &quot;/usr/local/bin/HandBrakeCLI&quot;;
my $MENCODER = &quot;/usr/bin/mencoder&quot;;
my $MPLAYER = &quot;/usr/bin/mplayer&quot;;

# Add backslashes to spaces
$DEST =~ s/ /\ /g;

while (1)
{
    # Read in the queue
    open(QUEUE, $QUEUE);
    my $line = &lt;QUEUE&gt;;
    my @fields;
    if ($line)
    {
        chomp ($line);
        @fields = split(/|/, $line);
    }
    else
    {
        print &quot;Waiting for new stuff to show up in the queue...n&quot;;
        close(QUEUE);
        sleep(60);
        next;
    }
    close (QUEUE);

    my $input = $fields[0];

    print &quot;Processing $inputn&quot;;

    # Fix spaces
    $input =~ s/ /\ /g;
    $input =~ s/'/\'/g;
    $input =~ s/&amp;/\&amp;/g;
    $input =~ s/;/\;/g;
    my @extlist = (&quot;.$SRC_EXT&quot;);

    my $base = basename($input, @extlist);

    if ($fields[1])
    {
        # DVD, since it has a title number
        my $title = $fields[1];
        my $output = &quot;$DEST/${base}_&quot; . $fields[1] . &quot;.$DEST_EXT&quot;;

        system_int(&quot;$HANDBRAKE --input $input --output $output --title $title --turbo --encoder x264 --vb $VBITRATE --audio 1 --aencoder faac --mixdown 6ch --arate $SAMPLE_RATE --ab $ABITRATE --detelecine --decomb --loosePixelratio --markers --two-pass --x264opts ref=3:mixed-refs:bframes=6:weightb:direct=auto:b-pyramid:me=umh:subme=9:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip=1:psy-rd=1,1&quot;);
    }
    else
    {
        # TiVo file, since it has no title number
        my $output = &quot;$DEST/${base}.$DEST_EXT&quot;;
        my $line;
        my $width;
        my $height;

        # Get video dimensions
        print &quot;Getting video information... &quot;;
        my @id = `$MPLAYER -nojoystick -nolirc -vo null -ao null -identify -frames 0 $input 2&gt;&amp;1`;
        foreach (@id)
        {
            if (/ID_VIDEO_WIDTH=(d+)/)
            {
                $width = $1;
            }
            if (/ID_VIDEO_HEIGHT=(d+)/)
            {
                $height = $1;
            }
        }
        if (!$width || !$height)
        {
            print &quot;FAILED!&quot;;
        }
        else
        {
            print &quot;(${width}x$height)n&quot;;
        }

        # Crop overscan
        $height-=$OVERSCAN;

        my %croptest;

        # Detect crop region
        print &quot;Detecting crop region... &quot;;
        my @cropdetect = `$MPLAYER -nojoystick -nolirc -vo null -ao null -vf crop=$width:$height:0:$OVERSCAN,cropdetect -ss 600 -endpos 180 $input 2&gt;&amp;1`;
        foreach $line (@cropdetect)
        {
            if ($line =~ /-vf crop=([d:]+)/)
            {
                $croptest{$1}++;
            }
        }

        # Get the crop value with the most hits
        my @croplist = sort { $croptest{$b} &lt;=&gt; $croptest{$a} } keys (%croptest);
        my $crop = $croplist[0];

        if (!$crop)
        {
            print &quot;FAILEDn&quot;;
            exit();
        }
        print &quot;($crop)n&quot;;
        print '-' x 80 . &quot;n&quot;;

        print &quot;Encoding first passn&quot;;
        print '-' x 80 . &quot;n&quot;;
        system_int(&quot;$MENCODER -ovc x264 -x264encopts pass=1:turbo:bitrate=$VBITRATE:bframes=1:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 -vf $DEINT,crop=$crop,scale=-1:-10,harddup -oac copy -ofps 30000/1001 $input -o /dev/null&quot;);

        print &quot;nn&quot;;
        print '-' x 80 . &quot;n&quot;;
        print &quot;Encoding second passn&quot;;
        print '-' x 80 . &quot;n&quot;;
        system_int(&quot;$MENCODER -ovc x264 -x264encopts pass=2:turbo:bitrate=$VBITRATE:bframes=1:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 -vf $DEINT,crop=$crop,scale=-1:-10:,harddup -oac copy -ofps 30000/1001 $input -o $output&quot;);
    }
    print &quot;Done. Removing from queuen&quot;;
    print &quot;nn&quot;;
    open(IN, $QUEUE);
    open(OUT, &quot;&gt;$QUEUE.tmp&quot;);
    while (my $qline = &lt;IN&gt;)
    {
        chomp ($qline);
        unless ($line eq $qline)
        {
            print OUT &quot;$qlinen&quot;;
        }
    }
    close (IN);
    close (OUT);
    unlink($QUEUE);
    move(&quot;$QUEUE.tmp&quot;, $QUEUE);
}

# Interruptible System Command
sub system_int($)
{
    my ($cmd) = @_;
    my $pid = fork();
    my $rc;
    if ($pid == 0)
    {
        exec($cmd);
    }
    else
    {
        waitpid($pid,0);
        $rc = $?;
    }
    return $rc;
}
</pre>
<p>It uses the same queue file that the other scripts will write to, so think of this as a continuation of the previous articles.  To use it, stick it somewhere like /usr/local/bin, and then change the locations to be wherever your queue is, and where you want your videos to end up.  The transcoding settings can get a little hairy, so I would say don&#8217;t mess with the actual command lines unless you know what you&#8217;re doing (but, if you did, you probably wouldn&#8217;t need this script!)</p>
<h4>External Utilities Needed:</h4>
<p>HandBrakeCLI &#8211; this can be downloaded from <a href="http://handbrake.fr/?article=download">here</a><br />
mplayer/mencoder &#8211; This can be installed via apt-get</p>
<h4>A couple of Notes/FAQs:</h4>
<p><b>Overscan removal:</b><br />
If you deal with letterboxed videos copied from TV, you&#8217;ll know what a pain overscan can be &#8211; Overscan is the generic term for the fuzzy line above the video that gets really annoying when watching on your monitor, but not on your TV.  This can wreak havoc with detecting where to crop the video, so I remove it.</p>
<p><b>HandBrake *AND* mencoder??  Why?</b><br />
I found that for some reason, Handbrake didn&#8217;t like working with the files that were copied from the TiVo &#8211; I dealt with lots of weird sync issues.  I posted it on the Handbrake forum, but never got a solution.  I ended up just using mencoder for the TiVo files, and Handbrake for the DVD rips, and left it at that.</p>
<p><b>Your setting XXX sucks &#8211; you should use YYY!</b><br />
If you can state that for any type of program (animation, TV, letterboxed, HD, etc.) that this is correct (and that it doesn&#8217;t make the process take much longer), I&#8217;ll happily thank you and update the script (as well as give you a mention here.)  I spent a bit of time trying to find settings that would work well for what I wanted, and ended up choosing these.  They&#8217;re not going to have the <b>best</b> quality, but the size and the time to transcode were good, so that&#8217;s what I stuck with.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Installing Perl Modules on Ubuntu Linux</title>
		<link>http://edsalisbury.net/installing-perl-modules-on-ubuntu/</link>
		<comments>http://edsalisbury.net/installing-perl-modules-on-ubuntu/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 14:00:02 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.edsfamily.com/ed/archives/10</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/installing-perl-modules-on-ubuntu/" title="Installing Perl Modules on Ubuntu Linux"></a>I&#8217;ve been a perl programmer/scripter/hacker for many years now, and I will frequently use CPAN modules to be able to do the out-of-the ordinary. This small guide is intended to help people easily install these modules. First, let&#8217;s get the &#8230;<p class="read-more"><a href="http://edsalisbury.net/installing-perl-modules-on-ubuntu/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/installing-perl-modules-on-ubuntu/" title="Installing Perl Modules on Ubuntu Linux"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2007/12/perl_image-138x150.jpg" alt="perl" title="perl" width="138" height="150" class="alignright size-thumbnail wp-image-319" /><br />
I&#8217;ve been a perl programmer/scripter/hacker for many years now, and I will frequently use <a href="http://www.cpan.org/">CPAN</a> modules to be able to do the out-of-the ordinary.  This small guide is intended to help people easily install these modules.</p>
<p>First, let&#8217;s get the CPAN module up to date:</p>
<p><code>$ sudo perl -MCPAN -e shell</code><br />
(take defaults to set everything up)<br />
<code>cpan&gt; exit</code><br />
<code>$ sudo perl -MCPAN -e shell<br />
cpan&gt; install Bundle::CPAN</code><br />
(answer yes to the question about saving data)<br />
<code>cpan&gt; reload cpan</code></p>
<p>Then, to install a module, it&#8217;s simply:<br />
<code>$ sudo perl -MCPAN -e shell<br />
cpan&gt; install &lt;name of module&gt;</code><br />
<code>cpan&gt; exit</code></p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/installing-perl-modules-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Set Up a TiVo Media Server on Ubuntu Linux</title>
		<link>http://edsalisbury.net/how-to-set-up-a-tivo-media-server-on-ubuntu-linux/</link>
		<comments>http://edsalisbury.net/how-to-set-up-a-tivo-media-server-on-ubuntu-linux/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 20:40:40 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[pytivo]]></category>
		<category><![CDATA[TiVo]]></category>

		<guid isPermaLink="false">http://www.edsfamily.com/ed/?p=97</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/how-to-set-up-a-tivo-media-server-on-ubuntu-linux/" title="How to Set Up a TiVo Media Server on Ubuntu Linux"></a>This guide will help you set up a media server to be able to play videos on your Series 3 TiVo, using pyTiVo. (Note: this post was moved from my old blog, but has been updated a bit) First, install &#8230;<p class="read-more"><a href="http://edsalisbury.net/how-to-set-up-a-tivo-media-server-on-ubuntu-linux/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/how-to-set-up-a-tivo-media-server-on-ubuntu-linux/" title="How to Set Up a TiVo Media Server on Ubuntu Linux"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2009/07/tivo-logo1-134x150.jpg" alt="TiVo" title="TiVo" width="134" height="150" class="alignright size-thumbnail wp-image-298" /><br />
This guide will help you set up a media server to be able to play videos on your Series 3 TiVo, using pyTiVo.  (Note: this post was moved from my old blog, but has been updated a bit)</p>
<p>First, install ffmpeg:</p>
<pre>$ sudo apt-get install ffmpeg</pre>
<p>Then, install git (needed to grab pyTivo):</p>
<pre>$ sudo apt-get install git-core</pre>
<p>Then, grab the latest version of the pyTivo script (Look at the <a href="http://pytivo.armooo.net/wiki/CurrentRelease">Current Release</a> page to verify that you have the right version):</p>
<pre>$ cd /usr/share
$ sudo git clone git://repo.or.cz/pyTivo/wmcbrine.git
$ sudo mv wmcbrine pyTivo</pre>
<p>Edit /usr/share/pyTivo/pyTivo.conf:</p>
<pre>$ cd /usr/share/pyTivo
$ sudo cp pyTivo.conf.dist pyTivo.conf
$ sudo vi pyTivo.conf</pre>
<p>The only thing that I changed is to comment out the default video share, and add my own:</p>
<pre>[Movies]
type=video
path=/data/Video/Movies
[Television]
type=video
path=/data/Video/Television
[Music]
type=music
path=/data/Audio/Music</pre>
<p>Run pyTivo:</p>
<pre>$ sudo python /usr/share/pyTivo/pyTivo.py</pre>
<p>Verify that things are working correctly &#8212; on the Tivo, go to &#8220;Now Playing List&#8221; and look for the shares.  If they appear and you can browse to them, you&#8217;re almost done!</p>
<p>One issue I had was with transferring the videos.  When I transferred them to the TiVo, it had a message of &#8220;unknown mpeg2 codec&#8221; or something to that effect.  Apparently the package for ffmpeg on Intrepid doesn&#8217;t have all of the codecs needed.  To install them, run the following:</p>
<pre>$ sudo apt-get install libavcodec-unstripped-51</pre>
<p>After I did this, videos were able to be transferred just fine.</p>
<p>The last thing to do is to make pyTiVo start automatically on bootup.  To do this, simply copy the following script to /etc/init.d:</p>
<pre class="brush:bash; gutter: false; wrap-lines: true; ruler: false">
#!/bin/bash
# chkconfig: 2345 99 05
# description: pyTivo server

### INIT INFO
# Provides: pytivo
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-description: pyTivo server
# Description: Start and stop the pyTivo server.
### END INIT INFO

RETVAL=0

start() {
echo -n "Starting pyTivo: "
pgrep -f pyTivo.py
RETVAL=$?
[ $RETVAL -eq 0 ] &#038;&#038; echo "pyTivo already running: Exiting" &#038;&#038; exit 1

# this call actually starts pyTivo.
python /usr/share/pyTivo/pyTivo.py > /dev/null 2>&#038;1 &#038;
RETVAL=$?
[ $RETVAL -eq 0 ] &#038;&#038; echo -n "done"
echo
return $RETVAL
}

stop() {
echo -n "Stopping pyTivo: "
pkill -f pyTivo.py
RETVAL=$?
echo
[ $RETVAL -eq 0 ] &#038;&#038; echo -n "done"
echo
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
sleep 1
start
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL
</pre>
<p><em>Note: I didn&#8217;t write this &#8211; I just grabbed it from somewhere when setting it up &#8211; let me know if you wrote it so that I can give you credit!</em></p>
<p>After creating the script, make it executable:</p>
<pre>$ sudo chmod u+x /etc/init.d/pytivo</pre>
<p>Then create links to /etc/rc3.d and /etc/rc1.d:</p>
<pre>$ sudo ln -s /etc/init.d/pytivo /etc/rc3.d/S99pytivo
$ sudo ln -s /etc/init.d/pytivo /etc/rc1.d/K99pytivo
</pre>
<p>This should make it so that pytivo starts automatically upon bootup.</p>
<p>Hopefully you&#8217;ve found this guide useful.  Next time, I&#8217;ll be talking about how to make the videos show up perfectly on the TiVo, with appropriate titles, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/how-to-set-up-a-tivo-media-server-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>How to Mount External Drives Statically on Ubuntu Linux</title>
		<link>http://edsalisbury.net/how-to-mount-external-drives-statically-on-ubuntu-linux/</link>
		<comments>http://edsalisbury.net/how-to-mount-external-drives-statically-on-ubuntu-linux/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 19:21:01 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[firewire]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=267</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/how-to-mount-external-drives-statically-on-ubuntu-linux/" title="How to Mount External Drives Statically on Ubuntu Linux"></a>The Issue: You have external USB drives that you want to be mounted the same way every time, but the /dev/sdX device name keeps changing. The Solution: First, unmount the drive: $ sudo umount /media/disk Then, look in /dev/disk/by-id to &#8230;<p class="read-more"><a href="http://edsalisbury.net/how-to-mount-external-drives-statically-on-ubuntu-linux/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/how-to-mount-external-drives-statically-on-ubuntu-linux/" title="How to Mount External Drives Statically on Ubuntu Linux"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2009/07/drive-3-cb-external-usb-256x256-150x150.png" alt="External Drive" title="External Drive" width="150" height="150" class="alignright size-thumbnail wp-image-269" /><br />
<strong>The Issue:</strong><br />
You have external USB drives that you want to be mounted the same way every time, but the /dev/sdX device name keeps changing.</p>
<p><strong>The Solution:</strong><br />
First, unmount the drive:<br />
<code>$ sudo umount /media/disk</code></p>
<p>Then, look in /dev/disk/by-id to find the correct device file:<br />
<code>/dev/disk/by-id/usb-WDC_WD30_00JB-00KFA0_DEF107679C83-0:0-part1</code></p>
<p>Add this to /etc/fstab:<br />
<code>/dev/disk/by-id/usb-WDC_WD30_00JB-00KFA0_DEF107679C83-0:0-part1                  /mnt/data01  ext3    defaults 0 0</code></p>
<p>Create the mountpoint:<br />
<code>$ sudo mkdir /mnt/data01</code></p>
<p>Mount the volume:<br />
<code>$ sudo mount /mnt/data01</code></p>
<p>Now, this device should always be mounted on /mnt/data01.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/how-to-mount-external-drives-statically-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Rip DVDs on Ubuntu Linux 9.04 (Jaunty)</title>
		<link>http://edsalisbury.net/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/</link>
		<comments>http://edsalisbury.net/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 06:41:37 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=25</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/" title="How to Rip DVDs on Ubuntu Linux 9.04 (Jaunty)"></a>One thing that I really enjoy is to be able to watch my DVDs from any computer in the house, or from (almost) any of the TVs, without having to deal with physical media.  The way I do this is &#8230;<p class="read-more"><a href="http://edsalisbury.net/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/" title="How to Rip DVDs on Ubuntu Linux 9.04 (Jaunty)"></a><p><img src="http://www.edsalisbury.net/wp-content/uploads/2009/06/dvd_discs-150x150.png" alt="DVDs" title="DVDs" width="150" height="150" class="alignleft size-thumbnail wp-image-185" />One thing that I really enjoy is to be able to watch my DVDs from any computer in the house, or from (almost) any of the TVs, without having to deal with physical media.  The way I do this is to &#8220;rip&#8221; the movies to my media server, and then transcode them to a smaller format.  This guide will discuss part one of this &#8212; ripping a DVD.  I know there are several utilities which will do this for me, but since I have very specific needs, and like things to be as automated as possible, I wrote a script to do this (naturally).<br/><br />
<span id="more-25"></span><br />
In order to use this script, you will need to install a few things:<br/></p>
<ul>
<li>lsdvd</li>
<li>vobcopy</li>
<li>libdvdcss2</li>
</ul>
<p>The first two are easy &#8211; simply:<br/></p>
<pre>% sudo apt-get install lsdvd vobcopy</pre>
<p>For the CSS library, you&#8217;ll need to first add medibuntu sources:<br/></p>
<pre>% sudo wget http://www.medibuntu.org/sources.list.d/jaunty.list --output-document=/etc/apt/sources.list.d/medibuntu.list
% sudo apt-get update
% sudo apt-get install medibuntu-keyring
% sudo apt-get update</pre>
<p>Then install libdvdcss2:<br/></p>
<pre>% sudo apt-get install libdvdcss2</pre>
<p>The next thing will be to download this script, and change $VOBDIR and $QUEUE according to where you want to put the VOB files and which text file to write the list of titles to transcode.<br/></p>
<p>Here&#8217;s some examples on how to use it:<br/></p>
<p>To rip a movie, choosing the longest title:</p>
<pre>% ripper -n "My Movie"</pre>
<p>To rip a movie, specifying the title number:</p>
<pre>% ripper -n "My Movie" -t 5</pre>
<p>To rip a TV Show disc &#8211; choosing only titles that are 20 minutes or longer:</p>
<pre>% ripper -n "My TV Show" -m 20</pre>
<p>Note: This script doesn&#8217;t convert from VOB files to anything else, it just copies the contents of the DVD, and writes to a queue file.  Transcoding to other formats will come soon.<br/></p>
<pre class="brush:perl; gutter: false; wrap-lines: true; ruler: false">
#!/usr/bin/perl
# DVD Ripper
# Uses vobcopy to rip DVDs
# by Ed Salisbury (ed@edsalisbury.net)
# http://www.edsalisbury.net
# (c)2009 Ed Salisbury, Some Rights Reserved
#
# External Utilities Required:
# * lsdvd
# * vobcopy
# * libdvdcss2 library
#
#
# Usage:
# ripper -n &lt;name&gt; -t &lt;title num&gt; -l -m &lt;minlength&gt;
#        -t: Title Number
#        -l: Longest title (default)
#        -m: Minimum title length (in minutes)
#
#
# Examples:
# Rip a movie, choosing the longest title
# % ripper -n "My Movie"
#
# Rip a movie, specifying the title number
# % ripper -n "My Movie" -t 5
#
# Rip a TV Show disc - choosing only titles that are 20 minutes or longer
# % ripper -n "My TV Show" -m 20
#
#
# Limitations:
# * Will not rip some DVDs (limitation of vobcopy)
# * Will not transcode the VOB files
#
#
# License:
# Except where otherwise noted, this work is licensed under Creative Commons
#   Attribution ShareAlike 3.0.
#
# You are free:
#   * to Share — to copy, distribute and transmit the work
#   * to Remix — to adapt the work
#
# Under the following conditions:
#   * Attribution. You must attribute the work in the manner specified by the
#     author or licensor (but not in any way that suggests that they endorse
#     you or your use of the work).
#   * Share Alike. If you alter, transform, or build upon this work, you may
#     distribute the resulting work only under the same, similar or a
#     compatible license.
#   * For any reuse or distribution, you must make clear to others the license
#     terms of this work. The best way to do this is with a link to the
#     license's web page (http://creativecommons.org/licenses/by-sa/3.0/)
#   * Any of the above conditions can be waived if you get permission from the
#     copyright holder.
#   * Nothing in this license impairs or restricts the author's moral rights.

use warnings;
use strict;
use Getopt::Std;
use File::Copy;
$|++;

sub usage();

# Where to store the VOB files
my $VOBDIR = "/data/Video/Rip";
# Queue for transcoding (not done by this script)
my $QUEUE = "/data/Video/queue.txt";

my $VERSION = "1.1";
my $LONGEST;

my $title_num = 0;
my $title_name;
my $min_time;
my $name;
my $mounted = '';
my $count = 0;
my $cmd;
my %opt = ();

# External Utilities
my $VOBCOPY = '/usr/bin/vobcopy';
my $LSDVD = '/usr/bin/lsdvd';
my $MOUNT = '/bin/mount';
my $GREP = '/bin/grep';
my $EJECT = '/usr/bin/eject';

getopts("v?n:t:lm:", %opt);

if ($opt{'?'})
{
    usage();
}

if ($opt{'v'})
{
    print "DVD Ripper ver. $VERSION by Ed Salisbury &lt;ed@edsalisbury.net&gt;n";
    exit();
}

# Check for installed external utilities
unless (-f $VOBCOPY)
{
    print "ERROR: vobcopy not installedn";
    exit(1);
}

unless (-f $LSDVD)
{
    print "ERROR: lsdvd not installedn";
    exit(1);
}

# Get Name
if ($opt{'n'})
{
    $name = $opt{'n'};
}
else
{
    print "Error: No name specifiedn";
    usage();
}

if ($opt{'l'})
{
    $LONGEST++;
}

if ($opt{'m'})
{
    $min_time = $opt{'m'};
}

if ($opt{'t'})
{
    $title_num = $opt{'t'};
}

if (!$min_time &#038;&#038; !$title_num)
{
    $LONGEST++;
}

if ($LONGEST)
{
    print "Using longest title.n";
}

# Check for mounted DVD
print "Checking for DVD-ROM...";
while (!$mounted)
{
    $mounted = `$MOUNT | $GREP cdrom`;
    if (!$mounted)
    {
        if ($count < 20)
        {
            print ".";
            sleep(1);
            $count++;
        }
        else
        {
            print " not found.n";
            exit();
        }
    }
    else
    {
        print " found.n";
    }
}

my @titles_to_xcode;

if ($title_num)
{
    push (@titles_to_xcode, $title_num);
}
else
{
    print "Getting DVD title info... ";
    $cmd = "$LSDVD 2>/dev/null";
    my @lsdvd = `$cmd`;

    foreach my $line (@lsdvd)
    {
        if ($line =~ /^Disc Title: (.*?)$/)
        {
            $title_name = $1;
        }

        if ($min_time &#038;&#038; $line =~ /^Title: (d+), Length: (d+):(d+):/)
        {
            my $length = ($1 * 60) + $2;
            if ($length > $min_time)
            {
                push (@titles_to_xcode, $1);
            }
        }

        if ($LONGEST &#038;&#038; $line =~ /^Longest track: (d+)$/)
        {
            push (@titles_to_xcode, $1);
        }
    }
    print "done.n";
}

print "Ripping...n";
$cmd = "$VOBCOPY -m -o $VOBDIR -F64";
system($cmd);
print "done.n";

print "Moving to proper location... ";
move("$VOBDIR/$title_name/VIDEO_TS", "$VOBDIR/$name");
rmdir("$VOBDIR/$title_name");
print "done.n";

print "Updating queue... ";
open (QUEUE, ">>$QUEUE");
foreach my $title (@titles_to_xcode)
{
    print QUEUE "$VOBDIR/$name|$titlen";
}
close (QUEUE);
print "done.n";

print "Ejecting DVD-ROM... ";
system("$EJECT");
print "done.n";

sub usage()
{
    print "ripper -n &lt;name&gt; -t &lt;title num&gt; -l -m &lt;minlength&gt;n";
    print "t-t: Title Numbern";
    print "t-l: Longest title (default)n";
    print "t-m: Minimum title length (in minutes)n";
    exit();
}
</pre>
<p>Soon I&#8217;ll post my scripts for transcoding DVDs to H.264.  Please let me know if you find this useful or have any comments/suggestions.</p>
<p><b>Update:</b> I have posted a new guide and script for processing the DVD rips <a href="http://www.edsalisbury.net/linux/how-to-convert-dvds-and-tivo-mpeg2-videos-to-h-264/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/how-to-rip-dvds-on-ubuntu-linux-9-04-jaunty/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How To Set Up a Two-Way Mirror Between Mac OS X and Ubuntu Linux</title>
		<link>http://edsalisbury.net/how-to-set-up-a-two-way-mirror-between-mac-os-x-and-ubuntu-linux/</link>
		<comments>http://edsalisbury.net/how-to-set-up-a-two-way-mirror-between-mac-os-x-and-ubuntu-linux/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 23:11:48 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[mirroring]]></category>
		<category><![CDATA[unison]]></category>

		<guid isPermaLink="false">http://www.edsalisbury.net/?p=58</guid>
		<description><![CDATA[<a href="http://edsalisbury.net/how-to-set-up-a-two-way-mirror-between-mac-os-x-and-ubuntu-linux/" title="How To Set Up a Two-Way Mirror Between Mac OS X and Ubuntu Linux"></a>After my hard drive crash a few months ago, I&#8217;ve been a bit paranoid about losing data.   By &#8220;a bit&#8221; I mean I&#8217;ve been sticking copies of my data on different machines to make sure I have various copies in &#8230;<p class="read-more"><a href="http://edsalisbury.net/how-to-set-up-a-two-way-mirror-between-mac-os-x-and-ubuntu-linux/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://edsalisbury.net/how-to-set-up-a-two-way-mirror-between-mac-os-x-and-ubuntu-linux/" title="How To Set Up a Two-Way Mirror Between Mac OS X and Ubuntu Linux"></a><p><a href="http://www.flickr.com/photos/aloshbennett/3237417064/"><img class="alignleft size-thumbnail wp-image-82" title="Mirror to the Sky" src="http://www.edsalisbury.net/wp-content/uploads/2009/06/aloshbennett-mirror-to-the-sky-150x150.jpg" alt="Mirror to the Sky (aloshbennet CC)" width="150" height="150" /></a>After my hard drive crash a few months ago, I&#8217;ve been a bit paranoid about losing data.   By &#8220;a bit&#8221; I mean I&#8217;ve been sticking copies of my data on different machines to make sure I have various copies in case another hard drive dies, or a computer gets fried, melting everything inside, or my house burns down&#8230; Oh wait, I don&#8217;t have that scenario covered&#8230;.  Time to fix that!  What I want is the ability to copy my data to an offsite location, and keep the backup up to date.  The main thing I care about is my family photos.   I was talking to my cousin Dave, and he had the same issue.  He wanted access to my photos, as well as have an offsite backup copy of his family&#8217;s photos.  I thought of a solution.  What if we could set up a two-way mirror between his machine and mine, and keep it updated nightly?  That way if he sticks something in the directory on his machine and vice versa, keeping a live backup.  I began doing some research, and I found the tool &#8212; <a href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a>.</p>
<p><span id="more-58"></span></p>
<p>One slight wrinkle is the fact that he runs Mac OS X and I run Ubuntu Linux.  Unison will run on both, so it should be fine.</p>
<p>A couple of things to consider:</p>
<p>Mirroring over the internet is <strong>SLOW</strong> &#8212; if you want to keep a large quantity of files mirrored, it&#8217;s best to &#8220;seed&#8221; the mirror by doing a local copy to the drive.  Dave sent me his hard drive via snailmail, so this worked out.</p>
<p>This process will involve poking holes in your firewall, and setting up SSH keys with no password.  These are security risks (which can be minimized).  You have been warned.</p>
<p>To make things easy, I&#8217;ll specify the hostnames:</p>
<p><strong>Mac Host: eve</strong></p>
<p><strong>Linux Host: twiki</strong></p>
<p>One thing needs to be decided before we go on is which host will be initiating the transfer.   You can initiate from both sides, but to make it easy, I&#8217;ll just be initiating from my computer, twiki.</p>
<p>The first step is to verify connectivity between the two machines.  Since I&#8217;m initiating the transfer, I&#8217;ll be adding a hosts entry for eve.  I first have Dave go to <a href="http://www.whatismyip.com">www.whatismyip.com</a> and have him tell me his IP address.  I put this into /etc/hosts on my machine:</p>
<pre>&lt;hismachinesipaddress&gt;        eve</pre>
<p>I try to first ping the address.  Most likely it will fail.  Dave will need to poke a hole in the firewall (set up port forwarding) &#8211; How to do this is outside the scope of this article, but <a href="http://portforward.com">www.portforward.com</a> has a lot of info on how to do this.  Dave forwards port 22 (SSH) to his local IP address and saves settings.</p>
<p>Ping still doesn&#8217;t work, but SSH should.  I try sshing to the box, and voila, I get a password prompt.</p>
<p>The next step is to have Dave create an account for me.  To make it easy, I have him call it &#8220;ed&#8221; (same as on twiki)</p>
<p>After my account has been created, I&#8217;m able to login via ssh.  The next step is to set up an SSH key to make it so that I can ssh in without having to give a password.  On twiki, I run:</p>
<pre>twiki% ssh-keygen -t dsa -f ~/.ssh/unison</pre>
<p>(Press enter when it asks for a passphrase)</p>
<p>Add the contents of ~/.ssh/unison.pub to ~/.ssh/authorized_keys2 on eve.  Make sure it&#8217;s all on one line (no linebreaks)</p>
<p>To test it out, I ssh from twiki to eve, specifying the unison key:</p>
<pre>twiki% ssh -i ~/.ssh/unison eve</pre>
<p>It shouldn&#8217;t ask me for a password, so I&#8217;m good to go for this step.  If it does, make sure the permissions on the files in ~/.ssh are set to 600.</p>
<p>Next, we&#8217;ll install Unison on both machines:</p>
<p><strong>On Eve:</strong></p>
<ul>
<li>Get and install <a href="http://darwinports.com/download/">MacPorts</a></li>
<li>Use MacPorts to install Unison:</li>
</ul>
<pre>eve% sudo /opt/local/bin/port install unison
---&gt;  Fetching ocaml
---&gt;  Attempting to fetch ocaml-3.11.0.tar.bz2 from http://distfiles.macports.org/ocaml
---&gt;  Verifying checksum(s) for ocaml
---&gt;  Extracting ocaml
---&gt;  Configuring ocaml
---&gt;  Building ocaml
---&gt;  Staging ocaml into destroot
---&gt;  Installing ocaml @3.11.0_0
---&gt;  Activating ocaml @3.11.0_0
---&gt;  Cleaning ocaml
---&gt;  Fetching unison
---&gt;  Attempting to fetch unison-2.27.57.tar.gz from http://distfiles.macports.org/unison
---&gt;  Verifying checksum(s) for unison
---&gt;  Extracting unison
---&gt;  Applying patches to unison
---&gt;  Configuring unison
---&gt;  Building unison
---&gt;  Staging unison into destroot
---&gt;  Installing unison @2.27.57_0
---&gt;  Activating unison @2.27.57_0
---&gt;  Cleaning unison</pre>
<p><strong>On Twiki:</strong></p>
<pre>twiki% sudo apt-get install unison
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
unison
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 0B/529kB of archives.
After this operation, 1262kB of additional disk space will be used.
(Reading database ... 150151 files and directories currently installed.)
Unpacking unison (from .../unison_2.27.57-1ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for doc-base ...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Setting up unison (2.27.57-1ubuntu1) ...</pre>
<p>Next, set up the profile on twiki:</p>
<pre>twiki% mkdir ~/.unison
twiki% vi ~/.unison/default.prf</pre>
<p>Put the following into default.prf (changing as appropriate):</p>
<pre>root = /data/EdsPhotos
root = ssh://eve//DavesPhotos
rshargs = -C
sshargs = -i /home/ed/.ssh/unison
servercmd = /opt/local/bin/unison
ignore = Name _*
ignore = Name .*
batch = true
log = true</pre>
<p>For security purposes, add the following to ~/.ssh/authorized_keys2 on eve.  This will only allow this ssh key to be used to run unison:</p>
<pre>command="/opt/local/bin/unison",no-port-forwarding,no-X11-forwarding,no-agent-forwarding</pre>
<p>On twiki, run unison:</p>
<pre>twiki% unison</pre>
<p>It will spit out a lot of data, but should start scanning and eventually copying data back and forth, depending on how much data there is.   In order to run nightly, add the following to your crontab on twiki:</p>
<pre>0 0 * * * nohup /usr/local/bin/unison &gt; /dev/null 2&gt;&amp;1</pre>
<p>That should be it.  Any feedback would be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsalisbury.net/how-to-set-up-a-two-way-mirror-between-mac-os-x-and-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

