Arc Forumnew | comments | leaders | submitlogin
6 points by gjohnson 6147 days ago | link | parent

Just for kicks, here it is solely in HTML and CSS. Ah...gotta love those target selectors.

    <!DOCTYPE HTML>
    <html>
        <head>
            <title></title>
            <style type="text/css">
            #page2{display:none}
            #page2:target{height:100%;width:100%;position:absolute;top:0;left:0;background-color:#ffffff;z-index:2;display:block}
            #page13:target input[type="submit"]{display:none}
            #page13 p{display:none}
            #page13:target p{display:inline}
            #page13:target input{display:inline-block;border:0px}
            </style>
        </head>
        <body>
            <div id="page13" class="page">
                <form action="" method="post">
                <p>You said:</p>
                <input type="text">
                <div style="position:relative">
                    <input type="submit">
                    <a href="#page2" style="position:absolute;top:0;left:0;height:100%;width:100%"></a>
                </div>
                </form>
            </div>
            <div id="page2" class="page">
                <a href="#page13">click here</a>
            </div>
        </body>
    </html>


2 points by gjohnson 6146 days ago | link

Oh yeah. A little side note here. Just wondering how you guys want to judge this submission for length since:

1) No programming languages used, only markup/presentation languages (0 lines of code?).

2) Entirely client side behavior.

3) Works simultaneously across multiple page instances in tabbed browsing as several folks have pointed out that this could be a problem with some of the session managed solutions here.

Anyway, I'm loving everyone's submissions. These are some great hacks, folks. Keep'em coming. &P

-----

2 points by sacado 6146 days ago | link

Excellent submission. Didn't think it was possible to deal with that only through pure HTML... As for length, well, no matter whether it is pure markup language only on client side or not, the point is, to make it work, you had to type n lines of code, and pg's motto is : "the shorter the better"

-----

2 points by gjohnson 6146 days ago | link

Ah, touche. However, pg claimed that the length of the program should be measured in terms of the length of its parse tree, not the number of lines of code. In everyone's submissions here, their code is generating one or more webpages in HTML (as, of course, is pg's). The parse tree being measured (at least in pg's original arc example) appears to be that of the server-side language used to do the scripting and generate the HTML and does not include the parse tree of the HTML itself, which is, of course, generated and executed in the client-side webbrowser for everyone's example and shouldn't be counted toward the server-side parse tree.

So then, to sum it all up, I'd have to say that this "program" to meet pg's requirements requires no server-side code (and thus a server-side parse tree of size 0) since it's just being served up as a static page. If you want to count the DOM parse tree length of my HTML/CSS, then you must also count that generated by every other submission here, which essentially adds some constant factor to all the metrics in this forum and thus becomes essentially a non-useful piece of information in comparing the entries.

pg claimed that you don't need to include your template libraries or other magical exotic web framework code. You can just assume it's there, so most folks aren't showing their HTML, and of course, it wouldn't make sense to count it towards their program's parse trees on a tag-by-tag basis since it's likely just a bunch of strings in most of their systems. But hey, like I said, in the end they're all making webpages, and if that's the case then I still think I've got a bit of a headstart on a lot of folks.

Then again, maybe not. What do you folks think? Am I just a big fat cheater or what? prepares to dodge ballistic tomatoes

  ~Keep on hackin' in the Free world.

-----

2 points by eds 6146 days ago | link

Does it really matter where the code runs? Or does it just matter who writes it?

In most examples, HTML runs on client machines which may be roughly comparable to your example, but who cares, because the code (whether measured in lines or nodes) the author had to write to generate that HTML was presumably superior in some way compared to writing HTML manually. (Otherwise why not just code straight HTML, all the time?)

In your example, even though the server side code consisted of 0 lines/nodes, the code written by you consisted on an entire HTML page. So did you really save any time or effort in writing the HTML? Maybe, that's why we compare the code trees. But even in that case, the HTML itself will count toward the code tree.

Perhaps this means that HTML templates (not HTML generated by server-side scripts) used in other entries should also be included in their code tree count, if they had to be coded manually by the author. But even if this is the case, it doesn't just add a constant factor to all entries (I believe the arc entry did not require any HTML to be written by the author), and thus is still useful information, although perhaps the two should be considered separately.

P.S. Really liked your submission. I just don't think it counts as 0 lines of code.

-----

4 points by gjohnson 6145 days ago | link

Thanks, eds. I think that's a pretty fair judgment, and you're right that it wouldn't be a constant factor because different people are generating different amounts of HTML in the end. My example only has one page, and though it should be valid HTML4, I do include some CSS and div's that other folks wouldn't need. Admittedly, to keep theirs valid, they'd also need a lot more html, head, title, and body tags than me if they're making multiple pages.

The thing that strikes me as being kind of a funny metric here with code length is that if the author wrote the HTML and imported it into their code, you have to count it, but if some other author wrote the HTML and you import it, then you don't have to count it. Seems kind of weird to me, seeing as this opens the door to somebody else saying:

Alright, maybe gjohnson's code count includes all that silly HTML and CSS, but my program uses his HTML template file (which isn't much of a template in this case, of course, being kind of the whole shebang), and has a parse tree of length 1.

Here it is:

  <!--#include virtual="gjohnsons_magic.html" -->
Tada! I mean, heck. It's true that pg didn't write the HTML in his arc challenge submission code, but wait a minute! He did write it in his function library when he was defining the language. So being the author of the original HTML, does he have to include it after all?

Just my 2 cents here. Open to feedback as always.

-----

4 points by sacado 6145 days ago | link

You're right. That was one of the main objection against this challenge, from what I read on many forums. Well, the really convincing test is to use Arc for real. I wrote a small webapp with Arc and I never wrote such an app so fast. Quite amazing for a language I didn't know.

-----

3 points by gjohnson 6145 days ago | link

Point taken. This stuff about parse trees and who-wrote-what is after all just an academic argument. You're absolutely right that it's what we can write and how he enables us to write it in the end that makes this stuff all so interesting.

Anyway, keep going everyone. Those submissions are rockin' on. I've got my mind wrapped around a pretty perversely heinous challenge response that I may get to in the next couple of days. Keep your eyes peeled!

P.S. Did anybody notice that those class="page" attributes are unnecessary in my HTML/CSS code above? Just checking. Looks like I forgot to remove'em before posting.

-----