I want to change the key length in Yahoo Clouse Services Benchmark - ycsb

I have a very simple requirement:
I need keys of much longer length than what are available in YCSB. I want keys of around 100 to 800 characters as primary keys.
According to this thread, the key length is fixed- it is a concatenation of "user" with an integer.
https://github.com/brianfrankcooper/YCSB/issues/587
I cannot locate the code where this concatenation is done in ycsb source code.
If I change "User" to another String of 100 characters, or pick one from a predefined set of about 100- it will meet my requirement. But I Cannot locate the line of code that combines the string "User" with a string representation of an Integer.
I have looked through the source code, but just cannot find the line(s) that generate the keys. I found the lines that generate the fields.

please look at CoreWorkload.java and the function - buildKeyName().

Related

How to extract string from sentence using sub-string and position function?

I have to extract a value from string and I am working on cognos application that doesn't support regex. It has some built in functions like substring and position
My string is similar to
/content/folder[#name='ab_Salary Reports']/folder[#name='INT Salary Reports']/folder[#name='INT Sal Sche']/jobDefinition[#name='Salary Rep R025']
And I have to extract Salary Rep R025, ie. the last name value.
Static substring will not work because string is variable.
Use the position function to locate the starting and ending point of your target substring. Try
position('/jobDefinition', [pathstring])
combined with substring:
substring( [pathstring], position('/jobDefinition', [pathstring]) + 22, length([pathstring]) - position('/jobDefinition', [pathstring]) + 22)
This will start 22 characters after where it finds /jobDefinition, meaning it will start just past '/jobDefinition[#name='', and will proceed for the remaining length of the string, determined by subtracting the starting point from the full length.
You may need to adjust by +1 or -1 in order to include or exclude your quotes.
Also note that this is using Report Studio functions. The source for Cognos reports is queries on tables, so you may have native functions available depending on your source. For example, most of the reports I work with come out of an Oracle database, so I can use oracle string functions instead of Report Studio functions. They work better, and are processed on the database side rather than on the Cognos Dispatcher, which is always faster.

Looking for a hash with an output of 50 characters?

I'm attempting to figure out how Skype stores the emoticons it downloads, and there does seem to be a standard in the naming scheme. All files are prefixed with a code similar to the one below, which is a 50 character hash prefixed and suffixed with a caret character. I have been unable to find any reference to a 50 character / 200 bit hash, although references to SHA-3 did appear in my queries.
^2BA3514B75E7AF97940579D1E698B7F33984FE029B2FA59CB3^
This hash might be some variation of 'rain', '(rain)' or 'Raining', however I have no way of attempting to reverse-engineer it. If possible, could you point me to a similar or identical algorithm?

Matlab - Using special characters in table header

I have constructed a table with data from a struct and now wish to add custom headers to the columns before exporting the table. I found the following command:
T.Properties.VariableNames{'OldHeader'} = 'NewHeader';
This command however does not allow me to use spaces or special characters for my headers. My table contains the output from processed lab data and I wish to have headers like "Vol. [mL]" and "Conc. [wt%]".
To illustrate using the example from matlab documentation:
S.Name = {'CLARK';'BROWN';'MARTIN'};
S.Gender = {'M';'F';'M'};
S.SystolicBP = [124;122;130];
S.DiastolicBP = [93;80;92];
T = struct2table(S)
T.Properties.VariableNames{'Gender'} = 'Sex';
The above works, but restricts me to normal characters and no spaces. My question is how to change "Gender" to "Vol. [mL]" - if even possible?
As #Jubobs already mentioned in the comment, there are some rules for naming variables that prevent you from choosing the exact name that you want. From the documentation that I found by googling the topic:
A valid variable name starts with a letter, followed by letters,
digits, or underscores. MATLABĀ® is case sensitive, so A and a are not
the same variable. The maximum length of a variable name is the value
that the namelengthmax command returns.
You cannot define variables with the same names as MATLAB keywords,
such as if or end. For a complete list, run the iskeyword command.
However, I could think of two easy ways to work around this:
Different names, for example you can use the variable name Vol_ml
Store the names in a list, perhaps with an index code like v1 for the first variable name, then you can make v1 the name of the first variable.

Ogg metadata - Vorbis Comment end

I want to implement a class to read vorbis comments. I know that a field will start with a field name, followed by an equal sign and the value. But how does it end? Documentation makes me think that a semicolon will end the field but I checked an ogg file with a hex editor and I cannot see any.
This is how I think it should look like in a file :
TITLE=MY SUPER TITLE;
The field name is title, followed by the equals sign and then the value is MY SUPER TITLE. And finally the semicolon to end the field.
But instead inside my file, the fields look like this :
TITLE=MY SUPER TITLE....
It's almost as above but there is no semicolon. The .'s are characters that cannot be displayed. I thought okay, it seems like the dots represent a value that will say "this is the end of the field!!" but they are almost always different. I noticed that there are always exactly 4 dots. The first dot has always a different value. The other free have usually a value of 0. But not always...
My question now, how does a field end? How do I read this comment?
Also, yeah I know that there are libraries and that I should use them instead of reinventing the wheel over and over again. I will use libraries later but first I want to know how to do it myself. Educational purpose only.
Each field is preceded by a little-endian 32-bit integer that indicates the number of bytes to read. You then convert the bytes to a string via UTF8.
See NVorbis' implementation (LoadComments(...)) for details.

How to fill a field with spaces until a length in Notepad++

I've prepared a macro in Notepad++ to transform a ldif file in a csv file with a few fields. Everything is OK but I have a final problem: I have to have 2 fields with a specific length and in this moment I cannot ensure that length because in the source file they are not coming so
For instance, I generate this line:
12345,namenamename,123456
And I have to ensure that the 2nd and 3rd fields have 30 (filling with spaces at right side) and 9 (filling with zeros at left) characters, so in this case I should generate:
12345,namenamename ,000123456
I haven't found how Notepad++ could match a pattern in order to add spaces/zeros, so I have though in to add 1 space/zero to the proper field and repeat this step so many times as needed to ensure the lengths (this is, 29 and 8, because they cannot come empty) and search with the length in the regex (for instance: \d{1,8} for the third field)
My question is: can I repeat only one step of the macro several times (and the rest of the macro only 1 repetition)?
I've read the wiki related to this point (http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Editing_Configuration_Files#.3CMacros.3E) and I don't found anything neither
If not possible, how could be a good solution? Create another 2 different macros and after execute the main one, execute this new 2 macros several times?
Thanks in advance!
A two pass solution with Notepad++ is possible. Find a pair of characters or two short sequence of characters that never occurs in your data file. I will use =#<= and =>#= here.
First pass, generate or convert the input text into the form 12345,=#<=namenamename______________________________,000000000123456=>#=. Ie add 30 spaces after the name and nine zeroes before the number (underscores used here just to make things clearer).
Second pass, do a regular expression search for =#<=(.{30})_*,0*(\d{9})=>#= and replace with \1,\2.
I have just suggested a similar solution in special timestamp format of csv