A code style question

classic Classic list List threaded Threaded
40 messages Options
12
Reply | Threaded
Open this post in threaded view
|

A code style question

Geoff Canyon-4
I think these two functions are equivalent. Which would you use? (or would
you use a different function altogether?)

function baseID newID
   if newID is empty then
      if not exists (the baseID of this stack) then
         set the baseID of this stack to "this card"
      end if
   else
      if exists newID then
         set the baseID of this stack to newID
      else
         set the baseID of this stack to "this card"
      end if
   end if
   return the baseID of this stack
end baseID

function baseID newID
   if (newID is not empty and not exists newID) or \
         (newID is empty and not exists (the baseID of this stack)) then \
         set the baseID of this stack to "this card"
   if newID is not empty then set the baseID of this stack to newID
   return the baseID of this stack
end baseID
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Geoff Canyon-4
It would be good to post code that works:

function baseID newID
   if (newID is not empty and not exists(newID)) or \
         (newID is empty and not exists(the baseID of this stack)) then \
         set the baseID of this stack to "this card"
   if newID is not empty then set the baseID of this stack to newID
   return the baseID of this stack
end baseID
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Peter Haworth
I'd go with the first one. The second one makes my eyes glaze over! Plus I
think there should be an else before the second if in the second function.

I might consider something like this.

function baseID newID
   if newID is empty then
      baseID_newIDempty
   else
      baseID_newIDnotempty
   end if
   Return the baseID of this stack
end baseID

The two subsidiary handlers would have the logic from your first function
for empty/not empty.

Pete
lcSQL Software
It would be good to post code that works:

function baseID newID
   if (newID is not empty and not exists(newID)) or \
         (newID is empty and not exists(the baseID of this stack)) then \
         set the baseID of this stack to "this card"
   if newID is not empty then set the baseID of this stack to newID
   return the baseID of this stack
end baseID
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Peter Haworth
A slightly corrected/modified version.

To set the baseID:

set the baseID of this stack to baseID(newID)

To get the baseID

get the baseID of this stack.

The function(s) then become

function baseID newID
   if newID is empty then
      return baseID_newIDempty()
   else
      return baseID_newIDnotempty(newID)
   end if
end baseID

function baseID_newIDempty

   if not exists (the baseID of this stack) then
         return "this card"
   else
      return the baseID of this stack
   end if

end baseID_newIDempty

function baseID_newIDNotEmpty newid

   if exists newID then
     return newID
   else
      return "this card"
   end if

end baseID_newIDNotEmpty


Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Tue, Jan 20, 2015 at 8:45 AM, Peter Haworth <[hidden email]> wrote:

> I'd go with the first one. The second one makes my eyes glaze over! Plus I
> think there should be an else before the second if in the second function.
>
> I might consider something like this.
>
> function baseID newID
>    if newID is empty then
>       baseID_newIDempty
>    else
>       baseID_newIDnotempty
>    end if
>    Return the baseID of this stack
> end baseID
>
> The two subsidiary handlers would have the logic from your first function
> for empty/not empty.
>
> Pete
> lcSQL Software
> It would be good to post code that works:
>
> function baseID newID
>    if (newID is not empty and not exists(newID)) or \
>          (newID is empty and not exists(the baseID of this stack)) then \
>          set the baseID of this stack to "this card"
>    if newID is not empty then set the baseID of this stack to newID
>    return the baseID of this stack
> end baseID
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Richard Gaskin
The first is slightly faster, but they don't return the same result -
running the code below I always get:

6 8 false
this card 1000

Did I mess up the test somewhere?


on mouseUp
    put 1000 into tIterations
    --
    set the baseID of this stack to empty
    put the millisecs into t
    repeat tIterations
       put baseID1(1000) into r1
    end repeat
    put the millisecs - t into t1
    --
    set the baseID of this stack to empty
    put the millisecs into t
    repeat tIterations
       put baseID2(1000) into r2
    end repeat
    put the millisecs - t into t2
    --
    put t1 && t2 && (r1=r2) &cr& r1 && r2
end mouseUp

function baseID1 newID
    if newID is empty then
       if not exists(the baseID of this stack) then
          set the baseID of this stack to "this card"
       end if
    else
       if exists( newID) then
          set the baseID of this stack to newID
       else
          set the baseID of this stack to "this card"
       end if
    end if
    return the baseID of this stack
end baseID1

function baseID2 newID
    if (newID is not empty and not exists(newID)) or \
          (newID is empty and not exists(the baseID of this stack)) then\
          set the baseID of this stack to "this card"
    if newID is not empty then set the baseID of this stack to newID
    return the baseID of this stack
end baseID2


--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Geoff Canyon-4
In reply to this post by Geoff Canyon-4
okay, I think this is correct for both versions (gah)

function baseID newID
   if newID is empty then
      if not exists (the baseID of this stack) then
         set the baseID of this stack to "this card"
      end if
   else
      if exists(newID) or \
            newID is among the items of "this card,card list,background
list,stack list" then
         set the baseID of this stack to newID
      else
         set the baseID of this stack to "this card"
      end if
   end if
   return the baseID of this stack
end baseID


function baseID newID
   if (newID is not empty and not exists(newID)) or \
         (newID is empty and not exists(the baseID of this stack)) then \
         set the baseID of this stack to "this card"
   if exists(newID) or \
         newID is among the items of "this card,card list,background
list,stack list" then \
         set the baseID of this stack to newID
   return the baseID of this stack
end baseID
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

A Got-Ya

Ralph DiMola
I just spent an 1.5 hours of "what the heck just happened". My fault but
just wanted to let others know.

I have a custom stack prop named "pRegion". This worked as expected except
in one handler. It always returned empty. From either the handler or from
the message box while the handler was being debugged or from an answer
dialog. Click the stop button in the debugger, then from the message box the
custom property is the value the inspector says. Breakpoint on the first
line of the mouseup handler and it's gone. Deleted all the code in the
handler and it's back even though I examined it before any code was run from
the debugger both times.
Problem: I had a local of the same name by mistake. I was not even using it.
I just deleted it and all was OK. This might be obvious to the more seasoned
LiveCoder but to a beginner... not so much

Just an FYI

Ralph DiMola
IT Director
Evergreen Information Services
[hidden email]



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Richard Gaskin
In reply to this post by Geoff Canyon-4
Thanks for the fix.  Once I took care of the email line wrap it ran
well.  The first version is still slightly faster, and to my eye more
readable, so I'd go with that.



on mouseUp
    put 1000 into tIterations
    --
    set the baseID of this stack to empty
    put the millisecs into t
    repeat tIterations
       put baseID1(1000) into r1
    end repeat
    put the millisecs - t into t1
    --
    set the baseID of this stack to empty
    put the millisecs into t
    repeat tIterations
       put baseID2(1000) into r2
    end repeat
    put the millisecs - t into t2
    --
    put t1 && t2 && (r1=r2) &cr& r1 && r2
end mouseUp

function baseID1 newID
    if newID is empty then
       if not exists (the baseID of this stack) then
          set the baseID of this stack to "this card"
       end if
    else
       if exists(newID) or \
             newID is among the items of "this card,card list,background
list,stack list" then
          set the baseID of this stack to newID
       else
          set the baseID of this stack to "this card"
       end if
    end if
    return the baseID of this stack
end baseID1


function baseID2 newID
    if (newID is not empty and not exists(newID)) or \
          (newID is empty and not exists(the baseID of this stack)) then \
          set the baseID of this stack to "this card"
    if exists(newID) or \
          newID is among the items of "this card,card list,background
list,stack list" then \
          set the baseID of this stack to newID
    return the baseID of this stack
end baseID2

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A Got-Ya

Mike Kerner
In reply to this post by Ralph DiMola
ugh.  That's an ugly.  I'd file a feature request to have the
parser/compiler catch those for you.  I am a big proponent of loose syntax,
but if it's going to be loose enough that you can do THAT, then you either
should get an error for misusing the token or it should be smart enough to
not fail.

On Tue, Jan 20, 2015 at 1:13 PM, Ralph DiMola <[hidden email]>
wrote:

> I just spent an 1.5 hours of "what the heck just happened". My fault but
> just wanted to let others know.
>
> I have a custom stack prop named "pRegion". This worked as expected except
> in one handler. It always returned empty. From either the handler or from
> the message box while the handler was being debugged or from an answer
> dialog. Click the stop button in the debugger, then from the message box
> the
> custom property is the value the inspector says. Breakpoint on the first
> line of the mouseup handler and it's gone. Deleted all the code in the
> handler and it's back even though I examined it before any code was run
> from
> the debugger both times.
> Problem: I had a local of the same name by mistake. I was not even using
> it.
> I just deleted it and all was OK. This might be obvious to the more
> seasoned
> LiveCoder but to a beginner... not so much
>
> Just an FYI
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> [hidden email]
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A Got-Ya

Peter Haworth
Confirmed here.  Although unlikely to happen, that's a bad bug. The
presence of "the" and "of <objectreference>" should make it clear that a
custom property is being referenced, not a variable.

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Tue, Jan 20, 2015 at 11:17 AM, Mike Kerner <[hidden email]>
wrote:

> ugh.  That's an ugly.  I'd file a feature request to have the
> parser/compiler catch those for you.  I am a big proponent of loose syntax,
> but if it's going to be loose enough that you can do THAT, then you either
> should get an error for misusing the token or it should be smart enough to
> not fail.
>
> On Tue, Jan 20, 2015 at 1:13 PM, Ralph DiMola <[hidden email]>
> wrote:
>
> > I just spent an 1.5 hours of "what the heck just happened". My fault but
> > just wanted to let others know.
> >
> > I have a custom stack prop named "pRegion". This worked as expected
> except
> > in one handler. It always returned empty. From either the handler or from
> > the message box while the handler was being debugged or from an answer
> > dialog. Click the stop button in the debugger, then from the message box
> > the
> > custom property is the value the inspector says. Breakpoint on the first
> > line of the mouseup handler and it's gone. Deleted all the code in the
> > handler and it's back even though I examined it before any code was run
> > from
> > the debugger both times.
> > Problem: I had a local of the same name by mistake. I was not even using
> > it.
> > I just deleted it and all was OK. This might be obvious to the more
> > seasoned
> > LiveCoder but to a beginner... not so much
> >
> > Just an FYI
> >
> > Ralph DiMola
> > IT Director
> > Evergreen Information Services
> > [hidden email]
> >
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>    and did a little diving.
> And God said, "This is good."
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A Got-Ya

Dr. Hawkins
On Tue, Jan 20, 2015 at 11:44 AM, Peter Haworth <[hidden email]> wrote:

> Confirmed here.  Although unlikely to happen, that's a bad bug. The
> presence of "the" and "of <objectreference>" should make it clear that a
> custom property is being referenced, not a variable.
>

But it's nastier than that:  you can't can't quote the custom property to
get around this, either . . .


--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A Got-Ya

Dave Kilroy
In reply to this post by Ralph DiMola
For those who haven't read it yet I'll leave this link to Richard's excellent article here...
http://www.fourthworld.com/embassy/articles/scriptstyle.html
"The first 90% of the task takes 90% of the time, and the last 10% takes the other 90% of the time."
Peter M. Brigham
Reply | Threaded
Open this post in threaded view
|

Livecode server + NGINX ?

Pierre Sahores-2
Hi Friends,

Did anyone know if Livecode Server can be set to use NGINX as its web server ?

Thanks and best regards,
--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Livecode server + NGINX ?

Richard Gaskin
Pierre Sahores wrote:
> Did anyone know if Livecode Server can be set to use NGINX as its web server ?

My (admittedly limited) understanding is that NginX doesn't support CGI,
only FastCGI, so without threading LiveCode would seem a difficult fit
for that server environment.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Geoff Canyon-4
In reply to this post by Richard Gaskin
I figured the first version would be faster, since it only checks each
thing once, where the second version tests some booleans twice, but this
isn't going to be called repeatedly, so maximum performance isn't an issue.

I was more curious about the readability, because I thought I might be the
odd one out here, and it seems I am. The nested if statements in the first
one, and the duplicated

    set the baseID of this stack to "this card"

offend my eye.

Once I realized I needed to test for "exists" OR "is among" more than once
I used a separate function for those. Along with an inline "if" function I
already had, and switching from a stack property to a local, I came up with:

local baseID

function baseID newID
   put iff(validID(newID),newID, \
         iff(validID(baseID), baseID,"this card")) into baseID
   return baseID
end baseID3

function iff X,T,F
   if X then return T else return F
end iff

function validID I
   return ((I is among the items of "this card,card list,background
list,stack list") or exists(I))
end validID

Maybe not everyone's cup of tea, but clear to me.



On Tue, Jan 20, 2015 at 1:14 PM, Richard Gaskin <[hidden email]>
wrote:

> Thanks for the fix.  Once I took care of the email line wrap it ran well.
> The first version is still slightly faster, and to my eye more readable, so
> I'd go with that.
>
>
>
> on mouseUp
>    put 1000 into tIterations
>    --
>    set the baseID of this stack to empty
>    put the millisecs into t
>    repeat tIterations
>       put baseID1(1000) into r1
>    end repeat
>    put the millisecs - t into t1
>    --
>    set the baseID of this stack to empty
>    put the millisecs into t
>    repeat tIterations
>       put baseID2(1000) into r2
>    end repeat
>    put the millisecs - t into t2
>    --
>    put t1 && t2 && (r1=r2) &cr& r1 && r2
> end mouseUp
>
> function baseID1 newID
>    if newID is empty then
>       if not exists (the baseID of this stack) then
>          set the baseID of this stack to "this card"
>       end if
>    else
>       if exists(newID) or \
>             newID is among the items of "this card,card list,background
> list,stack list" then
>          set the baseID of this stack to newID
>       else
>          set the baseID of this stack to "this card"
>       end if
>    end if
>    return the baseID of this stack
> end baseID1
>
>
> function baseID2 newID
>    if (newID is not empty and not exists(newID)) or \
>          (newID is empty and not exists(the baseID of this stack)) then \
>          set the baseID of this stack to "this card"
>    if exists(newID) or \
>          newID is among the items of "this card,card list,background
> list,stack list" then \
>          set the baseID of this stack to newID
>    return the baseID of this stack
> end baseID2
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  ____________________________________________________________________
>  [hidden email]                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

J. Landman Gay
On 1/20/2015 7:33 PM, Geoff Canyon wrote:
> I was more curious about the readability, because I thought I might be the
> odd one out here, and it seems I am. The nested if statements in the first
> one, and the duplicated
>
>      set the baseID of this stack to "this card"
>
> offend my eye.

There's two of us then. I tend toward combining as many statements as
possible too. But if a handler gets too snarly to grasp quickly, I pull
it back apart. Yours was pretty snarly. :)

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A Got-Ya

Geoff Canyon-4
In reply to this post by Mike Kerner
Two things to consider:

1. It's almost impossible to catch conflicts with custom properties. They
don't have to be mentioned by name in a script because:
2. It's a feature that custom property names can be stored/referenced using
variables. For example:

   repeat for each item P in "left,top"
      -- not custom properties, but the same principle applies
        set the P of button "example" to 10 * trunc(the P of button
"example" / 10)
   end repeat

If you have a large number of custom properties to initialize, this allows
you to do something like:

   put "cProp1,23 cProp2,18 cProp3,98" into P
   split P using space and comma
   repeat for each key K in P
      set the K of button "example" to P[K]
   end repeat

In neither of these cases would it be easily detectible to the compiler
what (custom) properties are being referenced, and these cases aren't close
to pathological. On the other hand, simply disallowing the use of a
variable to store/reference a (custom) property would be a significant loss
of functionality.

On Tue, Jan 20, 2015 at 2:17 PM, Mike Kerner <[hidden email]>
wrote:

> ugh.  That's an ugly.  I'd file a feature request to have the
> parser/compiler catch those for you.  I am a big proponent of loose syntax,
> but if it's going to be loose enough that you can do THAT, then you either
> should get an error for misusing the token or it should be smart enough to
> not fail.
>
> On Tue, Jan 20, 2015 at 1:13 PM, Ralph DiMola <[hidden email]>
> wrote:
>
> > I just spent an 1.5 hours of "what the heck just happened". My fault but
> > just wanted to let others know.
> >
> > I have a custom stack prop named "pRegion". This worked as expected
> except
> > in one handler. It always returned empty. From either the handler or from
> > the message box while the handler was being debugged or from an answer
> > dialog. Click the stop button in the debugger, then from the message box
> > the
> > custom property is the value the inspector says. Breakpoint on the first
> > line of the mouseup handler and it's gone. Deleted all the code in the
> > handler and it's back even though I examined it before any code was run
> > from
> > the debugger both times.
> > Problem: I had a local of the same name by mistake. I was not even using
> > it.
> > I just deleted it and all was OK. This might be obvious to the more
> > seasoned
> > LiveCoder but to a beginner... not so much
> >
> > Just an FYI
> >
> > Ralph DiMola
> > IT Director
> > Evergreen Information Services
> > [hidden email]
> >
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>    and did a little diving.
> And God said, "This is good."
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Livecode server + NGINX ?

Peter W A Wood
In reply to this post by Richard Gaskin
Pierre

Richard is correct that nginx does not support CGI. It will forward requests to an upstream server or a number of upstream servers. I support one application that has been running for a couple of years that forwards CGI requests to a second server. (The second server is Cheyenne from Softinnov with which you may be familiar).

I have also used nginx to distribute requests to a number of upstream servers when the upstream server could only process  one request at a time. In my case, I spread the load over four servers. This load balancing feature of nginx use a simple approach in the free version, I believe the “not free” version has more sophisticated load balancing.

Regards

Peter

> On 21 Jan 2015, at 08:09, Richard Gaskin <[hidden email]> wrote:
>
> Pierre Sahores wrote:
>> Did anyone know if Livecode Server can be set to use NGINX as its web server ?
>
> My (admittedly limited) understanding is that NginX doesn't support CGI, only FastCGI, so without threading LiveCode would seem a difficult fit for that server environment.
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> [hidden email]                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Livecode server + NGINX ?

Pierre Sahores-2
Thanks Richard and Peter. Cheyenne, the Rebol HTTPd (Carl Sassenrath and Cindy !) and Olivier Auverlot, a friend i used to be colleague with when i was working for the French Secretary of Education…

Warm Regards,

Pierre

Le 21 janv. 2015 à 03:14, Peter W A Wood <[hidden email]> a écrit :

> Pierre
>
> Richard is correct that nginx does not support CGI. It will forward requests to an upstream server or a number of upstream servers. I support one application that has been running for a couple of years that forwards CGI requests to a second server. (The second server is Cheyenne from Softinnov with which you may be familiar).
>
> I have also used nginx to distribute requests to a number of upstream servers when the upstream server could only process  one request at a time. In my case, I spread the load over four servers. This load balancing feature of nginx use a simple approach in the free version, I believe the “not free” version has more sophisticated load balancing.
>
> Regards
>
> Peter
>
>> On 21 Jan 2015, at 08:09, Richard Gaskin <[hidden email]> wrote:
>>
>> Pierre Sahores wrote:
>>> Did anyone know if Livecode Server can be set to use NGINX as its web server ?
>>
>> My (admittedly limited) understanding is that NginX doesn't support CGI, only FastCGI, so without threading LiveCode would seem a difficult fit for that server environment.
>>
>> --
>> Richard Gaskin
>> Fourth World Systems
>> Software Design and Development for the Desktop, Mobile, and the Web
>> ____________________________________________________________________
>> [hidden email]                http://www.FourthWorld.com
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: A code style question

Ben Rubinstein
In reply to this post by J. Landman Gay
On 21/01/2015 01:58, J. Landman Gay wrote:
> On 1/20/2015 7:33 PM, Geoff Canyon wrote:
>> The nested if statements in the first
>> one, and the duplicated
>>
>>      set the baseID of this stack to "this card"
>>
>> offend my eye.
>
> There's two of us then.

Me three.

Also I was glad to see you also have a reflex of defining

> function iff X,T,F
>    if X then return T else return F
> end iff

(I usually name my version "ifthenelse" - I like the conciseness of yours, but
I studied logic some decades ago, so for me "iff" is already a word, and it
means something different - if and only if.)

I don't we think should be proposing fundamental additions to the language
very often, but this is such a useful one that I think it should be considered.

What do you think?

Ben


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12