Archive for March, 2011

Facebook Revolution?

March 31, 2011

The protestors in Tahrir Square, Cairo, explicitly gave credit to Facebook and Twitter for sparking the revolution in Egypt, as well as others across the Middle East and North Africa. Does Facebook and Twitter deserve this credit? I think they earned a tiny little bit of credit, while the kids getting shot at and beaten deserve all the credit for overthrowing their dictators. Check out this animated video of a brief talk by Steven Pinker. He says individual knowledge is when everyone believes that the dictator sucks. But that’s not enough. Mutual knowledge is when everyone knows that everyone else also knows that the dictator sucks. Normally, the dictator would control all means of mass communication (TV, radio, press) and kill anyone who tried to spread word that the dictator is bad. But with the Internet this is practically impossible now. Using Facebook or Twitter a message such as “this dictator sucks!” can spread quickly through a key demographic (young protesters) and create mutual knowledge. So in that sense, social media is an uncontrollable means of mass communication that can help inspire and organize change. They deserve credit for this. But how might one build a website dedicated to inspiring revolutions? What would it look like? Facebook and Twitter would just help spread the message virally. I’m sure someone is putting it together now.

Groupon is Woot

March 24, 2011

Groupon is just Woot for small businesses. Whereas Woot disposes of junk at very low prices, Groupon claims to be a better way for small businesses to attract customers. Unfortunately, for many businesses their deep discounts are their undoing. Most customers are buying coupons with no intention of becoming repeat customers. Groupon is now a deal a day site that fails to convert customers into regulars. Their model has to change before small businesses catch on to this gimmick.

Groupon needs to qualify customers. That means limit the coupons to customers most likely to pay full price for that service. For example, if they saw that you regularly pay $100 for a salon haircut, then comparable competitors can offer you coupons to try and lure away your business. But it would be useless to give me a coupon because I have never paid more than $15 for a haircut. Mint is in a great position to do this, as is Blippy. Even Yelp or Opentablecould do this for restaurants. Groupon should partner with these types of companies to offer more relevant coupons to qualified customers.

NYTimes subscription announced

March 17, 2011

The NYTimes finally announced their online subscription plan. It’s $15/month, $20 for the iPad app, or $35 for some undefined all-access plan. They allow casual users to view 20 stories a month for free. I have a great deal of sympathy for newspapers. They deserve to be paid for their work, and the price is equivalent to 4 Starbucks lattes. The problem is most people browse different news sources and it’s annoying to have to pay for each one. It would be better if newspapers adopted the cable model: a single bill gives access to lots of news sources.

I wonder how this will effect Flipboard on the iPad. The NYTimes will allow links from Google, Facebook and Twitter for free. What about links from Flipboard which aggregates those Facebook(?) and Twitter links? What if I just spider the Times and stick the links on Twitter? I think they will put a limit on those links, too.

[edit]The WSJ charges $12/month and nothing extra for their iPhone and iPad apps. For the first year, it’s only $8/month. So why is the NYTimes charging so much more than the WSJ?

AA Tree in Haskell

March 9, 2011

Here’s an implementation of an AA tree, which is a simplified balanced binary tree algorithm. I’m just trying to sharpen my very rusty Haskell programming skillz. I wish the popular match macro for Scheme had guards like Haskell. Instead, the match macro has an uber-powerful fail continuation that is overkill for most situations. Anyway, this code isn’t so great, but it seems to work.

data AATree a = Node { level :: Int, 
                       left :: AATree a, 
                       value :: a, 
                       right :: AATree a }
              | Nil deriving (Show, Eq)

skew :: AATree a -> AATree a
skew (Node n (Node ln ll lv lr) v r) 
    | ln == n = Node ln ll lv (Node n lr v r)
skew t = t

split :: AATree a -> AATree a
split (Node tn a tv (Node rn b rv x@(Node xn _ _ _))) 
    | tn == xn = Node (rn+1) (Node tn a tv b) rv x
split t = t

insert :: Ord a => AATree a -> a -> AATree a
insert (Node n l v r) x | x < v = fixup (Node n (insert l x) v r)
                        | x > v = fixup (Node n l v (insert r x))
                        where fixup = split . skew 
insert Nil x = Node 1 Nil x Nil 

tpred :: AATree a -> a
tpred (Node _ _ v Nil) = v
tpred (Node _ _ v r)   = tpred r 

tsucc :: AATree a -> a
tsucc (Node _ Nil v _) = v 
tsucc (Node _ l v _)   = tsucc l 

lvl :: AATree a -> [Int]
lvl Nil = [] 
lvl (Node n _ _ _) = [n]

declvl :: AATree a -> AATree a
declvl t@(Node n Nil v Nil) = t 
declvl (Node n l v Nil) | s < n = Node s l v Nil
                        where s = level l + 1 
declvl (Node n l v (Node rn rl rv rr)) 
    | s < n && s < rn = Node s l v (Node s rl rv rr)
    where s = minimum (lvl l ++ [rn]) + 1 
declvl t = t

remove :: Ord a => AATree a -> a -> AATree a
remove (Node n l v r) x | x > v = Node n l v (remove r x)
                        | x < v = Node n (remove l x) v r
remove (Node n Nil v Nil) x | x == v = Nil 
remove (Node n Nil v r) x | x == v = Node n Nil s (remove r s)
                          where s = tsucc r
remove (Node n l v r) x | x == v = Node n (remove l p) p r
                        where p = tpred l 
remove t x = t

delete :: Ord a => AATree a -> a -> AATree a
delete Nil x = Nil 
delete t x 
    | a == Nil = Nil 
    | right a == Nil = let Node n l v r = split a in Node n l v (split r)
    | otherwise = let Node n l v r = a
                      Node rn rl rv rr = skew r 
                      Node b c d e = split $ Node n l v (Node rn rl rv (skew rr))
                  in Node b c d (split e) 
    where a = skew (declvl (remove t x))


Get every new post delivered to your Inbox.