<?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>Proffer&#039;s Ramblings</title>
	<atom:link href="http://johnproffer.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnproffer.com</link>
	<description>Development Blog</description>
	<lastBuildDate>Sat, 28 Aug 2010 15:54:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Business closed, new agenda!</title>
		<link>http://johnproffer.com/2010/08/business-closed/</link>
		<comments>http://johnproffer.com/2010/08/business-closed/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 19:31:11 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[3 Guys Lab]]></category>
		<category><![CDATA[fusion]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=96</guid>
		<description><![CDATA[Well, it was good while it lasted.   I decided to close our busienss, 3 Guys Lab, because after many months of delays and back-and-forths and so on, ultimately nobody really trusted each-other anymore, and nothing was getting done.
We had some great ideas that were very, very marketable.  But without good inter-owner relations and TRUST, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it was good while it lasted.   I decided to close our busienss, 3 Guys Lab, because after many months of delays and back-and-forths and so on, ultimately nobody really trusted each-other anymore, and nothing was getting done.</p>
<p>We had some great ideas that were very, very marketable.  But without good inter-owner relations and TRUST, it&#8217;s moot.   I may continue developing some of my ideas that we were originally going to develop together, but depends on my time (which is scarce these days).</p>
<p>So, what&#8217;s next for me?</p>
<p>Currently, I work as a Software Engineer, for <a title="Community Techknowledge" href="http://www.communitytech.net" target="_blank">Community Techknowledge</a>, which is an amazing company with a great and extremely useful product (<a title="Apricot" href="http://www.apricot.info" target="_blank">Apricot</a>), which I highly recommend to y&#8217;all.  End of shameless plug.</p>
<p>As for my &#8220;off&#8221; time -  I have a few projects going, one of which I think I&#8217;ll likely blog about:</p>
<ul>
<li>Project #1 &#8211; <strong>Fusion Generator </strong><strong></strong>Yeah, real Fusion, as in Nuclear Fusion.  It&#8217;s nothing new and has been  done by quite a few hobbyists, and at least 2 national labratories.   They&#8217;re better known as Fusors.  So I&#8217;m jumping into that bandwagon, and  going to help try to figure out ways to harness its energy.   If you  want to build your own, it&#8217;s relatively easy &#8211; just build a 20kv DC  power source, fill a vacuum chamber with Deuterium, charge the case, and  fire ions into the center.  It produces a fusion reaction and releases  enormous amounts of energy (in the million-volt range).</li>
</ul>
<ul>
<li>Project #2 &#8211; <strong>Perpetual Generator </strong> &#8211; This one&#8217;s a bit of a &#8220;try-but-probably-wont-work&#8221; project.  I&#8217;m  experimenting with ways to re-channel the magnetic fields of ND:50  magnets in such a way that it&#8217;d allow a ring of magnets to push a  camshaft and drive a generator motor.  Nobody&#8217;s ever succeed in creating  a perpetual generator, so I don&#8217;t have high hopes but it&#8217;ll be fun to  experiment with, nontheless.</li>
</ul>
<ul>
<li>Project #3 &#8211; <strong>Ultra-efficient MVC framework  &#8211; </strong>I&#8217;ve already developed 2 MVC frameworks, but as any developer knows,  they can always be improved.  So this third round focuses on two things:
<ol>
<li>Improve speed by optimization and reduction of execution paths.</li>
<li>Improve automation and output optimization by file inclusion detection (e.g. css/js library requirements)</li>
</ol>
<p>This  one&#8217;s well underway, and the underlying framework is about 90%   finished.  I&#8217;ve managed to whittle execution time down to 0.0007   seconds/avg, with 3mb memory usage after loading 20 classes and   generating a front-end display (via smarty).  I lost about 0.00097s after I switched to a mysql-based session management   method (final benchmark at 0.00161s/avg).</p>
<p>The MVC is unfortunately private and will (hopefully) be   used in future versions of Apricot, provided everyone there likes it.    If not, then maybe I&#8217;ll publish it, minus any proprietary Apricot/CTK   functionality</li>
<li>Project #4 &#8211; <strong>Compact microalgal growth methods</strong> &#8211; Currently I&#8217;m researching methods on how to grow microalgal in denser farming environments.  I can&#8217;t comment more on this one &#8211; it&#8217;s a FOR-PROFIT project, taking direct aim at <a href="http://en.wikipedia.org/wiki/Supermajor" target="_blank"><strong>Big Oil</strong></a>&#8217;s monopoly.</li>
<li>Project #5 &#8211; ??  &#8211; I&#8217;m really open to working with anyone who has a great idea that <strong>will benefit society</strong>.   I want to do something to contribute back to society, and improve everyone&#8217;s lives.  So if you have any ideas towards this regard,  that&#8217;re feasible and needed,  I&#8217;m open.  The only conditions I have:
<ol>
<li>The project/idea must not be for the sole benefit of a small group of individuals with intent to profit.</li>
<li>A patent may not be applied for.  All research / results must be for public benefit ONLY, and be of public domain.Like I said, I&#8217;m a busy guy, so if any more of my time is to be sacrificed towards a project, it needs to be a real project with the goal of bettering society, not making anyone rich.  Because I think that&#8217;s the cornerstone of problems in modern society &#8211; people don&#8217;t believe in eachother  &#8211; it&#8217;s all about the dollar bottom line, keeping board members happy, keeping politicans happy, keeping industry owners happy..  nobody cares if the PEOPLE are happy.   I want to change that.</li>
</ol>
</li>
</ul>
<p>Anyway, I&#8217;ll look into starting maybe fusor.johnproffer.com or something, for the Fusor project.  It&#8217;s going to take a while to do since I&#8221;m doing it in my spare time while doing other stuff as well (e.g. MVC).  But it&#8217;ll happen! <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2010/08/business-closed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First product</title>
		<link>http://johnproffer.com/2010/01/first-product/</link>
		<comments>http://johnproffer.com/2010/01/first-product/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 15:21:42 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[3 Guys Lab]]></category>
		<category><![CDATA[Oscien]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=92</guid>
		<description><![CDATA[Our first product, Oscien, will be in early beta Jan 22, 2010.  Oscien is a new type of search engine.  More details to come after we send out beta test invites.
If you&#8217;re interested, give me your email and I&#8217;ll send an invite your way once the service is ready.  Please don&#8217;t post your email in [...]]]></description>
			<content:encoded><![CDATA[<p>Our first product, Oscien, will be in early beta Jan 22, 2010.  Oscien is a new type of search engine.  More details to come after we send out beta test invites.</p>
<p>If you&#8217;re interested, give me your email and I&#8217;ll send an invite your way once the service is ready.  Please don&#8217;t post your email in comments, unless you enjoy spam. <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2010/01/first-product/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Business</title>
		<link>http://johnproffer.com/2009/10/new-business/</link>
		<comments>http://johnproffer.com/2009/10/new-business/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 23:54:55 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[programming - PHP]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=88</guid>
		<description><![CDATA[I&#8217;ve started a new business along with 2 good friends.  We&#8217;ll be churning about about 10 products, including 2 hardware products and numerous iPhone applications.
Going to be crazy busy for a while, since I also work for a company in DC, writing a very large, very complicated web application (SOA).  I&#8217;m the only developer for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started a new business along with 2 good friends.  We&#8217;ll be churning about about 10 products, including 2 hardware products and numerous iPhone applications.</p>
<p>Going to be crazy busy for a while, since I also work for a company in DC, writing a very large, very complicated web application (SOA).  I&#8217;m the only developer for that company, so definitely have my work cut out for me <img src='http://johnproffer.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />   It&#8217;s a great company though &#8211; love working with them &#8211; they&#8217;re a small business, very down to earth and dont take themselves too seriously.</p>
<p>As for my business, it&#8217;s called 3 Guys Lab, www.3GuysLabcom (nothing really there yet since we just started it).  3GL will be developing a number of applications that can serve many different business markets simultaneously, targeting both local and international markets.  We&#8217;ll also be writing some very specialized products.  Unfortunately cant list those due to their specialized nature.  Stealth mode and all that <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/10/new-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back in America!</title>
		<link>http://johnproffer.com/2009/08/back-in-america/</link>
		<comments>http://johnproffer.com/2009/08/back-in-america/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 10:42:37 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[china]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=79</guid>
		<description><![CDATA[Wow, 3 months since my last post.  I&#8217;ve been seriously neglecting my poor blog.
We finally returned to the states.  At least, two of us did.  My wife and I.  Our daughter, Lilly, is staying in China for a few more months, to attend school there.  We&#8217;re quite proud of her &#8211; she&#8217;s only 3.5 [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, 3 months since my last post.  I&#8217;ve been seriously neglecting my poor blog.</p>
<p>We finally returned to the states.  At least, two of us did.  My wife and I.  Our daughter, Lilly, is staying in China for a few more months, to attend school there.  We&#8217;re quite proud of her &#8211; she&#8217;s only 3.5 years old and already knows 3 languages.  Ok, she can&#8217;t hold a solid conversation in Chinese yet, but she knows the vocabulary, and can count from 1-20 in chinese, as well as make basic sentences.   That&#8217;s something, considering she was only there for 2 months. <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Haven&#8217;t finished sorting through all our pics yet &#8211; it&#8217;s likely I wont be posting too many.  Don&#8217;t really have anyplace to post them, and my blog&#8217;s primary focus is on development topics and the like &#8211; so I guess its kind of my.. portfolio? Resume? Window into the labyrinth of my mind?  Dunno, take your pick, but I&#8217;d like to keep personal stuff to a minimum, I guess.   Unless it&#8217;s about Lilly, of course <img src='http://johnproffer.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   She&#8217;s the gem of my life!  It&#8217;s amazing to watch her blossum, her personality morphing as she grows and learns new things.  If I could beam online, y&#8217;all would be blind, I tell you <img src='http://johnproffer.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Anywhoo.. China was awesome.  There is NOTHING, I think, in the world quite like the Chinese &#8211; they&#8217;re such a close-knit people, yet so friendly and welcoming to complete strangers.   Definitely a unique experience, and we look forward to returning sometime this December or Jan.  Definitely look forward to the food.  OMG.  The food there is AMAZING.  They put US organics to shame. In the 3 months I was there, never once was anything frozen brought into anyone&#8217;s home.  Live fish and shellfish were available in every supermarket, and extremely affordable (not just by American currency standards &#8211; but in the Yuan as well!).  Meat came directly from live animals butchered only when someone purchases a cut.  Absolutely nothing wasted, no preservatives or food dyes needed or used.  And I have to tell you, the taste is completely different.  Just.. wow.  Have you ever seen a clam trying to escape a bin in your local supermarket?  I can tell you right off, nope.  Never happen.  Maybe if you live next to the docks.   Have to say though, watching a clam trying to escape is.. hilarous.</p>
<p>Let me paint a picture in your mind.   You&#8217;re in front of a big blue bucket, filled with circulated water.  The bottom of the bucket is lined with clams.  Exactly one layer of live, happy clams.  There&#8217;s more bins on either side, about 10 or 15 in either direction.  All identical to the one you&#8217;re standing in front of, each one with a different size or species of clam, mullosk, oyster, or other shellfish.  Anyway back to our clams.  You see one crack open just slightly.  a tube protrudes, and jettisons water and sand, before sucking more water in.   Tap the bin a bit, and the scene changes &#8212; the clam never opens the crack any wider &#8211; it&#8217;s open maybe 1mm.  But from that 1mm crack, a huge muscle blurbs out, like something out of &#8220;The Blob&#8221; &#8212; and starts pushing the thing around like a giant tongue.  It never gets anywhere &#8211; but its a damn funny sight to watch.  Yep, very fresh shellfish indeed.  Let&#8217;s see you do THAT, Whole Foods!</p>
<p>I spent the majority of my time in southeastern china, but was able to hit up Shanghai briefly.  Didn&#8217;t see any of the kinds of foods I saw in southeastern China, so not sure if the organic/freshness thing is limited to smaller cities.  Definitely hit up the small cities for a down-home experience &#8212; but stay away from Guangzhou lol.</p>
<p>For all you girls reading this blog &#8211; China is definitely king when it comes to shopping.  I forgot to take pics of their malls &#8211; but suffice it to say, you will never see 2 of the same shoe design &#8212; or color.  Not even similiar.   Thousands and Thousands of cloth and shoe designs, guaranteed to leave you in a fashion-induced seizure.</p>
<p>For you guys &#8212; sadly, technology is hair-raisingly expensive there.  What would cost $60 USD here, costs about $90 USD there.  Flat-screen TV&#8217;s start at around 15,000 Yuan ($2,196 USD at current exchange rates).  There&#8217;s cheaper, chinese-branded flats-screens, but they&#8217;re almost guaranteed to explode. Even the chinese wont buy them.</p>
<p>A last note for anyone planning to travel in China &#8211; Please download Tor to a USB thumb drive.  China&#8217;s military monitors *ALL* internet traffic, reads IM chats, and emails while they&#8217;re in transit between you and anywhere in the US.  If you&#8217;re just telling family back home of the sights, thats no biggie. But if you do any kind of business or work with code.. TOR. Oh, and just about every single blog, news, and video site on the internet is blocked in china, including Youtube, Facebook, Twitter (sometimes), Vimeo, and numerous other  services.  Really, I dont know why they bother having internet over there.  Nothing&#8217;s accessible!  Tor will get you around China&#8217;s Great Firewall, and restore the internet equivalent of life-giving oxygen.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/08/back-in-america/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Backup Strategy</title>
		<link>http://johnproffer.com/2009/05/mysql-backup-strategy/</link>
		<comments>http://johnproffer.com/2009/05/mysql-backup-strategy/#comments</comments>
		<pubDate>Sat, 09 May 2009 11:23:19 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[programming - bash]]></category>
		<category><![CDATA[bash mysql backup]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=53</guid>
		<description><![CDATA[As I mentioned in a past blog entry, I&#8217;ve been working my butt off on a new vertical market product, which is currently in beta.  As I finished off a section of code last week, I started thinking about the database &#8211; it was growing larger by the day, both in table count and data [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in a past blog entry, I&#8217;ve been working my butt off on a new vertical market product, which is currently in beta.  As I finished off a section of code last week, I started thinking about the database &#8211; it was growing larger by the day, both in table count and data population.  Data backup and recovery was a growing concern.  While hosted services carry their own backup solutions (usually automatically part of your hosting plan &#8212; whether they say so or not [think: liability!]), the same can&#8217;t be said for most developers who tend  to develop locally, and rely heavily upon manual backups when they feel they reach a critical point in development.</p>
<p>Anyway,  After reading a number of interesting articles on homebrew backup solutions (one interesting method involved <a href="http://www.viget.com/extend/backup-your-database-in-git/" target="_blank">using GIT to store differential backups</a>, which is nice!), I ultimately decided I needed something more fine-grained &#8211; since most of them relied on mysqldump of entire databases into a single file.  I like being able to run data stress tests and just restore a single table afterwards rather than having to do a whole import.</p>
<p>The option I selected was to write a bash script and have it run off of cron (since I run Linux).  It&#8217;s fast, reliable, and uses very little space.  Thought I&#8217;d share it, if theres anyone else out there who needs something similiar.  it creates incremential backups separated into directories named after the date, then further separated by database name.  Each individual table is dumped to its own .sql file and bzip&#8217;d.  Here&#8217;s the bash code</p>
<pre class="brush: bash;">
#!/bin/bash

# cd to the script dir to make sure files are put here
NOW=&quot;$(date +&quot;%Y%m%d&quot;)&quot;
BACKUP_PATH=&quot;/mnt/backups/db/$NOW&quot;
if [ ! -e &quot;$BACKUP_PATH&quot; ]; then
        mkdir -p $BACKUP_PATH
fi

cd $BACKUP_PATH

DATABASES=&quot;$(mysql -Bse 'SHOW DATABASES')&quot;

# loop through the databases
for DB in ${DATABASES[@]}
	do
		mkdir -p &quot;$DB&quot;
		echo &quot;Backing up $DB:&quot;
		TABLES=&quot;$(mysql $DB -Bse 'SHOW TABLES')&quot;
		# loop through the tables in the database
		for TABLE in ${TABLES[@]}
			do
				echo &quot;===$TABLE&quot;
				mysqldump &quot;$DB&quot; &quot;$TABLE&quot;  | bzip2 &amp;gt; &quot;${DB}/${TABLE}.bz2&quot;
		done
done
echo &quot;done.&quot;
</pre>
<p>I put in the echos so I&#8217;d get a nice somewhat formatted email from cron whenever it runs.  You can of course remove them.  Any feedback or updates would be appreciated. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/05/mysql-backup-strategy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic SEO Keyword Generation from Dynamic Content</title>
		<link>http://johnproffer.com/2009/05/page-seo/</link>
		<comments>http://johnproffer.com/2009/05/page-seo/#comments</comments>
		<pubDate>Mon, 04 May 2009 12:22:23 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[programming - PHP]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=48</guid>
		<description><![CDATA[I wrote this over a year ago now &#8211; it was my first attempt at automatic meta compilation based on dynamic page content. It was geared towards sites that needed some basic SEO, but didnt want to hire a SEO professional.  It does a pretty good job, but it can definitely be improved upon [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this over a year ago now &#8211; it was my first attempt at automatic meta compilation based on dynamic page content. It was geared towards sites that needed some basic SEO, but didnt want to hire a SEO professional.  It does a pretty good job, but it can definitely be improved upon and I plan to do just that sometime soon (when I have time, smile)</p>
<p>But thought I&#8217;d put what I wrote &#8220;out there&#8221; for anyone interested in it.  You&#8217;d call it by initializing the class just after the &lt;HTML&gt; tag, feed it any forced keyword priority (if so desired), and call $yourobj->GenSEO at the end of the page (after &lt;/HTML&gt;).  The class will read your content, determine popular keywoards (with priority towards &lt;H#&gt; tags) and generate meta keyword, title, and description.</p>
<pre class="brush: php;">
  class SEO {
        private $kwarray = array();
        private $words = array();
        private $common = array();
        private $top = array();

        public $desc=&quot;META KEYWORD SEO v1.0&quot;;
        public $title=&quot;PROFFER WAS HERE!&quot;;

        public function __construct() {
              ob_start();
              $this-&gt;Add(&quot;to be or not the them they was were have has had saw a go my mine you your yours our ours theirs of with without within she he his hers him her shall&quot;);
              $this-&gt;Add(&quot;should could would might probably an be does being ought been did going that than also yes no maybe etc get through if any also me b c d e f g h i j k&quot;);
              $this-&gt;Add(&quot;l m n o p q r s t u v w x y z as in by am do we some which here it went goes from is are and for st rd nd th one two three four five six seven eight nine&quot;);
              $this-&gt;Add(&quot;ten its at what how where why this can can zero will now on put when put see non said let each way new call end use try used tried lie lied may need more&quot;);
              $this-&gt;Add(&quot;want all common next just such like done using&quot;);
      }
      public function GenSEO($data,$max=20,$meta=FALSE) {
            $specialitems=array();
            for ($i=1; $i&lt;6; $i++) {
                preg_match_all(&quot;/&lt;[Hh]{$i}[^&gt;]*&gt;(.*?)&lt;\/[Hh]{$i}&gt;/&quot;,$data,$specials,PREG_SET_ORDER);
                if (count($specials)&gt;0) {
                    for ($j=0; $j&lt;count($specials); $j++) { $specialitems[$specials[$j][1]]=15; }
            }
          }
              $this-&gt;words=$specialitems;
            $_d = preg_replace(&quot;/&amp;amp;|&amp;quot;|&amp;copy;|&amp;nbsp;|&amp;dash;|&amp;lt;|&amp;gt;|=|\+|\&lt;|\&gt;|\r|\n|\t|\[|\]|\/|\(|\)|,|\||\.|\*|\%|\$|\d{1,99}|\'|\&quot;|:|\?|\!|\@|\-|\&lt;97&gt;|;|_/i&quot;,&quot; &quot;,strip_tags($data));
            $_d = preg_split(&quot;/\s|$/i&quot;,$_d,-1,PREG_SPLIT_NO_EMPTY);

            for ($i=0; $i&lt;count($_d); $i++) {
                  $word=strtolower($_d[$i]);
                  if (!$this-&gt;common[$word]) { $this-&gt;words[$word]++; }
          }
          array_multisort($this-&gt;words,SORT_DESC);
          $this-&gt;top=array_slice($this-&gt;words,0,$max);
          $top = array_keys($this-&gt;top);

          if ($meta) {
          $meta = &quot;&lt;meta name=\&quot;keywords\&quot; content=\&quot;&quot;.implode(&quot;, &quot;,$top).&quot;\&quot; /&gt;\r\n&quot;;
          $desc = &quot;&lt;meta name=\&quot;description\&quot; content=\&quot;{$this-&gt;desc}\&quot; /&gt;\r\n&quot;;
          echo &quot;
              &lt;HEAD&gt;
                  &lt;TITLE&gt;{$this-&gt;title}&lt;/TITLE&gt;
                  $meta
                  $desc
              &lt;/HEAD&gt;
              $data
          &quot;;
          } else {
                echo &quot;Top $max:&lt;HR&gt;&quot;.implode(&quot;&lt;BR&gt;&quot;,$top).&quot;&lt;hr&gt;&quot;;
          }
      }
      public function Add($e) {
            $s = preg_split(&quot;/\s/i&quot;,$e,-1,PREG_SPLIT_NO_EMPTY);
            foreach ($s as $e) {
                $this-&gt;common[$e]=TRUE;
            }   

      }
      public function Force($word,$score) { $this-&gt;words[$word]=$score; }
  };
</pre>
<p>You&#8217;re free to use this code under the terms of the <a href='http://www.gnu.org/licenses/gpl-3.0.txt' target='blank'>GPL v3</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/05/page-seo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>China..</title>
		<link>http://johnproffer.com/2009/05/china/</link>
		<comments>http://johnproffer.com/2009/05/china/#comments</comments>
		<pubDate>Sat, 02 May 2009 07:37:42 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[china]]></category>
		<category><![CDATA[beijing]]></category>
		<category><![CDATA[fuzhou]]></category>
		<category><![CDATA[hong kong]]></category>
		<category><![CDATA[international]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=46</guid>
		<description><![CDATA[Wow, its been 3 weeks already.  Time zooms by super-fast.  Been in China (still am) visiting relatives. Next month will start hitting the road a bit, visit Shanghai, Taiwan, Taipei, then maybe go back to Hong Kong and slap Jackie Chan silly for his pro-communism comments recently. 
Anyway, in the meantime I&#8217;ve been [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, its been 3 weeks already.  Time zooms by super-fast.  Been in China (still am) visiting relatives. Next month will start hitting the road a bit, visit Shanghai, Taiwan, Taipei, then maybe go back to Hong Kong and slap Jackie Chan silly for his pro-communism comments recently. </p>
<p>Anyway, in the meantime I&#8217;ve been working on a fairly large project &#8211; vector market product that&#8217;s going beta in a couple of weeks.  Already have some people interested in trying it out &#8211; so very excited. We&#8217;re making huge strides and it&#8217;s not even launched yet!  </p>
<p>BTW if you ever travel to China &#8211; BRING CASH, or pay off your Amex/Visa.  They don&#8217;t take debt cards here. =) (Hey I like debt cards.. zero interest!)  Oh yeah and if you bring cash, get it converted at your bank before you get here.  They have huge exchange fees here. </p>
<p>More later! </p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/05/china/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LUHN Algorithm</title>
		<link>http://johnproffer.com/2009/03/luhn-algorithm/</link>
		<comments>http://johnproffer.com/2009/03/luhn-algorithm/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 19:57:50 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[programming - PHP]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=36</guid>
		<description><![CDATA[Recently I was chatting with a friend on creditcard validation.  He was looking for ways to validate a creditcard via javascript.    While it&#8217;s certainly possible, and there&#8217;s alot of sample code out there for it,  I just cant bring myself to use any kind of client-side process for verification of [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was chatting with a friend on creditcard validation.  He was looking for ways to validate a creditcard via javascript.    While it&#8217;s certainly possible, and there&#8217;s alot of sample code out there for it,  I just cant bring myself to use any kind of client-side process for verification of what in my opinion is crucial information such as creditcard numbers.</p>
<p>For one, you can disable javascript, which may bypass validation entirely (depending on how the form submit is being handled).  For another, you could, with the right Firefox plugins, just edit the javascript function directly in the page and have it return &#8220;true&#8221; to get a successful submission.  So I was giving him some sample sites utilizing PHP LUHN algorithms, and noticed something interesting &#8211; As with the javascript versions, most of them don&#8217;t work or have flaws that haven&#8217;t been fixed.   One must wonder how many people out there are copy/pasting these buggy versions for use in professional websites.  </p>
<p>I decided to dig up my own LUHN algorithm, and did some tweaks to it before posting it here. It&#8217;s 100% operational, and so far I&#8217;ve been unable to produce any false results with it. </p>
<pre class="brush: php;">
    function IsValidCC($cc) {
	$cc=str_replace(&quot;-&quot;,&quot;&quot;,$cc);
        for($i = strlen($cc); $i &gt;=0; --$i) {
            $dnum .= ($odd = !$odd) ? $cc[$i]*2 : $cc[$i];
        }
        for($i = 0; $i &lt; strlen($dnum); $i++) {
            $sum += (int)$dnum[$i];
        }
        return (($sum % 10 ==0) &amp;&amp; ($sum != 0));
    }
</pre>
<p>Without alot of dramatic analysis of its inner workings and so on, here are the numbers I tested with, their results, and the processing time for the entire bunch.</p>
<p>Validating 55 numbers</p>
<p>true  [5328304431046754]<br />
true  [5103312845585953]<br />
true  [5310941494599177]<br />
true  [5502457933980793]<br />
true  [5526386293832793]<br />
true  [5541030109388076]<br />
true  [5160933962299217]<br />
true  [5516418411392004]<br />
true  [5202598727749606]<br />
true  [5319527039331431]<br />
true  [4539642231959702]<br />
true  [4916962068349733]<br />
true  [4556574648962060]<br />
true  [4556389698328918]<br />
false [4916971931396181]<br />
false [4485099272362583]<br />
true  [4929771078260656]<br />
true  [4532940023485978]<br />
true  [4156763252772170]<br />
true  [4916726708254888]<br />
true  [4929857283556]<br />
true  [4539778019847]<br />
true  [4024007176858]<br />
true  [4556449022851]<br />
true  [4716337992272]<br />
true  [340315629019234]<br />
true  [371245491835627]<br />
true  [348410551014014]<br />
false [374973107447824]<br />
true  [343837789734937]<br />
true  [6011337931905012]<br />
true  [6011750581974742]<br />
true  [6011625028562351]<br />
true  [36673333924894]<br />
true  [30326629585715]<br />
true  [30036607370614]<br />
true  [201463953817936]<br />
false [201466327996032]<br />
true  [201473001172531]<br />
true  [180090307342009]<br />
true  [180045216543949]<br />
true  [210005131596400]<br />
true  [3088574904967422]<br />
true  [3528446407813882]<br />
true  [3158631681355554]<br />
true  [869940964429408]<br />
true  [869953540433067]<br />
true  [869965600155299]<br />
false [10]<br />
false [55]<br />
false [0]<br />
false [-1]<br />
false [-5-5]<br />
false [abcde]<br />
false []</p>
<p><b>Processing time: 0.00612s</b></p>
<p>Not bad, if you ask me. <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/03/luhn-algorithm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>more updates coming!</title>
		<link>http://johnproffer.com/2009/03/more-updates-coming/</link>
		<comments>http://johnproffer.com/2009/03/more-updates-coming/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 15:58:27 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[programming - PHP]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[moving on]]></category>
		<category><![CDATA[problem]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=30</guid>
		<description><![CDATA[Been crazy the past couple of weeks. Work&#8217;s kept me pretty busy..  But, have alot more time now that I dropped a potential partnership which was chewing up whatever free time I had in evenings / weekends.  The guy did nothing but blow alot of hot air and continiously emphasize that he was smarter [...]]]></description>
			<content:encoded><![CDATA[<p>Been crazy the past couple of weeks. Work&#8217;s kept me pretty busy..  But, have alot more time now that I dropped a potential partnership which was chewing up whatever free time I had in evenings / weekends.  The guy did nothing but blow alot of hot air and continiously emphasize that he was smarter than me.  After all, he&#8217;s a self-proclaimed &#8220;marketing genius&#8221;.</p>
<p>But, I won&#8217;t shrink to his level. So, enough of that &#8211; moving on.</p>
<p>Soon I&#8217;ll start updating this page with code snippets I&#8217;ve written to solve various issues. I&#8217;ll also start touching up my whitepaper skills. Been a while since I&#8217;ve written one <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   One of my favorite pasttimes is research &amp; development.  Taking a real-world problem, analyzing it, and finding solutions to that problem.</p>
<p>So if anyone has a PHP, C++, or AS3 problem they&#8217;d like solved, shoot me an email, jproffer at gmail dot com and I&#8217;ll take a crack at it and post the results here.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/03/more-updates-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically Loading Classes &amp; Modules in PHP</title>
		<link>http://johnproffer.com/2009/03/module-loading-routine/</link>
		<comments>http://johnproffer.com/2009/03/module-loading-routine/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 23:13:08 +0000</pubDate>
		<dc:creator>John Proffer</dc:creator>
				<category><![CDATA[programming - PHP]]></category>
		<category><![CDATA[autoload]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[recursion]]></category>

		<guid isPermaLink="false">http://johnproffer.com/?p=3</guid>
		<description><![CDATA[Any serious developer will tell you, __autoload is your friend.  It greatly reduces your application&#8217;s memory footprint in complex web applications by only loading classes when they&#8217;re actually needed, and can take the pain out of adding new features.  This is especially useful in MVC framework development.
That said, while working on my own [...]]]></description>
			<content:encoded><![CDATA[<p>Any serious developer will tell you, <a href="http://php.net/__autoload">__autoload</a> is your friend.  It greatly reduces your application&#8217;s memory footprint in complex web applications by only loading classes when they&#8217;re actually needed, and can take the pain out of adding new features.  This is especially useful in MVC framework development.</p>
<p>That said, while working on my own MVC framework (not public, sorry! <img src='http://johnproffer.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> ), I came across the need to keep a structured directory and recursively and selectively load certain file types.  While  __autoload can be coded to load files recursively as well as from multiple locations (I&#8217;ll cover that in a later blog post), there&#8217;s serious disadvantages &#8211; the biggest one being that your classes cannot raise exceptions, not without implementing an ugly eval() hack.</p>
<p>Instead I wrote a loader which recursively loads files based on an easily maintainable path/filter array (which I place in my MVC&#8217;s conf/config.php file):</p>
<p><strong>config.php:</strong></p>
<pre class="brush: php;">
$_inc_paths = array(
         &quot;Libraries&quot; =&gt; array(LIB_PATH,&quot;lib_*.php&quot;),
         &quot;Controllers&quot; =&gt; array(CTL_PATH, &quot;*_controller.php&quot;),
         &quot;Utilities&quot; =&gt; array(ROOT_PATH.&quot;/app/utils&quot;, &quot;*.php&quot;)
);
</pre>
<p>Next, since this is a MVC framework and everything is being passed through index.php, we define and execute our load routine here:</p>
<p><strong>index.php:</strong></p>
<pre class="brush: php;">
/**
* @desc Dependency loader routine
* @var $path - absolute path to check
* @var $filter - file filter
* @return none
*/

function LoadRecursively($path,$filter) {
    // include any files matching our filters
    $_inc_list=glob(&quot;$path/$filter&quot;);
    foreach ($_inc_list as $_inc_file) {
        if (substr(basename($_inc_file),0,4)==&quot;lib_&quot;) {
                define(&quot;api_&quot;.basename($_inc_file),TRUE);
        }
        require_once($_inc_file);
    }

    // then scan for any subdirectories
    $_inc_dirlist=glob($path.&quot;/*&quot;, GLOB_ONLYDIR);
    if (!empty($_inc_dirlist)) {
        // if we find subdirs, do recursion and repeat cycle.
        foreach ($_inc_dirlist as $dir) {
                LoadRecursively($dir,$filter);
        }
    }
}

foreach ($_inc_paths as $name=&amp;gt;$obj) {
    LoadRecursively($obj[0],$obj[1]);    // func(path, filter)
}
</pre>
<p>The routine isnt really anything original or ingenious. It&#8217;s basically the same algorithm you&#8217;d use to recursively search for files in most applications.  You&#8217;ll also probably notice the <a href='http://php.net/define'>define()</a> line in my code:</p>
<pre class="brush: php;">
        if (substr(basename($_inc_file),0,4)==&quot;lib_&quot;) {
                define(&quot;api_&quot;.basename($_inc_file),TRUE);
        }
</pre>
<p>It&#8217;s not absolutely necessary, and can be removed.  I use it to prevent people from direct-linking to my library files or using them inappropriately.  The library files have a line like this at the top of the file, which checks if the api_* is defined and throws an exception if not, preventing the file from being parsed and the class loaded:</p>
<pre class="brush: php;">defined(&quot;api_lib_sanitizer.php&quot;) or die(&quot;Error: Cannot call lib_sanitize directly!&quot;);</pre>
<p>Now, some of you purists will probably say, <em>&#8220;this is not a good way to do it (loading files recursively), you could wind up using tons of memory!  It&#8217;s not very scalable!&#8221;</em>  &#8212; well, yes and no.  First off, if you have so many files and each one is so large, you&#8217;re OBVIOUSLY doing something wrong.  Very wrong <img src='http://johnproffer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Secondly, hardware is cheap these days. Especially with the emergence of <a href="http://aws.amazon.com/ec2/">cloud</a> <a href="http://www.rackspacecloud.com/">computing</a>.  As long as you code efficiently, use proper naming conventions and load based on the appropriate conventions, you should never run into a memory/speed issue.</p>
<p>Case in point:  My current MVC framework implements media management (image scaling, video conversion, thumbnail generation), db (including master/slave scaling), various security features including encryption and token generation, captcha, SEO, sanitization, gmaps, error handling, template management, xml handlers and zip handlers, yet uses only 1.5mb total memory footprint (including php and apache process overhead) per connection.  Load time is 0.002s on average, on an AMD x2 64 running Ubuntu 9.04, Apache 2.2 and PHP 5.3.</p>
<p>You&#8217;re free to use this code under the terms of the <a href='http://www.gnu.org/licenses/gpl-3.0.txt' target='blank'>GPL v3</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnproffer.com/2009/03/module-loading-routine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
