mariadb – Query all of a sudden stopped working – Simple left join but cannot see what is wrong

I had a query that was a simple left join between two tables with IS NULL included in the where clause because I needed all of the rows of the left table shown, even if it gave null values in the right table.

This worked as I had it working within my php code and my site was displaying what it needed. I haven’t looked at this in over a week and went back today to see that it is now all of a sudden not working even though I haven’t touched it.

I have created a db fiddle here with my exact code and tables – https://dbfiddle.uk/?rdbms=mariadb_10.4&fiddle=2effc82390641ce513806252700fd25c

I want to show – all rows in the left table (level_quiz) and all rows in the right table (student_points) where student_no = 40204123 OR there are NULL rows

Could anyone please have a look at this to see why it is not showing the extra row of the left table? (where there would be NULL values for the right table)

This would be much appreciated.

multithreading – Simple Parallel Sorting

i had made a simple parallel sorting for my personal games. it did well so far, but i would like to get some advises about how to improve it further or perhaps there are an alternative methods for better sorting data.

#include <iostream>
#include <iomanip>
#include <functional>
#include <vector>
#include <thread>
#include <future>
#include <random>

template<typename T, typename C = std::less<typename T>>
void parallel_sort(T* data, std::size_t len, std::size_t grainsize, const C& comp = C())
{
    // Use grainsize instead of thread count so that we don't e.g.
    // spawn 4 threads just to sort 8 elements.
    if (len < grainsize)
    {
        std::sort(data, data + len, comp);
    }
    else
    {
        auto future = std::async(parallel_sort<T, C>, data, len / 2, grainsize, comp);

        // No need to spawn another thread just to block the calling 
        // thread which would do nothing.
        parallel_sort(data + len / 2, len / 2, grainsize, comp);

        future.wait();

        std::inplace_merge(data, data + len / 2, data + len, comp);
    }
}


int main()
{
    auto eval = ()(auto fun) {
        const auto t1 = std::chrono::high_resolution_clock::now();
        const auto (name, result) = fun();
        result();
        const auto t2 = std::chrono::high_resolution_clock::now();
        const std::chrono::duration<double, std::milli> ms = t2 - t1;
        std::cout << std::fixed << std::setprecision(1) << name << " took " << ms.count() << " msn";
    };

    using ints_t = std::vector<int>;
    ints_t ints(200); // *Not* ints{200}!
    std::generate(begin(ints), end(ints), std::rand);
    {
        ints_t l{ ints };
        eval((&l) { return std::pair{ "parallel_sort",
            (&l) { return parallel_sort(l.data(),l.size(), l.size() / std::thread::hardware_concurrency()); } }; });
        assert(std::is_sorted(begin(l), end(l)));
    }
    {
        ints_t l{ ints };
        eval((&l) { return std::pair{ "std::sort",
            (&l) { return std::sort(std::begin(l), std::end(l)); } }; });
        assert(std::is_sorted(begin(l), end(l)));
    }
}

magento2.3 – How to use grouped product attributes for simple products in layered navigation

I am working on a chemical catalog and I have created grouped products to add attributes like molecular weigt, CAS-Number and other chemical data. These data are all the same for my simple products.
In the layered navigation the grouped products are displayed with its attributes.
What I want now is, that when I click on the layered navigation option, my simple products are displayed too. Untill now, I see only my grouped product.

Therefore my question:
Is there a way to use my grouped attributes to select also my simple products?

Thanks Chris

gui design – Simple implementation for search operators (Begins with, Contains, = etc.)

Wanted to get your input on different methods for implementing these sort of operators for search fields.

I’ve seen it done mostly by adding an extra dropdown option before each field with these options (Apple uses this method a lot)

mockup

download bmml source – Wireframes created with Balsamiq Mockups

However this takes up a lot of real-estate on the UI.

I would like to keep it within a single input field and maybe introduce filtering from how the string is entered:

  • Contains (default): John
  • Begins with: Jo*
  • Equals: “John”

This would be a training issue initially, but once you learn it much quicker, and minimal UI impact on current design.

choice field – Simple SharePoint Flow to Send Email Issues

Christy, the problem is that your condition assumes that theNeesUpdating field is a yes/no field. However, NeesUpdating field is simply a text/choice field. So you can’t compare text to the boolean values (true and false).

So, to fix the issue, simply update your Condition to compare with Yes like on the screenshot below:

enter image description here

Remember, you don’t need any quotes or formula, you simply ned to type Yes in the condition.

c++ – Simple username validation

Instead of the loop, we can use std::all_of() (or std::any_of() with the opposite condition).

And we have std::isalnum(), which is likely implemented as a lookup table like this (with the caveat that we need to be careful about signed char). It’s more portable, too – the code we have will be wrong if there are non-alphabetic characters between A and Z, as there are on EBCDIC systems, for example.

We could change the interface to just return the error string, with a null pointer indicating success, to avoid the “out” parameter.

#include <algorithm>
#include <cctype>
#include <string>
    
// return a null pointer if valid, else a pointer to the error message
const char *check_username_valid(const std::string& str)
{
    if (str.length() < MinUsernameLen) { return "Username Too Short"; }
    if (str.length() > MaxUsernameLen) { return "Username Too Long"; }
    auto const char_permitted
        = ()(unsigned char c){ return c == '_' || std::isalnum(c); };

    if (std::all_of(str.begin(), str.end(), char_permitted)) {
        return nullptr;
    }

    return "Invalid Character in Username";
}

Minor: no need for cast to int when indexing (a(int(((unsigned char)(x))))). An unsigned char is perfectly fine as array index.

python 3.x – Image shows normally on simple program, but appears blank when I introduce it to mine (Tkinter)

I am trying to show a graph on the screen that I just plotted using matplotlib on python.
Basically, my program receives a bunch of parameters and then makes a graph, that should be displayed on screen.
Since I am new to tkinter, I made a simple program to see if the code worked:

from tkinter import *
from PIL import ImageTk, Image
root=Tk()

my_img1=ImageTk.PhotoImage(Image.open("plot.png"))   
my_label=Label(image=my_img1)
my_label.grid(row=0,column=0,columnspan=3)

mainloop()  

This works just fine.

However, when I introduce it into my actual program:

def graficar_fracciones():
    
    lista_de_ERRtotal=()
    for i in range(1,50):
        agregar=ERR_total(i)
        if agregar <0:
            lista_de_ERRtotal.append(0)
        else:
            lista_de_ERRtotal.append(agregar)
    plt.figure(figsize=(1.5,1))
    plt.plot(lista_de_ERRtotal)
    plt.xlabel("Cantidad de fracciones")
    plt.ylabel('ERR Total')
    plt.savefig('plot.png', dpi=300, bbox_inches='tight')
    my_img1=ImageTk.PhotoImage(Image.open("plot.png"))   
    my_label=Label(image=my_img1)
    my_label.grid(row=0,column=0,columnspan=3) 
    return

This function graphs the plot, then saves it. Then I open that plot and try to show it on screen, but it just shows blank.
Why could this be happening? I have checked some similar posts, but haven’t been able to find an answer.

How do prevent a custom product from being directly linked when its simple products are out of stock?

  • if the config becomes out of stock, all symples in it are out of stock – then it is not available by reference, not visible (it becomes Not Visible Individually)
  • if in the config the simple becomes in stock, then the config is available via the link, becomes visible and available by search (Catalog, Search).