
<?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>Bryce McDonnell &#124;&#124; Freelance Web Application Developer &#187; HowTo</title>
	<atom:link href="http://www.brycemcdonnell.com/skills-and-expert-groups/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brycemcdonnell.com</link>
	<description>bryce mcdonnell is a freelance web application developer specializing in PHP, Ruby on Rails and MySQL</description>
	<lastBuildDate>Fri, 26 Feb 2010 18:18:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mootools content slider &#8211; javascript</title>
		<link>http://www.brycemcdonnell.com/2009/03/mootools-content-slider-javascript/</link>
		<comments>http://www.brycemcdonnell.com/2009/03/mootools-content-slider-javascript/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 00:32:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Stuff I'm Working On]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[content slider]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.brycemcdonnell.com/?p=77</guid>
		<description><![CDATA[
This is an old version of an improved Mootools Content Slider

I recently implemented a javascript based slider using MooTools. I&#8217;m increasingly becoming a huge fan of Mootools. Their documentation is great and the code I write just seems to be much cleaner. I don&#8217;t feel like it&#8217;s as fragile as js I&#8217;ve written in prototype/scriptaculous.
The [...]]]></description>
			<content:encoded><![CDATA[<div style="padding:20px; margin:10px; border:3px solid #FF0; background-color: #CCC">
<h2><span style="color: #000000;">This is an old version of an improved <a title="improved mootools content slider" href="http://blog.brycemcdonnell.com/improved-content-slider-in-mootools/">Mootools Content Slider</a></span></h2>
</div>
<p>I recently implemented a javascript based slider using <a href="http://mootools.net">MooTools</a>. I&#8217;m increasingly becoming a huge fan of <a href="http://mootools.net">Mootools</a>. Their <a href="http://mootools.net/docs">documentation</a> is great and the code I write just seems to be much cleaner. I don&#8217;t feel like it&#8217;s as fragile as js I&#8217;ve written in prototype/scriptaculous.</p>
<p>The content slider, which I pretty much implemented verbatim using <a href="http://woork.blogspot.com/2009/01/elegant-animated-weekly-timeline-for.html"><strong>Antonio Lupetti&#8217;s</strong></a> great tutorial at <a href="http://woork.blogspot.com/2009/01/elegant-animated-weekly-timeline-for.html">http://woork.blogspot.com/2009/01/elegant-animated-weekly-timeline-for.html</a>.</p>
<p>Antonio&#8217;s tutorial is really great. It is missing two elements which I think improve the code base:<span id="more-77"></span></p>
<p>1) you have to set the number of elements to scroll explicitly</p>
<p>2) it does not handle some crazy user clicking like mad on either the left or right buttons</p>
<p>To solve both those pains, I&#8217;ve updated the code a bit to work with MooTools 1.2 and made a couple of enhancements seen below.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> totIncrement <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> increment <span style="color: #339933;">=</span> <span style="color: #CC0000;">387</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> totalIncrements <span style="color: #339933;">=</span> $$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sliderList li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> 1
<span style="color: #003366; font-weight: bold;">var</span> maxRightIncrement <span style="color: #339933;">=</span> increment<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span> totalIncrements<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> fx <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Tween</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'sliderList'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
   property<span style="color: #339933;">:</span> <span style="color: #3366CC;">'margin-left'</span><span style="color: #339933;">,</span>
   duration<span style="color: #339933;">:</span> 1000<span style="color: #339933;">,</span>
   transition<span style="color: #339933;">:</span> Fx.<span style="color: #660066;">Transitions</span>.<span style="color: #000066;">Back</span>.<span style="color: #660066;">easeInOut</span><span style="color: #339933;">,</span>
   onStart<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slide-left&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeEvents</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slide-right&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeEvents</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
   onComplete<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      appEvent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> appEvent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #006600; font-style: italic;">// Previous Button</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slide-left'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEvents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #3366CC;">'click'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>totIncrement<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>0<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            event.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            totIncrement <span style="color: #339933;">=</span> totIncrement <span style="color: #339933;">+</span> increment<span style="color: #339933;">;</span>
            fx.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>totIncrement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// Next Button</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slide-right'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEvents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #3366CC;">'click'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>totIncrement<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>maxRightIncrement<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            event.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            totIncrement <span style="color: #339933;">=</span> totIncrement <span style="color: #339933;">-</span> increment<span style="color: #339933;">;</span>
            fx.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span>totIncrement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
appEvent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>By encapsulating the right and left click events into its own function, I can easily turn on and off the events to prevent the end user from invoking the slide event in the middle of an event that may already be going on. A shorter way to say that is users can&#8217;t double click.</p>
<p>Secondly, creating the totalIncrements variable allows someone (like me) to add another list element into the markup at a later date without having to remember to update the javascript code.</p>
<p>These are just a couple of tweaks to an otherwise great tutorial. Thanks a lot Antonio and keep up the good work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brycemcdonnell.com/2009/03/mootools-content-slider-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: Securely Backup Your Data Offsite Using Git, OpenSSL and Basic Linux Commands</title>
		<link>http://www.brycemcdonnell.com/2008/12/howto-securely-backup-your-data-offsite-using-git-openssl-and-basic-linux-commands/</link>
		<comments>http://www.brycemcdonnell.com/2008/12/howto-securely-backup-your-data-offsite-using-git-openssl-and-basic-linux-commands/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 07:15:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Stuff I'm Working On]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://blog.brycemcdonnell.com/?p=69</guid>
		<description><![CDATA[I am becoming a better systems administrator every day secondary to my work  as a ruby on rails and PHP developer. As a very small development shop I have very limited resources to perform the backup and recovery policies bigger shops and huge enterprises employ.
However, after just a morning of futzing with a few [...]]]></description>
			<content:encoded><![CDATA[<p>I am becoming a better systems administrator every day secondary to<a href="http://www.brycemcdonnell.com"> my work </a> as a <a href="http://www.rubyonrails.org">ruby on rails</a> and <a href="http://www.php.net">PHP</a> developer. As a very small development shop I have very limited resources to perform the backup and recovery policies bigger shops and huge enterprises employ.</p>
<p>However, after just a morning of futzing with a few key linux commands and better utilizing a service I already back up my source code to (<a href="http://www.github.com">www.github.com</a>) I have a found a robust and secure way to handle automated, off-site, redundant backups in a way that will let me compete with some bigger shops. I&#8217;ve posted the code below so I hope you will find it useful. Over the next few posts, I&#8217;ll unpack what I&#8217;ve written and the philosophy behind it.</p>
<p>A few things bothered me in the way I was doing traditional backups:</p>
<ol>
<li>I knew I had to get them off-site, but actually finding time to get off-site (to a secure location) wasn&#8217;t happening.</li>
<li>The backup had to be absolutely secure. My clients&#8217; source code is too precious and leakage too damaging to make even one mistake with security breach</li>
<li>Had to be simple and automated. I usually have 10 other things I need to do at the same time. I didn&#8217;t want backups to be number 11.</li>
<li>Small file size. Again, being a small dev shop, I didn&#8217;t want to put a lot of cost into storage of incremental backups</li>
<li>Incremental backups were key since I don&#8217;t want to go to all this trouble only to restore a copy of the bad data I was trying to replace. If I a problem isn&#8217;t made known until after the next set of backups are made, I&#8217;d be overwriting bad data with bad data; better to restore to the point before the problem happened.</li>
</ol>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#!/usr/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#backupdb</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;======================================&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;backing up database&quot;</span>
mysqldump <span style="color: #660033;">-u</span> backup <span style="color: #660033;">--all-databases</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>alldatabases.sql
&nbsp;
<span style="color: #666666; font-style: italic;">#tar and compress the directories really hacky and should either make a file for exclusions or just get rid of the crap</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-czvvf</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>bkp<span style="color: #000000; font-weight: bold;">/</span>websqlbkp.tar.gz <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>alldatabases.sql <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/*</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#encrypt that mug and then remove the decrypted file</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;encrypting backup&quot;</span>
openssl des3 <span style="color: #660033;">-salt</span> <span style="color: #660033;">-k</span> supersecret \
        <span style="color: #660033;">-in</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>bkp<span style="color: #000000; font-weight: bold;">/</span>websqlbkp.tar.gz \
        <span style="color: #660033;">-out</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>bkp<span style="color: #000000; font-weight: bold;">/</span>websqlbkpencrypted.tar.gz
&nbsp;
<span style="color: #666666; font-style: italic;">#cleanup files I don't want people to see</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;cleaning up files&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>bkp<span style="color: #000000; font-weight: bold;">/</span>websqlbkp.tar.gz
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>alldatabasesl.sql
&nbsp;
<span style="color: #666666; font-style: italic;">#update the git repo</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;committing to git <span style="color: #780078;">`date`</span> &quot;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>bkp<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;adding to git&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>git add .
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;commiting git&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>git commit <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;commiting backup on <span style="color: #780078;">`date`</span>&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;pushing to github&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>git push origin production</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.brycemcdonnell.com/2008/12/howto-securely-backup-your-data-offsite-using-git-openssl-and-basic-linux-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
