Sara Trice
Just a programmin', bellydancin', cake bakin' kinda girl

  • RSS-Feed posts
  • RSS-Feed comments

  • gallery
  • livejournal
  • résumé
  • website portfolio

Pages

  • gallery
  • livejournal
  • résumé
  • website portfolio

Fun Stuff

  • My Amazon Wish List

Webcomics

  • Dark Legacy Comics
  • Erfworld
  • Questionable Content

New Posts

  • Indexing users that belong to groups with ancestry and thinking sphinx
  • Avoiding Ruby hash conditionals in Ruby on Rails
  • Quickie: How to add a blank option to options_from_collection_for_select
  • Using javan/whenever on Engine Yard Cloud
  • Illinois Home Bakeries – for farmer’s markets only

Latest Comments

  • 08.05 | Marc-André Lafortune in Testing CKEditor in Ruby on Rails with Cucumber/Ca…
  • 01.05 | Charles in ImageMagick: "convert: color profile operates on a…
  • 25.02 | Stanislaw in Testing CKEditor in Ruby on Rails with Cucumber/Ca…
  • 24.02 | admin in Avoiding Ruby hash conditionals in Ruby on Rails
  • 24.02 | Pam in Avoiding Ruby hash conditionals in Ruby on Rails
May 2012
S M T W T F S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  
19
Feb

Using mysql2 on Windows

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!

by admin in tech
5 comments

15
Feb

Github, https, and you

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’
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
All fixed! Pulled down the file with no hiccups.
by admin in tech
1 comment

17
Dec

Movie Theater Coupons

Going to a movie this weekend? Here’s a few handy coupons:
Sign up for Muvico’s newsletter and get a free $5 popcorn.
Going to an AMC theater? Buy a large popcorn, get a large drink free.
Regal: $2 ZAP packs from Dec 17-19.

Have fun!

by admin in coupons
no comment

11
Nov

Pik and Git Bash on Windows 7

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:

#!/bin/sh
pik_path=C:\\pik

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

Hooray!

by admin in tech
2 comments

3
Nov

ImageMagick: “convert: color profile operates on another colorspace `icc’”

Another installment of Sara Beats Her Head Against Tech:

When trying to convert images from RGB to CMYK with ImageMagick, the regular command to convert:

convert original.jpg -colorspace CMYK new.jpg

worked – but the converted image’s colors looked absolutely terrible. So I downloaded some color profiles, and tried to use them:

convert original.jpg -colorspace CMYK -profile sRGB_v4_ICC_preference.icc -profile Photoshop5DefaultCMYK.icc new.jpg

which just gave me the error:

convert: color profile operates on another colorspace `icc’

Searching the internet gave me absolutely no answers on any forum. Then I noticed in the docs, the example given for using profiles when the original has no profile embedded already was:

convert rgb_image.jpg -profile sRGB.icc -profile USCoat.icm cmyk_image.jpg

Wait. Something’s missing… AHA! The -colorspace option was missing!

convert original.jpg -profile sRGB_v4_ICC_preference.icc -profile Photoshop5DefaultCMYK.icc new.jpg

Works like a champ. So, if you’re getting the error “convert: color profile operates on another colorspace `icc’,” try making sure you’re not specifying BOTH the colorspace and the profile(s).

by admin in tech
3 comments

26
Oct

RTFM, Ruby on Rails edition

Since the happymapper google group has been closed to posting, thought I’d toss this up here.

I posted this question to the group:

---------------------------------------------------
I have a node that looks like this:
<ItemInfo>
 <ProductVar text_id="Variable1">MyValue</ProductVar>
 <ProductVar text_id="Variable2">MySecondValue</ProductVar>
</ItemInfo>

I need both the value of the attribute "text_id" and the element value
"MyValue". I was trying to use something like what I saw in the
"current weather" example:

<aws:current-condition icon="http://deskwx.weatherbug.com/images/
Forecast/icons/cond007.gif">Sunny</aws:current-condition>
element :current_condition, String, :tag => 'current-
condition', :attributes => {:icon => String}

Which (the example) works just fine on my system. So this is the
mapping I have:

class ItemInfo
 include HappyMapper
 tag 'ItemInfo'
 has_many :product_var, String, :tag => "ProductVar", :attributes =>
{:text_id => String}
end

This does not return text_id. I can return
item_info.product_var.text_id if I use "element" in place of
"has_many", but there are always going to be multiple "ProductVar"s,
so that won't work. Whenever I try to replace "element" with
"has_many", I get this error:

undefined method `attribute_nodes' for ["text_id", "Variable1"]:Array

Ideas?
---------------------------------------------------

Well, if I’d thought this through and read the code, as suggested here:
http://railstips.org/blog/archives/2010/10/14/stop-googling/
I’d have figured this out. Since I didn’t, it took the help of both the wonderful Eric Larson and Damien Le Berrigaud to point out my epic failure to read the docs (in the nicest way possible).

Eric pointed out that what I needed was to make ProductVar its own class:

---------------------------------------------------
From: Eric Larson
Date: October 22, 2010 10:07:13 AM CDT

Hi Sara,

When I'm happymapping, I like to create a class per each element I'm
parsing, always.

Try something like this:

class Product
 include HappyMapper
 tag 'ProductVar'
 attribute :text_id, String
 content :value
end

class ItemInfo
 include HappyMapper
 tag 'ItemInfo'
 has_many :products, Product
end

- - - -

Pseudo code... but it should be very close to working.

Cheers,
- Eric
---------------------------------------------------

Which I thought was brilliant, but then realized I didn’t have the method “content” available to me because I was using the nokogiri-happymapper gem. So off to Damien I went, to ask if he could merge in the “content” method to nokogiri-happymapper, only to have him tell me:

---------------------------------------------------
You can already do that with text_node. Check the spec: it "should parse text node correctly" in happymapper_spec :)
---------------------------------------------------

So, had I just read the docs and/or the spec, I’d have figured this out. SMRT.

Thought I’d post this just in case anyone else had the same problem.

by admin in tech
1 comment

12
Aug

Yes, I’m schilling, what of it?

Ok, technically I’m not schilling because I’m not even pretending I’m not involved.

Luke and I are paying for the bulk of our wedding costs… and we’re coming up a bit short. If you’re interested in buying any of Luke’s music, now would be the helpful time to do it. “WHAT A RIPOFF! VOLUME 2″, an odds-and-ends compilation was just released, as well as the “GREATEST HITS VOLUME 1″ 2-CD. Also, he’s always looking for more work as a caricature artist & cartoonist – he’s for hire at parties as well as for individual caricatures/cartoons for gifts, as well as promo art.

I’m pretty much booked for website work for now, but I’ll be available after the wedding for more freelance.

by admin in Uncategorized
no comment

14
Jul

Ruby: how to split a string into equal chunks

“some long test string or other”.scan(/.{15}/)

Snagged from http://snippets.dzone.com/posts/show/5621 and posted here so I can find it later.

by admin in tech
no comment

27
May

RubyGems 1.3.7 doesn’t play nice with OSX 1.5.8

If you ever run into this pain in the butt error, hopefully this’ll save you some time:

Installing a gem without the version works fine; installing a gem using “-v 2.x.x” or whatever version you like ends in:
spec_fetcher.rb:254: warning: getc is obsolete; use STDIN.getc instead

Guess what? RubyGems 1.3.7 doesn’t play nice with OSX 10.5.8. So downgrade to 1.3.6, or if you’re using RVM, do this:
echo 'rubygems_version=1.3.6' >> ~/.rvm/config/user ; rvm remove 1.8.7 ; rvm install 1.8.7
(assuming you are using 1.8.7 in your RVM, otherwise, use 1.9.1 or whatever)
Voila, works like a charm.

EDIT 7/7/2011: According to Mike Shaheen, the new way to do this is simply:  rvm rubygems 1.3.5

Thanks to Wayne E. Seguin for his help on irc.freenode.net #rvm (and for RVM in the first place!)

PS You may have to downgrade to 1.3.5 to get “rake gems:install” to work.

by admin in tech
2 comments

22
May

Ready for Zombies.

Remember my last post about how I was starting an herb garden, about two months ago, and I wasn’t expecting anything to actually grow?

Stuff grew! The big foof of green you see on the left is parsley; I had to separate it out from the others so they didn’t hog all the sun. The rest in the tray is oregano, basil, tarragon, and catnip. The plant in the soda bottle bottom behind the parsley is a marigold I got from the UU church’s earth day service. Thinking tomorrow will be a good day for planting outside.

by admin in Uncategorized
no comment

« Previous Page — Next Page »

Meta

  • Log in
© 2008 - 2012
Design & CSS by
Freizeitler

Blogroll

    Dark Legacy Comics Yay MMORPGs!
    Erfworld Rob Balder writes this
    My Amazon Wish List Buy me somethin’!
    Questionable Content Am I more like Faye or Dora?