Log in

Using javan/whenever on Engine Yard Cloud

Originally published at Sara Trice. You can comment here or there.

UPDATE 4.17.2012: If you're on EY and not using custom chef recipes, you should start. A whenever recipe has been written and is detailed here. Info on how to start using custom chef recipes is here. It's not so bad, really. One gotcha: your "appname" in the recipe is not your rails application name, but your EY application name - these can be different things!

Things I wish I’d have known:
1. It does not matter if whenever is in your gemfile, you have to SSH to your EY server and install whenever as such: sudo gem install whenever
2. It will probably complain that you don’t have i18n installed, so: sudo gem install i18n

EDIT: You will have to repeat the two steps above ANYTIME you restart your EY instance!

3. If you want your crontab updated on deploy, make a file named deploy/before_restart.rb and stick this in it (make sure you replace ‘yourAppNameHere’, derp):

@rails_env = node[:environment][:framework_env]
run "cd #{release_path}; whenever --set environment=#{@rails_env}; whenever --update-crontab 'yourAppNameHere'"

This is called a ‘deploy hook’ and here’s more info.

I found the idea for this in an old EY forum post.

Originally published at Sara Trice. You can comment here or there.

Interesting tidbit about a new law that is being passed. IL Senate Bill 840 allows for “Cottage food operations” (i.e. you can use your home kitchen), with several stipulations, if and only if you are selling goods at a farmers’ market. So if I wanted to sell my cakes at a farmer’s market and got the appropriate paperwork, I could, but I still couldn’t sell them to individuals specifically out of my home. I’d have to have a table at a farmer’s market. Which is pretty much useless to me. Oh well, it’s a step in the right direction.

Article from the News-Gazette
Article from the IL Stewardship Alliance
Senate bill 840


Originally posted by karnythia at Of Fairy Wings And Glittering Crowns (Crowdfunded Fiction)
As some of you already know a few months ago we packed up and moved to Memphis. On paper it was a good plan. In execution...well, we wound up in an apartment where the floors slope at an angle so steep nothing on wheels can stay in place. One of the bedrooms has a hole in ceiling big enough to stick my arm through that we've been trying to get fixed since the week we moved in. And then there's the roach problem (complete with a nest inside the dishwasher), which...let's just say that we landed with the worst landlord possible and he shows no signs of getting better. Fortunately our lease is month to month. Unfortunately, having been here for the last six weeks we have discovered that we don't like Memphis. At all.

We're a family of walkers and Memphis is not pedestrian friendly in the slightest. We do have access to a car, but we hate having to drive everywhere. The kids were excited in the beginning, but between the apartment issues and the lack of playmates at any of the parks (it is too hot to play outside and the pools aren't open yet) they're miserable. We'd rather cut our losses now, instead of moving into another apartment in a city that we don't love in the first place. It doesn't help that having attracted the attention of the Cult of The Fetus (aka Jill Stanek & her followers) a few weeks ago, I don't feel super safe here. As silly as it may sound we're ready to head back to Chicago and accept that we are really Chicago kids. But, the expenses of moving down here mean we don't have enough cash to pay bills here, find a new place, and afford all the attendant costs of reworking our lives all over again. In theory we would eventually earn enough to swing it, but that would mean being here for months and we really don't want to do that.

So, I'm offering up a YA novel Of Fairy Wings And Glittering Crowns to be written in 60 days and posted chapter by chapter at Atypical Princess. I'll be posting the plot synopsis and character sketches today with an eye towards posting the first chapter tomorrow. There's a Chip In widget below that's not quite accurate (I got a couple of donations yesterday), but will still provide a way for folks to keep track of our goal. If you can't donate I still want you to read, after all what's the point of fiction if you can't share it? All I ask is that if you like it, you link it to your friends and family for their perusal. Thanks so much, I hope you enjoy reading this as much as I plan to enjoy writing it.

Selena Newly grew up in a family that took the fun out of dysfunctional. Sharing a house with a mother that never wanted her, aunts who detest each other, and a grandmother that has them all at the mercy of her purse strings hasn't exactly made for an idyllic childhood. In fact it has left her yearning for adulthood since she was old enough to walk. The day her mother throws her out is the best and worst day of her life. She is free, but she has nowhere to go, and no idea how she's going to support herself. When the door into Altanur opens it seems like the answer to all her childhood prayers. Her family isn't really her family, and she's a fairy princess. Unfortunately she's about to learn the hard way that everything has a price, and sometimes that price may be too high.

I'm blogging across two platforms. Feel free to comment here or there. You decide!

Originally published at Sara Trice. You can comment here or there.

The documentation for jsTree is thorough, but not particularly easy to read. If you are looking for an easy way to add “Expand All” and “Collapse All” buttons, here’s one way:

<input type="button" value="Collapse All" onclick="$('#tree_container_id').jstree('close_all');">
<input type="button" value="Expand All" onclick="$('#tree_container_id').jstree('open_all');">

where ‘#tree_container_id’ is, of course, the ID of the container node for your tree.

Originally published at Sara Trice. You can comment here or there.

Here’s an interesting read from Ars Technica:

Did file-sharing cause recording industry collapse? Economists say no

The most interesting paragraph I see in this article is this one:

So what is emerging is an increasingly “ephemeral” global music culture based not upon the purchasing of discrete physical packages of music, but on the discovery and subsequent promotion of musicians through file sharing. The big winner in this model is not the digital music file seller, but the touring band, whose music is easily discoverable on the ‘Net. As with so much of the rest of the emerging world economy, the shift is away from buying things and towards purchasing services—in this case tickets to concerts and related activities.

So I have to wonder – to my friends (and my husband) who count on selling merch at their unpaid performances – is this a game changer? Will musicians from now on be ultimately unable to make a living unless they go on the road – and stay there?


Originally published at Sara Trice. You can comment here or there.

I have a textarea with the id of “request_details”, made into a CKEditor instance by jQuery: $(‘#request_details’).ckeditor();

(Check this page if you need some help getting CKEditor to work with jQuery, it’s dead simple)

Feature looks like this:  And I fill in "Here are some details" in the CKEditor instance "request_details"

Step looks like this:

When /^I fill in "([^"]*)" in the CKEditor instance "([^"]*)"$/ do |value, input_id|
browser = page.driver.browser


My least favorite phrase

Originally published at Sara Trice. You can comment here or there.

I’ve decided on my least favorite phrase in the English language:

“Can’t you just…?”

Why is this my least favorite phrase? Because:

  1. It’s always in conjunction with a task that the questioner does not understand, but assumes should not be difficult at all;
  2. it is inherently second-guessing the person being asked, which is insulting;
  3. and, rather than asking if something is possible, as in “Can you?” or “Could you?”, the speaker is really saying, “This must be possible, and if you can’t do it, you’re an idiot.”

If you don’t understand how the system works, or what is involved with doing a task, please, ask if something is possible. Don’t demean the craftsman or browbeat them into doing whatever it is you want. A resentful craftsman is not on your side, and will not go out of his/her way to help you.


Using mysql2 on Windows

Originally published at Sara Trice. You can comment here or there.

Another edition of Sara uses Rails on Windows! *muppety fanfare*

Trying to get mysql2 to run on Windows is a bit of a pain. I used the lovely installer from Railsinstaller.org and then created an app with :

rails new testapp -d mysql

and then bundled.

By default this installs the mysql2 gem. There are some gotchas, and hopefully this will help:

  1. You have to install mysql first (derp!). Go here and pick either the 32 or 64 bit MSI installer, and use this guide to pick your options during the install (section II). I know, it’s an old guide, but it works fine. And it has pictures!
  2. You may get this error: “%1 is not a valid Win32 application.” This means you need to go here and get libmysql.dll, and copy it into c:\RailsInstaller\Ruby1.8.7\bin. Get the right version or your migrations will fail when you try to add indexes – the MySQL 5.5.9 64-bit version of libmysql.dll will NOT work! I got this version and it worked just fine: mysql-connector-c-noinstall-6.0.2-win32-vs2005.zip (you don’t need the MSI installer for this one, just grab a zippy file).
  3. Next error you may get is “rbreadline.rb:4404: uninitialized constant RbReadline::Encoding (NameError)”. Thanks to this blog post I found the answer is to go into c:\RailsInstaller\Ruby1.8.7\lib\ruby\site_ruby\1.8\rbreadline.rb, and comment out line 4404.

There you go! Rake away!


Github, https, and you

Originally published at Sara Trice. You can comment here or there.

Banged my head against this for a while. Starting a new rails project, trying to get rails.js from github, but it’s failing every time:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

So (after a lot of googling) I opened up gems/jquery-rails-0.2.7/lib/generators/jquery/install/install_generator.rb and added this just after the beginning of the InstallGenerator class (“class InstallGenerator < ::Rails::Generators::Base”) :

require ‘openssl’
All fixed! Pulled down the file with no hiccups.


Pik and Git Bash on Windows 7

Originally published at Sara Trice. You can comment here or there.

Lately I’ve been installing Ruby on Rails on Windows 7, and have run into a few people trying to make my life easier. One is Sarah Mei, a wonderful member of devchix who has posted a guide for getting things running.  Hearts and bunnies and flowers for her.

Pik is a neat project for Windows that helps you switch between installed versions of ruby. I’m using the Git Bash shell (as mentioned in the guide above), so I had to do a bit of tweaking, and maybe you do too, so here goes:

For some reason the installer didn’t create my .pik/.pikrc file in my home directory, so if yours didn’t create either, this is how it should look:


function pik {
$pik_path/pik_runner.exe pik.sh $@
[[ -s $USERPROFILE/.pik/pik.sh ]] && source $USERPROFILE/.pik/pik.sh
unset GEM_HOME
unset GEM_PATH

Those last two lines within the pik function are because something isn’t working in the current version and the gems aren’t being loaded when you switch versions.

Once you have your .pikrc add this line to your .bash_profile (create one if you don’t have it in your home directory):

[[ -s $USERPROFILE/.pik/.pikrc ]] && source $USERPROFILE/.pik/.pikrc