7 – How to embed a view that automatically filters the view as per the taxonomy term used on the page?

Suppose I have two Content Types – City and Destinations.

Nodes of Cities will have a view embedded listing destinations of any specific city. For example: India will be of Content type City and it will list down nodes Taj Mahal, Qutub Minar, City Palace as its Destinations.

How to achieve this?

magento2 – Magento 2 adminhtml how to create grid with data based on filters?

So I’m struggling creating a simple .phtml table that will have data of some search criteria.

I can’t use any datasource or collection because the data is not at any table, it comes from an API, so what is already doing the module is downloading in .csv the data, now I need to create a table and drop the data in that table .

I have tried this:

app/code/Vendor/Module/view/adminhtml/layout/reports_sales_report.xml

  <body>
        <referenceContainer name="content">
            <uiComponent name="vendor_reports_sales_grid"/>
             <block class="VendorModuleBlockAdminhtmlSalesReport" name="sales_report" template="Vendor_Module::grid.phtml">
             
            </block>
        </referenceContainer>
    </body>

But it’s not showing anything.

Can someone guide me?

Thanks!

magento2 – Magento 2 applying filters to collection reflects in all phtml

I have applied a filter in a PHTML that loads in headers. The filter is below.

In Constructor:

MagentoCatalogModelResourceModelCategoryCollection $collection

Block Code:

 public function getAllCategories(){
        return $this->collection;
    }

In PHTML:

$getAllCategories =  $block->getAllCategories();
$getAllCategories->addAttributeToSelect('*')->addAttributeToFilter('entity_id',array('in' => array($attributVaueArray)))->setOrder('updated_at', 'desc');

But I need to get the same collection in different PHTML without filters. If I use this Model in instructor the filter is applied automatically but I need to reset it.
Thanks in advance.

design – What’s the most efficient way to filter nearby users based on geolocation? (like dating apps filters)

I have a question about software design: Let’s suppose we have to design a dating application or other similar apps where you need to connect users based on location contiguity and let’s also suppose that the user itself can choose the miles/km range for possible connections. If the application has many users (milions), I think it would be very inefficient to navigate through the entire user table in the database, make geolocation comparisons for every user row and select only the people that satisfy a given range, probably with the help of indexes you can gain some time but would be still quite inefficient in my opinion.

What’s the efficient way that dating application use to complete this task? Maybe a preliminar filter to sort the best candidates (maybe based on cities, counties or countries borders) and then apply a second filter directly on the backend on that filtered collection retrieved from the database?

Image distorted on max zoom using filters

I have 77D and Sigma 150-600m contemporary lens. When I use any filter on the lens at 150mm I get desired outcome. But if I zoom in the image will get distorted. Is this expected or do I have faulty settings or faulty filters?

Clarification: Replication Filters for MySQL Group Replication

https://dev.mysql.com/doc/refman/5.7/en/replication-rules.html says:

Note that replication filters cannot be used on a MySQL server instance that is configured for Group Replication, because filtering transactions on some servers would make the group unable to reach agreement on a consistent state.

For example, if servers A, B, and C are a cluster, then each of them should be able to take over in case either of the others crashes. Therefore they should all have the same data at all times, i.e. the same schemas and tables and the same rows of data in the same state.

But if one of these servers have replication filters, then that one by definition doesn’t have the same data. If a failover event occurs, it will appear to clients as if some tables suddenly disappeared. And maybe those tables will suddenly come back if another failover event occurs later.

It just creates too many weird cases of inconsistency that have no clear resolution. You might be able to choose a resolution that makes sense for your application (or at least some cases in your application), but it won’t be the right resolution for someone else’s application.

The simpler rule is: don’t create replication filters on any server in a cluster, when the servers are intended to have identical data. If you have some other set of data that isn’t required to be kept in sync with the cluster, then you should provision another server.

algorithm – Refactor Javascript filter that handles click and changing together dropdown filters

I’m looking to rework and make it easier to read this handleFilterChange function

This is helper being used in the function

  const getTestableValue = (val: any) => val?.toString().trim();

Sample for the filter value

{
    "clock.props.children": (),
    "station": ()
}

Sample of val being passed

clock 
clearance and tagging

Sample of currentFilterMenu being used

{
    "prop": "clock.props.children",
    "name": "Clock Name"
}

This is the actual function I would like reviewed

  const handleFilterChange = (val: any) => {
    const testableValue = getTestableValue(val);
    let newFilters = JSON.parse(JSON.stringify(filters));
    if (currentFilterMenu) {
      if (
        testableValue === 'ALL' &&
        newFilters(currentFilterMenu.prop).length ===
          filterOptions(currentFilterMenu.prop).length
      ) {
        // hide all
        newFilters(currentFilterMenu.prop) = ();
      } else if (
        testableValue === 'ALL' &&
        newFilters(currentFilterMenu.prop).length !==
          filterOptions(currentFilterMenu.prop).length
      ) {
        // show all
        newFilters(currentFilterMenu.prop) =
          filterOptions(currentFilterMenu.prop);
      } else {
        const foundIdx = newFilters(currentFilterMenu.prop)?.findIndex(
          (item: any) => testableValue === getTestableValue(item)
        );
        if (foundIdx !== undefined && foundIdx >= 0) {
          // value is being unchecked
          newFilters(currentFilterMenu.prop).splice(foundIdx, 1);
        } else {
          // value is being checked
          newFilters(currentFilterMenu.prop).push(val);
        }
      }
    }
    setFilters(newFilters);
  };

field value parsed of the better exposed filters

Using the Better exposed filters in view. Filter fetch from the list of filed in content type. Not the taxonomy. For filter using ajax. how can we fetch individual filter field value in Url for copy individual list paste in another page?

io – How to write multiple filters and maps in Java 8 Streams

io – How to write multiple filters and maps in Java 8 Streams – Super User

filters – Support old attachment url scheme after migrating uploads

There is an active site where all attachments are stored in the root of the uploads directory. Many files dramatically affect the performance, so I decided to put them into subdirectories with the scheme: year/month/day according to post_date_gmt.

All went well, but there is a problem: there may be old links to the images on the Internet, and also, for SEO reasons, I want to maintain them for a while.
I wrote a small filter that determines the new path of the file by its name (since the images were in the same directory, uniqueness in subdirectories is guaranteed):

add_filter('request', function ( $request ) {
    $uri = $_SERVER('REQUEST_URI');
    $filename = basename(parse_url($uri)('path'));
    if ( empty( $filename ) || preg_match('//d{4}/d{2}/d{2}//', $uri)) {
        return;
    }
    global $wpdb;
    $sql = $wpdb->prepare(
        'SELECT meta_value FROM wp_postmeta WHERE meta_key = "_wp_attached_file" AND meta_value LIKE %s;',
        '%' . $filename
    );
    $result = $wpdb->get_results($sql);
    if ( ! empty( $result )) {
        $file_path = $result(0)->meta_value;
        $new_uri = str_replace($filename, $file_path, $uri);
        // header or wp_redirect
        header('Location: ' . $new_uri, true, 301);
        exit;
    }
}, 99, 1);

This code seems to work, but I notice problems in the admin panel (not all resources are loaded correctly). I suspect that my implementation is too naive, and I need to improve it.

Also uploads has been migrated to the AWS S3 and I use this plugin for it: https://github.com/humanmade/S3-Uploads

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheap USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Best Quality USA Private Proxies