Box Relatives

Thoughts about puzzles, math, coding, and miscellaneous

August 12, 2011
by Alex
7 Comments

Canadian baseball

When I saw the news that Wayne Gretzky’s son had signed with the Chicago Cubs my first thought was “I bet he hits left-handed and throws right-handed.” And sure enough:

Gretzky, 18, finished his senior season with a .393 batting average (42-for-107), 10 doubles, four triples, a home run and 27 RBI in 31 games for Oaks Christian in 2011. The 6-foot-4, 190-pounder recorded a .450 on-base percentage and was nine-for-10 in stolen base attempts. A left-handed hitter and right-handed fielder, Gretzky played first base and the outfield last season.

Why did I assume this? Because it seems like all Canadians do this. Now, just like with almost any vast generalization, there are exceptions — Russell Martin and Jason Bay come to mind — but consider some of the best Canadian baseballers — Joey Votto, Matt Stairs, Pete Orr, Justin Morneau, Adam Stern, Mark Teahen, Corey Koskie …

Is there any reason for this or is it just coincidence? Most people’s immediate reaction is that hockey has something to do with it, but I don’t see the connection. Any theories?

July 29, 2011
by Alex
15 Comments

Is crossword blogging illegal?

A short while back, a pseudonymous blogger started a blog covering the CrosSynergy crossword. It did the usual things a crossword blog did — it displayed the completed solution grid along with the clues and answers. In fact, it looked conspicuously like the LAT crossword blog looks on Sundays. About a week ago, the blogger was contacted by CrosSynergy, claiming that the site violated their copyright. They even went so far as to file a DMCA complaint with Google. The blogger immediately deleted the blog to avoid any further complications.

Well, as you’ve probably guessed, the pseudonymous blogger in question was me.

I won’t try to argue that what I was doing was legal. I’m not a copyright lawyer, and copyright law is complicated. I think it’s especially complicated for crosswords, because several things are certainly not copyrightable about a crossword — the empty grid itself, the individual clues … you could probably argue that the solution grid is copyrightable, and maybe the theme. And of course, the empty grid and clues together. But again, I don’t know enough about the issue to argue either way. I had just assumed it was okay because so many other sites were doing something similar.

I don’t mind having taken down the blog. It wasn’t getting many hits anyway. But what really hurts is that as a result of this, Google has disabled my AdSense account, as they now view me as a copyright violator. This includes removing all ads from my totally unrelated YouTube videos. I suppose I should be thankful that they didn’t delete my account entirely or bring criminal charges against me, but I don’t see it that way.

Anyway, I guess this is a word of warning. If you are planning on starting a crossword blog, you may want to check with the owners of the copyright of the crossword to make sure it’s okay. Most of them seem all right with it, but if you run into someone who’s not, you can potentially get yourself into a lot of trouble.

July 26, 2011
by Alex
0 comments

A Dan Uggla Statistic

On May 21 of this year, the Atlanta Braves beat the Anaheim/L.A. Angels 5-4. Dan Uggla went 1 for 6 in this game. What is remarkable about this, you ask? As far as I can tell, this is the only time all year that he had a hit in a game and actually lowered his batting average. In this case, it went down from .190 to .189. In other words, in every other game this year in which Dan Uggla has done so much as getting a single hit, it’s been enough to raise his batting average. That’s how bad his BA has been all season.

By comparison, you only have to go back a few days to find an instance in which Freddie Freeman has pulled off this feat. On July 23, he went 1 for 4, lowering his average from .280 to .279.

Okay, now place your bets: will this happen again to Uggla this season? His batting average now sits at .195, but is climbing thanks to a recent hitting streak. If he gets it above .200, he just needs a 1 for 5 day to lower his batting average despite getting a hit. There’s plenty of season left, I say he does it. I’ll say … early September. Because I’m an optimist.

July 21, 2011
by Alex
9 Comments

Why do you pay for cable?

Note: this is not a “you should stop paying for cable right now!” post. I’m legitimately interested in why people pay for cable TV. I personally don’t and I never have, but I have good reasons for this:

  • I don’t watch much TV at all. This is reason #1 and probably the main one. It’s simply not worth shelling out however much it is for cable with as little TV as I watch.
  • For most of the TV I do watch, I don’t mind watching it after it airs, either on Netflix or Hulu.
  • The only TV I really like watching live is sports. I can watch all the Braves games I want with my MLB.tv subscription, and I can watch just as many NFL games in HD as someone who pays for cable with my rooftop antenna.

So … I guess if you do pay for cable, it’s probably for the opposite of one of the above reasons, right? Maybe you like several of the shows you can’t get on Hulu, like “Breaking Bad” or “Mad Men”, and you can’t wait for them to come out on DVD. Maybe your favorite baseball team is local, and you need to get cable to watch them live (with MLB.tv, local teams are blacked out, which is ridiculous, especially if you live in Las Vegas or Iowa). Also, maybe you just love your TiVo? Though I guess that’s not really an excuse anymore.

So! Why haven’t you cut the cord?

June 28, 2011
by Alex
0 comments

Passwords

Update 7/6/2011 — Mirroring this site is not only allowed, but encouraged!  If you’re interested, grab the javascript and the code and post it on your site. I’d love it if you would post a comment here if you do so.

In recent weeks I’ve gotten increasingly worried about my passwords, what with all the hacking that has been going on. I was a serial password re-user and now I realize that this was a mistake. I’ve started using a password manager for Firefox at home, but this isn’t an ideal solution, as my passwords are only on my home computer. I was discussing this with some colleagues at work and thought the following might be the best solution: for each website simply take the first few (say 5) characters of the name of the site, then concatenate that with a key phrase (perhaps the password you’ve been reusing). Then create a hash of the result and take the first few (say 12) characters. Thanks to this site, I’ve embedded a SHA-256 hash generator below. Don’t worry — it only uses javascript so no information you type will be passed to my server.

Input
Calculate
Result

Let me give some examples here so it’s clear what’s going on. Say you’ve been using the ultra-insecure password “MyPassword” for gmail, paypal, and ebay, but now you want something more secure. Using the method detailed above, you would take the three strings “gmailMyPassword”, “paypalMyPassword” and “ebayMyPassword” and feed them into the generator above to get the three much more secure passwords “f8809f148b90”, “04b1bbe378d3”, and “691b2660c9e2”. You can then save them in a Firefox password manager for everyday use, and if you are at a new computer and need the passwords, you can come back to this page to retrieve them.

Now, this system isn’t perfect. Some sites will require you to have at least one uppercase letter — in that case I recommend changing the first letter in the generated password to uppercase (e.g. 691b2660c9e2 -> 691B2660c9e2). Some sites may require you to not start your password with a numeral, which is stupid, so you shouldn’t be on any of those sites (kidding! … though I don’t know how you would adapt this to that situation — Update: maybe pick a letter to add to the beginning in those situations?) And in case you are worried that this page may not be here forever, don’t worry — there are plenty of other SHA-256 hash generators online; you’ll just have to truncate to the first 12 characters manually.

Notes and updates:

  • Out of an overabundance of caution, you may not want to generate passwords in exactly the way I’ve described. Consider forming your strings like MyPasswordgmail, MyPassword@gmail, MyPassword!gmail, MyPasgmailsword, gmail.com-MyPassword, etc.
  • Yes, there are other sites that do something similar. But I would be worried that if those sites disappear, you would be left without a way to recover your original passwords. This process is simpler, only relying on the SHA-256 algorithm, which, as mentioned above, is popular and has many implementations.
  • I’ve re-posted this on Blogger so that in case I fail to pay for my web hosting, at least this service will remain active so long as I don’t violate Google’s terms of service or anything.
  • I’ve added an “advanced” method that does the following: it passes your string through the SHA-256 hash function as before, but then converts that output to a Base64 encoding, removes any ‘+’ or ‘/’ in the result, and gives you the first 12 characters of the output. This will give passwords with more characters, but is not as easily reproduced without this site.
  • 7/6/2011 — All right, I’ve added two more modes that rely on the popular MD5 hash, as opposed to SHA-256.  I may add more at some point as well.

June 20, 2011
by Alex
0 comments

Autogridding

I’m going to try something new here. I’ve got a new toy, and I’m going to play with it.

Last week, Brendan Quigley made a triple stack puzzle and mentioned

Still, even with the computer assistance, I can’t pull off the three on top, middle and bottom with another 15 running through all of them. Maybe sometime in the future. But as of today, it’s a mystery how to pull those off.

Well, I took that as a challenge and created this puzzle with a program that automatically fills a grid and clues it. It came out … okay. There’s a naughty word in it that really shouldn’t be there, but it’s more or less all right.

Well, this week, Brendan wrote a puzzle “with the six longest theme answers intersecting each other in the middle so that there’s a chunky 3×3 white in the dead center.” Well, that sounds like a challenge too! What about a puzzle with a chunky 5×5 block of white squares in the dead center? Well, here it is. 64 words, 38 blocks. A few too many partials, perhaps. The intersection of 4-Across and 6-Down could obviously be better. Still, not bad for a little under two minutes of computer work.

I think I’ll keep doing this. It’ll improve my word list and it’s fun to see what is easy with this little computer program, and what is not. Just FYI: quint-stacks and 50-word grids are NOT EASY.

June 10, 2011
by Alex
1 Comment

How to make money from the internet

There are lots of ways to make money off the internet*, but some of them are really hard. Here’s one (somewhat) easy way I can think of: come up with something that

  • People google but have a hard time finding, and
  • Is available on the internet already in some ungoogleable format.

That’s the hard part. Then all you have to do is write a script to convert that information into a more Google-friendly format, post it to a site, and plaster ads all over it. Preferably, this would be information that is changing all the time, so that you can create several pages of content, each with its own ads. Once you’ve written the script, this will all run on its own as often as it needs to be updated.

*One way is to create a blog post entitled “how to make money off the internet.”

The best example of this I’ve found is Crossword Heaven. If you google a crossword clue, Crossword Heaven’s site shows up early in the search results. It doesn’t show you the answer right away, it makes you click for it. And when you do click, you get the answer and a bunch of ads. It’s brilliant. I don’t think that site requires any manual intervention apart from the initial setup — every day (I assume) the site runs a script to download all the information about the day’s crosswords, adds them to a database, creates new pages based on the new clues, and voila. People are constantly googling crossword clues, so it makes sense to do that.

So! What other areas are open for this kind of scheme?

May 26, 2011
by Alex
0 comments

Making JPZ puzzles

So a while back I made a crossword for Brendan Quigley’s site. You can check it out here. If you haven’t done it, go ahead. I’ll wait. Listen to some defective turrets while you solve.




Okay, now you might have solved on paper, but you probably shouldn’t have. Ooh, should have warned you about that ahead of time. Um, the point is: how did I make the .jpz file? If I had Crossword Compiler, it probably would have been easy, but I don’t. So if you’re interested in how to make these things, come along!

Continue Reading →

May 19, 2011
by Alex
12 Comments

Deprecated perl

Perl, I’m leaving you.

I changed my GMail status to this today and I thought I would give a few words about why. I wanted to go through my Scrabble word list to find five-letter words in which the 3rd and 4th letters were the same, and which became new words when read backward. At first I modified a stock perl script of mine to do it, and then I wondered how easy it would be in Python. So I took a few minutes and came up with this:

#!/usr/bin/python

fid = open('scrabble.txt','r')
dict = [x.rstrip('\r\n') for x in fid.readlines()]
fid.close()
mywords = [x for x in dict if len(x) == 5 and \
x[2] == x[3] and x[::-1] in dict]
print mywords

(Edited to fix a minor error)

How awesome is that? Look at how short, clean, and readable it is! The only slightly tricky part is the

x[::-1]

bit that reverses the string x. So from now on, all my (new) scripting will be in Python. This includes, by the way, the Roman numeral clue page that’s just gone up. So there’s that, too.

Update: here’s Joon’s perl code to do the same thing.

#!/usr/bin/perl
use strict;

my %dict;
open DICT, "scrabble.txt";
while (<DICT>) { chomp; $dict{$_} = 1; }
close DICT;
for (sort keys %dict) { print "$_\n" if (/^..(.)\1.$/ && $dict{reverse($_)}); }

May 7, 2011
by Alex
1 Comment

Google Nexus Puzzle 6

All right, looks like I’m kicking off this blog with a complaint.  This does not bode well for the future.  Hey, I just kicked off the blog with a complaint and a self-deprecating remark!  We’re two for two.

Anyway: the puzzle-minded among you know that Google Nexus has a Twitter feed on which they post an occasional contest.  If you are the first to answer the contest correctly, you win a new Google Nexus S phone.  Not bad, right?  Well, recently, they ran a very frustrating puzzle.  The idea was, Twitter users would suggest ten-character strings, and they would tweet back whether your string fit a particular pattern they had in mind. If you picked up on the pattern early, you could tell them what it was and win the prize.

The problem?  For some reason they were verifying user-submitted strings by hand, and trying to do so every minute or so.  This probably led to some very tired and frustrated Google employees, and … it led to some mistakes.  Their intended pattern was: letters in ascending order, 3-5 numerals, exactly 1 vowel.  Except they allowed two strings that didn’t fit the pattern.  And, if you were wracking your brains trying to figure out the pattern like I was, it just led to a few hair-tearing-out* hours.

* For lack of a better word.

So I got to thinking: why didn’t they just write a script to auto-reply for them?  It should be easy to write a Python script that would search for @-mentions, check for ten-character strings, and reply to a user whether or not his string fit the pattern.  I gave myself an hour one morning and came up with this.  It certainly does the job and can easily be set to run every minute or so to look for new replies.  It might need to be tweaked a little — you’d want to make sure there are about as many “yes” replies as “no”, and you’d probably want to limit the total number of replies to somewhat less than 20 per minute.  But the point is: Google has much better Python coders than me.  For about an hour of coding (and some beta testing to be careful) they could have avoided a lot of trouble for themselves and a lot of gut-wrenchiness* for the rest of us.

* See above footnote

Okay!  No more complaining!  Next time, we’ll talk a little bit about the technical aspects of making my puzzle for BEQ’s site without Crossword Compiler.  If you’re interested in making JPZ puzzles, you might want to stay tuned.