RSSAmplifier

Blog

Tech, Ramblings, and Intellectual Detritus

kevinlochner.comRSS feed ↗30 posts

Latest posts

Open Source Payoffs

My edit was really minor, but seeing this still makes me happy:

Joyful Coding

From the redis manifesto: "We optimize for joy. We believe writing code is a lot of hard work, and the only way it can be worth is by enjoying it. When there is no longer joy in writing code, the best thing to do is stop. To prevent this, we'll avoid taking paths that will make Redis less of a joy to develop." Amen.

A developer is only as good as his commits

As a developer I've found new appreciation for the adage "a man* is only as good as his word." In business and in life, you can't depend on people who don't follow through on promises, especially when stakes are high. Amongst programmers, our code is our word. If collaborators can't trust that our code is of high quality, we are effectively a time and energy sink for those around us, forcing on…

Physical Technical Problems

A case study of the physical world bleeding into the technical . . . and a case study in idiotic StackExchange questions.

Canned interview problems are fundamentally flawed

I always hated "programming problems" when I was interviewing for jobs. I now also hate them as someone who is trying to hire programmers. As a candidate, I felt like these kinds of problems had little relationship to real work. How often do I really need to find the number of ways that one could walk down a set of stairs (a classic recursion interview question) or what floor an egg breaks on ?…

Safe Access for Temporary ActiveRecord Fields in Rails

I run into a fairly common problem in rails views when I'm pulling data from multiple tables. To optmize on db access, I use :select to pre-load the data from the joined tables. For example, let's say I want to list all users with their respective cities: Then I don't have to load the Address model to display a user's city: The problem is that my user partial is now coupled with my named scope: if…

How Twitter handles disabled Javascript

The home page works, but once you log in . . . . . . so much for Javascript fallback.

Bash-style history for irb

This functionality is included in some ruby gems ( Utility Belt seems to be the most popular), but I'm more of a "roll-your-own" kinda guy. Not to mention that the gem is a little overkill for printing out command history. Here's what I came up with:

Prompting for Facebook Permissions

When authenticating users via facebook, you have a laundry list of possible permissions to ask for. If you ask for no permissions, the user gets the following login window: Any requested permissions get displayed in the login window, but some of them get grouped into the same permission category. For example, many of the user_foo privileges get grouped into "Access my profile information", and…

Orkut update - officially a "new product"

Confirming the email alert I recently received, Google appears to be strategerizing in social with a renewed push for Orkut: it's listed on page 1 of their new products page (despite launching in 2004).

This is what heaven looks like

My browsing speed was noticeably & absurdly fast, so I ran a quick check :

Sign of a well played scrabble game

Is Google Bringing Orkut Back?

My old friend Orkut sent me an email yesterday, the first in a long time . . .

Use rails date_select without an activerecord model

I actually googled this and found a workable but ugly solution : ## view code <%= date_select('range', 'start_date', :order => [:month, :day, :year])%> ## controller code @start_date = Date.civil(params[:range][:"start_date(1i)"].to_i,params[:range][:"start_date(2i)"].to_i,params[:range][:"start_date(3i)"].to_i) I needed to include the hour and minute as well, and didn't want to cram more…

Feynman on Knowing vs. Knowing the Name

How I Roll

credit: http://bigeyedeer.wordpress.com/2008/07/15/this-cartoon-wrote-a-sweary-word-o...

Crappy TV Rant: Happy Town

I thought Happy Town had a decent chance of being entertaining : "Executive producer Josh Appelbaum and others on the show are huge fans of the Twin Peaks" "Executive producer Scott Rosenberg says he's more a Stephen King fan." "So if you think it's too much like Twin Peaks , blame them. If you think it's not enough like Twin Peaks , blame me." I love David Lynch films - Blue Velvet, Lost Highway,…

Facebook Connect Fail

Flash? Really? Funny given that Pandora was featured in the f8 keynote.

(not) Powered by Scala

The New Dashboard for Facebook Platform

Facebook has decided to do away with notifications - the little messages notifying you of things friends did on platform applications, or giving you updates on applications you have installed: While some of these messages are more nuisance than value, users have the ability to block notifications from specific applications, and many applications depend on these notifications to enable continuity…

My Brief Stint as a Groupon User

learning again that you get what you pay for Groupon For those that are unfamiliar, Groupon is a collective buying site, similar to Woot and BuyWithMe. Borrowing from the Wikipedia entry : The Groupon works as an assurance contract using ThePoint's platform: if a certain number of people sign up for the offer, then the deal becomes available to all; if the predetermined minimum is not met, no one…

Rails: Growing Pains With ActiveRecord

Rails, does it scale? That horse has been beaten to death, and there is ample evidence that it does scale with a little elbow grease where necessary. It's also commonly known that many of the rails convenience methods aren't terribly good at making complex queries. What I've just realized, is that some of the seemingly simple operations are implemented with horrible efficiency (the current…

recipe for disaster: Facebook Connect + AJAX + Internet Explorer

I just had an unbelievable debugging experience with our facebook connect site: One of our pages includes three main elements: a link to post to your facebook stream an link to update part of the page with AJAX an input form I had the page working fine in all sane browsers, and went to verify that everything was kosher on internet explorer. You're really not going to believe this. The Problem: The…

Work Party

A professor of mine once told a story about another hardware engineering professor, showing up for work friday afternoon with a cooler in tote and a big smile on his face, saying "My wife and kids are out of town, I can work *all* weekend." Coming from the perspective of an unattached grad student who could work all hours of the day/night, that statement seemed a little on the absurd side. Now…

Sanitizing Names for Files

I use database records for file names when generating reports, but some of those have invalid characters. The attachment_fu plugin has the sanitize_filename method, but I wasn't so happy with the output, e.g., >> sanitize_filename("foo & bar") => "foo___bar" >> sanitize_filename("14th @bar") => "14th__bar" So I wrote a prettier sanitization helper: which gives me: >> sanitize_for_filename(" foo &…

Call Markets, Efficiency, and High-Frequency Trading

Michael Wellman (my Ph.D. advisor) started a blog last week, and he wrote a short piece about economic efficiencies arising from high-frequency trading, which I was pointed to by Dan Reeves' blog post on messymatters.com . Mike says: Some have suggested that rapidity of response capability per se could open up manipulation possibilities or is otherwise destabilizing. We have also seen questions…

shortening urls

@codinghorror posted "trying to formulate an algorithm for collapsing a long URL legibly." This sounded like a fun distraction from a semi-painful monday, and the first thing that occurred to me was using letter frequencies to prune urls down. I couldn't resist coding it up to see how well it would work. First, here's the code: So, for example: >> url = "http://my.com/makethis/longish/url/shorter"…

Handling Unsubscribe Requests in Ruby On Rails With ActionMailer

If you're sending non-transactional email, you should be handling unsubscribe requests. So let's assume you have a database table of unsubscribed emails, and want to check this table before sending anyone an email. In RoR, the quick and dirty solution is to check for unsubscribe status before calling any deliver_action method in your mailer classes: MyMailer.deliver_action(address) unless…

rails sitemap entries for pages without models

In building a sitemap for my rails app, I went off of this blog post: http://tonycode.com/wiki/index.php?title=Ruby_on_Rails_Sitemap_Generator but I have public-facing pages for which no ActiveRecord model exists. I added the following to my sitemap controller to add entries for a given controller: Then, for example, in my controller I just call: @info_pages =…

rails environments with workling

I use mongrel_cluster to manage my rails app settings, and handle the actual start/stop tasks via monit. It would be asking for trouble to hard-code the rails environment in my monitrc file, so I modified listen.rb in the workling plugin to take a config file argument. With that done, i just needed to modify my monitrc file to start my working process with the path to my mongrel_cluster config…