PxPlus User Forum

Twitter Twitter Twitter

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.


Messages - bteixeira

Pages: [1] 2
1
iNomads / File Upload
« on: March 08, 2024, 04:57:18 PM »
Looking into allowing users to upload some files but worried that there seems little control.  Is there any way to limit the files a user can upload based on file type and/or size?  %inomads'upload_file doesn't seem to have any limitations.  I'm planning on saving the file to a directory and run a command line virus scan on it, but it would be better if I could do that on the web server and then move the approved file to the application server after it's been scanned.  Is there any way to put the upload file in the session's tmp directory or something?
Thanks.

2
Programming / Apache HTTP Interface
« on: January 03, 2023, 11:46:20 AM »
The HTTP interface, where you receive a request and are writing to %print_fn with the html (or xml or json or whatever) that you want to return... does it have to be Apache?  In the documentation there's clearly scripting info in a .cgi file to say start PxPlus and runs *plus/apache/pxp_cgi.  Is there anything in there that requires Apache rather than a different web server?  For example, could I have an equivalent script in IIS that runs PxPlus *plus/apache/pxp_cgi and it will forward the web request and return the response to IIS?

3
Language / JSON DIM LOAD
« on: September 15, 2021, 09:44:24 AM »
If I have a JSON array that's basically different records something like:

[{"name":"Alice","type":"A","balance":"123.45"},{"name":"Bob","type":"A","balance":"6543.21","extra-field":"1","extra2":"2"}]

if I do

dim load array${all}=json$

The results are:
array$["1.name"]="Alice"
array$["1.type"]="A"
array$["1.balance"]="123.45"
array$["2.name"]="Bob"
array$["2.type"]="A"
array$["2.balance"]="6543.21"
array$["2.extra-field"]="1"
array$["2.extra2"]="2"

What I'm looking for is a way to get the JSON string of the whole first element.  So something like
array$["1"]="{""name"":""Alice"",""type"":""A"",""balance"":""123.45""}"

Is there a way to do that?

4
iNomads / Re: Communicate with *browser object
« on: May 17, 2021, 02:28:26 PM »
Using the .click() function seems to trigger the button on change logic so if I include that in the javascript listener for the API I can automatically trigger the %inomads'js_eval().  I could probably even set it up as on focus logic on a multiline and use the .focus() javascript function to trigger that.

5
iNomads / Communicate with *browser object
« on: May 17, 2021, 10:24:48 AM »
I'm trying to integrate my iNomads application with a third party API.  Using the *browser object, I get an iframe that navigates to the other website where the user can enter data and we get an Ajax response.  I'm able to parse this response and put the data I need into multi-lines on the iNomads page.  What I haven't been able to figure out though is how to post that data back to PxPlus process to use.  If I click into the field and press enter the on it looks like the data for that field gets pushed and the onchange logic fires off.  Is there a way (presumably in javascript) to simulate this or otherwise push the data?

6
Language / Re: Force screen refresh in iNomads
« on: November 18, 2020, 04:41:06 PM »
Inspecting %inomads'* shows a 'redraw() method that seems to do what I need but isn't documented anywhere.  Anyone know if this is safe to use / which version it was added in?

7
Language / Force screen refresh in iNomads
« on: November 18, 2020, 02:05:08 PM »
Is there a way to force a screen refresh in iNomads?  refresh_flg=1 does not seem to do it.  I'm particularly interested in changing the template in code %inomads'template$="newtemplate" and then redrawing the current screen with the new template.

8
Language / *browser and reCAPTCHA
« on: October 21, 2020, 02:22:57 PM »
I'm getting mixed results trying to navigate to sites with a reCAPTCHA using *browser.  I think it might be version based.  I have a client running v14 and the reCAPTCHA won't load but in my office on v16 it does.  Captchas have been around for ages so I'm a little surprised that an older version of *browser wouldn't be able to handle it.  Are you aware of anything that may have changed between versions that would allow reCAPTCHA to start working?  Is there a minimum version for this or a setting to turn on so the old version will display properly?
Thanks,

9
Language / finditemtext$ and load on demand
« on: September 10, 2020, 06:07:49 PM »
Is there a way to get finditemtext$ and load on demand to work at the same time.  Right now it looks like finditemtext will only search loaded rows.

10
Programming / [odb] / [mysql] escape characters
« on: August 13, 2020, 04:21:49 PM »
We have code writing to a database using the [odb] tag.  It works well generally, however at one client, they are using a MySQL server.  MySQL needs backslashes to be escaped (especially at the end of a field where it would end up escaping the quote delimiters).  If using the [odb] tag, a backslash in data is not getting escaped.  Would using the [mysql] tag instead resolve this?  Is there an option or setting that would let us use the [odb] tag still but correctly escape the backslashes?

11
iNomads / iNomads Class for Queries
« on: August 04, 2020, 11:30:28 AM »
I don't see a place to put an iNomads class on query panels.  I at least need a way to distinguish that the panel is a query.
Additionally, is there a way to have query columns auto-size?  The query screen is maximizing to the browser, which is good but the columns stay small and it looks really bad.
Thanks

12
Language / Re: TCP channel, is it alive?
« on: February 13, 2020, 10:00:39 AM »
We'll try the keep alive option.  A one minute response is better than what we're currently seeing without a tim= branch of 10+ minutes (possible indefinite) while waiting on a read

13
Language / Re: TCP channel, is it alive?
« on: February 11, 2020, 04:20:02 PM »
Mike,
     I tried opening the channel and then forcing a disconnect and doing a write record.  PxPlus neither threw an error nor waited, I think it just went into some sort of system buffer.  I re-established the connection and the device picked up the command.  Is there anything on the write I could do to not buffer but instead throw an error if the connection is down?  That could work for us in this scenario.

The only way you can know if a TCP connection has dropped is basically by sending something to it and waiting for the packet acknowledgement.  This is effectively what KEEP-ALIVE does however the KEEP-ALIVE timeout is generally over 1 minute, so likely not suitable for this situation.

Using a TIM= is about the best I can suggest.  Perhaps with a longer timeout on the first character.

14
Language / TCP channel, is it alive?
« on: February 11, 2020, 02:53:25 PM »
At one of our clients, we're trying to communicate with a device via TCP but the connection isn't great.  We're having difficulty telling if the device is still working on the command and hasn't replied yet or if the connection has dropped.  The basic code looks like:

write record(tcp_chan)"command goes here"
while 1
read record(tcp_chan,tim=5)resp_segment$
let response$+=resp_segment$
if pos(end_of_message$=response$) then goto *break
wend

If the connection has dropped we want to know as soon as possible and then we can try re-opening the channel, request the last command, prompt the user to reset the device etc.  Without a tim= branch we can sit there way too long.  However the device may legitimately take a long time to process the command, especially if human interaction is involved it could take well over a minute.

Is there a way to determine if the connection has dropped or if the device is just taking a long time to process?

15
Language / Re: DIM (FIND ) and LIKE
« on: October 04, 2019, 10:32:58 AM »
So to the original question, is there a way to find the first element of an array that contains a substring without using a for loop?

Pages: [1] 2