Bye Bye, Silicone Bakeware

I received the America’s Test Kitchen Family Baking Book for Christmas this year, and while leafing through it, I came across the ”10 Baking Gadgets You Don’t Need.” First on the list was “silicone bakeware.”

What? Are you kidding? Nothing sticks to it! And … well ok, I’ll bite. Why not? “In our testing, we found that plastic doesn’t conduct heat very well and muffins and cakes did not brown properly.” I thought I’d try a test of my own, so this morning I made up a batch of banana chocolate chip muffins and made one half in my silicone bakeware and the other half in my trusty ol’ metal muffin pan.

P1040108 copy

 

The bottoms aren’t shown here, but the bottom of the muffin baked in the metal pan was nicely browned, while the bottom of the muffin baked in the silicone pan looked as pale and anemic as its top did. The sides of the silicone-pan muffin seemed almost burnt as well. That’s enough to convince me.

One thing I have found the silicone muffin pans good for, though, is freezing portions of chicken stock in pucks for easy storage. Other than that? I think I’m done with silicone.

Om Nom Cornbread

I love Jiffy brand cornbread mix. I like to keep a few boxes on hand at all times. It’s great with soups, chili, stew – most hearty American meal-in-a-bowl foods can benefit from a side of cornbread. It’s probably too sweet for some tastes, but I like a sweeter cornbread. (Hey, I never said I was a real southerner. I only lived there 9 years.)

Now, I don’t begrudge the Jiffy company at all. In fact, I support them whenever possible because they are a good company that treat their employees right and sell an honest product. But sometimes I forget to pick some up, or I run out, or they’re out at the store.  So I went poking around for a copycat recipe.  Turns out it’s not really that hard.

It’s not going to taste exactly like the Jiffy mix as written, because they use lard in the mix, and the below uses oil. Don’t freak out (unless you’re a vegetarian?), because lard probably isn’t as evil as you think it is.

Corn Muffin Mix
2/3 cup all-purpose flour
1/2 cup yellow cornmeal
3 tablespoons granulated sugar
1 tablespoon baking powder
1/4 teaspoon salt

Mix this up and store in a  sandwich-size bag. Makes about 1 1/3 c. (8.5 oz) mix.

To make, add: 
2 tablespoons vegetable oil
1 egg
1/3 cup milk

(If you have a recipe calling for a box of Jiffy Cornbread mix, add the “mix” above and the oil.)

To bake, beat the egg with the milk and oil, then fold into the mix until moistened. (If it seems too thick, add a little more milk.) Bake in a 400°F oven in a paper-lined (or use non-stick cooking spray) muffin tin. Makes 6 muffins.

I like adding 1/2 c. cheddar cheese and a can of green chiles before baking.

Copying all Devise emails to Salesforce

I’ve had the “joy” of working with Salesforce.com in the last year or so. When users receive emails from my application, the sales department wants to know about it, including anything that Devise sends (account confirmations, password resets, etc.).

Setting this up is fairly simple. I’m using Devise 3.1.1 in this instance.

First, create a custom mailer:

rails generate mailer CustomDeviseMailer

Then, to config/initializers/devise.rb, add this line:

config.mailer = "CustomUserMailer"

Finally, change app/mailers/custom_devise_mailer.rb to look like this:

class CustomDeviseMailer < Devise::Mailer
  def headers_for(action, opts)
    if Rails.env.production?
      salesforce_bcc_email = "(your Email to Salesforce address)"
    else
      salesforce_bcc_email = "salesforce_bcc_email@mailinator.com"
    end

    super.merge!({bcc: salesforce_bcc_email})
  end
end

If you need to know where your Salesforce BCC email is:

  1. login to Salesforce
  2. In the top bar click your name, choose “Setup” from the menu
  3. Under “Personal Setup” in the left sidebar, click “Email”
  4. Under the email menu you just expanded, click “My Email to Salesforce”
  5. On that page it’s highlighted with a bright yellow box

Kudos to this StackOverflow question for getting me all fixed up in Devise 3.

Tech and feminism

Anyone who knows me would know that I am not particularly militant when it comes to feminism. I am not a man-hater. I like men. I have many menfriends. I married one. I think they’re neat.

But crap like this happens, and I have to say something: http://stoptechfeminism.tumblr.com/

Talking about acts of sexual assault at tech conferences (which is apparently what engendered the above tumblr) does not equal looking for a sacrificial lamb. It is addressing a very real problem in the culture, the culture many of us belong to. And people need to know that when acts of sexual assault or harassment happen in our culture, there are very real consequences, not only to the people involved, but to the community at large.

Many of us want our culture to expand and include all kinds of different people with new, amazing ideas and different ways of thinking. People do not join a community in which they feel threatened from the get-go. We do not need the talent pool to stagnate, people. Also? Comparing feminists to the Westboro Church is not doing you any favors.

Sidekiq on Engine Yard using a Redis utility instance

So I’ve been running Sidekiq on an Engine Yard instance for a while, but haven’t updated the setup since it was installed. I wanted to fire up a utility instance to run Redis on to take some of the load off the master application instance, so time to dig in.

First thing I did was to update my fork of the ey-cloud-recipes repo. The fabulous Jim Neath has updated the Sidekiq recipe and it’s much better than the old one.

Most of the instructions here will get you where you need to be:
https://github.com/engineyard/ey-cloud-recipes/tree/master/cookbooks/sidekiq

However, it won’t have you connecting to Redis on a utility instance. It’ll have you connecting to redis on localhost or maybe on your database instance, which is fine if your load isn’t heavy.

Let’s fire up a Redis utility instance (in other words, go to your app environment in EY, click “Add”, select utility instance, and name it “redis”). Note that if you want to run sidekiq on a utility instance as well instead of your application instance, fire up an additional utility instance named “sidekiq”.

In your cookbooks/main/recipes/default.rb cookbook, uncomment these lines:

include_recipe "sidekiq"
include_recipe "redis-yml"
include_recipe "redis"

In your cookbooks/redis-yml/recipes/default.rb file, change the first line to also add redis.yml on utility instances:

if ['app_master', 'app', 'util'].include?(node[:instance_role])

Add this to your before_restart.rb deploy hook:

on_app_servers_and_utilities do
  # link redis.yml in current/config to shared/config
  run "ln -nfs #{config.shared_path}/config/redis.yml #{config.release_path}/config/redis.yml"
end

Then, create a file in your config/initializers directory called sidekiq.rb that looks like this (replacing “<yournamespace>” with whatever you want your redis namespace to be, mine is “<appname>:<environment>”). This was pretty much taken wholesale from Add Redis To Your Application.

# check if the redis.yml file exists - if you are running your staging env as 
# a solo instance without a redis utility instance, it won't
if File.exists?(Rails.root + 'config/redis.yml')
  # Load the redis.yml configuration file
  redis_config = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env]

  if redis_config
    Sidekiq.configure_server do |config|
      config.redis = {
         namespace: "<yournamespace>",
         url: "redis://#{redis_config['host']}:#{redis_config['port']}"
      }
    end
    Sidekiq.configure_client do |config|
      config.redis = {
         namespace: "<yournamespace>",
         url: "redis://#{redis_config['host']}:#{redis_config['port']}"
      }
    end
  end

else

  Sidekiq.configure_server do |config|
    config.redis = {namespace: "<yournamespace>"}
  end
  Sidekiq.configure_client do |config|
    config.redis = {namespace: "<yournamespace>"}
  end

end

Upload and apply your recipes and deploy your application.

Finally, check your log directory on your app instance to make sure you are connecting to the right instance. in /data//current/log/sidekiq_0.log it should say something like:

2013-08-30T23:11:25Z 22052 TID-17e8eg INFO: Booting Sidekiq 2.6.0 with Redis at redis://(some internal ip):6379/0

It should NOT say:

2013-08-30T10:27:50Z 25034 TID-17uk98 INFO: Booting Sidekiq 2.6.0 with Redis at redis://localhost:6379/0

You can check to make sure you are connecting to the right instance by checking your node info when you SSH into the app instance:

sudo gem install jazor
sudo jazor /etc/chef/dna.json

Look for a node like this:

  "utility_instances": [
    {
      "name": "redis",
      "hostname": "(some internal ip)"
    }

This hostname IP should match the one in your sidekiq log. Ta da!

Ruby on Rails and FTPS

If you’re unlucky enough to have to connect to an FTPS server (SFTP ends up being much easier), the Double Bag FTPS gem makes things much easier.

A few finer points to note:

  • “verify_mode: OpenSSL::SSL::VERIFY_NONE” makes your life easier in development mode – not to mention some FTPS sites won’t even have one
  • Most servers don’t like active mode, so explicitly use passive mode. Your connection ends up hanging without it.

So usage is:

DoubleBagFTPS.open(host, user, password, nil, DoubleBagFTPS::EXPLICIT, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |ftps|
 ftps.passive = true
 ftps.put("myfile.txt", filename)
 end

DIY syrups!

I’ve seriously been neglecting this blog, apparently. I started a new one, which you may find amusing:

http://www.mommashouldataughtyou.com/

Anyway, I made some syrups because I remembered helping my Mom making pancake syrup when I was a kid, and for the life of me I couldn’t remember why I wasn’t doing that. Sure, it’s not “real” maple syrup, but hey, it’s better than most of the stuff in the store, and a load cheaper. It doesn’t have any corn syrup, and the debate on that issue notwithstanding, at least if my friend who’s allergic to corn and corn products comes over, she can have some pancakes and syrup.

Storage:

  • save glass jars from other products (salsa, spaghetti sauce, etc.) and reuse them**
  • use clean wine bottles and some pourers with hinged lids or syrup pumps
  • oil bottles with pourer
  • plastic condiment bottles (the squeeze kind you might put ketchup in, I’ve found these at dollar stores, big box stores or restaurant supply stores)
  • Syrup dispensers with handles

I generally prefer something you can close or cap, since you’ll be storing these in the fridge and they can pick up smells from other foods.
**To clean and get the smell out of glass jars, follow these instructions. If you don’t want to wait that long, put 1/4 cup of baking soda in the jar with 1/2 cup of water, put the lid on tight, and shake for 5 minutes.

Maple syrup:

1 c water
1 c white granulated sugar
1 c brown sugar
1 tsp maple extract
1/2 tsp vanilla extract (optional)
1/2 tsp butter extract (optional)

In a saucepan, boil the water, then add the sugars and stir until dissolved. Remove from heat and stir in the flavoring(s). Let cool and store in refrigerator.

Homemade simple syrup:

(for flavored coffees, hot chocolates, etc.)
1 c water
2 c white granulated sugar
1 tsp flavored extract (peppermint, vanilla, almond, hazelnut, etc.)

In a saucepan, boil the water, then add the sugar and stir until dissolved. Remove from heat and stir in the flavoring. Let cool and store in refrigerator.

Homemade chocolate syrup:

(straight up stolen from Pennies on a Platter)

1 cup water
1/2 cup unsweetened cocoa powder
2 cups sugar
Pinch of salt
¼ teaspoon vanilla

Combine the water and cocoa powder in a medium saucepan. Heat over medium while stirring to dissolve the cocoa. Stir in the sugar until dissolved. Bring to a boil and heat for 3 minutes, watching carefully to avoid boiling over. (Turn down the heat, if necessary.) Remove from the heat and mix in the salt and vanilla. Let set to cool. Use a funnel to pour into a clean glass jar with a tight fitting lid. Store in the refrigerator for up to two months.

Sara’s notes: 

  • Give this your full attention. It only takes 10 minutes, so no walking away, lest you potentially have a burned, boiled-over chocolate disaster.
  • Use a whisk and keep whisking throughout or you’ll get scorched chocolate.
  • Be very careful with doing this on an electric stove. I have gas but I imagine you wouldn’t want to do more than med to med-high heat, since it doesn’t respond as fast and when it starts boiling it GOES.
  • If you have an empty 20 oz. plastic bottle, maybe from a previous purchase of chocolate syrup or some other condiment, this recipe fits almost perfectly in it.

Paperclip, Amazon S3 Storage, the Amazon AWS-SDK gem, and Error: “No such file or directory”

So at work, we switched from using the aws-s3 gem (unofficial) to the aws-sdk gem (official), since the new paperclip gem version required it. Added a new initializer file and made a few changes in how we were opening the S3 connection. No big deal.

Until we got to the part where we were opening a remote URL, reading its contents (an MP3), and trying to save it to a file on S3. (Before you get all riled up about piracy, it’s a voice generator service that we pay for.) So after switching gems, all we got when trying to grab the remote file was:

  No such file or directory - http://www.blahblahblah...

At first I thought it might be the service, but plugging in any other url didn’t work either. Arrgh! The code didn’t change in that respect! WTH?

Yeah well, apparently something did with the gem, because putting:

  require 'open-uri'

at the top of the controller fixed it all up.

Hope this saves you some time/hair pulling/frustration.