Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

JCWren Programming Challenge - Win a Perlmonks T-Shirt!

by jcwren (Prior)
on Nov 29, 2000 at 10:23 UTC ( #43857=perlmeditation: print w/ replies, xml ) Need Help??

Announcing the first JCWren programming challenge! (an idea shamelessly stolen from amelinda)

Write some code, win a perlmonks.org T-shirt, become famous1.

The idea:

To have a monthly contest for programming projects demonstrating some degree of skill, but within the ability of an average monk. Projects should take at least a few hours to complete, but shouldn't require skipping work for 3 days. Prizes are fiananced out of my pocket, and are (currently) in no way related to EDC, other than using them as a source for merchandise (and they ARE the only ones with PerlMonks T-Shirts).

The challenge:

Implement a Perl program that will read the file http://headlinenews.cnn.com/QUICKNEWS/virtual/swf.headline.txt and generate a web page with a 3 column table, the left column with the state name, the middle column with a date/time stamp, and the right column with the headline. The script should be able to be run from the cron (*nix) or at (Windows) scheduler. As new headlines for each state are encountered, they should be timestamped and added to a database (flat file, using the CPAN module of your choice. Not mySQL, postGRES, or any other potentially non-portable database). The webpage should be generated when the script is run, and as such is considered static. The page should contain a META tag to attempt an auto-refresh. Above the table should be a list of all states that headlines have been encountered for, and a HREF tag to that table entry (states with no headlines should not have an active link). Required command line options are:
  1. A parameter specifies the refresh interval for the META tag (default is 10 minutes).
  2. A parameter to specify the output path and filename (default is index.html in the current directory).
  3. A parameter to specify (in minutes) the time before an entry is aged out of the database (default is 24 hours).
  4. An option to clear any existing database.

Sample output:

Alabama | Alaska | Georgia | Florida | Iowa | Kentucky | Michigan | Remaining States
Georgia 2000/11/28 17:22 Major earthquake occurs on little known fault line between Atlanta and Macon. Trailer parks considered responsible.
Georgia 2000/11/28 19:44 Lake Sidney Lanier, a major recreational lake, is at a record low. Many boats now high and dry.
Michigan 2000/11/28 17:22 Tim Vroom, local hero and humanitarian, takes www.perlmonks.org commercial, makes millions.

Note that some state names contain spaces, and should not break. The date/time stamp should also not break on a space. Extra points2 for a command line switch that allows font name specification for the text, and uses them correctly for all text on the page.



The rules:

  1. Contest starts 2000/12/01 00:00 EST, and ends 2000/12/08 23:59 EST (unless #2).
  2. Contest ends on first entry that passes contest criteria rules.
  3. By submitting an entry, you agree the criteria has been adequately defined, and is non-contestable.
  4. Entries must be submitted to jcwren@jcwren.com (tar or zip, please)
  5. Winning entry will be notified by /msg.
  6. Entries must run on both Windows and Unix.
  7. Entries must run under Perl 5.005_05 and below.
  8. All platform indepedant CPAN modules are fair game.
  9. Code must contain functioning 'use strict' and -w.
  10. Output HTML must be legal HTML, and pass common HTML checkers.
  11. Winning code will be posted to the Code Catacombs (by the author).
  12. Saint level monks (as of 2000/12/01) are not eligible for contest prizes.
  13. Multiple people may work on a submitted entry, but only one prize will be awarded.
  14. In the event that PerlMonks T-Shirts are unavailable, other EDC products may be substituted.
  15. jcwren will be the judge. In the event of uncertainty, a saint level monk will be consulted.

I have done my best to create what I think are a fair set of rules, and within the capabilities of the average monk. If you have a point that needs clarifying, it needs to be before Friday morning (2000/12/01).

A copy of this page is available at www.tinymicros.com/contest

1 jcwren cannot be held responsible if fame fails to occur. Void where prohibited by law, offers may not be combined, cash value 1/10 cent.
2 Extra points are not redeemable for anything useful. But it does add coolness.
--Chris

e-mail jcwren

Comment on JCWren Programming Challenge - Win a Perlmonks T-Shirt!
Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by extremely (Priest) on Nov 29, 2000 at 10:34 UTC
    And there you have part of the answer to the need for "quests" and such. We need a Bounty section where people can promise items and goods in exchange for public perl code.

    You'll have to put a moderator or two in charge and eventually PM should hold the pre-bought prizes till the judgement comes in. Once a script wins, we pick it over for safety and power-power-power as group thanks to the sponsor.

    Or not... but in any case Go Go jcwren!

    --
    $you = new YOU;
    honk() if $you->love(perl)

Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by vroom (Pope) on Nov 29, 2000 at 10:46 UTC
    Trading t-shirts for the XP you're bound to gain from ++'s on this node. You're a clever one jc.

    Cool idea amelinda, cool contest idea jc. ++'s all around.

    vroom | Tim Vroom | vroom@cs.hope.edu

Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by quidity (Pilgrim) on Nov 29, 2000 at 18:39 UTC

    > 7. Entries must run under Perl 5.005_05 and below.

    Er, how far below?? There comes a point where punch cards come into play, and you can't email them as a .tar

      A couple of carifications:

      Perl versions:

      Basically, an entry cannot be reliant on any feature of 5.6 or above, but must use a Perl 5 version.

      Windows / Unix compatibility:

      I realize that not everyone will have a Windows box to test on, and others may not have a Unix box. However, I feel this is a pretty generic challenge. I believe that if fork() is avoided, there shouldn't be any OS specific functionality. If you select a CPAN module for your DB (and this is not REQUIRED. The requirement is only that headlines be stored. You could use a flat file.), the module generally indicates what platforms are or are not supported.

      Meta tag refresh time:

      The parameter for the META tag refresh interval is in minutes, with a default value of 10. (In the rules I had not clarified what units the refresh interval should be expressed in.)

      It's a little more difficult to design a challenge that gives all platform users a fair chance. This should run on a Mac, although so few people use Macs (compared to Windows/Unix), that I did not specifically call them out. Since this is the first one, I'm open to suggestions for future challanges on how to handle this. But for now, it was as fair as I could think of. Any input is appreciated.

      If I've still not expressed this well, please /msg me and I will update this node to clarify.

      The www.tinymicros.com/contest page has been updated, and includes a list of changes.

      --Chris

      e-mail jcwren
        Any Perl 5 version? I think many here would have trouble testing that. For instance how many here know (or need to) that
        foreach my $foo (@bar) { # Do something }
        is a syntax error in 5.003?
        Did I miss a memo? I don't recall seeing anything on who won this.

        Cheers,
        KM

Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by rlk (Pilgrim) on Nov 30, 2000 at 00:15 UTC

      As new headlines come in, they are placed in the database. Headlines older than 24 hours (by default. This is command line controllable) should be aged out. All headlines currently in the file should be displayed.

      Think of it as a sliding window, with a window width controlled by the command line argument for aging.

      --Chris

      e-mail jcwren

        Thanks. I would have figured as much, but with that being the case, I can't figure any interpretation of...

        • ...a list of all states that headlines have been encountered for...
        • (states with no headlines should not have an active link)

        ...wherein the second requirement is meaningful. With only one set of headlines (as opposed to a "new from the web" and an "old in the file" set), the set of states for which there is a headline, and for which there is no headline is null, thus all states listed will have an active link.

        Or am I missing something?

        --
        Ryan Koppenhaver, Aspiring Perl Hacker
        "I ask for so little. Just fear me, love me, do as I say and I will be your slave."

Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by boo_radley (Parson) on Nov 30, 2000 at 00:38 UTC
    Am I just being dense, or is this file (http://headlinenews.cnn.com/QUICKNEWS/virtual/swf.headline.txt) two months old ? (Fri Oct 13 17:53:45 2000)

    update it doesn't look like I am, since this is the file that the ticker points to... but if you wait long enough, you'll see what looks like an error in their regexps whenever one of the state headlines has an '&' in it. the headline gets truncated at the '&'!

    update Il Papa JCWren has kindly contacted the CNN folks about the stale news & apparently they've had a hung ftp server for a month+. Wow.

    update It looks like somethings gone all b0rken again: headlinecount=0&&headlineload=done

    "There is no news. Go away."

      No, you're not being dense. I used tcpdump to get the URL that the Super Ticker uses to display it. This is indeed the file it's using, but it *is* out of date.

      I have a call in to CNN right now trying to figure out what their problem is.

      In the event this is not fixed by Friday afternoon, I will provide an alternate URL, and write something that generates random headlines that will simulate that file.

      Since CNN advertises the Super Ticker regularly on Headline News, I suspect they will be interested in getting that fixed.

      --Chris

      e-mail jcwren
Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by AgentM (Curate) on Nov 30, 2000 at 01:45 UTC
    Out of fairness, I'd like to question your motives on why the contest should end on the first entry that resolves the problem. If you close the game so early, folks that need weekends to do anything other than work won't get much of a chance and better solutions may be ignored (Benchmarks, code compactness, clarity, etc.). I don't understand why the winner is the guy that can punch out the code the fastest after reading this post...
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

      I gave that issue some consideration, and decided that it raised more problems than it solved. Different people may take fairly radically different approaches to solve the problem.

      It can very difficult to make a judgement call on someone elses code. What I consider elegant may not be what you, or anyone else, does. I felt if I was the sole judge, I might appear arbitrary as to why I selected one and not another. In addition, getting multiple people involved in judging involves time commitments that I have no way of managing. And to be honest, I didn't feel like fielding calls of "Well, this way is better, why didn't you pick that"?

      I also thought about saying "Please don't start coding until 2000/12/01", but knew that I'd have no control over that, unless I with held a critical piece of information until that date. If this turns out to be a problem, maybe next time I'll do it that way.

      I'd like to do this every month. Maybe the first one won't go off without a hitch. That's why I'm asking for input, and taking feedback. I see one occurrence already of where I failed to clarify the specifications enough.

      And the very real reality is that no contest is completely fair. You won't win the $1,000,000 from McDonalds if you can't go there to get game pieces, and you have no stamps to mail in for pieces with. I feel like I've tried to be as fair as possible, within reason. If someone disagrees, I'll factor that in. But I seriously doubt that no matter how it's done, everyone will be happy.

      --Chris

      e-mail jcwren
        Perhaps, then, you can offer categories (obviously not passing out T-shirts to everyone...):
        • Most Obfuscated Solution
        • Shortest Solution (character-wise)
        • Most Ridiculous Solution (using the wrong modules for the wrong job but results in correct solution!)
        • Most Wasteful Solution (without dumping core)
        • Most Clear Solution (without documentation)
        • Fastest Solution (via BenchMark assuming taking web page from file instead of net)
        • perhaps some others...
        Arguably, not all of these are interesting or useful and are, of course, at your discretion, but I think it would be interesting to give lots of people chances to get something interesting done for others to see. Perhaps it would be more fair for all of the applicants' progs to show up on tinymicros.com for all the perlmonks to vote on (anonymous programs until winner declared for fairness). That way, the system can be almost completely automated.
        AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by Adam (Vicar) on Nov 30, 2000 at 02:04 UTC
    Nice contest idea. It is fairely easy to code but requires some knowledge of Perl and CPAN. I was sorry to see that you excluded Saint level monks, but I can't complain... I don't have time right now to do this anyway. Future contests aught to either involve the saints more as judges or allow them to compete. Maybe a split level contest where code submitted by Abbot's and up are judged separatly from code submitted by lower ranking monks.

      Maybe a split level contest where code submitted by Abbot's and up are judged separatly from code submitted by lower ranking monks.

      Some of us are only lower in rank because we've not been here for that long.

      Beware the Initiates!

      --

      Brother Marvell

Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by Anonymous Monk on Nov 30, 2000 at 23:05 UTC
    "...command line switch that allows font name specification for the text, and uses them correctly for all text on the page..."

    Use the CSS, Luke! I hope the readership isn't thinking of using the FONT tag; that's a "Bad Idea".

      Some may consider the use of a FONT tag gauche. However, since it's a command line argument, and therefore optional, and a heck a lot easier for most people that CSS sheets (which have their own problems), the FONT tag is completely acceptable for this challenge.

      --Chris

      e-mail jcwren
Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by marvell (Pilgrim) on Nov 30, 2000 at 23:15 UTC

    Call me slightly odd, but that does not sound like a compelling contest. I hear you have been looking at structured competitions for some time. This one seems very simple in essence and does not offer much of a challenge. However, as someone has already mentioned, adding criteria such as speed and size might make it more fun.

    --

    Brother Marvell

      If you've got a more compelling or interesting idea; please feel free to post it.

      In light of some recent threads; it's nice to see someone respond proactively and with generosity.

      Personally, I plan to work on this as an exercise, just to see what I learn and to see how close I come to the selected entry.

      --f
        I am gonna have a bash an after that who knows I may well follow the example and set a challenge of my very own.

        --

        Zigster

        OK, I take you point. I'd be happy to submit a challenge and take the time to judge others, if required. However, being so new the the Monks, I needs to ask one question:

        What motivates you?

        Specifically in a competition context. footpad has mentioned that he would simply complete the competition in order to see what he could learn. A very noble cause, indeed. However, I rather suspect some of the Monks may have a more competitive streak.

        So, let me know what you want and I'll see what I can do.

        --

        Brother Marvell

Re: JCWren Programming Challenge - Win a Perlmonks T-Shirt!
by merlyn (Sage) on Mar 02, 2001 at 01:20 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://43857]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-07-28 13:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (198 votes), past polls