You are viewing dement1a

Luke and Sara

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

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).

Tags:

RTFM, Ruby on Rails edition

Luke and Sara

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

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.

Tags:

Yes, I’m schilling, what of it?

Luke and Sara

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

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.

Luke and Sara

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

“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.

Tags:

Mmm, beverages.

Luke and Sara
Poll #1586626 What do you prefer from these choices?

Pick your most favorite from the following. It's a short list, I know.

Pepsi
3(8.6%)
Diet Pepsi
3(8.6%)
7-Up
3(8.6%)
Dr. Pepper
9(25.7%)
Coke
11(31.4%)
Diet Coke
6(17.1%)
Nestea (in cans)
0(0.0%)

Tags:

OMG SPARKLY

SQUEE!
 I admit it, I have a weakness for the sparkly. It's that girl chromosome poking its head out. This is what caught my eye today, from a link out of one of my wedding RSS feeds:




SPARKLY SPARKLY OMG I WANT THE SPARKLY

It's on sale for 20% off. That means if I buy it I'm saving money, right? Right? Hello, is this thing on?...

Yeah, I'll probably shoot for something less expensive and ornate, but. Well. The sparkly, it calls to me.

Tags:

Sara needs your help!

xander - work brain work
While walking through Target today, I spotted the slightly-classier-than-white-plastic "plastic flatware" from Diamond. I'd kind of like to use this at my wedding, and... what's that? "Try Me Free?"

SWEET.

Just one problem. 1 rebate per household. That's where you come in.

Yes dear friends, I said you! Here's my evil plan to stick it to Jarden Home Brands, maker of Diamond plasticware.
  1. You say "Yes, Sara, I'll paypal you $4 or $5 (depending on where you bought it)"
  2. I send you a paypal invoice, and you pay it (via personal payments so they don't take a fee out)
  3. I put your name and address on the rebate and send it in
  4. 6-8 weeks later, you get the rebate check and cash it!
Ha ha ha ha ha ha! MUAH HA HA HA HA HA! I'm brilliant! I'll take over the world! I'll...

Ok. I'll save $60 or so bucks on wedding stuff. But hey. I have to take my evil victories where I can.

Comment here if you'll help!
Luke and Sara

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

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.

Tags:

Ready for Zombies.

Luke and Sara

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

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.

1,2,3, There are zombies on the lawn…

Luke and Sara

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

Seedling starter tray: $4
Seedling soil: $4
Seeds: $6

Being prepared for zombies on my lawn: Priceless.

Well, here’s yet again another attempt at me starting an herb garden. Difference this time is that I actually have land to plant on. Yay, home ownership! I’ve got parsley, catnip, oregano, thyme, tarragon, and basil. Any tips from you green thumbs out there? ‘Cause generally anything I plant dies pretty horribly. Black thumbs run in my family. I know I need to keep them watered, but not too watered or I’ll get root rot. When should I water them? Every other day? Every second day? I have them at a west-facing window so they’ll get some sunlight filtered through the pine tree back there every day.

Any useful advice appreciated!

Latest Month

September 2011
S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 

Syndicate

RSS Atom
Powered by LiveJournal.com
Designed by Tiffany Chow