20120407

why was it not a gg?


After playing this game:


Me: gg
WrathofKane: it was not you suck i just sent my stuff to attack you... or you lose
Me: thats odd
why was it not a gg?
WrathofKane: cause i dint win
Me: :)
WrathofKane: you can call gg if you lose but it is not unless i win
Me: sweet
WrathofKane: and you saying it after i left means you are a cunt

20120323

buying an apartment in nyc


A friend asked me for advice about buying an apartment in NYC.

I wrote:

Buying a house means buying a job – as a property owner and manager.

Transaction costs are about 9% round trip.

Streeteasy, propertshark, ACRIS and Curbed are really important resources that you should be intimately familiar with pre-transaction.  Think of them collectively as your Bloomberg terminal. Also interesting are the Case-Shiller city indexes.  Millersamuel.com used to have great data available free – timeseries going back 15-20 years on co-op and condo sales -- and now it’s all behind a paywall.

New York Times has the best buy vs rent calculator.  http://www.nytimes.com/interactive/business/buy-rent-calculator.html

Check out its ADVANCED SETTINGS.  You’ll see that how long you own the place is really important to the buy-vs-rent calculus.  Also important is the rate of return you could be earning on the downpayment if you hadn’t bought a house.  That’s also in the ADVANCED SETTINGS.

Adverse selection is alive and well in the real estate market.  Places will have problems that are not apparent at first look.  Some of this can be mitigated, some of it can’t.  For example, if you do plan to fix it up, you could pick the general contractor first, and then have them survey the place before you buy it, and even make a binding bid to fix it up before you buy it.

It is entirely possible to construct a good estimate of construction costs in advance, but it will take some arm-twisting to get this to happen before you’ve bought the place.  The seller and the contractor will both fight to prevent this from happening.

Most of the fun things that you might want to do with a bought property could maybe also be done with a rented one?  If you shop for a rental with that feature in mind.

Since you brought up schools – the NYC school situation is changing rapidly.  Currently in Manhattan, there is a severe supply/demand problem between parents and schools.  I see the imbalance being resolved mostly by parents choosing to move out, as we did to Park Slope.  Not sure how that affects the Manhattan real estate situation.

Before buying any place, I recommend becoming intimately familiar with its local school dynamics, not because you personally will care, but because the next buyer might. For example, PS 3 and PS 41 have been threatening to change their service boundaries for a few years, which is driving people nuts in the affected areas.   Something similar is happening in Park Slope around 5th Avenue.

20120309

Rails is driving me mad, part 2

In django/python, in development, whenever I change any source file it's automagically reloaded.

In RoR, this is true for some source files, but notably not the source files in my lib directory.

There's a way to fix that:
http://stackoverflow.com/questions/2129458/automatically-reload-rails-module/2138935#2138935

But why is this in an obscure SO question/answer, and why doesnt Rails automagically do the right thing?  And why does Rails permit you to do it wrong, for example by using require instead of require_dependency?

20120306

Rails is driving me mad, part 1

In django, if a robot is spidering through your site and hitting non-existent links, you can suppress the email warnings about 404s with a simple configuration change, as explained here.

So how does one do this in Rails?

After a half-hour of fruitless searching I stumbled across this blog post and this piece of software.  The software does a lot more than I want, in particular it takes over the exception notification mechanism.  So I followed the instructions in the blog post, copy-pasting the code into my app, and so far it seems to be working OK.

This is not the magical experience I was promised!

20120206

Data Mining Degree?

The Data Collective blog just received the following solicitation:

Hello,

I am Matt with WebSponsors.org. My company represents a leading provider of online education. They would like to purchase ad space on your site's page - blog.datacollective.org/hacking-education-data-analysis-submission-tips-for-success-by-the-numbers.

It would look like...

"data mining degree"

with a link to our client's site. We can pay you $65.00 via PayPal as soon as an agreement is made for this ad space.

Please let me know if you are interested. Thanks for your time & consideration.

Matt
matt@websponsors.org
1-888-853-3601

Disclaimer: You have been selected to participate due to the high-quality of your website. If you accept to place this advertisement on your website, you are accepting the Advertiser Program Policy which can be found at http://www.websponsors.org/advertiser-program-policy.php. WebSponsors.org reserves the right to accept or reject this offer for an advertising placement on your website.
Reference Code: 782034#

20120204

MIT Battlecode!

Two Sigma has been a sponsor of MIT Battlecode for six years now. It's a programming tournament where teams of kids spend a month coding a virtual robot army to battle against other students' virtual robot armies.

Here's what a match looks like:

There's a lot going on in a battle, and it can be confusing. So today my colleague Lee Lin and I coded up some analysis to help us understand what's going on during a match. The x-axis is location on the battlefield -- the left side is one team's home base and the right side is the other team's. The y-axis is the amount of fighting force each team has at that location. We've taken the 2-D battlefield and projected it onto the axis running between the two bases.

The Battlecode code is all java so we started the analysis there. The AffineTransform class came in handy for the projection math. The java code dumped its frame-by-frame data in as valid JavaScript code. The visualization is a Highcharts chart being manipulated by JavaScript code on a simple timer.

The core of the updating code is offensively simple:

function updateData() {
  for (i=0; i<2; i++) {
    chart.series[i == 0 ? 1 : 0].setData(thedata[roundNum][i]);
  }
  if (roundNum < thedata.length-1) {
    roundNum++;
  }
  setTimeout(updateData, 15);
}

The chart is in an object called "chart". The data for the entire match is in a two-dimensional array called "thedata". The function "updateData()" gets called every 15 milliseconds -- we'd like a framerate of 60fps if possible. At the end of updateData() we call setTimeout() which asks JavaScript to call updateData() again in 15 millis.

20120127

Ruby/Rails is confusing for noobs

Here are my questions about Ruby/Rails:

  • After automagically generating the model/view/controller code for a given object, I then want to customize the HTML/CSS/JS for some of its views.  What's the right way to do this?  Do I directly edit the files like "show.html.erb"?  If I do, then don't I lose the ability to automagically update them when I add fields to that object?
  • ERB vs HAML appears to be a religious war... has anyone cleanly summarized the pros and cons?  I would rather not choose randomly, nor spend two hours reading articles about this just so I can decide.
  • Rails 3.2 came out on Jan 20.  Should I use it?  Are Rails releases typically well-tested upon release, or do they typically have bugs that I should hang back and let other people find?
  • Speaking of Rails 3.2, the wonderful site http://api.rubyonrails.org/ seems to have already switched to showing the 3.2 API.  But I'm using 3.1... how can I see the 3.1 API documentation?  Shit, just noticed that http://guides.rubyonrails.org/ switched over to 3.2 as well.  Must I therefore switch?
  • To generate the 3.1 documentation on my own machine, are these the steps I must follow?  http://www.nullislove.com/2007/05/29/rails-documentation/  This post is from 2007, I expect things have changed since then!  Here's more confusing garbage from 2007: http://www.ruby-forum.com/topic/113997  Sadly all the top hits appear to be from 2007.
  • Where do I put the static images that my site is serving?  /public/images or /app/assets/images?  I would like to use image_tag to generate my image tags.  http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html claims that "By default, Rails links to these assets on the current host in the public folder" , but in my own system the generated image_tag has a src of "/assets/img.png" which ends up being served from the directory /app/assets/images.  So, the docs are lying, they are not linked to the public folder.  Or is my setup misconfigured somehow?  Which files in my setup control this behavior?

Here are the meta-questions:
  • Where can I find best-practice source code for non-trivial sites built in Ruby/Rails?  I could then mine that code as a source of examples.
  • Where are the best up-to-date tutorials and references for Ruby/Rails?  Videos don't count because they're not searchable and their effective bit-rate is excruciatingly low, compared to well-written text.  http://guides.rubyonrails.org/ is nice but appears to leave many important questions and issues unanswered
  • Where can I best find out how to do X with Ruby/Rails?  For example I want to use jquerymobile for my UI.  What's the best way to integrate jquerymobile into Ruby/Rails?  Should I use a Gem?  There appear to be three competing gems for this.  And on further inspection they each seem to be pretty trivial, and potentially out of date.