polarizer – Polarizing filter – degree of polarization vs polarizing sunglasses?

The bulk of polarizing filters these days for photographic purposes are so-called “circular polarising filters”, in brief CPL. They consist essentially of a proper linear polariser and a “quarterwave plate” that “scrambles” the polarised light in order to make it mostly unpolarised again. The reason is that parts of camera optics particularly in SLR and DSLR, like beam splitters, phase-based autofocus, separate exposure meters, analog TTL flash metering will fail to work reliably with polarised light.

The quarterwave plate is not perfect but good enough for those purposes. As a result, CPL filters have a “polarised” and an “unpolarised” side in a manner of speaking, with the polarised side turned to the scene and the unpolarised turned to the camera.

For any purposes intended to try blocking light, you thus need to place CPL filters with their front sides facing each other or with the front side turned to (say) a laptop screen.

If you instead use the backside, the polarised light will first get depolarised by the quarterwave plate and then half of it gets blocked by the polariser plate. Since “depolarisation” is not perfect except for a single wavelength of light, you’ll get various hues by rotating the filter then, but no blockage. Orienting it the other way should give you the expected blockage on certain angles.

buttons – How do I tell the user a filter is active

I have a button in my interface that when clicked shows a listbox so the user can apply a filter by those items the user has selected. It looks like this:

Filter

My question is: How do I tell the user there is an active filter? The tooltip of the button will have a description of the active filters but I was thinking about a change in the icon or the border of the button. What color would you make the icon for when a filter is active and when it is not?

Edit: Screenshot of the top of the application where the button is placed (the button is in the middle after the three comboboxes:

Top

php – Catalog page filter by through url?

I am trying to get some custom parameters in the catalog page (archive.php) query. Like I can filter with attributes. For example, this works with the built in filter products by attribute woocommerce widget:

http://localhost:3000/shop/?filter_color=red

Now I basically want to be able to have this available as well directly through url parameters:

  • Filter on a time period. So lets say http://localhost:3000/shop/?start_date=some_date_format&end_date=some_date_format
  • Filter by terms

Now I know I can create for example a Tax Query and give my own parameters and basically use the get parameters, but my question is, when I go to for example: http://localhost:3000/shop/?start_date=some_date_format&end_date=some_date_format

how can I make sure I can use those get parameters in the query that the catalog page/archive.php?

sharepoint online – How to filter “Yes/No (check box)” field from lookup list using pnp/rest api

How to filter “Yes/No (check box)” field from lookup list using PnP/REST API?

I can filter other columns with different types but not able to filter “Yes/No (check box)” field.

It is showing below error message:

The query to field ‘LookupList/LookupField’ is not valid.

python – Filter a pandas dataframe using values from a dict

I need to filter a data frame with a dict, constructed with the key being the column name and the value being the value that I want to filter:

filter_v = {'A':1, 'B':0, 'C':'This is right'}
# this would be the normal approach
df((df('A') == 1) & (df('B') ==0)& (df('C') == 'This is right'))

But I want to do something on the lines

for column, value in filter_v.items():
    df(df(column) == value)

but this will filter the data frame several times, one value at a time, and not apply all filters at the same time. Is there a way to do it programmatically?

EDIT: an example:

df1 = pd.DataFrame({'A':(1,0,1,1, np.nan), 'B':(1,1,1,0,1), 'C':('right','right','wrong','right', 'right'),'D':(1,2,2,3,4)})
filter_v = {'A':1, 'B':0, 'C':'right'}
df1.loc(df1(filter_v.keys()).isin(filter_v.values()).all(axis=1), :)

gives

    A   B   C   D
0   1   1   right   1
1   0   1   right   2
3   1   0   right   3

but the expected result was

    A   B   C   D
3   1   0   right   3

only the last one should be selected.

Add Filter in REST Export display in view in D8

I have a view “Nearest Dealers” that lists all the near dealers. There are two displays – Page & REST Export. I’ve added a filter(exposed to visitors) that lets customer search dealers based on current location and distance(eg: 10km radius). Filter works perfectly, but I want to show the same filtered results in REST Export display for the same view. Is it possible to do so because I have no clue how to make this work. Or is there any way to add the same filter for the REST Export display ?

jquery – I want to reorder & filter the custom fields on the admin screen

I am using custom fields for an unpublished page to hold all kinds of data for my site. It works fine except that in the admin page, they’re ordered by their meta_id when I want them in order by meta_key like:

name value
field_a 1
field_b 2 
field_c 3 

instead of

field_c 3
field_a 1
field_b 2

I also wanted to add a filter so that only some fields will be shown at a time & I’d like a confirmation before deleting them.

My first impulse was to try to just do it in jquery so I put a script in admin that was like this:

function sortTable(table) {
  var tbody = table.find('tbody');
  tbody.find('tr').sort(function(a, b) {
      return jQuery('td:first input', a).val().localeCompare(jQuery('td:first input', b).val());
  }).appendTo(tbody);
}
sortTable(jQuery('#editor div#postcustom div#postcustomstuff table#list-table'));

That sorts by the first column, then I did this for the filter:

jQuery( "#postcustom .inside" ).prepend( ' <input type="text" id="custom_fields_filter" placeholder="filter by name">' );

jQuery("#custom_fields_filter").keyup(function() {
      if( !this.value ) {
        jQuery("table#list-table td.left input:text").closest('tr').show();
      }else{
        jQuery("table#list-table td.left input:text(value*='"+this.value+"')").closest('tr').show();
        jQuery("table#list-table td.left input:text").not("(value*='"+this.value+"')").closest('tr').hide();
      }
  });

There are problems: If I’ve filtered the list of terms and then delete a term, it can delete the wrong one. Is there way to filter and reorder these terms when they’re called from the db instead of doing it in on the front end?

Is there a plugin that will do all of this for me?

c++11 – A FIR filter using Modern C++ features

I’m diving into “modern CPP”, with wide usage of templates and containers,
So I started with FIR filter.

In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying).

So I define FIR filter as a class and apply it to single scalar value or to the vector itself

Could you please review my code in terms of C++ coding?

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <complex>
#include <cmath>
#include <iomanip>
#include <sstream>

// - Class method : operator(), constructor, various methods
// - Templates class and function
// - List and vector containers
// - Functors


template <typename T> std::string to_str(T & arr){
  std::ostringstream os;
  os << "(";  for (auto x: arr){    os<<" "<< x <<" ";  }  os << ")n"; 
  return os.str();
}

template <class T> class FIR { 
public: 
    std::vector< T > coeff;  // Array of coefficents is static all the time
    std::list< T > taps;  // Array of is are shifting each tick
    int order;

    FIR(std::vector< T > v)  
    { 
       coeff = v; 
       order = coeff.size();
       taps = std::list< T > (coeff.size(), 0);
    } 
    void reset(){
       taps = std::list< T > (coeff.size(), 0);
    }
    void append( T  x){
      taps.push_front( x);
      taps.pop_back();
    }

    auto sum_product(){
      T  psum = 0;
      typename   std::list< T >::iterator t;
      typename std::vector< T >::iterator c;
      // Can we do better here?
      for (   c =coeff.begin(),     t  =taps.begin(); 
              c!=coeff.end(),       t !=taps.end();
            ++c             ,     ++t             ){
        psum += (*c) * (*t);
      }
      return psum;
    }
    
    auto operator() ( T  x){
      append(x);
       T  psum = sum_product();
      return psum;
    }

     auto operator() (std::vector< T > x){
     std::vector< T > y( x.size(), 0);
     for (int i = 0; i<x.size(); ++i){
        y(i) =  operator()(x(i));
     }
     return y;
     }
}; 
  
int main() 
{ 
    std::vector<double> coeff = {0.0,1.0,5.0, 1.0, 0.0};
    
    FIR<double> fir(coeff); 
    std::cout <<"Coeff: " << to_str(fir.coeff);
    std::cout <<"Taps : "  << to_str(fir.taps);
    
    
    std::cout<<"nTRANSFORM IN THE LOOP n";
    std::vector<double> x_array = {0,1,2,3,4,5,6,0,0,0,0,0,0,13};
    for (auto x:x_array){
      auto p = fir(x);
      std::cout<<p<<"  ";
    }
    std::cout<<"n";
    fir.reset();

    std::cout<<"nTRANSFORM WITH FUNCTOR FOR SCALARn";
    std::vector<double> y_array( x_array.size(), 0);
    std::transform(x_array.begin(), x_array.end(), y_array.begin(), fir); 
    std::cout << to_str(y_array);
    fir.reset();

    std::cout<<"nAPPLY FUNCTOR FOR CONTTAINER n";
    auto y_2 = fir(x_array);
    std::cout << to_str(y_2);
    fir.reset();

    return 0; 
} 

arch linux – How to usb spice redirect filter qemu

I’m using Arch as the host, based on the https://wiki.archlinux.org/index.php/QEMU#USB_redirection_with_SPICE I have added to my qemu command

-device ich9-usb-ehci1,id=usb 
    -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on 
    -device ich9-usb-uhci2,masterbus=usb.0,firstport=2 
    -device ich9-usb-uhci3,masterbus=usb.0,firstport=4 
    -chardev spicevmc,name=usbredir,id=usbredirchardev1 
    -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 
    -chardev spicevmc,name=usbredir,id=usbredirchardev2 
    -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 
    -chardev spicevmc,name=usbredir,id=usbredirchardev3 
    -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 

now I want to pass just an specific vendor devices, based on this https://www.spice-space.org/usbredir.html I need to add a filter to some device specification so I have updated to

-device ich9-usb-ehci1,id=usb 
    -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on 
    -device ich9-usb-uhci2,masterbus=usb.0,firstport=2 
    -device ich9-usb-uhci3,masterbus=usb.0,firstport=4 
    -chardev spicevmc,name=usbredir,id=usbredirchardev1 
    -device usb-redir,filter='0x03:0x05ac:-1:-1:0|0x03:0x05ac:-1:-1:1',chardev=usbredirchardev1,id=usbredirdev1 
    -chardev spicevmc,name=usbredir,id=usbredirchardev2 
    -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 
    -chardev spicevmc,name=usbredir,id=usbredirchardev3 
    -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 

but the device still connect to the host instead the VM, even I tried the default filter filter='0x03:-1:-1:-1:0|-1:-1:-1:-1:1' which should auto connect any device but still doesnt works

I feel there’s some missing step not mentioned or vaguely mentioned that I need

Note: my VM is a macoS Catalina, and I’m trying to pass any apple device which vendor is 0x05ac

8 – How to recenter a geolocation google common map in views after an ajax boundary filter execution?

On Drupal 8.97 with all updated modules, I have a View that uses a Geolocation Google Common Map as an attachment. The map acts a boundary filter, but after the filter executes Drupal.ajax(ajaxSettings).execute() via /modules/contrib/geolocation/modules/geolocation_google_maps/js/geolocation-common-map-google.js, I am unable to re-center the map to ANY coordinates, including the user’s location.

Before the ajax call, map.getCenter() works, and so does manually inputting coordinates, like map.getCenter({ lat: -34.397, lng: 150.644 }), but afterwards, no dice. The custom re-center buttons I created still register clicks, and if console.log the map object afterwards, I can’t see any changes to the map object…and indeed some of my other custom map controls (like zoom in and out) still work after the ajax execution. I’m baffled.

I have looked at the ajaxSettings object too, and have attempted to change some of those center related properties before executing the Drupal.ajax(ajaxSettings).execute() command as above, but I still can’t get the map center to change (though I don’t quite know if I’m looking at the right properties…there’s hundreds of them). The map can still be panned around with a mouse of course, but I ultimately would like for users to be able to re-center to their location…and I would like to programmatically recenter and execute a search using the center of city locations without having to reload the page, so it’s kind of critical that I get this sorted.

Thank you in advance for your help.