Saturday, October 24, 2009

Rolling stones-paint it black

I'm discovering the Stones thanks to @kristinstecher

Wednesday, October 21, 2009

Devan


Devan-112, originally uploaded by Rooosh.

Yes, he is *that* cute.

Taking baby pics is probably the funnest thing I have done as a photographer, not to mention perhaps the most rewarding.

Thursday, September 17, 2009

[books] Good Omens

Good Omens: The Nice and Accurate Prophecies of Agnes Nutter, Witch Good Omens: The Nice and Accurate Prophecies of Agnes Nutter, Witch by Terry Pratchett


My rating: 4 of 5 stars
I love Terry Pratchett (though not as much Neil Gaiman, though I'm beginning to change my mind) and this has all the usual humour and fantasy that I would expect from Pratchett. Great book, fast read, just overall fun.

View all my reviews >>

[books] Infidel

Infidel Infidel by Ayaan Hirsi Ali


My rating: 5 of 5 stars
An autobiography that you can't put down - the story of Ayaan Hirsi Magan/Ali from birth in Somalia, childhood in Somalia, Saudi, Ethiopia and Kenya, to adulthood in Holland and an eventual rise to becoming an MP in Holland, to death threats and security crises and eventual move to the US.

Extremely compelling, makes you think of life in the non-western world, especially in Africa and especially Somalia. This is in equal parts a commentary on women's issues in fundamentalist Islam as it is about her life. She does not really offer any solutions to the problem of dragging Islam out of the 5th century into the 21st but does highlight the problems.

A very good read - though not exactly your lightweight beach reading. Strongly recommended.

View all my reviews >>

Wednesday, September 9, 2009

Has Twitter taken over?

I feel a bit guilty for not blogging in a long while. It seems that all I do is send pithy tweets about something or another and don't find the time and opportunity to write something (semi-) thoughtful.

This is rather unfortunate :(

Saturday, July 25, 2009

[geek] Splitting django views

Geekiness ahead; you have been warned.

Steve wrote a post about splitting django views. Consider this as another viewpoint / way of doing the same.

The primary problem is to split django's views.py into multiple different modules, ostensibly to make them smaller and more modular (duh).

To begin with, I'm not entirely certain the problem exists - in MVC or MD paradigms, the view is typically very tiny and almost entirely devoid of logic. It is there only to reflect changes made to the model. Consequently, it is unclear that the views.py needs splitting at all. I have not done enough large scale django development (my projects have been of the tiny homebrew variety), so lets assume that views become unmanageable in the long run and need to be split up.

Lets say you have a setup and have the following directory structure:

> ls
__init__.py manage.py* settings.py urls.py urls.py.orig views.py

and views.py looks like this:

> cat views.py

from django.http import HttpResponse

def index(request):
return HttpResponse('index')

def foo(request):
return HttpResponse('foo')

def bar(request):
return HttpResponse('bar')

Now we'd like to break apart views into a directory, so we change it to:
> ls -R
.:
__init__.py manage.py* settings.py urls.py urls.py.orig views/

./views:
bar.py foo.py index.py

where each file in the views directory has its own little function:

> cat views/foo.py

from django.http import HttpResponse

def foo(request):
return HttpResponse('foo')

At this point, note that there is no __init__.py at all.

The original url resolver obviously will not work because it looks like this:
urlpatterns = patterns('',
(r'^foo/', 'views.foo'),
(r'^bar/', 'views.bar'),
(r'^$', 'views.index'),

So we change that too:
urlpatterns = patterns('',
(r'^foo/', 'views.foo.foo'),
(r'^bar/', 'views.bar.bar'),
(r'^$', 'views.index.index'),

and the site is back up as normal.

I think this approach - explicit directions in urls.py is much cleaner and much more inkeeping with django's spirit of avoiding magic. Note that the other approach which basically imported all functions the minute __init__.py was touched would maintain the urls.py mappings, thus saving a bit of work. However, I think it would confuse the heck out of people, not to mention result in wierd name collisions if any of the individual view files happen to export the same function.

Tuesday, July 14, 2009

The Sotomayor Hearings

There was a point when watching the GOP self-destruct brought a bit of joy. The GOP felt like such an alien party - anti-intellectual, anti-everything except God - a party from another planet. Then came the 2008 elections, the Dems won and things were great.

Given their resounding defeat, one would have thought that they would have regrouped and introspected a bit and tried to figure out what went wrong, how they alienated their base and led the most colossal eff-up in the history of the U.S.

But one would be wrong.

Instead they decided to continue on this path of bigotry, racial hatred, and just common thick-headedness. What better proof than the way Jeff Sessions, Ranking member of the Judiciary Committee, manhandled Judge Sotomayor. Quoting the transcript:

"So first, I'd like to know, do you think there's any circumstance in which a judge should allow their prejudices to impact their decision-making?"


"But the statement was, "I willingly accept that we who judge must not deny the differences resulting from experience and heritage, but continuously to judge when those opinions, sympathies and prejudices are appropriate." That's exactly opposite of what you're saying, is it not?"


"...but isn't it true this statement suggests that you accept that there may be sympathies, prejudices and opinions that legitimately can influence a judge's decision?..."

"...I just am very concerned that what you're saying today is quite inconsistent with your statement that you willingly accept that your sympathies, opinions and prejudices may influence your decision-making."

Is Sessions possibly trying to make a point that a person can be completely unbiased? That his or her background cannot affect a judgement? Is it humanly possible? The answer, of course, is no - it is not possible to be unbiased and even if we think we are unbiased, we are not. This is not a statement that I make loosely - the race iat and other literature in psychology would be able to show this easily.

Sotomayor's point was so rational.
"I think the system is strengthened when judges don't assume they're impartial, but when judges test themselves to identify when their emotions are driving a result, or their experience are driving a result and the law is not."

Brilliant.

What is really sad about all this is that the GOP comes out as really bigoted and prejudiced and trying to browbeat a Judge into submission. Not to mention hysterical when a bunch of white guys accuse a latina of being rascist.

This self-destruction of the GOP is very bad for several reasons. For one, I actually agree with a bunch of their ideals - fiscal conservatism, smaller government (never mind that they oversaw some of the biggest increases in government and spending in the past century). But the other, more important reason is that in order for a democracy to function, and to be strong and vibrant, it needs a strong opposition. Having the Dems in absolute power is very, very bad, just as bad is it was when the Repubs were in absolute power: balance is irrevocably lost.

So Dear GOP: Please get a grip on yourselves. Obama checkmated you with Sotomayor - you cannot possibly block her nomination and every minute you pull stupid stunts like the one Sen. Sessions did, you hemorrhage latino votes. Its not a battle you want to fight. And when you do fight, please fight with dignity. Healthy debate is what we want, not mindless Limbaugh-esque repetition of false facts, hearsay and opinion.

Sunday, June 21, 2009

[books] Pride and Prejudice and Zombies

Pride and Prejudice and Zombies Pride and Prejudice and Zombies by Seth Grahame-Smith


My review


rating: 3 of 5 stars
Picture this:

The Bennet girls are at a ball. They are upset because Mr. Darcy made some disparaging remark about one of them or their mum. Blah blah blah.

Suddenly, the windows are shattered and the person nearest the window falls victim to the unmentionables, who quickly devour their brains. Because, as everyone knows, there is nothing a zombie likes more than brains.



This book has it all - Jane Austen with her proper romances, haughty bachelors and haughtier spinsters all looking to find the right husband or wife - and Grahame-Smith with his unmentionables (zombies), chinese kung-fu, japanese katanas, ninjas (yes, that's right, ninjas) and other formidable weaponry.



The book is so absurd that it makes you laugh at loud - the section at the end where the author puts in a list of things for classrooms of students to explore is some of the funniest writing I have read.



I want to give this book a higher rating - simply because I admire the author for the courage to write something so patently absurd and the publisher for going along with this. However, at the end of the day, the work is still Jane Austen and no army of ninjas is going to help save the utterly boring romances that Ms. Austen wrote.



This is definitely a library pick.


View all my reviews.

Thursday, May 28, 2009

Google Wave



I'm excited.

Friday, May 1, 2009

[books] Forever Peace

Forever Peace Forever Peace by Joe Haldeman


My review


rating: 3 of 5 stars
Not as good as Forever War, but not bad at all. A vision of utopia where there are means to connect everyone to a global hivemind that basically causes them to lose the will to kill each other. Interesting, some new concepts and some exploration of this idea. A bit heavy on wierd sexual stuff, a bit unnecessarily so, and a bit light on exploring the other side of what pacification of an entire species would do.


View all my reviews.