<?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>MikeBrum.com &#187; Programming</title>
	<atom:link href="http://mikebrum.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikebrum.com</link>
	<description>Bombarding the net with slightly greasy solar atoms for almost 10 years...</description>
	<lastBuildDate>Tue, 31 Aug 2010 02:25:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Let&#8217;s Compile Some win32 Binaries</title>
		<link>http://mikebrum.com/lets-compile-some-win32-binaries/</link>
		<comments>http://mikebrum.com/lets-compile-some-win32-binaries/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 15:31:03 +0000</pubDate>
		<dc:creator>mbrum</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mikebrum.com/?p=2069</guid>
		<description><![CDATA[Many people that read this probably know that I do tech work/support for BME from time to time. Starting at 1900 on 20091101, the community site IAM kinda went haywire. What&#8217;s somewhat unique about IAM is that it leverages native win32 binaries on the server side. They&#8217;re not scripts that a JIT compiler reads or [...]]]></description>
			<content:encoded><![CDATA[<p>Many people that read this probably know that I do tech work/support for <a href="http://bme.com/">BME</a> from time to time. Starting at 1900 on 20091101, the community site <a href="http://iam.bmezine.com/">IAM</a> kinda went haywire. What&#8217;s somewhat unique about IAM is that it leverages native win32 binaries on the server side. They&#8217;re not scripts that a JIT compiler reads or run on the .Net framework &#8212; they&#8217;re actual win32 compiled binaries that handle all of the CGI requests and respond to the initial requests. I can&#8217;t just log in, change a few lines of code and then &#8220;the problem&#8217;s fixed&#8221; like someone can do with PHP, Python or Perl. And since the original developer (Shannon Larratt) is no longer involved in BME, I had to figure things out. </p>
<p>After eliminating any environmental factors, I went code diving. I finally isolated the issue (which I&#8217;m still surprised at &#8212; it was in no way obvious) and spec&#8217;ed out the scope of the changes that were needed. </p>
<p>As I mentioned above, these are win32 binaries &#8212; so I then had to set up a dev environment locally before I could recompile any of them. What makes this more fun is that I&#8217;m a Mac and Linux user at home &#8212; so I had to kick up a VM (thank you <a href="http://www.vmware.com/products/fusion/">VMWare Fusion</a>!) to do all of that work in. Only then could I actually make my changes and spin up some new binaries for testing and deployment to the webserver. </p>
<p>What a pain in the ass!</p>
<p>But after all is said and done, I got everything working and everyone seems to be a lot happier. I definitely feel like a super hero. </p>
]]></content:encoded>
			<wfw:commentRss>http://mikebrum.com/lets-compile-some-win32-binaries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome Back Haiku!!</title>
		<link>http://mikebrum.com/welcome-back-haiku/</link>
		<comments>http://mikebrum.com/welcome-back-haiku/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 05:36:40 +0000</pubDate>
		<dc:creator>mbrum</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://mikebrum.com/?p=2018</guid>
		<description><![CDATA[A few days ago, I posted about determining the number of syllables in a word. I&#8217;m still happy with it despite a number of edge cases that I know won&#8217;t get caught. I ported the old haiku that were submitted years ago from an old database backup to the new database and rewrote a front-end [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I posted about <a href="http://mikebrum.com/counting-the-syllables-in-a-word-with-php/">determining the number of syllables in a word</a>. I&#8217;m still happy with it despite a number of edge cases that I know won&#8217;t get caught.</p>
<p>I ported the old haiku that were submitted years ago from an old database backup to the new database and rewrote a front-end for it. You can get there by simply clicking on the <a href="http://mikebrum.com/haiku/">Haiku link</a> in the main pages list at the top of the page. The biggest pain in the ass is dealing with html encoding and special characters that go along with it that aren&#8217;t alpha.</p>
<p>Right now, you can add new haiku and view random haiku. I still need to write a paginated view so you can look through all of them &#8212; but that&#8217;ll be for another day.</p>
<p>Feel free to submit some of your own and look at those that other people have submitted &#8212; that&#8217;s why it&#8217;s there!!</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebrum.com/welcome-back-haiku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Counting The Syllables In A Word With PHP</title>
		<link>http://mikebrum.com/counting-the-syllables-in-a-word-with-php/</link>
		<comments>http://mikebrum.com/counting-the-syllables-in-a-word-with-php/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 03:20:30 +0000</pubDate>
		<dc:creator>mbrum</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mikebrum.com/?p=1902</guid>
		<description><![CDATA[Years and many site revisions ago, I used to have a very basic haiku page on my site. People could submit their own haiku and bring up random haiku that were submitted previously. The only problem that I had was that either people couldn&#8217;t count or they had a different idea on the classic haiku [...]]]></description>
			<content:encoded><![CDATA[<p>Years and many site revisions ago, I used to have a very basic haiku page on my site. People could submit their own haiku and bring up random haiku that were submitted previously.</p>
<p>The only problem that I had was that either people couldn&#8217;t count or they had a different idea on the classic haiku format (three lines with five, seven and five syllables, respectively). Thinking that there was no meaningful way to check the number of syllables in a word via code, I never pursued it any further and just left it as-is.</p>
<p>For no real reason beyond random inspiration, I revisited this idea and came up with a pretty decent function that will take a word and simply return the number of syllables.</p>
<p>Here&#8217;s what the code looks like:</p>
<blockquote><p>function count_syllables($word) { $word = strtolower($word);</p>
<p>  // Regex Patterns Needed $triples = &#8220;dn\&#8217;t|eau|iou|ouy|you|bl$&#8221;;<br />
  $doubles = &#8220;ai|ae|ay|au|ea|ee|ei|eu|ey|ie|ii|io|oa|oe|oi|oo|ou|oy|ue|uy|ya|ye|yi|yo|yu&#8221;;<br />
  $singles = &#8220;a|e|i|o|u|y&#8221;;<br />
  $vowels = &#8220;/(&#8220;.$triples.&#8221;|&#8221;.$doubles.&#8221;|&#8221;.$singles.&#8221;)/&#8221;;<br />
  $trailing_e = &#8220;/e$/&#8221;; $trailing_s = &#8220;/s$/&#8221;;</p>
<p>  // Cleaning up word endings<br />
  $word = preg_replace($trailing_s, &#8220;&#8221;, $word);<br />
  $word = preg_replace($trailing_e, &#8220;&#8221;, $word);</p>
<p>  // Count # of &#8220;vowels&#8221;<br />
  preg_match_all($vowels, $word, $matches );</p>
<p>  $syl_count = count($matches[0]);<br />
  return $syl_count; <br />
 }
</p></blockquote>
<p>It works based on the following assumptions:</p>
<ul>
<li>The number of syllables a word has is equal to the number of &#8220;vowel sounds&#8221; in the word</li>
<li>A &#8220;vowel sound&#8221; can be defined largely by series of consecutive vowels (greater than or equal to one) with a few exceptions</li>
<li>There are certain instances in which a &#8220;vowel sound&#8221; doesn&#8217;t indicate a new syllable</li>
</ul>
<p>The letter groupings defined in $triples, $doubles and $singles (which get concatenated into the pattern in $vowels) are the summation of these assumptions. To handle the third point, I remove trailing &#8220;s&#8221; and &#8220;e&#8221; letters from words. Since I&#8217;ve removed any &#8220;e&#8221; from the end of words and the suffix &#8220;-able&#8221; is two syllables, I look for the pattern &#8220;bl$&#8221; to account for these discrepancies.</p>
<p>Also, to account for contractions, I&#8217;ve found that the string &#8220;n&#8217;t&#8221; preceded by the letter &#8220;d&#8221; typically should count as a vowel sound. Just finding the string &#8220;n&#8217;t&#8221; in a word doesn&#8217;t necessarily count as a vowel sound by itself. This allows us to properly differentiate between the contraction such as &#8220;can&#8217;t&#8221; and &#8220;couldn&#8217;t&#8221;.</p>
<p>For the most part, I&#8217;ve matched up any two-vowel pair with the exception of &#8220;ia&#8221;. This allows us to treat &#8220;i&#8221; and &#8220;a&#8221; as single vowels in words like &#8220;pliable&#8221; where they&#8217;d be otherwise be treated as a single vowel sound if the pair &#8220;ia&#8221; was added to the regex pattern.</p>
<p>I&#8217;m sure there&#8217;s all sorts of additional edge cases that I&#8217;m missing. And additionally, any non-English word has a chance of not abiding by these rules. The good thing is that if there&#8217;s any glaring holes, you can add new vowel sounds to the patterns above. Since preg_match_all() &#8220;short circuits&#8221; on a successful match (meaning that it will start at the next character after a match is found and start at the beginning of the match string), be sure to add them at an appropriate spot in the list. This also explains why the &#8220;larger&#8221; patterns should probably come first.</p>
<p>All-in-all, the function is fairly tight and small for what it does. With a minor caveat that there may be exceptions to the results it returns for weird edge cases, this should provide sufficiently accurate and efficient</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebrum.com/counting-the-syllables-in-a-word-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Site Redesign</title>
		<link>http://mikebrum.com/site-redesign/</link>
		<comments>http://mikebrum.com/site-redesign/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 17:29:32 +0000</pubDate>
		<dc:creator>mbrum</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://mikebrum.com/?p=1840</guid>
		<description><![CDATA[Over the past few days, I&#8217;ve done a bunch of work to redesign the site. I obviously rethemed WordPress, but also made a number of modifications to that theme and changed how the Google Ads are distributed and displayed. I had to make a few changes to various plugins to get them working properly, but [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few days, I&#8217;ve done a bunch of work to redesign the site. I obviously rethemed WordPress, but also made a number of modifications to that theme and changed how the Google Ads are distributed and displayed.</p>
<p>I had to make a few changes to various plugins to get them working properly, but I think everything&#8217;s working without issue now.</p>
<p>I&#8217;m sure there&#8217;ll be some minor tweaks, but this should be it for a while.</p>
<p>I really like the cleaner look and how everything exists in a discrete &#8220;box&#8221;. Visually, I find this very appealing and easy to identify elements and identify what you&#8217;re looking for.</p>
<p>If anyone notices any problems, feel free to <a title="Contact Me" href="http://mikebrum.com/contact-me/">let me know</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebrum.com/site-redesign/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP &amp; Plugin Updates</title>
		<link>http://mikebrum.com/wp-plugin-updates/</link>
		<comments>http://mikebrum.com/wp-plugin-updates/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 05:12:34 +0000</pubDate>
		<dc:creator>mbrum</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Site News]]></category>
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://mikebrum.com/?p=1834</guid>
		<description><![CDATA[I just got through updating WP and all of my plugins to the latest versions. It takes some time because I&#8217;ve made modifications to about half of the plugins and it&#8217;s a PITA to upgrade my test system, test it, make sure I&#8217;ve made all necessary changes and then upgrade the production box and make [...]]]></description>
			<content:encoded><![CDATA[<p>I just got through updating WP and all of my plugins to the latest versions. It takes some time because I&#8217;ve made modifications to about half of the plugins and it&#8217;s a PITA to upgrade my test system, test it, make sure I&#8217;ve made all necessary changes and then upgrade the production box and make the changes that are needed.</p>
<p>It&#8217;s worth it to stage all of the upgrades so that I don&#8217;t totally FUBAR the production box, but it definitely makes the task run a bit longer.</p>
<p>Luckily, most of the plugins don&#8217;t tend to have crazy updates, so I just need to get a diff of my changes and basically apply it to the new version of code instead of having to re-engineer the functionality against a new code base. </p>
<p>If anyone finds anything odd about the site, feel free to holler at me via the <a href="http://mikebrum.com/contact-me/">contact form</a>. Though everything&#8217;s looking good right now. </p>
<p>Oh, and I&#8217;m back from a very productive trip to LA that was 100% related to <a href="http://bme.com/">BME</a>. As a totally unrelated, but exceptionally cool, aside, I&#8217;m still overjoyed that I got to hear the <a href="http://latimesblogs.latimes.com/lanow/2009/09/with-its-signature-sonic-boom-shuttle-lands-at-edwards.html">space shuttle&#8217;s sonic boom</a> on its way to land on Saturday.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebrum.com/wp-plugin-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Photo Gallery Created</title>
		<link>http://mikebrum.com/new-photo-gallery-created/</link>
		<comments>http://mikebrum.com/new-photo-gallery-created/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 22:58:22 +0000</pubDate>
		<dc:creator>mbrum</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://mikebrum.com/?p=1595</guid>
		<description><![CDATA[If you look up, you&#8217;ll see a new link: Photo Galleries. I wrote some code to leverage the existing gallery engine that I&#8217;m using and display a nice listing of the galleries that I have to show. I&#8217;m running the exec-php plugin to allow me to actually embed code in my posts and pages, which [...]]]></description>
			<content:encoded><![CDATA[<p>If you look up, you&#8217;ll see a new link: <a href="http://mikebrum.com/photo-galleries/">Photo Galleries</a>.</p>
<p>I wrote some code to leverage <a href="http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/">the existing gallery engine that I&#8217;m using</a> and display a nice listing of the galleries that I have to show. I&#8217;m running the <a href="http://bluesome.net/post/2005/08/18/50/">exec-php</a> plugin to allow me to actually embed code in my posts and pages, which increases WordPress&#8217;s versatility exponentially in my opinion. I used it a while back while running my old <a href="http://scrag.net/">D&amp;D Blog</a>, but haven&#8217;t really had need to dabble with it for quite some time. I wanted to find a &#8220;simple solution&#8221; for a gallery display and I think this is it.</p>
<p>I had to make a minor code change to a NextGEN Gallery module in the end, but it was amazingly trivial. While I&#8217;ve been working on this for about 4 hours, it was also while chatting, browsing and watching The Big Lebowski &#8211; so I definitely didn&#8217;t have my head buried in code the whole time. The biggest issue was tracking down the NextGEN Gallery issue, which turned out to be the addition of just two lines of code. I still want to add some error handling/sanity test code to the gallery wrapper, but it&#8217;s ready to go as-is.</p>
<p>Definitely feeling good about finally having a nice gallery browser. I&#8217;m sure I&#8217;ll extend it over time.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebrum.com/new-photo-gallery-created/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
