Announcement

Collapse
No announcement yet.

SMTP Error

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

    SMTP Error



    It would be preferable to have the following
    instead of the blank line:

    <MvEVAL EXPR=3D"{asciichar(13) $ asciichar(10)}">

    That puts the proper rfc-compliant carriage return
    line feed. But does that come before or after the
    mime stuff? Those are headers so shouldn't they
    go before the crlf?

    David

    Bill Gilligan wrote:
    > Put a break between the smtp and the content.
    > <MvSMTP to=3D"<[email protected]>" subject=3D"Property
    > Search Request"
    > mailhost=3D"smtp.stonewall-realty.com"
    > from=3D"<[email protected]>">
    >=20
    > MIME-Version: 1.0
    > Content-Type: text/html; charset=3Dus-ascii
    >=20
    >=20
    > Bill
    >=20
    > -----Original Message-----
    > From: [email protected] [mailto:[email protected]]On
    > Behalf Of Jonathan Coulter Sent: Friday, January 28, 2005 10:54 PM
    > To: Miva-Users
    > Subject: RE: [meu] SMTP Error
    >=20
    >=20
    > Thanks David,
    >=20
    > That fixed part of it. I still got the same error message
    > until I changed
    > the FROM to a real address within <>. That allowed the email
    > to be sent.
    >=20
    > However, the email was received was empty. The rest of the code is as
    > follows. Maybe its too late to be working on this, it's
    > gotta be obvious.
    > Any suggestions?
    >=20
    > <MvSMTP to=3D"<[email protected]>" subject=3D"Property
    > Search Request"
    > mailhost=3D"smtp.stonewall-realty.com"
    > from=3D"<[email protected]>">
    > MIME-Version: 1.0
    > Content-Type: text/html; charset=3Dus-ascii
    >=20
    > <font face=3D"Verdana" size=3D"2">
    > The following information was entered via the website's
    > Property Search
    > Form.
    >


    > <table width=3D100% border=3D0>
    > email details go here
    > </table>
    >=20
    > </MvSMTP>
    >=20
    > Thanks,
    > Jon
    >=20
    >=20
    > -----Original Message-----
    > From: [email protected] [mailto:[email protected]]On
    > Behalf Of David Hubbard Sent: Friday, January 28, 2005 11:33 PM
    > To: Jonathan Coulter; Miva-Users
    > Subject: RE: [meu] SMTP Error
    >=20
    >=20
    > Change your TO=3D to have angle brackets around the
    > address, <[email protected]>
    >=20
    > David
    >=20
    > Jonathan Coulter wrote:
    >> Hello,
    >>=20
    >> Can anyone tell me what is wrong with this?
    >>=20
    >> <MvSMTP TO=3D"[email protected]" FROM=3D"{ xemail }"
    >> SUBJECT=3D"Property Search Request"
    >> MAILHOST=3D"smtp.stonewall-realty.com">
    >>=20
    >> I am getting this error message ...
    >>=20
    >> Runtime error in /moreinfo.mvc @ [00000000:0000008e]: moreinfo.mv:
    >> Line 5: MvSMTP: 5.5.2 where is <...> in that?
    >>=20
    >> Thanks!
    >> Jon Coulter
    >=20

    #2
    SMTP Error



    Woo-hoo ... that worked David. It didn't format my email as HTML, but I
    think I can fix that problem.

    Jon

    -----Original Message-----
    From: [email protected] [mailto:[email protected]]On
    Behalf Of David Hubbard
    Sent: Saturday, January 29, 2005 12:11 AM
    To: Miva-Users
    Subject: RE: [meu] SMTP Error


    It would be preferable to have the following
    instead of the blank line:

    <MvEVAL EXPR="{asciichar(13) $ asciichar(10)}">

    That puts the proper rfc-compliant carriage return
    line feed. But does that come before or after the
    mime stuff? Those are headers so shouldn't they
    go before the crlf?

    David

    Bill Gilligan wrote:
    > Put a break between the smtp and the content.
    > <MvSMTP to="<[email protected]>" subject="Property
    > Search Request"
    > mailhost="smtp.stonewall-realty.com"
    > from="<[email protected]>">
    >
    > MIME-Version: 1.0
    > Content-Type: text/html; charset=us-ascii
    >
    >
    > Bill
    >
    > -----Original Message-----
    > From: [email protected] [mailto:[email protected]]On
    > Behalf Of Jonathan Coulter Sent: Friday, January 28, 2005 10:54 PM
    > To: Miva-Users
    > Subject: RE: [meu] SMTP Error
    >
    >
    > Thanks David,
    >
    > That fixed part of it. I still got the same error message
    > until I changed
    > the FROM to a real address within <>. That allowed the email
    > to be sent.
    >
    > However, the email was received was empty. The rest of the code is as
    > follows. Maybe its too late to be working on this, it's
    > gotta be obvious.
    > Any suggestions?
    >
    > <MvSMTP to="<[email protected]>" subject="Property
    > Search Request"
    > mailhost="smtp.stonewall-realty.com"
    > from="<[email protected]>">
    > MIME-Version: 1.0
    > Content-Type: text/html; charset=us-ascii
    >
    > <font face="Verdana" size="2">
    > The following information was entered via the website's
    > Property Search
    > Form.
    >


    > <table width=100% border=0>
    > email details go here
    > </table>
    >
    > </MvSMTP>
    >
    > Thanks,
    > Jon
    >
    >
    > -----Original Message-----
    > From: [email protected] [mailto:[email protected]]On
    > Behalf Of David Hubbard Sent: Friday, January 28, 2005 11:33 PM
    > To: Jonathan Coulter; Miva-Users
    > Subject: RE: [meu] SMTP Error
    >
    >
    > Change your TO= to have angle brackets around the
    > address, <[email protected]>
    >
    > David
    >
    > Jonathan Coulter wrote:
    >> Hello,
    >>
    >> Can anyone tell me what is wrong with this?
    >>
    >> <MvSMTP TO="[email protected]" FROM="{ xemail }"
    >> SUBJECT="Property Search Request"
    >> MAILHOST="smtp.stonewall-realty.com">
    >>
    >> I am getting this error message ...
    >>
    >> Runtime error in /moreinfo.mvc @ [00000000:0000008e]: moreinfo.mv:
    >> Line 5: MvSMTP: 5.5.2 where is <...> in that?
    >>
    >> Thanks!
    >> Jon Coulter
    >

    Comment


      #3
      SMTP Error



      To send with HTML you need to format the SMTP command as follows:

      <MvSMTP line>
      <MvEVAL EXPR="{'MIME-Version: 1.0' $ l.cr}">
      <MvEVAL EXPR="{'Content-Type: text/html; charset="iso-8859-1"' $ l.cr}">
      <MvEVAL EXPR="{'Content-Transfer-Encoding: 8bit' $ l.cr $ l.cr}">
      <MvEVAL EXPR="{ the content of your html formated email }">

      -Bruce


      > -----Original Message-----
      > From: [email protected]
      > [mailto:[email protected]] On Behalf Of Jonathan Coulter
      > Sent: Friday, January 28, 2005 9:32 PM
      > To: Miva-Users
      > Subject: RE: [meu] SMTP Error
      >
      > Woo-hoo ... that worked David. It didn't format my email as
      > HTML, but I think I can fix that problem.
      >
      > Jon
      >
      > -----Original Message-----
      > From: [email protected] [mailto:[email protected]]On
      > Behalf Of David Hubbard
      > Sent: Saturday, January 29, 2005 12:11 AM
      > To: Miva-Users
      > Subject: RE: [meu] SMTP Error
      >
      >
      > It would be preferable to have the following instead of the
      > blank line:
      >
      > <MvEVAL EXPR="{asciichar(13) $ asciichar(10)}">
      >
      > That puts the proper rfc-compliant carriage return line feed.
      > But does that come before or after the mime stuff? Those
      > are headers so shouldn't they go before the crlf?
      >
      > David
      >
      > Bill Gilligan wrote:
      > > Put a break between the smtp and the content.
      > > <MvSMTP to="<[email protected]>" subject="Property Search
      > > Request"
      > > mailhost="smtp.stonewall-realty.com"
      > > from="<[email protected]>">
      > >
      > > MIME-Version: 1.0
      > > Content-Type: text/html; charset=us-ascii
      > >
      > >
      > > Bill
      > >
      > > -----Original Message-----
      > > From: [email protected] [mailto:[email protected]]On
      > > Behalf Of Jonathan Coulter Sent: Friday, January 28, 2005 10:54 PM
      > > To: Miva-Users
      > > Subject: RE: [meu] SMTP Error
      > >
      > >
      > > Thanks David,
      > >
      > > That fixed part of it. I still got the same error message until I
      > > changed the FROM to a real address within <>. That allowed
      > the email
      > > to be sent.
      > >
      > > However, the email was received was empty. The rest of the
      > code is as
      > > follows. Maybe its too late to be working on this, it's gotta be
      > > obvious.
      > > Any suggestions?
      > >
      > > <MvSMTP to="<[email protected]>" subject="Property Search
      > > Request"
      > > mailhost="smtp.stonewall-realty.com"
      > > from="<[email protected]>">
      > > MIME-Version: 1.0
      > > Content-Type: text/html; charset=us-ascii
      > >
      > > <font face="Verdana" size="2">
      > > The following information was entered via the website's Property
      > > Search Form.
      > >


      > > <table width=100% border=0>
      > > email details go here
      > > </table>
      > >
      > > </MvSMTP>
      > >
      > > Thanks,
      > > Jon
      > >
      > >
      > > -----Original Message-----
      > > From: [email protected] [mailto:[email protected]]On
      > > Behalf Of David Hubbard Sent: Friday, January 28, 2005 11:33 PM
      > > To: Jonathan Coulter; Miva-Users
      > > Subject: RE: [meu] SMTP Error
      > >
      > >
      > > Change your TO= to have angle brackets around the address,
      > > <[email protected]>
      > >
      > > David
      > >
      > > Jonathan Coulter wrote:
      > >> Hello,
      > >>
      > >> Can anyone tell me what is wrong with this?
      > >>
      > >> <MvSMTP TO="[email protected]" FROM="{ xemail }"
      > >> SUBJECT="Property Search Request"
      > >> MAILHOST="smtp.stonewall-realty.com">
      > >>
      > >> I am getting this error message ...
      > >>
      > >> Runtime error in /moreinfo.mvc @ [00000000:0000008e]: moreinfo.mv:
      > >> Line 5: MvSMTP: 5.5.2 where is <...> in that?
      > >>
      > >> Thanks!
      > >> Jon Coulter
      > >

      Comment


        #4
        SMTP Error



        Thanks everyone ... works like a charm. Time for me to hit the sack ... I
        really should have known some of this.

        Thanks again!
        Jon

        -----Original Message-----
        From: [email protected] [mailto:[email protected]]On Behalf
        Of Bruce Golub - Phosphor Media
        Sent: Saturday, January 29, 2005 12:48 AM
        To: 'Miva-Users'
        Subject: RE: [meu] SMTP Error


        To send with HTML you need to format the SMTP command as follows:

        <MvSMTP line>
        <MvEVAL EXPR="{'MIME-Version: 1.0' $ l.cr}">
        <MvEVAL EXPR="{'Content-Type: text/html; charset="iso-8859-1"' $ l.cr}">
        <MvEVAL EXPR="{'Content-Transfer-Encoding: 8bit' $ l.cr $ l.cr}">
        <MvEVAL EXPR="{ the content of your html formated email }">

        -Bruce


        > -----Original Message-----
        > From: [email protected]
        > [mailto:[email protected]] On Behalf Of Jonathan Coulter
        > Sent: Friday, January 28, 2005 9:32 PM
        > To: Miva-Users
        > Subject: RE: [meu] SMTP Error
        >
        > Woo-hoo ... that worked David. It didn't format my email as
        > HTML, but I think I can fix that problem.
        >
        > Jon
        >
        > -----Original Message-----
        > From: [email protected] [mailto:[email protected]]On
        > Behalf Of David Hubbard
        > Sent: Saturday, January 29, 2005 12:11 AM
        > To: Miva-Users
        > Subject: RE: [meu] SMTP Error
        >
        >
        > It would be preferable to have the following instead of the
        > blank line:
        >
        > <MvEVAL EXPR="{asciichar(13) $ asciichar(10)}">
        >
        > That puts the proper rfc-compliant carriage return line feed.
        > But does that come before or after the mime stuff? Those
        > are headers so shouldn't they go before the crlf?
        >
        > David
        >
        > Bill Gilligan wrote:
        > > Put a break between the smtp and the content.
        > > <MvSMTP to="<[email protected]>" subject="Property Search
        > > Request"
        > > mailhost="smtp.stonewall-realty.com"
        > > from="<[email protected]>">
        > >
        > > MIME-Version: 1.0
        > > Content-Type: text/html; charset=us-ascii
        > >
        > >
        > > Bill
        > >
        > > -----Original Message-----
        > > From: [email protected] [mailto:[email protected]]On
        > > Behalf Of Jonathan Coulter Sent: Friday, January 28, 2005 10:54 PM
        > > To: Miva-Users
        > > Subject: RE: [meu] SMTP Error
        > >
        > >
        > > Thanks David,
        > >
        > > That fixed part of it. I still got the same error message until I
        > > changed the FROM to a real address within <>. That allowed
        > the email
        > > to be sent.
        > >
        > > However, the email was received was empty. The rest of the
        > code is as
        > > follows. Maybe its too late to be working on this, it's gotta be
        > > obvious.
        > > Any suggestions?
        > >
        > > <MvSMTP to="<[email protected]>" subject="Property Search
        > > Request"
        > > mailhost="smtp.stonewall-realty.com"
        > > from="<[email protected]>">
        > > MIME-Version: 1.0
        > > Content-Type: text/html; charset=us-ascii
        > >
        > > <font face="Verdana" size="2">
        > > The following information was entered via the website's Property
        > > Search Form.
        > >


        > > <table width=100% border=0>
        > > email details go here
        > > </table>
        > >
        > > </MvSMTP>
        > >
        > > Thanks,
        > > Jon
        > >
        > >
        > > -----Original Message-----
        > > From: [email protected] [mailto:[email protected]]On
        > > Behalf Of David Hubbard Sent: Friday, January 28, 2005 11:33 PM
        > > To: Jonathan Coulter; Miva-Users
        > > Subject: RE: [meu] SMTP Error
        > >
        > >
        > > Change your TO= to have angle brackets around the address,
        > > <[email protected]>
        > >
        > > David
        > >
        > > Jonathan Coulter wrote:
        > >> Hello,
        > >>
        > >> Can anyone tell me what is wrong with this?
        > >>
        > >> <MvSMTP TO="[email protected]" FROM="{ xemail }"
        > >> SUBJECT="Property Search Request"
        > >> MAILHOST="smtp.stonewall-realty.com">
        > >>
        > >> I am getting this error message ...
        > >>
        > >> Runtime error in /moreinfo.mvc @ [00000000:0000008e]: moreinfo.mv:
        > >> Line 5: MvSMTP: 5.5.2 where is <...> in that?
        > >>
        > >> Thanks!
        > >> Jon Coulter
        > >

        Comment


          #5
          SMTP Error



          When in doubt, check out http://mivo.truxoft.com/resources.htm ...that's
          where all the magic potions are stored...

          -bruce

          > -----Original Message-----
          > From: [email protected]
          > [mailto:[email protected]] On Behalf Of Jonathan Coulter
          > Sent: Friday, January 28, 2005 9:57 PM
          > To: 'Miva-Users'
          > Subject: RE: [meu] SMTP Error
          >
          > Thanks everyone ... works like a charm. Time for me to hit
          > the sack ... I really should have known some of this.
          >
          > Thanks again!
          > Jon
          >
          > -----Original Message-----
          > From: [email protected]
          > [mailto:[email protected]]On Behalf Of Bruce Golub -
          > Phosphor Media
          > Sent: Saturday, January 29, 2005 12:48 AM
          > To: 'Miva-Users'
          > Subject: RE: [meu] SMTP Error
          >
          >
          > To send with HTML you need to format the SMTP command as follows:
          >
          > <MvSMTP line>
          > <MvEVAL EXPR="{'MIME-Version: 1.0' $ l.cr}"> <MvEVAL
          > EXPR="{'Content-Type: text/html; charset="iso-8859-1"' $
          > l.cr}"> <MvEVAL EXPR="{'Content-Transfer-Encoding: 8bit' $
          > l.cr $ l.cr}"> <MvEVAL EXPR="{ the content of your html
          > formated email }">
          >
          > -Bruce
          >
          >
          > > -----Original Message-----
          > > From: [email protected]
          > > [mailto:[email protected]] On Behalf Of Jonathan Coulter
          > > Sent: Friday, January 28, 2005 9:32 PM
          > > To: Miva-Users
          > > Subject: RE: [meu] SMTP Error
          > >
          > > Woo-hoo ... that worked David. It didn't format my email
          > as HTML, but
          > > I think I can fix that problem.
          > >
          > > Jon
          > >
          > > -----Original Message-----
          > > From: [email protected] [mailto:[email protected]]On
          > > Behalf Of David Hubbard
          > > Sent: Saturday, January 29, 2005 12:11 AM
          > > To: Miva-Users
          > > Subject: RE: [meu] SMTP Error
          > >
          > >
          > > It would be preferable to have the following instead of the blank
          > > line:
          > >
          > > <MvEVAL EXPR="{asciichar(13) $ asciichar(10)}">
          > >
          > > That puts the proper rfc-compliant carriage return line feed.
          > > But does that come before or after the mime stuff? Those
          > are headers
          > > so shouldn't they go before the crlf?
          > >
          > > David
          > >
          > > Bill Gilligan wrote:
          > > > Put a break between the smtp and the content.
          > > > <MvSMTP to="<[email protected]>"
          > subject="Property Search
          > > > Request"
          > > > mailhost="smtp.stonewall-realty.com"
          > > > from="<[email protected]>">
          > > >
          > > > MIME-Version: 1.0
          > > > Content-Type: text/html; charset=us-ascii
          > > >
          > > >
          > > > Bill
          > > >
          > > > -----Original Message-----
          > > > From: [email protected]
          > [mailto:[email protected]]On
          > > > Behalf Of Jonathan Coulter Sent: Friday, January 28, 2005 10:54 PM
          > > > To: Miva-Users
          > > > Subject: RE: [meu] SMTP Error
          > > >
          > > >
          > > > Thanks David,
          > > >
          > > > That fixed part of it. I still got the same error
          > message until I
          > > > changed the FROM to a real address within <>. That allowed
          > > the email
          > > > to be sent.
          > > >
          > > > However, the email was received was empty. The rest of the
          > > code is as
          > > > follows. Maybe its too late to be working on this, it's gotta be
          > > > obvious.
          > > > Any suggestions?
          > > >
          > > > <MvSMTP to="<[email protected]>"
          > subject="Property Search
          > > > Request"
          > > > mailhost="smtp.stonewall-realty.com"
          > > > from="<[email protected]>">
          > > > MIME-Version: 1.0
          > > > Content-Type: text/html; charset=us-ascii
          > > >
          > > > <font face="Verdana" size="2">
          > > > The following information was entered via the website's Property
          > > > Search Form.
          > > >


          > > > <table width=100% border=0>
          > > > email details go here
          > > > </table>
          > > >
          > > > </MvSMTP>
          > > >
          > > > Thanks,
          > > > Jon
          > > >
          > > >
          > > > -----Original Message-----
          > > > From: [email protected]
          > [mailto:[email protected]]On
          > > > Behalf Of David Hubbard Sent: Friday, January 28, 2005 11:33 PM
          > > > To: Jonathan Coulter; Miva-Users
          > > > Subject: RE: [meu] SMTP Error
          > > >
          > > >
          > > > Change your TO= to have angle brackets around the address,
          > > > <[email protected]>
          > > >
          > > > David
          > > >
          > > > Jonathan Coulter wrote:
          > > >> Hello,
          > > >>
          > > >> Can anyone tell me what is wrong with this?
          > > >>
          > > >> <MvSMTP TO="[email protected]" FROM="{ xemail }"
          > > >> SUBJECT="Property Search Request"
          > > >> MAILHOST="smtp.stonewall-realty.com">
          > > >>
          > > >> I am getting this error message ...
          > > >>
          > > >> Runtime error in /moreinfo.mvc @ [00000000:0000008e]:
          > moreinfo.mv:
          > > >> Line 5: MvSMTP: 5.5.2 where is <...> in that?
          > > >>
          > > >> Thanks!
          > > >> Jon Coulter
          > > >

          Comment


            #6
            OT Programming Conundrum - But where else can I find such excellent help?



            I'm building an application where I need to perform an action depending on
            the relationships (<,=,>) of 4 variables (A,B,C,D).

            This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D) with a total
            of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
            A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.

            Obviously, many of these 729 results are mathematically impossible (eg,
            anything containing A=B,B=C,A>C) and could never occur.

            I was able, semi-manually, to eliminate (I hope) all the impossibles (654),
            leaving me with only 75 mathematically possible results.

            Further examination turned up 50 results that were not possible in the
            context of the application and 12 that were possible but had no effect on
            the application, although both groups needed an error trap just in case.

            All told, I ended up with only 13 conditions where I had to program an
            action - definitely much easier to deal with than the 729 I started with.


            Now, my problem - my employer wants to add a fifth variable (E) to the mix.
            This will give me 10 comparisons with a possible set of results numbering
            59,049 (3 to the 10th power).

            Just as I did with the 4 variables I need to eliminate all the impossibles,
            but this is wayyyy to0 many for me to reduce using semi-manual techniques.

            Can anybody give me a link to something on the web that can help me? I don't
            even know what it's called to start looking for it. I tried "Truth table" in
            Google and got 168,000 hits, but nothing seemed relevant.

            Any suggestions?

            Thanks


            Mike McBee
            Signature House
            [email protected]
            www.signaturehouse.net
            304-842-3386




            Comment


              #7
              OT Programming Conundrum - But where else can I find such



              Fun stuff. FWIW, searching for "permutations" might be a good place to
              start.

              btw, I read this a couple times and am still not quite clear on exactly
              what you are after.

              Adam

              Signature House wrote:
              > I'm building an application where I need to perform an action depending on
              > the relationships (<,=,>) of 4 variables (A,B,C,D).
              >
              > This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D) with a total
              > of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
              > A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.
              >
              > Obviously, many of these 729 results are mathematically impossible (eg,
              > anything containing A=B,B=C,A>C) and could never occur.
              >
              > I was able, semi-manually, to eliminate (I hope) all the impossibles (654),
              > leaving me with only 75 mathematically possible results.
              >
              > Further examination turned up 50 results that were not possible in the
              > context of the application and 12 that were possible but had no effect on
              > the application, although both groups needed an error trap just in case.
              >
              > All told, I ended up with only 13 conditions where I had to program an
              > action - definitely much easier to deal with than the 729 I started with.
              >
              >
              > Now, my problem - my employer wants to add a fifth variable (E) to the mix.
              > This will give me 10 comparisons with a possible set of results numbering
              > 59,049 (3 to the 10th power).
              >
              > Just as I did with the 4 variables I need to eliminate all the impossibles,
              > but this is wayyyy to0 many for me to reduce using semi-manual techniques.
              >
              > Can anybody give me a link to something on the web that can help me? I don't
              > even know what it's called to start looking for it. I tried "Truth table" in
              > Google and got 168,000 hits, but nothing seemed relevant.
              >
              > Any suggestions?
              >
              > Thanks

              Comment


                #8
                OT Programming Conundrum - But where else can I find such excellent help?



                On Tue, 8 Mar 2005 12:56:44 -0500, Signature House
                <[email protected]> wrote:
                > I'm building an application where I need to perform an action depending on
                > the relationships (<,=,>) of 4 variables (A,B,C,D).
                >
                > This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D) with a total
                > of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
                > A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.
                >
                > Obviously, many of these 729 results are mathematically impossible (eg,
                > anything containing A=B,B=C,A>C) and could never occur.
                >
                > I was able, semi-manually, to eliminate (I hope) all the impossibles (654),
                > leaving me with only 75 mathematically possible results.
                >
                > Further examination turned up 50 results that were not possible in the
                > context of the application and 12 that were possible but had no effect on
                > the application, although both groups needed an error trap just in case.
                >
                > All told, I ended up with only 13 conditions where I had to program an
                > action - definitely much easier to deal with than the 729 I started with.
                >
                > Now, my problem - my employer wants to add a fifth variable (E) to the mix.
                > This will give me 10 comparisons with a possible set of results numbering
                > 59,049 (3 to the 10th power).
                >
                > Just as I did with the 4 variables I need to eliminate all the impossibles,
                > but this is wayyyy to0 many for me to reduce using semi-manual techniques.
                >
                > Can anybody give me a link to something on the web that can help me? I don't
                > even know what it's called to start looking for it. I tried "Truth table" in
                > Google and got 168,000 hits, but nothing seemed relevant.

                This looks like a very interesting/challenging/fun puzzle.
                Maybe we should start a Miva Quiz for things like this.

                for references see:
                <A HREF ="http://www.rubyquiz.com/">http://www.rubyquiz.com/</A>
                http://perl.plover.com/qotw/

                --
                Bill Guindon (aka aGorilla)

                Comment


                  #9
                  OT Programming Conundrum - But where else can I find such excellent help?



                  As Adam told, it is not quite clear what are you trying to achieve. More
                  specific description would certainly help to find the right way to solve it.

                  However, in programming it is very rarely needed to code each logical
                  permutation separately. Mostly you can either serialize the conditions
                  and/or use functions for each part, or find an algorithm (or a few of them),
                  or simply not trying to match all possible input variation, but rather all
                  possible outcomes instead.

                  If really each of the relations (A::B, A::C, A::D,B::C,B::D,C::D), or most
                  of them results in a completely different value, and no algorithm can be
                  used to give the result, then probably the simplest and fastest solution
                  would be using a database with a record for each permutation and indexed
                  accordingly. Depending on your specific case, one field (column) of the
                  database would contain the symbolic expression (used as a key) - for example
                  "A<B,A=C,A=D,B>C,B<D,C>D", and the second field would contain the result -
                  it could be both a constant (number, character, string,...) or an expression
                  (logical, numerical, function,...). You would then use MvFIND to return the
                  proper result practically instantly.

                  Ivo Truxa

                  | http://miva.truxoft.com
                  | Advanced Miva Merchant modules





                  -----Original Message-----
                  From: Adam Denning


                  Fun stuff. FWIW, searching for "permutations" might be a good place to
                  start.

                  btw, I read this a couple times and am still not quite clear on exactly
                  what you are after.

                  Adam

                  Signature House wrote:
                  > I'm building an application where I need to perform an action depending on
                  > the relationships (<,=,>) of 4 variables (A,B,C,D).
                  >
                  > This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D) with a total
                  > of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
                  > A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.
                  >
                  > Obviously, many of these 729 results are mathematically impossible (eg,
                  > anything containing A=B,B=C,A>C) and could never occur.
                  >
                  > I was able, semi-manually, to eliminate (I hope) all the impossibles
                  (654),
                  > leaving me with only 75 mathematically possible results.
                  >
                  > Further examination turned up 50 results that were not possible in the
                  > context of the application and 12 that were possible but had no effect on
                  > the application, although both groups needed an error trap just in case.
                  >
                  > All told, I ended up with only 13 conditions where I had to program an
                  > action - definitely much easier to deal with than the 729 I started with.
                  >
                  >
                  > Now, my problem - my employer wants to add a fifth variable (E) to the
                  mix.
                  > This will give me 10 comparisons with a possible set of results numbering
                  > 59,049 (3 to the 10th power).
                  >
                  > Just as I did with the 4 variables I need to eliminate all the
                  impossibles,
                  > but this is wayyyy to0 many for me to reduce using semi-manual techniques.
                  >
                  > Can anybody give me a link to something on the web that can help me? I
                  don't
                  > even know what it's called to start looking for it. I tried "Truth table"
                  in
                  > Google and got 168,000 hits, but nothing seemed relevant.
                  >
                  > Any suggestions?
                  >
                  > Thanks



                  Comment


                    #10
                    OT Programming Conundrum - But where else can I find such excellent help?



                    Hi Mike

                    That is called Logic or constraints programming and more specifically a
                    search. Languages like Prolog and Mozart and a few others are designed =
                    for
                    that, if you are interested in this you may want to take a look at the
                    mozart tutorial to see how they handle that:
                    <A HREF ="http://www.mozart-oz.org/documentation/fdt/index.html or">http://www.mozart-oz.org/documentation/fdt/index.html or</A>
                    <A HREF ="http://www.mozart-oz.org/papers/.=20">http://www.mozart-oz.org/papers/.=20</A>

                    The way is to first reduce logically or mathematically the number of
                    possible combinations and then get the rest, if necessary through brute
                    force.

                    I'm afraid however this won't give you a quick answer....=20

                    With 5 variables, you actually don't have that many possibilities at =
                    all.
                    The mistake is to think of x power y, because in fact your choices are =
                    much
                    more limited because a>b is the same as b<a and if a=3Db and c=3Dd then =
                    is a=3Db=3Dc




                    A=3DC B=3DC ---> A,B=3DC
                    A<C B<C ---> A,B<C
                    A>C B>C ---> A,B>C
                    A=3DD B=3DD C=3DD ---> A,B,C=3DD
                    Etc.

                    So if you forget for a moment the variables, but instead you look at the
                    operators, you get

                    A=3DB=3DC=3DD=3DE ---> =3D=3D=3D=3D
                    A<B=3DC=3DD=3DE ---> <=3D=3D=3D
                    A>B=3DC=3DD=3DE ---> >=3D=3D=3D=20
                    A=3DB<C=3DD=3DE ---> =3D<=3D=3D
                    A=3DB>C=3DD=3DE ---> =3D>=3D=3D
                    A=3DB=3DC<D=3DE ---> =3D=3D<=3D
                    ... Etc.

                    In form of a matrix, that looks like this:=20

                    1 2 3 4
                    1 =3D =3D =3D =3D
                    2 < =3D =3D =3D
                    3 > =3D =3D =3D
                    4 =3D < =3D =3D
                    5 < < =3D =3D
                    6 > < =3D =3D
                    7 =3D > < =3D
                    8 < > < =3D
                    9 > > < =3D
                    10 =3D =3D < =3D
                    11 < =3D < =3D
                    12 > =3D < =3D
                    13 =3D < > =3D
                    14 < < > =3D
                    15 > < > =3D
                    16 =3D > > =3D
                    17 < > > =3D
                    18 > > > =3D
                    19 =3D =3D =3D <
                    20 < =3D =3D <
                    21 > =3D =3D <
                    22 =3D < =3D <
                    23 < < =3D <
                    24 > < =3D <
                    25 =3D > < <
                    26 < > < <
                    27 > > < <
                    28 =3D =3D < <
                    29 < =3D < <
                    30 > =3D < <
                    31 =3D < > <
                    32 < < > <
                    33 > < > <
                    34 =3D > > <
                    35 < > > <
                    36 > > > <
                    37 =3D =3D =3D >
                    38 < =3D =3D >
                    39 > =3D =3D >
                    40 =3D < =3D >
                    41 < < =3D >
                    42 > < =3D >
                    43 =3D > < >
                    44 < > < >
                    45 > > < >
                    46 =3D =3D < >
                    47 < =3D < >
                    48 > =3D < >
                    49 =3D < > >
                    50 < < > >
                    51 > < > >
                    52 =3D > > >
                    53 < > > >
                    54 > > > >


                    which are effective 54 combinations.

                    With a recursive function which interrupts itself as soon as a value =
                    returns
                    false, you can actually get a result quite quickly.=20

                    Enough of all that theory, here some more practical code that is =
                    actually
                    tested: If you sort the values first, as Bill suggested, you can even =
                    reduce
                    the number of iterations much further. You can use the following =
                    function
                    for as many combinations / variables as you like. (The script can be
                    shortened a bit, because it has some rudimentary things in it from the
                    original version with with 3 different operators).=20

                    // You have 11 variables:

                    <MvASSIGN NAME =3D "l.var" INDEX=3D"1" VALUE =3D "1880" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"2" VALUE =3D "15" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"3"VALUE =3D "75" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"4" VALUE =3D "13450" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"5" VALUE =3D "1544" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"6" VALUE =3D "15.44" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"7" VALUE =3D "1880" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"8" VALUE =3D "15" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"9"VALUE =3D "4755" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"10" VALUE =3D "100" >
                    <MvASSIGN NAME =3D "l.var" INDEX=3D"11" VALUE =3D "1544" >

                    // ... And 2 operators:=20
                    <MvASSIGN NAME =3D "g.op" INDEX=3D"1" VALUE =3D "=3D" >
                    <MvASSIGN NAME =3D "g.op" INDEX=3D"2" VALUE =3D "<" >


                    <MvASSIGN NAME =3D "l.result" VALUE =3D "{ loop(
                    1,miva_array_deserialize(sort(l.var)),l.var,'') }" >


                    <MvEVAL EXPR =3D "{ l.result }" >


                    Iterations: <MvEVAL EXPR =3D "{ g.counter }" >



                    <MvFUNCTION NAME =3D "sort" PARAMETERS=3D"num" STANDARDOUTPUTLEVEL =3D
                    "html,text,compresswhitespace">=20
                    // this is just the sorting script=20

                    <MvASSIGN NAME =3D "l.a" VALUE =3D "1" >
                    <MvWHILE EXPR =3D "{ l.num[l.a] }">
                    <MvASSIGNARRAY NAME =3D "l.sorted" VALUE =3D "{ l.a }" >
                    <MvMEMBER NAME=3D"{ padl( gettoken(l.num[l.a],'.',1),10,'0') $
                    padr( gettoken(l.num[l.a],'.',2),5,'0') }">
                    <MvDIMENSION INDEX=3D"{ miva_array_max(
                    miva_variable_value('l.sorted:'$padl(
                    gettoken(l.num[l.a],'.',1),10,'0')$padr(
                    gettoken(l.num[l.a],'.',2),5,'0')))+1 }">
                    </MvASSIGNARRAY>
                    <MvASSIGN NAME =3D "l.a" VALUE =3D "{ l.a+1 }" >
                    </MvWHILE>
                    <MvFUNCRETURN VALUE=3D"{ miva_array_deserialize( l.sorted )}">
                    </MvFUNCTION>



                    // The main recursive function

                    <MvFUNCTION NAME =3D "loop" PARAMETERS=3D"step,sorted,num,final"
                    STANDARDOUTPUTLEVEL =3D "html,text,compresswhitespace">=20

                    <MvIF EXPR =3D "{ l.step EQ miva_array_max(l.num) }">
                    <MvFUNCRETURN VALUE=3D"{ l.final }">=20
                    </MvIF>
                    <MvASSIGN NAME =3D "l.p" VALUE =3D "1" >
                    <MvWHILE EXPR =3D "{ l.p LE 2 }">
                    // just a counter to get the number of iterations.=20
                    <MvASSIGN NAME =3D "g.counter" VALUE =3D "{g.counter+1 }" >
                    <MvIF EXPR =3D "{ calc( l.p,l.num[ l.sorted[l.step]] , l.num[
                    l.sorted[l.step+1]]) }" >
                    <MvASSIGN NAME =3D "l.final" INDEX=3D"{l.step}" VALUE =3D
                    "{l.num[ l.sorted[l.step]] $ g.op[l.p]$l.num[ l.sorted[l.step+1]] }" =
                    >
                    <MvFUNCRETURN VALUE=3D"{ loop(l.step+1,l.sorted,l.num,l.final
                    ) }">
                    </MvIF>
                    <MvASSIGN NAME =3D "l.p" VALUE =3D "{ l.p+1 }" >
                    </MvWHILE>
                    =20
                    <MvFUNCRETURN VALUE=3D"{ l.final }">
                    </MvFUNCTION>


                    // a little helper:

                    <MvFUNCTION NAME =3D "calc" PARAMETERS=3D"iteration,var1,var2"
                    STANDARDOUTPUTLEVEL =3D "html,text,compresswhitespace">=20
                    <MvIF EXPR =3D "{ NOT fmod(l.iteration,2) }" >
                    <MvFUNCRETURN VALUE=3D"{ l.var1 LT l.var2}">
                    <MvELSE>
                    <MvFUNCRETURN VALUE=3D"{ l.var1 EQ l.var2}">=20
                    </MvIF>
                    </MvFUNCTION>




                    /////////////////////////////////////////////////////


                    This returns:=20
                    15=3D15,15<15.44,15.44<75,75<100,100<1544,1544=3D1 544,1544<1880,1880=3D18=
                    80,1880<4
                    755,4755<13450=20
                    Iterations: 17=20


                    /////////////////////////////////////////////////////


                    I have not the slightest clue if this has any meaning for your auction
                    script, but it was fun - all the good stuff is in it, recursive function
                    calls, nested array indices, sorting through structures, functionreturns =
                    for
                    IF-conditions etc... You have to love mivascript, especially if ...




                    ...it can get shorter:

                    <MvASSIGN NAME =3D "l.values" VALUE =3D "{ sort(l.var) }" >

                    <MvASSIGN NAME =3D "l.a" VALUE =3D "1" >
                    <MvWHILE EXPR =3D "{ l.values[l.a+1] }">

                    <MvIF EXPR =3D "{ l.var[l.values[l.a]] LT l.var[l.values[l.a+1]] }" >
                    <MvASSIGN NAME =3D "l.result" INDEX=3D"{l.a}" VALUE =3D "{ =
                    l.values[l.a]
                    $'<'$ l.values[l.a+1] }" >
                    <MvELSE>
                    <MvASSIGN NAME =3D "l.result" INDEX=3D"{l.a}" VALUE =3D "{ =
                    l.values[l.a]
                    $'=3D'$ l.values[l.a+1] }" >
                    </MvIF>
                    <MvASSIGN NAME =3D "l.a" VALUE =3D "{ l.a+1 }" >
                    </MvWHILE>



                    <MvEVAL EXPR =3D "{ l.result }" >


                    Which effectively returns the array indices of the original variables =
                    (the
                    result is the same):
                    2=3D8,8<6,6<3,3<10,10<5,5=3D11,11<1,1=3D7,7<9,9<4= 20

                    As others said before me, you need to look into the requirements
                    (constraints) and cut the number of conditions down first that way.
                    Otherwise you end up like me writing 30 lines of fancy code when 10 =
                    simple
                    ones do the trick.=20



                    Markus











                    -----Original Message-----
                    From: [email protected] [mailto:[email protected]] On =
                    Behalf
                    Of Signature House
                    Sent: Dienstag, 8. M=E4rz 2005 18:57
                    To: 'Miva-Users'
                    Subject: [meu] OT Programming Conundrum - But where else can I find such
                    excellent help?

                    I'm building an application where I need to perform an action depending =
                    on
                    the relationships (<,=3D,>) of 4 variables (A,B,C,D).

                    This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D) with a =
                    total
                    of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
                    A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.

                    Obviously, many of these 729 results are mathematically impossible (eg,
                    anything containing A=3DB,B=3DC,A>C) and could never occur.

                    I was able, semi-manually, to eliminate (I hope) all the impossibles =
                    (654),
                    leaving me with only 75 mathematically possible results.

                    Further examination turned up 50 results that were not possible in the
                    context of the application and 12 that were possible but had no effect =
                    on
                    the application, although both groups needed an error trap just in case.

                    All told, I ended up with only 13 conditions where I had to program an
                    action - definitely much easier to deal with than the 729 I started =
                    with.


                    Now, my problem - my employer wants to add a fifth variable (E) to the =
                    mix.
                    This will give me 10 comparisons with a possible set of results =
                    numbering
                    59,049 (3 to the 10th power).

                    Just as I did with the 4 variables I need to eliminate all the =
                    impossibles,
                    but this is wayyyy to0 many for me to reduce using semi-manual =
                    techniques.

                    Can anybody give me a link to something on the web that can help me? I =
                    don't
                    even know what it's called to start looking for it. I tried "Truth =
                    table" in
                    Google and got 168,000 hits, but nothing seemed relevant.

                    Any suggestions?

                    Thanks


                    Mike McBee
                    Signature House
                    [email protected]
                    www.signaturehouse.net
                    304-842-3386




                    Comment


                      #11
                      OT Programming Conundrum - But where else can I find such excellent help?



                      On Wed, 9 Mar 2005 03:19:59 +0100, MvMarkus <[email protected]> wrote:
                      > Hi Mike
                      >
                      > That is called Logic or constraints programming and more specifically a
                      > search. Languages like Prolog and Mozart and a few others are designed for
                      > that, if you are interested in this you may want to take a look at the
                      > mozart tutorial to see how they handle that:
                      > <A HREF ="http://www.mozart-oz.org/documentation/fdt/index.html or">http://www.mozart-oz.org/documentation/fdt/index.html or</A>
                      > <A HREF =/"http://www.mozart-oz.org/papers//">http://www.mozart-oz.org/papers/</A>.
                      >
                      > The way is to first reduce logically or mathematically the number of
                      > possible combinations and then get the rest, if necessary through brute
                      > force.
                      >
                      > I'm afraid however this won't give you a quick answer....
                      >
                      > With 5 variables, you actually don't have that many possibilities at all.
                      > The mistake is to think of x power y, because in fact your choices are much
                      > more limited because a>b is the same as b<a and if a=b and c=d then is a=b=c

                      [a lot of impressive stuff snipped]

                      We're on the green now, that deserves a *golf clap*.

                      I'm pretty sure I eliminated the need to reduce the </> by doing a
                      sort first, which let you use one or the other. Either way, I'll have
                      to study your post Markus, lots to learn from there.

                      btw, for any of you looking for a language to play/experiment with, I
                      strongly recommend Ruby (I'll try to keep comments like that to a
                      minimum... but it'll requre "extremerestraints"). It's a great
                      addition to any toolbox, and can be used many ways to make your Miva
                      coding easier.

                      --
                      Bill Guindon (aka aGorilla)

                      Comment


                        #12
                        OT Programming Conundrum - But where else can I find such excellent help?



                        Markus

                        Great! Give a man a fish and eats for a day, but teach him how to fish and
                        he eats for life (or something like that).

                        Thanks so much for naming this thing for me.

                        On the rest, I think I'm going to disagree with you here, at least at first
                        glance.

                        In my initial statement I said I had 4 variables (ABCD) to deal with and
                        that I wanted to compare each to all of the others. I arrived at a unique
                        set of 729 potential comparisons by a 2 step use of combinations and
                        permutations.

                        First step: How many potential comparisons?:
                        Since A=B is equivalent to B=A, A>B equivalent to B<A, and A<B equivalent to
                        B>A, order was not important. Therefore, I'm looking at a combination, not a
                        permutation; and since A=A, B=B, ... are also not important, it's without
                        replacement. So, I have 6 possible comparisons
                        (A::B,A::C,A::D,B::C,B::D,C::D). If order was important, then I'd have been
                        talking about a permutation, also without replacement and there would have
                        been 12 comparisons(A::B,B::A,...).

                        Second step: How many potential results?:
                        Looking at the 6 comparisions that I have (A::B,A::C,A::D,B::C,B::D,C::D),
                        you can see that I have 6 holes to fill, each with one of 3 operators (<, =,
                        >). Since order does matter, I now have a permutation, albeit a some what
                        unusual one since replacement does occur, ie, 3 items taken 6 at a time. The
                        solution is 3 to the 6th power, or 729 potential, unique results.

                        Applying the same steps to the 5 variable problem gives me 10 comparisons
                        and 59,049 potential, unique results.

                        Your list of 54 combinations is missing some items, for example, <<<<

                        Having said that, and remembering that this response is just after a first
                        glance, I may very well be all wet. If so, I certainly want to find it out
                        now.

                        I'll certainly give your response a lot more study, especially the code - it
                        really looks interesting.

                        Many thanks


                        Mike McBee
                        Signature House
                        [email protected]
                        www.signaturehouse.net
                        304-842-3386

                        -> -----Original Message-----
                        -> From: [email protected] [mailto:[email protected]]On
                        -> Behalf Of MvMarkus
                        -> Sent: Tuesday, March 08, 2005 09:20 PM
                        -> To: 'Signature House'; 'Miva-Users'
                        -> Subject: RE: [meu] OT Programming Conundrum - But where else can I find
                        -> such excellent help?
                        ->
                        ->
                        -> Hi Mike
                        ->
                        -> That is called Logic or constraints programming and more specifically a
                        -> search. Languages like Prolog and Mozart and a few others are
                        -> designed for
                        -> that, if you are interested in this you may want to take a look at the
                        -> mozart tutorial to see how they handle that:
                        -> <A HREF ="http://www.mozart-oz.org/documentation/fdt/index.html or">http://www.mozart-oz.org/documentation/fdt/index.html or</A>
                        -> <A HREF =/"http://www.mozart-oz.org/papers//">http://www.mozart-oz.org/papers/</A>.
                        ->
                        -> The way is to first reduce logically or mathematically the number of
                        -> possible combinations and then get the rest, if necessary through brute
                        -> force.
                        ->
                        -> I'm afraid however this won't give you a quick answer....
                        ->
                        -> With 5 variables, you actually don't have that many possibilities at all.
                        -> The mistake is to think of x power y, because in fact your
                        -> choices are much
                        -> more limited because a>b is the same as b<a and if a=b and c=d
                        -> then is a=b=c
                        ->
                        ->
                        ->
                        ->
                        -> A=C B=C ---> A,B=C
                        -> A<C B<C ---> A,B<C
                        -> A>C B>C ---> A,B>C
                        -> A=D B=D C=D ---> A,B,C=D
                        -> Etc.
                        ->
                        -> So if you forget for a moment the variables, but instead you look at the
                        -> operators, you get
                        ->
                        -> A=B=C=D=E ---> ====
                        -> A<B=C=D=E ---> <===
                        -> A>B=C=D=E ---> >===
                        -> A=B<C=D=E ---> =<==
                        -> A=B>C=D=E ---> =>==
                        -> A=B=C<D=E ---> ==<=
                        -> ... Etc.
                        ->
                        -> In form of a matrix, that looks like this:
                        ->
                        -> 1 2 3 4
                        -> 1 = = = =
                        -> 2 < = = =
                        -> 3 > = = =
                        -> 4 = < = =
                        -> 5 < < = =
                        -> 6 > < = =
                        -> 7 = > < =
                        -> 8 < > < =
                        -> 9 > > < =
                        -> 10 = = < =
                        -> 11 < = < =
                        -> 12 > = < =
                        -> 13 = < > =
                        -> 14 < < > =
                        -> 15 > < > =
                        -> 16 = > > =
                        -> 17 < > > =
                        -> 18 > > > =
                        -> 19 = = = <
                        -> 20 < = = <
                        -> 21 > = = <
                        -> 22 = < = <
                        -> 23 < < = <
                        -> 24 > < = <
                        -> 25 = > < <
                        -> 26 < > < <
                        -> 27 > > < <
                        -> 28 = = < <
                        -> 29 < = < <
                        -> 30 > = < <
                        -> 31 = < > <
                        -> 32 < < > <
                        -> 33 > < > <
                        -> 34 = > > <
                        -> 35 < > > <
                        -> 36 > > > <
                        -> 37 = = = >
                        -> 38 < = = >
                        -> 39 > = = >
                        -> 40 = < = >
                        -> 41 < < = >
                        -> 42 > < = >
                        -> 43 = > < >
                        -> 44 < > < >
                        -> 45 > > < >
                        -> 46 = = < >
                        -> 47 < = < >
                        -> 48 > = < >
                        -> 49 = < > >
                        -> 50 < < > >
                        -> 51 > < > >
                        -> 52 = > > >
                        -> 53 < > > >
                        -> 54 > > > >
                        ->
                        ->
                        -> which are effective 54 combinations.
                        ->
                        -> With a recursive function which interrupts itself as soon as a
                        -> value returns
                        -> false, you can actually get a result quite quickly.
                        ->
                        -> Enough of all that theory, here some more practical code that is actually
                        -> tested: If you sort the values first, as Bill suggested, you can
                        -> even reduce
                        -> the number of iterations much further. You can use the following function
                        -> for as many combinations / variables as you like. (The script can be
                        -> shortened a bit, because it has some rudimentary things in it from the
                        -> original version with with 3 different operators).
                        ->
                        -> // You have 11 variables:
                        ->
                        -> <MvASSIGN NAME = "l.var" INDEX="1" VALUE = "1880" >
                        -> <MvASSIGN NAME = "l.var" INDEX="2" VALUE = "15" >
                        -> <MvASSIGN NAME = "l.var" INDEX="3"VALUE = "75" >
                        -> <MvASSIGN NAME = "l.var" INDEX="4" VALUE = "13450" >
                        -> <MvASSIGN NAME = "l.var" INDEX="5" VALUE = "1544" >
                        -> <MvASSIGN NAME = "l.var" INDEX="6" VALUE = "15.44" >
                        -> <MvASSIGN NAME = "l.var" INDEX="7" VALUE = "1880" >
                        -> <MvASSIGN NAME = "l.var" INDEX="8" VALUE = "15" >
                        -> <MvASSIGN NAME = "l.var" INDEX="9"VALUE = "4755" >
                        -> <MvASSIGN NAME = "l.var" INDEX="10" VALUE = "100" >
                        -> <MvASSIGN NAME = "l.var" INDEX="11" VALUE = "1544" >
                        ->
                        -> // ... And 2 operators:
                        -> <MvASSIGN NAME = "g.op" INDEX="1" VALUE = "=" >
                        -> <MvASSIGN NAME = "g.op" INDEX="2" VALUE = "<" >
                        ->
                        ->
                        -> <MvASSIGN NAME = "l.result" VALUE = "{ loop(
                        -> 1,miva_array_deserialize(sort(l.var)),l.var,'') }" >
                        ->
                        ->
                        <MvEVAL EXPR = "{ l.result }" >

                        ->
                        Iterations: <MvEVAL EXPR = "{ g.counter }" >
                        ->
                        ->
                        ->
                        -> <MvFUNCTION NAME = "sort" PARAMETERS="num" STANDARDOUTPUTLEVEL =
                        -> "html,text,compresswhitespace">
                        -> // this is just the sorting script
                        ->
                        -> <MvASSIGN NAME = "l.a" VALUE = "1" >
                        -> <MvWHILE EXPR = "{ l.num[l.a] }">
                        -> <MvASSIGNARRAY NAME = "l.sorted" VALUE = "{ l.a }" >
                        -> <MvMEMBER NAME="{ padl( gettoken(l.num[l.a],'.',1),10,'0') $
                        -> padr( gettoken(l.num[l.a],'.',2),5,'0') }">
                        -> <MvDIMENSION INDEX="{ miva_array_max(
                        -> miva_variable_value('l.sorted:'$padl(
                        -> gettoken(l.num[l.a],'.',1),10,'0')$padr(
                        -> gettoken(l.num[l.a],'.',2),5,'0')))+1 }">
                        -> </MvASSIGNARRAY>
                        -> <MvASSIGN NAME = "l.a" VALUE = "{ l.a+1 }" >
                        -> </MvWHILE>
                        -> <MvFUNCRETURN VALUE="{ miva_array_deserialize( l.sorted )}">
                        -> </MvFUNCTION>
                        ->
                        ->
                        ->
                        -> // The main recursive function
                        ->
                        -> <MvFUNCTION NAME = "loop" PARAMETERS="step,sorted,num,final"
                        -> STANDARDOUTPUTLEVEL = "html,text,compresswhitespace">
                        ->
                        -> <MvIF EXPR = "{ l.step EQ miva_array_max(l.num) }">
                        -> <MvFUNCRETURN VALUE="{ l.final }">
                        -> </MvIF>
                        -> <MvASSIGN NAME = "l.p" VALUE = "1" >
                        -> <MvWHILE EXPR = "{ l.p LE 2 }">
                        -> // just a counter to get the number of iterations.
                        -> <MvASSIGN NAME = "g.counter" VALUE = "{g.counter+1 }" >
                        -> <MvIF EXPR = "{ calc( l.p,l.num[ l.sorted[l.step]] , l.num[
                        -> l.sorted[l.step+1]]) }" >
                        -> <MvASSIGN NAME = "l.final" INDEX="{l.step}" VALUE =
                        -> "{l.num[ l.sorted[l.step]] $ g.op[l.p]$l.num[ l.sorted[l.step+1]] }" >
                        -> <MvFUNCRETURN VALUE="{ loop(l.step+1,l.sorted,l.num,l.final
                        -> ) }">
                        -> </MvIF>
                        -> <MvASSIGN NAME = "l.p" VALUE = "{ l.p+1 }" >
                        -> </MvWHILE>
                        ->
                        -> <MvFUNCRETURN VALUE="{ l.final }">
                        -> </MvFUNCTION>
                        ->
                        ->
                        -> // a little helper:
                        ->
                        -> <MvFUNCTION NAME = "calc" PARAMETERS="iteration,var1,var2"
                        -> STANDARDOUTPUTLEVEL = "html,text,compresswhitespace">
                        -> <MvIF EXPR = "{ NOT fmod(l.iteration,2) }" >
                        -> <MvFUNCRETURN VALUE="{ l.var1 LT l.var2}">
                        -> <MvELSE>
                        -> <MvFUNCRETURN VALUE="{ l.var1 EQ l.var2}">
                        -> </MvIF>
                        -> </MvFUNCTION>
                        ->
                        ->
                        ->
                        ->
                        -> /////////////////////////////////////////////////////
                        ->
                        ->
                        -> This returns:
                        -> 15=15,15<15.44,15.44<75,75<100,100<1544,1544=1544, 1544<1880,1880=
                        -> 1880,1880<4
                        -> 755,4755<13450
                        -> Iterations: 17
                        ->
                        ->
                        -> /////////////////////////////////////////////////////
                        ->
                        ->
                        -> I have not the slightest clue if this has any meaning for your auction
                        -> script, but it was fun - all the good stuff is in it, recursive function
                        -> calls, nested array indices, sorting through structures,
                        -> functionreturns for
                        -> IF-conditions etc... You have to love mivascript, especially if ...
                        ->
                        ->
                        ->
                        ->
                        -> ...it can get shorter:
                        ->
                        -> <MvASSIGN NAME = "l.values" VALUE = "{ sort(l.var) }" >
                        ->
                        -> <MvASSIGN NAME = "l.a" VALUE = "1" >
                        -> <MvWHILE EXPR = "{ l.values[l.a+1] }">
                        ->
                        -> <MvIF EXPR = "{ l.var[l.values[l.a]] LT l.var[l.values[l.a+1]] }" >
                        -> <MvASSIGN NAME = "l.result" INDEX="{l.a}" VALUE = "{ l.values[l.a]
                        -> $'<'$ l.values[l.a+1] }" >
                        -> <MvELSE>
                        -> <MvASSIGN NAME = "l.result" INDEX="{l.a}" VALUE = "{ l.values[l.a]
                        -> $'='$ l.values[l.a+1] }" >
                        -> </MvIF>
                        -> <MvASSIGN NAME = "l.a" VALUE = "{ l.a+1 }" >
                        -> </MvWHILE>
                        ->
                        ->
                        ->
                        <MvEVAL EXPR = "{ l.result }" >

                        ->
                        -> Which effectively returns the array indices of the original
                        -> variables (the
                        -> result is the same):
                        -> 2=8,8<6,6<3,3<10,10<5,5=11,11<1,1=7,7<9,9<4
                        ->
                        -> As others said before me, you need to look into the requirements
                        -> (constraints) and cut the number of conditions down first that way.
                        -> Otherwise you end up like me writing 30 lines of fancy code when
                        -> 10 simple
                        -> ones do the trick.
                        ->
                        ->
                        ->
                        -> Markus
                        ->
                        ->
                        ->
                        ->
                        ->
                        ->
                        ->
                        ->
                        ->
                        ->
                        ->
                        -> -----Original Message-----
                        -> From: [email protected]
                        -> [mailto:[email protected]] On Behalf
                        -> Of Signature House
                        -> Sent: Dienstag, 8. März 2005 18:57
                        -> To: 'Miva-Users'
                        -> Subject: [meu] OT Programming Conundrum - But where else can I find such
                        -> excellent help?
                        ->
                        -> I'm building an application where I need to perform an action
                        -> depending on
                        -> the relationships (<,=,>) of 4 variables (A,B,C,D).
                        ->
                        -> This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D)
                        -> with a total
                        -> of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
                        -> A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.
                        ->
                        -> Obviously, many of these 729 results are mathematically impossible (eg,
                        -> anything containing A=B,B=C,A>C) and could never occur.
                        ->
                        -> I was able, semi-manually, to eliminate (I hope) all the
                        -> impossibles (654),
                        -> leaving me with only 75 mathematically possible results.
                        ->
                        -> Further examination turned up 50 results that were not possible in the
                        -> context of the application and 12 that were possible but had no effect on
                        -> the application, although both groups needed an error trap just in case.
                        ->
                        -> All told, I ended up with only 13 conditions where I had to program an
                        -> action - definitely much easier to deal with than the 729 I started with.
                        ->
                        ->
                        -> Now, my problem - my employer wants to add a fifth variable (E)
                        -> to the mix.
                        -> This will give me 10 comparisons with a possible set of results numbering
                        -> 59,049 (3 to the 10th power).
                        ->
                        -> Just as I did with the 4 variables I need to eliminate all the
                        -> impossibles,
                        -> but this is wayyyy to0 many for me to reduce using semi-manual
                        -> techniques.
                        ->
                        -> Can anybody give me a link to something on the web that can help
                        -> me? I don't
                        -> even know what it's called to start looking for it. I tried
                        -> "Truth table" in
                        -> Google and got 168,000 hits, but nothing seemed relevant.
                        ->
                        -> Any suggestions?
                        ->
                        -> Thanks
                        ->
                        ->
                        -> Mike McBee
                        -> Signature House
                        -> [email protected]
                        -> www.signaturehouse.net
                        -> 304-842-3386
                        ->
                        ->
                        ->
                        ->

                        Comment


                          #13
                          OT Programming Conundrum - But where else can I find such excellent help?



                          Wow! This is great (or is it?) So many different approaches, so much to
                          think about. And so little time to do it in. <sigh>

                          Unfortunately, the drudge of production & maintenance work always take
                          precedence over the much more enjoyable development stuff. With 3 large
                          sales a year, I'm lucky to squeeze out 6 weeks between each one where I can
                          actually do the fun stuff, and even those time periods are never completely
                          available (our current system CREAKS).

                          We start another major cycle this Monday, so I'll probably not get to spend
                          more than a few hours on it for the next 7-8 weeks. I lose a LOT of time
                          simply trying to get back up to speed each time.

                          Oh, well, such is Life.

                          I've responded with initial observations to some of your posts. I'll study
                          all your suggestions. Some are fairly alien to my thought processes (which
                          is what I needed) so wish me luck.

                          Many thanks for all of your suggestions.

                          Mike McBee
                          Signature House
                          [email protected]
                          www.signaturehouse.net
                          304-842-3386


                          Comment


                            #14
                            OT Programming Conundrum - But where else can I find such excellent help?



                            I thought it was:

                            Give a man a fish and he eats for a day.
                            Teach a man to fish and he sits in a boat and drinks beer all day.

                            ;-)

                            Larry Hiscock
                            AngelicHost
                            =20

                            -----Original Message-----
                            From: [email protected] [mailto:[email protected]] On =
                            Behalf
                            Of Signature House
                            Sent: Wednesday, March 09, 2005 11:40 AM
                            To: 'Miva-Users'
                            Subject: RE: [meu] OT Programming Conundrum - But where else can I find =
                            such
                            excellent help?

                            Markus

                            Great! Give a man a fish and eats for a day, but teach him how to fish =
                            and
                            he eats for life (or something like that).

                            Thanks so much for naming this thing for me.

                            On the rest, I think I'm going to disagree with you here, at least at =
                            first
                            glance.

                            In my initial statement I said I had 4 variables (ABCD) to deal with and
                            that I wanted to compare each to all of the others. I arrived at a =
                            unique
                            set of 729 potential comparisons by a 2 step use of combinations and
                            permutations.

                            First step: How many potential comparisons?:
                            Since A=3DB is equivalent to B=3DA, A>B equivalent to B<A, and A<B =
                            equivalent to
                            B>A, order was not important. Therefore, I'm looking at a combination, =
                            not a
                            permutation; and since A=3DA, B=3DB, ... are also not important, it's =
                            without
                            replacement. So, I have 6 possible comparisons
                            (A::B,A::C,A::D,B::C,B::D,C::D). If order was important, then I'd have =
                            been
                            talking about a permutation, also without replacement and there would =
                            have
                            been 12 comparisons(A::B,B::A,...).

                            Second step: How many potential results?:
                            Looking at the 6 comparisions that I have =
                            (A::B,A::C,A::D,B::C,B::D,C::D),
                            you can see that I have 6 holes to fill, each with one of 3 operators =
                            (<, =3D,
                            >). Since order does matter, I now have a permutation, albeit a some =
                            what
                            unusual one since replacement does occur, ie, 3 items taken 6 at a time. =
                            The
                            solution is 3 to the 6th power, or 729 potential, unique results.

                            Applying the same steps to the 5 variable problem gives me 10 =
                            comparisons
                            and 59,049 potential, unique results.

                            Your list of 54 combinations is missing some items, for example, <<<<

                            Having said that, and remembering that this response is just after a =
                            first
                            glance, I may very well be all wet. If so, I certainly want to find it =
                            out
                            now.

                            I'll certainly give your response a lot more study, especially the code =
                            - it
                            really looks interesting.

                            Many thanks


                            Mike McBee
                            Signature House
                            [email protected]
                            www.signaturehouse.net
                            304-842-3386

                            -> -----Original Message-----
                            -> From: [email protected] [mailto:[email protected]]On
                            -> Behalf Of MvMarkus
                            -> Sent: Tuesday, March 08, 2005 09:20 PM
                            -> To: 'Signature House'; 'Miva-Users'
                            -> Subject: RE: [meu] OT Programming Conundrum - But where else can I =
                            find
                            -> such excellent help?
                            ->
                            ->
                            -> Hi Mike
                            ->
                            -> That is called Logic or constraints programming and more specifically =
                            a
                            -> search. Languages like Prolog and Mozart and a few others are
                            -> designed for
                            -> that, if you are interested in this you may want to take a look at =
                            the
                            -> mozart tutorial to see how they handle that:
                            -> <A HREF ="http://www.mozart-oz.org/documentation/fdt/index.html or">http://www.mozart-oz.org/documentation/fdt/index.html or</A>
                            -> <A HREF =/"http://www.mozart-oz.org/papers//">http://www.mozart-oz.org/papers/</A>.
                            ->
                            -> The way is to first reduce logically or mathematically the number of
                            -> possible combinations and then get the rest, if necessary through =
                            brute
                            -> force.
                            ->
                            -> I'm afraid however this won't give you a quick answer....
                            ->
                            -> With 5 variables, you actually don't have that many possibilities at =
                            all.
                            -> The mistake is to think of x power y, because in fact your
                            -> choices are much
                            -> more limited because a>b is the same as b<a and if a=3Db and c=3Dd
                            -> then is a=3Db=3Dc
                            ->
                            ->
                            ->
                            ->
                            -> A=3DC B=3DC ---> A,B=3DC
                            -> A<C B<C ---> A,B<C
                            -> A>C B>C ---> A,B>C
                            -> A=3DD B=3DD C=3DD ---> A,B,C=3DD
                            -> Etc.
                            ->
                            -> So if you forget for a moment the variables, but instead you look at =
                            the
                            -> operators, you get
                            ->
                            -> A=3DB=3DC=3DD=3DE ---> =3D=3D=3D=3D
                            -> A<B=3DC=3DD=3DE ---> <=3D=3D=3D
                            -> A>B=3DC=3DD=3DE ---> >=3D=3D=3D
                            -> A=3DB<C=3DD=3DE ---> =3D<=3D=3D
                            -> A=3DB>C=3DD=3DE ---> =3D>=3D=3D
                            -> A=3DB=3DC<D=3DE ---> =3D=3D<=3D
                            -> ... Etc.
                            ->
                            -> In form of a matrix, that looks like this:
                            ->
                            -> 1 2 3 4
                            -> 1 =3D =3D =3D =3D
                            -> 2 < =3D =3D =3D
                            -> 3 > =3D =3D =3D
                            -> 4 =3D < =3D =3D
                            -> 5 < < =3D =3D
                            -> 6 > < =3D =3D
                            -> 7 =3D > < =3D
                            -> 8 < > < =3D
                            -> 9 > > < =3D
                            -> 10 =3D =3D < =3D
                            -> 11 < =3D < =3D
                            -> 12 > =3D < =3D
                            -> 13 =3D < > =3D
                            -> 14 < < > =3D
                            -> 15 > < > =3D
                            -> 16 =3D > > =3D
                            -> 17 < > > =3D
                            -> 18 > > > =3D
                            -> 19 =3D =3D =3D <
                            -> 20 < =3D =3D <
                            -> 21 > =3D =3D <
                            -> 22 =3D < =3D <
                            -> 23 < < =3D <
                            -> 24 > < =3D <
                            -> 25 =3D > < <
                            -> 26 < > < <
                            -> 27 > > < <
                            -> 28 =3D =3D < <
                            -> 29 < =3D < <
                            -> 30 > =3D < <
                            -> 31 =3D < > <
                            -> 32 < < > <
                            -> 33 > < > <
                            -> 34 =3D > > <
                            -> 35 < > > <
                            -> 36 > > > <
                            -> 37 =3D =3D =3D >
                            -> 38 < =3D =3D >
                            -> 39 > =3D =3D >
                            -> 40 =3D < =3D >
                            -> 41 < < =3D >
                            -> 42 > < =3D >
                            -> 43 =3D > < >
                            -> 44 < > < >
                            -> 45 > > < >
                            -> 46 =3D =3D < >
                            -> 47 < =3D < >
                            -> 48 > =3D < >
                            -> 49 =3D < > >
                            -> 50 < < > >
                            -> 51 > < > >
                            -> 52 =3D > > >
                            -> 53 < > > >
                            -> 54 > > > >
                            ->
                            ->
                            -> which are effective 54 combinations.
                            ->
                            -> With a recursive function which interrupts itself as soon as a
                            -> value returns
                            -> false, you can actually get a result quite quickly.
                            ->
                            -> Enough of all that theory, here some more practical code that is =
                            actually
                            -> tested: If you sort the values first, as Bill suggested, you can
                            -> even reduce
                            -> the number of iterations much further. You can use the following =
                            function
                            -> for as many combinations / variables as you like. (The script can be
                            -> shortened a bit, because it has some rudimentary things in it from =
                            the
                            -> original version with with 3 different operators).
                            ->
                            -> // You have 11 variables:
                            ->
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"1" VALUE =3D "1880" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"2" VALUE =3D "15" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"3"VALUE =3D "75" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"4" VALUE =3D "13450" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"5" VALUE =3D "1544" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"6" VALUE =3D "15.44" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"7" VALUE =3D "1880" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"8" VALUE =3D "15" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"9"VALUE =3D "4755" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"10" VALUE =3D "100" >
                            -> <MvASSIGN NAME =3D "l.var" INDEX=3D"11" VALUE =3D "1544" >
                            ->
                            -> // ... And 2 operators:
                            -> <MvASSIGN NAME =3D "g.op" INDEX=3D"1" VALUE =3D "=3D" >
                            -> <MvASSIGN NAME =3D "g.op" INDEX=3D"2" VALUE =3D "<" >
                            ->
                            ->
                            -> <MvASSIGN NAME =3D "l.result" VALUE =3D "{ loop(
                            -> 1,miva_array_deserialize(sort(l.var)),l.var,'') }" >
                            ->
                            ->
                            <MvEVAL EXPR =3D "{ l.result }" >

                            ->
                            Iterations: <MvEVAL EXPR =3D "{ g.counter }" >
                            ->
                            ->
                            ->
                            -> <MvFUNCTION NAME =3D "sort" PARAMETERS=3D"num" STANDARDOUTPUTLEVEL =
                            =3D
                            -> "html,text,compresswhitespace">
                            -> // this is just the sorting script
                            ->
                            -> <MvASSIGN NAME =3D "l.a" VALUE =3D "1" >
                            -> <MvWHILE EXPR =3D "{ l.num[l.a] }">
                            -> <MvASSIGNARRAY NAME =3D "l.sorted" VALUE =3D "{ l.a }" >
                            -> <MvMEMBER NAME=3D"{ padl( gettoken(l.num[l.a],'.',1),10,'0') $
                            -> padr( gettoken(l.num[l.a],'.',2),5,'0') }">
                            -> <MvDIMENSION INDEX=3D"{ miva_array_max(
                            -> miva_variable_value('l.sorted:'$padl(
                            -> gettoken(l.num[l.a],'.',1),10,'0')$padr(
                            -> gettoken(l.num[l.a],'.',2),5,'0')))+1 }">
                            -> </MvASSIGNARRAY>
                            -> <MvASSIGN NAME =3D "l.a" VALUE =3D "{ l.a+1 }" >
                            -> </MvWHILE>
                            -> <MvFUNCRETURN VALUE=3D"{ miva_array_deserialize( l.sorted )}">
                            -> </MvFUNCTION>
                            ->
                            ->
                            ->
                            -> // The main recursive function
                            ->
                            -> <MvFUNCTION NAME =3D "loop" PARAMETERS=3D"step,sorted,num,final"
                            -> STANDARDOUTPUTLEVEL =3D "html,text,compresswhitespace">
                            ->
                            -> <MvIF EXPR =3D "{ l.step EQ miva_array_max(l.num) }">
                            -> <MvFUNCRETURN VALUE=3D"{ l.final }">
                            -> </MvIF>
                            -> <MvASSIGN NAME =3D "l.p" VALUE =3D "1" >
                            -> <MvWHILE EXPR =3D "{ l.p LE 2 }">
                            -> // just a counter to get the number of iterations.
                            -> <MvASSIGN NAME =3D "g.counter" VALUE =3D "{g.counter+1 }" >
                            -> <MvIF EXPR =3D "{ calc( l.p,l.num[ l.sorted[l.step]] , l.num[
                            -> l.sorted[l.step+1]]) }" >
                            -> <MvASSIGN NAME =3D "l.final" INDEX=3D"{l.step}" VALUE =3D
                            -> "{l.num[ l.sorted[l.step]] $ g.op[l.p]$l.num[ l.sorted[l.step+1]] =
                            }" >
                            -> <MvFUNCRETURN VALUE=3D"{ loop(l.step+1,l.sorted,l.num,l.final
                            -> ) }">
                            -> </MvIF>
                            -> <MvASSIGN NAME =3D "l.p" VALUE =3D "{ l.p+1 }" >
                            -> </MvWHILE>
                            ->
                            -> <MvFUNCRETURN VALUE=3D"{ l.final }">
                            -> </MvFUNCTION>
                            ->
                            ->
                            -> // a little helper:
                            ->
                            -> <MvFUNCTION NAME =3D "calc" PARAMETERS=3D"iteration,var1,var2"
                            -> STANDARDOUTPUTLEVEL =3D "html,text,compresswhitespace">
                            -> <MvIF EXPR =3D "{ NOT fmod(l.iteration,2) }" >
                            -> <MvFUNCRETURN VALUE=3D"{ l.var1 LT l.var2}">
                            -> <MvELSE>
                            -> <MvFUNCRETURN VALUE=3D"{ l.var1 EQ l.var2}">
                            -> </MvIF>
                            -> </MvFUNCTION>
                            ->
                            ->
                            ->
                            ->
                            -> /////////////////////////////////////////////////////
                            ->
                            ->
                            -> This returns:
                            -> =
                            15=3D15,15<15.44,15.44<75,75<100,100<1544,1544=3D1 544,1544<1880,1880=3D
                            -> 1880,1880<4
                            -> 755,4755<13450
                            -> Iterations: 17
                            ->
                            ->
                            -> /////////////////////////////////////////////////////
                            ->
                            ->
                            -> I have not the slightest clue if this has any meaning for your =
                            auction
                            -> script, but it was fun - all the good stuff is in it, recursive =
                            function
                            -> calls, nested array indices, sorting through structures,
                            -> functionreturns for
                            -> IF-conditions etc... You have to love mivascript, especially if ...
                            ->
                            ->
                            ->
                            ->
                            -> ...it can get shorter:
                            ->
                            -> <MvASSIGN NAME =3D "l.values" VALUE =3D "{ sort(l.var) }" >
                            ->
                            -> <MvASSIGN NAME =3D "l.a" VALUE =3D "1" >
                            -> <MvWHILE EXPR =3D "{ l.values[l.a+1] }">
                            ->
                            -> <MvIF EXPR =3D "{ l.var[l.values[l.a]] LT l.var[l.values[l.a+1]] }" =
                            >
                            -> <MvASSIGN NAME =3D "l.result" INDEX=3D"{l.a}" VALUE =3D "{ =
                            l.values[l.a]
                            -> $'<'$ l.values[l.a+1] }" >
                            -> <MvELSE>
                            -> <MvASSIGN NAME =3D "l.result" INDEX=3D"{l.a}" VALUE =3D "{ =
                            l.values[l.a]
                            -> $'=3D'$ l.values[l.a+1] }" >
                            -> </MvIF>
                            -> <MvASSIGN NAME =3D "l.a" VALUE =3D "{ l.a+1 }" >
                            -> </MvWHILE>
                            ->
                            ->
                            ->
                            <MvEVAL EXPR =3D "{ l.result }" >

                            ->
                            -> Which effectively returns the array indices of the original
                            -> variables (the
                            -> result is the same):
                            -> 2=3D8,8<6,6<3,3<10,10<5,5=3D11,11<1,1=3D7,7<9,9<4
                            ->
                            -> As others said before me, you need to look into the requirements
                            -> (constraints) and cut the number of conditions down first that way.
                            -> Otherwise you end up like me writing 30 lines of fancy code when
                            -> 10 simple
                            -> ones do the trick.
                            ->
                            ->
                            ->
                            -> Markus
                            ->
                            ->
                            ->
                            ->
                            ->
                            ->
                            ->
                            ->
                            ->
                            ->
                            ->
                            -> -----Original Message-----
                            -> From: [email protected]
                            -> [mailto:[email protected]] On Behalf
                            -> Of Signature House
                            -> Sent: Dienstag, 8. M=E4rz 2005 18:57
                            -> To: 'Miva-Users'
                            -> Subject: [meu] OT Programming Conundrum - But where else can I find =
                            such
                            -> excellent help?
                            ->
                            -> I'm building an application where I need to perform an action
                            -> depending on
                            -> the relationships (<,=3D,>) of 4 variables (A,B,C,D).
                            ->
                            -> This gives me 6 comparisons (A::B, A::C, A::D,B::C,B::D,C::D)
                            -> with a total
                            -> of 729 (3 to the 6th power) possible results, ranging from A<B, A<C,
                            -> A<D,B<C,B<D,C<D through A>B, A>C, A>D,B>C,B>D,C>D.
                            ->
                            -> Obviously, many of these 729 results are mathematically impossible =
                            (eg,
                            -> anything containing A=3DB,B=3DC,A>C) and could never occur.
                            ->
                            -> I was able, semi-manually, to eliminate (I hope) all the
                            -> impossibles (654),
                            -> leaving me with only 75 mathematically possible results.
                            ->
                            -> Further examination turned up 50 results that were not possible in =
                            the
                            -> context of the application and 12 that were possible but had no =
                            effect on
                            -> the application, although both groups needed an error trap just in =
                            case.
                            ->
                            -> All told, I ended up with only 13 conditions where I had to program =
                            an
                            -> action - definitely much easier to deal with than the 729 I started =
                            with.
                            ->
                            ->
                            -> Now, my problem - my employer wants to add a fifth variable (E)
                            -> to the mix.
                            -> This will give me 10 comparisons with a possible set of results =
                            numbering
                            -> 59,049 (3 to the 10th power).
                            ->
                            -> Just as I did with the 4 variables I need to eliminate all the
                            -> impossibles,
                            -> but this is wayyyy to0 many for me to reduce using semi-manual
                            -> techniques.
                            ->
                            -> Can anybody give me a link to something on the web that can help
                            -> me? I don't
                            -> even know what it's called to start looking for it. I tried
                            -> "Truth table" in
                            -> Google and got 168,000 hits, but nothing seemed relevant.
                            ->
                            -> Any suggestions?
                            ->
                            -> Thanks
                            ->
                            ->
                            -> Mike McBee
                            -> Signature House
                            -> [email protected]
                            -> www.signaturehouse.net
                            -> 304-842-3386
                            ->
                            ->
                            ->
                            ->

                            Comment


                              #15
                              OT Programming Conundrum - But where else can I find such excellent help?



                              No, no... It's:
                              Give a man fire and he's warm for a day; set a man on fire
                              and he's warm for the rest of his life.

                              /Scott Mc

                              --- Larry Hiscock <[email protected]> wrote:

                              > I thought it was:
                              >
                              > Give a man a fish and he eats for a day.
                              > Teach a man to fish and he sits in a boat and drinks beer
                              > all day.
                              >
                              > ;-)
                              >
                              > Larry Hiscock
                              > AngelicHost
                              >
                              >
                              > -----Original Message-----
                              > From: [email protected]
                              > [mailto:[email protected]] On Behalf
                              > Of Signature House
                              > Sent: Wednesday, March 09, 2005 11:40 AM
                              > To: 'Miva-Users'
                              > Subject: RE: [meu] OT Programming Conundrum - But where
                              > else can I find such
                              > excellent help?
                              >
                              > Markus
                              >
                              > Great! Give a man a fish and eats for a day, but teach
                              > him how to fish and
                              > he eats for life (or something like that).
                              >
                              > Thanks so much for naming this thing for me.
                              >
                              > On the rest, I think I'm going to disagree with you here,
                              > at least at first
                              > glance.
                              >
                              > In my initial statement I said I had 4 variables (ABCD)
                              > to deal with and
                              > that I wanted to compare each to all of the others. I
                              > arrived at a unique
                              > set of 729 potential comparisons by a 2 step use of
                              > combinations and
                              > permutations.
                              >
                              > First step: How many potential comparisons?:
                              > Since A=B is equivalent to B=A, A>B equivalent to B<A,
                              > and A<B equivalent to
                              > B>A, order was not important. Therefore, I'm looking at a
                              > combination, not a
                              > permutation; and since A=A, B=B, ... are also not
                              > important, it's without
                              > replacement. So, I have 6 possible comparisons
                              > (A::B,A::C,A::D,B::C,B::D,C::D). If order was important,
                              > then I'd have been
                              > talking about a permutation, also without replacement and
                              > there would have
                              > been 12 comparisons(A::B,B::A,...).
                              >
                              > Second step: How many potential results?:
                              > Looking at the 6 comparisions that I have
                              > (A::B,A::C,A::D,B::C,B::D,C::D),
                              > you can see that I have 6 holes to fill, each with one of
                              > 3 operators (<, =,
                              > >). Since order does matter, I now have a permutation,
                              > albeit a some what
                              > unusual one since replacement does occur, ie, 3 items
                              > taken 6 at a time. The
                              > solution is 3 to the 6th power, or 729 potential, unique
                              > results.
                              >
                              > Applying the same steps to the 5 variable problem gives
                              > me 10 comparisons
                              > and 59,049 potential, unique results.
                              >
                              > Your list of 54 combinations is missing some items, for
                              > example, <<<<
                              >
                              > Having said that, and remembering that this response is
                              > just after a first
                              > glance, I may very well be all wet. If so, I certainly
                              > want to find it out
                              > now.
                              >
                              > I'll certainly give your response a lot more study,
                              > especially the code - it
                              > really looks interesting.
                              >
                              > Many thanks
                              >
                              >
                              > Mike McBee
                              > Signature House
                              > [email protected]
                              > www.signaturehouse.net
                              > 304-842-3386
                              >
                              > -> -----Original Message-----
                              > -> From: [email protected]
                              > [mailto:[email protected]]On
                              > -> Behalf Of MvMarkus
                              > -> Sent: Tuesday, March 08, 2005 09:20 PM
                              > -> To: 'Signature House'; 'Miva-Users'
                              > -> Subject: RE: [meu] OT Programming Conundrum - But
                              > where else can I find
                              > -> such excellent help?
                              > ->
                              > ->
                              > -> Hi Mike
                              > ->
                              > -> That is called Logic or constraints programming and
                              > more specifically a
                              > -> search. Languages like Prolog and Mozart and a few
                              > others are
                              > -> designed for
                              > -> that, if you are interested in this you may want to
                              > take a look at the
                              > -> mozart tutorial to see how they handle that:
                              > -> <A HREF ="http://www.mozart-oz.org/documentation/fdt/index.html">http://www.mozart-oz.org/documentation/fdt/index.html</A>
                              > or
                              > -> <A HREF =/"http://www.mozart-oz.org/papers//">http://www.mozart-oz.org/papers/</A>.
                              > ->
                              > -> The way is to first reduce logically or mathematically
                              > the number of
                              > -> possible combinations and then get the rest, if
                              > necessary through brute
                              > -> force.
                              > ->
                              > -> I'm afraid however this won't give you a quick
                              > answer....
                              > ->
                              > -> With 5 variables, you actually don't have that many
                              > possibilities at all.
                              > -> The mistake is to think of x power y, because in fact
                              > your
                              > -> choices are much
                              > -> more limited because a>b is the same as b<a and if a=b
                              > and c=d
                              > -> then is a=b=c
                              > ->
                              > ->
                              > ->
                              > ->
                              > -> A=C B=C ---> A,B=C
                              > -> A<C B<C ---> A,B<C
                              > -> A>C B>C ---> A,B>C
                              > -> A=D B=D C=D ---> A,B,C=D
                              > -> Etc.
                              > ->
                              > -> So if you forget for a moment the variables, but
                              > instead you look at the
                              > -> operators, you get
                              > ->
                              > -> A=B=C=D=E ---> ====
                              > -> A<B=C=D=E ---> <===
                              > -> A>B=C=D=E ---> >===
                              > -> A=B<C=D=E ---> =<==
                              > -> A=B>C=D=E ---> =>==
                              > -> A=B=C<D=E ---> ==<=
                              > -> ... Etc.
                              > ->
                              > -> In form of a matrix, that looks like this:
                              > ->
                              > -> 1 2 3 4
                              > -> 1 = = = =
                              > -> 2 < = = =
                              > -> 3 > = = =
                              > -> 4 = < = =
                              > -> 5 < < = =
                              > -> 6 > < = =
                              > -> 7 = > < =
                              > -> 8 < > < =
                              > -> 9 > > < =
                              > -> 10 = = < =
                              > -> 11 < = < =
                              > -> 12 > = < =
                              > -> 13 = < > =
                              > -> 14 < < > =
                              > -> 15 > < > =
                              > -> 16 = > > =
                              > -> 17 < > > =
                              > -> 18 > > > =
                              > -> 19 = = = <
                              > -> 20 < = = <
                              > -> 21 > = = <
                              > -> 22 = < = <
                              > -> 23 < < = <
                              > -> 24 > < = <
                              > -> 25 = > < <
                              > -> 26 < > < <
                              > -> 27 > > < <
                              > -> 28 = = < <
                              > -> 29 < = < <
                              > -> 30 > = < <
                              > -> 31 = < > <
                              > -> 32 < < > <
                              > -> 33 > < > <
                              > -> 34 = > > <
                              > -> 35 < > > <
                              > -> 36 > > > <
                              > -> 37 = = = >
                              > -> 38 < = = >
                              > -> 39 > = = >
                              > -> 40 = < = >
                              >
                              === message truncated ===


                              __________________________________________________
                              Do You Yahoo!?
                              Tired of spam? Yahoo! Mail has the best spam protection around
                              http://mail.yahoo.com

                              Comment

                              Working...
                              X