memcached set not stored - memcached

The following step has followed:
telnet localhost 11211
set Test 0 100 10
get Test
CLIENT_ERROR bad data chunk
ERROR
set amit 2 2 2
get amit
CLIENT_ERROR bad data chunk
ERROR

In my case I was providing the value but the bytes were not exactly what I was mentioning in the set command, for the format of the command is:
set KEY META_DATA EXPIRY_TIME LENGTH_IN_BYTES
so for those who were just copy pasting the command without knowing as to why is it not storing the key and came here for the answer, this might help:
You need to provide the value of exactly the same bytes which you have mentioned in the last parameter of the set command
the following won't work:
also the following won't:
So when you enter the value it has to be exactly the same bytes, like this:

Although you do not ask a specific question, i presume you want to store a value.
You could test with the default example from the Memcached manual.
You define that you want to store a key, but don't specify a value.
The following example specifies that you want to save a key "tutorialspoint", no flags, timeout of 900 and reserve 9 bytes for a value. Those 9 bytes are specified in the next line: "memcached". In your example i don't see a value.
set tutorialspoint 0 900 9
memcached
STORED
get tutorialspoint
VALUE tutorialspoint 0 9
memcached
END

‘set Test 0 100 10’, then enter a value which the length is equal to 10。

the set command takes 4 arguments:
key - this is an arbitrary key you'll later use to retrieve the value
flag - use 0 for no flags
ttl - time to live in seconds. this is how long memcache will hold your value.
size - in bytes. Byte count of your value.
In my case I was neglecting to calculate the number of bytes and that was why I kept getting the "client error bad data chunk" error

Related

maxTableColumnSize in .ipsproject-File

I need to store a String of at least 2000 chars in the database, but i get the following validation message in Faktor-IPS:
Spalten-Size erreicht das Limit [1..255]
I found the PersistenceOptions in the .ipsproject-File and the attribute maxTableColumnSize - which is set to 255. If I change this value to 2000, all seems fine. Are there other effects if this value is changed or is this attribute only used for the validation?
The 'maxTableColumnSize' is only used for this validation and should be set according to your database implementation. Typical values can be found here: https://blog.faktorzehn.de/2021/06/faktor-ips-persistenz-optionen/?lang=en

Is it valid that two FIX messages are sent together in one go?

My QuickFIX client is complaining that the body length is not expected.
After checking, it is found that it receives a message which actually contains 2 messages (2 different MsgTypes <35>). Also, 2 BeginStrings <8>
Is it a valid message?
The error is reported by QuickFIX, instead of my own code.
Hence, it looks like an invalid message to me although I cannot find any official doc, saying that it is not allowed.
I would expect that QuickFIX could parse the messages as long as the body length of the first message is correct.
You could check if the body length is correct by using the following:
counting the number of characters in the message following the BodyLength (9) field up to, and including, the delimiter immediately preceding the CheckSum (10) field. ALWAYS SECOND FIELD IN MESSAGE. (Always unencrypted) For example, for message 8=FIX 4.4^9=5^35=0^10=10^, the BodyLength is 5 for 35=0^
Source: https://btobits.com/fixopaedia/fixdic44/index.html?tag_9_BodyLength.html
Its completely depends on your fix engine whether to support multiple messages in one go or not.
Using BodyLength[9] and CheckSum[10] fields.
BodyLength is calculated starting from field starting after BodyLenght and
before CheckSum field.
CheckSum is calculated from ‘8= upto SOH before the checksum field.
Binary value of each character is calculated and compared to the LSB of the calculated value to the checksum value.
If the checksum has been calculated to be 274 then the modulo 256 value is 18 (256 + 18 = 274). This value would be transmitted a 10=018 where
"10="is the tag for the checksum field.

AS400 Macro, input fields count

5250 emulator:
Hello everyone, I want an operator which will count that input fields as it is shown on attached picture. In this case i have 5 input field.
Thanks in advance and best regards
It can be done!
Download this source: http://www.code400.com/ffd.php
You can comment out the GETKEY section from FFDRPG as you won't need that and it will probably cause it to fall over anyway.
Also, rememember when you use the command, to put the record format name in as well as your display file name - don't just leave *FIRST in there or you'll just get the fields from the first record format in the display file.
EDIT:
You'll need to add an extra field to the ListDs data structure:
D ListDs DS
D SfFld 1 10
D SfType 11 11
D SfUse 12 12
D BufferOut 13 16B 0
D FieldLen 21 24B 0
D Digits 25 28B 0
D Decimals 29 32B 0
D FieldDesc 33 82
If you add the 3rd field SfUse, you can check whether it contains 'I' so you only count Input Capable fields.
Check out the QUSLFLD API https://www.ibm.com/support/knowledgecenter/en/ssw_i5_54/apis/quslfld.htm if you want to see exactly what information can be retrieved by this API.
The example in the download uses the most basic format FLDL0100 but more information can be retrieved if you ask for format FLDL0200 or FLDL0300 but they will take longer to execute and you shouldn't need the extra info to achieve what you're after.
I'm not sure if this is possible, but you might find some joy with the DSM APIs.
QsnQry5250 has a maximum number of input fields return parameter, but it may just show you the maximum allowed on the display rather than the number you have on your screen.
There's an example here https://www.ibm.com/support/knowledgecenter/en/ssw_i5_54/apis/dsm1g.htm
And the API documentation here https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/apis/QsnQry5250.htm
Sorry I can't be of more help - I've never used those APIs and can't think of another way to achieve what you're after.
If you tell us the reason you need to know the number of input fields on screen, we may be able to suggest another way to achieve what you want to achieve.
Damian

How to find out KDB Query Execution Time

I would like to find out how much time a query took for getting executed. I plan to log this for audit and support purposes.
I have found this in the documentation:
q)\t log til 100000 / milliseconds for log of first 100000 numbers
3
But the above method actually evaluates the query again and tells us the time. It doesn't return the results of the query. So if I use this it will actually be like running every query twice, once for getting the results and once for knowing the execution time.
Is there any other method someone is aware of?
You could also capture the time before/after the query runs to figure out the execution time.
Execute on one line:
q)start:.z.p;result:log til 100000;exectime:.z.p-start
q)exectime
0D00:00:00.297268000
q)result
-0w 0 0.6931472 1.098612 1.386294 ...
This method will give you nano-second precision but can easily be adapted to return the same as \t.
q)res:system"t a:{st:.z.p;log til 10000000;.z.p-st}[]"
q)`long$`time$a /convert to Ms
297
q)res
297
You can use a "system t" call (the equivalent of \t) to store the result and the time in one go.
b:system"t a:log til 100000"
It's not very general or functional though so it mightn't suit your needs to have the commands inside a string.
Expanding on Connor's idea, you can wrap this in a function that will return the value and print the time taken to stdout:
time:{ t0:.z.t; r:eval x; 0N!.z.t-t0; :r }
And then send the parse tree of your function as the argument:
q)a:time (log;til 100000)
00:00:00.003
q)a
-0w 0 0.6931472 1.098612 1.386294 1.609438 1.791759 1.94591 2.079442 2.197225..

What is the best way to ensure the correctness of data returned by a SNMP query?

I am working on code which uses the snmp->get_bulk_request() method to make SNMP queries to get interface table details from a network device.
The problem I am facing is that sometimes, the data I receive from the query is missing some detail. This is a transient issue.
I believe that placing a set number of retries will reduce the probability of error. But, as I go through the documentation for snmp->get_bulk_request(), I find a parameter called
maxrepetitions. It is not clear to me from the documentation what this parameter does.
I am trying to figure out what effect the maxrepetitions parameter has when used with the get_bulk_request call method. I have gone through the documentation in "get_bulk_request() - send a SNMP get-bulk-request to the remote agent" and found this:
$result = $session->get_bulk_request(
[-callback => sub {},] # non-blocking
[-delay => $seconds,] # non-blocking
[-contextengineid => $engine_id,] # v3
[-contextname => $name,] # v3
[-nonrepeaters => $non_reps,]
[-maxrepetitions => $max_reps,]
-varbindlist => \#oids,
);
The default value for get-bulk-request -maxrepetitions is 0. The maxrepetitions value specifies the number of successors to be returned for the remaining variables in the variable-bindings list.
Specifically, my questions are:
Is adding maxrepetitions equivalent to adding retries for the query?.
Is retrying the right way to ensure the data is most probably correct?
If not, what is the best method to ensure the probability error is low in data returned by SNMP query?
From the man page:
Set the max-repetitions field in the GETBULK PDU. This specifies the maximum number of iterations over the repeating
variables.
Example
snmpbulkget -v2c -Cn1 -Cr5 -Os -c public zeus system ifTable
will retrieve the variable system.sysDescr.0 (which is the lexicographically next object to system) and the first 5 objects in
the ifTable:
sysDescr.0 = STRING: "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m"
ifIndex.1 = INTEGER: 1
ifIndex.2 = INTEGER: 2
ifDescr.1 = STRING: "lo0"
et cetera.