RedBeanPHP: UTF8 vs UTF8MB4 issue - Specified key was too long; max key length is 767 bytes - redbean

My problem is described here: https://groups.google.com/d/msg/redbeanorm/z8SD3qeMEM4/eROS7wBBtccJ
But I can't reply to the post. It just gets deleted every time. In any case, I'm hoping someone here has run across this.
Precondition: No table named 'my_table' exists
Code:
$bean = R::dispense('my_table');
$bean->setMeta("buildcommand.unique", array(array('barcode')));
$bean->barcode = '000000000000000000';
$bean->date_created = gmdate('Y-m-d H:i:s');
R::store($bean);
Postcondition:
"SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes"

Related

What does "integer at offset 60" mean in SQLite documentation for the `user_version? pragma`

In the SQLite documentation for the user_version pragma it says:
The user_version pragma will to get or set the value of the user-version integer at offset 60 in the database header.
What does it mean by "integer at offset 60"? My intention was to use this variable to store my application's schema version. Is this variable formatted as a 32 bit unsigned integer?
"integer at offset 60" is reffering to the byte offset in the SQLite database's header. So if you were to get all the bytes in the database's header, and then move to byte number 60, that would be the beginning of the user_version pragma. And because it is 4 bytes in size (32 bits), you know that it will occupy bytes 60-63.
For reference here is the documentation for the database header. If you scroll down to the row where the value in the 'Offset' column is 60, you'll see they indicate this space is dedicated for the user_version pragma.

des-ecb Encryption in elixir/erlang

How do i pass a 24 byte key to elixir/erlang block_encrypt des-ecb cipher.
As a follow up to my previous question How to set a 24 byte length key to elixir/erlang block_encrypt/4 function using des_ede3 as mode of encryption that i was able to get working, Am trying to pass a 24byte key to the key field in elixir/erlang block_encrypt method.
Below is what i have so far.
# this failed
key = "Fget63htyu3nvu28nuineiru34"
<<key_1::binary-8, key_2::binary-8, key_3::binary-8>> = key
cipher = :crypto.block_encrypt(:des_ecb, {key_1, key_2, key_3}, pad(data, 8))
How do i pass the 24 byte length key as an 8 byte key thats required by the des_ecb cipher.

Pointer position at the time of VSAM START command

I am a bit confused. I know when you START a VSAM file, a pointer is set to a specific record, which will be read by subsequent READ command.
Let's assume that VSAM has records:
100
200
300
400
500
When you write:
START filename
KEY IS GREATER THAN 400
It will place pointer at 500. But if you say
START filename
KEY IS GREATER THAN 600
where will the pointer be placed ?
Will it be on 500 or will it be an error.
Also, my understanding is that START will never give an end of file (RETURN CODE 10).
The pointer will not be positioned to any record.
An INVALID KEY condition will be raised with FILE STATUS "23", indicating no record found.
From the 2002 COBOL standard:
"14.8.37.3 General rules
"7) Following the unsuccessful execution of a START statement, the
file position indicator is set to indicate that no valid record
position has been established. For indexed files, the key of reference
is undefined."

Issue with GameNetwork and Corona SDK

From the picture above in matchDataListener function in line 225, the question is what is the meaning of matchDataEvent.data.data. I have already explored to the reference in http://docs.coronalabs.com/api/type/GameNetwork/match.html but there is no any explanation.
I also don't understand the meaning of
for i = 1, #matchDataEvent.data.participants, 1
in line 244
Could anyone explain them to me?
matchDataEvent.data.data refers to the string inside matchDataEvent.data table/array. I've no idea about what it generally contains though. The line #225 in particular; checks if this string exists and in not empty.
In #matchDataEvent.data.participants, the # is the __len method which returns the length of the table/array matchDataEvent.data.participants. Total number of participants are returned (a number). This number is used as the max value in the for loop.

About Neo4j internal data storage

I was looking at the data files storage in Neo4j and I came up with interrogations.
I followed those two articles :
http://digitalstain.blogspot.jp/2010/10/neo4j-internals-file-storage.html
http://digitalstain.blogspot.jp/2011/11/rooting-out-redundancy-new-neo4j.html
I'm working with Neo4j 2.0.0
Here are my questions :
The .id files have a 8 bytes id while the other files just need 4 bytes.
Why is the size different?
.
In the neostore.nodestore.db, a node is represented by 14 bytes. We have :
1 : in-use flag
2 to 5 : id of the first relation
6 to 9 : id of the first property
10 to 13 : id of the first label
The 14th byte is always 00 for me, what does it mean?
.
About how you make the difference between
a short string (which can be stocked like the primitives properties)
and a long string (which has to be stocked in a separate file).
In the article, it is said that the limit is 3 blocks and a half.
There may be no direct relation to neo4j but I've tried several strings
the same length strings don't produce the same result (one goes with other properties, the other goes to the separate file).
Can someone explain why?
.
When a long string is stocked in the neostore.relationshiptypestore.db.names file,
each record takes 128 bytes. I don't fully understand the structure :
1 to 3 : ???
4 : length of the string
5 to 8 : ??? (always ff ff ff ff for me, which makes me think about a link but...)
9 to 128 : content of the string
One last question :
In the file neostore.propertystore.db.index, the 2 to 5 bytes are always 00 to me.
In the article, it is said that it represents the property count.
Any additionnal information?
--
Sorry for the long post, didn't know if I had to make one or several posts...
Hope my questions are understandable.
Thanks!

Resources