

Ask HN: When have you coded yourself out of a real-life problem?  - jasonjei

What are some of the ways that you coded yourself out of a real-life problem?<p>For me, I wanted to go to Momofuku Ko, except they have an annoying .NET reservation system for their coveted 12 seats and 2 seatings, which you can only book 6 days in advance for 24 seats. You have seconds to enter your credit card number to confirm.<p>But it is a good restaurant, and reservations disappear fast; all are gone by 10:00 AM ET. So like any self-respecting hacker, I got TextMate and Ruby out, performed some sudo gem install mechanize magic, did some serious Regex/XQuery work, wrote a function to perform exponential smoothing on calculating the time difference from my clock to the Momofuku clock, and slept soundly at 7 AM Arizona time, knowing that my reservation would be booked (it's unfair I have to get up at 6:55 AM to check if my resy went through, just because I live in a state like Arizona where food is bad except for Pizzeria Bianco and some others!)<p>Hope to hear some great things from you guys!<p>Cheers,
Jason<p>Post scriptum: Frank Bruni, former NYT food editor, hates the resy system: 
NYT, Frank Bruni, "Going Ko-Ko," http://goo.gl/NYfj; NYT, Frank Bruni, "More Fun with Ko," http://goo.gl/gKGZ; NYT, Frank Bruni, "Ko-da," http://goo.gl/6rNc; Departures, "Eating Small in NY," http://departures.com/articles/eating-small-in-new-york
======
ryanwaggoner
I was going to Paris for the first time and I had been learning french, but my
pronunciation was still terrible. I use a spaced repetition flashcard system
[1] to learn new things and improve my recall, and I wanted to use it to learn
some french pronunciation. About.com has a 2500-word french audio dictionary
[2], so I spent a few hours building a scraper to pull down all the pages,
parse out the words (their markup is crazy), download the mp3 files, and build
an xml file so I could import it all into my SRS system.

Not a terribly challenging problem, but it's always nice to be able to quickly
hack up some code to solve something.

1\. <http://www.mnemosyne-proj.org/>

2\. <http://french.about.com/od/vocabulary/a/audiodictionary.htm>

~~~
Ixiaus
I use Mnemosyne quite a bit too.

I also have enjoyed writing scrapers for data I wanted but wasn't being
provided in a downloadable format - most commonly stuff on forums.

I wrote a scraper that scraped the entire textfiles.org website for their
texts (mostly for fun), I wrote a scraper that logged in as me into my
favorite phpBB forum and scraped every post in every forum in every thread -
the script would create a directory for the forum, a directory within that
named by a number to denote which page it was on, a directory within that
named after the thread, a directory within that named by a number to denote
which page it was on, and a text file containing only the content div (to
retain the formatting of the original post).

I used Python and Mechanize for most of this - the phpbb forum scraper was the
most fun and rewarding.

I've also written page scrapers for websites that have things like "1324 of
the best side boobs!" I didn't want to Save As for all of them! So I wrote a
script that downloaded them for me (this one was easy though compared to the
phpbb script).

------
coryl
This is more of a hack than coding, but I owed the school library money for a
lost book in grade school. I didn't have the money and didn't want to to tell
my parents about it, so I studied the library system.

It was a self-check in, check out system with a scanning wand. You take your
book, log your student number, scan the barcode, and it was added to your
account inventory. Returning the book was the same way; but if you didn't have
the book, you obviously couldn't scan it back in. I figured out you could look
up the book's ISBN through your account inventory, write it down, and manually
enter it into the return form.

BAM! Lost book was magically returned :D. I told a few friends about it, I'm
sure the school lost out on a few hundred dollars worth of books that year.

------
iuguy
At College they used 386s and 486s running DOS and Windows 3.1. At home I used
an Amiga 1200. The two are not exactly compatible. I would routinely be given
assignments, have to write them in QuickBasic for class and would have to
spend half a day at college instead of at home. I didn't have a Microsoft
Basic variant (other than GW-BASIC which wasn't quite compatible) and used
AMOS instead to test the algorithm, then rewrite in QuickBasic. I tried
submitting work in C but my lecturer would refuse to accept them as we hadn't
covered that module yet.

In the end I wrote an AMOS -> QuickBasic converter in C, first for DICE C on
Amiga, then tweaked for Turbo C on the PC. I could then do the rest of my
coursework at home on my Amiga, instead of the grubby old slow 386s.

------
phaedrus
I've written my own custom data recovery tools to recover lost files. The
first was a hack of ddrescue to only recover sectors containing a certain
string (because the drive had so many bad sectors that a full ddrescue would
have taken weeks to complete). Recently I wrote a tool to recover deleted
directory contents from ext file systems that works even if all the inodes are
gone. I didn't need the file data, only the names and folder structure, and I
realized that if you don't need the data you never need to dereference the
inodes. Instead you can treat the inode _number_ like a database key to cross
reference directory blocks.

------
randylahey
I realized I had lost an important file (a letter of recommendation from my
university co-op placement). I no longer had the e-mail it was attached to
(this is prior to me using webmail), nor the e-mail program. But what's this?
I still have the mailbox files. Well, I know python has some multipart
utilities... maybe I can copy and paste the relevant parts out of this message
and into a script and have it write out the attachment sub-message. After a
bit of fiddling, it worked!

I was elated. It was by no means a very challenging thing to do, but I would
have been totally fucked if I didn't know how to do software development.

------
atomical
There is a particular database system used by newspapers that encodes the date
in base64 in a query parameter. You could search and find the dates, but you
needed a subscription to access the links. It was setup so if you had the link
you could link others to it free of charge.

Well, the guy at the local library with subscription started to get irritated
with me after the third or fourth link so I built my own search engine to use
their search engine. I was a research assistant at the time.

------
eof
In 10th grade, we had some security software on our computers in high school
called 'Fortress' (circa 1998). I had a multi-media project due for a class
that I never did. I compiled eofspresentation.exe in VB that did one thing:

Popped up a dialog, "Cannot run due to security"

~~~
TeHCrAzY
Reminds me of grabbing a random .dll, renaming it to .doc, putting it on a
floppy disk and handing it in, all to gain myself a few extra days to finish
my assignment.

~~~
threepointone
I did a smililar thing for my final year mid year thesis review - took a pdf,
opened it up in wordpad (!), cut out chunks of it, saved it, and submitted it.
Got 2 weeks extra, nabbed an A myself.

... not sure if I should have said this in public, but I remember being
strangely proud for having bent the system a bit :)

------
axxl
I hated powerpoint (and still mostly do), so I ended up coding a presentation
in BlitzMax (a version of Basic designed for cross platform game development)
in order to make a presentation for my geometry class sophomore year. I had
all different shapes displayed on screen and transformed them around and such
to show off different proofs.

------
sdrinf
Problem: born in hungary. Solution: during high school, I've complemented my
english courses using the Internet (reading RFCs, and white papers). After
university, I've literally hacked myself out of the country, by doing
consulting on the side, and saving every penny I could.

Currently in London, and content, if not happy.

------
fezzl
Back in 7th grade, I wanted to know everything about my high school crush, so
I phished her email password via email link baits (followed by fake Hotmail
error pages). Worked so well that I started phishing the entire school's
passwords.

