The emergence of dudebro

Media_http3bpblogspot_hbvhp

What is it about some internet communities that band together to do something? Is it perhaps for the lulz? In this case, it reminds me of some group projects I had to work with these other guys in junior high. If we had some project to do, it would turn into a large production. It was often imagination running wild, mostly for the laughs of the idea, since we couldn’t actually do them.

But here, I guess is not only imagination rampant, but people can do something about it. So as a form of oneupsmanship, they start putting up screenshots, mockups, which stirs the imagination of others to join in on the oneupsmanship.

And perhaps it’s because it’s so ridiculous that people realize it could never be done elsewhere, so it might as well be done here. Because no one’s going to be losing their job over Dudebro. And like snakes on a plane, it just seems like something that should exist.

If someone has a clue, enlighten me. Because as far as I can tell, the most HN‘s been able to produce has been co-founder dating sites.

Game mechanics roundup

Last week, I went to some meetup, and I met someone that was looking to make a game out of doing things in real life.  It’s not really a new concept, but I don’t think people really understood it until recently with foursquare and gowalla.  
Mobtropolis was suppose to be something that improved your life experiences as you got better at the game.  But My execution sucked, and I didn’t know where to find users.  But like someone said to me, just because you wandered around in the desert doesn’t mean you found the treasure.  Lots of other people wandered there, you just don’t know about it–I mean, how many people knew about Mobtropolis?  
Anyway, it was good to hear about people interested in gaming mechanics in applications.  I don’t think there are hardly any games that were hard to figure out how to use it.  It may be that games copy each other a lot, or because it’s because I was persistent as a teen gamer.
If you’re interested in game mechanics in applications, here’s a round up.  We can start with Amy Jo Kim with “Putting the fun in functional”
here are her slides:

However, just because you put points on something isn’t quite enough to motivate people to do things in real life.  Here’s another oldie, but goodie about the Theory of Fun  (here’s the book).  
You can also use games as a way of motivating people to do grunt work.  Here’s the ESP game.  He basically concocted a game for people to play that generates test data for machine learning algorithms to learn image recognition.  Here’s the fascinating talk about it by the professor that invented it, Luis von Ahn.  
There’s also a protein folding game for people to compete on how to compactly fold proteins.  Some people do a lot better and faster than computers doing a search.
And a TED talk about how gaming in real life can safe the world.  See a pattern yet?
I play casual games at one more level.  They post one every day of the working week, without all the annoying ads.  They’re all casual games that you can pick up easily.  
Long live games.

 

Chat roulette as a platform for new video content formats

I thought this was pretty interesting use of chatroulette.

When we first got TV cameras, we just video broadcasted radio shows–which became late night talk shows. Eventually, we figured out that you can shoot shows with different formats, from sitcoms to reality TV.

It seems like we’re exploring different formats of internet video, chatroulette being one of them. Sure, you can chat with people, with chatroulette, but if you can come up with something interesting that interacts with the person on the other end, you essentially have a never-ending stream of people as an audience on chat roulette.

In addition, when you record your performances to one person over the chat, you can broadcast it on justin.tv or youtube. Plenty of enjoyment to be had from watching these records, as shown by the video above, as well as the original people in the video getting their 15 mins of fame.

Whoever figures this formate out first is going to have a lot of fast followers and land grab. This is the story that journalists are looking for on chat roulette, not that chatroulette is like playing russian roulette with cocks in five of the chambers.

One of the YC companies in our batch did something like chat roulette, but as video speed dating facebook app. I thought it was pretty brilliant, but somehow they never pursued it. I have no idea why.

How to alter columns in postgresql

So here’s a goodie for those of you using postgresql.

Let’s say you have a migration to do where you need to change a column from an integer to a boolean.  So if you’re doing a rails migration, you might write something like

1
2
3
4
5
6
7
8
class ChangeDatatableAttributes < ActiveRecord::Migration
  def self.up
    change_column :datatables, :is_numeric, :boolean
  end
  def self.down
    raise ActiveRecord::IrreversibleMigration.new
  end
end

And then postgresql throws up (well, it does on Rails 2.3.5):

==  ChangeDatatableAttributes: migrating ======================================
— change_column(:datatables, :is_numeric, :boolean)
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  column “is_numeric” cannot be cast to type boolean
: ALTER TABLE “datatables” ALTER COLUMN “is_numeric” TYPE boolean

Well, that’s no good.  The web was not exactly much help here, but I managed to find this in the postgresql docs:

the USING expression is not applied to the column’s default value (if any); the result might not be a constant expression as required for a default. This means that when there is no implicit or assignment cast from old to new type, ALTER TYPE might fail to convert the default even though a USING clause is supplied.

Looks like you need to drop the default also, and then set it afterwards.

1
2
3
4
5
6
7
8
9
10
11
12
13
-- change a column named "is_numeric" from integer to boolean
ALTER TABLE sometable ALTER COLUMN is_numeric DROP DEFAULT;
ALTER TABLE sometable ALTER COLUMN is_numeric TYPE boolean
  USING CASE is_numeric
    WHEN '1' THEN true
    ELSE 0 END;
ALTER TABLE sometable ALTER COLUMN is_numeric SET DEFAULT true;

-- change a column named "multiplier" from string to integer
ALTER TABLE sometable ALTER COLUMN multiplier DROP DEFAULT;
ALTER TABLE sometable ALTER COLUMN multiplier TYPE integer
  USING CAST(multiplier as INTEGER);
ALTER TABLE sometable ALTER COLUMN multiplier SET DEFAULT 1;

Or if you’d like, create a method that you can throw into a module to mixin.

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
# used to alter columns in postgresql
module AlterColumn
  def alter_column(table_name, column_name, new_type, mapping, default = nil)
    drop_default = %Q{ALTER TABLE #{table_name} ALTER COLUMN #{column_name} DROP DEFAULT;}
    execute(drop_default)
    # puts drop_default

    base = %Q{ALTER TABLE #{table_name} ALTER COLUMN #{column_name} TYPE #{new_type} }
    if mapping.kind_of?(Hash)
      contains_else = mapping.has_key?("else")
      else_mapping = mapping.delete("else")
      when_mapping = mapping.map { |k, v| "when '#{k}' then #{v}" }.join("n")
      
      base += %Q{ USING CASE #{column_name} #{when_mapping} } unless when_mapping.blank?
      base += %Q{ ELSE #{else_mapping} } unless contains_else.blank?
      base += %Q{ END } if !when_mapping.blank? or !contains_else.blank?
    elsif mapping.kind_of?(String)
      base += mapping
    end
    base += ";"
    
    execute(base);
    # puts base
    
    unless default.blank?
      set_default = %Q{ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET DEFAULT #{default};}
      execute(set_default)
      # puts set_default
    end
  end
  module_function :alter_column
end

And use it like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class ChangeTableAttributes < ActiveRecord::Migration
  class << self
    include AlterColumn
  end
 
  def self.up
    alter_column :sometables, :is_numeric, :boolean, { "1" => true, "else" => false }, true
    alter_column :sometables, :multiplier, :integer, "USING CAST(multiplier AS integer)", 1
  end

  def self.down
    raise ActiveRecord::IrreversibleMigration.new
  end
end

Or if all else fails, you can just follow Heroku’s advice and just drop the column and create another.  Tip!