I was missing Array.join: class Array def process_and_interpose(initial, middle, last) initial + (map { |i| yield i }).join(middle) + last end end
Archives for June, 2007
switched over to ruby version of the cli tool
I’ve switched over to using the Ruby version of the CLI tool for editing my book database; works great, as far as I can tell. Short, too: panini$ wc -l *.rb 9 author_writer.rb 18 book_writer.rb 11 closeable.rb 24 compound_author_writer.rb 21 connected_database.rb 30 connected_insert_row.rb 24 connected_result.rb 36 connected_result_row.rb 37 connected_table.rb 26 connected_write_row.rb 60 date.rb 21 decoder.rb […]
super paper mario
I wasn’t too excited about Super Paper Mario when I first heard about it. I certainly enjoyed the 2-D Mario games when I first played them, but the state of the art has changed, and nostalgia only takes me so far. So I’ll occasionally play a 2-D platformer and enjoy it, but I figured New […]
learning japanese: initial hiccups
I pulled out my Japanese textbook over the weekend and read the first chapter. All stuff I knew, so it went really fast – no big surprise. So I pulled out my box of blank vocabulary cards, and started writing down words. At which point I felt like I was stuck in molasses. Basically, my […]
weinberg on incremental construction
I’m a fan of authors on construction whose works I can read in a programming context. On a related note, here’s a bit from Gerald Weinberg with a building/programming analogy that I like. (Quality Software Management, v. 4: Anticipating Change, pp. 216–217: Imagine building a house by bringing all the parts to the lot, then […]
welcome, jordan!
I’m pleased to announce that my friend Jordan has joined the ranks of people with obscurely-named blogs. As of now, it’s a pleasant mix of the funny, the cute, and more serious math culture thoughts.
go refactoring!
In our last installment, we had this code: def parenthesized_list(array) array.process_and_interpose(“(“, “,”, “)”) { |element| yield element } end class Array def process_and_interpose(initial, middle, last) inject_with_index(initial) do |memo, element, i| memo + yield(element) + (i != length – 1 ? middle : last) end end end I’d extracted the latter method not because I thought […]
parenthesized_list revisited
I previously lamented this code: def parenthesized_list(array) list = “(” first = false array.each do |element| if (first) list += “,” else first = true end list += yield element end list + “)” end I still haven’t found a magic bullet in Enumerable or Array which will let me dramatically shrink it. But I […]
more groovelily rhymes
Some songs from Striking 12 came up in shuffle mode on the way to day care earlier this week, and Miranda decided she wanted to listen to more of it. So we’ve been making our way through the album. Some rhymes I was amused by, both from “Resolution”: What’s there to celebrate about? I’d rather […]
japanesepod101
Now that I’ve finished my book queue, my next major queue to work through is my backlog of JapanesePod101 episodes. I first subscribed to that podcast just a few months after it started, but it took me several months after that to start really paying attention to it; by the time I got hooked, I […]
is every single one broken, or what?
I don’t know how I missed this interview with a Microsoft bigwig about Xbox 360 failures. Even if you have zero interest in video games, it’s a stunning display of interview stonewalling. My first reaction: how can they possibly think that responses like this are a good move? My second reaction: but what if this […]
console buying thoughts
I just fired off a letter to my local paper’s video game journalists, in response to a question they asked in their latest podcast. And, of course, blogging has trained me to never type something longish without thinking about whether it could be considered even vaguely relevant for the blog! So: a lightly edited version. […]
ruby talking to mysql
My current programming project at home is to port my dbcdb code from Java to Ruby. So far, I’m working on porting over the CLI tool, which lets me update the database to add books that I’m reading, update information about them, etc. Until today, I’d been using a fake database abstraction that I made […]
maintaining a steady state of books
In response to my previous post, Stuart asked: “So, what do you do with all your books?” The answer got a little long, so I’m forking it out as a separate post. I don’t have any great solutions. But, if you assume a fixed capacity, there are basically two tacks you can take: get rid […]
finished book queue; rorty
Looking back, I had my lean book-buying revelation more than a year ago. As I said at the time, “right now, I have … lots of books to read before I can start buying again”, and while I have hardly sworn off from buying books since then, I have made an effort to read down […]
pasta procope
It’s been more than a year since I posted a recipe: it’s not clear that anybody is interested in them, and while that doesn’t stop me most of the time, it seems particularly pointless in the case of recipes. Still, every once in a while, somebody comes over for dinner and wants the recipe for […]
sun street cred
One other fun thing about the Fowler-DHH interview that I mentioned recently: about 37 minutes into the podcast, the conversation turns to large companies and their involvement in open source in general, Ruby in particular. They initially start off dubious about the concept, with Microsoft as their example, which made me wonder “hey, what about […]
good fsck!
I reported my problem to the author of fsck yesterday; today, I had an e-mail waiting for me, saying he thought it was a bug he’d fixed recently, and asking me to try a new version. I did, and at first it seemed to get stuck in the same place; while I was poking around […]
isolated podcast episodes
I recently ran into a couple of interesting episodes (if that’s the term) of podcasts that I don’t regularly listen to. Hanselminutes had an interview with Martin Fowler and David Heinemeier Hansson; great stuff. Lots of good talk about design, beauty (I didn’t know that Japanese Ruby code apparently has a rather different aesthetic than […]
bad fsck!
I just rebooted my computer, and it decided that some of my filesystems needed to have fsck run on them. (It had been more than 20 reboots since they were last checked.) And fsck decided to hang 4.6% through the initial check on one of them. Rebooting didn’t help: after every reboot, it noticed that […]