My First Sinatra Project

I have a wufoo form that I’m using and I want to automatically see the results on a webpage. One of the hangups of this process is that I can’t put any script on the webserver. But what I can do is embed an iframe. So I could download the information that I wanted from my form to another server and then display that page in the iframe. My question was what to run on my second server, which I’m going to call my results server. All it really needed to do was get the results and then show them. So using a ruby on rails app for this seemed to be overkill. After reading about it, sinatra seemed to be the perfect fit. I could still use ruby and just show the results I wanted. This seemed to be the perfect project to test out sinatra.

The only gems that I needed were sinatra and wuparty. Wuparty is a gem specifically written for wufoo. I installed it with gem install and found that it didn’t install correctly. I looked at the source code on git and saw that everything except the /lib/wuparty/* files got installed. If I knew how to use git better, I’d submit a ticket. But it was easy for me to just fix manually.

Anyway, ignoring all the files I need to deploy or set things up, here’s what I needed.


source ''
git_source(:github) { |repo| "{repo}.git" }

ruby '>= 2.5.0'

gem 'wuparty' # For using wufoo API
gem 'capistrano' # For deployment
gem 'rake', '12.3.2'
gem 'rack', '2.0.7'
gem 'sinatra', '2.0.5'

require 'rubygems'
require 'sinatra'
require File.expand_path '../display_results.rb', __FILE__

run Sinatra::Application

entry.rb (this is where I define which fields are for what)

Entry =, :lastname, :institution, :attending, :guestfirstname, :guestlastname, :guestattending)

module Entries


if __FILE__ == $0
x ='George', "Washington", "White House", "Dinner and Talks", "Martha", "Washington", "Dinner").to_h
puts x[:firstname]


require 'rubygems'
require 'sinatra'
require 'wuparty'
require_relative 'entry'

config = YAML.load_file("config/wufoo.yml")
account = config["ACCOUNT"]
api_key = config["API_KEY"]

get '/results.html' do
erb `cat public/results.html`, layout: false

post '/results' do
@entries = []
wufoo =, api_key)
form = wufoo.form('FormName')
count = form.count.to_i
pageSize = 100
times = (count / pageSize).to_i
(0..times).each do |l|
form.entries(limit: pageSize, pageSize: pageSize, pageStart: (pageSize * l)).each do |e|
@entries <<["Field1"], e["Field2"], e["Field4"], e["Field6"], e["Field215"], e["Field216"], e["Field218"]).to_h
output = erb :'results.html'"public/results.html", "w") do |f|

That’s basically it. It’s really simple, but does exactly what I want it to do. And wufoo has webhooks that you can set up. I use those to send a post request each time someone signs up. This post request generates a new results.html file for me. And that’s the file that I put in an iframe on the website where I’m very limited in what I can do. I store a few things in a config file that I don’t want to store in my repo.

This is pretty simple, that I’m pretty sure it would be easy for me to add another get/post combo for another wufoo form when I add it.

This was a fun project and I like being able to set up sinatra to handle simple things like this. Rails would have been overkill here.

Quick Baby Quilt

After the success of my Dr. Seuss quilt, I was in the mood to make another quilt. So I used only leftovers from my previous quilts to make a baby quilt for a cousin who is having a baby. My original idea was to make it in 30 days, but I think I took longer than that. I’d have to check my journal to find out exactly when I started it, but I finished it on July 31st. And the baby is due the first week of August, so I’m happy with that. I’m not happy that I haven’t yet mailed it to them, but I’ll try to do that soon.

The other thing I really like about the quilt is that I think I’m finally getting the hang of correctly mitering the corners. Look at how good this corner looks. I actually stopped sewing to take a picture of it because I was so pleased. I’d like to say the other corners all looked like this, but they weren’t as good.

My best corner ever

And here are some pictures of the final quilt. I’m quite pleased with how it turned out.


I haven’t been doing much with writing/compiling c programs of late. So I didn’t really notice the move from using make to using cmake for the build environment. We’ve been having some issues at work with this, so I’ve spent a few days trying to learn it. I’m not at expert at this at all, but I have picked up a few things. So I want to document them here.

Here’s a simple hello.c program.

#include <stdio.h>

int main() {
printf("Hello world!\n");
return 0;

It can be compiled with:

yo:hello $ gcc hello.c -o hello
yo:hello $ ./hello
Hello world!

How would I do this using cmake?

yo:hello $ mkdir build
yo:hello $ touch CMakeLists.txt
yo:hello $ ll
total 32
-rw-r--r--  1 maryh  staff     0 Apr 24 10:23 CMakeLists.txt
drwxr-xr-x  2 maryh  staff    68 Apr 24 10:23 build
-rwxr-xr-x  1 maryh  staff  8432 Apr 24 10:09 hello
-rw-r--r--  1 maryh  staff    73 Apr 24 10:06 hello.c

The file that cmake looks for is called CMakeLists.txt. Edit this file so it looks like this:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
add_executable(hello hello.c)

All this does is check that we’re using at least version 3 of cmake. Not necessary for this, but for some other work programs, I needed that. The project line sets up the project and stores the name in the variable PROJECT_NAME. And if it’s the top-level CMakeLists.txt file, it also stores it in CMAKE_PROJECT_NAME. And the add_executable line adds an executable target (for us called hello) that’s built from the source file(s) (for us we only have hello.c).

That’s all that is needed. It’s nice to make the build directory and run the cmake program there because it makes things much easier to delete all the files if you’re doing various iterations on things.

To compile then, go to the build directory and run:

yo:hello $ cd build
yo:build $ cmake ../
-- The C compiler identification is AppleClang
-- The CXX compiler identification is AppleClang
-- Check for working C compiler: /Applications/
-- Check for working C compiler: /Applications/ -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/
-- Check for working CXX compiler: /Applications/ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/maryh/Documents/C/hello/build

Now use make to compile the program.

yo:build $ make
Scanning dependencies of target hello
[ 50%] Building C object CMakeFiles/hello.dir/hello.c.o
[100%] Linking C executable hello
[100%] Built target hello
yo:build $ ll
total 80
-rw-r--r--   1 maryh  staff  13521 Apr 24 10:33 CMakeCache.txt
drwxr-xr-x  15 maryh  staff    510 Apr 24 10:34 CMakeFiles
-rw-r--r--   1 maryh  staff   4751 Apr 24 10:33 Makefile
-rw-r--r--   1 maryh  staff   1373 Apr 24 10:33 cmake_install.cmake
-rwxr-xr-x   1 maryh  staff   8432 Apr 24 10:34 hello
yo:build $ ./hello
Hello world!

This is definitely overkill for such a simple program, but those are the basic steps for more elaborate programs. And the key file to edit is basically CMakeLists.txt.


It’s weird. I’ve just spent the past two hours making myself a calendar. I was wondering how to design it and it just popped into my head that I have pictures from the early 2000s to now. Why don’t I use some of my own pictures on my calendar? And then find some quotes I like and put them over the picture. It’s a really simple idea, but I love it. I’m going to get a calendar that has motivational or inspirational quotes and I can look at pictures of things I’ve done which brings back those memories. Totally going to make me happy.

I had wanted to read a book tonight, but I finally got my bluetooth speaker working with my laptop. So I felt that I had to listen to music. I can’t really read when there’s music playing that I can sing along to, so I gave up reading pretty quickly. Then I was thinking that I need to start tracking that I’m eating vegetables, so I need a calendar. And making calendar on the computer is something I can easily do while listening to music. I don’t know why, but now that I don’t have a tv, I feel like I’m getting more and more good ideas for projects. Or maybe it’s just that I have the time to do them, since I’m not sitting in front of a tv. All I know is that I’m loving getting more and more ideas, so I hope they keep coming.

UPDATE: Just printed the calendar. I have a cheap printer and it says it prints on 13×19 paper, which technically it does. But on a few pages, everything was a little skewed. So I think it has a hard time handling paper that big. But it’s printed and hanging on my wall and I love it!

Happy 2019!

Got a decent amount of sleep last night, so I’m starting the year off right. Just went for a short walk to the mailbox to pay some bills and now I want to think about things for the coming year…and beyond.

I think it was Bill Gates who said “People overestimate what they can do in one year and underestimate what they can do in ten years.” I completely agree with that. In fact, I learned that around my 40th birthday when I decided to learn ruby on rails. I had very little programming experience and I recall that it took about four years for me to produce something usable. Now I’m still not a programmer, but in a pinch, I can put together something that can solve a problem for me. And that’s all come from my few years investment in learning a decade ago. So while what I’m going to list here are my resolutions for this year. I’m also hopefully laying the groundwork for some longer term things that I want to do.

I’m old enough to know that if you set up good habits, it’s much easier to “trust the process” and get to your final goal without being miserable. Most of the difficulties in life that I have are due to bad habits that are very difficult to break. Just look at all the people who fail at quitting smoking. I’m fortunate that I didn’t take up smoking. But my bad habits tend to gather around eating. I don’t plan meals that much, I snack a lot and I eat far too many sweets. It doesn’t take a genius to know why I’m overweight. So my first resolution is the same as last year. Basically, it’s eat more vegetables. (Quite frankly, this is a resolution for life.) But in order to track things, the exact goal is to eat at least on vegetable per day. I just read a book on eating and the ideal is to make 50% of each meal to be fruits and vegetables. I’m actually ok with eating fruits. I have fruit every morning with breakfast. I know me and it’s the vegetables that I have an issue with. So I’m going to try a bunch of different kinds of things and cooking them in different ways. Hopefully, I’ll find something that can be a go-to meal with vegetables.

My second resolution is probably quite funny, considering that this is being read on a blog. And that’s to get away from screens of all types. I’m far too distracted when I work on my laptop. I always have mail open and immediately check any new messages that come in. When I’m at work, that’s fine…it’s my job. But when I’m at home, I need to start shutting that off. I sort of started this last year when I switched to using an android phone from my iphone. It’s not as nice to use, so I didn’t want to use it as much. I also deleted all (except instagram) of my social media accounts. And took all the apps off my phone. I can still check instagram, but I have to log into it on my computer. That’s painful enough that I know I won’t do it very often. My overall goal here is to be more present. When I’m visiting or talking to people, I want it to be about that connection and not have some electronic devices in the way. I’m not getting rid of all my electronic devices. I work in IT and knowing how to take care of them is my job. And I’m still happy to help people who are having trouble. But the random pull my phone out because I’m bored or am not enjoying the conversation needs to stop. If I’m that bored someplace, I should just leave and go and do something more productive.

Related to the previous goal is to do more with physical objects. Again, I started this last year with doing more DIY projects and I’m all for continuing with that. But this also includes, writing more in my journal and seeing friends face-to-face instead of talking through text messages. The journal writing has been wonderful. I’ve been going to the coffeeshop on weekends for the past few months and just thinking and writing down ideas. I usually just take my journal, pens and a book to read. Is it an expensive habit? Yep, I probably shouldn’t be spending $10 on lattes every weekend. But I think it’s very worth the benefits I get from sitting and thinking for an hour or two every weekend.

I pretty much do this a lot already, but I’m putting it down because it’s very important to me. Bike more. I am almost always happy when I’m riding a bike. It’s good for me, the environment, saves money…the list of benefits seems endless.

Fail more. This may seem kind of odd, but I think I’ve gotten too comfortable with life. In general, I’m not a risk-taker, but I think I’ve flipped to the too risk-averse. I need to try some big public things where I can look like a complete fool when they don’t work out as planned. And yes, people will make fun of me for them for the rest of my life. That’s fine. It won’t kill me and perhaps I’ll actually achieve a crazy goal.

The items above are my actual resolutions for the year and my life essentially. But there are some other things that I’d like to do or try, but I may not really commit to them this year. I’m putting them down just to note them.

  • meditation–though my coffeeshop writing is already a sort of meditation
  • yoga, tai chi or some other practice that will help with flexibility and focus
  • drawing or calligraphy class
  • try making a bullet journal for my garden and maybe some other projects
  • find people who are interested in the same things as me, maybe start going to meetups about stuff I’m interested in
  • do a 5k
  • look into shorter-term volunteer opportunities
  • do a metric-century (62 miles) bike ride
  • learn about being a landlord
  • learn electronics
  • get the garage set up for welding
  • try more difficult sewing projects
  • do more repair…look for a repair cafe to join
  • host people in my house more
  • read more books

I think that’s enough. It’s funny, when my mind is calm and I can focus, the ideas just seem to pour in. Yet another reason that I should always carry a little notebook and pen. Sometimes I need to write things down quickly.

Happy New Year!

2018 Year in Review

Another year has gone by. It was a fine year. I have no complaints. Took Jack and Annie to Europe and I turned 50. I think those were the highlights. This is also the year that I’ve put the ‘pay off the mortgage’ idea into overdrive. For the past few months, I’ve basically been paying two payments each month to get it paid off. If I make a big payment tomorrow, I think I have around 18 months to go. This makes me very happy. There’s really no reason that I need to pay this off so quickly, but I like the idea of being completely out of debt. Financially-speaking, the year has been good. I’ve saved 37% of my take-home pay, which is good. Not great, but good enough. I’d like to say that I’m about 15 pounds lighter than I was at the start of the year, but I’m exactly 1/2 pound lighter, which is basically a wash. I had been doing good up until my birthday, at which point I proceeded to regain all the weight I had lost throughout the year. Oh well, I’ll try again. Let’s take a look at my goals for the year and see how I did.

Eat a vegetable a day. FAIL. I wish I did, but I don’t even remember when I stopped tracking this. However, this is a really good goal. I’m going to try again.

Get the lead water line changed. FAIL. I don’t think I have enough saved up to do this yet. The good news is that Janet gave me a filter to use. And even better, the city gave me a very fancy pitcher/filter system with a particulate matter detector. So I’m fairly confident that there isn’t any lead in the water I’m drinking. The water I’m showering with isn’t great, so I still want to get the line changed, but I feel that I can wait a bit.

Get back in the habit of biking to work. PASS. I did bike more this year than last year. 1122 miles according to my phone, noting that I don’t turn on the tracker when I’m going short distances, like to the grocery store, library or tutoring. And I’m still doing very good at biking to those places. Looking at my calendar, shows two rides in January, one in November, none in February, March and December. I rode quite a bit in May-October, so overall I’m pleased. I could still ride more, but I’m happy with that.

Better gardening. PASS. I got a ton of tomatoes this year and gave them away. I also got some zucchini which was pretty good. And I found that I love leeks, which I’ll be planting again.

More DIY projects. PASS. Even though I was working way too much until around August, I feel I was making a bunch of things. Offhand, I’m thinking about the stools I made for the brewpub, which turned out pretty well and on which I learned a lot. And then I got the sewing machine, which was the best purchase I made in the year. I love it and have already made gifts on it and have a bunch of other projects in progress.

Connecting with people. PASS. Here I was mainly thinking about volunteering in the community. I still go to the literacy center and I’m enjoying that. It’s twice a week, so it’s a bit of a commitment, but I’m happy to do it.

One thing that I’ve done a lot less this year is post to this blog. And I see that continuing for the time-being. However, this does not mean that I’m writing any less. For the past few months, I’ve been going to my favorite coffeeshop on Saturday and Sunday mornings to get a latte and write in my journal. I can’t say how satisfying this has been. Taking just an hour or two every weekend to sit and think about my week and what I’d like to get done has been great. I feel so much more organized and this has let me accomplish so much more without feeling overwhelmed. And I seem to be in a phase where I’m trying to work on the computer less and more with physical things more. I feel it’s good for my sanity to get away from screens.

I’ve also basically deleted all my social media apps. The only one I haven’t completely deleted is my instagram account, but I have deleted the app from my phone. So I probably won’t be posting to it anymore. I can still see my feed if I go to the website and login. But since this is a hassle, I probably won’t do that, which is the point of deleting the app.

I’ll get into the reasons why I’m doing some of this in my 2019 plans post that I’ll put up tomorrow. But to sum up 2018, it was a good year and I feel incredibly lucky to have my life.

UPDATE: Just got home from dinner at Julie’s and saw that my odometer read ~66150 miles on the car. So for last year, I drove 66150-44800= 21350 miles. That’s a ton. However, I lent the car to John and Ted for a few weeks and they did a ton of driving when they were in the country. I just checked my credit card and see that I only bought $800 worth of gas for the whole year. That’s a little less than I paid for gas over 2017. Even taking into account that gas has gotten cheaper, I’m thinking that I probably drove about the same amount that I usually do (~12,000 miles) and that all the extra mileage was from people I lent the car to.