Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 20 of 32 total
Thread Has The Lack Of Functions Been A Setback?
Mon, Sep 23 2013 10:59 AMPermanent Link

Frederick Chin

(Matthew Jones) wrote:

/*
integer(Floor(theValue))
will give you the integer version.

Yes, it may not be ideal for negatives, but it is easy to write a Trunc for
yourself with these tools.
*/

I can live with this but should I call my function MyTrunc() or Trunc(). This is in case EWB comes out with its own Trunc() function.

Frederick
Mon, Sep 23 2013 1:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< As a beginner, I would want EWB to be able to handle the following
processes without any third-party support:- >>

You're not really understanding the browser environment, which makes points
3 and 4 not feasible.  You don't want any long-running data processing going
on in a browser application, period.  If you do that, you're going to get
"script is busy" dialogs in the browser, and this is going to cause issues
for your users.  Likewise, there is simply *no way* to create PDF files in a
browser application in a way that doesn't run into the same issue, unless
it's a trivial PDF file.  That's why these things should *always* be done by
the back-end, not the front-end.

General rule of thumb:

Data processing, data generation -->  Back-End
UI, display --> Front-End

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 23 2013 1:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Has this been a setback to your using EWB? Should I be calling a similar
working function as trunc() mytrunc()? >>

Call it MyTrunc().  This is the Trunc() that I added to the RTL (WebCore)
for the next build:

function Trunc(Value: Double): Integer;
begin
  if (Value < 0) then
     Result:=Ceil(Value)
  else
     Result:=Floor(Value);
end;

BTW, in the future, instead of getting into a philosophical discussion about
why EWB does or doesn't have a particular function, just ask for it.  It
will be in the next build, if possible.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 23 2013 1:43 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< I use the Trunc() function to get the integer value of a float. Since
there is no Int() either, I have to cobble my own.

You don't need an Int() function - the Floor and Ceil functions return
integers:

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Ceil
http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Floor

Tim Young
Elevate Software
www.elevatesoft.com

Mon, Sep 23 2013 10:05 PMPermanent Link

Frederick Chin

Tim,

/*
You're not really understanding the browser environment, which makes points
3 and 4 not feasible.  You don't want any long-running data processing going
on in a browser application, period.  If you do that, you're going to get
"script is busy" dialogs in the browser, and this is going to cause issues
for your users.  Likewise, there is simply *no way* to create PDF files in a
browser application in a way that doesn't run into the same issue, unless
it's a trivial PDF file.  That's why these things should *always* be done by
the back-end, not the front-end.

General rule of thumb:

Data processing, data generation -->  Back-End
UI, display --> Front-End
*/

Let's say that when I click a button at the EWB front-end and I want to go through a large number of database records to perform updates. I would need to pass the request to a script in the back-end to perform the work.

I would not be able to write this script in EWB because EWB (which outputs JS code) is not meant for back-end data processing. A possible language to use is PHP.

Is the above correct?

Frederick
Mon, Sep 23 2013 10:06 PMPermanent Link

Frederick Chin

Tim,

/*
BTW, in the future, instead of getting into a philosophical discussion about
why EWB does or doesn't have a particular function, just ask for it.  It
will be in the next build, if possible.
*/

Noted.

Frederick
Mon, Sep 23 2013 10:18 PMPermanent Link

Frederick Chin

Tim,

/*
You don't need an Int() function - the Floor and Ceil functions return
integers:

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Ceil
http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Floor
*/

Actually, I never needed to use all three functions above in Delphi. Trunc() is used especially to obtain the value of a spinner control and to perform code like the following:-

nInstcnt:=MyTrunc(FloatToStr(StrToFloat(StrReplace(cPrice,',','',True))/450));

Frederick
Tue, Sep 24 2013 5:28 AMPermanent Link

Matthew Jones

> I would not be able to write this script in EWB because EWB (which
> outputs JS code) is not meant for back-end data processing. A
> possible language to use is PHP.

Yes, but depending on your hosting needs, consider using Delphi. Delphi is quite
able to handle a fair number of requests, particularly if you use a framework like
the RemObjects SDK, or REST, or SOAP. What I do is send a request from EWB to the
server, which puts the request in a queue (DBISAM database table) and worker
threads then look for tasks and perform them, finally updating the table with
status (success or fail). The client can then use a timer to check the status, and
get the result when it is ready (perhaps show a PDF in a sub-page).

I like this because the language is basically the same for both front and back ends.
Obviously if PHP or other is what you are happy with, then it will suit well too.

/Matthew Jones/
Tue, Sep 24 2013 10:46 AMPermanent Link

Frederick Chin

(Matthew Jones) wrote:

/*
Yes, but depending on your hosting needs, consider using Delphi. Delphi is quite
able to handle a fair number of requests, particularly if you use a framework like
the RemObjects SDK, or REST, or SOAP. What I do is send a request from EWB to the
server, which puts the request in a queue (DBISAM database table) and worker
threads then look for tasks and perform them, finally updating the table with
status (success or fail). The client can then use a timer to check the status, and
get the result when it is ready (perhaps show a PDF in a sub-page).

I like this because the language is basically the same for both front and back ends.
Obviously if PHP or other is what you are happy with, then it will suit well too.
*/

Thanks for the tip.

Would the above work if the EWB app is hosted in an Apache web server running in Linux with MySQL as the database? Although I would love to work with DBISAM, I want to stick with just one database for EWB apps whether for locally or publicly hosted environments.

Frederick
Tue, Sep 24 2013 12:19 PMPermanent Link

Matthew Jones

> Would the above work if the EWB app is hosted in an Apache web
> server running in Linux with MySQL as the database? Although I
> would love to work with DBISAM, I want to stick with just one
> database for EWB apps whether for locally or publicly hosted
> environments.

I'd say not easily. You'd have to look at something like FreePascal, and the host
may not allow it anyway. The likes of Azure and Amazon will host you a virtual
machine though which will work nicely. But if you are familiar with a particular
server technology, then EWB will work well with that. It is what I like about the
web stuff - you have the client and the server and they can be replaced easily and
the other side doesn't care.

/Matthew Jones/
« Previous PagePage 2 of 4Next Page »
Jump to Page:  1 2 3 4
Image