Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: 1 ... 5 6 [7] 8 9 10
 61 
 on: February 23, 2024, 03:35:10 am 
Started by Dave T. - Last post by wilkinson w.

To open a folder with spaces using the os.Path.dirOpen function on a Windows client, wrap the folder path in double quotes. This ensures that the entire path is handled as a single item, with the spaces not construed as separators.

For instance, if the folder location is "C:\Program Files", you can open it with the following code:

import os basketball stars

folder_path = 'C:\\Program Files'
os.startfile('"{}"'.format(folder_path))

This will open the folder without any problems due to gaps in the path.
This is an excellent response, and I am quite appreciative of the fact that you choose to provide it.

 62 
 on: February 23, 2024, 03:29:39 am 
Started by Nuno T. - Last post by william s.
Hello,

I need to do a Restful request to a outside web service, is there a way to use method GET and a json request ?

LET json = {"articleNumber":"800700"}

LET req = com.HttpRequest.Create("https://xxx/GetProductAvailabilities geometry dash " )
        CALL req.setMethod("GET")
        CALL req.setHeader("Content-Type", "application/json")
        CALL req.setHeader("Accept", "application/json")
        CALL req.doTextRequest(json)


I always have this error message:
Program stopped at 'codetest.4gl', line number 63.
FORMS statement error number -15555.
Unsupported request-response feature.

     
If i change to POST, it works, but it is now allowed.

Thanks very much in advance.
The error message you're seeing means that the functionality you're attempting to utilize (sending a JSON payload in a GET request) isn't supported. According to RESTful principles, JSON payloads are often supplied using POST requests rather than GET requests.

If you need to deliver a JSON payload in a GET request, encode the data as query parameters in the URL. Here's an example of how to change your code to accomplish this:


```python
import com.HttpRequest

LET json = {"articleNumber":"800700"}
LET json_string = STRING(json)
LET encoded_json = com.HttpUtility.urlEncode(json_string)

LET url = "https://xxx/GetProductAvailabilities?data=" + encoded_json
 
LET req = com.HttpRequest.Create(url)
CALL req.setMethod("GET")
CALL req.setHeader("Content-Type", "application/json")
CALL req.setHeader("Accept", "application/json")
CALL req.doTextRequest("")
```

In this code sample, the JSON data is first encoded with the 'com.HttpUtility.urlEncode()' method before being attached to the URL as a query parameter. This allows you to include JSON data in your GET request.

Please keep in mind that encoding sensitive information or big payloads in URLs is not recommended due to security and performance concerns. Consider transmitting JSON payloads via POST requests whenever possible.

 63 
 on: February 23, 2024, 03:20:28 am 
Started by Dave T. - Last post by william s.
Hi all,

Does anyone have any tricks to allow a folder to be opened (that contains spaces) with the os.Path.dirOpen method on a Windows client ?

Cheers

Dave

To open a folder with spaces using the os.Path.dirOpen function on a Windows client, wrap the folder path in double quotes. This ensures that the entire path is handled as a single item, with the spaces not construed as separators.

For instance, if the folder location is "C:\Program Files", you can open it with the following code:

import os

folder_path = 'C:\\Program Files'
os.startfile('"{}"'.format(folder_path))

This will open the folder without any problems due to gaps in the path.

 64 
 on: February 21, 2024, 05:04:14 pm 
Started by Jose Edvandro M. - Last post by Jose Edvandro M.
I have a csv file, I'm trying to import it with the LOAD command. However, this file has asmash kartsheader. How do I import the file without importing the first line, which is the header?
If you are trying to import a CSV file with a header using the LOAD command, you can use the IGNORE keyword to skip the first line of the file. Here’s an example:

LOAD DATA INFILE 'filename.csv'
INTO TABLE tablename
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;

The IGNORE 1 ROWS statement tells MySQL to skip the first row of the file, which is the header. This will allow you to import the data from the CSV file without including the header row.

LOAD DATA INFILE works only for mysql.
We work with postgresql, sql server, informix and oracle

 65 
 on: February 21, 2024, 11:22:17 am 
Started by Paul M. - Last post by restore b.
I had the same problem in Genero BDL 4.01.06. happy wheels

 66 
 on: February 21, 2024, 11:04:57 am 
Started by Randy H. - Last post by terro r.
The message "Error calling docXML.loadfromstring" has been recognized as an error. I question whether readXmlRequest() is a preferable choice to readFormEncodedRequest in the case where the input is an XML document rather than a key-value dataset. eggy car

 67 
 on: February 16, 2024, 06:42:48 pm 
Started by Olivier E. - Last post by Olivier E.

 Genero Enterprise 4.01 Maintenance Release :
Genero Browser Client 4.01.21


Four Js is pleased to announce a Maintenance Release of Genero Browser Client 4.01.21.

What's new ...
  • The Home page has been simplified.
  • Some variables from the application launcher have been removed.
  • Rows in a TABLE with FLIPPED attribute or in a SCROLLGRID with WANTFIXEDPAGESIZE=NO can be rendered as cards when the rowAspect style attribute is set to "card".
  • GBC now supports the "position" presentation style attribute at the toolbar level. It can be used to display toolbars individually at the top or bottom of the window, in the chromebar, or to hide the toolbar completely.
  • For clarity and to be consistent with the naming convention chosen for toolBar (instead of toolbar), some CSS classes have been modified.

Please refer to see  https://4js.com/online_documentation/fjs-gbc-manual-html/index.html#gbc-topics/gbc_whatsnew_40121.html


This version also includes the following bug fixes: https://4js.com/support/issue/GBC/4.01.21


It is now downloadable from the website: https://4js.com/download/products/.


All Four Js Genero customers under maintenance have free access to the new release.

Best regards,

Four Js Development Tools

 68 
 on: February 15, 2024, 05:25:18 pm 
Started by Francois G. - Last post by Francois G.
Thanks Olivier,

Useful information indeed.
We will run some experiments and see how we can cleanly terminate the entire process tree of our 4GL app (which itself has called many sub-processes, which also need to be cleanly terminated).

 69 
 on: February 15, 2024, 05:18:23 pm 
Started by Francois G. - Last post by Olivier E.
Hi François,

Does the following "Ask-Reuben" topics answer your questions?

https://4js.com/ask-reuben/ig-74/

https://4js.com/ask-reuben/ig-176/

Olivier


 70 
 on: February 15, 2024, 04:50:32 pm 
Started by Francois G. - Last post by Francois G.
We have  been reading the "Front-end termination" page of the manual (https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_programs_010.html) so we mostly understand how 4GL generally handles that

Pages: 1 ... 5 6 [7] 8 9 10
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines