What's the difference between text/xml vs application/xml for webservice response

Question: This is more of a general question about the difference between text/xml and application/xml.
I am fairly new to writing webservices (REST - Jersey). I have been producing application/xml since it is what shows up in most tutorials / code examples that I have been using to learn, but I recently found out about text/xml and was wondering what is different about it and when would you use it over application/xml?
Comment: As noted in DaveV's answer, and in the header at https://tools.ietf.org/html/rfc3023, RFC 3023 (cited by Oded's answer, currently accepted) is obsolete. The newer RFC 7303 actually gives a significantly different answer to this question than RFC 3023 used to. I think it would therefore be helpful to future readers if you accepted DaveV's answer, so that the most up-to-date information is kept at the top of the answer list.
Comment: Based on Dave V below and Marián Černý it appears that application/xml is preferred now if you were doing something new.
Comment: `text/` is meant for humans. `application/` is meant for computers
Answer: From the RFC (3023), under section 3, XML Media Types:

If an XML document -- that is, the unprocessed, source XML document
-- is readable by casual users, text/xml is preferable to
application/xml.  MIME user agents (and web user agents) that do not
have explicit support for text/xml will treat it as text/plain, for
example, by displaying the XML MIME entity as plain text.
Application/xml is preferable when the XML MIME entity is unreadable
by casual users.

(emphasis mine)
Comment: @CommaToast A web server might return formatted and indented XML if "text/xml" is the Accept, whereas application/xml might return all insignificant whitespace removed. In ASP.NET MVC for example, you can specify different handlers for different mimetypes.
Comment: @drachenstern - I think non descriptive elements and attributes more likely (``, for example as unreadable by _casual_ users).
Comment: Please give an example of unreadable vs readable. We use files that are mostly readable but do have base64 encoded nodes, etc..
Comment: @JoePhilllips - There you go. base64 is not readable by humans. If the entire document can be read and make sense to a human without tools or looking at a manual (what's that `xgsf` tag mean?), then it is readable.
Comment: @Mike Of course. Some XML files are basically a list of records, like this: http://msdn.microsoft.com/en-us/library/ms762271%28v=vs.85%29.aspx This is more likely to be read and processed by an application. Others are basically text with markup, like a HTML page. Using text/xml for them sounds more appropiate.
Comment: This answer explains the *intent* behind text/xml vs. application/xml but it doesn't explain *the technical difference* between the two. What actually changes when "application/xml" is used instead of "text/xml"?
Comment: So reading the part that you quoted, reckon what a non-human-readable XML looks like, since XML is pretty much text. I suppose if you embedded binary or base64 encoded data ...
Comment: @Mike I think a less subjective distinction is along the lines of record-based xml content and document-based xml content.
Comment: So if I am creating the xml myself and producing it as a response, is it up to ME to use non-descriptive elements and attributes then if I am using application/xml?
Comment: @Mike - this is what the RFC says. However, in my experience, it doesn't really matter which one you use.
Comment: @biziclop I'm sorry but I don't quite understand what you mean, could you expand on that?
Comment: I'll give you another reason to use text instead of application. I just spent half the day fighting how our code to pull files (Java & C#) from several web servers started failing. Changed from application to text and it worked. No beeping idea why.
Answer: This is an old question, but one that is frequently visited and clear recommendations are now available from RFC 7303 which obsoletes RFC3023. In a nutshell (section 9.2):
The registration information for text/xml is in all respects the same
as that given for application/xml above (Section 9.1), except that
the "Type name" is "text".

Comment: The cited paragraph mentions IANA registration information, which (by checking Section 9.1) deals also with the encoding, so there should not be any more any differences in character set handling between `application/xml` and `text/xml`. In addition, I consider this part of the abstract: "This specification standardizes ... application/xml ... while defining text/xml ... as alias..." to mean that `application/xml` and `text/xml` are equivalent and there is no preference of one about the other.
Comment: @MariánČerný wouldn't the fact that one is "standard" while the other is an "alias" basically mean that `application/xml` is the one to use by default? Seems to me that the only reason to keep `text/xml` at this point is for backwards compatibility given the standardization is happening on `application/xml` instead.
Answer: According to this article application/xml is preferred.

EDIT
I did a little follow-up on the article.
The author claims that the encoding declared in XML processing instructions, like:
<?xml version="1.0" encoding="UTF-8"?>

can be ignored when text/xml media type is used.
They support the thesis with the definition of text/* MIME type family specification in RFC 2046, specifically the following fragment:
4.1.2.  Charset Parameter

   A critical parameter that may be specified in the Content-Type field
   for "text/plain" data is the character set.  This is specified with a
   "charset" parameter, as in:

     Content-type: text/plain; charset=iso-8859-1

   Unlike some other parameter values, the values of the charset
   parameter are NOT case sensitive.  The default character set, which
   must be assumed in the absence of a charset parameter, is US-ASCII.

   The specification for any future subtypes of "text" must specify
   whether or not they will also utilize a "charset" parameter, and may
   possibly restrict its values as well.  For other subtypes of "text"
   than "text/plain", the semantics of the "charset" parameter should be
   defined to be identical to those specified here for "text/plain",
   i.e., the body consists entirely of characters in the given charset.
   In particular, definers of future "text" subtypes should pay close
   attention to the implications of multioctet character sets for their
   subtype definitions.

According to them, such difficulties can be avoided when using application/xml MIME type. Whether it's true or not, I wouldn't go as far as to avoid text/xml. IMHO, it's best just to follow the semantics of human-readability(non-readability) and always remember to specify the charset.
Comment: +1 for the link. In your own words, what is the basic conclusion reached in the article? Maybe "the article states that file encoding is ignored, which means you can't send utf-8 and binary data in a file with a text/xml header" also is this verified?
Comment: According to the original author, this has been fixed in later revs of the specifications `Update: The situation has changed in the new HTTP/1.1 RFC: The default charset of ISO-8859-1 for text media types has been removed; the default is now whatever the media type definition says.`
Comment: I agree with @Shanimal, the answer should include the gist of the article as the link may not last forever. Its disappearance will render the answer pretty much useless. Could anyone confirm the statement about ignoring XML processing instructions concerning encoding?
Comment: If I load an XML file with ajax it is a "document" of type `application/xml` but if I use an input form element it is a "file" of type `text/xml` which does not process properly with my code.  How can I convert it to the other format?
Answer: application/xml is seen by svn as binary type whereas text/xml as text file for which a diff can be displayed.
Answer: Web browsers display text/plain as plaintext while most browsers will parse application/xml into data tree, with syntax highlighting, or even go further and apply transformation declared using XSLT. Some browsers cut off rendering application/xml as data tree when an error is detected, but will always display text/xml in full regardless of errors in syntax.


Sizing Logos in InDesign

Question: I am putting together a flyer for our company. We have three different logos. The logos are actually trademarked or registered names such as ReMan, LiftTrax, LiftSafe and all are in the same font. When I import them, they are all different sizes.
I need all the three of these logos to be the same size for placement purposes. How do I get all three of these logos to be the same size?
Thank you.
Comment: In most cases, it's more about visual adjustment than technically being the *exact* same size. Some logos will just naturally appear to take up more space than others. So, generally adjusting by *eye* is better than trying to measure things.
Answer: When you place the image in InDesign, you'll notice it's placed inside an Image Frame.

To resize the image and the frame, you need to hold down CMD + SHIFT and then click on one of the corners to resize it.
Alternatively, after clicking on the Image Frame, you can enable Auto-Fit, at the top menu bar.  This will resize the image to fit the frame automatically, so you only need to hold SHIFT while resizing.
Answer: It may be that the files you're placing need to adjusted in the authoring program (Photoshop, Illustrator etc) to make the files the exact size you want, and then place them. Or you can adjust them in InDesign by selecting the content (SHIFT + ESC) and then typing in the exact proportions you want in the control bar, then fitting the frame to the content (though the suggestions above work too). If they're going to be placed over and over, it might be a better idea to make the files themselves all the exact sizes you want in the authoring program itself.

Sizing Logos in InDesign


Good tools for backing up SQL Server?

Question: Im "new" to SQL Server and i want to start doing backups of all my data. Whats a good starting place? are there any good tools out there for this? Also i'd like it if i could have backups that could be potential loading into another instance of SQL Server on a separate Server incase our current one "dies"
Answer: In the first instance use what SQL Server provides - http://technet.microsoft.com/en-us/library/ms187658.aspx
Maintenance plans are the quickest and easiest way to backup your databases, and you can use the .bak files to populate another server.
If you're already running another backup system (Like Backup Exec) you could also investigate what addons they have for SQL Server.
Answer: I assume you mean MS SQL?
You could start with a SQL Agent job to dump the database to a file which can then be backed up. This can be a regular job.
If you're on SQL Express you can accomplish the same thing with a Windows scheduled task I think.
Comment: MS SQL Server, im using the developer version i think.

Good tools for backing up SQL Server?


How to set the radius value in self organizing map?

Question: I'm training the self organizig map, I need to set the value for the radius of it. is there any method to find the optimum radius size ?
Answer: It depends on the range and scale of your input data.  If you are mean-zero standardizing your feature values, then try $\sigma=4$.  If you are normalizing feature values to a range of [0,1] then you can still try $\sigma=4$, but a value of $\sigma=1$ might be better.  Remember, you have to decrease the learning rate $\alpha$ and the size of the neighborhood function with increasing iterations, as none of the metrics stay constant throughout the iterations in SOM.
It also depends on how large your SOM is.   If it's a 10 by 10, then use for example $\sigma=5$.  Otherwise, if its a 100 by 100 map, use $\sigma=50$.
In unsupervised classification, $\sigma$ is sometimes based on the Euclidean distance between the centroids of the first and and second closest clusters.
Comment: Interesting, I've been using SOM for different applications and always stuck with the default parameters. The values you mention look like rules of thumb. Could you please provide some reference(s) to learn more?
Comment: Look at Kohonen's book on SOMs.


My Terraria NPC will not settle down in a house

Question: I have made an arena for the moon lord boss battle and made a small house for the nurse to move into. It says the message that the NPC moved in and the nurse banner is there, but no matter what I do, she won't move into the house and will just walk around outside.
Comment: Have you tried exiting your world and loading back into it? Sometimes a little session reset like that is enough to move NPCs.
Comment: If her banner is in the house, then at night or when it rains she should teleport there if offscreen. If after that and restarting your game it still doesn't work, why don't you edit your question with a picture of the house?
Answer: Wait until night and make sure the nurse and her house are out of view. After you've done that, she should teleport into her room. If, after that, you find her outside of her house, she has found a way out and you can simply repeat and she will be back.
Answer: You can build a house where you want the nurse to be. To force her to get in, you can simply get a couple of blocks, maybe 200 and whenever the nurse moves forward, you put blocks behind her, so she can't go back and be forced in the house. You may need to put her banner in the house first, tho.


ADA locked with assets

Question: Can you send just NFTs and the transaction fee or do you always need to send ADA in a transaction. Also is there a way to unlink the ADA and Asset in the receiver wallet?
Answer: To make a transaction on the blockchain you will need to pay a transaction fee of ~0.17 Ada (may change) to the block producer
There is also minimum Ada that needs to be sent to the receiving wallet:

1 Ada
or ~1.5 Ada for NFTs
Answer: I think you are referring to the minUtxoValue which is a protocol parameter that prevents malicious growth of the UTXO set.
For each new UTXO you create, it needs to have that value (around 1 ADA or so). There is no way to create an UTXO just with native assets.
Answer: Recover Any $ADA 'locked' with any cnft https://link.medium.com/YbyZABPNepb
$ADA #Cardano
Comment: Take a look at the help regarding referencing external sources to see how to improve this.  https://cardano.stackexchange.com/help/referencing

ADA locked with assets


How do I stop mold growth on greenboard behind my shower wall?

Question: We have greenboard behind our shower wall.  There are signs of mold growth on it.
Can it be cleaned up with a bleach solution and then painted with RedGard?
Comment: Picture would help here.
Answer: No
You are trying to seal the wrong side.
There is a reason greenboard is no longer IRC code approved for tile in wet locations  without waterproofing.  Its because its NOT waterproof, and neither is grout.  You can improve grout's water shedding on vertical surfaces with the better sealers.
The Redguard (2 coats, at right angles) must be between the tile and the greenboard.
Other waterproof membranes would also work, (Kerdi or Nobleflex for sheet, Hydroban for liquid)
You must fix the source of the water intrusion to have a hope of saving this wall from demolition.  Mold will stop growing if the moisture is removed.
Answer: No.  You will need to cut out the area with mold and probably 6 inches to 12 inches around it.  Redgard helps with surface issues for sure but will not stop mold growth that is built into the board - meaning that it is not the surface getting moldy it is the whole board.


How can I watch Netflix on Linux?

Question: I recently installed Fedora 14 on my home PC so I have a dual boot system running windows and linux.  I probably would primarily use Linux on that machine as its older and Linux manages its resources MUCH better than Windows does, BUT I'm a bit of a Netflix junky and from what I've read there isn't currently a solution that allows for Netflix to work on Linux.  Evidently Moonlight (which as I understand is supposed to be like silverlight) is missing a key piece of functionality.  So is there really no solution?
Comment: Hmm... I'm starting to think there might not be a solution... :/
Comment: In general any service employing DRM won't work on Linux.
Comment: Is there a reason for this?  Perhaps a solution pending?
Comment: There are several different reasons. Licensing (GPL directly forbids most types of DRM), patenting (alternative implementations can't be created), NDA (even if the DRM technology isn't patented and there aren't licensing issues, you will have to sign an NDA which is of course incompatible with creating an open source implementation).
Comment: So most likely there will never by a way to make it work then... :(  And I'm guessing the only work around would be to use Wine or something like that... but then that defeats one of the big purposes of being on Linux. Oh well... dual boot it is!  lol
Comment: Instead of doing dual boot, I would look into running Windows in a VM. It's much more secure that way, and a lot easier to switch back and forth between them.
Answer: From what I understand, the only way you can reliably watch netflix is through a virtual machine running Windows. At this point, playing natively in Linux is not supported.
Comment: It's great to see (judging by the recent comments made here) that this problem has been solved since I wrote this comment in 2011, and that there are now ways to run Netflix on Linux.
Answer: With Microsoft abandoning Silverlight, Netflix has made strong efforts to switch their video delivery software to HTML5. An HTML5 video player does not need a browser plugin like Adobe Flash or Microsoft Silverlight to work. However, in order to stream videos, Netflix requires their delivered content to remain secure. This is achieved in HTML5 via a browser plugin known as Network Security Service. Finally both of these components are mature enough.
If you use Chrome version 37 or later and have nss-3.16.2 or greater, streaming videos on Netflix should work out-of-the-box on any Linux distribution.
Answer: there is an easy way to install netflix now. How to install Netflix on Ubuntu, Linux Mint and Fedora
$ sudo apt-add-repository ppa:ehoover/compholio
$ sudo apt-get update && sudo apt-get install netflix-desktop

Answer: The answers to your questions are here: http://www.iheartubuntu.com/2012/11/netflix-on-ubuntu-is-here.html
By adding a ppa you can get a special blend of wine and firefox that will run the netflix videoplayer (silverlight). It's 3 commands and although I personally have had some trouble on the 64-bit kernel it works well on a 32-kernel. If you have further questions or you get it running on a 64-bit kernel let me know.
Comment: Please summarize the steps in your answer so they will be preserved even if the link dies.
Answer: You can watch netflix inside of a webbrowser simply by changing your user agent. Normally your browser sends a user agent to the server when accessing a website containing your browser version and your operating system. It looks something like this:
Firefox on Linux:
Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0

Chrome on Windows:
Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36

You can fake your user agent using a browser extension. When your user agent says that you're on Windows, you can watch Netflix inside of your browser even though you are on a Linux system. I'm not sure why Netflix doesn't want Linux users to watch their content but it works!
Comment: Note that that question was asked 10 years ago. Netflix has been running out of the box on Firefox/Chromium for a few years now. If it doesn't work for you out of the box, it may be something specific with your setup, you may want to ask a different question here.

How can I watch Netflix on Linux?


Wordpress Admin panel issue

Question: I have made some changes to functions.php, specifically i deregister some js libraries and then manually add them back to the footer using a plugin(header and footer plugin). That changes caused to my site a minor problem, some times when i try to visit wp-admin it shows me that message "The page cannot be displayed because an internal server error has occurred." with a blank page behind the message BUT the front site is okay. If i visit themes, plugins or anything else it is okay except mysite.com/wp-admin
And i also mention it again, that occurs some times and then it is ok, not everytime.
Comment: Use `is_admin` to check and perform customization only in the frontend.
Answer: When you enqueue new libraries to WordPress for the sake of front-end effect only, it is highly recommended to preface the function in the conditional if (!is_admin()); , thus:
/**
 * Load newer jQuery min file.
 */
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
   wp_deregister_script('jquery');
   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null, false);
   wp_enqueue_script('jquery');
}

Additionally, wp_enqueue_script() has the necessary options to specify loading in the footer, and only once other dependencies have loaded. Read more here.

Wordpress Admin panel issue


What types of derivatives, other than stock options, are available to the retail trader?

Question: How can a retail trader identify other derivative instruments to trade, and how can one go about doing so?
Answer: Other derivatives include warrants which are equivalent to a very long term option, futures contracts  and  single stock futures.  Outside the US there are CFDs (Contract for Difference).
Comment: Thanks, perhaps the question I should've asked then is what kinds of futures are available to the retail trader (oil, pork, soy, gold, etc.)? And how does a retail trader trade them?
Comment: To find out the kinds of futures that are available to the retail trader, Google: "Futures Market Symbol List".  To trade them, you need an account at with a futures broker. I traded some 30+ years ago and quickly realized that they were not for me so I really don't have anything more than that Captain Obvious information to offer you.


Does having an active operation coin cause you to play on different matchmaking servers?

Question: If you're playing competitive matchmaking games, does having an coin for the active operation cause to to play on different servers than you would without?
Comment: I don't think it does but I have no evidence one way or another.
Answer: If you select maps from the operation then you will be put on a server running one of those maps and you'll be playing with other people who also has the operation.
If you select the standard maps you can still be matched to play with people who haven't bought the operation.
Whether or not you equip the coin is irrelevant.
Comment: Although true before breakout, Operation Breakout's maps were available to all who had the [base] game. Buying breakout gave access to the coin, missions and the associated cases - not the maps.  This was a change made, presumably, to prevent segregation of the player base.


Why is $e^\pi - \pi$ so close to $20$?

Question: $e^\pi-\pi\approx 19.99909998$
Why is this so close to $20$?
Comment: It's not close at all. There are infinitely many numbers closer than that.
Comment: Obligatory link: https://xkcd.com/217/
Comment: The $0$ at $10^{-4}$ removes any relevance of the $9998$ that follows...
Comment: by chance (6 more to go...)
Comment: Though these comments are somewhat old, the argument that "[there] are infinitely many numbers closer" is unconvincing. For if the difference was, say, $10^{-10^{9}}$ or some other ridiculously tiny number, one could still employ that argument but I don't think many would accept it then. The reason for this is perhaps psychological, and perhaps that other near-integers (ie. Ramanujan's constant) are near-integers for a reason.
Comment: This isn't particularly close IMHO, it's almost .01% off. Given how many different "special" formulas crop up, you'd expect some of them to be at least this close to an integer.
Comment: A closed form series for $e^\pi-\pi-20$ is given in http://math.stackexchange.com/questions/1598664/why-e-pi-pi-approx-20-and-e2-pi-24-approx-29/1599014#1599014
Comment: $e^{\pi \sqrt {163}}$ differs from an integer by less than $10^{-12}$.
Comment: $\pi^e-e$ is a worse but pretty close approximation for $e^\pi - \pi$
Comment: Curiously
\begin{align}
\color{blue}{41}^3-2\cdot3\cdot5&=\color{red}{71\cdot97}\cdot2\cdot5+3\cdot7=68891. \\
\color{blue}{41}\cdot\color{blue}{163}+\color{blue}{41}\cdot5-1&=\color{red}{71\cdot97}=6887\\
\end{align}
I have following identity:
\begin{align}
2\cdot\frac{\color{blue}{41}^3-2\cdot3\cdot5}{\color{blue}{41}\cdot\color{blue}{163}+\color{blue}{41}\cdot5-1}-\pi+\ln(23)&=20.0000000086875486\ldots\\
\end{align}
Comment: Yeah, that was silly. I meant 19.9991, sorry.  My point though is that it's probably just an accident of the fact that we're calling 20 special.
Comment: Not an accident, although it has nothing to do with the $\pi$ just with the fact that it is close to 3 and that the remainder 0.14 is still small enough for various linear approximations.
Comment: Because...it could be another number.
Comment: @ringø $e-\gamma-\log\left(\frac{17}{2}\right)$ has even more correct digits after the wrong one.
http://math.stackexchange.com/questions/1605706/why-is-e-close-to-h-8-closer-to-h-8-left1-frac1802-right-and-even
Answer: It cannot be accidental in the real sense. It is either special or typical. Observe that in almost all such equations it is always something else in disguise. For example, in many cases you can reduce numbers to their rational approximations and explicitly check everything.
Instead of just using approximation, you can find some simpler connection and argue about extreme values or something that is going to give you a common reason for the equation.
One of the examples of this procedure is given in: Prove $\left(\frac{2}{5}\right)^{\frac{2}{5}}<\ln{2}$
and I will illustrate here how we can check your statement above using the simple approximation of $\pi \approx \sqrt{10}$. This is probably not sufficient on its own for immediate success but it gives you the flavor of the method, and it gives you some estimation to work around, especially, it specifically explains that it is not $e$ or $\pi$ in many similar equations, it is just something that looks like it.
So the equation we are interested in becomes
$$y^{\sqrt{x}}-\sqrt{x}=20$$
The solution is of course
$$y=(\sqrt{x}+20)^{\frac{1}{{\sqrt{x}}}}$$
We can expand it around 0 and get
$$(\sqrt{x}+20)^{\frac{1}{{\sqrt{x}}}} = e^{\frac{1}{{\sqrt{x}}}\ln{(\sqrt{x}+20)}} \approx e^{\frac{\ln(20)}{\sqrt{x}}+\frac{1}{20}-\frac{\sqrt{x}}{800}+...}$$
For the sake of simplicity we will ignore the terms beyond $-\frac{\sqrt{x}}{800}$ and simply try to solve
$$\frac{\ln(20)}{\sqrt{x}}+\frac{1}{20} = 1 $$
This gives
$$x=\frac{400\ln{20}^2}{361}$$
Well now it is easy
$$\frac{400\ln{20}^2}{361} \approx \frac{400\ln{20}^2}{360}=10(\frac{\ln{20}}{3})^2$$
and now comes the simple part $\ln(20)=2.995 \approx 3$ making $(\frac{\ln{20}}{3})^2 \approx 1$ and $x \approx 10$ as expected which is the key reason for the equation itself.
This is all telling you that you are right, but something is still missing.
What remains is to justify the remainder.
$$e^{\pi}-\pi=e^3 \cdot e^{\pi-3}-\pi=20$$
$$20 e^{\pi-3}-\pi \approx 20$$
$$e^{\pi-3}\approx 1+\frac{\pi}{20}$$
I hope that you can see the game here. $0.14$ is still small enough for reasonable estimation of $e^{\Delta{x}}=1+\Delta{x}$ and at the same time $$\frac{\pi}{20} \approx 0.15 \approx \pi - 3$$
So this last part is essentially $$e^{\pi-3}\approx 1+\pi-3 \approx 1+\frac{\pi}{20}$$
As you can see the equation in question is not much more than a game of two combined "accidents" $\ln(20) \approx 3 \; \; \; (1)$ and $\frac{\pi}{20} \approx \pi - 3 \; \; \; (2)$
We can establish a strict form and write
$$e^{3+x}-(3+x)=e^3$$
This has a nice solution in form of Lambert function
$$x=-W_{-1}(-e^{-e^3})-3-e^3 \approx 0.1454$$
but this is just rephrasing all what we have said already.
The key reason for the entire conundrum is obviously $$-W_{-1}(-e^{-e^3})-e^3 \approx \pi$$
Observe that the true nature of it is given by the approximations (1) and (2). This last is just all that at more sophisticated level. Still it has not much to do with $\pi$ itself, just with its value, as strange as this may sound.
You may ask, ok, but why do we have $\ln(20) \approx 3$? That is strange on its own. You can approach this by using some series for $e^x$ and argue about the zeros or you can again use something like
$$\frac{e^{x+1}}{5x}-x$$
and find that this has a minimum around $x=1.99...$ since it is achieved for $e^{x+1}(x-1)=5x^2$ and even just by looking at it you can see that $x \approx 2$ providing $e^3 \approx 20$ or the other way around.
I would truly consider the approximate thing of $e^{\pi}-\pi \approx 20$ as very much solved by this analysis.
For some reason unknown to me, it will not be that fast to find this or some derived explanation around the Internet. It can't be all that there is to it, can it?
Unless you want to add a factor or two more to justify maybe one digit more it is indeed all that there is to it: $\ln(20) \approx 3$ and $\frac{\pi}{20} \approx \pi-3$
(The reason I have used $\sqrt{10}$ for $\pi$ is to have something to check the estimations without going more close to the value of $\pi$ itself. Using $\sqrt[3]{31}$ we can achieve somewhat better accuracy but that is not completely necessary at first.)
If you are still in doubt simply draw an implicit graph $y(x)$ of
$$e^{x(1+\frac{1}{e^{y}})}-x(1+\frac{1}{e^{y}})-e^{y}=0$$
and notice how fast after 1 it becomes very close to $y(x)=x$. As an exercise you may even try to find derivative of this function.

In that sense this has not much to do with $\pi$ itself, it is something else in disguise.
Few additional notes:
Since we got very close, I will explain the final steps leading more precisely to the approximation. We start from
$$e^{3+x}-(3+x)=e^3$$
and realize that $e^3$ is a little bit larger than $20$. We rewrite it all as
$$e^{3+x}-(3+x)=e^{3-y}$$
and now all values are small so we can use linear approximation getting
$$(e^{3+x}-1)\mathrm{d} x=-e^{3-y}\mathrm{d} y$$
which makes
$$\mathrm{d} y = -\frac{(e^{3+x}-1)}{e^{3-y}}\mathrm{d} x$$
or with all things we know so far it is
$$\mathrm{d} y \approx -\frac{22}{20}\mathrm{d} x$$
We would like to reduce $x$ by about $0.003899$, which requires increasing y by about
$$\frac{22}{20}0.003899=0.0042889$$
Notice now that $3-\ln(20)=0.00426...$ almost precisely the figure we need in order to reach $20$ from $e^3$. Regardless of this last precision details, we could say that we are by chance almost as close to $\ln(20)$ in one case as we are to $\pi$ in another. This is not what is creating the approximation completely, this last is just adding a digit or two to the result because it can.
These last details are somewhat self-regulating since we are using linear approximations that are adding by themselves a digit or two more and the functions used are constantly some sort of $e^x$ so the needed ratio remains. What looks like some sort of chance (or design) is that all figures are sufficiently and relatively precisely close to each other so that we can use linear approximations and confirm that they are even closer.
Last but not least is indeed magic. Once we have reached a proximity of probably below fifth or sixth decimal digit, we allow ourselves a little bit of trickery. Imagine, we have the result of 19.9999999 for some value close to $\pi$, but in order to reach $\pi$ more closely we need 19.9992. We would totally allow this and still be surprised since our sense of being close allows a final margin of error to be just anything. In essence this is a trick since we are actually forcing the result close to what we want at the expense of enlarging the error.
You can find a similar magical effect on many even very serious sources which claim instead of the above that $\cos(\ln(\pi+20)) \approx 1$. $\cos$ is reducing the error around $1$ making the result even more "surprising", but unless this form is supported by some deeper theory, it is advisable to keep the form so that the surprising integer effect is lowered. (The form $\cos(\ln(\pi+20))$ is probably not going into the right direction since even $\cos(\ln(\pi+21))$  or $\cos(\ln(\pi+19))$  is "close" to 1 then.)
Far from being a complete trick, these almost integers are hiding some properties of the constants we know so well, which we would not be aware of otherwise.

All the above is saying why we have these two numbers so close, but it does not say if the situation is special in any particular way. If you run a simulation of around the same size random numbers, minimizing the value $av_{1}+bv_{2}+c$ you will notice that this behavior together with the error term below 0.001 is typical, you find about one or two solutions that use integers, $a,b,c$ in the range $[-25,25]$.
The fact that we have one large integer of 20 is another strong indication that there is no special linear relation between $e^{\pi}$ and $\pi$ that is not within the same rank of two average random numbers in the same range. For example, the testing shows that if there is more than one solution the average of integers employed is lower, and for our case $\frac{20+1+1}{3} \approx 7$ is just about right for the numbers that have one integer connection for the given margin of 0.001. There is no statistical evidence, if you want, that points to any special connection, which is to say that there could be as many as you like without any indication over which one is more correct.
(Of course the situation is simple enough to check all this using the probability theory, but for the moment we were quite happy with the simulation.)

This above is an illustration of the method. It gives the flavor. A full account actually goes over the function
$$-x-W_{-1}(-\frac{1}{e^{x}})$$ which is a solution for $y$ of $e^y-y=x$
We start from $x_{0}=e^3-3 \approx 17$ because $-x_{0}-W_{-1}(-\frac{1}{e^{x_{0}}})=3$
and we want to get to
$$-20 -W_{-1}(-\frac{1}{e^{20}}) \approx 3.1416 \approx \pi$$
We expand $-x-W_{-1}(-\frac{1}{e^{x}})$ around $e^3-3$ getting
$$-20-W_{-1}(-\frac{1}{e^{20}})=3+\frac{23-e^3}{e^3-1}-\frac{e^3(23-e^3)^2}{2(e^3-1)^3}+$$ $$\frac{e^3(23-e^3)^3(1+2e^3)}{6(e^3-1)^5}-\frac{e^3(23-e^3)^4(1+8e^3+6e^6)}{24(e^3-1)^7}+$$ $$\frac{e^3(23-e^3)^5(1+22e^3+58e^6+24e^9)}{120(e^3-1)^9}... $$ getting with first 5 terms $3.14163...$ only to realize that except at first few digits the value has no recognizable connection with $\pi$ itself.
If we make a crude assumption that $e^3 = 20 $ we have that the value is $$\approx 3+\frac{3}{19}-\frac{9\cdot 20}{2\cdot 19^3}+\frac{27\cdot 820}{6\cdot 19^5}-...$$ which nicely explains the logic we have been trying to follow in the text considering the structure of the value of $\pi$.
Another options is to have it all expanded around $x_{0}=20-\ln(20)$, because $-W_{-1}(-\frac{1}{e^{x_{0}}})=20$. And now you need only $\ln(20) \approx 3$ to express the approximation to $\pi$.
$$-20-W_{-1}(-\frac{1}{e^{20}})=\ln(20)+\frac{\ln(20)}{19}-\frac{10\ln^2(20)}{19^3}+\frac{410\ln^3(20)}{3\cdot 19^5}$$ $$-\frac{12805 \ln^4(20)}{6\cdot 19^7}+\frac{215641 \ln^5(20)}{6\cdot 19^9}-\frac{22884241 \ln^6(20)}{36\cdot 19^{11}}+...$$
Finally if you expand around $x_{0}=e^\pi - \pi$ since $-x_{0}-W_{-1}(-\frac{1}{e^{x_{0}}})=\pi$ you have even the error term in a more precise form:
$$-20-W_{-1}(-\frac{1}{e^{20}})=\pi+\frac{20+\pi-e^{\pi}}{e^{\pi}-1}-\frac{e^{\pi}(20+\pi-e^{\pi})^2}{2(e^{\pi}-1)^3}+...$$
And the second term defines the error since the third is already $\sim 10^{-9}$, $\frac{20+\pi-e^{\pi}}{e^{\pi}-1} \approx 0.00004$.
Comment: This is a really nice answer ! Thanks for providing it.
Comment: As the author of the article I object to the last edit done by @Benjamin Wang. It is not in the spirit of the markup done through the article and fix no errors. Therefore I ask the article to be reverted to the state that was before this unnecessary edit. And I find allowing this extensive change a very troubling sign, Imagine 10 people doing this, the article would look totally different. To what end? I simply insist of not changing cosmetics of any article to that extent on this site. Period. Among else because it is bordering disrespect too.
Comment: @user1134174 Done. My apologies.
Answer: You may find :

This curious near-identity was apparently noticed almost simultaneously around 1988 by N. J. A. Sloane, J. H. Conway, and S. Plouffe, but no satisfying explanation as to "why" $e^\pi-\pi \simeq 20$ is true has yet been discovered.

after some googling.
Comment: It's probably no accident that this is the very same S. Plouffe who coined the name "Ramanujan Constant" for the almost-integer $e^{\pi\sqrt{163}}$.
Comment: well now this answer has exactly 20 upvotes, no approximation necessary
Comment: "well now this answer has exactly 20 upvotes, no approximation necessary" - Sorry to burst your bubble, but one of those upvotes was only .99909998 of an upvote.  The site doesn't display fractional upvotes carefully enough.
Comment: Well, that's not good enough either. Really, that last one needed to be $(e^{\pi}-\pi-19)$'ths of an upvote. $.99909998$ isn't NEARLY good enough.
Answer: The proximity to $\pi$ is purely coincidental, as is often the case. Take for instance the root of the equation $x^4+x^5=e^6$, which is $x=\pi+0.000 000 029$. Many other far more accurate yet equally coincidental approximations are shown on this page: http://www.contestcen.com/pi.htm.
For each of these coincidences, one could be surprised and wonder: "Why is it so close? ". This is a naive question because a particular relationship is especially selected to be close to an exact value and chosen among an infinity of relationships more or less approximated.
One can find very easily as many coincidences as we want, with $\pi$ or/and with other usual constants, thanks to computer automatic search. The general principle of the method is described with examples in the paper "Mathématiques expérimentales" published on Scribd (in French): http://www.scribd.com/JJacquelin/documents.
Answer: The right question is why
$$e^\pi-\pi\approx 20-\frac{1}{1111+\frac{1}{11+\frac{1}{\sqrt{2}}}} $$
Comment: Hmmmm.... ${}{}$
Answer: As much as I wish there was some deep connection here, all (lack of) evidence points to the fact that this is nothing but mere, brilliant mathematical coincidence.
Comment: you could perhaps argue that nothing is a coincidence, and in time some weird area of number theory (perhaps alien to what we know today) will give this some better explanation than just "coincidence"
Comment: @Sabyasachi There are some that aren't coincidences, such as $e^{\pi\sqrt{163}}$ as Geoff mentions. This one is though, IMHO.
Comment: There are actually quite some examples where some operations on transcedental numbers turn out to be extremely close to an integer. Maybe something good for a new post?
Comment: @imranfat maybe a post on a list of coincidences.
Comment: @AlexBecker okay I wasn't aware of that.
Answer: If you think that's good agreement, try Ramanujan's constant $e^{\pi \sqrt{163}}.$ There is a deep explanation for the proximity in that case though.
Answer: Probably the simplest possible answer is in looking at
$$f(x,y)=x^y-y$$
around $(x,y)=(3,3)$ because both $\pi$ and $e$ are close to $3$
Taylor to first degree would be
$$f(3+x,3+y)=3^3-3+(y-3)(3^3\log(3)-1)+3^3(x-3)=24+(y-3)(27\log(3)-1)+27(x-3)$$
Notice that a very close expression (without $\log(3)$)
$$24+(y-3)(27-1)+27(x-3)=24+26(y-3)+27(x-3)$$
for rational approximations $e=\frac{19}{7}$ and $\pi=\frac{22}{7}$ is giving
$$24+(\frac{22}{7}-3)(27-1)+27(\frac{19}{7}-3)=20$$
So we are dealing with two functions that are very close and linear in the region which we are interested in, as you can see in the graph.

We want to arrive from the black dot at the blue line to the black dot at the orange line. But look, the situation is very symmetrical and quite linear so it is not surprise that we do not move too much from targeted $20$ when we use the intended full arguments not their rational approximations.
Let us swap the arguments to make this more obvious. Notice that both functions behave very linearly in this small space.
$$f_1(x,y)=x^y-y-20$$
$$f_2(x,y)=24+26(y-3)+27(x-3)-20$$
$$f_1(\frac{19}{7},\frac{22}{7})=(\frac{19}{7})^{\frac{22}{7}}-\frac{22}{7}-20=-0.079$$
$$f_2(\pi,e)=24+26(\pi-3)+27(e-3)-20=0.075$$
So we expect that swapping arguments will cancel the effect and keep the value intact, so we will get close to $20$ again, even with $f(x,y)=x^y-y$ and $(x,y)=e,\pi$
To make it totally clear create two implicit functions:
$$g_1(x,y):(\frac{19}{7}+x)^{\frac{22}{7}-y}-(\frac{22}{7}-y)=20$$
$$g_2(x,y):24+26(\pi+y-3)+27(e-x-3)=20$$
The difference between these two functions in the region we are interested in $(e-\frac{19}{7},\frac{22}{7}-\pi)$ is just about the precision we have in the expression which we are observing that is $0.0001$. As we push $x,y$ towards the value in $g_2$ that coincide with rational approximations, $g_1$ goes towards the intended values of $e$ and $\pi$.

Together this magic is consisting of three points:

Having rational approximations of $\pi$ and $e$ with a small denominator, actually the small one, $7$, with sufficient precision. Sure, this makes it easy to conjure up quite some integer connections, the simplest of which would be

$$\frac{e}{19}-\frac{\pi}{22}=0.0002...$$

Having $\pi$ and $e$ sufficiently close to $3$

A specific function $x^y-y$ that is comparable with another closely related linear function whose evaluation with rational approximations of $e$ and $\pi$ is an integer.

I am quite certain that just based on these principles of low but sufficiently precise rational approximations, one can invent tons of similar "surprising" examples. The choice of function is just that - a choice. The fact that $e$ and $\pi$ have the same small denominator in rational approximation might be something that would require some slightly deeper theory, but I doubt we would need much there.
Still, it is kind of a small theory, not just an incident I would say. It is just a couple of connected general properties.
Using the above system you can derive this "marvel":
$$\frac{1}{8}(e^4+\pi^4)=19.000905$$
Add-on:
After checking many similar examples, almost all of them follow the same pattern as long as the incigers (ha, did you see what I have done there) are relatively small.
I will show the system for $\pi$ but it is all the same for any other number and combination as long as the rational approximation is sufficiently good. For $\pi$ we set a reference to be $3$ but it could be any other rational number close to $\pi$.
Create an equation
$$a_0 + a_1(x-3)$$
where $a_0$ and $a_1$ are not extremely large, so that $m$ is an integer when $x$ is a rational approximation of $\pi$, $x_{\pi}$ like $\frac{22}{7}$.
$$a_0 + a_1(x_{\pi}-3)=m$$
Find a function $f(x)$ that is somewhat linear around $3$ so that
$$f(3) \approx a_0$$
and
$$f'(3) \approx a_1$$
if not equal. Then we expect $f(\pi) \approx m$ as well. Use this over $x+x^2$ and you will find not perfect but a good starter $\pi+\pi^2=13.01...$
Answer: Partial Answer
If $e^\pi-\pi\approx20$ then $e^x-x-20$ must have a root around $x=\pi$. Hence the function defined by $z=e^{f(z)}-f(z)-20$ should pass $f(0)\approx\pi$. So with the Lagrange Inversion Theorem, we can find a series representation for $f(z)$. If there's any special reason why $f(0)\approx\pi$, it would explain why $e^\pi-\pi\approx20$. We can find $f(z)$ by inverting $e^x-x-20$ at $x=3$, as follows. *
$$f(z)=3+\frac{[z-(e^3-23)]}{e^3-1}-\frac{e^3[z-(e^3-23)]^2}{(e^3-1)^3\cdot 2!}+\frac{(e^3+2e^6)[z-(e^3-23)]^3}{(e^3-1)^5\cdot 3!}\ldots$$
If we substitute $z=0$ and simplify the series, our question is equivalent to asking why: $$3+\sum_{n=1}^{+\infty}\frac{(23-e^3)^np_n(e^3)}{(e^3-1)^{2n-1}(2n-1)!}\approx\pi$$
Where $p_n(e^3)$ are polynomials in $e^3$. Indeed we see that the left hand side is approximately $3.1416$. This is expected since solving $e^x-x-20=0$ gives us $x\approx 3.141\,633\,302\,801\,037$.
Figure: $\color{red}{y=e^x-x-20}$ in red, $\color{blue}{y=x}$ in blue, $\color{purple}{y=f(x)}$ in purple and the partial sum for $\color{green}{y=f(x)}$ up to $n=3$ in green. The purple curve represents the reflection of the red curve over the line $y=x$. The purple curve crosses the $y$ axis around $(0,\pi)$, implying $e^\pi-\pi\approx20$. Geogebra link: https://www.desmos.com/calculator/nhbpehuuds

Potential Next Steps
The coefficients of $e^{3k}$ for each $p_n(e^3)$ are shown in the table below. For example, when $n=3$, $p_3(e^3)=e^3+2e^6$.
$$\begin{array}{|c|c|c|c|c|}
\hline
n&\text{Coefficient of }e^3&e^6&e^9\\
\hline
1&0&0&0\\
\hline
2&-1&0&0\\
\hline
3&1&2&0\\
\hline
4&-1&-8&-6\\
\hline
\end{array}$$
If you think you can see any particular pattern in the table, or would like to calculate more entries, it could poetntially lead to an explanation.
We could also attempt to compare the terms in the series to a series for $\pi$. Namely $f(0)=3+0.153-0.0123+0.00135-0.000169\ldots$. We could narrow our search to the series for $\pi$ with the same rate of convergence. I think this series has first order convergence.

* We can't invert $e^x-x-20$ around $x=0$ because the derivative is $0$ here. I tried at $x=1$ but couldn't get it to work.

Why is $e^\pi - \pi$ so close to $20$?


Trying to bring a bike on amtrak?

Question: I'm hoping to bring my bike with me on Amtrak from Syracuse, NY to the Albany, NY station. I feel like I have seen bike cars on Amtrak before but according to this article, bikes aren't allowed (http://maphappy.org/2015/03/things-that-will-get-you-kicked-off-amtrak/). I was wondering if there were any of you guys who have had personal experience w/ this topic (seeing someone get kicked out of Amtrak for carrying a bike, attempting to bring your own bike on Amtrak, etc.).
Answer: Well you most likely won't get kicked off because of the bicycle unless you just bring it on board without permission.
According to the Amtrak Policy there are a few routes that offer "walk-on" bicycle service but none of them travel through Albany.
You can reserve space on the bicycle rack or put it into baggage in Syracuse and pick it up in Albany, so I would just suggest doing that.
Answer: Regular bicycles take up a lot of space, are unbalanced, can't stack, and their pedals are ankle eaters. Unless they have a designated space, they are a hazard.
That said, if you pack your bike in a suitcase or carrying case, so that is the same size and shape as airplane checked luggage, you should be fine. This is what I do with my folding bike. When asked what it is, I say that it's exercise equipment.

Trying to bring a bike on amtrak?


Is it possible to change the sequence of convolution layer and pooling layer?

Question: Many CNN architectures sequentially consist of convolution layers and pooling layers. I just wonder if it is possible to change the sequence of convolution layers and pooling layers. If not, could you explain the reasons why a convolution layer precedes to a pooling layer?
Answer: In crude terms, a single convolution layer tries to capture to what degree certain feature is present in given region of figure. Max pooling layer is a downsampling strategy: instead of capturing presence of certain feature to a very fine-grained degree, the layer downsamples to certain classes like almost present, almost not present. (In crude terms because what exactly each layer learns is highly specific to dataset and network architecture used).
If you think of convolution as signal extraction and max pooling as a downsampling/smoothing strategy, it makes sense to use smoothing after signal extraction and not before.
Comment: I know the role, but I just wanna know whether it is possible to change the sequence in CNN when to deal with images.
Answer: Besides to what our friend has referred to, I want to add something which is somehow relevant. It is customary to convolve the inputs in the convolution layer, then they would be passed to the non-linearity and after that max-pooling is usually employed. I have experienced an alternative solution which can reduce the number of calculations for the activation function. Try to use filters, pass the outputs to the max-pooling layer, finally add the non-linearity, activation function, after exploiting max-pooling layer. It reduces the number of calculations without any changes to the outputs of the previous sequence of layers.


MySQL 5.7 Upgradation - Binary log basename

Question: Recently upgraded to MySQL 5.7 and I am in the process of setting up binary log. I have enabled the binary log but I am not able to set the log_bin_basename and binary log path. It showing it is a global read only variable. I need to separate binary logs from data directory. How to edit the log_bin_basename?. After editing in configuration file, the server not starting. Thanks in advance.
Comment: Is this the Master?  Or a Slave?  Please show us the line(s) in my.cnf that you changed before it "not starting".
Comment: @Rick James - I have not yet started the replication in this server. It is a newly built testing server. In default, there was only log_bin commented, nothing else was there, I have been adding other variable configuration.
Comment: If you are not capturing changes to the binlog, and you are writing to the Master, then the Slave will get out of sync.
Comment: Probably `log_bin_basename` can be set only in `my.cnf`, followed by a reset.
Answer: After, discussion with my colleagues, I found that, the log_bin_basename is read only variable and it took the value from the log-bin definition. So I added another variable log-bin, without modifying the default log_bin variable. Now the binary log enabled and basename pointed to the separate directory.
# BINARY LOGGING
#log_bin # This is default
log-bin                       =       /logs/binlog/mysql-bin
log_bin_basename              =       /logs/binlog/mysql-bin
expire_logs_days              =       5
sync-binlog                   =       1


Leggierissimo line

Question:
The 3rd bar on the top has a run. They're written as 8th notes, but that doesn't make any sense to me. Why are they written as 8th notes? Or does it actually rhythmically make sense?
Answer: The values don't really matter. It's in 3/4, so all that's left is nothing!. However, the whole piece has come to a stop - there are pause marks all over the previous notes in that bar. So it's more of an anacrucis to start the next part off again. Notice all those noteheads are smaller than usual, so it gives the performer carte blanche as to how quickly he plays them, and the tempo will recommence on the first notes of bar 4.
Comment: Those upvotes should have been dvs! I stated it was in 4/4. Rubbish!
Answer: As noted by Tim, the pause stops the music long enough to play whatever fills out the bar. The reason for using eighth notes is visual; the flag line gives a natural connection to the pattern but using 2 or more lines would just be cluttered.
Answer: Notes written in a tiny font like this are grace notes, and it's understood that

they don't count against the beats in the bar they're in
you're supposed to play them with free rhythm, almost certainly not all the same length.

(Grace note passages are usually just one or two notes, but Romantic composers, especially Chopin, went way overboard with them.)

Leggierissimo line


How can I keep my disk usage under control when regularly running the Bitcoin Core functional tests?

Question: What directories should I delete regularly to keep my disk usage under control when regularly running Bitcoin Core and the unit/functional tests?
Answer: This was answered on Twitter by various individuals.
You should remove the directory /tmp/test_common_Bitcoin Core regularly. For Martin Leitner-Ankerl this was 6GB of leftover files (leftovers only happen when tests fail or are canceled).
theStack also recommends running rm -rf /tmp/bitcoin_func_test_* every now and then.
The /tmp directory is usually only deleted at boot. It is uncommon on modern Linux distros for /tmp to be cleaned up automatically during runtime.
Occasionally (e.g. with the merge of #23371) you need to run rm -rf ./test/cache to force cache regeneration. In the #23371 case the pre-mined chain of the functional test framework changed and the functional tests using MiniWallet would fail (credit: theStack)
For general advice on compiling Bitcoin Core and running the tests see this doc from Jon Atack.
Answer: Hello Michael Folkson,
Thanks for sharing insights on controlling disk usage during Bitcoin Core functional tests. To optimize space management, consider:
Mounting /tmp with LVM
Explore using Logical Volume Management (LVM) to mount /tmp, allocating dedicated space. This prevents /tmp from consuming root directory space, enhancing disk usage efficiency.
Implementing LVM provides flexibility and avoids potential issues related to space constraints on the root partition.
Incorporate this best practice for improved Bitcoin Core testing environment performance.
Best regards.


Received monero, how many confirmations do I need to wait before fully confirmed?

Question: Why do we need to wait for such a long time when receiving monero? I thought it was 2 minutes only, but it seems that is not the case and I have to wait still a good 5+ minutes for a transaction to confirm.
Comment: The other question is about "when can I spend it", this one is "when do I get it".
Comment: Possible duplicate of [Number of confirmations and node location](https://monero.stackexchange.com/questions/4155/number-of-confirmations-and-node-location)
Comment: See the title "Received monero, how many confirmations do I need to wait before fully confirmed?". That said, the question *body* then asks about received time ~ which we have both covered both parts.
Answer: Seeing as you mixed two concepts in your question, receiving and full confirmation...
Just like practically every other cryptocurrency, two things happen when you send money: 1) the transaction gets broadcast and placed in a transaction pool. Your wallet sees (receives) this almost straight away, but it is locked until 2) it is mined in a block and then N subsequent blocks have been mined afterwards. In Monero's case, wallets keep the funds locked for N=10 blocks (which is roughly 20 minutes).
Cryptocurrencies do this locking / confirmation wait because of a few reasons, mostly to avoid double spends (whether intentional or accidental), but also because of the possibility of orphaned blocks.
With this knowledge,

Why do we need to wait for such a long time when receiving monero?

You don't. Your wallet receives / sees the transaction almost instantly.

I thought it was 2 minutes only, but it seems that is not the case and I have to wait still a good 5+ minutes for a transaction to confirm.

You thought wrong. For the transaction to be fully confirmed (unlocked) by your wallet, it takes 10 blocks (roughly 20 minutes). For comparison, Bitcoin aims for a 10 minute confirmation / unlock time.
Lastly, it's worth noting, there is nothing at the consensus level enforcing an N blocks lock time. The wallets / merchants implement this. Some wallets / merchants accept a lower block confirmation (even zero in some cases), but that's a risk they are willing to take (a risk they never get to use the funds because of a double spend for example).
UPDATE (for v0.15+)
The 10 block lock time is now enforced by the protocol (consensus). Therefore it is now only possible to spend funds with at least 10 blocks of age.
Comment: I love monero for its privacy features, but this transaction time delay of not being able to spend your coins again after sending it is a MAJOR UX problem. No matter how fancy a wallet looks, this is a built in hurdle for monero users.
Comment: Check this out.  Should help.  https://github.com/monero-project/monero/pull/5489
Answer: It's up to you, depending on how risk averse you are.
You can act upon transactions as soon as you see them in the txpool (if you do, it means they're valid, but not mined yet, but they're still fairly easy to get to never be mined by double spending them). It gives very good user friendliness though, and many businesses tend to accept those for low value transactions.
You can act upon transactions as soon as they get included in the blockchain.
You can act upon transactions once N blocks have been mined over the block the transaction is in. The higher N is, the less likely a reorganization will cause the transaction to be removed from the blockchain.
In the end, if comes down to a risk calculation, which is something you have to decide. There is no amount of time you can wait which will make the transaction 100% final, due to how the PoW system works. The finality probability just increases fast with confirmations, but never reaches 100%.
To answer your point about time: finding blocks is an inherently stochastic process. The network manages difficulty to aim at a 2 minute per block average rate, but since finding blocks is a "chance" based system, you won't get blocks on a perfect 2 minute schedule. You can see it as a "when do I get a 6" when rolling dice: on average, you get a 6 every 6th roll, but you don't get a 6 every 6th roll like clockwork. It's an average you tend to as you roll more and more.
Additionally, when the txpool is filled, it may take time for a transaction to get included in a block, even when blocks are being found: since miners include transactions with a better paying fee first, if there are too many transactions available that can fit in next block, a transaction may linger in the txpool for longer than it takes for the next block or next few blocks to be mined. This is one of the dangers of acting upon unconfirmed transactions that you have to consider as a business decision. Be safe, or offer your customer fast service.
If you're not a business making this decision, but just wondering when you're going to receive your monero you withdrew from a business, and you're just waiting for the "received..." line in monero-wallet-cli, not that the wallet sees when you received a transaction but will only tell you about it when it gets mined. If you want to see whether you've got monero incoming before it gets mined, you can use:
<code>  show_transfers pool
</code>
This will show any incoming monero before it gets mined.


Java 7 language features with Android

Question: Just wondering if anyone has tried using new Java 7 language features with Android?
I know that Android reads the bytecode that Java spits out and turns it to dex. So I guess my question is can it understand the bytecode of Java 7?
Comment: Alternatively, maybe you can use the Java 7 language features but compile to Java 6 bytecode?
Comment: Android Studio will now give you a notification when creating a new project:
"With minSdkVersion less than 19, you cannot use try-with-resources, but other Java 7 language features are fine"
Comment: Yeah I know :) We are finally using Java 7 in our project.
Answer: If you are using Android Studio, the Java 7 language should be enabled automatically without any patches. Try-with-resource requires API Level 19+, and NIO 2.0 stuff are missing.
If you can't use Java 7 features, see @Nuno's answer on how to edit your build.gradle.
The following is for historical interest only.

A small part of Java 7 can certainly be used with Android (note: I have only tested on 4.1).
First of all, you could not use Eclipse's ADT because it is hard-coded that only Java compiler 1.5 and 1.6 are compliant. You could recompile ADT but I find there is no simple way to do that aside from recompiling the whole Android together.
But you don't need to use Eclipse. For instance, Android Studio 0.3.2, IntelliJ IDEA CE and other javac-based IDEs supports compiling to Android and you could set the compliance even up to Java 8 with:

File → Project Structure → Modules → (pick the module at the 2nd pane) → Language level → (choose "7.0 - Diamonds, ARM, multi-catch, etc.")

This only allows Java 7 language features, and you can hardly benefit from anything since a half of improvement also comes from the library. Features you could use are those which do not depend on the library:

Diamond operator (<>)
String switch
Multiple-catch (catch (Exc1 | Exc2 e))
Underscore in number literals (1_234_567)
Binary literals (0b1110111)

And these features cannot be used yet:

The try-with-resources statement — because it requires the non-existing interface "java.lang.AutoCloseable" (this can be used publicly in 4.4+)
The @SafeVarargs annotation — because "java.lang.SafeVarargs" does not exist

... "yet" :) It turns out that, although Android's library is targeting for 1.6, the Android source does contain interfaces like AutoCloseable and traditional interfaces like Closeable does inherit from AutoCloseable (SafeVarargs is really missing, though). We could confirm its existence via reflection. They are hidden simply because the Javadoc has the @hide tag, which caused the "android.jar" not to include them.
There is already as existing question How do I build the Android SDK with hidden and internal APIs available? on how to get those methods back. You just need to replace the existing "android.jar" reference of the current Platform with our customized one, then many of the Java 7 APIs will become available (the procedure is similar to that in Eclipse. Check Project Structure → SDKs.)
In additional to AutoCloseable, (only) the following Java 7 library features are also revealed:

Exception chaining constructors in ConcurrentModificationException, LinkageError and AssertionError
The static .compare() methods for primitives: Boolean.compare(), Byte.compare(), Short.compare(), Character.compare(), Integer.compare(), Long.compare().
Currency: .getAvailableCurrencies(), .getDisplayName() (but without .getNumericCode())
BitSet: .previousSetBit(), .previousClearBit(), .valueOf(), .toLongArray(), .toByteArray()
Collections: .emptyEnumeration(), .emptyIterator(), .emptyListIterator()
AutoCloseable
Throwable: .addSuppressed(), .getSuppressed(), and the 4-argument constructor
Character: .compare(), .isSurrogate(), .getName(), .highSurrogate(), .lowSurrogate(), .isBmpCodePoint() (but without .isAlphabetic() and .isIdeographic())
System: .lineSeparator() (undocumented?)
java.lang.reflect.Modifier: .classModifiers(), .constructorModifiers(), .fieldModifiers(), .interfaceModifiers(), .methodModifiers()
NetworkInterface: .getIndex(), .getByIndex()
InetSocketAddress: .getHostString()
InetAddress: .getLoopbackAddress()
Logger: .getGlobal()
ConcurrentLinkedDeque
AbstractQueuedSynchronizer: .hasQueuedPredecessors()
DeflaterOutputStream: the 3 constructors with "syncFlush".
Deflater: .NO_FLUSH, .SYNC_FLUSH, .FULL_FLUSH, .deflate() with 4 arguments

That's basically all. In particular, NIO 2.0 does not exist, and Arrays.asList is still not @SafeVarargs.
Comment: Worth to mention that `AutoCloseable` interface doesn't exist in Android runtime until ICS (or perhaps until HoneyComb). So even if you use patched android.jar you'll receive `NoClassDefFoundError` on 2.x system.
Comment: try with resources can now be used on SDK 19 (Android Kitkat). see http://tools.android.com/recent/androidstudio032released
Comment: Great answer. I hope full jvm level support will happen soon in future, `nio2` and other goodies will definitely be a good news.
Comment: @deviant: That requires modifying the Dalvik VM, since Java 8 lambda uses `invokedynamic` which is not supported by the JVM targeting Java 6.
Comment: You might want to add an update that as of Android studio 3.2, Language level 7 is fully supported, as is try-with-resources if you're compiling against KitKat
Comment: what about ADT ? is there the possibility to use java 7 with adt?
Comment: @blackbelt yes, read my answer on http://stackoverflow.com/questions/20480090/does-android-support-jdk-6-or-7/
Comment: @blackbelt starting with ADT 22.6
Comment: Very interesting research! Hope this will lead into official Java 7 support on Android in some reasonably short time.
Comment: are you saying it is possible to develop in JDK 7 & Android using the inteliJ IDE ?
Comment: I posted an answer below of a git project that does allow you to use some Java 7 features, which solve some issues listed in this post.
Comment: This trick works only for Java7. Any advices how we can use Java8 lambdas?
Comment: In Android Studio 1.0.2 the option is called `Source Compatibility` instead of `Language Level`
Comment: Quick question, does Android support `Files.move()` method ? Beginning from what version ?
Comment: @JonasCz No, the class does not exist in the Android runtime.
Comment: try-with-resources statement can be used, it's a syntax sugar,  there are no runtime dependent on java.lang.AutoCloseable
Answer: EDIT: At the time this was written, the latest release was Android 9 and Eclipse Indigo. Thing have changed since then.

Practical answer

Yes, I have tried. But this is not a great test as the compatibility was limited to level 6 with no way (no simple way at least) to really use java 7:

First I installed a JDK7 on a machine that had no other JDK installed - Eclipse and Android are not installed either:

Then I installed a brand new Eclipse Indigo and checked it was actually using the JDK 7 (well, as this is the only one and as this is the one I've selected I would have been surprised)

Then I installed the latest version of the Android SDK (EDIT: Honeycomb, API13, at the time this post was written). It found my JDK 7 and installed properly. The same for ADT.
But I had a surprise when trying to compile and run a Hello Word Android app. The compatibility was set to Java 6 with no way to force it to Java 7:

I tried with a non-Android project, a regular Java one, and I had the explanation. The compatibility level seems to be limited by Eclipse (see the message at bottom of the following image):

So I had Hello World working, and also other apps, more complicated and using SQLite, Listview, Sensor and Camera, but this only proves that the compatibility handling of Java 7 seems to be well done and working with Android.
So, did someone try with the good old Ant, to bypass the Eclipse limitation seen above?

Theroetical answer

Anyway, the SDK is designed to be used with Java 5 or 6, as explained here.
We may have something working with Java 7, but it would be working "by accident". The building of the DEX may work properly or not, and once the DEX built, it may work or not. This because using a non-qualified JDK gives unpredictable results by definition.
Even if someone has succesfully built an Android app under plain Java 7, this does not qualify the JDK. The same process applied to another application may fail, or the resulting application may have bugs tied to the use of that JDK. Not recommended.
For those who are involved on webapps development, this exactly the same as deploying a web application built under Java 5 or 6 under an application server qualified for Java 4 only (let's say Weblogic 8 for example). This may work, but this is not something that can be recommended for other purposes than trying.
Comment: Also do note that if your toying with multiple versions of Java the tools provided are not compatible. What I mean is that if you first signed your app with jarsigner from java 6 tools and then later installed java 7 and signed a new version of our app with the jarsigner that came with java 7 and the same keystore as previously the signatures would not match!
Comment: Thanks for that detailed review. So looks like you can't use Java 7 language features but still use Java 7 as Java 6. Hopefully this changes soon :)
Comment: This is with Eclipse. With Ant, this is probably possible. I hope someone will do the test and I blame myself for being too lazy to do it :)
Comment: Yes Varga, but I don't think the compiler version limitation comes from Ant but from Eclipse.
Answer: Quote from dalvikvm.com:

dx, included in the Android SDK, transforms the Java Class files of Java classes compiled by a regular Java compiler into another class file format (the .dex format)

That means, the .java source file does not matter, it's only the .class bytecode.
As far as I know, only invokedynamic was added to the JVM bytecode in Java 7, the rest is compatible to Java 6. The Java language itself does not use invokedynamic. Other new features, like the switch statement using Strings or the multi-catch are just syntatic sugar and did not require byte code changes. For example, the multi-catch just copies the catch-block for each possible exception.
The only problem should be that the new classes introduced in Java 7 are missing in Android, like AutoCloseable, so I'm not sure if you can use the try-with-resources feature (somebody tried it?).
Any comments on that? Am I missing something?
Comment: Now the problem is how do we configure such that Java 7 source codes compile to Java 6 class files, especially in eclipse?
Comment: @Warpzit His only question is " **Can Android understand java 7 ?** " Ignorance is never a solution/answer...
Comment: The only question remaining is why would you even bother?
Comment: @Warpzit the bigger question should be **Why a developer won't bother for all this confusion ?**
Comment: @Amit because he's come to realize Android is different from Java and in order to work with Android he has to use the tools that is offered.
Answer: As of the Android SDK v15, along with Eclipse 3.7.1, Java 7 is not supported for Android development. Setting the source compatibility to 1.7 mandates setting the generated .class file compatibility to 1.7, which leads to the following error by the Android compiler:

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
Answer: To expand on the above answer by @KennyTM, if you are targeting 4.0.3 and above (minSdkVersion=15), you can use the hidden APIs by adding a few classes to your target's SDK android.jar.
Once you do this, you can use try-with-resources on any Closeable, as well as implement AutoCloseable in your own classes.
I've made a zip containing sources and binaries of all the classes that needed to be modified in android.jar to make these APIs available. You just need to unpack it and add the binaries to your android-sdk/platforms/android-NN/android.jar
You can download it from here: http://db.tt/kLxAYWbr
Also of note is that, in the past couple of months, Elliott Hughes has made a few commits to the Android tree: finished off AutoCloseable, added SafeVarargs, unhidden various APIs, fixed Throwable's protected constructor and added support for version 51 class files in dx. So, there is finally some progress going on.
Edit (April 2014):
With the release of SDK 19 it is no longer necessary to patch android.jar with the additional APIs.
The best method to use try-with-resources in Android Studio for an app that targets 4.0.3 and above (minSdkVersion=15) is add the following compileOptions to your build.gradle:
android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

Android Studio will complain that try-with-resources can't be used with this API level, but my experience is that it can. The project will build and run without issue on devices with 4.0.3 and above. I've experienced no issues with this, with an app that has been installed into 500k+ devices.

To ignore this warning, add the following to your lint.xml:
<issue id="NewApi">
    <ignore regexp="Try-with-resources requires API level 19"/>
</issue>

Comment: I find it interesting that Android Studio code warning says try-with-resources is new in API 13 and I should be using it. Though don't have time to actually test if it is working correctly.
Answer: It seems that getting this to work with pure ant is a bit of a kludge.
But it worked for me: http://www.informit.com/articles/article.aspx?p=1966024
Comment: I looked for this for a long time. To cut people trouble through filtering through the article, you'll need to change the `    ` line in the build.xml that's provided by android (not the one in your project!). For me it was in /opt/android-sdk-update-manager/tools/ant/build.xml
Comment: No you don't. You can overwrite those properties with `custom_rules.xml`, see my answer here: http://stackoverflow.com/a/24608415/194894
Answer: In order to use Java 7 features in code build by Android's ant based build system, simply put the following in your custom_rules.xml in your projects root directory:
custom_rules.xml:
<project name="custom_android_rules">
    <property name="java.target" value="1.7" />
    <property name="java.source" value="1.7" />
</project>

Answer: Some people might be interested in this git project I've found, that seems to allow to run Java 7 on android.
https://github.com/yareally/Java7-on-Android
However too much of a risk if I add this in the current project I work on. So I'll wait until Google to officially support Java 7.

Java 7 language features with Android


5e: Catapult Spell: Does my enemy gain advantage Dex Save within 5'

Question: Just wondering if there are any disadvantages to casting the spell Catapult within melee range of an opponent. Latest DM I had argued that the enemy would gain advantage on their DEX save to make it match up with other ranged spell attacks.
Answer: There is no basis in the RAW for them to have Advantage on the saving throw, though the rules do give DMs latitude to change things as they see fit. In this particular instance, the spell is 'aimed' by virtue of the magic you're wielding as opposed to you yourself, hence the reason for the Dex save.
While I assume your DM's intent was to balance it when compared to ranged attacks in melee range being made with disadvantage, there's no basis for this to apply to an opponent's need to make a Dexterity save. I suspect part of the reason for the rules to be written this way is that a Ranger missing his shot is simply down 1 arrow, while a Wizard missing with this spell would be down a 1st level spell slot which can be a significant loss at early levels.
By your DM's logic, it would seem the opponent is entitled to make any Dex save with advantage provided they were within 5' of the caster at the time of casting. Possibly only if the attack requiring a Dex save emanates from the caster. The specific issue I would take with this is that the Mage Slayer feat allows such a thing to be done. Unless the opponent has that feat, it can be a bit unfair for them to have access to that feature without paying for it.
RAW, the opponent doesn't have advantage on the save. However, also RAW, the DM has the final say provided they understand this is a notable nerf to casters. If you're feeling particularly metagamey, you could use it to your advantage and later on claim advantage when the evil wizard is cornered and trying to force a Dex save from their fireball, lightning bolt, burning hands or pretty much any other evocation spell that emanates from them (which might be almost all of them).
Comment: You might want to add some thing about Catapult being especially nerfed, because the projectile keeps moving if the first target succeeds his save -- which means someone else (including caster) might get hit by it if it doesn't run into a wall or reach the end of the range, because of the advantage.
Comment: Logically that makes sense, but do the RAW allow it to continue? For example, if I miss my target with the arrow, is there an in-game risk of hitting my ally who's right behind the target? Logically this makes sense, but is there a basis for it in the rules?
Comment: Arrow has no RAW support to continue. But catapult is clear the projectile does keep moving. "The object flies in a straight line up to 90 feet in a direction you choose before falling to the ground, stopping early if it impacts against a solid surface." So if it doesn't hit something, i.e. successful save, it keeps going until it reaches the 90 foot range. Which is awesome if you can line up a lot of enemies, and sucks if an ally is behind the target.


How to go from all four Moscow's (DME-SVO-VKO-ZIA) international airports to the city center?

Question: What are the best options (cost, time) from all four of Moscow's international airports to the city center with 1 Carry-on bag and 1 checked bag abt. (23 KG) ?
Answer: The least stressful is Aeroexpress. It's a non-stop train from the airport to one of the city's railway stations which are in the center. One-way ride is 30 to 40 minutes. It serves Sheremetyevo, Domodedovo and Vnukovo. Other possibilities are bus and taxi. Bus may cost less than Aeroexpress but it will bring you to the end metro station and you'll have to change to the metro if you want to reach city center.
There is no Aeroexpress to/from Zhukovsky, so the only possibilities are Express-bus and Train+Bus.
Answer: As Neusser has already answered (+1), the simplest way it to take Aeroexpress speed train that connects each of the three main airports (Sheremetyevo, Domodedovo and Vnukovo) with stations in Moscow center. It is rather expensive, especially if you travel in a group (and hence need several tickets), but runs on time and without any problems. Just check the timetable in advance, as the intervals between successive trains are relatively long (from 30 minutes to 1 hour, and a long break in night).
Another option is taxi (better order a taxi through app such as Yandex.Taxi or Uber; some airports AFAIK even have kiosks to order Yandex.Taxi). This is more expensive that Aeroexpress if you travel alone, but can even be cheaper if you travel in a group. However, travel times are often unpredictable due to Moscow traffic.
There are also regular buses that connect the airport with subway stations. They are very cheap, but they can be slow (due to traffic and/or due to their schedule), and you may find the whole system harder to understand (you should find the needed bus numbers in advance, find where they stop at the airport, check the schedule etc.) Also they will bring you only to a subway station on the outskirts of the city, and you will need to take additional subway ride.
Note also that Zhukovsky is a very small airport only recently put into operation, so there is no Aeroexpress, and other transportation options may be limited.
Answer: I think that a decent option is Uber or Yandex.Taxi app. The caveat here is that you would want to already have local SIM with data plan. If you come with international SIM you can spend on data in the roaming more than on the cab. Most likely, you can pick up a data SIM in the airport.
Comment: Too bad the question's closed, but at the very least, DME has Gett and Yandex.Taxi counters inside the arrival hall, so you don't even need a local SIM card, you can just ask there. Yandex' economy option is very comparable to the cost of aeroexpress.


Charge on conductors

Question: In a books Concepts of Physics by HC Verma,It is written that one a conductor only one surface cannot be charged.Both the surfaces have to be charged in order for the net electric field inside the conductor to be zero.I had a doubt regarding this.Suppose a conductor has a positive charge only on one side.Then the positive charge will create an electric field due to which the free electrons inside the conductor will move away from the field.So one side there would be a positive charge and on one side a negative charge.These charges will also create an electric field on a direction opposite to that of the field by the positive charge on the surface.Hence the Net electric field will become zero at some point inside the conductor.So why is A conductor charged only on one side not possible?
Comment: Please elaborate your question. In one part you are saying that ***".Then the positive charge will create an electric field due to which the free electrons inside the conductor will move away from the field.So one side there would be a positive charge and on one side a negative charge."*** and you are asking why charge on only one surface is not possible. Your answer is in your question.
Comment: With only one surface charged the net electric field is still 0.So why is it necesssary for both surfaces charged to create a net electric field
Comment: And can you say the page number where it is written?
Comment: Page 134 Hc Verma Part 2
Comment: it must have been for an isolated neutral (uncharged) conductor in electric field , when a isolated neutral conductor is placed in an electric field only one surface getting charged is not possible. but if it is not clear can you please provide in which line it is written
Comment: All right I Will share a photograph
Answer: Conductors (here) are of two types :
1) Having net charge
2) Not having net charge (*Conductors can have a charge separation without being injected with external charges)
Lets get to the theory why for Electric field inside a conductor(neutral) to be zero,  both sides must have charge.

Now lets see what happens if we place a 1 Coloumb Charge inside the conductor.

The negative charges on the left surface and positive charges on the right surface will push the 1C charge towards left.
And the Electric field will push the 1C charge towards right.
Both of these forces cancel each other out and so the net
Electric field inside the conductor is 0.
It is not possible to charge only one side of the (*neutral) conducting cube. This is because the moment when a charge develops on one side , due to that charge the opposite charges are repelled to the other sides thus causing charge separation on both sides.
Edit : In the second photo , it should be 'Repelled by $\color{red}{positive}$ charge on the right surface'

Charge on conductors


I can't retag or otherwise edit a question while waiting for an edit I reviewed from queue to be approved or rejected

Question: Happened on this question, fwiw. In particular I voted to reject it, then visited to add comment and vote to close, and wanted to add a java tag, but couldn't because had to wait to see the fate of the edit.
Comment: I'm afraid this will be marked as [tag:status-bydesign] and possibly as a duplicate.
Answer: The problem is that in the general case a single reject vote could be an outlier. If the edit was subsequently approved any other edits that occurred in the intervening period would introduce a three-way merge.
Allowing just the edits that wouldn't conflict means rejecting the ones that would. The error message "sorry your edit might conflict" is less intuitive and technically harder than blocking all edits whilst a review is in progress.
(There's also the question that if you allowed this should multiple non conflicting reviewed edits be allowed to be pending simultaneously?)
In short most edits should be fixing all the issues anyway and if you're that desperate to edit before review is over you can go through improve, untick helpful and then revert the edit manually as a binding "reject+edit" action.
In the specific instance I don't quite follow the logic of "fix the tags but reject fixing any other issues" either. An improve alone would be sufficient, with unhelpful as appropriate  depending on if you think the suggestion was too minor.


How to make colored backgrounds not influence the color of an object

Question: I am making an animation with a green background. When a lamp shines on my mesh, the background somehow makes the lamp shine on my mesh green as if the lamp was shining on it through green glass. How do I make this not happen? My mesh is opaque, has a diffuse BSDF, and is white. Thanks in advance.
Answer: When you are using any color (or image) as background in the world settings you have to imagine a shpere that completely surrounds the scene and that is emitting colored light from every point.

There are a few alternatives.

One is to have two different shaders for the background, and control them using a light path node, so that difuse rays are a neutral color and the rest are green.

You can use a neutral color (or no background at all) for the background and enable transparency (film transparent), and then add the background color in the compositor using alpha over.

I hope you are not putting green behind the object with the idea of using a chroma key later on to take away the background. If that is the case then just render with a transparent background and save in a format that can handle an alpha channel (EXR or TIFF).
Comment: How do you save an animation render in a format that has a fully transparent background? Say if your video editing software has not choice of removing alpha channels..... I thought of using a green background then chroma key, as my video software handles this, but not alpha
Answer: In Blender 2.90.1 you can turn off the Diffuse option under Ray Visibility to make the background color not affect the scene's objects.
Note that this option is only available for the Cycles render engine.
Answer: To answer urema's final question, to get an output with an alpha channel that works well, set your output type to be PNG.
Your output filename should be a directory.
When you choose PNG, there will be 3 colors available; choose RGBA, then render.
Your chosen Directory will be full of png images, one for each frame.
Programs like Hitfilm can import PNG Sequences and your workflow should now be the same as if you were working with an MP4 (ex you can put the png sequence into a Composite).


Export to png without an artboard? Illustrator CS6

Question: Is it possible to select an object on an artboard and turn that into a png? I have a lot of small titles I want to export as pngs but I dont want to make lots of small artboards for them.
Comment: Does CS6 have slice options? If yes, you can benefit from them.
Comment: Copy, New Document, Paste, Export, close (don't save).. via shortcuts.... c, n, enter, v, e, w, d..... repeat...
Answer: You can make artboards for all selected objects with this script:
var sel = app.selection;
var s = sel.length;
while (s--) app.activeDocument.artboards.add(sel[s].visibleBounds);

And then to export all the artboards to PNGs as usual. The export can be done with a script as well.
For example this script (based on this example) will save a selected object to 'd:/1.png':
if (app.selection.length) {

    var ex = new ExportOptionsPNG24();
    ex.artBoardClipping = true;
    var exType = ExportType.PNG24;
    var file = new File("d:/1.png");

    var doc = app.activeDocument;
    doc.artboards[doc.artboards.getActiveArtboardIndex()].artboardRect = selection[0].visibleBounds;
    doc.exportFile(file, exType, ex);
    app.undo();

} else { alert('Please select an object') }

If you have many objects and you need to export them all, you need to decide how to handle with file names.
I can combine these two scripts into one (select objects, make artboards for them and export all these artboards with names like 1.png, 2.png, 3.png...) but I see no much sense.
Comment: Nice and simple, but I agree: what is the purpose? Which workflow these days require having a ton of PNGs containing text?
Answer: A workaround:

In the left I have in Illustrator a "drawing" which contains three objects. In the other window in the right I had an empty drawing. It was opened as a new file.
I dragged the red object to the empty drawing and exported the drawing as PNG.
The PNG has nothing extra when it's opened in Photoshop:

The objects in the original drawing can overlap with no harm if you can select every object separately. There's no need to drag it to the other window, you can as well copy & paste. You can make selections in the layers panel.
Using Photoshop: If you have cut an object to the clipboard and open a new image in Photoshop you get an option to accept exactly the same pixel dimensions as the object had in Illustrator. If you paste an Illustrator object as pixels to an already opened image in Photoshop you can stretch the dimensions of the object with no quality loss as long as you have not nailed the pasting finally by hitting enter.
I'm afraid the shown methods will not be a great help if you must extract hundreds of items as separate PNGs. It needs something clever beyond the scope of this answer.
Answer: Edit I just realized that the question was phrased within the context of CS6 version of Illustrator. Not sure if that version has "Export Selection" or not. If so then I hope this helps! If not then I guess I'll just leave this answer here in case someone with a different version of illustrator stumbles along this question with the same needs
You can do this with "Export Selection". Select the object(or multiple items if you want a combination saved in one PNG), then go File>Export Selection…Make sure "Assets" is selected at the top of the window and not "Artboards", then choose PNG in the format window. You can also choose other setting like the save location or scaling if you would like.
You can also do this for multiple objects at a time, which sounds like it would be very useful in your situation.
Open up Asset Export (Window>Asset Export). Drag each asset you want to be exported into the Asset Export Window. Once you have added all the assets, choose which assets you want to be exported by clicking on them(command or ctrl click to select multiple, or shift-click the first and last asset to select them all). Chosen assets will have a blue box around them. Once you've chosen the assets you want to export, choose the format you would like(PNG in this case), and click "Export…". Illustrator will export each of these assets individually to PNG's and put them all in one convenient folder for you. No artboards required!
Comment: No "export selection" in CS6. You should still leave it. It may help future visitors `:)`
Comment: @Scott Gotcha, my bad haha
Comment: @Scott Gotcha, my bad haha


Why is contribution to intensity of light equal for both magnetic and electric field?

Question: In chapter on waves, my sir taught us that intensity of wave is directly proportional to the square of amplitude of wave. So when we were asked what is contribution of electric field and magnetic field to intensity of light, I used the relation that amplitude of electric field is $c$ times amplitude of magnetic field. When I used this I got the contributions of magnetic field to electric field to be in ratio of $1:c^2$. But this was wrong and the answer was $1:1$. When I asked my sir the reason for this, he said both cases are different, but got angry when I asked him to elaborate. Could anyone please explain this to me?
Answer: The energy per unit volume, $U_\text{B}$, in a magnetic field is given by
$$U_\text{B}=\frac{1}{2\mu_0} B^2.$$
The energy per unit volume, $U_\text{E}$ in an electric field is
$$U_\text{E}=\frac12\epsilon_0 E^2.$$
As you say, in an e-m wave,
$$E=cB.$$
Therefore
$$U_\text{E}=\frac12 \epsilon_0 c^2B^2=\frac{1}{2 \mu_0} B^2=U_B.$$
Here we have used the relationship $\mu_0 \epsilon_0=\frac{1}{c^2}$.
The mean rate of flow of energy in a plane wave per unit area of wavefront is then
$$\bar I=c\left[\frac{1}{2\mu_0}\overline{B^2} +\frac12\epsilon_0 \overline{E^2} \right].$$
The two terms in the square brackets are equal, that is the electric field energy and magnetic field energy contribute equally to the wave energy per unit area, that is to the wave intensity.
Comment: You *can* use the relationship between amplitude and intensity, with the (peak) electric field as amplitude. That's because equal energies are contained in the electric and magnetic fields, so the contents of my square bracket can be written as a single term, $\epsilon_0 \overline{E^2}$.
Comment: Could you please be a bit direct and state how intensity contributions are equal due to the two fields? Because I'm confused after reading your answer.. but thanks for answering!
Comment: You were quite right to ask for more clarity. I've added a bit to my answer.
Comment: I understood your answer(thanks!) but I also had another question, why can't we use the relationship between intensity and amplitude of the wave (intensity directly proportional to square of amplitude of wave) in this case?
Comment: Is the reason because that relationship is valid only for mechanical waves?
Comment: Thanks, I got that!
Comment: Old remembrances of when I was at university +1
Answer: In addition to the other answers, here is actually a simple argument (partially hinted at in Philip's answer):
The EM wave is fundamentally an oscillation between electric and magnetic fields. In other words, the energy goes back-and-forth between the electric and the magnetic component. Therefore, the electric and magnetic energies necessarily have to be equal !
How this translates to electric field and magnetic field values depends on the unit system used.
Comment: I'm not really sure what to make of that peculiarity, apart from the fact that E and B maxima have to be at the same place so they can be swapped in case of a change of frame.
Comment: Good point (note that your example propagates in the z direction). In fact maxwell's law tells you that E increases most in time where curl of B (so dBy/dz) is maximum, so the zero of E matches the zero of B.
Comment: [This comment  has been corrected. It originally preceded Nicholas's reply.]  "the energy goes back-and-forth between the electric and the magnetic component." How does this work? For a plane wave polarised wave propagating in the  direction we have, do we not?
$$_y=_0 \sin(−)\ \ \ \ \text{and}\ \ \ \ \ B_z=_0 \sin(−).$$
In other words the two fields vary in phase. [You can include a phase constant if you wish, but it's the same constant for each field.]
Comment: Thank you. But I still don't get this "energy back and forth" claim. For oscillations in an electric circuit consisting of an inductor, a capacitor (and, if you like, a little resistance) I agree that energy *does* swap backwards and forwards between inductor and capacitor (that is between B field and E field), but I don't see how this applies to an e-m wave.
Comment: Every wave/oscillation that I can think of is a periodic exchange between two forms of energy. Pendulum: kinetic and potential. LC (as you said) : magnetic and electric. Sound (air): thermal and kinetic.Sound (solid): elastic potential and kinetic. Tsunami: gravitation potential and kinetic… In all those cases, both forms store half the energy. Where the maximum is located (the phase) doesnt matter so much, and is a matter for dynamic analysis (my previous comment), as long as the total energy is conserved in time. It is true that for EM waves in vacuum, both energy components are in phase.
Comment: @ Nicolas  "In all those cases, both forms store half the energy." I agree. What I'm not convinced about is that in a wave the energy swaps back and forth between the two kinds. In an oscillation of lumped components, e.g. mass and spring, or L and C, it does swap back and forth – no argument.
Answer: The ratio of the energy densities can't be $1/c^2$, because their ratio has to be unitless.
The easiest way to see that the energy densities must be equal is by considering the case where two wave packets collide head-on, requiring that energy be conserved regardless of the polarization. This argument goes through regardless of what system of units you use.


migration assistant fails to move data files

Question: Using Migration Assistant, with direct connection by Ethernet, between two Mac Minis, both running Mavericks.All my applications moved, but none of my data files.
Have tried moving my data to various locations on the source computer but nothing works.
Answer: I am sure you read the instructions how to migrate on Mavericks.
There is also the manual data transfer information here.


Is there any way to limit reflection on a specific part of a mesh

Question: I have horrible reflections of the inside of the ring when i render, i was just wondering if there is a way to hide these reflections, maybe adding an invisible plane that does not show on the render but does on the reflections? It just makes the render look horrible.
Answer: Select the faces inside the ring and give them their own material. You can then assign them a material that doesn't reflect (or has diffuse reflections) and render that. If you really need to fake a reflective material inside the ring that can't see the rest of the ring....
Take that same new inner material and Set it to holdout. Do a render. Switch the material back to the same as before and do another render, but set the number of bounces in this new render to 1 or otherwise disable reflections. You can even hide the whole rest of the ring for the second render.  Then composite the two images together.