Thursday, December 2, 2010
Only in America
I drove by Marriot in Stamford tonight and I realized something: a girl next door and President Obama both had a party there. Ashley (the daughter of a union man) had a birthday party a couple years ago and Obama had a fundraiser before the elections. Is this a great country or what?
On WikiLeaks
Not that anyone cared, but I feel like adding my opinion to the growing pile out there.
I think we have two very different things here: WikiLeaks itself and the leaker.
The leaker signed an agreement and swore an oath not to do what he did. He needs to be prosecuted and hopefully jailed.
WikiLeaks, on the other hand, never promised not to publish juicy bits. I think they are morally wrong, but they aren't doing anything illegal. They are no different from any other newspaper. We have no basis to prosecute them.
Wednesday, December 1, 2010
As heard on NPR
Professor Nash on Wikileaks: "Usually the historians get to see such documents after the state has already collapsed". Is US a walking corpse?
The future is here!
I am posting this from my Personal Communication Device (AKA T-Mobile G2). The 21st century has arrived! Can the 24th be far behind?
Monday, October 11, 2010
Stupid novice error in closures in Python
I am wrapping a bunch of functions in python, so that they could take different arguments:
What's wrong with this picture? All wrappers end up calling the same function - the last in the list.
Took me about half an hour to figure it out. Closure in Python wraps a _variable_, not the object that the variable holds like it does in Java. The variable is shared between all wrappers - it's "fun". So all wrappers end up calling whatever is the value of "fun" at the time of call to the wrapper - the last function in the list. At the time of call to the wrapper, not wrapper creation!
The solution is of course
Now each wrapper gets its own "fun" variable - the one inside the particular invocation of wrap_function. Hurray!
for fun in functions:
def wrapper(state):
return fun(state.current)
# store wrapper as wrapped function
What's wrong with this picture? All wrappers end up calling the same function - the last in the list.
Took me about half an hour to figure it out. Closure in Python wraps a _variable_, not the object that the variable holds like it does in Java. The variable is shared between all wrappers - it's "fun". So all wrappers end up calling whatever is the value of "fun" at the time of call to the wrapper - the last function in the list. At the time of call to the wrapper, not wrapper creation!
The solution is of course
def wrap_function(fun):
def wrapper(state):
return fun(state.current)
return wrapper
for fun in functions:
wrapped_function = wrap_function(fun)
Now each wrapper gets its own "fun" variable - the one inside the particular invocation of wrap_function. Hurray!
Saturday, July 31, 2010
Home ownership - it ain't what it used to be
Back before the days of easy credit brought by the tax money, owning a home used to mean something. A home owner was a man of substance, possessed of the REAL property, most probably a link in a chain of generations. Mr. Jones of Trumbull, Connecticut.
Nowadays, it's a bit different. Just like you're expected to move out from your parents' house, you're expected to buy your first condo. Then your large family house. Then you sell it all and move to Florida. Then you die, leaving your kids a bunch of money (maybe) and not a pile of stones. Mr. Ivanov of somewhere within commuting distance to Wall Street.
I am one of the beneficiaries of this process, and I hate it anyway. Not much difference, nowadays, between renting and owning. Hard to call your house "my fortress" when you pay for it monthly, and will keep paying till you sell it. When Homeowners Association, insurance and zoning laws are as restrictive as any landlord about things you can do with "your" "property".
I am not sure I want the old days back. I am not even sure we could bring them back if we tried. But we have to realize that the kind of home ownership we have now is hardly the noble thing we hoped for. And, therefore, may not be worth quite so much.
Nowadays, it's a bit different. Just like you're expected to move out from your parents' house, you're expected to buy your first condo. Then your large family house. Then you sell it all and move to Florida. Then you die, leaving your kids a bunch of money (maybe) and not a pile of stones. Mr. Ivanov of somewhere within commuting distance to Wall Street.
I am one of the beneficiaries of this process, and I hate it anyway. Not much difference, nowadays, between renting and owning. Hard to call your house "my fortress" when you pay for it monthly, and will keep paying till you sell it. When Homeowners Association, insurance and zoning laws are as restrictive as any landlord about things you can do with "your" "property".
I am not sure I want the old days back. I am not even sure we could bring them back if we tried. But we have to realize that the kind of home ownership we have now is hardly the noble thing we hoped for. And, therefore, may not be worth quite so much.
Tough sell
I've got a flier from a cell phone company recently. Funny, there was nothing there about their great services. The whole thing was about great PHONES they had available. The phones they don't make. The phones that they do their best to cripple, disabling features the consumers like me want.
It's hard to be a wireless provider nowadays. All you can advertise is the price that's too high and a bunch of restrictions on usage that make your customer life harder. Better not mention it at all and concentrate on wonderful things other people sell.
It's hard to be a wireless provider nowadays. All you can advertise is the price that's too high and a bunch of restrictions on usage that make your customer life harder. Better not mention it at all and concentrate on wonderful things other people sell.
Subscribe to:
Posts (Atom)