I just spent a few hours banging my head on this one but it appears that my local git configuration was the source of a Fixture::FormatError occurring while running tests in Rails.
The specific error looked like this:
Fixture::FormatError: a YAML error occurred parsing /dev/current/myapp/test/fixtures/blogs.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html The exact error was: ArgumentError: Anonymous modules have no name to be referenced by
I have not yet pin pointed (and may never pin point) the exact source of the problem but what appears to have been causing it was my local git configuration (~/.gitconfig) which included the following two lines:
[core] whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
The git config file was passed around during a Cincinnati Ruby Brigade meeting and, being a git noob, I installed it dutifully.
Anyway, removing those two lines from the .gitconfig file resolved the issue after I moved the existing clone aside and re-cloned the repository. Feel free to provide details in the comments if you’ve got a clue and/or can shed some light on the exact cause.
It seems that a lot of folks are experiencing the “Error 51: Unable to communicate with the VPN subsystem” issue with Cisco’s VPN Client in Mac OS X. After much searching when I encountered the same issue, the solution turned out to be quite simple.
There is no annoying middle step.
I know that I should have these committed to memory by now but I don’t and I can never find them on the Web. Now I’ll never loose them! (Those sound like famous last words…)
During a recent Cincinnati Ruby Brigade meeting a new member who was running Windows would have benefited from a minimalist guide to installing Ruby on Rails on Windows. A few days later I was forced to press my old Windows desktop system into service as an emergency Rails development platform. So I decided to write this post.
Thanks to All About Ruby for providing a starting point for my research for this post.
Nota Bene: These instructions are Windows XP specific. If you’re using another flavor of Windows YMMV. Also, all references to software version numbers are current only at the date of this posting.
C:\>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
C:\>gem update --system Updating RubyGems... Attempting remote update of rubygems-update Successfully update rubygems-update-1.3.1 Updating version of RubyGems to 1.3.1 Installing RubyGems 1.3.1 [...] RubyGems system software updated
C:\>gem -v 1.3.1
WARNING! Be careful that you do not corrupt or delete the existing PATH string.
C:\>gem install sqlite3-ruby Select which gem to install for your platform (i386-mswin32) 1. sqlite3-ruby 1.2.4 (ruby) 2. sqlite3-ruby 1.2.3 (x86-mingw32) 3. sqlite3-ruby 1.2.3 (mswin32) 4. sqlite3-ruby 1.2.3 (ruby) 5. Skip this gem 6. Cancel installation > 3 Successfully installed sqlite3-ruby-1.2.3-mswin32 Installing ri documentation for sqlite3-ruby-1.2.3-mswin32... Installing RDoc documentation for sqlite3-ruby-1.2.3-mswin32...
C:\>gem install rails Successfully installed rails-2.2.2 1 gem installed
C:\>rails -v Rails 2.2.2
Let’s mimic the first couple of minutes of the famous Creating a weblog in 15 minutes video to test things out.
C:\dev>rails blog create create app/controllers create app/helpers create app/models create app/views/layouts [...]
C:\dev\blog>ruby script\server -> Booting WEBrick... -> Rails 2.2.2 application started on http://localhost:3000 -> Ctrl-C to shutdown server; call with --help for options [2009-03-14 13:55:45] INFO WEBrick 1.3.1 [2009-03-14 13:55:45] INFO ruby 1.8.6 (2007-03-13) [i386-mswin32] [2009-03-14 13:55:45] INFO WEBrick::HTTPServer#start pid-192 port-3000
C:\dev\blog>ruby script\generate scaffold Post title:string body:text exists app/models exists app/controllers exists app/helpers create app/views/posts [...] dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/post.rb create test/unit/post_test.rb create test/fixtures/posts.yml create db/migrate create db/migrate/20090315055640_create_posts.rb
C:\dev\blog>rake db:migrate (in C:\dev\blog) == CreatePosts: migrating ====================================================== -- create_table(:posts) -> 0.0940s == CreatePosts: migrated (0.0940s) =============================================
There you have it. Go ahead and finish the rest of the Creating a weblog in 15 minutes video and leave me a comment if you encounter any trouble.
Coming Soon! Git on Windows.
Imagine my joy when the company owner decided (for reasons that I care not to divulge here) to swap his year old MacBook Pro for my nearly two year old Dell X1! I hadn’t been using the Dell since I also had a year old MacBook (white) and although I was giving up 20GB of storage to upgrade from the MB to the MBP I jumped at the offer.
54 minutes after firing up Migration Assistant I was in business and loving the MBP goodness NOTE: I had just upgraded the MBP for the owner from Tiger to Leopard by means of a fresh install. So there wasn’t a lot of cruft on the drive that needed cleaning up once I deleted his user account.
All was well until I got around to hooking the MBP up to my second display. I am in the habit of using my ViewSonic VX715 for my work screen since it sits above my laptop, and leaving social apps like Adium, NatsuLion, and Skype open on the laptop display. However, I was no longer able to drag Safari, TextMate, etc. to the upper display although I could drag all the social apps there. Bizarre!
I posted this “annoyance” on Twitter and then the solution came to me immediately. All my “work” apps were too wide to fit the VX715’s default resolution of 1024X768. DOH! Adjusting the monitor’s resolution via System preferences freed my apps to move wherever I choose. I am a bit annoyed though that OS X apparently does not permit “over-sized” app windows move between displays since it is certainly possible to make an app window wider than any single screen. Nonetheless, mystery solved.
To many of you this information will come as no surprise, but I’ve searched (perhaps not hard enough) for succinct definitions of the various “types” of software development tests and I recently found these which I have paraphrased. Unfortunately, I do not now recall the source from which I derived these notes. If you believe you are the original author, please contact me and I will add proper attribution if your information appears familiar.
NOTE: I have ordered the tests (I believe) from most granular to least where such adjectives apply.
Software Testing:
As I am want to do, I became involved in an exchange on Twitter with the lovely and talented Cal Evans concerning his thoughts about forsaking his current OS/hardware choice and going Mac instead. While this seemed like a slam dunk to me, one person’s experience seemed to be giving him pause. With Twitter’s 140 character limit, there was no way for me to do justice to a very positive experience I had with Apple customer service. So, I thought I would recount the story here for posterity.
One of my current employers, Amphora Research, purchased me a PowerBook in 2005 which served me faithfully for a couple of years, until the hard drive died. Conditioned as I was to sweat such events by years of Windows and Linux use, I was not looking forward to the road to recovery ahead. I was no “spring chicken” and had been religiously backing up the PB using SuperDuper. Nonetheless, I was apprehensive as I headed to the local Apple Store to see what the geniuses could do for me. We had purchased Apple Care for the PB. So I was hoping for minimal hassle.
Upon arrival at the Genius Bar, without an appointment (you could still do that in 2007), I was greeted by a very knowledgeable genius (redundant as that may sound) who, after listening to my sad story, asked me to be patient while he checked to see what hardware they had available. As it turned out, all they had was an 80GB drive in stock but my PB came with only a 60GB drive installed. Prepared to be disappointed, I was very pleasantly surprised when the the genius asked if I would mind the extra 20GB of storage. When I asked how much the extra 20GB would cost me I was once more pleasantly surprised when he told me there was no additional cost! He asked me if I had all my data backed up which I assured him I did, and he informed me that he would need to keep the bad drive which was no concern to me. Giving Apple one more chance to disappoint me, I asked when the laptop would be ready to pick-up. “Give me a half an hour” he said, and one strawberry smoothie later I was walking out of the Kenwood Towne Centre with a juicy little upgrade but anticipating a day or two of OS and application re-installation.
I recalled the Apple genius telling me restoring the drive would be a snap when I told him I had backed up the drive using SuperDuper. He could not have been more correct. Here is the entire restore process (windows and Linux users may want to turn away at this point!):
No OS re-install. No application re-install. Simply go back to work! It don’t get no better than this.
Shortly thereafter, my boss bought me a new MacBook which required service six months after its purchase that necessitated a week long stay at a local Apple service provider, ComputerDNA. What was I going to do without my Mac for a week? Keep on working! I booted a Mac Mini we used for pair programming from the SuperDuper back-up volume and composed and saved documents to the back-up volume as if it were the internal drive. Once my MB was returned, I restored the back-up copy to the internal drive of MB and all my new work was there waiting for me. There were no hardware issues booting the back-up created on my MacBook on the Mini, or booting the back-up updated on the Mini and restored to the MacBook.
I’ve been using Macs for ten years and as my OS of choice for four years now. When I “need” Windows or Linux I fire up VMware Fusion but I’m always relieved to return to OS X. When was the last time you were pleasantly surprised by your operating system?
PS: Just so you don’t think I’m too much of an Apple/OS X fanboy, FileVault SUCKS!!!
I will never write an “enterprise” software application; web-based or otherwise. Thus, BIG design makes little sense in my world. I’m a “scratch your own itch” developer. The problems that most interest me are closest at hand and, frankly, “traditional” software design practices would be wasted solving such problems. As the days, weeks, months, and (God willing) years pass, you will find more information here pertaining to the latter and less about the former.
I was first exposed to Agile Software Development when my employer at the time began hosting the monthly Cincinnati eXtreme Programmers (or “XP-Cinci”, now known as the “Agile Round Table”) meetings. Having worked 17 years in various non-IT roles for a large, commercial airline, I had had enough of BIG.
My formative years as a developer were influenced heavily by fellow XP-Cinci members like Jim Weirich, Mark Windholtz, and Joe O’Brien. Each of these guys, and many others, has a wealth of BIG design experience and yet each has found Agile means more productive, rewarding, and, dare I say it, fun to use not only on their own software projects but those, large and small, that they produce for profit.
So sit back, step away from that Gantt chart, and have fun!
For my part-time gig I needed an elegent way to nudge an absent minded customer of his past due account balance. I typically invoice via an emailed PDF which I thought would be cool because one day I could create a “second notice” version by placing an appropriate watermark behind the original invoice. That at least was the plan…
Well, after months of forgetting to play with this idea, or playing with it on and off, I stumbled upon this. Now, thanks to Colin, and especially the creator(s) of pdftk the process of creating my second notice invoices is a simple as this:
pdftk invoice.pdf background notice.pdf output notice_invoice.pdf
What’s even better is that pdftk is available for Linux, OS X, FreeBSD, Solaris, and Windoze.
Greetings from Ruby Code Camp in Columbus, OH and thanks to the Columbus Ruby Brigade for spreading the word and to all the sponsors, especially Agile Consulting and EdgeCase. Here’s what I’ve learned…
Beside many other brilliant things he said, Rob Stevenson demonstrated the following (figurative – not literal) gem that will display all methods to which an object will respond:
>> 1.methods.each { |i| printf "Method name: %s\n", i.to_s } Method name: % Method name: inspect Method name: << Method name: singleton_method_added Method name: & Method name: clone Method name: >> Method name: method Method name: round Method name: rpower Method name: public_methods ...
As Rob Biedenharn was setting up for the next session he had the contents of his .irbrc file which among other things contained the following:
IRB.conf[:PROMPT_MODE] = :SIMPLE IRB.conf[:AUTO_INDENT] = true require 'rubygems' def clear system "clear" end alias :cls :clear
Setting the irb prompt to simple removes everything but the two “greater than” characters. The auto indent feature indents your input automatically (duh!) according to Ruby code conventions which is something Jim Weirich apparently didn’t know and although I would love to be able to tell folks that I taught Jim something about Ruby i only learned it by googling it two minutes prior to showing Jim. Since I use rubygems a lot I add those in by default, and since I like to keep my screen clean so I stole, eh…, I mean re-used Rob’s “clean” method setting an alias for called “cls”. I combined this knowledge to create the following means to output a sorted list of all methods to which a given object will respond:
def pretty_methods obj obj.methods.sort.each { |i| printf "%s\n", i.to_s } end alias :pm :pretty_methods
During the second hour of Ruby Introduction taught by Ron McCamish and coded by Rob Biedenharn I learned a new thing or three as the case may be about quickly getting at regular expression match data:
irb >> b = /v(olly)?ball/ => /v(olly)?ball/ >> str = "My vollyball is Tachikara" => "My vollyball is Tachikara" >> str =~ b => 3 >> $` => "My " >> $& => "vollyball" >> $' => " is Tachikara"
Finally, I learned that I need to better understand closures, the difference between “detect” and “select”, and that I will never be able to code as well as Jim Weirich.