fsync for my brain

Too many books start off like this...

1.x Why [Language]?

[Language] is a great language for [Book Subject] for a large number of reasons. First of all [Language] has clear syntax. Second, it makes text manipulation extremely easy. A large number of people and organizations use [Language] so there is ample development and documentation.

That last little gem is c/o Manning's Machine Learning in Action. I've been very pleased with the "[Foo] in Action" line of books and although it's a MEAP (Manning Early Access Program) - we have clearly started out on the wrong foot. With some constructive criticism, I would hope they change this small, but far too boilerplate paragraph in the book.

I mean really, you could drop nearly any language in there.

Rubbed the wrong way? You betcha!

 

In light of all that - you can nab this book 42% off until April 28th by clicking meow: http://www.manning.com/pharrington/ (note: not a referral URL)

 

Posted June 11, 2011

Solving the mailing list engagement "problem"

Mark Phillips from Basho posted on Twitter about how developers would get a faster response if they would just ask on the appropriate mailing list. In this context, we are of course talking about Riak, a Dynamo-inspired key/value store with a distributed database network platform that makes storing and retrieving data simple, safe and low-cost. Yes, I took that last blurb directly from their site.

Anyway, I had replied back stating that I think the reason developers, particularly "new-er" ones don't use mailing lists is because they don't supply them with "cred" like stackoverflow or quora might. Bradford, you might be thinking, that's just outright stupid! You're right, but developers, particularly hipst-er, y-young, younger ones prefer the engagement and "game theoriness™"[1] of these sites over the mailing lists.

So how might we solve this? How do we bring sexy back to the mailing lists? How, now that I'll likely rank first for people who search for "sexy" and "mailing list," will we nurture and hopefully keep that engagement? Let's bring it to the mailing lists.

My suggestion would be to have someone setup a subscriber to the mailing list and all it does is keep a count of:

1) How many questions have you asked (based on the "from" address of the first email in a thread)?
2) How many replies have you sent? This should have some sort of threshold to account for just "Thanks" or "No problem" replies. It should only count replies of n-characters or more in the body.
3) How deep of a discussion do you normally have with your questions? (Counting the levels of the thread) May be useful later on, who knows.

Throw all of that in a database[2] somewhere and slap up a leader board for all to see.

What about all those prior responses? Most mailing lists have their archives online, instead of playing XBox tonight or watching Jersey Shore, why don't you crawl them and back-fill that data?

In closing, there are some holes to this suggestion of mine, I dare to call it a solution, even though I used that as my title. First off, perhaps keeping every question related to the software at hand in one place is bad. Say the archives get lost, the company closes shop or what have you - not likely, but, possible. Second, for all I know, many, if not all mailing list management systems have this functionality already and I'm not providing anything "new" here (that would be great, I actually enjoy being wrong). Finally, if you're willing to implement it and it doesn't already exist, you certainly have my blessing, I have plenty to do already but am not too busy to tell others what to do.

Thanks for tuning in.

EDIT: I should point out; that if you are dealing with counters in Riak, you'll likely need an "intelligent" client if you're not forcing writes to every node. Eventually consistent counters would possibly lead to incorrect totals.

Atomic counters in riak is something I'm very interested in and hope to work something out in that realm soon-ish.

[1] - trademarked just now, by ME!
[2] - use the email address as the key, and supply three fields: question_total, reply_total, question_depth_average

Riak, csv and R

Hello friends...

First, I'd like to thank all of those who filled out the Functional Nashville survey.  About 50 people filled out the survey and I've been contacted by roughly another 30-40 people in three other states (that includes Ohio) that would be willing to pack up their user groups to come listen, speak and volunteer for such an event. I'll get to the analysis on the survey in my next post, but for now I have something I'd like to share.

I've been working with a startup named First Round Xchange on a fantasy football-esque game. There are some more details I'm not sure (ink is still wet) I can share yet, but soon to explain why this game (I think) is pretty interesting in a strategic manner, more on that later.

With this comes a bit of data wrangling. I have information from several sources which I'll be using to create valuations on players, etc... So with all this varying information comes, you guessed it, varying formats! And what better tools to use for lazy ETL than our dynamo-nosql-cloud-io-db or as the kids on the big bus call it: http://riak.basho.com.

I'd give the elevator pitch on what Riak is, but aside from me sounding like dozens of "foo-conf" talks and half-assed tech articles I'll trust in humanity that you want to know more and will click that link above. So...go click it, take the blue pill and continue reading.

Alright, back to my itch.

I have all these varying formats and I need to do statistical analysis on it. I have my handy dandy Riak cluster holding my data like it's that strand of small pox no one wants destroyed and I have the fantastic R language for me to get some dead simple analysis rolling on said data.

A match made in heaven, right? Well, sorta. I could take the easy way out, extract all of the bucket's JSON into an R data frame with an existing library, but I like to tinker and it seemed to me that it could be useful for someone else (eventually). The trouble with this approach is all the bloated NA pockets I would end up with, if the JSON isn't uniform I'd end up with something sort of resembling a sparse matrix. I just wanted something uniform that only handed me the information I was interested in and so was born https://github.com/bradfordw/riak_csv

It's currently very naive, once you get it started, navigate to http://127.0.0.1/csv/bucket_name and if your bucket exists, it will get the list of keys from this bucket, analyze the first entry in the bucket, use that entries properties as the columns for your CSV output and then rip through the rest of the bucket extracting only those properties from each subsequent entry.

So the upside here, is that I can just call via R the riak url using the httpclient() to load in my data and end up with a more trivial parsing (client-side) on the information I wish to work with.

And that's it, once again the url to the library is: https://github.com/bradfordw/riak_csv

A kinder, more functional Nashville

Hello Friends,

I'm writing you today because of a somewhat one-off conversation over Twitter with another developer here in Nashville regarding Erlang. I'm a bit saddened by the lack of functional-programming speak in the technology sector here in Nashville and would like to take a step towards introducing it (whether you like it or not) in an easy to follow (as in with a beer) manner.

So, whether you'd like to learn about Erlang, Clojure, Haskell, OCaml, et. al, show a little support and fill out the survey below. I have some early commitments from some great speakers outside of Nashville to drop by and talk specifically on and in the realm of Erlang.

The survey is as follows:

Filed under  //   functional   nashville   pray for free beer  

Kenny Hitchcock invited to watch training camp as Admiral Ackbar shakes head in disgust

Ansar Khan from MLive reported today that Ken Hitchcock (the one who was fired from that team in Ohio that has 1 good player) asked Coach Babcock if he could come up to Traverse City during the first few days of training camp to get a feel for how they run things. Babs was quoted as saying: "Hitch has been around winning his whole life, he loves hockey. If he can get something from us and we can get something from him, that’s a bonus situation.’’

Media_httpblogtownpor_abzqd

See here: http://www.mlive.com/redwings/index.ssf/2010/09/ken_hitchcock_invited_to_watch.html

Specifying default slot values for defrecord classes in Clojure | cemerick

This shared from: cemerick.com

Clojure’s datatypes are mana in a variety of ways.  In particular, for application-level programming, defrecord is the near-ideal construct — baked-in protocol support, Java interface interop, direct field storage of slots, fast keyword “accessors”, fast-as-Java method implementations…the list of goodness goes on and on.

Of course, there’s always room for improvement.  One big pain point for me was that I have a couple of records that, due to the domain, have a lot of slots, each of which needs to have a specific default value.  defrecord‘s generated constructor doesn’t provide for any kind of default value for slots.  The naive solution would be to write a factory function that aligned its arguments with some defined set of defaults, but that sounded painful from the start: slot definitions are then functionally spread over multiple forms and the handling of arguments into that factory function would either be a maintenance or performance nightmare.

It’s good to avoid macros as much as you can, but cases like this is where they shine:

01 (defmacro defrecord+defaults
02   "Defines a new record, along with a new-RecordName factory function that
03    returns an instance of the record initialized with the default values
04    provided as part of the record's slot declarations.  e.g.
05    (defrecord+ Foo [a 5 b \"hi\"])
06    (new-Foo)
07    => #user.Foo{:a 5, :b \"hi\"}"
08   [name slots & etc]
09   (let [fields (->> slots (partition 2) (map first) vec)
10         defaults (->> slots (partition 2) (map second))]
11     `(do
12       (defrecord ~name
13          ~fields
14          ~@etc)
15        (defn ~(symbol (str "new-" name))
16          ~(str "A factory function returning a new instance of " name
17             " initialized with the defaults specified in the corresponding defrecord+ form.")
18          []
19          (~(symbol (str name \.)) ~@defaults))
20        ~name)))

This macro is breaking my general rules of thumb that no def form should define more than one entity (here, a class and a factory function), and that def forms shouldn’t create vars with generated names.  Unfortunately, I don’t think there’s any other better approach to be had given what I’m aiming to do.

There’s an example in the docstring for defrecord+defaults, but let’s take a look at some possible usage in a REPL interaction:

01 user=> (defrecord+defaults SomeClass
02          [size 0
03           root nil
04           color java.awt.Color/black])
05 user.SomeClass
06 user=> (doc new-SomeClass)
07 -------------------------
08 user/new-SomeClass
09 ([])
10   A factory function returning a new instance of SomeClass initialized with the defaults specified in the corresponding defrecord+ form.
11 nil
12 user=> (new-SomeClass)
13 {:size 0,
14  :root nil,
15  :color
16  #<Color java.awt.Color[r=0,g=0,b=0]>}
17 user=> (assoc (new-SomeClass)
18          :size 1
19          :root "foo")
20 {:size 1,
21  :root "foo",
22  :color
23  #<Color java.awt.Color[r=0,g=0,b=0]>}

Yup, macros to the rescue (yet again!). What’s particularly handy about this is that the defined defaults can be any Clojure expression, which is evaluated each time the factory function is invoked. A neat future enhancement would be for the factory function to have a keyword-argument override that takes slot names and values that supersede the corresponding defaults provided in the defrecord specification.

I wouldn’t be surprised if something like this ends up in Clojure itself eventually, as a specialization of a future defrecord factory function facility.

 

It's like a schema for your classes! But without the horrid after-taste...

My First Blog Post

Curious about posterous...giving it a try.