How to hide field on editform.aspx using conditional statements?

I have a column name “Order” and if order is equal to “Car” then show the “Warranty” field, else hide it. I am using script editor for this and here is my code and someone it is not working. Can you point me to a right direction.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> <script>  if ($  ("select[title='Order']").val() != "Car") { $  (document).ready(function(){ $  ("nobr:contains('Warranty')").closest('tr').hide(); });  }  else  { $  (document).ready(function(){ $  ("nobr:contains('Warranty')").closest('tr').hide(); });  } </script> 

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}}$ $

SharePoint Designer 2010 – Conditional Formatting on List

I have been asked to apply conditional formatting to a list in SharePoint 2010 to change the font colour if the difference is 7 or less when you minus the date in the Date Valid column from todays date. So…

Today – Date Valid <= 7 

I can apply simple conditions but I think the one I have been asked for would need to be done in the Advanced Condition window and I haven’t been able to figure out what it would be.

Does anyone know what the condition would be?

WSL: Is there a conditional to detect “Open Linux Shell Here” case?

When I open the WSL by clicking on its icon I need it to be opened in a certain directory (of course one that is more useful than System32), so I add a cd destination in my .bashrc. But then the “Open Linux Shell Here” option (available when you hold the Shift key on keyboard and right-click on any folder is also being redirected to that destination, which is undesirable. Is there a way I can detect this case in my .bashrc script and let it behave as it should?

In short, I need to know when the shell has been opened by the option in Shift+Right Click inside a folder, so that I can avoid changing the working directory to another one.

I’m using WSL-Ubuntu 18.04 LTS and GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu).

How to write a Conditional Selection SQL QUERY in Magento2?

$  collection->getSelect()->where($  getMainTableAlias.'.entity_id IN (SELECT catText.entity_id FROM '.$  catalogCategoryEntityTextTable.' as catText where catText.attribute_id="'.$  attributeId.'" AND  FIND_IN_SET("'.$  groupId.'", catText.value) GROUP BY   catText.entity_id)'); 

I have this query. I have to remove the first where clause so as to avoid any filters but the rest will remain same. How can I perform this task?

How to handle conditional formatting/CSS in PnP Search Web Part?

I just love the PnP Search web part as it allows us to bring forward the enterprise search solutions. Great work!!

My question is how to best handle conditional formatting. In the code below I have a requirement that site collections should have a green header color and anything else should be red. The code works but I have a hard time mixing content and css. Is there any guideline how this should be handled? Thanks

 {{#each items as |item|}}                 <div class="ms-Grid-col ms-sm12 ms-md6 ms-lg4">                     {{#> resultTypes}}                         {{!-- The block below will be used as default item template if no result types matched --}}                         <div class="singleCard">                                 {{#eq RefinableString01 'STS'}}                                     <li class="ms-ListItem ms-ListItem--document" style="background-color: green"  tabindex="0">                                 {{else}}                                         <li class="ms-ListItem ms-ListItem--document" style="background-color: red"  tabindex="0">                                 {{/eq}}                                 <div class="cardInfo">                                     <span class="HeaderImage" ><img  src="/sites/TestingReactSearchWebPart/ModernDisplaytemplates/classic_logo_large.png" alt=""></span>                                     <span class="titleArea" style="word-wrap: break-word"> <h3><a  href="{{getUrl item}}">{{Title}}</a><br /></h3> </span>                                        <span class="ms-ListItem-secondaryText">Template: {{RefinableString01}}</span>                                     <span class="ms-ListItem-tertiaryText">{{getDate Created "LL"}}</span>                                      <div class="ms-ListItem-selectionTarget"></div>                                 </div>                             </li>                         </div>                     {{/resultTypes}}                 </div>             {{/each}} 

how to create conditional arguments in a function?

I have the following function that hides a password middle chars and leaves 1st and last char visible

function Hide-ConnectionStringPassword {     param(        [parameter(Mandatory,ValueFromPipeline)]        [System.Data.SqlClient.SqlConnectionStringBuilder]$  ConnectionString     )     [string]$  FistChar = $  ConnectionString.Password[0]     [string]$  LastChar = $  ConnectionString.Password[($  ConnectionString.Password.Length - 1)]     [string]$  Stars = '*' * ($  ConnectionString.Password.Length - 2)     $  ConnectionString.Password = $  FistChar + $  Stars + $  LastChar      return $  ConnectionString.ConnectionString } 

Usage:

Hide-ConnectionStringPassword 'Connection Timeout=120;User Id=UID1;Data Source=datasource.com;Password=password12!553;' 

output:

Data Source=datasource.com;User ID=UID1;Password=p************3;Connect Timeout=120

I have other connection strings that are JSON formatted, so the casting to sqlbuilder will not work on this type of input

{“Authentication Kind”:”UsernamePassword”,”Username”:”someID1″,”Password”:”Yu#gh456!ts”,”EncryptConnection”:true}

One thing i could do is something like this:

$  Json = '{"Authentication Kind":"UsernamePassword","Username":"someID1","Password":"Yu#gh456!ts","EncryptConnection":true}' $  Sql = $  Json | ConvertFrom-Json $  Sql.Password 

with

$  Sql.gettype().name  

i get

PSCustomObject

i would like to apply that in the function such that it checks string input is type pscustomobject so that it doesnt cast it as sqlbuilder

pseudocode:

function Hide-ConnectionStringPassword {     if ($  input.gettype().name -ne 'PSCustomObject')     {     param(        [parameter(Mandatory,ValueFromPipeline)]        [System.Data.SqlClient.SqlConnectionStringBuilder]$  ConnectionString     )}     else     {     param(        [parameter(Mandatory,ValueFromPipeline)]        $  ConnectionString     )}     [string]$  FistChar = $  ConnectionString.Password[0]     [string]$  LastChar = $  ConnectionString.Password[($  ConnectionString.Password.Length - 1)]     [string]$  Stars = '*' * ($  ConnectionString.Password.Length - 2)     $  ConnectionString.Password = $  FistChar + $  Stars + $  LastChar      return $  ConnectionString.ConnectionString } 

Conditional vs Logical Testing

I would like to get your code thought and views on using conditional vs logical testing.

For example:

To test the conditions of truthness of all of the following variables, their currect status is as follows:

a= True  b= True  c= True  d= True  e= True 

One could use as test as follows to ensure that they all are true:

  1. Method 1:
 If a And b And c And d And e Then x = "Passed" Else x = "Failed"  
  1. Metod 2:
If a = b = c = d = e Then x = "Passed" Else x = "Failed" 
  1. Method 3:
If a Then If b Then If c Then If d Then If e Then x = "Passed" Else x = "Failed" 

With all variables being “True”: Method 2 is the slowest and Method 3 using Condition is fastest.

If any of the variables states would be changed from True to False then Method 3 (Conditional) always wins by big margin.

I do tend to test 2 conditions or more for truthness using the AND logic (we all do, i guess). But isn’t quicker to do an “If If” statement.

Looking forward to your valuable feedback and input.

kind regards