Can I create connected apps programmatically?

Question: Is there a way to define connected apps w/o opening the UI? Has anyone already created apps like that? Any advice would be appreciated!!
Answer: Update: As of version 32 you can now supply your own ConsumerKey and ConsumerSecret when creating a Connected App.
You can use the Salesforce Metadata API to create a Connected App, it provides the ConnectedApp metadata type for this purpose. You can either use the File Based method or the CRUD method (preferable for programatic creation).

Represents a Connected App application. A connected app is an application that integrates with salesforce.com using APIs. Connected apps use standard SAML and OAuth protocols to authenticate, provide Single Sign-On, and provide tokens for use with Salesforce APIs. In addition to standard OAuth capabilities, connected apps allow administrators to set various security policies and have explicit control over who may use the applications. It extends the Metadata metadata type and inherits its fullName field.
ConnectedApp components have the suffix .connectedapp and are stored in the connectedapps folder.

This API is available in any language supporting HTTP callouts using Web Services (Salesforce provides a WSDL to consume in your client app). If your using a Java, there is a prebuilt client library available here. There is also an Apex wrapper around the API if your interested in doing this natively.
Comment: As of version 32 you can now supply your own ConsumerKey and ConsumerSecret when creating a Connected App.
Comment: I'm able to create apps now with code. There was a small mistake in my code so I kept getting errors the whole day. Now its working. Thank you once again.
Comment: Thank you so much Andrew. Is there any sample code that tells how I can use Metadata Types?? The code sample in that page uses soap Api. So I'm wondering if I can follow the same procedure. Thanks again!
Comment: Sure, what language are you using and i can advise accordingly.
Comment: Thank you. Right now I'm using Groovy / Java. My short term goal is to create a connected app (as automated as possible) in each and every new pod once it is added.
Comment: Awesome so please you got it working, i love the Metadata API! :-)
Comment: Yes. It's really good. If you don't mind I've one more question. Could you please tell me, how I can access SamlSsoConfig Object with Metadata API? Thanks.
Comment: Also can you tell me the way I can get consumer secret from a created app. I know it's a protected value but I need to get the value to finish this job.


What does 经起 actually mean?

Question: What does 经起 actually mean? Can you please give some sample sentences?
Comment: Can you share the context when you've heard of this term? The phrase doesn't ring any bell to me immediately so I suspect the character might not be the correct one
Answer: We don't see 经起 because it only works with one of the two potential particles --  得 (able to) and 不 (unable to)
经得起考验  = able to withstand test
经不起考验 = unable to withstand test
经得起风雨 = able to withstand hardship/ crisis
经不起风雨 = unable to withstand hardship/ crisis
from the examples above, we can deduct 经起 means withstand or stand against
However, we don't use 经起 alone without a potential particle
Example:
经(不)起考验时就惊惶失措 - Panic when (unable to) stand against a test

经(v): through; experience

起 (verb particle): up; begin to; upon

经(不/得) 起 --> (can/cannot) go through --> (can/cannot) withstand/ stand against
Comment: Agree and edited post
Comment: This kind of omission can not be accepted in Mandarin. I think this word is just an error.

What does 经起 actually mean?


Additional wire on light switch with no 3 way

Question: I recently changed my sons' bedroom light switch with Lutron smart dimmer. The house is fairly new and has not been remodeled. I have changed out about 3 other light switches without issue. This particular switch had an addition wire connected. I thought that maybe it was traveler so just didn't reconnect it when installing the smart switch. Turned on the power and the switch works well however, the receptacles (only in this room though the breaker runs 3 rooms) no longer work! What could this wire be? Thank you in advanced for your help.
Comment: Can you post photos of the inside of the switch box please?
Comment: I will try to add pictures tomorrow. Thank you again.
Comment: "An addtional wire connected" But where and how was it connected?
Answer: Without KNOWING how it was connected (which it's always good to document before you tear stuff apart, but too late for that) I'm going to GUESS that the outlets were getting their power by being joined to the unswitched hot feed to the switch.
Answer: It happens all the time where a device is used for a splice, and the splice is unrelated to the device.  So it seems inexplicable.
Let me pause and say the word "outlet" does not mean only receptacles, but any point-of-use including a light/switch combo.
As you certainly do know, there isn't a home run back to the panel for every outlet.  Most outlets also have power being chained forward to the next outlet.  Receptacles have extra screws just for this purpose (actually for dual purpose, but this is one of them).
In a switch, you have neutral coming from supply and carried onward both to the lamp and to the next outlet.  An old style switch doesn't need neutral, so this 3-wire splice happens in the back of the box at a wire nut.
In a switch, you have always-hot coming from supply and carried onward both to the switch and to the next outlet.  That's 2 wires + the switch.   You can do that with a pigtail from the switch combining with the 2 wires (making 3 wires, almost exactly like above).  However some installers just put the other 2 wires on the switch itself, using the switch as an ad-hoc splice also.
I recommend converting all such setups to the pigtail arrangement.  First, it's easier to understand.  Second, most smart switches have pigtails, so you'll have to do it anyway.  And third, switches aren't intended to be splice points, but they have both screw and backstab. This splice trick typically uses the backstab, and backstabs cause nothing but problems - mostly open connections (and they're extra hard to find when they're at a switch), but also arcing, meltdown and fires.
Comment: I tried to add pictures but too big. I believe that Harper might be correct if I am understanding, I'm an engineer and know nothing about electrical wiring. Thought this would be an easy upgrade. I kept the original switch. It has the pos. and neg going into the back of the switch then an additional wire connected to the copper screw on the side. I am assuming that I need to tie two wires going into the existing and then tie that int the switch? Thank you guys for your help with this!


Motivation for gamma distribution with a non-integer parameter

Question: The Erlang distribution has a straightforward interpretation in terms of waiting time for the occurrence of a predefined number of events in a Poisson process or a sum of a predefined number of exponential random variables. The gamma distribution is more general since it allows for a non-integer parameter, but it is usually given the same motivation. I know that this question was raised several times but I have not seen a satisfying answer so I will venture to pose it again: what is the canonical or at least a prototypical example of a random process that gives rise to some Gamma distributed random variable, which is not at the same time an Erlang random variable?
Comment: For one example ... what about sums of squares of deviation from the mean of iid normal variates? ....
Comment: What exactly do you take a "random process" to be, then?  We can readily translate @Glen's comment into a standard random process framework.  For instance, a random walk on the natural numbers, starting at $0$, having independent increments that are distributed as the square of a standard Normal distribution, will exhibit marginal Gamma distributions that are half-integers.
Comment: @Glen_b, this is a pertinent example, but it is seems to have more to do with hypothesis testing than with random processes per se. This is to say that, in my rather limited experience, in the applied literature, authors usually do not make an assumption that they are dealing with sums of normals, but rather assume that there is some underlying exponential distribution(s).
Comment: @whuber, I meant random processes that can approximate real-world scenarios.
Comment: In what sense, then, do you conceive that hypothesis testing is not a "real-world scenario"??
Answer: It seems you are asking for "real-life" examples where gamma distributions are used to model some real-world observables represented by random variables. There are many such examples. Take the Erlang distribution you mention first: The integer parameter case follows from some theoretical probability model for waiting times, but for modelling directly real-world waiting times, the gamma family with non-integer parameter will give better flexibility. Some other examples can be found here: Real-life examples of common distributions
Gamma distributions can model positive random variables, precipitation insurance (A quote from that paper Climatologists prefer the gamma distribution because it is sufficiently flexible to adequately characterize cumulative precipitation over time periods of varying length and link to a freely accessible version).
Other insurance use of gamma regression, in hydrology for modeling rainfall or floods, ... Inventory control use of the Gamma distribution, quote from that paper:  In the field of inventory control of finished goods we find that the observed frequency distributions of demand have the following general characteristics:

they exist only for non-negative values of demand
as the mean demand of items increases the observed distributions change
from:
(a) monotonic decreasing to
(b) unimodal distributions heavily skewed to the right, and finally to
(c) normal type distributions (truncated at zero)

... and they then observe that the Gamma family of distributions matches nicely this qualitative behavior. This is an important point in modeling, we are not only interested in how a certain individual distribution matches a particular dataset, we are interested in the general behavior of a family of distributions.
The classic McCullagh/Nelder chapter 8 "Models for data with constant coefficient of variation" mostly uses the gamma distribution, gamma regression.
Answer: Given a radioactive sample with unknown emission rate $\lambda$, the likelihood on $\lambda$ induced by observations of emissions is gamma distributed.
Given a normal process with known mean, but unknown precision, the induced likelihood on the precision is gamma distributed.
And similarly for Pareto and gamma models.


First usage of "get a handle on it"

Question: I'm editing a manuscript that uses the phrase "get a handle on it". The action is taking place in the late 19th century, and this usage seems somewhat anachronistic to me. However, I can't locate anything to back up this feeling. Does anyone know when this phrase was first used? (Even better would be knowing when its use was in vogue.)
Comment: @Kris - Certainly this is possible. And someone in the 19th century could also have invented the phrase "cowabunga, dude" as well. YMMV, but I find that even when each individual item (like this) isn't all that important on its own, checking many details like this can, in aggregate, add an additional sheen of authenticity. Similarly, failing to do this can make the reader do a little more work to believe in the story's background. And making things hard for readers is almost never advisable.
Comment: My wife is an editor and she has driven more than one author to distraction by finding one anachronism after another. The good authors know she is helping them, but some of the wannabes complain quite loudly.
Comment: Even assuming it was already used in the 19th century, how would we know if the author was aware of it? It could be his independent invention ('first use')?
Comment: @PeterRowell - She should probably never work on alternate history or steampunk, then. :)
Comment: It's not even a question of whether something is genuinely anachronistic. If the reader thinks it's anachronistic or a bit odd, and it takes the reader out of the story for a moment, then it's bad. (Although particularly in fantastic genres this rule may be relaxed; and there must be a cut-off because you wouldn't write a novel set in medieval England in genuine middle English.)
Answer: An instance appears in a 1902 college magazine, found among 1500-1978 links at ngrams for get a handle on it,get a handle.  Obviously it's a phrase not often found in books of that vintage, but ngrams says nothing about its frequency in spoken language.
A 1938 magazine article apparently uses the phrase too.
Comment: Interesting, I thought this phrase came about no earlier than the 1950's. This is helpful!
Answer: Under its entry for handle, the OED defines to get a handle on, as 'to gain control over . . . to acquire the means of understanding or of forming an opinion about' and the earliest citation in support is as late as 1972 from the 'New Yorker':

Scribner . . . said to me, 'I don't think people have any idea of how
  tough it is for anyone in this job to get a handle on anything.'

However, under the entry for get, there is this citation from Charles Kingsley's 'Hereward', published in 1865:

Driving them mad and desperate just that you may get a handle against
  them.

That doesn't seem to have quite the same meaning as the 'New Yorker' citation, but if you're looking for first use . . .
Comment: It's not the same meaning, but it's similar enough to be relevant to the passage in the manuscript I'm working on. Thanks!
Answer: Found this late 19th century use of the phrase that I think matches its more contemporary use. This is from an 1874 issue of The Atlantic Monthly:
Answer: When did 'get a handle on' become a popular idiom
For a sense of how recently the expression "get a handle on" became popular, consider this Ngram chart for the phrase for the period 1860–2005:

As you can see, isolated blips occur from the 1870s onward (though many of these are false positives generated by date errors), but sustained occurrences year in and year out begin only in 1957—and the idiom's rise from near-baseline frequency begins in earnest about a decade later. On the strength of this record, I would not be inclined to view "get a handle on [something]" as a common U.S. idiom until the late 1960s at the earliest.

Google Books search results for the idiom
I ran several Google Books searches covering the period 1800–2008. The earliest authenticated match that turned up in those searches was from Navy Department Bureau of Supplies and Accounts (1954) [combined snippets]:

How do you get a handle on either of these problems, both of which are inventory management problems? Determining what items should be put on a new base or a special purpose support ship, or what should go with a special movement forward, represents a possible third problem. It is submitted that summary reports based upon fraction information will give you a management lead to solution of these problems or at least to further more definitive questioning.

From Joint Committee on Atomic Energy, Development, Growth, and State of the Atomic Energy Industry: Hearings (February 19, 20, 21, 25, 26, 27, 28, and March 5, 1957) [combined snippets]:

Mr. FIELDS. The prices on the uranium 235 enriched varies with the enrichment. So you have a schedule of prices, and this has been published. To get a handle on it, it is $16, approximately, per gram for uranium enriched to 20 percent, that is, in uranium 235.

Next, from American Society of Newspaper Editors, Problems of Journalism: Proceedings of the Convention (April 21, 22, 23, 1960) [combined snippets]:

By measuring the insolation on a worldwide basis, one can probably get a handle on long-range weather prediction or gross weather prediction. It will take some time before it will really be possible for a satellite like this to predict weather. It will be used at first, and probably for some long time, as just an adjunct to the methods we now use. It will eventually revolutionize the prediction of weather, but it will take some time before that happens. For instance, the sorts of things it can't do, which are nevertheless important for predicting the weather, are things like measuring pressure, measuring rainfall, measuring the actual wind direction at various altitudes and so on. These are very important in meteorology. The satellite can't do them. What the satellite can do, though is get clouds and get them on a completely worldwide basis where otherwise there is no weather information.

On the strength of these three earliest matches, I surmise that the modern sense of "get a handle on" arose in the 1950s as U.S. bureaucratic slang meaning (as it still does today) "make sense of, grasp, or come to grips with."

Earlier instances cited in other answers
There remains, of course, the problem of what to make of much earlier instances of "get a handle on" cited in other answers to this question. My approach is simply to look at them individually and in context and see whether any of them can reasonably be viewed as likely progenitors of the idiom "get a handle on" that emerged in the 1950s.
In their answers, Callithumpian and jwpat7 find instances from 1874, 1902, and 1938. Let's look at each of these in turn.
From Constance Woolson, "The Lady of Little Fishing," in The Atlantic Monthly (September 1874):

There was a man among us—I have not said much of the individual characters of our party, but this man was one of the least esteemed, or rather liked; there was not much esteem of any kind at Little Fishing. Little was known about him; although the youngest man in the camp, he was a mooning, brooding creature, with brown hair and eyes and a melancholy face. He wasn't hearty and whole-souled, and yet he wasn't an out and out rascal; he wasn't a leader, and yet he wasn't a follower either. He wouldn't be; he was like a third horse, always. There was no goodness about him; don't go to fancying that that was the reason the men did not like him, he was as bad as they were, every inch! He never shirked his work, and they couldn't get a handle on him anywhere; but he was just — unpopular. The why and the wherefore are of no consequence now. Well, do you know what was the suspicion that hovered over the camp? It was this: our Lady loved that man!

Superficially, this instance looks like a match in sense for "get a handle on" as it is used today. But on closer examination, the sense of "get a handle on" here seems to be closer to "find something distinctly blameworthy about."
From "A Fantasy of Old Egypt" in The Mount Holyoke (December 1901):

"Halliwell! Aw, I say, Dick Halliwell, wake up!" A tall young Englishman with a trace of excitement in his drawling tones slapped the dreamer heartily on the back. "We're on the track of a find, dontcherknow. This morning got hold of one of the lying imps sent by the Khedive to thrash the ground for a new tomb last time he wanted one on hand for visitors—found something along by Deir-el-Bahari, you know. Aw, yes, kept secret, but, but, I say, they've smuggled more of the old chaps into Cairo in the last day or so than I've seen before for a year. Must have made quite a haul of their mustinesses. Struck some new tombs, a royal among them, I fancy. Thought I'd try to get a handle on it for you, dontcherknow, Halliwell."

Here "get a handle on" seems to mean "set something up [for someone]," although, again, the first impression you may have is that it means "get a sense of [something]," as the modern idiom sometimes does.
From Albert Maltz, "Rehearsal," in One Act Play Magazine (March 1938) [combined snippets]:

VERA: (Taking a deep breath.) I love you, Chris. (A pause.)
CHRIS: You never said that.
VERA: You never said it to me. I'm telling you now because I think I'd better. ... Does it make any difference?
CHRIS: I don't know.
VERA: Oh!!
(Silence ... Chris thrusts his hands into his pockets. His face is tight and unhappy. Vera regards him impassively.)
VERA: I wish you'd tell me what you have to say.
CHRIS: (In a low voice.) I'm going to ... I'm sorry as hell. I don't feel like hurting you. I don't even know my own mind.
VERA: You won't hurt me.
CHRIS: (Louder.) Sure I will. That's the trouble. I'll hurt you and you won't show it. Look at you: Not a ripple on your face. Like nothing was going on inside. I suppose nothing is?
VERA: You want a Joan Crawford? You want me to make unhappy faces and cry for you?
CHRIS: Why not? What's wrong with a woman crying?
VERA: I never cry!
CHRIS: And God damn it, that's the trouble with you.
VERA: Chris—you're not still mad because I came late?
CHRIS: God, no, I'm not thinking about that. I wish I was.
VERA: Will you tell me?
CHRIS: I'm trying to. I can't get a handle on it. (He pauses.) Oh—the hell with it!

The meaning of the phrase here is extremely close to the modern sense of "get a handle on [something]"; it means essentially "figure [something] out or put [something] into words." The question is whether any (or perhaps all three) of these three antecedents is actually a lineal predecessor of "get a handle on" as used today. The strongest argument in favor of them is that they don't seem terribly different in meaning, especially the 1938 instance. The main countervailing problem is that the record seems so spotty: three instances (each with a somewhat different meaning) spread across 64 years, and then another 16-year gap before the unmistakable modern idiom begins its ascent in popular usage.

What the dictionaries say
A number of major slang and idiom dictionaries that focus on U.S. usage—the four editions of John Barlett's Dictionary of Americanisms (1848–1877), the two editions of Barrère & Leland's Dictionary of Slang, Jargon & Cant (1889–1897), James Maitland's American Slang Dictionary (1891), Farmer & Henley's exhaustive seven-volume Slang and Its Analogues (1890–1904), Mitford Mathews's massive Dictionary of Americanisms on Historical Principles (1951), and the two editions of Wentworth & Flexner's Dictionary of American Slang (1960 & 1967)—from the period 1848–1967 don't mention "get a handle on" at all.
It is extremely difficult to square the silence of these resources with the notion that the idiomatic use of "get a handle on" was widespread during that time period. And when slang and idiom dictionaries do begin to take note of the phrase, they don't view it as being particularly old. From Paul Beale, Partridge's Concise Dictionary of Slang and Unconventional English (1989):

handle, n. ... 2. In have a handle on (something), to have it under control, to understand it, as in 'The police have a handle on the mob problem': Can.: since mid-C.20.

From Robert Chapman & Barbara Kipfer, Dictionary of American Slang, third edition (1995):

get a handle on someone v phr by 1972 To begin to understand someone; have a clue as to someone's character, behavior, etc.: That's right. I can't get a handle on on him.—Lawrence Sanders

Notice how different the sense of "get a handle on someone" is here (where it means begin to understand someone or have a clue about the person's character or behavior) and in Woolson's 1874 short story (where the narrator tells us that no one had any doubt bout the young man's character and shortcomings but that nevertheless people couldn't "get a handle on him anywhere").
From J.E. Lighter, Random House Dictionary of Historical Slang (1997):

handle n. ... 5. a firm grip, as on a fielded ball; (also) a way of managing or understanding.—usu. in negative constrs.; in phr. get a handle! calm down! get ahold of yourself! Now colloq. [First cited occurrence:] 1961 Ellison Memos 92: He was the weakest, most vulnerable kid I'd ever seen. He couldn't get a handle on life.

And from Christine Ammer, The Facts on File Dictionary of Clichés, second edition (2006):

get a handle on something, to To succeed in dealing with a difficult problem. Dating from the mid-twentieth century, this slangy Americanism alludes to coping with a cumbersome object by attaching a handle to it. However, "handle" has been used both figuratively and literally in several ways for many years. "Most things have two Handles; and a wise Man takes hold of the best," wrote Thomas Fuller in his Gnomologia (1732). Further, "handle" has been a colloquialism for a title, and by extension a name, since about 1800. The current saying, on its way to becoming a cliché, thus can allude either to getting a secure hold on a slippery problem, or to identifying it correctly by naming it. A synonym for the former sense is get a grip on something, meaning to take a firm hold on it.

Conclusions
Recent slang and usage dictionaries agree that "get a handle on [something]" emerged as an idiom in its modern sense between roughly 1950 and 1972.
The three much earlier instances of the phrase (from 1874, 1902, and 1938) pointed out in other answers to this question are very intriguing. It is possible that they reflect three generations of underground or highly localized usage of "get a handle on" leading to the emergence of today's popular idiom. Or they may be coincidental occurrences arrived at independently and doomed to serial extinction. The truth is difficult to discern.
But what seems unmistakable from the shape of the Ngram chart above and from the silence of slang and usage dictionaries between 1848 and 1989 is that "get a handle on" was not by any measure a widespread idiom in the nineteenth century, and that using it in historical fiction as though it had been a popular idiom then is in all likelihood an exercise in anachronism.
Answer: All these answers seem very well researched and thought out. I'd just like to throw in a theory of sorts as to its origin.
As a wood carver, knives are forged with a small tip of metal beneath the blade. To use it this way would be unwieldy, and unmanageable. To "handle" the tool is to create a wooden (or other material) object that can be easily gripped so the blade can be set within it, thus making the blade safer, easier, and more manageable to use.
Again, don't have any date, but the process of "handling" tools to make them easy to hold and use has been in practice for centuries. I imagine the turn of phrase in transference to people managing a task has been around for some time, certainly before the 1900s.

First usage of "get a handle on it"


Using References module, is it possible to only show nodes created by the logged in user in select list?

Question: I made a node reference field and it gives me a select list of all the nodes of a specific content type. However I only want the select list to show the nodes made by the logged in user. Is there any way to set conditions some way?
Comment: Wasn't a node reference 6 module? Why not Entity reference?
Comment: I'm sorry, I meant the references module

https://drupal.org/project/references
Comment: No problem, just wanted to clarify.
Comment: You should check the permission for that content type to allow:"View own content"
Answer: You can try making a views which return the list of all node title created by the user & then use View reference module to have field calling that.


Save Unity Desktop Session

Question: Is there a way to save current session (the applications + the organization of windows in desktops) in Unity and load it when needed?
Answer: I have made a workaround that is a script that helps to configure your session.
Download it here.
Make it executable and run from terminal ./session.config
You can view the code of script ( https://www.dropbox.com/s/w1btmead93q6hze/session.config?dl=0 ), there are explanations in each part. It will create a startup script which will move to each viewport and open the specified application.
Also you can run it whenever you want just press Alt + F2 and paste ~/.sessionconf.
Removing
To remove any changes made by my script just delete this files:

~/session.config
~/sessionconf
~/sessionconf.bak
~/.config/autostart/sessionconf.desktop

Or run this at terminal:
rm ~/session.config ; rm ~/sessionconf ; rm ~/sessionconf.bak ; rm ~/.config/autostart/sessionconf.desktop

Comment: The link is a 404 now. Can you paste the contents here? And update the link if possible? Thanks!
Comment: @TylerCollier the Dropbox download link still works for me (May 2018). If you are not logged into dropbox.com close the registration window that pops up then use the download link. Dropbox does not allow previewing files ending with the .config extension.
Comment: @frederickjh Not sure if the link was fixed or perhaps I was just wrong before, but it works now, thanks for letting me know!
Answer: You can do this: killall gnome-session. As we know that entering the command sudo gnome-session-save --logout will log out the system. This will save the current session on Unity. I  have tried this.
Or may be you can read about how to make a program auto-start everytime you log in.
Or you can try this gconf-editor key:
/apps/gnome-session/options/auto_save_session = true

Comment: What is `gnome-session-save`? I get "command not found". And I can't find it in repository. "Unable to locate package gnome-session-save".
Answer: No - as you've described it is not currently possible on Ubuntu versions 11.04 and up.
You may read this bug report, comment 24 in particular
https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/771896
or here is a more complete explanation (too long to copy here)?
https://lists.ubuntu.com/archives/ubuntu-desktop/2011-January/002734.html
Answer: This script works great for me on Xubuntu. It's more or less desktop-agnostic and in theory should also support Unity. From the original blog post by Arnon Weinberg:

GNOME session save and restore
This script is used to save and restore a desktop session.
Why this script?
Some desktop managers do offer some session management features.
  Under GNOME it may be possible to run gnome-session-properties manually and turn on "Automatically remember running applications when logging out".
  However, some GNOME implementations (notably Ubuntu's) appear to be deemphasizing or deprecating this feature in favour of the Suspend or Hibernate feature.
Both the automated session save and suspend feature however are limited to saving/restoring sessions only on clean logout/login.
I use this script because sometimes I just need to reboot, and sometimes I like to restore my session to a previous state.
How to use:
Download the script, place it on your PATH, and be sure to give it executable permissions.
To save the current session:
session save

To restore the saved session:
session restore

Installation on Ubuntu
The installation instructions provided in the blog post are valid for Fedora. On Ubuntu you will have to install the following dependencies:
sudo apt-get install perl wmctrl xdotool x11-utils

Please make sure to check out the 'Details' section of the original blog post to find out more about the different session restore levels.

Update: another user reported that the script only worked with the first line being #!/usr/bin/perl instead of #!/bin/perl.
Answer: dconf write /org/gnome/gnome-session/auto-save-session true

Should enable this for you.
Comment: Not working on 14.04 :(
Comment: I also cannot get it to work on 14.04. The property is changed correctly, but nothing gets restored. Do you know where the session data is stored? That way I could find out if it's actually being saved.
Answer: I wrote a little library/command line tool which allow saving and restoring sessions and has support for different monitors setups as well as virtual desktops.
Installation
npm install -g linux-window-session-manager

Usage
Save the current session to ~/.lwsm/sessionData/DEFAULT.json
lwsm save

Save the current session to ~/.lwsm/sessionData/my-session.json
lwsm save my-session

Restore the session from ~/.lwsm/sessionData/DEFAULT.json
lwsm restore

Restore the session from ~/.lwsm/sessionData/my-session.json
lwsm restore my-session

Gracefully close all running apps before starting the session
lwsm restore --closeAllOpenWindows

Check it out: https://github.com/johannesjo/linux-window-session-manager

Save Unity Desktop Session


How many pages make a chapter in a chapter book?

Question: I am writing my first chapter books for an older audience around 18+ and I need a little help with knowing when one characters point of view should end and the next begin. Can anyone help me?
Comment: Can you please clarify what "chapter books for an older audience" you have in mind, and maybe provide an example? In chapter books for children, chapter length should be adequate to child's attention span, but for adults, do you have some other limitations in mind?
Comment: Open any YA book, and count. First hand experiments are the best way to get a grip on the factual things of writing.
Comment: I would say (1) each chapter should be a mini arc either ending on a cliff hanger or a resolution. (2) In my experience many people prefer less than 3000 words per chapter. (3) Mine range from 1900 to 5300 and the longer chapters are hard for people to get through. (4) It seems people like the breaks at chapter breaks. Both of the current answers imply 1 chapter = 1 scene which I am personally trying to figure out.
Answer: If I understand the question correctly, we are being asked when POV should switch, and this question also assumes that POV will switch at chapter breaks.
Typically, POV should switch when a scene ends, and the subsequent scene would feature a problem that will have greater stakes for a different POV character. POV is usually best served to the character who has the most to lose in a scene, and so when the greatest burden of the stakes shifts from one POV character to another, then so should the POV.
As for chapter breaks, well, that's largely a matter of opinion. Something to keep in mind, however, is that a chapter break can serve an author well when there is a hook that will draw the reader on to the next chapter. Breaking a chapter after a peak of activity or tension may draw the reader on in an effort to find out what happened next.
Answer: The number of pages is as many as are needed. As Bryan shows, a chapter can be as short as a word, or a sentence. it can be very long.
In general, most chapters are a continuous narrative (a combination of exposition and dialogue) of sequential action. It could be exposition that covers the highlights of a thousand years, or it could cover a single conversation with a stranger in a parking lot.
The chapter ends when you need to "shift gears", a break to something else, when you can't write any more useful things for the reader to have in THIS narrative, and you wish to start another.
For example, the chapter ends when they board the train, there is zero plot development or character development you wish to do on the train, nothing you want to reveal in dialogue, no scenery worth describing that helps with the plot or foreshadowing or anything else, so the chapter ends. The trip is uneventful in the literal sense. The next chapter begins, "They finally found the Knightsmark hotel in Tragerton, where ...".
(IMO) Your writing should always be concise and not wander into sideshows much; everything I write is to advance something about the plot or characters. So I do not write about spans of time in which nothing advances, like when my main character is asleep, or traveling alone, etc.
Such spans of time are generally good times to break the chapter, and/or POV. Readers may not exactly be expecting a chapter break to cover a large span of time, but they are at least accustomed to that happening, and the next chapter beginning "[some_time_span] later, ...", whether that is minutes, days, weeks, months, years, a lifetime, whatever. One chapter ends with a baby being born. The next begins "John grew into athletic young man, unfortunately already balding at twenty-five."
The time span is certainly not necessary, just a POV change is fine. "While Allen was doing that, Bill was still puzzling on how to get into the safe."
You change when the setting changes, the POV changes, or uneventful time needs to elapse.
Do not cut or add words to try and reach some "good length".
Answer: I found an interesting Blog post on this.
https://blog.reedsy.com/how-long-should-a-chapter-be/
Based on their review of different books, the average word count is between 3000 and 4000 words. That being said, it's up to you. As long as you have covered everything it makes sense to cover in that chapter, then you are done.
For the fun of it, I looked to see what the shortest chapters in books are. I found this lovely gem out there.
https://www.shortlist.com/entertainment/the-20-shortest-chapters-in-literature/99631
Answer: Forgive me for nitpicking, but I can understand anything in this.
18+ could mean 75 years old, and you don't write the same way for that age group as you would a 18-35 year old target audience.
That aside, there is no hard and fast rule. Sure, there are guidelines. One such guideline states that each scene should be roughly 3500 words. But adhering too strictly to that gives you problems.
Let's say you're in a pivotal scene, and you're now at 4500 words? Do you break off the scene? Start off in the next chapter? Why is "1 scene = 1 chapter" a rule?
Truth is, it isn't. And how long or how short each scene is depends on what you want to show.
And example from Arch Angel's Shadow (by Nalini Singh). One chapter was ten pages long (roughly 5000 words). Another was a single page (rought 500 words). Why? The shorter chapter was describing the antagonist, vaguely showing they were waiting, waiting for the right moment. That the victim was already growing weak, her skin thin as paper and almost see-through.
Those 500 words hit you. Hard. You get a sense of urgency, a sense that it might already be too late. That it probably is too late. Another victim is going to die, and you don't want that for her.
In those 500 words, Singh achieved what she wanted to. Why drag it out? End the chapter, end the scene, move on. And leave your reader with that ball of worries in the pit of their stomach. If that is your goal, never offer a word more than what you need to achieve it.
Answer: 15 pages per chapter, is my answer. You can do your own thing though.
Also, next time you write a question, you should be slightly more specific. Like other comments pointed out, you should specify what age. You said 18+, but that could be 19 or 92. You write differently for those two ages.
I'm very late, but this might help other people who come to this question.
Comment: Only the first two sentences of this post actually answer the question. The rest should be a comment rather than an answer. Also can be you provide some support for *why* that is your answer? How did you arrive at 15? is this a rule or a guideline? single line answers aren't the most useful. Please take the [tour] and visit the [help] to learn about how things work around here.


My wine is gone!

Question: I am on ubuntu 14.04 LTS 64 bits
I was trying to Install an older stand alone version of flash player so i searched forums and someone suggested i ran this command..
<code>~$ sudo apt-get install libgtk2.0-0:i386 libnss3-1d:i386 libnspr4-0d:i386 lib32nss-mdns libxml2:i386 libxslt1.1:i386
</code>
Then i searched elsewhere and i relaized that 32 bit libs are no good for 64 bits system so what i did was to  run this command ...
<code>~$ sudo apt-get remove libgtk2.0-0:i386 libnss3-1d:i386 libnspr4-0d:i386 lib32nss-mdns libxml2:i386 libxslt1.1:i386
</code>
Sad thing is after i done that not only i lost my Skype but my wine is gone too and now that i'm trying to install wine from software centre after i click on install first software centre gets unresponding and so slow and a a message pops up saying downloading packages from nontrusted sources and such...
However i somehow fixed that but now some of my apps are misbeaving.
My question is how do i restore my system to what it was before i added those lib files?
Thank you
Comment: Install them again?
Answer: Assuming you are using Unity, in a terminal run:
<code>sudo dpkg --add-architecture i386 && sudo add-apt-repository ppa:wine/wine-builds && sudo apt-get update && sudo apt install --install-recommends winehq-staging ubuntu-minimal ubuntu-standard ubuntu-desktop
</code>

My wine is gone!


If ShriKrishna knew Karna and Arjuna are brothers, why did not he stop their fight?

Question: ShriVishnu knows everything, yet He lets Pandavas and Karna be at fight. Moreover, Karna, born to ShriSurya, the Illuminator of whole Universe, had to suffer worse than the most unfortunate mortal.
Comment: yes, in Kali Yuga, chanting name of God removes sins. But Karna lived in Dvarapa Yuga :)
Comment: @AnuragSingh If God's Name is chanted with Faith,surrender and without offense it delivers a person even from most abominable sin.
Comment: Everybody suffers for their past misdeeds. God does not interfere in that matter. You do good you get good. You do bad you get bad. Simple!
Comment: @Vishalprabhulawande then why is it said- Chant name of God, it is sin remover. Even in devi bhagwat it is said- if one kills all beings, and then even chants the name of Devi once, he will not be attached to any sin.
Comment: In Hinduism Gods like Vishnu, Shiva, Brahma are roles. They have to do their duty and do not have power over the Brahman which creates worlds for its selfish desire to grow. Contrary to the Indian thought of omnipotent Vishnu or Shiva could have stopped the war but didn't, they could not have stopped the war even if they wanted to.
Comment: Possible duplicate of [Why did Karna choose not to fight on the side of the Dharma?](https://hinduism.stackexchange.com/questions/11797/why-did-karna-choose-not-to-fight-on-the-side-of-the-dharma) Krishna did persuade Karma to fight for PAndava-s. But Karma declined due to obligations towards Duryodhana.
Answer: Krishna tried to.
Sama, Dana, Bheda, Danda - neeti - are the 4 types of bringing about reconciliation between two enemies, to be followed in that order preferably.
When Duryodhana said he wouldn't return Pandavas kingdom after 13 years as per agreement during Dice game, Pandavas send Krishna as messenger to Kauravas to talk samadhaan (diplomatic dialogue). When Duryodhana refuses, Krishna asks him to gift (Dana) 5 cities, or 5 villages, or 5 houses, or at least a house with 5 rooms. He still refuses.
Now, Krishna knows Duryodhana is ready to go to war because he feels he can rely on Karna as his biggest strength/weapon. So, Krishna goes to Karna, tells him the true story of his birth, that his mother is Kunti, and Pandavas are his younger brothers, and asks him to join his side (Bheda)
Karna however says he is 'indebted' to Duryodhana since he gave him Anga desh as gift during Pandavas 'graduation' ceremony where Karna was insulted that he could not participate in Dhanur Vidya exhibition/competition, as he was charioteer's son.
So, he refuses to join Pandavas' side.
So finally, Krishna takes up punishment (Danda), and orchestrates Kurukshetra war.
Also, just because two people are brothers does not mean they should not fight if one of them is doing Adharma. In previous Avatara, Shri Rama showed this twice - Vali vs. Sugriva, Vibhishana vs. Ravana. He didn't tell Sugrive that he should not fight with his brother Vali, or Visbhishana that he should not fight with his brother, Ravana.. because Rama always takes side of Dharma, irrespective of being one's brother or any other relation.
We all have free will.
God can show us the path, but if we refuse to walk the path, he won't force us to.
Answer: Sri Krishna's main task was total annihilation of the Kshatriya race that was predestined towards the end of Dwapara and beginning of Kaliyuga. Kshatriya race wielded so much power that Krishna did not want to leave them to misuse that power in kalyuga. The later Kshatriays were conceived with brahmana men and Kshatriya women and were not as powerful as the ones that were annihilated.
In Stree Parva of Mahabharata of Veda Vyasa, Gandhari is distraught after viewing the dead bodies in Kurukshetra after the battle. In anger and grief over the death of her sons and the Kaurava soldiers, Gandhari curses Krishna with the death of all Yadavas in a manner similar to the death of her sons. She blames Krishna for his inaction and believes that he could have prevented the war and the slaughter of hundreds of millions people who died in the war.
Krishna's answer is interesting.
This is from Mahabharata, Book 11, Stree Vilapa Parva, Section 25 (translation by Kisari Mohan Ganguli):
 "Hearing these words, the high-souled Vasudeva, addressing the venerable Gandhari, said unto her these words, with a faint smile, 'There is none in the world, save myself, that is capable of exterminating the Vrishnis. I know this well. I am endeavouring to bring it about. In uttering this curse, O thou of excellent vows, thou hast aided me in the accomplishment of that task. The Vrishnis are incapable of being slain by others, be they human beings or gods or Danavas. The Yadavas, therefore shall fall by one another's hand.' After he of Dasharha's race had said these words, the Pandavas became stupefied.
Comment: Welcome to Hinduism.SE. You should cite sources to back your answer. There were many Kshatrya remaining after the annihilation you are talking about. Parikshita was one of them.


Kenyan Business Visa

Question: I've been doing a lot of research on how to get a business visa for Kenya, but keep getting so many conflicting answers. I'm a US citizen and need to register a business in Kenya as the owner. What I'm most concerned about is the revenue requirement that I must show that we have 100k in a bank account. We're a very early stage startup and very bootstrapped, nowhere near 100k in the bank. Also do I have to register as a LLC or LLP?
Answer: What you describe requires business registration and The Embassy of the Republic of Kenya
US website has a step-by-step guide:
>

i.      Steps
  Fill the Investment Application Form.
  Engage legal advice in Kenya.
  Register Your business
  Submit Application Form + Certificate of Incorporation + Articles and memorandum of association to KenInvest
  Issue of The Investment License
ii.       Procedures for establishing a company in Kenya
  The principal types of business enterprises in Kenya are:
  Registered Companies (Private and Public)
  Branch offices of companies registered outside Kenya
  Partnerships Sole Proprietorships
  Co-operatives
Companies are registered as limited liability companies as in 1 and 2 above, and regulated by the Companies Act (Cap 486). Kenya's legal system is based on English law and practice. A wide range of legal services are locally available.
iii.      Company Registration
  The initial step in forming a company is to register the proposed company name with the Registrar of Companies at the Attorney General's Chambers in Nairobi. The Memorandum and Articles of Association should be filed with the Registrar of Companies who, upon satisfaction, issues the Certificate of Incorporation.
Opening a branch office of an overseas company
  An overseas company wishing to open a branch office in Kenya should deliver the following to the Registrar of Companies:
  A certified copy of the Charter, Statutes or Memorandum and Articles of Association of the Company, or other instruments defining the constitution of the company;
  A list of the directors and secretary of the company, giving full names, nationality and other directorships of companies in Kenya;
  A statement of all existing charges entered into by the company affecting properties in Kenya;
  Names and postal addresses of one or more persons resident in Kenya authorised to accept, on behalf of the company, service of notices required to be served on the company;
  Full address of the registered or principal office of the company in its home country; and,
  Full address of place of business in Kenya.
Both private and public companies may allot shares for considerations other than cash. Companies should inform the Registrar of Companies of such allotments and submit a written contract constituting the title of the allottee.
iv. Patents and Trade Marks
  Patents are regulated by the Industrial Property Act and administered by the Kenya Industrial Property Institute (KIPI), while trademarks are regulated by the Trade and Service Marks Act (Cap 506) and administered by the Registrar of Trademarks at KIPI. The duration of trademarks is seven years from the date of filing and renewable every 14 years.
v.    Work permits
  The Government allows investors to have key expatriate staff in senior management positions or where locals with specific skills are not available. Work permits for such expatriates are issued by the Immigration Department and are valid for one to two years, renewable on application.
vi.   Import and export procedures
  There is no import licensing except for a few items restricted for security, health or environmental reasons detailed in the Imports, Exports and Essential Supplies Act (Cap 502).
  During the Budget for Fiscal Year 2001/02 the Minister agreed to waive the 2.75% Import Declaration Form (IDF) fees applicable on imported goods used for manufacturing goods for exports under the Tax Remission for Export Office (TREO) scheme. Manufactures under the TREO will however have to pay Kshs. 5000 which is processing fees.

The World Bank, through its International Bank for Reconstruction and Development (IBRD) and The International Development Association (IDA) are invaluable resources for global businesses. I would suggest you review its Doing Business report for a:

[D]etailed summary of the bureaucratic and legal hurdles faced by entrepreneurs wishing to incorporate and register a new firm in Kenya. It examines the procedures, time and cost involved in launching a commercial or industrial firm with between 10 and 50 employees and start-up capital of 10 times the economy's per-capita gross national income.
This information was collected as part of the Doing Business project, which measures and compares regulations relevant to the life cycle of a small- to medium-sized domestic business in 190 economies. The most recent round of data collection was completed in June 2016.

Kenyan Business Visa


Quantitative Finance education/skills

Question: What is currently most desired in candidates by employers in quantitative finance/algorithmic trading? Strong quantitative academic background, for example, MSc/PhD in Physics, Engineering, Mathematics, Computer Science, Quantitative Finance or solid practical skills in C++, Python, R used in the finance context and applications of machine learning and AI in finance?
Answer: Ideally Both :)
But it depends somewhat on your role as a quant.
You don't necessarily need the same skillset in risk management as in financial engineering or quant developement.
Hence the answer will depend.
Answer: I totally agree with Vanity, but I would add that it really depends on the employer, and especially at the entry/junior level! Some want a strong quantitative academic background and are asking for an adequate knowledge of programming skills. Others, insist on the practical skills and care less about the academic/educational background (as long as you can prove that you have a certain level of numerical/quantitative knowledge).

Quantitative Finance education/skills


What is the difference between m/s and m/s/s?

Question: Can I subtract, say, for example, 600 m/s - 20 m/s/s? I am confused about this topic and there is no good information on the web.
Answer: To demonstrate why you can't do this, let's step up one derivative, and explore an anecdote about why it doesn't much sense to add distance and velocity directly.

I ask you, "How far away is your house from Jill's house?"
You answer, "It is is five kilometers plus seventeen meters per second away." ($5 \,\text{km} + 17\,\text{m/s}$.)
I was asking you for a distance. But you gave me something that was neither a distance, nor a velocity, but some garbled summation of units.
Confused by your answer, I decide to change the subject. "How fast do you think that car is driving over there?"
You answer, "It is driving ten miles per hour, minus fourteen feet." ($10 \,\text{mph} - 14\,\text{ft}$.)
Wait, what are you talking about? I wonder.
I was asking you for a speed. But you gave me something that was neither a speed, nor a distance, but some garbled summation of units.
If I ask for distance, give me a distance. If I ask for a velocity, give me a velocity.
The same principle applies for all units, and is precisely why checking your units at the end of a derivation is a great sanity check that at least you are attempting to express the type of quantity you wanted to.
Answer: No, you can't.m/s tells us how fast something is moving/ rate of change of distance and m/s/s tells us the rate of change of speed. we cant subtract them because these two are very different from each other.
Answer: There is no sensical way to add or subtract them together since they are terms that have completely different units and mean totally different things.
Velocity is the rate of change of displacement whilst acceleration is the rate of change of velocity or in other words the rate of change of the rate of change of displacement. If we think of something that is a rate of change as providing units of $s^{-1}$
then the rate of change of displacement will have units of $ms^{-1}$ and the rate of change of this velocity will have units of $ms^{-2}$.
Answer: In physics, we can add or subtract only those terms which have same dimensions (or SI units).
Velocity $(ms^{-1})$ and acceleration $(ms^{-2})$ are terms having different dimensions each so we can't add or subtract them from each other.


Torrent clients suddenly stopped downloading

Question: A few days ago I noticed, that Transmission in my Ubuntu 10.04 machine suddenly couldn't download anything anymore. To overcome this I have uninstalled and reinstalled Transmission and tried downloading with other clients (Deluge, Vuze) well seeded torrents (ubuntu iso images for example) without success.
   On the same computer I have also installed Ubuntu 10.10 and Windows 7, which I rarely use. What makes the problem I encounter weirder, is the fact that downloading via torrents works fine in my Ubuntu 10.10 and Windows partitions but not in Lucid Lynx.
   Browsing the web for similar problems didn't give me answers. Any help would greatly appreciated.
Comment: You might have gotten a different IP address which would break any custom firewall rules you have for forwarding traffic to your computer.  But this would only apply if you did manual traffic routing based on your IP address...
Comment: Where are you receiving your internet from? Are you located in a dorm, have shared internet access, etc? Or do you have your own internet access?
Comment: I am sorry I didn't respond earlier. Unfortunately I was unavailable.
Comment: I am sorry I didn't respond earlier. Unfortunately I was unavailable. @RSX-1327: I have my own Internet access at home via a Thomson TG585 v.8 modem/router, to which another laptop occasionally wirelessly connects to the Internet.
Comment: @ David Oneil I am sorry I didn't respond earlier. Unfortunately I was unavailable. I didn't apply manual traffic routing prior to the incident, although I tried manual port forwarding for Transmission in my attempt to solve the problem. Because this approach was unsuccessful, I reverted back to UPnP automatic port forwarding.
Answer: The problem is solved. My Peerguardian Linux installation caused all the trouble due to either some kind of a bug or some configuration adjustment I tried but can't remember. This was determined by the use of Wireshark (it informed me that the torrent clients connect to the trackers) and by getting the output of sudo iptables -L in a terminal (the output showed that pgl interfered with my machine's iptables rules). Temporarily terminating the appliance of these rules with sudo iptables -F proved the aforementioned hypothesis. Finally I uninstalled and reinstalled Peerguardian Linux and thus solved the problem.


tensorflow: difference between multi GPUs and distributed tensorflow

Question: I am little confused about these two concepts.
I saw some examples about multi GPU without using clusters and servers in the code.
Are these two different? What is the difference?
Thanks a lot!
Answer: It depends a little on the perspective from which you look at it.  In any multi-* setup, either multi-GPU or multi-machine, you need to decide how to split up your computation across the parallel resources.  In a single-node, multi-GPU setup, there are two very reasonable choices:
(1)  Intra-model parallelism.  If a model has long, independent computation paths, then you can split the model across multiple GPUs and have each compute a part of it.  This requires careful understanding of the model and the computational dependencies.
(2)  Replicated training.  Start up multiple copies of the model, train them, and then synchronize their learning (the gradients applied to their weights & biases).
Our released Inception model has some good diagrams in the readme that show how both multi-GPU and distributed training work.
But to tl;dr that source:  In a multi-GPU setup, it's often best to synchronously update the model by storing the weights on the CPU (well, in its attached DRAM).  But in a multi-machine setup, we often use a separate "parameter server" that stores and propagates the weight updates.  To scale that to a lot of replicas, you can shard the parameters across multiple parameter servers.
With multiple GPUs and parameter servers, you'll find yourself being more careful about device placement using constructs such as with tf.device('/gpu:1'), or placing weights on the parameter servers using tf.train.replica_device_setter to assign it on /job:ps or /job:worker.
In general, training on a bunch of GPUs in a single machine is much more efficient -- it takes more than 16 distributed GPUs to equal the performance of 8 GPUs in a single machine -- but distributed training lets you scale to even larger numbers, and harness more CPU.
Comment: Thank you very much for the explanation!
Comment: The inception link is broken. [Here](https://github.com/tensorflow/models/blob/16e4679834e1bf3e805703b197d377e35504fa09/tutorials/image/cifar10/cifar10_multi_gpu_train.py) is another example.
Answer: Well until recently there was no open-source cluster version of tensor flow - just single machine with zero or more GPU.
The new release v0.9 may or may not have changed things.
The article in the original release documentation (Oct 2015) showed that Google has cluster-based solutions - but they had not open-sourced them.
Here is what the whitepaper says:

3.2 Multi-Device Execution Once a system has multiple devices, there are two main complications: deciding which device to place the computation for each node in the graph, and then managing the required
  communication of data across device boundaries implied by these
  placement decisions. This subsection discusses these two issues
Comment: Thanks for the answer! However, they announced that they released distributed tensorflow with their v0.8, and they have an tutorial page for that: https://www.tensorflow.org/versions/r0.8/how_tos/distributed/index.html. Is that not the real distributed tensorflow?
Comment: this is great news! - let's hope someone steps in who is "up to steam" on this.


Do services still apply foam carpet on belly landings?

Question: From decades I have been reading that, fire services would spray foam on the runway, in order to avoid fire, on a belly landing. Is this procedure still being used? If not, what would be the safest procedure?
Comment: Recent gear-up landing (that was known in advance so emergency services could prepare) was [LOT B763 at Warsaw on Nov 1st 2011](http://avherald.com/h?article=4456bd6b). However I can't quickly find definite statement whether they foamed the runway in advance or not in the report (I believe they did not).
Comment: I have heard (probably here, but have no supporting documentation) that they no longer foam the runway so they don't use it all up on the runway and have none left for a fire that may break out on impact. There's a certain amount of logic to that (don't waste the foam if there isn't going to be a fire), but quite a bit of fallacy in it, too (they're really not going to plan that poorly, are they?).
Answer: Firefighting services still apply foam path, atleast outside US, though the practice is no longer encouraged.
FAA, in its 2002 CertAlert 02-04 actively discourages it:

The FAA does not recommend the foaming of runways for emergency landings and warns against the practice with any foam other than "Protein" foam....  It is recommended that ARFF personnel decline to foam a runway when requested by a pilot because they do not have the specialized equipment and protein foam

FAA lists a number of reasons for this decision (It had actually recommended foam paths for emergency landings in 1966, before withdrawing it in 1987), including,

Time may not be always available for foaming
The use of foam in foam path should not affect the subsequent firefighting abilities.
Foaming the runway should not affect the movement and safety of other aircraft.

ICAO too, does not recommend for foaming the runway in its Airport Services Manual, stating,

15.1.2 The effectiveness of runway foaming is not fully substantiated by the real evidence of operational incident studies.

ICAO also considers the various reasons for foaming the runway and analyses them:

a) Reduction in aircraft damage. ... The data available from a study of emergency landings made with, and without, the application of foam show
  that no significant reduction is achieved in the risk of fire or in the extent of damage by the foaming of runways.
Reduction in deceleration forces. ... It is to be noted that from what is
  known to date, the braking action of an aircraft on a foamed runway will only be slightly worse than that on a wet runway, assuming non-freezing weather.
Reduction in friction spark hazard. ... tests have shown that aluminium alloy metals produce no friction sparks capable of igniting aircraft fuel vapours ... on either dry or foam-covered concrete or asphalt runway surfaces. ... Titanium friction sparks, capable of igniting aircraft fuel vapours, could not be effectively suppressed by runway foaming in any of the scale research tests ...
Reduction in fuel spill fire hazard. From all that is known of the fire suppression qualities of foam and the scale research tests, it is clear that a foamed runway would have no appreciable effect on the fire hazard of fuel vapours in the atmosphere over the foam.

ICAO also points out that the primary firefighting vehicles should not be used for foam laying operations; Also, the time taken for the operations and replenishment is a concern.
It is to be noted that, though the practice is no longer recommended, fire services are not barred from using it if the pilot asks for it and facilities are available.
In a related note, US armed forces seem to use it.
Comment: `no significant reduction is achieved in the risk of fire or in the extent of damage`. This is the key point.  The Royal Air Force used to use Manston in southern England for landing "gear up" on a foam carpet but stopped when they found it made no difference to the outcomes.
Comment: Another reason they might add after [Asiana 214](https://en.wikipedia.org/wiki/Asiana_Airlines_Flight_214) is that survivors may be hidden in the foam and be run over by emergency vehicles


What item combinations give you health?

Question: Apparently there are some items in the game that give you health, and can be consumed with other health giving items. For example shark sarabrew, or sharp chocolate bomb. Are there more combinations? Are there cheap alternatives?
Answer: There are 3 combinations. There are:

Shark/Rocktail - Sara Brew
Shark/Monkfish - Chocolate Bomb
Shark/Rocktail/Monkfish - Karambwan

There are also Barbarian potions that when consumed heal as well (20 hp for non Eoc/ 200 for Eoc).
Probably the cheapest method is the Shark to sara brew. Then regain your skills by using a combat potion NOT a super restore.

What item combinations give you health?


Cross-thread exception throwing

Question: I have an application that allows users to write their own code in a language of our own making that's somewhat like C++. We're getting problems, however, where sometimes our users will accidentally write an infinite loop into their script. Once the script gets into the infinite loop, the only way they can get out is to shut the application down and restart, potentially losing their work. I'd like to add some means where the user, when he realizes that his code is in an infinite loop, can hit a special key, like F10 or something, and the code will break out of the loop. But I'd like to do it without implementing a ton of checks within the script runtime. Optimally, I'd like to have a separate "debugger" thread that's mostly idle, but as one of its tasks it listens for that F10 key, and when it gets the F10 key, it will cause the script runtime thread to throw an exception, so that it will stop executing the script. So my question is, is there a way to have one thread cause another thread to throw an exception? My application is written in C++.
Answer: If the script is actually interpreted by your application then you can just tell the interpreter to stop executing whenever some user event occurs.
Answer: It's possible.  Detect the keystroke in a separate thread, a hidden window and WM_HOTKEY for example.  Call SuspendThread() to freeze the interpreter thread.  Now use GetThreadContext() to get the CPU registers of the interpreter thread.  Modify CONTEXT.Eip to the address of a function and call SetThreadContext().  Have that function call RaiseException() or throw a C++ exception.  ResumeThread() and boom.
Answer: A short answer - no.
If your application runs on Windows, maybe you can send a message from this "debugger" tread and have a message loop in the main one?
Answer: Whether you code it explicitly or not, you will need to check a "interrupt" variable in the message loop. If you implement this by a simple volatile int, you will have both a very simple test and very little overhead.
Answer: The problem with that solution is, to do a message sending implementation, I'd have to set up a "listener" as part of the script interpreter. Right now, the interpreter just executes the function. The message loop is implemented outside of the interpreter. If within the function there is an infinite loop, then to break out of that script, I'd have to check for a message in between execution of each instruction in the interpreter, i.e. while(more instructions){check F10, execute script instruction}. That seems like a lot of extra unneeded checks that can slow down the script execution. But if that's the only solution, then I guess that's what it has to be. I still think there's got to be a better way. Maybe the script interpreter needs to be run on a child thread, while the main thread continues its message loop, and will then kill the script interpreter thread when it gets an F10.
Comment: "The problem with that solution is, to do a message sending implementation, I'd have to set up a 'listener' as part of the script interpreter" sounds a lot like "I want this new functionality, but I don't want to change the code to get it."  Sorry, but I think you'll need to change the code.
Answer: It is unsafe to terminate a thread, as it is probably using resources shared across the entire process.
It is less unsafe to terminate an entire process, but that's not going to help you.
A more safe way to deal with this would be to have the interpreter check for events on a regular basis and treat the stop event as a case to terminate (or at least spill out to a higher loop).
For windows, you could also queue an APC to that thread that calls RaiseException(...) or throws an exception, (although I would avoid the latter, since that crosses API boundaries), but that also implies that the thread will put itself into an alertable state. And I don't really recommend it.

Cross-thread exception throwing


how to transfer text link on an image to a clickable link?

Question: I want to transform a text link to a clickable link on an image, could you please provide some suggestion? the whole process should be done in a web based application. is there any open source framework doing this?
thanks a lot.
Answer: Do you want to make a label  clickable? If so you can use javascript for that
Like
< label id="LblId"  class="StyleToLabel"  onmouseover="this.style.cursor='pointer'"  onclick="JavascriptFunctionName('Parameter')" >Click Here< /label>
Hope it helps


IOS 7 iPad keyboard is unresponsive

Question: After downloading IOS 7 on my iPad, there is a 15-20 second delay between touching a keyboard character and the letter appearing on the screen.
Answer: Anytime iOS is seeming sluggish to me, I like to place it in Airplane mode to see if it's a network issue slowing things down.  For a delay that long, I would then power down the device and restart it while still in Airplane mode.
At that point you will know if your OS or device has issues to its just doing a lot of work.
From there, I would start at http://support.apple.com/iPad and start the troubleshooting assistant to narrow done the cause.
Comment: Also closing all other applications might release resources and make it less sluggish.  Newer iPad models have more memory and Apple optimize the experience for them, so if you have an older model this might be the reason.  A good example is that entering panorama mode on my iPhone 4S in iOS 7 might kill music playing instantly - my guess is that it requires SO much memory that even music playing (which should have top priority) has to go.
Answer: I updated to iOS 7 today, was going off my head with the unresponsive keyboard. Big delays, looked up potential bugs on google. Go into iCloud settings and switch off the toggle switch in documents and data. You will find that this will allow you to type things without wanting to launch your ipad across the room. If you access iCloud that will enable the documents and data again. Hope this helps :0)
Answer: I just updated to iOS 7.1 and as soon as I did on my iPhone 5 and iPad Air I instantly got a 7-15 second lag anywhere the OS used a keyboard including the Lock Screen.
After a couple of days of trying all the other options the only thing that works so far is to toggle OFF contacts on any gmail account in Settings -> Mail, Contacts, Calendars. This fixes the issue right away. If I toggle contacts ON this issue comes right back.
Apple needs to fix this issue right away, this worked fine before the 7.1 upgrade.

IOS 7 iPad keyboard is unresponsive


How does the neural network learn when used in the REINFORCE algorithm?

Question: As per my understanding, you run an entire episode, which contains many steps, and then back-propagate using just a single loss value. How does the neural network learn to differentiate between good and bad actions?
Answer:
How does the neural network learn to differentiate between good and bad actions?

Good actions - in context of a given state - have higher return than bad actions on average, taken over many examples where the actions occur in different combinations.
In REINFORCE, when training the neural network, all actions are effectively treated as ground truth "correct", but the gradient is weighted by the return from that time step. The best trajectories therefore get larger gradient steps, and therefore shift the action choices made in those trajectories more towards them than the less good trajectories.
In the case of positive vs negative returns this is very clear (because negative returns will reverse the gradient step away from the action choices that were made). However, even if all returns are negative or all are positive, the REINFORCE algorithm still works - provided there are enough samples of different trajectories with actions taken in different contexts, then there will be a preference for the best action in each state.
REINFORCE with baseline and Advantage-based update multipliers (which are a variation of REINFORCE with baseline) are slightly better than the most basic REINFORCE "race to the top", in that they are more numerically stable and will automatically split into relative positive and negative updates regardless of whether the environment produces positive or negative returns overall.
Ideally you would not run a REINFORCE update step based on a single trajectory at a time, for two reasons:

The trajectory contains correlated data, and neural networks learn badly from it, preferring i.i.d. samples if possible.

A single trajectory does not contain enough information by itself for a learning agent to figure out whether it is good or bad relative to other options.

Neither of these are complete showstoppers, but you should find that many implementations of policy gradient methods collect multiple trajectories before each update step.
Comment: The algorthm is gradient ascent on the neural network for the output of actions taken times the return measured when taking that action. Unlike classification which  rates the action against a known correct value, REINFORCE rates each action according to how well the overall trajectory after that point turned out. Clearly this includes impact of other choices. However, on average each state's choices will favour the best action in the long term. The algorithm never *compares* anything, it simply follows gradients that produce high returns more than it follows gradients that produce low ones.
Comment: I'm having a hard time wrapping my head around this. Each state would have an optimal action(s) compared to other actions. How would REINFORCE learn that by viewing an entire trajectory?
While calculating loss/backpropogation, does the algorithm ever compare the prediction for a state with the reward/value obtained?


My Wi-Fi and DNS configuration completely messed up after installation of KDE connect

Question: I need help to restore my Wi-Fi and DNS settings to previous state like was before installation of KDE connect. Now I have unstable Wi-Fi (every few minutes disconnect), I can ping, mtr from terminal BUT no browse. I have read every tutorial I found but no success. When I click on network manager icon on panel the connection information shows apparently correct. I'm connected to AP through an Wi-Fi repeater (TP-Link wr802n). Is this issue maybe related to Bluetooth ? Appreciate some help, Vladi PS: KDE connect can ping the phone and vice-versa, but nothing else, i don't know how to browse files and so on. I'm using Xubuntu 16.04. thanks
Comment: I have the same issue!!! I wiresharked a bit and it seems TCP is unhappy with retransmissions. I think the TCP handsake is failing due to receiving things twice but I was not able to research any further yet... (I dont think the bluetooth has anything to do with it, I think is the repeater playing over the same channel)
Comment: Quick update: I did a firmware upgrade on my TL-WA850RE and the problem seems to have gone away! I am not sure if the firmware or the device restart fixed the issue. I still see some TCP dups an retransmissions but things work now. Let us know how it goes and if restarting the repeater solves the issue
Comment: @urban I will restart the repeater and see what happen. Later I'll post the results. thanks
Comment: @urban I restart repeater and so far wifi connection is stable. BUT I removed completely KDE connect ! Very bad experience. Thanks. I'm afraid to reinstall again and get all sorts of WiFi problems.
Comment: @urban Unfortunately I was wrong, the connection is still  unstable, what to do? I can ping, mtr, sometimes telnet to port 80 but when I can't browse telnet doesn't work !! I did firmware upgrade to tplink wr802n but no success!! ALL these problems began after installation of KDE connect!! How can I reset every thing and setup again from scratch?? thanks
Answer: I have not gotten to the bottom of this yet so this is not a complete answer. However, I will use it to keep track of what worked for me in various cases and update it.
Symptoms
I see the following symptoms:

Ping works most of the time, however, some times it returns (DUP!)
Some websites are accessible and some are not. When they are not they timeout
Wireshark on the wlan0 interface show lots of TCP errors:

TCP Spurious Retransmission
TCP Dup ACK

Various other devices in the house do not automagically switch to the repeater (I see this from the received signal strength). Bouncing the wifi fixes the issue on Android
Various concerning errors in my syslog (can you post yours?)
<code>$ sudo tail -f /var/log/syslog -n1000 | grep wl_
Oct 13 11:21:02 urban-asus kernel: [29439.451313] CPU: 2 PID: 493 Comm: wl_event_handle Tainted: P        W  OE   4.4.0-137-generic #163-Ubuntu
Oct 13 11:21:02 urban-asus kernel: [29439.451464]  [<ffffffffc05cd085>] wl_notify_roaming_status+0xc5/0x140 [wl]
Oct 13 11:21:02 urban-asus kernel: [29439.451527]  [<ffffffffc05cc6e3>] wl_event_handler+0x63/0x1d0 [wl]
Oct 13 11:21:02 urban-asus kernel: [29439.451585]  [<ffffffffc05cc680>] ? wl_notify_scan_status+0x320/0x320 [wl]
Oct 13 11:21:03 urban-asus kernel: [29440.554124] ERROR @wl_cfg80211_get_station : Wrong Mac address, mac = c0:3e:0f:80:db:31   profile =ac:84:c6:c2:7c:73
Oct 13 11:21:03 urban-asus kernel: [29440.554537] ERROR @wl_cfg80211_get_station : Wrong Mac address, mac = c0:3e:0f:80:db:31   profile =ac:84:c6:c2:7c:73
Oct 13 11:21:04 urban-asus kernel: [29441.057439] ERROR @wl_cfg80211_get_station : Wrong Mac address, mac = c0:3e:0f:80:db:31   profile =ac:84:c6:c2:7c:73
Oct 13 11:21:04 urban-asus kernel: [29441.057529] ERROR @wl_cfg80211_get_station : Wrong Mac address, mac = c0:3e:0f:80:db:31   profile =ac:84:c6:c2:7c:73
Oct 13 11:21:05 urban-asus kernel: [29442.568268] ERROR @wl_cfg80211_get_station : Wrong Mac address, mac = c0:3e:0f:80:db:31   profile =ac:84:c6:c2:7c:73
Oct 13 11:21:07 urban-asus kernel: [29444.559172] ERROR @wl_cfg80211_get_station : Wrong Mac address, mac = c0:3e:0f:80:db:31   profile =ac:84:c6:c2:7c:73
Oct 13 12:39:58 urban-asus kernel: [34174.929046] ERROR @wl_dev_intvar_get : error (-1)
Oct 13 12:39:58 urban-asus kernel: [34174.929051] ERROR @wl_cfg80211_get_tx_power : error (-1)
</code>

Solutions that worked in the past
Firmware upgrade and repeater reset
I have upgraded the repeater firmware which caused it to reset and that solved the issue the first time. I am not sure if the firmware or the reset did the job...
Locking the BSSID
On infrastructure mode with multiple APs on the same SSID (network name) you can configure your adapter to prefer a particular AP. This morning I experienced the same issues as above and thus I created one network connection that forces the BSSID (mac address) of the repeater.
On KDE from the connection editor (right click on the tray-> Configure Network connections) I created a new connection:

I still have the original connection to my network that seems to be working as expected when I am closer to the router. When moving rooms this stops working... switching to the above connection did the job today (I will experiment more and see if switching back shows the same symptoms)
You can verify to which AP you are connected with:
<code>$ iwconfig wlan0
wlan0     IEEE 802.11abg  ESSID:"Urban - Sky"
          Mode:Managed  Frequency:2.472 GHz  Access Point: AC:84:C6:C2:7C:73
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
</code>
Try another wifi card
I have seen incompatibility issues with various routers where my card stops working and the connection needs to be reset. In this case it doesn't seem to be the case since I can still ping the router fine. However, I do have a USB wifi interface and I will experiment and see if it shows the same symptoms. If not, then it might be a card or driver issue (will update this section when I find some time to do the tests)
Let me know if any of the above solves the problem
Comment: I did some research and found some thing interesting : This router/repeater TL WR802n is a junk cheap router and a cause of all issues can be that on TP LINK configuration page should be set DNS servers like 188.8.131.52,22.214.171.124 or a OPENDNS and should be done release or flush DNS on the router and on the computer. I hope these suggestions can help. thanks.


Magnesium vs calcium vs barium ions from these 3 tests

Question: How do I pick up the difference between barium, calcium, and magnesium ions? I had to do a quantitative analysis practical exam: I was given an aqueous solution of a salt, and when adding separately dilute sulphuric acid, magnesium chloride, and sodium carbonate to the solution, a white precipitate formed in each tube. The notes say that all three ions make insoluble precipitates, so I don't know how to get the difference.
Answer: The unfortunate thing is that salts of these ions are white and can't be differentiated by just looking. But you can take solubility to your advantage.
The solubility of the sulfates of alkaline earth metal decreases down the group. So, you can form their sulfates and differentiate based on their solubility.
\begin{array}{c|c}
\mathbf{Salt} & \mathbf{Solubility~at~r.t.}  & \mathbf{Inference}\\\hline
\text{Magnesium sulfate} & \text{$\ce{35.1 g/100 ml}$} & \text{Very Soluble} \\
\text{Calcium sulfate} & \text{$\ce{0.26 g/100ml}$} & \text{$\ce{Slightly Soluble}$}\\
\text{Strontium sulfate} & \text{$\ce{97 mg/l}$} & \text{$\ce{Almost Insoluble but not negligible}$}\\
\text{Barium sulfate} & \text{$\ce{2.5 mg/l}$}& \text{Insoluble}\end{array}
You can make oxalates of ions and then dissolve in hot acetic acid. Barium oxalate is readily dissolved in acetic acid while calcium and magnesium oxalate are practically insoluble in acetic acid (calcium and magnesium oxalates can still be separated as described here)
Their chromates can be considered but I would not recommend as chromates are toxic and carcinogenic. Barium chromate is practically insoluble in water and acetic acid while calcium and magnesium chromate are soluble in water and acetic acid (the latter is more soluble).
But the most trustworthy test is flame test. Barium - pale green ; Calcium - Brick red ; Magnesium - Salts are colorless due to formation of oxide layer
Previous discussions:

How to separate and analyse a sample of cations of alkaline and earth alkaline cations and ammonium?
In qualitative analysis for basic radicals, why are group 2 cations not precipitated along with group 4?
How to test for magnesium and calcium oxide? (how to separate calcium and magnesium salts -- easiest way is turning them to their respective oxide and check its solubility in water)
Answer: Magnesium sulfate $\ce{MgSO4}$ is soluble in water. So when adding some dilute sulphuric acid $\ce{H2SO4}$ to the solution of magnesium sulphate, no precipitate should occur. It should occur with barium ions $\ce{Ba^{2+}}$ for sure, and with calcium $\ce{Ca^{2+}}$ if the solution is concentrated enough. So sulphuric acid helps deciding if the solution contains magnesium or not.
Solutions of sodium carbonate $\ce{Na2CO3}$ and magnesium chloride $\ce{MgCl2}$ are no use in your exam. Adding sodium carbonate will produce a precipitate with all ions. Adding magnesium chloride will never produce any precipitate.
To distinguish between calcium $\ce{Ca^{2+}}$ and baryum $\ce{Ba^{2+}}$ ions, the traditional method is to add some drops of potassium dichromate $\ce{K2Cr2O7}$ plus $2$ mL sodium acetate $\ce{CH3COONa}$ as a pH buffer. If there is barium in solution, it will produce a precipitate $\ce{BaCrO4}$. Calcium and magnesium do not produce a precipitate in this mixture.
Comment: Magnesium chloride could form a precipitate from some calcium or barium bearing solutions, especially if the solution is basic.
Comment: @ Oscar Lanzi. Yes, if the solution is basic. Is it basic ?
Comment: Unknown from the information given.


Can I use the phrase "impart money"?

Question: I know impart means "to give" and is used commonly with knowledge, as in "impart knowledge"...but can I say that a government scheme "imparted money" to the beneficiaries?
Answer: Oxford English Dictionary states:
<code>1. Make (information) known.
   'the teachers imparted a great deal of knowledge to their pupils'

1.1 Bestow (a quality)
    'shiitake mushrooms impart a wonderfully woody flavour to the salad'
</code>
As you are neither imparting information nor a quality I would say no. Also, as a native speaker it sounds awkward.
Comment: I think your answer explains it... money is neither information or a quality. The OP might be onto something if they want to say "a quality resulting from the possession of money" "Wealth" might work" and "liquidity" probably does work. Perhaps: "The Federal Reserve imparted liquidity into the banking system in crisis with their infusion of cash."  Money wasn't imparted however the infusion of money imparted the result from having more money.
Answer: From my perspective, impart more accurately would mean 'to share', which is not exactly what a government does. I would favor 'bestow', 'dispense', 'distribute', 'allocate' or if the tone is more nefarious 'embezzled'.

Can I use the phrase "impart money"?


Cross play for ps3 and psvita

Question: How does this work? Does it allow people who bought games for ps3 to play it also on their ps vita? Or does it require to be downloaded on the playstation network in order for it to be playable on any platform?
Answer: From the PS Vita Cross-Platform Play Playstation Knowledge Center article:

Cross-Platform Play (sometimes referred to as Cross-Play or Cross Play) is a feature that lets PS Vita games interact with compatible PlayStation 3 games. The type of interactivity varies by game, and not all games feature Cross-Platform Play support...
Cross-Platform Play is broad term that covers any PS Vita game that has the ability to interact with the PlayStation 3 version of the same game. New and exciting ways to utilize this unique technology are continuously being introduced;

Each game implements cross-platform play differently. You'll have to investigate how each game you're interested in takes advantage of and implements its Cross-Platform Play feature. The FAQ article above mentions several examples:

Marvel Ultimate Marvel Vs. Capcom 3 allows you to use your Vita to control the game running on a PS3.
Wipeout 2048 allows you race online against PS3 players.
MLB 12 The Show allows you to transfer game saves between the Vita and PS3, so you can essentially play the same game between the two.

Games that support cross-play will have this icon on its box:
Answer: If you're talking about being able to multi-player games with PS3 and PS4 versions of the games with your Vita... here's Sony's Cross-Play on PS Vita FAQ's. You must own all of the various versions separately in order to do this. So for instance with WipEout, you must own WipEout 2048 on the Vita to be able to play against someone playing WipEout HD on the PS3. It doesn't matter if the game is a physical or digital copy.
Answer: What you're describing is Cross-Buy, not Cross-Play.  Cross-Buy is where purchasing a game on one system (be it PS3, PS4, or PS Vita) lets you play it on another.  Cross-Play, as Splattered Bits points out, is the ability for a game on one system to play online with the same game on another (i.e. Vita and PS3, as you brought up).

Cross play for ps3 and psvita


Why doesn't dark matter interact with ordinary matter?

Question: Dark matter doesn't interact electrostatically  but I don't understand why it does not collide with ordinary matter . Also can a chunk of dark matter interact with another chunk of dark matter if so how? .Also are there any established experimental protocols for detection of dark matter in a direct manner , that is not by unseen mass present in a galaxy.
Comment: As an example of the scale of the problem, check and see how difficult it is to detect neutrinos, and we **know** what we are looking for in this case. Finding D.M. will be a process of elimination, if we are lucky, sooner rather than later.
Comment: Because its not made up of particles we know.
Comment: Experimental protocols depend on knowing what you are looking for, but we don't know for sure what composes dark matter. As far as I know, there are various experiments now being conducted, each targeted at a different candidate.
Comment: @count_to_10 All the current direct measurements at scale assume some kind of WIMP or another. There are technology demonstration scale test-bed that target axions. Indirect measurements are less picky, but WIMPs are one of only a few models used to estimate their sensitivity.
Comment: @dmckee thanks very much. When in doubt, blame your source, I need  new editions for  half my library.
Comment: "Collisions" in (macroscopic) ordinary matter are primarily due to the electromagnetic force, acting over a short distance. If dark matter could collide with ordinary matter it would probably interact with light as well. But as the answers say, it might interact by other forces than the electromagnetic one.
Answer: In one sense you raise the question of whether a type of matter or elementary particle can exist without interacting with known matter or particles. Of course gravitation is a form of such interaction, but if that is the only way dark matter (DM) interacts with known matter then it is in a sense "forever dark."
The attempt to detect DM by it collision with Xenon atoms is outlined by EasyPeasy. The assumption has been that DM is most likely interacts by the weak nuclear force, and a condensate of the super-partners of the photon, Higgs particle and the neutral current Z particle called the neutralino is a candidate for DM. If so then a neutralino, or any weak interaction DM particle, a WIMP, would interact with an atom. This would then translate some of the tranverse momentum or energy into another form. The Cryrogenic Dark Matter Search (CDMS) attempts to find such an interaction with a cold crystal. A DM particle will then in principle induce a phonon or quanta of vibration on the lattice.
So far these searches have come up empty. If such searches as well as the LUX-ZEPLIN, a scaled up version of ZEPLIN that has come up null in the search, fail to find anything then we may have to abandon the WIMP hypothesis. The null data so far from the LHC for low mass or low energy supersymmetry means the neutralino (as well as s-quarks etc) may not exist at multi-TeV energy.
The alternative is the axion, which is found in the supergravity multiplet, and is also the carrier of the CP violation for QCD. This has some interesting connections between gravity and QCD in a supersymmetric setting at much higher energy. The axion is a scalar particle that obeys the wave equation
$$
(\square~+~m^2)\phi~=~\kappa\vec E\cdot\vec B
$$
where this inhomogeneous term term $\kappa\vec E\cdot\vec B$ means the axion can be exchanged with photons. There are searches for this. An axion in the presence of a strong magnetic field can be converted to a photon. The Axion Dark Matter Experiment (ADMX) is an attempt to find such conversions. This will be very difficult for the axion mass that is a measure of the CP violation is expected to be very small.
An interesting paper came out recently on an anomalous decay of $^8Be_4$ that suggests an $17MeV$ particle may be produced. This is argued to be a new type of gauge particle that mediates interactions primarily in the dark matter sector. This may or may not turn out to be how nature works. It does have some connections with axions, and it also makes the point that dark matter might be a whole "zoo" of various types of quantum fields or particles.
Answer: The title question

Why doesn't dark matter interact with ordinary matter?

Could be taken a couple of different ways.
How does it work?
One way would be equivalent to asking "What's the mechanism?", but the answer is a bit unsatisfying. It comes down to, "Well, it just doesn't participate in the electromagnetic or strong forces. It does participate in gravitation and we don't yet know about the weak interaction." And the reason for that is unknown. It just is.
How do we know?
Or we could take it as "How do we know that?", to which we have a much more complete answer, that can none-the-less be summarized in one sentence "Because if it did interact with ordinary matter we'd have found it by now."
We've spent decades thinking up ways to explain first the galactic rotation curves and then the velocity distributions of galactic clusters with only kinds of matter that we are able to produce or observe in the universe, and then we have looked very hard for signs of those kinds of matter that we have missed. Very often we have found a little bit of stuff with those searches, but it doesn't add up to enough.
For example it's been considered that a lot of small, dense, cold object floating among the star (MACHOs for MAssive Compact Halo Objects) might do the trick. So in the 1990's a large scale effort to detect them by means of gravitational microlensing of stars in globular clusters and nearby galaxies was launched. And they found MACHOs. Enough MACHOs to account for as much as 3% of the matter needed to explain the rotation curve of the Milky Way.
Alternative approaches
Just for completeness I'll mention that people have also asked if maybe the law of gravitation that we've been using (general relativity, but it reduces to Newton's Universal Gravitation with retardation at large distances) needed to be changed. For a while this effort when by the name MOdified Newtonian Dynamics (MOND), and reputable scientists pubnlished papers on the idea in good journals. But in the end it was mostly abandoned, killed by esoteric mathematical difficulties and the trouble it has with a few bit of observational data like the bullet cluster.
Answer: More than 99% of the atoms mass is in a very small part of it. Dark matter does collide with ordinary matter just not with the whole part of the atom. Dark matter is believed to be passing through everything, including us. As it passes through us and other materials sometimes, but very rarely a bit of the dark matter will hit the nucleus of an atom. This SHOULD heat up the atom an almost unnoticeable amount.

Also are there any established experimental protocols for detection of dark matter in a direct manner

Yes currently in a super cooled environment in deep underground labs scientists keep extremely dense packed materials at around .4 Kelvin. The have instruments that can detect almost any temperature change at this low temperature and they're waiting for some dark matter to collide with a nucleus. The reason they're so deep underground (in an abandoned mine) is that they need to filter out other subatomic particles that may interfere. So far they have met no success.
Currently there is a Prototype of LUX-ZEPLIN (large underground Xenon). It will begin testing for dark matter in 2020. It's a 5 foot cylinder filled with super cooled liquid gas. When dark matter hits the nucleus of a xenon atom it will release a flash of light and some electrons. It will hold 10 tuns of xenon and will have a magnetic field pulling electrons to the top of it. This is the most complicated dark matter test ever done. Currently LUX-ZEPLIN can't run stabley but scientists are working on it. More info ->
Prototype of LUX-ZEPLIN
Comment: One of the problems with reading pop-sci article and thinking they give you a view of what is going on is that they almost always focus on a single instrument to the exclusion of the larger picture. And then you mention LUX-ZEPPLIN as if it were the only project going, leaving out COURE and ROSEBUD and PICO and SuperCDMS and so on.
Answer: Dark matter is something that adds lots of matter to the Universe. Dark matter is what allows the galaxies and galaxy clusters to not explode. It holds everything together by adding gravity to regular matter. Dark matter is not made of baryonic particles(most likely) it is probably made of WIMPs. WIMPs are weakly interacting massive particles.