• (nodebb)

    And irregularities of spelling. What is an "O-R-G-A-N-I-S-I-M" ?

  • Anon (unregistered)

    What is an "O-R-G-A-N-I-S-I-M" ?

    It's any creature with two eyes.

  • Brian Boorman (google)

    PHP. An array at the top (index, rank, and text) and a loop to generate the drop down. If clause to test rank against the row's rank value to insert the selected. Easy Peasy.

  • NotAThingThatHappens (unregistered)

    Version of doing this, without abstracting everything away into loops and lists.

        string IsSelected(bool selected) 
        return selected ? selected='selected' : '';
    
    
            echo "<option" + IsSelected($_POST['rank']=='superkingdom') + ">superkingdom</option>";
            echo "<option" + IsSelected($_POST['rank']=='phylum') + ">phylum</option>";
            echo "<option" + IsSelected($_POST['rank']=='class') + ">class</option>";
            echo "<option" + IsSelected($_POST['rank']=='order') + ">order</option>";
            echo "<option" + IsSelected($_POST['rank']=='family') + ">family</option>";
            echo "<option" + IsSelected($_POST['rank']=='genus') + ">genus</option>";
            echo "<option " + IsSelected($_POST['rank']=='species') + ">species</option>";
    
  • (nodebb) in reply to Steve_The_Cynic

    An organisim is an organic SIM card for biodegradable smart phones.

  • Michael R (unregistered) in reply to Brian Boorman

    You must be new here.

  • (nodebb) in reply to BernieTheBernie

    Are there many of those?

  • (nodebb) in reply to Steve_The_Cynic

    You are joking, but for a number of years, at least some Mercedes-Benz cars were made with bio-degradable wiring insulation material. The result? After the warranty period expires, it usually requires a complete replacement of the wiring with non-biodegradable materials. Take a guess as to whether it's a cheap or an expensive fix.

  • WTFGuy (unregistered)

    @Mr. TA: My understanding was that the biodegradable wiring was a feature of German national "green" legislation that was ahead of its time in terms of materials science. Every German-made car of any brand suffered with that kind of wiring for a few years before the legislation was changed.

    In addition to the planned natural degradation occurring too early while the car was still in service, another problem was that the degradable wiring tasted good to rodents. A wiring bundle doesn't work well once the rats have eaten a bunch of the insulation and a bunch of the bare conductors are touching each other.

    Oops!

  • (nodebb) in reply to WTFGuy

    Perhaps the material development lab also wrote terrible PHP code with useless repetition.

    Addendum 2022-07-27 11:40: PS. The offices of the German legislators who made that law in the first place definitely did.

  • Yikes (unregistered)
    function select($select_name, $arr, $selected, $select_id = NULL)
    {
      if not isset($select_id) $select_id = $select_name;
      echo "<select name=\"$select_name\" id=\"$select_id\">";
      foreach ($arr as &$list_item) {
          echo "<option " . (($list_item==$selected) ? "selected" : "") . ">". $list_item . "</option>"
      }
      echo "</select>";
    }
    
    # Enjoy limitless select's!
    
    $rank_arr = array("superkingdom","phylum","class","order","family","genus","species");
    dependent_select('rank', $rank_arr, $_POST['rank']);
    
    $organiSIM_arr = array("verizon","t-mobile","sprint");
    dependent_select('organiSIM', $organiSIM_arr, $_POST['organiSIM']);
    
    
  • Lurk (unregistered)

    Imagine this. You are a researcher, you are busy doing lots of science and you have a cobbled together piece of software that lets you do the important stuff, the research. This piece of software needs modifying to let you do more science. Do you, someone with no great experience in software development, spends hours, days or even weeks of your precious time learning the ins and outs of a programming language or do you look at the existing solution, spend 10 minutes copying and extending what's there because it works and get on with the day job? I know what I'd do and it wouldn't be to waste time on a cobbled together tool that will be binned when the project finishes.

  • NotAThingThatHappens (unregistered) in reply to Yikes

    Now 'Yikes ' and I will fight over which version is the more readable/usable/expenable.

    Mine is easier to read and it's even two lines shorter!!! Mwuhahaha!

  • (nodebb) in reply to Mr. TA

    Take a guess as to whether it's a cheap or an expensive fix.

    Based on the price just for the "part" when I was in a situation of potentially needing to replace the whole wiring loom(1) in a 1986 Ford Fiesta, where they quoted £500 plus labour (in 1999 pounds, higher now of course), I'm going to guess that it's an expensive fix.

    (1) The only part that was broken was the connector pins for the right front indicator bulb housing, but it was actually part of the wiring loom rather than a separate component that plugged into the wiring loom. Happily for me, the same part for a Transit van was a separate part, and it fit nicely in the right space in the bodywork. Nine pounds for the part and a few minutes with crimping tools to put the right connectors on.

  • Brian Boorman (google) in reply to NotAThingThatHappens

    Sure, but using a list allows it to potentially be reused elsewhere in the application without duplicating all the text. Maybe it's my bias from writing software for processors with only 8 kilobytes of RAM where everything needs to be const char* const to fix it into flash.

  • NotAThingThatHappens (unregistered) in reply to Brian Boorman

    Of course, but 8k ram seems to be a different kind of problem, requiring a different kind of solution.

    But if we look a Yikes implementation, then word 'select' exists three times in the strings, and the word 'option' twice. Should those also be templates to save 24 bytes?

    Dids nobody notice that Yikes has forgotten the 'selected=' attribute?

  • Yikes (unregistered) in reply to NotAThingThatHappens

    Ya, lots of typos - got distracted

  • dpm (unregistered) in reply to NotAThingThatHappens

    Congratulatons on the new optionselected tag.

  • (nodebb) in reply to Lurk

    The first version of research software tends to be a pile of rubbish (apart from the useful core of it); it's little more than a basic prototype because almost always it never becomes more than that. That's why, for the subset of software that merits additional effort, it goes into the hands of specialist software developers for cleaning up. That frees up the researcher to do research, and produces much better software out the end (up to full product grade, if people are willing to pay for the effort it takes). This is a sub-discipline of software engineering.

    I never really criticise the first 0.0.1 version of anything, as that's usually just to show the feasibility of using a program to solve the problem at all. I do criticise leaving that rubbish unreviewed in the final product.

  • Erk (unregistered)

    Nah! This is super optimized code, any for loop, foreach, while, extra function call BS will be at least 2 ns slower than this! Time is money!

  • Ascrak.org (unregistered)
    Comment held for moderation.
  • Orbelain (unregistered) in reply to Lurk
    Comment held for moderation.
  • what is it (unregistered) in reply to NotAThingThatHappens

    Psuedocode? Some odd mix of JS/PHP? What's going on here?

  • farhankanju (unregistered)
    Comment held for moderation.

Leave a comment on “Repetition is an Echo”

Log In or post as a guest

Replying to comment #:

« Return to Article