I'm looking to see if there is a way of taking a generic async function, such as AJAX, or web worker on message, and forcing it to behave synchronously.  First off - I really do need this behaviour, I am aware of all the arguments regarding async callbacks vs returns - but in this case, I truly need to wait for a callback.   If there is no generic solution available I'd settle for one that works purely on the Worker.prototype.onmessage as that is the primary use case here.   I'm fairly sure the answer will be "thats not possible" but I wanted to check before surrendering.  I've already looked into promises and generators, I'd prefer not to use a third party library (I'm aware of fiber/futures for Node).  A potential use case:  function main(){     worker = new Worker("someWorker.js")     var result = worker.onmessage(function(event){         return event.data;     })     //wait for worker.onmessage     return result; }
I have a JavaScript widget which provides standard extension points. One of them is the beforecreate function. It should return false to prevent an item from being created.   I've added an Ajax call into this function using jQuery:  beforecreate: function (node, targetNode, type, to) {   jQuery.get('http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value),    function (result) {     if (result.isOk == false)          alert(result.message);   }); }   But I want to prevent my widget from creating the item, so I should return false in the mother-function, not in the callback. Is there a way to perform a synchronous AJAX request using jQuery or any other in-browser API?
Suggested edit review should show custom rejection reasons Somewhat similar to , but rather more limited: when Rejecting an edit, not only the count of custom rejection reasons but the actual text of the reasons should be shown, IMO. Just now I  on SO that tidied some code in a trivially correct and substantially superior way because it looked perfectly legitimate and I couldn't understand why anyone would bother with a custom rejection reason. As it turned out, it was code in a question, of course.  In this case, the rejection reason correctly identified the problem, and had I seen it, I would have been reminded of that aspect I had neglected to check. In a document I'm writing, I'm using the familiar  option for my floating tables, and I  them. I'd like to avoid repeating that every time I'm creating a table. I assume it's easy to add something in my preamble that makes sure that these two options are used every time I begin a new table environment?  \documentclass{article} \begin{document} \begin{table}[hbt] \centering \begin{tabular}{*3{l}} 1 &amp; 2 &amp; 3\\ a &amp; b &amp; c\\ \end{tabular} \end{table} \end{document} Limit question on independent random variables (Exercise 4.2.4 from Grimmett and Stirzaker) Let $\{X_r | r \geq 1\}$ be independent and identically distributed with distribution function $F$ satisfying $F(y) &lt; 1$ for all $y$, and let $Y(y) = \min \{k | X_k &gt; y\}$. Show that $$ \lim_{y\rightarrow \infty} P(Y(y) \leq E[Y(y)]) = 1 - e^{-1}. $$  I managed to show that $E[Y(y)] = \alpha(y) = (1 - F(y))^{-1}$ and that $$ \lim_{y\rightarrow \infty} P(Y(y) \leq E[Y(y)]) = \lim_{y \rightarrow \infty} \left( \sum_{i = 1}^{\lfloor \alpha(y) \rfloor} {\lfloor \alpha(y) \rfloor \choose i} (-1)^{i+1} \alpha(y)^{-i} \right). $$ And the expression on the right, according to Mathematica, does indeed seem to converge to $1 - e^{-1}$. But how can I show that this is true? Can anyone give me a hint? Instant e-mail notifications of answers to questions I'd like to have Instant notifications by email of answers to my questions.  Can this be implemented? In the Harry Potter universe, wizards and witches have managed to keep Muggles unaware of their existence, across the planet and over many centuries. Up to the timeframe that the novels take place in (the 1990s), I can see how this can be achieved through a combination of discretion and magic, with discretion being the preferred method on occasion (e.g., you don't need magic to slip into Platform 9 3/4 unnoticed, you just need to check that nobody is looking).   Our current world of 2016, however, its a very different place. The UK is (in)famously heavily camera-monitored (). Even more poignantly, a very large (and growing) segment of the population carries an internet-enabled HD camera with them at all times and are willing to use it at a moment's notice (, but it is comedy in part because a more realistic version could happen). It looks like, the moment something magical happens in public, a video of it would be on Youtube/Facebook/Twitter and within minutes.   How does the Ministry of Magic deal with this development? Do they need to create a dedicated corps to monitor social media services and alter records as necessary? Often in my papers I want to mention theorems in the introduction that are introduced in more detail and proved in a later section.  I'd like to include the statement of these theorems twice over, each time numbered as the theorem would naturally appear in its later section.  My current solution (using amsthm) is, e.g.  %(in the introduction) \newtheorem*{thm:associativity}{Theorem \ref{thm:associativity}} \begin{thm:associativity} Lorem ipsum ... \end{thm:associativity}  %(in a later section) \begin{thm} \label{thm:associativity} Lorem ipsum ... \end{thm}      Can anyone think of a cleaner solution? Why does the odd part of the function integrate to $0$? When evaluating the integral $$\int^1_{-1}\frac{\cos(x)}{1+e^{1/x}}dx,$$ the author says that the odd part of the function integrates to $0$ over $-1$ to $1$. I have calculated the even part of the function ($\frac{1}{2}\cos(x)$), so the integral is equal to $\sin(1)$. But why exactly does the odd part integrate to $0$? I agree that every page in a site should have a unique TITLE, and that every page should have one and only one H1 element, but should the text of each H1 be completely unique too?  Instinctively one would think so, but there are potentially many cases where (IMHO) mind this doesn't make sense and attempting to do so will impair the user experience &amp; presentation of the page - for example, where pages are part of a closely related cluster, e.g. a multi-step process/tool/wizard.  Surely the process name should go in the H1 (e.g. "Pregnancy Planner"), and the current step you're on should be marked up as a H2 (e.g. "Step 1 - Trying for a baby"), rather than shoehorning both into a single H1 together (e.g. "Pregnancy Planner - Step 1 - Trying for a baby")?  Not only does this make the H1 rather long and potentially impact the presentation of the page, I would argue that in combining both into one you also lose semantic goodness, as the page is surely semantically richer by keeping parent (process) and child (step) as separate, nested headings?  Furthermore, the current proposal I have read is that on the first page the H1 should be the name of the process and the first step an H2, but on subsequent pages the same text should not be a H1 at all (just text styled exactly the same as an H1) and the current step should become the H1 instead. For me this is introducing unnecessary complexity to the page authoring/production process, and inconsistency in the semantic structure of the pages within the stepped process.  So it all comes back to the basic assertion that each H1 must be completely unique, which I question. Can you convince me that this should be so and that the cost/complexity of implementing this (especially in situations such as that above) is worth it?  Your thoughts please... Transferring Lyx Keyboard Shortcuts I recently updated my version of Lyx from 1.6.7 to 2.0.6. I would like to transfer my old keyboard shortcuts to this new version, but I am having difficulty because I was inconsistent with the way that I set them up:   Some were defined in the specified .bind file,  but others were modified in the lyx preferences menu.   I found that when importing my old .bind file into this updated version of lyx, it imported the keyboard shortcuts that were in the .bind file, but not those that I had added in the preferences menu.  Does anyone know if these keyboard shortcuts that were added via the preferences menu are stored in another .bind file somewhere in the lyx directory? Has anyone else successfully transferred keyboard shortcuts that had been implimented in the preferences menu? Anomalous community user activity On the meta home page I noticed the  is listed as doing something, but cannot figure out what it is.  There is nothing on the  or its , but the recent activity is listed with the same timestamp. Add scratches to a material in Cycles? This is a  about avoiding outgoing mail being classified as spam.   Also related:                    I'm wondering how to prevent my emails from my site being marked as spam? I'm using sendmail.  I'm trying to send emails through my ruby-on-rails application. The mails are all written in swedish (if that does make a difference?). I don't know why they keep getting marked as spam.  Are there any things that I can do to minimize the risk? Wire transfer to an intermediary bank account I sent money from a bank that doesn't have a space for intermediary bank, so I put the intermediary bank statement information where the beneficiary bank information is supposed to be.  I  don't know what will happen now. I've always wondered about this and never found a good solution.  But  reminded me of it.  When I have a URL on my website it can be displayed and accessed any of the following ways:  http://www.somesite.com/subdirectory http://www.somesite.com/subdirectory/ http://www.somesite.com/subdirectory/index.htm http://www.somesite.com/subdirectory/index.html http://www.somesite.com/subdirectory/index.php http://www.somesite.com/subdirectory/index.asp http://www.somesite.com/subdirectory/some-relevant-keywords http://www.somesite.com/subdirectory/some-relevant-keywords.htm http://www.somesite.com/subdirectory/index.php?page=some-relevant-keywords http://www.somesite.com/subdirectory/?page=some-relevant-keywords http://www.somesite.com/subdirectory/?page=some-relevant-keywords&amp;even=more-keywords   etc...   Now, I can understand the merits of adding keywords in the URL. Even the most basic SEO guide will mention to do just that. ... but for the sake of sanity, clarity, ease of reading, ease of use, and so on, including web compliance ...  Is it preferred to have a file-extension or not?  Really, deep down my logic tells me: yes, it should. The reason being is this stems back to the days of the past when the internet was mostly USENET, FIDONET, FTP and GOPHER.   See, if a URL has no filename, then it normally is considered a directory. This is where index.htm came about, because this by default lists the directory if no index file is found. However, soon enough, web programmers started overriding this and using index.htm to actually serve the content of that web directory as a page. The main difference, was markup language was added in, and this was parsed in the browser. With this markup language, the Content-Type:text/html; tag in the response header became the indicator to what filetype it was for any file. HTML seems to be the only "filetype" that just doesn't have consistently named extensions, except for when they are saved.  Unfortunately, once web pages became the main thing, it became a security error to actually display the directory contents, so everything stayed hidden with only the actual URL content being displayed.   Not to mention the cross-platform file-naming wars.. windows based require a 3 or less digit extension, and unix/mac can have more. So should it be .HTM or .HTML or NONE and let the platform decide?  So in essence, I guess what I am trying to figure out is beyond SEO and dealing more with aesthetics and web compliance. I am constructing a bibliography of as much of the prior research in a field I am working in. I would like to use BibTeX to print the citation in the pdf, and then I would like to add the details of the paper after the citation. Only then would I like to print the next citation. For example:  [1] Jahan M. Dawlaty and Yunquing Chen. Measurement of the optical absorption of graphene in the terahertz. Applied Physics Letters, 2008. Research Group: Cornell Pump Wavelength: 500 nm. Probe Wavelenth: 7 microns. Relaxation Time: 50 fs. [2] Paul George and Dmitry Vekslar, Measurement of Ultrafast Carrier Dynamics in Graphene. Applied Physics Letters, 2009.  . . . and so on. Does anyone know how this could be done? Is there an Amazon.com API to retrieve product reviews? Let $\alpha$ be an irrational real number and let $a_j$ be a sequence of rational numbers converging to $\alpha$. Suppose that each $a_j$ is a fraction expressed in lowest terms: $a_j = \alpha_j / \beta_j$. Prove that the $\beta_j$ tend to $\infty$  Attempt: AFSOC that $\beta_j$ does not tend to infinity, then it is bounded by some $M$. We can also find an interval $\alpha \in (k, k+1)$. Let $\epsilon &gt; 0$, $\exists N_0$ such that for all $N &gt; N_0$ we have $|a_N - \alpha|  &lt; \epsilon$. So $|\frac{p_N}{q_N} - \alpha| &lt; \epsilon$. We try to use the fact that $q$ is bounded but fail to derive a contradiction. I do not know how to use the fact that $\alpha$ is between two integers, although it might not be relevant at all.  Ideas? The Earth is spinning, so why don't we jump and land on a different location? I know there are similar questions on StackExchange but I think it is different and detailed.  The earth is spinning 465 meters/second so why don't we jump and land on a different location?  I googled about this question and I got some answers:   When we jump, we (and the atmosphere itself) also spin along with the earth so we don't land at a different location. (But why we are also spinning along with earth ?) The earth is so big and we are very small relative to earth so the tiny jump won't make any difference.   But according to answer 1, We are also spinning with the earth. But the question is, "why are we also spinning along with earth" ??  Regarding the answer 2, it won't make any difference but logically it doesn't make sense or I just don't understand it.  Here is the followup question,   "When we jump why don't we thrown out of earth due to centrifugal force of the spinning earth ??"  Please provide some detailed answer to these questions. With logic if possible.   This phenomenon is not possible I know, but even if it exists, then traveling will be so easy, we just have to hang on space (with help of helicopter etc.. ) and we can travel the whole world in 24 hours :D i install ubuntu and followed a guide to put 20gb in '/' and the rest (150gb) in '/home'. Now i just found out that a lot of the things installed in ubuntu usually goes to '/' instead of '/home'. I have a lot more things to install.  So what is the point of '/home' ? How do I fix this ? Should I transfer 150gb from '/home' to / ?  Filesystem      Size  Used Avail Use% Mounted on udev            7.8G     0  7.8G   0% /dev tmpfs           1.6G  9.5M  1.6G   1% /run /dev/sda6        19G   16G  1.8G  91% / tmpfs           7.8G  676K  7.8G   1% /dev/shm tmpfs           5.0M  4.0K  5.0M   1% /run/lock tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup /dev/sda2        96M   29M   68M  31% /boot/efi /dev/sda8       159G  1.1G  150G   1% /home tmpfs           1.6G   56K  1.6G   1% /run/user/1000   what is /boot ? Its not '/' or '/home' For a continuous function $f$ show $\exists c\in (0,1)$ s.t $f(c)=3c^2$ Let $f: [0,1] \to \mathbb{R}$ be a continuous function such that $$\int_0^1 f (t) dt =1 .$$ Show that there exists a point $c \in (0,1)$ such that $ f(c)=3c^2$.  I tried using mean value theorem of integrals on $f (x)$, so $$\int_0^1 f (t) dt = f (c) =1,$$ but it should be $3 c^2$. What is going wrong?