Tuesday, December 15, 2009

Discovered it is possible to travel to Antarctica and North Korea. You can also get Master's Degree in Greenland (150 students).

Saturday, December 12, 2009

Beefed up my backups after hearing the horror story of how Coding Horror lost their data.

Wednesday, December 09, 2009

Ahh, my first solid state disk. Not the leet Intel one, but a cheapo one about half the performance off ebay. Still, even half the performance of Intel's SSD beats any traditional drive. So wonderful to get rid of all those periods when the computer is doing nothing except just crunching loudly.

Tuesday, December 08, 2009

Been thinking how to use the community of Coolest Friends to start something else. I was thinking of a video dare site, where you get points for shooting vids where you do certain tasks. For example one dare could be "stand on one foot for a minute" and if you post a video where you do so, you would get some amount of points. Of course there would be a visible leader board, and you get more points the more difficult a task is, possibly determined by how many people did it.

But I feel a bit exhausted. After doing some "small" projects like this, I realize they always balloon from the "I bet I can do it in a week" to "3 months passed and I'm STILL doing this?".

Sunday, December 06, 2009

Traffic to Coolest Friends doubled. I have no idea why. It seems to come uniformly from profiles and homes. I noticed a slight dip before. Maybe it was somehow down and now all those people who couldn't visit, are coming back in order to get their daily increasing bonus? I have no idea. I really need to get into making updates to this app, but keep putting it off. For the moment, thank you whatever random effect for doubling my visits.

Finnish independence day. Celebrated the eve by being bored and then sleeping early to fight the boredom.

Quiz app seems dead. 133 visits yesterday, compared to 600 on the first day. If I don't do something to make it work soon, there won't be anyone around to spread it.

So which of these important tasks am I doing? Neither, instead I am trying to get particle-based water to work with HTML canvas tag.

Friday, December 04, 2009

Upgraded Mac Mini RAM to max 3GB using a cheese slicer to pry open the cover. Learned a trick to do modular arithmetic faster. What is 25 in mod 7? Find x such that 25-x is a multiple of 7. X is 4, so 25 is congruent to 4 mod 7. Now for positive values you could just do without that, but it gets useful with negative ones. What is -25 mod 7? Find x such that -25-x is multiple of 7. Closest multiple is -28, so x = 3. -25 is congruent to 3 mod 7. Helps with exercises about computing inverses of matrices in Z7.

Thursday, December 03, 2009

Winter came. Strangely on time for December to look so christmasy. Unity engine seems fun to play with, reminds me of good old Amos 3D days. Maybe I could make some Assembly gamedev entry with this. Coding should be fun. Modding with source engine isn't much fun, because you have to wait minutes to see your changes take effect. With Unity things change realtime as you change code.

Tuesday, December 01, 2009

Went to uni library and had a nice study session without distractions (aka internets). It's amazing what you can accomplish when Reddit isn't around. Seeing others immersed in their study is also somehow infectious. I think I'll try it again tomorrow.

Sunday, November 29, 2009

Change may have increased the likelihood that a user completes a quiz. Difficult to say yet as the "improvement" is still within just random daily fluctuation.

Had a private burst of anger at my math teacher. I failed his course and would like to blame that on his teaching style totally lacking any passion. I've tried to avoid attending the class, every time I leave being less motivated by the subject than when I came in. It's just a basic linear algebra course, which is very very useful and could be presented in an interesting way, but it feels more like attending a funeral. So I stayed at home and tried to study the things as a list of contents got updated to his homepage. But then in the exam (which he had scribbled by hand and xeroxed barely legibly) there was a question which wasn't mentioned on that list, and I failed just barely.

I had studied for that class every day for about two months, but not exactly the things that were in the exam. I got upset enough that I dropped studying math at all for over a month, but now I'm getting my self esteem back just enough to try and continue.

Saturday, November 28, 2009

Released update to Mixi quiz app. If it will only improve goal completion by a few percent, that might be enough to turn it from decline to growth. Natural Selection is the most brilliant PC game ever created.

Friday, November 27, 2009

Productive day.

Managed to remove the most failure prone iframe, things are much speedier now too. The app works on three social networks, Mixi, MySpace and Facebook. Most users are on Mixi and I think I will drop the other versions if they start to feel like work to maintain. Did some successful soldering on an electronics kit. Dubai causing stock markets to fall.

Iframes all the way down

In an unproductive slump, to break out of it decided to rewrite parts of the failing quiz app for Mixi. Was a mistake to use iframes so much, sometimes some people are seeing nothing when I try to show an iframe. The app itself is already an iframe, so that's an iframe in an iframe. At one point to show an image upload widget, I have an iframe in an iframe in an iframe.

Thursday, November 26, 2009

Today's lack of productivity brought to you by Adobe Flash CS4 and Sampo Bank

Spent much of today staring at the beach ball of doom (a spinning cursor you see on a Mac when things are ├╝ber slow), Adobe Flash CS4 editing interface is reaaally slow. I am trying to learn how to export isometric graphics from Blender for use in a Flash-based game. I have source files that I am editing in a separate editor, because I can often type faster than CS4 can read my typing, and it will sometimes do nothing for what feels like forever. Not productive.

Computer is Mac Mini, 1.84GHz Core 2 Duo 1GB. Decided to upgrade RAM to max 3GB and switch to a solid state drive. Upon attempting to pay for said drive, web bank wouldn't work. Stalled at "Starting Java..." with a (lack of) progress indicator not quite unlike the beach ball of doom. HD on another computer apparently has bad sectors, so switching that to an SSD as well. Tried to relax from all of this by doing some soldering on an electronics kit, but discovered soldering iron wall plug doesn't fit (ungrounded vs. grounded socket).

Wednesday, November 25, 2009


Went to Boston to attend Global Entrepreneurship Week, made new friends. Mike and Val are a fun couple, they are both into demoscene. Showed us around MIT. Saw wonderful little machines (by artist Arthur Ganson) with no other purpose than to look interesting. Favorite one was called "solitude", where a machine with gears made of thin wire existed only to move a miniature man's head left and right.

Tuesday, October 06, 2009

How to validate a Mixi.jp signed OpenSocial request on App Engine

I know nothing about security, but had to validate a signed request and this experimentally seems to work.

Get the certificate from here:

It is a long base64-encoded string that starts with -----BEGIN CERTIFICATE-----. Copy and paste it to base64 decoder. Store binary file "DecodedBase64.bin".

Run this command. This comes preinstalled on Mac Leopard.

openssl x509 -in DecodedBase64.bin -inform DER -noout -text

Copy and paste everything the hex values "Modulus (1024 bit):" to a text editor. Replace ":" and " " with "". Add \ to the end of each line. Now with this, you can use the instructions here to continue (the code after "which has been parsed, converted to hex value" on that page). Remember to put 0x in the beginning.

Friday, March 27, 2009

Using Google Spreadsheets with iGoogle to create a shareable dashboard for your startup

Google Analytics is excellent for tracking visits and can even be used for more advanced things like tracking conversions and events, but what if you want to track application-specific metrics which don't happen in a user's browser? For instance our Twitter meme aggregation site gets tweets using the Twitter API and stores them in our database, and the amount of tweets is something that I am interested in keeping an eye on. Here's what our dashboard looks like, and in this post I'll show you how you can effortlessly create your own.

Not only do the charts look pretty neat, but you can drag and drop them to rearrange them on the screen and even drag around inside each time series graph to see different spans of time. So where are these graphs coming from? A cronjob executes a simple Python script every quarter hour. The script queries our system for the load average, asks MySQL for the number of tweets and other data I want to chart. Each piece of data gets inserted into a separate Google Spreadsheet using the Google Spreadsheets API.

I can visit each of these spreadsheets and create charting gadgets (insert > gadget). Here I only used the time series gadget, which is like the one used on Google Finance, so you can easily zoom in to different periods of time and mouse over to see the absolute values. Clicking on the upper right corner of a gadget you'll find the option "add gadget to iGoogle". After you have added a few gadgets to your iGoogle, it may make sense to combine them into an iGoogle tab. Then on a tab's menu you'll find an option to "share this tab", and now any member of your team can view the data.

That's a summary of how this is done, but for the sake of completeness I will now mention some problems I encountered and share some code snippets so you won't necessarily have to go digging through the API.

First of all, one perhaps strange decision I made was to use a separate spreadsheet for each thing I track. One reason is that different data might be polled at different intervals, so the data is easier to handle this way as there won't be any blank fields for missing data. The more real reason however is a caveat I found, which is that each spreadsheet can contain no more than 200000 cells. There are around 35000 quarter hours in a year, so holding all data in the same spreadsheet would hit the limit in just a few months. I might also mention that I don't yet know how to get a charting gadget to automatically extend to cover all rows as the spreadsheet grows. If you know how to do that, please let me know and I'll be sure to mention the solution here.

Now some snippets. These use the Python library gdata-1.3.0. Logging in to Google Spreadsheets:

gd_client = gdata.spreadsheet.service.SpreadsheetsService()
gd_client.email = 'YOUR GOOGLE ACCOUNT EMAIL'
gd_client.password = 'YOUR GOOGLE ACCOUNT PASSWORD'
gd_client.source = 'exampleCo-exampleApp-1'

Below is the snippet for inserting one row to a certain spreadsheet. Each spreadsheet can consist of several worksheets. Not sure if it's always true, but experimentally I found that the first sheet seems to be called 'od6'. The spreadsheet_id you can find by creating a spreadsheet, then looking at your address bar and copy the base64 looking string in the "key" GET argument. The value here is any piece of data that you want to track, for example the number for your current load average.

def newValue(spreadsheet_id, value):
worksheet_id = 'od6'
dict = {'datetime':time.strftime("%m/%d/%Y %H:%M:%S"), 'value':value}
gd_client.InsertRow(dict, spreadsheet_id, worksheet_id)

Finally here is my complete list of things I import in the beginning of my script. It contains many unnecessary includes for these particular snippets, but I thought it might still prove helpful if you are trying to get the code to work.

from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
import gdata.spreadsheet.service
import gdata.service
import atom.service
import gdata.spreadsheet
import atom
import getpass
import string
import time
import urllib
import os
import re

Thanks for reading and please comment on Hacker News (preferred) or here in the comments. I'm interested in becoming a better blogger too, so any suggestions on improving my writing would be appreciated as well.