How can I export tables to Excel from a webpage

Question: How can I export tables to Excel from a webpage. I want the export to contain all the formatting and colours.
Comment: Why was this considered "opinion-based"? This is a very straightforward technical question.
Comment: The easiest way is probably to export a HTML document, which Excel can open.
Comment: @user where are you declaring column sizes and such? I'm not deeply familiar with exporting data to Excel but you may need to declare them inline, i.e. `<td style="background-color: ...`
Comment: @Pekka I've tried that, it loses all formatting/css/column size etc
Comment: @user - there are at least two different issues here: 1) formatting the data so that it appears correctly in Excel, and 2) exporting the data using Javascript so that it sets the mime-type correctly, prompting the user to save the file. Are you trying to solve both of these problems?
Comment: @user, did you find a solution that answers the question?  If so, could you accept?
Comment: simply select entry html table and drag it to excel. if html is valid, then all must work. Like here  http://www.mrkent.com/tools/converter/index.htm (if you need automated way, then this is not a solution)
Comment: I suggest you check out [TableExport](https://github.com/clarketm/TableExport). It is a simple, easy-to-implement plugin to export HTML tables to `xlsx`, `xls`, `csv`, and `txt` files. It also works in all major browsers.
Comment: https://tableexport.v4.travismclarke.com
Answer: Far and away, the cleanest, easiest export from tables to Excel is Jquery DataTables Table Tools plugin.  You get a grid that sorts, filters, orders, and pages your data, and with just a few extra lines of code and two small files included, you get export to Excel, PDF, CSV, to clipboard and to the printer.
This is all the code that's required:
  $(document).ready( function () {
    $('#example').dataTable( {
        "sDom": 'T<"clear">lfrtip',
        "oTableTools": {
            "sSwfPath": "/swf/copy_cvs_xls_pdf.swf"
        }
    } );
} );

So, quick to deploy, no browser limitations, no server-side language required, and most of all very EASY to understand.  It's a win-win.  The one thing it does have limits on, though, is strict formatting of columns.
If formatting and colors are absolute dealbreakers, the only 100% reliable, cross browser method I've found is to use a server-side language to process proper Excel files from your code.  My solution of choice is PHPExcel  It is the only one I've found so far that positively handles export with formatting to a MODERN version of Excel from any browser when you give it nothing but HTML.  Let me clarify though, it's definitely not as easy as the first solution, and also is a bit of a resource hog.  However, on the plus side it also can output direct to PDF as well.  And, once you get it configured, it just works, every time.
UPDATE - September 15, 2016:  TableTools has been discontinued in favor of a new plugin called "buttons"  These tools perform the same functions as the old TableTools extension, but are FAR easier to install and they make use of HTML5 downloads for modern browsers, with the capability to fallback to the original Flash download for browsers that don't support the HTML5 standard.  As you can see from the many comments since I posted this response in 2011, the main weakness of TableTools has been addressed.  I still can't recommend DataTables enough for handling large amounts of data simply, both for the developer and the user.
Comment: I understand, and I agree. But still - however minuscule - there's a .swf object there, and it cannot run without Flash.
Comment: Such a great a solution, but such a shame it needs Flash.
Comment: DataTables is fully Javascript.  Just the TableTools element uses Flash, and it's miniscule.  I would NEVER use Flash willingly in any of my products!
Comment: @PramodGaikwad, no, Datatables would replace NG-table.  They are effectively the same functionality, but Datatables is FAR more mature and has many, many more features.  There is a spinoff of Datatables created specifically for Angular:  http://l-lin.github.io/angular-datatables/#/welcome
Comment: Hello can you show a complete example, i am too noob to make it work without the example!
Comment: is same library available for ng-table?
Comment: Ok. @bpeterson76  Thanks for suggestion.
Comment: @Derek朕會功夫 iPad, no saved files, no?
Comment: @mplungjan Touché. But recently many browsers are going in the direction of dropping Flash support.
Answer: A long time ago, I discovered that Excel would open an HTML file with a table if we send it with Excel content type. Consider the document above:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Java Friends</title>

a	b

1	2

I ran the following bookmarklet on it:
javascript:window.open('data:application/vnd.ms-excel,'+document.documentElement.innerHTML);

and in fact I got it downloadable as a Excel file. However, I did not get the expected result - the file was open in OpenOffice.org Writer. That is my problem: I do not have Excel in this machine so I cannot try it better. Also, this trick worked more or less six years ago with older browsers and an antique version of MS Office, so I really cannot say if it will work today.
Anyway, in the document above I added a button which would download the entire document as an Excel file, in theory:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Java Friends</title>

a	b

1	2

        <button onclick="window.open('data:application/vnd.ms-excel,'+document.documentElement.innerHTML);">
            Get as Excel spreadsheet
        </button>

Save it in a file and click on the button. I'd love to know if it worked or not, so I ask you to comment even for saying that it did not work.
Comment: Made it work adding a replace in the end:
window.open('data:application/vnd.ms-excel,' + document.getElementById('table').outerHTML.replace(/ /g, '%20'));
Comment: Alternative way (recommended):
window.open('data:application/vnd.ms-excel,' + encodeURIComponent(document.getElementById('table').outerHTML));
Comment: Works perfectly in firefox, wrap your table in a div and then call the id with `document.getElementById('id').innerHTML` to selectively grab the table only, otherwise all your stuff gets exported to the spreadsheet. Doesn't work in old IE though, just opens a new window with all the html in the title
Comment: This no longer works in Office 365 due to more strict security measures.  Excel file must be a TRUE Excel document or it will throw error when opening.
Comment: This simple solution works just fine. Look at this duplicate question in order to be able to set filename, and set a work sheet name as well. Same type of solution; http://stackoverflow.com/questions/17126453/html-table-to-excel-javascript
Comment: I tried it and the result was a normal excel with all the html of the table as text in the first cell...but the idea is a good one nonetheless...i just needed something like this (but working :P)..
Comment: Its strange though that comparing the excel content with one exported as excel from asp.net the content is the same except the one exported with your function removed the spaces between attributes if else it would work fine :S example: ...
If i made an alert with the same tableelement.outerhtml it would display it fine with its spaces...
Comment: why the red line is till the end ? I put a width - and in the excel it takes still 100%...
Comment: Yes this is the easiest way by my opinion. Create table in Excel with all the formatting you consider, export it to HTML and observe its contents then use it as a template.
Comment: It doesn't work in IE. Can anyone give some lights to make it working in IE 9,10,11
Comment: @Phil damn you, proper security measures!!! __
Answer: It is possible to use the old Excel 2003 XML format (before OpenXML) to create a string that contains your desired XML, then on the client side you could use a data URI to open the file using the XSL mime type, or send the file to the client using the Excel mimetype "Content-Type: application/vnd.ms-excel" from the server side.

Open Excel and create a worksheet with your desired formatting and colors.
Save the Excel workbook as "XML Spreadsheet 2003 (*.xml)"
Open the resulting file in a text editor like notepad and copy the value into a string in your application
Assuming you use the client side approach with a data uri the code would look like this:

Then you can use string replace to create a collection of rows to be inserted into your worksheet template

Once you have the information collected, create the final string and open a new window using the data URI

It is worth noting that older browsers do not support the data URI scheme, so you may need to produce the file server side for those browser that do not support it.
You may also need to perform base64 encoding on the data URI content, which may require a js library, as well as adding the string ';base64' after the mime type in the data URI.
Comment: Thank you for teaching me something rather than telling me to use a plugin, highly appreciated. It's worth mentioning that this approach still works nicely today.
Comment: Although it's nice to use OpenXML, this solution wont work on tables with colspans or rowspans without lots of work on the javascript generator
Comment: Interesting, tried this approach. I just get the entire **'+
             ''+
             '**

values with my strings written into one cell, including all rows in one cell. What am I missing?
Answer: Excel has a little known feature called "Web queries" which let you retrieve data from almost every web page without additional programming.
A web query basicly runs a HTTP request directly from within Excel and copies some or all of the received data (and optionally formatting) into the worksheet.
After you've defined the web query you can refresh it at any time without even leaving excel. So you don't have to actually "export" data and save it to a file - you'd rather refresh the data just like from a database.
You can even make use of URL parameters by having excel prompt you for certain filter criteria etc...
However the cons I've noticed so far are:

dynamicly loaded data is not accessible, because Javascript is not executed
URL length is limited

Here is a question about how to create web queries in Excel. It links to a Microsoft Help site about How-To Get external data from a Web page
Comment: This won't work if the url is behind a login wall either.
Comment: It does work with basic and also form based authentication but with the latter you might have to click on "edit query" to re-enter credentials and obtain a new cookie from time time
Answer: This is a php but you maybe able to change it to javascript:
<?php>
$colgroup = str_repeat("<col width=86>",5);
$data = "";
$time = date("M d, y g:ia");
$excel = "
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">

<meta http-equiv=\"Content-type\" content=\"text/html;charset=utf-8\" />

<colgroup>$colgroup</colgroup>

Col1	Col2	Col3	Col4	Col5

1	2	3	4	5

";
  $fname = "Export".time().".xls";
  $file = fopen($fname,"w+");
  fwrite($file,$excel);
  fclose($file);
  header('Content-Type: application/vnd.ms-excel');
  header('Content-Disposition: attachment; filename="'.basename($fname).'"');
  readfile($fname);
  unlink($fname); ?>

Answer: First, I would not recommend trying export Html and hope that the user's instance of Excel picks it up. My experience that this solution is fraught with problems including incompatibilities with Macintosh clients and throwing an error to the user that the file in question is not of the format specified. The most bullet-proof, user-friendly solution is a server-side one where you use a library to build an actual Excel file and send that back to the user. The next best solution and more universal solution would be to use the Open XML format. I've run into a few rare compatibility issues with older versions of Excel but on the whole this should give you a solution that will work on any version of Excel including Macs.
Open XML
Answer: mozilla still support base 64 URIs. This allows you to compose dynamically the binary content using javascript:
<a href="data:application/vnd.ms-excel<base64 encoded binary excel content here>"> download xls

if your excel file is not very fancy (no diagrams, formulas, macroses) you can dig into the format and compose bytes for your file, then encode them with base64 and put in to the href
refer to
https://developer.mozilla.org/en/data_URIs
Answer: This code is IE only so it is only useful in situations where you know all of your users will be using IE (like, for example, in some corporate environments.)

Comment: I tried using this code it did open the table in excel but not the correct format looks like it just copied the html code into the tables. like this:  SARTIN, DAN
BALAEZ, BARBARA
Any Suggestions?
Comment: That's because he used innerHTML. The element he's getting IS the table, so it should be outerHTML. I made the edit
Comment: I get the error: "Automation server can't create object" while creating ActiveXObject. How can I fix it?
Answer: This is actually more simple than you'd think: "Just" copy the HTML table (that is: The HTML code for the table) into the clipboard. Excel knows how to decode HTML tables; it'll even try to preserve the attributes.
The hard part is "copy the table into the clipboard" since there is no standard way to access the clipboard from JavaScript. See this blog post: Accessing the System Clipboard with JavaScript – A Holy Grail?
Now all you need is the table as HTML. I suggest jQuery and the html() method.
Answer: Assumptions:

given url
the conversion has to be done on client side
systems are Windows, Mac and linux

Solution for Windows:
python code that open the ie window and has access to it:
theurl variable contain the url ('http://')
ie = Dispatch("InternetExplorer.Application")
ie.Visible = 1
ie.Navigate(theurl)

Note: if the page is not accessible directly, but login, you will need to handle this by entering the form data and emulating the user actions with python
here is the example
from win32com.client import Dispatch
ie.Document.all('username').value=usr
ie.Document.all('password').value=psw

the same manner for retrieval of data from web page. Let's say element with id 'el1' contain the data.
retrieve the element text to the variable
el1 = ie.Document.all('el1').value

then when data is in python variable, you can open the excel screen in similar manner using python:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlWb = xlApp.Workbooks.Open("Read.xls")
xlSht = xlWb.WorkSheets(1)
xlSht.Cells(row, col).Value = el1

Solution for Mac:
only the tip: use AppleScript - it has simple and similar API as win32com.client Dispatch
Solution for Linux:
java.awt.Robot might work for this it has click, key press (hot keys can be used), but none API for Linux that I am aware about that can work as  simple as AppleScript
Answer: simple google search turned up this:

If the data is actually an HTML page and has NOT been created by ASP, PHP, or some other scripting language, and you are using Internet Explorer 6, and you have Excel installed on your computer, simply right-click on the page and look through the menu. You should see "Export to Microsoft Excel." If all these conditions are true, click on the menu item and after a few prompts it will be imported to Excel.

if you can't do that, he gives an alternate "drag-and-drop" method:
http://www.mrkent.com/tools/converter/
Answer: And now there is a better way.
OpenXML SDK for JavaScript.
https://openxmlsdkjs.codeplex.com/
Comment: hmmm, downloaded and tried to run the examples in latest chrome, just got errors :(
Answer: There are practical two ways to do this automaticly while only one solution can be used in all browsers.
First of all you should use the open xml specification to build the excel sheet. There are free plugins from Microsoft available that make this format also available for older office versions. The open xml is standard since office 2007. The the two ways are obvious the serverside or the clientside.
The clientside implementation use a new standard of CSS that allow you to store data instead of just the URL to the data. This is a great approach coz you dont need any servercall, just the data and some javascript. The killing downside is that microsoft don't support all parts of it in the current IE (I don't know about IE9) releases. Microsoft restrict the data to be a image but we will need a document. In firefox it works quite fine. For me the IE was the killing point.
The other way is to user a serverside implementation. There should be a lot implementations of open XML for all languages. You just need to grap one. In most cases it will be the simplest way to modify a Viewmodel to result in a Document but for sure you can send all data from Clientside back to server and do the same.
Comment: Can the down-voter please comment what's the reason for downvoting?
Answer:    function normalexport() {

       try {
           var i;
           var j;
           var mycell;
           var tableID = "tblInnerHTML";
           var drop = document.getElementById('<%= ddl_sections.ClientID %>');
           var objXL = new ActiveXObject("Excel.Application");
           var objWB = objXL.Workbooks.Add();
           var objWS = objWB.ActiveSheet;
           var str = filterNum(drop.options[drop.selectedIndex].text);
           objWB.worksheets("Sheet1").activate; //activate dirst worksheet
           var XlSheet = objWB.activeSheet; //activate sheet
           XlSheet.Name = str; //rename

           for (i = 0; i < document.getElementById("ctl00_ContentPlaceHolder1_1").rows.length - 1; i++) {
               for (j = 0; j < document.getElementById("ctl00_ContentPlaceHolder1_1").rows(i).cells.length; j++) {
                   mycell = document.getElementById("ctl00_ContentPlaceHolder1_1").rows(i).cells(j);

                   objWS.Cells(i + 1, j + 1).Value = mycell.innerText;

                   //                                                objWS.Cells(i + 1, j + 1).style.backgroundColor = mycell.style.backgroundColor;
               }
           }

           objWS.Range("A1", "L1").Font.Bold = true;
           //                objWS.Range("A1", "L1").Font.ColorIndex = 2;
           //                 objWS.Range("A1", "Z1").Interior.ColorIndex = 47;

           objWS.Range("A1", "Z1").EntireColumn.AutoFit();

           //objWS.Range("C1", "C1").ColumnWidth = 50;

           objXL.Visible = true;

       } catch (err) {
           alert("Error. Scripting for ActiveX might be disabled")
           return
       }
       idTmr = window.setInterval("Cleanup();", 1);

   }

   function filterNum(str) {

       return str.replace(/[ / ]/g, '');
   }


Can I cash out my 403b any time after I leave the country?

Question: I'm British and will be moving back to the UK soon. My current employer pays into my 403b. When I leave I'll probably take it with me, although I accept this will come with penalties and taxes. I was thinking of taking it out the year after I leave so it doesn't get added to this year's income and tax bill, but am I able to do that? Or do I have to take it when my employment ends?
Comment: You'll need to check the plan rules
Answer: Many plans have a minimum amount that you are required to maintain in order to keep money in the plan.  Below that amount, they can force you out and mail you a check or roll you into a safe harbor IRA and wash their hands of you.  If you're above that amount, they can't force you out until it dips below the limit or you get old enough to hit the required minimum distributions in your 70s.  Generally the limit is $5,000.


Is a particular force different in different frames

Question: Can a particular real force have different magnitude in different frames?
Answer: Well, take the electromagnetic force...it has been shown that the induced magnetic field around moving charges is a relativistic reference frame effect. See this post How Special Relativity causes magnetism
Therefore a static electric force in one frame becomes a magnetic force in another.
However, from a Newtownian view, we either allow pseudoforces and say "yes" or only allow forces present in an intertial refernce frame and say NO, it only appears that way to a person (e.g., falling vs floating in space)
Answer: Short answer: If you're talking about the spatial components of force, then yes, through a Lorentz transformation on the force four-vector.
By "real force" I assume you mean a non-inertial force, so that you are computing force from an inertial frame, or, more generally, in a freefall frame - i.e. a locally flat Minkowskian tangent space to the spacetime manifold spanned by a nonaccelerating, nonspinning "vierbein" frame so that the orthonormal unit vectors $\vec{e}_j$ fulfill $\nabla_{\vec{e}_0} \vec{e}_j$ where $\vec{e}_0$ is the timelike unit vector and  $\vec{e}_1,\vec{e}_2,\vec{e}_3$ are the orthonormal space unit vectors) in the general relativistic context.
In this precise case, you therefore ask what are the Lorentz-invariant analogues of the quantities in Newton's second law? These are the four-velocity $\vec{v}$, the four-acceleration $\vec{v}$, the four-momentum $\vec{p}$ and four-force $\vec{f}$:
$$\vec{v}=\gamma(v)\,(c,\,v_x,\,v_y,\,v_z)$$
$$\vec{p}=m\,\vec{v}=(E/c,\,p_x,\,p_y,\,p_z)$$
$$\vec{a}={\rm d}_\tau \vec{v} = \gamma(v)\,{\rm d}_t \left[\gamma(v)\,(c,\,v_x,\,v_y,\,v_z)\right]$$
$$\vec{f}={\rm d}_\tau m\ \vec{v} = \gamma(v)\,{\rm d}_t\left[m\,\gamma(v)\,(c,\,v_x,\,v_y,\,v_z)\right]$$
where $m$ is the mass (i.e. rest mass - note that the "relativistic mass" $ \gamma(v)\,m$ is not a concept that is thought to be helpful for learning, these days) of the system in question), $v_x, v_y, v_z$ are the spatial nonrelativistic velocity components measured in the freefall frame,  $p_x, p_y, p_z$ are the spatial nonrelativistic momentum components measured in the freefall frame, $v=\sqrt{v_x^2+v_y^2+v_z^2}$, $\gamma(v) = \left(\sqrt{1-(v^2/c^2)}\right)^{-1}$, $t$ the nonrelativistic time measured in the freefall frame and $\tau$ is the proper time $\tau = \gamma(v)\,t$.
The last of the relationships above $\vec{f}={\rm d}_\tau m\ \vec{v} = \gamma(v)\,{\rm d}_t\left[m\,\gamma(v)\,(c,\,v_x,\,v_y,\,v_z)\right]$ is Newton's second law generalized to the freefall frame.
A handy reference sheet is given by the Wikipedia "four vector" page.


Are interference patterns the basis for all other measurements of light frequencies and wavelengths?

Question: The wavelength or frequency of monochromatic electromagnetic radiation is determined indirectly by calculations on the interference or diffraction pattern. These patterns are generated by gratings, crystals or also the beam splitting at semitransparent mirrors. Are there direct measurements of the wavelength or frequency of EM radiation beyond radio waves?
Comment: Please ask only a single question per thread - you know how the site works. I have edited out an unrelated question which should be asked separately.
Comment: You can buy a tabletop demonstrator/experimentation kit in the  microwave band from several suppliers of physical teaching equipment. They can be configured in modes where you examine both grating interference and Michelson interferometry.
Answer:
Are there direct measurements of the wavelength or frequency of EM radiation beyond radio waves?

For frequency it depends on what you are willing to call "direct", but there is a reasonable (though not necessarily bulletproof) case to be made that frequency measurements using frequency combs for the bill. (In short, you set up and lock the frequency comb, with a comb separation that can be measured directly in the radio regime, and then you count up the comb teeth up to the line you want to measure; you then also measure the separation to the nearest comb tooth by measuring the frequency of the beating between the tooth.) I don't think any semantic debate about whether this measurement is "direct" is at all interesting, though.
For wavelength, the answer is an unambiguous yes; the attosecond-streaking method I described in my answer to Have we directly observed the electric component to EM waves? is unambiguously a direct length measurement.
Answer: The first part of the question, "Are there direct measurements of the wavelength or frequency of EM radiation beyond radio waves?", needs a definition of "direct".  If you mean something like counting wave peaks as they pass by, then dividing by the time over which we are counting,  the answer is "no".  But it is possible to do something that does directly measure frequency, at least as directly as using a ruler to measure the length of a stick.
We have frequency references that are extremely stable, such as a CO2 laser frequency-locked to an absorption peak in methane.  Another laser's frequency can be compared to that reference frequency  by illuminating a fast photodetector with both lasers and counting peaks of the detector's output.  The frequency of the second laser is just the sum of the reference frequency and the frequency of the detector's output.
This is a temporal interference based measurement, but length measurement using a vernier scale is very, very much like an interference measurement and can be called a direct measurement.
Answer: Yes there is. In nuclear physics, for example, Germanium or silicon crystals are used in detectors for measuring the energy of gamma rays. The $Energy = h \nu$. There are other detectors used for x-rays as well.


Downloading historical OpenStreetMap data

Question: Where can I download historical data from OpenStreetMap?
I'm I am interested in downloading an OSM .pbf file of a particular city in previous years (say, from 2008 and 2010).
Answer: Historical OSM data is available in the OpenStreetMap Full History Dump file. You can dowload it as *.pbf or *.xml data. Extracs of selected countries can be downloaded from http://osm.personalwerk.de/full-history-extracts/ or from http://odbl.poole.ch/extracts/. I recommend you the OSM-history-splitter to generate extracts out of *.osh files and the OSM-history-renderer to render data from specific historical timestamps.
Another option is geofabrik website, which makes available OSM data in three different formats: .pbf , .shp and .XML for all countries and continents. The oldest datasets they have are from 2014-01-01. Search for "raw directory index" there to find the yearly datasets, e.g.: https://download.geofabrik.de/europe/
Answer: http://planet.openstreetmap.org/ provides access to OSM data in different formats and for many different points in time.
In particular, PBFs are available at http://planet.openstreetmap.org/pbf/
Answer: Use overpass turbo (https://overpass-turbo.eu/). Create a bounding box over your desired area, then use the following code and/or use the examples and resources on the webpage to tailor the code to isolate the data that you want (the below code loads all drinking water objects as they existed on 2016-01-01). Export the data to kml and upload to qgis!
[date:"2016-01-01T00:00:00Z"];
(
  node
  [amenity=drinking_water]
  ({{bbox}});
  way
  [amenity=drinking_water]
  ({{bbox}});
  relation
  [amenity=drinking_water]
  ({{bbox}});
);
out body;
>;
out skel qt;


Extreme nervousness during exam period

Question: I'm currently a master student in computer science. I study at a school where we have only one take for the exam. I study really hard, yet I am never able to feel confident enough when the exams approach. I am nervous that somehow things will go bad and it only makes me perform worse. I tried studying weeks in advance and really going over all of the materials to feel sure that I know it, but it does not help me. I feel I have no power over what happens in an exam and I feel that I only have one chance that could lead to an ugly mark on my resume. How do I reduce the stress and the nervousness?
Comment: Does your university provide special accomodations (extra time, separate room for taking the exam, etc.) for students with anxiety, ADHD, etc?  If so, it might be worth seeking an anxiety diagnosis and arranging special accomodations. Also, you should certainly seek counseling and try mindfulness techniques.
Comment: This might be worth reading:https://academia.stackexchange.com/q/31195/72855
Answer: Nervousness in the face of uncertainty is normal. Ask any astronaut sitting on the launch pad. What you experience is pretty common. Overconfidence can also be a hinderance.
You seem to have good study habits ("weeks in advance"). But note that cramming the night before an exam is counterproductive for nearly everyone. If you are tired, so is your mind. And it will be focused only on what you studied last, rather than having a more general and nuanced sense.
One "trick" is to do something active in the last couple of hours before a big exam. Anything to get your blood flowing and let your mind rest. Even deep breathing as a calming exercise has benefits.
I also have a bit of a mantra that I use at the start of an important activity, such as an exam. "Some things are beyond my control. I can only do my best."
Answer: Reducing Stress and Nervousness

Begin to look at the exam as a game. It is a quiz and you like quizzes.
Try to answer as many questions from the previous exam papers. This will add to your confidence.
Pray for a calm and clear mind. Never underestimate the power of prayer.
Focus on an imagined object for a short time when you start to feel stressed. This will help you relax.
Answer: I can only tell you what works for me. My degrees were all in physics, nothing in any sort of mental health or self help. So take this for what it's worth.
Visualize yourself doing well on the exam. Think about sitting at the desk and blocking out all manner of distraction and disturbance. You can even build yourself little fantasies about the student in the desk next to you being fidgety and making a lot of noise, or some door somewhere is slamming constantly, or there is a thunderstorm. But your concentration bubble deflects it all. Practice this calmness in your mind before the exam. Then in the exam it's going to kick in automatically.
If you are allowed, go look at the exam room in advance. If not, then go look at a similar room. In your mind, picture yourself sitting in this room and being calm. Do it "movie special effects" style and add feature by feature. In your mind, add some other students. Add the prof or the TA's patrolling the space between the desk. Add the sound of the clock. Even go sit at the desk and imagine you are already taking the test. Imagine that there is a furious amount of distraction around you, but it bounces off your Teflon and you are all untouched and untroubled.
After that it all comes down to practice and confidence at the subject matter. You should definitely set yourself some problems to do against the clock. Get yourself used to doing problems under stressful situations. Try going to the cafeteria (or the Starbucks or whatever) where there is noise and distraction and maybe even people bumping your table or chair. Do your timed problems under these conditions. If you can stay calm and finish your timed problem while some barista is shouting "half calf latte with extra foam for Fred!" then you should not get nervous in the exam. But also try doing them in the library where everybody is supposed to be quiet.

Extreme nervousness during exam period


How to exclude all hidden files and folders from duplicity backup

Question: How can I set duplicity to exclude all hidden files and folders from backing them up, without specifying each and every one of them?
Answer: The decision by the developer is to keep the options very simple. This has been requested several times, here and here are some bug reports/feature requests on the issue.
An easier way to achieve what you want is to add just the directories (/Documents, /Music, /Pictures, etc...) individually, instead of selecting the entire /Home directory. You likely have 10 or less folders in your /Home directory, so this is easier then manually excluding all the hidden folders and files.
It's a good question, but the answer is to use a workaround.
Comment: When excluding certain folders like `--include Documents --include Music`, do not forget to append `--exclude '*'` on the end or files will be included anyway.
Comment: @Lekensteyn Good point. My answer is more geared for people like me who use duplicity via the 'Backup' GUI-based app. I actually upvoted your answer as it's the better one, but I see others have now upvoted mine. Bottom line is if people are setting this up via terminal they need to make sure the exclude command is used, right?
Comment: I upvoted yours as well since it actually contains valuable information. It took me a minute to figure out that the `--exclude '*'` command is necessary, so hopefully I save others time now.
Answer: In duplicity's GUI ("Backup" / deja-dup), if you want to list dot-file in your excluded files, you may be having difficulty selecting them via the GUI.

Click on the plus ("+") icon under "Folders" tab and whichever category you wish (e.g. "Folders to ignore" category). This brings up a file browser.
If you want to select dot files (ie, "hidden files"), just right-click in some empty space in this file browser and choose "show hidden files".
Now you can make use of ctrl-click  or shift-click to select some or many or all of your dot files explicitly.

This does NOT answer the question, but the other answers referred to command line non-solutions. This is a GUI non-solution.
Answer: A hidden file or directory starts with a dot (e.g. .bash_history, .cache/). The pattern for that is .*, so you can use the --exclude '.*' option to exclude hidden files and directories. This option must come before other --include patterns because:

A given file is excluded
  by the file selection system  exactly  when  the  first  matching  file
  selection  condition specifies that the file be excluded; otherwise the
  file is included.

(from man duplicity)


Releasing a CocosNode and adding its children to Layer in Cocos2d

Question: I'm working on a Tetris clone in Cocos2d for the iPhone and I'm using a Block class of Sprites for the individual blocks and a Tetromino CocosNode class that the user controls in order to move the Blocks. All of these Blocks move around in a 20 by 10 grid of empty Blocks on the GameBoardLayer.
When the block finishes falling, I'd like to release the Tetromino and attach it's Block children to the GameBoardLayer in order to let them roam independently and create a new Tetromino for the user.
I tried overriding removeChild: in the Layer:
<code>- (void)removeChild: (CocosNode*)child cleanup:(BOOL)cleanup
{
    if ([child isEqual:userTetromino]) {
        for (Block *currentBlock in userTetromino.children) {
            [self addChild:currentBlock];
            [userTetromino removeChild:currentBlock cleanup:YES];

        }
    }

    [super removeChild:child cleanup:cleanup];
}
</code>
But it seems I cant add the child twice, since it's already a child of Layer through Tetromino. Any thoughts?
Answer: Why don't you swap the addChild and the removeChild?
<code>- (void)removeChild: (CocosNode*)child cleanup:(BOOL)cleanup
{
    if ([child isEqual:userTetromino]) {
        for (Block *currentBlock in userTetromino.children) {
                // The following lines are swapped here.
                [userTetromino removeChild:currentBlock cleanup:YES];
                [self addChild:currentBlock];

        }
    }

    [super removeChild:child cleanup:cleanup];
}
</code>


Does Multicollinearity between categorical variables affect the predictions in logistic regression?

Question: How do we check for multicollinearity between categorical variables?  Does multicollinearity between categorical variables make the logistic regression model unstable?
Answer: Per wikipedia:

Multicollinearity does not reduce the predictive power or reliability of the model as a whole, at least within the sample data set

Prediction will not be affected, even for a logistic regression model.
Multicollinearity will make the model coefficients unstable - the standard errors will be greater in the presence of multicollinearity. See here.
You can still use the VIF to assess multicollinearity among categorical variables. the vif function in the car package in r will do this (although, I'm not sure how it works with categorical variables).
Condition Indices can also be used to assess multicollinearity. See here and here.
Comment: Coefficient estimates i logistic regression are not unbiased


Tips on making PAX (OSGI testing) framework faster

Question: I know PAX is doing a lot of stuff and that creating the container and copying all those jars is not cheap but are there any general tips to improve performance. I have tests that execute outside the container in a fraction of a second while inside they take much longer. I am using PAX primarily to verify that my manifests are accurate and the bundle would be deployable without any missing dependencies. I have tried Knopflerfish, Equinox, Felix and in general there is little difference they are relatively slow to a barebones containerless run.
Answer: As you realised, the underlying container does not make much of a difference.
If you want to have minimal bundles created on the fly, you can try out Pax Tinybundles: if this applies to your case, you can build a set of minimized bundles with only the content you actually need for testing. For example, you can just package your Manifest. I haven't benchmarked it myself for this particular purpose, but it is worth a shot.
As a sidenote, please consider that Pax Exam 2.3 introduced support (see here) for @Before and @After, thus coming to your rescue for more flexible load setup/teardown.
Answer: Using Native Container is faster than Pax Runner Container, saving the overhead of starting an external process.
Using EagerSingleStagedReactorFactory saves the overhead of restarting the framework for each test.
To avoid copying JARs, prefer mvn: URLs or mavenBundle() to general URLs, then bundles will be taken from your local Maven repository, once they have been downloaded.
A new feature in Pax Exam 2.3.0 is the reference: protocol which allows you to provision bundles in place, without copying - this works even for exploded bundles (i.e. an unzipped directory structure).


Good explanation of cascade (ON DELETE/UPDATE) behavior

Question: I don't design schemas everyday, but when I do, I try to setup cascade updates/deletes correctly to make administration easier. I understand how cascades work, but I can never remember which table is which.
For example, if I have two tables - Parent and Child - with a foreign key on Child that references Parent and has ON DELETE CASCADE, which records trigger a cascade and which records get deleted by the cascade? My first guess would be the Child records get deleted when Parent records are deleted, since Child records depend on Parent records, but the ON DELETE is ambiguous; it could mean delete the Parent record when the Child record is deleted, or it could mean delete the Child record when the Parent is deleted. So which is it?
I wish the syntax was ON PARENT DELETE, CASCADE, ON FOREIGN DELETE, CASCADE or something similar to remove the ambiguity. Does anyone have any mnemonics for remembering this?
Comment: See also https://stackoverflow.com/q/38388423/562769
Answer: If you like the Parent and Child terms and you feel they are easy to be remembered, you may like the translation of ON DELETE CASCADE to Leave No Orphans!
Which means that when a Parent row is deleted (killed), no orphan row should stay alive in the Child table. All children of the parent row are killed (deleted), too. If any of these children has grandchildren (in another table through another foreign key) and there is ON DELETE CASCADE defined, these should be killed, too (and all descendants, as long as there is a cascade effect defined.)
The FOREIGN KEY constraint itself could also be described as Allow No Orphans! (in the first place). No Child should ever be allowed (written) in the child table if it hasn't a Parent (a row in the parent table).
For consistency, the ON DELETE RESTRICT can be translated to the (less aggresive) You Can't Kill Parents! Only childless rows can be killed (deleted.)
Comment: @Jus12 No, foreign key constraints work with 1 parent only. It's not a good analogy regarding this aspect.
Comment: The parent analogy can still work if we don't say "orphan". If there are two references to two separate parents on a child entry, this can still be seen as a child of a divorced couple.

Restrict: "I won't let you kill my mom"
Cascade: "If you kill my dad, I will also die"
Comment: @Jus12 That is allowed of course but it would be 2 foreign key constraints. Then every child (order) would have a parent (customer) and a parent (item). The behaviours of the 2 FKs might differ though. (So, for example, it could be that killing customers would kill all their (orders) children but killing items would not kill their orders.)
Comment: I feel something is still missing in the analogy. Can't a child have more than one parent? In this case will killing one parent make the child an orphan?
Comment: @ypercube: Is this not allowed? `Order(custID, itemID, orderID)` where `custID` refers to a primary key in `Customers` table and `itemID` refers to a primary key in `Items` table. Won't `Order` have two parents?
Comment: @ChristopherMcGowan  This analogy does explain better but you made it very funny :-D
Comment: I don't like word "kill" here. I prefer to say "euthanize" or "annihilate", much more professional. And `On Delete Leave No Witnesses`
Answer:
For example, if I have two tables - Parent and Child - where Child
  records are owned by Parent records, which table needs the ON DELETE
  CASCADE?

ON DELETE CASCADE is an optional clause in a foreign key declaration. So it goes with the foreign key declaration. (Meaning, in the "child" table.)

...it could mean delete the Parent record when the Child record is
  deleted, or it could mean delete the Child record when the Parent is
  deleted. So which is it?

One way to interpret a foreign key declaration is, "All valid values for this column come from 'that_column' in 'that_table'." When you delete a row in the "child" table, nobody cares. It doesn't affect data integrity.
When you delete a row from the "parent" table--from "that_table"--you remove a valid value from the possible values for the "child" table. To maintain data integrity, you have to do something to the "child" table. Cascading deletes is one thing you can do.

Chapter and verse, from PostgreSQL docs.

Restricting and cascading deletes are the two most common options.
  RESTRICT prevents deletion of a referenced row. NO ACTION means that
  if any referencing rows still exist when the constraint is checked, an
  error is raised; this is the default behavior if you do not specify
  anything. (The essential difference between these two choices is that
  NO ACTION allows the check to be deferred until later in the
  transaction, whereas RESTRICT does not.) CASCADE specifies that when a
  referenced row is deleted, row(s) referencing it should be
  automatically deleted as well. There are two other options: SET NULL
  and SET DEFAULT. These cause the referencing column(s) in the
  referencing row(s) to be set to nulls or their default values,
  respectively, when the referenced row is deleted. Note that these do
  not excuse you from observing any constraints. For example, if an
  action specifies SET DEFAULT but the default value would not satisfy
  the foreign key constraint, the operation will fail.
Comment: thanks but what other things can you do?
Comment: @leeCoder: Updated answer with references to the docs.
Answer: SQL:2011 Spec
There are five options for ON DELETE and ON UPDATE that can apply to the FOREIGN KEY. These are called <referential actions>, directly from the SQL:2011 spec

ON DELETE CASCADE: if a row of the referenced table is deleted, then all matching rows in the referencing table are deleted.
ON DELETE SET NULL: if a row of the referenced table is deleted, then all referencing columns in all matching rows of the referencing table to be set to null.
ON DELETE SET DEFAULT: if a row of the referenced table is deleted, then all referencing columns in all matching rows of the referencing table to be set to the column's default value.
ON DELETE RESTRICT: it is prohibited to delete a row of the referenced table if that row has any matching rows in the referencing table.
ON DELETE NO ACTION (the default): there is no referential delete action; the referential constraint only specifies a constraint check.

The foreign key establishes the dependent relationship. The <referential action> determines what happens when the relationship is dissolved.
Example / Metaphor / Explanation
For this example, we will accept the common model of society and economy: where every business is a company that maintains a relationship to the bourgeoisie through a fatcat_owner.
CREATE TABLE bourgeoisie(
  fatcat_owner varchar(100) PRIMARY KEY
);
INSERT INTO bourgeoisie(fatcat_owner) VALUES
  ( 'Koch Brothers' );

CREATE TABLE business (
  name         varchar(100),
  fatcat_owner varchar(100) REFERENCES bourgeoisie
);
INSERT INTO business(name, fatcat_owner)
  VALUES ('Georgia-Pacific', 'Koch Brothers');

If all businesses are directly affected by bourgeoisie by way of their fatcat_owner then what do you do after the workers' revolution when that you purge the fatcat_owners and have a classless society?
-- Viva la revolución
BEGIN;
  DELETE FROM bourgeoisie;
END;

You have a few options here,

Stop the revolution. In SQL parlance, RESTRICT. Some people believe this is the lesser evil, but they're usually wrong.

Allow it to go on. If so when the revolution happens SQL gives you four options,

SET NULL -- leave it blank. Who knows, maybe capitalism is restored the bourgeoisie comes up and oligarchs fill the roll of the fatcat_owners. Important note, the column must be NULLABLE (not NOT NULL) or this can never happen.

SET DEFAULT -- perhaps you had a DEFAULT that handled this? A
DEFAULT can call a function. Maybe your schema is revolution-ready, already.

CASCADE -- there is no damage control. If the bourgeoisie goes, so does the business. If a business must have a fatcat_owner, then sometimes it makes more sense to lose the data rather than have a non-business in a business table.

NO ACTION -- this is essentially a method of delaying the check, in MySQL it's no different than RESTRICT, but in PostgreSQL, you'd be able to do
    -- Not a real revolution.
    -- requires constraint be DEFERRABLE INITIALLY DEFERRED
    BEGIN;
      SET CONSTRAINTS ALL DEFERRED;
      DELETE FROM bourgeoisie;
      INSERT INTO bourgeoisie VALUES ( 'Putin' );
      UPDATE business SET fatcat_owner = 'Putin';
    END;

In such a system, the constraint is validated only before the transaction commits. This may result in stopping the revolution, but you can recover in the transaction -- for some degree of "recover."
Comment: Does `referenced` table means parent table and `referencing` table means child table?
Comment: @sg552 Yes, you understood it correctly.
Answer: A simple mnemonic would be
ON DELETE of parent CASCADE [by deleting] here
That tells you which deletes (deletes of the parent) get cascaded, where the ON DELETE CASCADE statement goes (on the child), and what gets deleted (the child).
Answer: Just remember: Relational databases are all about consistency. They want to ensure the data is consistent all the time.

If you have an Author table and a Book table, the Book table might have an author_id. Assume the author_id is set to on_delete=CASCADE.
The DB will become active when an author is deleted. When an author is deleted, the Book table could reference an ID that does no longer exist. Meaning that a deletion of an Author might need a "cascading" deletion of a book.
Answer: well, perhaps we can rationalize the syntax. Let's take a Python example:
class Parent(self):
    # define parent's fields

class Child(self):
    # define child's fields
    parent_pk_is_childs_foreign_key = models.ForeignKey(Parent, on_delete=models.CASCADE)

what this line says is on_delete of the Parent (which is accidentally mentioned in the statement), please cascade the deletion onto the child. That is why the CASCADE statement is defined at the child level, it marks those children that need to be deleted
For example if you had another class
class GrownUpChild(self):
        # define grown up child's fields
        parent_pk_is_childs_foreign_key = models.ForeignKey(Parent, on_delete=models.DO_NOTHING)

this structure would clearly show which of the children need to be removed (Child) and which are to stay (GrownUpChild) albeit orphaned
[Edit: Given the context of the discussion, specifically in cases of on_delete=models.CASCADE etc, ] in fact it is often a desired behavior to leave children of a deleted parent, due to auditing and reporting reasons, as well as recovering accidental deletions. [ of course enterprise level software will be built around such behavior and will flag deleted records as deleted=1 instead of actually deleting them and also will not include them in any queries for the front end, minus some specially designed reports. In addition it will have a function of purging the deleted==1 records from the database, which will usually be executed by the UI administrator, often avoiding any involvement from the database administrator's side.]
Comment: _'In fact it is often a desired behavior to leave children of a deleted parent, due to auditing and reporting reasons, as well as recovering accidental deletions'_ - that would be disastrous in a (sane) database.
Comment: @dezso thanks for your input. However, multiple enterprise level CRM systems do exactly that.
Comment: you sound like a savvy database admin :) I can totally hear your point. The software I mentioned above that does it, actually has a function to remove those deleted = 1 manually so it is up to the admin of the app to make this call. Normally database administrator is not even involved in maintaining this aspect. And besides, the entire software's database class is built around the concept, so it always checks for deleted flag in crud operations
Comment: Yes, that is a known and sane pattern - but then you should possibly change the wording above to reflect this.


Autowiring a javax.inject.provider in a unit-test with spring context

Question: While playing around with the javax provider, I have created a spring configuration file with the following two Beans:
@Bean
Provider<Map<Integer, JsonNode>> worldMapDataProvider() {
  //code here
}

@Bean
Provider<List<Building>> buildingsDataProvider() {
  //code here
}

I am injecting these two beans in two different services like so:
@Resource
private Provider<Map<Integer, JsonNode>> worldMapDataProvider;

@Resource
private Provider<List<Building>> buildingsDataProvider;

The implementation works as expected and my depending controllers also return the data in the anticipated format. Now I wanted to add a few unit-tests for my implementation, by autowiring the providers "into my test-setup".
The configuration for my test-class which worked at the end looks as follows:
@SpringBootTest(classes={ResourceProviders.class, ResourceProviderUtils.class, Beans.class})
class ResourceProvidersTest {

ResourceProvider is what I want to use; this class depends on ResourceProviderUtils which in turn depends on a jackson objectMapper which I have defined in Beans. Thus, the required dependency-chain is ResourceProviders -> ResourceProviderUtils -> Beans
Now, to get to my question.
I was trying to create an annotation-based solution for my test without using @SpringBootTest. To be precise, this is the configuration which I expected to work:
@ExtendWith(SpringExtension.class)
@ComponentScan("{myBasePackage}")

I injected the two Beans exactly the same way as I did in my services with the @Resource annotation. But in the test-case, I get the following exception:
 No qualifying bean of type 'java.util.List<{myBasePackage}.game.data.model.economy.buildings.Building>' available

You can see that it is not looking for a bean of type Provider<List>, but for one of type List. I have never delcared such a bean though and as such do not require it anywhere either. I always inject the provider into my services (and this test-case) and access the data using provider.get().
I have a feeling that the provider is implicitly being resolved somehow, but this is just an assumption. Could anybody explain to me what exactly is happening here and why? I would like to get a better understanding of why this is happening with the given configuration.
Comment: how did you annotate the Spring configuration?
Comment: Could you please describe the full code of your unit test?
Answer: @ComponentScan does not work with @ExtendWith, use @ContextConfiguration instead
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes={ResourceProviders.class, ResourceProviderUtils.class, Beans.class})
public class ResourceProvidersTest {
 @Autowire ResourceProviders resourceProviders;
 @Autowire ResourceProviderUtils resourceProviderUtil;
 @Autowire Beans beans;
 ...
}

Or use @SpringJUnitConfig; this annotation combines @ExtendWith(SpringExtension.class) with @ContextConfiguration
@SpringJUnitConfig(classes={ResourceProviders.class, ResourceProviderUtils.class, Beans.class})
public class ResourceProvidersTest {
 @Autowire ResourceProviders resourceProviders;
 @Autowire ResourceProviderUtils resourceProviderUtil;
 @Autowire Beans beans;
 ...
}


Why don't animals rot when trapped in amber?

Question: I just saw an image of a gecko stuck in amber 58 million years ago.  Why don't animals rot when they are trapped in amber?  I've seen dry insects whose chitin shells persist for a long time away from water and scavengers, but things with skin rot and dramatically change in appearance in the outside world.
Comment: I am no expert but conifer pitch/sap has a number of compounds that have anti bacterial and anti fungal properties.  Tie that together with the anaerobic conditions being encased in pitch would create and it is not too surprising that they are partially preserved.  I would wonder if the pitch might also have desiccant type properties as well.
Comment: I'm perplexed regarding the onslaught of votes to close for being off-topic. There are several unclosed questions at this site regarding fossils, and a few regarding amber.  Just because a question might be on-topic in another corner of the SE universe does not mean it is off-topic here.
Comment: I am curious as to what stack people think this belongs on if not earth science?
Comment: @John maybe biology!?!??  But I'm voting to reopen, for whatever it's worth now, as such questions that can't find a home seem worthwhile if somewhat on topic here, it's not like we're drowning in questions.  And if there's somewhere else to move it, it can be discussed.
Comment: What if they rot? Rotting produces a lot of poisonous things and that kills the bacteria. If it is hermetically sealed, nothing rots away completely. For example, surströmming (https://en.wikipedia.org/wiki/Surstr%C3%B6mming) is a fish conserved without any salt or so. It becomes the most stinky food of the world, but it remains eatable.
Answer: things need to be exposed to bacteria to rot, amber produces a perfect form fitting seal and has several antimicrobial properties to boot killing off bacteria that is already present. Even microbes trapped in amber become preserved. This makes a lot of sense when you realize the resin evolved to seal injuries in trees if it did not prevent the spread of bacteria it would not work. HOwever preservation in amber is not perfect and the things do degrade, but do so so slowly that more geologically recently deposits have decayed so little is is almost undetectable, the type of resin also matters all resin is not equal and some amber resins preserves better than others.


About the stress acting on the material

Question: I have considered a steel rod of cross section area A and a force of p acting on the two ends along the axis.Now my doubt is whether the internal stress force is p or 2p?
My approach is if the length of the rod is l then there Wil be a internal stress of p at each point but when you consider the rod at l/2 we will have 2p internal stress .please some one answer this and help me where I am wrong
Comment: No my approach is let us assume that there are 10 layers of atoms in this length l, now I have applied an equal force in both directions .It means the later next to extreme ends from both ends will have a stress of p, and this stress continues unless and until the two opposite acting forces don't coincide.But in Thai case when the forces reach the 4th and 6th layer both forces act upon a single bond between atoms so that the stress acting on this bond is 2p.So we have a stress of 2p at this point and we take the maximum value as stress for better functioning .Is it correct
Comment: I'd say that stress is a macroscopic concept (see answer below) and that it the word shouldn't be applied in its technical sense to interactions on an atomic scale.
Answer: Suppose the stress is tensile (so the rod is being pulled with equal and opposite forces, +F and –F at either end. Imagine you cut the rod anywhere along it. The forces you'd have to apply to the cut ends to maintain equilibrium would have to be –F and +F. By definition, the tension is F (= |F|) and the tensile stress is $\frac{F}{A}$.

About the stress acting on the material


Compute forward swap rate from spot swap rate?

Question: I am pretty new to interest rate swap and this question might sound silly.
Why does 3y2y (3yr forward and 2yr tenor) swap rate roughly equal to (5*5y swap - 3*3y swap) / (5-3)?
Any explanation would be helpful!
Answer: The 5y swap is effectively the weighted average of the 2y and 3y2y swap if discount rates are low enough and maturities are short enough. Lets suppose your discount curve is flat and zero, so all we have is a set of forecast libors from which we calculate fair swap rates. Then we know the following:
$$S_{5y} = \frac{1}{4\times5}\sum_{i=0}^{i=4\times5}F_i$$
$$S_{3y} = \frac{1}{4\times3}\sum_{i=0}^{i=4\times3}F_i$$
$$S_{3y2y} = \frac{1}{4\times2}\sum_{i=4\times3+1}^{i=4\times5}F_i$$
Its easy to see then that $$2 \times S_{3y2y} = 5 \times S_{5y} - 3 \times S_{3y}$$ and so the closer our discount curve is to flat and zero the closer this relationship is to true.
Comment: Sorry, didn't see that you had already provided an answer.
Answer: Let's have a look at this in a single curve world. The fair rate for a swap starting in $t$ and ending in $T$, $s_{t,T}$ is set such that the present values of the floating and the fixed leg are equal, i.e.:
$$
s_{t,T}=\frac{\sum_{u=t}^T \tilde{\Delta_u} F_{u-\tilde{\Delta_u}, u}D_u}{\sum_{u=t}^{T}\Delta_uD_u}
$$
where $\tilde{\Delta}$ and $\Delta$ are the legs' accrual period factors and $D_u$ is the discount factor for a cashflow at time $u$.
To a first order of approximation, for small $u$ or in a low interest rate environment, $D_u\approx 1$, i.e. $\sum_{u=t}^{T}\Delta_uD_u\approx T-t$.
Hence,
$$
\begin{align}
s_{t,T}&\approx \frac{Ts_{0,T}-ts_{0,t}}{T-t}\\
&=\frac{T\frac{\sum_{u=0}^T \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{\sum_{u=0}^{T}\Delta_uD_u}-t\frac{\sum_{u=0}^t \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{\sum_{u=0}^{t}\Delta_uD_u}}{T-t}\\
&\approx \frac{T\frac{\sum_{u=0}^T \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{T}-t\frac{\sum_{u=0}^t \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{t}}{T-t}\\
&= \frac{\sum_{u=0}^T \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u-\sum_{u=0}^t \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{T-t}\\
&=\frac{\sum_{u=t}^T \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{T-t}\\
&\approx \frac{\sum_{u=t}^T \tilde{\Delta_u} F_{u-\tilde{\Delta_u},u}D_u}{{\sum_{u=t}^{T}\Delta_uD_u}}
\end{align}
$$
In the first step, we apply your formula, and in the third step we use the approximation $D_u\approx 1$. In the last step, we apply that approximation again, but this time in the other direction "$1\approx D_u$".
HTH?


General relativity: For massless particles, is the momentum and velocity 4-vectors equal?

Question: I am following Carroll's GR book. He explain that it is convention to parameterize geodesics of photons by a parameter $\lambda$ such that
$$p^\mu ~=~ \frac{d x^{\mu}}{d \lambda}.\tag{3.62}$$
But this is the definition of 4-velocity for a massive particle in the case of $\lambda=\tau$ equal to proper time. My question then, is $$u^\mu = p^\mu$$ for all massless particles? I ask because it's well-known that proper time $\tau$ freezes for massless particles.
Answer:
How should we define momentum  of a massless point particle? It seems most systematic to use the Lagrangian formalism. The Lagrangian of a massive or massless point particle is$^1$
$$ L~=~\frac{\dot{x}^2}{2e}-\frac{m^2e}{2}, \qquad \dot{x}^2~:=~g_{\mu\nu}(x)~ \dot{x}^{\mu}\dot{x}^{\nu}~<~0,  \qquad  \dot{x}^{\mu}~:=\frac{dx^{\mu}}{d\lambda} ,\tag{1}$$
cf. e.g. this, this and this Phys.SE posts. We now restrict to the massless case
$$ m~=~0. \tag{2}$$
In eq. (1) $\lambda$ is a worldline (WL) parameter, and $e>0$ is a WL einbein field introduced to make the action
$$S[x,e]~=~ \int\! \mathrm{d}\lambda ~L\tag{3}$$
gauge invariant under WL reparamerizations
$$  \lambda\longrightarrow \lambda^{\prime}~=~f(\lambda).\tag{4} $$
In more detail the WL einbein field $e$ transforms as a WL co-vector/one-form,
$$ e~\mathrm{d}\lambda~=~e^{\prime}~ \mathrm{d}\lambda^{\prime}.\tag{5} $$
We can now address OP's question. The Lagrangian $4$-momentum$^2$ is defined in the standard way:
$$ p_{\mu}~:=~\frac{\partial L}{\partial \dot{x}^{\mu}}~\stackrel{(1)}{=}~ \frac{1}{e}g_{\mu\nu}(x)~\dot{x}^{\nu}.\tag{6}$$
Carroll's eq. (3.62), which in our notation reads$^3$
$$p^{\mu}~=~\dot{x}^{\mu}, \tag{7}$$
is eq. (6) in the gauge $e=1$, cf. e.g. this Phys.SE post.

--
$^1$ In this answer we put the speed of light $c=1$ to one and use the sign convention $(−,+,+,+)$.
$^2$ It is fun to check that in the massive case the Lagrangian momentum (6) becomes the standard $4$-momentum
$$ p^{\mu}~\approx~\frac{m\dot{x}^{\mu}}{\sqrt{-\dot{x}^2}}\tag{8}$$
in the static gauge $\lambda=x^0$ in Minkowski space. [Here the $\approx$ symbol means equality modulo eom.]
$^3$ Note that the notion of $4$-velocity
$$ u^{\mu}~:=~\frac{dx^{\mu}}{d\tau} \tag{9} $$
is not defined for massless particles. Here $\tau$ denotes proper time, which doesn't change for a massless particle. So OP's equation $p^{\mu}=u^{\mu}$ does not make sense if $u^{\mu}$ is supposed to be the conventional 4-velocity.
Answer: So a massless particle obeys $E = pc$ which is a special case of the relativistic equation $$(m c)^2 = p^\mu p_\mu = (E/c)^2 - |\vec p|^2,$$ when $m=0$. Indeed when we have a massive particle we have $\lambda = \tau/m$, but with a massless particle neither of these are defined: massleses particles do not have mass and do not experience time. Nevertheless you can imagine choosing someone who sees the particle moving at speed $c$ and using their local coordinate of time $t$, describing it as a 4-position path $x^\mu(t) = (ct, \vec x_0 +\vec v~t).$ Not everyone agrees on the $t$-derivative of this because not everyone agrees on $t$, but indeed there is a frame-dependent proportionality constant to take this to the 4-momentum and we can combine that with  $t$ into $\lambda$. So the problem is that there is no $u^\mu$ for massless particles, because there is no $\tau$ for massless particles, but we still have  $p^\mu$ and  $\lambda$ just fine.
Comment: No. There is no $u^\mu$ for massless particles in special relativity. There just isn't. If someone told you that there is, they were telling you a half-truth at best. There is a path, $\{\forall s: x^\mu(s)\},$ which everyone agrees on (subject to reparameterizations of $s$ and Poincaré transforms of the 4-vectors in the set, of course), but the tangent vectors to this path are all null vectors. $u^\mu(s)$ is defined as the tangent vector corresponding to $x^\mu(s)$ normalized so that $u^\mu~u_\mu = c^2$ (in the $(+ - - -)$ metric) and you simply cannot normalize null vectors this way.
Comment: But in special relativity we have $u^\mu$ for massless particles. In this case, is $p^\mu = u^\mu$?
Answer: The tangent vector (field) of a world line is not well-defined since the tangent vector is the derivative with respect to a parameter. Hence the tangent vector is parametrization-dependent. However, whether the tangent is timelike or lightlike (null) is invariant. For massive particles, $ds^2 > 0$, so the space time interval integrated along the curve can be used as a parameter. This is the the proper time, and we get the 4-velocity as $u^\mu = dx^\mu/d\tau$.
For massless particles, $ds^2 = 0$ and there is no notion of proper time. However, it can be shown that any curve can be given an affine parameter $\lambda$ such that the geodesic equation expressed in $\lambda$-derivatives takes a particular form. All such parameters are related affinely $$\lambda_1 = k\lambda_2 + m$$
where $k,m$ are constants.
This is enough freedom to choose $\lambda$ such that Carroll's condition holds.
(The 4-momentum can be defined in a parametrization-invariant way.)
Comment: So is $u^\mu = p^\mu$ or not?
Comment: $u^\mu$ cannot be defined for light-like worldlines


How does the de Broglie-Bohm picture explain the double-slit experiment with single particles?

Question: If the particle has a single well-defined trajectory in the de Broglie-Bohm theory, how come that the interference pattern still appears even with single particles?
Comment: Isn't it explained [here](http://www.bohmian-mechanics.net/whatisbm_pictures_doubleslit.html)?
Answer: To elucidate Luc's answer somewhat, the Bohmian wave function still travels through both slits and causes an interference pattern, it's just the beables (particles) being guided by this wave that only travel through one slit. Because they're being guided by a wave that's exhibiting interference, the particle positions on the screen reflect this interference pattern.
There's a good animation of this here that might clear things up somewhat, or in image form:

(found at this link from a Google image search; although this particular illustration I believe is by David Bohm originally)
It's apparent from this, and interesting to note, that Bohmian trajectories don't cross. It's therefore possible to a priori determine which slit each particle passed through from its position on the screen. Measurement of a particle in transit affects its momentum however, so we still can't observe them taking one of these paths. Because of this, whilst this may be a good visual aid for some, it doesn't help over standard quantum mechanics beyond that. Outside the scope of your question, but you may be interested to know that there are other applications where calculating such trajectories are useful though as they can allow for more efficient quantum simulations - this is seen particularly in quantum chemistry.
If anything's not clear or you have any follow-ups, please feel free to ask.
Comment: but we know that the moment we measure the particles at double slit, the interference pattern collapses. How is this explained by Bohmian mechanics. Even if you say we are messing with the momentum of the particle, then the particle must end randomly on the screen, but it ends up as though it came straight from the slit as a classic particle. How is this explained by Bohmian mechanics.
Answer: The wave function of Bohmian mechanics is the same object obeying the same equation as in usual QM, so we get interference on the observation screen. Then each particle starts from slightly different positions, which we do not know, and that makes some pass through one slit and others through the other slit. Finally, it is an assumption [*] of Bohmian mechanics that this unknown particle position has a probability density given by the modulus square of the wave function, thus reproducing the usual prediction.
[*] Some authors have claimed to demonstrate that result, in an analogue of Boltzmann H-theorem.
Comment: So in this view, one particle doesn't fly through both slits at the same time, but each particle flies only through one slit, correct?
Comment: @safesphere That's correct. I've created a separate answer to try to clear it up a bit better for you.


Create keystroke to a script

Question: In Google "documents" (not Spreadsheets), I've a script to insert Date. How do I create a keystroke to activate the script?
Answer: At this time Google Documents / Google Apps Script doesn't include a way to set a custom keyboard shortcut to run a script.
There is at least one feature request about this.
Feature request: map shortcut to script functions in Google Docs

Create keystroke to a script


How do I get brightness control working on an HP 655?

Question: please I installed Ubuntu 14.04.1 on my hp 655 alongside windows 8.1 but my brightness control doesn't work although it does work on my windows platform.
Answer: I finally got my brightness feature to work.
I discovered that my device uses radeon_bl0:
ls /sys/class/backlight/

to check and then i navigated to the brightness file under radeon_bl0.
My maximum brightness was 255 of which my current settings was on and i changed the value to a much lesser value and there, it worked. Here is the code i used...
 echo 'value' > /sys/class/backlight/radeon_bl0/brightness

where 'value' is any value between 1 and 255.
Hope this helps someone else.
Answer: Try modifying GRUB configuration (/boot/grub/grub.cfg) and use:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux"
instead of:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Then reboot your computer.
Comment: Thanks for your quick reply but on my grub.cfg file i couldn't find the above line.
Comment: @OROBOGENIUS and anything that says `quiet splash`? Sometimes people just insert that as a parameter for loading the kernel. Add `acpi_osi=Linux` just after `quiet splash` in the kernel parameters and try. Remember that you can always **test** without modifying `grub.cfg` by editing boot parameters on GRUB load (letter `e` or something). Also, in Ubuntu you could try editing the file `/etc/default/grub` as well (maybe there is the line I mentioned).
Comment: Doesn't work on HP 633 with Xubuntu 16.04.3 and kernel 4.13.
Comment: Why the downvote **four years after**?
Answer: Maybe, it could be the solution:
Add video.use_native_backlight=1 in the grub
sudo gedit /etc/default/grub

And add:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_native_backlight=1"

Then update the grub:
sudo update-grub

Finally, reboot.
Comment: Well... the kernel actually manages the ACPI (Advanced Configuration and Power Interface), which has to manage, well... the power interface and devices that consume energy (like the backlight). The ACPI acts as an interface to call and set backlight parameters in this case. Of course, there are many types of ACPI implementations (some standard, other not-so-standard) and this is clearly one that needs to be set manually (a not-so-standard ACPI implementation which requires "different" kernel extensions). That's what I understand at least...
Comment: What will updating GRUB have to do with brightness?
Comment: @Tim in some cases kernel parameters have to be set. Though I'd like a bit more explanation as well.
Comment: Thanks for all your inputs but the problem still persist. Here is the problem in detail. The brightness toggle actually works but it doesn't have any effect on the display, that is it doesn't dim or increase its just there. Like my windows 8.1 when i had the same problem i just installed an AMD Graphics driver and then it worked but am not sure about ubuntu. And i have tried editing the grub with the settings you guys posted above but still no solution.
Comment: Just tested it on HP 655 with Xubuntu 16.04.3 with kernel 4.13. Doesn't work.


How to change the Organiser for Family Sharing

Question: I have set up Family Sharing on my daughter's iPad Pro and I am the Organiser. I also added my daughter as a family member. How can I delete myself as the Organiser and add my wife instead? I hope after doing that my wife can replace my bank details with hers.
Answer: The only way to change the person who is responsible for the payment method (in other words, change the Organizer) is to turn off Family Sharing and have the new person start it over again.
In the Settings app go to iCloud then tap on Family, then your account in the list at the top, then Stop Sharing. This will disband the family.
At this point, your wife can go to the same location (Settings > iCloud > Family) to start Family Sharing again with her account as the Organizer. This will then use her selected payment method for any charges made by the Family members.
Your daughter's account will have to be re-invited to the family. Your wife can also invite your account and once you accept, mark you as a Parent so that purchase requests from your daughter will go to both you and your wife.
Answer: I believe you can just remove your payment info from your apple account and then have your wife add her payment info and she will be able you be the payee.
Your Apple ID is the personal account that you use to access Apple services like the App Store, iTunes Store, iCloud, iMessage, the Apple Online Store, FaceTime, and more. When you change your payment method or billing address, your information also updates everywhere that you use your Apple ID.
Or You can go to your
Settings > iCloud > Family and then tap your account. You will see an option to Stop Family sharing. This will allow you to clear this out and start over, which is what you were originally trying to do..
Comment: All that does is switch payment methods, they will still remain the organizer.


Difference between "become" and "make"

Question: Please explain the difference between "He will become a good lawyer" and "He will make a good lawyer."
Comment: _He will become a good lawyer_ = He can be expected to develop into a good lawyer in the future (perhaps when he has had more experience). _He will make a good lawyer_ = (said of someone who plans to become one) He is the kind of person who will probably be a good lawyer.
Answer: Both work in the case of a talented law student, but consider:
If someone is studying law and show early signs of talent, you can say they will become a good lawyer.
If a motorist is arguing with the police about some traffic infringement and is correct in proving no rules were broken, you can say he/she will make a good lawyer because they have a talent for legal matters.  You compare and imagine that person would be good at that job, yet there is no real possibility.

Difference between "become" and "make"


receiving calls/text if mobile data is off

Question: when I travel where only my phone network is available, I want to turn my data to off so I don't get any updates. If i do that can I still receive calls and texts from others?
Comment: This is a duplicate probably
Answer: Yes!
Turning Data Off only disconnects Internet connection. It doesnt effect Calls/Texts.
Answer: Yes you will still be able to send/receive phone calls and texts. If you are using any messaging apps that rely on internet then those won't work Your "radio" or "modem" is what controls the phone and texting. You just won't have any internet.


What is an alternative word for saying "A new trend in technology" or "Trending technology"

Question: What is an alternative word for saying "A new trend in technology" or "Trending technology". Can you suggest some word that I could use as a title for a seminar
Answer: This seems catchy to me!

A new trend in technology - can be broad and may cover many aspects in technology. Trending technology - is focused and used for particular technology.

Check these examples:

eCommerce is a new trend in technology for the online retailers.
  In eCommerce, responsive web design is trending technology.

However, using the word 'trending' fits and conveys the message without any ambiguity. Because the word trending itself is trending! Anything that's latest, on the rage these days can be referred to as trending. For instance, in social media, trending is widely used these days whether it's #followfriday or #throwbackthursday etc.
Another phrase I've come across is emerging technology that may not exactly mean trending but may be used.
To sum it up -
Use 'Trending Technology' if you are talking about one particular technology and if you are talking about what all is in these days in the world of technology, go for A New Trend in Technology
Answer: Depending on exactly what you're talking about and the desired tone, you might talk about "developments" in technology, "advances", "frontiers" (a little grandiose), "the latest" (rather informal), "the leading edge" or "the cutting edge" (those are becoming MBA-speak -- somewhat pretentious), "fads" (implying these are trends that will die before long), or "hottest new" (usually reserved for sales pitches).


What happens when you flicker a double-faced card?

Question: If I were to cast Restoration Angel targeting Ravager of the Fells, What side would Ravager of the Fells be on when he came back into the battlefield?
Comment: Double-faced cards don't have *sides*, they have *faces*.
Comment: you mean cards with 'transform' right? and not the flip cards from the kamikawa block? do both questions have the same answer?
Comment: @Colin D, Double-faced cards are the ones that transform, yes. Yes, it's the "same answer" for flip cards.
Answer: Its front face (the one with the sun symbol in the top-left corner), so Huntmaster of the Fells.
It's a brand new object put onto the 'field, as if you had just resolved it after casting it. It has summoning sickness; it's untapped; it doesn't have any counters, enchantments or equipment; and it's front face is up.

711.5. A double-faced card enters the battlefield with its front face up unless a spell or ability puts it onto the battlefield "transformed," in which case it enters the battlefield with its back face up.


Dulux EasyCare mist coat proportion (UK)

Question: I have Dulux EasyCare matt and want to use it as a mist coat on fresh plaster first. Instructions say to seal use "thinned 10% with water". Does that mean the mix should be 90% paint or 90% water?
Answer: "thinned 10% with water" means that you add 10% of the paint volume as water.
So if you have 1 litre of paint then you add 100ml of water, which now means you have a total volume of 1.1l of mixed paint.
BTW, stir well.


Is it possible for life to exist on asteroids?

Question: Can life exist on a asteroid? If the asteroid can sustain life, when the asteroid crashes on a planet can life survive going through a atmosphere and landing and then living on a earth-like planet it crashed on?
Answer: Asteroids/comets are typically thought to be the origin of prebiotic molecules (simple organic compounds) which aided in the construction of the first DNA/life on Earth. These molecules obviously were not destroyed during impact. If this is the sort of scenario you are looking for then yes, it is very possible.
However, it's unlikely that an asteroid could provide the heat required for life as we know it to form, so single-celled organisms would be unlikely, complex multicellular organisms out of the question.
See: https://en.wikipedia.org/wiki/Abiogenesis for more.
Answer: I would argue that Asteroids could in fact sustain life, at least in the bacterial form. In fact Ceres (OK technically a dwarf planet but piece would be asteriods) may have a liquid ocean beneath the surface . If there is liquid water then it has been stable for quite some time. At the very least Extremophiles would likely be able to live there.
Landing would be rough. Any asteroid that is large enough to sustain liquid water for long periods would deliver a fair bit of energy on impact. But if a smallish piece broke off the Asteroid while the big part misses the Earth and that small piece hits the ocean the bacteria might survive.
Answer: An asteroid could not hold active life (lack of atmosphere, low gravity, lack of stable heating mechanism etc.), but it could hold dead life even through atmosphere traversal and crash landing on a planet (if it is big enough to not get vaporized by the atmosphere) and could spread its inhabitants on the new planets. "Dead life" also includes eggs/seeds, so it could cause foreign organisms to live on a planet seeded by the asteroid.
Answer: In one theory, asteroids are though to have held basic organisms (we're talking single cell) that crashed and started life on this planet and possibly on others so yes, it definitely a plausible option. Nothing to advance though, don't expect any advanced alien races hiding out in one.


Deleting rows from DataSet from DataGridView

Question: This is my scenario the DataSource from my DataGridView is not linked to a open database, so I am not going to use a DataAdapter.
In order to avoid the need to have a constant database connection (to save resources), a user is only able to save changes (i.e., update the database), only when cells/rows are deleted/modified from the DataGridView.
My problem comes in here. I have a database with two DataGridView objects, resembling a master/detail relationship. The second DataGridView has an extra filter that is applied when the user clicks on the master table row, from which all records relating to that specific row will be reflected in the child DataGridView (second DataGridView).
I have three DataSets:

one for the master table,
one for the detail table, and
one for the filtered rows from the second table

The filter is a simple SELECT statement:
DataSet.Tables[TableName].Select(...);
When deleting rows from the second DataGridView (linked to the third DataSet), I want that specific row from the third DataSet to delete the second DataSet.
But I don't know how to link a DataSet to other DataSet objects.
Or is there another alternative here?
Answer: Use DataTable and follow example here:
Inner join of DataTables in C# to join two or more datatables by using LINQ


Do I need to adjust the truss rod when I change string gauge

Question: I am changing the string gauge of my electric guitar from 9's to 10's, will I need to adjust the truss rod, if so could anyone recommend tutorials ?
Answer: Impossible to say categorically yes or no, until you put the .009s on, and allow a few days for settlement. The change in tension is less than 10%, and the guitar's neck may well not move at all. Simplest is to measure some dimensions before and after - string height at 12th fret is a must, and feel playability after - you may not notice any difference. The make and model (and age) of the guitar are also factors that are relevant.
A more crucial factor is checking intonation, which will be slightly affected anyway. There are many sources of info. as to how this is achieved, along with how to remedy it. Actually, recommendations of this kind don't sit well on this site.


Take current item to workflow

Question: I want to write a workflow for sharepoint 2013 list in visual studio 2012.
When user adds a new SPListItem to SPList -> starting my workflow. How to take this SPListItem to workflow and reuse it?
Answer: Try this link
Hope this link will help. Also you can find various tutorial on google.

Take current item to workflow


How do I destroy Nekker nests?

Question: In "The Nekker Contract" quest, I need to destroy all of the Nekker nests. I found my first Nekker nest, but when I try to destroy it, Geralt just says, "I've got to blow up this nest," and doesn't do anything.
So I assume that I need something to blow it up—what would that be?
Screenshot of a Nekker nest with the left-click "destroy nest" option:
Answer: You find out the way to destroy the Nekker nests by obtaining enough knowledge about the Nekkers, either by reading a book about them (available in Flotsam) or by fighting them. If you're at knowledge level 3/3 (character screen -> Attributes -> Knowledge) there will be the following text about the Nekkers

Witchers can user their full range of
  skills and techniques when fighting
  nekkers. Signs, bombs, poisons and
  oils that augment bleeding are all
  extremely effective against the
  beasts. Nekker nests are best
  destroyed with Grapeshot bombs.

To build a Grapeshot bomb you first need the schematic, which is available from the elf Cedric. Just look out for the craftsman icon on the map in Lebinden to find him. After you bought the schematic you need to meditate and then build some Grapeshot bombs:

Thanks to Justin for the hint on how to destroy the nests.
Comment: Ah, I never new where all this information was. I always went to the Codex / Monsters page, which is pretty useless. Thanks !
Answer: You need a bomb called Grapeshot. You can get the recipe from Cedric in Lebinden.

How do I destroy Nekker nests?


Is there any regulation that authorizes autopilot use when cleared for a visual approach?

Question: Is there any FAA reference that recommends or specifically allows for the use of a coupled approach (such as autoland) when the pilot is specifically cleared for a visual approach?
Comment: I doubt there is any reference that specifically says you are allowed to use those aids when cleared for a visual approach. Typically regulatory systems do not deal in options, but in what you must or must not do. In the case of visual approaches, the pilot must be able to keep the airport in sight and remain clear of clouds. She/He is free to use or not use whatever aids might be available. Personally, I would not forego the pleasure of flying the airplane myself, although I might use the ILS to monitor my performance.
Comment: @fooot I don't think it's a dupe of that question, as it doesn't seem to address the autoland issue (except in a deleted answer.)
Answer: The general answer is no. A visual approach isn't considered an instrument approach according to ATC so there's no restriction - or direction, if you prefer - on how to fly one:

A visual approach is an ATC authorization for an aircraft on an IFR
  flight plan to proceed visually to the airport of intended landing; it
  is not an instrument approach procedure. Also, there is no missed
  approach segment. An aircraft unable to complete a visual approach
  must be handled as any go-around and appropriate separation must be
  provided.

And from the AIM 5-5-11:

The pilot must, at all times, have either the airport or the preceding
  aircraft in sight. After being cleared for a visual approach, proceed
  to the airport in a normal manner or follow the preceding aircraft.
  Remain clear of clouds while conducting a visual approach.

That means that when you're cleared for a visual approach it's entirely up to you how you approach and land, providing that you follow the rules mentioned in the AIM and  - in the case of airline operations - whatever procedures are detailed in your operations specification.
But if you're asking about autoland specifically (not general autopilot use) then the FAA does have a few relevant comments in their guidelines for CAT III operations:

Autoland or HUD to touchdown operations are required for all CAT III
  operations, and many operators use autoland or HUD for CAT II, CAT I,
  and visual flight rules (VFR) operations as well. Part 121, §
  121.579(c); part 125, § 125.329(d); and part 135, § 135.93(d) prohibit the use of autoland or HUD to touchdown in any operation unless the
  operator is specifically authorized via OpSpecs.

And:

Practice autoland or HUD to touchdown operations may be conducted at
  CAT I runways in CAT I or better weather conditions where the facility
  classification is unknown, because the flightcrew is monitoring system
  performance, visually verifying the position of the aircraft, and can
  determine whether to continue to a landing or execute a missed
  approach in CAT I or better weather conditions. Though it is not
  recommended, flightcrew monitoring and increased visibility also
  permits practice autoland or HUD to touchdown operations using an ILS
  classified as I/A, I/B, I/C, or I/T, provided the operation is
  performed in VFR conditions

I understand that to mean that autolanding is allowed in visual conditions (provided it's authorized via OpSpecs) for training/practice purposes, and since they mention autolanding use even under VFR I don't see why it wouldn't be allowed on a visual approach.


How to mount an extra partition in Ubuntu 14.04

Question: I have a desktop computer with two hard-drives. One drive has Ubuntu 14.04 installed on it (64-bit, UEFI).  The other drive has been partitioned into approximately two equal partitions.  One of these has Windows 8.1 installed on it and the other partition (~ 450 GB) is unallocated space.  I would like to use this unallocated space as an extra partition of my Ubuntu system,to be used mainly for backups.  Could someone please give me detailed instructions on how to do this (mount point, etc.)?  I have very little expertise.  I have Gparted installed, if this is what I should be using.
Comment: Are both drives gpt partitioned? You may want some shared data in an NTFS partition, but for Linux backups you need an ext4 formatted partition. If unallocated is not inside the NTFS partition, just use gparted to create a new ext4 partition. You probably want to permanently mount it with fstab. And will have to give yourself ownership & permissions. https://help.ubuntu.com/community/Fstab and https://help.ubuntu.com/community/FilePermissions
Comment: @oldfred is it must to have ext4 ? Why can't we use NTFS ? An answer below suggests to use NTFS
Comment: If just data, NTFS is ok. But if any Linux system files you need to use ext4 or another Linux format or use a compressed image inside the NTFS partition. NTFS does not support Linux owership & permissions which for data you can easily reset. But throughout system are various settings that are just about impossible to reset.
Answer: This is how I figured out. I will suggest you to re-format that unallocated space in ntfs format ( since this is easy on windows) and mount it on your ubuntu on any appropriate directory.
follow as below:

you need to get the list for active HDDs

fdisk -l

you should have all your disks listed as below corresponding to the partition.
Device Boot
/dev/sdb1
/dev/sdb2
/dev/sdb3

create a mount point anywhere you want i.e.

mkdir /mnt/share

and directory permission to 0777.

Mount the file system by using the following command

mount -t ntfs -o ro /dev/sdb3 /mnt/share

Now cd to the directory and you should be able to "ls" the items.

You can also mount the disk permanently by editing the /etc/fstab file. Hope this helps.
Good Luck!


ARIMA forecast confidence intervals

Question: Can someone explain how confidence intervals for ARIMA forecasts are derived? I can't seem to find any good explanation of it. From what I've read it seems like because an ARIMA process can be expressed as an infinite valued MA process then the forecast values are normally distributed. If this is true then how do you derive the standard deviation of the forecast?
Comment: It's from a prediction interval.
Answer: For reference, let your model be:
$$X_t=\phi X_{t-1} + \epsilon_t$$
Say you have data from 1 to $T$. So your point forecast for $X_{T+1}$ would be $$E(X_{T+1}|\{X_t\}_{t=1}^T) = \phi X_T$$ and the confidence interval of $X_{T+1}$ would depend on the distribution you assume for $\epsilon_T$. So forecast follows normal if you assume so for the error term.
There is another important point to be made here. If you are modelling your data, then you actually don't know the model parameter, $\phi$.  So you estimate $\phi$ by some method (OLS, MLE, etc.). Based on this estimate you have a point forecast which is $\hat{E}(X_{T+1}|\{X_t\}_{t=1}^T)$, i.e., you have an estimate of $E(X_{T+1}|\{X_t\}_{t=1}^T)$ and so another layer of uncertainty in your forecast. In general the parameter estimates are asymptotically normal. So this is another place from where normality comes into picture. Note however that here we define the confidence interval of forecast as that coming from uncertainty in parameter estimate. In contrast, prediction interval of forecast is the one that also includes the uncertainty from $\epsilon$.
For excellent discussion on this see here.
Comment: Taking example from my answer, assume you get $\hat{\phi}$. Whichever, method you use you will also get (estimate of) $Var(\hat{\phi})$. From the estimated residuals that you will get estimate of $\hat{\sigma} \equiv Var(\epsilon_{T+1})$. Assuming independence of $\hat{\phi}$ and $\hat{\sigma}$ (as far as I know, this assumption is very reasonable for OLS. For other methods I am not sure), estimate of $Var(X_{T+1})=Var(\hat{\phi}) + \hat{\sigma}$. So assuming normality of error term, you can use this estimate of variance to get bounds of confidence interval.
Comment: Thank you that cleared up a few things. So I guess what I'm really asking about is the prediction interval. After I make a point forecast how do I calculate the upper and lower bounds for the forecast?

ARIMA forecast confidence intervals


Origin of montages with incongruously happy music

Question: I'm asking about montages of some criminal or depressing thing that have a happy song underneath them. The first show I remember seeing them on is Breaking Bad, but I've also seen them on Stranger Things and probably other shows. Where do they come from?
Comment: Hello! I think your question is not exactly clear, if you're asking for a list of these kinds of scenes or tropes, then your question may be too broad and could be subjected to being closed, but if you are asking for the origin of this trope in TV or film, then there shouldn't be any problem. If you could edit your Q to make it clearer, that would be helpful.
Answer: You may be looking at a Sad Times Montage

A sequence in which it is shown that, while time is passing, the protagonist is feeling sad and alone. Opposite of the Good-Times Montage. In fact, some films will juxtapose a Sad-Times Montage with a Good-Times Montage earlier in the film, only with different music.

The description is very general but provides a more specific example

A montage appears in Good Morning, Vietnam, with images of American war atrocities played against, again, "What a Wonderful World".

OP tagurit rightly indicates that this is also an instance of Soundtrack Dissonance

Soundtrack Dissonance is utilized to, in literary terms, pose a juxtaposition with the intent of making a thematic statement and/or widening our emotional distance to the events before us, thus allowing us to view the piece in a more removed, intellectual manner.
You're taking advantage of a tactic used countless times over the years to heighten the sadness of a scene. Your dissonant music doesn't have to be played over a violent scene, of course. Happy, upbeat music at a funeral of a beloved character can also work. It can be used to excellent effect, especially if the song is somewhat silly
Comment: I found this on the Good Morning, Vietnam page, I think it's what I'm looking for: https://tvtropes.org/pmwiki/pmwiki.php/Main/SoundtrackDissonance Thanks for the answer!