Personal

RSpec matcher helper

| |

I've finally written more than one RSpec matcher. Creating a matcher essentially involves defining a class and a method that creates an instance of that class. Rather redundant, resulting in my RSpec matcher helper:

def defmatcher(name, &code)
  klass = Class.new
  klass.module_eval(&code)
  
  Object.send :define_method, name.to_s do |*args|
    klass.new(*args)
  end
end

That little method, defmatcher, creates the class and method for you. It saves some typing. An example can be found in the full source file, available here.

Update (2008/06/28): RSpec was having trouble keeping this all in one file. I created a project at GitHub to host this for the time being: http://github.com/sneakin/spec_matcher_helper/

Experiments with Erlang

| | |

Earlier today I setup an instance of HgWeb to host some old and new code bases of mine. Two of the repositories may interest those learning or looking to learn Erlang. Both repositories contain a simple project that doesn't amount to much of anything at the moment, though they could prove useful for some code reading/banging.

The two repositories are:

  • Station: This is a super basic, simple HTTP server framework. It can currently parse an HTTP request which gets dispatched to a station behavior that you can define. The station behavior contains a function that gets called on each valid request and returns a response which is sent back to the requestor. Proper query string and form handling still needs to be done along with dispatching to different modules based on the requested path.
  • mod_rest: This is an ejabberd module that adds an HTTP handler that allows HTTP clients to literally post arbitrary message stanzas to ejabberd. Those stanzas then get shoved through ejabberd's router just like any other stanza. My original use for this was to allow a Rails app to send messages through ejabberd without needing to be a full XMPP client.

You will need to install Mercurial to get the code onto your machine. It's the next best thing to git.

A Conservative iChat

|

I just ran into a problem with iChat that would probably leave most mystified. I found out due to some unknown reason that iChat is very picky about the XML contained in its rosters. It doesn't ignore errors. Instead it just kicks you off saying that you have lost your connection.

The little snippet that was the culprit was a roster entry with a namespaced attribute:

<item jid='***@gmail.com' name='***' gr:t='B' subscription='both'/>

I'm not sure where that "gr:t" attribute came from, but that appears to have been iChat's choker. The only reason I noticed that was with Apple's Console utility. iChat was spitting out error messages to the system.log which included a block of XML that caused parse error 27, whatever that error means.

To get iChat working I had to use another client to remove and readd that roster entry. Not good for the neophytes.

I am left with a couple of questions though. Who uses the "gr:t" attribute, and what's it for? And can iCh

Bitter

| | |

I slipped up a new site bitter.nolan.eakins.net the other day. It's my take on the don't make me think blog. I've already implemented a basic web interface and just slapped together an XMPP bot that makes Bitter much easier to use. There's a lot that I've left out, but I put a Bazaar repository up if anyone wants to play.

Intellectual Property and oDesk

| |

I followed the link TechCrunch posted to oDesk since I need some work. I found some job posting that I found interesting and proceeded to sign up. Low and behold the first service agreement I read just wasn't palatable. From my understanding of their Professional Services Agreement, any pre-existing intellectual property that is incorporated into a project can essentially be used for whatever purposes oDesk wants.

I wouldn't have an issue if this granted a license to the company that has requested the work, but it is oDesk—the site that connects professionals with those that need work done. I have a body of code that's gradually getting larger that allows me to be more productive, and I like to set my own terms on its use. Sorry, I won't grant an unlimited license to it to a company whose unstated business is to hoarde IP.

O' conclusion, where art thou conclusion?

I happened to read two articles tonight which offered zero conclusions. I've seen more in the past, and every time I've been left with a feeling that the author only supplied me with filler. I'd like to present tonight's culprits: "Hoarders vs. Deleters" and "Urban Fables".

The first article is Northwest Florida's Daily News' Hoarders vs. Deleters: What your inbox says about you which describes how different people handle their incoming email. This article ended with: "Because 'inboxes are metaphors for our lives,' Dr. Greenfield says, there's no cure-all solution to inbox management. We're all too different..."

Ain't that just hanky-panky. For the first couple of paragraphs, I thought I was completely mismanaging my inbox. It's not exactly the perfect void of emptiness. In fact my method isn't even listed. At least this article informed me that everyone is different. I couldn't fathom that people manage their email in completely different ways. Mine just happens to be the read, handle, and leave it method. I imagined there might be a better way, and this article would either cast me into Hell or grant me access to Heaven. I thought wrong.

Moving on, the second is Planetizen's Urban Fables: The Role Of Storytelling And Imagery In Successful Planning Movements which describes how advocates for urban planning and private property use allegories to persuade people to their side. At least this author had the gaul to be straight forward: "I do not intend this essay to be a criticism of the ideas or techniques of either movement, nor am I suggesting that New Urbanists or property rights advocates are blind followers of misguided faiths."

To bad that I thought that this article would come out to favor urban planners over private property advocates, or vice versa. Considering the title, I was expecting that he'd favor the planners, and the subject of this post would be criticizing how you can't plan the perfect society (well, these guys have).

There could be various reasons for why people write articles such as the above. The obvious would be that they just want to inform us and let us make our own judgement. To bad that I really don't care how Jane manages her email compared with Bob, or that people use allegories to demonstrate their principles and the resulting logic.

Another reason is that these are paid writers. They need to write something, anything just to meet this week's quoata. Perhaps they had a thought such as: "Boy! My inbox is a mess, and I still have to write my article." Or maybe their editor had an empty column that just needed to filled, so the editor called for an article about anything to fill this space.

Either way, I felt like a dog that's been fed green beans when I finished the article. It was filling but completely useless.

Chipping Away at Veneer

|

It looks like Paul Graham has changed the style of his posts a bit. Right now he has four posts listed. Two are rather small by his standards. One of the four is an interview he did for Ian Delaney.

In response to one of the questions, PG stated:

"A sense of design is also a big advantage. Big companies treat design almost as if you could paint it on after the fact. Even Google has this problem; their biggest weakness is that their definition of a hacker doesn't include a big enough design component. A hacker with design sense is really dangerous, especially as a startup founder."

—Paul Graham

Classic Nolan

|

It looks like I'm now quotable. Alex Mauer's home page contains something that I came up with, most likely during a late night chat. The quote is: "information is a free whore on the internet".

Goog's Page Creator

|

I toyed with Goog's Page Creator and created a home page. It's ugly, and I wasn't wowed by the page creator. It was an interesting use of JavaScript and proved that JS can be damn slow. I probably won't go back there unless I want to start a link farm.

People

| |

Last night I attended a Greenwood city council meeting in which a smoking ban was presented. It was one of those experiences where I saw first hand the problems with our nation. The problem isn't the myraid number of issues facing our governments, but the simple fact that principled people are hard to come by.

Only one member of the council, Ron Deer, took a principled stand against the ban. Practically everyone else in the room was in favor of the ban, in favor of using the government to coerce smokers. The mayor even suggested that tobacco should be made illegal, hinting to his lack of integrity.

I'm left wondering how people who do not hold rational princples can be persuaded with a principled argument? It also begs to ask why our schools fail to turn out principled people?

Syndicate content

Ad's by Google