Scott Kirkwood's Personal Blog
Programming, Brazil
Country Codes
Get link
Facebook
Twitter
Pinterest
Email
Other Apps
Wikipedia is my favorite source for all kinds of information and they did a nice job on the country codes. Unfortunately, the page goes by the name ISO 3166-1 so it's not as easy as it could be to find. Link
Mark Byer's site has some more Sudoku solvers here's a short one in Python that's only 178 bytes long:def r(a):i=a.find('0');~i or exit(a);[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import*;r(argv[1]) On the site is also shown a longer Perl version at 185 bytes: use integer;sub R{for$i(grep!$A[$_],@x=0..80){%t=map{$_/27-$i/27|$_%9/3-$i%9/3&&amp;amp;$_ /9-$i/9&&($_-$i)%9?0:$A[$_]=>1}@x;R($A[$i]=$_)for grep!$t{$_},1..9;return$A[$i]=0} die@A}@A=split//,<>;R I think the Python version is slightly easier to understand, although they are both quite cryptic. I'm not sure why I find these programs fascinating. I think it reminds me that any program can be written in such a way that it's cryptic, even in Python. In addition, the code is small enough that you should be able to figure out how it works, and may learn something the process. Related is: how to sol…
Project Euler is having some problems, and in any event, I wanted to download the questions that I haven't completed yet so that I could work on some problems even when I'm off the net. I thought of use httrack which is made for this, but it doesn't seem to support passing cookies from firefox. Wget is the swiss army knife for things like this here's what I did: wget --load-cookies $COOKIE --convert-links --recursive --level=1 --restrict-file-names=windows $SITE Where COOKIE points to my firefox cookie file (~/.mozilla/firefox/.defulat/cookies.txt) and SITE is the project euler site (http://projecteuler.net/index.php?section=problems) The parameter --convert-links will update the links so that they work offline and --level is to go only one level deep. The restrict-file-names=windows is needed so that firefox can read files with ? or = in it.
Comments