292 questions
Advice
0
votes
3
replies
122
views
How to adjust vector length in quiver plot?
This is the program I am using:
fig, ax = plt.subplots(figsize=(4, 4))
t, dt = np.linspace(-4, 4, 10, retstep=True)
x = t
y = t**3 - 9*t
xy = np.stack((x, y), axis=1)
n = len(xy)
d1ydx1 = np....
0
votes
0
answers
39
views
Exiting properly from multiple if/then statements, AND comparing the length of a variable
Good day everyone. I am writing a script which will parse a flat file with all the information I need, and if a certain variable is too long, or greater than some length, I need to break out of that ...
0
votes
0
answers
82
views
length greater than 32767 characters Oracle
I have the following code:
declare
v_output varchar2(32767);
begin
v_output := shell('ls -ltr /opt/ibm/');
dbms_output.put_line(v_output);
end;
It throws error as the output is more than 32767 and ...
1
vote
0
answers
118
views
To buffer or not to buffer - fputc() vs fwrite()
Edit: My bench marking code was wrong (SIZE / BUFSIZ in fwrite() should only be BUFSIZ), so everything is cleared up: in my case buffered fwrite() is giving better performance.
I try to speed optimize ...
0
votes
0
answers
64
views
How to do a nested loop over a variable length list of generators? [duplicate]
I have a list of generators L = [gen_1,...,gen_n] with variable length n.
How can I implement in a compact way the following:
for el_1 in gen_1:
for ...
for el_n in gen_n:
...
0
votes
0
answers
38
views
Correctly read binary data encoded in variable-lengths
I'm trying to read a binary data file containing time-series data in Matlab.
Sample data: [23,-10,47,19,-417,-434,-1,29,11,22,23,6,18,13,-383]
Command: fopen(filename,'r','ieee-le');
When I read the ...
1
vote
2
answers
174
views
How does declaring an array with a variable work inside a function
I am learning C and I realized that you can declare an array with the size determined by a function argument like in this example:
#include <stdio.h>
void foo(unsigned int size){
int array[...
0
votes
1
answer
60
views
Vertical-center text next to image only if short text
I'd like to vertically align a text next to an image. The text can be short or long – and with responsivity in mind, the parent container can also shrink.
But I personally find that the image should ...
0
votes
1
answer
141
views
J8583 - Nested LLLLVAR
Is it possible to do nested LLLLVAR using J8583? With the given sample value below the DE 63 which has length of 18 will have its LLLLVAR = 0018313830303030313431313831343030303234, then using this ...
0
votes
1
answer
43
views
How to Write a Function That Will Loop Through Dataframes of Differing Lengths
I have two different dataframes of different lengths, each with two value columns. What I want to do is find the mean and sum of each row of the two value columns in each dataframe by writing a ...
1
vote
1
answer
63
views
Checking the significance of the difference between two groups of different length
I need to check if the difference between land surface temperature in the past and present within the LULC is statistically significant. LULC units changed over time and the length of the temperature ...
1
vote
0
answers
384
views
Decode LEB128 getting wrong results
I'm trying to implement LEB128 to write a custom Minecraft Server implemention. I'm doing so by following Wikipedia article about LEB128 and port example Javascript code given to C.
https://en....
-2
votes
3
answers
577
views
How to display none if div tag doesn't exist?
If the "slick-initialized" div tag doesn't exist within a parent, then I want the parent ID (product recommender-recipe) to display none. Right now this is what I have set up:
HTML is set up ...
-1
votes
1
answer
416
views
Finding the midpoint of tuple of any length in python
I need to take a tuple of any length and preforming an operation to return the midpoint. However, I need to function to work with a tuple of any length so I'm not sure how to go about it.
def ...
0
votes
0
answers
31
views
How do i keep the tail zero in my dataframe and avoid variable lengths differ error from R
I have a dataset like below:-
Location
Reading
Above
0.0370
Above
0.0261
Below
0.0660
Above
0.0420
now when I load this in R, it appears prefectly in the console but when I run the below script-
model ...
1
vote
1
answer
338
views
Variable Length MIDI Duration Algorithm
I'm trying to compile MIDI files, and I reached an issue with the duration values for track events. I know these values (according to this http://www.ccarh.org/courses/253/handout/vlv/) are variable ...
1
vote
2
answers
72
views
Why do I get "TypeError: Cannot read property 'length' of undefined" when using length method
I wrote a function that returns the longest word
const longestWord = (phrase) => {
const arr = phrase.split(" ");
let longest;
for (let i = 0; i < arr.length; i++) {
if (arr[i]....
0
votes
1
answer
45
views
JS select length without ID
I'm trying to collect the length of several select. How can I know the length of each select? The way I found is $('#mylist option').length which seems not feasible in this case since I don't have IDs ...
3
votes
1
answer
4k
views
What is stack guard page and probing stack?
I'm analysing how the compiler implements the variable-length array in c99. The following is my c code and disassembly which is commented on my understanding. The code is compiled with "-O3 -...
1
vote
1
answer
123
views
Laravel rule to checking length is not equal to N
We have defined some rules in laravel but we need rule in which length of string should not be 5.
code is given below.
$rules = array(
'id' => 'required|numeric|digits_between:7,8'
);
current rule ...
1
vote
1
answer
508
views
Creating Table in R Using List of Values from Another Dataset with Different Length
I have a dataset of 50,000+ observations and I'm trying to create a table of my two variables of interest, chemical and lab_code. The code below outputs a working table that can be used to create a ...
0
votes
2
answers
545
views
Find all permutations possible of a string but of all possible lengths
getting simple permutations of a string is easy but how do you do if you want different length permutations
For eg:
def permutations(string):
if len(string) == 1:
return [string]
else:
...
1
vote
1
answer
161
views
how to calculate the size of the string with /0 inside which a pointer points to
let say I have a char pointer like this:
unsigned char* value="Hello\0Hello";
how can i calculate the size of value, as strlen only calculate the size of string until the '/0' so I can not ...
1
vote
1
answer
109
views
is it safe to make a VLA slightly longer than argv[1]?
Example code, treats argv[1] as a file path, replacing its extension with .png or appending it if none is found:
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
...
0
votes
1
answer
544
views
Variable lengths differ, R
#restricting sample
replicatedata_firststage <- replicatedata_full %>%
filter(!is.na(belief_treatment_w3), hk_local == 1,
followup_postjuly1st_w3 == 1, !is.na(...
0
votes
1
answer
34
views
Python: Add Two Integer Lists of Different Lengths Together as One List
What I have:
first = [1,2,3]
second = [1,2,3,4]
What I want:
third = [2,4,6,4]
first + second = third
I've tryed using numpy and zips but they all stop after the smallest list is complete.
1
vote
1
answer
110
views
How to get the length of a formula in R?
I am trying to get the length of the following formula:
myformula <- ~ (1 | Variable1) + (1|Sex) + Age + Cells + Glucose
But for some reason, R doesn't recognize the real number of elements (which ...
0
votes
2
answers
237
views
AWK-Get total count of records for numerical grouped column
I have a variable which splits the results of a column based on a condition (group by in others programming languages).
I'm trying to have a variable that counts the NR of each group. If we sum all ...
0
votes
1
answer
48
views
matrix code simplification and generalization
Good day, Please i need assistance trying to generalize this code for any matrix the data PoliticalDemocracy is available in the lavaan library
What I tried
library(lavaan)
R<-chol(cor(...
0
votes
2
answers
731
views
Neo4J variable-length pattern
Is it possible to write a Cypher query with a variable-length patter, that specifies that nodes between the start and end node can only be nodes with a certain property?
I think that a query like the ...
-2
votes
1
answer
38
views
I am writing a hangman style program but am having trouble checking if more than one character has been entered and the set word is guessed
I am using a while loop to check if the number of guesses is less than 10 and once 10 guesses has been made it will prompt you one last time to input the whole answer not just individual characters. I ...
-1
votes
1
answer
111
views
Run function over dataframe with columns of differing length after dropna()
I am trying to apply the following function over each column in a dataframe:
def hurst_lag(x):
minlag = 200
maxlag = 300
lags = range(minlag, maxlag)
tau = [sqrt(std(subtract(x.dropna()...
0
votes
2
answers
70
views
For loop continuing past set end point (matlab)
I have an array of matrices which are all different lengths. I want to compare the distance of each item in matrix 1 to the items in matrix 2 and so on. The for loops I've written below work well ...
0
votes
1
answer
51
views
Fitting data frame probability distributions with different lengths - EnvStat - looping in R
I'm trying to fit probability distributions in R using EnvStat package and looping to calculate multiple columns at once.
Columns have different lengths and some code error is happening. The data ...
1
vote
1
answer
680
views
Excel: Extracting numbers from a string with variable length
I have a column with data that looks like this:
Day
D003
D004
D008
D010
D012
D028
And in the next column, I need to extract just the 3, 4, 10, 12, etc. with NO leading 0's. I tried the following:
=IF(...
0
votes
2
answers
316
views
Change length of an object using the get() function R
I'm writing a function to analyse .csv files in a directory on my hard drive, using a series of for and while loops (I know for loops are unpopular in R, but they're good for what I need).
The ...
1
vote
1
answer
257
views
Trying to count number of elements but it returns zero
The elements:
<div>class="product-image-container"</div>
<br>
<br>
The code:
countMaterials(){
let countItems = 0;
cy.get('#center_column').find("div&...
0
votes
0
answers
821
views
Cast as decimal
I have 4 value in a column. For example;
ColumnA
2.651
3.5
4.55
7.9
And I want to sum it all and cast as a decimal;
select CAST(sum(ColumnA) as Decimal(LEN(sum(ColumnA)),2)) FROM tablename;
however ...
1
vote
3
answers
381
views
Getting error when trying to calculate the length of the array after sort in python
I am totally confused on the below code execution,
a= [10,30,4]
a = a.sort()
r = len(a) - 1
print (r)
When the above code is executed I get
r = len(a) - 1
TypeError: object of type 'NoneType' has no ...
0
votes
2
answers
1k
views
Flutter 'List<Post>' has no instance getter 'lenght'
I'm new to flutter. I am getting an error like this, can you help me?
I've been stuck in http for json for 5 days, the codes in the source don't work. :( L
It says list not entered but when I enter it ...
0
votes
1
answer
213
views
Data Engineering: Parse binary data stream with schema and variable length fields
I have a data pipeline that receives data from multiple sources, one of which streams binary data in a known schema, with one field being of variable length.
I need to parse this data into a tabular ...
0
votes
1
answer
138
views
how to implement variable length argument function in scala
I have to concatenate k different lengths of strings into one string res and save res string into ArrayBuffer[String]().
But the k is variable.
For example,
val result = new ArrayBuffer[String]()
...
0
votes
1
answer
138
views
Cypher - Gantt chart from variable length relationships
I'm new to Cypher, self taught so far. I've managed to get creative with basic queries but am now hitting something I have no idea how to achieve....
Given a list of job ID dependencies:
│"A"...
1
vote
3
answers
77
views
Can you get .length of number of svgs to create a rating score?
Not sure if this is doable, but is there a way you can use .length or another method to get the rating score of something which is usually displayed in svg form?
In the below HTML in each svg there's ...
2
votes
1
answer
445
views
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 ...
1
vote
0
answers
255
views
Decompress varint64 stream of variable-length integers into the qword elements of an __m256i with AVX2
Varint64 data is varlen data format.
Varint64: Divide uint64 into 8 8bits, each 8bits contains the highest flag bit and the lower 7 data bits. When the flag bit is 1, it indicates that the next 8bit ...
0
votes
1
answer
89
views
Getting wrong answer from data length calculation
I have a list of 41 data from a functioned I defined, but I only want to access the first 40 of them. So, the index positions I am looking for are from 0 - 39
forecast_price(10)[:len(forecast_price(10)...
-6
votes
1
answer
2k
views
What is the correct way to retrieve length of an array added a field in nested struct in golang
I have a nested struct and I need to find the length of an array which is one of the fields in the struct.
Here are the structs :
type TextEntry struct{
name string
Doc []DocEntry
}
type ...
-1
votes
1
answer
116
views
In Python why does the variable specified inside the loop has length 1 whereas the other outside the loop has its original length?
As declaring a variable1 inside for loop I have assigned some string to it>>>whereas given another variable2 .....when provided with the output it shows variable1 len is 1 and variable2 has 8 ...
0
votes
1
answer
439
views
gcc is too smart to generate __strcpy_chk
My code looks like
struct MyData {
int len;
char data[1];
};
MyData *d1 = malloc(1024);
strcpy(d1->data, a_string);
I use it as variable-length buffer and guarantee the buffer not ...