Is there a function to query/add values from a tab/sheet and keep fixed even if deleted or changed from the reference sheet/tab?

I have a sheet with dynamic values entered by a team. These data can change daily (deleted or changed or added more data) like list of names who are willing to participate in an event. I want to make a separate sheet or tab that will query or list all the data that were entered and not to disappear even if they were deleted later by the team.
Lets say Tab A is Data_Entry
and Tab B is my admin sheet that contains all data entered.

How to retrieve product attributes values in Magento 2

I want to get configuration product attributes values in phtml file.

enter image description here

Above two value i want to get in magento 2.

So please Explain me How to get.

THANKS.

bitcoin core – What algorithm do miners (mining pools) use the generate different blocks as they exhaust the nonce values

As I understand it, the building of a block goes something like this (please correct):

  1. Collect a bunch of new transactions.
  2. Hash all those transactions.
  3. Generate a coinbase transaction using the miner’s (mining pool) public address.
  4. Generate the Merkle root for all the transactions using an arbitrary order.
  5. Fill in the block header.
  6. Dispatch to mining hardware which will try all 2^32 nonce combinations.

Now, when the mining hardware says that there is no solution after trying all nonce combinations, it appears that it has the following options for generating new options to check:

  • Gather new transactions (or drop transactions), hash, and recalculate the Markle root.
  • Update the script (extranonce) field in the coinbase transaction (or the target address), hash, recalculate the Merkle root.
  • Update the timestamp in the header (what is the granularity on the timestamp).
  • Update the difficulty in the header (is this possible)??
  • Rearrange transaction order, and recalculate the Merkle root.

Are there any options I missed. What is the typical order that the mining pools do these things?

Thanks

python – how to compare two dictionaries values based on a key?

I have a code that with two lists of dictionaries, and should make a final dictionary based on the comparing of two lists.

This is the code:

zones = (
          {"id": 10, "serial": "11068", "lat": 35.25, "lon": 10.74},
          {"id": 11, "serial": "11122", "lat": 35.34, "lon": 9.89},
          {"id": 11, "serial": "11128", "lat": 35.34, "lon": 10.00},
          )

clients = (
    {"id": "e", "flag": True, "lat": 48.46, "lon": 15.03},
    {"id": "b", "flag": True, "lat": 45.66, "lon": 10.92})


def distance_in_km(lat1, lon1, lat2, lon2):
    # This function does subtraction on two geographic coordinates and returns distance in km
    return distance


temp_sorted = dict()
for cl in clients:
    
    if cl('flag'):
        temp_sorted.setdefault(cl('id'), {})
        for loc in zones:
            cl_lat = cl.get('lat')
            loc_lat = loc.get('lat')
            cl_lon = cl.get('lon')
            loc_lon = loc.get('lon')

            
            distance_val_in_km = distance_in_km(loc_lat, loc_lon, cl_lat, cl_lon)
            # filter distances less than 5
            if distance_val_in_km < 5:
                temp_sorted(cl('id'))(loc('serial')) = distance_val_in_km

So it goes to the client list and compare each dictionary lat and lon with all those values in the zones dicts. Pass the extracted values to distance_in_km() function and puts the final value in another dictionary.

This code works, but just courious to know is there any way to improve it.

Exposed filter in view should display all available values in select box

I added an exposed filter to my view where users can enter the desired value to filter the results accordingly. But I want to make it easier for them by changing this filter to a select box style dropdown where they can select a value out of all available values.

To make this more clear; I’m talking about a year, so each article has a field “year” and because there are many articles published in many years, I want to group all available years from all articles and show them to the user in this select box.

But I can only make this possible by adding the years in the grouped filters manually, that means each year I have to add a new option to the filter manually. And if there are articles added later which originally were published earlier than years available in the options, I probably will never cover all years in this set of static options.

So is there a way to get all years of all articles and showing them in a select box?

How to want to configuration product attributes values in Magento 2

I want to get configuration product attributes values in phtml file.

enter image description here

Above two value i want to get in magento 2.

So please Explain me How to get.

THANKS.

c# – Ajax string[] -> .Net List, All values appear as CSV in first element

I am having some trouble getting a list of strings to correctly translate from an jQuery.ajax request to a .Net controller method. The values of the client side string array are appearing as a comma separated list in the first element of the server side list.

It must have something to do with the way it is stringifying/parsing the data, but I can’t figure out what I can change to get the correct behavior (I’m sure it is something super simple that I’m not seeing). I mostly want to know what I can do to get this to work, but also what might be happening behind the scenes to cause this.

This is the value of the array just before sending it to the server (using typescript client side controller, auto-generated with TypeWriter from server controller)
enter image description here

And this is the value received by the .Net server side controller (I also tried using string() instead of List<string> and got the same result)
enter image description here

8 – How to override nid filter to accept multiple values on views

I have read a dozen of open tickets on this issue, but none of them explains how to solve this.
Lets say I have a raw array of nids and wanting to override the query in a hook for the nid filter.
The nid filter allows only 1 value or some of the operators given in the image below.

enter image description here

There isnt an operator “is one of” as in the taxonomy reference filter. So how could this be overriden and allow multiple values for the nids?
Is this possible perhaps within the hook_views_query_alter()?

naming – Pattern name to compare previous raw values to current values

I find myself applying a certain pattern again and again and I assume I am not the first one. I am looking for a name.

In the environment I find myself in we get updates to values via an external interface. Based on those updates, we have to produce certain effects. Practically, our effects not only depend on the current value, but also on the history.
For example, we might observe a traffic light, and if it turns red without passing yellow in between, we warn.

class TrafficLight {
    boolean red
    boolean yellow
    boolean green
    // TrafficLight part of interface -- cannot add methods
}

updateTrafficLight(TrafficLight current) {
    if (roadClear && current.red)
        log.warn( "switched from plain green to red without yellow in between!" ) // example effect
    roadClear = current.green && !current.yellow && !current.red
    
   // 50 more effects, might be organized in methods / classes
}

The main problem are flags like roadClear which extract some information from an update. Those flags are read on the next update. With the 50 other effects, the state becomes untractable and every little refactoring might introduce bugs because the sequence of setting the (previous)state and reading it might be shuffled.

These TrafficLight updates are well logged, part of the specification and analysed by external suppliers. So I often find myself refactoring this into mostly pure stateless functions that compare the previous update and the current value like this:

compareTrafficLight(TrafficLight previous, TrafficLight current) {
    if (isRoadClear(previous) && current.red)
        log.warn( "switched from plain green to red without yellow in between!" ) // example effect
}

boolean isRoadClear(TrafficLight trafficLight) {
    return trafficLight.green && !trafficLight.yellow && !trafficLight.red
}

Does this bundling of current and previous value (and avoid other state) have a name?
It might be worth noting that it gives rise to a container Diff<T>. Instead of Diff, there might be an accepted name. Diff has map (Functor) and flatMap (Monad).

Diff<T> {
    T getPrevious()
    T getCurrent()
}

java – Recursively traversing a tree to print values within a range

I have the following question:

Given a Binary Search Tree and two numbers – a & b, return all the nodes in the tree that lie in the range (a .. b). Your method should return an ArrayList with the data of the qualifying nodes inserted in ascending order.

This is the provided solution code, with my comments expressing my “theory” on why the recursion is written that way:

public  ArrayList<Integer> rangeList = new ArrayList<Integer>();

public void printRange(TreeNode root, int a, int b) {
    if(root == null){return ;}

    //check if there's something lower that needs to be added first
    //go down root.left
    if(root.data >= a){
        printRange(root.left, a, b);
    }

    //if within the range, add it to result list 
    if(root.data >= a && root.data <= b){
        rangeList.add(root.data);
    }

    //?????????
    if(root.data <= b){
        printRange(root.right, a, b);
    }

I cannot figure out third portion of the code. Why do we traverse the right subtree if root.data <= b?

It seems to me it is unnecessary to do so because we already know root.data <= b.

Anything > b would be ineligible to be put into our answer array. Yet we traverse down the right subtree.

Can anyone clarify?

Edit:

here is an example test case and solution:

Example:  
       4                                  
      /                               
     2   8  
        /                      
       5  10                  

Range (2,8) ==> (2, 4, 5, 8)

Range includes 2 & 8