Runcible Blog

Sick

For the past 3 days I've had serious ear pain. I thought it was an ear infection, but after a trip to the emergency room, it turns out that I don't have an ear infection or strep throat, but I have some kind of viral infection either in my ear, or throat, or lymph node on the left side. So, I couldn't get any antibiotics, and the advice was to go home, rest, drink plenty of fluids, and take tylenol. Well, that's not too helpful.

I tried sleeping tonight, but I still have a bit of a fever. I was drenched in sweat, and I can't tell if it's truly warm in here, or if my fever is getting worse.

I've had lots of fevers, but I can't remember one this painful. I hope it subsides soon — the ER doctor said I should come back if it doesn't get better in a week; I don't want to think about this feeling persisting for that long.


What is karma?

There's no such thing as karma.

I often hear people say that some event happened due to "karma" -- a kind of universal justice system. I kick a dog, and someday a dog will attack me. I help an old lady cross the street, and someday when I'm old, someone will help me. The catch is that you never know when "karma" is going to come back and bite you or benefit you. So, the idea is always to be vigilant, courteous, and good.

But I think that understanding karma as a law of nature is an extremely limited view of the concept – maybe even antithetical to the definition. Thousands of years of monotheistic tradition have taught us in the west that God punishes evil-doers and rewards the righteous. More recently, preachers interpret God's influence in more subtle ways (at least in non-fundamentalist traditions) – there may not be a literal heaven or hell, but God still has influence over our suffering or pleasure on this earth. In either case, God is the external force acting on our lives. God is the immutable law of nature. God is karma. The word karma, as used by people with a monotheistic background, is a neutral way of saying God. Or perhaps more scientifically, karma is analogous to the Conservation of Momentum. I suppose it's not hard for a modern person to make the case that if momentum, mass, energy, and force must be conserved in the universe ("every action has an opposite and equal reaction"), then why can't a law be applied to human interactions? Sounds reasonable enough, right?

The problem with this understanding of karma is that it clouds one's intention for doing good deeds or avoiding harmful acts. If I think that I shouldn't lie because karma or God will come and get me later, then I'm missing the point that I shouldn't lie because it might hurt the person I'm lying to. There doesn't need to be an external force in this case (or any case!) judging my actions. It's just me and everyone else involved. I'll admit, though, that the conscience has a lot easier job to do when it merely checks against a set of rules: don't cheat, don't steal, don't lie, don't kill. Why not? because God, Karma, Fate, Flying Spaghetti Monster will smite you if you do. Simple.

The ultimate "golden rule": "love thy neighbor as thyself" fits well with this limited understanding of karma. Whether we live by Commandments, Precepts, or just one special rule, we abdicate the responsibility to understand our intentions. We have faith that the rules are correct and will lead us to happiness. Violation leads to our demise. It's a little harder, however, to think, "what's the right course of action?" in every situation. But it's what we ought to do – forget about the rules.

Following rules of moral conduct on the surface seems like a selfless ideal, but that behavior hides a selfish goal: I should be a "good" person or else I'll go to hell or have Karma screw with my life. No, do the "right" thing all the time because it's the "right" thing to do. Why should we need a Creator, law of nature, or rulebook to determine how we should live our lives? Don't treat others as you want to be treated; treat them as they should be treated. (where should is this really vague word that everyone can argue about)

The other problem with our limited understanding of karma is the mysterious phenomenon: Why do bad things happen to good people? If karma holds true, then good people should have accumulated enough good karma that terrible things shouldn't happen to them. But we know from experience that this isn't the case. Which is the more likely conclusion:

  • a) God works in mysterious ways, and if He decides you should get hit by a bus, then it's all part of His grand plan.
    b) You may have lots of good karma today, but the bus hit you because you must've been a really terrible person in your previous lives.
  • There is no God or Karma. You have responsibility over every decision you make, but you will still experience pain no matter how saintly you live.

It's important to remember that we create karma in our minds. We also manufacture suffering, happiness, and the concepts of right and wrong. I'm reminded of a movie I just saw, Edmond, which ends with the main character living in prison after murdering someone (oops, did I give away the ending?). But he says that he finally feels safe in prison – like he was meant to be there all along. One thing to take away from the film, if nothing else, is the capacity to create our own prison (or heaven) in our heads. By society's standard, Edmond was being punished in the worst possible way: life in a cruel prison, but Edmond thrived in his new home. Unfortunately, that was due to psychosis rather than enlightenment, so we shouldn't read too much into the script...


I think I wanted to end with some universal message, but I started writing this early in the day, and now it's late. I've lost my train of thought. The message is really simple though: There is no force of Karma ruling our lives. Every tragedy or blessing feels the way it does because we create the feeling and the distinction between happiness and sadness. Imagine how painless life could be if we just stopped making the distinction? Easier said than done...



P.S. Somewhat related – on my outdated page, I said "Someday, I'll meet and kill Buddha." I thought that was really witty, but somehow I doubt that anybody gets the joke. The idea comes from a parable of sorts that I read somewhere. A wise man said, "If you meet Buddha on the side of the road, kill him." And I don't think there was any other explanation for the words, but that advice makes perfect sense. In a literal way, how can you meet Buddha when he's been dead for 2,500 years? That's silly. Abstractly, however, the advice is warning against the belief in powerful external forces. You could substitute God or the devil in the sentence and get the same meaning – you create the concepts of deity or karma; you can just as easily destroy them. And if you start seeing Buddha, you know your mind is really messed up. It's better to kill that jolly fat man than to walk down the road of extreme delusion. Don't worry, it's all in your head.


the right sentiment

With a few simple edits, this prayer makes a lot of sense.

Lord, make me an instrument of Your peace.
Where there is hatred, let me sow love;
where there is injury, pardon;
where there is doubt, faith (clarity);
where there is despair, hope;
where there is darkness, light;
and where there is sadness, joy.
O, Divine Master,
grant that I may not so much seek
to be consoled as to console;
to be understood as to understand;
to be loved as to love;
for it is in giving that we receive;
it is in pardoning that we are pardoned;
and it is in dying that we are born to eternal life.


Shaking Hands with Django on a Daily Basis

Since Ned put the smack down on the web framework zealots, and Antonio chimed in about the intangible benefits of working with a "fringe" framework/language, I thought I'd add my 2 rupees to the discussion on this whole web-development thang.

Having spent a year working on a Struts application (and evaluating several other Java frameworks) at my last gig, the difference between those platforms and Django (or hey, even Ruby On Rails) means the difference between being able to ship new features and make large changes to the code on a weekly rather than monthly basis. Ever since DHH brought Ruby on Rails down from Mt.Sinai and proclaimed that all of our controllers would go in this directory, and all the views would go in this other directory, plenty of people have woken up to the idea that web frameworks can take advantage of simple structure and use minimal configuration while still being powerful enough to "scale" (in the complexity sense of the word) to large projects.

While I was working on two projects at the Eagle-Tribune – the primary one in Java, and the other Django – I found myself asking, Why do I have to do have to do it this way? on the Struts project, while Django felt much more natural to me. As popular as Struts is, it seemed like an evolutionary dead-end after working with Django. You know your technology stack is doomed when you're afraid to add something new or change anything because it's such a hassle to wade through configuration files -- or, when there's a whole cottage industry around managing those configuration files

Working with Django at Tabblo lets me get on with the business of creating cool stuff without throwing road blocks up every 10 feet, as my Java Struts experience seemed to show. (I'm sure it helps to work with some passionate keen-beans) Also, perhaps ironically, working with a higher-level language leaves more time to spend on optimization because implementing features is comparatively easy. With "Web 1.0" languages/frameworks, (i.e. Java/Struts) you kind of have to think about performance up front and continually. Are you going to decide to use EJB? Any kind of ORM? What implementation of List should you use? ArrayList, Vector, LinkedList? I'm not saying one shouldn't understand the tradeoffs that different approaches entail, but with more agile languages and frameworks, you can defer those performance decisions until later (or never!). Java makes you think about performance optimization whether you need to or not.

Also, as the resident Magic-Remover at Tabblo, I'd like to make a couple observations about our migration to Django's trunk. First, it can be difficult to say what moving a large code base like Tabblo from one framework revision to another will gain -- is there a measurable gain in productivity? performance? features (which could not be backported)? Maybe yes; maybe not. But the overriding feeling was that staying current with Django would buy us some of those intangible benefits that open-source software tends to foster. Looking at some of the active branches in Django's Subversion repository gives a peak at some of the intriguing features that dozens of contributors are working on. So, although the short-term gains are minimal, the long term of Django development looks pretty exciting.

The other point I'd like to make about Django 0.95 is that the developers have moved much closer to the sweet spot of a powerful, easy to use and understand, and flexible abstraction in the new ORM. A simple example is that I built a rudimentary Django-0.91-style wrapper around the magic-removed syntax fairly easily (if only for the purposes of testing). I think it's a good sign that the new ORM is powerful enough to encompass the old ORM, but not the other way around.

Removing the magic out of Django let's us build even better magic into the Tabblo applications. Every decent framework should be pushing towards that goal. The days of bondage and discipline languages and "enterprisey" web frameworks are over. We youngsters with limited attention spans for XML sit-ups are getting stuff done with fewer acronyms and less code.


removing dupes

I came across a post about the quickest way to remove duplicates from a python list. This particular problem seems to crop up often, and I've noticed a huge slow down when doing something like:

new_list = []
for i in old_list:
    if i not in new_list:
        new_list.append(i)
I never took the time to benchmark different techniques like Peter did, though. It's interesting to see that:
{}.fromkeys(seq).keys()
is the fastest method, but only a hair faster than the conceptually simpler:
list(set(seq))

Most of the time, I use list(set(seq)) or just leave the sequence as a set without turning it back into a list. Also, the results present a strong argument against preserving order: even the fastest order-preserving method took 2.5 times as long as the quickest non-order-preserving method.

good to know.