Friday, April 30, 2010

CURDATE() in Oracle and MySQL

There's a big difference between CURDATE in Oracle and MySQL: Although they look similar, in Oracle, the following will work:

CURDATE + 1 or CURDATE -1 wil give you today's date +/- 1 day

However, in MySQL, the following seems to work:

CURDATE() + 1

However, it doesn't actually do a date calculation, it just adds 1 to the integer returned by CURDATE()! So that, if today is 2010-04-30, then

CURDATE() + 1 in MySQL returns 20100431 -- which is a nonsense date!

This can bite you hard if you don't suspect it, since it seems to work just fine most of the time, just not around month boundaries!

Instead, you need to use the ADDDATE(CURDATE(), INTERVAL 1 DAY) syntax in MySQL to get the correct behavior.

Sunday, April 19, 2009

How the banks are impeding economic recovery

The following article from the May 2009 Atlantic is a must-read for anyone who's curious about how we got into the present economic mess: The Quiet Coup, by Simon Johnson.

Johnson is a former IMF economis, now working at MIT's Sloan school, who has seen many other countries, mostly third-world, going through the same economic crisis that we now see in the US and worldwide. The usual cause of the problem, and the most difficult barrier impeding actual recovery, from his IMF experience, are the oligarchs running the financial system, and the government, of the countries in question.

His argument is that the US has become like a banana republic, in that it's being held hostage by a financial elite that got us into this mess, and is now resisting with all its might any change that would reduce its power.

In effect, the debate over who was most to blame for the financial crisis: lack of government regulation, or overoptimistic bankers, is a false dichotomy. In a sense, they are part of the same problem: the US is being run by financial elites who believe they are above law and any other power.

In its depth and suddenness, the U.S. economic and financial crisis is shockingly reminiscent of moments we have recently seen in emerging markets (and only in emerging markets): South Korea (1997), Malaysia (1998), Russia and Argentina (time and again).
...
But there’s a deeper and more disturbing similarity: elite business interests—financiers, in the case of the U.S.—played a central role in creating the crisis, making ever-larger gambles, with the implicit backing of the government, until the inevitable collapse. More alarming, they are now using their influence to prevent precisely the sorts of reforms that are needed, and fast, to pull the economy out of its nosedive. The government seems helpless, or unwilling, to act against them.


Scary stuff, but essential for understanding where we are right now.

Tuesday, July 01, 2008

Kill -9

If you don't know that "kill -9" refers to, I don't recommend listening to this, because it won't make any sense...
(not safe for kids or work)

http://www.monzy.com/intro/killdashnine_lyrics.html

Here's a sample of the lyrics (though you gotta listen to the song for the full effect):

My posse throws down like leaky bucket regulators;
I was coding shit in MIPS while you were playing Space Invaders.
With my finger on the trigger I run ./configure
Yo, this package is big, but MY package is bigger.
I roll my weed with Zig Zag while I zag-zig splay,
And I do a bounds check before I write to an array...

Awesome CompSci rap artists from Stanford

Tuesday, June 24, 2008

George Carlin clips



A prophet once said:

“The real owners are the big wealthy business interests that control things and make all the important decisions. Forget the politicians, they’re an irrelevancy. The politicians are put there to give you the idea that you have freedom of choice. You don’t. You have no choice. You have owners. They own you. They own everything. They own all the important land. They own and control the corporations. They’ve long since bought and paid for the Senate, the Congress, the statehouses, the city halls. They’ve got the judges in their back pockets. And they own all the big media companies, so that they control just about all of the news and information you hear. They’ve got you by the balls. They spend billions of dollars every year lobbying lobbying to get what they want. Well, we know what they want; they want more for themselves and less for everybody else.”

“But I’ll tell you what they don’t want. They don’t want a population of citizens capable of critical thinking. They don’t want well-informed, well-educated people capable of critical thinking. They’re not interested in that. That doesn’t help them. That’s against their interests. They don’t want people who are smart enough to sit around the kitchen table and figure out how badly they’re getting fucked by a system that threw them overboard 30 fucking years ago.

“You know what they want? Obedient workers people who are just smart enough to run the machines and do the paperwork but just dumb enough to passively accept all these increasingly shittier jobs with the lower pay, the longer hours, reduced benefits, the end of overtime and the vanishing pension that disappears the minute you go to collect it. And, now, they’re coming for your Social Security. They want your fucking retirement money. They want it back, so they can give it to their criminal friends on Wall Street. And you know something? They’ll get it. They’ll get it all, sooner or later, because they own this fucking place. It’s a big club, and you ain’t in it. You and I are not in the big club.”

“This country is finished.”

George Carlin