<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>TechDev</title>
	<link>http://karlherrick.com/dev</link>
	<description>A Digital Playground</description>
	<pubDate>Thu, 29 Jul 2010 13:00:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Gnome background changer</title>
		<link>http://karlherrick.com/dev/2010/06/16/gnome-background-changer/</link>
		<comments>http://karlherrick.com/dev/2010/06/16/gnome-background-changer/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 18:03:43 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Cron]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/06/16/gnome-background-changer/</guid>
		<description><![CDATA[Gnome 2.3 on Ubuntu 10.04 LTS (Lucid Lynx) doesn&#8217;t appear to have an automatic wallpaper changer built in. While it appears there are many ways to accomplish this, I decided to write my own little script to get some time in with bash&#8230; alternative ways I have found include using &#8220;Wallpaper-tray&#8221; (which doesn&#8217;t appear to [...]]]></description>
			<content:encoded><![CDATA[<p>Gnome 2.3 on Ubuntu 10.04 LTS (Lucid Lynx) doesn&#8217;t appear to have an automatic wallpaper changer built in. While it appears there are many ways to accomplish this, I decided to write my own little script to get some time in with bash&#8230; alternative ways I have found include using &#8220;Wallpaper-tray&#8221; (which doesn&#8217;t appear to be in 10.04), <a href="http://www.ghacks.net/2010/05/09/desktop-drapes-for-gnome/">Desktop Drapes</a>, or a <a href="http://ubuntuforums.org/showthread.php?t=49336#post257231">variation of the script below </a>using things like &#8220;<a href="http://ubuntu-tutorials.com/2008/01/10/gconftool-2-gconf-editor-from-the-shell/">gconftool-2</a>&#8220;.</p>
<p>To use this script, do the following:</p>
<ul>
<li>Right-click on the desktop and choose &#8220;<em>Change Desktop Background</em>&#8220;</li>
<li>Look through the backgrounds, and make sure the ones listed are the ones you want to have the script randomly select</li>
<li>Open up a text file using &#8220;<em>gedit</em>&#8220;, and add the contents of the script:
<div class="bash" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #808080; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #007800;">installedDir=</span>~/Pictures/backgrounds/random</p>
<p><span style="color: #007800;">i=</span><span style="color: #000000;">0</span><br />
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> line; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp;<span style="color: #007800;">data=</span>`<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;${line}&quot;</span> | <span style="color: #c20cb9; font-weight: bold;">grep</span> -i filename`<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$data&quot;</span> != <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #007800;">filenameCutLength=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #808080; font-style: italic;">#data<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000;">-11</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #007800;">filename=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$data</span> | <span style="color: #c20cb9; font-weight: bold;">cut</span> -b11-<span style="color: #007800;">$filenameCutLength</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$filename&quot;</span> != <span style="color: #ff0000;">&quot;(none)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> || <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$filename&quot;</span> != \<br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;random.img&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #007800;">extension=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #7a0874; font-weight: bold;">&#123;</span>filename,,<span style="color: #7a0874; font-weight: bold;">&#125;</span> | \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #c20cb9; font-weight: bold;">cut</span> -b$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">expr</span> $<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #808080; font-style: italic;">#filename<span style="color: #7a0874; font-weight: bold;">&#125;</span> - <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>-$<span style="color: #7a0874; font-weight: bold;">&#123;</span>#filename<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$extension&quot;</span> == <span style="color: #ff0000;">&quot;jpg&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> || <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$extension&quot;</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;== <span style="color: #ff0000;">&quot;png&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> || <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$extension&quot;</span> == <span style="color: #ff0000;">&quot;svg&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileArray<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$i</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$filename</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">i=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$i</span> + <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">done</span> &lt;&lt; EOF<br />
&nbsp; &nbsp;$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">deleted=</span>\<span style="color: #ff0000;">&quot;false -A7 ~/.gnome2/backgrounds.xml)<br />
EOF</p>
<p>fileArrayLength=`echo $[ ( $RANDOM % ${#fileArray[@]} ) ]`<br />
cp &quot;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>fileArray<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$fileArrayLength</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #ff0000;">&quot; <span style="color: #000099; font-weight: bold;">\</span><br />
&quot;</span><span style="color: #007800;">$installedDir</span>/random.img<span style="color: #ff0000;">&quot;</span></div>
</li>
<li>Save the file as &#8220;<em>gRandomBackground.sh</em>&#8221; in a directory (this example uses: &#8220;/home/$USER/Pictures/backgrounds/random&#8221;, if you install it elsewhere, be sure to change the $installedDir variable in the script)</li>
<li>Open &#8220;Terminal&#8221; and enter the command:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">crontab -e</div>
<p> If you haven&#8217;t used crontab before, stick with the default, &#8220;<em>nano</em>&#8220;</li>
<li>Paste the following as one line into the editor:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #cc66cc;">0</span> */<span style="color: #cc66cc;">3</span> * * * bash ~/Pictures/backgrounds/random/gRandomBackground.sh</div>
<p> This will change the background every three hours, on the hour. &#8220;Ctrl+O, and then Ctrl+W&#8221; should get the crontab saved and also get you exited out of nano. For more information on how to use cron, <a href="http://www.google.com/search?q=crontab">see Google</a>.</li>
<li>Open up the &#8220;<em>Appearance Preferences</em>&#8221; dialog again, by right-clicking on the desktop and selecting &#8220;<em>Change Desktop Background</em>&#8220;</li>
<li>Click the &#8220;<em>Add&#8230;</em>&#8221; button and browse to the directory that gRandomBackground.sh is installed to</li>
<li>Select the &#8220;<em>random.img</em>&#8221; background, click the &#8220;<em>Open</em>&#8221; button, and then the &#8220;<em>Close</em>&#8221; button</li>
</ul>
<p>Your background should change every three hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/06/16/gnome-background-changer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>McAfee deleted svchost.exe</title>
		<link>http://karlherrick.com/dev/2010/04/22/mcafee-deleted-svchostexe/</link>
		<comments>http://karlherrick.com/dev/2010/04/22/mcafee-deleted-svchostexe/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 12:26:20 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/04/22/mcafee-deleted-svchostexe/</guid>
		<description><![CDATA[Wednesday afternoon I had at least two reports of workstations that were suddenly rebooting on their own. No networking and no taskbar were also symptoms. I thought it may be a virus, so I did a few scans with some of the well known Windows malware scanning tools, all the while thinking&#8230; why didn&#8217;t McAfee [...]]]></description>
			<content:encoded><![CDATA[<p>Wednesday afternoon I had at least two reports of workstations that were suddenly rebooting on their own. No networking and no taskbar were also symptoms. I thought it may be a virus, so I did a few scans with some of the well known Windows malware scanning tools, all the while thinking&#8230; why didn&#8217;t McAfee catch this? After two hours of scanning and no positives on the scans, I decided to rebuild the machine, but declared that I would begin on it the next day.</p>
<p>Well&#8230; turns out, McAfee was the issue. I got an email from them that read in part like this: &#8220;Our initial investigation indicates that the error can result in moderate to significant performance issues on systems running Windows XP Service Pack 3.&#8221; Moderate to significant? One person affected couldn&#8217;t get on the network, had no taskbar, and their computer was auto rebooting&#8230; That sounds more like extreme systemic failure! <img src='http://karlherrick.com/dev/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>For verification of the issue, see the following screenshot:</p>
<p><img src='http://karlherrick.com/dev/wp-content/uploads/2010/04/zero_byte_svchost.jpg' alt='zero_byte_svchost.jpg' /></p>
<p>Here are some steps I took to fix it (taken mostly from the following website: <a href="http://brianseekford.com/index.php/2010/04/21/how-to-fix-the-mcafee-svchost-crash-from-the-virus-definition-update/">http://brianseekford.com/index.php/2010/04/21/how-to-fix-the-mcafee-svchost-crash-from-the-virus-definition-update/</a>)</p>
<ul>
<li>Boot workstation in safe mode and login as an administrative user</li>
<li>Press the following keys: CTRL-ALT-DEL.</li>
<li>Click the &#8220;File>Run&#8221; menu item, type in &#8220;cmd&#8221;, and press the &#8220;Enter&#8221; key</li>
<li>Run the command: del &#8220;C:\Program Files\Common Files\McAfee\Engine\avvscan.dat&#8221;</li>
<li>Next, we have to copy a replacement svchost.exe from the system if available. Some have found it in &#8220;c:\windows\system32\dllcache&#8221; and I found it in &#8220;C:\Windows\$NtServicePackUninstall$&#8221; so I will go with the instructions for what I had on this particular system&#8230;</li>
<ul>
<li>within the &#8220;cmd&#8221; window type the following below:</li>
<li>cd C:\Windows\$NtServicePackUninstall$&#8221;</li>
<li>copy svchost.exe c:\Windows\System32</li>
</ul>
<li>Next, restart the workstation, login, and update McAfee to the latest dat file. As of this writing they have replaced the broken 5958 dat with 5959.</li>
<li>Once McAfee has been updated, I had to restarted the workstation again to get McAfee to report as being updated.</li>
</ul>
<p>And more reading regarding the issue:</p>
<p><a href="http://www.cnet.com.au/how-to-fix-your-mcafee-crippled-computer-339302608.htm">http://www.cnet.com.au/how-to-fix-your-mcafee-crippled-computer-339302608.htm</a></p>
<p><a href="http://www.switched.com/2010/04/21/mcafee-update-sends-windows-xp-machines-into-endless-reboot/">http://www.switched.com/2010/04/21/mcafee-update-sends-windows-xp-machines-into-endless-reboot/</a></p>
<p><a href="http://tech.slashdot.org/story/10/04/21/1735211/McAfee-Kills-SVCHostexe-Sets-Off-Reboot-Loops-For-Win-XP-Win-2000">http://tech.slashdot.org/story/10/04/21/1735211/McAfee-Kills-SVCHostexe-Sets-Off-Reboot-Loops-For-Win-XP-Win-2000</a></p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/04/22/mcafee-deleted-svchostexe/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Screensavers in Ubuntu 9.10</title>
		<link>http://karlherrick.com/dev/2010/03/12/screensavers-in-ubuntu-910/</link>
		<comments>http://karlherrick.com/dev/2010/03/12/screensavers-in-ubuntu-910/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 00:17:33 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/03/12/screensavers-in-ubuntu-910/</guid>
		<description><![CDATA[I used to do some incredible tweaking for my screensaver in Ubuntu, especially because gnome-screensaver wouldn&#8217;t allow for editing the particular screensaver options like xscreensaver would (see: https://wiki.ubuntu.com/ScreenSaver). These days, I don&#8217;t want to tweak&#8230; I just want the thing to shut off when I am watching fullscreen flash video, so that I don&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>I used to do some incredible tweaking for my screensaver in Ubuntu, especially because gnome-screensaver wouldn&#8217;t allow for editing the particular screensaver options like xscreensaver would (see: <a href="https://wiki.ubuntu.com/ScreenSaver">https://wiki.ubuntu.com/ScreenSaver</a>). These days, I don&#8217;t want to tweak&#8230; I just want the thing to shut off when I am watching fullscreen flash video, so that I don&#8217;t have to wiggle the mouse every ten minutes. <img src='http://karlherrick.com/dev/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So I made a simple toggle script and created a launcher for the script on the desktop. Gonna watch video? Double-click the icon. Done watching video, double-click the icon.</p>
<div class="bash" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #808080; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #007800;">PID=</span>`<span style="color: #c20cb9; font-weight: bold;">pidof</span> gnome-screensaver`</p>
<p><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$PID&quot;</span> != <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#gnome-screensaver is running shut it down</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">killall</span> <span style="color: #000000;">-9</span> gnome-screensaver<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">#gnome-screensaver is not running, start it up</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; gnome-screensaver<br />
<span style="color: #000000; font-weight: bold;">fi</span></div>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/03/12/screensavers-in-ubuntu-910/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Post via script</title>
		<link>http://karlherrick.com/dev/2010/03/11/post-via-script/</link>
		<comments>http://karlherrick.com/dev/2010/03/11/post-via-script/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 02:47:25 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/03/11/post-via-script/</guid>
		<description><![CDATA[I just whipped up some PHP and threw it in the root of a brand new Wordpress 2.9.2 install:
&#60;?php
include_once&#40;&#39;wp-config.php&#39;&#41;;
include_once&#40;&#39;wp-load.php&#39;&#41;;
include_once&#40;&#39;wp-includes/wp-db.php&#39;&#41;;
$my_post = array&#40;&#41;;
$my_post&#91;&#39;post_title&#39;&#93; = &#39;My post&#39;;
$my_post&#91;&#39;post_content&#39;&#93; = &#39;This is my post.&#39;;
$my_post&#91;&#39;post_status&#39;&#93; = &#39;publish&#39;;
$my_post&#91;&#39;post_author&#39;&#93; = 1;
wp_insert_post&#40; $my_post &#41;;
?&#62;
Voila. The post appeared when navigating to the .php file.
See: http://codex.wordpress.org/Function_Reference/wp_insert_post.
For more creativity, get into the database: http://codex.wordpress.org/Function_Reference/wpdb_Class
]]></description>
			<content:encoded><![CDATA[<p>I just whipped up some PHP and threw it in the root of a brand new Wordpress 2.9.2 install:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #b1b100;">include_once</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;wp-config.php&#39;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #b1b100;">include_once</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;wp-load.php&#39;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #b1b100;">include_once</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#39;wp-includes/wp-db.php&#39;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p><span style="color: #0000ff;">$my_post</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$my_post</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;post_title&#39;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&#39;My post&#39;</span>;<br />
<span style="color: #0000ff;">$my_post</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;post_content&#39;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&#39;This is my post.&#39;</span>;<br />
<span style="color: #0000ff;">$my_post</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;post_status&#39;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&#39;publish&#39;</span>;<br />
<span style="color: #0000ff;">$my_post</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#39;post_author&#39;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">1</span>;</p>
<p>wp_insert_post<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$my_post</span> <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div>
<p>Voila. The post appeared when navigating to the .php file.</p>
<p>See: <a href="http://codex.wordpress.org/Function_Reference/wp_insert_post">http://codex.wordpress.org/Function_Reference/wp_insert_post</a>.</p>
<p>For more creativity, get into the database: <a href="http://codex.wordpress.org/Function_Reference/wpdb_Class">http://codex.wordpress.org/Function_Reference/wpdb_Class</a></p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/03/11/post-via-script/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Buzz</title>
		<link>http://karlherrick.com/dev/2010/02/10/google-buzz/</link>
		<comments>http://karlherrick.com/dev/2010/02/10/google-buzz/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 02:20:14 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Google]]></category>

		<category><![CDATA[Culture]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/02/10/google-buzz/</guid>
		<description><![CDATA[I heard about Google Buzz on CBC Radio yesterday&#8230; came home and tried to connect but it wasn&#8217;t activated. What&#8217;s all this Buzz about? Today, while using Gmail, I noticed the icon for it, opened it up, and added some &#8220;connected sites&#8221;. I&#8217;ve already had two conversations about a picture of a turtle I took [...]]]></description>
			<content:encoded><![CDATA[<p>I heard about <a href="http://www.google.com/buzz">Google Buzz</a> on CBC Radio yesterday&#8230; came home and tried to connect but it wasn&#8217;t activated. What&#8217;s all this Buzz about? Today, while using <a href="http://mail.google.com/">Gmail</a>, I noticed the icon for it, opened it up, and added some &#8220;connected sites&#8221;. I&#8217;ve already had two conversations about a picture of a turtle I took a few years back. Awesome.</p>
<p>Seems easier to use than <a href="http://www.facebook.com/">Facebook</a> too.</p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/02/10/google-buzz/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Recursive find and replace</title>
		<link>http://karlherrick.com/dev/2010/02/08/recursive-find-and-replace/</link>
		<comments>http://karlherrick.com/dev/2010/02/08/recursive-find-and-replace/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 21:42:55 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Hosting]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/02/08/recursive-find-and-replace/</guid>
		<description><![CDATA[From time to time I find myself wanting to replace a bit of text, in multiple files, throughout a huge directory tree (particularly in the case of a Wordpress migration).
Here&#8217;s a method I frequently use (other examples I&#8217;ve seen out there make use of perl, xargs, grep, etc.):
user@host:~$ cd Directory_To_Start_From
user@host:~$ find . -type f -exec [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time I find myself wanting to replace a bit of text, in multiple files, throughout a huge directory tree (particularly in the case of a <a href="http://wordpress.org/">Wordpress</a> migration).</p>
<p>Here&#8217;s a method I frequently use (other examples I&#8217;ve seen out there make use of perl, xargs, grep, etc.):</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">user@host:~$ cd Directory_To_Start_From<br />
user@host:~$ find . -type f -<a href="http://www.php.net/exec"><span style="color: #000066;">exec</span></a> sed -i <span style="color: #ff0000;">&#39;s/Text_To_Find/Replacement_Text/g&#39;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span> \;</div>
<p>The find command will return a list of all the files in the directory tree and execute the sed command on each one it locates. In the example below, I added the &#8220;-name&#8221; option to the find command to allow for working only on files with the .js extension:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">user@host:~$ cd website<br />
user@host:~$ find . -type f -name <span style="color: #ff0000;">&quot;*.js&quot;</span> -<a href="http://www.php.net/exec"><span style="color: #000066;">exec</span></a> sed -i <span style="color: #ff0000;">&#39;s/var pageName=&quot;example page&quot;;/var pageName=&quot;Final Page&quot;;/g&#39;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span> \;</div>
<p>In the next one, the text to find and replace has special characters (in this case the &#8216;/&#8217; in the URL).</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">user@host:~$ cd website<br />
user@host:~$ find . -type f -<a href="http://www.php.net/exec"><span style="color: #000066;">exec</span></a> sed -i <span style="color: #ff0000;">&#39;s/http:<span style="color: #000099; font-weight: bold;">\/</span><span style="color: #000099; font-weight: bold;">\/</span>www.example.com<span style="color: #000099; font-weight: bold;">\/</span>old_directory<span style="color: #000099; font-weight: bold;">\/</span>/http:<span style="color: #000099; font-weight: bold;">\/</span><span style="color: #000099; font-weight: bold;">\/</span>newsubdomain.example.com<span style="color: #000099; font-weight: bold;">\/</span>new_directory<span style="color: #000099; font-weight: bold;">\/</span>/g&#39;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span> \;</div>
<p>See the following links to read more about escaping special characters:</p>
<ul>
<li><a href="http://www.bash-hackers.org/wiki/doku.php/syntax/quoting">Bash Hackers Wiki - Quotes and escaping</a></li>
<li><a href="http://steve-parker.org/sh/escape.shtml">Unix / Linux Shell Scripting Tutorial - Escape Characters</a></li>
<li><a href="http://tldp.org/LDP/abs/html/quoting.html">Advanced Bash-Scripting Guide</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/02/08/recursive-find-and-replace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sloppiness at 1and1</title>
		<link>http://karlherrick.com/dev/2010/02/03/sloppiness-at-1and1/</link>
		<comments>http://karlherrick.com/dev/2010/02/03/sloppiness-at-1and1/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 20:07:07 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Culture]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Hosting]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/02/03/sloppiness-at-1and1/</guid>
		<description><![CDATA[So I have been noticing issues with 1and1 again. Yesterday when trying to get into my hosting control panel at admin.and1.com, I received a &#8220;HTTP Error 503 Service unavailable&#8221; error, and thought to myself&#8230; really, on the admin panel&#8230; really?
Today while checking out my own site, I noticed that all of the PHP files I [...]]]></description>
			<content:encoded><![CDATA[<p>So I have been noticing issues with <a href="http://1and1.com">1and1</a> again. Yesterday when trying to get into my hosting control panel at <a href="http://admin.1and1.com/">admin.and1.com</a>, I received a &#8220;<a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_Server_Error">HTTP Error 503 Service unavailable</a>&#8221; error, and thought to myself&#8230; really, on the admin panel&#8230; really?</p>
<p>Today while checking out my own site, I noticed that all of the PHP files I tried browsing to returned &#8220;<a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_Server_Error">500 Internal Server Error</a>&#8221; errors.</p>
<p>Now this has gone too far&#8230; so I called them up. At first the person I talked to explained that I needed to force PHP5 using a .htaccess file, and proceeded to tell me that they could make the change for me. Calmly, I responded by saying that I did not want a change, and that it had been working fine the way it was for months.</p>
<p>She put me on hold, and while I waited&#8230; it started working. She told me that the shared hosting server &#8220;had a glitch&#8221;.</p>
<p>Afterwards, I ssh&#8217;ed into my server. Look what I found:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span>uiserver<span style="color: #66cc66;">&#41;</span>:uXXXXXXXX:~ &gt; ls -al<br />
total XX<br />
-rw-r&#8211;r&#8211; &nbsp;<span style="color: #cc66cc;">1</span> uXXXXXXXX XXXXXXXX &nbsp; <span style="color: #cc66cc;">16</span> Feb &nbsp;<span style="color: #cc66cc;">3</span> <span style="color: #cc66cc;">14</span>:<span style="color: #cc66cc;">06</span> info.php</div>
<p>I thought, &#8220;weird, I didn&#8217;t put that there&#8221;.</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #66cc66;">&#40;</span>uiserver<span style="color: #66cc66;">&#41;</span>:uXXXXXXXX:~ &gt; cat info.php <br />
<span style="color: #000000; font-weight: bold;">&lt;?</span> <a href="http://www.php.net/phpinfo"><span style="color: #000066;">phpinfo</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></div>
<p>Shame on you <a href="http://1and1.com">1and1</a>, for not cleaning up after yourself. Well, I guess you <a href="http://karlherrick.com/dev/2007/07/27/1and1-horror-story/">get what you pay for</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/02/03/sloppiness-at-1and1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Interesting Analytics</title>
		<link>http://karlherrick.com/dev/2010/01/19/interesting-analytics/</link>
		<comments>http://karlherrick.com/dev/2010/01/19/interesting-analytics/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 19:28:28 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/01/19/interesting-analytics/</guid>
		<description><![CDATA[I thought this would be fun to show everyone.

The amount of visitors coming to karlherrick.com is fairly consistent, so I was surprised to see such a spike when I was in a car accident recently. There must be some correlation to draw here.
I am thinking of breaking my leg next week to drive the traffic [...]]]></description>
			<content:encoded><![CDATA[<p>I thought this would be fun to show everyone.</p>
<p><a href='http://karlherrick.com/dev/wp-content/uploads/2010/01/analytics_accident.jpg' title='Accident Analytics'><img src='http://karlherrick.com/dev/wp-content/uploads/2010/01/analytics_accident.thumbnail.jpg' alt='Accident Analytics' /></a></p>
<p>The amount of visitors coming to <a href="http://karlherrick.com">karlherrick.com</a> is fairly consistent, so I was surprised to see such a spike when I was in a <a href="http://karlherrick.com/blog/2010/01/accident-at-allan-park/">car accident</a> recently. There must be some correlation to draw here.</p>
<p>I am thinking of breaking my leg next week to drive the traffic back up. <img src='http://karlherrick.com/dev/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Just kidding.</p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/01/19/interesting-analytics/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Switching MySQL Databases on 1and1</title>
		<link>http://karlherrick.com/dev/2010/01/14/switching-mysql-databases-on-1and1/</link>
		<comments>http://karlherrick.com/dev/2010/01/14/switching-mysql-databases-on-1and1/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 20:51:59 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[Backups]]></category>

		<category><![CDATA[Apple]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Hosting]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/01/14/switching-mysql-databases-on-1and1/</guid>
		<description><![CDATA[After wanting to test Wordpress 3.0 on a 1and1 hosting account, I ran into the following issue&#8230; the particular setup I was dealing with had only one database available, and it wasn&#8217;t MySQL 5, but instead MySQL 4&#8230; furthermore, it was a version lower than 4.1.2, which more recent versions of Wordpress require as a [...]]]></description>
			<content:encoded><![CDATA[<p>After wanting to test Wordpress 3.0 on a 1and1 hosting account, I ran into the following issue&#8230; the particular setup I was dealing with had only one database available, and it wasn&#8217;t MySQL 5, but instead MySQL 4&#8230; furthermore, it was a version lower than 4.1.2, which more recent versions of Wordpress require as a minimum.</p>
<p>So after doing a bit of research on <a href="http://www.expand2web.com/blog/wordpress-2-9-upgrade-mysql/">what others had done</a>, I went about fixing the problem. Interestingly enough, 1and1 could have made some money in this situation if they would allow customers to simply purchase another database to add to their packages, but no, they want an entire upgrade to be purchased.</p>
<p>The first step was to backup the website and database. I ssh&#8217;ed into the web host:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@localhostname:~$ ssh <span style="color: #0000ff;">$username</span>@example.com</div>
<p>Then I backed up the database. The command below will dump all of the databases on the host (in this case, only one MySQL 4.x database) into a dated bzip file, in the home directory.</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@remotehostname:~$ mysqldump -C -A -u <span style="color: #0000ff;">$databaseUsername</span> -h <span style="color: #0000ff;">$databaseHostName</span> -p<span style="color: #0000ff;">$databasePassword</span> | bzip2 -cq9 &gt; ~/`<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a> +%F-%I-%M-%p`-db-backup.sql.bz2</div>
<p>Now to backup the site itself (not only in case disaster struck, but this would get a local copy of the sql dump I just made as well). On a local OS X workstation (or Ubuntu, if that suits your tastes) I ran something similar to the following:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@localhostname:~$ <a href="http://www.php.net/mkdir"><span style="color: #000066;">mkdir</span></a> ~/website_backups<br />
username@localhostname:~$ rsync -avz &#8211;exclude=<span style="color: #ff0000;">&quot;logs&quot;</span> <span style="color: #0000ff;">$username</span>@example.com: ~/website_backups/</div>
<p>From there, I was able to log into the 1and1 control panel and delete the existing database. This allowed me to setup a new one, and in particular, choose MySQL 4 or 5 as the type.</p>
<p>Back to the 1and1 hosting account:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@localhostname:~$ ssh <span style="color: #0000ff;">$username</span>@example.com</div>
<p>I uncompressed the sql dump:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@remotehostname:~$ bunzip2 <span style="color: #cc66cc;">2010</span><span style="color: #cc66cc;">-01</span><span style="color: #cc66cc;">-14</span><span style="color: #cc66cc;">-01</span><span style="color: #cc66cc;">-59</span>-PM-db-backup.sql.bz2</div>
<p>and was greeted with the raw sql in the file, &#8220;2010-01-14-01-59-PM-db-backup.sql&#8221;. From here it was only a hop skip and a jump away to restoration. It was necessary to edit the sql file in order to have it restore properly to the newly created database that was just created:</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@remotehostname:~$ nano -w <span style="color: #cc66cc;">2010</span><span style="color: #cc66cc;">-01</span><span style="color: #cc66cc;">-14</span><span style="color: #cc66cc;">-01</span><span style="color: #cc66cc;">-59</span>-PM-db-backup.sql</div>
<p>And I changed the $oldDatabaseName to $newDatabaseName.</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">&#8211;<br />
&#8211; <a href="http://www.php.net/current"><span style="color: #000066;">Current</span></a> Database: `<span style="color: #0000ff;">$oldDatabaseName</span>`<br />
&#8211;</p>
<p>CREATE DATABASE <span style="color: #808080; font-style: italic;">/*!32312 IF NOT EXISTS*/</span> `<span style="color: #0000ff;">$oldDatabaseName</span>`;</p>
<p>USE `<span style="color: #0000ff;">$oldDatabaseName</span>`;</div>
<p><em>ctrl+o, enter, and ctrl+x</em>, to save the file and exit nano. The sql dump was now ready to restore to the new database.</p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">username@remotehostname:~$ <a href="http://www.php.net/mysql"><span style="color: #000066;">mysql</span></a> -u <span style="color: #0000ff;">$databaseUsername</span> -h <span style="color: #0000ff;">$databaseHostName</span> -p<span style="color: #0000ff;">$databasePassword</span> <span style="color: #0000ff;">$databaseName</span> &lt; <span style="color: #cc66cc;">2010</span><span style="color: #cc66cc;">-01</span><span style="color: #cc66cc;">-14</span><span style="color: #cc66cc;">-01</span><span style="color: #cc66cc;">-59</span>-PM-db-backup.sql</div>
<p>The only other things to do were to update any existing applications that needed the new database name, username, hostname, and password.</p>
<p>As a note, if you are updating a Wordpress install to point to a new database, this info can be changed in the file, <em>wp-config.php</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/01/14/switching-mysql-databases-on-1and1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WDS Bridging Experiences</title>
		<link>http://karlherrick.com/dev/2010/01/07/wds-bridging-experiences/</link>
		<comments>http://karlherrick.com/dev/2010/01/07/wds-bridging-experiences/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 18:43:04 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Wireless]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/01/07/wds-bridging-experiences/</guid>
		<description><![CDATA[At the moment, our best solution for network coverage to multiple buildings is wireless. I have been planning out various solutions to improve our system (fiber optics, dslam, or a better wireless setup) but wanted to share what we have now and how well it has worked in this particular area of our property.

The image [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment, our best solution for network coverage to multiple buildings is wireless. I have been planning out various solutions to improve our system (<a href="http://en.wikipedia.org/wiki/Fiber-optic_communication">fiber optics</a>, <a href="http://en.wikipedia.org/wiki/Dslam">dslam</a>, or a better wireless setup) but wanted to share what we have now and how well it has worked in this particular area of our property.</p>
<p><a href='http://karlherrick.com/dev/wp-content/uploads/2010/01/wds_repeating_map.jpg' title='WDS Repeating Map'><img src='http://karlherrick.com/dev/wp-content/uploads/2010/01/wds_repeating_map.thumbnail.jpg' alt='WDS Repeating Map' /></a></p>
<p>The image above shows the main buildings that are being linked. The main router sits in an upstairs window and is a:</p>
<p><strong>Linksys WRT300N</strong></p>
<ul>
<li>Runs DD-WRT V24 - SP2 (Beta)</li>
<li>Has original antennas</li>
<li>Has the following properties set (among others, these are the interesting ones)</li>
<ul>
<li>Wireless - Basic Settings</li>
<ul>
<li>Mode: AP</li>
<li>Network Mode: BG-Mixed</li>
<li>Channel: 11 - 2.462 GHz</li>
<li>SSID Brodcast: Enable</li>
</ul>
</ul>
<ul>
<li>Wireless - Advanced Settings</li>
<ul>
<li>TX Power: 71</li>
</ul>
</ul>
<ul>
<li>Wireless - Security</li>
<ul>
<li>Security Mode: WEP (<em>I haven&#8217;t tested WPA2 with WDS yet, and I understand that WEP can be cracked easily</em>)</li>
</ul>
</ul>
<ul>
<li>Wireless - WDS</li>
<ul>
<li>The three router&#8217;s MAC addresses are filled in, and are set to &#8220;LAN&#8221;</li>
</ul>
</ul>
</ul>
<p>The three client WDS routers are also sitting in windows, and are on the first level of the buildings that they are in. They repeat the same SSID, and run on channel 11.</p>
<p><strong>Buffalo WLI-TX4-G54HP</strong></p>
<ul>
<li>Originally purchased as an ethernet bridge, it is now running DD-WRT V24 - SP2 (Beta)</li>
<li>Replaced the stock antenna with a 9 dBi omni-directional</li>
<li>Is on the 72.6m link</li>
</ul>
<p><strong>(2) Belkin F5D7230-4 routers</strong></p>
<ul>
<li>WDS on the stock firmware works with DD-WRT, sweet!</li>
<li>These are unmodified, running with their tiny fixed (two) omni-directional antennas</li>
<li>One is on the 35.4m link, and the other on the 88.5m link</li>
</ul>
<p>This setup has been going for weeks without an issue, and has served upwards of six families, a two person office, a fifteen to twenty person office, and a classroom with sixteen students.</p>
<p>We have other areas on the same property that have wireless access between buildings, but are nowhere near as complete as this arrangement. If we do end up using wireless to unify the property&#8217;s networks, then I will start looking into site to site links, multiple gateways, <a href="http://www.olsr.org/">OLSR</a>, and other mesh technologies. I have my doubts as to how well WDS scales. Has anyone had positive results with professional mesh solutions built on DD-WRT and Linksys hardware?</p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/01/07/wds-bridging-experiences/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Time Machine Size Limits</title>
		<link>http://karlherrick.com/dev/2010/01/02/time-machine-size-limits/</link>
		<comments>http://karlherrick.com/dev/2010/01/02/time-machine-size-limits/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 22:11:19 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Backups]]></category>

		<category><![CDATA[Apple]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2010/01/02/time-machine-size-limits/</guid>
		<description><![CDATA[So I have this new My Book World Edition, and I set it up to allow for Time Machine backups. The problem? On OS X, Time Machine wants to eat up almost the entire amount of free space before it goes about deleting old files&#8230; (un)conveniently there is no option to restrict the size of [...]]]></description>
			<content:encoded><![CDATA[<p>So I have this new My Book World Edition, and I set it up to allow for Time Machine backups. The problem? On OS X, Time Machine wants to eat up almost the entire amount of free space before it goes about deleting old files&#8230; (un)conveniently there is no option to restrict the size of the backups.</p>
<p>Never fear&#8230; I google&#8217;d a bunch and found that if you run the following command on the Mac doing the backups: </p>
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">defaults write /Library/Preferences/com.apple.TimeMachine MaxSize <span style="color: #cc66cc;">209715200</span></div>
<p>It doesn&#8217;t appear to do anything (or may possibly do something else that isn&#8217;t related to what I was after). <img src='http://karlherrick.com/dev/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So, I went about it in a different manner. If I clicked on the Time Machine icon (rotating clock) in the menu bar, and clicked &#8220;Enter Time Machine&#8221;&#8230; exited the GUI of Time Machine, and then opened terminal, I could do the following:</p>
<ol>
<li>Become root:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">sudo -s</div>
</li>
<li>Goto the /Volumes directory, and look for which folder is mounted for Time Machine backups:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">cd /Volumes &amp;&amp; ls -l</div>
</li>
<li>Enter the folder that is mounted for Time Machine backups:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">cd <span style="color: #0000ff;">$Mount_Point_For_Backups</span></div>
</li>
<li>Look for the .sparsebundle file that is being used for backing up the workstation:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">ls -l</div>
</li>
<li>Resize the sparsebundle file:
<div class="php" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">hdiutil resize -size 200g <span style="color: #0000ff;">$hostname</span>.sparsebundle</div>
</li>
</ol>
<p>The sparse image is then resized, and Time Machine will report that there is only around 200 gigabytes total available space rather than around a terabyte (which is the original size of the drive). <img src='http://karlherrick.com/dev/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2010/01/02/time-machine-size-limits/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MBWE SSH access</title>
		<link>http://karlherrick.com/dev/2009/12/28/mbwe-ssh-access/</link>
		<comments>http://karlherrick.com/dev/2009/12/28/mbwe-ssh-access/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 00:14:42 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2009/12/28/mbwe-ssh-access/</guid>
		<description><![CDATA[Just setting up a My Book World Edition (1TB, WDH1NC10000) and would recommend the following steps after purchase for SSH access:

Login to the MBWE&#8217;s &#8220;Network Storage Manager&#8221; by typing the unit&#8217;s IP address into a web browser and then authenticating with a valid username and password
Click the &#8220;Advanced Mode&#8221; link
Click the &#8220;Advanced&#8221; icon
Check the &#8220;Enable&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Just setting up a My Book World Edition (1TB, WDH1NC10000) and would recommend the following steps after purchase for SSH access:</p>
<ul>
<li>Login to the MBWE&#8217;s &#8220;Network Storage Manager&#8221; by typing the unit&#8217;s IP address into a web browser and then authenticating with a valid username and password</li>
<li>Click the &#8220;Advanced Mode&#8221; link</li>
<li>Click the &#8220;Advanced&#8221; icon</li>
<li>Check the &#8220;Enable&#8221; checkbox under the &#8220;SSH Access&#8221; area</li>
<li>Click the &#8220;Submit&#8221; button
</ul>
<p>Now SSH into the MBWE using the username, &#8220;root&#8221;, with the default password, &#8220;welc0me&#8221;. After logging in, be sure to change passwords for the root user by issuing the command, &#8220;passwd&#8221;.</p>
<p>A few other things I noticed were necessary, if you want ssh access via public key authentication:</p>
<ul>
<li>Copy the contents of the public key file from the client (usually <span style="font-style: italic;">~/.ssh/id_dsa.pub</span>) to the MBWE on a new line under /root/.ssh/authorized_keys</li>
<li>Login as root to the MBWE and issue the following command in the terminal: &#8220;<span style="font-style: italic;">chmod go-w ~/</span>&#8220;. This was neccessary as when I tried to authenticate via public key, I was getting the following in <span style="font-style: italic;">/var/log/messages</span> if I didn&#8217;t, &#8220;<span style="font-style: italic;">Authentication refused: bad ownership or modes for directory /root</span>&#8220;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2009/12/28/mbwe-ssh-access/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Office Compatibility</title>
		<link>http://karlherrick.com/dev/2009/11/20/office-compatibility/</link>
		<comments>http://karlherrick.com/dev/2009/11/20/office-compatibility/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 14:51:04 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Apple]]></category>

		<category><![CDATA[OpenOffice]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2009/11/20/office-compatibility/</guid>
		<description><![CDATA[OpenOffice or Microsoft Office. Use either. It&#8217;s like OS X vs. Linux&#8230; whatever tool that is best for the job right?
Here&#8217;s how you can make the two play a little nicer&#8230;
OpenOffice

Already reads and writes .docx, .xlsx, and .pptx (admittedly the .pptx support isn&#8217;t near as developed as the previous two formats mentioned, from my experiences [...]]]></description>
			<content:encoded><![CDATA[<p>OpenOffice or Microsoft Office. Use either. It&#8217;s like OS X vs. Linux&#8230; whatever tool that is best for the job right?</p>
<p>Here&#8217;s how you can make the two play a little nicer&#8230;</p>
<p><strong>OpenOffice</strong></p>
<ul>
<li>Already reads and writes .docx, .xlsx, and .pptx (admittedly the .pptx support isn&#8217;t near as developed as the previous two formats mentioned, from my experiences at least)</li>
<li>Download and install the following: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=1CD6ACF9-CE06-4E1C-8DCF-F33F669DBC3A&#038;displaylang=en">Excel Viewer</a>, <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3657ce88-7cfa-457a-9aec-f4f827f20cac&#038;displaylang=en">Word Viewer</a>, and <a href="http://www.microsoft.com/downloads/details.aspx?familyid=048dc840-14e1-467d-8dca-19d2a8fd7485&#038;displaylang=en">PowerPoint Viewer 2007</a></li>
<li>Download and install the following: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&#038;displaylang=en">Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats</a></li>
</ul>
<p><strong>Users with older versions of Microsoft Office Products, including Word 2000/2002/2003, Excel 2000/2002/2003, PowerPoint 2000/2002/2003)</strong></p>
<ul>
<li>Make sure your office products are updated with the latest service packs if any are available (check <a href="http://update.microsoft.com/">Microsoft Update</a>)</li>
<li>Download and install the following: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&#038;displaylang=en">Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats</a></li>
<li>Download and install the following: <a href="http://www.sun.com/software/star/odf_plugin/">Sun ODF Plugin for Microsoft Office</a></li>
</ul>
<p><strong>Users of Microsoft Office 2007</strong></p>
<ul>
<li>Download and install the following: <a href="http://www.sun.com/software/star/odf_plugin/">Sun ODF Plugin for Microsoft Office</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2009/11/20/office-compatibility/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Renaming MP3s in Bash</title>
		<link>http://karlherrick.com/dev/2009/11/17/renaming-mp3s/</link>
		<comments>http://karlherrick.com/dev/2009/11/17/renaming-mp3s/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 15:01:26 +0000</pubDate>
		<dc:creator>Karl Herrick</dc:creator>
		
		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://karlherrick.com/dev/2009/11/17/renaming-mp3s/</guid>
		<description><![CDATA[It seems like this comes up every now and again, but I end up forgetting how to do it. So, I will post the example here, where it will live forever on the intarwebs.
While there are a ton of ways to script this, using Bash, cut, ls, find, grep, sed, awk, perl, etc&#8230; In this [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like this comes up every now and again, but I end up forgetting how to do it. So, I will post the example here, where it will live forever on the intarwebs.</p>
<p>While there are a ton of ways to script this, using Bash, cut, ls, find, grep, sed, awk, perl, etc&#8230; In this particular instance, I find myself with a directory of about fifty files, each named in the following manner&#8230;</p>
<ol>
<li>01 Song Title.mp3</li>
<li>02 Another Song Title.mp3</li>
<li>02 Same Number Song Title.mp3</li>
<li>03 Author - Title.mp3</li>
</ol>
<p>Bash and cut to the rescue. The following code provides for each file in the current directory to have the number stripped off of the front, even it has <a href="http://mindspill.net/computing/linux-notes/using-the-bash-ifs-variable-to-make-for-loops-split-with-non-whitespace-characters.html">spaces in the filename</a>.</p>
<div class="bash" style="font-family: monospace;font-size: 110%; color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #808080; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #007800;">SAVEIFS=</span><span style="color: #007800;">$IFS</span><br />
<span style="color: #007800;">IFS=</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> -en <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\b</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> *; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #ff0000;">&quot;$f&quot;</span> <span style="color: #ff0000;">&quot;$(echo $f | cut -c 4-)&quot;</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<span style="color: #007800;">IFS=</span><span style="color: #007800;">$SAVEIFS</span></div>
]]></content:encoded>
			<wfw:commentRss>http://karlherrick.com/dev/2009/11/17/renaming-mp3s/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
