I need to check whether the String is an Integer. And I found such solution:  private boolean isInteger(String str) {     try {         Integer.parseInt(str);         return true;     } catch (NumberFormatException e) {         return false;     } }   Is there a more beautiful and proper way to do this without try/catch clause?
I normally use the following idiom to check if a String can be converted to an integer.  public boolean isInteger( String input ) {     try {         Integer.parseInt( input );         return true;     }     catch( Exception e ) {         return false;     } }   Is it just me, or does this seem a bit hackish?  What's a better way?    See my answer (with benchmarks, based on the  by ) to see why I've reversed my position and accepted  to this problem.  I think this original code will be used by most people because it's quicker to implement, and more maintainable, but it's orders of magnitude slower when non-integer data is provided.
If diary Tom Riddle had succeeded, would there have been two Voldemorts? Can I travel to the UK unaccompanied on an accompanied child visa now that I am over 18? I got a visa with my mother when I was 17 years old. On it was stated "Not valid unless accompanied by my mother".    Can I travel to the UK alone now that I am 18? Make "compact view" as a default directory view instead of "icon view" How can I make "compact view" the default for all directory views in File Manager, instead of "icon view" ? I'm writing a set of course notes that has an appendix containing many activities.   I do not wish the activities to be shown in the Table of Contents, but I do wish them to be numbered. Here is the solution I was using:  In the preamble:  \newcommand{\activity}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}   and now my "activity" starts out with:  \newpage \activity\section{A Fun Educational Activity}   There is only one problem. The activity starts out indented, as opposed to not indented, as a section should be.   How do I make my activity start out without an indent?  I realize I could simply add \noindent but it seems to me that there should be a more elegant solution. How can I search an Excel spreadsheet in SharePoint? Looking to be able to search an Excel spreadsheet from the SharePoint mobile app.  I have a spreadsheet with Postal Codes/Zip Codes with corresponding information. I would like to be able to search as you would in Excel.  When I upload a test spreadsheet, it opens as like a PDF. User has "Read" permissions for the document library the spreadsheet is located in.  Thanks in advance, Prove that negative absolute temperatures are actually hotter than positive absolute temperatures Could someone provide me with a mathematical proof of why, a system with an absolute  (such that of a spin system) is  than any system with a positive temperature (in the sense that if a negative-temperature system and a positive-temperature system come in contact, heat will flow from the negative- to the positive-temperature system). "I want you succeeding" vs. "I want your succeeding" I am happy seeing you succeed.   I am happy to see you succeed.   I want you to succeed.   I want you succeeding. I want your succeeding.  Could you please explain the differences between them, and the first and second examples independently of each other? What is the easiest way to parse an INI File in C++? I'm trying to parse an INI file using C++. Any tips on what is the best way to achieve this? Should I use the Windows API tools for INI file processing (with which I am totally unfamiliar), an open-source solution or attempt to parse it manually? How can I have a Linux machine join a Windows Domain? Sorry if I am misusing terms here; I actually don't know much about Active Directory and the related technologies.  Basically I have a Linux computer and I'd like it (or my user on that computer) to be associated with my user on the Domain, so that I can browse the network and all that stuff windows has.  Is this feasible?  What do I need to look into to do something like this? Are black holes in a sense transparent? Meaning, they don't 'hide' any stars that happen to be 'behind' them?  A regular object obviously blocks a point source of light emanating from 'behind' it. Meaning it creates an area of space photons cannot get to us from. But a massive object curves space, and so via gravitational lensing we can sometimes see distant stars that are 'behind' other stars (by behind I mean that if the star in the middle would suddenly vanish, the trajectory of photons traveling from the distant star to Earth would have passed through the volume now occupied by the middle star).  My thinking, is that black holes curve space so much, that from ANY source of light outside it, light has a trajectory to reach us on Earth (assuming of course no other object blocks it on its way).  The reasoning for this is: Suppose we draw the straight line between us and the light source (as if the black hole wasn't there at all). Photons from our light source crossing the event horizon would obviously 'fall' inside. A photon in theory traveling exactly tangent to the event horizon would in a sense go 'into orbit' around the black hole (obviously there is no such thing, because the black hole isn't perfectly spherical, and there are quantum effects and so forth. But I'm focusing on the geometry), crossing our straight line exactly at the intersection of our line and the event horizon. Any photon passing near the event horizon, but a bit farther, would follow a curve that intersects our line a little farther from the event horizon. Continuing this, there would be at last be a photon that would exactly curve our way. Show a,b,c congruences when $a^2+b^2=c^2$ i would like to know how to prove that if $a^2+b^2=c^2$ then   a) $3|a$ or $3|b$  b) $5|a$ or $5|b$ or $5|c$  c) $4|a$ or $4|b$   Also that $a^2+b^2+c^2+1$ can't be divisible by 8  Thank you very much! How do you prove a number is prime? I am a software engineer but try to keep up with maths as I really enjoyed the subject at school. I just saw a great TED talk:   The talk states that the current largest known prime is $2^{57885161}-1$  This got me thinking - how does one actually prove whether a number this large is prime or not?  Is it just done by brute force via a computer algorithm or are there any well known mathematical techniques for doing so?  I would be really grateful for any pointers as I am eager to learn about these techniques (if they exist). If $M$ is an $R$-module and $I\subseteq\mathrm{Ann}(M)$ an ideal, then $M$ has a structure of $R/I$-module Let $M$ be an $R$-module and let $I$ be an ideal of $R$ such that $I$ is a subset of $\mathrm{Ann}(M)$. Define a product of an element of $R/I$ by an element of $M$ as follows: $$(r+I)\cdot m=rm.$$ (a) Show that this product is well defined. (b) Show that this product, together with the sum of elements of $M$, turns $M$ into an $R/I$-module.  My answer for (a): Let $r+I,s+I \in R/I$ such that $r+I=s+I$. Then $(r+I)m=(s+I)m$, for all $m \in M$. Then $rm=sm \implies r=s$  (since the inverse of $m$ is in $M$), so the product is well defined.  Is my answer to (a) correct?  How can I use Ann(M) to answer (b)? Is there a way to make a fullscreen on VirtualBox? I tried many ways to make a bigger screen in VirtualBox because I do not like the small size of the guest window? Is there is a way to make it big? I am trying to calculate the sum of this infinite series after having read the series chapter of my textbook: $$\sum_{n=1}^{\infty}\frac{1}{4n^2-1}$$  my steps:   $$\sum_{n=1}^{\infty}\frac{1}{4n^2-1}=\sum_{n=1}^{\infty}\frac{2}{4n^2-1}-\sum_{n=1}^{\infty}\frac{1}{4n^2-1}=..help..=sum$$  I am lacking some important properties, I feel I am coming to the right step and cannot spit that out.. Is it possible to shutdown remote Computers without inputing the password? I used the following bash to shutdown remote computers,but for each computer,I must input the password for it.Is it possible to input the password Automatically?   #!/bin/bash  ssh -t root@192.168.1.11 "sudo poweroff" ssh -t root@192.168.1.12 "sudo poweroff" ssh -t root@192.168.1.13 "sudo poweroff" ssh -t root@192.168.1.14 "sudo poweroff" ssh -t root@192.168.1.15 "sudo poweroff" ssh -t root@192.168.1.16 "sudo poweroff" ssh -t root@192.168.1.17 "sudo poweroff" ssh -t root@192.168.1.18 "sudo poweroff" ssh -t root@192.168.1.19 "sudo poweroff" ssh -t root@192.168.1.20 "sudo poweroff" ssh -t root@192.168.1.21 "sudo poweroff" ssh -t root@192.168.1.22 "sudo poweroff" ssh -t root@192.168.1.23 "sudo poweroff" ssh -t root@192.168.1.24 "sudo poweroff" ssh -t root@192.168.1.25 "sudo poweroff" ssh -t root@192.168.1.26 "sudo poweroff" Lightning Web Component embedded in Visualforce Page via Aura Component and App not displaying I am writing a lightning web component that is going to be used in Salesforce Classic, Lightning Experience and an Employee Community. It does not HAVE to be a lightning web component - I could use a traditional Aura Lightning Component if I must.   However, what I am finding is that the visualforce page does not work, even when the lwc component is embedded in a aura component that is then used with Lightning Components for Visualforce. I can see from the documentation  that using a lwc directly from within visualforce is not supported, but I was under the impression that it may work if wrapped in an aura component.   My question then is this:  Has anyone had success having a lwc wrapped in an aura component display successfully within Visualforce? Or is this completely unsupported behaviour? In the Pottermore article on  it's mentioned that other fractional platforms exist (7 1/2, for instance). Is it ever stated elsewhere where these platforms lead? Perhaps you could get a connection from your hometown by accessing one of these platforms? Are there any add-ons that will cause a browser to automatically refresh a page when a particular file changes on disk? According to this , if at least one of the nouns involved is plural then it should take the plural form of the verb. Otherwise, it should take the singular form of the verb. But in the last part it says not all grammars agree to those rules thus proximity rule applies. However, it doesn't explain when to apply the proximity rule and when not to use the former rules.