Announcement

Collapse
No announcement yet.

MivaScript.com is now LIVE!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Re: MivaScript.com is now LIVE!

    User Annotations now colorize the sample Miva Script.
    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    Comment


      #32
      Re: MivaScript.com is now LIVE! - Sorting arrays/structures by element

      Originally posted by mvmarkus View Post
      I see your point, however I try to keep interfaces as simple as possible - and with this the number of (required) parameters as small as needed. Old habbit of a lazy programmer who hates to look up APIs...
      I'm with you. I'd rather have a few smaller functions than one catch-all function.

      With PHP you can overload a function and preset defaults; that way you only need to specify something if it's outside the norm. With MivaScript, You can't do that. So it's better to make one function for ascending sort, and another for descending. Admittedly, this means twice the code to debug, but the nice thing about these kind of functions is that once they're done, they're done.

      The alternative is to make "header" functions. Functions that are named distinctly, but call the parameter-heavy, work-horse function with all the bells and whistles established.

      So you have a Sort_Asc(l.data) and a Sort_Desc(l.data), but they call Sort('A', l.data) and Sort('D', l.data) respectively. Sort() is your catch-all function.

      As for "numbers"... To simplify the whole numbers versus strings issue, why not make a single isdigit() call and if true, padl() to say 10 digits with '0's. So all strings gets sorted as is, all numbers get sorted up to 10 significant digits, and if you have a mixture, they will still be sorted correctly. Or was this already discussed and I missed the post?

      Comment


        #33
        Re: MivaScript.com is now LIVE!

        I guess everyone else knows about it or doesn't need it, but this is the BEES KNEES to me. Since I code in Mivascript about 4% of my time, it is a HUGE timesaver. THANKS!!!
        Gordon Currie
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #34
          Re: MivaScript.com is now LIVE!

          Currently MivaScript.com does not rank well in Google (it's too new) but if the community would add links to it from their sites, that would improve.
          Last edited by RayYates; 03-06-11, 07:48 AM. Reason: spelling
          Ray Yates
          "If I have seen further, it is by standing on the shoulders of giants."
          --- Sir Isaac Newton

          Comment

          Working...
          X