How to condition an if else statement when the button is clicked and video is playing

I have a three buttons, Trailer, Movies and Movies Ads. I want to play the video dynamically, like when I clicked the button Trailer, then the video trailer must shown, when I clicked the button Movies, then the movie video must shown, and when I clicked the movie ads it must be shown again.

My Buttons

<button class="btn btn-sm btn-dark" id="trailer">Trailer</button> <button class="btn btn-sm btn-dark" id="movies">Movies</button> <button class="btn btn-sm btn-dark" id="movieads">Movie Ads</button> 

What I have right now under the video as you can see is a simple pseudo code which concludes my logic, is there any way to make this syntax achievable and working? thank you. please see my code below.

<div class="modal" id="myModal2">   <div class="modal-dialog modal-lg">     <div class="modal-content">       <div class="modal-body">         <div class="container" id='container'>          <div id="getdata" style='display: none;'>             <div class="overlay">                 <br><br><br><br><br>               <div class="container">                   <div class="row">                   <div class="text-center col-md-12">                       <div class="jumbotron" style="background-color: rgba(42, 44, 45, 0.9); color: #71777f">                         <h3>Passenger Announcement is Going On.</h3>                       </div>                   </div>                   </div>               </div>                 </div>          </div> ----------------------PSEUDOCODE HERE-----------------------------------          <?php             if (trailer == clicked) {             echo '<video controls playsinline id="player" width="100%">                 <source src="./inflightapp/storage/app/public/trailer_videos/<?php echo ''.$  row2['trailer_video'].''; ?>" type="video/mp4" size="1080">             </video>';           }else if(movies == clicked){             echo '<video controls playsinline id="player" width="100%">             <source src="./inflightapp/storage/app/public/trailer_videos/<?php echo ''.$  row2['movies_video'].''; ?>" type="video/mp4" size="1080">             </video>';           }else if(moviesAds ==clicked){             echo '<video controls playsinline id="player" width="100%">             <source src="./inflightapp/storage/app/public/trailer_videos/<?php echo ''.$  row2['movies_video'].''; ?>" type="video/mp4" size="1080">             </video>';           }            ?>          </div>       </div>     </div>   </div> </div> 

Anyone else having third-party modules with data integrity issues in M2’s checkout?

Using Amasty for a shipping calendar and orders randomly (It seems?) come through to the admin with shipping date missing. Very annoying but there is no obvious pattern and the bug can’t be replicated by Amasty, although they were able to see it happen once in testing. I heard from a couple of devs that they have heard other people having issues with data integrity using third-party extensions with Magento 2’s checkout. Has anyone seen anything like this? Thoughts?

Should I repeat unnecessary else condition?

I would like to know what the best way is for dealing with a situation where I repeatedly check a condition within a function using an if-elif-else chain, and if the condition is else, I raise an exception. Is it best to repeat the exact same if-elif-else chain, knowing that in repeated instances the else condition will never occur, or, since I know that, change the last elif to an else? My question is probably best explained with an example.

One option is to repeat the entire if-elif-else chain, knowing that the later else conditions will never be reached. For example:

a = 5 if case == 'case1':   a += 5 elif case == 'case2':   a -= 5 else:   raise Exception('Not a recognized case') # do a bunch of other steps # then, later... if case == 'case1':   a *= 5 elif case == 'case2':   a /= 5 else: # this will never happen, should I remove it?   raise Exception('Not a recognized case') 

Another option is to change the later final elif to an else, like so:

a = 5 if case == 'case1':   a += 5 elif case == 'case2':   a -= 5 else:   raise Exception('Not a recognized case') # do a bunch of other steps # then, later... if case == 'case1':   a *= 5 else: # I know it's case 2   a /= 5 

My goal is to make the code good and extensible. There are many cases, although I’ve only implemented the code for two of them. I would like to be able to implement them one-by-one when I need them. Right now I only need these two cases, but in a month I might need two more, so I’ll implement those when I do and I want the code to make sense with any reasonable (<=8) number of cases.

In the first example, having an else condition that is never used seems like a waste. In the second example the last else functions more as a “I know it’s case 2”, which is fine for the moment but when I enter case3 I’ll have to remember that that’s not really the “else” situation, but the “case 2” situation. A third option is to completely remove the later else from the first example, but then there’s only an if and elif, and that seems one typo/mistake away from creating a bug that’s difficult to find.

Why is isn’t the second if statement being ignored in favor of else?

Here is my code. In the first do while statement, everything runs perfectly, and if a1 doesnt equal 2, the do statement ends. In the second do while statement however, it seems that the nested if runs regardless of an input of ‘7’ the first time, displaying “incorrect”, and only the second time 7 is inputted is if ignored in favor of else, ending the do while statement.

 System.out.println("This is a quiz, you will have infinite attempts per question");         System.out.println("What's 10 minus 8?");         char a1;         char a2;         String a3;         do {          a1 = (char) System.in.read();          if(a1!= '2') {              a1 = (char) System.in.read();              System.out.println("incorrect");              a1 = (char) System.in.read();          }else a1 = '2';         }while(a1!='2'); System.out.println("Congrats, next question"); System.out.println("Whats 14 minus 7?");         do {             a2 = (char) System.in.read();             if(a2 != '7') {                 a2 = (char) System.in.read();                 System.out.println("incorrect");                 a2=(char) System.in.read();             }else a2 = '7';         }while(a2 != '7');         System.out.println("Good one, next question");         }         } 

If I am able to generate the same public key as someone else, do I also get the same private key?

I have a very basic understanding of the asymetric encryption. I have a couple of simple questions. I know I can generate a key pair, of public and private keys.

  • If by co-incidence my public key that is generated is the same as a public key of someone else. Does this mean we will also have the same private keys?

Second related question.

  • If the answer is yes to the first question. Then, is it in theory, possible to have a huge database of all known public keys and keep randomly generating key pairs and checking against the database if any of them match.

Breaking one specific key, is very hard. But is breaking any key also hard? If someone tries to find a match with publicly known key they could somehow break one or a handful of them. If not, what stops this from happening.

Thanks! : )

Chrome – unprompted auto-download of files after opening the browser – bug or something else?

Upon opening google chrome on android, it suddenly downloaded (unprompted by me) a jpeg, as well as a “seed” file. After scanning both files with the mobile version of kaspersky, i opened the jpeg file and noticed that i knew the picture from somewhere. Upon searching, i found it, along with the seed file in the download folder (from within the chrome app). Both were however said to be downloaded in 2017. In contrast, in my own download folder inside the file manager the files are said to be downloaded today.

Now, what could have caused said (re-)download? Was this simply a bug, or might there be something else wrong with my phone?

I’ve noticed that Windows 7 tends to boot much slower when I open the Windows boot disk. Anyone else notice this?

I now try to avoid opening the windows boot partition, because when I open and look at it, my Windows 7 takes inordinately long to boot. . . I’ve taken to using a non boot NTFS partition to store shared files. Is there some problem with Linux’s handling of the Win7 boot partition? Anyone else notice this?

Where else does “Primal” appear as a language (from The Hidden Shrine of Tamoachan adventure)?

Included in the Tales from the Yawning Portal, The Hidden Shrine of Tamoachan adventure includes a creature called the Tecuziztecatl, which has its stat block included in the appendix (page 245).

Its languages are listed as:

Languages Olman, Primal

Olman is referenced throughout the adventure, but what is Primal? I’ve never seen this referenced anywhere else, not in the PHB or under any other monster’s stat block.

Is this the same as Primordial? Since one of the PCs speaks Primordial, this will influence whether the party can speak with this creature or not.

If previous editions can provide any context, I’d be interested in any answer that cited old stuff as well; this is tagged 5e mainly just because I’m running the Tales from the Yawning Portal version of the adventure for 5e.