I am summarizing below. import javafx.collections.ObservableList; public class Product {     private ObservableList&lt;Part&gt; associatedParts;     public void addAssociatedPart(Part selectedAssociatedPart) {               Part testPart = new InHouse(10,&quot;Test&quot;,5.00d,4,3,2,5);          associatedParts.add(testPart); }  Everything works up to associatedParts.add(testPart). I get &quot;Caused by: java.lang.NullPointerException&quot;. I am new to coding but I think this should work. Can anyone help me understand what I am doing wrong here?
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
When I was a kid we had a VHS tape of some Disney live action (not animated) sci-fi movie. It may have been a mini-series or a made-for-tv movie, but I'm not sure. I'm also not sure about the year but it would probably have been late 80s or early 90s based on when I would have seen it. I know it was Disney because they had some live action Goofy and Mickey running around the movie's set as an introduction discussing the plot with a host before the movie.  The plot is basically as follows:   A starship is loaded with mostly children and teenagers as a cross-galaxy human settling effort. Accidents (which are not really accidents and later revealed) cause adult crew members to be killed.  They travel to another planet and face all sorts of troubles. It arrives at the new planet after overcoming obstacles.   Other memorable scenes that may help:   Navigating out of earth's asteroid belt made out of space junk. One of the adults was killed via an airlock malfunction. The ship was supposed to be peaceful with no weapons. At one point they bring on board some crazy guy who puts together a rail gun. There's a memorable line like "Do you want no weapons at all or a well aimed rock?"  There's a planet or space station (I can't remember which) that has a fight scene with the evil bad guy. This scene takes place on what looks to be a carnival or fairground. The bad guys are trying to steal the ship the kids are on because it has some kind of really good futuristic space drive.   Hopefully you remember it better than I do! I've tried looking online for it before with no luck. So, in my physics textbook it's written that the kinetic energy possessed by a body is equal to the amount of work done by an opposing force to stop the body, now that got me thinking that when a ball hits a wall, the wall which is the opposing force does no work  because there is no displacement, so to say isn't the kinetic energy possessed by the ball zero? How to pass multiple operator properties via UI layout? Basically, I want to have a single operator which can do multiple things, based on some attributes values.  class MyPanel(bpy.types.Panel):     # (...)     layout = self.layout     row = layout.row()     row.operator("my.button", text="Button text")  class MY_BUTTON_OT_Button(bpy.types.Operator):     bl_idname = "my.button"     bl_description = "Button description"     bl_label = "Button"     foo = bpy.props.IntProperty()     bar = bpy.props.BoolProperty()      if bar:         # Do something with foo     else:         # Do something else :P   I know how to set one attribute, like so:      row.operator("my.button", text="Button text").foo=5   But what about multiple arguments? I tried several things that didn't worked, like (e.g.):   With setattr(): row.operator("my.button", text="Button text").setattr(foo=5,bar=True)   With a custom method setVal() in the operator class: row.operator("my.button", text="Button text").setVal(foo=5,bar=True)   Maybe I must use a single EnumProperty? I hope to avoid this, so my question is: Is it possible to pass multiple custom arguments to set attributes in an operator class? And if yes, how ?  Thanks for your help. Is acceleration relative in relativity? Suppose a box A is moving relative to a Box B, then by time dilation equation if I take 1 sec passed for an observer in A then for an observer in B will be little longer. Now if I suppose that the box B is moving while A is stationary under the same condition, then by the time dilation equation time passed in B must be shorter than A. How is this issue resolved? In the twin paradox problem my book says that it's due to acceleration, but in my opinion acceleration is relative (please correct me if I'm wrong), but here it is not the case. Recently I've installed Kubuntu in a newly bought laptop with an Intel WiFi 6 AX200 network card, I can connect to the wifi without apparent problems but when I open the driver manager in the settings I face this weird situation:  Intel Corporation: Wi-Fi 6 AX200 This device is not working.  [ ] Using iwlwifi driver backport in DKMS format from backport-iwlwifi-dkms (open source)  [ ] Continue using a manually installed driver  [x] Do not use the device   Note that "Continue using a manually installed driver" is the only voice selectable in the list.  Here is some additional information:  $ lspci -nnk | grep 0280 -A3 02:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6 AX200 [8086:2723] (rev 1a)         Subsystem: Intel Corporation Wi-Fi 6 AX200 [8086:0084]         Kernel driver in use: iwlwifi         Kernel modules: iwlwifi  $ rfkill list all 0: hci0: Bluetooth         Soft blocked: yes         Hard blocked: no 1: phy0: Wireless LAN         Soft blocked: no         Hard blocked: no  $ dmesg | grep iwl [    2.888227] iwlwifi 0000:02:00.0: enabling device (0000 -&gt; 0002) [    2.945179] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-cc-a0-50.ucode failed with error -2 [    2.945217] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-cc-a0-49.ucode failed with error -2 [    2.947244] iwlwifi 0000:02:00.0: TLV_FW_FSEQ_VERSION: FSEQ Version: 43.2.23.17 [    2.947250] iwlwifi 0000:02:00.0: Found debug destination: EXTERNAL_DRAM [    2.947252] iwlwifi 0000:02:00.0: Found debug configuration: 0 [    2.947697] iwlwifi 0000:02:00.0: loaded firmware version 48.4fa0041f.0 op_mode iwlmvm [    3.145585] iwlwifi 0000:02:00.0: Detected Intel(R) Wi-Fi 6 AX200 160MHz, REV=0x340 [    3.159226] iwlwifi 0000:02:00.0: Applying debug destination EXTERNAL_DRAM [    3.160060] iwlwifi 0000:02:00.0: Allocated 0x00400000 bytes for firmware monitor. [    3.336456] iwlwifi 0000:02:00.0: base HW address: 50:eb:71:d7:0b:40 [    3.353553] iwlwifi 0000:02:00.0 wlp2s0: renamed from wlan0 [    4.457920] iwlwifi 0000:02:00.0: Applying debug destination EXTERNAL_DRAM [    4.621843] iwlwifi 0000:02:00.0: FW already configured (0) - re-configuring [    4.629999] iwlwifi 0000:02:00.0: BIOS contains WGDS but no WRDS   Someone have idea why this happened? In  as well as on Wikipedia the radial coordinate of the Schwarzschild metric is described as follows:     ...the r co-ordinate is the value you get by dividing the circumference of the circle by 2π.   This circumvents (no pun intended) the problem of talking about the path outwards from the singularity, but what about the circle itself: does it have the length we would measure when flying around it (however this is done) or is it a virtual circle assuming flat space, i.e. no mass at the center. How can I prove that $2017 \mid 1^{2017}+2^{2017}+\dots+2017^{2017}$? I tried proving it with the use of modulo, however it was to no avail. Afterwards, I  tried researching, for possible theorems, that may help, but that bore no fruit, either. Can you guys please help me proving it, as I am stuck? Thanking you in advance. Show that if $f: \mathbb{R} \to \mathbb{R}$ is a continuous injective map, then it is strictly monotonic.    Could someone give me a proof for this? I have the intuition for why it's true - I'm just having trouble expressing that intuition in a rigorous manner. Basically consider two points $x_1, x_2 \in \mathbb{R}$. By the problem statement, $f$ is continuous on $[x_1, \, x_2]$. WLOG, assume that $f$ is strictly increasing. It there exists a point where it is not increasing, then $f$ hits a value twice, and it's not injective. pgfplots: percentages and endvalues in stacked ybar I have two questions regarding the pgfplots package. I have attached the source code I worked on. There are two features I am not able to realize:   I would like to put the total value (sum of the whole stacked bar) on top of the bar, rotated by 90°. For me, it was only possible yet to get the value of each part of the stacked bar by using the nodes near coords command. Additionally, the percentage of each part of the stacked bar as relative to the whole stacked bar should be displayed in the bar, also rotated by 90° (addition equals 100%)   If it is somehow possible, percentages should have only one significant digit, and those below 5% should not be displayed in the bar. I know this is a pretty complex example, but maybe there is one who can solve it.  \documentclass{article}  \usepackage{pgfplots,pgfplotstable}   \usetikzlibrary{pgfplots.groupplots}    \pgfplotsset{compat=1.8}   \pgfplotstableread{  Criterion  ddd     ccc     vvv   (0)    700         750         750   (a)    700         750         750   (b)        1200        750         750       (c)    33      345     345  (d)    34      333     345  (e)    234     344     344   }\Rob   \pgfplotstableread{  Criterion  ddd     ccc     vvv   0      70          75          75    a      70          75          75    b          120         75      75        c      3       34      34  d      3       33      34  e      23      34      34  }\Gab   \begin{document}  \begin{tikzpicture} \begin{groupplot}[group style= {     columns=2,xlabels at=edge bottom,     ylabels at=edge left,     horizontal sep=1cm,group name=plots, }, ymin=0, enlarge x limits={abs=.5}, enlarge y limits={upper,value=0.4},  ylabel=Mon, ylabel style={text height=0.02\textwidth,inner ysep=0pt},  ybar,ybar stacked, major x tick style = transparent,  /pgf/bar shift=0pt, /pgf/bar width=9pt, x tick label style={text height=2ex},    xlabel style={yshift=-2ex},  xticklabels from table={\Rob}{Criterion},  xtick=data,legend columns=-1, legend style={draw=none, /tikz/every even column/.append   style={column sep=5pt}}]  \nextgroupplot[xlabel=Rob, xlabel shift = -7.5cm, legend to name=grouplegend] \pgfplotstableforeachcolumn\Rob\as\col{     \ifnum\pgfplotstablecol=0      \else       \edef\tmp{         \noexpand\addplot table [x expr=\noexpand\coordindex,y=\col] {\noexpand\Rob};         \noexpand\addlegendentry {\col}     }     \tmp     \fi }  \nextgroupplot[xlabel=Gab, xlabel shift = -7.5cm] \pgfplotstableforeachcolumn\Gab\as\col{     \ifnum\pgfplotstablecol=0      \else     \edef\tmp{         \noexpand\addplot table [x expr=\noexpand\coordindex,y=\col] {\noexpand\Gab};     }     \tmp     \fi   }   \end{groupplot}  \draw[dashed] (plots c1r1.south west) -- ++(0,-1.5);   \draw[dashed] (plots c1r1.south east) -- ++(0,-1.5);  \draw[dashed] (plots c2r1.south west) -- ++(0,-1.5);  \draw[dashed] (plots c2r1.south east) -- ++(0,-1.5);  \node at (plots c1r1.south) [inner sep=0pt,anchor=north, yshift=-12ex]     {\ref{grouplegend}};  \end{tikzpicture}  \end{document} How to connect a Nokia Lumia 730 to Ubuntu 14.04? Is it possible to use an Ubuntu Live CD and run GParted to partition a my HDD (including the partition that is usually mounted on a given system)? I'm encountering a problem with my HDD's partitions and can't resize it. I've described my problem and my system here: .  Now, from a more general perspective, I was thinking on whether it is possible to use an Ubuntu Live CD and use GParted in a live session to possibly go around that problem. Is that possible? I made a separate question as I'm interested in the possibility independently from my current problem.  You see, I only have one partition and that's mounted. When I use GParted through Ubuntu I don't get any error reports (unlike the case reported in the question linked above).  Thanks beforehand. "He didn't know where New Jersey was" scrlttr2: Position of the recipient's address Antiderivative of periodic function I practise before the real analysis exam and I got stuck on few excercises.  "if $F$ is an antiderivative of a continuous periodic function and $F$ is bounded, then $F$ is periodic"  $~\to~$ one should give a proof or counterexample.  (I'm convinced it's true, but how to prove it?) Is the usage of text embedded in an image a bad practice, for very controlled uses? What are your thoughts on writing your text in images?  I'm not saying throughout the whole website... But in certain key locations like image carousels. And I'm not talking about the special cases where you have font types that browsers can't render. I'm talking about text that uses standard fonts and is not too big (3/4 bullets).  Should I embed the text in the images that compose the carousel? Or should I apply the text to the images as "real text" HTML?  What are the advantages/ disadvantages of using text in an image? Per User Named Credential and External Identity Users My question is almost similar to one mentioned in 'Auth Provider with per-user Named Credential' (). I am trying to authenticate and make a API call when a new or existing Salesforce community users try to log in. The Authentication is provided by 3rd party (Cognito). So, the requirement is :  User to be authenticated using the 3rd party system for login. After successful authentication and before community page is displayed, the API call is to be made to 3rd party system to get more details about the user.  In order to achieve this:  Created an Open ID Connect Auth. Provider Use the registration handler on the Auth. Provider to create/link a new/existing user. Use a login flow for API call. Use Per User Identity Type Named Credential to make API calls.  No, where I am having issue is once the user has authenticated successfully, how do I allow the user to make API call without authenticating it again. I am getting the error: An Apex error occurred: System.UnexpectedException: You don't have permission to view this data, enter credentials for the named credential in your personal settings. Or ask your Salesforce admin for help. I believe this error is due to the fact that the user is not listed under 'Authentication setting for External Systems'. My requirement doesn't allow me to authenticate the user again, so how do I achieve this using either APEX or any other way? I want to implement the EM algorithm manually and then compare it to the results of the normalmixEM of mixtools package. Of course, I would be happy if they both lead to the same results. The main reference is Geoffrey McLachlan (2000), .  I have a mixture density of two Gaussians, in general form, the log-likelihood is given by (McLachlan page 48):      $$ \log L_c(\Psi) = \sum_{i=1}^g \sum_{j=1}^n z_{ij}\{\log \pi_i + \log f_i(y_i;\theta_i)\}. $$ The $z_{ij}$ are $1$, if the observation was from the $i$th component density, otherwise $0$. The $f_i$ is the density of the normal distribution. The $\pi$ is the mixture proportion, so $\pi_1$ is the probability, that an observation is from the first Gaussian distribution and $\pi_2$ is the probability, that an observation is from the second Gaussian distribution.   The E step is now, calculation of the conditional expectation:      $$ Q(\Psi;\Psi^{(0)}) = E_{\Psi(0)}\{\log L_c(|\Psi)|y\}. $$ which leads, after a few derivations to the result (page 49):      \begin{align} \tau_i(y_j;\Psi^{(k)}) &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{f(y_j;\Psi^{(k)}}  \\[8pt]                        &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{\sum_{h=1}^g \pi_h^{(k)}f_h(y_j;\theta_h^{(k)})} \end{align} in the case of two Gaussians (page 82):      $$ \tau_i(y_j;\Psi) = \frac{\pi_i \phi(y_j;\mu_i,\Sigma_i)}{\sum_{h=1}^g \pi_h\phi(y_j; \mu_h,\Sigma_h)} $$ The M step is now the maximization of Q (page 49):      $$ Q(\Psi;\Psi^{(k)}) = \sum_{i=1}^g\sum_{j=1}^n\tau_i(y_j;\Psi^{(k)})\{\log \pi_i + \log f_i(y_j;\theta_i)\}. $$ This leads to (in the case of two Gaussians) (page 82):      \begin{align} \mu_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}y_j}{\sum_{j=1}^n \tau_{ij}^{(k)}}  \\[8pt] \Sigma_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}(y_j - \mu_i^{(k+1)})(y_j - \mu_i^{(k+1)})^T}{\sum_{j=1}^n \tau_{ij}^{(k)}} \end{align} and we know that (p. 50)      $$ \pi_i^{(k+1)} = \frac{\sum_{j=1}^n \tau_i(y_j;\Psi^{(k)})}{n}\qquad (i = 1, \ldots, g). $$ We repeat the E, M steps until $L(\Psi^{(k+1)})-L(\Psi^{(k)})$ is small.        I tried to write a R code (data can be found ).    # EM algorithm manually # dat is the data  # initial values pi1       &lt;-  0.5 pi2       &lt;-  0.5 mu1       &lt;- -0.01 mu2       &lt;-  0.01 sigma1    &lt;-  0.01 sigma2    &lt;-  0.02 loglik[1] &lt;-  0 loglik[2] &lt;- sum(pi1*(log(pi1) + log(dnorm(dat,mu1,sigma1)))) +               sum(pi2*(log(pi2) + log(dnorm(dat,mu2,sigma2))))  tau1 &lt;- 0 tau2 &lt;- 0 k    &lt;- 1  # loop while(abs(loglik[k+1]-loglik[k]) &gt;= 0.00001) {    # E step   tau1 &lt;- pi1*dnorm(dat,mean=mu1,sd=sigma1)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))   tau2 &lt;- pi2*dnorm(dat,mean=mu2,sd=sigma2)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))    # M step   pi1 &lt;- sum(tau1)/length(dat)   pi2 &lt;- sum(tau2)/length(dat)    mu1 &lt;- sum(tau1*x)/sum(tau1)   mu2 &lt;- sum(tau2*x)/sum(tau2)    sigma1 &lt;- sum(tau1*(x-mu1)^2)/sum(tau1)   sigma2 &lt;- sum(tau2*(x-mu2)^2)/sum(tau2)    loglik[k] &lt;- sum(tau1*(log(pi1) + log(dnorm(x,mu1,sigma1)))) +                 sum(tau2*(log(pi2) + log(dnorm(x,mu2,sigma2))))   k         &lt;- k+1 }   # compare library(mixtools) gm &lt;- normalmixEM(x, k=2, lambda=c(0.5,0.5), mu=c(-0.01,0.01), sigma=c(0.01,0.02)) gm$lambda gm$mu gm$sigma  gm$loglik   The algorithm is not working, since some observations have the likelihood of zero and the log of this is -Inf. Where is my mistake? Intellisense in IntelliJ no longer working Presumably after an update, google chrome has very serious problems with page rendering. I want to downgrade it. (Switching to vmlinuz.old and initrd.img.old did not help).  $ apt-cache policy google-chrome-stable google-chrome-stable:   Installed: 35.0.1916.153-1   Candidate: 35.0.1916.153-1   Version table:  *** 35.0.1916.153-1 0         500 http://dl.google.com/linux/chrome/deb/ stable/main i386 Packages         100 /var/lib/dpkg/status   on a computer where google chrome works ok:  $ apt-cache policy google-chrome-stable google-chrome-stable:   Installed: 34.0.1847.132-1   Candidate: 35.0.1916.153-1   Version table:      35.0.1916.153-1 0         500 http://dl.google.com/linux/chrome/deb/ stable/main amd64 Packages  *** 34.0.1847.132-1 0         100 /var/lib/dpkg/status   (If I had the .deb on the 2nd computer, everything would be easier. But there's no .deb. And no old .deb's on the google site.)  So I try:  $ sudo aptitude install google-chrome-stable=34.0.1847.132-1 Unable to find a version "34.0.1847.132-1" for the package "google-chrome-stable" Unable to find a version "34.0.1847.132-1" for the package "google-chrome-stable" No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used.   You see, it does not work. The Synaptic manager also shows no version that I could set.  So, how do I downgrade google-chrome-stable?  Probably someone knows an archive of old google-chrome .deb's? I just noticed . Hey! I'm there! But that's beside the point.  The point is that Nick Craver is there too. Nick seems to like really long tag names, so his profile shows up like this:    Akk! Diamonds everywhere!  It seems that the page is optimized for only two lines of tags per user. One tag per line means three lines. Three lines means that Nick's reputation (tag) is cut in half.  Let's not cut Nick's rep (tag) in half on the Users page, no?