<?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>Chuck&#039;s Musings &#187; Programming</title>
	<atom:link href="http://blog.chuckcerrillo.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chuckcerrillo.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 21 Feb 2010 18:43:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Regex saves the day, again</title>
		<link>http://blog.chuckcerrillo.com/2009/08/regex-saves-the-day-again/</link>
		<comments>http://blog.chuckcerrillo.com/2009/08/regex-saves-the-day-again/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 22:21:08 +0000</pubDate>
		<dc:creator>Chuck</dc:creator>
				<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[search tool]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.chuckcerrillo.com/?p=44</guid>
		<description><![CDATA[Searching is easier with regex... Good thing MySQL supports that in SQL queries too!]]></description>
			<content:encoded><![CDATA[<p>I was supposed to do a &#8220;search&#8221; feature and a &#8220;related items&#8221; feature for the module I was assigned to. This was were my regex skills came in handy yet again.</p>
<p>I made a very barebone prototype of it, which takes some input text for the search query against some stored content, in this case, a full-text article (although the final version should be against a database).</p>
<p>The prototype I made is still very rough around the edges. What it does is that it extracts all keywords from the search query using this expression:</p>
<p><div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$regex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/\b([\p{L}|\p{Ll}|\p{Lu}|_]+?)\b/i'</span><span style="color: #339933;">;</span></div></div>
</p>
<p>That rule can be translated as follows:</p>
<p style="padding-left: 30px;"><em><span style="color: #993366;">take any combination of unicode characters and underscores that are enclosed in word boundaries </span></em></p>
<p>Having done that, I place all matched data into an array and call that my &#8220;keywords&#8221; array, to be used later.</p>
<p>The next thing I did was to chop the article down into smaller pieces, currently by sentence (I only used periods as a delimiter, I should probably include other punctuation marks I guess). Then I ran <em>preg_match()</em> through each piece to quickly check for matches for any of the keywords. These results are then compiled.</p>
<p>In each compiled piece, I assign a corresponding weight. This weight is my arbitrary way of picking the best match. My currently implementation <em>sets weight to be equal to the number of characters in the piece that are matched with keywords</em>. I still have to refine these rules later on.</p>
<p>When all pieces have their weight assigned, I sort them according to weight in descending order (highest to lowest weight). Then I display the results and highlight the matched characters.</p>
<p>Here&#8217;s the prototype I made: <a href="http://thedirtlab.chuckcerrillo.com/php-and-mysql/search.php">search tool</a>.</p>
<p>I&#8217;m still thinking of the refinements I could make so I&#8217;ll just post them here as I go along.</p>
<p>Also, it&#8217;s good to know that MySQL supports regex in your SQL queries, this should save me a lot of time!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chuckcerrillo.com/2009/08/regex-saves-the-day-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Picking a JavaScript framework</title>
		<link>http://blog.chuckcerrillo.com/2009/08/picking-a-javascript-framework/</link>
		<comments>http://blog.chuckcerrillo.com/2009/08/picking-a-javascript-framework/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 18:13:06 +0000</pubDate>
		<dc:creator>Chuck</dc:creator>
				<category><![CDATA[Javascript and AJAX]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.chuckcerrillo.com/?p=34</guid>
		<description><![CDATA[Prototype? Scriptaculous? jQuery? Mootools? What to use?]]></description>
			<content:encoded><![CDATA[<p>I had my own little experiences wrestling with JavaScript early into my webdevelopment days, but I never really went beyond simple DOM manipulation. JavaScript has always been overwhelming for me especially because I&#8217;d have to write different versions of the code as well as workarounds to ensure compatibility with most browsers&#8230; and I didn&#8217;t like rewriting stuff when I had to consider yet another browser.</p>
<p>Now,  a few years later, here I am again trying to get my feet wet with JS but at least there are several frameworks readily available to guide me through it, and take care of my problems (a pity they can&#8217;t help with personal problems, heh). I&#8217;m trying to choose from among the popular JS frameworks &#8211; Prototype, Scriptaculous, jQuery and Mootools. Based on my limited research, many devs prefer Mootools over the others, so I am thinking of starting with that.</p>
<p>So let me just formally state this before I begin&#8230;</p>
<p><strong><a href="http://www.mootools.net/">Mootools</a></strong>, I choose you!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chuckcerrillo.com/2009/08/picking-a-javascript-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
