this class is a test to see if my 2 methods (the "endfinder"s) are working (unfortunately they are not). endfinder() is meant to return the index of the next non space character in the provided string; endfinder2() is meant to return the endpoint of the word starting with the index found by endfinder. They're meant to be used to pull out words from a string with multiple words separated by spaces. I've gone over it for a few hours and there must be some obvious answer but I feel like I'm slowly going insane.   I've removed all of the outputs I used to test the code in many attempts to figure out what was wrong to make it cleaner.   Basically, what I've found is that endfinder() always returns 0 for some reason and endfinder2() runs until it reaches the break (I assume that's what happens as it used to loop infinitely before I added it in).  The result I want is start = 3, end = 6  which would make it output "[one]".  The result I get:   [   one  two three] start = 0, end = 17.  Here's my code:  import java.io.*; import java.util.*;  public class test {      static String answer, container;     static int start = 0, end = 1;        public static int endfinder(String perspective) {         int holder = start;         while (perspective.substring(holder, (holder + 1)) == " ") {             holder++;             if (holder == perspective.length())                 break;         }         return holder;     }      public static int endfinder2(String perspective) {         int holder = end;         while (perspective.substring(holder, (holder + 1)) != " ") {                 holder++;             if (holder == perspective.length())                 break;         }         return holder;     }      public static void main(String Args[]) {         System.out.println();         System.out.println();         container = "   one  two three";         start = endfinder(container);         end = start + 1;         end = endfinder2(container);         System.out.println("[" + container.substring(start, end) + "]");         System.out.println();         System.out.println("start: [" + start + "] end: [" + end + "]");         System.out.println();     }  }
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?
Listing, zebra effect and broken lines In , I've found one solution to produce a zebra effect for listing. Unfortunately, this only works if the lines are not broken. Is there a way to fix this?  Here is a code with an example showing the problem:  \documentclass[10pt,a4paper]{article}     \usepackage[utf8x]{inputenc}     \usepackage{ucs}     \usepackage[T1]{fontenc}     \usepackage{lmodern}     \usepackage[frenchb]{babel}     \usepackage[x11names, svgnames]{xcolor}     \usepackage{graphicx}     \usepackage{listings}     \usepackage{amsfonts}     \usepackage{amssymb}      \makeatletter         % Patch line number key to call line background macro         \lst@Key{numbers}{none}{%             \def\lst@PlaceNumber{\lst@linebgrd}%             \lstKV@SwitchCases{#1}%             {none&amp;\\%              left&amp;\def\lst@PlaceNumber{\llap{\normalfont                         \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}\lst@linebgrd}\\%              right&amp;\def\lst@PlaceNumber{\rlap{\normalfont                         \kern\linewidth \kern\lst@numbersep                         \lst@numberstyle{\thelstnumber}}\lst@linebgrd}%             }{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}          % New keys         \lst@Key{linebackgroundcolor}{}{%             \def\lst@linebgrdcolor{#1}%         }         \lst@Key{linebackgroundsep}{0pt}{%             \def\lst@linebgrdsep{#1}%         }         \lst@Key{linebackgroundwidth}{\linewidth}{%             \def\lst@linebgrdwidth{#1}%         }         \lst@Key{linebackgroundheight}{\ht\strutbox}{%             \def\lst@linebgrdheight{#1}%         }         \lst@Key{linebackgrounddepth}{\dp\strutbox}{%             \def\lst@linebgrddepth{#1}%         }         \lst@Key{linebackgroundcmd}{\color@block}{%             \def\lst@linebgrdcmd{#1}%         }           % Line Background macro         \newcommand{\lst@linebgrd}{%             \ifx\lst@linebgrdcolor\empty\else             \rlap{%                 \lst@basicstyle                 \color{-.}% By default use the opposite (`-`) of the current color (`.`) as background                 \lst@linebgrdcolor{%                 \kern-\dimexpr\lst@linebgrdsep\relax%                 \lst@linebgrdcmd{\lst@linebgrdwidth}{\lst@linebgrdheight}{\lst@linebgrddepth}%                 }%             }%             \fi         }     \makeatother      \lstset{ %    * Number for lines         numbers=left,                   % Where to put the line-numbers         numberstyle=\footnotesize,      % Size of the fonts used for the line-numbers         stepnumber=1,                   % Step between two numbers         numbersep=5pt,                  % How far the line-numbers are from the code % %    * Back returns for long lines         breaklines=true,                % Sets automatic line breaking         breakatwhitespace=false,        % Automatic breaks only happen at whitespace ?         breakindent=0pt,                % Space before the text of a break         postbreak=\mbox{                % Character used at the begining of a break             \rotatebox[y=0.9ex]{180}{\color{Red} $\Lsh$}%         },     }  \begin{document}  \begin{lstlisting}[language=Python,linebackgroundcolor={\ifodd\value{lstnumber}\color{gray}\fi}] for i in range(5): for i in range(5): for i in range(5): for i in range(5): for i in range(5): for i in range(5):     sum += i**3 print sum  print('Fin de la boucle...') \end{lstlisting}  \end{document} Why Process Builder doesn't work on Delete Scenario? As most of the time we have to think of requirement to accomplished using out-of-Box feature like e.g process builder which we think of an alternative to trigger, but suppose I have to handle scenario of Delete using Process Builder then there is limitation!(e.g calculation of roll-up on Delete) so I am curious about what is that limitation because of which Delete scenario is not handled in Process Builder. Is there a way to fully stretch one line of text on the full width of the page, without manually setting the letter spacing, no matter how many characters on the line? Google Chrome automatically adding websites to my list of search engines? I have noticed that certain websites (e.g. Stack Exchange sites, Dell, etc.) are automatically added to my list of search engines in Google Chrome.   They even add a keyboard shortcut to their entry. Here are some examples:   Dell: Keyboard -> Dell.com Stack Exchange Web masters: Keyboard -> webmasters.stackexchange.com Reuters: Keyboard -> reuters.com   Q1: Is this the default behavior in Chrome? (to let websites add themselves to the list of search engines?)  Q2: Is it possible to disable this behavior in Chrome?   Note: I'm running the latest version of Chrome: 11.0.696.57 on Windows 7 64, and I only have one extension installed: Google URL shortener. Proof that $\frac{a^2}{b} + \frac{b^2}{c} + \frac{c^2}{a} \geq a+b+c$ I've tried getting everything on the left side and transforming it into something squared so that I can prove it's bigger or equals to 0 but I've been unsuccessful. The Cartesian product of a family $(A_i\mid i\in I)$ is defined as $$\prod\limits_{i\in I}A_i=\{f:I\to\bigcup A_i\mid f(i)\in A_i\}$$ Let $I_n=\{i \in \mathbb N \mid i \le n\}$ for $n\in \Bbb N$ and $A_i$ be countable for all $i\in I_n$. Then $\prod\limits_{i\in I_n}A_i$ is countable.   My attempt: Lemma 1: $(\prod\limits_{i\in I_n}A_i) \times A_{n+1}$ and $\prod\limits_{i\in I_{n+1}}A_i$ are equinumerous for all $n \in \mathbb N$. (I presented a proof ) Lemma 2: If $A$ and $B$ are countable, then $A \times B$ is countable. (I presented a proof ) I will prove the theorem by induction on $n$. The theorem is trivially true for $n=0$. Assume that the theorem is true for $n=k$, then $\prod\limits_{i\in I_k}A_i$ is countable. Since $\prod\limits_{i\in I_k}A_i$ is countable (by inductive hypothesis) and $A_{k+1}$ is countable, then by Lemma 2 $(\prod\limits_{i\in I_n}A_i) \times A_{n+1}$ is countable. Furthermore, by Lemma 1 $(\prod\limits_{i\in I_k}A_i) \times A_{k+1}$ and $\prod\limits_{i\in I_{k+1}}A_i$ are equinumerous, then $\prod\limits_{i\in I_{k+1}}A_i$ is countable too. Thus the theorem is true for $n=k+1$. This completes the proof.   Does this proof look fine or contain gaps? Do you have suggestions? Many thanks for your dedicated help! How to use a decimal range() step value? No connection could be made because the target machine actively refused it (PHP / WAMP) How to search inside files on Windows 7? In Windows XP we can search for files that contain a defined keyword (inside all files types).  Windows 7 can look inside files for a keyword, but only for text files. (*.doc, *.txt, *.inf, ...), not (*.conf, *.dat, *.*, ...).   don't contain any filter I can use for this.  How is this possible? Nice looking progress bar in java lstlisting in two columns I would like to have two listings, side by side.  They have approximately the same length, therefore I don't care about how it's layed out if one part is longer.  I tried  \begin{minipage}{\textwidth} \begin{parcolumns}{2} \colchunk{\begin{lstlisting}[caption=code 1,frame=tlrb]{Name} void code() {  } \end{lstlisting}}  \colchunk{\begin{lstlisting}[caption=code 2,frame=tlrb]{Name} void code() {  } \end{lstlisting}}  \colplacechunks \end{parcolumns} \end{minipage}   while the border of the listings end up in chunks as follows:   Btw I'm using the texlive-package &amp; pdflatex on Ubuntu and the document class is  \documentclass[ a4paper, 10pt, twoside, openright, notitlepage, parskip=half, ]{scrreprt}   Any idea is appreciated. I would like to say something like     The boy, Adam's, favorite toy was a bike.   What is the proper way to say this? Serana disappeared during dawnguard questline. This is something I don't particularly understand. I get that for Windows, activation exists to prevent software piracy, but you don't have to pay for iOS. Perhaps activation exists to prevent Android devices from using iOS or to prevent jailbreaks and downgrades? Anyone know the real reason why? I want to trace a border in a box or minipage like this model. A border customizable in left angle on top and right angle in bottom. Somebody can help me? Thanks a lot JPierre Possible to create new Application Handler? 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 trying to find a way with QGIS to get the intersection area of more than 2 layers.  All the tools in QGIS take just the 2 input layers.  For example in the image below, I have 4 layers and I want to retrieve just the black area.   Furthermore, I need to retrieve the count attribute and add it to the intersected area attribute table (in this case 4)    I know there is a tool that does the trick in ArcGIS, but is there a QGIS solution? Getting an error in W3C Markup Validation when trying to get a whole  element as a link in a page If one uses Shadow Evocation on a willing ally (e.g. Telekinetic Charge) can they choose not to disbelieve? Shadow Evocation  Nondamaging effects have normal effects except against those who disbelieve them. Against disbelievers, they have no effect.  Disbelief  Creatures encountering an illusion usually do not receive saving throws to recognize it as illusory until they study it carefully or interact with it in some fashion. A successful saving throw against an illusion reveals it to be false, but a figment or phantasm remains as a translucent outline. A failed saving throw indicates that a character fails to notice something is amiss. A character faced with proof that an illusion isn't real needs no saving throw. If any viewer successfully disbelieves an illusion and communicates this fact to others, each such viewer gains a saving throw with a +4 bonus.  (my emphasis) Voluntarily Giving up a Saving Throw  A creature can voluntarily forego a saving throw and willingly accept a spell's result. Even a character with a special resistance to magic can suppress this quality.  If I understand the above correctly,  If the ally believes the caster actually cast Telekinetic Charge, it seems they get a save which they could forgoe and so be guaranteed the benefit of the spell. &gt;&gt; We're good here. If the ally knows the caster didn't cast Telekinetic Charge, (say because of a high Spellcraft check or because she knows the caster's spell list) they have proof that the illusion isn't real and so need no saving throw. &gt;&gt; Even though she &quot;needs no saving throw&quot;, can she still choose to forego the save and be effected by the spell?  In other words, I think the question boils down to: Does one always have a choice not disbelieve an illusion, even when one has proof that it's not real? Solution to German Tank Problem Is there a formal mathematical proof that the solution to the  is a function of only the parameters k (number of observed samples) and m (maximum value among observed samples)? In other words, can one prove that the solution is independent of the other sample values besides the maximum value?