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 - Allen Miglore

Pages: [1] 2 3
1
Programming / Re: creating UTF-8 text file
« on: March 10, 2024, 10:43:05 AM »

2
Wish List / Re: string interpolation
« on: November 15, 2023, 10:20:17 AM »
I agree, this is a handy feature of many languages.  I wrote a function to do something similar a while back and use it internally in UnForm.

def fn%resolveexpr$(local s$)
   local x,expr$,before$,after$,val$,between$
   s$=sub(s$,"\{",$01$),s$=sub(s$,"\}",$02$)
   x=msk(s$,"{[^{}]*}")
   while x>0
      before$=s$(1,x-1),between$=s$(x+1,msl-2),expr$="str("+s$(x+1,msl-2)+")",after$=s$(x+msl)
      val$=$01$+between$+$02$,val$=evs(expr$,err=*next)
      s$=before$+val$+after$
      x=msk(s$,"{[^{}]*}")
   wend
   s$=sub(s$,$01$,"{"),s$=sub(s$,$02$,"}")
   return s$
end def

It works with anything that can be resolved with evs().

a=123, b$="456"

?fn%resolveexpr$("This is a: {str(a:""###0.00"")}, this is b$: {b$}")
This is a:  123.00, this is b$: 456

Internal braces can be escaped:

?fn%resolveexpr$("This is a: {str(a:""###0.00"")}, this is b$: \{b$\}")
This is a:  123.00, this is b$: {b$}


3
Language / Re: TCB(44) Always a Positive Number?
« on: July 10, 2023, 01:42:30 PM »
I've found tcb(44) is negative east of 0-time UTC.  You can add the value to local time to get UTC or subtract it from UTC to get local time.  I've never had to deal with tcb(45) as tcb(44) takes it into account.  Right now, on my local systems, tcb(44) is 25200, so represents the 7-hour offset when California is in daylight savings time.

4
Programming / Re: merging PDFs
« on: March 28, 2023, 05:50:13 PM »
We use Ghostscript.  Not pvx, but just an invoke away, and available on both Windows and Linux.

5
Language / Re: *X Mnemonic / Print Channel Timing Question
« on: March 07, 2023, 10:32:59 AM »
This aligns with the documentation. I found that the behavior changed way back at pvx 6.

'*X' (asterisk X) contains the pathname of a program to CALL on the closing of a channel. When a file is closed, PxPlus issues a CALL to the program/entry point specified by the contents of '*X'. This takes place just prior the file being actually being closed, allowing the program to alter the contents of the file if desired.

6
Language / cvs base64:ascii bug
« on: November 13, 2022, 11:13:25 AM »
I think there is a bug in the cvs() base64 decode function.  If the input data ends with a newline, an extra $00$ is added to the decoded data.  I tested this in pxplus 14 and pxplus 19.

a$=cvs("test","ascii:base64")
print hta(cvs(a$,"base64:ascii"))
74657374
print hta(cvs(a$+$0a$,"base64:ascii"))
7465737400

7
Language / Re: Using libssl with PXP_SSL_LIB
« on: November 05, 2022, 01:05:32 PM »
Sounds like the days of having a universal Linux build are over.

8
Language / Using libssl with PXP_SSL_LIB
« on: November 04, 2022, 06:04:50 PM »
I saw that in pxplus 17 two environment variables were added to specify libssl and libcrypto shared object files.  I've added those and confirmed these libraries are on the system:

env|grep PXP
PXP_CRYPTO_LIB=/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
PXP_SSL_LIB=/usr/lib/x86_64-linux-gnu/libssl.so.1.1

I start up pxplus 18.20, and try to open a secure connection to pvxplus.com:

open(1)"[tcp]pvxplus.com;443;secure"
Error #99: Feature not supported
Last IO to [tcp]pvxplus.com;443;secure, channel 1
Could not locate entry point 'SSLv23_client_method' in libssl library.
Likely an incompatible SSL Interface. (err/ret=0/0)

What am I missing?

9
Programming / Re: Does PID Exist
« on: May 20, 2021, 09:47:27 AM »
The sys() function can be used.

if sys(pid)=0 then exists=1


10
Off Topic / Re: Suggestions for Cloud servers provider?
« on: March 23, 2021, 05:24:47 PM »
We use both AWS and Ionos, without any performance or reliability issues.

11
Language / Re: Serial data stream
« on: February 27, 2021, 06:02:41 PM »
You could do your own buffering.

open create (unt,isz=1)"testfile"
chan=lfo
for i=1 to 100
   rec$="test block "+str(i)+$04$
   write record(chan)rec$
next i
close(chan)

open input(chan,isz=1)"testfile"
buf$=""
while 1
   read record(chan,end=*break,bsy=*continue,tim=1,siz=-128)block$
   buf$+=block$
   x=pos($04$=buf$)
   while x>0
      rec$=buf$(1,x-1),buf$=buf$(x+1)
      recs$+=rec$+$0a$ ! do whatever with the record
      x=pos($04$=buf$)
   wend
wend
close(chan)

print recs$


12
Programming / Re: Converting UTC to local time
« on: December 22, 2020, 12:37:52 PM »
I've written a few functions over the years.  Maybe they'll help.

These two convert between utc seconds and julian (where julian includes a fractional part).

def fn%utcsectojul(local secs)=jul(1970,1,1)+(secs-tcb(44))/86400
def fn%jultoutcsec(local dtm)=(dtm-jul(1970,1,1))*86400+tcb(44)

These two produce text versions of a given date/time julian in universal or local time.

def fn%utctime$(local dtm)
 let dtm+=tcb(44)/86400
 return dte(int(dtm),24*fpt(dtm):"%Ds, %D %Ms %Yl %Hz:%mz:%sz +0000")
end def
def fn%localtime$(local dtm)
 local time
 return dte(int(dtm),24*fpt(dtm):"%Ds, %D %Ms %Yl %Hz:%mz:%sz")+" "+str(-tcb(44)/3600:"+00")+str(60*fpt(-tcb(44)/3600):"00")
end def

14
Language / Re: WINDEV with redirected printer
« on: April 15, 2020, 04:23:56 PM »
Cirrusprint is our companion product to UnForm.  It could provide a solution for remote printing.  If you'd like to check it out, please contract us offline at our support address (which of course you know...)

15
Programming / Re: mailto attachment
« on: November 11, 2019, 12:22:27 PM »
No - just a few header fields plus a special field called "body".  If a mailto url could get you to send an attachment, a website could be requesting some pretty sensitive information.

https://tools.ietf.org/html/rfc6068

Pages: [1] 2 3