import javax.sound.sampled.AudioInputStream;     import javax.sound.sampled.AudioSystem;     import javax.sound.sampled.Clip;      public class Test13 {          public Test13() {              ClassLoader classLoader = Thread.currentThread().getContextClassLoader();             System.out.println(classLoader.getResourceAsStream("audio1.wav"));              try{               Clip clip = AudioSystem.getClip();               AudioInputStream inputStream =                     AudioSystem.getAudioInputStream(classLoader.getResourceAsStream("audio1.wav"));               clip.open(inputStream);               clip.start();               clip.close();             } catch (Exception  e)                 {                   System.out.println("something failed");                 }      }  }   //When I click on Run, at Console window there showed :  //&lt;terminated&gt; Test13 [java application]C:\Program Files\java\jdk1.8.0_221\bin\javaw.exe
I am using the following code to play a sound file using the java sound API.      Clip clip = AudioSystem.getClip();     AudioInputStream inputStream = AudioSystem.getAudioInputStream(stream);     clip.open(inputStream);     clip.start();   The method call to the Clip.start() method returns immediately, and the system playbacks the sound file in a background thread. I want my method to pause until the playback has completed.  Is there any nice way to do it?  EDIT: For everyone interested in my final solution, based on the answer from Uri, I used the code below:  private final BlockingQueue&lt;URL&gt; queue = new ArrayBlockingQueue&lt;URL&gt;(1);  public void playSoundStream(InputStream stream) {     Clip clip = AudioSystem.getClip();     AudioInputStream inputStream = AudioSystem.getAudioInputStream(stream);     clip.open(inputStream);     clip.start();     LineListener listener = new LineListener() {         public void update(LineEvent event) {                 if (event.getType() != Type.STOP) {                     return;                 }                  try {                     queue.take();                 } catch (InterruptedException e) {                     //ignore this                 }         }     }; clip.addLineListener(listener ); }
How do the Hat Dash points work? I'm using MySQL's AUTO_INCREMENT field and InnoDB to support transactions. I noticed when I rollback the transaction, the AUTO_INCREMENT field is not rollbacked? I found out that it was designed this way but are there any workarounds to this? Remove linux version 3.19.31 How to mount and unmount hard drives under Windows (the unix way) How to make a half cylinder? I am having a tough time building a half cylinder and have not found any tutorial showing me how to do that. Why are image thumbnails cropped proportionally (not per dimensions)? For some reason WordPress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in functions.php:  add_image_size( 'main-thumbnail', 728, 410, true );   and in content.php:  &lt;div class="thumbnail"&gt;     &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;        &lt;?php the_post_thumbnail( 'main-thumbnail' ); ?&gt;     &lt;/a&gt; &lt;/div&gt;   I added these two things and regenerated my images with the  plugin, but it doesn't seem to matter. The images don't change.  For some reason WordPress isn't recognizing the hard crop and is keeping the images proportional, so some of my images are way taller than 410 pixels. Why is this? How to fix very slow Ubuntu booting? For me, it is pretty clear that $a + \overline{a}*b = a + b$, because the first $a$ in the or will make sure that if the second term must be 'evaluated', $a$ will always be false, and therefore won't matter in the and - probably because I'm a programmer and it is very common to see this unnecessary cluttering in long if-else structures.  I can easily prove it with the truth table as well, just make both expressions', and turns out they are identical.  But I was looking for a 'algebraic' way to prove it. That is, something using the basic operations properties like the fact that they are transitive, commutative, associative, etc. For example, if I was to prove this other simple identity $a + a*b = a$ I would simply do something like:  $a + a*b = a*(1 + b) = a*1 = a$.  Is there a way to also prove the former using this algebraic operations, without resorting to the truth table? I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).  What should I do? Shall I delete it or just stop updating its value? Why?    I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.  In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).      [Some related links about empty cluster case, added later by @ttnphns: ; ; ; ; ; ; ; ; ] Showing a bijection between the set of ringhomomorphisms $\mathbb{Z}[i] \to R$ and the set of $x \in R$ for which $x^2+1=0$ Comparing two logit or probit curves using a single parameter I've conducted a psychological experiment on the same subject, under two different condition. For each condition I've collected the number of correct and wrong answer for each stimulus (number of trials per stimulus = 10; number of stimulus = 15). From the data collected I fitted a psychometric curve (probit or logit curve), and now I want to compare the results.  Consider subject 1: His answers are collected in the following matrices  **COND_1**     correct cnt   Y  N   1   0 10   2   0 10   3   0 10   4   0 10   5   0 10   6   0 10   7   1  9   8   4  6   9   5  5   10  7  3   11  8  2   12  7  3   13 10  0   14 10  0   15 10  0  **COND_2**     correct cnt   Y  N   1   0 10   2   2  8   3   2  8   4   3  7   5   2  8   6   4  6   7   8  2   8  10  0   9   8  2   10 10  0   11  9  1   12 10  0   13 10  0   14 10  0   15 10  0  COND_1.1 &lt;- matrix(c(0, 2, 2, 3, 2, 4, 8, 10, 8, 10, 9, 10, 10, 10, 10, 10, 8, 8, 7, 8, 6, 2, 0, 2, 0, 1, 0, 0, 0, 0), byrow=F, ncol=2)  COND_1.2 &lt;- matrix(c(0, 0, 0, 0, 0, 0, 1, 4, 5, 7, 8, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 6, 5, 3, 2, 3, 0, 0, 0), byrow=F, ncol=2)  cnt &lt;- seq(from=0, to=1.4, by=0.1)  ddprob.1.1 &lt;- glm(COND_1.1 ~ cnt, family = binomial(link = "probit"))  ddprob.2.1 &lt;- glm(COND_2.1 ~ cnt, family = binomial(link = "probit"))     Observing the plot, you can surely say that performance under condition 2 is better then the performance under condition 1. In fact if you compute some parameters like AUC, p25, p50, p75 (the value of the stimulus at which the number of correct answers are 25%, 50% and 75% each) [threshold parameters], you'll see that:  COND_1      COND_2 AUC    &lt;    AUC p25    &gt;    p25 p50    &gt;    p50 p75    &gt;    p75     Now consider subject 2:  COND_1     correct cnt   Y  N   1   0 10   2   0 10   3   0 10   4   0 10   5   3  7   6   3  7   7   4  6   8   5  5   9   9  1   10  9  1   11 10  0   12 10  0   13 10  0   14 10  0   15 10  0  COND_2     correct cnt   Y  N   1   0 10   2   1  9   3   0 10   4   4  6   5   2  8   6   6  4   7   4  6   8   7  3   9   4  6   10  7  3   11  7  3   12 10  0   13  9  1   14 10  0   15 10  0   COND_1.2 &lt;- matrix(c(0, 0, 0, 0, 3, 3, 4, 5, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 6, 5, 1, 1, 0, 0, 0, 0, 0), byrow=F, ncol=2) COND_2.2 &lt;- matrix(c(0, 1, 0, 4, 2, 6, 4, 7, 4, 7, 7, 10, 9, 10, 10, 10, 9, 10, 6, 8, 4, 6, 3, 6, 3, 3, 0, 1, 0, 0), byrow=F, ncol=2) cnt &lt;- seq(from=0, to=1.4, by=0.1)  ddprob.1.1 &lt;- glm(COND_1.2 ~ cnt, family = binomial(link = "probit")) ddprob.2.1 &lt;- glm(COND_2.2 ~ cnt, family = binomial(link = "probit"))   The plotted curves are shown in the image below.    Can you say what performance is better? Under condition 1 or under condition 2? Extrapolating AUC, p25, p50, p75, you have:  COND_1      COND_2 AUC     &gt;   AUC p25     &gt;   p25 p50     =   p50 p75     &lt;   p75   So my question is: Is there a method to say that a generic curve (logit, probit or whatelse) is HIGHER then another? Is there a method to compare (a single number of "performance") that describe the differences of the two curves? My example shows that AUC, p25, p50, p75 are not good parameters. I'd like to compute a single numeric parameter for each curves, to make a simple t-paired test, extrapolated from the distribution seen. I read news on the BBC (on its website) this morning. When I was reading the news I noticed the definite article the was missing in a sentence. As per my opinion, the reporter missed the article the. But I also thought that the reporter also had some point as he did not use the article there. So I just wanted to confirm so landed here to get some help on it.     On the website:      It also proclaimed the group's leader, XYZ  (name), as caliph and   "leader for Muslims everywhere".      As per my opinion it should have been:      It also proclaimed the group's leader, XYZ  (name), as the caliph and   "leader for Muslims everywhere".   Source link: How to fade one material into the other? Hello blender community.  Could someone please let me know how to fix this issue? I have one material for the whole face and a different one for the lips.  there's a noticeable edge that I want to get rid of. I just want it to have an ease fade instead of a sharp edge.   what's the best way to go about this?  Thank you in advance!    Finished Update  I wanted to give an update on how it was fixed with @hexbob6 and @Lemon 's help.    I needed two textures. One is the actual colored version and the 2nd is the black and white masked version. Hexbob6 described very well on the process here:   A: The node process on how to do it.    The B/W masked texture is going to be connected to the Fac of the mixed shader along with its UV coordinates. Make sure the image is on clip instead of repeat. the 1st shader is going to be the black part of the B/W masked texture. An important thing to note is if you have a texture already for the object, be sure to connect the other UV coordinates! the 2nd shader will be the white part of the B/W masked texture.   B: This section is the UV layout called "mainUV" where all the color goes.  C: This section is the B/W masked texture to focus on the lips.  D: Just the render view  E: Best way to texture something is to be able to see it in 3D view and texture paint.  F: Just showing that there are two textures to keep track of. One is the main UV and the 2nd is to focus on the lip.   That was it. Once again thanks to those who replied and helped me figure this problem. In the process I learned other things that I didn't know about blender even though I've been using it for years. Is there a word for someone with the same name? If a person shares my name, in Dutch there is the word &quot;naamgenoot&quot;, meaning roughly 'member of the same name'.  John A: Hi, my name is &quot;John&quot;  John B: O, then we're insert solution word here!  Similarly,  'classmate' is 'klasgenoot' in Dutch 'roommate' is 'kamergenoot' in Dutch  I'm pretty sure I cannot call someone with the same name as mine a 'namemate' :)  Edit Because sceptics appear to be frustrated mightily by an apparent lack of research, there was  in chat, with no satisfactory conclusion. /Merriam Webster namesake appears to be linked to intentional name correspondance (being named after someone). There may be a US/UK English divide there.  &quot;I was named after my grandfather. I am his namesake.&quot; -   Also, the introduction seems to hint at much broader meaning:  &quot;Namesake is a term used to characterize a person, place, thing, quality, action, state, or idea that has the same, or a similar, name to another&quot;   Do you know of a better word/phrase to describe this succinctly? Why is a nonstop flight sometimes more expensive than multiple connections? Other than the general inductive method,how could we show that $$\sum_{r=0}^n \frac{(-1)^r}{r+1}\binom{n}{r} = \frac1{n+1}$$  Apart from induction, I tried with  to check the validity, but I can't think of an easy (manual) alternative.  Please suggest an intuitive/easy method. Ignore .DS_Store and Icon files in a folder with Cocoa NSFIleManager Comprehensive Rules for Game of Thrones Lines of Succession I'm three quarters through the third book, "Storm of Swords" right now (so please, no spoilers from too late in the book or any subsequent books).  I just read a part where Tyrion is discussing with Prince Oberyn and they mention the difference between Dornish law and Westerosi law in Line of Succession (ie women can rule under Dornish law).  I'm a little confused trying to puzzle out what the exact LOS rules are.  At first I though it was: at the moment a king/lord dies, to find who holds the title next, you do a depth-first search down the family tree starting with the oldest sibling (ignoring anyone who isn't true-born or has given up their claim ie as Night's Watch or Kingsguard etc.).  Then, for Dornish law you take the first living person and for Westerosi law the first living male person found in this way (so succession can pass through a woman in both cases, but only Dornish law actually allows them to claim the title). If there are no valid living heirs, then you work backwards along the paternal line until you find an ancestor who has living heirs and start from them.  But there were various references to if Sansa's brothers were all dead, then her child would claim Winterfell.  It seems to me that that's only true if somebody else doesn't get it first.  In other words, if Sansa's brothers are killed before she has a child (even if she's already married), doesn't that mean Winterfell would pass to the nearest cousin along her father's line (whomever that may be)?  And then because that cousin has already held Winterfell, when they die the next in the line of succession starts from them so Sansa's children's family would not have claim to Winterfell again unless that cousin has no valid heirs.  What am I missing here? Is there some exception?  Are there no valid cousins? reconfiguration issues with dpkg I ran into some problems installing a package with apt. The terminal hung up during an install and I saw no other choice but to close the terminal. The problem, however, is that I can't seem to solve the issues that this has caused.   As is typical, I get:  E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?   This gets me nowhere and I'm locked out until I run sudo dpkg --configure -a. Makes sense. However, this process spits the following out and then hangs on the last line:  Setting up virtualbox-dkms (5.2.10-dfsg-6) ... Removing old virtualbox-5.2.10 DKMS files...  -------- Uninstall Beginning -------- Module:  virtualbox Version: 5.2.10 Kernel:  4.15.0-23-generic (x86_64) -------------------------------------  Status: This module version was INACTIVE for this kernel. depmod...  DKMS: uninstall completed.  ------------------------------ Deleting module version: 5.2.10 completely from the DKMS tree. ------------------------------ Done. Loading new virtualbox-5.2.10 DKMS files... Building for 4.15.0-23-generic Building initial module for 4.15.0-23-generic   A typical solution I've read is that you need to fix the broken packages. When I try to fix the broken packages (sudo apt install -f), the system also hangs on the same line, although the output is different:  Reading package lists... Done Building dependency tree        Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 3 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up virtualbox-dkms (5.2.10-dfsg-6) ... Removing old virtualbox-5.2.1  0 DKMS files...  ------------------------------ Deleting module version: 5.2.10 completely from the DKMS tree. ------------------------------ Done. Loading new virtualbox-5.2.10 DKMS files... Building for 4.15.0-23-generic Building initial module for 4.15.0-23-generic   I am unable to get out of it unless I kill the process. This I do by checking what is currently running related to apt (ps aux |grep apt), and then I kill the relevant processes with sudo kill -9 process_number_here.  If I try to run things after that, it tells me I still need to reconfigure dpkg.  I tried looking around for more solutions to dpkg and all I really see is the nuclear option:  sudo rm /var/lib/dpkg/lock sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/apt/lists/lock   I also delete the files in /var/lib/dpkg/updates because when I did some digging one of the files inside had the exact same text as the above long output... but I fully admit to being out of my league here and I don't know what to do.   Taking a look at the error messages, I recognize that it hangs on building something related to the kernel. But I have no idea where to even start solving that. Any help is appreciated. My system is ubuntu 18.04 Given that $a$~$\mathcal{N}(\mu, \Sigma)$ and $\mu$~$\mathcal{N}(0, \sigma^2 I)$, Is $p(a|\Sigma, \sigma)=\int p(a|\mu, \Sigma)p(\mu|\sigma)d\mu$ again a Normal distribution? And how to estimate the mean and variance respectively? Thanks a lot!