Alaska Software Inc. - How to run an xBase app on the internet
Username: Password:
AuthorTopic: How to run an xBase app on the internet
Tom DHow to run an xBase app on the internet
on Wed, 15 Dec 2004 13:57:45 -0500
I have not yet done any programming for web based applications, so please 
excuse my lack of understanding.

I have an xBase program that uses .DBF files and .NTX indexes that I would 
like to make available to clients via the internet. I currently send them 
periodic database updates and they run the application at their own 
location, but if we set it up on a server here they could simply go on-line 
and see the latest updates.

This application has a couple of data browses, reports, and queries. It uses 
a lot of "Express" library functions for push buttons, check boxes, and 
radio buttons. What would need to be done to make the application run on the 
web? Would all menu and screen interface commands need to be changed? What 
is the best third party product for getting started. Thank you.
Martin AltmannRe: How to run an xBase app on the internet
on Wed, 15 Dec 2004 20:11:07 +0100
Tom,
if you are using eXPress++ have a look at XB2.NET from Boris Borzic!
Roger seem to have done a great job integrating his eXPress++ and XB2.NET - 
at least he showed some marvellous stuff at the DevCon!
Have a look at Rogers webpage as well as Boris' ( http://xb2.net )

HTH,
Martin
Phil Ide
Re: How to run an xBase app on the internet
on Thu, 16 Dec 2004 10:47:52 +0000
Tom,

> I have not yet done any programming for web based applications, so please 
> excuse my lack of understanding.
> 
> I have an xBase program that uses .DBF files and .NTX indexes that I would 
> like to make available to clients via the internet. I currently send them 
> periodic database updates and they run the application at their own 
> location, but if we set it up on a server here they could simply go on-line 
> and see the latest updates.
> 
> This application has a couple of data browses, reports, and queries. It uses 
> a lot of "Express" library functions for push buttons, check boxes, and 
> radio buttons. What would need to be done to make the application run on the 
> web? Would all menu and screen interface commands need to be changed? What 
> is the best third party product for getting started. Thank you.

That's actually a lot of questions .

Basically, you have three options:

1.  Write your application as a CGI app.
    Each web page must have a link which calls the the CGI app,
    which is invoked by the webserver.

The problem with this approach, is that for each request arriving at the
web-server, a new instance of the application is loaded.  This is fine for
small perl scripts or tiny C programs, but Xbase++ apps require several MB
of memory and time to load.  That's not to say it won't work, but if you
have a high hit rate, you'll want to look for something more efficient.

2.  Write your own web-server in Xbase++

This sounds ridiculously over the top, but the advantage is that your
application receives every request from the client and can act accordingly
without having to spawn a new process.  Boris' Xb2.NET provides all the
functionality you need, including a highly configurable framework
application which handles not only HTTP, but HTTPS for secure sites and
SOAP as well.  To write a server with Xb2.NET that provides a simple
'welcome' page created on the fly takes only a few minutes, and you can
then add as much functionality as you require.

3.  Write a persistent application which runs parallel to the web-server.

The web-server passes requests to this application via a CGI script.  This
is the way that WAA (Alaska's Web Application Adaptor) works.  Effectively,
it is a hybrid of the two options above.

Your next problem is that you cannot convert GUI applications to output web
pages.  Partly this is due to the fact that the controls on a web page are
not the same (even though they look the same) their GUI counterparts. Also
they way they are configured and handled is different. In an Xbase++ GUI
app you have control of the event handler, which you lose on an HTML page.

WAA provides you with a class for handling web pages, which has methods for
adding various edit controls, forms etc.  This is pretty basic stuff, and
content must be added to the page in a linear fashion.

I've written a library - XbHAL - which incorporates HTML syntax into the
Xbase++ language.  You can create very complex pages (as complex as you
like) that include styles, scripts, dhtml, objects etc.  You can add ontent
to the bottom of the page whilst adding a link to that content at the top
of the page, manipulate content within the <head></head> tags, and utilise
template HTML pages from which to build.  Here's an example that inserts a
logon screen:

    FORM START name=loginform
       HIDE WAA_FORM=Login
       TABLE border=0, cellpadding=3, cellspacing=0,;
             style="border:solid 1px black"
          ROW
             CELL colspan=2, align=center ? 'Welcome' BOLD
          ROW
             CELL ? '~Name'
             CELL INPUT name=UNAME, size=20, maxlength=20, accessKey=N
          ROW
             CELL ? '~Password'
             CELL INPUT AS PASSWORD name=UPASS, size=20, maxlength=20,;
                                    accessKey=P
          ROW END
       TABLE CLOSE
    FORM CLOSE

XbHAL makes it very easy to add client-side validation too.  This library
works equally well with WAA or Xb2.NET, and if you decide to switch from
WAA to Xb2.NET or vice-versa, then your XbHAL code will port across in just
moments.

The current version of XbHAL requires Alaska's HRF library, which comes
with the Professional Subscription, but v2 which is ready for use but
rather under-documented does not.  If you don't have HRF, email me for v2.


HTH
                   
Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Your ZIP file is open!
Mark CarewRe: How to run an xBase app on the internet
on Fri, 17 Dec 2004 08:41:19 +1000
Hi Phil,

I just got hal running, and a very fine utility it is too, to be sure; but
the dll it creates is hal.dll. When I was testing, I kept getting complaints
about myhtml3 not being found in dynamic link library hal.dll. Ah Ha, I can
see what the problem is thought I, there is an old version of hal.dll in
\windows\system32, which as you know is in the path on most win xp machines.
I'll just delete it and all will be fine and yes, it worked beautifully
until the next day when I restarted my xp pc.

I had to fire up another xp box and grab the real hal.dll after starting my
main box in windows recovery mode. It seems that hal.dll or is that ibm.dll
in disguise  is part of the op sys boot sequence. Could you rename your
dll to some other name to save others from making my silly mistake and
ruining perfectly good pcs. I call it htl.dll and it all works as expected.

Thanks

Mark
Thomas Braun Re: How to run an xBase app on the internet
on Fri, 17 Dec 2004 11:18:45 +0100
Mark Carew wrote:

> see what the problem is thought I, there is an old version of hal.dll in
> \windows\system32, which as you know is in the path on most win xp machines.
> I'll just delete it

Uh-oh! 

> and all will be fine and yes, it worked beautifully
> until the next day when I restarted my xp pc.

"I could have told you that" 

HAL = Hardware Abstraction Layer DLL, which is quite an essential part
of Windows.

> in disguise  is part of the op sys boot sequence. Could you rename your
> dll to some other name 

Nahh... I really like the reminiscence to HAL 9000
(http://en.wikipedia.org/wiki/HAL_9000), so Phil please don't  

> to save others from making my silly mistake and
> ruining perfectly good pcs. I call it htl.dll and it all works as expected.

This only delays the problem to a later point in time... you never know if
an when someone at M$ decides to create a htl.dll...

regards
Thomas
Mark CarewRe: How to run an xBase app on the internet
on Sat, 18 Dec 2004 05:54:11 +1000
>
> Nahh... I really like the reminiscence to HAL 9000
> (http://en.wikipedia.org/wiki/HAL_9000), so Phil please don't 
Yes me too
Phil Ide
Re: How to run an xBase app on the internet
on Fri, 17 Dec 2004 14:17:03 +0000
Mark,

> I just got hal running, and a very fine utility it is too, to be sure; but
> the dll it creates is hal.dll. When I was testing, I kept getting complaints
> about myhtml3 not being found in dynamic link library hal.dll. Ah Ha, I can
> see what the problem is thought I, there is an old version of hal.dll in
> \windows\system32, which as you know is in the path on most win xp machines.
> I'll just delete it and all will be fine and yes, it worked beautifully
> until the next day when I restarted my xp pc.

Yup, this problem is known, which is why I now refer to it as XbHAL and
XbHAL2.  The newer version has already been renamed.  Since v2 is
backwards-compatible with v1, v1 will be removed from my site as the new
release is made, so this roblem won't occur again after that.

Apologies - I had no idea there was a HAL.DLL until someone pointed it out
to me (Sander?).

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Women do come with instructions, ask them!
Sander Elias Re: How to run an xBase app on the internet
on Fri, 17 Dec 2004 17:11:15 +0100
>Apologies - I had no idea there was a HAL.DLL until someone pointed it out
>to me (Sander?).
Yes, it got me confused also the 1st time 

regards
Sander Elias
Sander Elias Re: How to run an xBase app on the internet
on Thu, 16 Dec 2004 12:22:59 +0100
Hi,

>This application has a couple of data browses, reports, and queries. It uses 
>a lot of "Express" library functions for push buttons, check boxes, and 
>radio buttons. What would need to be done to make the application run on the 
>web? Would all menu and screen interface commands need to be changed? What 
>is the best third party product for getting started. Thank you. 

Talk to Roger. Most of what you want is currently possible with
express. Roger delivers a framework so that you can make your own web
server with express code. I think you also need xb2.net if you want to
go all the way.

regards
Sander Elias