<?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"
	>

<channel>
	<title>Gear Adrift &#187; Coding</title>
	<atom:link href="http://www.gearadrift.com/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gearadrift.com</link>
	<description>Navy Humor, Navy Jokes, and Satire about Life in the Navy</description>
	<pubDate>Fri, 31 Oct 2008 12:08:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Navy Webmasters Suck</title>
		<link>http://www.gearadrift.com/navy/navy-webmasters-suck/</link>
		<comments>http://www.gearadrift.com/navy/navy-webmasters-suck/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 11:24:31 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Coding]]></category>

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

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

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

		<guid isPermaLink="false">http://gearadrift.com/navy/navy-webmasters-suck/</guid>
		<description><![CDATA[So what may seem like a simple task to most webmasters is getting all jacked up by whoever runs the Navy&#8217;s websites.  Let&#8217;s take, for instance, navy.mil.  Whoever runs this website needs to take a basic course in coding a website properly.
What most people don&#8217;t realize is that gearadrift.com and www.gearadrift.com are technically [...]]]></description>
			<content:encoded><![CDATA[<p><img width="100" src="http://gearadrift.com/wp-content/uploads/2007/08/chronicle.gif" alt="chronicle.gif" title="chronicle.gif" class="left" />So what may seem like a simple task to most webmasters is getting all jacked up by whoever runs the Navy&#8217;s websites.  Let&#8217;s take, for instance, navy.mil.  Whoever runs this website needs to take a basic course in coding a website properly.</p>
<p>What most people don&#8217;t realize is that <a href="http://gearadrift.com">gearadrift.com</a> and <a href="http://www.gearadrift.com/">www.gearadrift.com</a> are technically two different websites.  The WWW version is a subdomain of gearadrift.com, the main domain, just like <a href="http://docinthebox.blogspot.com/">http://docinthebox.blogspot.com</a> is a subdomain of <a href="http://blogspot.com/">http://blogspot.com</a>.<br />
<span id="more-43"></span></p>
<h3>Webmastering 101</h3>
<p>What most webmasters do is either let the two sites stay as they are and simply allow www to be a copy of the main domain (like gearadrift.com) or they redirect the non-www version to the www version (like yahoo.com d0es).</p>
<p>Try it out, open a new window and type yahoo.com without the www and watch the address bar.  You will see that yahoo.com redirects to <a href="http://www.yahoo.com/">www.yahoo.com</a>.  Both of these tactics have advantages that are outside the scope of this post.</p>
<h3>Now, what does navy.mil do?</h3>
<p>They don&#8217;t allow navy.mil to copy to <a href="http://www.navy.mil/">www.navy.mil</a> and they don&#8217;t even bother to redirect it for you.  This causes <a href="http://navy.mil">navy.mil</a> to not be found and forces the user to type in <a href="http://www.navy.mil/">www.navy.mil</a>.  Really sloppy, if you ask me.</p>
<p>I checked on a couple of other websites and <a href="http://navy.com/">http://navy.com</a> is the only one that works properly (probably managed by a different group of people).</p>
<h3>Don&#8217;t get me started on passwords</h3>
<p>Tell me, what good is it to have 197 different passwords that require different strength levels when you just allow a person to change it so easily.</p>
<p>Take the Navy Portal, <a href="http://nko.navy.mil/">http://nko.navy.mil</a> (careful, the link probably won&#8217;t work), this website has been hailed as the &#8220;be all and end all&#8221; of all Navy websites.  Have you ever been able to log on to this thing the very first time you tried?</p>
<h5>NKO Password Strength</h5>
<p><strong>The password requirments are very strong</strong>, 9 character minimum consisting of: <em>at least</em> 2 uppercase letters, 2 lowercase letters, 2 numbers, and 2 special characters.  This is probably a good idea considering the type of information on this website and what the Navy has planned for it.</p>
<h5>Dangerous Flaw</h5>
<p><strong>But you can change your </strong><em>(or someone&#8217;s)</em><strong> password very easily.  </strong>All I need to know is your First Name, Last Name, Birthday, and Social Security number.  <strong>WTF?!?!?  </strong>Has it occured to anyone how easy this information is to get?</p>
<p>Either make the passwords easier and reduce the sensitivity of the information of NKO or increase the requirments to change the password.  You can&#8217;t have it both ways and still be safe.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gearadrift.com/navy/navy-webmasters-suck/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Watermarking Images with PHP</title>
		<link>http://www.gearadrift.com/coding/watermarking-images-with-php/</link>
		<comments>http://www.gearadrift.com/coding/watermarking-images-with-php/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 00:38:23 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Coding]]></category>

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

		<guid isPermaLink="false">http://gearadrift.com/blog/2007/07/10/watermarking-images-with-php/</guid>
		<description><![CDATA[If you happen to have a website that displays original works of art or photographs.  Or, if you happen to want a quick way to copyright all of the images you are showing on your web page, then you can do this using php.

First, I create my copyright image:

As a point of fact, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>If you happen to have a website that displays original works of art or photographs.  Or, if you happen to want a quick way to copyright all of the images you are showing on your web page, then you can do this using php.<br />
<span id="more-31"></span><br />
First, I create my copyright image:</p>
<p><img src="http://www.gearadrift.com/wp-content/uploads/2007/07/copyright.png" alt="copyright.png" /></p>
<p>As a point of fact, I&#8217;ve saved this image as <strong>copyright.png</strong> using an 8 color palette.  I chose PNG8 because there are only 8 colors in the export.  This smaller pallete (as opposed to a JPEG with millions of colors) greatly reduces the chance of a <a href="http://en.wikipedia.org/wiki/Dithering">dithering effect</a> and hereby making the white of the image easier to eliminate, as you will see later.</p>
<p>Next, I take my original photograph.  In this case, me in Singapore.  I&#8217;ve named this file sing.jpg:</p>
<p><img src="http://www.gearadrift.com/wp-content/uploads/2007/07/sing.jpg" alt="sing.jpg" /></p>
<p>Now, I use php to call the images into a script:<br />
<code></p>
<p>Note the different imagecreate() statements.  Imagecreatefromjpeg calls a JPEG and imagecreatefrompng calls a PNG.</p>
<p>Now I want to copy my watermark (copyright.png) to my original photo (sing.png).  I do this by building onto the original code to get:<br />
<code></p>
<p></code></p>
<p>The imagecopy() statement is broken down as follows.  The <strong>first variable is the image you want watermarked</strong> and the <strong>second variable is the image of the watermark</strong>.  <strong>The third and fourth variables are the location in the destination image ($Image) where you want the image date to be copied.</strong>  They mark the upper left corner of the block, in this case (0, 0) marks the upper left-hand corner of the destination image (sing.jpg).</p>
<p>  <strong>The fifth and sixth variables are the position of the source image ($Copyright) to start copying from.</strong>  And the <strong>seventh and eighth variables mark the width and height of the image to be copied.</strong>  In this case, I want to copy the entire image and the dimensions of copyright.png are 400px wide by 100px high.</p>
<p>We use the following code to output the image</p>
<p><code></p>
<p></code><br />
And the output looks like this:<br />
<img src='http://www.gearadrift.com/wp-content/uploads/2007/07/first.jpg' alt='first.jpg' /></p>
<p>Now, this is hardly a watermark, so we have to make a few changes but at least we managed to copy the watermark image onto the original.</p>
<p>In order to make this look more like a watermark, we need to get rid of the white and adjust the opacity</p>
<p>To get rid of the white, after the line:</p>
<p><code><br />
$Copyright = imagecreatefrompng('copyright.png');<br />
</code></p>
<p>Add the following:</p>
<p><code><br />
$white = imagecolorexact($Copyright, 255, 255, 255);<br />
imagecolortransparent($Copyright, $white);<br />
</code></p>
<p>The imagecolorexact() function returns the color white.  The first parameter is the image with the color you want to identify and the second, third, and fourth parameters are the RGB values of the color you want.  The imagecolortransparent() function removes whatever value is specified in the second parameter from the image in the first parameter.</p>
<p>And we get this output:</p>
<p><img src='http://www.gearadrift.com/wp-content/uploads/2007/07/second.jpg' alt='second.jpg' /></p>
<p>Now this may be fine for most but I want to make it a little less obvious and more like a watermark.  This is accomplished by changing</p>
<p><code><br />
imagecopy($Image, $Copyright,0,0,0,0,400,100);<br />
</code></p>
<p>to read</p>
<p><code><br />
imagecopymerge($Image, $Copyright,0,0,0,0,400,100, 50);<br />
</code></p>
<p>Notice the change form the imagecopy() function to the imagecopymerge() function.  This new function allows for a ninth variable at the end of the parameters, in this case 50, that is opacity.</p>
<p>This change brings the final code to:</p>
<p><code></p>
<p></code></p>
<p>And the final image to:</p>
<p><img src='http://www.gearadrift.com/wp-content/uploads/2007/07/third.jpg' alt='third.jpg' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gearadrift.com/coding/watermarking-images-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Watermarking Images with PHP</title>
		<link>http://www.gearadrift.com/coding/watermarking-images-with-php/</link>
		<comments>http://www.gearadrift.com/coding/watermarking-images-with-php/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 00:38:23 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Coding]]></category>

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

		<guid isPermaLink="false">http://gearadrift.com/blog/2007/07/10/watermarking-images-with-php/</guid>
		<description><![CDATA[If you happen to have a website that displays original works of art or photographs.  Or, if you happen to want a quick way to copyright all of the images you are showing on your web page, then you can do this using php.

First, I create my copyright image:

As a point of fact, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>If you happen to have a website that displays original works of art or photographs.  Or, if you happen to want a quick way to copyright all of the images you are showing on your web page, then you can do this using php.<br />
<span id="more-31"></span><br />
First, I create my copyright image:</p>
<p><img src="http://www.gearadrift.com/wp-content/uploads/2007/07/copyright.png" alt="copyright.png" /></p>
<p>As a point of fact, I&#8217;ve saved this image as <strong>copyright.png</strong> using an 8 color palette.  I chose PNG8 because there are only 8 colors in the export.  This smaller pallete (as opposed to a JPEG with millions of colors) greatly reduces the chance of a <a href="http://en.wikipedia.org/wiki/Dithering">dithering effect</a> and hereby making the white of the image easier to eliminate, as you will see later.</p>
<p>Next, I take my original photograph.  In this case, me in Singapore.  I&#8217;ve named this file sing.jpg:</p>
<p><img src="http://www.gearadrift.com/wp-content/uploads/2007/07/sing.jpg" alt="sing.jpg" /></p>
<p>Now, I use php to call the images into a script:<br />
<code></p>
<p>Note the different imagecreate() statements.  Imagecreatefromjpeg calls a JPEG and imagecreatefrompng calls a PNG.</p>
<p>Now I want to copy my watermark (copyright.png) to my original photo (sing.png).  I do this by building onto the original code to get:<br />
<code></p>
<p></code></p>
<p>The imagecopy() statement is broken down as follows.  The <strong>first variable is the image you want watermarked</strong> and the <strong>second variable is the image of the watermark</strong>.  <strong>The third and fourth variables are the location in the destination image ($Image) where you want the image date to be copied.</strong>  They mark the upper left corner of the block, in this case (0, 0) marks the upper left-hand corner of the destination image (sing.jpg).</p>
<p>  <strong>The fifth and sixth variables are the position of the source image ($Copyright) to start copying from.</strong>  And the <strong>seventh and eighth variables mark the width and height of the image to be copied.</strong>  In this case, I want to copy the entire image and the dimensions of copyright.png are 400px wide by 100px high.</p>
<p>We use the following code to output the image</p>
<p><code></p>
<p></code><br />
And the output looks like this:<br />
<img src='http://www.gearadrift.com/wp-content/uploads/2007/07/first.jpg' alt='first.jpg' /></p>
<p>Now, this is hardly a watermark, so we have to make a few changes but at least we managed to copy the watermark image onto the original.</p>
<p>In order to make this look more like a watermark, we need to get rid of the white and adjust the opacity</p>
<p>To get rid of the white, after the line:</p>
<p><code><br />
$Copyright = imagecreatefrompng('copyright.png');<br />
</code></p>
<p>Add the following:</p>
<p><code><br />
$white = imagecolorexact($Copyright, 255, 255, 255);<br />
imagecolortransparent($Copyright, $white);<br />
</code></p>
<p>The imagecolorexact() function returns the color white.  The first parameter is the image with the color you want to identify and the second, third, and fourth parameters are the RGB values of the color you want.  The imagecolortransparent() function removes whatever value is specified in the second parameter from the image in the first parameter.</p>
<p>And we get this output:</p>
<p><img src='http://www.gearadrift.com/wp-content/uploads/2007/07/second.jpg' alt='second.jpg' /></p>
<p>Now this may be fine for most but I want to make it a little less obvious and more like a watermark.  This is accomplished by changing</p>
<p><code><br />
imagecopy($Image, $Copyright,0,0,0,0,400,100);<br />
</code></p>
<p>to read</p>
<p><code><br />
imagecopymerge($Image, $Copyright,0,0,0,0,400,100, 50);<br />
</code></p>
<p>Notice the change form the imagecopy() function to the imagecopymerge() function.  This new function allows for a ninth variable at the end of the parameters, in this case 50, that is opacity.</p>
<p>This change brings the final code to:</p>
<p><code></p>
<p></code></p>
<p>And the final image to:</p>
<p><img src='http://www.gearadrift.com/wp-content/uploads/2007/07/third.jpg' alt='third.jpg' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gearadrift.com/coding/watermarking-images-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Price Tapestry Modifications</title>
		<link>http://www.gearadrift.com/coding/price-tapestry-modifications/</link>
		<comments>http://www.gearadrift.com/coding/price-tapestry-modifications/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 02:00:54 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Coding]]></category>

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

		<guid isPermaLink="false">http://gearadrift.com/blog/2007/07/08/price-tapestry-modifications/</guid>
		<description><![CDATA[Price Tapesty is a price comparison script that has many of the features you would expect of this type of program. One of the best features of this script is the fact that Dave Morrison (the developer of price tapestry) left the code unencrypted and offers some of the best support I&#8217;ve ever seen on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pricetapestry.com/">Price Tapesty</a> is a price comparison script that has many of the features you would expect of this type of program. One of the best features of this script is the fact that Dave Morrison (the developer of price tapestry) left the code unencrypted and offers some of the best support I&#8217;ve ever seen on modifications.</p>
<p>I have one site that I have recently launched that runs a tricked out version of price tapestry and wanted to compile a list of some of my favorite modifications. I also wanted to get some feedback on these modifications from other users and see what they think.</p>
<p>The list of price tapestry modifications I&#8217;ve used:<br />
<span id="more-27"></span></p>
<ul>
<li><a href="http://www.pricetapestry.com/node/212">Filter by Brand Name</a> - I&#8217;ve used this modification on the category pages to filter the search results by brand name. An example can be seen at WhichisCheaper.com. Here is an example of the orignial category page for the <a href="http://electronics.whichischeaper.com/category/MP3-Players/">MP3 Player</a> category and here is the same category page with the brand name filter applied for <a href="http://electronics.whichischeaper.com/search.php?q=category%3AMP3+Players%3A&amp;brandFilter=Creative+Labs">MP3 Players by Creative Labs</a>.</li>
<li><a href="http://www.pricetapestry.com/node/1171">Tagging System</a> - This was an actual request by me and Dave generated the code and worked with me to make it happen exactly as I required.  <a href="http://www.pricetapestry.com/node/1171">This thread</a> provides the code and is a perfect example of the type of support you get with this excellent script.</li>
<li><a href="http://www.pricetapestry.com/node/679">Comparison based on sku</a> - I&#8217;m sure that there is some reason that, out of the box, the script compares by name.  However, based on the experiences I&#8217;ve had, every merchant uses a different product name or at least a very similar variation.  I have seen a couple of example where the <a href="http://en.wikipedia.org/wiki/Fuzzy_logic">fuzzy logic</a> worked and it matched the products accordingly but changing the comparison to match by UPC or SKU or Model # seems to work much better.</li>
<li><a href="http://www.pricetapestry.com/node/198">Product Feed Download Guide</a> - This proved invaluable to me.  I&#8217;ve used every piece of this guide to create the 3 tapestry sites that I run as of July 2007.  The only change I made to fetch.sh was to split up the code into two seperate files.  One that downloaded the files from the various merchants and the other that imported them into the site.  I found this easier to deal with because each of my sites run multiple subdomains.  I then set up a cron job that would run each script individually.</li>
</ul>
<p>As for templating, I would start with a template from <a href="http://oswd.org">OSWD.ORG</a> and then customize it myself or hire a graphic designer to do a header / logo.  Of course, for SEO purposes and to avoid any possible price tapestry <em>&#8220;footprints&#8221;</em> I remove or recode certain elements of the original script design.  For example, the products page is generated with &lt;table&gt; markup and I usually change this to css.</p>
<p>I am interested to hear any other modifications that people may have used, so if you have a price tapestry site, I&#8217;d like to hear your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gearadrift.com/coding/price-tapestry-modifications/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Other WordPress Plugins I&#8217;ve Used</title>
		<link>http://www.gearadrift.com/blogging/other-wordpress-plugins-ive-used/</link>
		<comments>http://www.gearadrift.com/blogging/other-wordpress-plugins-ive-used/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 01:42:03 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

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

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

		<guid isPermaLink="false">http://gearadrift.com/blog/2007/07/08/other-wordpress-plugins-ive-used/</guid>
		<description><![CDATA[I&#8217;ve decided to get this blog rolling off right with some helping blogging posts. The first of which is the best wordpress plugins I&#8217;ve seen. I&#8217;ve used each and every one of these plugins in my sites. Most of these are &#8220;must have&#8221; wordpress plugins and I wouldn&#8217;t dream of building a site without them. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to get this blog rolling off right with some helping blogging posts. The first of which is the <strong>best wordpress plugins</strong> I&#8217;ve seen. I&#8217;ve used each and every one of these plugins in my sites. Most of these are &#8220;must have&#8221; wordpress plugins and I wouldn&#8217;t dream of building a site without them. <strong>My list of Wordpress Plugins:</strong><span id="more-26"></span></p>
<ul>
<li><a href="http://www.arnebrachhold.de/2005/06/05/google-sitemaps-generator-v2-final" title="google sitemap generator for wordpress"><strong>Google Sitemap Generator</strong></a> - This plugin creates a sitemap for <a href="www.google.com/webmasters/sitemaps/" title="google sitemaps">google sitemaps</a>. It&#8217;s an xml-sitemap and is updated every time you make a new post or write a new page. Some useful features include: inclusion of non-wordpress pages into sitemap, ability to change frequencies and priorities of pages/posts in your sitemap, and the ability to exclude/include category pages and comments. Another useful feature is that the plugin automatically pings google to let it&#8217;s spider know that you&#8217;ve updated your sitemap. Great Plugin!</li>
<li><a href="http://da44en.wordpress.com/2006/01/06/dlc-related/" title="Related posts plugin for Wordpress"><strong>Related Posts</strong></a> - This is another must have plugin for getting your blog spidered properly. This plugin fetches articles based on keyword overlaps, and displays them as an unordered list. According to it&#8217;s homepage, posts with more keyword matches to the current post are displayed first. This plugin is also useful for gaining higher ranking in the serps because related pages tend to pass higher ranking than unrelated pages. For example, if you ran a poker site, a link from another poker site would weigh heavier than a link from say, a children&#8217;s site.</li>
<li><a href="http://guff.szub.net/2005/09/01/head-meta-description/" title="Head Meta Description Wordpress Plugin"><strong>Head META Description</strong></a> - A brilliant plugin from Guff, head meta description uses the excerpt data from wordpress posts and automatically creates a meta description for that post. Some argue that the search engines rarely pay attention to the meta tags but I believe it&#8217;s just part of good &#8220;webmastering&#8221;. Different Meta tags show each page is different and I have noticed that some search engines use the meta description as the description in it&#8217;s results. Either way, it&#8217;s just the right thing to do and this plugin makes it very easy.</li>
<li><a href="http://guff.szub.net/2005/02/26/the-excerpt-reloaded/" title="The Excerpt Reloaded Wordpress Plugin"><strong>The Excerpt Reloaded</strong></a> - This is another plugin by guff and it&#8217;s one of the best plugins I&#8217;ve seen. It allows for greater flexibility in using the the_excerpt() tag within wordpress. With this plugin, you can include/exclude html within your post excerpts as well as change the length, and many other features.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gearadrift.com/blogging/other-wordpress-plugins-ive-used/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
