Adam Hooper's Blog

Mar, 2017 back to Mar, 2006: (nothing)

Feb, 2006

Inspiration

Posted February 23 in Philosophy

Self-improvement is an admirable goal, but it's easy to lose track of why we should strive for it.

This morning I woke up with a flash of insight. I work hard to always become a better person to merit the respect, admiration and trust of the people I care about. The path takes a lifetime, and the rewards are well worth it.

Read full story

Blame

Posted February 21 in Philosophy

It's not my fault, it's theirs.

(By ignoring context, I have promoted this blog entry from an anecdote to a mantra.)

Read full story

Jan, 2006

Perfection

Posted January 27 in Philosophy

Perfection is the art of enjoying the world exactly the way it is.

Read full story

Philosophy vs Engineering

Posted January 15 in Philosophy

In my first Philosophy conference, we were asked to state our name, program, and reason for taking the course. After going about halfway around the room, the spotlight fell on the person next to me, who said she was in Chemical Engineering and was taking Philosophy because she was afraid Engineering is making her a robot.

My turn came right after that. I had prepared some drivel about improving my methods of reasoning. But I thought about it for one more second, and then I said, "same reason."

Read full story

Dec, 2005

Blog category list

Posted December 1 in Code

Ironically, the only time I actaully blog is when I'm hacking at my blog.

I wanted a simple HTML category list for my Pyblosxom blog. I hacked something up quickly, without much regard to maintanability or portability.

<![CDATA[__author__ = "Adam Hooper"
__version__ = "1.0"
__url__ = "http://www.adamhooper.com:4242/blog"
__description__ = "Gives an HTML list of blog categories"

import Pyblosxom.tools
import os.path
import re

def cb_prepare(args):
        request = args['request']
        data = request.getData()

        dirs = Pyblosxom.tools.Walk(request, root='/var/www/pyblosxom',
                                    pattern=re.compile('[^.].*'),
                                    return_folders=True)

        html = '  <ul>
'
        for d in dirs:
                rd = os.path.split(d)[-1]
                html += '   <li><a href="/blog/%s">%s</a></li>
' % (rd, rd)
        html += '  </ul>
'

        data['categoryList'] = html]]>

Read full story

Nov, 2005

Happiness

Posted November 30 in Philosophy

If you're not happy, determine why. Then formulate a plan to solve the problem. The end result is happiness. And what if you fail? Well, if you're not happy in the first place, what do you have to lose?

It really is that simple.

Read full story

I'm rich!

Posted November 28 in Philosophy


My blog is worth $0.00.
How much is your blog worth?

Somehow, this makes me proud. I couldn't be worth less if I tried.

Read full story

XHTML compliance

Posted November 6 in Code

I just set up this blog with PyBlosxom. The installation was completely smooth, and it was trivial to get the style the way I wanted it (like the rest of my website, that is).

But getting XHTML 1.1 compliance took a long time, because of of the Content-type header. I ended up having to write a plugin, which meant learning how PyBlosxom renderers.

My default flavour is called adam; with that in mind, here is my plugin:

<![CDATA[__author__ = "Adam Hooper"
__version__ = "1.0"
__url__ = "http://www.adamhooper.com:4242/blog"
__description__ = "Sends appropriate XHTML Content-Type header"

import os

def generate_content_type():
    if os.environ.get('HTTP_ACCEPT', '').find('application/xhtml+xml') != -1:
        return 'application/xhtml+xml'
    else:
        return 'text/html'

def cb_prepare(args):
    request = args['request']
    form = request.getForm()
    config = request.getConfiguration()

    if ((not form.has_key('flav')
         and config.get('default_flavour', '') == 'adam')
        or form['flav'].value == 'adam'):

        renderer = request.getData()['renderer']
        renderer.addHeader('Content-type', generate_content_type())
        renderer.needsContentType(None)]]>

Read full story