How do you compare a String value to an ArrayList? As shown below I declared an ArrayList of EmployeesRecords and added employees but I don't understand why this is not comparing. I'm new to java, can someone please help ArrayList&lt;EmployeeRecords&gt; employees = new ArrayList&lt;EmployeeRecords&gt;();  When the remove button is pressed, it should remove the employee if his/her Id number is equal to one entered by the user. String employeeID = textEmployeeID.getText(); if(employeeID == String.valueOf(employees.get(0).ID)){     employees.remove(0); }
How do I compare strings in Java? 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?
How to differentiate formally? What should i use for better performance, nine-patch or drawable xml resource? How do I close a tkinter window? How do I end a Tkinter program? Let's say I have this code:  from Tkinter import *  def quit():     # code to exit  root = Tk() Button(root, text="Quit", command=quit).pack() root.mainloop()   How should I define the quit function to exit my application? Some verbs are followed by ing, e.g. I enjoy swimming. We can't say I enjoy to swim. Likewise, some verbs are followed by to, e.g. I decided to make a plan.   Which particular verbs are followed by ing and to? Can you please provide a list for that?  Moreover, which verbs can be followed by both without having the meaning changed? The infinite product of the sines of all positive integers is zero I tried to prove that $\prod\limits_{k = 1}^\infty  {\sin k = 0}$  Define $$P(m)=\prod\limits_{k = 1}^m  {\left|\sin k\right|}$$  then I take the logarithm of both sides $$\log P(m)=\log \prod\limits_{k = 1}^m  {\left|\sin k\right|}$$  which can be written as $$a_m=\log P(m)=\sum\limits_{k = 1}^m  {\log\,\left|\sin k\right|}$$ for any $k\in\mathbb{N}$ we have $0&lt;\left|\sin k\right|&lt;1$, so all terms of the sum above is strictly negative.  I say that the sequence diverges: $\left\{a_m\right\}_{m\in\mathbb{N}}\to\,-\infty$  This is a delicate point on which I have some doubts.  I know that  $$\int\limits_0^\pi  {\log \left|\sin x\right|{\text{ d}}x}  =  - \pi \log 2$$ and that the function $\log \left|\sin x\right|$ is periodic with period $\pi$,  so the integral from 1 to $\infty$ diverges to $- \infty$. Then the series diverges as well for the integral test for convergence.  As $\log P(m)\to\, -\infty$ we can say that $P(m)\to\,0$ as $m\to\,\infty$  Therefore $$\mathop {\lim }\limits_{m \to \infty } \prod\limits_{k = 1}^m {\left| {\sin k} \right| = \mathop {\lim }\limits_{m \to \infty } \prod\limits_{k = 1}^m {\sin k = \prod\limits_{k = 1}^\infty  {\sin k = } 0} }.\quad \blacksquare$$ How to redirect output of an entire shell script within the script itself? Is it possible to redirect all of the output of a Bourne shell script to somewhere, but with shell commands inside the script itself? Redirecting the output of a single command is easy, but I want something more like this: #!/bin/sh if [ ! -t 0 ]; then     # redirect all of my output to a file here fi  # rest of script...  Meaning: if the script is run non-interactively (for example, cron), save off the output of everything to a file.  If run interactively from a shell, let the output go to stdout as usual. I want to do this for a script normally run by the FreeBSD periodic utility.  It's part of the daily run, which I don't normally care to see every day in email, so I don't have it sent.  However, if something inside this one particular script fails, that's important to me and I'd like to be able to capture and email the output of this one part of the daily jobs. Update: Joshua's answer is spot-on, but I also wanted to save and restore stdout and stderr around the entire script, which is done like this: # save stdout and stderr to file  # descriptors 3 and 4,  # then redirect them to &quot;foo&quot; exec 3&gt;&amp;1 4&gt;&amp;2 &gt;foo 2&gt;&amp;1  # ...  # restore stdout and stderr exec 1&gt;&amp;3 2&gt;&amp;4 Of course preventing them from getting stolen is the top priority, but invariably, someone is going to get jacked. What are some good practices to minimize the damage incurred when your PC is stolen?  Given most of our PCs contain our entire lives, its frightening to know that all this information can be in someone else's hands.   Some ideas i had (a bit paranoid, i admit).   keep encrypted backups.  Use truecrypt to have double encrypted (with strong password) volumes where you store your personal data. schedule Eraser to run every evening so that potential thieves couldn't undelete (and subsequently retrieve) sensitive data do all your banking in a virtual machine.  Keep the virtual machine volume encrypted, and on a portable usb drive that you carry with you / keep in a safe. have applications that phone home (or hit something to leave an IP trace) upon connection to the internet (can someone suggest a good solution for this?)   Does anyone have any other suggestions? Is there a suffix for loathing? For instance trichomania is a love of hair, and trichophobia is a fear of hair. But what suffix would denote a loathing of hair?  Edit: Maybe I'm looking at the wrong end of the word, and I should be considering the prefix "miso-". What is the difference between a HMAC and a hash of data? Extrude and bevel an imported svg curve I exported an svg 1.1 file from Adobe Illustrator CS6. I joined all the shapes by pressing Ctrl+J. I set the curve shape to 2D. Then I extruded using the right hand side panel:    So far so good. But when I try to apply even a slight bevel, all hell breaks loose:    It does get less insane if I bring the bevel down by multiple factors of 10... But then I really don't have much of a bevel.  Am I doing something wrong? Am I using the wrong kind of object? Should I be doing this with meshes? Do my curves just need cleaning up? Using more than one set of Locators in a Manipulate Creating the Nabla operator (also known as Del operator) as an operator What is this story about 20 y.o. inexperienced "kids" fighting against a stronger foe in space? Years ago (mid 90's) I saw a show on network TV, and I'm trying to figure out what the name of it was. The parts of the plot I remember are:   The crew consisted of 20-year-olds (half were women). They were on some mission when they lose their commander. They must then try to get back home, while being tracked down by a foe in a faster, more powerful ship. One of the main characters turns traitor. He's locked up in the brig pending a decision on his fate. He hangs himself, and his body is incinerated by the crew. One of the main characters plays a video game that basically looks like a visor over his face. While playing the game, he's given an idea on how to outwit their foe by using the laser cannon on their ship to create a holographic projection of a larger ship. In the end, they are about to be destroyed by a torpedo launched from the enemy ship.  The torpedo is destroyed by a laser beam from a friendly capital ship that arrives at the last moment.  I remember there being some sort of romance sub-plot to the show as well between two crew members.    Other non-plot details:   This was live action, not animated. I remember the special effects being quite high-end.   The guns on the ships were manipulated by a person sitting in a gunnery chair. This chair projected a holographic view of the fight in front of him/her. From there the gunner used a joystick and a keypad to control the weapons on the ship.  All the crew wore simple Star-Trek style uniforms throughout the entire program, so no jumpsuits or helmets.    I don't know if this was a movie or a TV show, because I never actually saw the beginning of it. I think I saw at least 45 minutes worth, so it could be either as far as I know.   That's all I remember, other than I think the name of the show was fairly generic (something like "Star Command"). I loved the show as a kid even though I only saw it once. I would like to watch it again and see how lame it really was. Inbox notification and reputation score is misaligned in mobile web view The inbox notification indicator and reputation score indicator are misaligned in the mobile web view. I'm having trouble getting basic APA bibliographies to work. The same thing works with nejm style, but changing the style to apa gives errors:  ! Undefined control sequence. &lt;argument&gt; \mkbibdateapalongextra  {year}{month}{day}\iffieldundef {endyear}{...  Package biblatex Warning: Macro 'name:apa:last-first' undefined. (biblatex)                Using \newbibmacro.  Package biblatex Warning: Macro 'name:apa:first-last' undefined. (biblatex)                Using \newbibmacro.   I'm using texlive 2012, as you can see I'm using biber, yes, I reran biber, and also tried delting the .bbl file and rerunning tools. My source markup is:  \documentclass[12pt]{article}  \usepackage[hidelinks]{hyperref} \usepackage[backend=biber,style=apa]{biblatex}  \addbibresource{BibResource.bib}  \begin{document}  test\parencite{ormrod2004human}  \clearpage  \printbibliography  \end{document} Mysterious! Beamer itemize has no bullets after adding a few packages this is my first time using beamer.  I copied a template from the sharelatex page on Beamer  Which works, and \begin{itemize} shows bullets     But after adding a few more packages that I need, all the bullets are gone!    What is going on and how can I fix this?  \documentclass{beamer}  \usepackage[utf8]{inputenc}    \usepackage{amsmath}  \usepackage{amsthm}     %Theorem Environment  \usepackage{amssymb}  \usepackage{multirow}  \usepackage{cancel}  \usepackage{amsfonts}  \usepackage{graphicx}  \usepackage{subfigure}  \usepackage{upgreek}     \usepackage{mathtools}  \usepackage{thmtools}  \usepackage{enumitem}       %Information to be included in the title page: \title{Sample title} \author{Anonymous} \institute{ShareLaTeX} \date{2014}  \begin{document}    \frame{\titlepage}    \begin{frame}  \frametitle{Sample frame title}  \begin{itemize} \item  This is a text in first frame.  \item This is a text in first frame. \item This is a text in first frame.  \end{itemize}  \end{frame}  \end{document} Large 10 kWh 18650 Lithium-ion power pack - What configuration? I need to build a 10 kWh lithium-ion pack, anywhere from 70 V to 200 V.  This is to drive a motor.  Power output will not exceed 15 kW.  The cells will be Panasonic NCR 'B' at 3.4 Ah 18650.  I would like to minimize space and weight and cost. :D  Level of safety would be standard for a hobby application.  Charging will be done in a safe area using two levels of overcharge and overcurrent protection.  Charging is from house current, 110V, and multiple chargers may be employed to double or triple the charge rate.   What is the best configuration for cells?  I would prefer if the pack is broken down into units of 1 to 2 kWh each.  Each unit may be charged separately. In addition to a balancing-protection board and a CCCV charger, what other protection or safety mechanisms are recommended, short of a smart BMS system? I have looked at a cheap Chinese balancing board that offers protection (thermal, overcharge, undercharge, overcurrent, short).  A 20S board will offer up to 84 V and adequate current for the application, for a 1.5 kWh unit.  At 1/3C, I would need a 83 V 6 A CCCV charger.  How do I get one of these? Off-topic question:  Can a balancing-protection board be used for a configuration with a lesser number of cells? Such as using a 10S board to control an 8S configuration.  Or does this depend on the board? Let $f: B(0,1) \rightarrow \mathbb{C}$ be holomorphic and suppose $\exists\ r \in (0,1)$ such that $f$ is injective in $A = \{z \in \mathbb{C} : r &lt; |z| &lt; 1\}$. Prove that $f$ is injective.  I tried using Rouché theorem, or the identity theorem, but I don't know what to do. Any hints? :) Adding shapefile or feature class as layer in ArcMap using ArcPy Video editing software options? What video editing software would you recommend on Ubuntu (or Linux in general) and why?  It can be for either beginners or experienced users.  Please only place one piece of software per response and include details to what makes it great!