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. :)

April 24, 2007

I Took It!

April 9, 2007

HEY!!! That’s not nice.

While filling out an online form today, I was presented with what we in the web biz call a CAPTCHA image. It’s one of those graphics that has text you need to confirm. The text is either distorted, covered with lines, shapes, or colors, or even both. It is presented in such a way as to obscure the text enough so that a computer can’t automatically guess what it says. They’ve become quite popular and for good reason. They work. But what happens when they start fighting back, or at least letting you know how they feel about you.

I kid you not, this is what it asked me to confirm…

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. :)

February 22, 2007

WTF? A TV?

WTF?  A TV?

So I’m buying gas today and I hear someone talking nearby. There wasn’t a car next to me so it couldn’t have been someone on their phone. What was it? Shell has installed small LCD tvs in their stands now. WTF?

I thought the grocery store checkout lanes was bad enough. It’s starting to get ridiculous now. What’s next? Above the stripper poles? At the crosswalks? Jeez.

I uploaded this through flickr

January 15, 2007

Who needs the real iPhone

2007-01-15

heh. This software is called “iPhony”. it’s a glorified app launcher for the Treo.

I uploaded this through flickr

December 5, 2006

I wonder how Jasper and Daphne would react to this?

[insert evil grin here]. I sooooo wanna see. This is a new remote-controlled dragonfly that’s being made by the same people who brought you the Robosapien. Unfortunately it hasn’t been made available for sale yet. It has only just been approved by the FCC.

I’m betting that Daphne runs under the dining room table or under the couch. I bet Jasper looks at it frantically for a bit but then goes to sleep in his box.

November 16, 2006

Autostarting Mongrel clusters in FreeBSD 6.x on bootup

Jeez this has been a confusing day. I’ve been trying to figure out why the mongrel clusters powering my websites weren’t starting after a reboot of my servers. I’m initializing the reboots so don’t worry that my servers are unstable. :) they’re not. They’re well-behaved children.

FreeBSD has the /usr/local/etc/rc.d directory for shell scripts that will autostart services for you. Kinda like the “Startup” directory in windows. Great. So I found a shell script someone had written and sent in this email on the Mongrel-users mailing list. I copied that to the rc.d directory and placed the require mongrel_cluster_enable=”YES” line into /etc/rc.conf.

reboot.

Nothing. Apache was starting. Mysql was starting. WTF.
Read rest of this entry »

October 27, 2006

Thank you TVUplayer

Tonight I was stuck at work trying to get my capistrano deployments working and I was listening to game 5 of the World Series. I couldn’t watch it and the Cards were quickly moving towards winning the game and The Series. However, with no TV nearby I couldn’t watch it. And everyone knows (you know. you really do) that you can’t just listen to the game when it finally ends and the winner is announced. What was I to do?

I realized that at some point in the past I’d downloaded this lovely piece of software called TVUplayer. It’s TV over the web but not like you’re used to hearing about it. They’re clever about how you receive the data. Kind of like how BitTorrent is a large mesh of users sharing data so that the speed can be very high, same here. Many users are watching the channel I want to watch so the datarate is better. Less users, the crappier the channel will look. Lifehacker may have described a little better than me.

Long story short. I got to WATCH the end of the game… sitting at my desk at work!!!

Isn’t technology wonderful? heh. Oh… and BTW - CONGRATULATIONS St. Louis!!!

« Older Entries