Author Archives: Turadg

Two proposals

For those keeping track, I made two proposals this summer: one to my now-fiancée and one to my dissertation committee. I’m happy to say that both went very well. This isn’t an autobiographical post though. Most of the people who would care are friends on Facebook, and that’s the topic of this post.

The engagement was first and when the news hit my Facebook profile, I was struck by how many more of the commenters were female. Eight people posted on my wall, all female. 42 people “liked” the news, females at twice the rate of males. My Fb friends are gender balanced (48% female, 47% male, 4% not specified) so I wondered what accounted for the difference. Are females more likely to be happy about an engagement? The comments were gender split 14/15, but counting up all 79 responses, 50 were female to 29 male, still almost twice the rate of reply.

When I passed my thesis proposal, the responses seemed mostly male, but once I counted them out it was less clear. Of 13 comments, 8 female and 5 male. Of 50 likes, 30 female and 20 male. So of all 63 responses, 38 (60%) female and 25 (40%) male. Are women just more supportive? (Or more specifically, my female Fb friends?) Hard to say. It is still striking that there were 8 wall posts from women on the engagement and none from men (and none from anyone on the less romantic proposal). Maybe women are more likely to make that stronger public support (that is the wall post) of love? Dunno, but I do know I managed to avoid working the last 20 minutes while still doing work-like activities.

 

Posted in Whatever | Tagged , | Comments closed

Solve Papers app syncing problem with ad-hoc Wi-Fi

Quick tip: if you’re using Papers for iPad (or iPhone) and can’t get your Mac to see the device, make an ad-hoc network using the Create Network… option in the Mac’s Wi-Fi menu. Works like a charm.

Posted in Research | Tagged | Comments closed

Bash completion for Rake tasks

I have a poor memory, especially for things a computer should do for me. Frustrated with Rake commands (is it logs:clear or log:clear?) I turned to Bash completion. A web search found this basic implementation. Because it called rake -T on each invocation, it was unusably slow. Another search found Jonathan Palardy’s implementation with caching. Nice.

I worked on it a little more to be able to add it to Homebrew’s bash-completion package. Though it turns out that Homebrew’s package just grabs from the main bash-completion distribution so I’ll have to see about adding it there.

In any case, here in all its glory, a bash-completion for Rake. It caches automatically so all but the first use is fast. It also checks for a tmp/cache directory (present in Rails projects) and places the cache in there if available. This saves you from having to add the .rake_t_cache file to your SCM’s ignore list.

Posted in Coding | Comments closed

“SSH Plugin” in latest Quicksilver

Today I came across this question, How to create an ssh connection Terminal shortcut, and had to answer as it’s been a frustration of mine. For years I’ve used Quicksilver with the SSH Plugin to quickly log into remote hosts: Cmd-space, type a few characters of the hostname, hit enter, and bam there I am. I avoid passwords by using ssh keys and I avoid setting up a list of hosts because SSH Plugin automatically scans ~/.ssh/known_hosts. And of course, I avoid so many more keypresses because Quicksilver is slick.

But Quicksilver is also old and buggy. The build I’ve been using is from 2006 and it’s is prone to long pauses and abrupt crashes. I’ve tried newer builds but they break SSH Plugin and I could never part with it. Today I decided to give it another try and discovered RemoteHosts. It does a lot more but there’s one critical setting if you want it to work like SSH Plugin: Go into the catalog for it and enabled the checkbox for ~/.ssh/known_hosts.

Incidentally, if you also need the latest Quicksilver binary, this is the latest I could find : Downloads for tiennou’s blacktree-alchemy – GitHub. There are new versions in the quicksilver source tree if you want the latest. All you needis XCode and it’s a one button build.

It’s a shame that Quicksilver has languished when it does so much that its upstart competitors still lack. Maybe the new Quicksilver Collated site will help.

Posted in Computing | Tagged | Comments closed

Show validation errors in RSpec be_valid output using a custom matcher

I’m getting into Rspec and loving it. So I was surprised when I get this pretty unhelpful message from a be_valid specification:

expected valid? to return true, got false

So I went looking for a way to see what errors there actually were in the validation. First I came upon rspec: model.should be_valid // opensoul.org. That looked good but it didn’t work for me on Rails 3 with Rspec 2. Then I found Creating a custom “be_valid” matcher for rspec_on_rails « nuby on rails, which has more details but still didn’t work. (Also the way I also found (My) RSpec best practices and tips | EggsOnBread, which is too good not to share.)

With some more searching I found a good walk-through on writing custom matchers RSpec 2 with an example of how to show errors on one specified field: solnic.eu / Custom RSpec-2 Matchers. I’m not sure how it’s different from the built-in errors_on. It also used the deprecated module Spec:

*****************************************************************
DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.
<internal:lib/rubygems/custom_require>:29:in `require'
* Spec is deprecated.
* RSpec is the new top-level module in RSpec-2
***************************************************************

With the help of all the above, a version that works in Rails 3 and RSpec 2:

RSpec::Matchers.define :be_valid_verbose do
  match do |model|
    model.valid?
  end
  
  failure_message_for_should do |model|
    "#{model.class} expected to be valid but had errors:n #{model.errors.full_messages.join("n ")}"
  end

  failure_message_for_should_not do |model|
    "#{model.class} expected to have errors, but it did not"
  end

  description do
    "be valid"
  end
end

Change the name to “be_valid” if you want. That works but I don’t like replacing standard stuff. Guess I’m not a Rubyist yet.

Is there a way to get this functionality without writing a custom matcher? Is there a safer way to override the be_valid?

Posted in Coding | Tagged , | Comments closed

JavaScript code prettifiers

If you need a JavaScript code prettifier you’ve got basically two options, google-code-prettify and SyntaxHighlighter. I just tried them both and here’s what I found.

google-code-prettify SyntaxHighlighter
Support Google Code site. No wiki. Project maintainer Alex Gorbatchev who seems quite helpful.
Languages highlighted Lots. Lots.
Hosting Must download yourself. Can load URLs directly. (Donate if you use this.)
Branding None. Shows a help “?” which activates a dialog asking for a donation.

How do they look? I needed YAML highlighting so that’s what my screenshots are of. (Incidentally, the YAML “brush” is not distributed with SyntaxHighlighter.)

Here’s the Google one. It parses strings wrong so only some words are highlighted. It gets dates. It gets comments. It gets numbers but interprets them as numbers even when they’re part of a string.

So I tried Alex’s with the YAML brush. It’s a little better. It colors the keys of the hash but it misses the first of each hash, maybe because it’s in a list. It doesn’t detect strings or dates. It has the same problem with numbers.

But the killer is that it resized my <pre> out of the boundary. I tried hard-coding width but that had no effect. So I’ll go with the Google one. Maybe someone will improve it, or if I really need to I will.

Posted in Coding | Tagged | Comments closed

Consolidating multiple WordPress blogs using categories

I’ve had separate professional and personal blogs for a while because most people I know who would read one wouldn’t be interested in the other. Recently as I started getting back into writing code, I wanted to participate in the active community of blogging programmers. But start yet another blog? Instead I decided to make heavy use of categories in my primary WordPress blog to split the audiences. Here’s how I did it.
Read More »

Posted in Coding | Comments closed

FeedBurner feed per category

Summary: This post describes how to set up a WordPress blog with a FeedBurner feed per category. Basically, use this wp-feedburner plugin by unzipping the latest plugin archive into your wp-content/plugins folder.

Read More »

Posted in Coding | Comments closed

Learning in public

Years ago I was a full time web software developer, with the LAMP stack my sword and Eclipse key bindings in my muscle memory. Or something.

More recently I've been in a PhD program and my coding skills have gone rusty. Meanwhile, the landscape changed. Ruby? Mongo? Heroku? My research is now at a point that I'm developing a working system so I'm having to learn anew. Which can be fun. Especially that the web has made coding into such a social activity. Github: awesome. To do my part in the community that has helped me so much in learning the modern world of web development, I started this Tumblr to let me post the little personal discoveries I make along the way. So maybe it'll be that much easier for the next person.
And I hope to have fun while doing it.
Posted in Coding | Tagged | Comments closed

How was your 2010?

My good friend Jake sent me a batch of questions to print out and take to a New Year’s Eve party. I got to spend New Year’s 2009-2010 with Jake and really enjoyed answering these questions with a large group of great people. This year, I thought why not answer them with even more people!

Below are the questions for your rumination. Answer them however you like, sincerely or sillily. Or any -ly you like. Note that your answers will be visible (anonymously) to other people who’ve answered, but please don’t let that prevent you from honestly considering the year behind us and turn to the New Year ahead. Without further ado…
Read More »

Posted in Whatever | Tagged | Comments closed
  • Subscribe

    Subscribe to all posts by feed.
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 3 other subscribers