Tag Archives: sudoku

Sudoku Scraper: newspaper sudoku in your Hipster PDA

The other day, I pub­lished my Sudoku Scraper code, both on a project page here at Netninja and over at GitHub.

For a while, I have had a lit­tle PHP script that scraped the USA Today and New York Times web­sites for the daily sudoku puz­zle.  And for a while, this script was the home­page on my iPhone.  Each day, it would grab the daily puz­zles and give me a lit­tle text dump that looked some­thing like this:

In that form it is fairly use­less.  That prompted me to make the “Sudoku Blank” Hipster PDA cards.  I could then copy down the daily puz­zles onto the blanks and solve from there.  I was quite happy with this for a cou­ple of years, but slowly grew tired of hav­ing to tran­scribe the puz­zles every day.  It even­tu­ally got to the point where I stopped doing the daily puz­zles.

Enter this new script.  The new Ruby script, much like the old PHP script, scrapes the two daily puz­zles.  It then goes a step fur­ther.  Instead of forc­ing me to tran­scribe the puz­zles (some­times with errors) onto a blank tem­plate, it actu­ally gen­er­ates the PDF tem­plate, already filled out with the day’s puz­zles.  Not only that, but if you set it up on a cron job, look at it in the iCab browser on the iPhone, then send it to Printopia, it can be on your printer before you even get out of bed.  I had to use iCab because it turns out that the iPhone’s Safari will not print PDFs.  You can use Safari to send the PDF to some other app that can print (GoodReader, iBooks), but it won’t print directly.  It’s then just a lit­tle bit of origami fold­ing to stuff it in your Field Notes book.

More infor­ma­tion, as well as the source code, is avail­able on the project page:


Posted in: Projects

Netninja Mobile, now with sudoku

A lit­tle over two years ago, back when the iPhone SDK con­sisted of “here, kid, here’s a text edi­tor, now go away and make your­self a nice lit­tle web page, and quit both­erin’ me,” I quickly hacked together a lit­tle web con­trol panel and called it Phonemarks. It ran, and con­tin­ues to run in some form or another, at http://m.netninja.com/. It has not been ter­ri­bly use­ful in recent times. There are now native apps. You can put book­marks to pages on your home screen. Through the magic of Foxmarks, I can keep my book­marks in sync between Firefox (all the places I have Firefox installed), Safari, and (by exten­sion) the iPhone. My Phonemarks project has all but died due to lack of use­ful­ness and lack of inter­est. The only thing I find use­ful about the page these days is the search box. It allows for quick search­ing of Google, Google Images, Wikipedia, IMDB, dictionary.com, thesaurus.com, Amazon, Powells, and Netflix. Adding a new search site is extremely easy. This sim­ple lit­tle form has saved a ton of time.

Veering off in a seem­ingly dif­fer­ent direc­tion for a bit: I enjoy sudoku. I enjoy work­ing on sudoku puz­zles with pen, paper, and my brain — with­out the aid of pro­grams to do the grunt-work for you. Increasingly, I can solve mod­er­ate and even a few dif­fi­cult puz­zles doing this grunt-work entirely in my head, but even when I have to do it, I find it sim­ple and repet­i­tive enough to be a sort of exer­cise in zen relax­ation. Yeah, it’s weird to talk about a num­ber puz­zle like that. Quite often I will go to the New York Times daily hard puz­zle and the USA Today daily puz­zle and copy them down to a blank Hipster PDA sudoku tem­plate for “offline” “low-fi” play. Because one of those pages is Java and the other is Flash, it means I have to be sit­ting at a desk­top browser to do this. Access from the iPhone does not work.

Veering off in yet a dif­fer­ent per­pen­dic­u­lar for a bit: I reverse engi­neered the data pro­to­col for both sudoku sites ages ago. I took lots of notes and wrote pseudocode, but never got around to writ­ing actual code. A few months ago, I cut my teeth on Adobe Flex pro­gram­ming by finally imple­ment­ing a data scraper app in Flex. Flex is a nice lan­guage. For a sand­boxed GUI front end. For apps that don’t inte­grate well into the native OS. It’s like Java for the Web 2.0 world and allows you to trade in all of the prob­lems with Java for an entirely new set of prob­lems. Don’t even talk to me about vari­able scop­ing. My sudoku scraper app is not avail­able for down­load, as it only works in the debug­ger due to some cross-site sand­box­ing issues. A few weeks ago, I rewrote that scraper in PHP and attached it to my iPhone home­page.

Just today (finally tying together the above asides — see, I was going some­where with those), I made a home­page for the Kindle sim­i­lar to my iPhone home­page. Some things could be left out of the search form — for instance, Google, Wikipedia, and dic­tio­nary searches are avail­able from just about every­where in the Kindle OS, so are redun­dant enough to get in the way. IMDB searches are use­ful (but would be more use­ful if they offered a mobile ver­sion of their site; their site is dog-slow on the Kindle’s browser). Sudoku, of course, is in there.

netninja-home-iphone netninja-home-kindle

So far my only com­plaint with the Kindle web browser is that, while some parts of CSS are avail­able, other (seem­ingly sim­pler) parts are not. There is no mono­spaced font. There is no non-breaking space. There is no <pre> tag. I tried to lay out the sudoku grid as plain­text instead of a table to shave a few dozen (or hun­dred?) mil­lisec­onds off of the page ren­der­ing time. Due to the nature of how I’d be using it, I care more about the speed of the page and the data con­tained in it than I care about a pixel-perfect fancy lay­out. But oddly, table CSS such as the right and bot­tom bor­ders of the indi­vid­ual table data ele­ments work fine but fea­tures I con­sider to be more sim­ple, like mono­spaced plain­text, do not work at all. Javascript some­times works, but often does not, so I will have to rework my Kindle/iPhone autode­tec­tor to work in PHP or mod_rewrite.

Posted in: Code iPhone Mobile

Drinking coffee could help to activate your prefrontal cortex

I fin­ished all of the sudoku on Brain Age and all I got was this stu­pid 100% read­out.


There was no fan­fare, no con­grat­u­la­tory mes­sage, noth­ing. Lately, I have only been play­ing the sudoku part of Brain Age — and I have not even been play­ing that all that much.  I really should get back into the other parts of brain train­ing and test­ing.

Posted in: Dear Diary Games

Hipster Sudoku

Please note that all blog posts before 8 April 2007 were auto­mat­i­cally imported from LiveJournal.  To see the com­ments and any LiveJournal-specific extras such as polls and user icons, please find the source post­ing at http://brianenigma.livejournal.com/2007/03/

Last time, I talked about print­ing or stamps, but I caved in and sim­ply made a smaller Sudoku grid. The pre­vi­ous grid was 2.75″ (on a 3″ wide card.) This new one is 2.5″ and should fall within the mar­gin of error of con­sumer double-sided print­ing.

Posted in: Projects


My 3x5 Life

Please note that all blog posts before 8 April 2007 were auto­mat­i­cally imported from LiveJournal.  To see the com­ments and any LiveJournal-specific extras such as polls and user icons, please find the source post­ing at http://brianenigma.livejournal.com/2007/03/

This is another Hipster PDA report from the front lines. Previous ones are tagged hip­ster­pda.

A month or two ago, I picked up a shirt pocket brief­case from Levenger. It’s basi­cally a leather wal­let and writ­ing sur­face for 3x5 cards. It’s a fancy Hipster PDA vari­ant that’s use­ful for car­ry­ing around to meet­ings with clients. While I still use the ghetto binder-clip ver­sion for all of my own stuff–for that extra street cred, ya’ know–the fancy ver­sion is use­ful for work-related notes (and for keep­ing work at work, iso­lated from the per­sonal Hipster PDA, if that makes sense.)

I noticed that Levenger sells 3x5 file fold­ers that look like your typ­i­cal manilla 8.5x11 fold­ers, but put through the shinkotron. Because I did not feel like fork­ing over the cash and because they are sim­ple enough I made some myself (PDF forth­com­ing, if you’re inter­ested.) This lets me jot down notes dur­ing meet­ings and brain­storms, then group sim­i­lar notes together — like with reg­u­lar paper and reg­u­lar hang­ing file fold­ers, but smaller. It’s also a use­ful long-term stor­age for “back of the paper nap­kin” style notes and dia­grams. I ended up get­ting another cheezy plas­tic recipe-box style box to put them in, but only after spend­ing a week try­ing to find a local place that sells nice wooden boxes of the cor­rect size.

I’ve found a flaw in the Sudoko cards that I designed. The flaw is that the PDF is too accu­rate for con­sumer print­ers. I’m find­ing that most print­ers, when han­dling card­stock, get really finicky about every­thing. Depending on how much paper is in the paper feed and how care­fully you try to feed it through, the results could be as much as a quarter-inch off by the time the printer reaches the other end of the paper. It’s that whole thing about small angles grow­ing to large dif­fer­ences if you fol­low the angle out far enough. Trying to man­u­ally get every­thing to line up each time, then cut things exactly (even with a nice paper cut­ter), is start­ing to be a pain in the butt. I actu­ally talked to a cou­ple of local print houses about hav­ing some­one else do the exact print­work and cut­ting, but over $100 for 500‑1000 cards seems exces­sive to me. As much as I hate to do it, I may just have to shrink down the size of the grid to account for printer inac­cu­ra­cies. Another thought was to have some­one make (or make myself, if there’s a way) a rub­ber stamp to just put the grid on reg­u­lar blank cards, but I have not had much luck in that depart­ment. Most stamp com­pa­nies only want to han­dle text: return mail­ing addresses, check endorse­ments, inspected by #23, and that sort of thing, with maybe a piece of stock cli­part. So shrink­ing the pat­tern might be my only remain­ing option.

Posted in: Dear Diary Work

Hipster PDA Revisited

Please note that all blog posts before 8 April 2007 were auto­mat­i­cally imported from LiveJournal.  To see the com­ments and any LiveJournal-specific extras such as polls and user icons, please find the source post­ing at http://brianenigma.livejournal.com/2007/02/

After about a month of using a Hipster PDA, I have to say that parts of it are work­ing extremely well and other parts aren’t.

To-Do List
This works sur­pris­ingly well, and I have a lit­tle bit of a the­ory about this. With the to-do list in my orga­nizer or on the com­puter, I always have to keep refer­ring back to it. Many, many, many times a day, I will hit the right sequence of but­tons (the “Calendar” key 3 times on my Treo) to bring it up. With the Hipster PDA to-do list, I remem­ber things on the list with­out hav­ing to look at it con­stantly. I believe this is entirely due to the tac­tile nature of the writ­ten list, giv­ing my brain some­thing to latch on to. With the com­puter and phone/organizer, the list is a screen. The back­ground is white, the fore­ground is black, the items on the screen are all a con­sis­tent size in a con­sis­tent font. It’s all cookie-cutter, and there­fore eas­ily for­get­table. It con­veys the infor­ma­tion long enough to look at, but does not leave any “hooks” for the brain (or, at least, *my* brain) to latch on to. With the printed list, there are a num­ber of good mem­ory “hooks.” First off, there is the act of writ­ing out the items. Like a school child writ­ing out the word “ency­clo­pe­dia” ten times in a row as a spelling exer­cise, writ­ing out the items hits a piece of [my] mem­ory that is not hit by sim­ply typ­ing. Second, there are lots of lit­tle irreg­u­lar­i­ties, incon­sis­ten­cies, or just plain unique things about hand­writ­ing on paper that seem to give my brain a bunch of things to latch on to: the spac­ing of the items, the size of the items, the cou­ple of items writ­ten side­ways because there wasn’t enough space at the bot­tom, the way that the descen­der on a par­tic­u­lar let­ter swoops, the “t” that didn’t quite get crossed, the asym­me­try of a par­tic­u­lar cap­i­tal “A,” or maybe just the look and feel of the paper as it fades from its orig­i­nal pure white after days of use. At any rate, there are lots of lit­tle phys­i­cal, vis­i­ble, and tac­tile cues in there that let me actively visu­al­ize the whole card and the items on the card. I do not have to refer to it as much because the items are more mem­o­rable.

I gave up. A printed cal­en­dar just can’t touch the iCal/Treo cal­en­dar syn­chro­niza­tion. It’s pretty much a data­base with mul­ti­ple views–day, week, month, etc. The only way to do that on paper cards is to use non-normalized data (to use a data­base term... or “lots of dupli­cates” to use com­mon English.) Duplicating the same event on the monthly, weekly, and daily cal­en­dars is just a pain.

Yes, it’s sort of a weird card/page, but the Harmony card is work­ing out well for me, but maybe not as well as I hoped. Its main focus is as a to-do, but to track a few short-term items ver­sus sev­eral long-term goals. It also helps bal­ance and track phys­i­cal, men­tal, social, and inspirational/spiritual goals. It’s a bit more rigidly defined than a free-form blank to-do card, and it forces me to think about long-term goals. I find that I’m maybe not refer­ring back to it enough, or maybe not com­ing up with good short-term steps to lead to the long-term goals. So while this is mostly work­ing, I either need to tweak the card or tweak my life to get it work­ing bet­ter.


Potential Project
Awesomeness! I often get crazy ideas for some future project. Sometimes I end up doing the project. Sometimes I drop it. Sometimes I com­pletely for­get about it. Having a spe­cific page for a spe­cific future project is an awe­some idea. There’s a spot for a title, descrip­tion, sum­mary, and a graph-paper sec­tion. When I think of a new idea, I can put it on a new Potential Project page, then for­get about it until later. These projects roll around in the back of my mind (although now won’t get lost because they’re writ­ten down in a spe­cific place) and some­times, with­out try­ing, I think of some cool detail or tech­nique to add to the card. If and when I get the time and moti­va­tion to work on one of these projects, all of the notes are in one spot.

Financial Log
I hon­estly haven’t used this. I tend to use the debit card for every­thing, which leaves an item­ized trans­ac­tion in my bank state­ment. It’s pretty easy to load this into the com­puter and tag it with the appro­pri­ate labels (gro­ceries, util­i­ties, etc.) based on the line item. I haven’t come across a time when I have needed to write down a trans­ac­tion.

Shopping List
The shop­ping list I made works really well. I am prob­a­bly going to flip the ori­en­ta­tion of the back side of the card, though. When I orig­i­nally designed it, I thought of hold­ing it in my hand, then flip­ping it top-to-bottom to get to the reverse. With it a “page,” clipped in to the hip­ster PDA, it really should behave more like a book and flip right-over-left. I am also con­sid­er­ing ‘s sug­ges­tion of group­ing items by kind, rather than alpha­bet­i­cally. One thing that I miss about the Treo SplashShopper pro­gram is the abil­ity to set up tem­plates (like “all prod­ucts nec­es­sary to make casse­role”), which can’t be eas­ily done on paper with­out car­ry­ing around a bunch of recipe ingre­di­ent cards.

Various Other Templates
For me, with my brain, noth­ing works as well or is as flex­i­ble as a blank white card. I have tried a few of the other tem­plates, but have found that [for me], they are either too rigid in for­mat or are so flex­i­ble that I’d be bet­ter off just using a blank card.

So over­all, it is work­ing great as a to-do list and for project notes. It works so-so for a num­ber of other things (shop­ping, long-term goals.) The pre-made pages don’t work well [for me] for other things, but blank pages are like blank can­vases and can hold all vari­ety of notes, so that’s a win. It is a lot more dif­fi­cult to draw a quick dia­gram or jot down a few free-form notes on the Treo, given its screen size and res­o­lu­tion. I didn’t men­tion it here, but the “big box o’ index cards” as a task list at work, as expected and as always, is still work­ing well.

Posted in: Projects

Sudoku Theory

Please note that all blog posts before 8 April 2007 were auto­mat­i­cally imported from LiveJournal.  To see the com­ments and any LiveJournal-specific extras such as polls and user icons, please find the source post­ing at http://brianenigma.livejournal.com/2007/01/

There is a sur­plus of sudoku books avail­able at most book­stores. They all have one thing in com­mon: they have a zil­lion puz­zles, some­times pref­aced with a scant 2–3 pages of how-to. The how-to is usu­ally not much more than a route set of rules to fol­low, with lit­tle real expla­na­tion. Books that actu­ally get into the the­ory, logic, and design are vir­tu­ally nonex­is­tent. I have my own skep­tic rea­sons for why this is the case–similar to the “give the man a fish vs. teach a man to fish” line of rea­son­ing. Why give out the secret to cre­at­ing sudoku when you can instead cre­ate a bunch your­self, bind them in books, and sell a bunch of dif­fer­ent books?

Some time, in recent mem­ory, I did see a book up on a shelf that did get into the math­e­mat­i­cal the­ory of sudoku as well as algo­rithms for cre­at­ing puz­zles. Unfortunately, I do not remem­ber where it was, what the title was, or who the author was. Amazon searches have found exactly one book, pri­mar­ily focused on Visual Basic. The review­ers are a bit crit­i­cal of the method­olo­gies (solv­ing by brute force, cre­at­ing using only 4 strate­gies), and I’d really rather not have to men­tally trans­late VisualBasic to any of the C-based lan­guages that are avail­able to me (C, C++, Java, PHP, etc.)

There has to be a decent book on the sub­ject out there. I just can­not seem to find it.

Posted in: Books Code