<?xml version="1.0" encoding="utf-8" ?>

<rss version="0.91" >
<channel>
<title>ameir dot net</title>
<link>http://www.ameir.net/blog/</link>
<description>My little place on the web...</description>
<language>en</language>
<image>
        <url>http://www.ameir.net/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: ameir dot net - My little place on the web...</title>
        <link>http://www.ameir.net/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Using rsync with CIFS or SMB (Windows) Destination</title>
    <link>http://www.ameir.net/blog/archives/51-Using-rsync-with-CIFS-or-SMB-Windows-Destination.html</link>

    <description>
        This took me a good bit of reading and trial/error, but here are rsync options that I found to work well with a Windows target (tested with a CIFS mount) from a Linux ext3 filesystem without errors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;rsync &lt;span style=&quot;color: #660033;&quot;&gt;-rvztO&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--progress&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--stats&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--copy-links&lt;/span&gt; &amp;#160;&lt;span style=&quot;color: #660033;&quot;&gt;--dry-run&lt;/span&gt; &amp;#160;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;source&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;path &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;destination&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;path&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
 
    </description>
</item>
<item>
    <title>Bing Site Search in PHP with Pagination</title>
    <link>http://www.ameir.net/blog/archives/49-Bing-Site-Search-in-PHP-with-Pagination.html</link>

    <description>
        This is a simple yet powerful way to get Bing&#039;s Site Search API working on your site in PHP.  Simply update the $config variables below and you&#039;ll be good to go.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;php geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/define&#039;]);&quot;  href=&quot;http://www.php.net/define&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;define&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;TITLE&#039;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;Search Results&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;header.php&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;appid&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;01234567890&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// change this&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;search_domains&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/array&#039;]);&quot;  href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;domain1.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;domain2.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;results_per_page&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$url&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;http://&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$_SERVER[HTTP_HOST]&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$_SERVER[PHP_SELF]&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/isset&#039;]);&quot;  href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;q&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; ? &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;lt;h1&amp;gt;Search&amp;lt;/h1&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;form method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;lt;div style=&amp;quot;text-align:right&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;lt;input type=&amp;quot;text&amp;quot; id=&amp;quot;q&amp;quot; name=&amp;quot;q&amp;quot; value=&amp;quot;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/isset&#039;]);&quot;  href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;q&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; ? &lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;q&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;Search...&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;quot;/&amp;gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Search&amp;quot; name=&amp;quot;submit&amp;quot; id=&amp;quot;searchButton&amp;quot; /&amp;gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/isset&#039;]);&quot;  href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;q&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$query&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/htmlentities&#039;]);&quot;  href=&quot;http://www.php.net/htmlentities&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;htmlentities&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;q&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/strlen&#039;]);&quot;  href=&quot;http://www.php.net/strlen&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;strlen&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;You didn&#039;t type anything!&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/isset&#039;]);&quot;  href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;page&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$page&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/htmlentities&#039;]);&quot;  href=&quot;http://www.php.net/htmlentities&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;htmlentities&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_REQUEST&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;page&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$offset&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$page&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;results_per_page&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$offset&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;http://api.search.live.net/json.aspx?Appid=&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;{$config[&#039;appid&#039;]}&lt;/span&gt;&amp;amp;sources=web&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;amp;query=&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/urlencode&#039;]);&quot;  href=&quot;http://www.php.net/urlencode&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;urlencode&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;site:&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/implode&#039;]);&quot;  href=&quot;http://www.php.net/implode&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;implode&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot; OR site:&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;search_domains&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;amp;Web.Count=&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;{$config[&#039;results_per_page&#039;]}&lt;/span&gt;&amp;amp;Web.Offset=&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$offset&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;//echo $result;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/file_get_contents&#039;]);&quot;  href=&quot;http://www.php.net/file_get_contents&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;file_get_contents&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; json_decode&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;lt;ul ID=&amp;quot;resultList&amp;quot;&amp;gt;&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;SearchResponse&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Web&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Results&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;lt;li class=&amp;quot;resultlistitem&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;&#039;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Url&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;quot;&amp;gt;&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;lt;h3&amp;gt;&#039;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Title&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;lt;p&amp;gt;&#039;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Description&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&amp;lt;/p&amp;gt;&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;lt;/ul&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// &amp;#160; &amp;#160; &amp;#160; &amp;#160;echo(&amp;quot;&amp;lt;pre&amp;gt;&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// &amp;#160; &amp;#160; &amp;#160; &amp;#160;print_r($result);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// &amp;#160; &amp;#160; &amp;#160; &amp;#160;echo(&amp;quot;&amp;lt;/pre&amp;gt;&amp;quot;);&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;SearchResponse&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Web&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Total&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1000&lt;/span&gt; ? &lt;span style=&quot;color: #cc66cc;&quot;&gt;1000&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;SearchResponse&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Web&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;Total&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot; results &amp;lt;br /&amp;gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;Sorry, no results to display. &amp;lt;br /&amp;gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$pages&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;int&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;results_per_page&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// echo &amp;quot;$pages pages &amp;lt;br /&amp;gt;\n&amp;quot;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// pagination&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// &amp;#160; &amp;#160; &amp;#160; &amp;#160;echo &amp;quot;Page #s:&amp;lt;br /&amp;gt;&amp;quot;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$pages&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;lt;a href=&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$url&lt;/span&gt;?q=&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$query&lt;/span&gt;&amp;amp;page=&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$i&lt;/span&gt;&amp;gt;&lt;span style=&quot;color: #006699; font-weight: bold;&quot;&gt;$i&lt;/span&gt;&amp;lt;/a&amp;gt; &amp;#160;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;footer.php&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;  
    </description>
</item>
<item>
    <title>MySQL Backup to FTP and Email Shell Script for Cron v2.2</title>
    <link>http://www.ameir.net/blog/archives/48-MySQL-Backup-to-FTP-and-Email-Shell-Script-for-Cron-v2.2.html</link>

    <description>
        It&#039;s been a while since I&#039;ve publicly made updates to this script, but I did make some tweaks over the years that I&#039;d like to share.&lt;br /&gt;
&lt;br /&gt;
Here are some changes over the last version:&lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt; Delete old backups via FTP&lt;br /&gt;
&lt;li&gt; Backup to multiple FTP servers&lt;br /&gt;
&lt;li&gt; More efficient backups&lt;br /&gt;
&lt;li&gt; Add time in filename (allows for multiple backups/day)&lt;br /&gt;
&lt;li&gt; More verbose/better error detection&lt;br /&gt;
&lt;/ul&gt;&lt;br /&gt;
With that said, follow the link below to download the new version:&lt;br /&gt;
&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/files/mysqlbackup-2.3.sh&#039;]);&quot;  href=&quot;http://www.ameir.net/files/mysqlbackup-2.3.sh&quot;&gt;mysqlbackup-2.3.sh&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You can view the previous version &lt;a href=&quot;http://www.ameir.net/blog/archives/18-MySQL-Backup-to-FTP-and-Email-Shell-Script-for-Cron-v2.1.html&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
If there&#039;s a feature that&#039;s missing that you&#039;d like to see, leave a comment below.&lt;br /&gt;
&lt;br /&gt;
 
    </description>
</item>
<item>
    <title>PHP Function to Return Lowest MX Record</title>
    <link>http://www.ameir.net/blog/archives/46-PHP-Function-to-Return-Lowest-MX-Record.html</link>

    <description>
        This is a quick and simple one, but I admittedly started off with a for loop before coming across array_multisort.  This turned out to be very useful for an application I&#039;m working on.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;php geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// example&lt;/span&gt;&lt;br /&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/echo&#039;]);&quot;  href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;Google&#039;s lowest MX is: &amp;#160;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; lowestmx&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;google.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; lowestmx&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$server&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/getmxrr&#039;]);&quot;  href=&quot;http://www.php.net/getmxrr&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;getmxrr&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$server&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$mxhosts&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.php.net/array_multisort&#039;]);&quot;  href=&quot;http://www.php.net/array_multisort&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array_multisort&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$mxhosts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$mxhosts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;  
    </description>
</item>
<item>
    <title>Yahoo! Mail IMAP Proxy</title>
    <link>http://www.ameir.net/blog/archives/43-Yahoo!-Mail-IMAP-Proxy.html</link>

    <description>
        &lt;p&gt;&lt;br /&gt;
&lt;strong&gt;UPDATE:  It was fun, but this proxy is no longer needed.  You can connect directly to Yahoo! via IMAP with the following servers:&lt;br /&gt;
&lt;br /&gt;
imap.mail.yahoo.com port 993 (SSL)&lt;br /&gt;
smtp.mail.yahoo.com port 465 (SSL)&lt;/strong&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;br /&gt;
There are a few Yahoo! Mail IMAP proxies out there (&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/ypopsemail.com/&#039;]);&quot;  href=&quot;http://ypopsemail.com/&quot;&gt;YPOPS!&lt;/a&gt;, &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.freepops.org/&#039;]);&quot;  href=&quot;http://www.freepops.org/&quot;&gt;FreePOPs&lt;/a&gt;), but to be honest, I haven&#039;t had much luck with either of them. &amp;#160;Additionally, switching webmail interfaces to Asia or Classic or whatever can be a bit of a hassle.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Yahoo! supports IMAP on some mobile devices, and now also allows it for anyone using the Zimbra mail client. &amp;#160;Unfortunately, I&#039;m not too fond of that client and much prefer my Thunderbird; too bad it isn&#039;t natively supported.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Luckily, Yahoo&#039;s IMAP implementation isn&#039;t too far off from what other clients recognize; it simply requires a &amp;quot;ID (&amp;quot;GUID&amp;quot; &amp;quot;1&amp;quot;)&amp;quot; &amp;#160;to be issued before logging in. &amp;#160;No clients do that (&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.crasseux.com/linux/&#039;]);&quot;  href=&quot;http://www.crasseux.com/linux/&quot;&gt;except for these hacked up versions of Thunderbird&lt;/a&gt;), so my workaround was to create a simple IMAP proxy.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;This proxy simply takes the commands sent to it by your mail client, passes them on to Yahoo, and relays them back to your client. &amp;#160;It all the while looks for your client to issue a &amp;quot;login&amp;quot; command so that it can inject the &amp;quot;id&amp;quot; command to unlock IMAP access.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;This program is written in C and has been tested on Linux and Windows (via Cygwin).  Read the release notes in the source for more information. &amp;#160;I haven&#039;t written in C for a while, and I know that this program can be improved. &amp;#160;If anyone does so, I&#039;d like to hear from you.&lt;/p&gt; &lt;br /&gt;
Connection settings:&lt;br /&gt;
Username: yahoo_username@yahoo.com&lt;br /&gt;
Hostname: localhost&lt;br /&gt;
Port: 3490&lt;br /&gt;
SSL: off&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/ymap.googlecode.com/svn/trunk/yahooproxy.c&#039;]);&quot;  href=&quot;http://ymap.googlecode.com/svn/trunk/yahooproxy.c&quot;&gt;Download latest source&lt;/a&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/ymap.googlecode.com/svn/trunk/yahooproxy-win.zip&#039;]);&quot;  href=&quot;http://ymap.googlecode.com/svn/trunk/yahooproxy-win.zip&quot;&gt;Download Windows Cygwin version&lt;/a&gt; &lt;/p&gt; &lt;br /&gt;
&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/code.google.com/p/ymap/&#039;]);&quot;  href=&quot;http://code.google.com/p/ymap/&quot;&gt;View Google Code Homepage&lt;/a&gt;&lt;br /&gt;
&lt;p&gt; &lt;/p&gt; 
    </description>
</item>
<item>
    <title>Installing Windows XP over a Network using PXE</title>
    <link>http://www.ameir.net/blog/archives/42-Installing-Windows-XP-over-a-Network-using-PXE.html</link>

    <description>
        &lt;p&gt;I just spent countless hours trying to revive an old laptop with seemingly no hope left in it. &amp;#160;Its CD-ROM drive is bad, it doesn&#039;t support booting from USB, and it has no floppy drive. &amp;#160;After backing up the hard drive using a USB caddy, I tried countless ways of loading up bootdisks over PXE using MEMDISK and PXELINUX. &amp;#160;I got very close several times, but unfortunately both FreeDOS and MS-DOS failed me. &amp;#160;The closest I got was by partitioning the hard disk such that I had a 1GB FAT partition at the end with the XP installation files copied to it. &amp;#160;Running winnt32.exe from DOS brought me a lot of hope, but also a lot of pain, namely the error &amp;quot;&lt;span style=&quot;color: #000000; font-family: arial, sans-serif; font-size: small; &quot;&gt;&lt;em style=&quot;font-weight: bold; font-style: normal; &quot;&gt;Setup is out of memory and cannot continue.&lt;/em&gt;&lt;/span&gt;&amp;quot; &amp;#160;I hacked away and the config.sys file and kept editing various bootdisks, but no luck in the end. &amp;#160;I tried dozens of things, but I&#039;ll skip that all and get to the good stuff: &amp;#160;how I got it working.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.ameir.net/blog/archives/42-Installing-Windows-XP-over-a-Network-using-PXE.html#extended&quot;&gt;Continue reading &quot;Installing Windows XP over a Network using PXE&quot;&lt;/a&gt;
    </description>
</item>
<item>
    <title>Getting Ubuntu 9.10 Karmic Koala working in OpenVZ</title>
    <link>http://www.ameir.net/blog/archives/41-Getting-Ubuntu-9.10-Karmic-Koala-working-in-OpenVZ.html</link>

    <description>
        &lt;p&gt;If you&#039;re an Ubuntu fan like me and use (or want to use) OpenVZ, you might not be too excited that the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/wiki.openvz.org/Download/template/precreated&#039;]);&quot;  href=&quot;http://wiki.openvz.org/Download/template/precreated&quot;&gt;OpenVZ site&lt;/a&gt; doesn&#039;t yet have the latest edition of Ubuntu, 9.10 Karmic Koala, available as a precreated template. &amp;#160;Luckily, you can find them &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blog.bodhizazen.net/linux/download-ubuntu-9-10-openvz-templates/&#039;]);&quot;  href=&quot;http://blog.bodhizazen.net/linux/download-ubuntu-9-10-openvz-templates/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;For my purposes, I downloaded ubuntu-9.10-minimal_9.10_amd64.tar.gz. &amp;#160;After setting up a virtual instance with Proxmox and opening up a VNC session, I found that this template is way more minimal than I ever expected. &amp;#160;In all reality, that isn&#039;t so bad. &amp;#160;The lighter, the better. &amp;#160;Unfortunately, since I was setting up this new instance as a server, I had a good bit of work ahead of me.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Firstly, networking wasn&#039;t working at all with my bridged setup out of the box. &amp;#160;The solution:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;edit /etc/network/interfaces and configure your NICs. &amp;#160;I had to comment out some properties of the venet0 interface to get things working. &amp;#160;Here&#039;s my final config file:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;auto&amp;#160;lo&lt;br /&gt;
iface&amp;#160;lo&amp;#160;inet&amp;#160;loopback&lt;br /&gt;
auto&amp;#160;eth0&lt;br /&gt;
#&amp;#160;iface&amp;#160;eth0&amp;#160;inet&amp;#160;dhcp&lt;br /&gt;
iface&amp;#160;eth0&amp;#160;inet&amp;#160;static&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;address&amp;#160;10.x.x.x&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;netmask&amp;#160;255.255.255.0&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;gateway&amp;#160;10.x.x.y&lt;br /&gt;
&lt;br /&gt;
auto&amp;#160;venet0&lt;br /&gt;
iface&amp;#160;venet0&amp;#160;inet&amp;#160;static&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;address&amp;#160;127.0.0.1&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;netmask&amp;#160;255.255.255.255&lt;/div&gt;&amp;#160;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Notice that I&#039;m using a static IP address. &amp;#160;You may want to try DHCP starting out since it&#039;ll make things easier. &amp;#160;Confirm network connectivity by pinging a remote host. &amp;#160;Don&#039;t forget to edit&amp;#160;/etc/resolv.conf if you need to.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Now, I need to get some goodies installed on this thing. &amp;#160;In the end, I&#039;m looking to install &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.virtualmin.com/&#039;]);&quot;  href=&quot;http://www.virtualmin.com/&quot;&gt;Virtualmin&lt;/a&gt; and host some websites, so I need to prep for that. &amp;#160;Luckily, Ubuntu makes it easy to get things started quickly. &amp;#160;Start off by issuing:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;br /&gt;
&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get&lt;/span&gt; update &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; tasksel &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; tasksel&lt;/div&gt;&lt;br /&gt;
&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;An ncurses dialog should appear. &amp;#160;Go ahead and select what you need. &amp;#160;I can tell you that I learned the very hard way by not initially selecting &amp;quot;Basic Ubuntu Server.&amp;quot; &amp;#160;If you don&#039;t select that (don&#039;t worry, it&#039;s only a couple of small packages), none of your services will start at boot-time and you&#039;ll have to start&amp;#160;each of&amp;#160;them manually.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;From there, you should be on your way. &amp;#160;I strongly recommend &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.webmin.com/deb.html&#039;]);&quot;  href=&quot;http://www.webmin.com/deb.html&quot;&gt;Webmin&lt;/a&gt;&amp;#160;(add the apt repo)&amp;#160;to ease server administration tasks.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Also, before I leave you be, if you&#039;re not using &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/pve.proxmox.com/wiki/Main_Page&#039;]);&quot;  href=&quot;http://pve.proxmox.com/wiki/Main_Page&quot;&gt;Proxmox&lt;/a&gt; to perform all of this OpenVZ magic, you&#039;re definitely missing out. &amp;#160;Hurry up and convert already!&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; 
    </description>
</item>
<item>
    <title>Setting up Virtualmin on Ubuntu 9.10 Karmic Koala</title>
    <link>http://www.ameir.net/blog/archives/40-Setting-up-Virtualmin-on-Ubuntu-9.10-Karmic-Koala.html</link>

    <description>
        &lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.virtualmin.com/os-support&#039;]);&quot;  href=&quot;http://www.virtualmin.com/os-support&quot;&gt;According to the Virtualmin website&lt;/a&gt;, the latest version of Ubuntu that is supported is 8.04 LTS. &amp;#160;That&#039;s probably a safe stance to take since non-LTS versions of Ubuntu have a six-month lifecycle, and most serious hosting companies would stick with LTS versions. &amp;#160;For those of us who live on the bleeding edge and want to try Virtualmin on the latest version of Ubuntu, 9.10 (Karmic Koala), you&#039;ll find that the standard method of installation (&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.virtualmin.com/download&#039;]);&quot;  href=&quot;http://www.virtualmin.com/download&quot;&gt;the install.sh script on their site&lt;/a&gt;) will fail.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Luckily, the solution is simple. &amp;#160; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Add the following repository to your sources.list file:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;deb http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;software.virtualmin.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gpl&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian virtualmin-universal main&lt;/div&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Then run the following as root:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;root &lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;software.virtualmin.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;RPM-GPG-KEY-virtualmin&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;software.virtualmin.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;RPM-GPG-KEY-webmin&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-key&lt;/span&gt; add RPM-GPG-KEY-virtualmin&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-key&lt;/span&gt; add RPM-GPG-KEY-webmin&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get&lt;/span&gt; update ; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; webmin webmin-virtual-server&lt;/div&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Webmin and Virtualmin will now be installed. &amp;#160;Note that the repository may not be as up-to-date as the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/download.webmin.com/download/virtualmin/?C=M;O=D&#039;]);&quot;  href=&quot;http://download.webmin.com/download/virtualmin/?C=M;O=D&quot;&gt;direct download link&lt;/a&gt;. &amp;#160;If that scenario arises, simply find the URL of the latest Virtualmin package from the link, and do:&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;download.webmin.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;download&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;virtualmin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;webmin-virtual-server_3.77.gpl_all.deb ; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;dpkg&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-i&lt;/span&gt; webmin-virtual-server_3.77.gpl_all.deb&lt;/div&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; 
    </description>
</item>
<item>
    <title>Cheapest SSL Certificates</title>
    <link>http://www.ameir.net/blog/archives/39-Cheapest-SSL-Certificates.html</link>

    <description>
        &lt;p&gt;Interested in securing your website? &amp;#160;There are several types of certificates out there at wildly varying prices, but they all provide exactly the same function--encryption. &amp;#160;In most cases, you&#039;re no more secure with a $300 certificate than a $10 one; the difference lies in the verification the certificate company performs to confirm your identity. &amp;#160;In short, if you&#039;re not a bank or think your users won&#039;t trust you using a cheapo certificate, then you&#039;ll be fine with a cheapo.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Below the cheapest SSL certificates I found online and have personally used:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;s&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.dynadot.com/ssl/about.html&#039;]);&quot;  href=&quot;http://www.dynadot.com/ssl/about.html&quot;&gt;AlphaSSL from Dynadot&lt;/a&gt;&amp;#160;($41.50/5 years)&lt;/s&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.cheapssls.com/index.php?dispatch=products.view&amp;amp;product_id=3&#039;]);&quot;  href=&quot;http://www.cheapssls.com/index.php?dispatch=products.view&amp;product_id=3&quot;&gt;Positive SSL from CheapSSLs.com&lt;/a&gt;&amp;#160;($24/3 years)&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.cheapssls.com/index.php?dispatch=products.view&amp;amp;product_id=1&#039;]);&quot;  href=&quot;http://www.cheapssls.com/index.php?dispatch=products.view&amp;product_id=1&quot;&gt;RapidSSL from CheapSSLs.com&lt;/a&gt;&amp;#160;($27/3 years)&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.servertastic.com/order/rapidssl/&#039;]);&quot;  href=&quot;https://www.servertastic.com/order/rapidssl/&quot;&gt;RapidSSL from Servertastic&lt;/a&gt;&amp;#160;($50/5 years)&lt;/p&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;As you can see, you get discounts if you pay for multiple years in advance. &amp;#160;If you plan on keeping the domain for a while, it shouldn&#039;t hurt--just be sure to keep the certificate and key in case you decide to switch servers over time.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;If you know of any other deals, let me know!&amp;#160;&lt;/p&gt; 
    </description>
</item>
<item>
    <title>Creating a customized OpenVPN installer - Round 2</title>
    <link>http://www.ameir.net/blog/archives/38-Creating-a-customized-OpenVPN-installer-Round-2.html</link>

    <description>
        &lt;p&gt;&lt;a href=&quot;http://www.ameir.net/blog/index.php?/archives/30-Creating-a-customized-OpenVPN-installer.html&quot;&gt;In a previous article&lt;/a&gt;, I outlined the steps I took to &amp;quot;roll&amp;quot; my own customized OpenVPN installer, and it worked like a charm back then.&amp;#160; OpenVPN has gone through several revisions since, and getting things running (especially on different architectures) with the new versions just doesn&#039;t work so well.&amp;#160; Luckily, there&#039;s another way to approach this problem and have OpenVPN installed as it was intended (i.e. the correct TAP driver will be detected and the shortcuts where they belong).&amp;#160; This method is more of a workaround, but definitely works.&amp;#160; Note that with this method you can&#039;t rename OpenVPN to &amp;quot;MyVPN&amp;quot; or whatever like the previous method.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;This method employs the use of an SFX that installs the vanilla OpenVPN installer as downloaded from their site, then automatically installs the keys afterwards.&amp;#160; You have the option of making the install entirely silent as well--it&#039;s all up to you.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/teejee2008.wordpress.com/&#039;]);&quot;  href=&quot;http://teejee2008.wordpress.com/&quot; target=&quot;_blank&quot;&gt;7-ZIP SFX Maker&lt;/a&gt; (version 2.0 at the time of writing)&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.7-zip.org/&#039;]);&quot;  target=&quot;_blank&quot; href=&quot;http://www.7-zip.org/&quot;&gt;7-Zip&lt;/a&gt; (or another 7-Zip-capable archiver such as &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.izarc.org/&#039;]);&quot;  target=&quot;_blank&quot; href=&quot;http://www.izarc.org/&quot;&gt;IZArc&lt;/a&gt;) &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.openvpn.net/index.php/open-source/downloads.html&#039;]);&quot;  href=&quot;http://www.openvpn.net/index.php/open-source/downloads.html&quot; target=&quot;_blank&quot;&gt;OpenVPN&lt;/a&gt; (version 2.1_rc19 at the time of writing)&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Your OpenVPN keys&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Steps:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;First, package your OpenVPN keys with 7-Zip.&amp;#160; If you want multiple OpenVPN connections configured on the same machine, it&#039;s a good idea to have each connection&#039;s keys in a subfolder.&amp;#160; Ensure that each connection has a .ovpn or .conf file with a unique name.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Next, open up 7-ZIP SFX Maker and add your archived keys by clicking on the &amp;quot;+&amp;quot; symbol.&amp;#160; Now, go to the &amp;quot;General&amp;quot; tab.&amp;#160; Under &amp;quot;Extract to specified folder&amp;quot;, enter &lt;strong&gt;%ProgramFiles%\OpenVPN\config&lt;/strong&gt;.&amp;#160; You can right-click for some preset environment variables if you want to change the path.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;img align=&quot;middle&quot; src=&quot;http://www.ameir.net/blog/uploads/openvpn/7zipsfx_path.png&quot; /&gt;&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;You can change other options if you&#039;d like.&amp;#160; I have &amp;quot;Beginning extraction of keys...&amp;quot; in the &amp;quot;Begin prompt&amp;quot; field of the Text tab.&amp;#160; From here, you&#039;re ready to click &amp;quot;Make SFX&amp;quot;.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Now, create another 7-Zip archive with your new SFX and the OpenVPN installer.&amp;#160; Add this archive to 7-ZIP SFX Maker.&amp;#160; In &amp;quot;General&amp;quot; enter %tmp% or another writable directory in the &amp;quot;Extract to specified folder&amp;quot; field.&amp;#160; I have &amp;quot;Allow user to change extraction path&amp;quot; checked as well--this all depends on your environment and needs.&amp;#160; Under the Text tab, I have it filled as follows:&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;img align=&quot;middle&quot; src=&quot;http://www.ameir.net/blog/uploads/openvpn/7zipsfx_messages.png&quot; /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Under the Shortcuts tab, I created a shortcut to OpenVPN GUI in Startup so that it starts on login.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Now, (and this is important), go to the Execute tab.&amp;#160; We will tell the SFX maker to run the OpenVPN installer then run the SFX for the keys.&amp;#160; Be sure to list them in that order.&amp;#160; Note that I have a /S in the first entry because I want OpenVPN to install silently.&amp;#160; Sadly, not everyone at my company knows how to install software, and I&#039;m satisfied with the setup defaults anyway.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;img align=&quot;middle&quot; src=&quot;http://www.ameir.net/blog/uploads/openvpn/7zipsfx_execute.png&quot; /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;You&#039;re now ready to &amp;quot;Make SFX&amp;quot;! Your new installer will be placed in the folder your files were in.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;You might want to play around with settings until the installer suits your tastes.&lt;br /&gt;&lt;/p&gt; 
    </description>
</item>
<item>
    <title>Redirect HTTP traffic to HTTPS with IIS</title>
    <link>http://www.ameir.net/blog/archives/37-Redirect-HTTP-traffic-to-HTTPS-with-IIS.html</link>

    <description>
        &lt;br /&gt;
&lt;p&gt;There are many situations where you&#039;d want a site to be accessible only securely, and there are several resources online on how to accomplish this.  Unfortunately, I couldn&#039;t find a perfect solution for me.  Influenced by &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/239875&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/239875&quot;&gt;this info&lt;/a&gt; and following the steps outlined &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/839357&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/839357&quot;&gt;here&lt;/a&gt; (under In Windows Server 2003 (IIS 6.0)), I came up with the following:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#60;%&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;If&amp;#160;Request.ServerVariables&amp;#40;&quot;SERVER_PORT&quot;&amp;#41;=80&amp;#160;Then&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Dim&amp;#160;strSecureURL&lt;br /&gt;
	&amp;#160;&amp;#160;&lt;br /&gt;
	&amp;#160;&amp;#160;strSecureURL&amp;#160;=&amp;#160;Replace&amp;#40;Request.QueryString,&quot;http&quot;,&quot;https&quot;&amp;#41;&amp;#160;&amp;#160;&#039;&amp;#160;entire&amp;#160;old&amp;#160;URL,&amp;#160;but&amp;#160;w/https&lt;br /&gt;
	&amp;#160;&amp;#160;strSecureURL&amp;#160;=&amp;#160;Replace&amp;#40;strSecureURL,&quot;403;&quot;,&quot;&quot;&amp;#41;				&#039;&amp;#160;remove&amp;#160;&quot;403;&quot;&amp;#160;from&amp;#160;beginning&lt;br /&gt;
	&amp;#160;&amp;#160;strSecureURL&amp;#160;=&amp;#160;Replace&amp;#40;strSecureURL,&quot;&amp;#58;80&quot;,&quot;&quot;&amp;#41;				&#039;&amp;#160;remove&amp;#160;port&amp;#160;#&amp;#160;that&#039;s&amp;#160;appended&amp;#160;to&amp;#160;server&amp;#160;name&lt;br /&gt;
	&amp;#160;&amp;#160;Response.Redirect&amp;#160;strSecureURL&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;End&amp;#160;If&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
%&amp;#62;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;It works well for my purposes, but of course, your mileage may vary.&lt;/p&gt;&lt;p&gt;More resources:&lt;/p&gt;&lt;p&gt;1.  &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/239875&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/239875&quot;&gt;http://support.microsoft.com/kb/239875&lt;/a&gt;&lt;br /&gt;2.  &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/839357&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/839357&quot;&gt;http://support.microsoft.com/kb/839357&lt;/a&gt;&lt;br /&gt;3.  &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blog.opsan.com/archive/2005/04/17/395.aspx&#039;]);&quot;  href=&quot;http://blog.opsan.com/archive/2005/04/17/395.aspx&quot; style=&quot;text-decoration: none; &quot;&gt;http://blog.opsan.com/archive/2005/04/17/395.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/839357&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/839357&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/839357&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/839357&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/239875&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/239875&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/239875&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/239875&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/239875&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/239875&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/support.microsoft.com/kb/239875&#039;]);&quot;  href=&quot;http://support.microsoft.com/kb/239875&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 
    </description>
</item>
<item>
    <title>GWMover:  WAN Failover Script for Linux</title>
    <link>http://www.ameir.net/blog/archives/36-GWMover-WAN-Failover-Script-for-Linux.html</link>

    <description>
        &lt;br /&gt;
&lt;p&gt;This is a script I wrote a while back but never posted up.  It allows you to switch from one gateway to another by repeatedly pinging your ISP gateway (or another external IP) and--upon detection of failure--switching to another gateway.  If the primary line is up upon the next run, we switch over to it.&lt;/p&gt;&lt;p&gt;This isn&#039;t a very advanced script and doesn&#039;t factor in other considerations, such as the state of the physical interfaces.  It simply attempts a number of pings, and considers the link dead or unreliable if they don&#039;t all come back.&lt;/p&gt;&lt;p&gt;If you have mutt installed, you will get an email alert when the primary link is considered &#039;dead.&#039;  You can easily change this behavior by modifying the script.&lt;/p&gt;&lt;p&gt;It will probably work on other POSIX/Unix-like OSes, but I&#039;ve only tested it on Linux in a BASH environment.  With all that said, here are the goods:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;#!/bin/bash&lt;br /&gt;
#&amp;#160;GWMover&amp;#58;&amp;#160;&amp;#160;WAN/Gateway&amp;#160;failover&lt;br /&gt;
#&amp;#160;	Pings&amp;#160;gateway&amp;#160;and&amp;#160;switches&amp;#160;to&amp;#160;backup&amp;#160;line&amp;#160;when&amp;#160;it&amp;#160;goes&amp;#160;down.&lt;br /&gt;
#&amp;#160;	Reverts&amp;#160;to&amp;#160;primary&amp;#160;line&amp;#160;when&amp;#160;gateway&amp;#160;becomes&amp;#160;accessible.&lt;br /&gt;
#&amp;#160;Modified&amp;#160;version&amp;#160;of&amp;#160;script&amp;#160;found&amp;#160;at&amp;#58;&lt;br /&gt;
#&amp;#160;http&amp;#58;//www.howtoforge.com/forums/showthread.php?p=55402#post55402&lt;br /&gt;
#&lt;br /&gt;
#&amp;#160;Last&amp;#160;modified&amp;#58;&amp;#160;&amp;#160;August&amp;#160;2,&amp;#160;2007&lt;br /&gt;
#&amp;#160;Ameir&amp;#160;Abdeldayem&lt;br /&gt;
&lt;br /&gt;
PRIMARYPUB=&amp;#34;66.92.162.1&amp;#34;&lt;br /&gt;
PRIMARYGW=&amp;#34;10.0.5.1&amp;#34;&lt;br /&gt;
SECONDARYGW=&amp;#34;10.0.0.1&amp;#34;&lt;br /&gt;
&lt;br /&gt;
EMAILS=&amp;#34;email@ddress1&amp;#160;email@ddress2&amp;#34;&lt;br /&gt;
&lt;br /&gt;
function&amp;#160;is_host_alive&amp;#40;&amp;#41;&amp;#160;#&amp;#160;Returns&amp;#160;success&amp;#160;or&amp;#160;failure&amp;#160;as&amp;#160;boolean&lt;br /&gt;
{&lt;br /&gt;
	PACKETS=3&lt;br /&gt;
	TRIES=5&lt;br /&gt;
	IP=$1&amp;#160;#&amp;#160;saving&amp;#160;contents&amp;#160;in&amp;#160;$1&amp;#160;before&amp;#160;is&amp;#160;used&lt;br /&gt;
	echo&amp;#160;&amp;#34;Pinging&amp;#160;$IP&amp;#34;&lt;br /&gt;
	i=0&lt;br /&gt;
	while&amp;#160;&amp;#91;&amp;#160;$i&amp;#160;-lt&amp;#160;$TRIES&amp;#160;&amp;#93;;&amp;#160;do&lt;br /&gt;
		REQUEST=$&amp;#40;ping&amp;#160;-qc&amp;#160;$PACKETS&amp;#160;$IP&amp;#160;|grep&amp;#160;packets|&amp;#160;cut&amp;#160;-d&amp;#34;&amp;#160;&amp;#34;&amp;#160;-f1,4&amp;#41;&lt;br /&gt;
		set&amp;#160;--&amp;#160;$REQUEST&lt;br /&gt;
		echo&amp;#160;-e&amp;#160;&amp;#34;Try&amp;#160;$i&amp;#58;&amp;#160;$1&amp;#160;$2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#34;&lt;br /&gt;
		if&amp;#160;&amp;#91;&amp;#160;$1&amp;#160;!=&amp;#160;$2&amp;#160;&amp;#93;;&amp;#160;then&lt;br /&gt;
			echo&amp;#160;&amp;#34;Bad&amp;#160;news.&amp;#160;$1&amp;#160;sent,&amp;#160;$2&amp;#160;received.&amp;#34;&lt;br /&gt;
			#&amp;#160;exit&lt;br /&gt;
			exitcode=1&lt;br /&gt;
		else&lt;br /&gt;
			echo&amp;#160;&amp;#34;Great!&amp;#160;$1&amp;#160;sent,&amp;#160;$2&amp;#160;received.&amp;#34;&lt;br /&gt;
			exitcode=0&lt;br /&gt;
		fi&lt;br /&gt;
		i=$&amp;#40;expr&amp;#160;$i&amp;#160;+&amp;#160;1&amp;#41;&lt;br /&gt;
	done&lt;br /&gt;
	return&amp;#160;$exitcode&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
CURRENTGW=`route&amp;#160;|&amp;#160;grep&amp;#160;&amp;#34;default&amp;#34;&amp;#160;|&amp;#160;awk&amp;#160;&#039;{print&amp;#160;$2}&#039;`&lt;br /&gt;
function&amp;#160;changegateway&amp;#40;&amp;#41;&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	if&amp;#160;&amp;#91;&amp;#160;$1&amp;#160;!=&amp;#160;$CURRENTGW&amp;#160;&amp;#93;;&amp;#160;then&lt;br /&gt;
		echo&amp;#160;&amp;#34;.&amp;#160;&amp;#160;We&amp;#160;need&amp;#160;to&amp;#160;change&amp;#160;the&amp;#160;default&amp;#160;route.&amp;#160;After&amp;#58;&amp;#160;$1&amp;#160;Before&amp;#58;&amp;#160;$2&amp;#34;&lt;br /&gt;
		route&amp;#160;add&amp;#160;default&amp;#160;gw&amp;#160;$1&lt;br /&gt;
		route&amp;#160;del&amp;#160;default&amp;#160;gw&amp;#160;$2&lt;br /&gt;
		echo&amp;#160;&amp;#34;The&amp;#160;routing&amp;#160;table&amp;#160;has&amp;#160;been&amp;#160;changed!&amp;#34;&lt;br /&gt;
		route&amp;#160;#&amp;#160;view&amp;#160;current&amp;#160;routing&amp;#160;table&lt;br /&gt;
		echo&amp;#160;-e&amp;#160;&amp;#34;$4&amp;#160;\n\nHere&amp;#160;is&amp;#160;the&amp;#160;updated&amp;#160;routing&amp;#160;table&amp;#58;\n$&amp;#40;route&amp;#41;&amp;#34;&amp;#160;|&amp;#160;mutt&amp;#160;-s&amp;#160;&amp;#34;$3&amp;#160;&amp;#40;$&amp;#40;hostname&amp;#41;&amp;#41;&amp;#34;&amp;#160;$EMAILS&lt;br /&gt;
	else&lt;br /&gt;
		echo&amp;#160;&amp;#34;,&amp;#160;and&amp;#160;we&amp;#160;are&amp;#160;already&amp;#160;pointing&amp;#160;to&amp;#160;it.&amp;#34;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function&amp;#160;test&amp;#40;&amp;#41;&lt;br /&gt;
{&lt;br /&gt;
	echo&amp;#160;$1&amp;#160;$EMAILS&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
##################&lt;br /&gt;
#&amp;#160;main&amp;#160;starts&amp;#160;here&lt;br /&gt;
##################&lt;br /&gt;
&lt;br /&gt;
if&amp;#160;is_host_alive&amp;#160;$PRIMARYPUB&amp;#160;;&amp;#160;then&lt;br /&gt;
	echo&amp;#160;-n&amp;#160;&amp;#34;The&amp;#160;primary&amp;#160;gateway&amp;#160;is&amp;#160;alive&amp;#34;&lt;br /&gt;
	SUBJECT=&amp;#34;$PRIMARYPUB&amp;#160;IS&amp;#160;NOW&amp;#160;UP&amp;#34;;&amp;#160;BODY=&amp;#34;The&amp;#160;server&amp;#160;$PRIMARYPUB&amp;#160;is&amp;#160;now&amp;#160;up&amp;#160;and&amp;#160;was&amp;#160;pinged&amp;#160;via&amp;#160;the&amp;#160;current&amp;#160;gateway&amp;#160;of&amp;#160;$CURRENTGW.&amp;#34;&lt;br /&gt;
	changegateway&amp;#160;$PRIMARYGW&amp;#160;$SECONDARYGW&amp;#160;&amp;#34;$SUBJECT&amp;#34;&amp;#160;&amp;#34;$BODY&amp;#34;&lt;br /&gt;
#	test&amp;#160;$PRIMARYGW&lt;br /&gt;
else&lt;br /&gt;
	echo&amp;#160;-n&amp;#160;&amp;#34;The&amp;#160;primary&amp;#160;gateway&amp;#160;is&amp;#160;dead&amp;#160;&amp;#60;img&amp;#160;src=&quot;http://www.ameir.net/blog/templates/default/img/emoticons/sad.png&quot;&amp;#160;alt=&quot;&amp;#58;-&amp;#40;&quot;&amp;#160;style=&quot;display&amp;#58;&amp;#160;inline;&amp;#160;vertical-align&amp;#58;&amp;#160;bottom;&quot;&amp;#160;class=&quot;emoticon&quot;&amp;#160;/&amp;#62;&amp;#160;We&amp;#160;should&amp;#160;be&amp;#160;on&amp;#160;the&amp;#160;backup&amp;#160;line&amp;#34;&lt;br /&gt;
	SUBJECT=&amp;#34;$PRIMARYPUB&amp;#160;IS&amp;#160;DOWN&amp;#34;;&amp;#160;BODY=&amp;#34;The&amp;#160;server&amp;#160;$PRIMARYPUB&amp;#160;could&amp;#160;not&amp;#160;be&amp;#160;pinged&amp;#160;via&amp;#160;the&amp;#160;current&amp;#160;gateway&amp;#160;of&amp;#160;$CURRENTGW.&amp;#34;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;changegateway&amp;#160;$SECONDARYGW&amp;#160;$PRIMARYGW&amp;#160;&amp;#34;$SUBJECT&amp;#34;&amp;#160;&amp;#34;$BODY&amp;#34;&lt;br /&gt;
fi&lt;/div&gt;&lt;/p&gt;&lt;p&gt;Download it &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/files/gwmover.sh&#039;]);&quot;  href=&quot;http://www.ameir.net/files/gwmover.sh&quot; title=&quot;gwmover.sh&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
 
    </description>
</item>
<item>
    <title>Sync SVN repository with remote FTP server</title>
    <link>http://www.ameir.net/blog/archives/35-Sync-SVN-repository-with-remote-FTP-server.html</link>

    <description>
        &lt;br /&gt;
&lt;p&gt;This script was written for the company I work for well over a year ago, but I just decided to release it to the public now.  It has been in use all of this time and is still in use now, so that should tell you that it&#039;s a pretty reliable script.  Any bugs we encountered over the course of using this program have been fixed.  Hopefully you&#039;ll have the same luck as us.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Basics:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;This script is run as a SVN hook (post-commit).  After committing changes to your subversion repository, this script is invoked and synchronization begins.  The script creates a local copy of the repository, and files just committed are sent via FTP.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Usage:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;One copy of the script can be used for an unlimited number of repositories, so the script can be placed in a globally-available location.  In our scenario, we placed the script at /usr/local/bin/svn2ftp.sh .  There are four command-line arguments to the script that are required.  The first two arguments can be kept the same as below, as they&#039;re passed to the script by subversion.  The third parameter is the path between the repository and the trunk (e.g., if your SVN path is http://&amp;lt;host&amp;gt;/svn/repo/dir/trunk, then you&#039;d put &amp;quot;dir&amp;quot; as the parameter; otherwise, you&#039;d put &amp;quot;.&amp;quot; if there&#039;s no directory in between).  The fourth parameter is the full path to the config file of the repo.  A sample to put in repo/hooks/post-commit:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;#&amp;#160;Update&amp;#160;this&amp;#160;repo&amp;#160;with&amp;#160;remote&amp;#160;FTP&amp;#160;server&lt;br /&gt;
DATE=`date&amp;#160;+&#039;%m-%d-%Y&#039;`&lt;br /&gt;
/usr/local/bin/svn2ftp.sh&amp;#160;&amp;#34;$REPOS&amp;#34;&amp;#160;&amp;#34;$REV&amp;#34;&amp;#160;&amp;#34;.&amp;#34;&amp;#160;&amp;#34;/svn2ftp/conf/repo.conf&amp;#34;&amp;#160;&amp;#62;&amp;#62;&amp;#160;/svn2ftp/logs/repo-$DATE.log&lt;/div&gt;&lt;/p&gt;&lt;p&gt;We have our directory structure as follows, but you can change it as you please:&lt;/p&gt;&lt;p&gt;/svn2ftp/conf     #  Where config files are stored&lt;/p&gt;&lt;p&gt;/svn2ftp/logs     #  Where log files are stored&lt;/p&gt;&lt;p&gt;/svn2ftp/repos   #  Where raw repo contents are stored&lt;/p&gt;A sample config file can be found below.&lt;br /&gt;&lt;p&gt;&lt;b&gt;The code:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I initially wrote this program using the Linux &#039;ftp&#039; program.  It works well and all, but if I encounter server or any other errors, the program still exits with a successful error code.  This was a bummer in our situation, so I wrote an FTP client in PHP that reports errors correctly.  When an error is encountered, files that were not uploaded successfully will be retried upon the next commit.  Links to both versions, as well as the config file, are below:&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/files/svn2ftp.sh&#039;]);&quot;  href=&quot;http://www.ameir.net/files/svn2ftp.sh&quot;&gt;Version using Linux &#039;ftp&#039; program&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/files/svn2ftp-php.sh&#039;]);&quot;  href=&quot;http://www.ameir.net/files/svn2ftp-php.sh&quot;&gt;Version using PHP FTP program&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/files/svn2ftp-php.sh&#039;]);&quot;  href=&quot;http://www.ameir.net/files/svn2ftp-php.sh&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/files/svn2ftp-php.sh&#039;]);&quot;  href=&quot;http://www.ameir.net/files/svn2ftp-php.sh&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.ameir.net/files/repo.conf&quot;&gt;Sample config file&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.ameir.net/files/ftpupdate-php.txt&quot;&gt;PHP FTP Updater&lt;/a&gt;&lt;/p&gt;&lt;p /&gt; 
    </description>
</item>
<item>
    <title>Site back online</title>
    <link>http://www.ameir.net/blog/archives/34-Site-back-online.html</link>

    <description>
        &lt;br /&gt;
The site was down for a while (since August 21) due to network issues where the previous server was located.  I found it easier to just move the site to another server than to investigate the issue (I&#039;d have to work out a time to go to the &#039;colocation center&#039;  -- my friend&#039;s dorm room).  I&#039;ve been meaning to move the site to this server anyways, so I guess it all worked out, despite the mega downtime.&lt;p&gt;&lt;br /&gt;Sorry for the inconvenience, and welcome back &lt;img src=&quot;http://www.ameir.net/blog/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; .&lt;/p&gt; 
    </description>
</item>
<item>
    <title>Using OpenDNS on Your Fon Router</title>
    <link>http://www.ameir.net/blog/archives/33-Using-OpenDNS-on-Your-Fon-Router.html</link>

    <description>
        &lt;br /&gt;
&lt;p&gt;There is large interest in &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.opendns.com/&#039;]);&quot;  href=&quot;http://www.opendns.com/&quot;&gt;OpenDNS&lt;/a&gt;, and I happen to be a fan of it myself.  Sadly, Fon routers, when connected directly to a modem and using DHCP, use the ISP&#039;s DNS servers and don&#039;t allow you to override those settings.  Fortunately, there is a loophole in older Fon firmware that allows you to enable a BusyBox shell (so you can connect to it via SSH).  This is actually a security hole and shouldn&#039;t be a good thing at all, but hey, I&#039;m kind of glad it exists.  Anyways, let&#039;s get started.&lt;/p&gt;&lt;p&gt;Enable SSH access to your Fon router by &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blog.blase16.de/index.php?url=2006/11/28/Hacking-Fonera&#039;]);&quot;  href=&quot;http://blog.blase16.de/index.php?url=2006/11/28/Hacking-Fonera&quot;&gt;following these instructions&lt;/a&gt;.  Be sure to enable permanent SSH access, as it&#039;ll be very useful later.  When your Fonera updates to newer firmware that doesn&#039;t allow code injections, SSH will still be enabled.  Be sure to leave your network cable unplugged until after you enable SSH permanently or you might form some gray hairs.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Now, in a shell, let&#039;s create a startup script that overrides the ISP&#039;s DNS settings after the network is initialized.  Type the following:&lt;/p&gt;&lt;pre&gt;vi /etc/init.d/S45opendns&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;Now, in the vi window, paste this (press &lt;i&gt;&lt;b&gt;i&lt;/b&gt;&lt;/i&gt; to insert text):&lt;/p&gt;&lt;pre&gt;echo &amp;quot;nameserver 208.67.222.222&amp;quot; &amp;gt; /etc/resolv.conf&lt;br /&gt;echo &amp;quot;nameserver 208.67.220.220&amp;quot; &amp;gt;&amp;gt; /etc/resolv.conf&lt;/pre&gt;&lt;p&gt;This will &amp;quot;blank&amp;quot; /etc/resolv.conf and load it with the OpenDNS settings.  Save and exit vi (press the esc key then type &lt;b&gt;&lt;i&gt;:x&lt;/i&gt;&lt;/b&gt;).&lt;/p&gt;&lt;p&gt;Now, to make the file executable type:&lt;/p&gt;&lt;pre&gt;chmod +x /etc/init.d/S45opendns&lt;/pre&gt;&lt;p&gt;You&#039;re all done!  OpenDNS settings will be persistent across reboots.  You can activate the settings now without having to reboot by simply running your new script:&lt;/p&gt;&lt;pre&gt;/etc/init.d/S45opendns&lt;/pre&gt;&lt;p&gt;If DHCP renewals cause your new nameserver settings to be overwritten to the ISP&#039;s, you can create a cron job that runs every few minutes (you can pick a time based on your ISP&#039;s DHCP lease time):&lt;/p&gt;&lt;p&gt;Type &lt;b&gt;&lt;i&gt;crontab -e&lt;/i&gt;&lt;/b&gt; in the terminal window.  When vi opens, insert the following line at the end:&lt;/p&gt;&lt;pre&gt;15 * * * * /etc/init.d/S45opendns&lt;/pre&gt;&lt;p&gt;This will run your new script every 15 minutes, so there will never be more than a 15-minute period where you will not be using OpenDNS.&lt;/p&gt;&lt;p&gt;That should be all you need to get you going. If you&#039;re using more advanced features of OpenDNS, you can use &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.dnsomatic.com/&#039;]);&quot;  href=&quot;http://www.dnsomatic.com/&quot;&gt;DNS-O-Matic&lt;/a&gt; on your Fon to keep OpenDNS informed of IP changes. Comment below with your experiences.&lt;/p&gt;&lt;p /&gt; 
    </description>
</item>

</channel>
</rss>

