Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread how load parameters like initfile
Fri, Nov 30 2012 7:05 PMPermanent Link

pedrini.franck

Axima srl


 Hello
 How the best way to load parameters , like initfile or file.ini in delphi ,for example setup the server-request url.  

  Thank you

( www.elevatesoft.com make with elevate web builder ?)
Fri, Nov 30 2012 7:31 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate


Easiest IMHO is to just return a json dataset from server consisting of
2 columns : setting key and value. This makes it easy to expand if you
need more settings (vs having each setting as column).

You could just return key value pairs directly in JSON but using dataset
makes it trivial to manage on EWB side (load and search).

More tricky question is how to identify the EWB app instance - if you
use login then username could be the key or remote IP (though that can
change).

Raul

No - website was not created using EWB.



On 11/30/2012 7:05 PM, pedrini.franck wrote:
>    Hello
>    How the best way to load parameters , like initfile or file.ini in delphi ,for example setup the server-request url.
>
>     Thank you
>
>   ( www.elevatesoft.com make with elevate web builder ?)
>
Fri, Nov 30 2012 7:40 PMPermanent Link

pedrini.franck

Axima srl


 Thank you Raul !
Sat, Dec 1 2012 12:21 AMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

You're welcome

I also realized i did not answer the other side of the question.

Since EWB is a javascript application running in sandboxed environment
inside the browser you cannot access anything on local file system (like
ini file in delphi). It's not an EWB limitation but limitation with all
javascript applications.

Normally you would host the EWB application on a webserver and have
client loading it. If you need to know what is the web server address
that EWB was loaded from then you can use window.location.host for this.

So for example assume you have a web server that hosts the EWB app and
also runs the web service that EWB can interact in '/mywebservice'
virtual path then you could reference your web service using something
like this :

myURL := 'http://'+ window.location.host+'/mywebservice/';

but of course use proper path there to access your service

Raul

NB! Bit off topic but there is a storage spec in HTML5 called web
storage. EWB does not support it yet (as far as i know) though in theory
if you did you could store settings there. Issue of course is that this
is something that user can clear and is specific to browser so you're
still better off doing server side storage of settings. Web storage
would be useful for caching data or maybe storing other session data
that can be always reloaded from server.

On 11/30/2012 7:40 PM, pedrini.franck wrote:
>    Thank you Raul !
>
Sat, Dec 1 2012 9:08 AMPermanent Link

pedrini.franck

Axima srl


  Hello Raul

 I like this solution ' window.location.host' . I install webclient on iis7 , and i place  my delphi indyhtpserver for
the data on the same server , the solution url+window.location.host+':GateNumber' is good and simple.  


 Thank You !
Mon, Dec 3 2012 3:17 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Raul,

<< NB! Bit off topic but there is a storage spec in HTML5 called web
storage. EWB does not support it yet (as far as i know) though in theory if
you did you could store settings there. Issue of course is that this is
something that user can clear and is specific to browser so you're still
better off doing server side storage of settings. Web storage would be
useful for caching data or maybe storing other session data that can be
always reloaded from server. >>

EWB has it in the WebDOM unit:

  external TWindow = class
     public
        { Properties }
        property closed: Boolean read;
        property defaultStatus: String read write;
        property document: TDocument read;
        property event: TEvent read; // IE-only
        property frames: TWindowList read;
        property history: THistory read;
        property innerHeight: Integer read; // Not supported by IE
        property innerWidth: Integer read; // Not supported by IE
        property localStorage: TStorage read; <<<<<<<<<<<<<< Here
        property location: TLocation read;
        property name: String read write;
        property navigator: TNavigator read;
        property opener: TWindow read;
        property outerHeight: Integer read; // Not supported by IE
        property outerWidth: Integer read; // Not supported by IE
        property pageXOffset: Integer read; // Not supported by IE
        property pageYOffset: Integer read; // Not supported by IE
        property parent: TWindow read;
        property screen: TScreen read;
        property screenLeft: Integer read; // IE-only
        property screenTop: Integer read; // IE-only
        property screenX: Integer read; // Not supported by IE
        property screenY: Integer read; // Not supported by IE
        property sessionStorage: TStorage read; <<<<<<<<<<<<<< Here
        property status: String read write;
        property top: TWindow read;
        property window: TWindow read;

And the declaration for TStorage is:

  external TStorage = class
     public
        { Properties }
        property length: Integer read;
        property items[index: Integer]: String read write; default;
        property items[const name: String]: String read write; default;
        { Methods }
        procedure clear;
        function getItem(const key: String): String;
        function key(n: Integer): String;
        procedure removeItem(const key: String);
        procedure setItem(const key: String; const value: String);
     end;

So you can reference it from anywhere in the application by using:

uses WebDOM;

var
  MyData: String;
begin
  MyData:=window.sessionStorage.getItem('MyData');
end;

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jan 21 2013 12:03 PMPermanent Link

Matthew Jones

Tim,

Given the opposite of this, to read the values, the string I get for anything never
written is "null". Is there a way to have this either an empty string, or to detect
if it exists before reading? I think empty is my preference, perhaps with a check
for those who care deeply about if it is not there at all.

While I'm writing, is there any method for basic encryption available for this
storage? I need to store a password, and obviously that shouldn't be in plain text.
Or is the local storage encrypted anyway - I'm new to this!

/Matthew Jones/
Mon, Jan 21 2013 12:06 PMPermanent Link

Matthew Jones

http://stackoverflow.com/questions/2642043/html5-web-db-security

seems relevant to my security question, though I'm not sure it really answer it.

Is there an easy way to XOR a string with another? That would probably do for this
purpose - just some basic obfuscation at this point. And I'll add a "remember
password" option so that people can turn it off.

/Matthew Jones/
Tue, Jan 22 2013 11:40 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Given the opposite of this, to read the values, the string I get for
anything never written is "null". Is there a way to have this either an
empty string, or to detect if it exists before reading? >>

Not in its un-wrapped form (the current form).  External interfaces simply
reflect what exists in the browser or external JS and can't introduce
functionality that doesn't already exist.

<< While I'm writing, is there any method for basic encryption available for
this storage? I need to store a password, and obviously that shouldn't be in
plain text. Or is the local storage encrypted anyway - I'm new to this! >>

No, currently none of the browsers encrypt the local storage (or provide a
mechanism to do so).

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jan 22 2013 11:46 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Is there an easy way to XOR a string with another? That would probably do
for this purpose - just some basic obfuscation at this point. And I'll add a
"remember password" option so that people can turn it off. >>

The problem with doing "simple" encryptions on the client is that anyone can
easily see what you're doing to "encrypt" the strings.  But, as long as
you're aware of that, you could use any existing Object Pascal XOR code that
is available.  Here's a random one that came up in Google:

http://delphi.cjcsoft.net/viewthread.php?tid=45395

Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 2Next Page
Jump to Page:  1 2
Image