journal
all all entries rss SoML excited dreams runes YRUU ultimate KTRU skate sleepy nihongo
Rob is 20,118 days old today.
prev day next day printable version

Entries this day: Mathoholic_Solver emiko_lesson lin

Mathoholic Solver

5:01pm JST Thursday 4 November 2010 (day 14834)

Recently I’ve been writing Mathoholic Solver, a program to solve equations in the iPhone game Mathoholic. The game is pretty tricky, and writing this code has been easier than increasing my math skills enough to solve the problems quickly.

It’s written in Python, for django, and I’ve got the code available on GitHub, and have thereby been learning Python, django, and reviewing the usage of git. Travis originally encouraged me to use django if I wanted to learn Python, and I’m glad; it’s been pretty easy to get things going.

One mess I almost made was regarding the models and views; I had a bunch of code in the view that should have been in the model, so I’ve moved it, and it’s therefore gotten much easier and reduced the amount of code needed.

Since Colleen left (3 or 4 days ago), I've spent most of my time on this project. Once I got past the roadblock of include files (instead of 'mathocheater' I needed to include 'mathoholic.mathocheater' to my list of INSTALLED_APPS in settings.py), coding has been pretty smooth.

Biggest roadblocks which I've had to go around:

  1. couldn't get .htaccess to rewrite the URLs nicely; I've determined .htaccess *can't* do this; it must be done with a redirect from the program.

    As I was thinking about it on my way to/from sleep, I realized not even Mediwiki can do what I'd like. (*)

  2. couldn't get javascript to take a textfield, and submit it as a URL path (**)

Tiny roadblock that I went around:

  1. couldn't figure out how to get django to load static CSS files. I've got a tiny smidgen of CSS so I just included it inline in the template.

(*) I've got .htaccess to take the URL http://www.example.com/1234 and send to the server the url http://www.example.com/?digits=1234

And when submitting a form, I send, via GET, digits=1324, where 1234 represents any 4 digits

The resulting URL from the submit is http://www.example.com/?digits=1234

I could probably use python's redirect to refresh this to http://www.example.com/1234

But, I couldn't get .htaccess to change the submitted URL http://www.example.com/?digits=1234 to be displayed as http://www.example.com/1234 and yet sent to the server as http://www.example.com/?digits=1234

(**) I *was* able to get Django to properly parse http://www.example.com/1234 without .htaccess at all, but then I couldn't get a textfield to be submitted into the same type of URL. I tried Javascript, but was not able to get a javascript framework (e.g. Jquery) to work because of the same static files problem I had with CSS.

Problems that gave me fits but I've gotten sorted:

  1. Figuring out why digit.statistics_set.create() didn't know the digit.id... Oh! I hadn't saved the digit yet.

  2. Figuring out the logic for how to create new Statistics based on the digits sent to the view.. Oh! This code should be in the model for Digits.

Next challenges that I've not yet faced:

  1. save the date and client IP address of each request

  2. use those to prevent ballot stuffing

permalink

emiko lesson

5:31pm JST Thursday 4 November 2010 (day 14834)

Now we’re arriving in Shimbashi, and I’m just about to go to a lesson with Emiko and then meet Lin. Lesson with Emiko is from 6:30 to 7:30, but I had to get out of the house early because Soness had her kids' lesson at 4:30 to 5:30, and if I were to leave the house at 5:30, I'd not make it to Tokyo in time for 6:30 lesson with Emiko.

I imagine I will be able to meet Lin at 8:15; I'll tell Emiko that we are planning to meet tonight.

6:06pm JST Thursday 4 November 2010 (day 14834)

omg. I'm sitting here on a chair on the platform in Tokyo station, playing Words With Friends on my iPhone, and a woman walked up to me and gave me 20,000 yen.

I just said ども and she was already walking away.

I put it in my pocket and wondered what had just happened. I pinched myself and felt the pain; I stood up and jumped and didn't fly. I'm not dreaming. I just got $200 for chillin' here... Sweet.

permalink

lin

11:13pm JST Thursday 4 November 2010 (day 14834)

Hung out with Lin mostly in a Royal Host between Kawasaki and Yokohama, talking about the latest haps in our lives, and planned haps for the future. Good times.

permalink
prev day next day