Active Threads | Active Posts | Unanswered Today | Since Yesterday | This Week
Program Development Jump to new posts
Re: xcall JSON opcode 3 & 4 John Andreasen 25 Apr 25 05:48 PM
OK, thanks for the fix. It is working for me now as well.
2 19 Read More
Program Development Jump to new posts
Re: xcall JSON opcode 3 & 4 Jack McGregor 25 Apr 25 12:35 AM
Definitely two bugs there, one of them harmless (the return status on op 3), the other one pretty bad. I think they're both fixed in 1771.4 ...

ash-7.0.1771.4-w32-upd.zip
ash-7.0.1771.4-w32c-upd.zip
ash-7.0.1771.4-d12-x86_64-upd.tz
2 19 Read More
Program Development Jump to new posts
xcall JSON opcode 3 & 4 John Andreasen 24 Apr 25 10:10 PM
Hi,

I am attempting to use xcall JSON with opcode 4 to unescape a string. I seem to be experiencing an issue which is reproduceable with the below program.
Code
MAP1 response$,s,132
MAP1 sts,f,6

	response$ = "t"+CHR(34)+"est"
	Trace.Print response$
	XCALL JSON, 3, sts, response$
	Trace.Print sts, response$
	! Process response string.
	XCALL JSON, 4, sts, response$
	Trace.Print sts, response$
	END

Which produces the following traces on 7.0.1770.1 EL7:
response$=[t"est]
sts=[0], response$=[t\"est]
sts=[1], response$=[teest]

It appears that the e gets duplicated and the " gets completely removed with opcode 4.
Also, shouldn't the status from opcode 3 be 1 instead of 0 since 1 character (the quote) was escaped?

Thanks,
John Andreasen
Diversified Data Software
2 19 Read More
Environment - UNIX / Linux Jump to new posts
Re: Debian 12 lslk cannot execute: required file not found Jack McGregor 23 Apr 25 11:50 PM
I think we included lslk in order to use it with LOKUTL.LIT, but I'm not sure anyone has any interest in that utility any more. I'll look into whether it's practical to include lslocks (i.e. doesn't create any conflicts with other packages) and whether LOKUTL can be updated to work with it).
3 25 Read More
Environment - UNIX / Linux Jump to new posts
Re: Debian 12 lslk cannot execute: required file not found Stephen Funkhouser 23 Apr 25 11:29 PM
OK, I don't remember the reason the lslk file is in the bin directory when you install from a .bin file, but it should be removed, and either have the lslocks or no file on Debian 12?
3 25 Read More
Environment - UNIX / Linux Jump to new posts
Re: Debian 12 lslk cannot execute: required file not found Jack McGregor 23 Apr 25 09:26 PM
lslk seems to have fallen out of favor in newer Linux distros, with lslocks taking it's place.
3 25 Read More
Environment - UNIX / Linux Jump to new posts
Debian 12 lslk cannot execute: required file not found Stephen Funkhouser 23 Apr 25 09:24 PM
Just as the title states, when attempting to run lslk in the %miame%/bin directory we get the follow error
Code
cannot execute: required file not found


I search the interwebs for how to install lslk, and came up with nothing
3 25 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP John Andreasen 22 Apr 25 02:08 AM
This has fixed the issue. Thanks
9 80 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP Jack McGregor 22 Apr 25 12:46 AM
Interesting. Looks like a dyslexic slip-up. I think it should be resolved in the 203 update of the library...

ashnet-1.14.203-w32.zip
libashnet.so.1.14.203-el7.tz
libashnet.so.1.14.203-d12-x86_64.tz
9 80 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP John Andreasen 22 Apr 25 12:21 AM
Hi Jack,

For some reason when I am using this, it seems the headers and response are separated by <LF><CR> instead of <CR><LF>.
[Linked Image]
Is this a mistake or is the CR a side effect of something else? I have an example program I can send if needed.
9 80 Read More
Program Development Jump to new posts
Re: .ISEMPTY() effiecny question Stephen Funkhouser 21 Apr 25 09:29 PM
Good to know. Thanks
2 29 Read More
Program Development Jump to new posts
Re: .ISEMPTY() effiecny question Jack McGregor 21 Apr 25 06:14 PM
Offhand I would say definitely, a built-in function is going to be faster than a user-defined function doing the same thing. Then again, .ISNULL() actually handles a couple of cases that yours doesn't (i.e. the case where the argument equals .NULL and the case where the argument is a string, possibly containing blanks.) But for what it's worth, here's a test program to measure it ...
Code
! test performance of .isempty(x) vs a function

define ISNULL_TRUE = -1

map1 usecs,b,4
map1 x,x,0
map1 i,f
map1 b,b,1

	x = fill(chr(0),30)
	xcall TIMES,3,usecs
	for i = 1 to 1000000
		b = fn'isnull(x)
	next i
	xcall TIMES,3,usecs
	? "fn'isnull(x) -- "; usecs/1000000; " usecs per call"

	xcall TIMES,3,usecs
	for i = 1 to 1000000
		b = .isempty(x)
	next i
	xcall TIMES,3,usecs
	? ".isempty(x) -- "; usecs/1000000; " usecs per call"
end

FUNCTION fn'isnull(var as x0:INPUTONLY) as b1
	IF (var = fill$(CHR(0),LEN(var))) THEN
		fn'isnull = ISNULL_TRUE
	ENDIF
ENDFUNCTION

On my laptop, the results are as follows (and it's pretty consistent, within a range of +/- 10%) ...
Code
.run isemptyx
1 million fn'isnull(x) --  2.35262
1 million .isempty(x) --  0.465129

So as expected, the built-in function is faster (about 5X), even though it's actually more complex. On the other hand, even the slow poke here is only burning up a couple of microseconds per call (and that's including the overhead of the FOR/NEXT loop and the XCALL to measure the time).

Just for kicks I re-arranged the loops so they performed the function call 10 times in line for each loop iteration, instead of once, which in theory should reduce the FOR/NEXT overhead 10 fold, and that shaved about 3 tenths of a microsecond off the above values, i.e.
Code
.run isemptyx2
fn'isnull(x) --  2.06697  usecs per call
.isempty(x) --  0.191827 usecs per call

So the real differential appears to more like 10X!
2 29 Read More
Program Development Jump to new posts
.ISEMPTY() effiecny question Stephen Funkhouser 21 Apr 25 04:56 PM
We have the following function for testing if an xvar is null. I believe this came from the SOSLIB. Would it be more efficient to use .ISEMPTY() for this?

Code
FUNCTION fn'isnull(var as x0:INPUTONLY) as b1

	IF (var = fill$(CHR(0),LEN(var))) THEN
		fn'isnull = ISNULL_TRUE
	ENDIF
ENDFUNCTION
2 29 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Stephen Funkhouser 19 Apr 25 01:50 PM
That works. Thanks
22 191 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Jack McGregor 19 Apr 25 12:52 AM
22 191 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Stephen Funkhouser 18 Apr 25 10:14 PM
We're storing each array element as a separate column in the database.

So, inventory.price(2,2) will be price_1_1, price_1_2, price_2_1, price_2_2

The same goes for 3 dimensions.
22 191 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Jack McGregor 18 Apr 25 09:47 PM
How do you convert ary(x,y,z) into a single #?

((x-1) * .extent(ary(1))) + ((y-1) * .extent(ary(2))) + z ?
22 191 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Stephen Funkhouser 18 Apr 25 09:35 PM
I just finished testing this, and it works as expected.

Unfortunately, we have a ton of multidimensional arrays nested in DEFSTRUCTS. I think (x, y, z) is the largest dimension. I just looked at the documentation specific to FETCHR_DYNFLDNUM
22 191 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP John Andreasen 16 Apr 25 07:25 PM
This seems to be working. Thank you
9 80 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP Jack McGregor 15 Apr 25 01:14 AM
Ok, I think this is ready to go. It only requires an update to the ashnet library ...

ashnet-1.14.202-w32.zip
libashnet.so.1.14.202-el7.tz
libashnet.so.1.14.202-d12-x86_64.tz

The notes are pretty straightforward:
Quote
1. LIBASHNET update - libashnet.so.1.14.202 supports the ability to request
response headers along with the response body in a POST request by combining
both the XHTTPF_REQPOST and XHTTPF_REQHEAD flags. The headers will be at
the start of the response, separated from the body by a blank line.
9 80 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Stephen Funkhouser 11 Apr 25 09:25 PM
I will work on testing this early next week.

Thanks,
22 191 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP John Andreasen 11 Apr 25 04:08 PM
OK, sounds good. Thank you
9 80 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP Jack McGregor 11 Apr 25 03:49 PM
That sounds sensible to me. So we'll define a new flag XHTTPF_HDRRESP (or perhaps use the existing XHTTPF_REQHEAD) which if specified along with XHTTPF_REQPOST, will cause the headers to be prepended to the response with a blank line separating them from the rest of the response. It will just require an update of the ashnet library.

I'll shoot for early next week.
9 80 Read More
Program Development Jump to new posts
Re: Receive Headers from xcall HTTP John Andreasen 11 Apr 25 03:35 PM
I think any of those options would work. It seems like in the second option that you would be able to separate them as the headers would be at the beginning of the response and could be separated from the body of the response by a single blank line (as it is in the actual HTTP protocol.)
9 80 Read More
ASQL Jump to new posts
Re: SQLOP_FETCH_ROW into a DYNSTRUCT Jack McGregor 11 Apr 25 03:20 PM
Perfect - that's exactly what we are hoping developers will do! Thank you!
22 191 Read More
Page 1 of 3 1 2 3
Powered by UBB.threads™ PHP Forum Software 7.7.3