i need to validate email like user@admin.state.in.us, its invalid   after @ symbol allow only (2 dots) xxx@xx.sk.au, not allow more then that.  any one can help  My code is:     $.validator.addMethod(          'email',         function(value, element){             return this.optional(element) || /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i.test(value);         },         "Verify you have a valid email address."     );
Over the years I have slowly developed a  that validates MOST email addresses correctly, assuming they don't use an IP address as the server part.  I use it in several PHP programs, and it works most of the time.  However, from time to time I get contacted by someone that is having trouble with a site that uses it, and I end up having to make some adjustment (most recently I realized that I wasn't allowing 4-character TLDs).  What is the best regular expression you have or have seen for validating emails?  I've seen several solutions that use functions that use several shorter expressions, but I'd rather have one long complex expression in a simple function instead of several short expression in a more complex function.
Change Folder Permissions How can I safely create a nested directory in Python? What is the most elegant way to check if the directory a file is going to be written to exists, and if not, create the directory using Python? Here is what I tried:  import os  file_path = "/my/directory/filename.txt" directory = os.path.dirname(file_path)  try:     os.stat(directory) except:     os.mkdir(directory)         f = file(filename)   Somehow, I missed os.path.exists (thanks kanja, Blair, and Douglas). This is what I have now:  def ensure_dir(file_path):     directory = os.path.dirname(file_path)     if not os.path.exists(directory):         os.makedirs(directory)   Is there a flag for "open", that makes this happen automatically? Flag as Broken Link I keep finding broken links in posts, currently I add a comment in the hope someone will return to update it or if I find a link I edit the answer.   I imagine this will only increase over time so I wonder if there could be a standard way to manage this?  My idea is adding a new flagging reason like "contains broken links", then it will go to a review queue where people will be able to have a look and fix the broken links. Paging SQL Server 2005 Results How do I page results in SQL Server 2005?  I tried it in SQL Server 2000, but there was no reliable way to do this. I'm now wondering if SQL Server 2005 has any built in method?  What I mean by paging is, for example, if I list users by their username, I want to be able to only return the first 10 records, then the next 10 records and so on.  Any help would be much appreciated. I have installed Ubuntu on my laptop and now I want to remove it and the Grub Loader. How I can do it without the Windows installation disk (I cannot use the Recovery Console). Just wanted some feedback to ensure I did not make any mistakes with this proof. Thanks!  Since $G$ is abelian, every subgroup is normal. Since $G$ is simple, the only subgroups of $G$ are $1$ and $G$, and $|G| &gt; 1$, so for some $x\in G$ we have $x\neq 1$ and $\langle x\rangle\leq G$, so $\langle x\rangle = G$. Suppose $x$ has either infinite order or even order. Then $\langle x^2\rangle \leq G$ but $\langle x^2\rangle \neq \langle x \rangle$, a contradiction. So $x$, and therefore $G$, has odd order, and by Feit-Thompson, $G\cong Z_p$ for some prime $p$.  Edit: Thanks, I see that Feit-Thompson is too much.  Since $G$ is abelian, every subgroup is normal. Since $G$ is simple, the only subgroups of $G$ are $1$ and $G$, and $|G| &gt; 1$, so for some $x\in G$ we have $x\neq 1$ and $\langle x\rangle\leq G$, so $\langle x\rangle = G$. Suppose $x$ has infinite order. Then $\langle x^2\rangle \leq G$ but $\langle x^2\rangle \neq \langle x \rangle$, a contradiction. So $x$, and therefore $G$, has finite order. Suppose $x$ has composite order $n$ so for some $p &gt; 1$ that divides $n$, $\langle x^p \rangle$ is a proper non-trivial subgroup of $G$, so $G$ is not simple. So $G$ is a cyclic group of prime order. Ubuntu Detects 2 monitors when I only have one Is there a printable version of a reference manual for all TeX primitives? error while loading shared libraries: libssl.so.1.1 (and libcrypto.so.1.1) As you can see I'm missing libcrypto and libssl files. I locked out myself from my server after running apt-update and apt-upgrade, I'm running this from web console, because ssh nor any other program won't work because of missing SSL files.  I tried removing and installing apt install openssl so did libssl-dev and/or compiling own openssl from a distro. None of these create the needed .so files, I ran locate, those files are not present anywhere on the server. There's also libssl1.0.0 which cannot be reinstalled and removing it would cause removal of 700MB of packages that would literally kill server and delete all data. Comparisons: "so [adjective/adverb] as" or "as [adjective/adverb] as" In Knuth's book "The Art Of Computer Programming Vol.1" there is a description about Euclid's algorithm to find the greatest common divisor of m and n.   And there is a phrase.     $m = qn+r$.  If $r = 0$, then $m$ is a multiple of $n$, and clearly in such a case $n$ is the greatest common divisor of $m$ and $n$. If $r \neq 0$, note that any number which divides both $m$ and $n$ must divide $m -qn =r$ , and any number which divides both $n$ and $r$ must divide $qn+r =m$.   I don't understand why any divisor of $m$ and $n$ must divide $m-qn =r$. Can the Room of Requirement provide anything if needed? For example:   James Potter wanted to hide from Voldemort, it would have served as a perfect hiding place. Harry Potter wanted all the Hocruxes, he should have gone straight to the room of requirement where he would have found all the Hocruxes along with the Sword. All the muggle borns of the wizarding community could have taken refuge in the room of requirement. Can someone meet a dead person in the room of Requirement if needed? Would it have been possible for Harry to go in past in order to see Dumbledore for the explanation of many things? Can the room duplicate something? For instance, Harry needed the Elder wand; with Voldemort having it, could he still get it? Someone wishes to be knowledgeable than Dumbledore, would the seeker find his desired wish by finding books and things?   Who created the room of requirement (surely not Salazar)? Was it beyond Dumbledore's magic to create such a place? This is one of the BibTex entries giving the problem:  @ARTICLE{2015ApJ...808L..36B,    author = {{Bonnivard}, V. and {Combet}, C. and {Maurin}, D. and {Geringer-Sameth}, A. and      {Koushiappas}, S.~M. and {Walker}, M.~G. and {Mateo}, M. and      {Olszewski}, E.~W. and {Bailey}, III, J.~I.},     title = "{Dark Matter Annihilation and Decay Profiles for the Reticulum II Dwarf Spheroidal Galaxy}",   journal = {\apjl}, archivePrefix = "arXiv",    eprint = {1504.03309},  primaryClass = "astro-ph.HE",  keywords = {dark matter, galaxies: dwarf, galaxies: individual: Reticulum II, gamma rays: galaxies, methods: statistical, stars: kinematics and dynamics},      year = 2015,     month = aug,    volume = 808,       eid = {L36},     pages = {L36},       doi = {10.1088/2041-8205/808/2/L36},    adsurl = {http://adsabs.harvard.edu/abs/2015ApJ...808L..36B},   adsnote = {Provided by the SAO/NASA Astrophysics Data System} }   and corresponding bbl file giving the error at compilation is  \bibitem{2009ApJ...697.1071A} {\sc W.~B. {Atwood}, A.~A. {Abdo}, M.~{Ackermann}, W.~{Althouse},   B.~{Anderson}, M.~{Axelsson}, L.~{Baldini}, J.~{Ballet}, D.~L. {Band},   G.~{Barbiellini}, and et~al.} \newblock {\bf {The Large Area Telescope on the Fermi Gamma-Ray Space Telescope   Mission}}. \newblock {\em \apj}, {\bf 697}:1071--1102, June 2009.   My guess is that Kile doesn't like references of the form 2015ApJ...808L..36B since these are the only ones giving the error.    Can somebody hint me to the problem in this? Thank you very much XmlInclude : List and array Why is the Finder app always open? First time Mac user. I am confused by the fact that the finder application is always open. For example, when switching apps with Cmd+Tab, it is always there, even when there are no windows opened for the app. Cmd-tabbing to Finder with no windows/tabs opened for it has no effect (it seems to me it would more intuitive to open a new tab when this action is chosen).   Furthermore, there is no 'Close app' option when I right click the Finder icon in the dock. Am I misunderstanding something about the Finder app? Is it required for proper functioning of Mac OS? From what I see, Finder is just a file browser, which by no means should be forced to be open 100% of the time. Print  only? How do I print the indicated div (without manually disabling all other content on the page)?  I want to avoid a new preview dialog, so creating a new window with this content is not useful.  The page contains a couple of tables, one of them contains the div I want to print - the table is styled with visual styles for the web, that should not show in print. tikz declare function and babel french option Problems with Curve Modifier Every time I think I have the curve modifier mastered, it throws me a another curve ball (no pun intended).  Why in  can I not get the lights to follow the spiral curve? When the modifier is activated, the lights are stretched and distorted along the curve.  I created the curve by converting it from a mesh (string of verts). Why does it not display like a normal Bezier? Is that related to my problem?  I am following all the "rules" that I am aware of, as detailed here: . The curve seems to run in the correct direction. The origin point is at the first point of the curve. The curve modifier on the lights is set to -Y which is the local orientation of the curve's direction.  What am I missing? I have a regular C# code. I have no exceptions. I want to programmatically log the current stack trace for debugging purpose. Example:  public void executeMethod()  {     logStackTrace();     method(); } How to stop mysql from running at boot time? Currently, my MySQL server starts on every server boot. For a couple reasons, this is undesirable behavior. Is there a way to disable this behavior?