Categories
Mastering Development

Recreate Excel formula in SQL

I am trying to recreate the below Excel formula/table and have True/False display but am stuck. Excel Formula: =ABS(ROUND(MEDIAN(C$2:C2),0)-ROUND(MODE.SNGL(C$2:C2),0))<[sample.xlsx]variables!$B$2 I have 200+ rows of data and I need the Median and the Mode only calculated from the first row to the current row. I can create the Median for all rows in SQL, but this […]

Categories
Mastering Development

How to get depth of tree of arrays given total num items and max array size?

Given this divide algorithm and sample data: const data = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, […]

Categories
Mastering Development

A regex to get any price string

I need to get the price from a string, but no other numbers. There are no restrictions on what the string can say, but it will always have a dollar amount in it. It’s the dollar amount I need to get from the string. The closest solution I’ve been able to find is \d{1,3}[,\\.]?(\\d{1,2})? On […]

Categories
Mastering Development

Appending and reading list values in nested dictionaries

Need to check I’m understanding this right. I’m running a function that appends lists to a list in a nested dictionary. I thought I would be able to assign a variable to append and return the same values as the nested dictionary, but it returns ‘None’, (and interestingly still appends the nested dictionary even though […]

Categories
Mastering Development

Unable to render thymleaf page from Spring-Boot controller

Issue : I have developed a Spring-Boot rest api which I can call from POSTMAN. Now I am requesting the same REST API method from a Thymleaf page. But it renders only a string. The actual page doesn’t gets loaded.. This is my controller : @RestController @RefreshScope @RequestMapping("/shopping") public class ShoppingController { @RequestMapping(value="/productList") public String […]

Categories
Mastering Development

What could you combine .uniq with to keep the original order of an array?

How would you either shift the order of an array or keep the natural order of an array when using the Ruby .uniq method or even .to_set? So for example: ([3,4,4,3,6,3]) # => [4,6,3]) ### with current method my solution outputs: Expected: [4, 6, 3], instead got: [3, 4, 6] These are all the other […]

Categories
Mastering Development

I want to flatten array based on it depth like if depth is 1 it will flatten array 1 if depth is 2 it will flattern array 2

HI everyone thanks in Advance I want to flatten array based on it depth like if depth is 1 it will flatten array 1 if depth is 2 it will flattern array 2 please see the expected output var depth = 1; function flatten(ary,depth) { return ary.reduce(function(a, b) { if (Array.isArray(b)) { return a.concat(flatten(b)) } […]

Categories
Mastering Development System & Network

Running MariaDB server 5.5 and sharing my.cnf on multiple diskless nodes

I’m attempting to install MariaDB Server 5.5 in a diskless image using Redhat Enterprise 7.8. The problem I am running into is having a single diskless image with a single /etc/my.cnf being deployed to all the nodes, which then are all pointed to the same data directory on the shared NFS storage. What I would […]

Categories
Mastering Development

Flutter Todo returns null at title = widget.title

I am having a problem with that my Todolist that returns error message: "A non-null String must be provided to a Text widget. ‘package:flutter/src/widgets/text.dart’: Failed assertion: line 360 pos 10: ‘data != null’ " and its in class MyHomePage at line title: new Text(widget.title. I have already tried to change it to title: new Text(widget.title??""), […]

Categories
Mastering Development

Repeating elements in vector

I am a C++ student. And I need to solve this problem: "Write a program that receives a number and an array of the size of the given number. The program must find all the duplicates of the given numbers, push-back them to a vector of repeating elements, and print the vector". The requirements are […]