Subscribe for automatic updates: RSS icon RSS

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

Pages: 1 2 3 [4] 5 6 ... 10
 31 
 on: March 13, 2024, 09:03:03 am 
Started by Francois G. - Last post by Rene S.
Try this:

Code
  1. MAIN
  2.    DEFINE s STRING
  3.    LET s = 'ab€c d'
  4.    DISPLAY SFMT("s:%1 l:%2 w:%3 number_of_logical_chars:%3",
  5.        s, length(s), fgl_width(s), number_of_logical_chars(s))
  6.    LET s = '123456'
  7.    DISPLAY SFMT("s:%1 l:%2 w:%3 number_of_logical_chars:%3",
  8.        s, length(s), fgl_width(s), number_of_logical_chars(s))
  9. END MAIN
  10.  
  11. FUNCTION number_of_logical_chars(s STRING) RETURNS INT
  12.    DEFINE i, l, n INT
  13.  
  14.    LET l = s.getLength()
  15.    LET i = 1
  16.    LET n = 0
  17.    WHILE i <= l
  18.        VAR c = s.getCharAt(i)
  19.        LET i += c.getLength()
  20.        LET n += 1
  21.    END WHILE
  22.    RETURN n
  23. END FUNCTION
  24.  

BTW: if the string not contains double-width East Asian characters, fgl_width will do the job.

 32 
 on: March 12, 2024, 10:44:14 am 
Started by Nuno T. - Last post by fada b.
Quote
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:
backrooms game

```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.
I understand, thank you very much.

 33 
 on: March 12, 2024, 10:08:28 am 
Started by Francois G. - Last post by Sebastien F.
No need to wait for Monday
Please contact me directly
Seb

 34 
 on: March 12, 2024, 09:56:51 am 
Started by Francois G. - Last post by Francois G.
Thanks Seb,

We usually have a call with Michelle and Neil on Monday mornings: would you be able to attend, or at least discuss with Neil?

Regards,

 35 
 on: March 12, 2024, 09:53:00 am 
Started by Francois G. - Last post by Sebastien F.
Hello François,

NO!!! You should not have to write such code to split UTF-8 strings at byte level to insert the text into the SQL database!

Please let's have a call to discuss this.

Seb

 36 
 on: March 12, 2024, 09:48:24 am 
Started by Francois G. - Last post by Francois G.
Hi,

Given LANG=en_GB.utf8 and FGL_LENGTH_SEMANTICS unset (defaulting to byte), and given a text typed in by the user containing emojis, accents, UK pound sign (£), quotes and double quotes from a word processor (3-byte UTF-8 characters), I need to be able to split this text into several Informix records (each 200 bytes long) at a UTF-8 character boundary (not at a byte boundary), as well as cut off a string at a certain byte length, but without damaging any UTF-8 towards the end (cut earlier than the byte length, so that all multi-byte UTF-8 characters keep their integrity).

How do I iterate through a STRING, one multi-byte UTF-8 character at a time (not one byte at a time) without changing FGL_LENGTH_SEMANTICS ?

I am currently using a horrible hack:

    FOR f_i = 1 TO f_note_text.getLength()
        LET f_utf8 = f_note_text.getCharAt(f_i)
        LET f_b64  = util.Strings.base64EncodeFromString(f_utf8)
        IF f_b64.getLength() = 4 AND f_b64 MATCHES "*==" THEN
            # 1 byte, 7-bit US ASCII, less than 0x7F
        ELSE
            # More than 1 byte, 8-bit, or byte more than 0x7F, either valid part of a UTF-8 character, or invalid part of a broken UTF-8 character
        END IF
    END FOR

With this semantics, ORD() and ASCII() are less than useful for this purpose.

I can also use "hexdump -C" from  the Linux backend and get all the bytes that I need, but this is very heavy and slow.

In C# there is a function for this:

    bytes = Encoding.UTF8.GetBytes(f_note_text);

Finally I could also write a C shared library (SO file) to do this.

Is there a native 4GL / BDL way to achieve this?

Regards,

 37 
 on: March 12, 2024, 05:32:58 am 
Started by Lu?s T. - Last post by acacia s.
I am trying to secure our webservices uing oAuth.
As I did not find anything natively implemented in Genero (I just found some examples of using oAuth as client, not as a server) I am trying to implement it by myself.
In oAuth the invocation of the webservices receives a Jason Web Token (JWT) in the header that should be validated to confirm the caller as access to the webservice.
The JWT is signed to garantee its integrity and it is when trying to validate the signature where I get stucked.
The signature algorithm is 'RS256' and I am trying to use xml.Signature.verifyString. When I try to set the Signture Key, using The CryptoKey class I get an error.
Code:
let key = xml.CryptoKey.Create("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
call  key.loadPEM("ciiSBqKB2SY_hcvJdxgzR.pem")
This is the stderr when I run it in AIX (I have set the FGLWSDEBUG variable):
Code:
WS-DEBUG (Security Info)
OpenSSL 1.1.1g  21 Apr 2020
WS-DEBUG END

WS-DEBUG (Security Warning)
Crypto library doesn't have any ZLIB compression algorithm.
WS-DEBUG END

WS-DEBUG (Security Warning)
SSL library wasn't compiled with support of RLE compression.
SSL library wasn't able to initiate the ZLIB compression library.
WS-DEBUG END

WS-INFO (Certificate authority) | Loading from directory /usr/informix/gnrdev1/fgl/web_utilities/certs | Loading from directory /var/ssl/certs
Program stopped at 'teste.4gl', line number 17.
FORMS statement error number -15648.
Xml security operation failed : xmlsec library function failed.
An this the output in Linux
Code:
WS-DEBUG (Security Info)
OpenSSL 1.1.1g  21 Apr 2020
WS-DEBUG END

WS-DEBUG (Security Warning)
Crypto library doesn't have any ZLIB compression algorithm.
WS-DEBUG END

WS-DEBUG (Security Warning)
SSL library wasn't compiled with support of RLE compression.
SSL library wasn't able to initiate the ZLIB compression library.
WS-DEBUG END

WS-INFO (Certificate authority) | Loading from directory /opt/informix/gnr-devstudio-3.20.09/fgl/web_utilities/certs | Loading from directory /etc/ssl/certs | Loading from directory /etc/pki/tls/certs
Program stopped at 'teste.4gl', line number 17.
FORMS statement error number -15648.
Xml security operation failed : crypto library function failed : openssl error: 151584876: PEM routines: get_name no start line.
I attached the pem file. Thanks

Looks like there's something wrong in your code.

 38 
 on: March 11, 2024, 06:20:10 pm 
Started by Christine R. - Last post by Christine R.

 Genero Enterprise 4.01 Maintenance Release :
Genero Browser Client 4.01.22


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

What's new ...
  • The setting for rowAspect style attribute is changed from "card" to "list".
  • The table menu refers to the menu that allows users to show or hide specific columns, autofit columns depending on the size of the window, and reset the table to its original state.
  • Some mobile front calls are now implemented as standard front calls.
  • The $theme-sidebar-show-child-name variable is added to allow you change how applications are displayed in the Application List on the sidebar.

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


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


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

 39 
 on: March 11, 2024, 05:17:30 pm 
Started by Christine R. - Last post by Christine R.

 Genero Enterprise 4.01 Maintenance Release :
Genero Report Engine 4.01.12


Four Js is pleased to announce a Maintenance Release of Genero Report Engine 4.01.12.

This version includes the following bug fixes: https://4js.com/support/issue/GRE/4.01.11-4.01.12.

It is now downloadable from the web site : 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

 40 
 on: March 11, 2024, 10:30:26 am 
Started by . - Last post by Tady D.
Quote


I think your expectation is correct. :focus should remain the highest priority, so in your example (:focus = orange, :empty=red) the field would be red until it got focus, then would become orange. On exiting the field it would either revert to red if left empty or default to normal if an entry has been made. This should only happen after the field has been exited - not during edit.

If the field is the first entry field it would still start orange because it has focus and only ever go red if the user moves off the field having left it blank. This would work because the users focus has already been drawn to the field because it was the first field.

Thanks
snow rider 3d

Jeff
I also agree with your point of view. Priority must be given to orange before this is the core to attract attention.

Pages: 1 2 3 [4] 5 6 ... 10
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines