Monthly Archives: March 2009

How to increase your son’s intelligence.

Fifteen-year-old males who ate fish at least once a week displayed higher cognitive skills at the age of 18 than those who it ate it less frequently, according to a study of nearly 4,000 teenagers published in the March issue of Acta Paediatrica.

Eating fish once a week was enough to increase combined, verbal and visuospatial intelligence scores by an average of six per cent, while eating fish more than once a week increased them by just under 11 per cent.

So reports Science Blog on the results of a Swedish study.

I normally just kind of glaze over on studies such as this, but really … 11 percent is quite significant!

JSON feed for Source servers

I’m kind of a statistics whore.

To further my pursuit of more statistics, I’ve developed a Python CGI which provides a JSON feed of all sorts of information about servers based on Valve’s Source engine.

This script has three dependencies outside of what is in the standard Python library:

Once you have those installed (worst-case scenario just drop them in the same directory as sourcejson.py), you need to edit sourcejson.ini.  This file just has three options: rcon_pass, ip, and port.  If you don’t have the rcon password for the server you wish to monitor just leave it blank.

To access the JSON feed just use the url to sourcejson.py.  Something like this:

http://YOUR_DOMAIN/sourcejson.py

To access the extended information that having an rcon password allows use:

http://YOUR_DOMAIN/sourcejson.py?info=extended

If you use the extended format, but haven’t provided an rcon password in sourcejson.ini, it will just default to the basic feed.

Included in the zip is a .htaccess to prevent directory listings, which will help protect the contents of sourcejson.ini.

Download sourcejson here!

Using Python 2.6 + MySQL on Windows is nearly impossible

Update:  I made progress on this issue.  See my newer post here.

If you’re interested in writing Python scripts on Windows which access MySQL databases, be sure you avoid Python 2.6.

The standard way to interact with a MySQL database via Python is to install the mysql-python package The problems arise because of several things.

  1. mysql-python still doesn’t have compiled binaries for 2.6
  2. Windows doesn’t ship with a C compiler.
  3. It’s a SOB to use any of the free C compilers to compile from source.

A couple of kind souls have provided their own compiled versions in this forum thread, but neither of the provided versions works on the two Windows machines I’ve tried them on.

I tried following the official directions to compile on windows using the “setup.py build”-method, but MinGW spits out several bajillion lines indicating the following(bolded part indicates error found over and over again):

C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\opt/mysqlclient.lib(./mysqlcli
ent.dir/relwithdebinfo/inftrees.obj):(.text[_inflate_table]+0x4e3): undefined re
ference to `@__security_check_cookie@4′
collect2: ld returned 1 exit status
error: command ‘gcc’ failed with exit status 1

There’s very little useful information to be found from a google search on this, so as it stands, I’m pretty much unable to use Python 2.6 + MySQL.

I really wonder why MySQL support isn’t packaged with Python.  It’s not like accessing MySQL is an unheard of operation…