Basically I am reading a string patterned like AABBCCAACC; how can I count how many times has each group of 2 characters been typed in by the user?  I have tried this without success:  for (int i = 1; i &lt; str.length(); i+=2) {   if(str.substring(i, i+1) == "AA");   {     countAA++;   } }
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?
Partition of harddisk lost/unusable How to run a LaunchAgent that runs a script which causes failures because of System Integrity Protection After upgrading to Mojave, my rsync based backup script run via a launch agent in ~/Library/LaunchAgents, could no longer read some directories in ~/Library. Why do only two sexes exist for animals? Why, from the natural selection point of view, do only two sexes exist for animals? creating variable using variable value as part of new variable name I'm trying to create a new variable using the value of an existing variable as part of the variable name.  filemsg"$word1"=" "   I've also tried   filemsg$word1=" "  filemsg${word1}=" "   on all attempts I get the following when that line executes,  cicserrors.sh[45]: filemsgCICS= : not found [No such file or directory] How to prove the Fibonacci sum $\sum \limits_{n=0}^{\infty}\frac{F_n}{p^n} = \frac{p}{p^2-p-1}$ Why are some galaxies flat? What is the explanation for the flatness of some galaxies?   (If it's due to their rotation then why they are rotating, why some other galaxies are not flat etc., I would like to hear a nice and complete answer :) ) On the paragraph explaining arithmetic expansion,  uncovers 2 different ways of evaluating an expression, the first one uses $(( EXPRESSION )) and the second one uses $[ EXPRESSION ]. The two ways seem pretty similar as the only difference I have found is:     $[ EXPRESSION ] will only calculate the result of EXPRESSION, and do no tests:   Yet, I am intrigued because the same document recommends using $[ EXPRESSION ] rather than $(( EXPRESSION )).     Wherever possible, Bash users should try to use the syntax with square brackets:   Why would you want that if less tests are being done? What antivirus program can I use on Ubuntu? Are there any antivirus applications that work on Ubuntu 16.04? Thanks! Is it possible to Pivot data using LINQ? Convergence of exponential Brownian martingale to zero almost surely Define the exponential Brownian martingale as $N_t = \exp\left\{a W_t - \frac12 a^2 t \right\}$ which is a martingale with respect to the natural filtration of $W$ which stands for a standard Brownian motion.  I now want to prove that $N_t \rightarrow 0$ a.s. for $t \rightarrow \infty$. As $N_t$ is a martingale it is by definition in $L^1$ hence Doob's martingale convergence theorem tells us that there exists a $N_\infty \in L^1$ such that $N_t \rightarrow N_\infty$ a.s., but how could I prove that $N_\infty \equiv 0$? Any help is greatly appreciated! Create buffer in meters? I'm very new to the GIS world, so my problem could be very stupid, but I'm going to try anyway.  Objective  Given a list of coordinates in longitude/latitude, stored as a .csv file, I want to create a buffer with distance of x km around those coordinates. (In case this is relevant, these coordinates are locations of the societies in the . These societies scatter all around the world.)  Problem  I'm only able to create buffers with distance in radial degrees, but I want to do them in (kilo)meters. I'm aware of the following Q&amp;A's, but following what's suggested therein doesn't seem to solve my problem:          What I have tried...   I start QGIS (v2.4), and Add delimited text layer  choose my .csv file and the x/y fields, click OK select WGS 84 as my CRS (also tried NAD83 but didn't make a difference), click OK right-click on layer and select Save As..., in the dialog box, choose the following and click OK:  add sccs_meter.shp as layer to the current project Select Vector > Geoprocessing Tools > Buffers > set buffer distance as 10   The result is a buffer with radius of approximately 1068km, which suggests that buffer distance is 10 degrees rather than 10 meters.  What did I do wrong here? Meta sites in "Your Communities" display different reputation Is $\{\frac{m}{10^n}\mid m,n\in\mathbb Z,\ n\geq 0\}$ dense in $\mathbb R$? The set $S$ of real numbers of the form $m/10^n$, $m,n$ integers and $n$ greater than or equal to $0$, is a dense subset of $\mathbb R$ or not??   I know dense means closure of $S$ in $\mathbb R$ is $\mathbb R$ then it will be dense. How to prove or disprove I have no idea. Guests see the Protected notice , somewhat displaced:    Logged in, all is fine:    It actually belongs there, at the bottom, but then it has some design glitches, or it needs to be placed at the top.  Verified on Firefox and Chrome stable. $S=\{(n,{1\over n}):n\in\mathbb{N}\}$ is closed in $X$? The topological space $X=\mathbb{N}\times \mathbb{Q}$ with subspace topology of $\mathbb{R}^2$ the set $S=\{(n,{1\over n}):n\in\mathbb{N}\}$ is closed in $X$?  $S^c=\phi\times\{{1\over n}\}^c$ right? but I know $\mathbb{Q}$ is neither open nor closed in $\mathbb{R}$, I am confused here, could any one help me to answer this question?  the boundary of $S$ is $\bar{S}\setminus $ int S. as int S is $\phi$ so boundary is $\mathbb{N}\times \mathbb{R}$? How do I size a UITextView to its content? Is there a good way to adjust the size of a UITextView to conform to its content? Say for instance I have a UITextView that contains one line of text:  "Hello world"   I then add another line of text:  "Goodbye world"   Is there a good way in Cocoa Touch to get the rect that will hold all of the lines in the text view so that I can adjust the parent view accordingly?  As another example, look at the notes' field for events in the Calendar application - note how the cell (and the UITextView it contains) expands to hold all lines of text in the notes' string. Finding functions such that $f(g(x)) = f(x)g(x)$ Let's assume the functions in question are continuously differentiable. If $f(g(x)) = f(x)g(x)$, then: $$f'(g(x))g'(x) = f'(x)g(x)+f(x)g'(x)$$ I attempted to find a particular solution by letting $g(x) = x$. Then, $$f'(x) = xf'(x) + f(x)$$ $$df = xdf + fdx$$ $$\frac{df}{f} = \frac{dx}{1-x}$$ $$\ln(f(x)) = -\ln(1-x)+C$$ $$f(x) = \frac {A}{1-x}$$ Where $A$ is a constant. This solution was fairly unsatisfying to me, and upon checking it, I see it doesn't actually work, as letting $g(x) = x$ leads to $f(x) = xf(x)$. I was wondering if there were better answers, or at least a less trivial way to go about the problem. Possible Duplicate:          Is there anywhere or anyone to complain to about the behaviour of moderators? I've been "spoken" to offensively by a moderator, and I'm unhappy about it. Proving that $\frac{\phi^{400}+1}{\phi^{200}}$ is an integer. How do we prove that $\dfrac{\phi^{400}+1}{\phi^{200}}$ is an integer, where $\phi$ is the golden ratio?  This appeared in an answer to a  I asked previously, but I do not see how to prove this.. How to obtain a confidence interval for a percentile?