In my program, a Java8 application library, written on NetBeans, when I go to the dist folder and run Project.jar using the command:  java -jar Project.jar   I get the following error:  Sorry, unable to find config.properties Exception in thread "main" java.lang.NullPointerException   It seems it cannot create the input stream necessary to read the properties file.  Here is the class I use to read the properties:  public class PropertyAccess {      public static String getPropertyFromFile(String propertyName){         String ret = "";         //System.out.println(propertyName);         InputStream input = null;         Properties prop  = new Properties();          try {             String filename = "config.properties";             input = PropertyAccess.class.getResourceAsStream(filename);             if(input == null) {                     System.out.println("Sorry, unable to find " + filename);             }              //input = PropertyAccess.class.getResourceAsStream("/config/config.properties");             //input = new FileInputStream("config/config.properties");              input = PropertyAccess.class.getClassLoader().getResourceAsStream("config/config.properties");              prop.load(input);             ret =  prop.getProperty(propertyName);         } catch (IOException ex) {             ex.printStackTrace();         } finally {             if (input != null) {                 try {                     input.close();                 } catch (IOException e) {                     e.printStackTrace();                 }             }         }          return ret;     } }   There is a bad design/implementation where I load the prop file every time I need to read a property from file, this will be corrected before the main release, but this is not what is causing the issue.  Can someone explain how to fix this?  I've tried to add the file to the classpath, but  it also doesnt work.
I need to read a properties files that's buried in my package structure in com.al.common.email.templates.  I've tried everything and I can't figure it out.  In the end, my code will be running in a servlet container, but I don't want to depend on the container for anything. I write JUnit test cases and it needs to work in both.
How can I make a Click-once deployed app run a startup?  The best option I found by searching was to set the Publisher on the app to Startup, so the Start menu shortcut would be placed in the Startup folder, but that seems like a huge hack and I would like there to be a Start menu icon people can find.  What options do I have? What is the variance of the weighted mixture of two gaussians? Say I have two normal distributions A and B with means $\mu_A$ and $\mu_B$ and variances $\sigma_A$ and $\sigma_B$. I want to take a weighted mixture of these two distributions using weights $p$ and $q$ where $0\le p \le 1$ and $q = 1-p$. I know that the mean of this mixture would be $\mu_{AB} = (p\times\mu_A) + (q\times\mu_B)$.  What would the variance be?    A concrete example would be if I knew the parameters for the distribution of male and female height. If I had a room of people that was 60% male, I could produce the expected mean height for the whole room, but what about the variance? Unmarshal a single element list fails My online friend is asking for money in order to visit my home country. Is this a legit request or a scam? Question statement is as in the title:     $\varphi:G\to H$ is a Lie Group Homomorphism, then $\ker \varphi$ has Lie algebra $\ker D_e \varphi$   Since $\varphi$ is a Lie group homomorphism, in particular it is continuous. As $H$ must be Hausdorff, every point set is closed, and hence $\{e\}$ is closed in $H$, which implies that $\ker\varphi = \varphi^{-1}(e)$ is closed as well.  So $N=\ker\varphi$ is an embedded Lie subgroup of $G$. Therefore, the inclusion $j:N\to G$ is a Lie Group homomorphism, and induces a Lie algebra homomorphism $D_e j :T_e N \to T_e G$. So I only need to show that $D_e j$ is in fact an isomorphism between $T_e N$ and $\ker D_e \varphi$.  But I'm stuck at this point. I know that for $X\in T_e N$, we have, for $f\in C^{\infty}(H)$,  $$ D_e\varphi (D_e j(X))(f)=D_e j (X)(f\circ \varphi)=X(f\circ \varphi\circ j)=0$$  So $D_ej(T_e N) \subset \ker D_e \varphi$.  At this point, I can either show inverse inclusion: that is, for every $X\in \ker D_e \varphi$, we can find $Y\in T_e N$ such that $D_e j (Y)=X$, or for all $f\in C^{\infty}(G)$, $Y(f\circ j)=X(f)$  Or I can somehow show that dimensions of the two spaces are the same.   But I can't proceed from here.  It'd be great if someone could help me Combinatorics Question Asking How Many Integer Solutions Given Different Restrictions How many integer solutions of $x_1 + x_2 + x_3 + x_4 = 28$ are there with:  (a) $0 ≤ x_i ≤ 12$?  (b) $−10 ≤ x_i ≤ 20$?  (c) $0 ≤ x_i, x_1 ≤ 6, x_2 ≤ 10, x_3 ≤ 15, x_4 ≤ 21$?  \ \  My attempts (I was really only able to solve part (a) but I would appreciate if you could check my work for this one as well):  (a) First I took the total number of integer solutions with no restrictions: There would be ${28+3\choose 3}$ = ${31\choose 3}$ total solutions with no restrictions.   Then I used the inclusion exclusion principle and knew I would have to subtract [P(A) + P(B) + P(C) + P(D)] where A --> $x_1$ is greater than or equal to 13, ..., D--> $x_4$ is greater than or equal to 13. The probabilities of all these cases would equal ${15+3\choose 3}$ = ${18\choose 3}$ because once we assign 13 to one of the $x_i$ there would be $28 - 13 = 15$ remaining to distribute among the $x_i$ values. We would also need to choose which of the $x_i$ to give the 13 to so we would multiply the ${18\choose 3}$ by ${4\choose 1}$ = ${4\choose 1}{18\choose 3}$  We would then have to add back, since we "oversubtracted", the case in which there is an intersection between two of the $x_i$ or in other words two of the $x_i$ receive 13 or more. P$(A\bigcap B)$ = $28-2(13) = 2$ remaining to distribute among the $x_i$ values. So we would also have to choose which of the $x_i$ to give the 13 to so we would have ${4\choose 2}$ ways to choose them. So there would be ${4\choose 2}{2+3\choose 3}$ = ${4\choose 2}{5\choose 3}$ solutions in this case.   Thus the number of solutions would be: ${31\choose 3} - {4\choose 1}{18\choose 3} + {4\choose 2}{5\choose 3}$.  I'm not sure if this is correct and I'm really stuck on b and c so I would appreciate any help or feedback. Thank you! A user has asked  which did not receive much attention, and thus the user deleted the post. After some time, the user asked the  (with just slight changes to the title and a tag change), so that it could receive a bit more attention. The strange thing is that the question was not downvoted or poorly written, and yet the user deleted the original post. Now, since the original question was deleted, I could not mark the new one as a duplicate (it threw an error). My question is, how do we handle such questions? Just let them be as such or let the user know about it or is there another way to handle such situations? Why an abstract class implementing an interface can miss the declaration/implementation of one of the interface's methods? I have some programs running on start-up like . UAC prompts every time the Windows starts. How can I set a program to make sure that no intervening prompt would appear during start-up? Show that $\int_{0}^{\infty}|\frac{\sin x}{x}|\,dx=\infty $ Problem: Show that $\int_{0}^{\infty}|\frac{ \sin x}{x}|=\infty $ .  Here is what i have tried :  I found out that for all $x&gt;0$ , $x-\frac{x^3}{6} &lt; \sin x &lt;x $  . So $1-\frac{x^2}{6}&lt;\frac{ \sin x}{x}&lt;1$ . So applying integration to both side from $0$ to $M$ we have $M-\frac{M^3}{18}&lt;\int_{0}^{M}|\frac{ \sin x}{x}|&lt; M$ . Now we send $M \rightarrow \infty$ and observe that left-hand side goes to infinity . Hence proved .  Please point out if there is anything wrong with my approach . I will also be delighted if could provide alternative solutions . Thank you . What torque for caliper brakes onto carbon-alloy forks? I've recently got a new bike with a . This comes with deep-drop calliper brakes (Shimano R451 Dual Pivot). The first time out I bumped one of the brakes and it twisted around the single attachment bolt and rubbed on the rim.  I managed to easily twist it back by hand and carry on, however I thought the bolt probably needs tightening. The question is: How tight can it be?  As the fork is part carbon I've so far only dared to take it up to 4Nm, but it still seems possible to twist the whole calliper around with a bump of the hand. Maybe that's normal? Perhaps it's easier to bump around because of the longer deep-drop lever. Should I be aiming to get it really secure?    I'm not sure whether the brake mount in the fork is all carbon, or some of it is alloy underneath, but either way I'd like to know what a sensible torque is. As far as I can see from the  there is no such specification. How can I find this out? override Home key in android ICS I would really like to see all of my questions and answers on the profile page, even if some of them were deleted, and I don't have enough rep to see them on the site. (Note that some questions are  after 30 days or 1 year, and the author might be oblivious about what happened.)   , the &quot;deleted recent [questions/answers]&quot; links in one's own user profile now list all respective posts that were deleted in the past 60 days, rather than just those that were originally posted in the last 60 days. , users with the &quot;access to moderator tools&quot; privilege (10k+ on designed sites, 2k+ on beta and non-designed sites) can use the search operator deleted:1 to see all their own deleted posts. , deleted questions and answers that were posted in the past 60 days, can be seen using the &quot;deleted recent questions&quot; and &quot;deleted recent answers&quot; links on the questions and answers tabs (at the bottom of the tab) in your user profile. For older posts: as of 2013-04-23 you can  if you already have a link to them, but they still aren't linked from the user profiles (not even just for you). Nor do you see inbox notifications for comments on them if you come back a few hours later. You have to have thought to bookmark your question, or you have to go digging for it in your browser history. I have a question about subsets $$ A \subseteq \mathbb R $$ for which there exists a function $$f : \mathbb R \to \mathbb R$$ such that the set of continuity points of $f$ is $A$. Can I characterize this kind of sets? In a topological,measurable or in some way? For example, does there exist a function continuous on $\mathbb Q$ and discontinuous on the irrationals? Does the integral $\int_{1}^{\infty} \sin(x\log x) \,\mathrm{d}x$ converge? I want to clear the inputtext used to search, and clear all search results using a commandbutton. I tried the following on the 'Reset' button I added but it only clears the inputtext and the search results are not clearing.  &lt;apex:pageBlockSectionItem &gt;                     &lt;apex:outputPanel layout="block" Rendered="true"&gt;                     &lt;apex:inputText value="{!ReportSearchString}" /&gt;                     &lt;apex:commandButton value="Search" action="{!searchReports}" reRender="ReportSearchResults, "/&gt; &amp;nbsp;&amp;nbsp;                      &lt;apex:commandButton value="Back" action="{!BackToCreateFeedPage}"/&gt;&amp;nbsp;                     &lt;apex:commandButton value="Reset" onclick="this.form.reset();return false;"/&gt;                     &lt;/apex:outputPanel&gt;                 &lt;/apex:pageBlockSectionItem&gt;                             &lt;/apex:pageBlockSection&gt;                         &lt;apex:pageBlockSection id="ReportSearchResults"&gt;                 &lt;apex:outputText value="{!warningMessage}" rendered="{!!showTable}" /&gt;                 &lt;apex:pageBlockTable value="{!reportList}" var="item" rendered="{!showTable}"&gt;                     &lt;apex:column headerValue="Report Name" &gt;                         &lt;apex:commandLink value="{!item.Name}" action="{!BackToCreateFeedPage}"&gt;                             &lt;apex:param value="{!item.Id}" name="SelectedReport" assignTo="{!selectedReportId}" /&gt;                         &lt;/apex:commandLink&gt;   This is my search function, it works fine. I need to clear the results of this search on clicking 'Reset' button.   public void searchReports()     {         showTable = false;               reportList = new List&lt;Report&gt;();          reportSearchResult = new Map&lt;Id, Report&gt;();          selectedReport = new Report();         if((ReportSearchString != null &amp;&amp; ReportSearchString != '') &amp;&amp; ReportSearchString.length() &gt;= 3)         {             reportSearchResult = new Map&lt;Id, Report&gt;([Select Id, Name From Report Where Name Like :'%'+ReportSearchString+'%' limit 2000]);              warningMessage = 'No Result Found';         }         else         {             warningMessage = 'Search text should have atleast 3 characters';         }     } Profitable strategy in coin tossing? There is a coin with a probability $p$ of heads, and $1-p$ of tails. Tosses are independent of each other. When you bet an amount of money $x$, you receive $2x$ if it lands heads, and you lose what you bet if it lands tails.  We are going to use the following strategy:  You start betting an initial amount $x_0$. Every time you lose, you bet twice what you bet in the previous throw. You keep doing this, until you win, at which point you retire, or start again, betting $x_0$.  The interesting case of course is when $p &lt; 0.5$.  The question is: How profitable is this strategy? Intuitively I feel that eventually I can always win an arbitrarily large amount of money. But that can't be entirely right ("the house always wins!"). So what am I missing here? What's the expected win in each run?  Also, does this sort of strategy have a name in the literature?  P.S.: Found this later, My Bridgestone MB-5 currently has a 7-speed rear wheel. I'd like to convert it to a 10-speed. Is this possible? Is it practical? I have the following text:    A   Hello   world   B   Hello   world   C   Hello   world   I know that I can replace Hello by Hi using sed:  sed 's/Hello/Hi/g' -i test   but this replace each Hello with Hi:    A   Hi   world   B   Hi   world   C   Hi   world   what I really want is to replace only the Hello after B:    A   Hello   world   B   Hi   world   C   Hello   world   so I have tried this:  sed 's/"B\nHello"/"B\nHi"/g' -i test   but nothing happened, How can I do this?  Note: There are some white-spaces on the beginning of each line of the file. javascript document.getElementsByClassName compatibility with IE