Build filter for post-type + multi taxonomies + multi terms

I Need to build an interface with a filter set (a list of checkboxes) that the user can check and click ‘filter’ to search with in 1 custom post-type for posts with matching terms (there are 3 custom taxonomies with each an unlimited amount of terms).

How to go about this? I am thinking to code the following:

I displayed the GUI filterlist like this (x3 because there are 3 taxonomies):

<form action="/filter-result" method="get">     <?php $  terms = get_terms( array(         'taxonomy' => 'taxonomy-name',         'hide_empty' => false,     ) );     foreach($  terms as $  term) {          echo '<label><input type="checkbox" name="taxonomy-name" value="' . $  term->name .'">' . $  term->name . '</label>';     } ?>     <input type="submit" value="Filter"> </form> 

I end up on the /filter-result page with an URL with more than one parameter that all have the same name: filter-result/?taxonomya=term1&taxonomya=term2&taxonomyb=term9

My plan is to GET all the parameters- I don’t know how because there are parameters with the same name- and then build an SQL out of the filtered data.

Python/Django Filter with Datetime and extra options

I’m creating a filter in python/django. I want to make a datetime human-readable. You have multiple options: Plain Datetime (“04. Februar 2018, 18:18”)

(bools="False,False"), 

sentence Datetime (“am 04. Februar 2018 um 18:18”)

(bools="True,False"),  

onlydate Datetime (“04. Februar 2018”)

(bools="False,True"),  

sentence and onlyDate (“am 04. Februar 2018”)

(bools="True,True") 

Here’s my filter:

@register.filter def naturaldaytime(daytime, bools="False,False"):     if daytime is None:         return daytime      sentence = str2bool(bools.split(",")[0])     onlyDate = str2bool(bools.split(",")[1])      now = datetime.datetime.now()     difference = now.day - daytime.replace(tzinfo=None).day     loc = locale.setlocale(locale.LC_TIME, "de")      if onlyDate:         if difference == 0:             return daytime.strftime(settings.DATE_FORMAT_TODAY) if not sentence else daytime.strftime(settings.DATE_FORMAT_SENTENCE)         elif difference == 1:             return daytime.strftime(settings.DATE_FORMAT_YESTERDAY) if not sentence else daytime.strftime(settings.DATE_FORMAT_YESTERDAY)         elif now.isocalendar()[0] == daytime.isocalendar()[0]:             if now.isocalendar()[1] == daytime.isocalendar()[1]:                 return daytime.strftime(settings.DATE_FORMAT_THIS_WEEK) if not sentence else daytime.strftime(settings.DATE_FORMAT_THIS_WEEK_SENTENCE)             return daytime.strftime(settings.DATE_FORMAT_THIS_YEAR) if not sentence else daytime.strftime(settings.DATE_FORMAT_THIS_YEAR_SENTENCE)         return daytime.strftime(settings.DATE_FORMAT) if not sentence else daytime.strftime(settings.DATE_FORMAT_SENTENCE)     else:         pass         #so what...   def str2bool(v):     return v.lower() in ("yes", "true", "t", "1") 

and my settings vars:

TIME_FORMAT = "%H:%M"  DATE_FORMAT = "%d. %B %Y, {0}".format(TIME_FORMAT) DATE_FORMAT_THIS_YEAR = "%d. %B, {0}".format(TIME_FORMAT) DATE_FORMAT_THIS_WEEK = "%A, {0}".format(TIME_FORMAT) DATE_FORMAT_YESTERDAY = "Gestern, {0}".format(TIME_FORMAT) DATE_FORMAT_TODAY = "Heute, {0}".format(TIME_FORMAT)  DATE_FORMAT_SENTENCE = "am %d. %B %Y um {0} Uhr".format(TIME_FORMAT) DATE_FORMAT_THIS_YEAR_SENTENCE = "am %d. %B um {0} Uhr".format(TIME_FORMAT) DATE_FORMAT_THIS_WEEK_SENTENCE = "diesen %A um {0} Uhr".format(TIME_FORMAT) DATE_FORMAT_YESTERDAY_SENTENCE = "gestern um {0} Uhr".format(TIME_FORMAT) DATE_FORMAT_TODAY_SENTENCE = "heute um {0} Uhr".format(TIME_FORMAT) 

How to filter Data on the basis of id or uuid by Rest API?

I am using Drupal 8 i have installed poll module i created a view with REST export Enabled. Now when i Get the data by this url

http://localhost/poll/rest/polling 

i am getting all the data of polls like this

[{"question":"which is best city","choice_target_id":"Delhi, Mumbai, Chennai","id":"1","choice_target_id_1":["1","2","3"],"uuid":"b0ef150c-bf05-4a25-8ae9-b6864539c080"},{"question":"Where do you work?","choice_target_id":"Flat, Hotel, Factory, Shop","id":"2","choice_target_id_1":["4","5","6","7"],"uuid":"b2145904-fe8b-4ef6-82fa-f069c2e29f3b"}] 

But when i get the data on the basis of id or uuid by this url

http://localhost/poll/rest/polling?id=1 

then i am still getting all the data without getting filtered as per the id

what i am doing wrong

Applying a Sigma-Point Kalman Filter to State of Charge Estimation

I’ve found a research paper that would allow me to implement a Kalman filter to estimate state of charge for a LiPo battery, but cannot make sense of some of the symbols as I’m a first year. Can anybody give a rough description of the process used (for the Sigma Point Kalman Filter detailed) and what some of the symbols in the augmented state covariance mean. We have some understanding but do not fully understand the meaning of some of the positive and negative symbols in the superscript and subscript mean.

Need to get an overview so we can finish develop a working model in Matlab.

Here is a link to the paper: https://www.researchgate.net/publication/308672015_State-of-charge_estimation_based_on_microcontroller-implemented_sigma-point_Kalman_filter_in_a_modular_cell_balancing_system_for_Lithium-Ion_battery_packs

Cheers.

Views Contextual Filter by taxonomy in field collection

I have a Drupal 7 project I’m working on that’s got me stumped.
I’m building a site where the node (Decals) are applicable to models and years (This decal is correct for this model of this year). Each product my be applicable multiple models and multiple years.

I created a content type that has a field collection of model and years that can have unlimited values. So far so good.

Where i’m stuck is i want to have a related decals block at the bottom, that would suggest additional decals based not the models and years that listed in the field collection.
I’ve creating a view of nodes that has a relationship to the field collection, but I can’t figure out how to limit the results to only the models & years associated to the node.

Any suggestions would be greatly appreciated.

Exposed filter timestamp is not working

I’m using Drupal 8. I created a new content type (title, body, image, date). The date is a timestamp field.

I used the devel module and the Realistic Dummy Content module to generate a test content for my view test.

I created my test view and chose the date as an exposed filter.

Here is my configuration: enter image description here

And this is my view: enter image description here

But my filter is not working! If I add the title as an exposed filter, the search with title works well.

Any idea please?

Thanks in advance 🙂

map, filter, reduce is taking time compare with for loop is that true?

In Javascript ES6 we have map, filter,reduce function. I read one article in medium he mentioned those method taking little time for running comparing with for loop is that true? and he gave examples also.

const numbers = [2, 4, 8, 10]; const halves = numbers.map(x => x / 2);  for(var i=0;i<numbers.length;i++){ x = numbers[i]/2 } 

Filter for RGB separation and its effect on the image

Looking at Bayer filter of a typical consumer camera, one can easily see that sensitivity of the filter for each color is all over the place. Are there filters similar to Bayer that do a better job at separating and keeping the sensitivity within each color’s own frequency band? What are the visual effects of such a filter?

Spontaneously one would think a more precise filter would give a much better representation of the real view. enter image description here