Questions tagged [variable-length]

Refers to anything whose length can vary

Refers to anything whose length can vary

290 questions
3
votes
2 answers

Creating a function with variable-length arguments python

I need create a simple function that computes the cumulative sum (every value in the input tuple should be replaced by the sum of all values before and including the current value, thus (1, 2, 3) becomes (1, 3, 6)) of its arguments, which you can…
Thomas
  • 113
  • 3
  • 14
3
votes
3 answers

Total length of elements, and subsets, in a pandas dataframe

How I can count the total elements in a dataframe, including the subset, and put the result in the new column? import pandas as pd x = pd.Series([[1, (2,5,6)], [2, (3,4)], [3, 4], [(5,6), (7,8,9)]], \ index=range(1, len(x)+1)) df =…
Fadri
  • 157
  • 1
  • 1
  • 9
3
votes
3 answers

Sending Variable-Length Data Over TCP Socket

My application needs to send/receive xml data via a tcp socket. There is no way to include any kind of a fixed-length header containing message length. As far as I understand, data transmitted over tcp can come to the receipient like this.…
Primary Key
  • 1,237
  • 9
  • 14
3
votes
2 answers

Freeing variable-sized struct in C

I am using a variable-sized C struct, as follows: typedef struct { int num_elems; int elem1; } mystruct; // say I have 5 elements I would like to hold. mystruct * ms = malloc(sizeof(mystruct) + (5-1) * sizeof(int)); ms->num_elems =…
Alex
  • 33
  • 2
3
votes
2 answers

How to get the length of an integer in Java (Android)

So if I had the value 1234 the output should be 4. I've written the following code, but don't know what I did wrong. This is an App, that adds two numbers. So I've got two EditTextfields. But if an EditTextfield is left blank, the App crashes. So I…
Marsstar
  • 159
  • 4
  • 10
3
votes
1 answer

A variable length bitset in C++

I have a working 4 bit linear feedback shift register, using 3 bitsets of length 4: inpSeq, operSeq and bit. I want to make the program accept a variable length bit sequence, so those previous bitsets should be of variable length somehow. The user…
Mohamed Ahmed
  • 457
  • 1
  • 7
  • 25
3
votes
4 answers

Difference between variable-length argument and function overloading

This C++ question seems to be pretty basic and general but still I want someone to answer. 1) What is the difference between a function with variable-length argument and an overloaded function? 2) Will we have problems if we have a function with…
raj_arni
  • 959
  • 2
  • 15
  • 29
3
votes
1 answer

database table design for storing different sized datasets

I am designing a Microsoft Access database to store results from lab equipment. They are in the form of hundreds of lists of frequency vs. response curves which I have previously stored rather easily, but inefficiently in Excel. The difficulty…
3
votes
1 answer

What is this variable-length integer encoding?

I am documenting an old file format and have stumped myself with the following issue. It seems to be that integers are variable-length encoded, with numbers <= 0x7F encoded in a single byte, but >= 0x80 are encoded in two bytes. An example set of…
Aidan Steele
  • 10,999
  • 6
  • 38
  • 59
2
votes
1 answer

Importing Variable length text files per individual into R

I would like to import a very large text file as a dataframe into R. The file is produced by the "National Institute for Health and Disability Insurance" in Belgium. It contains individual data on health professionals in Belgium. It's a fixed width…
Joël
  • 73
  • 1
  • 9
2
votes
1 answer

Javolution - reading variable-length string

How to read variable length String from a C struct using Javolution API? For example the code below is used to get a fixed size String- public final UTF8String data= new UTF8String(100); Can anyone give me an example for reading variable length…
Susmitha Pandi
  • 155
  • 1
  • 3
  • 11
2
votes
2 answers

Validate Australian DVA numbers (which may have variable length)

I'm doing validation on Australian DVA numbers, the rules are: String length should be 8 or 9 First char should be N, V, Q, W, S or T The next part should be letters or space and can have up to 3 characters Next part should be number and can have…
catcon
  • 1,295
  • 1
  • 9
  • 18
2
votes
5 answers

How to Generate Random numbers in Javascript based on the provided range Minimum and Maximum characters

I have a bit weird requirement where I need to generate Random numbers of the length that is given by user. User can give Minimum Length and the Maximum Length and I need to generate the random numbers which consist of the character length between…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
2
votes
1 answer

R code Gaussian mixture -- numerical expression has 2 elements: only the first used

I'm trying to create a Gaussian Mix function according to these parameters: For each sample, roll a die with k sides If the j-th side appears from the roll, draw a sample from Normal(muj, sdj) where muj and sdj are the mean and standard deviation…
2
votes
2 answers

javascript object max size limit at 10000 chars

When I run this code, the variable items only appends 9999 chars and rest is truncated. I got a few answers in the previous post but the problem still persists. var items = []; for (var i = 1; i < 400; i++) { items.push('{"Key":' + '"this is a…
Paras
  • 2,997
  • 6
  • 35
  • 46