Categories
Mastering Development

Pick a slice from R array according to coordinates

I have two vectors x and y of coordinates and a 3D array A in R. I want to produce a matrix, where the i’th row is A[x[i], , y[i]]. If A was 2D, I believe I could use A[cbind(x,y)]. For the 3D array, I think the following works, but it’s kind of slow: sapply(1:length(x), […]

Categories
Mastering Development

How do you create a long number from a List

How do you create a long number from a List<Integer> ? From: List<Integer> ints = Arrays.asList(1,2,3,4,5,6,7,8,9) TO: long = 1234567489 Thanks

Categories
Mastering Development

boot function with purr::map in R

I’m studying about bootstrap two sample t test with boot package. In gene expression matrix, I want to compare genes between conditions and my aim is to find expressed genes. I have a matrix 5*12(5 control, 7 treatment and 5 genes) and firstly I converted this data matrix to tibble format as two long vector […]

Categories
Mastering Development

How to invoke a new line after each text in the value section for embed

I am coding the help command for my discord bot and it looks good when finished but its just not perfect, I just want to know, is there a way to invoke a new line after each text in the value section for embed, for example it would look like this: Moderation: kick ban ect.. […]

Categories
Mastering Development

How to add subplot table to right of graph

I am wanting to combine a table and a horizontal bar graph, so you can see a note from the table that goes with the bar in the bar graph. What I have now looks like this: I am wanting to just add one column to the right of the graph from Catalyst = in […]

Categories
Mastering Development

Count the occuarences of each elements in numpy array, where elements are elementwise equal with another array?

I have two arrays like [2,2,0,1,1,1,2] and [2,2,0,1,1,1,0] I need to count (eg. with bincount) the occourances of each element in the first array, where the elements equal by position in the second array. So in this case, we get [1,3,2], because 0 occurs once in the same position of the arrays, 1 occurs three […]

Categories
Mastering Development

How to add limited hints when programming a quiz?

I am making a trivia quiz that allows users to solve 10 trivia questions and get a score. I am planning to provide the users 3 hints and print out Sorry! You used all the hints. when the user uses all 3 hints. How do I do that? I know I would need to use […]

Categories
Mastering Development

AHK – Sleep inside a function doesn’t work (2)

I have read previous similar article and tried as there adviced. But it doesn’t work for me. Or I missing something? I tried many syntax variations. keydelay := 1000 ^z:: PlayQueue([1,2,3,"q","e"]) return PlayQueue(queue) { global keydelay for i, k in queue Send, %k% Sleep %keydelay% } Its just fires instantly without delays :/

Categories
Mastering Development

pentaho data integration (Kettle) method and step to convert a long comma separated string/list to table/matrix format

Using Pentaho data integration (Kettle), I read a long string from a text file: a, 1, 2, b, 3, 4, c, 5, 6, … Is there any PDI/Kettle steps or method to split this string to become an n column table format like below (the column name can be define freely): column1 column2 column3 a […]

Categories
Mastering Development

Python pandas how to deal with operations

I have the following problem which I am not sure how to solve with acceptable performance. Example: I have a list with all the close prices from stock between 2 dates, let’s say close_price = [1, 2, 5, 3, 10, 1] And I also have an array with just True and False which has True […]