Thursday, July 31, 2008

sumidiot.com

I said I'd have one more post about sumidiot.com. Well, here it is. I've now got rss feeds available on sumidiot.com (all news, math jokes news, for now). So if you're interested in the site, I'll probably just let you follow those. Then if you aren't interested, you don't have to hear too much about it here.

Logging in seems to work (as long as you have cookies enabled), though it won't get you much right now. The next thing I will write should let you rate jokes, if you are logged in, and then it'll be totally worth it.

One of the things I wanted to play with was another way to access the math jokes. If you direct your browser to sumidiot.com/jokeN, and it's a proper N (like N=1 works), you'll see a joke as part of the webpage. For example, if you follow the 'Random' joke link, it'll send you to a /jokeN. If you'd rather just get the raw joke text, you can send 'Accept: text/plain' in your HTTP header. I'm pretty sure this doesn't qualify this as a web API, but it's the closest I'm going to get for a while. If nothing in this paragraph made any sense, just ignore it.

Ok, I guess I better get back to things I'm actually supposed to be doing with my time...

[Update (July 31, 2008): Changed the feed links above to use feedburner. Nice to have stats sometimes, I guess.]

Tuesday, July 29, 2008

Keeping Up

It might be a mathematician's obsessive-compulsive tendencies, or lack of proper motivation to do other things, but I like to try to keep up with all my rss/atom feeds, and largely with my twitter stream. I tried, for a while, setting up Google Reader with a folder that I didn't keep up-to-date with, and would just check randomly when I was bored, but it never quite sat right with me. I'll star items to read later, but once I get over 20 or 30, and certainly by about 40 starred items, I start getting pretty antsy. Furthermore, I check Reader's 'Discover' link every few days, because the thought of it not being an empty list of recommended feeds is a little annoying. Sometimes I wish I could turn off the recommendation engine, though I suppose not clicking 'Discover' is about the same.

This past week I moved into a new apartment, which was, itself, newly renovated with all brand new appliances. I mention this because one of my new appliances gives me something else to keep up with. My fridge has a pretty productive little ice-maker. As it is summer time, and I'm trying to do a fair bit of running, I need to be drinking lots of water anyway. And I don't like drinking water without lots of ice. So it's nice that there's always ice. At the same time, it's just one more thing to keep up with :)

Sunday, July 27, 2008

The .com(s)

For a while (longer than I'd like to admit), I've had the sumidiot.com domain. I never really got around to doing much with it, besides rarely messing about with how I wanted the menus to look and such. Then at some point I decided 'parallelality' was a cool name, and should have a cool webpage. I found parallelality.com un-occupied, so I figured I might as well keep it from being a stupid ad page or something. It's set up to just redirect to sumidiot.com, but if you can think of a cool use for it, please let me know. I'd be happy to see somebody do something worthwhile with it.

Before you head over there, you should know that make pages look nice is not something I'm good at. I'd be incredibly shocked if there weren't drastic rendering issues depending on your operating system and browser, or even just your default font settings. But I've only got so much time to work on this, and making it look pretty for everybody isn't my top priority. It looks acceptable to me, on my browser, so that'll have to be good enough for now. Don't like it? Make your own page.

Anyway, the news is that there is now, at least a little bit, something to look at there. Namely a large collection of math jokes. If you've got suggestions for how you'd like to interact with a large collection of math jokes, please leave me a comment below, and I'll see about making it happen. In the near future I hope to let you rate jokes, and star your favorites. Then you'll also be able to look at the most popular jokes. I'm also wondering about maybe putting a list of mathy comics up there. I just went through my list and found 3: abstruse goose, brown sharpie, and xkcd (does it have a high enough math/non-math ratio to count?). If you know any others, please leave a comment below.

I wanted to make this post earlier this week, but at one point I accidentally deleted all of the pages - on the server and on my own computer. So that was pretty stupid. But I guess I wanted to do a re-write anyway (that's why I was deleting things to begin with), so besides the time loss, it kinda worked out.

There's still plenty I'd like to do on the page, but probably there's more pressing priorities. I'm going to try to take at least a little time every week to mess about with it though. One of the next things I'd like to do is make a feed on that domain, so that I'm not always posting here about changes made there. Hopefully that'll cut down on the amount of posting here about changes there, though I'll probably still post about big changes here. Something for you to look forward to.

Saturday, July 19, 2008

The Drive-In

Last night I decided to finally go check out the drive-in theater in Fork Union. I've always kinda wanted to go, since I've never been to a drive-in, but never took the opportunity. I'm glad I finally did, and look forward to going again.



While 'Fork Union' shows up on cvillemovies, you'd be hard-pressed to say it was in Charlottesville. I drove somewhere along the lines of 40-50 minutes both ways, and I left from the side of cville closest to the theater. That said, if you find a weekend (they only run Friday, Saturday, and Sunday) when both movies are movies that you want to see, I definitely recommend the trip. The gates open at 7:30 and the movie(s) start at 'dusk'. Yesterday 'dusk' was apparently about 8:45. I showed up around 7:15 (I thought the gates opened at 7, and didn't realize 'dusk' was quite that late) and there were a half dozen or so cars already there. However, as I sat around waiting for the movie to start, I never noticed a line of cars waiting to get in, so you can probably aim to get there a bit later. Tickets cost \$8.50, but that's for two movies (it'll be a late night). There was an intermission of about 15 minutes between films, with previews on the first film, and none on the second. They claim to operated rain or shine (well... shine? at night?), and I'm now curious what it'd be like to see a movie in the rain.

Unlike every other theater I've ever been to, they let you bring in your own food. The people in the car next to me had a pizza. There is a concession stand, and it's got more variety than most theaters. It's got the usual popcorn, soda, candy, and nachos, but they also sell hotdogs, pulled-pork sandwiches, and various ice creams. I'd still recommend bringing your own, it's almost certainly cheaper. The concession stand is open the entire evening, in case you were curious.

Since I'd never been to a drive-in theater, I wasn't entirely sure what to expect. I thought you got the sound from your car radio, but was hesitant about that option for fear my battery would die. Turns out, that is one option, but they also have some speaker setup which I don't really understand (I'm pretty certain that the individual speakers are not powered). Throughout the park there are lots of poles coming up out of the ground, and each has 2 speakers attached to it. You can hang these on the window or door frame of your car, and this it the option I went with.

At one point the sound was a little off (I don't know how to describe sounds... tin-y maybe?), but it didn't last long, so I didn't try the car radio to see if it was also strange there. The speakers do have a volume knob, and with the volume all the way up and two speakers hanging on the passenger side window the sound level was just right. If it hadn't worked out, there's always the car radio.

I also wasn't entirely sure what picture quality would be like. When the previews started, the picture was quite fuzzy, but that was soon corrected. The sky was still a little bit light at the time, so the screen was a little bit washed out. Dark colors were difficult to distinguish. However, before long it was actually dark, and the screen looked good the rest of the night, even when the moon came up from behind us, shining on the screen.

Lots of people had bug spray, particularly those that stayed outside of their cars. I saw several people cleaning off their windshields before the movies started. I hadn't thought about it, but it seems like that's probably not a bad idea. If you show up early, like I did, bring something to do. It helps to have friends that go with you, so you can play cards or something. Many people brought chairs or towels and things to sit on. What seemed to me like perhaps the most comfortable was the people with pickup trucks who just sat in the bed of the truck. With some padding in there, it'd be like watching a movie in bed, I recon. The restroom facilities... leave a little to be desired. It consists of what seems like an outhouse, but with running water. There is one toilet for men, and one for women. You probably don't want to spend much time in them (and other people don't want you to either). Finally, the guy who opened the gates and sold me my ticket (whom I presume is the owner, but I didn't ask) has a quite large, but friendly, dog. My guess is a great dane, if they come in sort of brown and black.

In summary, the Fork Union has risen to the top of my list of movie theaters 'in' Charlottesville. I intend to keep better track of their movie schedule, and go back when the double feature consists of two movies I want to see. They had signs up for 'Wall-E' and 'The Dark Knight', so I've got my fingers crossed that those will show the same night sometime soon. This weekend (July 18-20) was 'The Incredible Hulk' and 'Wanted'. Next weekend is 'You don't mess with the Zohan' and 'Hancock'.

Wednesday, July 16, 2008

Debugging

Recently I have been trying to get OpenID working on a website. I want to use the JanRain OpenID PHP library, and it looked like the EasyOpenID extension to it would make things easier, so I wanted to use that as well.

My first few attempts with them seemed to have various setup issues (the blame for which rests solely with me, I concede), so I decided to remove everything and start fresh. I remembered at some point one of the issues being about getting the proper include path, so the first thing I did was put all of the .php files in the same directory. I also re-did the 'include' and 'require_once' lines to accommodate this, and removed the initial bits of the example OpenID consumer code that set up the php include path. I figured this would at least eliminate one of the problems, and if I got it all working from here, it should be feasible to undo this step.

So, the index.php loaded correctly and asked for my OpenID url. I entered one, and was sent to try_auth.php, where after a few seconds I was presented with a "500 Internal Server Error". Hmm. This is code other people have written and published. People who I expect blow me out of the water, programming-wise, so something strange is going on. Nevertheless, I tried tracking down the error. The only way I knew to do this was to put lots of error_log lines into the program to trace execution, and update my php.ini on the server to write errors to a log file. Reloading the try_auth.php file (with my url specified as a GET parameter) I'd still get the 500 error, and now I could track what was going on by also reloading the error log file. Slow and tedious, but it seemed to work.

When I finally tracked down the last line of the code that was executing, I was fairly surprised where it was. It was in JanRain's BigMath.php, and the actual line that was failing was a call to bcpowmod, a built-in PHP function (part of the encryption/decryption process, if I understand correctly). Since bcpowmod is only available in newer versions of PHP, BigMath.php has it's own powmod function, which gets called if bcpowmod is not available. So I changed the code to skip bcpowmod, and use the powmod function in BigMath. Still died. The powmod function is basically a single while loop, so I stuck a counter in to see how much it was looping. Somewhere among 500-600 iterations of the loop, the code would fail. The precise number of times was different each time, but it was always somewhere in that range. In the process I found the bcpowmod was also getting called at an earlier stage, where it finished without issue.

Ok, take a step back. Maybe it was something screwy with the OpenID provider I had picked. So I tried another one. No dice. When I finally decided to have some friends try, they also had the same error, and looking at the error log, it was in the same place. Ah, maybe wrap the offending code in a try/catch block. No dice. No exception thrown.

Well, maybe there was actually something strange with bcpowmod. So I had the code print out the values it was calling bcpowmod with (nice long integers) in the error log. I copied those into a little local script whose only job was to call bcpowmod. Worked fine. Ok, upload that to the server. Worked fine there. Hmm.

Perhaps the server was cutting the script off at a certain amount of time. I seem to recall, in reading Google App Engine documentation (not what I'm using, but still), that code had only a few seconds to return before it was interrupted, for performance reasons. Perhaps that's how the server I'm on is set up. So I found that php.ini contains those sort of limiting parameters, both execution time and memory usage. Comparing with my local php.ini I noticed the memory usage allowance was a little lower on the server, so I tried temporarily up-ing it. Didn't work. The execution time allowance was set at the default 300 (seconds), and the script was dying after about 6, so I figured that wasn't it. All the same, to test it, I changed the allowed time to about 5 seconds, to see what would happen when the script was forced to quit early. For grins, I also told the script to pause for a few seconds using a usleep() call. This gave me a different error message, so I decided that wasn't the problem.

So, now I'm out of ideas. I contacted the hosting company by submitting a support request online. Tracking the work log, it looks like they've taken a look (at something, my notice at least, hopefully the issue itself), but it's now been 3 days (2 since they last checked it out). Makes me feel like this is at least a little bit of a justifiable puzzler.

Anybody have any ideas? If this gets resolved sometime, I'll let you know how. Perhaps it's just time to start over fresh? Maybe without the EasyOpenID bit? Just get something, anything, working?

Mind Reading

So I sat down today and read 'Kluge: The Haphazard Construction of the Human Mind' by Gary Marcus [amazon]. It was overall enjoyable, but I think 'On Intelligence' by Jeff Hawkins [amazon] will still stick with me more. If you've got the time, both are worth reading, but I'd start with Hawkins' book.

My favorite part of Kludge, and a decent proportion of the text, was the numerous references to studies that had been performed, testing varying aspects of the mind and human behaviour. Examples:
  • Groups were given scrambled sets of words that, properly unscrambled, formed sentences. Those groups with words "designed to elicit the concept of the elderly" tended to leave the study walking slower than other groups. (p. 25)
  • An apparently isolated indigenous group (in the mountains of central Asia, in the 1930s) was presented with the following: "In a certain town in Siberia all bears are white. Your neighbor went to that town and he saw a bear. What color was the bear?" To this, individuals responded that they wouldn't know, and the neighbor should be asked directly. (p. 63)
One quote I liked from the book was (p. 149)
To be human is to fight a lifelong uphill battle for self-control. Why? Because evolution left us clever enough to set reasonable goals but without the willpower to see them through.
I also learned a new strange sentence in this book: "People people left left" (p. 117). That is, 'a group of people, who were left by a group of people, left'. It reminds me of this one.

Another thing I'll take away from this book is a new method of remembering lists. I've grown to distrust memory, as it seems like one of the more fallible parts of the (at least my) brain. Anyway, the technique: if you've got a list of things to remember, associate each with a room in a building that you know well. Then to remember the list, just 'walk through the building'.

While I'm at it, I'll share a memory technique of my own, which I got from my reading of 'On Intelligence' (I don't know if it was mentioned there explicitly or not, I'd have to re-read it to find out). Frequently, as I'm trying to fall asleep, I'll remember something I need/want to do. If it's not important enough to deal with immediately, what I'll do is take something nearby my bed (a book, or shirt or something), and place it somewhere that I'll be surprised to see it in the morning (toss it across the room, maybe, or, in the case of the shirt, fold it up neatly). The idea being that when I wake up, I'll notice something out of place, and it will trigger the associated memory from the night before of the thing I have to do. It's worked out well enough for me so far.

Thursday, July 10, 2008

Invites and Elsewhere

I've recently gotten a chance to sign up at a couple of online services that are apparently in 'invite-only' beta. But they have given me invites. So I thought I'd extend, to you, beloved readers, those invites. I've got a couple of invites over at Twine, and a few at dailymile. Twine is supposedly a 'semantic web' application. As far as I can tell it's a new place to store bookmarks (though you can also post comments, notes, blog), and keep them well organized. The more info you put into Twine, the better it knows you, and the better it can recommend new items. That's my understanding, anyway. Dailymile is for people who run, bike, or swim. Some sort of social network for such people, where you can keep some information about your training as well as upcoming events. So anyway, if you'd like to try either service, leave a comment below, with your email (or, if you don't want your email showing up in public comments, you'll have to find another way to contact me - or I suppose I could delete the comment afterwards). I'll update this post, at the top, if/when I run out of invites.

So, since I've been signing up at places online and trying things out, I thought it might be a good idea to make a list of those places. And since they're all reasonably public, I went ahead and posted them on the 'contact' part of my other webpage. The list includes: this blog, twitter, reader shared items, twine, dailymile, mapmyrun, goodreads, flickr, youtube, facebook, and friendfeed. Feel free to find me there.

In the process of adding those links, I thought I should try something else out. This is the XFN (XHTML Friends Network) microformat. For the links I made to my other pages, I added rel="me" to the (x)html. Supposedly that's helpful in some sort of semantic web sense. Reading a little, though, I found that rel="me" is supposed to be symmetric. So I'm supposed to now to go all of those other places and make pointers to all of the other places from them? Some of them don't have that sort of capability setup. So am I not to claim rel="me" when I link to them? I mean, I think I see the argument for rel="me" to by symmetric - if it's not, I can go around claiming any page I want.

Of course, if I'm only linking to my pages, it's not much of a 'Friends Network', huh?

I've also wondered about linking to pages that mention me before, maybe storing them all in some sort of 'mention file'. Not because I really care that if somebody finds me online, that they also find all of my other mentions. What I was thinking was if I linked to pages that mentioned me, bots might be able to distinguish between various instances of Nicholas Hamblet online (I think there is at least one other, in case you were curious). It seems like this could be helpful somehow. Like... I find an interesting mention of a 'A. Person' and wonder if it might be the 'A. Person' I went to high school with. So I go to some web services that has crawled 'mention files', and put in the page I found them on and the name (that page could, after all, mention many other people). If the web service has found a 'mention file' for that link and person, it'll let me know. Clearly this has issues: (1) several people could claim the same mention, either intentionally or not, (2) spam, as always, (3) more popular people get mentioned all the time, and keeping their 'mention file' up-to-date would be a hastle. All the same, it's something I've wondered about. I guess one way would be to set up a web service that crawls, finds names, and stores them. If it keeps track of context, it may be able to guess intelligently to distinguish individuals with the same name, and with the help of some 'mention files' and appropriate microformats, perhaps it could do ok? Perhaps there's already such a thing? Either the 'mention files' or the web service?

Tuesday, July 8, 2008

GPS in Ubuntu

When I started running more often, I decided to keep a log of my runs. I've found it to be helpful and mostly encouraging. To map the runs I do and get some idea of distance and such, I use mapmyrun (but only until I roll my own...). However, when running on trails, you're pretty much just guessing where points are. So I consider myself lucky enough to have a friend with a little portable GPS unit that I was able to borrow (thanks Sean). I took this on my favorite parts of the Rivanna Trail, here in Charlottesville. I had been worried that it'd be difficult to get the information off the unit, but it was really easy.

The unit is a Garmin etrex Venture Cx, and I am using Ubuntu 8.04 Hardy Heron. So here goes
  1. Install the gpsbabel package, with "sudo apt-get install gpsbabel".
  2. Plug the unit in via usb cable, and turn it on. I'm inside so it couldn't get a strong satellite reading, and complained about that after a few minutes, but I told it to just work without gps, so that it'd remain on.
  3. I first tried "gpsbabel -i garmin -f usb: -o gpx -F file.gpx", but it complained at me. Somewhere online I saw some indication that you had to be root, so 'sudo' that command, and you get the waypoints off of the unit. That was easy.
  4. What I was most interested in was the 'Tracks' it had stored. While probably overkill, the command "sudo gpsbabel -t -r -w -i garmin -f usb: -o gpx -F file.gpx" pulled the tracks (and waypoints, and probably more, I haven't looked too closely yet) off the unit.
So there you have it. I now have a nice looking xml file with some geodata in it. Now I just gotta get my mapping software to a point where I can use this information...

Sunday, July 6, 2008

Roku Box

My mom has been off and on thinking about joining Netflix for a little while. I've been a fan for several years. On my recent trip home I decided to sign her up, and while I was at it I bought her one of the Roku set-top boxes. I was curious how it would go, and hoping it would help provide whatever sorts of entertainment she's after. If all else fails, and she really doesn't like it... well, I'd be happy to take up the burden.

She's had the box for about a week, and here's what she had to say:
I had the boondock saints in my instant queue, but after set-up nothing happened, so I couldn't get it to the box. TV kept saying "go to netflix and put something on your queue." Netflix kept saying "you can't watch movies on your Mac." I forgot the part about rolling cursor over title slowly so "add to instant queue" came up as an option. Finding something to PUT in my queue has been a challenge - nothing current or fun seems to be on the list, though it is rather hard to tell. I've watched 4 things so far, including the boondock saints.... Works well, and we'll see what I can find on the list...
So there you have it. Sounds like the limited library might be the only issue, after learning the interface.

Friday, July 4, 2008

Toenails

With a title like that, you know this is going to be an exciting post. It's been boring here lately. You're probably better off skipping this post entirely, but I figure posting once a week is about the lowest frequency I'd like.

Anyway, I've spent more time looking at my feet since taking up running. Even more so since the Charlottesville marathon in April. The day after that run I noticed that the toe next to my big toe was bruised, basically the entire area under the nail. It was about time for some new shoes anyway, so I went ahead and bought a pair. I've had blisters most of the time since. It doesn't help that I pick at them.

But it was just this past week sometime that I realized how pointless toenails are. I mean, fingernails are useful. Toenails? Not so much. Don't get me wrong, I'm sure they were useful, somewhere along the evolutionary trail. But these days, they are just there. Stupid things. It made me wonder if there is some surgery you can get to remove the parts that are in charge of making nails. So one day I go to the doctor, get my toenails removed, and they basically turn off my body's "make toenails" function. From then on, toenail free. I think toes might look cooler without them anyway. Of course, I'd never actually do such a thing. I'm all talk. If you do it though, let me know how it goes.

I told you that you should have skipped reading this post. You'll never get this time back. If you stop following this feed, I'll understand.