Categories
Mastering Development

Basic differences between Array and Object in Javascript

Why the typeof operator in Javascript returns "object" for arrays? Is there any specific reason for that? var arr = [1, 2, 3, 4]; var obj = { a: 1, b: 2 }; console.log(arr); console.log(obj); console.log(typeof arr); console.log(typeof obj); console.log((typeof arr) == (typeof obj))

Categories
Mastering Development

Using tidy evaluations with furrr

I want to make the following function run in parallel using the furrr package instead of the purrr package. library(furrr) library(tidyverse) input <- list(element1 = tibble::tibble(a = c(1, 2), b = c(2, 2)), element2 = tibble::tibble(a = c(1, 2), b = c(4, 4)) ) multiplier <- function(data, var1, var2){ purrr::map_df(.x = data, .f = ~ […]

Categories
Mastering Development

Getting random images into qualtrics using Javascript

I’m new to Javascript and I’m creating a survey in Qualtrics platform. In the code attached bellow you can see that I have 5 diffrent stories, 20 names and 20 pictures that need to be randomly inserted into the survey. so far I’d manage to add the names and the stories but I don’t know […]

Categories
Mastering Development Software

Using temp table/database in getting value SQL Server in android studio

I’m trying to get the #tempTable to be created, so that it can be used in gettingcost method to return back the variable needed. So right now I get SQL Exception whichs says my #tempTable is not found, might means my #tempTable is not created when running the gettingcost method, therefore may I know a […]

Categories
Mastering Development

Need a algorithm to make Slots which contain unique pairs, and those pairs are unique combinations of digits N

There are N digits. Let say N=6 Digits = [1,2,3,4,5,6] We need to create their unique pairs such as each digit pair up with other only once. Eg pairs: (1,2),(1,3),(1,4),(1,5),(1,6), (2,3),(2,4),(2,5),(2,6), (3,4),(3,5),(3,6), (4,5),(4,6), (5,6) So we can say for a value of N, there will be (N)*(N-1)/2 pairs For N=6, Total Pairs = 15. Now, […]

Categories
Mastering Development

BCEWithLogitsLoss: Trying to get binary output for predicted label as a tensor, confused with output layer

Each element of my dataset has a multi-label tensor like [1, 0, 0, 1] with varying combinations of 1’s and 0’s. In this scenario, since I have 4 tensors, I have the output layer of my neural network to be 4. In doing so with BCEWithLogitsLoss, I obtain an output tensor like [3, 2, 0, […]

Categories
Mastering Development

How can I generate a football tournament with match timings and parallel matches?

Currently building a Laravel application which allows users to generate football (soccer) tournaments – mostly for 5-7 a side. When creating a tournament, the organiser chooses whether it’s a round-robin or knockouts tournament. They also define how many pitches are available (e.g. 1, 2, 3), how long each match is in minutes and also how […]

Categories
Mastering Development

array.sort() is sorting everything the same way

I’m trying to practice by doing the following exercise: Write a function that takes a numeric array and returns an object containing two arrays. The first one should have the elements sorted in ascending order, and the second one should have them in descending order. This is the code without the validation portion (which I […]

Categories
Mastering Development

Recursively iterate through nested object to deep copy AND apply defaults from separate data source

Ok, this one might be a doozy. I’m banging away but wonder if there’s an elegant way to approach this. I have an object of assets, each of which has some properties, as well as some number of sub-assets in either of two possible objects: assets and characteristics. I also have a flat object with […]

Categories
Mastering Development

how to put matrix inside sudoku bord JS

I hope my question is understandable. I have a matrix and I want to put it into a sudoku board. Without using jquery. I have the ID I gave to each cell: HTML Sudoku Board I have this function: const sMat1= [ [7,8,9,3,6,5,4,2,1], [6,5,4,9,2,1,8,7,3], [3,2,1,8,7,4,9,5,6], [9,6,3,7,8,2,5,1,4], [4,1,2,5,9,3,7,6,8], [5,9,6,2,4,8,1,3,7], [2,4,7,1,3,9,6,8,5], [1,3,8,6,5,7,2,4,9] ]; ` function fillBord(sMat1){ for(let […]