categories – Second filter (by date) doesn’t use the category of first filter after the first click

I have two filters. First one is the filter by post category, it works well.
The second category filter is post by date (period = week, 2nd week) and work only on first click for this filter.

When I click on one category, I store the number of this one inside a span “data-catid”. Same for the date filter with “data-date” in the same span.
Ajax request for date filter use “data-catid” to get the category used by post category filter.

However from the second click on each date filter div, ajax request use always the same category.
That’s mean it’s no longer uses the “data-catid” only after first click.

the value wrote inside data-catid and data-date are always good !

Span “cat-id” is insert before the container refreshed by ajax request.

example : by default data-catid=”all” and data-date=”fweek”

First click (change category) : data-catid=”49″ (sport) and data-date=”fweek” (fisrt week) -> ok

Second click (change period): data-catid=”49″ and data-date=”fweek2″ (second week from “fweek”) -> ok

Third click (change category (2)): data-catid=”50″ (Culture) and data-date=”fweek2″ -> ok

Fourth click (change period (2)): data-catid=”50″ (Culture) and data-date=”fweek” -> problem = data-catid use by date filter is “49”.

After fourth click each click on period button get always category “49”.
it could be another category

I can’t find a solution

(function($){
    $(document).ready(function(){
        
        //Filtre par cat├ęgorie
        $(document).on('click', '.js-filter-cat > a', function(e){
            e.preventDefault();
            e.stopPropagation();
            
            var selected = $(this);
            var category = $(this).data('category'); 
            var idrangedate = $('.rangedate_selected').data('date');
            $.ajax({
                url: wpAjax.ajaxUrl,
                data: { action:'filter_cat', category: category, idrangedate: idrangedate},
                type: 'post',
                beforeSend: function () { 
                    $('.c_loader').removeClass('dnone');
                    $('.js-filter-cat > a').removeClass('category_selected');
                },
                success: function(result){
                    $('.c3-info').html(result);
                    $.getScript('https://website.fr/wp-content/themes/websiteTheme/script/publicites.js');
                    selected.addClass('category_selected');
                    if(selected.hasClass('all')){
                        $('#cat-id').attr('data-catid','all'); 
                        category = 'all';
                        alert(category);
                    }else{
                        $('#cat-id').attr('data-catid',category);
                        alert(category);
                    }
                },
                complete: function () { 
                    $('.c_loader').addClass('dnone') 
                },
                error: function(result){
                    console.warn(result);
                }
                
            });
        });
        
        //Filtre par date - en fonction de la cat├ęgorie choisie
        $(document).on('click', '.topleftbar-options li', function(e){
            e.preventDefault();
            e.stopPropagation();
            
            var selected = $(this);
            var filtercategory = $('#cat-id').data('catid');
            alert(filtercategory);
            var idrangedate = selected.data('date');
            $.ajax({
                url: wpAjax.ajaxUrl,
                data: { action:'filter_date', filtercategory: filtercategory, idrangedate: idrangedate },
                type: 'post',
                beforeSend: function () { 
                    $('.c_loader').removeClass('dnone');
                    $('.topleftbar-options li').removeClass('rangedate_selected');
                },
                success: function(result){
                    //alert("error");
                    $('.c3-info').html(result);
                    $.getScript('https://website.fr/wp-content/themes/websiteTheme/script/publicites.js');
                    selected.addClass('rangedate_selected');
                    
                    $('#cat-id').attr('data-catid',filtercategory);
                    $('#cat-id').attr('data-date',idrangedate);
                },
                complete: function () { 
                    $('.c_loader').addClass('dnone') 
                },
                error: function(result){
                    console.warn(result);
                }
                
            });
            //reset();
        });
        
        
    });
})(jQuery);

javascript – Filter object properties by key in ES6

Let’s say I have an object:

 var item=   {
      date1: {enabled: false, label: "Date1 Label"},
      date2: {enabled: false, label: "Date2 Label"},
      date3: {enabled: true, label: "Date2 Label"},
    }

Like this I have textbox and dropdown.
I want to create html input , dropdown based on enabled is true
by filtering the object need to get an array which is having enabled option.
I am looking for a clean way to accomplish this using Es6.

8 – How to filter content by a specific taxonomy term when vocabulary allows multiple values?

I have defined a vocabulary that allows multiple terms to be checked for a Content Type and I would like to create a View that could gather all the data from that Content Type but grouping the results by a specific term.

When I’m not applying any contextual filter, the result list should contain a group of data for every term in my vocabulary. Naturally, some of the items will appear in multiple groups because of the multiple terms scenario.

I would like to create a contextual filter for a specific term and get as a result only one of those groups. The problem is that I’m getting not only the group I expect but other groups in which some of the results have more than one term selected for the same vocabulary.

For example:

  • Content type is “Dogs”.
  • Vocabulary is “Places”.
  • Taxonomy terms for “Places” are: “Kitchen”, “Living room”, “Garage”, “Outside”.

“Dogs” has a field called “Places to play with my owner” which is related to “Places” and the user can select one or more options.

I created a view that has:

  • A relationship with “Places” vocabulary.
  • A contextual filter that retrieves all the “Dogs” that play on each of those places when there is no specific term to filter.
  • A field group using the “Places” term names.

And retrieves the following results on a URL like: /dogs/places-to-play/:

  • Kitchen: Dog A, Dog B.
  • Living Room: Dog A.
  • Garage: Dog C.
  • etc.

The contextual filter should receive a “Places” term name via URL like: /dogs/places-to-play/kitchen and the expected result would be:

But in my case, the results are:

  • Kitchen: Dog A, Dog B.
  • Living Room: Dog A.

Because “Dog A” has options “Kitchen” and “Living Room” selected in its “Places to play” field.

The question is: Is there a way to avoid getting the extra groups?

Thanks in advance.

High shutter speed VS ND filter

There can be differences. For some subjects, a longer exposure just works better.

One of the classic examples is taking a picture of moving water in a river or stream. With a short exposure, the water looks rather strange and frozen. With a longer exposure, you get a smooth, flowing look that many people find more pleasing. Depending on how fast the stream is moving, it often takes an exposure around 10-15 seconds (or so) to achieve this look, so in bright light you often just about need an ND filter to get a long enough exposure.

Another place that a really long exposure can be helpful is taking pictures of popular tourist attractions. If you’re patient (and have a tripod) with a heavy ND filter, you can take something like a five minute exposure. The people (who rarely sit still very long) mostly disappear. Take a half dozen or so, and combine them properly in Photoshop, and most of the tourists simply disappear.

Of course, there are also cases where you really want a short exposure. The most obvious is almost anything (like sports) that involves fast action. With too long of an exposure, most of this would turn into an incoherent blur. On the other hand, I think many people to a bit overboard with this, trying to completely “freeze” everything in the shot. I generally prefer to use a long enough exposure that a few of the fastest moving parts are still at least slightly blurred, to retain a sense of motion.

Just for example, consider this shot:

enter image description here

Here I worked pretty hard to find what I considered the “right” shutter speed. The obvious strategy would have been to shoot with the aperture wide open, to get the shortest shutter speed, so everything would be frozen and sharp looking.

I chose, instead, to use a longer exposure and pan with the bike, so the background and spokes of the wheels are blurred, so you get clarity but get a clear sense of motion. In this case, I only used the aperture to get a slower shutter speed, but if I’d had the right ND filter with me, I’d have used it–shallower depth of field to further blur the background would be an improvement.

This can get a little tricky though. For example, another shot from the same night:

enter image description here

Part of the time I think this would be better if I’d used a faster shutter speed. Other times, I think the kind of…frenetic feel of it is just about right. Kind of depends on what sort of result you want though–at least to me, the way it is right now is strong on “feel”, but would probably be a problem if you wanted a really factual presentation.

WooCommerce REST API: Filter orders by advanced custom field

I am using WooCommerce and Advanced Custom Fields for the orders.
Is there a way to filters orders using the WooCommerce REST API by a custom field?

I’m guessing if there is no built in solution, perhaps some custom function can allow this.

Thank you.

How to use the filter flag in drush config:status

If you look at the ConsolidationFilterOperatorFactory class mentioned with the error, you’ll see documentation at the top of the Class that outlines the acceptable syntax.

**
 * Convert a simple operator expression into an Operator.
 *
 * The supported operators include:
 *
 *      key=value           Equals
 *      key*=value          Contains value
 *      key~=#regex#        Regular expression match
 *
 * It is also possible to negate the result of an operator by
 * adding a logical-not operator either before the entire expression,
 * e.g. !key=value, or before the operator, e.g. key!=value.
 *
 */

Using the above documentation as a guide, the following all work for me – examples two and three should work for your example case.

// 1. Use the *Equals* option to show only the config entity with name "webform.webform.contact"
drush --filter="name=webform.webform.contact" config:status

// 2. Use the *Contains value* option to show any config entity with name containing "webform.webform"
drush --filter="name*=webform.webform" config:status

// 3. Use the *Regular expression match* option to show any config entity with name starting with "webform.webform."
drush --filter="name~=#^webform.webform.*#" config:status

How to filter my view of Groups to show results matching Term A or Term B

By default, all Filters get added to the same Filter Group (a filter group is just a group of filters that share a logical operator, e.g. AND or OR). The default behavior is to put all filters into the same group with the logical operator AND. This means that if you have Filter A, Filter B, and Filter C, the view will only produce results that have the value from each filter, Filter A, Filter B and Filter C.

You can review your filter operators and grouping by clicking the Dropdown Button for Filter Criteria and choosing the And/Or Rearrange option.

Views Filter Criteria And/Or Rearrange screen showing Filter A, Filter B, and Filter C in one filter group with logical operator AND

However, it sounds like you want Filter B and Filter C to use an OR Filter group, i.e. you want the view to show results where the content has the value from Filter B or has the value from Filter C.

To do this, you need to make sure that Filter B and Filter C are in their own Filter group and that group’s logical operator is set to OR. If you only have the two filters, you can use the original grouping, but change the operator. However, if you have other filters, e.g. my example with 3 filters, you’ll need to create a new group.

After you create a second filter group, you’ll see that you can control the operator for each filter group and you can also control the operator between the filter groups.

In an example with Filters A, B, and C, if I want to display all results where content has the value from Filter A AND the content has the value from Filter B OR Filter C, I would create two filter groups:

  1. Group 1: with only Filter A
  2. Group 2: with Filter B and Filter C

I would then set the logical operators:

  • Group 1’s logical operator would be set to AND (the default, there’s only one filter here so it shouldn’t matter).
  • Group 2’s logical operator would be set to OR (as we want to get results where the content matches either of the Filter B or Filter C, it does not need to match both).
  • The operator between Group 1 and Group 2 would be set to AND

Views Filter Criteria And/Or Rearrange screen showing Filter A in one Filter Group with logical operator AND, Filter B and Filter C in a second filter group with logical operator OR, with the AND operator between the two groups

long exposure – Will stacked ND filters perform as well as a single 10 stop ND filter?

If you’re stacking filters, you’re liable to get vignetting around the corners of the photo. Plus, there’s the danger of internal reflections, and other optical issues.

My preferred solution is a single, variable ND filter, with which you can dial-in the amount of light you want.

EDIT responding to comment:

A variable ND filter is one that can vary its density. By twisting it, it gets lighter or darker, so — depending on the filter in question — you could adjust from, say, 1 stop to 10 stops, all in a single accessory. Obviously this is more expensive, even than buying a couple of regular filters, but I find it a big help.

As I understand it, this is basically built of two thin CPL filters, so twisting it alters the angles between the polarization, letting in more or less light. But when I tried to do that myself, with two of my own CPLs, the results just didn’t work at all.

EDIT 2: I only just looked at your sample image. I don’t think that you can do this photo with ND filters alone. I’m pretty sure there’s also multi-exposure HDR going on in there as well.

Does play store filter out NFC apps for phones which do not have NFC?

That depends on the app. For using NFC in an app the developer has to declare that in the app’s AndroidManifest.xml that is contained it the app (and used by the PlayStore to detect if an app is compatible at all).

When using a feature you can declare if it is required=true or not, if it is not required it is considered optional:

<uses-feature android:name="android.hardware.nfc" android:required="true"/>

Therefore for apps that declare the NFC feature as required=true PlayStore will not show you those apps on a non NFC phone. If it is set to optional (required=false) then you will be able to see this app.

See also https://stackoverflow.com/questions/52695866/does-nfc-permission-result-in-an-error-when-the-device-has-no-support

rsyslog single filter conditional sintax

I’m looking to a way to write a single rule with multiple match values, don’t write those row to logfile if the message contain first word or second work

This works but isn’t DRY:

if $msg contains "WARNING:" then { Action (type="omfile" File="/var/log/ignorethis") stop }
if $msg contains "IGNORE THIS MESSAGE:" then { Action (type="omfile" File="/var/log/ignorethis") stop }

this one doesn’t work:

if $msg contains "WARNING: || IGNORE THIS MESSAGE:" then { Action (type="omfile" File="/var/log/ignorethis") stop }