Recent

Author Topic: New to internet programming frustrations  (Read 7842 times)

dgrhoads

  • New Member
  • *
  • Posts: 34
New to internet programming frustrations
« on: March 30, 2024, 05:26:30 am »
I am new to programming for internet access and am finding that the three avenues I've tried so far have issues.  My third avenue is InternetTools.   It seems to be widely used.

I downloaded the internettools.zip and have tried to install the package "internettools.lpk".  During installation, I got an error message telling me that it cannot find PASDBLSTRUTILS. 

This file is not included in the latest Lazarus distribution nor in the InternetTools zip file.  I fouund it on the internet and have downloaded it.  Where do I put this file so it will be available every future time I rebuild my system and where it will be compiled along with all the other files during the rebuild?


Thaddy

  • Hero Member
  • *****
  • Posts: 14376
  • Sensorship about opinions does not belong here.
Re: New to internet programming frustrations
« Reply #1 on: March 30, 2024, 06:00:41 am »
internettools is a bad choice. very old. and contrary to your belief hardly used anymore.
look at the preinstalled fcl-web and fpc-net libraries and the included examples. there also some component wrappers for that. it is maintained and written by the freepascal core team. you may also be interested in pas2js, but for beginners i would start with first two in mentioned.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

TRon

  • Hero Member
  • *****
  • Posts: 2534
Re: New to internet programming frustrations
« Reply #2 on: March 30, 2024, 07:05:08 am »
I downloaded the internettools.zip and have tried to install the package "internettools.lpk".  During installation, I got an error message telling me that it cannot find PASDBLSTRUTILS. 
The use of that unit is a choice (just like many others choices/dependencies for that package). See internettoolsconfig.inc

I downloaded the internettools.zip  ....
From where ? When ?

Always try to go directly to the source, like in this case here.

PS: something I forgot to mention. Internetools are just plain Pascal units e.g. there are no visual components. and as stated on the website:
Quote
Since the Internet Tools and their XQuery-Engine consist of a set of plain Pascal units they do not require installation. You just need to extract all files from the .zip package and ensure that FPC can find the .pas files.
But if you want to then the package can be installed (with the earlier mentioned note about the configuration in mind).
« Last Edit: March 30, 2024, 07:19:57 am by TRon »

dgrhoads

  • New Member
  • *
  • Posts: 34
Re: New to internet programming frustrations
« Reply #3 on: March 30, 2024, 06:14:10 pm »
Thanks for the suggestions.

I successfully loaded the fpweb package.  Then I attempted to follow the directions in two of the website tutorials suggested by TRon.  (I am using the latest Lazarus distribution 3.2.)  Partial success.  Frustrations continue.

fpWeb Tutorial.  I tried the "Hello World" example.  Used the HTTP Server Application.  In Item #5, I was directed to move to the Object Inspector.  There were NO objects available under Object Inspector.  Consequently, I could not select an event as specified under Item #6.

fcl-web.  I was able to create the first application (CGI Application) as directed.  I was able to compile it successfully (Run/Quick compile).  However the normally green arrow used to launch the application was not illuminated, so I couldn't run the application.

Are these bugs in 3.2 that I am finding or is it me?

Is it possible to use fpweb with a straight Application rather than the HTTP Server Application or the CGI Application?  If so, is there a tutorial on how to do that?

TRon

  • Hero Member
  • *****
  • Posts: 2534
Re: New to internet programming frustrations
« Reply #4 on: March 31, 2024, 07:06:28 am »
fpWeb Tutorial.  I tried the "Hello World" example.  Used the HTTP Server Application.  In Item #5, I was directed to move to the Object Inspector.  There were NO objects available under Object Inspector.  Consequently, I could not select an event as specified under Item #6.
Which type of web module did you select on the HTTP project creation window ? If you leave it empty non will be created and hence there will not be any presented in the object inspector.

Quote
fcl-web.  I was able to create the first application (CGI Application) as directed.  I was able to compile it successfully (Run/Quick compile).  However the normally green arrow used to launch the application was not illuminated, so I couldn't run the application.
A CGI application does not run on its own (it is an extension for an existing/running server). To my knowledge there is no default provision in Lazarus configured for that.

Quote
Are these bugs in 3.2 that I am finding or is it me?
Wiki tutorial not being updated and rough edges (though the latter, I am not sure if Lazarus should also be able to act as a http daemon)

nummer8

  • Full Member
  • ***
  • Posts: 111
Re: New to internet programming frustrations
« Reply #5 on: March 31, 2024, 12:55:47 pm »
Marcus Fernstrom wrote a few articles on freepascal and internet on medium

https://medium.com/@marcusfernstrm

Serving static webpages
https://medium.com/@marcusfernstrm/serve-static-webpages-with-freepascal-c0d9c9dee352


Creating Rest API's
https://medium.com/@marcusfernstrm/create-rest-apis-with-freepascal-441e4aa447b7

and several related issues.

Thaddy

  • Hero Member
  • *****
  • Posts: 14376
  • Sensorship about opinions does not belong here.
Re: New to internet programming frustrations
« Reply #6 on: March 31, 2024, 07:17:58 pm »
Thanks for the suggestions.
I successfully loaded the fpweb package.
Which is strange because it is already in the fpc distribution. Such things can only cause harm.
and fcl-web is packed full of examples. fcl-web used to be called fpweb so that is definitely old.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

egsuh

  • Hero Member
  • *****
  • Posts: 1292
Re: New to internet programming frustrations
« Reply #7 on: April 02, 2024, 08:38:59 am »
Hello,

The Tutorial is outdated --- recent Lazarus is slightly different.
You may add Webmodule at the creation of New (Http server) application, as in the attached image. Probably the red-circled part is not in the tutorial.

But as you have already created the project (without webmodule), you can add it. Go to main menu File > New > WebModule, and press OK. Then you may resume at #5 of the Tutorial.


Quote
4. Whatever you choose, pick "OK" and you'll be presented in the default one module fpWeb app.

5. Focus the module and move to Object Inspector. Feel free to rename the module if you wish.

Don't get frustrated. Here are some people to advise you.
« Last Edit: April 02, 2024, 08:40:36 am by egsuh »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: New to internet programming frustrations
« Reply #8 on: April 02, 2024, 12:36:20 pm »
The Tutorial is outdated --- recent Lazarus is slightly different.
Part is me to blame as the original author of the article, I assume people will contribute and update accordingly. Turns out my assumption is wrong.
Is it possible to use fpweb with a straight Application rather than the HTTP Server Application or the CGI Application?  If so, is there a tutorial on how to do that?
You can even use it without any IDE, just a text editor. As written in the New Mechanism part of my tutorial:
Code: Pascal  [Select][+][-]
  1. uses
  2.   fphttpapp, httpdefs, httproute;
  3.  
  4. procedure DoHello(ARequest:TRequest; AResponse : TResponse);
  5. begin
  6.   AResponse.Content:='<html><body><h1>Hello,World!</h1></body></html>'
  7. end;
  8.  
  9. begin
  10.   HTTPRouter.RegisterRoute('*', @DoHello);
  11.   Application.Port := 9000;
  12.   Application.Initialize;
  13.   Application.Run;
  14. end.
  15.  
is all you need to get a working "Hello, World" example. I should probably write a new tutorial ignoring everything that uses the form designer or even the IDE wizard.

 

TinyPortal © 2005-2018