Archive for October, 2009

30
Oct
09

some thoughts about sustainable dieting

Most people giving advice about dieting advocate some kind of diet composition. Typically something to the effect of low-carb, low-calorie, Mediterranean, etc, etc. I believe there is some validity to this, but these diets are not typically sustainable because we cannot stick to them for the rest of our lives. This is because we typically have social obligations that prevent us from doing so, or we’re traveling, or we’re just too hungry to avoid eating according to these guidelines.

I believe the most important thing that must be changed is our food habits. Habits are self-sustaining, and consistent. If you develop good eating habits, then your set-point (the weight that you will arrive at unconsciously by following your habits) will be reasonable. If you have bad habits, your set-point will be off kilter. Good habits make for a sustainable diet, and it is extremely hard to make selecting a certain food composition a habit because there are too many cases where we cannot do so (unless you choose to be a hermit).

Two major culprits in terms of being overweight for me are eating to feel better, and not paying attention and being mindful when I eat. I realized that I frequently eat pizza when I’m stressed out, which is probably due to the fact that it was one of my favorite foods as a child. I also realized that I frequently overeat well beyond the point where I’m satisfied. As a child I was constantly urged to eat more and to clean my plate and not waste food. Hence, as a child there were two habits that were ingrained into me, I learned to seek junk food for comfort, and I also learned to ignore my natural feelings of satiety. These mental habits, subtle as they are, are what define my set-point.

28
Oct
09

NBA Broadband League Pass

Living in the Bay Area, I’m unable to watch the Warriors online with NBA League Pass because of exclusive broadcast rights sold to Comcast Sports Network Bay Area. Depressing, since I don’t have that channel anymore and only have the internets!

So NBA League Pass is pretty much useless unless you’re a total basketball junky and have to watch games out of your region (aka follow other teams besides your local one). I guess that’s nice if you moved away or something, but still…it’d be amazing to watch the games online while in the region or at least access the archives.

28
Oct
09

one thing ruby has over python…

the “end” command to close a block. This allows Emacs to automagically indent everything properly, particularly if someone’s crappy editor screwed up the proper indenting. The lack of a block-closing tag in python prevents Emacs from figuring out what ends where, and we all know if you screw with Emacs, you screw with truth, justice, and the American way.

28
Oct
09

CAPTCHA scraping – Opening urls with urllib2 over an https proxy

I’m currently trying to scrape CAPTCHA images over Tor (my own personal botnet ;) ) for certain sites that maintain aggressive forms of rate limiting (i.e. Yahoo/Ebay). Strangely enough Google and Microsoft do not care as much. They probably spend more time solving problems like…having a good search engine?

Most CAPTCHA’s appear on https:// protected pages, hence the need for a https proxy to use with Tor. I tried Polipo, which doesn’t support https proxying (which I soon found out). However, Privoxy does.

Once I setup the actual proxy itself to connect to my Tor router, I find out that currently, most linux packages of python (and Mac OS X Snow Leopard) do not contain the necessary patch to support opening urls over an https proxy. You need svn revision numbers 72880 and up (any version released roughly after July of 2009) for python 2.6. The patch is also somewhere in 3.x. Linux package management maintainers really need to push up to date versions with backported fixes more frequently or quickly.

Details on the bug reporting and fix are here:

http://bugs.python.org/issue1424152

Note that the correct way of using the https proxy code is to call

proxy_support = urllib2.ProxyHandler({“https” : “https://127.0.0.1:8118″})

opener = urllib2.build_opener(proxy_support)

Why is https proxying so poorly supported? It boggles my mind. I guess open source developers don’t run into this problem often.

This has been a public service announcement by the Foundation for Annoyed Programmers (FAP).

27
Oct
09

Quick Tip with Mail.app

I go through my email and bucket them into roughly 4 folders: Archive, Action, Pending, [Project], where [Project] is can be replaced with the name of an actual project I’m working on. One way to quickly sort through these things is to create a global shortcut key in Mac OS X with the menu item being the name of the folder you want it to be sent to. For example, I have Ctrl+A binded to the menu item “Archive.” This subsequently sends a selected email to the Archive folder when pressed.

25
Oct
09

Health

Health is a major component of happiness.

Having ruptured my patellar tendon back in April has proven this to me once and for all, and I’ve finally decided to make it a longstanding priority in my life. Being basically bedridden for 6 months, my health deteriorated as I stopped eating well and obviously, I could not exercise. This left me feeling lethargic on a daily basis. After being able to walk again I lived in Beijing which proved detrimental to my health, as the pollution there is terrible, and my lifestyle was not conducive to being healthy. Although the excessive gluttony and partying did prove one thing to me, that these simple pleasures did not make life worth living.

Today I went for a run, and having previously injured my knee, I kept to my new exercise mantra of comfortable moderation. This meant that I would run so I would get a good sweat going, but would not feel excessively strained in terms of my leg muscles, nor my heart rate. When you run this way, it feels a lot better, and is a lot more fun. My knee injury was a consequence of going too hard too fast, and only reinforces my belief in small continual progression in terms of exercise (and in life in general).




 

October 2009
M T W T F S S
    Nov »
 1234
567891011
12131415161718
19202122232425
262728293031