Categories
Mastering Development

Add column with same prefix only if it s already existing in the dataframe

Here is my dataframe df2 <- data.frame(ID = c("1100455", "1100455", "1100455", "1100455", "1100455", "1100464", "1100464"), CATEGORIE = c("10110", "10160", "10604", "11220", "10110", "10110","10140"), RANK = c("1", "1", "1", "1", "0" ,"1", "1"), MD = c("0", "0", "0", "3", "4", "0", "0" ), PROD = c(2345.00,1114.58,501.40,0.00,0.00,2720.00,636.80), VALUE = c(540.00,0.00,0.00,0.00,0.00,0.00,0.00), QANT = c(50.00,0.00,5.00,0.00,50.00,0.00,0.00), VALUE3 = c(563.76,0.00,17.35,0.00,0.00,0.00,0.00), PROD3 […]

Categories
Database Development

View to check for spaces or zeros in all columns in all tables

I have a schema in a mapping system that has dozens of tables with columns that have incorrect values: Number columns where the value is zero, but it should be null. Text columns where the value is a space, but it should be null. I would like to create a dynamic view that users could […]

Categories
CMS Mastering Development Wordpress

Change woocommerce order total in api w3

I want to add custom order total via woocommerce api but could not find any solution. below is my request. $data = [ "status" => "processing", "customer_note" => "temp", "billing" => [ "first_name" => "first name", "last_name" => "last name", "address_1" => "address1", "address_2" => "address2", "email" => "abc.xyz@gmail.com", "city" => "CITY", "state" => "GJ", […]

Categories
Mastering Development

tidyverse function to `mutate_sample`?

I’m looking to mutate a column for a random sample, e.g., mutate_sample. Does anyone know whether there is a dplyr/other tidyverse verb for this? Below is a reprex for the behavior I am looking for and an attempt to functionalize (which isn’t running because I’m struggling with quasiquotation in if_else). library(dplyr) library(tibble) library(rlang) # Setup […]

Categories
Mastering Development

When I display a form using an array, POST data is not being stored as expected

I’m displaying a form using a foreach loop, however when trying to retrieve each field’s POST data they always return as empty. The function to create the form: <?php function display_form($fields) { foreach ($fields as $field) { ?> <label><?=$field[‘label’]?> <input type="<?=$field[‘type’]?>" name="<?=$field[‘name’]?>" value="<?=$field[‘value’]?>" /> </label> <?php } } ?> And the array itself with which […]

Categories
Mastering Development

LWJGL finding different OpenCL installation when runing outside of IDE

I’ve been using java in IntelliJ as a hobby for quite some time and have decided to start using OpenCL for parallel computing. I’m pretty sure that I’ve made no mistake downloading and adding the LWJGL library to my project, since it does always compile. The problem is that when I run the program, it […]

Categories
Mastering Development

arr.splice index inserts in all available indexes

const list = [] const obj = { name: ”, mobile: ” } _.forEach(errors, (value, key) => { // eslint-disable-next-line no-debugger // debugger const field = key.split(‘.’)[2] const index = key.split(‘.’)[1] obj[field] = value[0] list.splice(index, 1, obj) console.log(obj) }) Above is the code I am working on. And below, is the screenshot, of the logs […]

Categories
Mastering Development

arr.splice index inserts in all available indexes

const list = [] const obj = { name: ”, mobile: ” } _.forEach(errors, (value, key) => { // eslint-disable-next-line no-debugger // debugger const field = key.split(‘.’)[2] const index = key.split(‘.’)[1] obj[field] = value[0] list.splice(index, 1, obj) console.log(obj) }) Above is the code I am working on. And below, is the screenshot, of the logs […]

Categories
Mastering Development

Can’t generate an error response when user is not verifying recaptcha

everything is working perfectly but for some reason i can’t generate a error response when the user is not checking the ReCaptcha button. the form wont send until the user is checking that he is not a robot. I built a controller for the recaptcha that works perfectly fine and the error msg that it […]

Categories
Mastering Development

C++ operator[] access to elements of SIMD (e.g. AVX) variable

I’m looking for a way to overload operator[] (within a broader SIMD class) to facilitate reading and writing individual elements within a SIMD word (e.g. __m512i). A couple constraints: Compliant with C++11 (or later) Compatible with additional intrinsics based code Not OpenCL/SYCL (which I could, but I can’t *sigh*) Mostly portable across g++, icpc, clang++ […]