Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Stéphane Devouard

#1
General Announcements / Re: Forum Upgrade
July 09, 2024, 09:40:32 AM
Hopefully the new forum app won't add extra linefeeds to my posts

And I won't have to edit them after posting

Let's see...

EDIT : it worked !!! :)
#2
Phil

Well, this just says that the pvxtcp.c (the module / library where the TCP layer of the interpreter is located, I suppose) is now on Devon's local SVN repo after 40+ years being on Mike's machine  ;)

Running services in Windows with the LocalSystem account has always been a major pain.

The underlying issue here is probably some security credentials as pointed out by Loren.
Make sure that the pxplus directory tree is accessible as this is probably somewhere in the lib sub-folders that PxPlus creates files for the web sessions
#3
Hi Phil

You could try to create the *ezweb/logs directory and see if EZWEB logs any error message in it
#4
Programming / Re: Why use PVX?
June 22, 2024, 04:52:25 AM
Sorry for the late response, been away for a few days

I agree with all of the above

On the new blood attractiveness of the language, I had the bad luck of one year of unemployment with the good luck of a web development training funded by the french unemployment agency. I learned PHP, Javascript, Java / C# programming. And refreshed / upgraded my OOP knowledge.

Youngbloods can download PHP, Java or C# on their machine and start programming straight away without paying anything. They don't have to re-init ACTIVATE.PVX with a demo key after 30 days, and they don't have to consider paying a license if they want to test their app with data files above 5000 records.

Youngbloods are shown code editors and IDEs such as VScode, Eclipse, Jetbrain's PHPStorm, etc... So they may be a bit surprised when they see *IT, a little less when they see ED+. Don't show them *e :) The new PxPlus VScode extension in the last PxPlus version is great. However it's limited to PxPlus for Windows at the moment. The great thing with VScode is that it exists for Windows, Linux with GUI and MacOS.

Youngbloods are shown web frameworks that speed up development, often with concepts such as convention over configuration. You put your code in a convention-named script in a convention-based directory, and the framework picks it up by itself when reacting to an URL. No such framework in PxPlus. Because you have to pay for a development license, you want to protect the code and in-house framework you write for your needs. No such thing as open-source in PxPlus, so no ecosystem of ready-to-use modules / libraries. No such thing as PHP's Composer, Python's PIP, Javascript/NodeJS yarn/npm etc... For those not knowing what this is, basically these are package managers, where you can add to your projects/apps external libraries created by others and shared through open-source licenses.

Youngbloods are taught OOP concepts. PxPlus OOP model exists but is a bit different from standard : no 'protected' visibility, no static (=class) members only instance members, no interfaces (another way of implementing inheritance). So even if they know OOP, they have an additional learning curve to get used to PxPlus OOP paradigm.

Youngbloods are taught SQL for data persistence. KEYED files and ISAM b-trees are not concepts you learn nowadays. They have to learn READ/FIND/WRITE/REMOVE/KEY() and understand that they cannot expect a DB engine to optimize their query, they have to know how the files are structured, and they have to join related files in their code. They do not even know about semantic primary keys (customer code, product sku,...), as nowadays everyone design their DB schemas with auto-incrementing integers as primary keys.

I am not saying you shouldn't use PxPlus. I am just describing the difficulties that newcomers to the language may encounter, because I've seen "the other side" after 30 years of Business Basic.

On the other hand, re-developping an app with mainstream languages & framework requires that you re-skill your existing staff on the new technology stack you choose, which takes much more than a few weeks of courses to be productive and efficient. And of course, you cannot freeze your existing code base, so the functional gap keeps widening as you re-develop the app.

IMHO, we PxPlus developers are not to be afraid of AI yet. Generative AIs create source code by analysing and borrowing the petabytes of web pages, blogs and forums where people post code in mainstream languages. There is no such thing in PxPlus. So far I haven't been able to run any of the "PxPlus" code generated by ChatGPT in a pxplus.exe instance :)

My 0.02€
#5
Language / Re: Easiest way to create an XML file
June 04, 2024, 04:44:40 AM
MikeH

Working daily at my job with *obj/xml to handle interfaces with an e-Commerce app API, I haven't been confronted with any memory issue in the last 2 years

*obj/xml represents an XML node, so internally, every single node or subnode of your XML document is an *obj/xml instance
IIRC the powerpoints from 20+ years ago, in PVX OOP, all instances of the same class share the logic (the methods are loaded in memory only once), only the instance data (properties) is distinct.
The actual XML string is created only when you use the 'get_xml$() method

In any case, Mike's logic is the best way to go if you're worried about memory usage

My 0.02€
#6
Nomads / Re: Library Query
May 28, 2024, 10:51:20 AM
Mike

The problem here is the inclusion of TCB(13) in the file name

TCB(13) is not a fixed value throughout your session. It varies depending how deep you are in the CALL stack.
In your main program it is 0.
In a subprogram called / performed from your main program it is 1.
In a sub-subprogram called / performed from your subprogram it is 2.


Doing a PROCESS of a panel or a query is like doing a CALL.
So if you created your temp file in your main program, it was named WKFLT0010.
If you PROCESS a query to read it, that's a CALL, so when the query runtime program tries to resolve the file name, it evaluates to WKFLT0011 which does not exist.

You need to change the way you name your WKFL files if you want to make this work.
#7
Nomads / Re: Library Query
May 28, 2024, 01:13:33 AM
Mike
TCB(13) is the current level in the program call stack
If you create the work file in your main level program, its value will be 0
But PROCESS a panel and it's value is set to 1 or 2 because basically PROCESS is a call to *winproc
Invoke a query from the panel (which is a call to *winproc which then performs *winqry) and now your TCB(13) is 4 or 5
Not sure why you want to include TCB(13) in the file name, but it will never work as you've experienced. If you included this for file name uniqueness, maybe TCB(89) would be a better choice as it is the same whatever level you are in the call stack
Hope this helps
#8
Henderson,

Jeff's suggestion is only an example, you need to check the documentation of the API you're trying to interact with and see what is the name of the html form field that this API expects. If filename does not work, maybe it is file_name or xml_file.
Also make sure that the data in the XML file is escaped using either cvs(..., "utf8:xml") if the data may contain utf8 encoded characters, or cvs(..., "ascii:xml") in case the data contains reserved XML chars such as < >


Jeff,

You can spare a call by using the cvs() function
base64_credentials$ = cvs(raw_credentials$, "ascii:base64")
#9
Jeff

Attached is the PVX helper class I use to upload files to APIs

Use it like this :


field_name$="Name of the form field the webservice is waiting for"
file_name$="Name of the file to upload : this will be the value of the form field above"
file_content$="File content"
file_mime_type$="MIME type of the file to upload, application/octet-stream by default"
upload=new("http.upload",field_name$,file_name$,file_content$,file_mime_type$)
! // use upload'content_type$ as mime_type in the *plus/web/request
! // use upload'body$() as body in the *plus/web/request


The file_content$ variable should be loaded with a binary read of the file


open (hfn,isz=-1) file_name$
file_content$ = rcd(lfo,siz=10000000)


Hope this helps
#10
Cedric

Here is the code I use on Linux to ungzip content returned by some APIs we're working with :


0780 UNGZIP:
0790 ENTER (GZIPPED$)
0800 !
0810 UNGZIPPED$=""
0820 !
0830 GZFILE$="/tmp/pvx/TEMP."+FID(0)+"."+DTE(0:"YYYYMMDD.%Hz%mz%sz")+".gzip"
0840 OPEN CREATE PURGE (HFN,ISZ=-1,ERR=*NEXT)GZFILE$
0850 IF TCB(2)=1 THEN RETURN ""
0860 WRITE RECORD (LFO,SIZ=LEN(GZIPPED$),ERR=*NEXT)GZIPPED$; GZIPPED$=""
0870 CLOSE (LFO)
0880 FOR (GZIPPED$="")
0890 OPEN (HFN,ERR=*BREAK)"<cat "+GZFILE$+"|gzip -d"
0900 UNGZIPPED$+=RCD(LFO,END=*NEXT); GOTO *SAME
0910 CLOSE (LFO)
0920 ERASE GZFILE$,ERR=*NEXT
0930 NEXT
0940 !
0950 RETURN UNGZIPPED$


Hope this helps
#11
Hi Cedric

Check out the DIM CLASS directive : https://manual.pvxplus.com/PXPLUS/directives/dim_class.htm

Hope this helps
#12
Language / Re: ERROR 302 file not found
March 25, 2024, 04:24:12 PM
Hi

HTTP error 302 is not a file not found error but a redirect status

You should use the *plus/web/request http client instead, which will follow redirections

Regards
#13
Phil


When using the SVN interface from PxPlus, programs and Nomads libraries are converted to text when you commit changes to the repo. Each library becomes a folder and each Nomads object (panels, queries, file maintenance, menus) is converted to a text file.
The format of the exported file is not XML, it's more like an INI file format
I believe the conversion program can be called. You'd need to explore the *plus/proj folder to find out.


Hope this helps
#14
Wish List / Re: string interpolation
November 16, 2023, 06:55:57 AM
Thomas

String interpolation exists (kinda) in PxPlus :

print MSG(="Hello, %1 ! Today is %2, it's %3 now.",name$,dte(0:"%Wl"),dte(0:"%Hz:%mz"))
#15
Hi Arno

PxPlus has an interesting concept of LOCAL globals

If you declare
LOCAL %INFO$ in a program

Then %INFO$ will be global in the current stack level and "above"
If there is another similar declaration in a higher stack level, then the current %INFO$ value will be preserved, the new value will replace it, and when dropping to a lower stack level, the preserved value will be restored

Hope this helps