I want to check the internet connection when sending an ajax request and I'm not using the javascript library offline. I thought of 3 methods in doing this. I want to know if they are reliable. 1- In the first method, I check if the connection is online using navigator.onLine inside beforeSend function if not online I return false from the function which stops the execution of ajax. But I read that using navigator.onLine is not reliable. $.ajax({             url: '../write.php',             type: 'POST',             data: object,             cache: false,             beforeSend: function() {                 $('#overlay').fadeIn(300);                 if(!navigator.onLine){                     return false;                 }             },             success: function(returnArr) {                 $('#overlay').fadeOut(300);             },             error: function() {                 $('#overlay').fadeOut(300);             },             timeout: 5000,         });  2- Second is using the error function in the ajax to check for internet connection. I don't have an idea to implement this. $.ajax({             //...Content similar to the last one             error: function() {                 //Show the network error             },         });  3-Third is using the javascript 'online' and 'offline' event listeners to update some variables. Using that variable as a check before calling ajax. And I want to know if this method if compatible in all browsers. online = true; window.addEventListener('offline', (event) =&gt; {     online = false; });  // onoffline version window.onoffline = (event) =&gt; {   online = true; };  online = //boolean based on the eventlisteners if(online){   ajax(); }  Out of these methods which is the best or is there a better solution to this problem. I am relatively new to javascript. Thank you for your help.
How to detect the Internet connection is offline in JavaScript?
Suppose $n$ is a non negative integer $\geq 4$ and $\sigma\in S_n$ a permutation. Conjugacy classes in $S_n$ are completley determined by the cycle structure of $\sigma$. If we let the alternating group $A_n$.act on $S_n$ by conjugation, the orbits coincide with the conjugacy classes in $S_n$ except for those (even) permutations whose cycle structure is composed of even cycles (which corresponds to cycles of uneven length) of distinct order (fixed points are treated as cycles of length $1$.) See   For instance a $3$-cycle in $A_4$ has cycle structure $[3,1]$ which fits the bill, and a $5$-cycle in $A_5$ or $A_6$ works too, since the cycle structure is $[5]$ and $[5,1]$ respectively. On the other hand, a $3$-cycle in $A_5$ will does not satisfy the criteria as it has cycle structure $[3,1,1]$ with two fixed points.  In this case, the conjugacy class of $\sigma$ inside $S_n$ splits in $2$ orbits of the conjugation action of $A_n$, and if $\tau$ is any odd permutation, for instance $(12)$, then we have $$\mathrm{Conj}_{S_n}(\sigma)=\mathcal{O}(\sigma)\coprod\mathcal{O}(\tau\sigma\tau^{-1})$$  My question is How can we differentiate between the two orbits? Does it have geometric meaning?    I can see that this information can be useful when looking at representations of the alternating groups, since there are as many irreducible representations as conjugacy classes. As for some geometric interpretation, I ask because there is one for the three cycles in $A_4$. If $S_4$ is understood as the group of symmetries of a regular tetrahedron, then $A_4$ is the subgroup of direct symmetries, and a $3$-cycle corresponds to a rotation of angle $\frac{2\pi}{3}$ or $\frac{4\pi}{3}$ with axis passing through one of the vertices. Conjugacy classes inside $A_n$ preserve the angle, and that's how we can tell them apart. In this case the computations are so simple we don't really need this picture, but I think it is a nice way to understand the fact $3$-cycles in are not all conjugate inside $A_4$... I've become very accustomed to managing service startups on Redhat/RHEL platforms using chkconfig though that doesn't appear to be the Debian/Ubuntu way - How do I update runlevel information for system services on Ubuntu?  Ultimately looking for the equivalents of:  chkconfig --add &lt;service&gt; chkconfig --level 345 &lt;service&gt; on chkconfig --del &lt;service&gt; Synthetic division of polynomials by factor of the form $(ax+b)$ An alternative to translation for non-English speakers? How to make a series of rectangles follow a pen path I am trying to get a series of shapes (rectangles) to follow a path (sine wave) that I made with the pen tool, but I have no clue how to do that or if it is possible.   I have tried warping a rectangle into the sine wave path, but it takes many different warped rectangles and it isn't smooth.  I thought  might work for rectangles, but it only works for text. Discovering new features Let $f:\mathbb{C} \rightarrow \mathbb{C}$ be a entire function. Suppose that there are $M$, $r&gt;0$ and $n\in \mathbb{N}$ such that $\left|f(z)\right|&lt;M\left|z\right|^n$ for all $z \in \mathbb{C}$ with $\left|z\right|\geq r$.  Show that $f$  polynomial of degree at most $n$.  Remark: I tried to follow the proof of Liuville's Theorem but I have complications with the condition  $\left|z\right|\geq r$.. I want to put a table and a figure side-by-side. The table should fill two third of the text width, and the figure the last third.  So I'd like to achieve one of the following effects (which are equivalent in my case):   One table with 3 columns. The first two columns contain text, the third column contains a lengthy image. The height of the image should be determined by the height of the whole table, if that's possible Or, a divided page like in newspapers. On the left side I have the table, on the right side the image.   What I have tried:  \begin{multicols}{2} \begin{tabular}{ l l } Text &amp; Text \\ Text &amp; Text \\ ... &amp; ... \\ \end{tabular} \vfill \begin{figure}[H]     \includegraphics[]{images/image} \end{figure} \end{multicols}   But this places the picture directly on top of the table.  I also tried using \usepackage[export]{adjustbox} and \includegraphics[right]{images/image} but the caption is still in the center of the page and therefor on top of the table. Is it possible to install an earlier version of Skype on Windows 8? What is the geometric interpretation of the transpose? Store pictures as files or in the database for a web app? My question is fairly generic and I know there might not be an 100% answer to it. I'm building an ASP .NET web solution that will include a lot of pictures and hopefully a fair amount of traffic. I do really want to achieve performance.  Should I save the pictures in the Database or on the File system? And regardless the answer I'm more interested in why choosing a specific way.  Many thanks, Stefan   DUPLICATE: , ,  and probably some others.    COMMENT: Thanks for many good answers. I will go for a file based solution even if I like the idea of having a 100% database driven solution. It seems that there are today good solutions to do what I want with databases etc but I have a few reasons for not doing it.   I will be on a hosted solution, I have huge amount of storage(10gb) but only 300mb for the database. It will cost a lot for extra storage in the DB. I'm not an DB expert and as well not in control of settings of the DB. A DB based solution might need custom configuration as it looks like.   If we will move to run the site on our own server I might consider a DB based solution. thanks, Stefan For each $y \in \mathbb{R}$ either no $x$ with $f(x) = y$ or two such values of $x$. Show that $f$ is discontinuous. How do I remove duplicate "Open With" context menu items in Finder.app? For whatever reason, the "Open With" context menu in Finder is always listing every app four times (exactly).     I've read about (and tried) rebuilding the Launch Services database to restore the context menu to its initial state, but nothing seems to work. I've also used Onyx.app to clear user and system caches, but I'm still left with four repetitions of each app under the "Open With" service. I have restarted the system a few times just to be sure it was not some temporary corruption of the list.  I'm running OS X 10.6.6 on a 2011 17" MacBook Pro with a fresh install of OS X (i.e. I didn't use Migration Assistant.app or a Time Machine backup). I did, however, sync all my preferences and other files using MobileMe like I always do, so I imagine it's feasible that a preference file somewhere is causing problems? I didn't notice whether this was happening before or after my MobileMe sync.  How can I fix this so one app shows? Cannot use polyglossia/babel with biblatex in LuaTeX: etoolbox Toggle undefined This is an example test.tex document. Both babel and polyglossia failed and produce the same error: \documentclass{book}  %\usepackage[vietnamese]{babel} \usepackage{polyglossia} \setdefaultlanguage{vietnamese}  \usepackage{biblatex}   \title{Sth}  \begin{document}  \maketitle  \end{document}   is the full log. And my config for VS Code: &quot;latex-workshop.latex.recipes&quot;: [     {         &quot;name&quot;: &quot;lualatex-&gt;biber&quot;,         &quot;tools&quot;: [             &quot;lualatex&quot;,             // &quot;biber&quot;,         ]     } ], &quot;latex-workshop.latex.tools&quot;: [     {         &quot;name&quot;: &quot;lualatex&quot;,         &quot;command&quot;: &quot;lualatex&quot;,         &quot;args&quot;: [             &quot;--shell-escape&quot;,             &quot;-synctex=1&quot;,             &quot;-interaction=nonstopmode&quot;,             &quot;-file-line-error&quot;,             &quot;-pdf&quot;,             &quot;%DOC%&quot;         ]     },     {         &quot;name&quot;: &quot;biber&quot;,         &quot;command&quot;: &quot;biber&quot;,         &quot;args&quot;: [             &quot;%DOCFILE%&quot;         ]     } ],  I installed all Vietnamese-related package I found using tlmgr search, notably babel-vietnamese and vntex, to no avail. When I use English language, it works. When I paste the exact document to Overleaf, it also works. So it's something on my part. How can I fix this? How can we prove that for every pair $N \in \mathbb{N}$, and natural number $\beta\in [2, \infty)$ there exists a unique set of integers $x_i \in [0, \beta -1]$, $k\in [0,\infty)$ such that:  $$N = \sum_{i=0}^{k}\beta^ix_{i}, \quad $$  It's a question if every positive integer has its unique representation in every base $\beta$. Is the validity of above statement somehow related to Horner's rule? glBufferData not working outside main function I'm working through Rotman (1994). It's the 2nd chapter where my curiosity lead me to a question that is not from the book. Here's the problem that inspired the question:      2.8. Imbed $S_n$ as a subgroup of $A_{n+2}$, but show, for $n\ge2$, that $S_n$ cannot be imbedded in $A_{n+1}.$    Since the alternate subgroup has the property of even parity, I thought that a little investigation of parity for the second and third symmetric groups was in order. So I constructed a table for each of them, grouped by even and odd number of disjoint products.   I'll forego writing the actual table and simply provide the answers. In symmetric groups with an even idegree, two even permutations come together under composition to produce an even permutation. Two odds also make an even. Two different parities produce odd elements.   When the symmetric group has an odd degree, e.g. $S_3$, two odds make an odd, two evens make an odd, and two different parities make an even element. Exactly the opposite results from the symmetric groups with even index.   Two questions: is this enough to prove the $A_{n+1}$ case? And can this be generalized modulo 2 e.g. $A_{2n+1}$? Areas versus volumes of revolution: why does the area require approximation by a cone? Suppose we rotate the graph of $y = f(x)$ about the $x$-axis from $a$ to $b$.  Then (using the disk method) the volume is $$\int_a^b \pi f(x)^2 dx$$ since we approximate a little piece as a cylinder.  However, if we want to find the surface area, then we approximate it as part of a cone and the formula is $$\int_a^b 2\pi f(x)\sqrt{1+f'(x)^2} dx.$$  But if approximated it by a circle with thickness $dx$ we would get $$\int_a^b 2\pi f(x) dx.$$  So my question is how come for volume we can make the cruder approximation of a disk but for surface area we can't. Reading Excel files from C# What is $\int_{-\pi}^\pi \cos(nx)\cos(mx)\,dx$?