Reviewing documents without having a permission to download

Question: I need to have a team reviewing documents but don't want them to save it on their PC's. I know you can open it up and work it then when it saves it will save back on SharePoint. Is there a way to allow them to do so but restrict it for saving on to the PC?
Comment: So you want it disconnected from SharePoint? You want it to **not** sync?
Answer: First, to prevent users from downloading the content to local PC, you could set "Offline Client Availability" to "No" at site settings.
Second, you could enable Office Web Apps / Office Online Server to provide co-authoring over the browser.
Answer: You didn't clarify whether you are using SharePoint Online or SharePoint On-premise. With SharePoint Online, documents with common Office file types can be opened on the browser when it's just set as the default opening behavior. With SharePoint On-premise, you need to have Office Web Apps installed and configured besides setting the default opening behavior.
For the review-requirement: It depends whether the download should be disabled for all, or only for the reviewers. Also if by reviewing you only mean that users can open the document (in their browser), read it through, and leave it as it is, the following is what you should do. If reviewing means something else for you, then you need to clarify your question.
If you want to have the Download-feature completely disabled in your document library, go to the library's Settings > Advanced Settings and on Allow items from this document library to be downloaded to offline clients? select No. This will prevent the downloading of the document for all users.
If the download-option should still be available for e.g. Full Control users, then you need to assign the built-in permission level View Only to your users doing the review in your document library. With View Only, users do not have a permission to download the documents to their computers.
Answer: If you have enabled 'Publishing' on a SharePoint 2013 site collection you could use the Restricted Read permission level; this is an OOTB SharePoint group on Publishing sites.  This Microsoft page has info about SP groups, including Restricted Read.
Warning - activating Publishing on your SharePoint site might have some unintended consequences, so please fully inform yourself before activating Publishing.  Here is a blog post on Publishing should you need some background info.


Make the pixel values of the DEM correspond to the actual heights

Question: I have a grayscale DEM. From the screenshots it can be seen that the min max value of the pixels range from 267 to 270. However from the generation report (using Metashape) it is known that the actual heights range from 241m to 275m. How do I make the pixels in the raster correspond to these actual heights and not some seemingly random values it has picked?
Comment: I do not really believe that Agisoft is saving ramdom values into pixels. And QGIS shows the pixel values raw as they come from Agisoft. Could it be that the metashape report covers a larger area?
Comment: @user30184 Ah that could perhaps be it. Might have to do some digging around in the source. Thanks for the hint
Answer: I had a similar SE-GIS question several years ago.  The answer: by default, QGIS displays an estimate of the min/max values, which results in the unexpected values.  To see this, open up the Min/Max Value Settings button, shown in your bottom screenshot.
To avoid the estimation, set the Min/Max Value Settings > Accuracy tab to Actual (slower).
For more detail and background, see the two (excellent) answers to my question at:
QGIS VRT values differ from the source rasters


Single email address - Multiple readers of inbox

Question: I've setup an email address for a new website and now I need it to be able to be accessed by multiple users who can setup the email account on their computer and read the Inbox. Some users use Mac some use Windows. Because there will be multiple users the likelihood is that emails might be deleted before other users have read those emails. Which type IMAP or POP do I setup the account in on the multiple users computers? Or is there a better way to ensure that all incoming and outgoing messages are held on the account for all users to read? Thanks in advance.
Answer: The only reliable way to ensure this is to create separate accounts, one for each user.
Most mail systems can be easily set up to "forward" or "alias" one recipient's mail to multiple mailboxes; often as simple as adding a
shared: usera userb userc

to /etc/aliases.
This way, all users will receive a fresh, marked as "unread", copy of the message, and deleting one will not affect others.

People do frequently take offense at being suggested better methods than the ones they think should work. So if you have to choose between IMAP and POP, you will need to choose POP – and if possible, configure the server to disallow message deletion, as some users may accidentally configure their mail clients to "fetch and delete" before other users get the messages.


Confused on this wire config

Question: I am trying to install (2) Lutron Caseta Wireless Switches to replace two legacy light switches. This is my first attempt at replacing a light switch. When looking inside, I am a bit confused on the wiring configuration:
-Why are there four white wires that are just joined together? Do they serve a purpose?
-Why is only one switch grounded?
-Why is there a connection from one switch direct to the other (capped with a yellow connector in this image)
Comment: Both switches should be grounded. Someone was just lazy or careless.
Comment: Sorry @A.I.Breveleri our edits collided.   IMO the second ground doesn't matter if the cover plate is metal.  But it might matter to the smart switch.
Answer: The whites in the back of the box are very important.  They are neutral, and you wouldn't have a circuit without them.  Also it's rather fortunate they are there, because a good quality smart switch will require them.
On both switches, you have 2 wires going to a single screw terminal.  This is nothing but a lazy shortcut in wiring.   Those multiple wires could be replaced by a pigtail, in which case the wiring would be easier to understand.   It looks like that hoppy wire is the "always hot" wire, and is commonly** color coded black, which it happens to be.  The solo black wires are switched-hots going up to the lights, and they are commonly** color coded red, and I'd mark them with red tape.  I'dThis will make it even easier to understand.
Most people, even freshmen like yourself, don't need equipment safety ground explained to them.  The only thing you might need to know is when ground has insulation, it is green, or green/yellow stripe.
** that is common practice. The law only specifies colors for ground and neutral (white or gray).  Legally a hot can be any other color.  In this wiring, the switched-hot is black because they are using pre-made cables and don't have a choice for color.  That's what tape is for.
Comment: Sorry A.I. Your edit collided with my adding paragraph 2
Comment: Your edit covers my contribution. Plus, you said it better.

Confused on this wire config


How do I download a GitHub repository to an Andriod Studio project that I am currently working on?

Question: I am working on an Android Studio project and I would like to add a getup repository to the current project. I am using a Mac.
I have downloaded the Github repository and unzipped the folder and was able to create a NEW project using the GitHub repository in Android Studio, but I do not know how to either
A) merge the two projects in Android Studio so my initial project can use the new GitHub Repository Project.
or
B) if I did this process incorrectly and I need to add the GitHub repository directly to my initial Project. I just don't know how and I have looked everywhere for the answer. Any assistance would be fantastic.
I found this answer about merging projects, but I do not know where to find my projects "module root"
Comment: Are you planning on editing the contents of that repository?
Answer: You may refer to these 2 links, 1 and 2 for elaborations.
First of all, open the project you want to push in Android Studio.
Click VCS -> Enable version Control Integration -> Git
There doesn't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project and do git remote add
Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.
If you are getting the error: fatal: remote  already exists that means you already added it. To see your remotes do git remote -v and git remote rm  to remove.
You may also refer to here and here for more understanding.


Why is the pressure in the house faucets low when my outdoor sprinkler system turns on?

Question: The pressure in the house is good but when the sprinkler system turns on outside the pressure drops in the house. I don't believe this has always been the case or maybe I didn't notice but it seems to be a new thing.
Comment: check your water pressure regulator outside, during both events
Comment: Do you mean pressure, or flow-rate?
Comment: It is normal for pressure and flow to drop when more than one outlet is being used, and especially when one of them is a sprinkler system.  But perhaps you have a new problem where the effect is much worse than before.  This could be caused by a new blockage or constriction in the pipe that feeds both inside and outside, or by a damaged pipe or head in the sprinkler system.   Do all the sprinkler heads work similarly well to one another and to the way they worked before you noticed this problem?  Does one zone  spray poolrly?  Do all zones spray worse than before you noticed the problem?
Answer: The logical and common reason for this is a leak in the sprinkler system.
Of course this is assuming that the sprinkler is fed by the same supply line as the home.
Depending on the type of layout for your irrigation, you may have a loop around the house with each zone being fed by inground zone valves.  Or you may have a single supply to a manifold of valves. This is usually located close to where the house water supply comes into the home. Each zone is branched off of the manifold. It will take a little bit of investigating to find the area where the issue is.
Often a root from a tree or a large bush cracks a pipe or causes a fitting to be disconnected.  Then when the sprinkler is active you lose considerable pressure from the damaged area.
Take a walk around the yard and look for a spot where the ground is extra damp or muddy.  That will give you an indication that the leak may be in that area.
Check your house pressure when each zone is turned on.  If the drop occurs only with one particular zone on, then the leak is in the piping for that zone.
If the pressure drop is experienced with every zone, the leak will most likely be in the main line.
One of the common places for a leak is where the irrigation supply ties into the home supply line.  Often it is deep enough that the evidence of the leak is not easily visible.
I have found leaks in the ground with a mechanics stethoscope.  Push it in the ground and if there is a leak around you will hear a roaring or hissing sound.   Good Luck.


Adding items to an object through the .push() method

Question: I'm doing a loop through few input elements of 'checkbox' type. After that, I'm adding values and checked attributes to an array. This is my code:
var stuff = {};
$('form input[type=checkbox]').each(function() {
    stuff[$(this).attr('value')] = $(this).attr('checked');
});

This works fine, but I'm just wondering if I can do the exact same thing with .push() method in Jquery?
I've tried something like this but it doesn't work:
stuff.push( {$(this).attr('value'):$(this).attr('checked')} );

Edit:
I was trying to use .push() method on Object, but .push() is actually just a method of Array Object.
Comment: It is not possible that your second example works if you really are initializing "stuff" as you describe.
Comment: maybe i've tried that example when stuff was initialized as "var stuff = [];". I think you're right, yeah...
Answer: .push() is a method of the Built-in Array Object
It is not related to jQuery in any way.
You are defining a literal Object with
// Object
var stuff = {};

You can define a literal Array like this
// Array
var stuff = [];

then
stuff.push(element);

Arrays actually get their bracket syntax stuff[index] inherited from their parent, the Object.  This is why you are able to use it the way you are in your first example.
This is often used for effortless reflection for dynamically accessing properties
stuff = {}; // Object

stuff['prop'] = 'value'; // assign property of an
                         // Object via bracket syntax

stuff.prop === stuff['prop']; // true

Answer: so it's easy)))
Watch this...
    var stuff = {};
    $('input[type=checkbox]').each(function(i, e) {
        stuff[i] = e.checked;
    });

And you will have:
Object {0: true, 1: false, 2: false, 3: false}

Or:
$('input[type=checkbox]').each(function(i, e) {
    stuff['row'+i] = e.checked;
});

You will have:
Object {row0: true, row1: false, row2: false, row3: false}

Or:
$('input[type=checkbox]').each(function(i, e) {
    stuff[e.className+i] = e.checked;
});

You will have:
Object {checkbox0: true, checkbox1: false, checkbox2: false, checkbox3: false}

Answer: stuff is an object and push is a method of an array. So you cannot use stuff.push(..).
Lets say you define stuff as an array stuff = []; then you can call push method on it.
This works because the object[key/value] is well formed.
stuff.push( {'name':$(this).attr('checked')} );
Whereas this will not work because the object is not well formed.
stuff.push( {$(this).attr('value'):$(this).attr('checked')} );
This works because we are treating stuff as an associative array and added values to it
stuff[$(this).attr('value')] = $(this).attr('checked');
Comment: This does not explain why `stuff.push( {'name':$(this).attr('checked')} );` works. Honestly, it shouldn't.
Answer: This is really easy:
Example
//my object
var sendData = {field1:value1, field2:value2};

//add element
sendData['field3'] = value3;

Answer: Another way of doing it would be:
stuff = Object.assign(stuff, {$(this).attr('value'):$(this).attr('checked')});

Read more here: Object.assign()
Answer: Today you can use destructuring to make these things for you!
https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
Destructuring works both for arrays and objects too. You can just put:

let stuff = {
  text: "value"
}
// create some other value
const anotherVariable = 10
stuff = {
...stuff,
anotherVariable
}

console.log(stuff)

And the output will be: {text: "value", anotherVariable: 10}


run nmb cable in conduit

Question: I've decided to run a new 60 amp sub panel in my garage using 6/3 NMB. Can I run it 35' through 1" pvc conduit from main panel to sub panel without stripping off the outer sheathing?
Comment: You can. But you should get separate wires. Harper or one of the other pros will explain in excruciating detail with code references etc. But basically there are wires designed for use in conduit which are much easier to fish through than NM cable. Plus you can't simply strip NM cable to use the individual wires in conduit because it is not rated for that use. Plus individual wires should be a little cheaper anyway - and most people (except electricians) don't have a bunch of 6/3 lying around extra.
Comment: On such a short pull .why only 60 amps ? Pennies more could run 100 amps. To a garage.
Comment: Have you ever heard of running individual wires in conduit?
Answer: Stripping the sheath is prohibited
The wires you use have to be identified, i.e. have markings on them.  Interior wire in NM cable is not marked.
You have to pig-wrestle the entire NM cable through, sheath and all.  Good luck.
The correct wires are THWN or XHHW
If you want the flexibility of individual wires, you want THWN or XHHW type. You need a #10Cu green or bare ground and three #6Cu wires, one neutral white or gray, and two hots any other color.  They can be the same color.
If you don't like the price of #6Cu try #4Al.
If you run #3Cu instead, you can run 100A on that wire.  You will need to bump the ground wire to #8Cu and it will need to be bare. This will be a harder pull, though.
Comment: @Will #3Cu for conductors, #8Cu bare for ground, will just  fit in your 1" pipe.   If you haven't laid the pipe yet, price a larger size like 1-1/2 and cheaper #1Al conductors.
Comment: okay if I move up to 100A what size THWNN wires and how big is the conduit?
Answer: Yes you can, and may not have to be in pipe the whole way. Pulling cable may be tough ,to do. You could have gotten single stranded wire for easy pulling.  Make sure you lube pull and a good pull line. And no you do not strip,the wire. Only has to be in pipe ,subject to damage areas only.

run nmb cable in conduit


Is there a HDD/Hard-Drive testing tool for mac?

Question: I just found an external HDD in my shelf and want to sell it :-) Before this, I tried to delete all the files on the HDD, but the disk utility of Snow Leopard aborted with a known error "Disk Erase failed with the error: POSIX reports: The operation couldn't be completed. Cannot allocate memory". So I used the terminal (as described here) to delete the files on the HDD. Now my question is: is there a (freeware) tool to check whether the HDD works well? I don't want to (accidantely) sell a broken HDD
Comment: Could you give the error message? POSIX is just an acronym for a whole class of functions, and since I've never had problems with Disk Utility, I can't guess what error you're seeing.
Comment: Just updated my question
Answer: Why not use Disk Utility to write zeroes or if you have more time, interest in being sure it works repeatable, set it to write more passes of random data.
The drive will report IO errors in the system.log if there are hardware errors. If you have an SSD or want a tool to read back the random bits to ensure everything not only wrote properly, but can be read back with perfect fidelity, see the free tool stressdrive written by rentzsch.
You might also like to read over What is the best free hard drive diagnostics app for Mac OS X?
Comment: Thank you for your answer! I tried "overwrite with zeros", but after 2 hours overwriting I get the same "POSIX" error... I'll try your links


In "Cursed" what is the location of this castle?

Question: When Merlin and Nimue first meet it is in the remains of a ruined castle, is this a real castle somewhere or was it a set/CGI?
Answer: Atlas of Wonders has a write up on the filmin locations in Cursed: Filming Locations Guide: Where was Cursed filmed? The Castle Location. For the most part is seems extremely accurate, here is what it has to say on the location where Nimue and Merlin meet:

The ruined castle where Nimue meets Merlin in episode 6 pictured above doesn't exist in the real world. Most of the scenes set here were shot in the romantic remains of Waverley Abbey in Farnham, Surrey. Abandoned since the 16th-century, this is a great location for productions set in a medieval world like Cursed.

The interior arches seen above certainly do match Waverley Abbey as seen from English Heritage's page on the place:

However, barring the taller part of the building, the exterior certainly isn't a match and appears to be CGI:
Comment: Ahh, that pesky Henry VIII, making all sorts of picturesque ruins for us.


Heinlein story regarding suspended animation and reading newspapers?

Question: In one of Heinlein's stories, a character awakes after having been in suspended animation for many years and catches up on what he's missed by spending a few hours reading a history book, then remarks on how much time he would have wasted had he read a newspaper every day for all that time, reading about matters too ephemeral to make the history books.
Answer: The closest story I can find by Heinlein that matches your question is 'FOR US, THE LIVING: A Comedy of Customs' (pub.2003).
It concern our protagonist waking up 150 years after apparently dying in a car crash. Although I cannot find a quote matching your question, the protagonist does catch up on history by means of a few history books (and one evening spent with a history professor). In fact, this catching up is the main bulk of the story (it's far from his best work).

"Where do we start?"
"I can't decide what you are to do about anything, but it seems to me that the very first thing to do is to bring you up to date so that you will fit in twenty-eighty-six. It is a rather different world. You must learn a lot of new customs and a century-and-a-half of history and a number of new techniques and so forth. When you are up to date, you can decide for yourself what you want to do – and then you can do anything you want."
"It sounds to me as if I'd be too old to want to do anything by that time."
Comment: I tried to read *For Us, the Living* once but gave up. This question reminds me of *The Door into Summer* but the hero of that one spends many hours reading old newspapers.
Comment: @user14111, it is indeed a bit of a slog. It works more as an essay on how Heinlein thinks the world will progress in that timeframe than it does a work of fiction.


Does having Abuse and Postmaster Emails help to stop being treated as SPAM?

Question: I read on some blog (I don't remember the URL) that having firstname.lastname@example.com and email@example.com in addition to main email help to prevent our mails from being categorized as spam. Is it true? Is it worthy to create two additional email accounts. On my hosting, only 5 are allowed. Please suggest.
Comment: You should be able to setup a 'forward' instead and save your mailboxes? Usually the limit on 'forwards' is much higher.
Answer: It would appear so.  After a quick search I turned up a few links that described why it is important to have.
http://www.activewebhosting.com/faq/email-postmaster.html
http://forums.macresource.com/read.php?1,132477,132509
Comment: Just to add, regarding your first link to activewebhosting.com, the bit of info that states, "This [postmaster] is where E-Mail ends up which is addressed to a non-existant account on your domain" - is just how that particular webhost has set things up in this case.
Comment: Although the information is sound, the fact the articles are from around 2006 makes me wonder if Google and other companies still have the same measures because much as changed since then.
Answer: No. It's (maybe) just wrong text, but having these mailboxes doesn't change classifications of e-mail.
Having postmaster@ is a requirement from RFC-world, having abuse@ is just bon ton (proper) between postmasters.
Answer: To be honest I've never heard of such requirements with any of my recent web development projects, nor have I even had clients use those exact emails. Even at my company we stick with emails on a real name basis because abuse & postmaster are so generic that they're essentially spam magnets for bots since it's a default term.
If you wanted to play it safe you always could use an alias and forward it to a main account or just delete all email through there. From my experience, even at the server level on Linux, when I setup Dedicated/VPS DNS Servers I've used my primary company email so I'm atop of any issues.


Opening Excel file in IE provokes three logons?

Question: I have a classic ASP website that posts a form to a page that then generates and streams an Excel file out to users. Actually, its a raw HTML table which I send with:
Response.AddHeader "Content-Disposition", "inline; filename=file.xls"
Response.AddHeader "Content-Type", "application/vnd.ms-excel"

The intranet website is secured via integrated windows authentication. No other access mode is checked. The user logs in with their network password and all is well.
Now, when the user submits the form, this action results in two more login dialogs. You can actually cancel out of both and still open the file. In fact, if you put in your credentials, it requires you to enter them four times! If you check "Remember password", it doesn't affect the need for logging in. Also, this happens even if the URLs are listed on the Trusted Sites section of IE.
Any ideas on what I can do to minimize this?
PS: Not sure, but seems to be a relatively recent issue, meaning a more recent version of IE (7/8), Office (2007+) and or Windows (Vista/7).
UPDATE: Using Fiddler, I can see that something called "User-Agent: Microsoft-WebDAV-MiniRedir/6.1.7600" is attempting to connect, and getting 401.2'ed. Is IE offloading the download to something else that isn't authenticating properly?
UPDATE2: Doubly-interestingly, Firefox does none of this. It receives and interprets things properly:
HTTP/1.1 200 OK
Date: Mon, 21 Feb 2011 19:25:26 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Disposition: inline; filename="SavingsReport_4Q2010.xls"
Content-Type: application/vnd.ms-excel
Content-Length: 111851
Cache-control: private

Comment: IE tries to find out if this is a Sharepoint site with Option requests. You better not challenge these request but send a 404.
Comment: can we get an update or kill the question?
Answer: Old question but here goes in case someone else stumbles on it.
Office tries to authenticate with the file server, through an OPTIONS request, in order to access the file as explained on this article.
Without entirely understanding why, changing your content-disposition from inline to attachment will not prompt for authentication in most environments.
Be careful as this seems to have an effect on the file's name (on win XP - IE7.
E.g. file with name file name.xls would be opened as file_name.xls
Here is example classic ASP Code:
Response.AddHeader "Content-Disposition", "attachment; filename=MyReport.xls"


Arduino with cell phone

Question: I am trying to simulate button presses on a cell phone by using the Arduino to complete the button circuit thus simulating a button press. I figured out I have to use a transistor but I can't get it to work.
Answer: Here's a test I would do before I tried to replace the button with a transistor: check to see whether the closing of the circuit pulls the joined contacts high or low. Once you know that, you can design the right replacement circuit.
To explain a little more: when the button is not pressed, one terminal will be high (3.3 V, maybe?) and the other will be low (0 V). When you press the button, does the low one get pulled up to 3.3 V, or does the high one get pulled to 0 V?
If you're trying to pull a terminal low when you should actually be pulling the other terminal high, I don't think the circuit will behave like you want.
Comment: That approach assumes that the button is connected directly to a pin somewhere in the phone.  If the button is part of a scanned grid (like many keyboards), tying the line high or low could give you some pretty crazy results.  A mosfet would make more sense in that situation.
Comment: @phooky: Right-- the scanned grid is a likely implementation, and a MOSFET is the right tool for the job. I'll add more detail if jason11 comes back with some answers, or you can. Know a good N-channel / P-channel MOSFET pair?
Answer: Analogue switches like those in the 74HC4066 are often used in situations like that.
Answer: What phone are you using?
I took a look at this over the weekend. It seems (unsurprisingly) that there is more than one button mechanism.
An old Verizon/Samsung phone I pulled apart had separate buttons which looked like discretes. Endolith/Pingswept seem to be on the right track with testing.
Answer: I've used these 5V DIL relays before, with great results. They are low-current reed relays that can be driven directly from the Arduino. Using these would negate the need to work out whether the terminal goes high or low - just connect the relay pins across the button's contacts.
Also, the link is to Jaycar Electronics in Australia, who I can highly recommend.

Arduino with cell phone


What is the bare minimum to host a website, without pre-packaged solutions?

Question: I want to host an html page on a domain I have purchased. The html page is less than 20 lines of code. On the internet I find recommendations for certain solution stacks, like XAMPP or WAMP or LAMP, or mentions of wordpress. Is all this really necessary? What's the bare bones method that I could have an html page accessible through any browser in the world? I have a secondary laptop I'm willing to dedicate to the task. Searching is difficult as most results are tailored to entrepreneurs or those who need a full stack.
Answer: No, all of that is fortunately not necessary.  :-)
You just need an HTTP server.  Nginx is a good choice if you're hosting yourself.  Its default configuration is all you need.
I do recommend though adding LetsEncrypt to get an HTTPS certificate for your server.  It's free and automates via CertBot if you've installed Nginx (or other  common web server).
Answer: You would need a static IP address to effectively host a publicly accessible website from your own network. As an alternative you could use a free static hosting solution like Github Pages, Render or Cloudflare Workers.
Comment: You don't actually need a static IP address.  It is common to use a dynamic IP address with [Dynamic DNS](https://en.wikipedia.org/wiki/Dynamic_DNS) for hosting.
Comment: I actually agree with this answer - I think a free hosting solution may be the easiest way forward, and Besworks did qualify the need for a static as being to **effectively host** a website.
Comment: DDNS is certainly an option and I upvoted that comment because it does add value but the OP asked for a "bare minimum" method and mentioned that they have already purchased a domain name. Not all DNS providers offer dynamic configuration and I wouldn't really call the steps required to configure such a service along with the routing and server software setup to be a minimum of effort.
Answer: There are 3 parts to solving this problem (ie hosting website on your own computer)  -

Pointing the domain to the website.  I expect you have this under control, and if you don't its usually easy enough to do through your domain registrar.

Allowing requests to get to your web server.  If you are hosting this at home you will need to make changes to your router firewall to allow it to push connections to the computer you are using as a web server.

You need to set up a web server.  As others have mentioned, you can install Apache or NGINX or any other web server and just make your pages available through that.  In practice though, it may actually be easier to get a simple "WAMP" or similar stack which does this for you, along with some other bits you don't need.

From a technical POV, the answer is quite different.  You may be able to host the website on your router or even a $5 ESP8266 - although doing this is probably more work then a prepackaged solution.


Will decision trees perform splitting of nodes by converting categorical values to numerical in practice?

Question: In Decision Trees, when doing classification or regression, do we use only numerical values? Suppose I have a categorical column Wind as a feature. Suppose I am have 5 rows (observations), and the values for Wind are [high,low,high,medium,medium].
Can I feed this categorical data into a decision tree classifier (like scikit-learn), will it take the data? That is, will the splitting of node based on wind happen on categorical values high with count 2, medium with count 2 and low with count 1. Or, will the system converts it into dummy variable?
Answer: The theory is different than the practice.  Basically, how the algorithms were described in theory is not always respected in practice.  In the case of scikit-learn, the decision trees are implemented considering only numerical features.  This is wrong, or at least, not complete, since for nominal variables you have different ways to find splits than for numerical variables.
A short example.  Numerical variables are first sorted and walking through the sorted values, new tests are created and evaluated. Tests on numerical inputs have the form: to the left all values greater than equal with a possible split value, to the right the other. For nominal values there are various tests, one of them has the form: on the left goes instances with one category, on the right the rest of the instances.
One can always transform a nominal variable into a numeric one using an encoding of some sort. This is fine as long as you do not do some math with the encoded values. But the problem with the implementation from scikit-learn is that it will use the logic for numerical variables on split, applied on the numerical encoding of a nominal variable. Thus, you really can't reproduce the behavior for nominals that I had given to you as an example.
It received also consideration the one hot encoding alternative. This means you will transform a nominal variable into multiple binary variable (one for each level of the nominal variable). Treating numeric encoding of nominal variables or one hot encoding might produce results (no doubt of that).  The point is that they produces different results than the algorithm specified in theory since they do not fully implement it.
There are various ML libraries, most of them having support for treating categorical variables (R names them factors, Weka names them nominals, etc).
[Later edit: address comments from Soren and Candic3]
As far as I know specification from Breiman on random forests considers binary splits on nominal variables from all groups of variables combinations. As Soren said, this are $2^{L-1}$. This is too much. However there are two things which can be said about that.
First one is that you don't have to follow this recipe for nominal.  You can search for binary splits on nominal variables of the form one vs all.  These are short in number, even for variables with many levels.  One can say that you can transform into binary indicators with some encoding. This is true, but not complete, since you have to deal somehow with missing values, which is not an easy job with encoding. Using surrogates or weighted random is impossible. Somehow you must do variable imputation before the encoding takes place, or consider missing as another category.
The second thing is that in case of binary classification for Gini impurity there are proofs that shows that the best split from all $2^{L-1}$ is found much faster if you use the following procedure. Compute purity function for each level subset. Sort variables by the value of impurity function computed on each subset. Then, compute binary splits of subsets where on one side you have first $k$ variables sorted previously, and in the other group the remaining values. This procedure is computed in linear time so, is much efficient and can actually handle variables with more than 32 levels. For details on that see Elements of Statistical Learning, 2ed - page 310, section 9.2.4 Other Issues. You will find there an explanation and following references.
My personal conclusion in topics like that is the following. If possible use categorical treatment. This is sometimes possible even for large number of levels. However for large number of levels you should proceed with caution. Too much levels can be translated in low predictive power. So maybe a grouping of the levels gives more than use directly the variable.
For example if you have zip codes. The number of levels can be huge. A direct treatment is possible, but perhaps some decoding of zip codes into regions has an increased level of generality and thus more predictive power.
My thinking is that too much granularity in nominal levels should be analyzed and solved in a more interpretative way that directly by programming tricks.
Comment: And if more than 32 levels you can use extraTrees algorithm instead.
Comment: R factors can ofc have a lot more levels. Implementations of tree models such as randomForest cannot handle more than 32 levels, because every possible split is tried and that increases exponentially, e.g. 2^(32-1)=2.1 10^9. If more than 32 levels one can use the extraTrees algorithm instead which will only try a much smaller random fraction of splits.
Comment: Nicely answered. So, R has that ability . Thanks for the information.
Comment: R is able to do that. However, note that in R factor variables are allowed to have a maximum number of levels. The maximum is 32 or 64 or something else, I don't remember now. I hope you don't have this case.
Comment: So, what is the proper way to handle it in theory?  I'm not sure I'm getting that from your answer, @rapaio.  Thanks.
Answer: Generally, categorical variables should be treated as such, and not assigned dummy numerical values. Imagine a case where the variable is "hair color", and the possible values are "red, black, blonde, brown". Assigning a numerical value to this variable wouldn't make any sense because there's no inherent ordering. If there is inherent ordering in your variable's values, like with your wind example, you may need to specify that directly (depending on your analysis package) as numerical values, associating each variable state with a number directly - your package probably won't necessarily put them in the order Low, Medium, High by default.
Comment: So, I have one question. In the case of hair colors , if the program like scikit learn is obtaining a column of hair colors, will it count the unique number of hair colors ? My primary doubt a computer can do calculations or comparisons based on numerical values. So, if the system find a variable or value in this case as "black" hair color, how come the computer knows , ok its a unique thing. I should split the node by considering it. How that happens in practice ?


Why do I see a Smiley instead of Next button?

Question: My relatively newly acquired Samsung Galaxy GT-I9000 running Android 2.1 should have a next button around the bottom right of the keypad as per manual/online information. However, I can only see a Smiley button which doesn't have newline as one of the options.
Is there a user configurable option to switch between Smiley and Next? If yes, how to invoke?
Comment: Do you know which keyboard you're using? The Galaxy S comes with a number of different keyboards by default, you may be using a different one than the instruction assume that you're using: go into **Settings** -> **Locale and Text**, **Select Input Method** and see which is selected (you should have at least **Samsung Keyboard** and **Swype** as options).
Comment: As below - I use Swype. Samsung keyboard gives Next button. I should imagine next is a must whereas smiley is nice to have - regardless of input method (just an opinion)
Answer: Can it be that you only have a next button when there is more than one field on screen ?
Please add what program you are using when you see this .
Comment: Agreed, using the Swype keyboard on my Galaxy S, the button on the bottom-right changes functions depending what app I'm in and what I'm doing, sometimes it's an Enter key, sometimes it's a Next field button, sometimes it's a Go button. I assume the same sort of thing happens on other keyboards.
Comment: Thirded, this is the same on my SGS Vibrant with the stock Android keyboard.
Comment: Hi. Thanks what I've noted since is that I don't have the issue on Samsung keyboard but Swype keyboard.
Comment: Also - to answer your question, I'm using it for regular SMS
Answer: This is quite normal on the default keyboard. The smiley should only shows if you're typing in a single-line textbox (i.e. it have been configured so you cannot add newline), and there is only a single textbox in the page, and the app did not bind custom functionality to it.

Is there a user configurable option to switch between Smiley and Next?

Not as far as I know. The developer of the app you're currently using gets to decide the "type" of keyboard that is shown by default, and they can customize the action button.

If yes, how to invoke?

Try opening the browser, while on the browser, the smiley should turn into newline button (e.g. on multiline form input), or Go button (on the address bar), or sometimes Next button (on pages that have multiple single-line input).
Answer: I have Jelly Bean 4.2.2 on a HTC One S and Swype 1.4 installed. I was ready to go on a shooting spree when I thought I couldn't hit a return button to start a new line!
I opened a SMS thread, tapped Menu > Settings and scrolled all the way down. There is an option at the bottom called Soft keyboard type. Open that and you get --
<> Smiley key
<> Send
<> Enter for a new line
Select the bottom one and you're golden!
This setting will change it for both the stock Android keyboard and Swype.
Cheers
Comment: Just to be clear for other visitors: this will change the behaviour for any keyboard, but **only** in the SMS app. As others have described, it's up to the app to choose whether an Enter key or some other action key is displayed.


Birchas HaTorah - everyone was awake all night

Question: Suppose everyone in the Shul remained awake the whole night of Shavuos. What do you do regarding Birchas HaTorah?
Answer: With regard to Birchas Hatorah, Mishna B'rura (47:28) brings a difference of opinion if one should recite Birchas Hatorah after a sleepless night, and therefore rules that one need not say the b'racha (ספק ברכות להקל). However, if possible one should hear it said by someone else and respond "amen", as is usually done Shavuos morning. If no one slept, though, it would seem this is not possible, and everyone should have in mind to be yotzei with the b'racha of ahava rabba before k'rias shema, and then say some p'sukim or learn some Torah immediately after shacharis.
However, if someone took a nap on erev Shavuos, then proceeded to stay awake the entire night, the Mishna B'rura brings the ruling of R' Akiva Eger, that he must recite Birchas Hatorah according to all opinions in the dispute cited above. That said, you will most always find someone who is obligated to say Birchas Hatorah.
Of course, as usual, for practical rulings, CYLOR.
Comment: The RAE trick probably only works if you for some reason didn't say Maariv (including Ahavat Olam) the night before, since the blessings on shema exempt you if you needed it after napping.
Answer: According to Rav Ovadia Yosef (for sepharadim), you say morning berachot as normal starting from אלהי נשמה (and including birkat hatorah) at Alot HaShachar.
Comment: Source? (15 characters)
Answer: ANECDOTAL
When this happened at my shul about 12 years ago, the rabbi simply sent someone up to say the b'rachos aloud on behalf of the congregation.
Comment: You can mention who the Rabbi is and it would qualify as a "Maase Rav".


Cross platform COM development

Question: COM as we know is language and platform independent standard, but all the time I see only articles on developing COM components on Windows. Could you share your thoughts on how to develop a true cross-platform application.
Answer: I've written code using COM on Mac and Unix, with no supporting libraries.  You actually just need C++.  It's basically a protocol.
However, if you really want to write using cross-platform COM, I suggest you look at https://developer.mozilla.org/en/XPCOM
Answer: If you aren't opposed to commercial tools, MainSoft's MainWin let's you integrate Visual Studio COM/ATL development in a Linux environment.  You actually develop on your windows box but the binaries are compiled on the native Linux box.  You can check it out here:
http://www.mainsoft.com/content/mainsoft-enterprise-edition-overview
I have personally used this at my company with great success.

Cross platform COM development


How should sampling frequency, switching frequency, control loop update frequency, and anti-aliasing filter corner frequency relate?

Question: Suppose one is designing a processor-controlled switching supply. In general, how does one properly select switching frequency vs. control loop update frequency vs. feedback sampling frequency vs. feedback anti-aliasing filter corner frequency? I think control loop update frequency should match switching frequency, and that the feedback sampling frequency should be at least the switching frequency. I also think that the anti-aliasing filter should be a lowpass that cuts frequencies above half the sampling frequency (though of course doing that perfectly is impossible). Is that accurate? If not, where am I wrong? Should the sampling frequency in fact exceed the switching frequency? Should there be some digital filtering involved as well?
Answer: This is a broad question with whole books written on this subject, so it can only be dealt with briefly here.
For most processor-controller power supplies, switching frequency is the control loop frequency.  If you have a high switching frequency and a complicated control loop, you might only run the loop every second cycle, or some small number of cycles.
Sampling the external state would be done just before each control loop iteration, at least for the important signals that are "inside" the loop, like the value it is trying to control.
As for filtering, generally filtering any feedback input to a control loop is a bad idea.  Put another way, you never want to hear about output changes late.  It is OK to filter other input to the control loop, like the control input, because that isn't really inside the "loop" and changing it slowly doesn't cause instability.  It does reduce the overal input to output bandwidth of the whole system, but sometimes it is useful to limit the control input to the frequencies that the system can realize.
Comment: All that makes sense. Thanks. Now, if you want to filter your feedback signals as little as possible, but you still need an anti-aliasing filter before your A/D converter (right?), does that imply that higher sampling rates allow for less filtering, and are thus better? Or would the higher sampling rate need to be countered by a digital filter, resulting in less improvement?
Comment: @Stephen: No, I wouldn't put any deliberate filter between the output signal and the A/D input.  Any delay in this path decreases the stability margin.  You can apply a little bit of filtering to reduce random noise, but the time constant needs to be small compared to the loop time.  Generally you don't filter and live with a little random noise.  The slower the control reaction, the more filtering it can tolerate.  Basically you can trade off transient response with steady state noise somewhat.
Comment: @OlinLathrop: Much of what I've learned about control theory has come after the last job I did which involved positioning large motors.  Would I be correct to guess that filtering to avoid moving a motor back and forth when there's nothing much for it to do would have been better placed on the back-end than the front-end, possibly with a little feedback so that the "expected" motor motion will correspond to the control signal it was actually given, rather than the PID output?
Comment: So no anti-aliasing filter, you just live with the aliasing?
Comment: @Stephen: What aliasing exactly?  What signal are you expecting to be on the readings that has a frequency more than half the pulse rate?  These readings are synchronous with the pulses, so that doesn't cause aliasing.  There is always some noise, but part of good design is to minimize the noise in the feedback path.
Comment: @OlinLathrop Ahh. Right. You don't get aliasing if there's no frequency content that high. I guess I was assuming the fact that the control variable I'm measuring isn't a perfect sine wave would result in there being high frequency content you'd need to get rid of. Not enough to worry about, typically?
Answer: These are my personal opinions based on the type of switching power supply I've seen you raise questions about.
You should establish (in your own mind) that the switching frequency is chosen ONLY to suit the application's energy storage devices, its load requirements and the input supply voltage range that can be expected. This is the critical part of the design.
Once established, you then determine what duty cycle you need to map to any given condition such as load changes and supply voltage changes.

If your supply voltage range doesn't move quickly (why should it?) then your control system doesn't need to be fast to cope with this.
If your load requirements don't change quickly then the same applies.
You can assume that the components you have chosen don't alter their values except at a slow-rate due to aging and or self-heating.

You also need to consider how much you can tolerate as an error should the duty cycle be fixed and the power input voltage level change by (say) 5%. Ditto the load current due to load resistance changes.
From this you could implement forward error correction techniques to tweak duty cycle based on your processor measuring how much your input supply voltage moves and how much your load current is changing. This does not require fast measurements and they are not at all comparable with switching speed. This is similar to mapping an engine.
So far no relationship needed connecting ADC sampling, anti-aliasing and switching speed.
Summarizing, you have a decent core of switching components that produce the required output voltage for a given duty cycle. Most of the elements that may affect output voltage can be forward error corrected by tweaking the duty cycle. It doesn't produce a fantastic regulator but it would work reasonably well but can drift over time. No feedback yet and no chance of instability.
But the loop does need to be closed because components heat and age and the mapping of the core electrical components won't be an exact science so ask your self the question - how quickly will the output drift from the nominal given that you can forward error correct the obvious culprits?
For your type of power supply I would say it doesn't drift quickly but only you can answer that. The feedback you do implement isn't far-reaching - it's not trying to accommodate supply voltage variations or radical load changes - let the forward error correction do that - let the actual feedback system only deal with drift.
So, the final "nail" should be feedback based on what your average output voltage is doing and providing you have designed the switching elements correctly this "real" part of the control-loop doesn't need to have high bandwidth.


Desktop environment switcher is broken?

Question: I have Ubuntu 16.04.2 LTS, with kubuntu-desktop installed as well as ubuntu-gnome-desktop. The problem is that I cannot switch between Unity, Plasma, and Gnome. When I click the switcher, it does not show any desktop environments and defaults to Gnome. When I try to install Unity, which apparently has been uninstalled, it gives me a "you have held broken packages" error. The login is also quite broken, as it requires multiple tries to log in. In short, I might have irreversibly damaged my computer.
Comment: I have a feeling this is a problem with multiple display managers (lightdm, gdm, kdm etc...) you can try `sudo dpkg-reconfigure lightdm` (or gdm, etc..) and set a default display manager.
Comment: gdm3 and sddm work for the switcher. It seems that the problem lies with lightdm.
Comment: Glad to hear it, I had a similiar issue and lightdm was my problem too. It doesn't seem to want to play nice with the others.
Answer: You can set a different default display manager using
<code>sudo dpkg-reconfigure lightdm
</code>
(or gmd3, kdm, sddm, etc...)
Changing the default manager should work to restore the switcher functions. It seems lightdm does not like to play well with others.

Desktop environment switcher is broken?


Personal sound library workflow

Question: when you stumble upon an interesting sound and you record it, Do you edit it right away keeping only what you think you'll need?  Or, do you keep the raw files and use them when you'll need them?
Comment: In terms of peak levels and consistency, is there a general level to normalize ambiences like streets, rain, etc...as well as all sorts of hits, crashes and louder sounds?
Answer: We did a whole tonebenders episode on this topic with Paul Virostek.
I personally edit what I need, backup the originals and then never think of them again.  Dustin keeps all of it and I have no idea how he goes back through the source recordings.
I find soundminer to be a huge asset for this kind of thing, because it lets me tag the files as I see fit and then I can import only portions of the files into my sessions if I don't need the whole thing, or if I have a series of sounds edited into a single file.
Answer: it all goes into my library; the original recordings, edited versions, processed versions or whatever... It is so easy to manage and find media via SoundMiner, drive space is so cheap, better to keep it all because you just never know.... a new context might arise....
Comment: how do you handle labeling of raw vs edited stuff?  do you chop the good stuff out of the raw stuff and label it separately?  How often do you go back and listen to the raw stuff?  I find that I never really do that.
Comment: i rarely revisit the raw recordings,but it is cheap peace of mind to know they exist... it depends on what i am working on and why the recordings were made as to editing and outputing versions, and naming... my library drives are chronologically compiled/growing
Answer: I have a "to edit" folder on my hd where i copy all raw files if i don´t have the time to edit them right away, which is the common situation. When i find the time, i edit the single sounds, clean them up with RX, change gain(if needed) and write metadata into them (twisted wave). After that i rename them and save them into the dedicated folders and import them in Audiofinder. If i´m happy with the results i delete the raw files. I backup my whole soundlibrary every day. In the beginning i always kept the raw files but as i noticed, that i never got back, i delete them all.
Comment: that's VERY similar to my workflow.
Comment: I don't do much noise reduction as i try to avoid noise in my recordings but if i have to do, i donit right away. I want my sounds to be usable without any further editimg or restauration, except sound mangling :)
Comment: Pretty much exactly what I do myself as well but in addition I always try to take a photo of whatever it is I record and then name the photo the same as the recording. Saves me having to remember the setup/mics etc. and thus won't forget them when I add the metadata into the .wav at a later point in time.
Comment: @AndréEngelhardt This is, what i forgot to mention. I also do pictures of nearly every recording, sometimes even videos ;)
Answer: My workflow bears some resemblance to @Andreas.  I maintain a repository of raw recordings, sorted by folders appropriately.  But once I master them (one big part of my mastering is that I often don't do much to them - mostly just corrective EQ notching, gain staging, M/S width).  But once I'm happy with what I've got, I blow out the raw.  I know that personally, I'm never going to touch the raw again anyway.  Especially so because much of it is MS anyway so the raw files would be a pain to work with in editorial.
To each their own though.  Raw files are of little use to me once I have the recording dialed in the way I like it to sound.  Helps with the learning process of making a commitment to a creative choice and sticking with it, through better or (sometimes with much later hindsight), worse.  But even those can be great learning experiences too.
Comment: I also think it´s usefull to write a final M/S File. This is a certain kind of artistic expression and on the other hand, people are not be able to work with XY, AB  or ORTF in the same way. These are all fixed stereo images and it´s good. Everyone accepts it. Shure people can do a lot with M/S Raw…but do people need it or do they live with a great stereo recording ? Sometimes it´s good to have a border. It´s easier not to have endless possibilities. This leads to a more straight workflow…. (my opinion) ;)
Comment: So you decode your recordings during mastering?
Comment: Yes.  I never store them in their final form as raw M/S.  It's useless for my editorial workflow, and I feel that I know exactly what I want out of a recording to make the final M/S balance decision ('know what I want out of it' both when I recorded it and am re-evaluating it during mastering), and am able to trust the decision I make due to the calibrated monitoring environment I master in.
Comment: By decode I am referring to XY output, now the raw M/S.  I record as M/S (with M/S decoded headphones via 702), and than matrix them after the fact.
Comment: I certainly agree.  Setting a boundary/border is a great way of putting it.  At least with M/S.

Personal sound library workflow


How can I create a Distribution from its probability density function?

Question: I have a probability density function.
Is there a mechanism to create a Distribution object from it, such that normal Mathematica commands that usually work on distributions, such as Variance, RandomVariate, etc., work on it?
Comment: "[`ProbabilityDistribution`](http://reference.wolfram.com/language/ref/ProbabilityDistribution.html)[$\mathit{pdf}$, {$x$, $x_\min$, $x_\max$}] represents the continuous distribution with PDF $\mathit{pdf}$ in the variable $x$ where the $\mathit{pdf}$ is taken to be zero for $x < x_\min$ and $x > x_\max$."
Answer: You need ProbabilityDistribution.
Example:
distr = ProbabilityDistribution[E^(-(x^2/2))/Sqrt[2 π], {x, -Infinity, Infinity}]

Mean[distr] (* ==> 0 *)

Variance[distr] (* ==> 1 *)

Warning:
You are responsible for ensuring that the probability density function you provide is normalized over its domain.  Mathematica will not verify this and will not warn you if it isn't, however it will give you incorrect results when using the distribution.  I know from experience that e.g. Variance and RandomVariate will give incorrect results in this case.
Comment: Addendum to the warning: in current versions, use the setting `Method -> "Normalize"` if you want `ProbabilityDistribution[]` to perform normalization of your PDF on your behalf.
Comment: +1 for the warning, I have experienced that as well. It's something that should at least be noted in the documentation.
Comment: @Guillochon ust checked, it's mentioned under Possible Issues.
Comment: This is new to the documentation in Mathematica 10 (and the online documentation), it is not mentioned clearly in the Mathematica 9 documentation. There, it appears under "properties & relations" and simply says "The integral of the PDF over the distribution domain needs to be unity."
Comment: @Guillochon I think it's a good idea to use the feedback box at the bottom of *online* doc pages, they seem to listen to reasonable suggestions.


Direct selection is edting all cornes of a rectangle

Question: I am reading a tutorial. The author drags a rounded corner away from the rectangle to remove it. I do the same and all corners are altered. I am using CC 2015 the sames as the author.
Comment: What is your question? It sounds like you're trying to turn a rounded corner into a sharp corner using the live corner feature in Illustrator.
Answer: With the Direct Selection Tool A, click on the shape to select it.
Click on the corner widget once, to select it
Then do a second click and drag on the selected corner widget to move it
Example


When should I use a ground plane?

Question: I am new to PCB design. My circuit contain a voltage of 3.3V, maximum signal frequency of 400 kHz and less than 10 components connected to ground. Do I really need a ground plane in my PCB? Or to be precise: When should I use a ground plane?
Answer: A lot depends on whether you are doing a commercial PCB to be manufactured and sold, or a few one-off boards for your own use.  If the former, then a  ground plan is more important to keep radiated emissions down to meet FCC (Part 15, unintentional radiators), CE and other regulations, although I've seen plenty of commercial products with one or two-sided boards and no-ground planes.  (On the other hand, one of my clients just made a six-layer board with three signal layers, a Vcc layer, and two ground planes in a sandwich configuration.)
If you only have signals up to 400 kHz, then it sounds like you aren't using a microcontroller (or if you are, you are using an internal oscillator so there is no crystal).  If you have prototyped your circuit on a wireless breadboard or the like, and it works okay, then it should work fine without a ground plane.
Even if you are doing a commercial product, if your device is battery powered,
and it has no signals above 1.705 MHz (which is true in your case), then it is exempt from FCC rules.
Answer: First, you need to make sure that your assumptions are valid. For example, if your circuit is connected to two pieces of equipment powered by switch mode supplies, there will be a common-mode high frequency current flowing between those units. The current will flow through your device, generating "noise" voltages on the impedances of the traces in your circuit.
Secondly: whether it's a problem or not depends solely on what the circuit is doing. You need to estimate the impedances of the traces between various nodes in the circuit, and model their effect on the circuit. If you're using a circuit modeling tool such as spice, you should replace your "solid" connections with circuits equivalent to trace impedances. You can then determine if the voltages dropped across those impedances are an issue or not.
Answer: Idealy you should always use a ground plane. But for different kind of reason it is not always possible or suitable:

1 and 2 layer(s) PCB:

For 1 layer, I think the reason is quite obvious. You can fill the unrouted PCB with copper to GND but that's not a real ground plane.
For two layers, you don't always have enough space for routing on one layer and a ground plane on the other, but if you can, do it, even if you have some small traces on the ground plane layer.

Analog design:

Some analog design should not be referenced to a ground plane or should have a star connection for GND.
For instance, if you're doing an acquisition circuit, you should worry about the different reference planes. Same for isolated power supplies.
Also it depends of your design, if you're doing a 5V CMOS level design, disturbances like 1V spikes may not affect your circuit's behavior, while with a 1.8V, it become quite harmful for the behavior.
Same for frequency and rise time: a low-speed circuit won't spread too much EMC comparing to high-speed circuits (I'm not talking about the signal frequency, but about the rise time equivalent frequency).
Comment: So are you saying that ground plane is best used on 3 layer boards?
Comment: 3 layers board doesn't exist.

When should I use a ground plane?


Usage of the word "issue"

Question: I'm confused about the usage of the word "issue". How does it differ from "problem"?
Also, could you tell me whether this sentence correct: "There are different opinions on the issue of learning foreign languages". I feel this my guts that it's not, but I cannot be 100% sure since I'm not a native speaker.
Can I use the phrase "the issue of ____" and "the problem of ___" just with any noun?

The problem of making or buying presents
  The problem of souvenirs
  The issue of learning foreign languages

Thank you in advance!
Answer: 'Issue' has a broader sense than 'problem' as the former means a subject or problem that people are thinking and talking about. Nevertheless, 'problem' means a thing people have to deal with or solve.
E.g. 1 - 'There are a number of issues to be discussed in the meeting. It reflects the word 'issue' refers to the topics and matters people have to discuss.
E.g. 2 'There are a number of problems for the department to address.' Then, problems means something to solve.
The issue of poverty / The problem of poverty (noun) are both correct in grammar.
Comment: Yes. The modern trend of using "issue", when the better word would be "problem" depresses me. Biggest culprits are technical support people who insist on calling your problem an "issue" - as if it isn't in fact a problem.

Usage of the word "issue"


Rails 3, using Prototype and JQuery, remote => true not working

Question: I have a Rails 3 application that needs to use both Prototype and JQuery libraries.  Now I am having problems when it comes to making different kinds of remote calls.  I am able to do a remote_function call and return RJS and that works just fine.  But, on another page I want to do a form_for :remote => true, but that fails - it just submits like a normal form.  It seems like the JQuery is not handling the :remote => true stuff like its supposed to.  I checked that the HTML is correct, that I have the correct JQuery version of rails.js, and that I have included the jquery libraries correctly and they are being loaded.  One thing I noticed is that this alleged remote call has a content type of HTML instead of JS.  That doesnt seem right to me, because the previous remote_function call had a content type of JS.
So my questions are:

Am I missing something to make Rails use JQuery?  Other than having the correct rails.js and including the jquery libraries, and adding the jQuery.noConflict() bits,  do I need to install a gem or add some special lines to some config file somewhere?
Should a form_for :remote => true call have a of content type JS or HTML?
What is a form_for :remote => true call expecting to get back?  Is it just looking for a good or bad status, or can I pass things back like RJS used to allow (like DOM changes, or effects)?
I want to use the proper JQuery callbacks instead of RJS, how/what should I respond with?  I'm confused about .js.rjs vs .js.erb, and how the data or DOM changes will get back to the page so that the JQuery callbacks can do something useful with them.
Answer: I am sure you may have figured out the answer by now. I just wanted to add a link that I found helpful when i was in need of both JQuery & Prototype.
JQuery & Prototype in Rails 3
Hope it works out for you.


Connecting a 5v dc fan to ultrasonic sensor

Question: I am currently doing a simple uni project where i want the distance read by an ultrasonic sensor to control the speed of a dc 5v fan. I have attached a schematic of how i think i can link the ultrasonic sensor and fan components in order to achieve my main goal. Please tell me if this circuit is right or wrong and give some helpful feedback, thank you!
Answer: It's wrong.
A fan is a motor. A motor is a power hungry inductive device.
Just like any other motor or similar device (such as a relay or solenoid) you cannot drive it directly from the Arduino. Instead you need (at the very least) a transistor to switch a higher current and a diode to absorb back EMF.
Comment: The same way as you would for any other inductive device such as a relay (like I am *sure* I mentioned). There's a billion and one tutorials telling you how (and that's *not* an overstatement).
Comment: Thank you for telling me it was wrong. Would like to know where i could possibly plop this transistor and diode.


Running nicklist with irssi using screen inside tmux?

Question: I try to run the nicklist addon with irssi using screen inside tmux but strangely :) it doesn't work and I get the input on top of the screen. Is it possible to run nicklist when you are on tmux?
Answer: An alternative way is splitting your current window in tmux (C-b + h or whatever you set up your shortcut) (horizontal), resize that window (C-b + left/right) and then activate nicklist.pl in the "FIFO" way:
In irssi:

/NICKLIST FIFO (only the first time,
to create the fifo)

In a shell:

In the window we split and resize: $
cat ~/.irssi/nicklistfifo

Then in irssi again:

/SET nicklist_heigth "height of nicklist"

/SET nicklist_width "width of nicklist"

/NICKLIST FIFO

So at the end you should have:
--------------------------|----------
---------irssi ----------   |nicklist
--------------------------|----------
Comment: Finally tried tmux again and tested your solution and it seems to work well. Great answer! Thanks!
Comment: I used it some time, but it got too annoying with switching and scrolling so I dropped the nicklist windows and doesn't really miss it. Thanks anyways for a good answer!


Is 8 the largest cube in the Fibonacci sequence?

Question: Can you prove that 8 is the largest cube in the Fibonacci sequence?
Answer: This paper, using some heavy-duty number-theoretic machinery, shows that 1, 8, and 144 are the only perfect powers in the Fibonacci sequence, which in particular implies that 8 is the largest cube. There may be an easier way to prove it for cubes, however.
Comment: The Fibonacci Series, slightly wonky powers of 2.
Comment: It seems, at least at first, that the mode average (of the simplest form of) every fraction of pairs of values from the sequence, draws for first place, at 2, and 3, and 5, and 8, and 13, and 21, etc... It's strangely meta :)
Comment: Name of this paper:  [Bugeaud, Mignotte, and Siksek - Classical and modular approaches to exponential Diophantine equations. I. Fibonacci and Lucas perfect powers](https://arxiv.org/abs/math/0403046).
Answer: This is only a partial answer, but: one characterization of Fibonacci numbers is that an integer $a$ is Fibonacci if and only if $5a^2 \pm 4$ is a perfect square.
Because of this: finding Fibonacci cubes is equivalent to solving the Diophantine equation(s) $5a^6 \pm 4 = b^2$.  There are standard techniques for doing this: for example, in the case of $5a^6 + 4 = b^2$, the equation can be rewritten and factored as $5a^6 = (b-2)(b+2)$, and using the fact that any common factor of $b-2$ and $b+2$ must divide 4, you can get a lot of information out of this situation by looking at the prime factorizations of both sides.
In the case of $5a^6 - 4 = b^2$, you have to pass to the Gaussian integers (numbers of the form $a+bi$ with $a$ and $b$ both integers) to obtain a factorization:  $5a^6 = (b+2i)(b-2i)$.  Again, you can apply the same approach (Gaussian integers also have unique factorization): it will be a little bit trickier, but I've seen problems like this solved by the same method.
Anyone want to try to fill in this sketch of a proof?
Edit:  Having thought about it a bit more, I'm less optimistic.  The problem is dealing with the factors of 5:  the methods I describe are excellent for dealing with questions like $a^6 \pm 4 = b^2$ or even $a^3 \pm 4 = b^2$, but those arguments break down when you take the 5 into account.  Also, any method that uses either of the factorizations I mentioned will also have to say something about solutions to the equation $5a^2 \pm 4 = b^2$: but we know that this equation has many solutions (since a can be any Fibonacci number).  There are other potential ways we could rearrange this equation to factor it, but analyzing them won't be easy.
However, rephrasing this question as a Diophantine equation is still helpful.  There's a general and rather hard theorem (Siegel's Theorem) that any Diophantine equation of genus $\ge1$ has only finitely many solutions.  What "genus" is is a bit technical, but most equations of degree $\ge3$ have this property, and in particular Siegel's equation applies to equations of the form $y^2 = P(x)$ where $P(x)$ is a polynomial in $x$ of degree $\ge3$ (with no repeated roots), which includes our two equations.
So we can deduce from this that there are only finitely many Fibonacci numbers that are cubes. Unfortunately, Siegel's result isn't very helpful for the original problem because it doesn't give you any way of telling when you've found all of them.
Additionally, we know that if we have an solution to $5a^6 \pm 4 = b^2$, setting $c = a^2$ gives us a solution to the equation $5c^3 \pm 4 = b^2$.  This is the equation of an elliptic curve, and there is a fair amount known about how to find the integer points on an elliptic curves (and more generally, rational points on elliptic curves), although the computations involved are usually not fun to do by hand. Anyone know how hard it would be to get a computer to solve this problem?
Comment: It's _really easy_ to get a computer to find all the integer points on an elliptic curve, as I was just saying the other day at http://mathoverflow.net/questions/20286/repeated-digits-of-squares-in-different-bases . Multiply up by 25 and we're looking for integer points to X^3+-100=Y^2 (with X,Y both multiples of 5). Both magma and sage have got this implemented now: you just type "IntegralPoints(EllipticCurve([0,100]));" into magma for one, and change 100 to -100 for the other. Both commands terminate in about 0.2 seconds.
Comment: [remark: the biggest integer point on either curve is 5*532^3+4=27438^2, but, unfortunately, 532 isn't a square]
Comment: If you look through all the results for ones that are 5 times a perfect square, it's only 0, 5 and 20. So that seems to answer the question completely.
Answer: For a much more accessible treatment, and history of the result, see Andrejic (2006) "On Fibonacci powers"
Comment: Let's try again: http://www.doiserbia.nb.rs/img/doi/0353-8893/2006/0353-88930617038A.pdf
Comment: The link works but most of the definite articles are missing.
Comment: In case the link doesn't work, try http://pefmath.etf.bg.ac.rs/to appear/rad520.pdf (.yu domain changed to .rs)
Comment: I made a URL that actually works: http://tinyurl.com/y8afbvb
Answer: In Siegel's article Zum Beweise des Starkschen Satzes. Inventiones mathematicae (1968), Siegel reduces the class number one problem for imaginary quadratic fields to the determination of Fibonacci cubes. The latter problem he solves in an elementary way. However, he does not mention Fibonacci numbers.


What are the various Swiss dialects for Guten Abend and other day greetings?

Question: Swiss people were heard saying Guten Abend as "Gütte Oppa" in one part of the country. How is the Swiss-German spelling for this actually, and what are the various ways the different Swiss dialects say Guten Morgen and Guten Abend, etc?
Comment: In which dialect do people say "Güten Abend"?
Comment: Is this a spelling mistake and should read 'Guten Abend' etc?
Comment: I don't think the spelling of dialect is really standardized, but one video I saw went with "Gueten Oobe".
Comment: Gütte Oppa is how the Swiss greeting sounds, and only a guess at how it would be spelled according to English phonetics. Sorry if there is no umlaut at all for Guten Abend, but that's beside the point. Was Gueten Oobe used elsewhere for confirmation? And is this now a question of whether Oobe is the Swiss-German word for Abend.
Comment: I have removed the ü's. If they were intentional and somehow related to dialect then please revert and clarify. I did not know what to do about the one remaining ü.
Comment: In the first sentence, should it be Gueten Abend, or stay as Guten Abend? Is one Swiss and one High German?
Answer: Not really an answer since I'm by no means an expert, but I did find some relevant information. First, despite there being several YouTube channels purporting to teach "Swiss German", the German spoken in Switzerland is really a collection of related dialects. So not even a native Swiss would necessarily know all the variations possible in a simple expression. Wikipedia lists about two dozen main dialects and says there are many more sub-dialects within these groupings. The point is there is really no such thing as the Swiss-German word for something, you'd have to specify whether you're talking about Bern, Basel, Zürich or some other location. This video from the Easy German channel compares five different Swiss dialects.
I'm getting "Gueten Oobe" from a Speaksli channel video, and I mentioned it above because it seemed closest to what you were trying to spell out in the question. Note that the "gueten" is not a typo; the Swiss have a "ue" diphthong different from "ü" (not a diphthong). Apparently the Swiss tend to devoice their b's, d's, and g's a lot, even by German standards. Also, at least in the dialect the Speaksli channel covered, the "e" sound is very open. So "Oobe" sounds very much like "opa" to an English speaker. The Speaksli video uses native Swiss speakers, but it doesn't mention which dialect they're using, which seems very unhelpful. In the Easy German video one speaker, in St.-Galler-Deutsch uses "Guetä obig". Another, in Walliserdeutch, says "Güetn Abund". Another, in Berndeutsch, says "Guete Abe". A fourth speaker, in Churerdeutch, says "Guata obig". (One of the speakers doesn't say "good evening" in any dialect.)
Swiss German is primarily a spoken language; everyone learns Standard German in school so people are able to communicate with each other, and that's used as the written language. This means there is no standard spelling and everything is written phonetically. So not only do you have different dialects, you might see different spellings of the same word in a single dialect. It also means that it's difficult to find reference materials on Swiss German, so unless you happen to find a native of the region where a particular dialect is used, it will probably be difficult to get much information on it.
I'm wondering what inspired the question though. If you're planning a trip to Switzerland and attempting to learn Swiss German to prepare, then you should probably make sure to learn the correct dialect for the region you're visiting. I highly recommend the Easy German video to see what you're dealing with in terms of the differences between dialects. In any case, I think learning Standard German would be more useful; as I mentioned above, everyone in Switzerland learns Standard German in school and it's spoken in a large area of Central Europe, not just a single Canton.


How to calculate lift coefficient using pressure distribution?

Question:
Above is the image of the question I want to ask. Please clarify on how the pressure coefficients of the upper and lower surfaces of an airfoil can be used, also if there is a set equation to calculate this lift coefficient.
Comment: Maybe the discussion in this Q&A helps: [How are Cd and Cl calculated from Cp data?](https://aviation.stackexchange.com/questions/45904/how-are-cd-and-cl-calculated-from-cp-data)
Comment: The exact way to calculate was not provided. Just wanted to know how it would be calculated. @Bianfable
Comment: I have looked through that discussion, but I can't seem to use the Xfoil software @Bianfable
Answer: Pressure is defined as the force applied perpendicular to a surface divided by the surface's area.
In order to go from the pressure coefficient to the (aerodynamic) force coefficient, one simply have to multiply the former by the surface.
In this particular case this can even be done manually, taking into account that:

an airfoil is considered in the text; that means that we are dealing with a pure 2D body and therefore a wing area cannot be really defined; instead, we consider as our area only the length along the chord (i.e. we suppose that the wing possesses a unitary span);
the shape of the airfoil is not know; that means that also the direction perpendicular to it is not know; anyway as a first approximation we can consider that the surface of an generic airfoil is practically horizontal everywhere except close to the leading edge; therefore the relevant aerodynamic force is basically vertical everywhere and then it goes in the development of lift (except close to the leading edge, where it mostly goes in the development of drag; anyway we focus here only on lift).

With those two points in minds, the value of the lift coefficient becomes:
$C_l=\text{ sum of }(C^i_{p,low}-C^i_{p,upp})c^i$
where "$^i$" means the local i-th station along the chord, from 0 to 14 as given in the text. $c^i$ is the local "surface" (piece of chord) and can be approximated with the distance between two stations, that is 0.02 for the firsts 6 stations and 0.1 afterwards. As said, the value at chord=0 is not considered in the calculation of the lift since it contributes almost exclusively to the drag and therefore we start from 1:
$C_l=(0.54--1.35)\cdot0.02+(0.54--1.512)\cdot0.02+ ... +(0.1404--0.27)\cdot0.1=1.3$
For a standard NACA 2412 this corresponds to an $\alpha$ of some 10°.


Can the Spider catch the Fly?

Question: The spider and the fly are both on an infinite line and the spider is hungry. He can move twice as fast as the fly, however his vision is very bad (he can only see the fly when he is 1 meter or less from the fly) and he doesn't know where the fly starts. The fly can always see where the spider is and obviously will move so as not to be eaten. Can the spider catch the fly in finite time, no matter where the fly starts, or will he go hungry?
Comment: If the fly is infinitely far down the infinite line from the spider, he'll obviously move away from the spider, and the spider, who has no clue as to the fly's infinite whereabouts, can only guess which way to go, and if he does go infinitely towards the fly then they'll just keep going infinitely in the same direction at different speeds for eternity. I'd say the spider goes hungry.
Comment: @Rumpelstiltskin answers are not for comments, please. Additionally it seems you're making some assumptions which, while reasonable, are not confirmed by the OP - I've asked for confirmation in my first comment.
Comment: @NielIGuess If your comments are for a specific person, please add an @-sign right next to their username (such as @Rumpelstiltskin) to let them know the comment is for them.
Comment: Choosing direction at random and preserve it forever for the spider succeeds if direction is against the fly and not succeeds if it is away. So it is to prove or disapprove an existence of zig-zag spider's strategy of changing direction in some increasing consecutive distances.  Fly has a simple optimal strategy - always moving away from the spider. Intuitively it seems that spider can always decrease the distance to the fly enough to catch it.
Answer: Assumption (& simplification):

The spider and the fly starts at different finite points on an infinite 1-d axis.
Furthermore, assume the fly starts somewhere. Whether it's 10, 100 or 1000 it doesn't matter (but can't be $\aleph_0$). The spider starts at the origin (position zero).
Answer:

 By turning around after going N times the distance before its last turning, the spider can always catch the fly, as long as N > 3.

Example:

 With N = 4, the spider turns around at 1, -3, 13, -51, ...

Proof:

Obviously the optimal strategy for the fly is flee away from the spider, so this is assumed to be "always true".
Now that the spider goes twice as fast as the fly:

 Assume the first time (from start to first turn) the spider goes 1 meter, then we can construct a list of "turn positions" with the following formula:

 $$\begin{align} a_0 &= 0 \\ a_1 &= 1 \\ a_{i+1} - a_i &= -N(a_i - a_{i-1}) \end{align}$$

 Which solves into

 $$a_i = \cfrac{1 - (-N)^i}{N + 1}$$

 Meanwhile, the distance that the fly can go is:

 $$b_i = \frac{1}{2} \times \cfrac{N^i - 1}{N - 1}$$

 Since $1-(-N)^i$ and $N^i-1$ grows at the same speed, minus the sign for the difference in direction, we know that $a_i$ outruns $b_i$ as long as the following holds:

 $$\frac{1}{2} < \frac{N-1}{N+1}$$

 This proves the conclusion at the beginning.
Comment: You were faster, upvote for this, @iBug
Answer: Yes, the spider can always catch the fly.
First, observe a simpler case:

 Fly distance from the spider is known, direction not. Spider starts in one direction long enough to catch the fly if direction is right. If not caught, direction is wrong, change direction and catch the fly on the other direction.

Now, let the start distance to be unknown:

 Assume the distance is 2m (or any other $>1m$). Go into one direction just long enough to catch the fly if the direction is right and fly starting distance less than 2m. If not change direction and assume starting distance was twice as assumed in previous step. As starting distance is finite, in some step calculated distance will be larger than starting distance.
Comment: If I'm interpreting your answer literally (*starting distance was twice as*), it's the same as mine with N = 3, which is unfortunately on the edge of failure. In that case, the spider only goes as far as the fly (i.e. $a_i=b_i$), and has no extra distance to cover the initial distance.
Comment: This assumes that the fly stays stationary, which is not necessarily the case.
Comment: @iBug, not explained in details, on each step the   distance increase, which is finite and exactly determined of a fly is included. And when the initial distance + cumulative increase reached, there is at most two steps to catch the fly, as in a simplified case.
Comment: @iBug, you're right, my construction for sure needs an improvement, at least an adddition of distance increase from previous step to double distance. In fact, this is a nice and  theoreticaly interesting problem for math SE. With slightly different formulation,  maybe could lead to some kind of problem of convergence existence.

Can the Spider catch the Fly?


Warning about `$HTTP_RAW_POST_DATA` being deprecated

Question: I switched to PHP 5.6.0 and now I get the following warning everywhere:
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will
be removed in a future version. To avoid this warning set
'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream
instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0

Fine, I rely on some deprecated feature. Except that I don't!

I haven't ever used this variable in any of my scripts. To be honest I had no idea it even exists.
phpinfo() shows that I have always_populate_raw_post_data set to 0 (disabled). So what is going on?

I don't want to "avoid the warning" by setting this value to -1. This will just hide the warning, and I'll still have deprecated configuration. I want to solve the problem at its source and know why PHP thinks that HTTP_RAW_POST_DATA populating is turned on.
Comment: The same problem, but possible different cause/solution: http://stackoverflow.com/questions/25984623/errors-in-unknown-on-line-0-after-php-upgrade
Comment: This warning give me trouble when running PHP SoapServer's handle() on PHP >= 5.6.  This warning will always be outputed
in the response of SOAP, so that a SoapClient's __soapCall() will get "SoapFault exception: [Client] looks like we got no XML document"
exception.  So hard to debug because this warning normally won't show up.
Answer: It turns out that my understanding of the error message was wrong. I'd say it features very poor choice of words. Googling around shown me someone else misunderstood the message exactly like I did - see PHP bug #66763.
After totally unhelpful "This is the way the RMs wanted it to be." response to that bug by Mike, Tyrael explains that setting it to "-1" doesn't make just the warning to go away. It does the right thing, i.e. it completely disables populating the culprit variable. Turns out that having it set to 0 STILL populates data under some circumstances. Talk about bad design! To cite PHP RFC:

Change always_populate_raw_post_data INI setting to accept three values instead of two.

-1: The behavior of master; don't ever populate $GLOBALS[HTTP_RAW_POST_DATA]
0/off/whatever: BC behavior (populate if content-type is not registered or request method is other than POST)
1/on/yes/true: BC behavior (always populate $GLOBALS[HTTP_RAW_POST_DATA])

So yeah, setting it to -1 not only avoids the warning, like the message said, but it also finally disables populating this variable, which is what I wanted.
Comment: **tl;dr** this is a dumb warning that appears even if you don't use the thing it warns against; set _always_populate_raw_post_data_ to -1
Comment: i have set it `always_populate_raw_post_data = -1` . still now the warning coming and corrupting the json response
Comment: So the answer in effect is to go to your `php.ini` file and set (or uncomment) `always_populate_raw_post_data = -1`.
Comment: But I don't really get the point. That's **exactly** what the warning is saying? `To avoid this warning set
'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream
instead.`
Comment: @Andreas the point is the reason why it says that, i.e. the difference between 0, which is apparently "disabled", and -1, which is... "stronger disabled"? → confusion → reason for this question (and answer).
Comment: @rr-: Well, I agree that the "0 / -1" values on that setting were definitely a bad design decision back then. But the warning is apparently correct. The warning does not mention at any point that "0" means disabled? It clearly suggests to set the value to "-1".
Comment: Frustrating I'll say. I only started seeing this after deciding to call a PHP script via XMLHttpRequest using POST instead of GET, to avoid the data being displayed in the URL on my page. It worked fin in that the data comes through in the PHP, but now I get this warning filling my ERROR log, and setting  "always_populate_raw_post_data = -1" (or "always_populate_raw_post_data = on" as suggested in my PHP.INI comments) does nothing to remove the error. I guess I'll just have to go back to exclusively using GET. Any thoughts helpful. My PHP version is 5.6. Maybe I should try upgrading to 7.x
Answer: Been awhile until I came across this error. Put up my answer for anyone who may stumble upon this issue.
The error only means that you are sending an empty POST request. This error is commonly found on HTTPRequests with no parameters passed. To avoid this error, you can always add a parameter to the POST without changing the php.ini.
Like:
$.post(URL_HERE
    ,{addedvar : 'anycontent'}
    ,function(d){
       doAnyHere(d);
    }
    ,'json' //or 'html','text'
);

Comment: This is the best answer I have found for this issue!  I have been dealing with this problem off and on for a month and it had me looking in the wrong direction.  I simply had an empty POST on accident and once that was fixed everything worked great!  Thank you for saving me from a terrible headache!
Comment: This is a terrible solution. First, you are expecting that everyone is using jQuery, second, you are forcing a POST variable rather than dealing with the issue at hand.
Answer: I experienced the same issue on nginx server (DigitalOcean) - all I had to do is to log in as root and modify the file /etc/php5/fpm/php.ini.
To find the line with the always_populate_raw_post_data I first run grep:
grep -n 'always_populate_raw_post_data' php.ini

That returned the line 704
704:;always_populate_raw_post_data = -1

Then simply open php.ini on that line with vi editor:
vi +704 php.ini

Remove the semi colon to uncomment it and save the file :wq
Lastly reboot the server and the error went away.
Comment: If the line is commented out in your `php.ini` you are probably using a development configuration of php.ini.
Answer:
If you are using WAMP...

you should add or uncomment the property always_populate_raw_post_data in php.ini and set its value to -1. In my case php.ini is located in:
C:\wamp64\bin\php\php5.6.25\php.ini

..but if you are still getting the warning (as I was)
You should also set always_populate_raw_post_data = -1 in phpForApache.ini:
C:\wamp64\bin\php\php5.6.25\phpForApache.ini
If you can't find this file, open a browser window and go to:
http://localhost/?phpinfo=1
and look for the value of Loaded Configuration File key. In my case the php.ini used by WAMP is located in:
C:\wamp64\bin\apache\apache2.4.23\bin\php.ini (symlink to C:\wamp64\bin\php\php5.6.25\phpForApache.ini)

Finally restart WAMP (or click restart all services)
Answer: If the .htaccess file not avilable create it on root folder and past this line of code.
Put this in .htaccess file (tested working well for API)
<IfModule mod_php5.c>
    php_value always_populate_raw_post_data -1
</IfModule>

Comment: please explain My Lord
Answer: Uncommenting the
always_populate_raw_post_data = -1

in php.ini ( line# 703 ) and restarting APACHE services help me get rid from the message anyway
; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature and it will be removed in a future version.
; If post reading is disabled through enable_post_data_reading,
; $HTTP_RAW_POST_DATA is *NOT* populated.
; http://php.net/always-populate-raw-post-data
; always_populate_raw_post_data = -1

Answer: For anyone still strugling with this problem after changing the php.init as the accepted answer suggests. Since the error ocurs when an ajax petition is made via POST without any parameter all you have to do is change the send method to GET.
var xhr = $.ajax({
   url:  url,
   type: "GET",
   dataType: "html",
   timeout: 500,
});

Still an other option if you want to keep the method POST for any reason is to add an empty JSON object to the ajax petititon.
var xhr = $.ajax({
   url:  url,
   type: "POST",
   data: {name:'emtpy_petition_data', value: 'empty'}
   dataType: "html",
   timeout: 500,
});

Answer: I got this error message when sending data from a html form (Post method). All I had to do was change the encoding in the form from "text/plain" to "application/x-www-form-urlencoded" or "multipart/form-data".
The error message was very misleading.
Answer: Unfortunately, this answer here by @EatOng is not correct. After reading his answer I added a dummy variable to every AJAX request I was firing (even if some of them already had some fields) just to be sure the error never appears.
But just now I came across the same damn error from PHP. I double-confirmed that I had sent some POST data (some other fields too along with the dummy variable). PHP version 5.6.25, always_populate_raw_post_data value is set to 0.
Also, as I am sending a application/json request, PHP is not populating it to $_POST, rather I have to json_decode() the raw POST request body, accessible by php://input.
As the answer by @rr- cites,

0/off/whatever: BC behavior (populate if content-type is not registered or request method is other than POST).

Because the request method is for sure POST, I guess PHP didn't recognize/like my Content-Type: application/json request (again, why??).
OPTION 1:
Edit the php.ini file manually and set the culprit variable to -1, as many of the answers here suggest.
OPTION 2:
This is a PHP 5.6 bug. Upgrade PHP.
OPTION 3:
As @user9541305 answered here, changing the Content-Type of AJAX request to application/x-www-form-urlencoded or multipart/form-data will make PHP populate the $_POST from the POSTed body (because PHP likes/recognizes those content-type headers!?).
OPTION 4: LAST RESORT
Well, I did not want to change the Content-Type of AJAX, it would cause a lot of trouble for debugging. (Chrome DevTools nicely views the POSTed variables of JSON requests.)
I am developing this thing for a client and cannot ask them to use latest PHP, nor to edit the php.ini file. As a last resort, I will just check if it is set to 0 and if so, edit the php.ini file in my PHP script itself. Of course I will have to ask the user to restart apache. What a shame!
Here is a sample code:
<?php

if(ini_get('always_populate_raw_post_data') != '-1')
{
    // Get the path to php.ini file
    $iniFilePath = php_ini_loaded_file();

    // Get the php.ini file content
    $iniContent = file_get_contents($iniFilePath);

    // Un-comment (if commented) always_populate_raw_post_data line, and set its value to -1
    $iniContent = preg_replace('~^\s*;?\s*always_populate_raw_post_data\s*=\s*.*$~im', 'always_populate_raw_post_data = -1', $iniContent);

    // Write the content back to the php.ini file
    file_put_contents($iniFilePath, $iniContent);

    // Exit the php script here
    // Also, write some response here to notify the user and ask to restart Apache / WAMP / Whatever.
    exit;
}

Answer: N.B : IF YOU ARE USING PHPSTORM

I spent an hour trying to solve this problem, thinking that it was my php server problem, So i set 'always_populate_raw_post_data' to '-1' in php.ini and nothing worked.
Until i found out that using phpStorm built in server is what causing the problem as detailed in the answer here : Answer by LazyOne Here , So i thought about sharing it.
Answer: Well, if there's anyone out there on a shared hosting and with no access to php.ini file, you can set this line of code at the very top of your PHP files:
ini_set('always_populate_raw_post_data', -1);

Works more of the same. I hope it saves someone some debugging time :)
Answer: ; always_populate_raw_post_data = -1
in php.init
remove comment of this line ..
always_populate_raw_post_data = -1
Comment: could you explain?? why ? Also, format/indent your post properly.
Answer: I just got the solution to this problem from a friend.
he said: Add ob_start(); under your session code.
You can add exit(); under the header.
I tried it and it worked.
Hope this helps
This is for those on a rented Hosting sever who do not have access to php.init file.