James Tauber's Blog 2005/01/11


blog > 2005 > 01 >


Petals Around the Rose

I'd heard about the dice-based brain teaser Petals Around the Rose but didn't read the details until tonight when I followed Bob Congdon's link to this page.

At the outset of reading the latter, I decided I would try to work it out myself and not cheat by Googling the answer. I had a couple of hypotheses but none of them worked past one or two of the sample rolls given.

By the end of the page, I hadn't worked it out. Bob Congdon had suggested "the less you think about it the easier it is to solve" so I stopped thinking about it all together and started getting ready for bed.

Then it all of a sudden hit me! I rushed back to the computer and tested my hypothesis. I was right every time!

Go read the article for yourself. Even if you don't get it right away, stop thinking and let it come to you. Nothing beats working it out yourself.

by : Created on Jan. 11, 2005 : Last modified Feb. 8, 2005 : (permalink)


More on Lost CGI Environment Variables in Python 2.4

I previously mentioned problems a user was having running Leonardo under Python 2.4 on Windows and that I'd narrowed it down to CGIHTTPServer and the environment not getting populated.

Looks like others have had the same problem.

Pierre-André Côté pointed me to this bug report and fix at SourceForge and Markus Schramm suggested subclassing CGIHTTPServer with this workaround:

# There seems to be a bug in Python 2.4.0, that I could reproduce under # Win98SE and WinXP Home SP1a (Python 2.3.4 works OK for both systems). # # The CGI variables are set inside the current process. Normally the # CGI script will be executed in a new subprocess, but without this # workaround the variables are not accessible there. # # Expected reason (some additional tests done): # os.popen3(..) and os.popen4(..) do not correctly pass the modified # os.environ to the new subprocess (Windows platforms only). # # Workaround: # Redefine some class variable values to force a fallback mode that # executes the CGI script in the current process. # if 'win' in sys.platform and sys.version_info >= (2, 4): have_fork = have_popen2 = have_popen3 = False

Markus also suggested the following override (unrelated to the lost environment problem)

# Overridden to not call socket.getfqdn(host), that doesn't work at # all machines and is very very time consuming (several seconds) then. # Note: Merely used for logging to the console. # def address_string(self): return '%s:%s' % self.client_address2

Thanks also to Jeff de Wet.

by : Created on Jan. 11, 2005 : Last modified Feb. 8, 2005 : (permalink)


Learning a Language with Pimsleur

I've just finished the Pimsleur Italian I course. I cannot recommend enough the Pimsleur approach to language learning if you are learning on your own. It is expensive, but having completed my first, I think it's money well spent (and I've already bought Italian II)

I thought I'd share some tips I've picked up along the way. I should note that, although you can get through it in 30 days, it took me much longer due to various false starts. Which leads me to my first tip:

Tip #1

If you miss doing it for more than a few days, consider starting again. At least go back five to ten lessons. At first I couldn't bring myself to do it but then I reminded myself that the objective was to learn Italian, not get through the CDs in record time.

Tip #2

If possible, do one full lesson a day (30 minutes, although it drops to 25 after Lesson 9, the case of Italian I, if you postpone the reading as I did). If you don't have 30 minutes a day, try overlapping over two days. e.g. 0:00-20:00 the first day, 10:00-30:00 the second day.

Tip #3

Never pause the CD to give you more time to answer. Much better to get used to thinking on your feet. If that's too hard, see Tip #4.

Tip #4

If you are having trouble with a lesson, go back and repeat the previous one. I found this incredibly useful and it enabled me to get through difficult patches (which I did find came every 5 lessons or so).

by : Created on Jan. 11, 2005 : Last modified Feb. 8, 2005 : (permalink)