the singularity of being and nothingness
existdissolve
This user hasn't shared any biographical information
Homepage: http://existdissolve.com
Jabber/GTalk: existdissolve
Posts by existdissolve
Grouping in CFLoop…Finally!
Feb 18th
With the public release of ColdFusion 10 Beta yesterday, I thought I’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 <cfloop>.
As expected, this is pretty straightforward, and has the same capabilities as the <cfoutput> corollary. Here’s a quick example:
<cfquery name="qproducts" datasource="somedatasource"> select * from products order by category,subcategory,product </cfquery> <cfoutput> <cfloop query="qproducts" group="category"> <h1>#category#</h1> <cfloop group="subcategory" groupcasesensitive="true" > <h2>#subcategory#</h2> <cfloop> #product#<br /> </cfloop> </cfloop> </cfloop> </cfoutput>
Pretty simple, but something which I know a lot of people have wanted for quite a while. Well, now you have it!
Learning Ruby: Day 6
Feb 7th
Ah, back to Ruby. Unfortunately, I had to take several days off for personal reasons…or rather, work invading on personal time. Ugh.
But enough of that nonsense.
This day of Ruby is a short one: exceptions and iterations.
ExceptionsI’ll be perfectly honest: I’m lost on this one. I understand parts of it (for example, that particular errors…like StandardError…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’d be completely lost when it comes to handling exceptions in Ruby.
Fortunately, the internet exists, and a quick Google reveals that there a dozens of good articles (like this one) about exception handling in Ruby. So I’ve got some reading to do. And you know what? That’s okay. Part of learning is getting frustrated, hitting a wall, and seeking out the answers. I expected this all along, so no biggie.
IterationsThe 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 “each”, “find”, “select”, etc. The syntax is pretty straightforward:
myarray = ['one', 'two', 'three']
myarray.collect { More >
Learning Ruby: Day 5
Jan 26th
Today’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 grasping basic concepts, and my journey through the Koans is becoming less of flailing blindly and more of thinking about what I’ve learned and trying to reason through the challenges I encounter. Granted, not impressive, but it is progress
ConstantsThe first Koan dealt with the concept of constants. The role of constants in programming is pretty well-understood, so there’s nothing difficult to understand about their usage in Ruby…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. Check it out when you have a chance.
Control StatementsAh, what would programming be without control (if, else, for, while…) statements? Probably not worth doing!!
A couple cool things I want to point out about control statements in Ruby.
First, I’m warming to More >
CSS3 Infographic
Jan 22nd
There’s something with me, the weekend, and CSS3…hmm…
On Saturday, Google Politics & Elections posted an interesting infographic about search trends over the last week related to the four remaining GOP Presidential candidates.
Here’s the infographic:
From Google Politics & Elections
Overall, pretty nice. It makes good use of color, highlights the important details, and avoids loading the graphic with needless frills, pointless content, etc.
The one problem, though, is that it’s simply an image. While it’s nice to look at, it’s kind of boring.
Some CSS3 Up In HereSo 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.
Check Out the Example (note: you’ll need a more recent version of Webkit or Firefox for this to work…)
In this experiment, I’m using a few things I’ve not messed with much in the past: keyframes and the flex-box model.
Flex-Box ModelIf you’re a web designer, you’ve no doubt spent endless hours trying to coax HTML and CSS to do simple things like expand “columns” 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 More >
Learning Ruby: Day 4
Jan 19th
I took a couple days’ 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…) of Nura: Rise of the Yokai Clan.
But now I’m back!
Day 4 of Ruby entails some tasty symbols, regular expressions, and methods.
SymbolsWhile I knew this going in, I’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 “stuff” is.
Symbols are a great example of this gap. They’re scattered sneakily throughout the preceding examples, and seem easy enough to use. However, defining what a “symbol” is by virtue of the Koan itself leaves a bit to be desired.
So I did some reading. I eventually came across a nice article entitled “The Ruby_Newbie Guide to Symbols” 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.
I’ll let you read Steve’s article for the full scoop, but my reading of symbols is More >
Chunky Checker: Some CSS3 Fun
Jan 16th
In keeping with my New Year’s resolution to not get involved in “black-hole” projects so that I have more flexibility to pursue fun stuff on a whim, I whipped up a fun experiment in CSS3.
The Main IdeaIf 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.
Enter “Chunky Checker.” 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 “depressed” look, sort of as if a button was physically pressed.
The MarkupThis approach is completely, 100% CSS and HTML–no JavaScript whatsoever. Moreover, it uses a pretty standard markup. The following is all that’s needed to recreate the demos:
<fieldset> <legend>Favorite Color:</legend> <input type="checkbox" name="color" value="Red" id="red" class="red"/> <label for="red">Red</label> <input type="checkbox" name="color" value="Orange" id="orange" class="orange" /> More >
Learning Ruby: Day 3
Jan 14th
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’m learning something after all!
Day 3 of Ruby Koans brings 3 new lessons: array assignments, hashes, and strings.
Let the fun begin!
Array AssignmentsWith 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’d expect.
A couple interesting things, though.
First, let’s say that you try to access a position in the array that doesn’t exist:
icecream, gummybears = ["Vanilla"] favorite = gummybears
In this example, I’m trying access the “gummy bears” position within the array. However, it doesn’t exist. Instead of annoyingly erroring out, Ruby returns nil. Remember, nil is an object. So no error, but something useful to deal with. Nice.
But the most interesting part in this koan was the brief example of using the “splat operator.” Before deferring to others for an explanation, here’s the example:
first_name, *last_name = ["John", "Smith", "III] last_name = ["Smith", "III"]
In this example, using the splat operator (*) when assigning “last_name” not only assigned “Smith” and “III” to last_name, but additionally transformed them into an More >
Learning Ruby: Day 2
Jan 13th
Day 2 of my journey to learn Ruby covers 3 koans: nil, objects, and arrays. If anyone is interested in how I’m running the koan tests, I am simply loading the base-level path_to_enlightenment.rb file from Terminal, and I’m using Xcode to modify the individual koan files. Yes, I said it. I’m using Xcode.
Don’t be a hater. It was the program that opened when I double-clicked the first koan. It seems to work fine for what I’m doing. Will I try other editors? Probably. Are there better ones? I’m sure there are (VIM, maybe?), but I’ll never know which is the best until someone leaves a comment and tells me which one is best!
Alright, enough of that. On to the koans!
Crazy, Interesting NilWhen I saw nil, I thought, “oh, this is NULL”. A keyword, placeholder, something special that represents no-thing. In Ruby, though, nil is interesting, if for no other reason than that it is an object. Yep, an object…definitely not “NULL”.
As an object (e.g., nil.is_a?(Object) == true), nil has its own methods. Consider the following:
nil.to_s => "" (e.g., nil to string == empty string) nil.to_i => 0 (e.g., nil to integer == 0)
So in a scenario in which you have to deal More >
Learning Ruby: Day 1
Jan 12th
So, 11 days into the new year, and I’m actually still going pretty strong with my resolution to make time for learning new (to me) development skills. Yay!
Recently, I was working on a small project where I needed to emulate some of the color transformations from SASS in JavaScript. In order to do this, I needed to dig into the source code, written in Ruby. I was able to suss out what I needed easily enough, but the syntax and approach in Ruby intrigued me. So I figured, what the heck, let’s learn Ruby!
Getting StartedI wanted to start small and easy, so after installing Ruby, I followed the nice and accessible “Ruby in Twenty Minutes” tutorial at the main Ruby site. It’s nothing earth-shattering: your typical “Hello World” turned “Say Hello to Everyone” introduction. However, the tutorial is easy to follow, gives you a nice overview of the some of the syntax conventions that are to come, and (at least for me) leaves you wanting to continue with exploring Ruby.
Where to Go From HereAs with any language, the obligatory “Hello World,” while giving you a taste of the language, does very little in the way of actually teaching you what Ruby is More >
ColdFusion Queries to ExtJS Data Models
Jan 8th
I love data Models in ExtJS. They are extremely simple to use, but are amazingly powerful for driving robust JavaScript applications. In fact, I’ve gotten to the point where I use them in just about everything I do, and they are fast becoming an indispensible part of my JavaScript development approach.
A big part of the appeal of ExtJS data Models is their flexibility. While some data “plugins” in other JS frameworks certainly allow you mimic some of the behaviors of a data model, ExtJS’ data Model wins hands down because of its extreme flexibility. With a ExtJS Model, you can quickly and easily create powerful definitions of data objects (fields, data types, associations, validations, etc.) in your application. These models can then in turn be used to craft a data Store, which can themselves be plugged into many of ExtJS’ data components (DataView, Grid, Chart). What you end up with is a super-powerful, deeply-data-driven application in a ridiculously small number of lines of code.
Of course, the perfect complement to the simplicity and grace of ExtJS’s data Model is to “feed” it using ColdFusion. Below, I’ll outline how to retrieve data from CF, as well an extremely easy way (there are More >