Creative Communications

22 June, 2010

Brain Training, Data Capture and Simple Math Problems

Filed under: Life Management — admin @ 10:00 pm

Personal Data Monitoring has been eeking into the public sphere of awareness. The basic idea is that if you can quantify information about your life, and adjust your input parameters, you can discover correlations you would otherwise miss, due to the frailty of subjective memory.

Brain Training is another facet which you’ve probably heard of incorporated in video games like “Brain Age“. We build our neural connections through use, hence the more you exercise your brain, the better it gets, according to the ideas of brain training.

Somewhere in my reading about this, I heard about someone who wrote a small program to test their math skills every day. They discovered a correlation between flax seed oil and higher cognitive performance. Wow! Yet, a casual google search turned up nothing so far as software.

I’ve been meaning to pick up a little Python, and here is my attempt to duplicate this program. Basically it asks you 30 simple math questions, times you and displays your score.


#!/usr/bin/env python
# encoding: utf-8
"""
TimedMathTest.py
- inspired by some brain training / data measurement
Created by Sean Canton on 2010-06-22.
Copyright (c) 2010 8isc.com All rights reserved.
"""

import sys
import os
import math
import random
import time

NUM_TRIALS = 30

timetally = 0
correct = 0
wrong = 0

for i in range(0, NUM_TRIALS):
start = time.time()
a = random.randint(0,10)
b = random.randint(0,10)
op = random.randint(0,2)
d = {0:"+", 1:"-", 2:"*"}
op = d.get(op)
s = str(a) + op + str(b)
a = raw_input(s + " = ")
#print 'Code: ' + str(s)
# print 'Ans: ' + str(eval(s))
# print 'Yours: ' + str(a)
finish = math.floor((time.time() - start)*100)/100
timetally += finish

if a == str(eval(s)):
#print 'true'
#print finish
correct += 1
elif a != str(eval(s)):
#print 'false'
wrong += 1
#print finish

perc = correct/float(NUM_TRIALS)

perc *= 100
print "time: " + str(timetally)
print "right : " + str(correct)
print "wrong :" + str(wrong)
print "% : " + str(perc)


As you can see, it’s fairly straightforward. .get is a dictionary method that returns the value from the key value pairs in variable d. Python doesn’t have a switch/case function, and I have to say, the dictionary way of doing things is much cleaner.

I’m looking forward to diving into more Python experiments. I’ll keep you all posted.

21 September, 2009

Sept. 21st 2009 – Daily Infogatherings

Filed under: Uncategorized — Sean Canton @ 5:51 pm

So, as not to be completely useless with this space. I’m posting the interesting things I run across.

Yahoo UX Pattern Collection

Awesome collection, a Library of Libraries. ( ux, ui, ia )

Top 10 Underhyped Webapps, 2009 Edition [Lifehacker Top 10]

My favorite of the bunch is Freckles. Tending towards simplicity, this time-tracking app beats out the major contender, RescueTime, merely because it allows you to input your own hours without being a buggy BigBrother.

26 August, 2009

Google Custom Search into YubNub

Ok, we all love Google Custom Search, but if only it was easier to access the power underneath the hood. YubNub to the rescue!

First, you need an easy way to use YubNub, my favorite way is through an application or input driven URL launcher. Alternatively, you can place

http://yubnub.org/parser/parse?command=

in the Firefox about:config setting “keyword.URL” for awesome bar access.

about:config setting keyword.URL in FF3

about:config setting keyword.URL in FF3

Second, you need to make, or utilize, a Google Custom Search. The specifics of that are up to you to decipher.

Third, go to “manage your existing search engines” from the GCSE main page. Click on the link for the search engine you want to YubNub and query some simple garbage, like “asdf”, and it will likely return this :

GCSE Fail

That’s ok, it’s the URL we’re after (your cx numbers will be different).

http://www.google.com/cse?cx=013447137807661701068%3Annr5ynxpzry&ie=UTF-8&q=asdf&sa=Search&hl=en

Pay special attention to the q variable. Hey, that’s my query! That means I can do almost anything with this URL! Drop it into QuickSilver, make a keyword based search for FireFox, or put it into YubNub!

Simply replace the “asdf” in your URL with a “%s” and you’re ready to rock with every possibility I’ve described above.

My first one was a Javascript Reference that shortens to “jsr”, fyi.

Older Posts »

Powered by WordPress