Re: LC Server - Check for Screen size?

2021-03-21 Thread matthias rebbe via use-livecode
Hi Rick,
here's a sample with some put commands and comments for better understanding.
"
-- the cookie does not exists or is empty, so we now executing JS, but 
-- the following closing tag is mandatory, otherwise the js is not executed
?>   

let screenwidth = (screen.availWidth);
let screenheight =(screen.availHeight);
document.cookie = "screenres="+screenwidth +","+screenheight;

"
else
put "Cookie already there"
end if

--now we extract height and width from the var tScreenRes
set the itemdelimiter to ","
put item 1 of tScreenRes to tWidth
put item 2 of tScreenRes to tHeight

--from here take action according the detected screenresolution.
?>


Note: The above script detects and uses the available screen resolution. 
Regards,


-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 21.03.2021 um 01:02 schrieb Rick Harrison via use-livecode 
> :
> 
> Hi Matthias,
> 
> So you are thinking something like:
> 
> 
> 
> 
> 
> Your Screen:
> 
> 
> 
> 
> var txt = "";
> txt += "

Total width/height: " + screen.width + "*" + screen.height + > "

"; > txt += "

Available width/height: " + screen.availWidth + "*" + > screen.availHeight + "

"; > txt += "

Color depth: " + screen.colorDepth + "

"; > txt += "

Color resolution: " + screen.pixelDepth + "

"; > > document.getElementById("demo").innerHTML = txt; > > > > > > And then put the information into a Javascript cookie and then read the > cookie value with an LC Server script. > > I’ll see if I can get that to work. > > Thanks! > > Rick > >> On Mar 20, 2021, at 6:10 PM, matthias rebbe via use-livecode >> wrote: >> >> As Livecode Server runs on the server there is no direct command/function >> in LC Server available for this task. >> >> But you could use Javascript (document.cookie) in your LC Server script to >> write the screen resolution into a cookie and read that cookie then with >> your Livecode Server script. >> >> >> - >> Matthias Rebbe >> Life Is Too Short For Boring Code > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LC Server - Check for Screen size?

2021-03-21 Thread Rick Harrison via use-livecode
Hi Matthias,

Thanks!

Rick

> On Mar 21, 2021, at 7:51 AM, matthias rebbe via use-livecode 
>  wrote:
> 
> Hi Rick,
> here's a sample with some put commands and comments for better understanding.
>  -- read Cookie screeres if available
> put $_COOKIE["screenres"] into tScreenRes
> 
> if tScreenRes is empty
> then
>   put "cookie not found. we need to write the cookie"
> -- the cookie does not exists or is empty, so we now executing JS, but 
> -- the following closing tag is mandatory, otherwise the js is not executed
> ?>   
> 
>   let screenwidth = (screen.availWidth);
>   let screenheight =(screen.availHeight);
>   document.cookie = "screenres="+screenwidth +","+screenheight;
> 
>put "cookie written"
> else
>   put "Cookie already there"
> end if
> 
> --now we extract height and width from the var tScreenRes
> set the itemdelimiter to ","
> put item 1 of tScreenRes to tWidth
> put item 2 of tScreenRes to tHeight
> 
> --from here take action according the detected screenresolution.
> ?>
> 
> 
> Note: The above script detects and uses the available screen resolution. 
> Regards,
> 
> 
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: numberformat question

2021-03-21 Thread Sean Cole (Pi) via use-livecode
Livecode can handle floating point numbers up to 2^52. But then
calculations would have to fit within that range in a floating point
perspective too. So, once you add that ninth zero to the end of your
divider, it struggles with the calculation and returns, effectively, number
out of range.

Fractions in FP binary are tremendously complicated. Calculation in it are
even more so.

https://www.h-schmidt.net/FloatConverter/IEEE754.html


On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I don't have an answer, other than to say there has been a LOT of
> discussion over the years about the limits of number precision in
> LiveCode and a number of enhancement requests and 3rd party libraries
> that have attempted to provide a framework for high precision math. You
> might search the list archives or search the forum on the LC web site
> for past discussions about number precision.
>
> On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
> > Hi list,
> > I am a bit lost :
> >
> >set numberformat to ".#"
> >put -0.007347880794884118999 / 1000
> > -- returns -0.07347880794884119  which is ok
> >
> >put -0.007347880794884118999 / 100
> > -- returns -0.7347880794884 -> also ok
> >
> >put -0.007347880794884118999 / 1
> > -- returns -0.0073478807949 -> still ok
> >
> >put -0.007347880794884118999 / 10
> > -- returns 0 -> ?
> >
> > Any explanations ?
> > Thanks in advance.
> > Best,
> > jbv
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
-- 
Pi Digital
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: numberformat question

2021-03-21 Thread jbv via use-livecode

Paul, Sean,

Thank you both for your answers, although it doesn't really solve my 
problem.
The most surprising thing is that javascript runs these calculations 
without

problem :
(-0.007347880794884118999 / 10) returns 
-7.347880794884119e-16
(-0.007347880794884118999 / 1) returns 
-7.347880794884119e-19


Best


Le 2021-03-21 07:11, Sean Cole (Pi) via use-livecode a écrit :

Livecode can handle floating point numbers up to 2^52. But then
calculations would have to fit within that range in a floating point
perspective too. So, once you add that ninth zero to the end of your
divider, it struggles with the calculation and returns, effectively, 
number

out of range.

Fractions in FP binary are tremendously complicated. Calculation in it 
are

even more so.

https://www.h-schmidt.net/FloatConverter/IEEE754.html


On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:


I don't have an answer, other than to say there has been a LOT of
discussion over the years about the limits of number precision in
LiveCode and a number of enhancement requests and 3rd party libraries
that have attempted to provide a framework for high precision math. 
You

might search the list archives or search the forum on the LC web site
for past discussions about number precision.

On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
> Hi list,
> I am a bit lost :
>
>set numberformat to ".#"
>put -0.007347880794884118999 / 1000
> -- returns -0.07347880794884119  which is ok
>
>put -0.007347880794884118999 / 100
> -- returns -0.7347880794884 -> also ok
>
>put -0.007347880794884118999 / 1
> -- returns -0.0073478807949 -> still ok
>
>put -0.007347880794884118999 / 10
> -- returns 0 -> ?
>
> Any explanations ?
> Thanks in advance.
> Best,
> jbv
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


About the project - Team-xapi-in-LiveCode

2021-03-21 Thread Brian K. Duck via use-livecode
Tom, 

Sorry for the delayed response.

We’ve launched this project in support of the Spring 2021 xAPI Cohort, details 
on this free 12-week educational activity focused on the Experience API are 
available at xAPICohort.com, and it’s not too late to signup for the free 
learning sessions which allows access to our GitHub for project updates and the 
code repository.

The short answer is: there is more information in GitHub on our discussions 
page. 

https://github.com/orgs/xapicohort/teams/team-xapi-in-livecode/discussions

However - As the team site on GitHub is part of the xAPI Cohort, new members 
wanting to participate (or just to view the code) must sign up for the xAPI 
Cohort to gain access to the GitHub and Slack, where you can request access to 
the GitHub for team-xapi-in-LiveCode. (Sorry this is so convoluted, were just 
seeing this limitation as we invite members of the use-LiveCode list to join 
the team GitHub.)

Our team page says:

team-xapi-in-livecode
@xapicohort/team-xapi-in-livecode
We’re working with LiveCode developers to bring them into the cohort and will 
be working actively as a team during Spring 2021 Cohort to bring a LiveCode LRP 
to life. 

Initial Goals for #Team-xAPI-in-LiveCode 
1. Build a Learning Record Provider (LRP) for use as a baseline in other 
LiveCode Projects and publish to GitHub 
2. Utilize the LiveCode LRP to build example training content: likely using 
video profile, CMI5 or others.

There are weekly updates posted on the discussions page, and currently 4 
different LiveCode projects posted in the code / GitHub repository page that 
document the LiveCode projects that have been posted.

Sent from my iPad,
Brian
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode