2006-08-01 @ 22:59

Holla

Sup ya’ll. I know its been a while since I rapped at you, but I’ve been busy. I was in Chi-town hollaing at my girl Jackie. Basically hanging with my shortie was more fun than spitting rhymes at the local hip-hop club. In less than 24 hours, I had a hottie up in my grill asking me on a date! I was like holla! In 5 1/2 years in Seattle, that has never happened to me. Seattle can suck it! I hate you Seattle. Except for your weather.

One night Jackie and I went to South Chicago to a Reggae party at someones house. I had a really fun time, but it was very strange to be the only white man there. Also, one night we went to a brit-pop/new wave dance night at some club. I had an awesome time there! I can’t believe we don’t have a place like that in Seattle. Does anyone know where I can go dancing to stuff like that here?

In conclusion….. Seattle, I love you for your weather, beer, mushrooms, scenery, my friends, the cheese festival, coffee shops, and the seafood. However, you need to do some major work on your dance clubs, women, public transit, expensive houses, crappy nightlife, abundance of fleece, and pinecones. Those things are lame.

Peace out. A-town.

read more »

2006-08-08 @ 15:51

More Ruby Mechanize Dev

I’ve been working away at mechanize lately. It seems like my creativity comes in bursts. As soon as I make a small bugfix release, I get inspired and write a whole bunch of stuff. Anyway, Eric pointed out that I didn’t have support for multi-select lists, so I added that for 0.5.2. I’m excited to release 0.5.3 already because I updated it so that when operating on an WWW::Mechanize::List, if the list doesn’t respond to the method being called, it will try it on the first element of the list. So, what does that mean? You can click on links without having to specify the first one all the time. You can do this:

agent.click page.links.text('Something')

Instead of doing this:

agent.click page.links.text('Something').first

But it is still an array, so if you have multiple links with the text ‘Something’, you can index in to the array like so:

agent.click page.links.text('Something')[2]

I’ve also been toying around with adding a “click” or “select” method to most objects. Then you can select the first radio button with either of the following lines:

agent.click form.radiobuttons.first
form.radiobuttons.first.click

I think this may help in the future if I want to get Javascript support. I’ve currently got this working with select lists, so this will select the second option from a dropdown:

form.selectlist.options[2].select

As for WWW::Mechanize 0.6.0, I’ve got Hpricot support in the trunk with all unit tests passing. This means that browsing the web and scraping those pages at the same time will be a breeze! I just hope that Why releases a gem for Hpricot on rubyforge soon! I also want to see if I can get Mechanize working with Selenium IDE so that scripts generated by Selenium IDE can be executed using mechanize and not through the browser.

read more »

2006-08-10 @ 13:12

Mechanize + KEXP = New Music

I was able to write a pretty quick mechanize script that grabbed the playlist from kexp and put it in a SQLite database. From that, I came up with the top 4 songs played on KEXP for July:

  1. Tv On The Radio - Playhouses
  2. Midlake - Roscoe
  3. Johnny Cash - Gods Gonna Cut You Down
  4. Silversun Pickups - Lazy Eye

I also used Gruff Graphs to make a graph:

Popular KEXP Songs for July

read more »

2006-08-15 @ 16:49

Twan Is Gonna Get Killed

My family was in town last week, and my sister found a gigantic spider in my bathroom.

Big Spider

Now, I didn’t know this at the time, but Twan (I named him Twan) is a Hobo Spider. Here are some interesting facts about Twan, all of which will make me kill any of his brothers I find. Twan:

  1. Injects venom which causes necrosis
  2. Is really big
  3. Is very fast
  4. Bites humans during "unintentional contact while in bed sleeping"

Sorry Twan. This circle of life isn’t big enough for the both of us. Next time I see you, you are dead, and that is a threat. Also, it looks like Twan might have pooped while in captivity.

read more »

2006-08-20 @ 12:11

Bacon Cake

First off, happy birthday Todd!

This weekend was Todd’s birthday, so Stacy and I made him a Bacon Cake. It consisted of two layers of delicious corn bread with a layer of bacon and frosting between. We frosted the outside, and coated it in bacon. The frosting was a cream cheese frosting with maple syrup. We cooked up two pounds of bacon for the cake.

The cake actually tasted really good, but next time I think we should make the frosting not so sweet. Stacy had suggested a sour cream frosting, but I didn’t like the idea of sour cream with corn bread. I think next time we should use less sugar, more syrup, and add some bacon fat to the frosting.

read more »

2006-08-24 @ 20:21

Automatically Query iTunes Shares

Here’s a quick program I came up with to query iTunes shares as soon as they connect. It uses dnssd to query for iTunes over multicast dns, and Net::DAAP::Client (ruby iTunes client) to query the iTunes share. The program will wait until someone starts up iTunes and automatically queries the iTunes server.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'rubygems'
require 'dnssd'
require 'net/daap'

Thread.abort_on_exception = true

class ITunesResolver
  @@servers = {}
  def self.resolve(br, action = :add)
    Thread.new(br, action) { |br, action|
      DNSSD.resolve(br.name, br.type, br.domain) { |rr|
        tr = rr.text_record

        # Skip servers that have a password
        if ! tr.has_key? "Password" or tr["Password"] == "false"
          if action == :add
            @@servers[rr.target] = Thread.new(rr.target) { |t|

              # Connect to the server and list all songs
              daap = Net::DAAP::Client.new(t)
              daap.connect do |dsn|
                daap.databases do |db|
                  # Print song names
                  db.songs.sort.each { |s| puts s.name }
                end
              end # End DAAP Query
            }
          else
            (@@servers.delete rr.target).kill if @@servers.has_key? rr.target
          end
        end
        rr.service.stop
      }
    }
  end
end

browse_service = DNSSD.browse('_daap._tcp') do |browse_reply|
  if browse_reply.flags.add?
    ITunesResolver.resolve(browse_reply)
  else
    ITunesResolver.resolve(browse_reply, :del)
  end
end

$stdin.gets
browse_service.stop

It’s not perfect, but the bugs are left as an exercise for the reader to fix!

read more »

2006-08-29 @ 16:42

Sylvester Wants Revenge

(Please sing this post while reading it)

Its twelve in the evening, and I’m walkin’ in to my beeeddrroooom. / I look down on the floor, and I can’t believe what I’m seein’ here. / I says “Is that you Twan? How the hell did you get up on my floor? / I thought I had sent you to sleep with the mother fucking fiiishes” / He says “My name ain’t Twan, and I’m here to exact some reveeeenge” / “My name is Sylvester, and you’re the man who killed my broooother” / So I pulled out my beretta, I trapped him in a tumbler, then I took some photos, then I smashed his ass, ass, ass, ass, ass, ass, ass.

IMG_0075.JPG

read more »