I am trying to parse a String to Long which sometimes starts with 0. I want that the result maintains the "0" at the beginning of the Long (e.g. 0247484 instead of 247484).  I have tried this Long.parseLong(city.getId()) but it deletes the first "0".  Thank you
Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something)  static String intToString(int num, int digits) {     StringBuffer s = new StringBuffer(digits);     int zeroes = digits - (int) (Math.log(num) / Math.log(10)) - 1;      for (int i = 0; i &lt; zeroes; i++) {         s.append(0);     }     return s.append(num).toString(); }
How can I pass arguments to a batch file? How to make a safe in vanilla Minecraft that locks and unlocks with a key? How can I make a safe/vault or something to lock my door that is very easy (as I am not that advanced with redstone) to keep people out of my house? Without mods? Force MacBook to drain the battery while connected to charger I leave my MacBook Pro on my desk nearly all the time, connected to the charger with the lid closed, connected to an external display.  I've heard this is bad for the battery health, and everyone in my office have to replace swollen batteries every couple of years. I want to regularly discharge the battery, per , but I don't want to physically unplug it because that temporarily turns off the external monitor, and then I have to reconnect the monitor.  So I am looking for a software method of disabling the power input, to force the laptop to discharge its battery to 20% and then re-enable the power input. Square roots -- positive and negative I've just started playing with Guice, and a use-case I can think of is that in a test I just want to override a single binding.  I think I'd like to use the rest of the production level bindings to ensure everything is setup correctly and to avoid duplication.  So imagine I have the following Module  public class ProductionModule implements Module {     public void configure(Binder binder) {         binder.bind(InterfaceA.class).to(ConcreteA.class);         binder.bind(InterfaceB.class).to(ConcreteB.class);         binder.bind(InterfaceC.class).to(ConcreteC.class);     } }   And in my test I only want to override InterfaceC, while keeping InterfaceA and InterfaceB in tact, so I'd want something like:  Module testModule = new Module() {     public void configure(Binder binder) {         binder.bind(InterfaceC.class).to(MockC.class);     } }; Guice.createInjector(new ProductionModule(), testModule);   I've also tried the following, with no luck:  Module testModule = new ProductionModule() {     public void configure(Binder binder) {         super.configure(binder);         binder.bind(InterfaceC.class).to(MockC.class);     } }; Guice.createInjector(testModule);   Does anyone know if it's possible to do what I want or am I completely barking up the wrong tree??  --- Follow up: It would seem I can achieve what I want if I make use of the @ImplementedBy tag on the interface and then just provide a binding in the test case, which works nicely when there is a 1-1 mapping between the interface and implementation.  Also, after discussing this with a colleague it would seem we'd head down the road of overriding an entire module and ensuring we have our modules defined correctly.  This seems like it might cause a problem though where a binding is misplaced in a module and needs to be moved, thus possibly breaking a load of tests as bindings may no longer be available to be overriden. GIS Point or discrete longitude and latitude columns? I see that the Point type is made to store geometric coordinates, however I don't see what problem it is trying to solve, or what advantages it offers over simply using two numerical columns. It's 16 bytes, so is it just an abstraction for two 8 byte floats? Or is it a string containing some kind of geohash that optimizes the performance of certain queries?  Let's say I want to get all the points for a specific viewport on a Leaflet map... with numerical columns representing latitude and longitude, I'd just filter for all the rows that have a latitude number between the N/S bounds and a longitude number between the E/W bounds, easy. I looked into using Point here, but the syntax is cumbersome and it seems to me like unnecessary overhead for development and for database performance... is it? Voldemort couldn't kill Harry as long as he called the Dursleys home. Why didn't he just murder the Dursleys? This would prevent Harry from being able to live there. While rendering a mesh with smooth shading on, I get a dark region/shadow on certain faces. The effect is more evident when smooth shading is applied to a mesh containing ngons, with the ngons turning black when rendered.   The blackening effect is visible in the viewport too.  How can I solve this problem? Where in the world is tikzlibraryhobby.code.tex? I was trying to reproduce Claudio Fiandrino's answer to .  However, I do not have the hobby package by Andrew Stacey in my local distribution.  After reading  and , I looked at the latest  (build on December 7, 2012) but could not located the hobby package in it.  I found  but do not know where each file is supposed to go in my distribution.  How do I add the hobby package? In general, what would be the easy way to get any new TikZ package installed in a Mac?  EDIT:  I have used the drag-and-drop (mac) method as described below.  (1) Drag pml3array.sty file to /Users/Username/Library/texmf/tex/latex folder. (2) Drag hobby.code.tex file to /Users/Username/Library/texmf/tex/generic/pgf/math folder. (3) Drag pgflibraryfpu.code.tex to /Users/Username/Library/texmf/tex/generic/pgf/libraries folder. (4) Drag tikzlibraryhobby.code.tex to /Users/Username/Library/texmf/tex/generic/pgf/frontendlayer/tikz/libraries folder.  I no longer get the hobby cannot be found error message.  But, is this correct? Is there a video that explains how Stack Overflow works and can be used? Is there a video that explains how Stack Overflow works and can be used? I.e. a short tutorial to get new users started. If there isn't, then the people behind this site or others who know how it works should make one, because it's overwhelmingly different from other sites and thus difficult for beginners. Fundamental Theorem of Algebra - an elementary complex analysis proof? We begin by assuming that a non-constant complex polynomial $$p(z)=a_n z^n+a_{n-1}z^{n-1}+...+a_1 z+a_0,$$ where $a_0 \neq 0$, doesn't vanish in $\mathbb{C}$. Therefore $1/p$ is also an analytical function everywhere. Note that $(p(z)-a_0)/z$ is a polynomial and therefore, due to Cauchy's theorem, the following integral must be zero.  $$\int_{S_r^1}\frac{(p(z)-a_0)/z}{p(z)}dz=\int_{S_r^1}\frac{a_nz^{n-1}+a_{n-1}z^{n-2}+...+a_1}{a_nz^n+a_{n-1}z^{n-1}+...+a_1 z+a_0}dz=0.$$  On the other hand  $$\int_{S_r^1}\frac{a_nz^{n-1}+a_{n-1}z^{n-2}+...+a_1}{a_nz^n+a_{n-1}z^{n-1}+...+a_1 z+a_0}dz$$  $$=\int_{0}^{2\pi}\frac{a_n(re^{i\theta})^{n-1}+a_{n-1}(re^{i\theta})^{n-2}+...+a_1}{a_n(re^{\theta})^n+a_{n-1}(re^{i\theta})^{n-1}+...+a_1 (re^{i\theta})+a_0}(ire^{i\theta})d\theta$$  $$=\int_{0}^{2\pi}i d\theta - \int_{0}^{2\pi}\frac{a_0 i}{a_n(re^{i\theta})^n+a_{n-1}(re^{i\theta})^{n-1}+...+a_1 (re^{i\theta})+a_0}d\theta$$ $$=2\pi i -\int_{0}^{2\pi}\frac{a_0i}{p(re^{i\theta})}d\theta.$$  Let $r \rightarrow \infty$ and the integral approaches value $2\pi i$ - a contradiction. Therefore $1/p$ can't be entire and $p$ must vanish somewhere in the complex plane.  EDIT: I have changed this post and deleted the idea that the integral $\int_{\partial D_r}\frac{(p(z)-a_0)/z}{p(z)}dz=0$ could be evaluated with the fundamental theorem of calculus. Now, as it stands, this proof is essentially the same as the one that Mr. José Carlos Santos points out in his comment. In , one learns two definitions of free groups associating with sets.        Let $A$ be a set, the free group of $A$, $F(A)$ is the initial object in the category $\mathcal{C}$, where \begin{equation} \operatorname{Obj}(\mathcal{C})=\{A\xrightarrow{g}G\}, \end{equation}where the codomain $G$ are groups, and \begin{equation} \operatorname{Hom}(\mathcal{C})=\{\text{Commutative Diagrams } A\xrightarrow{g_1}G_1\xrightarrow{\phi}G_2\xleftarrow{g_2}A\}  \end{equation} where $\phi$ are group homomorphisms.   Also $F(A)$ has the concrete construction with elements being non-redundant words with alphabet $A$, and the group multiplication being juxtaposition and reduction.      But what good are free groups? Why are they useful?  says they are useful in topology, but does not explain why explicity.   Can someone give some examples that an undergraduate can understand? I am asking about examples that can show the usefulness of this abstract construction. So I guess the identification of $\mathbb{Z}=F({a})$ does not really count. Unable to locate package TSA broke a lock for which they have a master key. How can I claim compensation? Usage of "they" / "them" / "their" when the person's gender is not known I know that one can use "they" / "them" / "their" in place of "he" / "him" / "his" or "she" / "her" / "hers" when the subject's / direct object's gender is not known; for instance, just looking at the default user's about me section on Stack Exchange sites:     Apparently, this user prefers to keep an air of mystery about them   My question is what happens when someone wants to reference the subject using a pronoun instead.  Should the verb be conjugated accordingly to the pronoun? E.g.:     Apparently, they prefer to keep an air of mystery about them   Or should the conjugation be retained? E.g.:     Apparently, they prefers to keep an air of mystery about them   The former looks unclear because it wouldn't allow the reader / listener to understand if the writer / speaker is talking about a single person or about a group of people, however the latter sounds very weird, at least just to the non-native speaker which I am. A novel where a woman from "future" of 1999 speaks leet-speak A property of every real polynomial. Question: For every polynomial $P(x)$ of degree at n we have $$\sum_{i=0}^{n+1}(-1)^i\binom{n+1}{i}P(i)=0$$  Well I was inducting on degree of the polynomial, for $n=0$ its true and I got a bit confused in the inductive step, actually I cant figure the inductive step.   Is this property (if true) a famous one?  Thank you for your help. Shouldn't this table span the whole page width? I have this table definition as part of a invoice  \begin{tabularx}{\textwidth}[ht]{lXrr}%   It worked fine for years until I have a very short word in the X column for the first time. Now my table is very small in width and centered horizontally on the page.  In my expectation the X column should fill up all space until the width of the table reaches the width of the page except the margins.  I have read about workarounds specifying something like 1.2\textwidth, but I don't like that, because the table is a template included via \include, so it would affect all my invoices.  I also tried \linewidth, \hsize and \columnwidth, but everything results in the same layout.  Is there a way to make the only X column expand so that it uses all available space?    Complete included table definition (Rechnungstabelle.tex):  \newcommand{\Rechnungstabelle}[4]{% vielen Dank für Ihren Auftrag. \noindent \begin{tabularx}{\textwidth}[ht]{lXrr}% \toprule% \bf{Anzahl} &amp; \bf{Bezeichnung} &amp; \bf{Einzelpreis} &amp; \bf{Gesamtpreis} \\% \midrule% #1% \bottomrule% &amp; \bf{Rechnungsbetrag}  &amp; &amp; \bf{\EUR{#2}} \\% \ifthenelse{\equal{#3}{}}{}{&amp; Enthaltene MwSt. 19\% &amp; &amp; \EUR{#3} \\}% \ifthenelse{\equal{#4}{}}{}{&amp; * Enthaltene MwSt. 7\% &amp; &amp; \EUR{#4} \\}% \end{tabularx}% }   Changing the table header row to  \bf{Anzahl} &amp; \bf{Bezeichnung} \hspace{\textwidth} &amp; \bf{Einzelpreis} &amp; \bf{Gesamtpreis} \\%   is a workaround, but I don't think that would be good TeX style.  Minimum example for reproducing:  \documentclass[ fontsize=12pt,                  paper=a4,                 foldmarks=TBMPL,                 fromalign=center,                 ngerman                 ]{scrlttr2} \usepackage{babel} \usepackage[utf8]{inputenx} \usepackage[right]{eurosym} \usepackage{tabularx} \usepackage{ltablex} \usepackage{booktabs} \usepackage{ifthen}  \input{Rechnungstabelle} \begin{document} \begin{letter}  \Rechnungstabelle{     1,0 h &amp; Do something &amp; \EUR{99,00} &amp; \EUR{99,00} \\      }     {99,00}     {}{} \end{letter} \end{document} Looking for an intuitive explanation why the row rank is equal to the column rank for a matrix How is Gauss' Law (integral form) arrived at from Coulomb's Law, and how is the differential form arrived at from that?