class Test{     public static void main(String[] arg){         String str1="a,,";         String str2="a,,b";         System.out.println(str1+" len="+str1.split(",").length);         System.out.println(str2+" len="+str2.split(",").length);     } }   The output is  a,, len=1 a,,b len=3   Isn't the number of parts supposed to be 3 in both the cases?
Check out the below program.   try {     for (String data : Files.readAllLines(Paths.get("D:/sample.txt"))){         String[] de = data.split(";");         System.out.println("Length = " + de.length);     } } catch (IOException e) {     e.printStackTrace(); }   Sample.txt:   1;2;3;4 A;B;; a;b;c;   Output:   Length = 4 Length = 2 Length = 3   Why second and third output is giving 2 and 3 instead of 4. In sample.txt file, condition  for 2nd and 3rd line is should give newline(\n or enter) immediately after giving delimiter for the third field. Can anyone help me how to get length as 4 for 2nd and 3rd line without changing the condition of the sample.txt file and how to print the values of de[2] (throws  ArrayIndexOutOfBoundsException)?
i have a scenario where i want to know in which position number the column name comes   like i have sample data below   ID|NAME|S1|BQ|S2|VN|D1 1|vimal|10.12|12.4|56.2|12.2|11.22 2|vilas|10.12|12.4|56.2|12.2|11.22 3|viky|10.12|12.4|56.2|12.2|11.22   Colum name : S1 S2 D1   output should be :  3 5 7 how to run a winform from console application? How do I create, execute and control a winform from within a console application? How many times more than $0$? Disfigured Feynman Diagrams! Restricing domains for universal and existential quantifiers I am currently using Rosen's "Discrete Mathematics and Its Applications" (7th ed.) for my discrete mathematics course. We recently talked about quantifiers, more specifically the universal and existential quantifier. What confuses me is when we started talking about restricting the domain (i.e. instead of all real numbers, only all real positive numbers), where does the conditional statement come from when restricting the domain of a universal quantifier and where does the conjunction come from when restricting the domain of a existential quantifier?  This link did help:   However, the part that confuses here is how are the domains restricted in the answer given in the link above? I have a cron job that runs every minute on an Ubuntu 12.04 box  $sudo crontab -e * * * * * mylogin /pathto/file.sh &gt; /log/filelog   If I run file.sh, the bash script does some stuff and echos out runs:  $ ./file.sh  runs   If I check the log of cron tab it shows that the job is running:  Jul 10 12:41:01 localhost CRON[1811]: (root) CMD (mylogin /pathto/file.sh &gt; /log/filelog) Jul 10 12:41:01 localhost CRON[1810]: (CRON) info (No MTA installed, discarding output) Jul 10 12:42:01 localhost CRON[1813]: (root) CMD (mylogin /pathto/file.sh &gt; /log/filelog)   However, the script is not running. It is not doing it's work and not echoing runs to /log/filelog.  $cat /log/filelog  #shows nothing   What other steps can I take to debug this problem? Adverb between conjugated verb and infinitive? For QA workstations preparation (Windows-based PCs) our IT department uses typical batch deployment tools. I'm not at all interested in the details of such process, but IT guys ask me:  What typical set of software you need for everyday manual testing tasks? We could include these in our deployment so that you guys could save more time for testing, not for environment prep &amp; tuning.  Sure thing we do test various range of projects, from web applications to standalone solutions, and each application requires its own set of tools for manual testing, e.g.:  Browsers Virtualization utilities DB clients Screens capturing tools FTP clients XML editors etc.  However, and that's for sure - there's a list of tools every QA MUST have installed on its PC, regardless of project types under testing. My area of experience is mostly standalone / complex web apps, that's why my vision on the task is a bit subjective. So, your suggestions of what are tools / software an average QA specialist can't live without will be highly appreciated. 2 assumptions:  Manual testing is a point of interest. Let's limit the list to not more than 15 (better 10) items.  Thanks in advance! When do you use Java's @Override annotation and why? I have Opportunity-lookup field on Opportunity (self),  Scenario:   Opportunity A if select Opportunity B using lookup then Opportunity B's same lookup field automatically populate with Opportunity A.   I tried to achieve this using trigger - before insert/update but its failing as:  System.DmlException: Update failed. First exception on row 0 with id 006G000000DHaBlIAL; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 006G000000DHaBl) is currently in trigger Oppy_before_INSUPD, therefore it cannot recursively update itself: [] When is logistic regression solved in closed form? How can I set up password-less SSH login? I want to be able to login to a remote via ssh without having to enter the password all the time.   How do I set it up? Is a different command required to execute a password-less session? The temperature and pressure everywhere inside the Sun reach the critical point to start nuclear reactions - there is no reason for it to take such a long time to complete the reaction process.  Just like a nuclear bomb will complete all the reaction within $10^{-6}$seconds.  Why does most of the hydrogen of the Sun still not react even though it reaches the critical point, and why take stars billions of years to run out of fuel? How will going from 75% Credit Utilization to 0% Credit Utilization affect my credit score? power outage/frozen meat We were on vacation for a week. The neighbor said we were out of power the whole time.  We have a chest freezer full of beef. It thawed but remained in the freezer unopened the whole time. Is the meat bad if it is thawed but still cold? Can we refreeze it and eat it? How to prove the inequality $a_1^{a_1}a_2^{a_2}\cdots a_n^{a_n} > \left(\frac{a_1+\dots+a_n}{n}\right)^{a_1+\dots+a_n}$? If $a_1,\dots,a_n$ are all unequal positive quantities, then prove that: $$\prod_{i=1}^n a_i^{a_i} &gt; \left(\frac{\sum_{i=1}^n a_i}{n}\right)^{\sum_{i=1}^n a_i}$$ No other conditions are given. I tried to solve it using logarithms, but I could not understand how can I prove $${a_1\log a_1}+{a_2 \log a_2}+\dots+{a_n\log a_n} &gt; {(a_1+\dots +a_n)}  \left(\log(a+\dots+a_n)-\log(n)\right)$$ And please tell me, is there any standard method to solve this kind of problems? Tags on badge question list I'm trying to get the Weed-Eater hat on Stack Overflow. To do so, I'm looking at the list of questions . The problem is, no tags show up there, and so it's rather difficult to see which ones I have a shot at. Any chance of showing the tags on this page?  I realize that getting this before Winter Bash is over would be difficult, but it would be good to keep such things in mind for the future. Is it better to have an ErrorDocument 404 redirect back to the homepage or a standard 404 error page? Is there any analytics information that moderators can access for individual questions? Set margins in maketitle Is it possible to change the margins in make title, so they match the margins of the document?  I have created the following modification to the \maketitle. I would like everything to align to at the same left margin.    \documentclass[a4paper]{article} %=============================================== % Title and author \makeatletter \def\@maketitle{%   \newpage   \vspace*{-\topskip}      % remove the initial space    \flushleft Incomplete draft. Please do not cite or quote without premission   \vskip 2em   {}   \begingroup\flushleft    % instead of \begin{center}   \let \footnote \thanks   \hrule height \z@        % to avoid the insertion of lineskip glue     {\LARGE \protect\textbf{\@title} \par}%     \vskip 1.5em     {\large       \lineskip .5em          \@author         \par}%     \vskip 1em     {\normalfont       Last updated on \@date}   \par\endgroup            % instead of \end{center}   \vskip 1.5em             % &lt;--- modify this to adjust the separation } \makeatother %============================================== \title{Physician Information Acquisition In a Dynamic Setting} %\email{rud} \author{ \large {\Large Rud Faden} \\ \textit{\normalfont University of Copenhagen} \\ \textit{{\small \href{mailto:rudfaden@gmail.com}{rudfaden@gmail.com}}} } \date{\today} % no date \usepackage{hyperref} \begin{document} \maketitle \abstract{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enimad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ocia deserunt mollit anim id est laborum.}    \section{First} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \end{document}