News for hackers. Stuff that matters.
Re:Show HN: I wrote a script to turn a webpage into bitmap H... by stcredzero on Friday December 31, 2010 @12:44PM (#2055898)
Perhaps this could be a good start for another coding contest: The most inefficient webpage.

The object: take a copy of the Google search page and represent it in the most inefficient, bloated way possible. There would be two divisions: time-bloat and space-bloat.

Rules: Every piece of code must be involved in displaying something visibly on the page. Every statement in the Javascript must be making forward progress toward displaying the page.

The functionality of the page must be exactly the same as the original.

Any other rules?

(There wouldn't be any loading and waiting on external resources, of course.)

Re:Show HN: I wrote a script to turn a webpage into bitmap H... by viraptor on Friday December 31, 2010 @01:02PM (#2055944)
Calculate `h=SHA256(original_page)` and `n=len(original_page)`.

    do
      page = gen_random_bytes(n)
    while (h != SHA256(page))
    print page
It can be even generated client-side!
Re:Show HN: I wrote a script to turn a webpage into bitmap H... by wwortiz on Friday December 31, 2010 @01:23PM (#2055993)
Can't the same hash mean different data?
Re:Show HN: I wrote a script to turn a webpage into bitmap H... by viraptor on Friday December 31, 2010 @02:52PM (#2056268)
Well, sure. But if you add another check for likelihood that `page` is fairly-correct html in utf8, there should be around one correct result really :) If you get 2, the other one is probably a <form> you can use to sell your soul to satan - do not hit submit if you get it.
Re:Show HN: I wrote a script to turn a webpage into bitmap H... by stcredzero on Friday December 31, 2010 @08:28PM (#2056996)
The problem with this, is that the random bytes in one iteration of the loop might be closer to the page than the next iteration, so there would be reverse progress in that instance. This entry would be disqualified.
Re:Show HN: I wrote a script to turn a webpage into bitmap H... by meric on Friday December 31, 2010 @10:37PM (#2057156)

    page_bytes = bytes(size_of(bytes_of(page)))
    do
      page_bytes += 1
    while (page_bytes != bytes_of(page))
    print page