Archive for January, 2008

Could an ISP Rewrite Online Advertisements?

Wednesday, January 30th, 2008

Some hippies at the Maker Faire convinced me to get a free wireless router from Meraki a few months back. It boosted my wireless signal and let all my neighbors share my internet connection. I was fine with this, but at some point the firmware updated itself to start putting ads at the top of the page so I shut it off.

But this got me thinking: instead of putting ads at the top of the page, why not just rewrite affiliate links in the content it found? (Big online retailers and others let you embed a marker in links that you display and then give you a cut of the profit you make off people that follow the links. This is how a lot of little startups and publishers make a profit on the web.) But why stop there? Why not overwrite the Google adsense and adwords ads to your own ads? Honestly, I’m not sure I would care if they did that and they would make a ton of money.

I’ve heard that some adware and viruses do this. But why isn’t Firefox/IE doing this? Firefox has a popup blocker, why not a popup rewriter? And who makes those third party online ad blockers? Are they legal? What about an app that instead of blocking online ads redirected them to a different ad and gave the ad revenue to charity?

The big question: why aren’t ISPs doing this? An ISP could pay YOU to surf the internet if they could get even a fraction of the revenue Google makes off your searches. Would it be illegal? It must be illegal or people would do it, right?

Investing in Athletes

Monday, January 28th, 2008

Slate pointed me to a new kind of investment company: Real Sports Investments. They buy a fraction of an athletes future earnings and sell it to investors. You can actually buy shares in all future earnings of a minor league pitcher named Randy Newsom right now. It’s a cool idea, and I would have bought a few shares for fun, but the ROI looks outrageously bad. The “market cap” of Randy Newsom’s earnings is 1,250,000 dollars and even if I’m completely risk neutral I just can’t believe that the expected value of a minor league player’s salary is anywhere close to that. They take >10% in fees as well. But I wonder if people will do this kind of investment for fun.

Data Frame

Saturday, January 19th, 2008

I’ve been doing a lot of data analysis in Ruby lately. In the past I did a lot of data analysis in R, and I love R, but it has always driven me a little crazy. As part of a two man startup the majority of my coding time is spent on just making the basic infrastructure work and since most of the code is already in Ruby I end up wanting to do basic analysis in Ruby.

The one feature I really miss from R is all the crazy array indexing things you can do. This is probably the best feature of R besides the amazing set of statistics libraries.

For example, if “a” is a matrix of data that looks like [[1,2,3][4,5,6][7,8,9]] you can say things like

a[a<2] = 4

And it will take all the elements less than 2 and set them to 4. This kind of flexible lookups and setting is really useful for data cleanup and exploration.

There are ruby libraries that have some of this matrix functionality, such as NArray, but for data analysis I really wanted something with named rows and columns and fancy ways to look up those names.

I’ve been slowly building up a library that does this, which you can find on rubyforge at http://rubyforge.org/projects/dataframe.

The first functionality I built which is already really useful to me is just to be able to look things up by names row or column, you can pull parts of the array out by name, number, regex on the name, or even an arbitrary function on the name:


def test_basic_partial_lookups
d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
assert(d["snake",true] == D[{"length" => 10, "height" => 1}])
assert(d["snake",true] == D[1, 10])
assert(d["snake"] == D[1, 10])
assert(d[true, "height"] == D[[10], [1]])
assert((d/”height”) == D[[10], [1]])
end
def test_array_lookups
d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
assert(d[["snake", "giraffe"], ["height"]] == D[[1], [10]])
assert(d[["giraffe", "snake"], ["height"]] == D[[10], [1]])
assert(d[[0,1], 0] == D[[10], [1]])
assert(d[[1,0], 0] == D[[1], [10]])
end

def test_regex_lookups
d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
assert(d[/nak/, /.*/] == D[10, 1])
assert(d[/CANTFIND/, true].nil?)
end

def test_proc_lookups
d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
d[Proc.new {|v| v == "snake"}, Proc.new {|v| v != "height"}] = 1
end

The second useful thing is to be able to set slices of the matrix, i.e.


def test_set_atomic
d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
assert(d == D[[10, 3], [1, 10]])
d["giraffe", "length"] = 2

assert(d == D[[10, 2], [1, 10]])

d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
d[0,0] = 2
assert(d == D[[2, 3], [1, 10]])

d[2,2] = 6
assert(d == D[[2, 3, nil], [1, 10, nil], [nil, nil, 6]])

assert_raise(RuntimeError) { d[-1,2] = 0}
assert_raise(RuntimeError) { d[2,-1] = 0}

d[2,5] = 10
pp d
assert(d == D[[2, 3, nil, nil, nil, nil], [1, 10, nil, nil, nil, nil], [nil, nil, 6, nil, nil, 10]])
end

def test_set_vector
d = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
d[0] = D[2,2]
assert(d == D[[2, 2], [1, 10]])
d["giraffe"] = D[3,3]
assert(d == D[[3, 3], [1, 10]])
d[true,1] = D[[4],[4]]
assert(d == D[[3, 4], [1, 4]])
d[true,"height"] = D[[5],[5]]
assert(d == D[[5, 4], [5, 4]])
d[true,"age"] = D[[4], [3]]
assert(d == D[[5, 4, 4], [5, 4, 3]])
end

def test_set_matrix
d1 = DataFrame[{"snake" => {"length" => 10, "height" => 1}, "giraffe" => {"length" => 3, "height" => 10}}]
d2 = DataFrame[{"car" => {"length" => 9, "height" => 5}, "truck" => {"length" => 10, "height" => 6}}]
d1 << d2
assert(d1 == D[[10,3],[1,10],[5,9],[6,10]])
d1[["snake", "car"], true] = D[[5,6], [7,8]]
assert(d1 == D[[10,3],[5,6],[7,8],[6,10]])
d1[["car", "snake"], true] = D[[5,6], [7,8]]
assert(d1 == D[[10,3],[7,8],[5,6],[6,10]])
d1[["car", "snake"], ["length","height"]] = D[[5,6], [7,8]]
assert(d1 == D[[10,3],[8,7],[6,5],[6,10]])
end

The final thing is to add R’s “which” operator functionality, which I haven’t done yet. But this 400 line library has served me really well so far. It’s open source if you want to contribute :).

Galileo

Friday, January 18th, 2008

All the complaining about the Pope defending the burning of Galileo reminds me of a question I’ve had since I was a kid and never really gotten a satisfactory answer. How is it “truer” to say that the Earth goes around the Sun than the Sun goes around the Earth?  Galileo probably thought God held the Sun fixed because it made modeling the location of other planets simpler, and the church clearly thought God held the Earth fixed. But now we should know better. They’re both traveling in roughly circular paths around each other. And other stuff goes around the Earth, i.e. the Moon. Just because all of our diagrams of the solar system have a fixed Sun doesn’t make it true.

Progressive Reading Series is Back

Tuesday, January 15th, 2008

Stephen Elliot used to host an awesome reading series at a bar near my house, and it’s back!  Pretty much every month there would be a contemporary author that I knew of (and you have to be a pretty famous author for a nerd like me to know you) and lots of great authors I never heard of.  So few people show up that you can actually meet the authors.  I highly recommend it.  And this month has Tobias Wolff!

 

Announcing The Return of the Progressive Reading Series

A monthly literary benefit to support progressive congressional candidates nationwide

When: Saturday, January 19, 7pm

Where: The Makeout Room – 3225 22nd Street, San Francisco, (415) 647 2888

Price: $10 - $20 sliding scale

January Beneficiary: Charlie Brown, running for Congress in California’s 4th district against Republican incumbent John Doolittle

 

Readers

Tobias Wolff author of Old School

Jami Attenberg author of The Kept Man

Ali Liebegott author of The IHOP Papers

Adam Johnson author of Emporium

Walter Kirn New York Times critic and author of The Unbinding

And comedian Nato Green

Hosted by Stephen Elliott author of Happy Baby and editor of the new anthology Sex For America

**

The progressive reading series happens on the third Saturday of every month though the 2008 election at 7pm at the Makeout Room in San Francisco.

For January 19 please purchase tickets online by making donations to Charlie Brown’s campaign through our Act Blue page. Just print out your receipt and bring it to the door. http://www.actblue.com/page/progressivereading

We strongly recommend getting tickets in advance as these events frequently sellout.

get on the Progressive Reading email list by sending an email to:

steves_list-subscribe@yahoogroups.com

Most Popular Posts

Monday, January 14th, 2008

I’ll soon be shutting down the old a-a-i blog. I thought it would be interesting to look back and see what posts got the most visitors before the information is lost forever. Here’s the top 10:

  1. How to Sketch a Polynomial
  2. Using Games to Generate Useful Data
  3. A New Proof of an Old Theorem
  4. Random Interesting Stuff
  5. WordNet
  6. Yahoo and China Censorship
  7. The Ecstacy of Influence
  8. Go Complex vs. Chess Complex
  9. Give All Your Money to One Charity?
  10. Harmonic Series

I’m not exactly sure what the number of visitors means. The b2evolution made some attempt to filter out crawlers, but I have no idea how well it did that. There’s definitely some bias towards older posts, since they’ve had more time to collect page views.

Welcome to lukasbiewald.com!

Tuesday, January 8th, 2008

Thanks for coming to the new blog.