<?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>existdissolve.com</title>
	<atom:link href="http://existdissolve.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://existdissolve.com</link>
	<description>the singularity of being and nothingness</description>
	<lastBuildDate>Mon, 20 Feb 2012 04:14:51 +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>ColdFusion 10: Filter Functions</title>
		<link>http://existdissolve.com/2012/02/coldfusion-10-filter-functions/</link>
		<comments>http://existdissolve.com/2012/02/coldfusion-10-filter-functions/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 04:14:51 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[ArrayFilter]]></category>
		<category><![CDATA[ListFilter()]]></category>
		<category><![CDATA[StructFilter()]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2376</guid>
		<description><![CDATA[In the vein of my last post on ColdFusion 10&#8242;s new ArrayEach() and StructEach() functions, there are some other related functions that help with the very common task of filtering arrays, structs, and list. The new functions are ArrayFilter(), ListFilter(), and StructFilter(). Like ArrayEach() and StructEach(), the new filter methods have a &#8220;function&#8221; parameter (which&#8230;]]></description>
			<content:encoded><![CDATA[<p>In the vein of my <a title="ColdFusion 10: ArrayEach and StructEach, Hooray!" href="http://existdissolve.com/2012/02/coldfusion-10-arrayeach-and-structeach-hooray/">last post on ColdFusion 10&#8242;s new <strong>ArrayEach()</strong> and <strong>StructEach()</strong> functions,</a> there are some other related functions that help with the very common task of filtering arrays, structs, and list. The new functions are <strong>ArrayFilter()</strong>, <strong>ListFilter()</strong>, and <strong>StructFilter()</strong>.</p>
<p>Like <strong>ArrayEach()</strong> and <strong>StructEach()</strong>, the new filter methods have a &#8220;function&#8221; parameter (which can also be either an inline function or a named function). However, unlike <strong>ArrayEach()</strong> and <strong>StructEach()</strong> which return nothing, the new filter functions return a <strong>new</strong> array, list, or struct, respectively.</p>
<p>To accomplish this, you need to return a boolean from the function parameter. If the current array element, list item, or structure value matches some criteria and returns &#8220;true&#8221;, it will be added to the new returned array/list/structure. Conversely, if it fails the criteria and returns &#8220;false,&#8221; it will be excluded from what is returned.</p>
<blockquote><p><strong>NOTE:</strong>  The array/list/struct filter() functions return <strong>NEW</strong> arrays/lists/structures. The original arrays/lists/structs against which the filter() functions are called are unaffected.</p></blockquote>
<h2>An Example</h2>
<p>Let&#8217;s say that we have a simple set of &#8220;circles&#8221; for a <a title="Add Me :)" href="https://plus.google.com/u/0/104753668904759400057" target="_blank">Google+ account</a> which includes a circle for friends, one for co-workers, and another for family. We might model this data like so:</p>
<pre>'circles' = {
    'friends': ['Lucas','Phil','Dave','Brian','Dillon'],
    'coworkers': ['Tyler','Mike','Doug'],
    'family': ['Dean','Jared','Jason']
};</pre>
<p>Now, let&#8217;s imagine that for some reason, we want to filter all of the people in our circles, and return all the contacts (regardless of circle) whose names start with the letter &#8220;D&#8221;.  One approach might be as so:</p>
<pre>// create an array to hold all the names
allDnames = [];
// use structeach() to evaluate each "circle" 
structeach(circles,function(key,value) {
     // "matched" names will be the new array returned from the arrayfilter()
     // which is applied to each circle in the structeach() loop
     matchednames = <strong>arrayfilter</strong>(value,function(obj) {
         // if the first letter is a "D", return true; otherwise, return false;
         return left(obj,1)=='D';
     });
     // now let's add each filtered name to our master array of "D" names 
     arrayeach(matchednames,function(obj) {
          arrayappend(allDnames,obj);
     });
});</pre>
<h2>Wrapping Up</h2>
<p>As you can see, using CF10&#8242;s new <strong>ArrayFilter()</strong> function is pretty simple, and the <strong>ListFilter()</strong> and <strong>StructFilter()</strong> functions work exactly the same, just with slightly different parameters and return types.</p>
<p>But perhaps more importantly, this example shows how functions like <strong>StructEach()</strong> and <strong>ArrayFilter()</strong> can make processing of complex data structures a snap. Instead of bothering with messy for-loops in which it would be incredibly easy to lose our place, this approach feels much more sane and easy to follow.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/02/coldfusion-10-filter-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ColdFusion 10: ArrayEach and StructEach, Hooray!</title>
		<link>http://existdissolve.com/2012/02/coldfusion-10-arrayeach-and-structeach-hooray/</link>
		<comments>http://existdissolve.com/2012/02/coldfusion-10-arrayeach-and-structeach-hooray/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 02:58:36 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[ArrayEach]]></category>
		<category><![CDATA[StructEach]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2373</guid>
		<description><![CDATA[Earlier today, I was looking through the &#8220;New Functions in ColdFusion 10&#8221; doc, and noticed a few gems: ArrayEach() and StructEach(). These are huge, because until now, there has been something of a disconnect between dealing with arrays and structures in CF, and their counterparts in other languages, like JavaScript. All JS libraries (like ExtJS)&#8230;]]></description>
			<content:encoded><![CDATA[<p>Earlier today, I was looking through the &#8220;<a href="http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WS890819DC-DE4D-4b24-A237-6E3483E9D6A1.html">New Functions in ColdFusion 10</a>&#8221; doc, and noticed a few gems: <strong>ArrayEach()</strong> and <strong>StructEach()</strong>. These are huge, because until now, there has been something of a disconnect between dealing with arrays and structures in CF, and their counterparts in other languages, like JavaScript. All JS libraries (<a href="http://docs.sencha.com/ext-js/4-0/#!/api/Ext-method-each">like ExtJS</a>) have &#8220;each&#8221; methods attached to basic objects which allows you to treat collections of the same kind of thing in a bulk way. Fortunately, CF10 introduces two very handy new methods to apply an &#8220;each&#8221;-like process to both arrays and structures.</p>
<blockquote><p><strong>NOTE</strong>: The ArrayEach() and StructEach() functions act on the original array/struct. Therefore, if you make changes to the array/struct within these functions (as in the ArrayEach() example below), the original array/struct will be affected (thanks Andy!).</p></blockquote>
<h2>ArrayEach()</h2>
<p>So, for example, let&#8217;s say you have an array of friends&#8217; names, and you want to make the list all uppercase. Pre-CF10, you might approach this by looping over the array, and executing a function at each iteration. Fine, easy enough, and it works. However, with <strong>ArrayEach()</strong>, you can ditch the clunkiness of the for-loop, and keep everything self-contained to the array. And, you can execute either an &#8220;inline&#8221; function, or call a named function. The two examples (which produce the same results) are below:</p>
<pre>names = ['John','mary','JOseph','Glenda','Mike'];

// named function
// notice that the function takes one argument, the value of the current iteration of the array
function makeLowercase(obj) {
    names[arrayfind(names,obj)] = lcase(obj);
}

<strong>//  run arrayeach() with an inline function</strong>
arrayeach(names,function(obj) {
    names[arrayfind(names,obj)] = lcase(obj);
});
writedump(names);

<strong>// run arrayeach() with a named function</strong>
arrayeach(myarray,makeLowercase);
writedump(myarray);</pre>
<h2>StructEach()</h2>
<p>Not to be outdone, structures get some each() lovin&#8217; in CF10 as well. But instead of iterating over an array, the <strong>StructEach()</strong> function executes for every key-value pair in the structure. As with ArrayEach(), you can use either use an inline function or a named function.</p>
<p>In this example, we have a simple collection of &#8220;favorites,&#8221; which we want to print to the screen.</p>
<pre>favs = {color: 'blue', food: 'pizza', sport: 'basketball'};

// named function
// notice that the function takes two arguments, the key and value pair of the current iteration of the structure's key-value pairs
function getFavorites(key, value) {
    writeoutput('My favorite ' &amp; key &amp; ' is ' &amp; value);
} 
<strong>// run structeach() with a named function</strong>
structeach(favs,getFavorites);
<strong>// run structeach() with an inline function</strong>
structeach(favs, function(key,value) { 
    writeoutput('My favorite ' &amp; key &amp; ' is ' &amp; value);
});</pre>
<h2>Wrapping Up</h2>
<p>While these two functions probably won&#8217;t garner the attention that other additions will, I think they&#8217;re pretty dang awesome. Not only are they a long time coming (honestly, how often do you loop over an array&#8230;like 20 times every hour!!), but they help to make developing with these basic data types just a bit easier as they more closely align methodologies in CF with those you&#8217;d find elsewhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/02/coldfusion-10-arrayeach-and-structeach-hooray/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ExtJS 4: Querying Records in a Data Store</title>
		<link>http://existdissolve.com/2012/02/extjs-4-querying-records-in-a-data-store/</link>
		<comments>http://existdissolve.com/2012/02/extjs-4-querying-records-in-a-data-store/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 04:29:55 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[Store]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2371</guid>
		<description><![CDATA[As you come to use data stores regularly within ExtJS applications, you&#8217;ll quickly come to realize just how powerful they are. With very little code, you can create robust data repositories that can not only store complex data, but can (perhaps more importantly) drive components within your applications. At some point, however, you&#8217;ll need to&#8230;]]></description>
			<content:encoded><![CDATA[<p>As you come to use <a href="http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store">data stores</a> regularly within ExtJS applications, you&#8217;ll quickly come to realize just how powerful they are. With very little code, you can create robust data repositories that can not only store complex data, but can (perhaps more importantly) drive components within your applications.</p>
<p>At some point, however, you&#8217;ll need to retrieve data from your Store in a query-like manner. That is, instead of looking up a record by a known ID or position within the store, you may need to find one or more records based on a search term, a category, or whatever else is required by your app.</p>
<p>Of course, as with everything else, ExtJS makes this pretty simple. Let&#8217;s suppose that we have the following Model:</p>
<pre>Ext.define("MyApp.model.Bookmark", {
     extend: "Ext.data.Model",
     idProperty: "id",
     fields: [
         {name: "id", type: "int"},
         {name: "target", type: "string"},
         {name: "title", type: "string"},
         {name: "category", type: "string"},
         {name: "created", type: "date"}
     ]
});</pre>
<p>Nothing to crazy here. Just a simple model with some standard kinds of fields for storing data, in this case, &#8220;bookmarks.&#8221; Now, let&#8217;s define our data store:</p>
<pre>Ext.define("MyApp.store.Bookmarks", {
    extend: "Ext.data.Store",
    model: "MyApp.model.Bookmark",
    autoLoad: true,
    storeId: 'bookmarks',
    proxy: {
        type: 'localstorage',
        id  : 'myapp-bookmarks'
    }
});</pre>
<p>As with the model, this is very straightforward. We&#8217;ve configured a simple store which happens to have a localStorage proxy (change it if you want&#8211;ExtJS doesn&#8217;t care!).</p>
<h2>Simple Data Lookup</h2>
<p>Ok, so now that we&#8217;re up and running with our model and store, let&#8217;s pretend we&#8217;ve created a simple app to save bookmarks into our data store. As we&#8217;re plugging along, we find that we need to put some kind of tollgate in place to prevent the same bookmark from being entered over and over: after all, having one bookmark to <a href="http://www.youtube.com/watch?v=QFCSXr6qnv4&amp;feature=related">Charlie the Unicorn 2</a> is certainly enough!</p>
<p>How can we prevent this? In our <strong>addBookmark()</strong> method, we can do a simple lookup on our data store to see if a bookmark with the same title already exists. This might look something like so:</p>
<pre>function addBookmark(target,title,category) {
    var store = Ext.data.StoreManager.lookup('bookmarks');
    var match = <strong>store.find('title','title');</strong>
    if(match == -1) {
        ...add the bookmark
    }
}</pre>
<p>In this simple example, we use the store&#8217;s <strong>find()</strong> method to search through the store&#8217;s records. The <strong>find()</strong> method takes two required arguments&#8211;the column to search, and the value to be used in the search&#8211;but has more flexibility for case-sensitivity, partial matches, etc. Based on whether the index of a record in our store is returned, we decide whether or not to add the new data to our store.</p>
<blockquote><p>Of course, if we don&#8217;t care about the index of the record and simply want to get a matched record, we could use <strong>findRecord()</strong> instead. It functions in the same way, but returns a model instance instead of a record index.</p></blockquote>
<h2>More Complex Data Lookup</h2>
<p>The store&#8217;s <strong>find()</strong> and <strong>findRecord()</strong> methods are great if you only need to find matches based on a single data column. What if you need to match on more than one column, though? For example, let&#8217;s say that we want to be able to store bookmarks with the same title as long as they belong to a different category. Obviously, our previous method will not work, since the method will prevent insertions of records with already-existent titles. Nope, we need something a bit more robust. Thankfully, ExtJS data stores have just the ticket: <strong>findBy()</strong>.</p>
<p>The <strong>findBy()</strong> method&#8217;s power lies in the fact that you can specify a custom function that will be executed against every record in the data store. Within this custom function, you can do any manner of checks on the entire data record (not just the value of one column). If the conditions you specify succeed, the method will return the index of the first matching record.</p>
<p>So here&#8217;s what that might look like for our scenario of checking for the uniqueness of both bookmark title AND category:</p>
<pre>function addBookmark(target,title,category) {
    var store = Ext.data.StoreManager.lookup('bookmarks');
    // custom function for finding record with complex criteria
    var match = <strong>store.findBy</strong>(function(record,id) {
        if(record.get('target')==target &amp;&amp; record.get('category')==category) {
            return true;
        }
    });
    if(match == -1) {
        ...add the bookmark
    }
}</pre>
<p>As you can see, the custom function is passed two arguments: the model instance of the currently-evaluated record, and the id of the record. Since we want to check to make sure that the combination of bookmark title and bookmark category are unique, we can simply check the &#8220;title&#8221; and &#8220;category&#8221; values of the would-be-bookmark against each model in our data store. If no match is found, we know the record is unique and we can add it to the data store. Magical <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Wrapping Up</h2>
<p>Obviously, the example provided above is very simple; however, I hope it shows just how easy it is to not only query data from a data store, but moreover to create custom functions to apply more complex query logic to the data in your stores.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/02/extjs-4-querying-records-in-a-data-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grouping in CFLoop&#8230;Finally!</title>
		<link>http://existdissolve.com/2012/02/grouping-in-cfloop-finally/</link>
		<comments>http://existdissolve.com/2012/02/grouping-in-cfloop-finally/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 18:06:45 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[CFLoop]]></category>
		<category><![CDATA[ColdFusion 10]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2368</guid>
		<description><![CDATA[With the public release of ColdFusion 10 Beta yesterday, I thought I&#8217;d play around a bit with some of the new capabilities. One of the features added in this release is the ability to group in query loops using &#60;cfloop&#62;. As expected, this is pretty straightforward, and has the same capabilities as the &#60;cfoutput&#62; corollary. Here&#8217;s&#8230;]]></description>
			<content:encoded><![CDATA[<p>With the public release of <strong><a href="http://labs.adobe.com/technologies/coldfusion10/">ColdFusion 10 Beta</a></strong> yesterday, I thought I&#8217;d play around a bit with some of the new capabilities. One of the features added in this release is the ability to <strong>group</strong> in query loops using &lt;cfloop&gt;.</p>
<p>As expected, this is pretty straightforward, and has the same capabilities as the &lt;cfoutput&gt; corollary. Here&#8217;s a quick example:</p>
<pre>&lt;cfquery name="qproducts" datasource="somedatasource"&gt;
     select *
     from   products
     order by category,subcategory,product
&lt;/cfquery&gt;

&lt;cfoutput&gt;
     &lt;cfloop query="qproducts" group="category"&gt;
          &lt;h1&gt;#category#&lt;/h1&gt;
          &lt;cfloop group="subcategory" groupcasesensitive="true" &gt;
               &lt;h2&gt;#subcategory#&lt;/h2&gt;
               &lt;cfloop&gt;
                    #product#&lt;br /&gt;
              &lt;/cfloop&gt;
          &lt;/cfloop&gt;
     &lt;/cfloop&gt;
&lt;/cfoutput&gt;</pre>
<p>Pretty simple, but something which I know a lot of people have wanted for quite a while. Well, now you have it!</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/02/grouping-in-cfloop-finally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Ruby: Day 6</title>
		<link>http://existdissolve.com/2012/02/learning-ruby-day-6/</link>
		<comments>http://existdissolve.com/2012/02/learning-ruby-day-6/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 02:42:19 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Koans]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2365</guid>
		<description><![CDATA[Ah, back to Ruby. Unfortunately, I had to take several days off for personal reasons&#8230;or rather, work invading on personal time. Ugh. But enough of that nonsense. This day of Ruby is a short one: exceptions and iterations. Exceptions I&#8217;ll be perfectly honest: I&#8217;m lost on this one. I understand parts of it (for example,&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-e1326426711127.png"><img class="alignleft  wp-image-2326" title="256px-Ruby_logo" src="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-150x150.png" alt="" width="63" height="63" /></a>Ah, back to Ruby. Unfortunately, I had to take several days off for personal reasons&#8230;or rather, work invading on personal time. Ugh.</p>
<p>But enough of that nonsense.</p>
<p>This day of Ruby is a short one: <strong>exceptions</strong> and <strong>iterations</strong>.</p>
<h2>Exceptions</h2>
<p>I&#8217;ll be perfectly honest: I&#8217;m lost on this one. I understand parts of it (for example, that particular errors&#8230;like StandardError&#8230;are subclasses of other errors), but this is a good example where I think the Koans (or probably my brain) come a little short. If I were to stop here, I&#8217;d be completely lost when it comes to handling exceptions in Ruby.</p>
<p>Fortunately, the internet exists, and a quick Google reveals that there a dozens of good articles (like <a href="http://ruby.activeventure.com/programmingruby/book/tut_exceptions.html">this one</a>) about exception handling in Ruby. So I&#8217;ve got some reading to do. And you know what? That&#8217;s okay. Part of learning is getting frustrated, hitting a wall, and seeking out the answers. I expected this all along, so no biggie.</p>
<h2>Iterations</h2>
<p>The Iterations Koan is all about looping over arrays and collections (which have the same methods for iterations, btw). As one might exepct, you have most of the standard operations, like &#8220;each&#8221;, &#8220;find&#8221;, &#8220;select&#8221;, etc. The syntax is pretty straightforward:</p>
<pre>myarray = ['one', 'two', 'three']
myarray.collect { |item| 'twenty-' + item}
// gives us =&gt; ['twenty-one', 'twenty-two', 'twenty-three']</pre>
<p>In this example, I&#8217;m using the array&#8217;s &#8220;collect&#8221; method to transform each individual element in the array. Pretty nifty.</p>
<h2>Wrapping Up</h2>
<p>Well, that was short and sweet. I&#8217;m [hopefully] diving back more full-time into Ruby tomorrow, so should have some more cool stuff to share soon. I &lt;3 Ruby <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/02/learning-ruby-day-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Ruby: Day 5</title>
		<link>http://existdissolve.com/2012/01/learning-ruby-day-5/</link>
		<comments>http://existdissolve.com/2012/01/learning-ruby-day-5/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 02:04:23 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Koans]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2361</guid>
		<description><![CDATA[Today&#8217;s excursion into Ruby is a short one. The 3 Koans (constants, control statements, and true/false) are pretty basic. However, upon completing them, I am now officially over 50% done with Ruby Koans! Of course, I am by no means ready to really start doing anything with Ruby. However, I do feel like I am&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-e1326426711127.png"><img class="alignleft  wp-image-2326" title="256px-Ruby_logo" src="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-150x150.png" alt="" width="90" height="90" /></a>Today&#8217;s excursion into Ruby is a short one. The 3 Koans (constants, control statements, and true/false) are pretty basic. However, upon completing them, I am now officially over 50% done with Ruby Koans!</p>
<p>Of course, I am by no means ready to really start doing anything with Ruby. However, I do feel like I am grasping basic concepts, and my journey through the Koans is becoming less of flailing blindly and more of thinking about what I&#8217;ve learned and trying to reason through the challenges I encounter. Granted, not impressive, but it is progress <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Constants</h2>
<p>The first Koan dealt with the concept of constants. The role of constants in programming is pretty well-understood, so there&#8217;s nothing difficult to understand about their usage in Ruby&#8230;in fact, the Koan dealt mostly with how to access constants (within and outside of their definitions relative to particular classes). I did find a nice, more in-depth explanation of the role and usage of constants within Ruby. <a href="http://rubylearning.com/satishtalim/ruby_constants.html">Check it out</a> when you have a chance.</p>
<h2>Control Statements</h2>
<p>Ah, what would programming be without control (if, else, for, while&#8230;) statements? Probably not worth doing!!</p>
<p>A couple cool things I want to point out about control statements in Ruby.</p>
<p>First, I&#8217;m warming to the idea of &#8220;statement modifiers&#8221;. For example, consider the following:</p>
<pre>def mytest()
    value = if true
            :somethingtrue
         else
            :somethingfalse
     end
end</pre>
<p>Pretty straightforward, a standard if-&gt;else convention. However, in Ruby, you can do something like this:</p>
<pre>def mytest()
     value = :somethingfalse
     value = :somethingtrue <strong>if true</strong>
end</pre>
<p>Notice the bit at the end of the third line, the ending &#8220;if true&#8221;. This accomplishes the same thing as the first example, without the *bulk* of the extra lines. By default, Ruby will return the first &#8220;value&#8221;, since methods ALWAYS return something. However, the value is overwritten with :somethingtrue if true is&#8230;well&#8230;true. Probably not a huge advantage either way, but it&#8217;s kind of an interesting way to go about it.</p>
<p>The other thing I wanted to mention is related to the first in that it uses a statement modifier. However, instead of using an &#8220;if x&#8221; evaluator, this uses &#8220;unless&#8221;:</p>
<pre>def mytest()
     value = :somethingfalse
     value = :somethingtrue <strong>unless false</strong>
end</pre>
<p>Nothing terribly profound about that, but it&#8217;s a nice way of shortcutting a bunch of unnecessary evaluation, if suitable.</p>
<h2>True and False</h2>
<p>Coming from a ColdFusion background, this one was a bit interesting. ColdFusion has interesting ways of dealing with booleans, and interesting &#8220;things&#8221; which evaluate as booleans. Check out <a href="http://www.coldfusionmuse.com/index.cfm/2010/2/5/Booleans.and.Coldfusion">Mark Kruger&#8217;s excellent article</a> on the subject.</p>
<p>If you are from the same background, a word of warning: Ruby treats true and false in different ways than ColdFusion!</p>
<p>Here&#8217;s a rundown, from the Koan, of some ways that Ruby deals with true and false:</p>
<pre>true =&gt; true
false =&gt; <strong>false</strong>
nil =&gt; <strong>false</strong>
1 =&gt; true
0 =&gt; true
[] =&gt; true
{} =&gt; true
"icecream" =&gt; true
"" =&gt; <strong>true</strong></pre>
<p>In a nutshell, Ruby treats &#8220;false&#8221; and &#8220;nil&#8221; as false. Beyond that, everything else&#8212;EVEN EMPTY STRING?!?&#8211;is treated as &#8220;true&#8221;. Interesting <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Wrapping Up</h2>
<p>Yay, 5 days of Ruby&#8230;done! Onward!</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/01/learning-ruby-day-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3 Infographic</title>
		<link>http://existdissolve.com/2012/01/css3-infographic/</link>
		<comments>http://existdissolve.com/2012/01/css3-infographic/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 20:26:28 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Flex-box]]></category>
		<category><![CDATA[Infographic]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2356</guid>
		<description><![CDATA[There&#8217;s something with me, the weekend, and CSS3&#8230;hmm&#8230; On Saturday, Google Politics &#38; Elections posted an interesting infographic about search trends over the last week related to the four remaining GOP Presidential candidates. Here&#8217;s the infographic: Overall, pretty nice. It makes good use of color, highlights the important details, and avoids loading the graphic with&#8230;]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s something with me, the weekend, and CSS3&#8230;hmm&#8230;</p>
<p>On Saturday, <a href="https://plus.google.com/u/0/114401727024677849167/posts">Google Politics &amp; Elections</a> posted an interesting infographic about search trends over the last week related to the four remaining GOP Presidential candidates.</p>
<p>Here&#8217;s the infographic:</p>
<div class="wp-caption alignnone" style="width: 624px"><img class=" " title="Top 4 Candidate Search Gains (1/14 - 1/21)" src="https://lh6.googleusercontent.com/-i9HmVaMuS3Q/TxsJSXk-8tI/AAAAAAAACHg/d9t9nX6FPXs/s1024/gingrich%2Bsurge%2B2.jpg" alt="" width="614" height="346" /><p class="wp-caption-text">From Google Politics &amp; Elections</p></div>
<p>Overall, pretty nice. It makes good use of color, highlights the important details, and avoids loading the graphic with needless frills, pointless content, etc.</p>
<p>The one problem, though, is that it&#8217;s simply an image. While it&#8217;s nice to look at, it&#8217;s kind of boring.</p>
<h2>Some CSS3 Up In Here</h2>
<p>So as I was internally complaining about how boring the image qua image is, it occurred to me that some simple CSS3 flourishes could really make this nice.</p>
<p><strong><a href="http://existdissolve.com/demos/css3/infographic/">Check Out the Example</a> </strong>(note: you&#8217;ll need a more recent version of Webkit or Firefox for this to work&#8230;)</p>
<p>In this experiment, I&#8217;m using a few things I&#8217;ve not messed with much in the past: <strong>keyframes</strong> and the <strong>flex-box model</strong>.</p>
<h3>Flex-Box Model</h3>
<p>If you&#8217;re a web designer, you&#8217;ve no doubt spent endless hours trying to coax HTML and CSS to do simple things like expand &#8220;columns&#8221; a particular percentage in width and height. This is a horrible nightmare to endure, and it usually ends in a lot of hacks and more cursing, just to get content to line up correctly.</p>
<p>Enter the flex-box model. WIth the flex-box model, you can create dynamic, &#8220;flexible&#8221; areas of content that not only &#8220;flex&#8221; to fill space based on your precise specification, but can also have intrinsic relationships to other elements.</p>
<p>In my example, I used the flex-box model to handle laying out the &#8220;name&#8221; and &#8220;percentage&#8221; content in each candidate&#8217;s &#8220;bar.&#8221; Here&#8217;s the HTML:</p>
<pre>&lt;div class="bar"&gt;
    &lt;img src... /&gt;
    &lt;div class="name"&gt;Newt Gingrich&lt;/div&gt;
    &lt;div class="total"&gt;+688%&lt;/div&gt;
&lt;/div&gt;</pre>
<p>Very simple. In fact, the flex-box doesn&#8217;t really require much in the way of mark-up&#8230;you can easily use the basic structures that you would normally implement.</p>
<p>Since there&#8217;s nothing special about the markup, the real magic happens in CSS:</p>
<pre>// flex box styles for "bar" container
.bar {
    display: -webkit-box;
    display: -moz-box;
}
// flex box styles for "name" content
.name {
    -webkit-box-flex: 1;
    -moz-box-flex:1;
}</pre>
<p><strong>That&#8217;s it?</strong> Yep, that&#8217;s it. When we add &#8220;display:box;&#8221; to the parent element, we are telling it that it should behave according to the flex-box model. By default, this will lay out all of its children along the horizontal axis. Notice we didn&#8217;t have to float anything. That is awesome.</p>
<p>And for the &#8220;name&#8221; content, we&#8217;ve added the &#8220;box-flex&#8221; attribute and given it a value of &#8220;1&#8243;. This tells the individual item that not only should it be laid out horizontally with its siblings, but that moreover it should take up additional space. Since we&#8217;ve applied &#8220;box-flex&#8221; to only 1 element, this will take up any remaining space in the parent&#8211;if other siblings had &#8220;box-flex&#8221; as well, the value of &#8220;1&#8243; would change in relation to the box-flex of the other siblings.</p>
<p>In essence, what this does it to give us a really nice horizontal layout of 3 items (the image, the &#8220;name&#8221; and the &#8220;percentage&#8221;) without needing floats, positioning, or any other nonsense. Since &#8220;name&#8221; is the only content with &#8220;box-flex&#8221; assigned, it will greedily gobble up the remaining space left over in the parent, resulting in a nice right-alignment of the variable-width &#8220;percentage&#8221; content. Did I mention no floats? Hooray.</p>
<h3>Keyframe Animations</h3>
<p>Besides the super-sweet flex-box utilization, this example also uses the super-fancy keyframe animation specification. What are keyframes? Think about when you used to create animations in Flash, and you created keyframes at specified points along a timeline where you wanted specific events to occur. Keyframes in CSS3 animations are very similar.</p>
<p>In this example, I wanted to animate the background of the main content area (the gradients behind each candidate). WIth the keyframe specification, this is stupid simple. Here&#8217;s some CSS:</p>
<pre>@-webkit-keyframes expanding {
    0%   { width:0;}
    100% { width:100%;}
}
.bar {
    -webkit-animation-iteration-count: 1;
    -webkit-animation-name: expanding;
    -webkit-animation-duration: .25s;
    -webkit-animation-timing-function:ease-in-out;
    -webkit-animation-fill-mode: forwards;
}</pre>
<p>This is a bit more involved than the flex-box model, so let&#8217;s take a look piece by piece.</p>
<p>The first chunk of code is where we define the keyframe to be used in the animation. You use the <strong>@-webkit-keyframes</strong> directive, and then provide a name (&#8220;expanding&#8221;, in this example). Then, within the object, you simply define the style rules that should be applied at each &#8220;frame&#8221; of the animation. In this example, we have a very simple definition. At the start of the animation (0%), the width of the element will be 0; at the end (100%) the width will be 100%. The cool part is that the browser takes care of the animation in between each keyframe, and this is why we get the horizontal bar &#8220;expansion&#8221; animation in this example.</p>
<p>The next chunk of code is how we 1.) apply the keyframe specification to the particular element (&#8220;animation-name&#8221;) and 2.) additionally configure how the animation will behave, such as the duration, why kind of timing function should be applied, how many times the animation should run, etc.</p>
<p>Pretty cool stuff.</p>
<h2>Some Caveats</h2>
<p>Unfortunately, support in browsers for some of the cooler stuff in this demo is currently pretty limited. To the best of my knowledge, both the flex-box and keyframe specification are only implemented in Webkit and Firefox.</p>
<p>Moreover, I didn&#8217;t bother with a graceful degradation to other browsers. So if you open this example in IE, Opera, etc., you&#8217;re out of luck. If you feel like implementing a graceful degradation, feel free to <a href="https://github.com/existdissolve/InfoGraphic">grab the source from GitHub</a>.</p>
<h2>Wrapping Up</h2>
<p>While a lot of these features are still not yet ready for primetime, I think this example shows ways in which these new aspects of CSS3 can help to improve the experience of the internet. Does this application of CSS3 radically improve the infographic? Probably not. However, it does show the promise of how simple interactivity can be added without much pain at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/01/css3-infographic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning Ruby: Day 4</title>
		<link>http://existdissolve.com/2012/01/learning-ruby-day-4/</link>
		<comments>http://existdissolve.com/2012/01/learning-ruby-day-4/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 02:51:07 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Symbols]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2348</guid>
		<description><![CDATA[I took a couple days&#8217; break from the Ruby train. I had some other things I wanted to do, and darn it, I did them! I also needed some brain-recuperation time. Oh yeah, and I was finishing up the last episode (or 10&#8230;) of Nura: Rise of the Yokai Clan. But now I&#8217;m back! Day 4&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-e1326426711127.png"><img class="alignleft  wp-image-2326" title="256px-Ruby_logo" src="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-150x150.png" alt="" width="105" height="105" /></a>I took a couple days&#8217; break from the Ruby train. I had <a title="Chunky Checker: Some CSS3 Fun" href="http://existdissolve.com/2012/01/chunky-checker-some-css3-fun/">some other things I wanted to do</a>, and darn it, I did them! I also needed some brain-recuperation time. Oh yeah, and I was finishing up the last episode (or 10&#8230;) of <a href="http://en.wikipedia.org/wiki/Nura:_Rise_of_the_Yokai_Clan">Nura: Rise of the Yokai Clan</a>.</p>
<p>But now I&#8217;m back!</p>
<p>Day 4 of Ruby entails some tasty symbols, regular expressions, and methods.</p>
<h2>Symbols</h2>
<p>While I knew this going in, I&#8217;m finding more and more that Koans are a great tool for teaching how to use stuff in a language. What they are not great at, however, is explaining precisely what the &#8220;stuff&#8221; is.</p>
<p>Symbols are a great example of this gap. They&#8217;re scattered sneakily throughout the preceding examples, and seem easy enough to use. However, defining what a &#8220;symbol&#8221; is by virtue of the Koan itself leaves a bit to be desired.</p>
<p>So I did some reading. I eventually came across a nice article entitled &#8220;<strong><a href="http://www.troubleshooters.com/codecorn/ruby/symbols.htm">The Ruby_Newbie Guide to Symbols</a></strong>&#8221; by Steve Litt. In this article, Steve makes a helpful, birds-eye exploration of symbols in Ruby, sticking to broad categories and avoiding getting lost in the weeds of over-definition.</p>
<p>I&#8217;ll let you read Steve&#8217;s article for the full scoop, but my reading of symbols is that they are &#8220;things&#8221; comprised of an integer identifier and a string; are immutable (can&#8217;t be changed at runtime); are the same &#8220;thing&#8221;, regardless of how many times they are used (see below).</p>
<p>Clear as mud? Sure. However, an easy way (for me, at least) to think of symbols is to think of them in the context of a hash. Consider this example:</p>
<pre># create an array of hashes using strings for keys
names = []
names[0] = {"name" =&gt; "Joel"}
names[1] = {"name" =&gt; "Jason"}</pre>
<p>In this example, we&#8217;re using strings for keys. However, when we do this, each instance of &#8220;name&#8221; becomes a separate object. We can see this by looking at the object id of each key:</p>
<pre>names[0].keys[0].object_id // =&gt; something like 2167457900
names[1].keys[0].object_id // =&gt; something like 2167433500</pre>
<p>As you can see, each key is its own object. No big deal in our example, but over thousands of keys, this would add up to some possibly significant memory usage.</p>
<p>Now, let&#8217;s do the same thing, but this time with symbols:</p>
<pre># create an array of hashes using symbols for keys
names = []
names[0] = {:name =&gt; "Joel"}
names[1] = {:name =&gt; "Jason"}</pre>
<p>If we look at the object ids of the keys now, we&#8217;ll see something very interesting:</p>
<pre>names[0].keys[0].object_id // =&gt; something like 435228
names[1].keys[0].object_id // =&gt; something like 435228</pre>
<p>The object ids of the two keys are the same because&#8230;well&#8230;it&#8217;s the same symbol. Instead of a new object being created for each key, one symbol is shared between the two, as well as any other keys using the same symbol that we might create. As you can imagine, over thousands of iterations, this could add up to a decent performance win. Kind of cool.</p>
<h2>Regular Expressions</h2>
<p>I have a horrible aversion to regular expressions. I&#8217;m not very good at them, and frankly this Koan did not help that sentiment. I mostly muddled my way through this Koan, and I&#8217;ve decided that regular expressions are something that I need to dedicate some significant time to later this year.</p>
<p>Believe me, I&#8217;m not (just) trying to be lazy here. I honestly am not good at regular expressions AT ALL, so I don&#8217;t feel that I can speak even partially intelligently about any sort of evaluation of this Koan.</p>
<p>So, moving on&#8230; <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Methods</h2>
<p>The methods Koan was pretty tame&#8211;nothing terribly out-of-the-ordinary from what you&#8217;d expect to find in a discussion of using &#8220;methods&#8221; within language A, B, or C. There were a few interesting tidbits, through.</p>
<h3>Look Ma, No Parentheses!</h3>
<p>First, you can call methods with arguments <em>without parentheses</em>. So the following&#8230;</p>
<pre>### define method
def my_method(a,b)
    a+b
end
### call method
result = <strong>mymethod 4,5</strong>  // =&gt; 9</pre>
<p>This is disconcerting to me, a person who likes things &#8220;bracketized.&#8221; However, it&#8217;s there, so if you REALLY need to save those 2 keystrokes and don&#8217;t care about driving the OCD amongst us crazy, go for it.</p>
<h3>Default Arguments</h3>
<p>Another cool thing is that you can easily define default values for arguments directly in the method definition:</p>
<pre>### define method
def my_method2(a,b=3)
    a+b
end
### call method
result = my_method(4) // -&gt; 7</pre>
<h3>Explicit or Not Explicit Returns</h3>
<p>Last, and perhaps in keeping with the possible frustrations inherent in #1, is that methods will potentially return values, whether or not you explicitly define a &#8220;return&#8221;. For example, the following will return the same value:</p>
<pre>### define method
def my_method3(a,b=3)
    return a+b
end

### define method
def my_method4(a,b=3)
    a+b
end</pre>
<p>There&#8217;s a part of me that hates that (I kind of like the self-documenting nature of brackets, specifying returns, etc.). However, I&#8217;m trying to keep an open mind to the patterns that are used in Ruby&#8230;hopefully it will make me better <strong><em>precisely</em></strong> by making me uncomfortable!</p>
<h2>Wrapping Up</h2>
<p>Another great day of Ruby. I&#8217;m happy with my progress so far, and I&#8217;m looking forward to Day 5!</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/01/learning-ruby-day-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chunky Checker: Some CSS3 Fun</title>
		<link>http://existdissolve.com/2012/01/chunky-checker-some-css3-fun/</link>
		<comments>http://existdissolve.com/2012/01/chunky-checker-some-css3-fun/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 20:53:27 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Checkbox]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Radio]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2341</guid>
		<description><![CDATA[In keeping with my New Year&#8217;s resolution to not get involved in &#8220;black-hole&#8221; projects so that I have more flexibility to pursue fun stuff on a whim, I whipped up a fun experiment in CSS3. The Main Idea If you design a lot of forms, you know that radio and checkbox lists are hard to&#8230;]]></description>
			<content:encoded><![CDATA[<p>In keeping with my <a title="Resolutions and Stuff" href="http://existdissolve.com/2012/01/resolutions-and-stuff/">New Year&#8217;s resolution</a> to not get involved in &#8220;black-hole&#8221; projects so that I have more flexibility to pursue fun stuff on a whim, I whipped up a fun experiment in CSS3.</p>
<h2>The Main Idea</h2>
<p><a href="http://existdissolve.com/wp-content/uploads/2012/01/chunkychecker.jpg"><img class="alignleft size-medium wp-image-2342" style="border: solid 1px #dadada;" title="chunkychecker" src="http://existdissolve.com/wp-content/uploads/2012/01/chunkychecker-300x109.jpg" alt="" width="300" height="109" /></a>If you design a lot of forms, you know that radio and checkbox lists are hard to style. And no matter how perfectly you lay them out, they are still just plain boring. I thought it would be fun to make checkbox and radio lists a bit more fun by going an entirely different route, and by getting a bit more 3D.</p>
<p>Enter &#8220;Chunky Checker.&#8221; This set of styles takes an ordinary list of checkboxes or radio buttons and converts them into a super-chunky 3D list. As the radios/checkboxes are activated, the particular segment of the list transforms, creating a &#8220;depressed&#8221; look, sort of as if a button was physically pressed.</p>
<h2>The Markup</h2>
<p>This approach is completely, 100% CSS and HTML&#8211;no JavaScript whatsoever. Moreover, it uses a pretty standard markup. The following is all that&#8217;s needed to <a href="#demos">recreate the demos</a>:</p>
<pre>&lt;fieldset&gt;
    &lt;legend&gt;Favorite Color:&lt;/legend&gt;
    &lt;input type="checkbox" name="color" value="Red" id="red" class="red"/&gt;
    &lt;label for="red"&gt;Red&lt;/label&gt;
    &lt;input type="checkbox" name="color" value="Orange" id="orange" class="orange" /&gt;
    &lt;label for="orange"&gt;Orange&lt;/label&gt;
    &lt;input type="checkbox" name="color" value="Yellow" id="yellow" class="yellow" /&gt;
    &lt;label for="yellow" class="yellow"&gt;Yellow&lt;/label&gt;
    &lt;input type="checkbox" name="color" value="Green" id="green" class="green" /&gt;
    &lt;label for="green" class="green"&gt;Green&lt;/label&gt;
    &lt;input type="checkbox" name="color" value="Blue" id="blue" class="blue" /&gt;
    &lt;label for="blue"&gt;Blue&lt;/label&gt;
    &lt;input type="checkbox" name="color" value="Indigo" id="indigo" class="indigo" /&gt;
    &lt;label for="indigo"&gt;Indigo&lt;/label&gt;
 &lt;/fieldset&gt;</pre>
<p>Nothing out of the ordinary here.</p>
<h2>How it Works</h2>
<p>in general, the styling is created by completely hiding the checkbox/radio buttons, and applying all of the styles to each input&#8217;s <strong>label</strong>. As checkboxes and radio buttons will be activated by their label being clicked, it&#8217;s easy to manage the &#8220;state&#8221; of the input element.</p>
<p>Speaking of input state, the stylesheet uses the <a href="http://www.w3.org/TR/selectors/#UIstates"><strong>:checked</strong> psuedo-selector</a> to determine whether or not to apply particular styles based on the state of the input. There are also rules to apply particular styles based on the state of adjacent inputs.</p>
<p>Finally, there are box-shadows added to create a 3D-ish look, and some animations are thrown in the mix to make the whole thing a bit more dynamic.</p>
<h2>Caveats</h2>
<p>This has been tested very little <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I don&#8217;t recommend you use it in production anywhere, as the following issues have been admittedly neglected. If you have suggestions for improving in these areas, please <a href="https://github.com/existdissolve/Chunky-Checker">get the source from GitHub</a> and hack away to your heart&#8217;s content.</p>
<p><strong>Cross-browser Compatibility:</strong> I&#8217;ve only tested it on Chrome, Firefox, Safari, and Opera, and even then, only on Mac. It seems to work decently well on all of them, although by far it works best in Firefox (go figure). There&#8217;s no telling how it behaves in IE9+, and it will surely be terrible in anything before IE9. On the other hand, this is an experiment in CSS3, so that&#8217;s kind of expected&#8230;</p>
<p><strong>Accessibility:</strong> Accessibility for this is probably awful, although I don&#8217;t have the interest to test it. There is currently no &#8220;focus&#8221; class for the inputs&#8217; labels, so this probably isn&#8217;t great for use with a keyboard.</p>
<p><strong>Chrome Hack:</strong> There is a crazy, silly bug in Chrome that caused me some headaches. If you depress a label, you&#8217;ll notice that an inset shadow appears on the depressed label element. When depressing the label to the right of an already-depressed label, the shadow *should* disappear. This works correctly in Firefox and Opera, but only works in Chrome if you move your mouse over the previously-depressed label, open Developer Tools, close Developer Tools, or do some other action that messes with Chrome&#8217;s chrome.</p>
<p>Fortunately, I ran across a <a href="http://css-tricks.com/webkit-sibling-bug/">good description of this bug</a>, which helpfully also had a hack solution. Check it out if you&#8217;re curious.</p>
<h2><a name="demos">The Demos</a></h2>
<p>I whipped up a couple of demos to show that this works pretty snazzily with radios and checkboxes.</p>
<ul>
<li><a href="http://existdissolve.com/demos/css3/chunkychecker/checkbox.html">Checkbox Example (Color)</a></li>
<li><a href="http://existdissolve.com/demos/css3/chunkychecker/checkbox_grey.html">Checkbox Example (Grey)</a></li>
<li><a href="http://existdissolve.com/demos/css3/chunkychecker/radio.html">Radio Example (Color)</a></li>
<li><a href="http://existdissolve.com/demos/css3/chunkychecker/broken.html">Chrome Bug Active</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/01/chunky-checker-some-css3-fun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning Ruby: Day 3</title>
		<link>http://existdissolve.com/2012/01/learning-ruby-day-3/</link>
		<comments>http://existdissolve.com/2012/01/learning-ruby-day-3/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 03:58:47 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Koans]]></category>

		<guid isPermaLink="false">http://existdissolve.com/?p=2336</guid>
		<description><![CDATA[Wow. Three straight days of the same thing, and I have yet to get distracted or go wandering off into some endless, pointless project. Maybe I&#8217;m learning something after all! Day 3 of Ruby Koans brings 3 new lessons: array assignments, hashes, and strings. Let the fun begin! Array Assignments With one significant exception the&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-e1326426711127.png"><img class="alignleft size-full wp-image-2326" title="256px-Ruby_logo" src="http://existdissolve.com/wp-content/uploads/2012/01/256px-Ruby_logo-e1326426711127.png" alt="" width="160" height="160" /></a>Wow. Three straight days of the same thing, and I have yet to get distracted or go wandering off into some endless, pointless project. Maybe I&#8217;m learning something after all!</p>
<p>Day 3 of <a href="http://rubykoans.com/">Ruby Koans</a> brings 3 new lessons: <strong>array assignments</strong>, <strong>hashes</strong>, and <strong>strings</strong>.</p>
<p>Let the fun begin!</p>
<h2></h2>
<h2></h2>
<h2>Array Assignments</h2>
<p>With one significant exception the array assignment koan was pretty straightforward. Dealing with arrays in most languages is pretty straightforward, and the idioms used in Ruby are much of what you&#8217;d expect.</p>
<p>A couple interesting things, though.</p>
<p>First, let&#8217;s say that you try to access a position in the array that doesn&#8217;t exist:</p>
<pre>icecream, gummybears = ["Vanilla"]
favorite = gummybears</pre>
<p>In this example, I&#8217;m trying access the &#8220;gummy bears&#8221; position within the array. However, it doesn&#8217;t exist. Instead of annoyingly erroring out, Ruby returns <strong>nil</strong>. Remember, <strong>nil</strong> is an object. So no error, but something useful to deal with. Nice.</p>
<p>But the most interesting part in this koan was the brief example of using the &#8220;<strong>splat operator</strong>.&#8221; Before deferring to others for an explanation, here&#8217;s the example:</p>
<pre>first_name, *last_name = ["John", "Smith", "III]
last_name = ["Smith", "III"]</pre>
<p>In this example, using the splat operator (*) when assigning &#8220;last_name&#8221; not only assigned &#8220;Smith&#8221; and &#8220;III&#8221; to last_name, but additionally transformed them into an array.</p>
<p>Honestly, I&#8217;m still trying to figure out exactly what the splat operator is meant to do. While I muddle through figuring it out, you can check out <a href="http://kconrails.com/2010/12/22/rubys-splat-operator/">this article</a>, <a href="http://devblog.imedo.de/2008/06/25/the-splat-operator-is-so-pretty/">this one</a>, and <a href="http://pivotallabs.com/users/nick/blog/articles/438-ruby-pearls-vol-1-the-splat">one more</a>.</p>
<h2>Hashes</h2>
<p>Like array assignments, there wasn&#8217;t a ton in hashes that was out of the expected in the koan. A few helpful things to keep in mind, though:</p>
<ul>
<li>Keys in hashes are unordered.</li>
<li>A hash&#8217;s keys are an array</li>
<li>A hash&#8217;s values are also an array</li>
</ul>
<p>One cool thing you can do with hashes is to merge them. Consider the following:</p>
<pre>hash = {"videogames" =&gt; "awesome", "opera" =&gt; "interesting"}
newhash = hash.merge({"opera" =&gt; "amazing", "NBA" =&gt; "boring"}) 
newhash =&gt; {"videogames" =&gt; "awesome", "opera" =&gt; "amazing", "NBA" =&gt; "boring"}</pre>
<p>As you&#8217;ll notice, merging two hashes with the same keys will overwrite the value of the original key. With a hash, you&#8217;d expect this&#8230;but still, the merge method is pretty elegant.</p>
<h2>Strings</h2>
<p>The strings koan is long. There are a lot of methods covered (your typical split, join, etc. idioms). I&#8217;m not going to go into a ton of detail about the koan, but I will call out a couple of things that I found really interesting.</p>
<p>First, there&#8217;s the &#8220;shovel&#8221; operator (&lt;&lt;) for concatenating strings. Actually, you can really call it &#8220;building&#8221; strings, since the shovel operator modifies the original string. Consider the following:</p>
<pre>ostr = "Hello "
nstr = ostr
person = "Joel"
nstr &lt;&lt; person
ostr =&gt; "Hello Joel"</pre>
<p>Even though &#8220;ostr&#8221; is not explicitly modified before the end, the final dump of &#8220;ostr&#8221; shows that it has, in fact, been modified via the string concatenation with the shovel operator.</p>
<p>Next, there&#8217;s the interpolation of variables within a string. For example:</p>
<pre>myval = "Wildcats"
str = <strong>"</strong>My favorite college basketball team is the #{myval}<strong>"</strong>
str =&gt; "My favorite college basketball team is the Wildcats"</pre>
<p>Straightforward enough. But consider the same example, just with single quotes:</p>
<pre>myval = "Wildcats"
str = <strong>'</strong>My favorite college basketball team is the #{myval}<strong>'</strong>
str =&gt; "My favorite college basketball team is the #{myval}"</pre>
<p>This is hard to swallow. Double quoted strings interpolate variables, but single quoted strings do not. I suppose if you do it enough, this becomes &#8220;one of those things&#8221; that you get used to. However, I can just anticipate some half-hour of frustration in my future when I forget this <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2012/01/learning-ruby-day-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

