<?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>Compiled Thoughts by John Ciacia</title>
	<atom:link href="http://www.johnciacia.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnciacia.com</link>
	<description>Science, Technology, and Beyond</description>
	<lastBuildDate>Fri, 06 Jan 2012 15:46:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Propel 2.0</title>
		<link>http://www.johnciacia.com/2012/01/03/propel-2-0/</link>
		<comments>http://www.johnciacia.com/2012/01/03/propel-2-0/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 20:30:02 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Propel]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1359</guid>
		<description><![CDATA[It has been long over due. For those of you who have been waiting, thank you. To any new users who find this, I hope you enjoy. I planned to include more features than those of which are being released, but in lieu of some bugs introduced with WordPress 3.3 which render the 1.x branch [...]]]></description>
			<content:encoded><![CDATA[<p>It has been long over due. For those of you who have been waiting, thank you. To any new users who find this, I hope you enjoy. I planned to include more features than those of which are being released, but in lieu of some bugs introduced with WordPress 3.3 which render the 1.x branch of Propel useless, I decided it was better to hide some partially implemented 2.0 features than to fix the bugs in 1.7 or postpone the release of 2.0. Before you upgrade to from 1.7 to 2.0, it is strongly recommend you take a full backup of your database. The major changes being released are largely internal.</p>
<h2>New Features (2.0)</h2>
<ul>
<li>Propel 1.7 moved to custom post types. Propel 2.0 now takes full advantage of the default UI functionality and used the interface provided by custom post types. This allows for better integration with WordPress as a whole, and Propel now plays well with other plugins that modify custom post types.</li>
<li>In 1.7 project and task meta were stored as a single key as a serialized array. This made filtering data impossible. Each piece of data is now stored as an individual metakey (documentation will be provided on how to take advantage of this). This is why you will receive a database update notice when you upgrade from Propel 1.7 to 2.0.</li>
<li>Changed the priority from 1-10 to use Low, Medium, and High instead. After the upgrade, any tasks previously with a priority of 1-3 will be low priority. Tasks with a priority with 4-7 will have a medium priority and tasks with a priority 8-10 will have a high priority.</li>
<li>Changed progress from intervals of one to intervals of five. Upon upgrading, your previous tasks progress will be rounded to the nearest five.</li>
<li>Removed the shortcode for a frontend display (sorry! I know some people used this, but it is kind of unnecessary. I will explain how to display your projects and tasks in the frontend in another post later)</li>
<li>Ability to categorize tasks</li>
<li>A better interface for adding terms to tasks</li>
<li>Ability to assign projects to clients</li>
<li>Ability to globally turn on/off start date, end date, project progress, and project client (keep in mind, using the &#8220;Screen Options&#8221; at the top of your WordPress admin pages, you can hide columns and widgets).</li>
<li>Task &#8220;type&#8221; taxonomy &#8211; giving you the ability to classify tasks as bugs or features.</li>
</ul>
<h2>Partially Implemented / Hidden Features (2.1 ETA ~1.5 months)</h2>
<ul>
<li>A taxonomy to reflect the &#8220;state&#8221; of a task &#8211;  Not Started, Started, Completed, Delivered, etc&#8230;</li>
<li>Ability to add custom task &#8220;types&#8221;</li>
<li>Better filtering (if you have a lot of tasks, it is very hard to manage the tasks via the All Tasks page)</li>
<li>Roles and capabilities. In its current release, everyone can see all the tasks. The goal here is to create two &#8220;roles&#8221; &#8211; Project Manager and Developer. Developers would only see tasks assigned to them, while project managers would be able to see all tasks.</li>
<li>Email notifications when a user is assigned a task, a task is updated, or a comment is made on a task.</li>
</ul>
<h2>Planned Features (2.2+)</h2>
<ul>
<li>A full featured theme (this will likely be a paid add-on)</li>
<li>GitHub post-receive hook endpoint (add comments to tasks and complete tasks when you commit to github)</li>
<li>Integration with WP-Invoice (need help from the WP-Invoice guys for this)</li>
<li>Ability to group tasks into &#8220;task lists&#8221; or &#8220;milestones&#8221; or &#8220;sprints&#8221; or &#8220;iterations&#8221; or whatever project management paradigm calls it.</li>
<li>Gantt Chart</li>
<li>Burn Down Chart</li>
<li>Other charts that I don&#8217;t know about</li>
<li>Features you request</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2012/01/03/propel-2-0/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Object and Array Casting</title>
		<link>http://www.johnciacia.com/2011/11/29/object-and-array-casting/</link>
		<comments>http://www.johnciacia.com/2011/11/29/object-and-array-casting/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 19:24:16 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[cast]]></category>
		<category><![CDATA[object]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1355</guid>
		<description><![CDATA[A few days ago, I posted about some interesting behavior when casting arrays to objects. I would like to take a look at some other interesting behavior. Lets start be creating a basic class Test with three properties each with a different visibility. Now create a new instance of the class and cast it to [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I posted about some interesting behavior when casting <a href="http://www.johnciacia.com/2011/11/08/curly-braces-for-invalid-class-property-name/">arrays to objects</a>. I would like to take a look at some other interesting behavior. Lets start be creating a basic class <strong>Test</strong> with three properties each with a different visibility.</p>
<pre class="brush: plain; title: ; notranslate">class Test {
  private $foo;
  protected $bar;
  public $bat;

  public function __construct() {
    $this-&gt;foo = &quot;lorem&quot;;
    $this-&gt;bar = &quot;dolor&quot;;
    $this-&gt;bat = &quot;amit&quot;;
  }
}</pre>
<p>Now create a new instance of the class and cast it to an array.</p>
<pre class="brush: plain; title: ; notranslate">$test = new Test();
print_r((array)$test);</pre>
<p>The result is as follows:</p>
<pre class="brush: plain; title: ; notranslate">Array
(
    [Testfoo] =&gt; lorem
    [*bar] =&gt; dolor
    [bat] =&gt; amit
)</pre>
<p>On the surface it appears as if the private property had the class name prepended and the and the protected property had an astrick prepended. Now what happens if we cast this array back to an object?</p>
<pre class="brush: plain; title: ; notranslate">$test_object = new Test();
$test_array = (array)$test_object;
var_dump((object)$test_array);</pre>
<p>Results in: </p>
<pre class="brush: plain; title: ; notranslate">object(stdClass)#2 (3) {
  [&quot;foo&quot;:&quot;Test&quot;:private]=&gt;
  string(5) &quot;lorem&quot;
  [&quot;bar&quot;:protected]=&gt;
  string(5) &quot;dolor&quot;
  [&quot;bat&quot;]=&gt;
  string(4) &quot;amit&quot;
}</pre>
<p>How did PHP know the <strong>Testfoo</strong> key and the <strong>*bar</strong> key were private and protected? After all, doing the following does not work:</p>
<pre class="brush: plain; title: ; notranslate">$test_array = array(&quot;Testfoo&quot; =&gt; &quot;lorem&quot;, &quot;*bar&quot; =&gt; &quot;dolor&quot;, &quot;bat&quot; =&gt; &quot;amit&quot;);
var_dump((object)$test_array);</pre>
<p>It turns out, PHP stores meta information with the keys in the form of null bytes. Thus</p>
<pre class="brush: plain; title: ; notranslate">$test_array = array(
  &quot;\x00Test\x00foo&quot; =&gt; &quot;lorem&quot;,
  &quot;\x00*\x00bar&quot; =&gt; &quot;dolor&quot;,
  &quot;bat&quot; =&gt; &quot;amit&quot;
  );
var_dump((object)$test_array);</pre>
<p>Results in the object we expect.</p>
<pre class="brush: plain; title: ; notranslate">object(stdClass)#2 (3) {
  [&quot;foo&quot;:&quot;Test&quot;:private]=&gt;
  string(5) &quot;lorem&quot;
  [&quot;bar&quot;:protected]=&gt;
  string(5) &quot;dolor&quot;
  [&quot;bat&quot;]=&gt;
  string(4) &quot;amit&quot;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/11/29/object-and-array-casting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sinatra on Ubuntu 11.04</title>
		<link>http://www.johnciacia.com/2011/11/22/sinatra-on-ubuntu-11-04/</link>
		<comments>http://www.johnciacia.com/2011/11/22/sinatra-on-ubuntu-11-04/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 03:11:29 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>
		<category><![CDATA[thin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1343</guid>
		<description><![CDATA[The following guide is non-authoritative and probably will not work for you. It is simply the commands I use to reproduce a particular environment: Ruby 1.8.7 with Gems 1.8.10 and Sinatra (using Thin). Before we get started, here is some information about my system: 1. Install the necessary Ubuntu packages (not sure if you need [...]]]></description>
			<content:encoded><![CDATA[<p>The following guide is non-authoritative and probably will not work for you. It is simply the commands I use to reproduce a particular environment: Ruby 1.8.7 with Gems 1.8.10 and Sinatra (using Thin).</p>
<p>Before we get started, here is some information about my system:</p>
<pre class="brush: plain; title: ; notranslate">ubuntu@domU-12-31-38-04-6D-D7:~$ uname -a
Linux domU-12-31-38-04-6D-D7 2.6.38-8-virtual #42-Ubuntu SMP Mon Apr 11 07:04:38 UTC 2011 i686 i686 i386 GNU/Linux
ubuntu@domU-12-31-38-04-6D-D7:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 11.04
Release:	11.04
Codename:	natty
</pre>
<p>1. Install the necessary Ubuntu packages (not sure if you need all of these).</p>
<pre class="brush: plain; title: ; notranslate">sudo apt-get install git build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev </pre>
<p><strong>Note: For Ubuntu 11.10 use libreadline-gplv2-dev instead of libreadline5-dev<br />
</strong><br />
2. Install RVM. At the time of writing this, the Ruby and Gems in the official repo are a little out of date. Note: I am running this as root for a multi-user install (more on this can be found <a href="http://beginrescueend.com/rvm/install/">here</a>.)</p>
<pre class="brush: plain; title: ; notranslate">sudo bash &lt; &lt;(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)</pre>
<p>3. Add necessary users to the RVM group.</p>
<pre class="brush: plain; title: ; notranslate">sudo usermod -a -G rvm ubuntu</pre>
<p>4. Now you need to restart your shell for the changes to take affect. You can try to <code>source</code> the necessary files, but it is just as easy to exit and restart a new session.</p>
<p>5. At this point, it is a good idea to run <code>rvm notes</code> and <code>rvm requirements</code> and do/install anything it tells you (at the time of writing this, there was nothing extra I needed to install. By the time you read this, that probably will not be the case)</p>
<p>6. I was having some major problems with zlib, so I had to install that (<a href="https://rvm.beginrescueend.com/packages/zlib/">here</a> for more information).</p>
<pre class="brush: plain; title: ; notranslate">rvm pkg install zlib</pre>
<p>7. Install Ruby 1.8.7 and set it as the default</p>
<pre class="brush: plain; title: ; notranslate">rvm install 1.8.7
rvm --defaut use 1.8.7</pre>
<p>8. Install Sinatra and Thin</p>
<pre class="brush: plain; title: ; notranslate">gem install sinatra
gem install thin</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/11/22/sinatra-on-ubuntu-11-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Curly Braces for Class Property Names</title>
		<link>http://www.johnciacia.com/2011/11/08/curly-braces-for-invalid-class-property-name/</link>
		<comments>http://www.johnciacia.com/2011/11/08/curly-braces-for-invalid-class-property-name/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 15:22:09 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1336</guid>
		<description><![CDATA[I ran into an interesting situation the other day where I was parsing an RSS into a SimpleXML object. I cannot recall the exact situation but I will replicate it below. Suppose you have an associative array with a key that that is not a valid variable name. This can happen if the key begins [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an interesting situation the other day where I was parsing an RSS into a SimpleXML object. I cannot recall the exact situation but I will replicate it below. Suppose you have an associative array with a key that that is not a valid variable name. This can happen if the key begins with a number or if the key has spaces it in. For example:</p>
<pre class="brush: plain; title: ; notranslate">
$a['1st_key'] = &quot;first_key&quot;;
$a['k e y'] = &quot;value&quot;;
</pre>
<p>Now lets say, for whatever reason, we cast this array to an object:</p>
<pre class="brush: plain; title: ; notranslate">
$o = (object)$a;
</pre>
<p>This will convert all the array keys into the objects properties. But, how do we access them? Both <code>$o->k e y</code> and <code>$o->1st_key</code> are obvious syntax errors. As a solution, you can use curly braces.</p>
<pre class="brush: plain; title: ; notranslate">
echo $o-&gt;{'1st_key'};
echo $o-&gt;{'k e y'};
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/11/08/curly-braces-for-invalid-class-property-name/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get Trending Topics from Twitter</title>
		<link>http://www.johnciacia.com/2011/07/03/get-trending-topics-from-twitter/</link>
		<comments>http://www.johnciacia.com/2011/07/03/get-trending-topics-from-twitter/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 04:29:41 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1281</guid>
		<description><![CDATA[I recently had the need to get the trending topics on Twitter, and discovered it was really easy. Below is the code:]]></description>
			<content:encoded><![CDATA[<p>I recently had the need to get the trending topics on Twitter, and discovered it was really easy. Below is the code:</p>
<pre class="brush: plain; title: ; notranslate">$url = &quot;http://api.twitter.com/1/trends/1.json&quot;;
$data = json_decode(file_get_contents($url));
print_r($data);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/07/03/get-trending-topics-from-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the UIButton in Xcode</title>
		<link>http://www.johnciacia.com/2011/07/03/using-the-uibutton-in-xcode/</link>
		<comments>http://www.johnciacia.com/2011/07/03/using-the-uibutton-in-xcode/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 05:05:50 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[uibutton]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1266</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><iframe width="560" height="349" src="http://www.youtube.com/embed/TAMM6mszYf4" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/07/03/using-the-uibutton-in-xcode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regular Expressions &#8211; A Crash Course</title>
		<link>http://www.johnciacia.com/2011/07/02/regular-expressions-a-crash-course/</link>
		<comments>http://www.johnciacia.com/2011/07/02/regular-expressions-a-crash-course/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 04:05:03 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1226</guid>
		<description><![CDATA[Regular expressions give you a set of tools to match strings of text, which is often useful for validating user data. Many novice programmers often have trouble with regular expressions. In this article we are going to take a look at the fundamentals. In later articles we will take a look at more advanced regular [...]]]></description>
			<content:encoded><![CDATA[<p>Regular expressions give you a set of tools to match strings of text, which is often useful for validating user data. Many <del datetime="2011-07-01T07:53:27+00:00">novice</del> programmers often have trouble with regular expressions. In this article we are going to take a look at the fundamentals. In later articles we will take a look at more advanced regular expressions, learn about the theory behind regular expression engines, and how to apply regular expressions in PHP.</p>
<p>
<h2>Characters</h2>
<p>Characters are broken up into two types: literal characters and special characters. Literal characters are treated <em>literally</em> while the regular expression treats special characters uniquely.<br />
<strong>Special Characters</strong><br />
The following characters have special meanings, and we will explore their meanings in more depth soon.<br />
<code>[ ] \ ^ $ . | ? * + ( ) { }</code><br />
<strong>Literal Characters</strong><br />
Any character that you can type on your keyboard, that is not a special character, is a literal character.
</p>
<p>
<h2>Character Classes</h2>
<p>A character class allows you to match one out of all the characters in the set. Character classes are defined by using the square brackets [ ] and placing the list of characters between the brackets. For example <code>[aeiou]</code> will match a single vowel. Character classes also support the range operator (hyphen), so instead of writing <code>[0123456789]</code> to match a single digit, you can simply use <code>[0-9]</code>. If you want to use special characters in a character class you must escape them with the backslash. For example, if you wanted to match The square bracket you would use <code>[\[]</code>. You may also use non-printable characters and if your engine supports them, unicode characters as well. Some examples: <code>[\t]</code> will match the <em>tab</em> character, <code>[\x09]</code> will also match the <em>tab</em> character using hex notation. <code>[\u0394]</code> will match the unicode Greek letter capital delta.</p>
<p><strong>Negated character classes</strong><br />
By using the carat after the opening square braket, you can negate a character class. As an example, if we want to only match consonants, we can negate our vowel character class we defined above <code>[^aeiou]</code>. This is a lot easier than creating a character class with the 21 consonants. </p>
<p>
<h2>Shorthand Characters</h2>
<p>The following shorthand characters are provided by many regular expression engines. However, if your engine does not support the shorthand characters, the equivalent character class is also provided.<br />
<code>\d</code> matches a digit. The equivalent character class would be <code>[0-9]</code><br />
<code>\w</code> matches a word. The equivalent character class would be <code>[a-zA-Z0-9_]</code><br />
<code>\s</code> matches white space. The equivalent character class would be <code>[ \t\r\n]</code> (space, tab, or line break)<br />
<code>\D</code> negated digit. This is the same as <code>[^\d]</code> or <code>[^0-9]</code><br />
<code>\W</code> negated word. This is the same as <code>[^\w]</code> or <code>[^a-zA-Z0-9_]</code><br />
<code>\S</code> negated white space. This is the same as <code>[^\s]</code> or <code>[^ \t\r\n]</code><br />
<code>.</code> The dot/period character will match <em>anything</em>, except for newlines characters, meaning the dot character is actually a negated newline class <code>[^\n]</code>. It is extremely powerful as it lets you be lazy, which is often a bad thing when you are trying to validate data.</p>
<p>
<h2>Repeating Character Classes</h2>
<p>Matching a single character is often necessary. However, under many circumstances, you will want to match more than one character. For this you can use quantifiers. Quantifiers are placed <em>strong</em> the character or character you want to match.<br />
<code>?</code> The question mark will match zero or one character.<br />
<code>*</code> The star, formally known as the Kleene star, will match a character zero or more times.<br />
<code>+</code> The plus will match a character one or more times.<br />
Using curly brackets, you can specify quantities as well.<br />
<code>{5}</code> This matches a character exactly five times.<br />
<code>{1,3}</code> This matches a character one, two, or three times.<br />
<code>{5,}</code> This matches a character five or more times.</p>
<p>Lets build a regular expression to match a phone number of the form 111-222-3333:</p>
<pre class="brush: plain; title: ; notranslate">[\d]{3}-[\d]{3}-[\d]{4}</pre>
<p>We can also make the hyphens optional</p>
<pre class="brush: plain; title: ; notranslate">[\d]{3}-?[\d]{3}-?[\d]{4}</pre>
</p>
<p>
<h2>Anchors</h2>
<p>Literal characters and character classes allow you to match characters, where as anchors allow you to match positions.<br />
<code>^</code> The carat matches the position before a string.<br />
<code>$</code> The dollar sign matches the position after a string.<br />
It is important to not that when the carat is used inside a character class, it is used to negate the class. However, when the carat is used outside of a character class, it acts as an anchor. If we want to match the word <em>the</em> we would use the literal characters. However  <code>the</code> would also match <em>there</em> and <em>them</em>. Using the dollar sign we tell the regular expression to only match patterns that end in the. Thus <code>the$</code> will not match <em>there</em> and <em>them</em> since the words do not end in <em>the</em>. However, this regular expression will still match words like <em>bathe</em> and <em>clothe</em>. To fix this, we can use the carat to tell the regular expression to match only words that begin with <em>the</em>: <code>^the$</code>
</p>
<p>
<h2>Modifiers</h2>
<p>Modifiers allow you to change the behavior of some characters.<br />
<code>/i</code> will make the expression case insensitive. By default, regular expressions are case sensitive. If you noticed above, when we specified the character class to match a word, we specified lowercase as well as uppercase characters. In some instances, you may want to turn off the case sensitivity, and for this you use the <code>/i</code> modifier.<br />
<code>/s</code> enables single-line mode. In this mode, the dot character will match new lines.<br />
<code>/m</code> enables multi-line mode. In this mode, the <code>^</code> and <code>$</code> anchors will span multiple lines.
</p>
<p>That is it for this tutorial. Next, we will take a look at grouping, back-references, look-aheads, look-behinds, and extend some of the concepts we have already looked at. Do you have any hand crafted regular expressions you would like to share? I would love to seem them in the comments below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/07/02/regular-expressions-a-crash-course/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert text to an image</title>
		<link>http://www.johnciacia.com/2011/07/02/convert-text-to-an-image/</link>
		<comments>http://www.johnciacia.com/2011/07/02/convert-text-to-an-image/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 06:17:56 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1243</guid>
		<description><![CDATA[Inspired by this post, I decided to write a file to bmp converter (because I have nothing better to do with my life). (there is a small problem somewhere that leads to extra padding at the end, but oh well, they are null bytes)]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="http://stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers/5509538#5509538">this post</a>, I decided to write a file to bmp converter (because I have nothing better to do with my life).</p>
<pre class="brush: cpp; title: ; notranslate">//because I can...
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdint.h&gt;
#include &lt;string.h&gt;

int main(int argc, char **argv) {

	if(argc != 3)
		printf(&quot;%s &lt;input-file&gt; &lt;output-file&gt;\n&quot;, argv[0]);

	FILE *input_file, *output_file;
	long size;
	char *buffer;
	size_t result;

	input_file = fopen(argv[1], &quot;rb&quot;);
	if(input_file == NULL) { fputs (&quot;File error&quot;, stderr); exit(1); }

	fseek(input_file, 0, SEEK_END);
	size = ftell(input_file);
	rewind(input_file);

	buffer = (char*)malloc(sizeof(char)*size);
	if (buffer == NULL) { fputs(&quot;Memory error&quot;, stderr); exit (2); }

	result = fread(buffer, 1, size, input_file);
	if (result != size) { fputs(&quot;Reading error&quot;, stderr); exit(3); }

	uint8_t header[54] =
		{
			'B', 'M', 	//2		signature
			0,0,0,0,	//6		size of BMP file in bytes
			0,0,		//8  	reserved must be zero
			0,0,		//10	reserved must be zero
			54,0,0,0,	//14	offset to start of image data
			40,0,0,0,	//18	size of BITMAPINFOHEADER structure, must be 40
			0,0,0,0,	//22	image width in pixels
			0,0,0,0,	//26	image height in pixels
			1,0,		//28	number of planes in the image, must be 1
			24,0,		//30	number of pits per pixel (1, 4, 8, or 24)
			0,0,0,0		//34	compression type
						//54	useless stuff
		};

	//Set the image size
	header[2] = (uint8_t)(size + sizeof header);
	header[3] = (uint8_t)((size + sizeof header) &gt;&gt; 8);
	header[4] = (uint8_t)((size + sizeof header) &gt;&gt; 16);
	header[5] = (uint8_t)((size + sizeof header) &gt;&gt; 24);

	//Do something fancy calculation for with the width/height
	header[18] = (uint8_t)(size/3);	//image width
	header[22] = (uint8_t)(1);		//image height

	output_file = fopen(argv[2], &quot;wb&quot;);
	fwrite(header, sizeof header, 1, output_file);
	fwrite(buffer, size + sizeof header, 1, output_file);

	fclose(input_file);
	fclose(output_file);
	free (buffer);
	return 0;
}</pre>
<pre class="brush: plain; title: ; notranslate">dhcp197-066:~ johnciacia$ cat hello.c
#include &lt;stdio.h&gt;

int main(void) {
	printf(&quot;Hello, World!\n&quot;);
	return 0;
}

dhcp197-066:~ johnciacia$ cat hello.bmp
BM?6(#include &lt;stdio.h&gt;

int main(void) {
	printf(&quot;Hello, World!\n&quot;);
	return 0;
}

dhcp197-066:~ johnciacia$ hexdump hello.bmp
0000000 42 4d 84 00 00 00 00 00 00 00 36 00 00 00 28 00
0000010 00 00 1a 00 00 00 01 00 00 00 01 00 18 00 00 00
0000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000030 00 00 00 00 00 00 23 69 6e 63 6c 75 64 65 20 3c
0000040 73 74 64 69 6f 2e 68 3e 0a 0a 69 6e 74 20 6d 61
0000050 69 6e 28 76 6f 69 64 29 20 7b 0a 09 70 72 69 6e
0000060 74 66 28 22 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64
0000070 21 5c 6e 22 29 3b 0a 09 72 65 74 75 72 6e 20 30
0000080 3b 0a 7d 0a 00 00 00 00 00 00 00 00 00 00 00 00</pre>
<p>(there is a small problem somewhere that leads to extra padding at the end, but oh well, they are null bytes)</p>
<p><a href="http://www.johnciacia.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-2.13.26-AM.png"><img src="http://www.johnciacia.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-2.13.26-AM.png" alt="" title="Screen shot 2011-07-02 at 2.13.26 AM" width="488" height="374" class="aligncenter size-full wp-image-1244" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/07/02/convert-text-to-an-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to change your company name in Xcode 4.0</title>
		<link>http://www.johnciacia.com/2011/06/24/how-to-change-your-company-name-in-xcode-4-0/</link>
		<comments>http://www.johnciacia.com/2011/06/24/how-to-change-your-company-name-in-xcode-4-0/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 15:37:23 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[company name]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1216</guid>
		<description><![CDATA[I probably just spent about 45 minutes searching, and trying to change the default company name Xcode uses. There was a lot of information on how to change the company name for the project, and a lot of useless commands that tried to edit the plist file. To change the default company name, simply change [...]]]></description>
			<content:encoded><![CDATA[<p>I probably just spent about 45 minutes searching, and trying to change the default company name Xcode uses. There was a lot of information on how to change the company name for the project, and a lot of useless commands that tried to edit the plist file.</p>
<p>To change the default company name, simply change the company associated with your contact information in the address book. Simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/06/24/how-to-change-your-company-name-in-xcode-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful find Commands</title>
		<link>http://www.johnciacia.com/2011/06/23/useful-find-commands/</link>
		<comments>http://www.johnciacia.com/2011/06/23/useful-find-commands/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 20:28:24 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[chmod]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[recursively]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=1214</guid>
		<description><![CDATA[I&#8217;ll be honest, I find man pages rather boring, and rather than reading the man page for find, I always search google for the commands I need. Every time I need to use a find command, I will index it below for my reference later. Recursively search your directory tree starting at . (dot) and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be honest, I find man pages rather boring, and rather than reading the man page for <code>find</code>, I always search google for the commands I need. Every time I need to use a find command, I will index it below for my reference later.</p>
<p>Recursively search your directory tree starting at . (dot) and chmod all the folders to 755.</p>
<pre class="brush: plain; title: ; notranslate">find . -type d -exec chmod 755 {} \;</pre>
<p>Recursively search your directory tree starting at . (dot) and chmod all the files (ignoring folders) to 644.</p>
<pre class="brush: plain; title: ; notranslate">find . -type f -exec chmod 644 {} \;</pre>
<p>Do you have any useful find commands? Please share below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2011/06/23/useful-find-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.johnciacia.com @ 2012-05-19 06:38:38 -->
