Decimal Maths

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

Decimal Maths

Simon Forster
Aaaaaaaaargggghhhhh.

I'm getting floating point math errors - which should NOT be  
happening - at least not if I could get Lasso to work to some  
sensible level of precision.

(decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
'adjustment_PRODUCTFINISH')) * ( 1 + (((decimal: (field:  
'vatRate_PRODUCT')) / 100.00));

Keeps on evaluating to 3 decimal points of precision (and I've tried  
adding 1.000000 to the front of all this to force greater precision -  
to no avail). This is with respective field values of:

228.94, 0, 17.5

The problem with this is that I get floating point errors - which  
become significant because of the level of precision being applied to  
the math. If I can get the errors small enough, they become  
insignificant.

As you may be able to tell, this is starting to do my head in.

Any pointers please kind people?

TIA

Simon Forster
_______________________________________________________
  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
  Tel: +44 (0)20 8133 0528   Fax: +44 (0)70 9230 5247
_______________________________________________________



------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Decimal Maths

Adam Randall-4
Lasso will read any level of precision, but till output whatever it  
determines is a good precision at the end. You can override the  
default output precision by doing:

[decimal->setformat(-precision = 2) &]

In your example, this would be:

[((decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
'adjustment_PRODUCTFINISH')) * ( 1.00 + (((decimal: (field:  
'vatRate_PRODUCT')) / 100.00)))->(setformat: -precision = 2) &]

If you wanted a precision of 6 places, you'd do:

[((decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
'adjustment_PRODUCTFINISH')) * ( 1.00 + (((decimal: (field:  
'vatRate_PRODUCT')) / 100.00)))->(setformat: -precision = 6) &]

Adam.


On Aug 14, 2006, at 3:54 PM, Simon Forster wrote:

> Aaaaaaaaargggghhhhh.
>
> I'm getting floating point math errors - which should NOT be  
> happening - at least not if I could get Lasso to work to some  
> sensible level of precision.
>
> (decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
> 'adjustment_PRODUCTFINISH')) * ( 1 + (((decimal: (field:  
> 'vatRate_PRODUCT')) / 100.00));
>
> Keeps on evaluating to 3 decimal points of precision (and I've  
> tried adding 1.000000 to the front of all this to force greater  
> precision - to no avail). This is with respective field values of:
>
> 228.94, 0, 17.5
>
> The problem with this is that I get floating point errors - which  
> become significant because of the level of precision being applied  
> to the math. If I can get the errors small enough, they become  
> insignificant.
>
> As you may be able to tell, this is starting to do my head in.
>
> Any pointers please kind people?
>
> TIA
>
> Simon Forster
> _______________________________________________________
>  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
>  Tel: +44 (0)20 8133 0528   Fax: +44 (0)70 9230 5247
> _______________________________________________________
>
>
>
> ------------------------------
> LASSO MASTER CLASS - Orlando, FL
> Following the FileMaker Developer Conference
> 2 Day intensive seminar: Learn the best way to get your FileMaker  
> data on the web.
> http://www.briandunning.com/lasso-training/
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage



--
Adam Randall <[hidden email]>
Senior Web Architect
Stork Avenue, Inc.
http://www.storkavenue.com
(800) 861-5437 x137




------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Decimal Maths

Adam Randall-4
Also, if you are getting precision errors, you may need to verify  
that your data is correct. If the data is coming out of MySQL, you  
may need to change your column type to DECIMAL versus FLOAT as your  
precision can get off at a certain level. A DECIMAL numeric type is  
stored in more character oriented form to preserve the precision.  
It's larger than FLOAT, but better at holding the value correct.

Computers are weird with decimal precision. It's kind of a "close  
enough" type thing. Lasso's decimal accuracy is completely dependent  
on the machine it's running on and the OS. Fun stuff :)

Adam.


On Aug 14, 2006, at 4:38 PM, Adam Randall wrote:

> Lasso will read any level of precision, but till output whatever it  
> determines is a good precision at the end. You can override the  
> default output precision by doing:
>
> [decimal->setformat(-precision = 2) &]
>
> In your example, this would be:
>
> [((decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
> 'adjustment_PRODUCTFINISH')) * ( 1.00 + (((decimal: (field:  
> 'vatRate_PRODUCT')) / 100.00)))->(setformat: -precision = 2) &]
>
> If you wanted a precision of 6 places, you'd do:
>
> [((decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
> 'adjustment_PRODUCTFINISH')) * ( 1.00 + (((decimal: (field:  
> 'vatRate_PRODUCT')) / 100.00)))->(setformat: -precision = 6) &]
>
> Adam.
>
>
> On Aug 14, 2006, at 3:54 PM, Simon Forster wrote:
>
>> Aaaaaaaaargggghhhhh.
>>
>> I'm getting floating point math errors - which should NOT be  
>> happening - at least not if I could get Lasso to work to some  
>> sensible level of precision.
>>
>> (decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
>> 'adjustment_PRODUCTFINISH')) * ( 1 + (((decimal: (field:  
>> 'vatRate_PRODUCT')) / 100.00));
>>
>> Keeps on evaluating to 3 decimal points of precision (and I've  
>> tried adding 1.000000 to the front of all this to force greater  
>> precision - to no avail). This is with respective field values of:
>>
>> 228.94, 0, 17.5
>>
>> The problem with this is that I get floating point errors - which  
>> become significant because of the level of precision being applied  
>> to the math. If I can get the errors small enough, they become  
>> insignificant.
>>
>> As you may be able to tell, this is starting to do my head in.
>>
>> Any pointers please kind people?
>>
>> TIA
>>
>> Simon Forster
>> _______________________________________________________
>>  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
>>  Tel: +44 (0)20 8133 0528   Fax: +44 (0)70 9230 5247
>> _______________________________________________________
>>
>>
>>
>> ------------------------------
>> LASSO MASTER CLASS - Orlando, FL
>> Following the FileMaker Developer Conference
>> 2 Day intensive seminar: Learn the best way to get your FileMaker  
>> data on the web.
>> http://www.briandunning.com/lasso-training/
>>
>>
>> ------------------------------
>> Lasso Support: http://support.omnipilot.com/
>> Search the list archives: http://www.listsearch.com/lassotalk.lasso
>> Manage your list subscription: http://www.listsearch.com/ 
>> lassotalk.lasso?manage
>
>
>
> --
> Adam Randall <[hidden email]>
> Senior Web Architect
> Stork Avenue, Inc.
> http://www.storkavenue.com
> (800) 861-5437 x137
>
>
>
>
> ------------------------------
> LASSO MASTER CLASS - Orlando, FL
> Following the FileMaker Developer Conference
> 2 Day intensive seminar: Learn the best way to get your FileMaker  
> data on the web.
> http://www.briandunning.com/lasso-training/
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage



--
Adam Randall <[hidden email]>
Senior Web Architect
Stork Avenue, Inc.
http://www.storkavenue.com
(800) 861-5437 x137




------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Decimal Maths

Simon Forster

On 14 Aug 2006, at 21:43, Adam Randall wrote:
> Computers are weird with decimal precision. It's kind of a "close  
> enough" type thing. Lasso's decimal accuracy is completely  
> dependent on the machine it's running on and the OS. Fun stuff :)

Yeah, I know. In fact I was reading an article on floating point  
maths yesterday morning - and then I got bitten by it yesterday evening!

On 14 Aug 2006, at 21:38, Adam Randall wrote:
> If you wanted a precision of 6 places, you'd do:
>
> [((decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
> 'adjustment_PRODUCTFINISH')) * ( 1.00 + (((decimal: (field:  
> 'vatRate_PRODUCT')) / 100.00)))->(setformat: -precision = 6) &]

This is what I needed. I need the math to be done at this sort of  
level of precision so that the floating point errors are small enough  
not matter. Lasso's default behaviour was given me precision to 3  
decimal places - which was causing problems when rounding to 2  
decimals. Using greater precision, the floating point errors are  
small enough not to come into play once the rounding has occurred.

Thanks for your help Adam.

ATB

Simon Forster
_______________________________________________________
  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
  Tel: +44 (0)20 8133 0528   Fax: +44 (0)70 9230 5247
_______________________________________________________



------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Decimal Maths

Adam Randall-4
Actually, the precision that is set using ->setformat is only a  
cosmetic thing. Unless you are doing some converting from decimal to  
string and then back would you really lose precision. for example:

[

var: 'x' = (decimal: 12.34567);
var: 'y' = (decimal: 54.023819682);

$x->setformat(-precision = 2);
$y->setformat(-precision = 2);

$x / $y;

]

Is going to produce the same result as:

[

var: 'x' = (decimal: 12.34567);
var: 'y' = (decimal: 54.023819682);

$x->setformat(-precision = 10);
$y->setformat(-precision = 10);

$x / $y;

]

Additionally:

[

var: 'x' = (decimal: 12.34567);
var: 'y' = (decimal: 54.023819682);

$x->setformat(-precision = 2);
$y->setformat(-precision = 2);

($x / $y)->setformat(-precision = 3) &;

]

Is the same output, but with a precision of 3.

It's just a cosmetic flag. Internally, Lasso stores all information  
in 64 bit constructs, so you've got a LOT of decimal places to play  
with (and for that matter, a lot of decimal weirdness at those levels).

You should take a C class...it'll drive you nuts this stuff :)

Adam.

--
Adam Randall <[hidden email]>
Senior Web Architect
Stork Avenue, Inc.
http://www.storkavenue.com/
(800) 861-5437
AIM/iChat: blitz574

Hobbes: "How come we play war and not peace?"
Calvin: "Too few role models."


On Aug 15, 2006, at 5:38 AM, Simon Forster wrote:

>
> On 14 Aug 2006, at 21:43, Adam Randall wrote:
>> Computers are weird with decimal precision. It's kind of a "close  
>> enough" type thing. Lasso's decimal accuracy is completely  
>> dependent on the machine it's running on and the OS. Fun stuff :)
>
> Yeah, I know. In fact I was reading an article on floating point  
> maths yesterday morning - and then I got bitten by it yesterday  
> evening!
>
> On 14 Aug 2006, at 21:38, Adam Randall wrote:
>> If you wanted a precision of 6 places, you'd do:
>>
>> [((decimal: (field: 'price_PRODUCT')) + (decimal: (field:  
>> 'adjustment_PRODUCTFINISH')) * ( 1.00 + (((decimal: (field:  
>> 'vatRate_PRODUCT')) / 100.00)))->(setformat: -precision = 6) &]
>
> This is what I needed. I need the math to be done at this sort of  
> level of precision so that the floating point errors are small  
> enough not matter. Lasso's default behaviour was given me precision  
> to 3 decimal places - which was causing problems when rounding to 2  
> decimals. Using greater precision, the floating point errors are  
> small enough not to come into play once the rounding has occurred.
>
> Thanks for your help Adam.
>
> ATB
>
> Simon Forster
> _______________________________________________________
>  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
>  Tel: +44 (0)20 8133 0528   Fax: +44 (0)70 9230 5247
> _______________________________________________________
>
>
>
> ------------------------------
> LASSO MASTER CLASS - Orlando, FL
> Following the FileMaker Developer Conference
> 2 Day intensive seminar: Learn the best way to get your FileMaker  
> data on the web.
> http://www.briandunning.com/lasso-training/
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Decimal Maths

Simon Forster

On 15 Aug 2006, at 13:23, Adam Randall wrote:

> Actually, the precision that is set using ->setformat is only a  
> cosmetic thing. Unless you are doing some converting from decimal  
> to string and then back would you really lose precision.

You're right (of course). This was a visual thing leading me astray.  
If I ignore the test output and round to 2 decimals anyway, I get the  
right result. An instance of Lasso's helpfulness (deciding I only  
needed 3 decimal points of precision), getting in the way of finding  
a minor error in logic.

> You should take a C class...it'll drive you nuts this stuff :)

Been there, done that - many years ago though. I quickly decided that  
for the sort of work I do and for the clients I have, C/C++ just  
doesn't offer the productivity I need. Having said this, I'm  
beginning to find that Lasso is starting to get in the way of more  
advanced work. There are quirks to the language and its operating  
environment which slow me down. This "rounding when displaying" is  
one such issue. Another, which has taken up a goodly chunk of the day  
so far is a recursive error - i.e. a file being included recursively.  
I tracked down the problem file - but it's a plain HTML include file  
(all be it with a .lasso suffix). I've turned off mod_rewrite,  
disabled all the other sites in the dev server and generally faffed  
around trying to fix the problem. As I was typing up this email I  
deleted the line:

<p><a href="?l=shop%2fget&1=Lighting&manu="></a></p>

 From the include file and... fixed. wtf?

I guess the dev server needs a restart but none-the-less, one can do  
without this sort of aggravation.

Don't get me wrong, I like Lasso and the community that surrounds it  
and I've done some pretty fun things with Lasso quite quickly - but  
there are instances where the "black box", tag like nature of Lasso  
gets in the way.

Sorry, strayed there.

ATB

Simon Forster
_______________________________________________________
  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
  Tel: +44 (0)20 8133 0528   Fax: +44 (0)70 9230 5247
_______________________________________________________



------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Decimal Maths

Bil Corry
Simon Forster wrote:
> You're right (of course). This was a visual thing leading me astray. If
> I ignore the test output and round to 2 decimals anyway, I get the right
> result. An instance of Lasso's helpfulness (deciding I only needed 3
> decimal points of precision), getting in the way of finding a minor
> error in logic.

I use [lp_decimal_precisionSet] to force Lasso to display all significant digits:

  <http://tagswap.net/lp_decimal_precisionset>


When using it, don't specify the precision and it'll show all significant digits:

  (lp_math_pi + 1); '<br>';
  lp_decimal_precisionSet: (lp_math_pi + 1); '<br>';
  lp_decimal_precisionSet: (lp_math_pi + 1), 3; '<br>';

Returns:

  4.14159
  4.1415926535897931
  4.142


- Bil


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Session Expires

Bruce Knox
In reply to this post by Adam Randall-4
Hi List

I have a solution with about 200 users and all user sessions were set
to expire after 15 minutes. But one of the users keeps losing data
because they are taking forever to fill in a couple of fields. This
user just says it is the way he works and that I need to fix the
problem!!

I thought I had a bright idea by adding a field to the authentication
db of session_length and having all but him on 15 minutes. But
unfortunately the session_start tag will not accept a variable from
within the session until the session itself has actually been started.

The only thing I can think of is -

a. Shooting this particular user

OR

b. Starting the session with a default 15 mins and then without
ending it starting it again with the variable session_length (this
works by the way!)


I thought I would ask the wise people here if there is a cleaner /
better way of dealing with this issue and not getting myself arrested
at the same time.

Regards


--
Bruce Knox
31 St Stephen's Square
Norwich
Norfolk
NR1 3SS

Tel 01603 - 615466
Fax 01603 - 444552

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Session Expires

Mark Palmer
Oh man, if only Omnipilot could include that in the next release. :)

On 16 Aug 2006, at 08:22, Bruce Knox wrote:

> a. Shooting this particular user



Regards

Mark Palmer
E: [hidden email]
T: 01902 620500
W: www.pageworks.co.uk





------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Session Expires

Jono-2
In reply to this post by Bruce Knox
LOL, I just watched the Simpsons Homer NRA episode a few minutes ago,  
and I know what Homer would recommend

However I would recommend against option a.

I would say shove an AJAX polling component in your form page to keep  
the session alive while users are on there. It means that when they  
are on that page the session won't time out but when they're on any  
other page it will honor the 15 minute idle session kill.

If you need help with that just holler - we can add some lightweight  
AJAX libs in without the need for you to go the whole hog with LJAX  
or prototype etc.



On 16/08/2006, at 7:22 PM, Bruce Knox wrote:

> The only thing I can think of is -
>
> a. Shooting this particular user
>
> OR
>
> b. Starting the session with a default 15 mins and then without  
> ending it starting it again with the variable session_length (this  
> works by the way!)
>
>
> I thought I would ask the wise people here if there is a cleaner /  
> better way of dealing with this issue and not getting myself  
> arrested at the same time.


Jono

// ---------------------------------------------------------
/*
     Jonathan Guthrie
     xServe Ltd, Wellington NZ
     [hidden email]   |   http://xserve.co.nz
     DDI +64 4 978 7388   |   Mob +64 21 678890

*/
// ---------------------------------------------------------



------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Session Expires

Jussi Hirvi
In reply to this post by Bruce Knox
Bruce Knox ([hidden email]) kirjoitteli (16.8.2006 10:22):
> I have a solution with about 200 users and all user sessions were set
> to expire after 15 minutes. But one of the users keeps losing data
> because they are taking forever to fill in a couple of fields. This
> user just says it is the way he works and that I need to fix the
> problem!!

Below is the code I have been using for this exact purpose. The code is from
Miles, or some other LassoTalk genius. It's "general-purpose", though you
will first have to wield it into your login procedure. I've been using it a
lot, and only once I was reported that it "didn't work" for some user. I
suspect the trouble there was "between his ears", as they say.

This is included in LassoBlogger (see LassoForge.com), so there you can see
the code in context, if you want to. It's on page /gen/frame_admin.inc.

This code will be shown only when there is no valid user (like when session
has expired).

HTH,
Jussi H.


<form action="[$myfilename]" method="POST" id="loginform" name="loginform">

<input type="hidden" name="loginform" value="yes">
<?LassoScript

If: (Action_Param:'dbChange')==1;
// we know that someone is trying to update/add/delete something somewhere

$speakBubble = 'The operation will be continued after reauthentication.';

// show speakBubble text
Include: $fromMetoRoot + $myInc + 'speakBubble.inc';

iterate: (Action_Params), local:'i';
    // exclude Lasso keywords and internal Lasso actionparams
    // exclude action params which only have to do with login procedure
    if: !((#i -> first) -> (beginswith: '__')) &&
      !((#i -> first) -> (beginswith: '-')) &&
      !((#i -> first) == 'loginform') &&
      !((#i -> first) == 'cusername') &&
      !((#i -> first) == 'cpassword');
        Output: '<input type=\"hidden\" name=\"' + (#i ->first) + '\"
value=\"' +
                (#i -> second) + '\">\r',-encodeNone;
//      var:(#i ->first) = (#i -> second);
    /if;
  /iterate;
/If;

// now show login form so that the user can log back in

?>
<table cellpadding="0" cellspacing="5" border="0" STYLE="margin-left:auto;
margin-right:auto;">
<tr>
<td align="right">
Username
</td>
<td>
<input type="text" name="cusername" size="20" value="">
</td>
<tr>
<td align="right">
Password
</td>
<td>
<input type="password" name="cpassword" size="20" value="">
</td>
</tr>
</tr>
<tr><td colspan="2" align="center">
</td></tr>
</table>

<p class="submit">
<INPUT TYPE="Submit" NAME="-nothing" id="submit" VALUE="Login &raquo;">
<INPUT TYPE="Hidden" NAME="-nothing" VALUE="Kirjaudu">
</p>
</FORM>



--
Jussi Hirvi * Green Spot
Topeliuksenkatu 15 C * 00250 Helsinki * Finland
Tel. & fax +358-9-493 981
Mobile +358-40-771 2098 (only text messages)
[hidden email] * http://www.greenspot.fi/


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Session Expires

Paul Melia

Bruce Knox ([hidden email]) kirjoitteli (16.8.2006 10:22):
> I have a solution with about 200 users and all user sessions were set
> to expire after 15 minutes. But one of the users keeps losing data
> because they are taking forever to fill in a couple of fields. This
> user just says it is the way he works and that I need to fix the
> problem!!
>


Bruce,

My suggestion would be to use a javascript timer (though that opens  
the "does the user have javascript enabled?" question) that would pop-
up at some point to ask the user if they are still there/working.
Or you could alert the pokey user that he has 5 minutes left by  
throwing up an alert at 10 minutes.

Here is a link to some code...

http://www.plus2net.com/javascript_tutorial/timer-set.php

HTH,
Paul

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Session Expires

Fletcher Sandbeck
In reply to this post by Bruce Knox
On 2006-08-16 at 08:22 by [hidden email] (Bruce Knox):

>b. Starting the session with a default 15 mins and then without
>ending it starting it again with the variable session_length (this
>works by the way!)

The expiration time from the most recent [Session_Start] is stored in the database so this will work as long as the user is visiting one or two pages after they log in.

>I thought I would ask the wise people here if there is a cleaner /
>better way of dealing with this issue and not getting myself arrested
>at the same time.

The sessions are stored in a database so you could get the user's session ID, find their record, and adjust their expiration time.  The default session storage is in the database 'site' in the table 'sessions'.

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Compress / decompress between Python (Win) and Lasso (Mac)

Marc Vos-3
In reply to this post by Jussi Hirvi
Hi Adam,

It is indeed the ZLIB compression that causes weird problems.

We tested some stuff and it sometimes worked when I altered their  
header with what Lasso produced as a header, for example their header  
was "Cnic" and they added AAAA for compatibility. Lasso produced  
AAAByin as the first 8 bytes. When I changed the AAAACnic into  
AAABynic, sometimes I could recreate the original text.


We looked at the Compress_GZip tag from Fletcher, but there's no  
Decompress_GZip, so we can't use it. Calling shell pgms is not an  
option, there are to many records that need to be displayed and that  
would take to much time and effort from the system.


Any ideas?


Regards,
-Marc Vos

* * * * * * * * * * * * * * * * * * * * * * * *
Goodyear Dunlop Tires Germany GmbH
Private:  http://marc.vos.net/
iChat/AIM : mhevos
* * * * * * * * * * * * * * * * * * * * * * * *




------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Compress / decompress between Python (Win) and Lasso (Mac)

Bil Corry
Marc Vos wrote:
> It is indeed the ZLIB compression that causes weird problems.
>
> We tested some stuff and it sometimes worked when I altered their header
> with what Lasso produced as a header, for example their header was
> "Cnic" and they added AAAA for compatibility. Lasso produced AAAByin as
> the first 8 bytes. When I changed the AAAACnic into AAABynic, sometimes
> I could recreate the original text.

You're comparing/changing the base64 encoded value.  Since you know that isn't the issue, instead, you should compare the compressed values to each other.  For example:

  var:'their_value_64' = 'AAAABXicy0jNyckHAAYsAhU=';
  var:'their_value_compressed' = decode_base64: $their_value_64;
  var:'your_value_compressed' = compress: 'hello';
  'Their value:';
  lp_string_radixprint:$their_value_compressed,-bytes;
  'Your value:';
  lp_string_radixprint:$your_value_compressed,-bytes;
  define_atend:{ content_body = (string_replaceregexp: content_body, -find='\\0', -replace=' '); }; // this just lets me copy/paste the text into thunderbird, which doesn't like nulls


Which returns:


Their value:

Binary                           |   Hex    |    Dec     | Chr
---------------------------------+----------+------------+----
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000101 |       05 |      5     |  
00000000000000000000000001111000 |       78 |     120    |  x
00000000000000000000000010011100 |       9C |     156    |  �
00000000000000000000000011001011 |       CB |     203    |  �
00000000000000000000000001001000 |       48 |     72     |  H
00000000000000000000000011001101 |       CD |     205    |  �
00000000000000000000000011001001 |       C9 |     201    |  �
00000000000000000000000011001001 |       C9 |     201    |  �
00000000000000000000000000000111 |       07 |      7     |  
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000110 |       06 |      6     |  
00000000000000000000000000101100 |       2C |     44     |  ,
00000000000000000000000000000010 |       02 |      2     |  
00000000000000000000000000010101 |       15 |     21     |  

Your value:

Binary                           |   Hex    |    Dec     | Chr
---------------------------------+----------+------------+----
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000101 |       05 |      5     |  
00000000000000000000000001111000 |       78 |     120    |  x
00000000000000000000000010011100 |       9C |     156    |  �
00000000000000000000000011001011 |       CB |     203    |  �
00000000000000000000000001001000 |       48 |     72     |  H
00000000000000000000000011001101 |       CD |     205    |  �
00000000000000000000000011001001 |       C9 |     201    |  �
00000000000000000000000011001001 |       C9 |     201    |  �
00000000000000000000000000000111 |       07 |      7     |  
00000000000000000000000000000000 |       00 |      0     |    
00000000000000000000000000000110 |       06 |      6     |  
00000000000000000000000000101100 |       2C |     44     |  ,
00000000000000000000000000000010 |       02 |      2     |  
00000000000000000000000000010101 |       15 |     21     |  



You'll need my library to use [lp_string_radixprint]:

  <http://tagswap.net/lp__library>


- Bil



------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Performance Testing and Diagnostics

random-4
In reply to this post by Adam Randall-4
Good afternoon,

Here I am again, asking for advice.  I hope sometime to be able to
contribute some.

I'm working on what is, by my standards, a very large lasso page. The
source is over 700 lines, and it evaluates to over 3000 lines of html.
Maybe that by itself is the problem.

Having said that, the page is somewhat slow, and I'm not sure how to go
about isolating the problem.

If I capture the output page source, upload it to the server and just
load it as html, it takes about a second to load.  Likewise there are 4
sql queries, which seem to take about a second between them.  But...  
the whole page can take up to 10 seconds to load (I've had user reports
of even longer times.)

So, from that I'm concluding that the other 6 to 8 seconds are being
consumed by lasso.  The trouble is, that among those 700 lines
(including the html), I'm not sure where to look.  I've tried pulling
out certain suspect blocks, but no luck.

Here's what I'd like to know:

1. If you had this problem, what's the first gotcha you'd look for?
2. Is there some way I can insert some kind of timing tag, or see
something in a log somewhere which will tell me how the processing time
is being used?
3. Am I just being unrealistic in my expectations for performance?

I think I could eventually whittle away at this until I found where the
slow down is originating, but I'm trying to find a more efficient way
to test which parts of the script are slow.

Thanks very much.

John


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Performance Testing and Diagnostics

decorior
Hi, John:

The simple place to start is to place [date_getcurrentdate] at  
several points in your code. This will at least tell you what area is  
consuming time.

You can also get down to milliseconds if needed.

You should also check to see that any external files that are being  
referenced are actually loaded, since that can cause a slow down.

I guess the last thing I would consider is the size of your page.  
While it is not technically a problem, a 3,000 line output does  
suggest a usability question. Perhaps there is a better way to  
provide the information back to the user in more manageable "chunks"

Deco
On Aug 19, 2006, at 9:57 AM, John wrote:

> Good afternoon,
>
> Here I am again, asking for advice.  I hope sometime to be able to  
> contribute some.
>
> I'm working on what is, by my standards, a very large lasso page.  
> The source is over 700 lines, and it evaluates to over 3000 lines  
> of html. Maybe that by itself is the problem.
>
> Having said that, the page is somewhat slow, and I'm not sure how  
> to go about isolating the problem.
>
> If I capture the output page source, upload it to the server and  
> just load it as html, it takes about a second to load.  Likewise  
> there are 4 sql queries, which seem to take about a second between  
> them.  But...  the whole page can take up to 10 seconds to load  
> (I've had user reports of even longer times.)
>
> So, from that I'm concluding that the other 6 to 8 seconds are  
> being consumed by lasso.  The trouble is, that among those 700  
> lines (including the html), I'm not sure where to look.  I've tried  
> pulling out certain suspect blocks, but no luck.
>
> Here's what I'd like to know:
>
> 1. If you had this problem, what's the first gotcha you'd look for?
> 2. Is there some way I can insert some kind of timing tag, or see  
> something in a log somewhere which will tell me how the processing  
> time is being used?
> 3. Am I just being unrealistic in my expectations for performance?
>
> I think I could eventually whittle away at this until I found where  
> the slow down is originating, but I'm trying to find a more  
> efficient way to test which parts of the script are slow.
>
> Thanks very much.
>
> John
>
>
> ------------------------------
> LASSO MASTER CLASS - Orlando, FL
> Following the FileMaker Developer Conference
> 2 Day intensive seminar: Learn the best way to get your FileMaker  
> data on the web.
> http://www.briandunning.com/lasso-training/
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:  http://www.listsearch.com/ 
> lassotalk.lasso?manage


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Performance Testing and Diagnostics

Mark Palmer
In reply to this post by random-4
Hi,

Drop this at the top of your code
Var('timer' = _date_msec);

and then report the expires time using this at points of interest  
throughout your code.

'Time expired: '(_date_msec - $timer)' ms.';

Are the fields you are searching on in your database indexed?

Could any of the SQL queries be cached? You have the Lasso cache tags  
and there is the MySQL query cache that might help -  if your using  
MySQL.

http://dev.mysql.com/doc/refman/5.0/en/query-cache.html



On 19 Aug 2006, at 16:57, John wrote:

> Good afternoon,
>
> Here I am again, asking for advice.  I hope sometime to be able to  
> contribute some.
>
> I'm working on what is, by my standards, a very large lasso page.  
> The source is over 700 lines, and it evaluates to over 3000 lines  
> of html. Maybe that by itself is the problem.
>
> Having said that, the page is somewhat slow, and I'm not sure how  
> to go about isolating the problem.
>
> If I capture the output page source, upload it to the server and  
> just load it as html, it takes about a second to load.  Likewise  
> there are 4 sql queries, which seem to take about a second between  
> them.  But...  the whole page can take up to 10 seconds to load  
> (I've had user reports of even longer times.)
>
> So, from that I'm concluding that the other 6 to 8 seconds are  
> being consumed by lasso.  The trouble is, that among those 700  
> lines (including the html), I'm not sure where to look.  I've tried  
> pulling out certain suspect blocks, but no luck.
>
> Here's what I'd like to know:
>
> 1. If you had this problem, what's the first gotcha you'd look for?
> 2. Is there some way I can insert some kind of timing tag, or see  
> something in a log somewhere which will tell me how the processing  
> time is being used?
> 3. Am I just being unrealistic in my expectations for performance?
>
> I think I could eventually whittle away at this until I found where  
> the slow down is originating, but I'm trying to find a more  
> efficient way to test which parts of the script are slow.
>
> Thanks very much.
>
> John
>
>
> ------------------------------
> LASSO MASTER CLASS - Orlando, FL
> Following the FileMaker Developer Conference
> 2 Day intensive seminar: Learn the best way to get your FileMaker  
> data on the web.
> http://www.briandunning.com/lasso-training/
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:  http://www.listsearch.com/ 
> lassotalk.lasso?manage



Regards

Mark Palmer
E: [hidden email]
T: 01902 620500
W: www.pageworks.co.uk





------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Performance Testing and Diagnostics

Bil Corry
Mark Palmer wrote:
> Drop this at the top of your code
> Var('timer' = _date_msec);
>
> and then report the expires time using this at points of interest
> throughout your code.
>
> 'Time expired: '(_date_msec - $timer)' ms.';

I use this ctag to do the same thing:

  <http://tagswap.net/lp_page_timer>


Just call it once at the beginning of the page, then call it again after each section of code you want to time.  Here's an example, using [sleep] to simulate how long the code takes:

  // top of page
  lp_page_timer;

  // some code to time
  sleep: 50;
  lp_page_timer;

  // some code to time
  sleep: 200;
  lp_page_timer;

  // some code to time
  sleep: 10;
  lp_page_timer;



- Bil


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Performance Testing and Diagnostics

Steffan A. Cline
In reply to this post by random-4
I ran into this with a client recently. If there are many sql queries on the
page then you can do query caching which will save you many cpu ticks in
opening/closing connections. Wrap the body of your code with

inline(-database='the db you are going to using',-nothing);
    all your other queries go in here but do not
    specify the db name, ONLY the table names so
    lasso will know what encoding to use.

/inline;

Additionally people do sql queries and then forget that they can return
thousands of records but only need one. People forget that Lasso receives
ALL records from a query unless a max is specified then Lasso parses it out.
example:
Inline(-database='xxx',-table='xxx',sql='select * from
something',-maxrecords=10);

Well, look at that?  You are returning all records but then expecting lasso
to only take the first 10. That takes time and horse power. Never do this.
If you are going to build your own sql be sure to limit the number of
records returned using the LIMIT option. Now, if you are looking for more
than 50 records be sure to say -maxrecords=all so that your results are not
limited yet you still control the limit from your SQL statement. Also, in
classic inlines with sql (classic meaning no -sql option) be sure to use the
-UseLimit option so that when lasso creates the sql for you that it uses
this to avoid the aforementioned problems.

Still confused. Try this. If it does not work paste the code in here and one
of us can show you how to optimize it. I have MANY sql pages where the
queries join 10 tables with calcs and all and it works just fine and fast.
If a lasso page runs that slow it is usually coder inexperience. I'm not
trying to sound insulting but rather doing as an old friend Charlie Tiggs
did with me, "Teaching a man to fish."

Anyhow, let us know what you think.


Thanks

Steffan

---------------------------------------------------------------
T E L  6 0 2 . 5 7 9 . 4 2 3 0 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline
[hidden email]                             Phoenix, Az
http://www.ExecuChoice.net                                  USA
AIM : SteffanC          ICQ : 57234309
                                  Lasso Partner Alliance Member
---------------------------------------------------------------



> From: John <[hidden email]>
> Reply-To: <[hidden email]>
> Date: Sat, 19 Aug 2006 11:57:16 -0400
> To: <[hidden email]>
> Subject: Performance Testing and Diagnostics
>
> Good afternoon,
>
> Here I am again, asking for advice.  I hope sometime to be able to
> contribute some.
>
> I'm working on what is, by my standards, a very large lasso page. The
> source is over 700 lines, and it evaluates to over 3000 lines of html.
> Maybe that by itself is the problem.
>
> Having said that, the page is somewhat slow, and I'm not sure how to go
> about isolating the problem.
>
> If I capture the output page source, upload it to the server and just
> load it as html, it takes about a second to load.  Likewise there are 4
> sql queries, which seem to take about a second between them.  But...
> the whole page can take up to 10 seconds to load (I've had user reports
> of even longer times.)
>
> So, from that I'm concluding that the other 6 to 8 seconds are being
> consumed by lasso.  The trouble is, that among those 700 lines
> (including the html), I'm not sure where to look.  I've tried pulling
> out certain suspect blocks, but no luck.
>
> Here's what I'd like to know:
>
> 1. If you had this problem, what's the first gotcha you'd look for?
> 2. Is there some way I can insert some kind of timing tag, or see
> something in a log somewhere which will tell me how the processing time
> is being used?
> 3. Am I just being unrealistic in my expectations for performance?
>
> I think I could eventually whittle away at this until I found where the
> slow down is originating, but I'm trying to find a more efficient way
> to test which parts of the script are slow.
>
> Thanks very much.
>
> John
>
>
> ------------------------------
> LASSO MASTER CLASS - Orlando, FL
> Following the FileMaker Developer Conference
> 2 Day intensive seminar: Learn the best way to get your FileMaker data on the
> web.
> http://www.briandunning.com/lasso-training/
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage



------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
12