July 10, 2008

log_buddy and Windows

I recently started playing around with the log_buddy gem for Rails and because my development machine is on windows, the “d” method wasn’t playing nice with some paths.  it didn’t like paths that included the drive letter.

this is a sample of a line that would cause log_buddy to barf.  it just so happens to also be the line that causes the error.  :)

c:/ruby/lib/ruby/gems/1.8/gems/log_buddy-0.0.5/lib/log_buddy.rb:98:in `read_line'

the original line looked like this…

file, line_number = frame.split(/:/, 2)

the fix is to replace that line with

file, line_number = frame.reverse.split(/:/, 3)[1..2].map(&:reverse).reverse

yeah.  ugly, and maybe could be written better but it works for me.

now if only I could get log_buddy to output good inspections of objects I toss to it… like “current_user”.  I’m prolly using it wrong right now, but this isn’t helpful…

current_user = '#<User:0x47143d8>'

just saying.  :)

UPDATE: I monkeypatched log_buddy to fix this functionality. I created a “RAILS_ROOT/lib/log_buddy_extensions.rb” file with the following code.

class LogBuddy

  private

  # Return the calling line
  def self.read_line(frame)
    file, line_number = frame.reverse.split(/:/, 3)[1..2].map(&:reverse).reverse
    line_number = line_number.to_i
    lines = File.readlines(file)
    lines[line_number - 1]
  end

end

and I figured out that the “current_user” line above shouldn’t be …

d { current_user }

it should be

d { current_user.inspect }

that outputs what I want …

current_user.inspect = '#<User id: 1, login: "matte", email: "matte@localhost", crypted_password: "...", salt: "...", created_at: "2007-08-30 18:23:32", updated_at: "2008-07-08 18:57:45", remember_token: "...", remember_token_expires_at: "2008-07-22 18:57:45", name: "...", password_reset_code: nil, company_id: 2, active: true>'

May 13, 2008

XSendFile note

I coulda had a V8Note to everyone using Apache and the XSendFile module. If you’ve included the module and are getting 0-byte files, like I was today, make sure you have the following lines in your VirtualHost config

XSendFile on
XSendFileAllowAbove on

The website needs to know you want to use the module. Duh. :)

February 22, 2008

It’s a bad sign…

… when your day starts out with you walking into work with the song “Back to Life, Back to Reality” by En Vogue (or is it Soul 2 Soul) in your head.

February 9, 2008

Sitting on the patio today…

Sitting on the patio today...

… working, while my family back in Wisconsin sits through more than a foot of snow. Shucks. :)

I uploaded this through flickr

January 18, 2008

GO PACKERS!

G Force

September 5, 2007

FIRST!!!

hah!! this is really funny.

And first person to comment “First!” gets a virtual handslap across their tocks. :)

PS: not safe for nephew ears to hear. hint hint saj.

April 24, 2007

I Took It!

April 16, 2007

Restarting mongrel_cluster with capistrano

Update 4/17: Bradley, the author of mongrel_cluster, was already aware of this issue and is getting ready to release a new version with some fixes for this issue. Best practice for now is to update your config files to place the pid files in /var/run/mongrel_cluster. He mentioned it way back on February 23rd. I shoulda read closer.

If you’ve been experiencing problems with restarting your mongrel cluster through Capistrano then I have two solutions that have worked for me and I’m pretty sure will for you as well. Read rest of this entry »

March 27, 2007

and 15 cents in change

WOOT!! Just really excited about my first IPO ever!!!!! we priced at $11 a share and ended the day at $14.15 per share!

It’s been a long time in coming. I moved out here in ‘98 and have lived through the lean times of the post-2000 bail-out of all things Internets. It’s nice to be on the upside of good times.

Thanx to all those that deserve but don’t get naming (sorry, for strict reasons of privacy). If you think you deserve thanx, then I give you those thanx and more. You know who you are. I’ve worked with the best and it shows. Many amazing people have stood alongside me and I have worked for many amazing talents during the downturn in the .com economy and we’ve come out of it all and stood tall. Thank you, thank you, thank you. I can’t begin to express my thanx.

[holding a glass of Veuve Clicquot in the air] here’s to the future everyone. Keep your feet on the ground and keep looking to the stars… or what ever Kasey Casem used to say. :)

December 15, 2006

That’s low!!! Even for a spammer

Homer screaming in an electric chairI get a lot of spam at work. Not that I think YOU don’t, but as the webmaster for the company I work for, I get my fair share. Usually I just empty my spam folder but this one pissed me off. The subject line read…

“memoriam James KimCNET senior”

Spammers have no morals to begin with but that’s just TOO LOW!!!! I think hell has been adding on over the last few years and their biggest new circle is dedicated to spammers.

effers. I hate you all. what homer is going through in that picture is too good for you.

« Older Entries