Interaction for dependent sibling input fields?

I have two fields in a form – Country and Organisation. These hold the same hierarchy and are dependent on each other.
Meaning, the user should be able to either select a country first and then select an Organisation that falls under the Country or, select an Organisation first and then select the Countries that the Organisation exists in.

So something like the following:
(If user chooses Organisation tab first, hovering on Uniqlo only displays the countries it is present in. If he chooses the country tab first, hovering over US will only display Organisations that are present in the US)

I’m convinced that this is not an ideal design and could be very confusing for some but I also can’t think of another alternative. Asking the user to choose “What would you like to choose first? Org or the Country?” seems like one way to go but still seems like bad design. Is there some clever design pattern for such cases? To throw in some context, this is for a web only admin access control UI.

conditional probability of dependent random variables

Suppose I have 3 random variables:

$$X \sim \mbox{Bernoulli}(1/2)$$ $$Z \sim \mbox{Normal}(0,1)$$ $$Y = X+Z$$

How do I compute the conditional probability:

$$P(X=1 | Y=y)$$

Attempt1:

Probability[ X == 1 \[Conditioned] X + Z == y,             {             X \[Distributed] BernoulliDistribution[1/2]            ,Z \[Distributed] NormalDistribution[]            }          ] 

Attempt2:

D[Probability[ X == 1 \[Conditioned] X + Z >= y,             {             X \[Distributed] BernoulliDistribution[1/2]            ,Z \[Distributed] NormalDistribution[]            }          ],y] 

Attempt3:

Likelihood[       TransformedDistribution[X + Z,                     {                     X \[Distributed]BernoulliDistribution[1/2],                     Z \[Distributed] NormalDistribution[]}]            , {y}] 

Pencil and Paper attempt:

$$P(X=1 | Y=y) = \frac{P(X=1 , Y=y)}{P(Y=y)}$$ $$= \frac{P(X=1 , X+Z=y)}{P(Y=y)}$$ $$= \frac{P(X=1)P(Z=y-1)}{P(Y=y)}$$ $$= \frac{P(X=1)P(Z=y-1)}{P(X=1)P(Z=y-1)+P(X=0)P(Z=y-0)}$$

$$P(Z=y)=\frac{e^{-\frac{y^2}{2}}}{\sqrt{2 \pi }}$$ $$P(Z=y-0)=\frac{e^{-\frac{y^2}{2}}}{\sqrt{2 \pi }}$$ $$P(Z=y-1)=\frac{e^{-\frac{1}{2} (y-1)^2}}{\sqrt{2 \pi }}$$ $$P(X=1)=\frac{1}{2}$$ $$P(X=0)=\frac{1}{2}$$

$$P(X=1 | Y=y) = \frac{e^{-\frac{1}{2} (y-1)^2}}{2 \sqrt{2 \pi } \left(\frac{e^{-\frac{y^2}{2}}}{2 \sqrt{2 \pi }}+\frac{e^{-\frac{1}{2} (y-1)^2}}{2 \sqrt{2 \pi }}\right)}$$

$$P(X=1|Y=y) = \frac{e^y}{e^y+\sqrt{e}}$$

How to get super attribute dependent relation on custom page

I need to get list of all super attribute on my custom phtml page.

Like I have 3 attributes Color, Size, Height.

So I need three drop-down on my custom page where after selecting color, dependent size value should be populate in size drop-down and after selecting size, dependent height attribute value should be populated in height drop-down.

I tried with $product->getTypeInstance(true)->getConfigurableAttributesAsArray($ product)

It gives attributes used for particular product but I am not able to make it dependent does any one has solution for this.

Dependent dropdowns in Magento 2 Frontend

How can I create a pair of dropdowns such that when one is selected, the options for the other one are updated?

PHTML

<?php $stateList =$  block->getStates(); ?>      <div>         <h3 class="text-uppercase margin-bottom15"><?php echo __('Pedir una Cita') ?></h3>         <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>         <div>             <form id="search_cita">                 <div class="form-group states required">                     <select id="state" name="state">                         <option value="">Estado</option>                         <?php foreach($stateList as$  index): ?>                         <?php  echo '<option value="'.$index['state'].'">'.$  index['state'].'</option>'; ?>                         <?php endforeach ?>                     </select>                 </div>                 <div class="form-group cities required">                     <div class="control">                         <select name="city" id="city" class="input-text" data-validate="{required:true}">                             <!--option value="">Ciudad</option-->                             </select>                     </div>                 </div>                  <div>                     <button type="submit" class="btn btn-primary"><?php echo __('Buscar un taller') ?></button>                 </div>              </form>         </div>     </div>      <script>         require(['jquery', 'jquery/ui'],function(){                 jQuery(document).on('change','#state',function() {                     var param = 'frame='+jQuery('#state option:selected').attr('value');                     var url = "<?php echo $block->getStateAction(); ?>"; //alert(param); jQuery.ajax({ showLoader: true, url: url, data: param, type: "POST", dataType: 'json' }).done(function (data) { jQuery('#city').empty(); jQuery('#city').append(data); }); }); }); </script>  BLOCK <?php namespace Morwi\Citas\Block; class Display extends \Magento\Framework\View\Element\Template { protected$  _isScopePrivate;     public function __construct(         \Magento\Framework\View\Element\Template\Context $context, \Magento\Directory\Block\Data$  directoryBlock,         array $data = [] ) { parent::__construct($  context, $data);$  this->directoryBlock = $directoryBlock;$  this->_isScopePrivate = true;     }      public function getStateAction() {         return $this->getUrl('citas/index/display', ['_secure' => true]); } }  CONTROLLER <?php namespace Morwi\Citas\Controller\Index; use Magento\Framework\Controller\ResultFactory; class Display extends \Magento\Framework\App\Action\Action { protected$  _resultPageFactory;     public function __construct(         \Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory$  resultPageFactory     ){                   parent::__construct($context);$  this->_resultPageFactory = $resultPageFactory; } public function execute() { //*$  result = $this->resultFactory->create(ResultFactory::TYPE_JSON);$  objectManager = \Magento\Framework\App\ObjectManager::getInstance();         $resource =$  objectManager->get('Magento\Framework\App\ResourceConnection');         $connection =$  resource->getConnection();          $html='<option selected="selected" value="">Ciudad</option>';$  stateName = $this->getRequest()->getParam('frame'); if($  stateName!='') {              $tblSL =$  resource->getTableName('store_locator');              $sql = "SELECT DISTINCT city from " .$  tblSL . " WHERE state LIKE '%". $stateName ."%'";$  city = $connection->fetchAll($  sql);                foreach($city as$  index){                 $hmtl= '<option value="'.$  index['city'].'">'.$index['city'].'</option>'; } } return$  result->setData(['success'=>true,'value'=>\$  html]);         //*/        }  }  ?> 

But this returns to me

in success I don’t paint the html

Any help would be appreciated.

Thanks

Magento 2: Knockout JS dependent dropdowns

How can I create a pair of dropdowns such that when one is selected, the options for the other one are updated? The values for options for both dropdowns are coming from PHP.

I have absolutely no clue about knockout js. Any help would be appreciated.

Thanks

Magento 2 : Dependent dropdowns in knockout

I am trying to override Magento/Checkout/view/frontend/web/js/view/shipping-address/list.js and Magento/Checkout/view/frontend/web/template/shipping-address/list.html.

I need to create two dropdowns here such that when one is selected, the other one gets it’s values. Like countries and provinces.

The array of values for each dropdown is created in php in config provider.

How can I create these dropdowns in knockout js? Thanks!

How to make drop-down dependent on another drop-down value in admin ui component Magento 2

I want to update one drop-down option on the change of another drop-down using UI Component in Magento admin section.

Like: have one drop-down with color option ex: Red, Pink, Black, etc. and another drop-down has a size value which depends on color.

How can I dynamically update size option on the change of color using UI component in Magento admin?

For proof automation in Coq, when is it appropriate to use canonical structures or dependent types instead of Ltac?

There are a few possible approaches to proof automation in modern Coq.

• Writing proof scripts with Ltac. This is the approach described in http://adam.chlipala.net/cpdt/, which the author uses to great effect in projects like http://adam.chlipala.net/papers/BedrockPOPL15/. It can significantly reduce the amount of proof code required, but requires a good handle on the quirks of Ltac and does not seem straightforward to debug.
• Canonical-structures-based automation. This is the approach described in https://people.mpi-sws.org/~beta/lessadhoc/, and used in Mathcomp. It involves taking advantage of Coq’s type inference mechanism to automatically execute logic programs that search for certain kinds of proof terms. It’s described in that paper as less ad-hoc than the Ltac-heavy approach, but not necessarily faster, and can be more verbose due to needing to use the canonical structures mechanism for something it wasn’t directly designed for.
• Dependent types/Equations. The Equations plugin (https://www.irif.fr/~sozeau//research/publications/drafts/Equations_Reloaded.pdf) seems to faciliate in Coq the same convenience when working with dependently typed programs as a language like Agda or Idris. With this approach the elaborator acts as a form of automation, and the amount of proof code is reduced by having algorithms create, manipulate and pass around proof terms directly.

There are also some modern developments that complement these.

• Ltac2. This is meant as a replacement for Ltac, with fewer quirks and potentially better performance, as described in https://popl19.sigplan.org/details/CoqPL-2019/8/Ltac2-Tactical-Warfare. The paper states that “Ltac2 is still in an active development phase, but the foundations of the language have been settled. More than anything, it is in need of users in order to polish the rough edges”. If it is meant to be a superior replacement to Ltac, then should it be considered instead of Ltac for new projects, since it’s already ready for user testing?
• Metacoq. This provides metaprogramming features that allow the development of higher level tools, as described on https://www.irif.fr/~sozeau/research/publications/drafts/The_MetaCoq_Project.pdf, and presumably simplify the use of proof by reflection, a technique used in both canonical-structures-based an Ltac-heavy approaches.

My question is, if I’m starting a new project, what criteria should I use to determine which approach or combination thereof to adopt? As a concrete example, imagine I want to verify the easy-to-verify parts of a program that connects to a server over the internet, downloads some data, processes the data somehow, then serves the processed data over TCP. By easy-to-verify I mean not verifying the TCP/HTTP stack, or proving from scratch the correctness of well-known algorithms used in the data processing. When I consider how I’d structure this it seems like the structure would be quite different depending on which of the above approaches I used, and I lack the experience to make a judgement regarding which would produce the best result in terms of maximising the output of verified code per unit of development time. What factors should necessitate the use of canonical structures or Equations instead of just plain Ltac?

All components dependent only on a core component [on hold]

I’m kind of obsessed about hiding all implementations in .net behind interfaces. I came up with idea of storing all interfaces in a core component (with dtos and so on) and their implementations in many others. The only one component in the system that is dependent on all the others is a bootstrapper for dependency injection, and the rest is dependent only on the core and conditionally on the bootstrapper.

I consider component as the smallest deployable unit e.g dll.

Is this approach too extreme? What are possible issues that can occur?

How to design a dependent subscription

I have several products for which there are several services and some services are common among some products. I need to design a system where service will be served only once even if multiple services exits among subscribed products by the user. Below is a sample of what I want to achieve

Product-A – Service1 – Service2 – Service3 – Service4

Product-B – Service2 – Service5 – Service6

Product-C – Service1 – Service2

If user subscribes to Product-A and Product-B, I need to serve only Service1, Service3, Service4 from Product-A and Service2, Service5, Service6 from Product-B.

Right now, what I have in my code is, I take all the services of Product-A into a MapA and services of Product-B into MapB and then find out commonMap as intersection of MapA and MapB. I serve only each service once.

Problem with my current approach is, there is no way I can identify if I am serving Service2 from Product-A or Product-B. Also, the Products, Services are going to be increased by a huge number which increases dependencies and if user selects too many products, finding intersection would not be a good idea.

I am searching for an approach where, the sServices can be identified at runtime and I should be able to identify which Service is coming from which Product.