Does applying a longer duration Charm effect extend the duration of Philter of Love’s love effect?

The item “Philter of Love”(DMG, p. 184) hast the following description:

The next time you see a creature within 10 minutes after drinking this philter, you become charmed by that creature for 1 hour. If the creature is of a species and gender you are normally attracted to, you regard it as your true love while you are charmed.

If the creature who was the first to be seen by the creature drinking the potion charmed the drinker, would the drinker continue to regard them as their true love while they are charmed? There’s no distinction that you must be charmed “in this manner” or by the effects of the potion.

So, would charming a creature affected by the Philter of Love extend the potion’s love effects for the duration of the charm?

SharePoint Column Conditional Formatting – Applying CSS classes to a date field using a nested IF statement

Apologies, I am relatively new to SharePoint/JSON, So forgive me if I am not seeing the obvious. I would be INCREDIBLY grateful if someone would help.

I would like to apply conditional formatting to a date field using a nested IF statement.

IF the current field is blank, then set the CSS class to ‘blocked’. However, if the current field is populated, run a second IF: IF the current field is more than 1 year before today, then set the CSS class to ‘blocked’, however if the current field is within the last year, set the CSS class to ‘good’.

I have ran the following, without success. No formatting is applied whatsoever.

 {    "$  schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  "elmType": "div",  "attributes": {  "class": "=if(toString(@currentField)=='', 'sp-field-severity--blocked', if([@currentField]+31104000000 < @now,'sp-field-severity--blocked', 'sp-field-severity--good'))"   },  "txtContent": "@currentField"  } 

HOWEVER, when I split the conditions into two, they work independently.

  1. =IF empty, blocked, good.
{   "$  schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",   "elmType": "div",   "attributes": {     "class": "=if(toString(@currentField)=='','sp-field-severity--blocked', 'sp-field-severity--good')"   },   "txtContent": "@currentField" } 
  1. =IF exceeds 1 year, blocked, good.
{   "$  schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",   "elmType": "div",   "attributes": {     "class": "=if(@currentField+31104000000 < @now, 'sp-field-severity--blocked', 'sp-field-severity--good')"   },   "txtContent": "@currentField" } 

My next step would be to add the corresponding CSS class icon into the field.

Data Structure for applying transformations upon universe of tuples

Problem

I want a data structure which describes a universe of tuples all of length $ n$ , $ U$ . In $ U$ we associate each $ tuple$ with a non-negative value, which we will denote as $ U.count(tuple)$ . If $ U.count(tuple)=0$ , then we consider $ tuple$ to not be in $ U$ . I want to be efficiently update these $ U$ with five operations, some of which involve two fixed constants $ maxVal$ and $ minVal$ . (to clarify, $ maxVal$ and $ minVal$ should not change throughout the process, and should a tuple in $ U$ should never have a value which exceeds $ maxVal$ )

1) append(U,c): yields an updated universe $ U’$ , $ c$ should be below $ maxVal$ . For each tuple $ t$ in $ U$ , make a copy $ t’$ , and append $ c$ to $ t’$ . For each $ t’$ , $ U’.count(t’) = U.count(t)$ .

2) add(U,c,i): yields an updated universe $ U’$ . For each tuple $ t$ in $ U$ , we create a copy $ t’$ , and add $ c$ to $ t'[i]$ . If $ t'[i]<maxVal$ , then then $ t’$ is in $ U’$ and $ U’.count(t’) = U.count(t)$ . Otherwise $ U’.count(t’)=0$ and for our purposes we no longer need to keep track of it, and can exclude it from $ U’$ .

3) merge(U,i,j): yields an updated universe $ U’$ . For each tuple $ t$ in $ U$ , we create a copy $ t’$ , we pop $ t'[j]$ , and add its value to $ t'[i]$ . In this case, there can be multiple tuples $ t$ which correspond to $ t’$ in $ U’$ , thus let us initially say $ U’.count(t’)=0$ and then add to this. Now, if $ t'[i] < maxVal$ , $ U’.count(t’) = U’.count(t’) + U.count(t)$ .

4) finish(U,i): yields an updated universe $ U’$ . For each tuple $ t$ in $ U$ , we make a copy $ t’$ and delete $ t'[i]$ . Again, for the same reasons as in 2, let us initially say $ U’.count(t’) = 0$ . If $ t[i] > minVal$ , then $ t’.count = t’.count + t.count$ . At the end, all $ t’$ with non-zero count are included in $ U’$ .

5) combine(U1,U2): yields an updated universe $ U’$ , $ U_1$ and $ U_2$ should have same length tuples. For each $ t$ in $ U_1 \cup U_2$ , $ U’.count(t) = U_1.count(t) + U_2.count(t)$

My thoughts so far (messy)

If we did this naively, and represented $ U$ as a list of the tuples with non-zero, this would be horribly inefficient. Let’s assume $ U.count(t) \neq 0$ for all $ t$ that don’t exceed $ maxVal$ . Then, with $ maxVal = 10$ , a universe for tuples of length $ 4$ , that’s 10,000 if statements for the add operation…

I think one optimization would to have a tree, where the first level has nodes for each value of $ t[0]$ , and the child of a node are the next element in the tuple. I’d imagine you’d do this by having a list of all your first level nodes. Each node itself, is represented as a tuple of its value, and a list of its valid children, or $ U.count(t)$ for leaves. With add at lower levels, you have much less updates to do, and by ordering children in a fixed way according to their value, and keeping childless nodes as placeholders, your only need to do the validity check once too. Furthermore, to make append efficient, instead of having the levels be consecutive indices, we could make the order arbitrary, describe the tree-level to tuple index conversion with another list. For stuff like combine I am less sure what’s a good way to do things, maybe it would be beneficial to actually sum the counts of shared tuples, but maybe there are a clever cheats or work arounds…

My explicit questions

1a) Is there an efficient data-structure which performs these operations?

1b) Otherwise, are there some general rules of thumb for data structure which are relevant for this problem or my proposed solution?

2) Same as above but for the case where combine is applied to a very large number of universes, instead of just 2.

Magento 2 REST API – Get filterable attributes of a category before and after applying filter with multiselect

I am trying to achieve multiselect filter in custom script to be able to use it in custom REST API.

While I am able to get all filterable attributes specific to a category. But after applying filter through params (e.g. Size), the size attribute get removed from the filterable attribute list after apply (default magento behaviour).

Need filters to behave as multiselect. I tried to implement it using classes of some 3rd party modules but of no help.

Below is my code

<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Copyright 2009, FedEx Corporation. All rights reserved. // Version 12.0.0 use Magento\Framework\App\Bootstrap; /** * If your external file is in root folder */ require __DIR__ . '/app/bootstrap.php'; $  params = $  _SERVER; $  bootstrap = Bootstrap::create(BP, $  params); ini_set('display_errors', 1); $  obj = $  bootstrap->getObjectManager(); $  state = $  obj->get('Magento\Framework\App\State'); $  state->setAreaCode('frontend');  $  objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $  categoryFactory = $  objectManager->get('Magento\Catalog\Model\CategoryFactory'); $  storeManager = $  objectManager->get('Magento\Store\Model\StoreManagerInterface'); $  resource = $  objectManager->get('Magento\Framework\App\ResourceConnection'); $  request = $  objectManager->get('Magento\Framework\App\Request\Http'); $  params = $  request->getParams(); $  connection = $  resource->getConnection(); $  storeId = $  storeManager->getStore()->getId(); $  categoryId = 824;  $  category = $  categoryFactory->create()->setStoreId($  storeId)->load($  categoryId); $  storeManager->setCurrentStore($  storeId);  $  filterableAttributes = $  objectManager->get(\Magento\Catalog\Model\Layer\Category\FilterableAttributeList::class); $  appState = $  objectManager->get(\Magento\Framework\App\State::class); $  layerResolver = $  objectManager->get(\Magento\Catalog\Model\Layer\Resolver::class); $  filterList = $  objectManager->create(     \Magento\Catalog\Model\Layer\FilterList::class,     [         'filterableAttributes' => $  filterableAttributes     ] );  $  layer = $  layerResolver->get(); $  layer->setCurrentCategory($  category); $  allFilters = $  filterList->getFilters($  layer);  $  beforefinalFilters = []; foreach ($  allFilters as $  filter) {     if ($  filter->getName() != 'Category' && $  filter->getName() != 'Price'){         if ($  filter->getItemsCount()) {             $  output = [];             foreach ($  filter->getItems() as $  item) {                 if($  item->getFilter()->getData("attribute_model")){                     $  flag = false;                     $  code = $  item->getName();                     $  name = strip_tags($  item->getLabel());                      $  beforefinalFilters[$  code][] = array(                                                'name'=> $  name,                         'value'=> $  item->getValue(),                         'code'=> $  item->getFilter()->getAttributeModel()->getAttributeCode(),                         'isActive' => $  flag                     );                 }             }         }     } }  echo "Before filter: \n"; echo "<pre>"; print_r($  beforefinalFilters); echo "</pre>"; echo "----------------------------------------------------------------------------------"; echo "<br>";  $  appliedFilters = array(); foreach ($  allFilters as $  filter) {     if ($  filter->getName() != 'Category' && $  filter->getName() != 'Price' && $  filter->getItemsCount() && isset($  params[$  filter->getAttributeModel()->getAttributeCode()])) {         $  appliedFilters[$  filter->getAttributeModel()->getAttributeCode()]['label'] = $  filter->getAttributeModel()->getFrontendLabel();         $  appliedFilters[$  filter->getAttributeModel()->getAttributeCode()]['value'] = isset($  params[$  filter->getAttributeModel()->getAttributeCode()])?$  params[$  filter->getAttributeModel()->getAttributeCode()]:'';         $  appliedFilters[$  filter->getAttributeModel()->getAttributeCode()]['filter'] = $  filter;         $  request->setParam($  filter->getAttributeModel()->getAttributeCode(), $  params[$  filter->getAttributeModel()->getAttributeCode()]);     } }  foreach ($  appliedFilters as $  key => $  value) {     $  filter = $  value['filter'];     $  filterValue = $  value['value'];     if($  key == 'price' || $  key == 'category'){         continue;     }else{         //apply filter         //Magento\Catalog\Model\Layer\Filter\Attribute         $  filter->apply($  request);     } }  $  collection = $  layer->getProductCollection(); $  collection->getSelect()->group('e.entity_id');   //get filters after applying $  allFiltersAfter = $  filterList->getFilters($  layer);  $  afterfinalFilters = []; foreach ($  allFiltersAfter as $  filter) {     if ($  filter->getName() != 'Category' && $  filter->getName() != 'Price'){         if ($  filter->getItemsCount()) {             $  output = [];             foreach ($  filter->getItems() as $  item) {                 if($  item->getFilter()->getData("attribute_model")){                     $  flag = false;                     $  code = $  item->getName();                     $  name = strip_tags($  item->getLabel());                     $  afterfinalFilters[$  code][] = array(                                                 'name'=> $  name,                         'value'=> $  item->getValue(),                         'code'=> $  item->getFilter()->getAttributeModel()->getAttributeCode(),                         'isActive' => $  flag                     );                 }             }         }     } }  echo "\n After filter: \n"; echo "<pre>"; print_r($  afterfinalFilters); echo "</pre>"; 

Error after applying patch to authorize.net module

I have applied patch from MD5 to SHA-512 to Magento 2 Authorize.net direct post module, when i tried to test purchasing with a credit card i got this error on exception.log file

main.CRITICAL: Warning: pack(): Type H: illegal hex digit : in /public_html/vendor/magento/module-authorizenet/Model/Directpost/Response.php on line 111  

this is the code line 111

return strtoupper(hash_hmac('sha512', $  message, pack('H*', $  signatureKey))); 

How can i fix this error?

Applying filters in Flaks API with MongoDB

I am trying to filter my data based on nationality field of the data.

@app.route("/api/v1/players/<name>", methods = ['GET']) def get_player(name):     """     returns an object of a player given a name     """     try:         player = db.players.find_one({'name': name})         return jsonify({'result': player_to_dict(player)})      except:         return jsonify({             'result': 'failure',              "error": 400,              "message": "Bad Request (Double check player's name)"}), 400  @app.route("/api/v1/players/<nation>", methods = ['GET']) def get_player_by_nation(nation):     """     returns an array of player objects given a nation     """     try:         player = db.players.find({'nation': nation})         return jsonify({'result': player_to_dict(player)})      except:         return jsonify({             'result': 'failure',              "error": 400,              "message": "Bad Request (Double check nation's name)"}), 400 

I tried something like this, but since those two endpoints are considered the same thing, only the /<name> endpoint gets called and gives me an error when I put in a nation name.

What is the convention of applying filters or sorting in Flask?

Indian with UAE resident visa expiring in 2 months while applying for Schengen Visa

Me and my family are planning for a week long trip to Austria, Hungary & Czech Republic(max. no of stay).

We will be returning from there on October 28th, 2019 and my wife’s UAE Resident Visa is expiring on January 1 2020(2 month validity as per the Checklist I have seen). But rest of the family got their visa till mid year of 2020.

Will this be a problem in the visa application?