I have a main file including many files from the same subfolder. I get lualatex working in case:   I include the files from the subfolder and let the aux/pdf files be generated in the main directory I don't include any file from the subfolder and set the directories aux/output to different subfolders.   However, when I include files from the subfolder and set aux/output directories I got an error     Emergency stop. \include{SourceFiles/Ch2_Literature}      I can't write on file `SourceFiles/Ch2_Literature.aux'. \include{SourceFiles/Ch2_Literature}   where I don't understand why it looks for aux file in the subfolder instead of the aux-directory I already set.

I'm writing my manuscript using TeXlive and Texmaker. I have different folders for chapters, images and frontmatter (including title, declaration, acknowledgements, ...) to organize a little bit the writing process. All these documents are properly written.  To be a little bit organized, I would like to use the option in Texmaker of creating a "build" folder for the generated files during compilation (.aux, .nlo, .log, .bbl, ...) but I can't use the \include command with that "build" option because I got this error:  ! I can't write on file `frontmatter/title.aux'. \@include ...\immediate \openout \@partaux #1.aux \immediate \write \@partau... l.63 \include{frontmatter/title}   If I don't use that option everything works as it should but my main folder is filled with those auxiliary files. Apparently there is a problem writing the auxiliary files, but I can't figure out why.  On the other hand, if I use \input command, everything works well even with the "build" option selected in Texmaker.  But there is a big difference in using \input instead of \include in a large document as you well know in terms of compilation time and other issues related with numbering and referencing if I want to compile only one chapter.  Here is my MWE: Main.tex  \documentclass[12pt,a4paper]{report} \begin{document} \include{frontmatter/dedication}   %%% Not working with "build" option %\input{frontmatter/dedication}   %%% It works with "build" option \end{document}   dedication.tex(included in frontmatter folder which is in the same folder as main.tex)  \chapter*{Declaration} I declare that ........................   Any hint will be appreciated! Happy new year!


I know, that when I create empty catalog it has his own size:  mkdir test && du -h test   gives:  4,0K    test   But this case is another. I had catalog with 1e6 files (74 GB) on external HDD (ext4). I processed these files, saved in other catalog and deleted from this location in parallelized script. Now this catalog should be empty. So it is ok that  ls -a raw/all   print  .  ..   But   du -h raw/all   gives  19M     raw/all   Without -h we have exactly 19288B. And this is also strange result:  ls -la raw/all  total 19292 drwxr-xr-x 2 daniel daniel 19746816 wrz 18 19:23 . drwxrwxr-x 4 daniel daniel     4096 wrz 17 13:21 ..    What is going on? Is there any cache in du command? Or after processing such many files there are any rest after these files? I deleted filed by unlink in perl5 script.  Update - answers to questions from comments  ls -aiR raw/all raw/all: 51647758 .  51647760 ..  lsof +L1    prints 44 lines but nothing connected with this catalog. But lsof gives something with numbers like 19746816.  lsof | grep raw bash      5355                daniel  cwd       DIR               8,17  19746816   51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all lsof      5677                daniel  cwd       DIR               8,17  19746816   51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all grep      5678                daniel  cwd       DIR               8,17  19746816   51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all lsof      5679                daniel  cwd       DIR               8,17  19746816   51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all   Laptop was rebooted. External drive was disconnected. But du still shows 19M.

This does not make any sense!  user@localhost:~/folder$ du -h --max-depth=1 6.1M    ./subfolder 6.1M    . user@localhost:~/folder$ ls -la subfolder total 6228 drwx------ 2 user user 6369280 2013-07-08 16:03 . drwx------ 9 user user    4096 2013-07-08 16:04 ..   du reports 6.1 megabytes, ls reports a total of "6228" (I don't know total of what)... but the folder is empty... indeed, there is no file there and it should be empty indeed.  Why is that? Can someone explain this to me?  This is happening in a VPS running Ubuntu 10.04  Thank you.


If I cast a spell that has an "on cast" effect, does the effect still trigger even if the spell is countered? For example, if I play  and it gets countered by a counter spell, do I still get to exile 2 target permanents?

If I cast  and target my opponent's two  on the board, does the exile effect resolve before my opponent has a chance to tap one of the lands to play ?   My guess is that the cast effect would go on the stack & resolve prior to Ulamog being on the field and in play as a legal target for Path, but I'd like some confirmation to be certain.


While reviewing a post another one appeared when I was finished. This second post was difficult to comprehend so much I didn't know who was posting and who was attempting an edit. Of course it is marked, but again both were such a mess (I suspected maybe ESL?) that I decided to attempt an edit so I could see what the result was going to be.  I was given a notice that this was some sort of system test that indicated I was in error in editing what was an attempt to deface a post. It pointed out my failure, but I intended on cancelling this edit, but wasn't given the chance.  Maybe this could be adjusted so it waits until the laast step before assuming someone is making an error? This is the only feedback I've ever had for my reviews. Now I'm not sure if I'm doing this correctly at all.  Here was the post:

For the first time I failed an audit in review, but I sure don't think I should have.  I saw the edit wasn't that good, so I hit the improve button to clean things up and got this message:     This was an audit, designed to see if you were paying attention. You didn't pass. This edit vandalizes the post. Don't improve it – Reject it   Sure, I could have rejected it, but some of those can just be improved, especially if the original post needed editing.  Maybe SO could keep track of my successful improves and see that I know what I'm doing, and let me hit the improve button and not fail me for the audit.  EDIT:  I realized after it happened to me again today, that my workflow is to see that there is an error, and instead of checking the whole post, I go into edit mode, and then completely go over the post editing it as needed.  Since SO doesn't seem to want to adapt to that kind of workflow, I'll unfortunately have to change mine, or just do less.  It really slows things down to have to completely go over a post twice (kind of like the inbox zero concept, try to deal with things immediately).


I'm on a B2 visitor visa in the US. I want to go back go the UK for christmas. If I did so would I be able to reenter the country right now? Or would I be denied entry?

This community wiki explains the current restrictions by the United States of America on the entry of individuals who may pose a risk of transmission of the SARS-Cov2, the virus which causes the Covid-19 disease.


The following identity is allegedly due to Ramanujan $$\int_0^\infty \frac{{\rm d}x}{(1+x^2)(1+r^2x^2)(1+r^4x^2)\cdots} = \frac{\pi/2}{\sum_{n=0}^\infty r^{\frac{n(n+1)}{2}}} \, $$but how do you prove this? The denominator of the right side is related to the Jacobi Function, so maybe one could proceed via modular forms?

While studying Ramanujan's Collected Papers I came across a paper titled "Some Definite Integrals" which appeared in Messenger of Mathematics, ${\tt XLIV}, 1915, \mbox{10-18}$. It contains lot of weird integrals for which Ramanujan has given proofs.  However in one instance he discusses about the integral \begin{align} &\int_{0}^{\infty}\frac{dx}{\left(1 + x^{2}\right)\left(1 + r^{2}x^{2}\right)\left(1 + r^{4}x^{2}\right)\cdots} \\[5mm] = &\ \frac{\pi}{2\left(1 + r + r^{3} + r^{6} + r^{10} + \cdots\right)}\label{1}\tag{1} \end{align} where $0 < r < 1$.  Ramanujan derives this formula from \begin{align} &\int_{0}^{\infty}\frac{\left(1 + arx\right)\left(1 + ar^{2}x\right)\cdots}{\left(1 + x\right)\left(1 + rx\right)\left(1 + r^{2}x\right)\cdots}x^{n - 1}\,\mathrm{d}x \\[5mm] = &\ \frac{\pi}{\sin\left(n\pi\right)} \prod_{m = 1}^{\infty}\frac{\left(1 - r^{m - n}\,\,\right)\left(1 - ar^{m}\,\right)}{\left(1 - r^{m}\,\right)\left(1 - ar^{m - n}\,\,\right)}\label{2}\tag{2} \end{align} where $0 < r < 1, n > 0, 0 < a < r^{n - 1}$ and $n$ is not an integer and $a$ is not of the form $a = r^{p}$ where $p$ is a positive integer.  Unfortunately, Ramanujan does not prove the formula (\ref{2}).   Is there any direct approach to establish (\ref{1}) without using (\ref{2}) or some way to establish (\ref{2}) $?$.


I am running a regression and I'd like to be able to do the calculation to get to the F stat  .3062.  How is this .3062 calculated?  Can you help?   x<-rnorm(20000) y<-rnorm(20000) data<- data.frame(x =x, y=y)  fit<-lm(x ~ y) summary(fit)  ####### calculation for r squared rss<- sum(resid(fit)^2) meanX<-mean(x) tss<- sum( (x - meanX)^2) r.squared<- 1-(rss/tss) r.squared   Call: lm(formula = x ~ y)  Residuals:     Min      1Q  Median      3Q     Max  -3.6405 -0.6794  0.0033  0.6674  4.3485   Coefficients:             Estimate Std. Error t value Pr(>|t|) (Intercept) 0.003090   0.007064   0.437    0.662 y           0.003897   0.007043   0.553    0.580  Residual standard error: 0.999 on 19998 degrees of freedom Multiple R-squared:  1.531e-05, Adjusted R-squared:  -3.469e-05  F-statistic: 0.3062 on 1 and 19998 DF,  p-value: 0.58

The help pages in R assume I know what those numbers mean, but I don't. I'm trying to really intuitively understand every number here. I will just post the output and comment on what I found out. There might (will) be mistakes, as I'll just write what I assume. Mainly I'd like to know what the t-value in the coefficients mean, and why they print the residual standard error.   Call: lm(formula = iris$Sepal.Width ~ iris$Petal.Width)  Residuals:      Min       1Q   Median       3Q      Max  -1.09907 -0.23626 -0.01064  0.23345  1.17532    This is a 5-point-summary of the residuals (their mean is always 0, right?). The numbers can be used (I'm guessing here) to quickly see if there are any big outliers. Also you can already see it here if the residuals are far from normally distributed (they should be normally distributed).  Coefficients:                  Estimate Std. Error t value Pr(>|t|)     (Intercept)       3.30843    0.06210  53.278  < 2e-16 *** iris$Petal.Width -0.20936    0.04374  -4.786 4.07e-06 *** --- Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1    Estimates $\hat{\beta_i}$, computed by least squares regression. Also, the standard error is $\sigma_{\beta_i}$. I'd like to know how this is calculated.  I have no idea where the t-value and the corresponding p-value come from. I know $\hat{\beta}$ should be normal distributed, but how is the t-value calculated?  Residual standard error: 0.407 on 148 degrees of freedom   $\sqrt{ \frac{1}{n-p} \epsilon^T\epsilon }$, I guess. But why do we calculate that, and what does it tell us?  Multiple R-squared: 0.134,  Adjusted R-squared: 0.1282    $ R^2 = \frac{s_\hat{y}^2}{s_y^2} $, which is $ \frac{\sum_{i=1}^n (\hat{y_i}-\bar{y})^2}{\sum_{i=1}^n (y_i-\bar{y})^2} $. The ratio is close to 1 if the points lie on a straight line, and 0 if they are random.  What is the adjusted R-squared?  F-statistic: 22.91 on 1 and 148 DF,  p-value: 4.073e-06    F and p for the whole model, not only for single $\beta_i$s as previous. The F value is $ \frac{s^2_{\hat{y}}}{\sum\epsilon_i} $. The bigger it grows, the more unlikely it is that the $\beta$'s do not have any effect at all.


I have the text file (input.txt)  *HEADING *NODE, NSET=ALLNODES    1,   0.000000e+00,   0.000000e+00,   0.000000e+00    2,   2.500000e-01,   0.000000e+00,   0.000000e+00 *ELEMENT, TYPE=S9R5, ELSET=EB1   ...   ...   ...   ...  **  * END OF FILE   My goal is replace all the lines between the lines (*ELEMENT, TYPE=S9R5, ELSET=EB1) and (**) with a new lines.  and keep the rest of the file unchanged. Any solution using: open('input.txt', 'w') as f1: would erase everything in the file and write the new two lines and this is not the thing I need.

I want to loop over the contents of a text file and do a search and replace on some lines and write the result back to the file. I could first load the whole file in memory and then write it back, but that probably is not the best way to do it.  What is the best way to do this, within the following code?  f = open(file) for line in f:     if line.contains('foo'):         newline = line.replace('foo', 'bar')         # how to write this newline back to the file


What is the difference between == and === in php. I am unsure when to use both.  Updated note: So that it shows up in StackOverflow search, the difference between == and === is the same as the difference between != and !==.

What is the difference between == and ===?  How exactly does the loosely == comparison work? How exactly does the strict === comparison work?  What would be some useful examples?


I changed my operating system (LMDE to Ubuntu) and would like to migrate some of the settings stored in the dconf binary file.  I know how to edit the dconf setting of the actual system (using dconf-editor or gsettings), but do not know how to read a dconf binary file of the backup of the home folder of my old system.  Is there any nice way to partially migrate my old setting, e.g. for Deja-Dup?

I've taken a backup of the file where my  database is stored (~/.config/dconf/user which is a binary file), and now I need to move some keys from the backup to the dconf in use.  How can I view the content of the backed up dconf without putting it "in place" and view it with for example dconf-editor?


I'm writing a 3D rigid body physics engine, I am using OpenGl for simulation.  Only convex objects are considered.   My question involves how to detect the point of collision, so that when I apply a response force, I can also calculate torque.  I have used SAT algorithm to detect collision according to this ,  Everything seems to be work fine , But as i get SAT only gives for objects are they colliding? as well as by how much?, it does NOT give you a reference point at which to apply the response force (and thus calculate torque).  I have looked at        None of them seems to be an answer

The Separating Axis Theorem (SAT) makes it simple to determine the Minimum Translation Vector, i.e., the shortest vector that can separate two colliding objects. However, what I need is the vector that separates the objects along the vector that the penetrating object is moving (i.e. the contact point).  I drew a picture to help clarify. There is one box, moving from the before to the after position. In its after position, it intersects the grey polygon. SAT can easily return the MTV, which is the red vector. I am looking to calculate the blue vector.    My current solution performs a binary search between the before and after positions until the length of the blue vector is known to a certain threshold. It works but it's a very expensive calculation since the collision between shapes needs to be recalculated every loop.  Is there a simpler and/or more efficient way to find the contact point vector?


I was following along with the MIT Opencourseware "Statistics for Applications" and their analysis of GLMs only covers discussion of GLMs whose dependent variable $y$ is distributed according to a distribution in the canonical exponential family (i.e. of the form below): $$ P(y\ |\ \theta) = h(y)\exp(\theta^Ty - A(\theta)) $$ If this is the case, then one can easily determine that $\mu = \mathbb{E}[Y] = A'(\theta)$, and since $\mu$ is related to the linear predictor via the link function $g$, we have $$ X^T\beta = g(A'(\theta)),\qquad \theta = (g\circ A')^{-1}(X^T\beta) $$  However, I'm curious about the more general case where the distribution belongs to the overdispersed exponential family: $$ P(\mathbf y\ |\ \theta,\tau) = h(y,\tau)\exp\left(\frac{\mathbf b(\mathbf \theta)^T\mathbf{T}(\mathbf y) - A(\theta)}{d(\tau)}\right) $$  Using the identity $\mathbb{E}[\nabla_\theta\ell] = 0$ where $\ell$ is the log-likelihood function I was able to arrive at $$ [D_\theta \mathbf b]^T\mathbb{E}[\mathbf T(\mathbf y)] = \nabla_\theta A $$ but there are two problems with this. For one, the dimension of $\mathbf b$ might not equal the dimension of $\theta$, and even if it did this would not guarantee the matrix $D_\theta\mathbf b$ (the Jacobian of $\mathbf b$) is invertible. Second, even if it were invertible, we would only arrive at $$ \mathbb{E}[\mathbf T(\mathbf y)] = ([D_\theta \mathbf b]^T)^{-1}\nabla_\theta A $$ which doesn't give us any direct correspondence between the parameter $\theta$ and the linear predictor $\mathbf X^T\beta$, since the link function links $\mathbb{E}[\mathbf y]$ to $\mathbf X^T\beta$, not $\mathbb{E}[\mathbf T(\mathbf y)]$.  So, how are GLMs of this form implemented? Where can I go to read more about how this works?

Is there consensus in the field of statistics that one book is the absolute best source and completely covering every aspect of GLM - detailing everything from estimation to inference?


How to prove that the intersection of  $L^1(\mathbb{R})$ space and $L^2(\mathbb{R})$ space is dense in $L^2(\mathbb{R})$ space?

In Lieb and Loss's Analysis, I saw that they mentioned  $L^1(\mathbb{R}^n) \cap L^2(\mathbb{R}^n)$ dense in $ L^2(\mathbb{R}^n)$ (dense wrt the $L^2$ norm, I think). But I didn't find its proof in the book. So I wonder why it is?    Does this conclusion hold for $L^1(\Omega, \mathcal{F}, \mu) \cap L^2(\Omega, \mathcal{F}, \mu)$ for any measure space $(\Omega, \mathcal{F}, \mu)$?  Are there similar statements if replace $L^1$ with $L^p$, and  $ L^2$ with $L^q$ for $p \leq q \in (0, \infty ]$ or $\in [1, \infty]$?  Thanks and regards!


Here is the question      Prove that the set of limit points of a set is closed.   I'm not even understand the question fully.  Is question meaning  $\{E= {N_\epsilon(p) }\}$? if you said $p$ is the limit point?  How do you approach this question?

From Rudin's Principles of Mathematical Analysis (Chapter 2, Exercise 6)  Let $E'$ be the set of all limit points of a set $E$. Prove that $E'$ is closed.  I think I got it but my argument is a bit hand wavy:  If $x$ is a limit point of $E'$, then every neighborhood of $x$ contains some $y\in E'$, and every neighborhood of $y$ contains some $z\in E$. Therefore every neighborhood of $x$ contains some $z\in E$, and so $x$ is a limit point of $E$. Then $x\in E'$, so $E'$ is closed.  The thing that's bugging me is the leap from one neighborhood to another. Is this formally correct?


I'm using the natbib package for the bibliography, and initially had the plainnat style but have since been told that I've got to use Harvard referencing only. So I tried changing the bibliography styles to ones I've found on online reference sheets - e.g. agsm.bst, but the only ones I find that work and put the bibliography references in the order they need to be ('Author;Year;Title;Journal;Volume;Pages') will bold the volume number like this:     JR Krebs. 1980. Optimal foraging, predation risk and territory defence. Ardea, 68:83-90   It looks very odd and I would like to remove this but I don't know how - do I need to change the code, or is there a style package that I should be using?  Here's the code I have set up:   \documentclass[12pt]{article}  \usepackage{fontspec} \setmainfont{Arial}  \usepackage{natbib} \usepackage{graphicx}  \usepackage{listings} \lstset{frame=single,breaklines=true} \setcounter{secnumdepth}{4} \sloppy  \usepackage{geometry} \geometry{margin=1in}   \title{PAPER TITLE} \date{}  \begin{document} TEXT HERE \bibliographystyle{plainnat} \bibliography{bibliography.bib}   and the bibliography entries are being entered like this:  @article{krebs1980optimal,   title={Optimal foraging, predation risk and territory defence},   author={Krebs, JR},   journal={Ardea},   volume={68},   pages={83--90},   year={1980},   publisher={BioOne} }

Lovely day. I am quite new to LaTeX but picking things up fast. One area which is confusing me greatly is getting my bibliography to work just how I like it.  I have settled on the agsm style and the natbib citation management issue, but there are still some issues.    The volume number of a journal is set in bold. (blue in pic) I want it to just be plain (un-bolded). The journal titles have apostrophes around them. (red in pic) I want to get rid of the apostrophes.   This image added highlights these problems.    Lastly, for the electronic copy, I would like it so the journal identifiers (DOIs) are highlighted blue, so you can click on them and it takes you to the website of the journal article. (green in pic)  Help on any / all of the above would be greatly appreciated. I have searched online for about 8 hours and finally need to ask the lords of TeX.  Edit: This is my bibliography code so far I forgot to add:  \documentclass[11pt,a4paper]{report} \usepackage[numbers]{natbib} \renewcommand\harvardyearleft{\unskip, } \renewcommand\harvardyearright[1]{.}  \bibliographystyle{agsm} \usepackage{hyperref} \begin{document} \cite{ref1} \bibliography{bibFile} \end{document}   Note - that \renewcommand I found from this forum; it gets rid of brackets around the year field which I didn't want.


I know the name of a package in a directory that I already added, and I want to download it without installing it, how is that possible?   Suppose I have already installed it, can I already find the package (or its content)?  Thanks a lot guys

I have apt-get 0.7.23.1 on host machine. I do not have root, thus not able to update it, or install other packages.  I want to download .deb packages with it, but neither  apt-get -d bash   (Invalid operation bash)  nor  apt-get -d install bash   (do not have root)  work.  On my home machine with a newer version of apt-get I can  apt-get download bash   and it does exactly what I want it to.  How can I perform the same on the host machine?


I have a major lagging problem with my XPS L501x. It lags in everything: browsing, gaming, opening files, Ctrl+F in txt files takes too long to open, even the right click lags, watching youtube videos, games, programs, applying settings on anything, playing music and video files, switching between tabs in any browser, opening folders, typing, etc..  I formatted all the hard drive including all partitions and done a clean Windows 7 Home Premium 64-Bit Installation, updated all the drivers definitions but problem wasn't resolved. I ran dell diagnostics by pressing the F12 key while starting up and it passed all the tests, updated the BIOS to A08. Also cleaned all vents to remove dust and used a cooling pad under the laptop but the problem still exists.  I uninstalled the Intel Rapid Storage Driver as I found that this may help but with no luck too.  I ran a memtest to check the laptop memory and no errors are found. then I ran a hard disk diagnostics tool (HD Tune Pro.) which came up with some errors and I don't know whether this errors are the cause of lags or not.  It came up with 31 damaged sectors and 104402084 interface CRC error count and I actually don't know what does this error means. I also was monitoring the temperature and it varies between 50 to 52 C, I don't know whether it is normal or not. Last thing I noticed the read access time is 18.9 ms which is yellow highlighted by the software so maybe it is abnormal. I want to know if my hard drive working normal or this results shows a hard disk failure and needs replace? and If I replaced it this will solve the slow/lags problem or not?  Note: Processor temperature on load: 70 to 73c maximum. Intel Core i7 740QM 1.73GHZ.   Any suggestions please?  My Laptop Specs:  Intel Core i7 1.73 GHz with TurboBoost  RAM: 6GB  Nvidia GeForce GT 435M 2GB Dedicated.  Toshiba Hard Disk: 640GB

I have two laptops, a Dell XPS running 64-bit and HP Pavilion 32-bit and I want to replace the Dell hard drive with the hard drive in the HP temporarily because my Dell laptop became very slow and I want to test if the problem is with the hard drive or something else. The question is: Can I do that without losing data in the two hard drives? I know that maybe data on C partitions will be deleted and that's OK, but will the rest of the data will be lost or not?


You're given a card game as the following:   With a randomly shuffled set of 52 cards, you keep turning over the first card from the remaining cards until you get an Ace Once you get an Ace, you keep turning over cards only this time you look for 2, once you get 2, you look for 3, so on so forth When you have turned over all cards, the biggest number you reached to is your score   What is your expected score then?  [ People used simulation to solve this problem in the aforementioned link.  Is it possible to solve this problem analytically?   For example, as a classic question, we know that on average you need to wait for 10.6 cards to get an Ace.   Or is it possible to get an accurate range for the expectation at least?

I am having some trouble solving the following.  You draw cards from a standard 52-card deck without replacement until you get an ace. You draw from what is remaining until you get a 2. You continue on with 3. What is the expected number you will be on after the entire deck runs out?  It was natural to let   $T_i = \text{first position of card whose value is }i$ $U_i = \text{last position of card whose value is }i$   So the problem essentially amounts to figuring out the probability that you will be on $k$ when the deck runs out, namely:  $$Pr(T_1<\cdots<T_k \cap U_{k+1} < T_k)$$  I can see that  $$Pr(T_1<\cdots<T_k) = 1/k!  \\  \text{and}  \\ Pr(U_{k+1} < T_k) = 1/70$$  but could not get any further...


The script below is a test script and I can get the if else to run when the variable is an int. But I can't seem to get it to run the if else statement when a string is entered.  import java.util.Scanner;  public class ifelse {    public static void main (String[] args)    {       Scanner keyboard = new Scanner (System.in);        String money;        System.out.println("Enter how much money you have.");       money = keyboard.nextLine();        if (money == "fifty"){        System.out.println("money");       }       else if(money == "seventy"){       System.out.println("Nothing");       }    } }   The code below works and it's using int for the variable.  import java.util.Scanner;  public class ifelse {    public static void main (String[] args)    {       Scanner keyboard = new Scanner (System.in);        int money;        System.out.println("Enter how much money you have.");       money = keyboard.nextInt();        if (money == 50){        System.out.println("money");       }       else if(money == 70){       System.out.println("Nothing");       }    } }   Any help is appreciated. Thank you!

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


I have python code that displays the 'fileselect' panel to retrieve and image file. I would like to add a button and event code to this panel. Currently I initiate the 'fileselect' panel with the following after setting it up.  context.window_manager.fileselect_add(self)   Thanks

The dialog above is created with the code below. When I click on the file icon (see red arrow), nothing happens. Is there a proper way to get these to just work or at least point to a custom operator which invokes context.window_manager.fileselect_add(self) or something similar?  It really seems like the functionality I want should be built into the StringProperty when using FILE_PATH as a subtype... I must be missing something obvious.  What I am trying to do is execute a single operation that requires selecting more than one file path. I can invoke 2 fileselect_add's one after the other, but it becomes confusing because right when you click to accept the path the new path window opens immediately. It is just too confusing as to which one is being selected as there is really no way to customize the fileselect_add window to any usefull degree (as far as I am aware) to make it more obvious what the user is selecting.  Dialog code:  class mydialog(bpy.types.Operator):         bl_idname = "tools.mydialog"         bl_label = "My Dialog"          inFilePath = StringProperty(name="input file", subtype="FILE_PATH")         outFilePrefix = StringProperty(name="out prefix", subtype="FILE_PATH")      def invoke(self, context, event):         return context.window_manager.invoke_props_dialog(self)      def execute(self, context):         print(self.inFilePath)         print(self.outFilePrefix)         return {'FINISHED'}


I have a directory with 8,000 images.  These have a variety of filenames and are of type jpeg or png.  I want to rename them to:  pic00001.png pic00002.jpg   I don't mind if I end up doing the pngs in one run and the jpegs in another, ending up with two slightly overlapping sets - pic00001.png, pic00002.png and pic00001.jpeg, pic00002.jpeg  Current questions on SE cover bulk renaming if you take the existing file name and add or remove static information. I'm not doing that. I am replacing the entire filename with an incrementing number.

I have files such as  a bb ccc abc emrls   I would like to rename them so that, after sorting them (for example, lexicographically), each file gets the following name:  00001 00002 00003 etc   where the # of digits for the 0 padding is specified a priori, e.g. 6 in the case above (assuming that we know how many digits are needed).  Since the shell I am most comfortable with is zsh, I'm interested in solutions that benefit from features on zsh (maybe using zsh's zmv?). I would also be interested in solutions that are compatible with Bash.


If $f$ is a continuous function in the complex plane, then how do I use the fact that if $f^2$ and $f^3$ are analytic on $\mathbb{C}$, then $f$ is analytic on $\mathbb{C}$, where $\mathbb{C}$ is complex plane?

Let $f: \mathbb{C} \to  \mathbb{C}$ be a continuous function such that $f^2$ and $f^3$ are both analytic. Prove that $f$ is also analytic.   Some ideas: At $z_0$ where $f^2$ is not $0$ , then $f^3$ and $f^2$ are analytic so $f = \frac{f^3}{f^2}$ is analytic at $z_0$ but at $z_0$ where $f^2$ is $0$, I'm not able to show that $f$ is analytic.


This is the program which was asked in an interview to predict the output         main()   {      char **p = 0;      printf("%d\n", ++p);   }   Can you please let me know why is the answer 4 here?

Does anyone have any good articles or explanations (blogs, examples) for pointer arithmetic?  Figure the audience is a bunch of Java programmers learning C and C++.


I am travelling to Hungary for an all expenses paid coding competition I have been invited to by a very well known company. I need to apply for a tourist visa.  I am currently residing in India and quit my job a few months back. I am freelancing now and have a decent income. Unfortunately I haven't registered myself as a business yet. Is this going to be a problem?  I have the following documents:    Return flight tickets Accommodation confirmation Invitation letter from the company stating the purpose and sponsorship on their letterhead 6 months bank statements showing income and consistent savings Travel insurance covering 50k USD 3 years of Tax Returns   Is there any risk of my visa getting rejected?

There are many visa applicants who are working as an unregistered freelancer (photographer, construction contractor, fashion designer, journalist etc ). Some of these freelancers make really handsome monthly income and don't really need to work as a full time employee. Most of them receive variable amount of payments (cash, cheques, demand drafts etc) When it comes to filling a visa application form (USA, UK, Schengen etc), there is always an employment section in all visa form, eg for Schengen visa employment form :    This is a very important factor to make an application really strong.  Questions:   1 Unregistered freelancers can just simply write their profession? what documents to produce along with the application?  2 Bank statements with variable methods of payments could convince the visa officer that these are all legitimate payments?


I'm trying to use the format() to print a string, but it's failing. The error is:  java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Console java.io.Console.format(java.lang.String, java.lang.Object[])' on a null object reference  Here's the code snippet. Would appreciate any tips  public class BootNotifier extends BroadcastReceiver {     public String TAG = "BootNotifier";     Console console = System.console();     String fmt = "%s";     String msg = "Android boot completed successfully";      @Override     public void onReceive(Context context, Intent intent)     {         Log.e(TAG, "onReceive");         if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction()))         {             Log.e(TAG, "onReceive: BOOT_COMPLETED");             console.format(fmt, msg);         }     } }

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?


I installed rkhunter 1.4.2 but I wanted rkhunter 1.4.4.  Currently I receive a warning for:  /usr/bin/lwp-request   I assume this  warning is in error or the file is corrupt.   Additional error include:   Checking /dev for suspicious file types                  [ Warning ] Checking for hidden files and directories                [ Warning ]   To clarify, I added Mozilla Firefox apt to show national flags in the address box. I noticed when I open my home page I load from a US server then when Facebook is opened the system slows down and the server changes to Ireland. Keyboard and mouse issues have also developed. Random letters are skipped and random words are accepted as correct spelling with obvious letter omitted. Right mouse click stopped functioning.  OS: Linux Mint 18.2 Sonya, Language en-US  Mozilla Firefox version: Linux Mint 56(64 bit) mint 1.0

The rkhunter version of the ubuntu package is currently 1.4.0, while the installer is version 1.4.4  The repo version of chkrootkit is 0.49, while its installer is 0.52  Since security is a major concern for servers, what would be the best choice: install the latest version or my distribution's package, even if outdated?


I am trying to figure out the best title for a section of a technical document. I wish to mean tables with 12 columns. Should I write: 12-Column Grid or 12-Columns Grid ? Which is correct?

Sorry for the title, it is not very evident and intuitive but I really do not how to tell it better...  Well, you know, several times, or better, many times, we use this form:  If I want to say:      "development of special weapons was   the first point in Hitler's   program..."   I will say this (a better form):      "special weapon development was..."   OK...  is it      "special weapon development"   or      "special weapons development" (note   the plural...)   what's the grammar rule in order to understand how to use this very used form?


I have the following situation, where my program terminates with a NullPointerException during the function. What can I do to make this function work?  UPDATE  else if (str == null)     emptyLinks.add(newPageLinks.get(i).getText() + "at link: " + str);


Can someone please explain the following cases?  In case I, I thought of something reverse. For small objects, e.g., 1, python could allocate new objects for different references. But for large objects, e.g., 10000..., python could keep reusing the same memory. But case I here clearly shows the opposite.  In case II, both 'a' and 'b' refer to large objects. If case I makes sense, why assigning a tuple to 'a' and 'b' ends up with 'a' and 'b' having the same id?   Case I  >>> a = 1 >>> b = 1 >>> id(a), id(b) (140293399709656, 140293399709656)  >>> a = 100000000000000000 >>> b = 100000000000000000 >>> id(a), id(b) (140293400116296, 140293400116344)   Case II  >>> a = 100000000000000000 >>> b = 100000000000000000 >>> id(a), id(b) (140293400116296, 140293400116344)  >>> a, b = 100000000000000000, 100000000000000000 >>> id(a), id(b) (140293400116320, 140293400116320)

Why does the following behave unexpectedly in Python?  >>> a = 256 >>> b = 256 >>> a is b True           # This is an expected result >>> a = 257 >>> b = 257 >>> a is b False          # What happened here? Why is this False? >>> 257 is 257 True           # Yet the literal numbers compare properly   I am using Python 2.5.2. Trying some different versions of Python, it appears that Python 2.3.3 shows the above behaviour between 99 and 100.  Based on the above, I can hypothesize that Python is internally implemented such that "small" integers are stored in a different way than larger integers and the is operator can tell the difference. Why the leaky abstraction? What is a better way of comparing two arbitrary objects to see whether they are the same when I don't know in advance whether they are numbers or not?


I'm new to PHP and database programming and have been attempting to add data from a form to MySQL database. It works fine but is this open to my MySQL injection? I've read plenty of tutorials and I'm thinking PDO prepared statements. How can I do this for my comments field for example? This field (it's a text field) will be fairly open to whatever the user wants to put. How can I write this in order to make it more secure?  <?php ob_start(); $username = 'name';  $password = 'pass';  $host = 'localhost';  $dbname = 'map';    try { $dbh = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); // set the PDO error mode to exception $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO Incidents (           protocol,         jurisdiction,         date,         time,         comments,         video,         lat,         lng                )          VALUES (           '".$_POST["protocol"]."',         '".$_POST["jurisdiction"]."',         '".$_POST["date"]."',         '".$_POST["time"]."',         '".$_POST["comments"]."',         '".$_POST["video"]."',         '".$_POST["lat"]."',         '".$_POST["lng"]."'           )          ";  // use exec() because no results are returned $dbh->exec($sql); header("Location: map1.php");   } catch(PDOException $e) { echo $sql . "<br>" . $e->getMessage(); }  $dbh = null;     ob_end_flush(); ?>

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?


Dynamically created date picker not working from created second row:  $(document).ready(function () {     $(".add_button").click(function () {         var currentRow = $(this).parents("tr");         var nr = currentRow.clone(true, true);         nr.find(".name").val('');         currentRow.after(nr);     });     $(".del_button").click(function () {         var currentRow = $(this).parents("tr");         if ($(".test tr").length != 2)         {             $(this).closest('tr').remove();         }         else         {             alert("You cannot delete first row");         }     }); });   <script>     $(function () {         $("#datepicker").datepicker({autoclose: true});     }); </script>

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


How do I go about finding the principal value of this integral? $$\int_{-\infty}^{\infty}\frac{\sin(x)}{a-x}dx$$  suggested that shifting the integrand by making the change $x \rightarrow x+a$ is one way to simplify to two easier integrals. Can someone help me solve this without changing the integrand like that with a more direct approach (a summary of it will suffice)? Thank you

I need to find the cauchy principle value of $\int_{-\infty}^{\infty}\sin(x)/(x-a)dx$ ? I'm think of rewriting in terms of $e^{i\theta}$ and try to rewrite as contour integral?   Need some aid on how to calculate this integral please. Thank you for help


What are differences between the words wardrobe, cupboard, closet, drawer, cabinet, and other terms used for objects in which things are stored? (I can't think of other terms right now.)   For me wardrobe is only for the storage for clothes.  Cupboard is for the storage of anything.  Closet is more like part of room or a small room. Drawer and cabinet are similar; cabinet has drawer(s) and/or some other openings, and drawer for me is a single pull-open storage place.

What's the difference between "cabinet" and "cupboard"?


In Terminator Genisys, Kyle Reese goes back in time and we find out that Kyle is Sarah Connor's "mate" and John Connor's father even though Kyle was born 30 or 40 years after Sarah Connor.   A similar trip by Kyle to the past caused the birth of John Connor in an earlier movie. So there is a paradox. Kyle Reese goes back in time to protect the mother of John Connor but in that very same act Kyle himself becomes the father of John Connor. So that John Connor would not even exist in the first place if this recursive loop in time were not repeating.   So how did this loop begin?

If Kyle Reese was always John Connor's father:   Kyle pops out of nowhere, impregnates Sarah, dies, and then Kyle Reese is born, becomes a member of resistance and he is sent back in time. John Connor was always Kyle Reese's son.    But:   SkyNet sent the Terminator specifically to affect time, (prevent the leader of resistance from being born), and the resistance also sent someone, and they do affect the future: (delaying judgement day, improving SkyNet, killing a bunch of other Sarahs, etc.).   Was Kyle Reese always John Connor's father, or was there a timeline in which someone else fathered him?


here is a qualifying exam problem and my best attempt thus far: (This is a previous problem, I'm not taking it right now.) Problem: if $(\mathbb{R},\mu)$ is a finite Borel measure and $\phi(t)=\int e^{ixt}\,d\mu(x)$ is its Fourier transform if furthermore $\mu(\{x\})=0$ for any $x\in \mathbb{R}$, prove that $$\frac{1}{T}\int_{-T}^T|\phi(t)|^2\,dt\rightarrow 0$$ as $T\rightarrow\infty$. My attempt is to write $$\int_{-T}^T|\phi(t)|^2\,dt=\int\int_{-T}^Te^{-itx}\phi(t)\,dt\,d\mu(x).$$ While the inversion theorem says that $$\int_a^b\int_{-T}^Te^{-itx}\phi(t)\,dt\,dx\rightarrow 2\pi\mu([a,b])$$ as $T\rightarrow\infty$ and somehow go from here. But I'm kind of stuck. Please help me!! Thanks!! Oh, actually this follows from

Consider a finite Borel measure $\mu$ on $\mathbb R$. The Fourier transform $\hat{\mu}$ of $\mu$ is defined by $\hat{\mu} (\xi)= \int _{\mathbb R} e^{-ix\xi} d\mu(x)$. I would like to prove the following identity:  $$\lim_{R\to \infty}\frac{1}{2R}\int_{-R}^R {|\hat{\mu}(\xi)|}^2d\xi=\sum_{x\in \mathbb R} \mu({\{x\}}) ^2$$.  My attempt:  By Jensen's inequality,  $$\int_{-R}^R {|\hat{\mu}(\xi)|}^2d\xi=\int_{-R}^R|\int _{\mathbb R} e^{-ix\xi} d\mu(x)|^2d\xi\leq\int_{-R}^R\int _{\mathbb R} e^{-2ix\xi} d\mu(x)d\xi$$  By Fubini,  $$\int_{-R}^R\int _{\mathbb R} e^{-2ix\xi} d\mu(x)d\xi=\int _{\mathbb R}\int_{-R}^R\ e^{-2ix\xi} d\xi d\mu(x)$$ But I don't know how to proceed from here. Any advice will be appreciated.


Given a positive integer $n$, is it possible to represent $n$ as a sum of coprime squares iff $v_2(n) \leqslant 1 $ and no prime $p \equiv -1\pmod{4}$ divides $n$? Clearly any $n$ violating the two conditions is not a sum of coprime squares, and any $p \equiv 1 \pmod{4}$ prime can be written as a sum of two squares, but im not sure on the general case. I tried to use the identity $(a^2+b^2)(c^2+d^2) = (ab+cd)^2 + (ac-bd)^2$, but it is not at all clear when the new squares are coprime.

I want to find integers $z=a^2+b^2$ with $\gcd(a,b)=1$.  Clearly all prime numbers of the form $4k+1$ are such numbers, but what other composite numbers also enjoy this property?  e.g. $74=5^2+7^2$, $625=7^2+24^2$.  Please answer.


I have a view which uses "unformatted list" as it's output format.

...

   Now I want these divs to be stripped.  I tried the solution in , but I just want to change the format. I do not want to use  as that does not help at all in my case.  I manually created a views theme (copying unformatted list) and changing its code as:  <?php if (!empty($title)): ?>
<?php print $title; ?>
 <?php endif; ?> <?php foreach ($rows as $id => $row): ?>   <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>     <?php print $row; ?>
 <?php endforeach; ?>   to:  <?php if (!empty($title)): ?>
<?php print $title; ?>
 <?php endif; ?> <?php foreach ($rows as $id => $row): ?>

<?php print $row; ?>

 <?php endforeach; ?>   but that deeply craps out my overall design.  What is the most appropriate and simplest way to do this?

In my page.tpl.php I'm doing this to display one of my view:  print views_embed_view('teaserview', 'default');   That gives me the following html output:

Edit view

    But the only thing that I really need is     Is there a possibility to modify the views_embed_view call so that I get only the needed data?   There would be the possibility to modify all the views .tpl.php files but I hope there's an easier way to do this.   I also read about the semantic views module but I didn't understand how to configure my view with it so that i get only the needed markup as output. it didn't seem to have any effect.


I have Ubuntu 14.04 and my bluetooth stopped working.  The accepted solution for this problem is to find the driver in hex format and convert it to hcd for installation:    sudo apt-get install git git clone git://github.com/jessesung/hex2hcd.git cd hex2hcd make ./hex2hcd ../BCMxxxx.xxx.xxx.xx.hex BCM43142A0-0a5c-21d7.hcd (Correct hex file and required hcd name here)   So I followed the commands and installed git and everything seems to go just fine until the end when I get a "command not found":    $ git clone git://github.com/jessesung/hex2hcd.git Cloning into 'hex2hcd'... remote: Counting objects: 8, done. remote: Total 8 (delta 0), reused 0 (delta 0), pack-reused 8 Receiving objects: 100% (8/8), 8.71 KiB | 0 bytes/s, done. Resolving deltas: 100% (1/1), done. Checking connectivity... done. ~$ cd hex2hcd :~/hex2hcd$ make gcc -O2 -march=native    hex2hcd.c   -o hex2hcd ~/hex2hcd$ hex2hcd BCM43142A0_001.001.011.0084.0086.hex BCM43142A0-0a5c-21d7.hcd hex2hcd: command not found   Why am I getting "command not found" ???    If i look in the directory the command hex2hcd is present:    ~/hex2hcd$ ls BCM43142A0_001.001.011.0084.0086.hex  hex2hcd  hex2hcd.c  LICENSE  Makefile   And if I examine the hex2hcd file its properties are executable.  I do not know what to do next to resolve this.  hmm.  This question has been marked as a duplicate to:      But I do not understand how that helps or how I would have ever found that page.  Actually another suggest to prepend ./ before my command is a helpful answer as it has solved the problem.  But that solution is not found on the page marked as duplicate.  I don't understand why I need to prepend ./ when I am already in the directory with the command ...  So I have a solution but do not understand why it is needed.

I'd like to know if there is a way to run  program/shell script without typing full path:  /opt/idea/bin/idea.sh


Should I use 'the' before the word 'banking system' when I refer banking system as a whole?

I can’t for the life of me figure out where to use a and where to use the — and where there is no article at all. Is there a simple rule of thumb to memorize?   The standard rule you always hear:     “If a person knows which item you are talking about then use "the"   . . . doesn’t clear things up for me, as I have no idea whether or not they know.


I want to find one month later from a date but I don't know how.  Lets say I have this date:  08.03.2012   I want to find one month later from that date automatically like:  08.04.2012   Does anyone know how to do that?

I am using the datetime Python module.  I am looking to calculate the date 6 months from the current date. Could someone give me a little help doing this?  The reason I want to generate a date 6 months from the current date is to produce a review date.  If the user enters data into the system it will have a review date of 6 months from the date they entered the data.


I have a notebook with dual boot (Windows 8.1 & Ubuntu 16.04). I'm trying to merge an unallocated partition with an ext4 (sda8) partition.Is this possible?    I'm using a LiveUSB for all the procedure.  I really appreciate any help you can provide.

Previously, I have installed Windows 7 on my 320 GB laptop with three partitions 173, 84 and 63 GB each. The 63 GB partition was where the Windows was installed. The rest were for file containers.  Now I changed my OS to Ubuntu 12.04 LTS. I installed Ubuntu by replacing the entire Windows 7 on the 63 GB partition. The rest of the partitions remain as an NTFS Windows partition and I can still access them both (the 173 and 84 GB partitions).  Now I want to change the two partitions of Windows into an Ubuntu format partitions plus most importantly, I want to extend the 63 GB partition to more than a 100 GB because at the moment I am running out of disk space. Whenever I try to install any application, especially using wine, it always complains for a shortage of disk space.  How do I do the extending activity before I entirely format my laptop again and lose all the important files on my partitions?


When do I star and question? Is starring the same as leaving a like? I have seen one other person star one of my questions, and I do not know why.   Note that this is not a duplicate because I am asking when do I star someone else's post? Do I star a post when I like the question? I am not -- for clarification reasons -- asking about how to star a post or what happens when you star a post.

What does bookmarking a question mean? How do you bookmark a question? Do users get updates on their bookmarked questions? Are my bookmarks publicly visible? How do you see your own bookmarks? How do you see other users' bookmarks? How do you see which users have bookmarked a particular question? What impact does the bookmark system have on the voting system? Can I "un-bookmark" a question? Can I search within my bookmarks?


Prove that, if $\left\{a_n\right\}_{n=1}^{\infty}$ converges to A, then $\left\{|a_n|\right\}_{n=1}^{\infty}$ converges to |A|. Is the converse true?

Problem 3. Show that for a sequence $(x_n)$ the following are true:   (i) $\lim x_n=0$ if and only if $\lim |x_n|=0$.   (ii) $\lim x_n=L$ implies $\lim |x_n|=|L|$. Is the converse true? Prove or give a counterexample.    (i) is already done, easy.  I'm halfway done with (ii), I split it into three cases:  $L = 0$, $L > 0$ and $L < 0$.  For $L = 0$ I just refer to part (i).  For $L > 0$, we know that $|x_n - L| < \epsilon$   if lim $|x_n|$ = $|L|$, then we must have  $||x_n| -|L|| < \epsilon$  but by the reverse triangle equality, $||x_n| - |L|| < |x_n - L|$ so clearly $||x_n|-|L|| < \epsilon$, thus  lim $x_n = L$ $\implies$ lim $|x_n| = |L|$ for $L > 0$  for some reason I'm confused as to part three, $L<0$. I'm having trouble seeing the difference between $L>0$ and $L<0$, and i'm starting to think that splitting it up like that isn't necessary at all.


I can’t seem to get my camera settings right, can someone list the right settings for indoor pictures. Trying to take pictures of my dog but it’s been raining. Also list good outdoor settings as well, so maybe like tell me what’s the best ISO, shutter speed, exc. thank you.

I know digital cameras have ISO options, and that ISO is the camera's sensitivity to light, but if you set  higher ISO then you can get a noisy image. I also know there are two other camera options, shutter speed and aperture.   What is the relationship of between them? Is there any equation, or something like that?  For example, if I set the ISO to 640, then how should I set the shutter speed and aperture?


I need to deserialize a JSON string into a type which is not know at compile time. There are several classes that it can be deserialized into. The name of the class is provided as input into the application and based on that I want to instantiate the class (already done this through reflection): var type = Type.GetType(className); var myClassInstance = (IParser)Activator.CreateInstance(type);  ...and then use its type as the generic type parameter for JsonConvert.DeserializeObject<typeof(myClassInstance).Name>(jsonString) but that doesn't work. How can I provide the class to DeserializeObject<>() dynamically?

What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?  Consider the following sample code - inside the Example() method, what's the most concise way to invoke GenericMethod<T>() using the Type stored in the myType variable?  public class Sample {     public void Example(string typeName)     {         Type myType = FindType(typeName);          // What goes here to call GenericMethod<T>()?         GenericMethod<myType>(); // This doesn't work          // What changes to call StaticMethod<T>()?         Sample.StaticMethod<myType>(); // This also doesn't work     }      public void GenericMethod<T>()     {         // ...     }      public static void StaticMethod<T>()     {         //...     } }


I've got java.lang.ArrayIndexOutOfBoundsException: null exception in my application two times,  both of them happened at list.get() method, the JDK source like this     `private E get(Object[] paramArrayOfObject, int paramInt)   {     return paramArrayOfObject[paramInt];   }   `   What's the problem?   please give some simple example which throws  java.lang.ArrayIndexOutOfBoundsException null.   Thanks!

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?


I am trying to make it so that there are "beams" coming out of the top of an object. Here is a crappying drawing:  I have made this so far:

(a.k.a. "god rays" and many other names) can be created in Blender Internal by checking the Halo checkbox in the lamp properties box.  How can I create a similar effect using Cycles?


I have upgraded my system with sudo pacman -Syu, then I opened a terminal and saw this.  Any suggestions, how to fix this issue?

I have a file in UTF-8 encoding with BOM and want to remove the BOM. Are there any linux command-line tools to remove the BOM from the file?  $ file test.xml test.xml:  XML 1.0 document, UTF-8 Unicode (with BOM) text, with very long lines


I have misplaced my iPhone 6s password and it is saying it's disabled due to too many tries.

I forgot my iPhone 5 passcode when I was changing the code. A window appeared on the device screen saying that iPhone is disabled.  I have Apple ID and password for it. After signing in to iCloud I have erased the device in order to remove the passcode from my iPhone but it still says that device will be erased when device will connect to internet. What would i have to do?


I think I understand how IDs and classes are used (IDs for a single element on an HTML page, classes for many elements). But why bother with IDs in the first place; why not just use classes for everything?

What's the difference between
 and
 when it comes to CSS? Is it alright to use
?  I see different developers doing this in both ways, and since I'm self taught, I've never really figured it out.


Is there a way to attach a listener to the active object in such way that whenever I change the crease value of any edge, it fires a custom function?  Thanks guys

Blender's application handlers are listed , but is it possible to create a new one?  For example, I'd like an application handler which is a callback for every time I add a strip to the Video Sequence Editor.


I am looking for a way to view all the entries in . I have it installed already and running. By default, it shows just five recent notifications even when you have more than five in a 'list' somewhere.    Like in the screenshot above, how can I see all the 11 notifications at once?

I'd like to read a list of messages displayed by notify-osd from time to time. I'm using 12.04 still, if it matters. Is this possible?    questions from 2010 indicate that a log file should exist at ~/.cache/notify-osd.log. I have no such file, and I'd like to know if this is a bug (in which case this question should be closed) or if this log file depends on another setting (like System Settings -> Privacy)?  I don't care about storing data between reboots. I just want to browse messages from the current session.  EDIT: Two good answers now but I'd like to know if these messages are stored anywhere, (total guess, /tmp? RAM?) for a short period after appearing on the screen. Some sort of buffer must exist as they appear one after another, a few seconds each, even if there are 20-30 notifications over the span of a minute or two.  I failed to mention in my original question that I'm not interested in yet another PPA + indicator or excessive drive writes, I just want to know if it is possible to see the messages for a short time after they appear.  My use case for this is to go back and find what song was played a few minutes ago on a streaming radio station. I have it on as background music, and occasionally a tune sticks in my head after I hear it. I have no way of going back to see what played 1-2 songs ago.


For $a>0,b>0$, $a+b=1$ prove:$$\bigg(a+\dfrac{1}{a}\bigg)^2+\bigg(b+\dfrac{1}{b}\bigg)^2\ge\dfrac{25}{2}$$   My try don't do much, tough  $a+b=1\implies\dfrac{1}{a}+\dfrac{1}{b}=\dfrac{1}{ab}$  Expanding: $\bigg(a+\dfrac{1}{a}\bigg)^2+\bigg(b+\dfrac{1}{b}\bigg)^2\\=a^2+b^2+\dfrac{1}{a^2}+\dfrac{1}{b^2}+4\\=(a+b)^2-2ab+\bigg(\dfrac{1}{a}+\dfrac{1}{b}\bigg)^2-\dfrac{2}{ab}+4\\=4-2ab-\dfrac{2}{ab}+1+\dfrac{1}{a^2b^2}\\=4-2\bigg(\dfrac{a^2b^2+1}{ab}\bigg)+\dfrac{a^2b^2+1}{a^2b^2}\\=4-\bigg(\dfrac{a^2b^2+1}{ab}\bigg)\bigg(2-\dfrac{1}{ab}\bigg)\\=4-\bigg(ab+\dfrac{1}{ab}\bigg)\bigg(2-\dfrac{1}{ab}\bigg)$   Seems to using Cauchy-Schwartz. Please help.

If $a, b$ are positive real numbers and $a+b = 1$, prove that :  $$\left(a+\frac{1}{a}\right)^2 + \left(b+\frac{1}{b}\right)^2 \geq \frac{25}{2}$$  I can see that the value $\frac{25}2$ is attained for $a=b=\frac12$. But I do not know how to show that this is the minimal possible value.  Thank you.


This is the error message(below) i get when i try to update through update manager. Can anyone help me with this one?  W: Failed to fetch gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_precise-security_universe_binary-i386_Packages  Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead.

When I check for updates, I get a "Failed To Download Repository Information" error.   This is what comes up under details:   W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_natty_main_source_Sources  Hash Sum mismatch,  E: Some index files failed to download. They have been ignored, or old ones used instead.


Is posible Get Client IP Using WebRTC JS API and the ICE protocol (STUN for public IP)?

I need to somehow retrieve the client's IP address using JavaScript; no server side code, not even SSI.  However, I'm not against using a free 3rd party script/service.


In "Ask Question" page of SE sites displays list of question already asked based on the title of the current question, it would be helpful if the questions are ordered based on the tags if tags are added in the current question being asked.  For example:  In Stackoverflow if the question is "Call super class method" and the tag is , first two questions are in  and . If those questions are in c# it will be helpful and reduce duplicate questions.

When asking a new question and typing in the title we get a list of similar questions named     Questions that may already have your answer     That suggestions contains posts across all tags. Like the example in the screenshot it returns similar questions for Python, jQuery, SQL, C#, Java, C++, ...  This makes the list less useless unlikely people find a question that already answers theirs. If people actually find a similar question in that list many duplicates could be avoided.  So can tags I entered below the question be considered to update the list? And can the tag textbox maybe put above the question title?


If $x+2y+3z=10$ where x,y,z are postive real numbers, find the maximum value of $x^2y^2z^6$. I started by trying to find some integer solutions. The first thing I found was $(x,y,z)=(1,3,1)$. But the value of $x^2y^2z^6$ was way too small (it was a multiple choice question in the paper I was solving). The next thing I tried was setting $x=y=z$ because I thought the product of numbers would be highest if they were equal. And I got $x=y=z=\frac{5}{3}$. And so I got $x^2y^2z^6 = (\frac{5}{3})^{10}$ But this answer seems very weird and even my logic is not right, I merely went by intuition. Please help me solve this.

I'm trying to solve this problem using Lagrange's multiplier method but I'm unable to get the value of lambda and also $z.$ kindly help  me out with this problem. I'm getting $x = 2y$  I'm stuck somewhere between the steps


A typical lens have white focus indicators on their lenses [5m 50m and infinity] but some have red points for 85m and farther and some lenses have a red curve instead of numbers.  What are these red focus numbers and curves?

Take this  I have for example, it has red values on the distance scale (not sure what do you call it exactly) next to the focus ring. What does these values mean?


How does the photon absorption takes place in a hydrogen?  The classical mechanics shows the absorption of photonic energy resulting in the excitation of atom. Intuitively, a photon with frequency higher than that required for excitation of electron brings about the excitation process. But something restricts the excitation of electrons by photons of higher energy.   Why the match of energy of electron and the photon is an essential condition for excitation.  @Urgje said,     The probability of atomic excitation by photon absorption is given in terms of the "cross- section" for single photon absorption. This quantity shows a sharp peak if the photon energy and the atomic energy level difference match (the coupling between the atom and electromagnetic field causes the atomic states to broaden, the natural line width). Thus excitation by photons of higher energy is possible but its probability is very small.   What is meant by the cross section for single photon adsorption? Is there a electron excitation probability vs. Frequency of the photon plot?  What are the direct factors that affects there probability of the electron excitation?

This might be a stupid question, but nonetheless, it has been bothering me.  If you take a photon, make it go through some atoms in a solid, liquid or whatever, then you have the chance of this photon being absorbed by an electron, and thereby exciting the electron. This requires the photon to have enough energy to actually excite the electron to another energy level.  My question is then: How does the photon know if it has enough energy or not? Do they interact very quickly to determine if it's okay or not, or is it just something it "knows?"


I keep getting numerous notifications throughout the day that there are updates. However, running the updater shows a different story. Running sudo apt update && sudo apt upgrade -y says all is up to date.   Which should I trust?

I keep receiving the following notification about new updates:    If I then run the Software Updater, however, I don't receive any of these updates on Ubuntu 16.04.    Does someone have the same problem?


Is there any direct command which can help me to put the number of a equation in the parentheses, for example if I write the following:  \begin{equation} \label{eq:1} this is my equation  \end{equation}  I need this equation: \ref{eq:1}   I need to produce the following      I need this equation: (1)   I need that (1) .

I'm writing a math paper in LaTeX and for math formulas I'm just using $$math formula$$. Is is possible to numerate formulas? Or do I have to you use some specific commands such as align?


Hello I installed Ubuntu 13.10 alongside Windows XP, Now that I never use Windows XP and I have almost no space for Ubuntu (I literally only have 136mb left) I would like to uninstall it from my NTFS and reallocate the remaining space on my NTFS drive to Ubuntu without damaging my Ubuntu installation.

I'm currently dual-booting to either Ubuntu 10.10 or Windows XP. However, I rarely use windows and would like to remove it.  I've use the Ubuntu live CD to access GParted. I've also deleted the windows partitions (I think), which were labeled both ntfs and fat32.  I'm just not sure how to extend the Ubuntu partition to cover the unallocated space. Furthermore, how do I deal with the 'key' designations, which state that a partition is busy.  Help!


Ive heard many theories one being that a 0 looks like an egg and the french word for egg sounds like love and after time became just that, but this is just one theory. Does anyone know the actual reason why 0 in tennis is called love?

I have never understood this form of scoring. What is the origin of this score "title".


I removed a folder\files from my Git repo by running  git rm -r --cached Application01   to untrack all the files in that folder and reduce the size of the Git repo.  The problem is that the pack file .git/objects/pack/*.pack is still holding the files I removed\untracked.  How can I completely remove all untracked files and lose all their history and make the pack file smaller?  Thanks

I accidentally committed an unwanted file (filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the repository history.   Is it possible to rewrite the change history such that filename.orig was never added to the repository in the first place?


I am wondering which library to use for base64 encoding/decoding? I need this functionality be stable enough for production use.

I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6.


My laptop operates on ubuntu 16.04. when I enter the command on the terminal window to install a new software, it gives the following error:  ashutosh@ashutosh-HP-Pavilion-g4-Notebook-PC:~$ sudo apt-get install arduino [sudo] password for ashutosh:  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?   can you please tell me the reason for this..??

I get this error when trying to use apt-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?     How can I fix this?


In introductory analysis, it is common to define a single-variable polynomial as a function $p:\Bbb{R}\mapsto\Bbb{R}$ (or $\Bbb{C}\mapsto\Bbb{C})$ such that $$ p(x)=\sum_{i=0}^{n}a_ix^i \text{ for all $x$.} $$ This means that $x^2$ is technically not a polynomial, but rather the value of the polynomial $t\mapsto t^2$ at the point $x$. However, according to , in abstract algebra one often distinguishes between polynomials and polynomial functions. According to this definition, $x^2$ is literally a polynomial, whereas $t\mapsto t^2$ is the corresponding polynomial function. My question is:  In abstract algebra, what is the purpose of defining polynomials as formal algebraic expressions, rather than as functions? How important is it to draw a distinction between polynomials and polynomial functions?

In the following I'm going to call   a polynomial expression an element of a suitable algebraic structure (for example a ring, since it has an addition and a multiplication) that has the form $a_{n}x^{n}+\cdots+a_{1}x+a_{0}$, where $x$ is some fixed element of said structure,     a polynomial function a function of the form $x\mapsto a_{n}x^{n}+\cdots+a_{1}x+a_{0}$ (where the same algebraic considerations as above apply) a polynomial an element of the form $a_{n}X^{n}+\cdots+a_{1}X+a_{0}$ with indeterminates $X$ (these can be formalized, if we are in a ring, with strings of $0$s and a $1$).   Note that when we are very rigorous/formal, polynomial expressions and polynomials are something different (although in daily life we often use them synonymously). Polynomial functions and expressions are also different from each other although in this case the relationship is a closer one, since every polynomials expression can be interpreted as a polynomial function evaluated at a certain point (thus "polynomial functions" are something more general than "polynomial expressions").  My question is: Why do we use polynomials ? It seems to me that every piece of mathematics I have encountered so far, one could replace every occurrence of polynomials with polynomial expressions/functions without any major change in the rest of the proof/theorem/definition etc.  The only reasons that I can see to use polynomials are the following two:$$ $$ 1. After one makes the idea precise that one can plug "suitable" elements into polynomials (which may lie a ring containing the ring in which the coefficients live in), one can save time in certain setting, by handling the "plugging of suitable elements into polynomials" more elegantly: For example in case of the theorem of Cayley-Hamilton, which in its "polynomial function" version would look like:  Let $A$ be an $n\times n$ matrix over $K$, whose characteristic polynomial (function) is $x\mapsto a_{n}x^{n}+\cdots+a_{1}x+a_{0}$. Then  $$ a_{n}A^{n}+\cdots+a_{1}A+a_{0}I=0. $$  whereas the "polynomial" version looks more elegant:  Let $A$ be an $n\times n$ matrix over $K$, whose characteristic polynomial is $p_{A}\in K\left[X\right]$. Then  $$ p_{A}\left(A\right)=0. $$ 2. The only thing that polynomials can "do", but algebraic expressions/functions can't, is to be different, when the algebraic expressions/functions are the same (i.e. there's a theorem that tells us that the mapping of polynomials to polynomials expressions/functions isn't injective, if the field is finite). Maybe this small difference makes a big enough difference to consider polynomials after all, but as I said, I haven't encountered any situation in which this difference could manifest itself. (I'm guessing that maybe cryptography or higher number theory really needs polynomials and not just polynomial expressions/functions. Since I don't know anything about these subjects, I would be very happy with an example of a theorem (whose content isn't merely technical as it is the case with the theorem above) involving polynomials, where these absolutely cannot be replaced by polynomial expressions/functions. Conversely I would also be happy with an authoritative statement from someone knowledgeable that indeed we could dispense of polynomials, if we wanted to.)


Given a pointer to a derived object, which has overridden some method virtual void moo(), is there a way to call the base's moo() method? One way is to create a sliced base class object from the derived object, but that would involve copying: #include <iostream>  class A {     public: virtual void moo() { std::cout << "moo from A\n"; } };  class B final : public A {     public: void moo() override final { std::cout << "moo from B\n"; }; };  int main() {     A* a_ptr = new B; // could point to any A or A-derived object.      A a(*a_ptr); // is there a way to get A::moo without doing this?     a.moo(); // moo from A of course, but would be cooler without the copy above }  Why would I wanna do that you ask? So glad that you ask... not, because now I have to explain everything to you. Well A's virtual void moo() is actually more like std::string serialize(), which gives A's data members serialized into a std::string. Now when you have a big std::vector<A*> pointing to all sorts of derived objects and only the data from the base objects are needed (to be sent over network), it'd be nice to get only A::moos, although those pointers in that vector point to all sorts of moos. (I'm aware of the possibility to 'simply' put a second void moo2() into A, that does not get overridden. But I'd also like to know if there's a third or fourth alternative.)

Say I have classes Foo and Bar set up like this:  class Foo { public:     int x;      virtual void printStuff()     {         std::cout << x << std::endl;     } };  class Bar : public Foo { public:     int y;      void printStuff()     {         // I would like to call Foo.printStuff() here...         std::cout << y << std::endl;     } };   As annotated in the code, I'd like to be able to call the base class's function that I'm overriding. In Java there's the super.funcname() syntax. Is this possible in C++?


The question is: n balls are distributed into n holes at random. What is the probability that exactly one hole remains empty. I came up with $$P\left(A\right)=\frac{\:\dbinom{n\:}{1}\:\dbinom{n\:-1}{1}\:\left(n-2\right)!}{n^n}$$ but was told I’m way way off. Yes, I do realize I’m awful at probability. Thanks for the help.

How would you do the following problem:     Suppose that $n$ balls are placed at random into $n$ boxes. Find the probability that there is exactly one empty box.   I mentally pictured $n$ boxes being in front of me and $n$ balls which I'm throwing (hence randomness) in the boxes, each ball has an equal chance of landing in any of the boxes. That led me to this: $$\frac{n(n-1)\frac{n!}{2}}{n^n}\tag{1}$$ Which is a good answer yet to a different problem, and the answer to the above problem turned out to be $$\frac{n(n-1)}{\binom{2n-1}{n}}\tag{2}$$  I can reverse engineer the correct answer $(2)$ and think about it in terms of stars and bars but it's unclear what mental picture do I need to have in mind after reading the word problem?  And as a side question: do you think the phrasing of the cited problem is unambiguous? How would you state the problem which has $(1)$ as its solution?


I can't change segments or anything.    As soon when I create a UV sphere or cylinder the menu from left pops up but is already greyed out.

Sometimes when adding an object to the scene I see that all options (on toolbar or in window after pressing F6) are disabled. Can anyone tell me when can this happen? What is causing it and how to revert it - make it enabled again. It worked for me when I restarted Blender and reloaded the scene. However I would really like to know what can cause it?


I just wrote a simple console application to see if I was crazy         var html = "
<x></x>
";          HtmlDocument doc2 = new HtmlDocument();         doc2.LoadHtml(html);         var pageNodes2 = doc2.DocumentNode.SelectNodes("//div[contains(@class,'page')]");          foreach (var pageNode in pageNodes2)         {             Console.WriteLine(pageNode.InnerHtml);         }   and the output is      <x></x>   but if the x is replaced by
 the output becomes
   how can I solve it ?

I am using HtmlAgilityPack.  I create an HtmlDocument and LoadHtml with the following string:  <select id="foo_Bar" name="foo.Bar"><option selected="selected" value="1">One</option><option value="2">Two</option></select>   This does some unexpected things.  First, it gives two parser errors, EndTagNotRequired.  Second, the select node has 4 children - two for the option tags and two more for the inner text of the option tags.  Last, the OuterHtml is like this:  <select id="foo_Bar" name="foo.Bar"><option selected="selected" value="1">One<option value="2">Two</select>   So basically it is deciding for me to drop the closing tags on the options.  Let's leave aside for a moment whether it is proper and desirable to do that.  I am using HtmlAgilityPack to test HTML generation code, so I don't want it to make any decision for me or give any errors unless the HTML is truly malformed.  Is there some way to make it behave how I want?  I tried setting some of the options for HtmlDocument, specifically:   doc.OptionAutoCloseOnEnd = false;  doc.OptionCheckSyntax = false;  doc.OptionFixNestedTags = false;   This is not working.  If HtmlAgilityPack cannot do what I want, can you recommend something that can?


I wanted to ask how you can solve an equation such as:  $$ \sin x = x + 1 $$  How would you solve for x?

How would you be solve sin x = 1 - x, without drawing the graph and manually measuring the point of intersection?


As the question says, how can I prove that $\sqrt[3]{2}+\sqrt[3]{4}$ is irrational? I have tried setting it to be equal to $a$, and $\sqrt[3]{4}$ equal to $a^2$, but I haven't gotten anywhere. The solution does not have to use the above. Any help is appreciated. (I know this is a duplicate, but I haven't seen any answers that I have gotten a full solution from)

So while doing all sorts of proving and disproving statements regarding irrational numbers, I ran into this one and it quite stumped me:  Prove that $\sqrt[3]{2} + \sqrt[3]{4}$ is irrational.  I tried all the usual suspects like playing with $\sqrt[3]{2} + \sqrt[3]{4} = \frac{a}{b}$ for $a,b\in \mathbb{Z}$ , but got nowhere.  I also figured maybe I should play with it this way:  $2^\frac{1}{3} + 4^\frac{1}{3}=2^\frac{1}{3} + (2^2)^\frac{1}{3}=2^\frac{1}{3} + 2^\frac{2}{3}=2^\frac{1}{3} + 2^\frac{1}{3}\times 2^\frac{1}{3}=2^\frac{1}{3}(1+2^\frac{1}{3})$  But there I got stumped again, because while $1+2^\frac{1}{3}$ is irrational, nothing promises me that $2^\frac{1}{3} \times (1+2^\frac{1}{3})$ is irrational, and I feel like trying to go further down this road is moot.  So what am I missing (other than sleep and food)? What route should I take to  prove this? Thanks in advance!


I have a group $G$ of order $2p$, where $p>2$ and prime. The additional thing that I also know, that $\exists a\in Z(G)\mid O(a)=2$.  I need to prove that G is abelian.  But first, before that, tell me please, isn't here (in my next direction of thinking any objection to the given information).   So, I look at two sub-groups of $G$ (the order isnt prime so they exist and their order devides the order of the group) of order $p$, $A,B\le G\mid O(a)=O(b)=p$  They are cyclic because of their order (is prime). And their elements are the total elements in $G$ (because they are sub-groups and there are totally $2p$ elements, and here I look at different sub-groups with $p$ elements each).  So left to prove that any $a\in A$ abelian with any $b\in B$. Now I think about the second data that given.  The center of $G$ is in $G$, so there is $g\in G\mid g^2=e$. But must $g\in A$ or $g\in B$, but their order is $p$ and $2$ does not divide any of them. Isn't that an objection ?  Otherwise, which of the step is wrong, what can't I conclude from what I wrote?

I have G where $|G|=2p$ ; p is prime. $\exists a\in Z\left(G\right);\:a^2=e$. I need to prove that G is abelian.  Now, let's translate it into math. To prove that G is abelian, is in other words ti prove that $Z\left(G\right)=G$, but $Z\left(G\right)\in G$, so if I prove that \left|Z\left(G\right)\right|=\left|G\right|, I've done.  Now, by lagrange's theorem, $\left|Z\left(G\right)\right|$ can be 2, p or 2p (which I want to prove).   It cant be p, because there is $a\in Z\left(G\right)$, which means $a\in G$ so $a^{2}=e$, therefore $2 : |Z(G)|$.   So I'm left with 2 and 2p. But as I see, theoretical the center can be only 2 elements: $\left\{e,a\right\}$, because all the data I have that there is there some $a$, but $a^{-1}=a$ because $a^{2}=e$, so I have for sure 2 elements.   I dont see how can i prove that there is at least one another abelian element in Z(G), because the existence of two fits perfect eather, as I can see.  Can somebody give me a hint ? Can this exercize be solved like that or Am I in the wrong direction from the first place ?  Can somebody give me a hint?


I am trying to implement a registration panel with username password and email only. I put all the usernames and passwords in a text file "usernames.txt". But my problem is not working properly if user clicks the submit button and the username already exists nothing happens( it should display JOptionPane with text "Username already exists!" ). here is my code :  submitButton.addActionListener(new ActionListener() {         @Override         public void actionPerformed(ActionEvent e) {             BufferedReader br = null;             try {                 br = new BufferedReader(new FileReader("usernames.txt"));             } catch (FileNotFoundException e2) {                 // TODO Auto-generated catch block                 e2.printStackTrace();             }             try {                    String line = br.readLine();                 StringBuilder sb = new StringBuilder();                 Pattern usernameAndPasswordPattern = Pattern.compile("^(\\S+) (\\S+)$");                 while (line != null) {                     sb.append(line); //                      sb.append(System.lineSeparator()); //                      line = br.readLine();                 }                 String everything = sb.toString();                 Matcher userNameAndPasswordMatcher = usernameAndPasswordPattern.matcher(everything);                  //if username exists!                 while (userNameAndPasswordMatcher.matches()) {                     String username = userNameAndPasswordMatcher.group(1);                     String password = userNameAndPasswordMatcher.group(2);                      if (username.equals(usernameTextField.getText())) {                         int result = JOptionPane.showConfirmDialog(null, "Username already exists!", "Registration incomplete", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);                     }                 }              } catch (IOException e1) {                 // TODO Auto-generated catch block                 e1.printStackTrace();             } finally {                 try {                     br.close();                 } catch (IOException e1) {                     // TODO Auto-generated catch block                     e1.printStackTrace();                 }             }                                }     });   Here you can see a pic from my panel

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


Today, I received a fifth upvote on one of my answers . As this was the fifth upvote on a new answer to an old question, it also earned me a .  The upvote and its +10 rep are displayed both on  as well as on the  (moderator version of timeline shown below):      However, it's not appearing in the top bar (which reflects a badge earned with an upvote):    I assumed this wasn't intended behaviour, so here's my  report.

Over at Science Fiction & Fantasy, I answered this question:  (spoilers for Harry Potter 6/7!). This brought my reputation up to 10,565. However... this upvote didn't show up in the dropdown. Some screenshots:  The dropdown, showing +120 today:    My ?tab=reputation page, showing +130:    My /reputation page, showing the upvote:    So...  Why is it not showing in the dropdown?    This also happened with  - the dropdown is exactly the same as before, and yet I gained another 10 rep, and it's showing in all the other places. And on this question - there's no change in the dropdown. And again on SO - I had a  approved, which gave me +2, and... nothing in the dropdown.


I don't have enough reputation (1K) to view the individual up and downvote counts on a post on Stack Overflow. Therefore, the cursor is the default one when I hover a post's score.  However, when an answer is added to the list of answers via a "There's 1 new answer to this question" message, the cursor is a pointer, like I can view the individual counts. This is only front-end: when I click on it, I get an "error during vote count fetch".  How to reproduce:   Go to any site where you have less than 1K rep Go to any question Wait for someone to post an answer Try to view the individual votecounts

When a user has the  privilege, they can click on the post score to see the individual counts for upvotes and downvotes.  When a user doesn't have this privilege this functionality isn't present, except after loading newly added answers without refreshing the page. After clicking the "new answers to this question" link the click functionality to view vote counts is added to all posts, though actually clicking on it results in a dialog stating that an error occurred (I'd assume due to not having the required reputation).  May be related to the fix for this previous bug report:


Let's define $e$ as the number $a$ such that $\frac {d}{dx} a^x = a^x$.  I'm trying to prove that this $a$ has to be $e$.  I don't see any way of proceeding from here except by the limit definition (I'm not assuming I know what the $\ln$ function is, or else there'd be a much easier definition of $e$ to be had).  $$\frac {d}{dx} a^x=\lim_{h\to 0} \frac {a^{x+h}-a^x}{h}=\lim_{h\to 0} a^x\frac{a^h-1}{h}=a^x\left(\lim_{h\to 0} \frac{a^h-1}{h}\right)$$  So clearly $e$ must be the number that makes that limit on the far right equal to $1$.  I'm not sure how to evaluate this. Using L'Hopital's rule, I just get $\lim_{h\to 0} \frac {d}{dh} a^h$, which doesn't particularly help.  So my question:     How can I prove that there is a unique number such that $\lim_{h\to 0} \frac {a^h-1}{h}=1$?

We can define $e$ as the number such that $\lim_{h \to 0} \frac{e^h-1}{h}=1$.  However, of course we can only define $e$ this way if it is unique, i.e., there is no other value $c$ for which that is a true statement. Could someone prove this uniqueness for me? I am tutoring a calculus student and he asked me something to this effect and I couldn't see why. Thanks!


I was wondering about  how can one apply for a PhD program in a top ranked university. I can tell you about a namely accomplishments and skills which is labelled as 'very good' for a graduated M.Sc student in an average university so that you can consult me and the people who almost have a similar accomplishments and skills.    To be more precise I would like to know:     How can one be accepted and get the scholarship for a very top-ranked university like Berkeley, MIT. For example are the following accomplishments and skills satisfactory?   If not, which points should be added or improved generally?   How much is it matter how old are you for applying for PhD at these places?   What features differentiate the CV of someone admitted to a top school (MIT)versus someone admitted to an average school (Calgary Canada).      Two ISI papers Including one ' ' and ''. IELTS and GRE meet the minimum requirements.  Having a very strong recommendation letter. Also, my supervisor professor is one of the top (top 50) in his field. Two years teaching experience in a small university as a lecturer.     P.S. I have B.Sc and M.Sc in Electrical Engineering.

When applying to a PhD program in the US, how does the admissions process work? If an applicant is weak in a particular area, is it possible to offset that by being strong in a different area?  Note that this question originated from this . Please feel free to edit the question to improve it.


If $$2^6k+2\equiv4\pmod9$$ then this implies that $$2^6k+2\equiv4\pmod{18}$$since both sides are even. Can anyone explain to me why this inference is true?

If a prime number $p$ is a divisor of a product $ab$, $p$ has to be a divisor of $b$ or $a$. How can I demonstrate this theorem? I demonstrated this theorem on one way using Bezout's theorem in an  but are there other proofs??


So I'm trying to prove, by induction, that $$ n^n \geq n!, \forall n\geq1$$  Base case:  $$ \text{For } n=1, 1^1 = 1 \geq 1 = 1!$$  Hypothesis:  $$ n^n \geq n!$$  Step:  $$ \text{Trying to prove: } n^{n+1} \geq (n+1)! $$  Now, somewhere around here I get some contradicting things. For example, if I start from the right side I get:  $$ (n+1)! = (n+1)\cdot n! \leq (n+1)\cdot n^n = n\cdot n^n + n^n = n^{n+1} + n^n$$  Based on this I would need $n^{n+1} + n^n$ to be less than or equal to $n^{n+1}$, which is certainly not true. Something similar happens when I go the other way.   Any ideas what I'm doing wrong here? Thanks.

How would you go about proving $n! < n^n$ using a mathematical induction proof?  I understand how to solve inductive proofs with = but I'm getting a bit lost in this example.   Any help is much appreciated.


any way to texture hair particles mid strand? like have brown hair with white frosted tips or a pink star in the middle?

At some point (not right away), I'll be wanting to make a character model which has multicolor hair.  Namely, it will be one color closer to the roots, and another color closer to the tips.  Is there any way to do this in blender?  I would be using Cycles for this.


I just want to understand why we use *args when the same work can be done by list when we pass it as a argument. In which scenarios do we really need *args, where list as a argument will fail to do that operation.  list =[1,2,3,4,5,6,7] def method1(args):     for i in args:         print(i*2) method1(list)   list =[1,2,3,4,5,6,7] def method1(*args):     for i in args:         print(i*2) method1(*list)    I didn't find any differences. Please correct me if i am wrong.

In the following method definitions, what does the * and ** do for param2?  def foo(param1, *param2): def bar(param1, **param2):


I have several huge .txt files and I need to remove a line if it is exactly 9 characters long. No more no less.  Is there a way to do this using awk / sed?


I have this string and trying get phone number: +420 731 58 34 12.  How I can do this using php ?
Studio Diana
Lidická 25
Brno, 602 00
Tel.: +420 731 58 34 12
E-mail: diana@studio-diana.cz
http://www.studio-diana.cz
&nbsp;
Otevírací doba:
Po-Čt: 8:00–18:00&nbsp;
Pá: 8:00–15:00

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:   1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901   I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.


I was looking at python code that printed palindromes, and I stumbled upon this line of code:  for i in range(1000, 7, -1):     if (str(i) == str(i)[::-1])   I'm trying to learn Python right now, and I'm just not that familiar with the syntax. Currently, I understand that this line of code checks to see if the first digit of integer i matches its last digit. Does the syntax of this line mean that the index is being incremented in order to check if it's a palindrome? What is the purpose of having two colons?

I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.


W: The repository 'http://extras.ubuntu.com/ubuntu xenial Release' does not have a Release file. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8) manpage for repository creation and user configuration details. E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/source/Sources  404  Not Found [IP: 91.189.92.152 80] E: Some index files failed to download. They have been ignored, or old ones used instead.   how do i solve it

When running sudo apt-get update I get these following errors:  Err archive.ubuntu.com quantal InRelease Err archive.ubuntu.com quantal-updates InRelease Err archive.ubuntu.com quantal-backports InRelease Err archive.ubuntu.com quantal-security InRelease Err archive.ubuntu.com quantal Release.gpg   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] Err archive.ubuntu.com quantal-updates Release.gpg   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] Err archive.ubuntu.com quantal-backports Release.gpg   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] Err archive.ubuntu.com quantal-security Release.gpg   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] Reading package lists... Done W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal/InRelease   W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-updates/InRelease   W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-backports/InRelease   W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-security/InRelease   W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-updates/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-backports/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-security/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80] W: Some index files failed to download. They have been ignored, or old ones used instead.   I am using Ubuntu 12.04. This is the command I used after installing Ubuntu from window installer. I am sure my laptop is connected to internet. What can I do now?


What do they mean when they say that a function can or cannot be "extended" to another function? I don't quite understand the terminology here. Whar does "extended" mean in this scenario? I want to show that a bounded continuous function cannot always be extended to a continuous function, but I don't know what this means.   Can someone please clarify on this? Thank you.

What does it mean to extend a function? Can someone please give an example?  Thanks in advance!


None of my aliases work. I tried the most simple thing, defining an alias to access the Desktop/ folder from $HOME:  # just to show that I do have a Desktop/ folder ~ bf$ cd Desktop/  Desktop bf$ cd ~  ~ bf$ alias dd='Desktop/'  ~ bf$ cd dd -bash: cd: dd: No such file or directory  ~ bf$ echo dd dd   I also tried to save this alias in .bash_profile (in my $HOME directory), source it, but it won't work. What's happening? Also why does echoing the alias just return its name?

There are several files I work with often. For instance some configuration files or log files. Let's say the Apache log file. I often want to tail or grep it. Instead of writing:  tail -50 /var/log/apache2/error_log   I prefer to write  tail -50 apachelog  So that apachelog functions as an alias for this filename. But if I define an alias in my bashrc, it needs to be a whole command; it (apparently) can not be an alias for a filename so that you can reference it later. Is there a way to achieve this?   NOTE: I have a large variety of files and a large variety of different commands I want to run, so creating functions or aliasses for all of those different options will not be my preferred solution.


After developing an app for Android we want to step forward a bit and do it for iOS. We have no prior experience with developing for iOS(the code is not the problem, but the tehnique is). With a bit of research, i found that you need Apple Computers or VM's or Apple Mirroring for this job, because it is "imposible" to develop in Xcode(meaning that i try to keep it as native as i can). I also found Xamarin and other tools but finaly decided with my team upon a Mirrored Mac ( inCloud). The problem is that, with little financial backup we do not afford to buy a Mac or to Buy more than 1 subscription(30-35$ for a month is a lot for starters). Now i want to know if there is a safe way to work for iOS on Windows(maybe without installing anotherOS on PC), or at least to Design( visual)- storyboards, views and others..for the app.. Maybe one can work on the Cloud Machine and the others can work from their home computers..and than kind of merge the projects.. thank you.

Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?  The only other way I can think of doing this is to run a Mac VM image on a VMWare server running on Windows, although I'm not too sure how legal this is.


I need to extract a field value from a JSON string using POSIX.2 extended regular expressions (man 7 regex on Linux): eg. from {"field":"value"}  I'm used to working with Perl-style regex when a simple /"field":"(.*)"/ would do the trick, but the POSIX regex don't seem to have a notion to express capture groups.  Is there a trick to craft a POSIX pattern that will match exactly the JSON value ?

I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?