Questions tagged [variable-length]

Refers to anything whose length can vary

Refers to anything whose length can vary

290 questions
1
vote
1 answer

Reading various inputs from stdin

I'm reading from the stdin. The user is promoted to eather type one digit or to type three. Which functions are good this problem? I have tried int in[3] = {-1, -1, -1}; scanf("%d %d %d", &in[0], &in[1], &in[2]); printf("%d, %d, %d\n",…
Jan
  • 13
  • 3
1
vote
1 answer

Algorithm to hash a string to a dynamic number of characters

I'm looking for a way to hash a string to a dynamic number of characters. I don't want to trim an existing hash (such as SHA) but generate a hash that you can specify the number of output characters for. It should also work if the input is less than…
The Cookies Dog
  • 1,915
  • 2
  • 22
  • 38
1
vote
4 answers

Summing up values in one column based on unique values in another column

I am trying to add the values in column C based on unique values in column B.For instance,for B = 1,I would like to add all rows in column C i.e. 5+4+3=12. A B C 1 1 5 2 1 4 3 1 3 4 2 1 5 2 3 for(i in unique(df$B)){ df$D = sum(df$C) } Also, I…
shome
  • 1,342
  • 1
  • 12
  • 30
1
vote
1 answer

Why swap bytes in variable length encoding in the Thrift CompactProtocol?

I wondered why you had to swap bytes in the Trift CompactProtocol when encoding Ints with variable length. Example taken from Data Intensive Applications (online, page 120): Number in Base 10 to be encoded: 1337 1337 in Base 2: 0010100…
User12547645
  • 6,955
  • 3
  • 38
  • 69
1
vote
0 answers

Tunable variables Simulink and real-time workshop (RSIM)

At the moment I’m working on a Simulink model and interested in getting its C code (batch /.exe file) in order to work with it with no further compilation. I’ve already generated the code (using RSIM) and everything works perfectly when I run the…
little_mice
  • 177
  • 6
1
vote
1 answer

Wilcox.test error: 'x' and 'y' must have the same length

Currently trying to run a grouped wilcox.test on relative humidity (erh) and temperature (temp) data. The dataframe looks like this: head(sw_1d_wilcox_data, n = 25) # A tibble: 25 x 3 sens_type erh temp 1 OS…
Claire Lepine
  • 21
  • 2
  • 4
1
vote
1 answer

Apply regular expressions to compare values in data frames of different length in R

I am trying to apply a regular expression to match values in two data frames of different length in R. My objective is to retain only the values that match the regex in both data frames. An example of the dataset would…
1
vote
0 answers

Hadoop: InputFormat for Variable-Length files without delimiter

I have to process (by Hadoop) variable-length files without delimiter. The format of these files is: (LengthRecord1)(Record1)(LengthRecord2)(Record2)...(LengthRecordN)(RecordN) There is no delimiter between the records (the file is in one…
1
vote
1 answer

Correct use of sequence_length in dynamic_rnn

I am attempting to design an RNN for sequence classification purposes using tensorflow's dynamic_rnn. My examples can vary in length and through my research I learned that I can pass "sequence_length" as a parameter that designates the length of my…
The_Chicken_Lord
  • 129
  • 1
  • 11
1
vote
4 answers

Variable-Length Argument List passing generics and generic arrays as params - Java

I am attempting to write a helper print method so I can print items out to the console with less code and in an easier fashion. I am however, running into issues printing arrays that are passed into my method because I cannot loop over a regular…
ViaTech
  • 2,143
  • 1
  • 16
  • 51
1
vote
2 answers

Can I quickly get the minimum length of the most inner sub-lists within a list in python?

This shows how to get the minimum length of first-level inner lists. How can I return 4 for this list b=[[1,0,1,2,1,1,1,3111111,[1,1,6,7]],[31,1,4,51,1,1,1],[1,1,6,7,8]] as [1,1,6,7] only has 4 elements. I can run a for-loop to get it. But can it be…
lanselibai
  • 1,203
  • 2
  • 19
  • 35
1
vote
2 answers

Error Using Length() Method in Array Within a For Loop

I created an array within a for loop to generate the cube of 1-9 in descending order. My code appears to work as I am able to run it without any syntax or runtime errors. However, whenever I try to use the length() method in my for loop, I get an…
1
vote
1 answer

What is the meaning of the first byte of each record set when downloading a v(b)-file from z/OS over FTP using "TYPE E" and "MODE B"

Right now, I'm trying to upload and download files with variable record lengths from an IBM mainframe running zOS 2.1. Like this guy: How to FTP a variable length file from linux to mainframe z/OS curl --user "******" --verbose --silent --show-error…
Daniel Heinrich
  • 790
  • 4
  • 12
1
vote
2 answers

Calculate Hamming distance between strings of variable length in Matlab

I would like to calculate the Hamming distance between two strings of variable length in Matlab. For fixed length strings the following syntax solves my problem: str1 = 'abcde'; str2 = 'abedc'; sum(str1 ~= str2) ans = 2 How can I do this…
smonsays
  • 400
  • 2
  • 17
1
vote
1 answer

Count Length of Digits Per Column Per Row

I generated the following table: CREATE table user ( user_id INT NOT NULL UNIQUE AUTO_INCREMENT, user_phone_number INT, user_city VARCHAR(32) NOT NULL, PRIMARY KEY (user_id) ); And I'm being asked the following: number of…