Verse of the Day – Part 3: MailChimp templates

Beside getting OAuth 2 setup for Google Apps, the hardest part of this was to come up with a simple way to create and send MailChimp campaigns with a similar layout and look, but with some custom content. My choices seem to be to between:

1. Create the full HTML5 content from scratch, taking care to include the required Mailchimp tags like *|UNSUB|* or *|HTML:REWARDS|*

2. Use the mailchimp.campaigns and mailchimp.campaigns.template_content from the Mailchimp API to take the template from the campaign and inject content in just the places I want it.

So that I could allow users the chance to continue using the Mailchimp template editor and then just provide search-n-replace snippets, I opted for #2. If I wanted to have radically different content style each time or I had content providers that where more savvy with HTML5 skills and tools, #1 would work, but that is not my world.

First, I created a place-holder campaign there I would layout the style and the bits to be replaced with content. All future campaigns would be replicated from this one then altered using the campaign settings and altering the campaign content itself. Settings are easy with code like:

mailchimp.campaigns.update(campaign_id,'options',{ 'Some Title' })

The content is a bit messier. I get the template as a big data structure with mailchimp.campaigns.template_content(campaign_id), search through it for my search-n-replace “tags” then  use the campaigns.update method to inject it back into the content.

    content = mailchimp.campaigns.template_content(campaign_id)
    content.each do |k, v|
      if v.is_a?(String)
        v.gsub!(/\{(.*?)\}/) { message[Regexp.last_match[1]] }
        mailchimp.campaigns.update(campaign_id, 'content', { 'sections' => { k => v } })

While this works for the simple temple I use, it tends to fall apart for templates with nested sections like Mailchimp allows.

Because this is for a “verse of the day”, there is also code in the script to grab HTML formatted verses from ESV api


Verse of the Day, Part 2: using Google Spreadsheet

Last time, I described what I thought needed to happen in order to send out a verse of the day message via SMS and email. This makes use of Google Drive, ESV Bible, Twillio, and MailChimp APIs and interfaces.

The first thing is to create a place to store our information. This includes people’s signup information such as names, emails, and SMS numbers. Also we need a place to store the content that will be sent out.

Since most of our staff uses Google Docs, a Google spreadsheet seemed like the best choice to support the hand entry process. Some of the signup data was expected to come through a MailChimp form so keeping the spreadsheet and mailchimp in sync might become an issue, but for this year, we can sync the signups by hand. MailChimp has an easy import/export from Google Docs process which makes it easier.


Verse of the Day, Part 1: Making use of Google Apps, Twilio, MailChimp, and ESV Bible WS

Our Church does a 40 Day Event during this time of year that includes, among other things, being able to signup to get an relevant Bible verse and message via SMS and/or email.

This year, I decided it was time to make the process a little less labor intensive and take a few ruby modules for a spin.

What I needed:

  1. A place to record the the verses and messages we will be sending out each morning for 40 days. Also a place to store other information for the messages like email subjects and titles.
  2. A way to sign people up by hand ( a signup sheet passed a round on a Sunday morning ) and electronically.
  3. Send one or more text messages to each person who signed up. Depending on the overall length of the message, it may need to be broken up to fit the 160 character SMS limit.
  4. A way to send attractive emails to everyone who signed up.

timekpr Grows Up ( or “Why I Love Open Source” )

Back in February, I had the need to limit the amount of time my kids spent on a shared Ubuntu box. I cobbled together a simple script that would give a warning then shutdown the user session. It worked for me (made my kids unhappy, tho’), but I knew it could be better. Dispite my full knowledge it was a cheesy little script, I posted it on my blog since it fit I need I had as a Dad that I thought others might have.

Well, a number of folks have commented, posted bug fixes and enhancements, even translated it to Hungarian! A few hours ago, one of the folks that had offered others help and enhancements on Ubuntu Forums, Even Nedberg, posted a comment to the old blog entry that he and a friend had converted the script to Python and added a GUI and other cool enhancements.They have even set up a project at to make the code more accessible.

Wow! I have been pretty busy this summer, and couldn’t have hoped to provide these types enhancements, but thanks to the spirit of open source and the need to “scratch an itch”, ‘timekpr’ has grown up, and is on it’s way to becoming a really useful (and needed) tool for the Linux desktop.

.nedberg and forger – Please take this blog entry as my permission to use the name ‘timekpr’ and any code or ideas in the original script (please don’t take the bugs, I’ll keep those!) and just go wild. I know parents will greatly appreciate you efforts!

Coding General

12 Step Program for Ubuntu Update-Manager Addicts

Hi, my name is Chris.

I am Ubuntu update-manager addict.

I began innocently enough, sometime back in Febuary, I ran ‘update-manager -d‘ to get a peek at Unbuntu Hardy Heron. Since that time I have been unable to resist the little orange “Updates Available” icon. Checking two or three times a day for improved progams, bug fixes, and new features. Swearing off updates after each bad dependency problem, only to run update again in hopes it will get fixed this time.

My family is tired of the home PCs being tied up running update-manager all the time and I’m not getting much done on my laptop while it’s burning up bandwidth updating the repository indexes. It’s time for an intervention.

I know I can’t break this habit alone, so I’m thinking of starting a 12 step program. I know there are others out there with the same problem so maybe a support group will help, all we have to do is:


How to Limit Daily Desktop Usage in Ubuntu

I have been looking for a way to limit the amount of time my kids spend on the computer. After toying with a couple of different things like timeoutd and pam_time, I decided to hack together something to meet my needs:

Coding Learning

6 Tools for Keeping Kids Safe with Open Source

My family uses open source software almost exclusively. Everyone from the toddlers to the teen to the Mrs. have what they need to play games, chat with friends, manager emails, surf the web, keep busy schedules straight, do homeschooling, and pretty much anything they may want to do.


Microsoft likes software pirates – when they count

Microsoft doesn’t really hate software pirates… when they might count toward market share for their latest Internet Explorer release. In the face of slipping numbers, Microsoft has reversed thier earlier requirement that users have a legal copy of Microsoft Windows XP or greater in order to download and install Internet Explorer 7. M$ has done their best stem the defection of users to the more secure and more standards compliant Firefox browser, but failed to prevent it’s steady climb in market share to 15% among average users, as high as 35% among some segments, such as the tech savvy and non-US users.

It seems a little desperate to me to rail against software pirates, spend millions hunting them down across the globe, then turn a blind it to them when it suits them. While I often convince people to make the switch to Firefox on it’s technical merits, I find it hard to understand why people continue to use products from a company with such a complete lack of moral and ethical backbone.

All I can say is:

Coding IXOYE

OpenWorship project

After searching for a suitable worship slide system for our church, I decided to write my own using the S5 presentation software and Ruby on Rails. Check it out at the OpenWorship project site. It’s still early, but I can build a presentation (using rails scaffolding) and display it, so thats a start.

Coding Learning Playing

The Expanding Web

I’ve realized I’ve gotten into a bit of a rut when it comes to web surfing lately. I could probably count on my fingers and toes the number of sites I regularly visit to keep up on events, technology, coding, linux… Luckily, one of those places I check off and on is to keep up with firefox. I recently decided to give the 1.5 beta of Firefox a spin, and while attempting to updated some of my favorite extensions, I ran across one for StumbleUpon a collaborative site review and grouping system that includes a button to randomly pick a site based on your preferences and sites you’ve recommended. Unlike other “random” link systems, this one tends to take you to a quality site you will actually be interested in.
Well, I was hooked, so I installed it at work and at home, but while my bookmarks lists grew in both places, I felt it might be more useful put my bookmarks online so I can share them – enter another website and cool extension and Foxylicious, an extension that make it easy to add and maintain my social bookmarks. makes keeping and sharing bookmarks easy, but it also ranks and list new links and most popular links, as well as popular tags. I can see another time sink-hole opening…