On this page:

Upgrading from Rails 3 to Rails 4; thank goodness for Emacs and rspec

I spent some time working on upgrading Quantified Awesome from Rails 3 to Rails 4. I was so glad that I had invested the time into writing enough RSpec and Cucumber tests to cover all the code, since that flushed out a lot of the differences between versions: deprecated methods, strong parameters, and so on.

rspec-mode was really helpful while testing upgrade-related changes. I quickly got into the habit of using C-c , m (rspec-verify-matching) to run the spec file related to the current file. If I needed to test specific things, I headed over to the spec file and used C-c , s (rspec-verify-single). Because RSpec had also changed a little bit, I needed to change the way rspec-verify-single worked.

(defun sacha/rspec-verify-single ()
  "Runs the specified example at the point of the current buffer."
  (interactive)
  (rspec-run-single-file
   (concat
     (rspec-spec-file-for (buffer-file-name))
     ":"
     (save-restriction
               (widen)
               (number-to-string (line-number-at-pos))))
   (rspec-core-options)))

(sacha/package-install 'rspec-mode)
(use-package rspec-mode
  :config
  (progn
    (setq rspec-command-options "--fail-fast --color")
    (fset 'rspec-verify-single 'sacha/rspec-verify-single)))

C-c , c (rspec-verify-continue) was also a handy function, especially with an .rspec containing the --color --fail-fast options. rspec-verify-continue starts from the current test and runs other tests following it, so you don’t have to re-run the tests that worked until you’re ready for everything.

I should probably get back to setting up Guard so that the tests are automatically re-run whenever I save files, but this is a good start. Also, yay, I’m back to all the tests working!

Test coverage didn’t mean I could avoid all the problems, though. I hadn’t properly frozen the versions in my Gemfile or checked the asset pipeline. When I deployed to my webserver, I ran into problems with incompatible changes between Rails 4.0 and 4.1, and Bootstrap 2 and Bootstrap 3. Whoops! Now I’m trying to figure out how to get formtastic-bootstrap to play nicely with Bootstrap 3 and Rails 4 and the latest Formtastic… There are some git repositories that claim to do this correctly, but they don’t seem to work.

Grr.

Fine, I’ll switch to simple_form, since that seems to be sort of okay with Bootstrap 3. I ended up using this simple_form_bootstrap3 initializer along with

# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
config.collection_wrapper_tag = :div

# You can define the class to use on all collection wrappers. Defaulting to none.
config.collection_wrapper_class = 'collection'

and this in my style.css.sass:

.form-horizontal
  .control-group
    @extend .form-group
  .control-label
    @extend .col-sm-2
  .control-group > .form-control, .form-group > .form-control, .form-group > .collection
    @extend .col-sm-10
  .help-block
    @extend .col-sm-offset-2
  .control-label.boolean
    text-align: left
    font-weight: normal
    @extend .col-sm-offset-2
  label.radio
    font-weight: normal

which is totally a hack, but it sort-of-semi-works for now.

More changes to come, since I’ve got to get it sorted out for Rails 4.1 too! Mrph.

Weekly review: Week ending October 24, 2014

Wow! Surprising lot of things done this week. Went to Jade’s party, helped W- go shopping for a coat, baked lots of cupcakes for Hacklab’s relaunch, and dusted off the code for Quantified Awesome. =)

Next week, I’ll be wrapping up my main consulting gig, working on more code, and voting in Canada for the first time. Yay!

Blog posts

Sketches

Link round-up

Focus areas and time review

  • Business (46.6h – 27%)
    • Earn (12.2h – 26% of Business)
      • E1: Attend celebrations
      • E1: Pick up pass
      • E1: Update analytics
      • E1: Wrap up neatly
    • Build (20.7h – 44% of Business)
      • Drawing (2.9h)
      • Delegation (0.0h)
        • Interview potential accountant/bookkeeper
        • Hire accountant and assemble information
      • Packaging (0.0h)
      • Paperwork (0.0h)
    • Connect (13.8h – 29% of Business)
      • Prepare for Hacklab open house
      • Attend QS meetup
  • Relationships (22.4h – 13%)
    • Attend Jade’s party
    • Get more kitchen things
    • Go to Thanksgiving thing
    • Help look for winter coat
    • Make egg tarts
    • Repackage spices in mason jars
  • Discretionary – Productive (1.9h – 1%)
    • Emacs (0.0h – 0% of all)
    • Buy winter coat
    • Complete Swirl assignment for getting and cleaning data
    • Work on Coursera R Programming assignment 2 and 3
    • Have massage
    • Quantified Awesome
      • I can organize items by aisle/category
      • Re-set-up dev environment for Quantified Awesome
      • Start working on kitchen organizer
      • Update to Bootstrap 3
      • Upgrade Rails 3 to Rails 4
      • We can cross items off
      • Fix forms and bootstrap 3
      • Fix token authentication
      • Update to Rails 4.1
    • Bike to work
    • Get passport pictures
    • Vote!
    • Writing (1.8h)
  • Discretionary – Play (7.3h – 4%)
  • Personal routines (15.7h – 9%)
  • Unpaid work (13.6h – 8%)
  • Sleep (60.5h – 36% – average of 8.6 per day)

Coming to terms with online courses

There are lots of free online courses available on sites like Coursera, but I’ve always had a hard time sticking with them. I don’t like listening to lectures; they feel too slow. Slides and subtitles are inferior to properly-formatted tutorials or books. I sometimes sign up for courses, but then I wander off when I lose interest.

I decided to try online courses again, since one of the other Hacklab members spoke highly of the R course she was taking on Coursera. This time, I tried skipping the lectures, focusing instead on answering the quizzes and doing the programming assignments – essentially, treating it as an open-book exam. That worked out pretty well, actually. I quickly completed all the quizzes, and it took me a few more hours to get the programming assignments sorted out. Many of the programming assignments had self-checking mechanisms, so I didn’t have to wait for peer evaluation.

I like that a lot more than the old way I used to try to get through these online courses. By focusing on the assessments, I can get through the course quickly, identify anything I want to dig deeper into, and try something new with the ability to check my work. Sure, I miss out on testing my ability to retain more information and I might miss out on important points not covered by quiz questions, but at least I’m getting some value out of online courses. I’m sure I’ll get the hang of other ways to study later on!

On “Hell, yeah! or No” and other approaches

If you find yourself overcommitted, the “Either ‘Hell Yeah!’ or ‘No’” approach suggested by Derek Sivers (among others) might be a good fit. The idea is that if you rate things on a scale of 1 to 10 (with 10 being awesome), ditch the things that are less than 9 instead of wasting your time and energy.

2014-10-22 On Hell Yeah and other approaches

2014-10-22 On Hell Yeah and other approaches

I can see the merits of this approach. Reflecting on it, though, I noticed that I prefer to do things a little differently, and I wanted to dig into the reasons why.

When it comes to requests from other people, I’m pretty good at sticking to the “Heck, yeah!” range. After all, whatever I say no to might be a good fit for someone else, or it could be an opportunity to help someone pick up new skills. Besides, if I make few promises, I have more flexibility when it comes to choosing what to work on at the moment.

For myself, though, I’m okay with working on things that aren’t an immediate “Heck, yeah!” I think it’s because I see a lot of value in the range of things you would rate from 3 to 8 on that 10-point scale, so it can be good to deliberately carve out time to work in that range instead of spending most of your time at 9 or 10.

When I look at the skills and interests that have become big parts of my life, very few of them were instant passions. I’ve always liked reading. I think I fell in love with programming immediately, but I’m not sure because I don’t remember enough about the beginning. On the micro-scale, though, there’s often a little bit of awkwardness and mediocrity when I’m learning something new. I liked personal finance and analytics as soon as I learned about them, but statistics took me longer to wrap my mind around.

Most of the things that enrich my life grew slowly. It took me years and years and years to get to the point of enjoying writing, drawing, or cooking. I didn’t look at W- across a crowded room and feel my world come into focus; I got to know him as a friend before growing to love him. Canada made me sad and homesick before it slowly became a second home. Biking was something limited and a little scary before it became freeing. I’m still working on enjoying exercise and picking up DIY skills.

Sometimes my goals for learning something burn brightly enough to keep me going, but sometimes I start something trusting that it’s good for me and that I might eventually enjoy it more. It can be difficult getting through the plateau of mediocrity, but it might be worthwhile.

I might not often rate deliberate practice and improvement as a 9 or 10 on the excitement scale, either. Sometimes I get impatient or distracted. But it’s good for me too, and it helps me do even better. So I’ll spend time on that, even if I feel a little blah about getting started. Sometimes momentum creates its own energy.

Still, it might be interesting to get more of my activities to that “Heck, yeah!” level of energy, when you’re jazzed up about things and you’re in the flow. It’s fun to have those happy-dance-“I rock! I rock! I rock!” moments. How can I amp up the things that I do, moving them up the scale, now that I understand my motives a little better?

2014-10-22 What kinds of activities do I want to fully enjoy

2014-10-22 What kinds of activities do I want to fully enjoy

  • Coding: If I’m coding on my own, I can encourage more “I rock!” moments by coming up with lots of little ideas for personal projects, investing time into improving my workflow, and practising in other ways.
  • Writing, drawing, packaging: This is tricky, since the “I rock!” moment isn’t as clear as in coding. Maybe if I come up with questions and explore them all the way to the point of packaging a resource…
  • Sewing: If my main challenges are patience and skill, maybe I can start with tiny projects and gradually work my way up, learning how to enjoy the process.
  • Exercise: Even small exercises have their own “I rock!” moments, and I can track my progress to enjoy this more.
  • Learning: Maybe progress tracking, speed, and practical application? Hmm…
  • Talking to people: Can I build up a stronger interest in people’s stories and lessons learned? Also, if I accept silences and the occasional awkward bit as normal, that reduces the downsides of conversations.
  • Committing to stuff: Actually, maybe I’ll continue to minimize this for now. =)  

Reflecting on motives

I’ve been thinking about motives and bigger dreams lately. I have a good foundation for experiments, and I probably should be building something bigger on top of it. But I don’t resonate with the entrepreneurial stories of passion and focus. I don’t start with a vision of how the world should be and then work backwards from there in order to make it reality. I don’t dream of dollars or media mentions when starting an experiment. So if those aren’t the things that get me going, what does?

2014-10-21 Exploring my current motives

2014-10-21 Exploring my current motives

A couple of recent decisions are helping me learn more about my motives. Over dinner, one of the Hacklab board members asked me if I would consider helping with bookkeeping, since the current volunteer was struggling with some of the work. After some deliberation, I agreed to help out. I noticed that my reasons for doing so were primarily because I felt Hacklab board had good people in it, and that solid financial information could help us navigate this somewhat precarious period.

On another note, I’m wrapping up the consulting engagement I’ve been working on for the past two and a half years. I said yes to that primarily because the person who asked me had good karma. He had helped me get into and make the most of IBM, so I wanted to help him and his team as well.

These two decisions helped me realize how strongly I’m motivated by helping specific people, versus being motivated by a grand vision, the desire to help a general class of people, or other reasons. I hadn’t realized the extent before, but now that I look closely, I can see how it plays out. I like prototyping because I can quickly build things with lots of feedback from people who will actually be using the tools. I like automation because I can save specific people time and effort. I like helping people with Emacs because of the individual quirks of their workflows.

I do have other motives, too. Sometimes I do things out of curiosity and because they tickle my brain. Tracking data and tweaking Emacs for myself belong to this category. Sometimes I do things because I think they will be useful, like writing and drawing.

I feel like I have small-m motives rather than the big-M Motives you read about in the biographies of people who change the world. I like working on a small, personal scale. Does that mean I should just focus on small dreams, gradually growing them in size? Are these motives something I can tinker with, work around, or transform into even better strengths?

2014-10-22 People who follow similar motivations well

2014-10-22 People who follow similar motivations well

Fortunately, I can look around me for role models living good lives following similar motivations. My parents also seem highly motivated by helping specific people. For example, my dad wanted to help one boy with autism who was interested in photography. That grew into a large initiative called Photography with a Difference. He’s also motivated by curiosity and crazy ideas, like the way he decided to go on a cross-country ultralight flight. My mom was once asked about passion and work. She replied, “John’s passion is photography. My passion is John.” She focused on building an advertising photography business so that my dad could do amazing things behind the camera. W- seems motivated by helping specific people, too, and he also focuses on doing things well. Many of my friends who are into programming are into it because of curiosity and the joy of creation (it helps that it pays the bills, too!). On my best days, I do what I do because I get to help specific people, follow my curiosity, and build resources that might be useful.

So if you can live a good life even with “small-scale” motives like this (compared to, say, the desire to reshape the world), what does that mean for me? How can I make things a little bit better? And–just to play with the idea–what would it be like if I had different motives?

2014-10-21 Reflecting on my primary motives

2014-10-21 Reflecting on my primary motives

I’m not strongly influenced by everyone, but since I do have that desire to help specific people, I can be deliberate about the people I spend time with and include in this consideration. It works out well if helping people out also helps me build skills and resources. It also works out well if I can expand to a group of good people, so I’m not anchored by only one person. For example, having gotten to know the rest of the team during my consulting gig, I feel like they’re also good people I’m happy to help.

I want to balance the people motive, though. This is such a strong pull on my brain, and it’s so tempting to work on other people’s tasks instead of following my own curiosities or developing my own things. I can de-emphasize this by being selective about the tasks I take on, picking the things that are best-aligned to what I want to learn or do anyway. I can also carve off time for self-directed interests, since I’ll probably benefit from training myself to get even better at following curiosity and making things I can build on later.

It would probably be very difficult to swap out my motives, going from concrete to abstract, even if it would theoretically be interesting to do so. Ah well. I’ll start by working with what I have, but it might be interesting to see if I can experiment with being an Alternate Universe Sacha just in case I discover I actually like it.

Anyway, what kinds of things do I want to be able to do with slightly tweaked motives?

2014-10-22 What would I like to be able to do with sustained motivation

2014-10-22 What would I like to be able to do with sustained motivation

I think it would be interesting to play around with Emacs, open source, and other tools, getting the hang of building more resources. It would probably be good to be able to fully enjoy DIY skills (including sewing) and other things that are good for me, like exercise. If I can notice things about these activities that line up with the things that currently motivate me — or tweak my motivations so that I like more of the things that are good for me — maybe that will make this stuff easier to do and easier to stick with.

Hmm…

Sleep as Android

Following W-‘s example (I’m such a copycat!), I’ve been trying out a few sleep-related applications on my phone. I get more sleep than he does and my schedule is pretty flexible, but I figure that an app might let me swap out the diminishing returns of sleeping in for some extra discretionary time. For a while, I ran Sleep as Android in parallel with SleepBot, and I also tried each of them separately. I used a sturdy, extra-long USB cable to charge my phone, and I slept with my phone under my pillow.

Both apps seem to agree with each other on the motion they detect, and they also appear to do a decent job of distinguishing between my motion and W-‘s motion (we have different-looking graphs). I’m not sure if there’s a significant difference, but I prefer Sleep as Android’s timing, so I bought it after the trial ended.

I also like Sleep as Android’s way of gradually waking me up with short buzzes, gradually leading up to an audio alarm. I like buzzes because they feel more discreet. I don’t have to feel guilty about interrupting W-‘s sleep.  They also don’t lead to overexposure to whatever tones I picked for my alarm. I’d previously used the built-in Medieval Jaunt and songs like Shonen Knife’s Cookie Day, and those still result in an odd tug on my concentration whenever I hear them.

I’m still not keen on morning meetings, but I can make them with less grumbling now!