HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

The Hall Of Code Curiosities

2

Comments

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    @Bleistivt I read your link, but it talks about data types.

    My point (and the topic of the poll) was that valr() & co. are not recursive functions :)

    If one would want to argue that valr() is indeed recursive since it makes use of arrays which are recursively defined data types, then every function using an array would have to be called recursive. If the argument is that valr() traverses a recursive data type, then every for-loop over an array would have to be called recursive, too :winky:

  • @mtschirs said:
    We finally have a result on our iterative vs recursive poll - and the winner is... iterative :chuffed:

    n < 20 :anguished:

    Vanilla is probably bipolar. Massaging one line, refusing to hold hands the next day:

    https://github.com/vanilla/vanilla/blob/1ae06b/applications/dashboard/controllers/class.entrycontroller.php#L1008

    @mtschirs said:
    Bleistivt I read your link, but it talks about data types.

    My point (and the topic of the poll) was that valr() & co. are not recursive functions :)

    There was never any question whether the function was iterative. The name refers to the data type it works with.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    @hgtonight schrieb:
    n < 20 :anguished:

    you got me :unamused:

    @hgtonight schrieb:
    There was never any question whether the function was iterative. The name refers to the data type it works with.

    Let's consult our primary source here:

    if (!function_exists('getValueR')) {
        /**
         * Return the value from an associative array or an object.
         *
         * This function differs from GetValue() in that $Key can be a string consisting of dot notation that will be used
         * to recursively traverse the collection.
         ...
    

    So the postfix 'r' (whether it is a postfix or a suffix shall be the topic for a future debate) stands for "recursive traversal". Which is exactly what you, hgtonight, already suspected earlier. However, there is no recursive traversal. In fact, there can be no recursive traversal without recursive traversal function :expressionless:

    The argument that getValueR() performs recursive traversal because the variable it iterates through has a recursively-defined datatype could equally be used to argue that inspecting any array or object properties is recursive traversal - which is clearly not the case.

    This discussion shall remind all of us of the horrors that await those who prematurely name their functions.

  • @mtschirs said:
    We finally have a result on our iterative vs recursive poll - and the winner is... iterative :chuffed:

    I'd say: 5 votes doesn't make a poll. But we could have a vote about that ;)

  • KasperKasper Vanilla Staff
    edited September 2015

    My 5 cents on the whole "recursive vs. iterative" discussion: The functions are by all means iterative and have nothing to do with recursion. The r-suffixed ones are however deep in the sense that they can traverse more than one level down object and array properties.

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • In library/vendors - functions.webwizhash.php:

    // This code is for private use only
    

    I hope nobody uses Vanilla commercially :glasses:

  • LincLinc Admin
    edited September 2015

    @mtschirs said:
    In library/vendors - functions.webwizhash.php:

    // This code is for private use only
    

    I hope nobody uses Vanilla commercially :glasses:

    Now you're referencing code that isn't even ours :silenced:

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    @Linc schrieb:
    Now you're referencing code that isn't even ours :silenced:

    That's kind of the point. Vanilla includes "private use only" code that some of us (and you) use commercially. Not that I care, but the author of that library might :tongue:

  • @mtschirs said:
    That's kind of the point. Vanilla includes "private use only" code that some of us (and you) use commercially.

    Given the context it is in, after this:

    Feel free to distribute as long as code is not modified, and header is kept intact

    and just before this:

    and the security and/or encryption of the resulting hexadecimal value is not warrented [sic] or gaurenteed [sic] in any way.

    I read that statement as part of a disclaimer, not a licensing restriction. The author is free to disagree or clarify.

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    The 3rd party license says:

    Feel free to distribute as long as code is not modified

    Todd ported the code from WebWiz's functions_hash1way.asp to Vanilla PHP. I would argue that a port is a modification.

    @Linc said:
    I read that statement as part of a disclaimer, not a licensing restriction. The author is free to disagree or clarify.

    I don't see much room for interpretation in "private use only". However, I see where you come from. That code is old, the author might not care and the whole thing is just an annoyance. But what if the author decides to care one day?

    Let's say you don't agree with me on these two points. Then here is why that code should really be removed from the Vanilla codebase:

    "Distribution or modification of programs, including incompatibly licensed code, will result in copyright infringement." ("Understanding Open Source and Free Software Licensing" by Andrew M. St. Laurent, O'Reilly Media, Inc., 2004)

    or

    "If I add a module to a GPL-covered program, do I have to use the GPL as the license for my module? The GPL says that the whole combined program has to be released under the GPL. So your module has to be available for use under the GPL." (gpl faq)

    Clearly, "Feel free to distribute as long as code is not modified" is not GPL compatible.

  • Are you talking of that license? (Not sure because I never heard of Web Wiz before) https://www.webwiz.co.uk/license/Web Wiz License Agreement.pdf

    I think it is quite clear and there is no need to cite third party meta open source license philosophers ;)


    3. License Grant
    Licensor grants Licensee a non-exclusive, non-transferable license to use Software for personal or
    business purposes, in accordance with clause 4 below, any copy must contain all of the original
    proprietary notices. (...)

    4. Permitted Use

    (...)
    4.2. You may modify the Software, so long as it is permitted in this Agreement.
    (...)

    6. Undertakings
    You undertake to;
    (...)
    6.2. reproduce and include our copyright notice (or such other party's copyright notice as specified
    on the Software) on all and any copies of the Software, including any partial copies of the
    Software or it’s derivative works;
    (...)


    What is described in 6.2 is a very good description for how Vanilla uses their code: "partial copy"/"derivated work".
    So I would say that enclosing their license text as a comment in the file is all that is needed. And that would also mean that there is no problem using the software commercially.

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    @R_J I am not talking about that license (otherwise you might be right), but about the license found in vanilla/library/vendors/misc/functions.webwizhash.php

  • mtschirsmtschirs ✭✭✭
    edited September 2015

  • R_JR_J Admin
    edited September 2015

    I wouldn't care about that since this function is part of the web wiz forum and I see no reference of any meaning anywhere else. So I would go with the web wiz license.

    @mtschirs said:
    I would argue that a port is a modification.

    Others call it a derivative work which results to much more freedom concerning the license: http://www.linuxjournal.com/article/6366

    Based on the copyright act, they write: Almost everyone agrees that if you take the copyrighted source code of any program and physically modify it—actually revise the program or translate it into another computer language—you have created a derivative work of that program.

    So there is even less reason for doing anything.

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    @R_J The only relevant (copyright and) licensing clause here is the one found in the header of the source code:

    ' Written By: Mark G. Jager
    ' Written Date: 8/10/2000
    '
    ' Free to distribute as long as code is not modified, and header is kept intact

    and in one particular case

    ' This code is for private use only

    Whether or not other projects (such as web wiz whatever) re-package and distribute that code with their software is irrelevant to Vanilla as long as the original author hasn't made its code available under a GPL compatible license by dual/cross licensing.

    It is the same issue e.g. bloggers face when using photos from another website which mistakenly states them as being licensed under CC. The original photographer can still sue for copyright infringement.

  • mtschirsmtschirs ✭✭✭
    edited September 2015

    Actually, if you chose to ignore the file-scope licensing terms of Mark G. Jager and go with the Web Wiz license instead, you are in for even more trouble.

    1. Permitted Use
      4.2. You may modify the Software, so long as it is permitted in this Agreement.

    2. Restrictions On Use
      5.1. You shall not resell, rent, lease or distribute the Software.
      5.5. You shall not use any part of the Software outside of the Software package, this includes, but not limited to, displaying or ‘hot linking’ to, icons, images and graphics.
      5.7. [... A] valid copyright notice must be provided within the user documentation that specifies ‘Web Wiz’ as the provider of the Software bundled with the licensee’s application.

  • The comment:

    /**
     * @param integer $timeout How long to allow for this request. 
     * Default Garden.SocketTimeout or 1, 0 to never timeout. Default is 0.
    

    The code:

    function fetchPageInfo($url, $timeout = 3) { ... }
    
  • Man, this thread took a pretty dank turn for a while. Thanks for bringing back the entertainment value, @mtschirs :)

  • TimTim Vanilla Staff

    This discussion would be a lot less annoying if every time someone made fun of some old code that has decayed they also included a pull request that fixes it. Especially in such trivial cases as a docblock that has stopped matching the code.

    Otherwise its just frustrating to read what is essentially mockery of something that many people here have devoted more than half a decade to building.

    Thats just my 2 cents though.

    Vanilla Forums COO [GitHub, Twitter, About.me]

Sign In or Register to comment.