Exception Handling vs manually checking the condition
When to throw an exception?
I've been perusing the internet looking for interesting problems to solve. I found the following problem and have been going at it for the past 30 minutes with no success:     Find a function $f: \mathbb{R} \to \mathbb{R}$ satisfying $f(f(x)) = -x$ for all $x \in \mathbb{R}$.   I am also wondering, can we find $f$ so that is continuous?  I was thinking of letting $f$ be a periodic function, and adding half the period to x each time. I had no success with this, and am now thinking that such a function does not exist.  Source: What's a word for lack of confidence? Is it possible to have connecting loop lines (like algorithm2e) in algorithmic? How to enable MySQL client auto re-connect with MySQLdb? I came across PHP way of doing the trick:  my_bool reconnect = 1; mysql_options(&amp;mysql, MYSQL_OPT_RECONNECT, &amp;reconnect);   but no luck with MySQLdb (python-mysql).  Can anybody please give a clue? Thanks. Finding $\frac {d(\tan \theta)}{d\theta}$ Importing 3D DXF file into QGIS with z information as attribute value? I have a dxf file of 3d contours. after import it does have only  layer,x,y attribute and doesn't have Z attribute.  How can I provide Z attribute to create a TIN file? When I try to play multiplayer I type in the only server I know, which the game says was right, then click Play and it loads. Then it says Can't connect to server: bad log in. How can I fix this? What are the survival limitations of alcohol? This question was inspired by watching one of the Pirates of the Caribbean movies; particularly where Jack Sparrow allegedly survives on a desert island by finding an unlimited supply of rum. I've heard alcoholic drinks dehydrate you more than hydrate you, so this seems like an unsustainable strategy.  My question is threefold.    How long can a human survive by drinking hard liquor (40% alcohol by volume) for their sole water intake (ignoring food)? If it's unsustainable, what will finally take you down? If the hard-liquor approach isn't viable, what % alcohol can keep you hydrated (beer, wine, etc.)?   Related: 1.  2. Live search through table rows What to do when you find a bad link in an answer? If a link has gone stale in an answer, what is the correct way to report this in the SO universe?  e.g. Jon's first link in    I have added a comment but not found the correct link yet. Why is $L^{\infty}$ not separable? Why "?v=hash" is added to my URLs? I'm new to wordpress, I set up everything, but there's something that bothers me: on every single URL or link, there's a "?v=hash" appended everywhere (example.com/?v=d21feabed96b).  I tried to see inspect every plugin, I don't understand how this parameter is added.  It looks like it's added in js, because if I see the source, there's no trace of this hash, but I can see in firebug live source.  Plugins installed:   jetpack sumome wp-piwik wp super cache woocommerce   Theme: Storefront  I tried to disable everything, but still I get this hash, does anyone knows how and why it's added?  I'm also using cloudflare Show/Hide CSS Ignored When Inside an SLDS Grid Column Proper use of passive and active voices? When hyperref is loaded I receive the following error:     TeX capacity exceeded, sorry [input stack size=5000].   However, when I remove hyperref package it compiles successfully. I traced it back and found that \maketitle causes the error but don't know how to fix it. Is there any way to use hyperref in my setup.   Code:       %!TEX TS-program = xelatex     \documentclass[journal,transmag,]{IEEEtran}      \usepackage[hyphens]{url}     \usepackage{hyperref}      \usepackage{xunicode}      \usepackage{fontspec}      \usepackage{polyglossia}     \setmainlanguage{english}     \setotherlanguage{arabic}     \newfontfamily\arabicfont[Script = Arabic]{Amiri} % Replace 'Simplified Arabic' with a font from your system       \begin{document}     \title{A Very Nice Title}      \author{\IEEEauthorblockN{             John Doe\IEEEauthorrefmark{1}}%,~\IEEEmembership{Member,~IEEE}         \IEEEauthorblockA{\IEEEauthorrefmark{1}My address}         % &lt;-this % stops an unwanted space         \thanks{Manuscript received mm dd, 20xx; revised mm dd, 20xx.               }     }      % The paper headers     \markboth{headers...}%     {Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for IEEE Transactions on Magnetics Journals}      \IEEEtitleabstractindextext{%         \begin{abstract}My Abstract.\end{abstract}          % Note that keywords are not normally used for peerreview papers.         \begin{IEEEkeywords}             Key 1, Key 2     \end{IEEEkeywords}}      \maketitle       \IEEEdisplaynontitleabstractindextext     % \IEEEdisplaynontitleabstractindextext has no effect when using     \IEEEpeerreviewmaketitle       \section{Introduction}     English Text      \begin{Arabic}      السَلَامُ عَلَيكُمْ     \end{Arabic}       \end{document} How many switches can be stacked/interconnected? Not sure if there is a cultural difference. In our family it is considered normal to frighten the child so that he behaves the way we want.  Example- Parent: Eat that quickly or the God will punish you! Parent: Don't go on the stairs. The ghost is hiding there and it'll catch you! Parent: Be quiet or the police will grab you!  Does this kind of behavior from the parent's side has any abnormal effects on the baby in the longer run? Can this behavior be accepted as normal?  Has any research been done on this aspect? Let $\alpha = \frac{1+\sqrt{-19}}{2}$. Let $A = \mathbb Z[\alpha]$. Let's assume that we know that its invertibles are $\{1,-1\}$. During an exercise we proved that:     Lemma: If $(D,g)$ is a Euclidean domain such that its invertibles are $\{1,-1\}$, and $x$ is an element of minimal degree among the elements that are not invertible, then $D/(x)$ is isomorphic to $\mathbb Z/2\mathbb Z$ or $\mathbb Z/3\mathbb Z$.   Now the exercise asks:     Prove that $A$ is not a Euclidean Domain.   Everything hints to an argument by contradiction: let $(A, d)$ be a ED and $x$ an element of minimal degree among the non invertibles we'd like to show that $A/(x)$ is not isomorphic to $\mathbb Z/2\mathbb Z$ or $\mathbb Z/3\mathbb Z$.  How do we do that? My problem is that, since I don't know what this degree function looks like, I don't know how to choose this $x$!  I know that the elements of $A/(x)$ are of the form $a+(x)$, with $a$ of degree less than $x$ or zero. By minimality of $x$ this means that $a\in \{0, 1, -1\}$. Now I'm lost: how do we derive a contradiction from this? Refresh Icon Cache Without Rebooting Normally, to refresh the icon cache in Windows, we have to reboot.  Is there a way to refresh the icon cache in Windows 7/8 without rebooting? PostgreSQL, SELECT from max id