<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Cash &#187; Sundry Musings</title>
	<atom:link href="http://www.earn-web-cash.com/category/sundry-musings/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.earn-web-cash.com</link>
	<description>Writing, Designing, and Making Money Online</description>
	<lastBuildDate>Sun, 04 Dec 2011 22:52:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Another Penny Auction Site: Bigger Bidder (Plus Free Bids!)</title>
		<link>http://www.earn-web-cash.com/2011/09/24/another-penny-auction-site-bigger-bidder-plus-free-bids/</link>
		<comments>http://www.earn-web-cash.com/2011/09/24/another-penny-auction-site-bigger-bidder-plus-free-bids/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 01:16:28 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[auction]]></category>
		<category><![CDATA[bidding]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[penny auction]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/?p=209</guid>
		<description><![CDATA[The idea of penny auction sites &#8211; like QuiBid &#8211; is enticing. I&#8217;m sure you&#8217;ve seen the ads&#8230; he bought an iPad for $5! What a savings! Well, there&#8217;s another company on the scene &#8211; Bigger Bidder &#8211; with a similar business model. Bigger Bidder hosts penny auctions, just like QuiBid. People &#8220;bid&#8221; on stuff, [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of penny auction sites &#8211; like QuiBid &#8211; is enticing. I&#8217;m sure you&#8217;ve seen the ads&#8230; he bought an iPad for $5! What a savings!</p>
<p>Well, there&#8217;s another company on the scene &#8211; <a href="http://adscendmedia.com/click.php?aff=12672&#038;camp=3813&#038;crt=9446&#038;sid=">Bigger Bidder</a> &#8211; with a similar business model. Bigger Bidder hosts penny auctions, just like QuiBid. People &#8220;bid&#8221; on stuff, just like they would on eBay, and each bid increases the price one penny. At the end, you pay for the final bid, you pay for the shipping, and you get the item.</p>
<h3>So&#8230; How Does That Work?</h3>
<p>Here&#8217;s how it works.</p>
<p>Bids are not free. Each bid costs you $0.68. When you place a bid, you use a bid&#8230; in other words, you just spent $0.68.</p>
<p>So let&#8217;s take an example (and yes, this is a real example from the website). On September 23, an auction ended for an Apple iPad 2. The final price was $15.09. Shipping was an additional $20.00.</p>
<p>The final bidder paid $35.09 out of pocket for a brand new iPad 2. Awesome! Right? Maybe.</p>
<p>Let&#8217;s say the winner placed one final bid and happened to win. That would be an <b>awesome</b> deal. But, if the price increased to $15.09, there were 1,509 bids placed. Let&#8217;s say the winner was bidding heavily for the last couple hours, and placed 100 bids. Well, then he spent $68 in bids alone. Still a good deal; around $100 with the final price and shipping.</p>
<p>How does Bigger Bidder make money? All the other bids. In this case, 1,509 bids x $0.68/bid = $1,026. That&#8217;s double the retail price of the item, so assuming they got some kind of wholesale price they made a nice profit on this. The trick (or luck) of it is to get in at the <b>end</b> of an auction. If you bid too early, you either invest a lot of money (and don&#8217;t save anything) or just end up giving up and wasting all your money.</p>
<h3>Are There Deals to Be Had?</h3>
<p>Most definitely. Somebody won an Apple TV for $0.02 + $15 shipping. Less than $20, for an item that costs $100 on Amazon? A Dell Inspiron laptop (retail $900) also went for $0.02.</p>
<p>I don&#8217;t quite understand the rhyme or reason behind these auctions ending so low. I guess it&#8217;s just plain dumb luck&#8230; but if you can get lucky, you can definitely get a good deal. It may also be that the user base is still relatively small, so there are auctions ending at weird times of the day where you won&#8217;t have competition. A larger site, like QuiBids, will have a more steady buying audience and thus more stable end prices.</p>
<h3>The Best Part?</h3>
<p>You can get <b>free</b> bids. <a href="http://adscendmedia.com/click.php?aff=12672&#038;camp=3813&#038;crt=9446&#038;sid=">Sign Up</a> through <a href="http://adscendmedia.com/click.php?aff=12672&#038;camp=3813&#038;crt=9446&#038;sid=">this link</a> and you can get 150 free bids.</p>
<p>You might not win anything&#8230; but at least you can try the site out without wasting your <b>own</b> money. Just think, that&#8217;s about $100 worth of bids. Isn&#8217;t it worth trying to snag some nice piece of electronics at a discount price? And if you lose, just keep on moving!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2011/09/24/another-penny-auction-site-bigger-bidder-plus-free-bids/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Moving Elsewhere. Slowly</title>
		<link>http://www.earn-web-cash.com/2008/12/07/moving-elsewhere-slowly/</link>
		<comments>http://www.earn-web-cash.com/2008/12/07/moving-elsewhere-slowly/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 01:28:38 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Sundry Musings]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/12/07/moving-elsewhere-slowly/</guid>
		<description><![CDATA[If you take a look at the archives, you may notice that this site hasn&#8217;t been updated in quite some time. April, to be specific. In the late Spring, I got burnt out and kind of lost momentum to continue posting things. Ironically, the site was increasing in traffic and readership. Doh. I was otherwise [...]]]></description>
			<content:encoded><![CDATA[<p>If you take a look at the archives, you may notice that this site hasn&#8217;t been updated in quite some time. April, to be specific.</p>
<p>In the late Spring, I got burnt out and kind of lost momentum to continue posting things. Ironically, the site was increasing in traffic and readership. Doh.</p>
<p>I was otherwise occupied throughout the summer (Damn you, <a href="http://worldofwarcraft.com">WoW</a>!).  When the school year swung around, and I officially quit WoW, I decided it was time to revive my old web development/publishing pursuits.</p>
<p>However, for a variety of reasons, I chose not to just pick up with this site and continue. For one thing, I wanted to combine a handful of projects into one, manageable project.  One reason I stopped posting here was to work on a blog about World of Warcraft.  My new project &#8211; <a href="http://life-of-brian.com">This Life of Brian</a> &#8211; incorporates a couple of different topics/websites under one umbrella.  It makes it a lot easier to keep things up to date.</p>
<p>Also, I grew tired of this domain name.  It sounded catchy at first, but now I think it&#8217;s a bit spammy.  I had a couple articles do well on Digg, and some commenters pointed out the domain name.  Doh.</p>
<p>I&#8217;m now in the process of slowly migrating the archives of this site to my new project.  They&#8217;ll all be contained in the web development and publishing section of the site &#8211; <a href="http://life-of-brian.com/category/nerds-at-work/">Nerds at Work</a>.  It&#8217;s pretty well segregated from the other topics (online gaming, education, and random blogging pursuits).  It&#8217;s got its own theme and its own RSS feed.</p>
<p>I&#8217;m also hosting all of my new content at that site, and this site will no longer be updated.  I just renewed the domain for another year, so this site will be here until next December.  However, don&#8217;t expect anything new here&#8230; and hopefully all of the old articles will be at Nerds at Work by the spring time.</p>
<p>So what are you waiting for?  Head on over and check out my <a href="http://life-of-brian.com/category/nerds-at-work/">latest work</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/12/07/moving-elsewhere-slowly/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Five Useful, Simple WordPress Plugins</title>
		<link>http://www.earn-web-cash.com/2008/03/20/useful-wordpress-plugins/</link>
		<comments>http://www.earn-web-cash.com/2008/03/20/useful-wordpress-plugins/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 00:30:13 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/03/20/useful-wordpress-plugins/</guid>
		<description><![CDATA[I&#8217;ve been playing around with developing WordPress sites for a while now. I love how quick and easy it is to launch a site and update content. One of the greatest features is the thousands of plug-ins available for WordPress. You can find a plug-in for just about anything you want to do &#8211; or [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with developing WordPress sites for a while now.  I love how quick and easy it is to launch a site and update content.</p>
<p>One of the greatest features is the thousands of plug-ins available for WordPress.  You can find a plug-in for just about anything you want to do &#8211; or if you have some PHP know-how, you can develop your own.</p>
<p>Here are five basic WordPress plug-ins that I&#8217;d recommend using for <strong>any</strong> project you start.<br />
<span id="more-179"></span></p>
<h4>Akismet &#8211; Spam Protection</h4>
<p>This plug-in comes pre-installed with WordPress &#8211; and there&#8217;s absolutely no reason you shouldn&#8217;t use it.  <a href="http://akismet.com/>Akismet</a> automatically captures most spam comments and places them in a separate &#8220;spam&#8221; category.  You don&#8217;t get bombarded with &#8220;Moderate Now&#8221; e-mails, and you can trust that your comment logs will be pretty clean.</p>
<p>Since I&#8217;ve been using it on this site (about two months), Akismet has caught a little over 900 comments.  Once a week or so, I scan through the comment log and rescue any false positives.  Occasionally a legitimate comment will get swept up, but all you need to do is select it, hit &#8220;De-spam Comment,&#8221; and it will be saved.</p>
<h4>All In One SEO Plug-In</h4>
<p>The <a href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/">All In One SEO Plug-In</a> is just what it sounds like.  It adds some extra functionality to tweak the SEO of each of your posts and pages.</p>
<p>For example, All In One will automatically generate a description meta tag based on your excerpt and it will automatically generate keywords based on your tags.  You can also use this to modify the title element of each page.  I&#8217;d say it&#8217;s a must have for optimizing your website.</p>
<h4>Exec-PHP</h4>
<p>Early on, I was looking for a way to execute PHP code inside a post.  WordPress doesn&#8217;t have built-in support for this, so you need to find a plug in to do it.</p>
<p>There are dozens of plug-ins that attempted to implement this feature.  <a href="http://bluesome.net/post/2005/08/18/50/">Exec PHP</a> is hands down the best that I&#8217;ve found.  You simply add regular PHP tags to your post and the PHP code will be executed properly.  I&#8217;ve never run into any bugs while using the plug-in, unlike some other plug-ins I&#8217;ve tested.</p>
<h4>Per Post CSS and JS</h4>
<p><a href="http://www.flog.co.nz/">Per Post CSS and JS</a> allows you to attach individual stylesheets or javascript files to your posts or pages.  This is great for changing the look of a specific page without creating an entirely new template.  By attaching these files to individual posts, you cut down a lot on redundancy.</p>
<p>For example, let&#8217;s say you wrote a javascript file that you use in 10% of your posts.  Why should it be attached to the other 90% of your posts?</p>
<p>I&#8217;ve also found it <strong>very</strong> useful for creating HTML/CSS/JS tutorials.  I can place my sample code in external .css and .js files and have it attached properly to the page.  This way I don&#8217;t have to write in-line styles to demonstrate functionality.</p>
<h4>WP Unformatted</h4>
<p>This simple plug-in removes all of the auto-formatting that WordPress adds to your posts.  With <a href="http://alexking.org/projects/wordpress">WP Unformatted</a>, you can add a custom field to your post to tell the plug-in to strip out all of that formatting.</p>
<p>For example, WordPress likes to wrap text in <code>&lt;p&gt;</code> tags.  Sometimes &#8211; like with forms &#8211; this is entirely undesirable.  It can mess up your carefully formatted (and syntactically correct) HTML.</p>
<p>By using WP Unformatted, you can add sophisticated mark up to your post content without worrying that WordPress will screw it up with random <code>&lt;p&gt;</code> and <code>&lt;br /&gt;</code> tags.</p>
<h4>And Many More&#8230;</h4>
<p>There are, of course, dozens of other useful plug-ins.  I&#8217;ve used plenty of other plug-ins that I liked.  However, these are the ones that I feel appeal to the widest audience.</p>
<p>No matter what you&#8217;re doing, you&#8217;ll probably find a use for spam filtering, individualized stylesheets, SEO, PHP, and clean formatting.  I would never start another project without these plug-ins.</p>
<p>What else do you find useful?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/03/20/useful-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Busting 5 Myths About (Ubuntu) Linux</title>
		<link>http://www.earn-web-cash.com/2008/03/03/ubuntu-linux-myths/</link>
		<comments>http://www.earn-web-cash.com/2008/03/03/ubuntu-linux-myths/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 23:07:54 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/03/03/ubuntu-linux-myths/</guid>
		<description><![CDATA[Every time I see a discussion on the forums about Linux vs. Windows vs. Mac, I&#8217;m struck by the persistence of certain myths about Linux. Reading the conversations, it seems obvious that a lot of people who have never tried Linux have seriously inaccurate conceptions of it. I recently switched my main computer to Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>Every time I see a discussion on the forums about Linux vs. Windows vs. Mac, I&#8217;m struck by the persistence of certain myths about Linux.  Reading the conversations, it seems obvious that a lot of people who have never tried Linux have seriously inaccurate conceptions of it.</p>
<p>I recently switched my main computer to <a href="http://www.ubuntu.com">Ubuntu Linux</a>.  With that as an example Distro, let&#8217;s take a look at some popular myths about Linux and see just how true they are.<br />
<span id="more-168"></span></p>
<h4>#5.  You Get What You Pay For</h4>
<p>This is seriously off.  Linux &#8211; and free open source software available for Linux &#8211; is high quality.  If you upgrade to a brand new version of a distro, you&#8217;ll probably encounter some bugs.  Of course, if you upgrade to a new version of Windows right away you <strong>will</strong> encounter some bugs.</p>
<p>The Linux community is full of individuals and teams dedicated to the success of free software.  They quickly find and fix bugs, regularly update programs, and offer help in community sites.  Moreover, most applications and distros are designed <strong>by</strong> users, <strong>for</strong> users, so you can be sure you&#8217;ll get something useful and usable.</p>
<p>In terms of pure value, you certainly get <strong>far more</strong> than what you pay for with Linux.  The same can&#8217;t be said for Windows and applications developed for it.</p>
<h4>#4.  But There Are No Games!</h4>
<p>True, there are few games developed for Linux (with the exception of Quake).  That doesn&#8217;t mean you can&#8217;t enjoy games on a Linux machine, though.</p>
<p>You can grab <a href="http://www.winehq.org/">Wine</a> &#8211; a program that allows you to run Windows applications &#8211; and boot up most computer games.  I don&#8217;t know if I&#8217;d trust it to push the envelope of graphics and gaming performance, so this might not be appropriate for the hardcore gamers out there.</p>
<p>But I hear tell it runs World of Warcraft perfectly.  Is there another game out there?</p>
<h4>#3.  But It&#8217;s Not User Friendly</h4>
<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/03/add-remove-applications.png' title='Ubuntu Add Remove Applications Dialog'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/03/add-remove-applications.thumbnail.png' alt='Ubuntu Add Remove Applications Dialog' /></a>Although this could depend on the distro, this is entirely untrue for Ubuntu.  Ubuntu is designed to be an extremely user-friendly and accessible version of Linux.</p>
<p>Want to install a new application?  No problem.  Go to Add/Remove Programs and search the database of downloadable applications.  In a handful of clicks, you can search for a suitable application, select it for installation, and find out if you need to install any extra libraries.</p>
<p>You can also browse through the System->Administration and Preferences menus to change a whole bunch of settings on your machine.  Windows users familiar with the Control Panel will feel more or less right at home.</p>
<h4>#2.  What About Available Software?</h4>
<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/03/inkscape.png' title='Inkscape Screenshot'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/03/inkscape.thumbnail.png' alt='Inkscape Screenshot' /></a>It&#8217;s often suggested that there is little in the way of software available for Linux machines.  Just look on the shelf at your computer store &#8211; 90% Windows, 10% Mac, 0% Linux.  This argument is sheer ignorance.</p>
<p>The reason you won&#8217;t find many (or any) Linux applications in stores is because you can obtain them for free over the internet.  With Ubuntu, you can install things seamlessly through the Add/Remove Programs dialog.  On other distros, you can surf the web and find whatever application you want.</p>
<p>Need to listen to MP3s?  Grab <a href="http://amarok.kde.org/">Amarok</a>.  Want something like Photoshop for image editing?  Try <a href="http://www.gimp.org/">GIMP</a>.  How about a drawing program like Illustrator?  There&#8217;s <a href="http://www.inkscape.org/">Inkscape</a>.  Would you like a full-featured programming IDE like Dreamweaver?  <a href="http://quanta.kdewebdev.org/">Quanta Plus</a> is waiting for you.  Or maybe you just want an office suite &#8211; so try <a href="http://www.openoffice.org/">Open Office</a>.</p>
<p>For practically every major program you use on Windows, there&#8217;s a Linux alternative of equivalent or superior quality.  You don&#8217;t even have to shell out hundreds of dollars for a license &#8211; and then pay later to upgrade.</p>
<h4>#1.  Fine.  But I Don&#8217;t Know Geek-Speak!</h4>
<p>Perhaps the worst misconception of Linux is that you have to be an uber-hacker fluent in terminal commands in order to browse the internet.  Ubuntu has a <strong>graphical</strong> user interface, just like Windows.</p>
<p>Sure, in 1992 Linux revolved around a command line.  But so did the other 90% of computers that didn&#8217;t use Mac OS.  Today, Linux distros have mature GUIs just like Windows and Mac.  For the average user, there is rarely ever a problem forcing you to open the terminal and enter a text command.</p>
<p>This of course ignores the fact that Linux commands aren&#8217;t hard to learn, and they can make some computing tasks more efficient.  They are, however, a <strong>luxury</strong> at this point.  Nothing is forcing you to use it if you&#8217;re more comfortable with a mouse.</p>
<h4>Get It.  Try It.</h4>
<p>Bottom line, Linux is a great alternative to Windows.</p>
<p>There&#8217;s a great community of developers waiting to improve on it and help you out.  You can run most of your Windows based games in Wine, and you can find <strong>free</strong> Linux alternatives to almost every major <strong>expensive</strong> Windows application.  You don&#8217;t even need to learn geek-speak &#8211; you can keep on using your mouse.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/03/03/ubuntu-linux-myths/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>What Is the Point of this Spam Comment?</title>
		<link>http://www.earn-web-cash.com/2008/02/29/useless-spam-comment/</link>
		<comments>http://www.earn-web-cash.com/2008/02/29/useless-spam-comment/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 00:32:52 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[akismet]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/02/29/useless-spam-comment/</guid>
		<description><![CDATA[Every couple of days, I quickly browse through the Akismet spam bin to see if any real comments got sucked in. There usually aren&#8217;t any. However, I&#8217;ve been struck recently by seemingly pointless spam comments. They are clearly generated by a bot, but they don&#8217;t include any kind of backlink&#8230; what&#8217;s the purpose of that? [...]]]></description>
			<content:encoded><![CDATA[<p>Every couple of days, I quickly browse through the Akismet spam bin to see if any real comments got sucked in.  There usually aren&#8217;t any.</p>
<p>However, I&#8217;ve been struck recently by seemingly pointless spam comments.  They are clearly generated by a bot, but they don&#8217;t include any kind of backlink&#8230; what&#8217;s the purpose of that?<br />
<span id="more-165"></span></p>
<h4>Pointless Spam Comment from Swiss Dude</h4>
<p>I&#8217;ve been getting a lot of spam comments lately that follow a simple pattern.  They are clearly generated by some sort of script that searches for a random phrase, picks a result, and then automatically submits a comment based on the title information in the page.</p>
<p>Here&#8217;s a sample comment.</p>
<blockquote><p>Hey! I came across your blog posting after searching for and your post on Badge | Web Cash makes an interesting read. Thanks for sharing. I will research more next Friday when I have the day off.</p></blockquote>
<p>It seems that a phrase should be inserted in between &#8220;searching for&#8221; and &#8220;and your post.&#8221;  Another dead give away that this is a bot is that it mentions my post on &#8220;Badge | Web Cash.&#8221;</p>
<p>It&#8217;s clearly copied right out of the title tag for the pages.  These include the blog name (Web Cash) at the end, where-as the on-page titles don&#8217;t.  And no human in his right mind would reference a post title like that.</p>
<p>Here&#8217;s another example comment, which seems to have gone through the bot script better.</p>
<blockquote><p>Hello webmaster I found your blog on Google while searching for background check and your post regarding Modify a WordPress RSS Feed Widget with Rel=Nofollow | Web Cash looks very interesting for me. Ive bookmarked the post in my digg account.</p></blockquote>
<p>Again, the title appears verbatim from the <code>&lt;title&gt; element</code>.  The name that is used also appears to line up with the search phrase used (in this case, background check).  </p>
<p>So I guess the script is designed to take a phrase you are trying to optimize for, search for that phrase, and spam all the results with a comment.</p>
<h4>But Some Comments Have No Link&#8230;</h4>
<p>Some of these comments have a link filled into the URI section.  This is logical.  If a bot is going to spider through my site and dump random comments it ought to leave a link back to the original site&#8230; or it&#8217;s just wasting it&#8217;s time.</p>
<p>Yet a lot of these comments (all seemingly coming from &#8220;Swiss Dude&#8221;) have no link attached to them.  I guess maybe the guy botched some of the settings and screwed up the script.</p>
<p>Ah well.  All I can say is &#8211; thank goodness for Akismet.  If I had to wade through all these comments on a daily (hourly?) basis, I&#8217;d probably have commenting turned off.  As it stands, Akismet picks up about 95% of the trash that comes in &#8211; and the rest is inane enough that I just let it go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/02/29/useless-spam-comment/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting Combinations: Calculating a Binomial Coefficient</title>
		<link>http://www.earn-web-cash.com/2008/02/24/combinations-binomial-coefficients/</link>
		<comments>http://www.earn-web-cash.com/2008/02/24/combinations-binomial-coefficients/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 20:52:50 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Game Design]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[probability]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/02/24/combinations-binomial-coefficients/</guid>
		<description><![CDATA[I came across this problem on the DigitalPoint forums the other day. How can we write a script to calculate the total number of random combinations in a set (i.e. the binomial coefficient), and how can we generate a list of these combinations? Today, we&#8217;ll tackle the first part. We&#8217;ll start with a quick primer [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this problem on the DigitalPoint forums the other day.  How can we write a script to calculate the total number of random combinations in a set (i.e. the binomial coefficient), and how can we generate a list of these combinations?</p>
<p>Today, we&#8217;ll tackle the first part.  We&#8217;ll start with a quick primer on math &#8211; what is a binomial coefficient?  Then, we&#8217;ll look into the most efficient way to calculate that and get the total number of possible combinations.<br />
<span id="more-159"></span><br />
<h4>What Is a Binomial Coefficient?</h4>
<p>If it&#8217;s been a while since you took statistics or calculus, you might be scratching your head thinking about what a binomial coefficient is and what it has to do with combinations.</p>
<p>If you&#8217;re looking at a set of random items &#8211; let&#8217;s say 52 playing cards &#8211; and you want to pick out a number of them &#8211; let&#8217;s say a 7 card poker hand &#8211; the binomial coefficient tells you how many possible combinations you can make.</p>
<p>The general formula for that is usually written:</p>
<p><code>(x Choose y) = (x!) / (y! * (x-y)!)</code></p>
<p>In our example above, the total number of combinations you can get in a 7-card poker game is (52! / (7! * 45!)) or somewhere around 130,000,000.</p>
<h4>How Do We Calculate That (in PHP)?</h4>
<p>These methods of calculation will work for any language, really.  We&#8217;ll just use PHP as an example.</p>
<p>The simplest way to calculate the binomial coefficient would be to loop through, calculate each factorial, and then evaluate the equation.  Notice I said simple, not efficient.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">52</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//  This is the numerator, 52!</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$x</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$num</span> <span style="color: #339933;">*=</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$denOne</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//  This is the first part of the denominator, 7!</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$y</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$denOne</span> <span style="color: #339933;">*=</span> <span style="color: #000088;">$b</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$denTwo</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//  This is the second part of the denominator, 45!</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&lt;=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$denTwo</span> <span style="color: #339933;">*=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$combinations</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$denOne</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$denTwo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>PHP will evaluate this properly because it&#8217;s nice and flexible with data types.  Do you know how large 52! is?  Try 8.06581751709E+67 large.</p>
<p>This is clearly too big to be an integer value, but PHP quietly converts the values to floats and keeps running.  There should be a better way &#8211; one where we don&#8217;t have to calculate all of the factorials.</p>
<h4>Method Two &#8211; Using array_diff</h4>
<p>This method is a bit more along the lines of human logic.  However, it&#8217;s still not going to be efficient.  Although it&#8217;ll work with smaller numbers than the first method, it&#8217;ll take more time and memory to compute.</p>
<p>Basically, we&#8217;ll create three arrays.  One for each set &#8211; {1, 2, 3, &#8230; 52}, {1, 2, 3, &#8230; 7}, {1, 2, 3, &#8230; 45}.</p>
<p>Since we know that the third set (45!) will be in the denominator and the first set (52!) will be in the numerator, we can use a nifty function called array_diff to cancel out all of the common values and shrink the numerator for us.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$newNumerator</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_diff</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$oldNumerator</span><span style="color: #339933;">,</span> <span style="color: #000088;">$oldDenominator</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then we can calculate the factorials by multiplying all of the values in the array.  We can also make use of another PHP function here &#8211; array_product.  It does more or less what it sounds like &#8211; it finds the product of all the values in an array.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$x</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$num</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// the numerator array, 52!</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$denOne</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$y</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$denOne</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$b</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//  The first denominator array, 7!</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$denTwo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&lt;=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$denTwo</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// The second denominator array, 45!</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//  Use array_diff to cancel out the common values in 52! and 45!</span>
<span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_diff</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #339933;">,</span> <span style="color: #000088;">$denTwo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$combinations</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_product</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #990000;">array_product</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$denOne</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This keeps the numbers much smaller.  Therefore we can work with bigger combinations before PHP putts out.  However, the arrays can eat up a lot of memory and processing power&#8230; so there still should be a better way.</p>
<h4>Combine the Two Concepts</h4>
<p>The more efficient way is to combine the two concepts.  We&#8217;ll use the first method of multiplying through a loop to generate the factorials.  This is far more efficient than iterating an array.</p>
<p>However, we&#8217;ll still cancel out the common values between 52! and 45!.  To do this, we modify the first loop so that it counts down from $x (52) to $x &#8211; $y (45).  Then we simply ignore the third loop &#8211; since it&#8217;s values were essentially counted when we calculated the first loop.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$x</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$y</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span><span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$num</span> <span style="color: #339933;">*=</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$den</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$y</span><span style="color: #339933;">;</span> <span style="color: #000088;">$b</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$den</span> <span style="color: #339933;">*=</span> <span style="color: #000088;">$b</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$combinations</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$den</span><span style="color: #339933;">;</span></pre></div></div>

<p>At this point, our script is pretty efficient.  It doesn&#8217;t use up a lot of memory, it executes quickly, and it&#8217;s not calculating very many redundant values.</p>
<p>However, there&#8217;s still a limit to what we can do.  The biggest number PHP seems to be able to calculate is 170!.  After PHP sees the value 7.25741561531E+306 it just seems to give up.  Geez, like 300 zeroes is a lot.</p>
<p>You could improve this a bit more, and increase the number of combinations it could compute.  Rather than calculating the $numerator and $denominator separate, as we did here, you&#8217;d want to calculate the $denominator first and then cancel out values as you multiply the numerator.</p>
<p>In other words, calculate the $denominator as normal.  Then, while you&#8217;re looping through to calculate the numerator, you factor out any common values in the $denominator and the number about to be multiplied into the numerator.</p>
<h4>Who Cares About How Many Combinations&#8230; I Want to See Them</h4>
<p>This is really the boring part.  Who cares how many combinations there are?  We can easily find that with a calculator.</p>
<p>The interesting part &#8211; where we definitely need a computer to help us &#8211; is to iterate through the set and find all of the possible combinations.  We&#8217;ll come back to this later in the week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/02/24/combinations-binomial-coefficients/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Javascript Game Spotlight: 3d Worm</title>
		<link>http://www.earn-web-cash.com/2008/02/23/javascript-3d-worm/</link>
		<comments>http://www.earn-web-cash.com/2008/02/23/javascript-3d-worm/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 15:09:07 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/02/23/javascript-3d-worm/</guid>
		<description><![CDATA[I was browsing the <a href="http://www.frihost.com" rel="nofollow">Frihost</a> forums this morning, and I stumbled on a cool Javascript game.

One of the Frihost users and his friend made a <a href="http://tekage.com.ar/uploaded/3Dworm/">3d Worm game</a>.  Although the directions are in Spanish (as is the source code), the game is pretty cool.  It's a good example of what you can accomplish with some Javascript/DOM trickery.]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/02/3dworm.png' title='3d Worm Screenshot'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/02/3dworm.thumbnail.png' alt='Screenshot of a 3d Worm game written in Javascript.' /></a>I was browsing the <a href="http://www.frihost.com" rel="nofollow">Frihost</a> forums this morning, and I stumbled on a cool Javascript game.</p>
<p>One of the Frihost users and his friend made a <a href="http://tekage.com.ar/uploaded/3Dworm/">3d Worm game</a>.  Although the directions are in Spanish (as is the source code), the game is pretty cool.  It&#8217;s a good example of what you can accomplish with some Javascript/DOM trickery.<br />
<span id="more-153"></span><br />
Playing the game is simple enough.  You use the four arrow keys and the Q/A key to pick one of six directions to go in.</p>
<p>At first, it can be very difficult to gauge the &#8220;3d&#8221; position of the apple.  Once you learn to use the shadows to your advantage, the game becomes pretty easy.  It&#8217;s still fun, though, and a great example of how Javascript can be used to make an interface for a game.</p>
<p>You see a few cool things here.</p>
<p>For one, the script captures keyboard input to drive the action.  Rather than clicking on buttons/boxes on the screen, the user can hit the appropriate keys and the game responds.  This is important for making a game feel &#8220;real&#8221; and not a kind of mash-up.</p>
<p>A lot of the positioning is done with &#8220;position: absolute&#8221; and the &#8220;top&#8221;/&#8221;left&#8221; styles.  This let&#8217;s you use the screen as a kind of canvas &#8211; drawing the images where-ever you need them.  It frees you from the constraints of normal HTML positioning, where you need to float/margin/padding stuff to get it to line up where you want.</p>
<p>It&#8217;s possible to read source code written in another language.  I just find this interesting.  The source is written in Spanish &#8211; so most of the variable/function names don&#8217;t mean a lot to me.  However, the code is pretty straightforward so it&#8217;s still easy enough to follow what&#8217;s going on.</p>
<p>Well go play some Worm.  This has inspired me to go do some coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/02/23/javascript-3d-worm/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Which PHP Logical Operator Is Better &#8211; &#8216;and&#8217; or &#8216;&amp;&amp;&#8217;?</title>
		<link>http://www.earn-web-cash.com/2008/02/16/php-logical-operator/</link>
		<comments>http://www.earn-web-cash.com/2008/02/16/php-logical-operator/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 20:07:47 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[logical]]></category>
		<category><![CDATA[operator]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/02/16/php-logical-operator/</guid>
		<description><![CDATA[I was browsing the Sitepoint forum today and somebody raised this question &#8211; is it better to use &#8216;and&#8217; or &#8216;&#038;&#038;&#8217; as a logical operator in PHP? In most cases, they evaluate the same way. For example, these two statements are equivalent. if &#40;$x &#38;&#38; $y&#41; &#123; ... &#125; if &#40;$x and $y&#41; &#123; ... [...]]]></description>
			<content:encoded><![CDATA[<p>I was browsing the Sitepoint forum today and somebody raised this question &#8211; is it better to use &#8216;and&#8217; or &#8216;&#038;&#038;&#8217; as a logical operator in PHP?  </p>
<p>In most cases, they evaluate the same way.  For example, these two statements are equivalent.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> and <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>So what&#8217;s the difference?<br />
<span id="more-119"></span></p>
<h5>&#038;&#038; vs And &#8211; Is One Quicker?</h5>
<p>Initially, I thought there may have been a speed factor.  &#038;&#038; and || are the traditional logical operators &#8211; the ones I used when I learned C++.</p>
<p>Therefore, it would be logical to assume that &#8216;and&#8217; and &#8216;or&#8217; are simple conveniences added to PHP.  If these have to be re-routed through &#8216;&#038;&#038;&#8217; and &#8216;||&#8217; to actually evaluate, there would be a slight performance hit if &#8216;and&#8217; was used instead of &#8216;&#038;&#038;&#8217;.</p>
<p>I did some benchmark testing to see if this turned out to be true, and there was no appreciable difference in execution time.</p>
<p>I designed a script (<a href='http://www.earn-web-cash.com/wp-content/uploads/2008/02/log.txt' title='Logical Operator Benchmark Test Results'>here&#8217;s the source code if you want to try it yourself</a>) to test &#8216;&#038;&#038;&#8217; verse &#8216;and&#8217;.</p>
<p>The basic timed task is to compare a set of numbers.  In order to ensure that each time the script executed it did the same comparisons, I hard coded five sets of numbers.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This was executed 100,000 times and timed.  The time was recorded and the entire script was run over 100 times.  At the end, an average was taken.  The script was then modified to replace &#8216;&#038;&#038;&#8217; with &#8216;and&#8217; in the statement, and an average of 100 times was taken again.</p>
<p>The results showed no appreciable difference between using &#8216;&#038;&#038;&#8217; and &#8216;and.&#8217;  Using &#8216;&#038;&#038;&#8217; took an average of 0.152 seconds, while &#8216;and&#8217; took an average of .155 seconds.  At a little under 2% variation, I doubt that&#8217;s statistically significant.</p>
<p>I did notice that there were a few more outliers in the &#8216;and&#8217; set &#8211; a couple times were slightly faster and a couple times were slightly longer than any of the &#8216;&#038;&#038;&#8217; times.</p>
<p>Regardless, it appears that there&#8217;s no appreciable difference in execution time or efficiency between &#8216;and&#8217; and &#8216;&#038;&#038;&#8217;.</p>
<h5>Precedence in Evaluation</h5>
<p>The only difference between the two operators, then, turns out to be their <a href="http://us3.php.net/manual/en/language.operators.php#language.operators.precedence">precedence</a>.</p>
<p>As the documentation describes, &#8220;&#038;&#038;&#8221; has greater precedence than &#8220;and&#8221;.  This is somewhat misleading.  An example and some more accurate wording would help illustrate what this means.</p>
<p>This is the example in the documentation.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$g</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// $g will be assigned to (true &amp;&amp; false) which is false</span>
<span style="color: #000088;">$h</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span> and <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// $h will be assigned to true</span></pre></div></div>

<p>The level of precedence between &#8216;&#038;&#038;&#8217; and &#8216;and&#8217; is rather irrelevant here.  However, they both have different levels of precedence relative to the &#8216;=&#8217; operator.</p>
<p>&#8216;&#038;&#038;,&#8217; like most operators, is evaluated before the &#8216;=&#8217; operator.  Therefore, the entire expression <code>true &#038;&#038; false</code> is evaluated and stored in $g.</p>
<p>&#8216;and&#8217; on the other hand is evaluated <strong>after</strong> the &#8216;=&#8217; operator.  Therefore &#8216;true&#8217; is stored in $h and <strong>then</strong> the expression <code>$h and false</code> can be evaluated.</p>
<h5>Is There a Lesson Here?</h5>
<p>Yes.  Precedence of operators in PHP can be a bit strange.</p>
<p>Normal mathematical operations are normal enough.  As expected, multiplication and division are evaluated before plus and minus.  The PHP developers remembered the order of operations from middle school math.</p>
<p>However, other operators (like these logical operators) can have unpredictable consequences.  Instead of relying on PHP&#8217;s hard-coded levels of precedence, you should use parentheses often to make sure that your logic is being evaluated the way <strong>you</strong> want it to be.</p>
<p>For example, you could fix the &#8216;&#038;&#038;&#8217; &#8211; &#8216;and&#8217; discrepancy with a set of parentheses.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$g</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$h</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span> and <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now we have explicitly told PHP to evaluate the &#8216;and&#8217;/'&#038;&#038;&#8217; expression first and <strong>then</strong> assign a value to our variable.  Likewise, you could use a set of parantheses around <code>$h = true</code> to revert to the other order of evaluation.</p>
<p>While you may understand these obscure rules, not everyone who comes along will.  To prevent confusion in the future and needless headaches, tell PHP how you want expressions to be evaluated.  Don&#8217;t let it decide for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/02/16/php-logical-operator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More Backlinks, More Cash with Squidoo</title>
		<link>http://www.earn-web-cash.com/2008/02/15/backlinks-cash-squidoo/</link>
		<comments>http://www.earn-web-cash.com/2008/02/15/backlinks-cash-squidoo/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 21:25:35 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Online Tools]]></category>
		<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[Traffic]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[backlinks]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[squidoo]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/02/15/backlinks-cash-squidoo/</guid>
		<description><![CDATA[I&#8217;d seen this idea suggested on a forum, and it&#8217;s about time I got around to it. I created my first lens at Squidoo. Why? I was able to work in a few nice backlinks to my site and my articles. I&#8217;ll earn some cash if it gets traffic of its own. How Does Squidoo [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d seen this idea suggested on a forum, and it&#8217;s about time I got around to it.  I created my first lens at <a href="http://www.squidoo.com/lensmaster/referral/Walkere">Squidoo</a>.</p>
<p>Why?  I was able to work in a few nice backlinks to my site and my articles.  I&#8217;ll earn some cash if it gets traffic of its own.<br />
<span id="more-115"></span></p>
<h5>How Does Squidoo Work?</h5>
<p><a href="http://www.squidoo.com/lensmaster/referral/Walkere">Squidoo</a> is another writing site online &#8211; with a bit of a twist.</p>
<p>Squidoo isn&#8217;t about articles&#8230; it&#8217;s about &#8220;lenses.&#8221;  Each lens is a mini-website.  It&#8217;s longer and more in depth than an article &#8211; but it&#8217;s only one page.</p>
<p>You add all the content you want about your topic &#8211; writing, pictures, polls, link lists, etc &#8211; and hope users come a knockin.  If you do get traffic, you get a portion of the advertising revenue.</p>
<p>You can eke out a few extra bucks by including items for sale on your lens &#8211; like books at Amazon.com.</p>
<h5>Why Did I Write a Lens at Squidoo?</h5>
<p>I&#8217;m pretty sure my lens (<a href="http://www.squidoo.com/xml-php">XML Through PHP</a>) isn&#8217;t going to make a ton of money.  That&#8217;s no reason to scoff at the idea, though.</p>
<p>The lens I created was (as you might have guessed from the title) about XML and PHP.  In the past week or so, I&#8217;ve written three articles here about working with XML.  Do you see where I&#8217;m going with this?</p>
<p>The lens is an overview of working with XML.  Three parts of the lens are hooks to get the reader to come read an article here about a particular application of XML in PHP.</p>
<p>In writing this lens, I accomplished a number of tasks.  I created a useful online resource &#8211; it should be educational for someone that&#8217;s new to working with XML and PHP together.  I created some advertisement for my site &#8211; any readers of the lens should be enticed to click on one or another of my links.  I also improved the SEO of my site by including five targeted backlinks from the lens to content on my own site.</p>
<h5>You Should Join Too!</h5>
<p>I don&#8217;t see any reason <strong>not</strong> to join Squidoo and make a lens or two about your niche.</p>
<p>You can create optimized links to your site and also capture some extra search engine traffic and direct it back to your site.  There&#8217;s a decent referral system in place &#8211; you get $5 if a referree makes $15.  You can also diversify your online writing portfolio and make a little more loot every month.</p>
<p>So head on over to Squidoo, <a href="http://www.squidoo.com/lensmaster/referral/Walkere">sign up, and write your own lens</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/02/15/backlinks-cash-squidoo/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Five PHP Coding Mistakes to Avoid</title>
		<link>http://www.earn-web-cash.com/2008/02/04/php-coding-mistakes/</link>
		<comments>http://www.earn-web-cash.com/2008/02/04/php-coding-mistakes/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 01:06:21 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Sundry Musings]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/02/04/php-coding-mistakes/</guid>
		<description><![CDATA[While browsing through dZone the other day, I stumbled on this article &#8211; 40 signs you really are a lousy PHP programmer. While I don&#8217;t agree with all of the author&#8217;s points, it&#8217;s an interesting list of php coding habits to avoid &#8211; but that most of us tend to pick up anyway. Here&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>While browsing through <a href="http://www.dzone.com">dZone</a> the other day, I stumbled on this article &#8211; <a href="http://reinholdweber.com/?p=19">40 signs you really are a lousy PHP programmer</a>.</p>
<p>While I don&#8217;t agree with all of the author&#8217;s points, it&#8217;s an interesting list of php coding habits to avoid &#8211; but that most of us tend to pick up anyway.  Here&#8217;s a list of my five biggest pet peeves.<br />
<span id="more-99"></span></p>
<h5>5.  Output Information Directly in Functions</h5>
<p>This is pretty annoying when it&#8217;s unexpected.  I installed a WordPress plugin (wp_time_since), and I expected it to return a value to me.  I ran into some weird outputting difficulties when I tried to echo the plugin output.</p>
<p>After a few minutes I figured out that the plugin was echo&#8217;ing the output for me &#8211; instead of letting me store it and output it myself.  Give me the information, and let me worry about outputting it.</p>
<h5>4.  Use $_GET When $_POST Would Be Better</h5>
<p>There are appropriate places to use $_GET &#8211; such as search queries and simply fetching information from a database.  However, any time you&#8217;re modifying something in the database you should be using a post method and the $_POST array.</p>
<p>This isn&#8217;t 100% safe since people can still spoof your script with their own form or a simple http header request, but at least it prevents the average user from accidentally putting random stuff in the URL and screwing up your day.  Use the request superglobal arrays wisely.  They&#8217;re divided into two separate arrays for a reason.</p>
<h5>3.  Return HTML, not Data, Strings, or Objects</h5>
<p>This kind of goes along with #5.  It&#8217;d be nice if your function gave me raw output, so that I could style and structure it the way I want to.  If nothing else, I&#8217;d like to wrap the text in my own paragraph tag, in case I want to give it a class.</p>
<h5>2.  Misuse Object Oriented Programming</h5>
<p>For a lot of web-script programmers, OOP is a strange beast.  Why?  Because it&#8217;s new to PHP.</p>
<p>I come from a C++ background, and OOP is pretty natural to me.  Therefore it&#8217;s annoying when OOP is misused and abused.  It&#8217;s not simply a container for functions.  You should appropriately use private/public methods.  It should make some kind of sense, in an &#8220;object&#8221; kind of way.</p>
<p>Otherwise, just stick with procedural programming.  It&#8217;s still a valid way of creating your script &#8211; and it may just be simpler.</p>
<h5>1.  Not Clearly Commenting Code</h5>
<p>I <strong>hate</strong> this.  I really, really hate this.</p>
<p>Code should be clearly commented and documented.  If I&#8217;m wading through the API of a large project, I want a narrative of what the function is doing, what the parameters should look like, and what I&#8217;m getting in the end.  I don&#8217;t have all day to figure out your script &#8211; so tell me what it&#8217;s doing.</p>
<p>Lastly, there&#8217;s one thing he mentions that I really don&#8217;t agree with.</p>
<p>The author suggests that templating engines (like smarty) are a waste of time.  I originally wondered what the purpose of them were, until I used it to build a module for CMS Made Simple.</p>
<p>Templating engines can be very helpful tools to structure and style your output.  They&#8217;re also terrific if you want to break down the developer/designer tasks.  The developer is responsible for fetching and creating the output, and the designer takes the pre-defined Smarty (or template) variables and places them in the template where they need to be.</p>
<p>I can see why some people wouldn&#8217;t like them for small tasks, but they can be immensely helpful.  Work with them for a while before you pass judgement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/02/04/php-coding-mistakes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

