tag:blogger.com,1999:blog-85125538378453483852012-09-22T17:14:57.607-04:00Attack of the Codosaurus!Adventures of a dinosaur evolving to meet today's challenges.Dave Aronsonnoreply@blogger.comBlogger28125tag:blogger.com,1999:blog-8512553837845348385.post-82209811441154607042012-09-22T17:14:00.002-04:002012-09-22T17:14:57.618-04:002012-09-22T17:14:57.618-04:00Do the Domain Shuffle! Heads up! I've finally pulled the proverbial trigger on setting up my LLC. Henceforth, Dave Aronson Software Engineering & Training will be Codosaurus, LCC, and will take over this blog's domain, http://www.codosaur.us. This blog is about to move to http://blog.codosaur.us. http://www.davearonson.com will eventually be replaced with stuff more about me personally.Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-28429338489047303232012-09-21T13:40:00.004-04:002012-09-21T13:40:51.095-04:002012-09-21T13:40:51.095-04:00Ruby microhack: kinds of triangles Someone recently posted on the RubyOnRails-talk mailing list, about a little exercise he was doing as a beginning Rubyist. The task was to construct a method that would return the type of a triangle (equilateral, isosceles, or scalene), given the three lengths. He had the logic down fine, but needed some help with the Ruby syntax, properly ending a series of if-statements.
A quite Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-22599168715592909792012-09-09T11:54:00.001-04:002012-09-09T12:13:28.138-04:002012-09-09T12:13:28.138-04:00Free Full-Text Search with Heroku, Part 2 Last time, we looked at putting a Ruby on Rails app on Heroku, using the pg_search gem to access PostgreSQL's built-in full-text search by making pg_search_scopes, and how to work around the bogon that you must always feed them something to search on.
The second bogon, subject of their very first issue filed on Github, is that you can't chain two or more of them in the same statement. ForDave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-76058112931734182542012-09-09T11:40:00.004-04:002012-09-09T12:14:16.430-04:002012-09-09T12:14:16.430-04:00Free Full-Text Search with Heroku, Part 1 If you want to put up a Ruby on Rails app for free, where's the natural place to put it? Heroku, of course! :-)
BUT... what if your app idea involves full-text search? While Heroku gives you lots of great tools for free, and they do have a number of full-text search tools, they don't give you any level of full-text search tools for free. (Other than a few things in public beta, or if Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-82747320141385999602012-03-20T13:44:00.002-04:002012-03-20T13:44:49.140-04:002012-03-20T13:44:49.140-04:00TDD or TDDD, or should we call it T3D? I was commenting on Test Driven Development in one of the Ruby groups on LinkedIn today, and realized it might make a decent blog post. So here we go:
The "purpose" of TDD is somewhat controversial, and also depends just how you do it. The traditional approach is "think of what you want it to do, think how you would test that, write the test, verify that the test fails (because you Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-75198601980143616742012-02-29T15:47:00.002-05:002012-02-29T15:47:34.222-05:002012-02-29T15:47:34.222-05:00Rubymoticons A few days ago, I was demonstrating injection of a symbol, to perform a series of subtractions in an array, and noticed a familiar pattern of characters. That inspired a bit more investigation. So now I present some basic Rubymoticons:
[].inject( :-)
{}[ :-]
->() { :-}
These are perfectly valid Ruby code, and evaluate to nil, nil, and a lambda.
Of course, the Dave Aronsonnoreply@blogger.com1tag:blogger.com,1999:blog-8512553837845348385.post-6821571608032790562012-02-08T12:45:00.000-05:002012-02-08T12:45:31.112-05:002012-02-08T12:45:31.112-05:00Sie mögen mich! Sie wirklich mögen mich!
Andy Newton, over at In Search of the Tempestuous Sea, has just nominated me for this award:
According to the terms of the award, I must now:
Paste the image on my blog. (See above.)
Link back to the blogger who gave me the award. (See further above.)
Pick my five favorite blogs with less than 200 followers, and leave
a comment on their blog to let them know they have received theDave Aronsonnoreply@blogger.com2tag:blogger.com,1999:blog-8512553837845348385.post-75616206603186922462012-01-18T07:20:00.000-05:002012-01-18T08:12:50.588-05:002012-01-18T08:12:50.588-05:00Stop SOPA and PIPA!
This post is black in protest of SOPA and PIPA, the House and Senate bills that will strangle freedom and innovation on the Internet, while doing next to nothing about "piracy", the alleged reason for the bills. Take action!
* Go sign Google's petition against them, at https://www.google.com/landing/takeaction/, and any others you can find.
* Contact your Senator and Representatives. Dave Aronsonnoreply@blogger.com1tag:blogger.com,1999:blog-8512553837845348385.post-49223450860689446202011-12-08T19:54:00.001-05:002011-12-08T19:55:06.951-05:002011-12-08T19:55:06.951-05:00Ruby Geekery: Defining method_missing and respond_to at the same time Not all the code (or coding comments) I'd like to share with the world, is on my own blog. Recently I made a comment I'd like to direct y'all to, over on Avdi Grimm's wondrous blog, Virtuous Code. Long story short:
Ruby has this interesting mechanism called method_missing, whereby you can call a method that doesn't really exist, but method_missing will be called instead, recognize the name, Dave Aronsonnoreply@blogger.com2tag:blogger.com,1999:blog-8512553837845348385.post-226026925049203772011-11-22T14:08:00.002-05:002011-11-22T14:12:35.419-05:002011-11-22T14:12:35.419-05:00I Am Decider, Hear Me RoR! I have finally gotten off my duff and pushed a little app to Heroku. The UI has not yet been polished at all, and the workflow still needs some tweaks, but the basic functionality is there. It's a decision support tool, that lets you create a bunch of Decisions. Each Decision has Alternatives (which just have names), and Factors (which have names and weights). Editing a Decision lets you Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-19654083596188899272011-10-05T08:51:00.000-04:002011-10-05T08:51:10.525-04:002011-10-05T08:51:10.525-04:00For Hire! Well that didn't quite go as planned! :-(
Long story short, I've been "let go". Turns out Rosetta Stone needed more of an ActionScript guru than I was able to turn into over the course of about ten months, starting from scratch. Of course, it didn't much help that they refused to send me to training on it. Reading AS books and following AS blogs in my spare time, listening to AS Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-64530683028137038132011-06-06T11:27:00.000-04:002011-06-06T11:27:46.524-04:002011-06-06T11:27:46.524-04:00Not the FTP Client Just a disclaimer: this site is not connected with the Codosaurus FTP client, found at http://grilledbacon.com/. I only discovered that yesterday, and by an amazing coincidence my first iPad will supposedly be arriving soon (anniversary present), so I haven't even tried it.Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-9671075020725513562011-04-24T12:13:00.000-04:002011-04-24T12:13:03.250-04:002011-04-24T12:13:03.250-04:00Password Security Some of you might know that this blog is not my only means of communicating technical information. I have also led classes, mentored colleagues, given briefings, and so on, at work. What some of you might not know is that I also give speeches at my Toastmasters club. Occasionally the topics are technical, such as this one I gave last Thursday. (Okay, it's nothing new for me, but it may be Dave Aronsonnoreply@blogger.com2tag:blogger.com,1999:blog-8512553837845348385.post-27662495048233019742010-11-20T13:39:00.000-05:002010-11-20T13:39:25.618-05:002010-11-20T13:39:25.618-05:00Code Kata Nine: Supermarket Checkout, Part B (Decouple) As you may recall, before life (real life, not Conway's) got rather busy, I left you hanging off the cliff of Dave Thomas's Code Kata #9. I had finished the "just make it work" part. Now for the "decouple the price rule format" part.
As Dave (the other Dave) says, there are many ways to do it. I chose to use the Strategy Pattern. (If you're not familiar with design patterns, you really Dave Aronsonnoreply@blogger.com4tag:blogger.com,1999:blog-8512553837845348385.post-31269150598777477722010-11-14T15:54:00.000-05:002010-11-14T15:54:02.728-05:002010-11-14T15:54:02.728-05:00And now for something completely different... Okay, maybe not completely different, as it will still be code-related. But, coding time is at quite a premium right now. So, until I manage to get some time to sit down and code for fun, I'm just going to post little snippets of advice.
I'm working on a team with some newer developers -- just a few years under each belt, versus my decades. One advantage, as far as this blog goes, is Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-82054052390464741002010-10-05T13:28:00.000-04:002010-10-05T13:28:37.139-04:002010-10-05T13:28:37.139-04:00Ads? What ads? Oops! Sorry for the large number of ads on here. Long story short I goofed the setup. I knew they wouldn't show up for me, due to Adblock Plus. (One of my most favoritest Firefox plugins EVAR!) What I didn't realize is that it would also block their representation on the Blogger layout design screen! So I had a bunch, at the top, when I thought I had none, and intended to just put one Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-48009753428858104682010-10-03T19:16:00.000-04:002010-10-03T19:16:15.717-04:002010-10-03T19:16:15.717-04:00Rosetta Stone: the company, and my own In other news, I have accepted a post with Rosetta Stone, in Rosslyn VA, and will be starting on October 18. Oddly enough, I'll be working mainly in ActionScript and Flex... neither of which I know yet! I'm told that ActionScript is generally similar to JavaScript, which I do know, so at least that's a head-start.
What does this mean for you, my loyal readers? I may soon start doing Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-92039875501234100832010-10-03T14:39:00.001-04:002010-10-03T18:52:31.068-04:002010-10-03T18:52:31.068-04:00Life in N Dimensions Sometimes we all feel as though life has gotten a bit out of hand. It's certainly been that way for me lately. As you may have noticed, I haven't updated this blog in quite some time, despite the way I was obviously trying to do it weekly. Was this just yet another case of someone up and walking away from their blog? No, not me! Really! I promise! (Well, at least this time it wasn't....Dave Aronsonnoreply@blogger.com4tag:blogger.com,1999:blog-8512553837845348385.post-9217549217870286832010-09-06T20:23:00.000-04:002010-09-06T20:23:01.002-04:002010-09-06T20:23:01.002-04:00Code Kata Nine: Supermarket Checkout, Part A (Just Make It Work!) Wow, I really managed to milk Conflicting Objectives for quite a run! Now let's move on to Dave Thomas's ninth code kata: Supermarket Checkout. Follow the link to go read up on it. I'll wait.
. . .
Ah, you're back. Good. Now, I want to make a little twist on the basic kata, as I believe this will be more instructive for the readers. First I am writing as though I am a naive but Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-40713814310098755332010-08-29T19:42:00.000-04:002010-08-29T19:44:43.042-04:002010-08-29T19:44:43.042-04:00Kata 8: Conflicting Objectives, Part 3B Okay, now I've had some time to think about what it means for the code to be "extensible". Offhand I'm thinking it's as in the "open" part of the Open-Closed Principle, which states that a class should be open to extension but closed to modification. That is, you should be able to extend it o do new and different things, but not so much monkey around with the existing functionality and Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-14978783284150612862010-08-22T12:56:00.000-04:002010-08-22T12:56:13.875-04:002010-08-22T12:56:13.875-04:00Kata 8: Conflicting Objectives, Part 3A Part 3, much like Part 1, is open to much interpretation. I figure that the sense of "extensible" that Dave Thomas probably meant to drive at, was "easy to add features to", most likely by making subclassing easy, and accepting code blocks, and things like that. I've been giving that some thought, and it makes my head hurt. :-)
So for now, I'm going to "creatively misinterpret" it as "Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-75523428313883582082010-08-15T11:55:00.000-04:002010-08-15T12:02:36.308-04:002010-08-15T12:02:36.308-04:00Code Kata Eight: Conflicting Objectives, Part 2 (Make It Fast) As you may recall from last time, kata number eight has three parts: write it to be readable, write it to be fast, and write it to be extensible. I covered readability last time, so now let's go for speed. (Cue The Distance, by Cake.)
#! /usr/bin/ruby
# Dave Thomas Code Kata #8: Conflicting Objectives
# See http://codekata.pragprog.com/2007/01/kata_eight_conf.html
# Solution by Dave AronsonDave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-50792580101759624462010-08-07T20:56:00.000-04:002010-08-07T20:56:44.783-04:002010-08-07T20:56:44.783-04:00Code Kata Eight: Conflicting Objectives, Part 1 Kata number seven is a non-coding kata, so let's move on to kata number eight. This one is about conflicting objectives. To quote the original:
Write the program three times.
The first time, make program as readable as you can make it.
The second time, optimize the program to run fast fast as you can make it.
The third time, write as extendible a program as you can.
Even that, though, Dave Aronsonnoreply@blogger.com1tag:blogger.com,1999:blog-8512553837845348385.post-65230772523461071672010-08-01T15:44:00.000-04:002010-08-01T15:49:18.317-04:002010-08-01T15:49:18.317-04:00Anna Graham? No, kata number six is about anagrams, not some lady named Anna Graham. Follow the link for more details, but briefly the objective is to load in a bunch of words, say which ones were anagrams of which, what the longest anagrammed word is, and what the largest set of anagrams (i.e., words using the same letters) is. My solution hinges around the load_words method. The implementation, in Dave Aronsonnoreply@blogger.com0tag:blogger.com,1999:blog-8512553837845348385.post-82973769377533010082010-07-24T13:13:00.000-04:002010-07-24T13:14:47.803-04:002010-07-24T13:14:47.803-04:00Code Kata Five (Bloom Filter) Solution Kata number five is about Bloom Filters. No, that isn't anything to do with flowers, though of course it could be used for that purpose. Dave Thomas' description will quite suffice. If you're not familiar with them, go read it now. I'll wait.
Oh, you're back. Good. Now that you have a good understanding of what they do and how, here's my implementation. It uses each pair of bytes Dave Aronsonnoreply@blogger.com0