Can the Senate or any government officials initiate peace talks or negotiations during a war without the President's consent?

Question: Can the Senate or any government official initiate peace talks or negotiations during a war without the President's consent? Or does this amount to treason? I read that there's this discussion among legal experts that every person appointed by the President works for him, so I am wondering if there are people outside of the Senate who may challenge the president, and challenge the president by trying to negotiate or talk for peace for a war that was declared by the President.
Comment: [Nixon took a stab at it](https://www.nytimes.com/2017/01/02/us/politics/nixon-tried-to-spoil-johnsons-vietnam-peace-talks-in-68-notes-show.html) though he wasn't acting as a government official, rather as a spoiler to blow Dems' chances at reelection.  Basically, he convinced the SVN not to enter negotiations with the North so that no peace agreement would grace Dem electoral appeal.  https://en.wikipedia.org/wiki/Anna_Chennault#Vietnam_and_the_%22Chennault_Affair%22
Answer: No, negotiation requires the authority of the United States. The Logan Act states:

Any citizen of the United States, wherever he may be, who, without authority of the United States, directly or indirectly commences or carries on any correspondence or intercourse with any foreign government or any officer or agent thereof, with intent to influence the measures or conduct of any foreign government or of any officer or agent thereof, in relation to any disputes or controversies with the United States, or to defeat the measures of the United States, shall be fined under this title or imprisoned not more than three years, or both.

This doesn't say explicitly that the authority of the president is required. That is stated in the constitution which vests the authority to negotiate treaties with the president. As Wikipedia states:

Article II, Section 2, Clause 2 of the United States Constitution includes the 'Treaty Clause,' which empowers the President of the United States to propose and chiefly negotiate agreements, which must be confirmed by the Senate, between the United States and other countries, which become treaties between the United States and other countries after the advice and consent of a supermajority of the United States Senate.

[The President] shall have Power, by and with the Advice and Consent of the Senate, to make Treaties, provided two-thirds of the Senators present concur ...

In United States v. Curtiss-Wright Export Corp., 299 U.S. 304 (1936), Justice Sutherland, writing for the Court, observed,

[T]he President alone has the power to speak or listen as a representative of the nation. He makes treaties with the advice and consent of the Senate, but he alone negotiates. Into the field of negotiation, the Senate cannot intrude; and Congress itself is powerless to invade it. As Marshall said in his great argument of March 7, 1800, in the House of Representatives, 'The President is the sole organ of the nation in its external relations, and its sole representative with foreign nations.'

Or does this amount to treason?

No, violating the Logan Act is a felony. Whether a specific act that violates the Logan Act is also another crime (like treason) depends on the specifics of the case.

I read that there's this discussion among legal experts that every person appointed by the President works for him, so I am wondering if there are people outside of the Senate who may challenge the president, and challenge the president by trying to negotiate or talk for peace for a war that was declared by the President.

There was a senator who attempted to negotiate with the French circumventing the president's authority: Senator Logan. According to Wikipedia:

In 1798, he went to Paris to negotiate peace with the French to settle the Quasi-War. On his return, he found he had been denounced by the anti-Jeffersonian Federalists, who had passed a statute informally known as the "Logan Act", which made it a crime for an individual citizen to interfere in a dispute between the United States and a foreign country.
Comment: @phoog I believe the answer to that is yes, but the treason becomes a separate charge under a different statute, so the criminal act under Logan still isn't treason per se. It's splitting hairs to be sure, but welcome to law and so on.
Comment: "No, violating the Logan Act is a felony": it is possible that some act could violate the Logan act _and_ be treason (for example, giving aid or comfort to an enemy with intent to influence the measures or conduct of that enemy in relation to a dispute or controversy with the United States, or to defeat the measures of the United States).
Comment: Might be worth mentioning that there is a significant body of opinion that the Logan Act is unconstitutional.
Comment: @phoog Yea but I think they are separate concepts. It's like asking whether killing someone is a war crime. Sure, it can be in certain contexts but it doesn't have to be.
Comment: @JJJ that is of course correct.  But the logic in this answer seems to be that negotiations of the sort contemplated in the question are not treasonous _because they are a felony under the Logan act,_ and that reasoning is fallacious.  I'm taking exception to an answer, not a question, so it's not "like asking" anything; on the contrary, it's like _answering_ the question you mention by saying that an act that is murder under the civilian criminal code isn't a war crime _because it's murder,_ which is false.  The determination of whether it's a war crime is a separate question.
Comment: @phoog I see, added an extra phrase to make it a bit clearer. Feel free to edit in / make clearer such technicalities yourself, after all that's what the edit button is for. ;)


SharePoint query suggestions not working and I'm not an overall search admin

Question: Hi universe :)  I am a site collection admin and I really want the search query suggestions functionality to work on my site.  When searching for help, I see a lot of responses that would work if I had greater permissions.  Is there a way I can do it as a collections admin without having to make changes to the entire enterprise search center (as I don't have that ability).  Responses appreciated!!!
Comment: @Erin...you need to be farm admin to create query suggestions..Query suggestions are set under Search Service Application administration....as site collection admin you cannot do it..
Comment: If I've seen search suggestions populate before, does it just mean there's some rule behind the scenes whereby a search term or query has to be executed some number of times before it will populate as a suggestion?  @SiddharthVaghasia   (Thank you for your response!!!)
Comment: @Erin..have added your query as answer....
Answer: Query suggestion can be added manually but Sharepoint also creates it automatically.....
The search system automatically creates suggestions for a query when users have clicked one or more of the results for that query at least six times. The query suggestions are generated daily for each result source and for each site collection, so the automatic query suggestions can be different for different result sources and site collections.
For Manually adding phrase to query suggestion, below steps can be followed
To add phrases that you want the search system to always or never suggest to users as they start typing a query, you have to create one or several text files that contain these phrases, and then import the files into the search system.
To add phrases that should always be used as query suggestions
Verify that the user account that is performing this procedure is an administrator for the Search service application.
Open the Query Suggestion Settings page.
On the home page of the SharePoint Central Administration website, in the
Application Management section, click Manage service applications.
On the Manage Service Applications page, click the Search service application.
On the Search Administration Page, in the Queries and Results section, click Query Suggestions. The Query Suggestion Settings page opens.
In the Language for suggestion phrases section, select the processing language for the query suggestions that you always want to suggest.
In the Always suggest phrases section, click Import from text file.
Browse to the file that you want to import and click OK.
Click Save Settings.
Ref link


Debugging gives PermGen space error in Netbeans

Question: I have Netbeans 7.0 and Spring application. I try to debug application, I always get PermGen space error. It runs normally. I'm new with debugging so can anyone give any hints how to deal with this problem?
Comment: Sorry, my dyslexic typo. It's permgem!!
Comment: Not sure what pemgem is, program? Pretty sure its not [this](http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CB0QFjAA&url=http%3A%2F%2Fwww.mims.com%2FIndia%2Fdrug%2Finfo%2FPEMGEM%2FPEMGEM%2520vial&ei=2evNTvCFM-ji2AXvguWPDw&usg=AFQjCNF7vs6rZdNkZpWTLz100UoFydUC6Q&sig2=q_XIadjjl9abcLsDYxOX3Q) :-)
Comment: Did any of the links in my answer help?
Answer: Take a look at this Fresh Blurbs entry: Explaining java.lang.OutOfMemoryError: PermGen space. Understanding and avoiding the Java Permgen Space error also discusses this memory leak problem. Last but not least take a look at this: Dealing with "java.lang.OutOfMemoryError: PermGen space" error.
Answer: when i faced this problem it was after the number of look ups loaded on start up increased to some high number but my team didnt have this problem so
i tried a lot on the internet but the solution for me was
whenever i want to debug
i login to a new windows account i created and debug smoothly
i don't know why it worked
but i think net-beans on a new account has its default Gui IDE configuration as its just installed and it worked fine for me because i dont need to debug alot but the problem is there
 it worked once so i installed another windows on another drive it worked for sure fast
hope it helps
**oops i edit what i posted it crashed again pergem space !! :(


erroneous decisions by beit din for which korbanot must be brought by beit din and the people

Question: In masechet horayot we learn that korbanot must be brought if the beit din makes an erroneous decision that is followed by the people. Do we know of such a mistake that was made by a beit din? If so, what was it?
Comment: I would suggest putting in the exact citation besides fixing the typos.
Comment: Welcome to Mi Yodeya mink
Comment: @kouty found that Shlomo Hamelech made a mistake and brought the korban. see below at the end of his answer.
Comment: For those who haven't learned Horayos, the halachos in question are discussed in its first perek. The karban is known as a Par He'elam Davar, the "cow of a hidden matter" - I.e. The Halacha that was hidden from Beis Din. The source is Vayikra 5.
Answer: At the Time of the King Salomon, People followed the Beth Din instructions. Then, the Beth din realized his error,  the Beth Din needed to bring a bull as special Qorban Chatat.  The bans are only Chayave Kretot, see the first mishna of massechet kretot (actually, they cooked and ate).
We found something in Gemara Moed Qatan and Horayot about a verse.Melachim I, 8, 65
 וַיַּעַשׂ שְׁלֹמֹה בָעֵת-הַהִיא אֶת-הֶחָג וְכָל-יִשְׂרָאֵל עִמּוֹ קָהָל גָּדוֹל מִלְּבוֹא חֲמָת עַד-נַחַל מִצְרַיִם, לִפְנֵי יְהוָה אֱלֹהֵינוּ, שִׁבְעַת יָמִים, וְשִׁבְעַת יָמִים--אַרְבָּעָה עָשָׂר, יוֹם
So Solomon held the feast at that time, and all Israel with him, a great congregation, from the entrance Hamath unto the Brook of Egypt, before the LORD our God, seven days and seven days, even fourteen days.
Massechet Moed Katan 9A
R' Parnak, reporting R' Johanan, said that that year Israel did not observe the Day of Atonement, whereat they were perturbed
At the time of King Salomon they cooked and ate on Yom Kippur and they offer Par Heelem Davar Dhel Tzibur (Eating and cooking in Yom Kipur is Chayav Qaret). This is clear from the Gemara in Horayot 3a from the words of Rav Asi commenting a verse in Melachim 1.8.65. About the Par Heelem Davar Shel Tzibur, there are several opinions(Horayot 3a) who need to bring it. According to one opinion in the name of Rabbi Meir, the Beth Din bring it. Following Rabbi Yehuda the congregation, following Rabbi Shimeon Ben Eleazar in the name of Rabbi Meir, both the congregation and the Beth Din bring a Qorban Tzibur.
Comment: The OP was looking for a documented case of a mistaken ruling. I don't see how this answers the question.
Comment: Yes, that's better. Now, the first half of our answer is unnecessary, and misleadingly worded as if it's there that the question is answered.
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/37294/discussion-between-kouty-and-sabbahillel).
Comment: @magicker72 you see my response to the OP in name of the Rogotshover?
Comment: Does *Beis Din* bring it?
Comment: @DonielF there are several opinions. Rabbi Yehuda holds that the people brings the Qorban and Rabbi Meir that people, and Rabbi Shimeon that both.


How can I read/write ethereum as a database by python code?

Question: I am a startup in this domain. I see some article about Ethereum could save data as a contract. But they are too complex to me. If I already have an Ethereum account with some ETH. Is there some python code could just simply write some data to ethereum & read it back when needed with this account? This data (or contract) no need to interactive with other account or contract on Ethereum, for example like greeting function, just only record data. Thanks a lot for any reply
Answer: If you are using Python language, you can 1) connect to Ethereum node from your Python code 2) Read and write (send transactions) to contracts using Web3.py library.
Answer: You can do several things. But before describing the possible solution, take into consideration that saving data in ethereum is expensive.
With that said:

You can write a contract that receives data and saves it, using keys (IDs) to differentiate between different pieces of data set. For instance:
contract storeData {
    mapping(uint256 => bytes) public data;

    function saveData(bytes memory newData, uint256 dataID) public {
        data[dataID] = newData;
    }

    function readData(uint256 dataID) public view returns(bytes memory) {
        return data[dataID];
    }

}

Another solution is just to send normal transactions and put your data in the field data/input. You then save the hash of the transaction (txHash) locally and whenever you want the data you use web3.gettransaction(txHash) (you can use web3py for this) to recover the transaction and the data that was sent with it.

Hope this helps


How to adapt an integrated graphics card as if it were dedicated to another PC

Question: I have a tower PC, the power supply stopped working so I am recovering functional parts, like my hard drive, RAM and I also want to recover my video card, I can buy a PCI express adapter to be able to use the integrated video card from my old PC as a dedicated video card from my other tower PC. Since both have PCI express ports. Any recommendation.
I hope to understand.
Answer: This is impossible except on a multi-cpu board. Since the integrated GPU lives inside the CPU it is impossible to put it on a PCIe card. Only dedicated GPUs are reusable across different CPUs


A potentially dangerous Request.Form value was detected from the client

Question: I am using CKEditor/CKFinder as wysiwyg editor on my MVC.NET site.
I have set [ValidateInput(false)] and it works when debugging it locally, but I receive the following error when I have published the site:
A potentially dangerous Request.Form value was detected from the client (message="

Testing</e...").

can anyone explain why the published site is different from the locally site, especially when I have set [ValidateInput(false)]?
*Update:*I am using .Net 3.5 so shouldn't  [ValidateInput(false)] work out the box?
Comment: Can you confirm that the .NET AppPool which your published site is using is not running under .NET 4.0? I am guessing it is.
Comment: Adding the web.config won't disable the validation on all pages unless you specify `[ValidateInput(false)]` before action.
Comment: Thanks, apparently the hos ran .Net 4.0.
Answer: Have you tried setting the htmlEncodeOutput property?
CKEDITOR.replace('editor1', {
    htmlEncodeOutput: true });

This should encode the output and you should be able to avoid setting the requestValidationMode.
Documentation for it is here: ckEditor documentation
Comment: +1 this is better than disabling the validation in my opinion.
Comment: I agree with @ashes999. Two indications to help future readers of the post **1** 'editor1' is the id of the ckeditor control **2** don't forget to decode the value received after POST with _System.Net.WebUtility.HtmlDecode_ otherwise you'll probably continue to have same error.
Comment: And then use
@Html.Raw(System.Web.HttpUtility.HtmlDecode(Model.Text))
to decode encoded text from database, when you need to edit the text. Se more here: https://stackoverflow.com/questions/14978281/html-encode-decode-ckeditor
Comment: I am not use CKEDITOR.replace(), I use <textarea class="ckeditor" ..., what should I do?
Answer: Add this to your web.config:
<httpRuntime requestValidationMode="2.0" />

Comment: The answer was to have the host change the App pool to .Net 3.5, but since this answer would have helped if i was running .net 4.0 I am marking it as the answer.
Comment: Sorry I forgot to mention that I didn't want to disable it on all pages. Also my question was also about why it was different when debugging than when published.
Comment: this won't turn it of for all pages. It will just make your attribute [ValidateInput(false)] work. http://www.hanselman.com/blog/ExperimentsInWackinessAllowingPercentsAnglebracketsAndOtherNaughtyThingsInTheASPNETIISRequestURL.aspx
Comment: I am using MVC.Net 3.5 so shouldn't [ValidateInput(false)] work out of the box?
Comment: requestValidationMode is as far as I know not an attribute in the .Net 3.5
Comment: This fixes the reported error, but removes request validation from your whole website, I don't think this should be the Accepted answer.
Answer: Just add an Annotation to the Post method Action as [ValidateInput(false)]
[HttpPost]
    [ValidateAntiForgeryToken]
    [ValidateInput(false)]
    public ActionResult Detail(ModelClass m)
    { return View(); }

Answer: ValidateRequest="false"
Add this in the particular Page.
Example:
Answer: Add ValidateRequest="false" to your Page:
<%@ Page Language="C#" AutoEventWireup="false" Codebehind="MyForm.aspx.cs" Inherits="Proj.MyForm" ValidateRequest="false"%>

Or add to web.config if using .NET Framework 4.0 (Visual Studio 2010)
<httpRuntime requestValidationMode="2.0" />

Answer: Use Request.Unvalidated["myTextBox"]
for example,
var text = Request.Unvalidated["myTextBox"];

where "myTextBox" is the form field you want to allow HTML to be posted from.


How is $\delta(at+b)=\frac{1}{|a|}\delta(t+b/a)$?

Question:
This result has been used in the second last line of the pic. I don't know why it's true. Both functions are zero for $t$ not equal to $-b/a$. But at $t=-b/a$, a scaling factor $1/|a|$ has been introduced in the second function.
Answer: First of all it seems useful to establish what we mean by an equation like
$$\delta(at+b)=\frac{1}{|a|}\delta(t+b/a),\qquad a\neq 0\tag{1}$$
Since the Dirac impulse $\delta(t)$ is a distribution, Eq. $(1)$ only makes sense if interpreted as
$$\int_{-\infty}^{\infty}\delta(at+b)\phi(t)dt=\frac{1}{|a|}\int_{-\infty}^{\infty}\delta(t+b/a)\phi(t)dt\tag{2}$$
where $\phi(t)$ is a so-called test function, by which we generally mean that it has derivatives of any order, and that for $|t|\to\infty$ it tends to zero sufficiently rapidly.
In order to prove $(1)$, it is sufficient to show that
$$\delta(at)=\frac{1}{|a|}\delta(t),\qquad a\neq 0\tag{3}$$
because substituting $t+t_0$ for $t$ in $(3)$ results in
$$\delta(a(t+t_0))=\frac{1}{|a|}\delta(t+t_0),\qquad a\neq 0\tag{4}$$
which is equal to $(1)$ for $t_0=b/a$.
Proving $(3)$ means that we need to show that
$$\int_{-\infty}^{\infty}\delta(at)\phi(t)dt=\frac{1}{|a|}\int_{-\infty}^{\infty}\delta(t)\phi(t)dt,\qquad a\neq 0\tag{5}$$
Eq. $(5)$ can be shown in a straightforward manner by the variable substitution $at=\tau$, which results in $a\,dt=d\tau$:
$$\begin{align}\int_{-\infty}^{\infty}\delta(at)\phi(t)dt=\begin{cases}\displaystyle\frac{1}{a}\int_{-\infty}^{\infty}\delta(\tau)\phi(\tau/a)d\tau,&a>0\\\displaystyle\frac{1}{a}\int_{\infty}^{-\infty}\delta(\tau)\phi(\tau/a)d\tau,&a<0\end{cases}\tag{6}\end{align}$$
Since
$$\frac{1}{a}\int_{\infty}^{-\infty}\delta(\tau)\phi(\tau/a)d\tau=-\frac{1}{a}\int_{-\infty}^{\infty}\delta(\tau)\phi(\tau/a)d\tau\tag{7}$$
the result $(6)$ can be summarized as
$$\int_{-\infty}^{\infty}\delta(at)\phi(t)dt=\frac{1}{|a|}\int_{-\infty}^{\infty}\delta(t)\phi(t/a)dt,\qquad a\neq 0\tag{8}$$
which is equivalent to $(5)$ because
$$\begin{align}\frac{1}{|a|}\int_{-\infty}^{\infty}\delta(t)\phi(t/a)dt&=\frac{1}{|a|}\int_{-\infty}^{\infty}\delta(t)\phi(t)dt\\&=\frac{1}{|a|}\phi(0),\qquad a\neq 0\end{align}\tag{9}$$
Consequently, $(8)$ and $(9)$ prove $(3)$, which in turn proves $(4)$ and $(1)$.

Thanks to Laurent Duval for commenting and motivating me to rewrite this answer with a bit more (engineering) rigor.
Comment: Could be useful to integrate $\delta$ against some generic "good function"
Comment: @LaurentDuval: Well, yes, I guess you could say so ... I'll add some explanation later on. Anyway, the only way Eq. (4) can make sense is if interpreted as applied to a test function, but my impression was that the OP would prefer to be spared with that kind of stuff ...
Comment: @LaurentDuval: You're right, I'll add that later on.
Comment: @LaurentDuval: I believe that my edited answer makes more sense now, while hopefully still being accessible for engineers. Thanks for pointing out the hand-waviness of the previous version.
Comment: It does, yet I already upvoted it before the update (trust). On such a Q&A forum, it is difficult to answer efficiently (from the OP point of view) while keeping sufficient rigor (for next generations) on enough places of the reasoning. I do have my own share of approximations in answers as you have noticed. Here, I thought (future) trouble could come from the $\int f = \int g$, thus $f=g$ simplification. Witnessing how SE pals like you do is very instructive.
Comment: Sure. However, test functions would be better everywhere, as you can identify the kernels only if all integrals wrt all test functions are equal
Answer: [While commenting on Matt's answer, I tried to find a different path. I somehow failed to do so, but it is written, so]
A folk (and false) interpretation of the Dirac $\delta(t)$ is that

this is would be a function (false, in the classic sense, it cannot be evaluated; it should be understood as an application or operator on other functions, and called generalized function or distribution)
which would be infinite at $t=0$ and zero elsewhere  (nonsense: this is no "single" sense of infinity that can cope with that, as far as I know).

Assuming this false interpretation for a quick moment, one might think that with $at$, with $a> 0$, $at = 0$ only when $t=0$, and  $at \neq 0$ only when $t\neq0$, so $at$ and $t$ are essentially similar for  $\delta(t)$ evaluation, and thus, the $0$ and $\infty$ "values" of  $\delta(t)$, at $t=0$ and $t\neq 0$ respectively,  could be the  same.
However, this interpretation is wrong.
What makes a little more sense is to treat $\delta(t)$ as undefined at $t=0$, yet considering  its area property. In other (yet mundane) words, its surface is unity: $$\int_{-\infty}^{\infty}\delta(t)dt=1$$
Then, $at$ is seen as a time stretch. Even at the vicinity of $0$, the time axis can be stretched. One interpretation of the Dirac is to consider it as a limit of standard function sequences of unit area. Examples are rectangle (left) or triangle (right) functions. If the triangles $T_\epsilon(t)$ of support $[-\epsilon,\epsilon]$ and height $\epsilon$ are dilated by $a$, they now have support $[-a\epsilon,a\epsilon]$, hence have area $a$ instead of $1$.

So to preserve the unit area, we shall compensate by dividing the height by $a$: $T_\epsilon(at)/a$. What happens with $a<0$? Well (huge simplification) the triangle is symmetric, so the time reversion does not change its shape and area.
So, if (big if) $\delta(t)$ is a limit of unit area triangles (but this works for other functions) of support $[-\epsilon,\epsilon]$ and height $\epsilon$, $\delta(at)$ is a limit of unit area triangles (but this works for other functions) of support $[-a\epsilon,a\epsilon]$ and height $\frac{1}{|a|}\epsilon$, or  $\frac{1}{|a|}T_\epsilon(t)$, hence with limit  $\frac{1}{|a|}\delta(t)$.
Finally, the question of the shift is simpler than the stretch: $$\delta(at+b) = \delta(a(t+b/a))$$
and the result follows.
Comment: honestly I didn't read your answer before posting mine :-))
Comment: Good to see some uniform convergence on pathological functions :)
Comment: should not be more surprising to see some uniform convergence of Cauchy series on a set of real numbers where between each two rational members existing are infinitely many non-rational numbers as well ;-)
Comment: I hope you'll like this one. For $p=1,2$, the smooth plane curve $x^p+y^p=1$ (a line or a circle) has infinitely many couples of rational solutions. Interestingly (for me), when $p>2$, Wiles-Fermat says that the same parametric smooth curves avoid ALL rational points $(r_1,r_2)$ that are dense in the $[0\,,1]^2$
Answer: For those who prefer an approach using limits instead of integrals, it follows like this:
Consider the following definition of the unit-impulse located at the origin $t=0$ :
$$ \delta(t) = \lim_{\Delta \to 0} \delta_{\Delta}(t) \tag{1} $$
where the classical function $\delta_{\Delta}(t)$ is defined as
$$ \delta_{\Delta}(t) = \begin{cases} {\frac{1}{\Delta} ~~~, ~~~ 0 < t < \Delta \\ ~ 0 ~~~~,~~~ \text{otherwise} } \end{cases}
\tag{2}$$
Observe that the area $A$ of this pulse is always unity for any value of $\Delta > 0$. This area becomes the weight of the impulse as we take the limit.
Now consider the following pulse $\delta_{\Delta}( a t)$ whose limit is (let $a >0$) :
$$ \lim_{\Delta \to 0} \delta_{\Delta}(a t) = \delta(a t) \tag{3} $$
But the new pulse is defined as:
$$ \delta_{\Delta}(at) = \begin{cases} {\frac{1}{\Delta} ~~~, ~~~ 0 < at < \Delta \\ ~ 0 ~~~~,~~~ \text{otherwise} } \end{cases}  = \begin{cases} {\frac{1}{\Delta} ~~~, ~~~ 0 < t < \Delta/a \\ ~ 0 ~~~~,~~~ \text{otherwise} } \end{cases}
\tag{4}$$
This new time-scaled pulse has an area of $A_a = 1/a$. Then using the unit-area definition of the basic pulse we can re-write the new pulse as :
$$ \delta_{\Delta}(at) = \begin{cases} {\frac{1}{a\Delta} ~~~, ~~~ 0 < t < \Delta \\ ~ 0 ~~~~~,~~~ \text{otherwise} } \end{cases}  ~~ = ~~ \frac{1}{a} \delta_{\Delta}(t)
\tag{5}$$
Finally taking the limits we see that
$$ \lim_{\Delta \to 0} \delta_{\Delta}(a t) = \delta(a t)  = \lim_{\Delta \to 0} \frac{1}{a} \delta_{\Delta}(t) = \frac{1}{a} \delta(t) \tag{6} $$
The shift can also be shown on a similar basis and it's no surprise to see that
$$ \lim_{\Delta \to 0} \delta_{\Delta}(t-b) = \delta(t-b)  \tag{7} $$
is a unit impulse located at $t=b$ instead of $t=0$.
Then combining the time-scale and time-shift we can argue that
$$ \delta_{\Delta}(a t + b) = \frac{1}{a} \delta_{\Delta}(t + b/a) \tag{8}$$
and the limit yields:
$$ \lim_{\Delta \to 0} \delta_{\Delta}(a t + b) = \frac{1}{a} \delta(t+b/a) \tag{9}$$
For $a<0$ we use the absolute value on the weight.
Comment: I've messed around with this sort of thing; it's useful at times to consider $\delta_\Delta(t)$ to be *any* function that is (A) centered on $t=0$, (B) has a total area of 1, and (C) tends to zero as $\Delta t$ gets sufficiently small (and, I'm not going to try to explain what I mean by "sufficiently small" here -- I'm in the deep end and furiously treading water!)


Where will EU money go?

Question: There is no doubt that money from the UK goes to the EU regardless of how much it receives in return. Now that the UK will leave the EU, what will the money that the UK regularly gives to the EU be spent on? I was thinking it would go to the NHS due to below photo but that was propaganda, so what is the reality?
Comment: If you don't spend your money to buy that beer, how can you tell you are going to spend it on shoes, gas, or clothing? Even if you had written down budgets before and after, what if several items had budgetary changes? I think the question as asked is impossible to answer.
Comment: The EU currently provides a bunch of services for us (e.g. European Medicines Agency) so replacing those with our own versions at vast expense
Answer: Most of it will likely go to paying the Brexit divorce bill to honor existing obligations, which is expected to be in the range of £35-39 billion. In comparison, the amount that the UK currently sends to the EU per year is approximately £9 billion. This doesn't include some EU investment in the UK private sector, nor does it consider economic benefits to consumers of lower prices. Any other money returned will likely just go into the UK general fund--there's no reason to think it will be specifically allocated to one source.
Answer: Besides all the technicalities regarding the way budgets work or the "divorce bill", there is a more fundamental reason why you cannot count how much money the UK currently pays into the EU budget and assume this money will be available for any other purpose: Brexit is likely to have huge effects on the economy.
If, as experts warn, growth is depressed (even without a full blown recession), government revenue will be lower and there might very well be nothing left after paying for all current expenses. In the unlikely event that Brexit ushers a new era of prosperity, revenue would increase, some spending would decrease and the government would have an even larger budget surplus to fund additional spending or tax cuts. Either way, looking at the current net contribution to the EU budget tells you very little about the budget outlook in the next few years.

Where will EU money go?


is the nature of friction forces chemical or mechanical or both or other?

Question: I don't quite understand the nature of friction forces, in simple mechanics and also in fluid mechanics. Is the nature of these forces, intermolecular forces ie. chemical nature? Or is it microscopical mechanical forces, ie actual mechanical contact nature? Or both? And which nature is for which case, for the various situations, eg tyre on road or fluid flowing in pipe?
Comment: It is essentially molecular in nature, but microscopic descriptions of friction are quite hard. There is no simple theory for it. Your best bet is to look for papers in the rheology literature that discuss your system in particular.
Comment: This is essentially answered under What does it mean for two objects to "touch"? http://physics.stackexchange.com/questions/23797/what-does-it-mean-for-two-objects-to-touch
Answer: The nature of frictional forces is primarily electromagnetic forces, in case of both rough surfaces and in case of adhesive surfaces. A rough surface acts like it has teeth on it, which goes into the grooves of another surface sliding on it, and the teeth apply a contact force (which is fundamentally electromagnetic) on the groove walls, which we see as frictional force.
In case of adhesive surfaces like a wide cellotape, if you try to rub your finger on the adhesive part, it resists your movement. This is partially due to "chemical forces", that is attractive interactions between glue material and your skin. But even that is primarily an electromagnetic force, like all chemical bonds.
Answer: Easiest way to think about it is as an electrostatic force between the atoms/molecules of two different materials causing repulsion. This is based purely on the EM field of the atoms/object, and their proximity to one another. This is the case for both "simple mechanics and fluid mechanics" so for both a "tyre on a road" and "fluid flowing in pipe."

Is the nature of these forces, intermolecular forces ie. chemical nature? Or is it microscopical mechanical forces, ie actual mechanical contact nature? Or both?

It's both in the sense that "contact" occurs when the electrostatic forces between two objects stop them from passing through one another.
Hope that helps!


When is this even possible (even for a dense graphs) $|E| = \Theta (|V|^2)$

Question: Wikipedia says that "a dense graph is a graph in which the number of edges is close to the maximal number of edges."  and "The maximum number of edges for an undirected graph is $|V|(|V|-1)/2$".  Then why do even use $ |E| = \Theta (|V|^2)$?, understand that $\Theta$ is the correct(tightest) bound in asymptomatic notation.  It seems to me that $|E| = \Theta (|V|^2)$ can never happen, so why do we use it?
Answer: Note that asymptotic bounds only apply to infinite sequences.
In this case, $|E| = \Theta(|V|^2)$ applies to an implicit infinite sequence of graphs $G_i=(V_i,E_i)$, meaning that there are two positive constants $c,c'$ such that, $c\cdot|V_i|^2 \leq |E_i| \leq c'\cdot|V_i|^2$ whenever $i$ is large enough.
This constraint can be satisfied. For every $i\in \mathbb N$, take $G_i$ to be the complete graph on $\{1,\ldots, i\}$. Hence, $G_i$ has exactly $i\cdot(i-1)/2$ edges. For large enough $i$, we have
$$
\frac{1}{4}i^2 \leq \frac{i\cdot(i-1)}{2} \leq \frac{1}{2}i^2
$$
So, we can say that $|E| = \Theta(|V|^2)$.
Another sequence could be constructed taking "almost complete" graphs, where we remove one edge from each complete graph $G_i$ in the previous sequence. This would still satisfy the bound.
We could even remove, say, $100*i$ edges from each $G_i$ (when possible) and still satisfy the bound. This is because we only care about $|E_i|$ growing with "quadratic speed".
Comment: Balanced complete bipartite graphs $K_{\lceil n/2\rceil,\lfloor n/2\rfloor}$ (with about $n^2/4$ edges) are a good example to show that there are dense graphs that aren't just "cliques with a few edges removed".
Answer: You're absolutely right that $\Theta$ is the tightest asymptotic bound. But it's still asymptotic, and that means that we don't care about constant factors or terms of lower degree: when $n$ (or $v$ or whatever) gets big enough, the smaller terms become negligible.
In this case, $\frac{v(v-1)}{2} = \frac{1}{2} v^2 + \frac{-1}{2} v$. So removing the constant factors and lower terms leaves us with $v^2$.
Comment: I don't understand your last paragraph. It doesn't make sense to use $\Theta$ on a single graph anyway, since there's nothing to go to infinity. But $\Theta$ absolutely includes a lower bound.
Comment: @DavidRicherby Sorry, let me rephrase: using $\Theta$ implies that you can put a lower bound on how many edges are in a graph, in terms of the number of vertices. But the lower bound is always zero. So I would use $O$, which is only concerned with the upper bound (and it is in fact bounded above in terms of the number of vertices).
Comment: But asymptotic bounds don't apply to single graphs. We need to be talking about _classes_ of graphs being dense and, in that case, we absolutely need to use $\Theta$ because it's precisely the lower-bound that defines density. If we just said "A class of graphs is dense if the $n$-vertex members of the class have $O(n^2)$ edges", then every class would be dense.
Comment: @DavidRicherby Ahh, I see what you mean, I misread the question. I thought they were saying the number of edges in a general simple undirected graph was $\Theta(n^2)$ (not specifically in a dense graph), which makes no sense because there isn't a lower bound there.


What happens if President Trump has been found to be colluding with Russia?

Question: What happens if it is proven that President Trump has been colluding with Russia during his campaign? Does he go to trial or get impeached? Or does nothing happen?
Comment: It should be noted that, in the USA, colluding is not a legal term and carries no weight.  The term used by the hearing committee today was *co-ordination*.  Something I learned myself for the first time watching the live stream of Comey.
Comment: Black's Law Dictionary defines collusion as "A deceitful agreement or compact between two or more persons, for the one party to bring an action against the other for some evil purpose".  I'm surprised that it's not a formal legal term...
Comment: I am only repeating what the hearing said.
Comment: Does this answer your question? [What happens if a candidate in a US Presidential election becomes the subject of a serious criminal charge?](https://politics.stackexchange.com/questions/10153/what-happens-if-a-candidate-in-a-us-presidential-election-becomes-the-subject-of)
Answer: Only the House of Representatives (sometimes called the Lower House) can impeach a President. The House Judiciary Committee holds hearings and, if necessary, prepares articles of impeachment. If a majority of the committee votes to approve the articles, the whole House debates and votes on them.
The House is pretty much free to decide what constitutes an impeachable offense ("treason, bribery, or other high crimes and misdemeanors" is the formal list in our Constitution). They may choose to or not. A majority ( > 50%) vote of the House is required to Impeach.
Impeachment is equivalent to bringing charges. Removal from office requires a trial in the Senate (sometimes called the Upper House), presided over by the Chief Justice. If 2/3 of the Senators vote for Impeachment, the President is removed from office and the Vice President takes his place.
If the House declined to impeach Trump, nothing would happen...
Comment: @arp - I'm not actually sure that's true.  It would certainly make it less likely, but at some point there could be enough of an outcry that they may decide that it's better to cut their losses and give the population what it (presumably) wants, while promoting the *Republican* VP to President.
Comment: Because the US is so polarized politically, there is very little chance that a Republican controlled House of Representatives would choose to impeach a Republican President even if there were overwhelming evidence that he had accepted a direct bribe from the Russian government (such as, for hypothetical example, a 19% interest in the Russian gas company Rosneft) in return for promulgating policies favorable to the Russians, let alone confirmation of the allegations that his Presidential campaign had coordinated election strategy and tactics with the Russians.
Comment: Can you expand this to make it clear how the Lower House move to impeach but the trial takes place in the Upper house.
Comment: @Venture2099 the Lower House (as a whole) doesn't "move to" impeach, any more than it "moves to" pass a bill. Individual House members "move to impeach", but the House as a whole only impeaches (or not).
Comment: @arp oddly the President recently sanctioned [Rosneft](https://www.mcclatchydc.com/news/politics-government/white-house/article240234021.html). Maybe playing the long con.
Answer: There's nothing illegal by itself about coordinating with a foreign entity. You can coordinate with anyone you want. Now, if you can prove Trump knew/directed that

The Russians had hacked the DNC and John Podesta's email
Were timing the release of some of the more salacious details to cause maximum political damage
The Trump Administration is somehow proving benefits to Russia in a quid-pro-quo relationship

That would be enough to topple a President. General sentiment would turn easily, and you could Impeach him readily (remember, Impeachment is largely a political process, not so much a legal one).
The problem is you must prove Trump knew all of this and was involved in some way. What sank Nixon in similar circumstances were the Watergate tapes proving he had direct knowledge of illegal activity. Barring something similar to connect the dots, it seems more likely that you could find someone in the Trump campaign who was involved. In that case, the person who was caught would likely face some sort of charges, while the White House would simply deny knowledge and assert that person had acted on their own.
Comment: I don't know that one *must prove* anything. Congress has the discretion to impeach based on their own opinion of what "high crime or misdemeanors" may be. So it's not so much that something must be proven, but rather congress needs the will and convincing to do so if it's to be done.
Comment: @Venture2099 I think you've misread what I've said. Coordinating, by itself, isn't illegal. Coordinating to perform a clearly criminal act is. So if Trump talked to Putin and asked for general help winning the election, it's quite different from Trump asking Putin to help dig up dirt and/or hacking emails to help him win. The former looks bad and would be scandalous but not rise to the level of removal. The latter would turn public opinion against Trump and possibly get him removed.
Comment: @blip True, but it's not Congress that needs convincing. You need enough evidence to convince the American people (who have never removed a sitting President) that the current guy needs to go. No matter who is in office, that's a pretty high bar to clear. Without some clear way to tie Trump to actual wrongdoing, I just don't see that happening to move the political will enough to do it. As Republicans proved in 1996, Impeachment is easy but removal is hard. As the political tide had not turned against Clinton, Republicans suffered backlash
Comment: "There's nothing illegal about coordinating with a foreign entity."  Nonsense. Absolute nonsense.
Comment: No. Context is important.  The reverse of the blanket statement is "are you saying ALL coordination is legal under US Law?"  If so we can just disband our counter intelligence apparatus.
Comment: @Venture2099 USA coordinates with foreign entities all the time. E.g. NATO operations, UN Security Council resolutions, and so on. Are you saying that all those generals' and ambassadors' actions are illegal?


Why is it safe to ignore the phase factor when working with unitary operations? (and potentially elsewhere?)

Question: After not understanding the explanation of the no-cloning theorem proof in my lecture notes I turned to Wikipedia, this explanation made more sense to me however it had an extra phase factor that is neither mentioned in my lecture notes, or the no-cloning proof in Michael A. Nielsen's "Quantum Computation and Quantum Information". Why is it safe to ignore this extra factor? Is it only present in unitary operations or have all the operations I have been working with secretly had this phase factor that has been conveniently ignored?
Comment: Is perhaps this question better suited for the physics board?
Comment: does https://quantumcomputing.stackexchange.com/q/2036/55 or https://quantumcomputing.stackexchange.com/q/17760/55 answer your question?
Answer: Proofs of the no-cloning theorem vary in quality. It's often something you meet early on in your studies of quantum information, so people want to keep it simple, but those simplifications can miss out on some aspects of a more complete full proof. The one on Wikipedia will do, but it ignores one class of possibilities in which your unitary could be acting over a larger Hilbert space, and it's just a part of it that has to exhibit the cloning transformation. Other proofs that you see will take into account this possibility. For example, you might see that the required transformation as being something like
$$
U|\phi\rangle_A|e\rangle_{BC}=|\phi\rangle_A|\phi\rangle_B|s(\phi)\rangle_C
$$
In such a case, there's no phase factor $e^{i\alpha(\phi)}$ out the front because you can easily incorporate it into the definition of $|s(\phi)\rangle$.
If the proof doesn't have the extra system $C$, then it probably should have the phase in it, although it will make no difference to the proof.


What's the difference between "harrowing" and "poignant"?

Question: What's the difference between "harrowing" and "poignant"?
Answer: Odd question as these words are not often synonymous.
Briefly, harrowing means very distressing while poignant means emotionally moving or powerful. Poignancy is not necessarily negative.
Comment: Thank You, PyroTyger. Can You, please, give me an example, in which "poignancy" would be in positive sense.
Comment: I would be happy to, but I think @crypto has done an excellent job! You'll see from his examples that the word seldom has a *positive* connotation, but is not necessarily negative either. (Its origin is closer to "harrowing" or "painful" but the English meaning has transmuted over time.)
Answer: In a nutshell,
"poignant" could be used in place of "harrowing", to indicate distress. However, the former can be used in several other situations, as illustrated below:
harrowing could mean:

causing pain or distress.

It was after a harrowing journey on
  foot that we reached the belly of the
  Amazonian rainforest.

poignant could mean:

incisive

The journalist's poignant queries left
  the senator lost for words.

apt; to the point

His poignant summary of the poem
  garnered a huge round of applause.

emotionally moving; sometimes to the
point of distress.

The poignant tale of the girl's
  suffering moved many to tears.

pleasurably stimulating

The sight of his childhood sweetheart
  brought back poignant memories.
Answer: I would say it's the difference between being being bitten by hundreds of ants (harrowing) and being stung by a scorpion (poignant).  Compare the etymology of the two words:

harrow (n.) "agricultural implement,
heavy wooden rake," c.1300, haru, from
O.E. *hearwa, apparently related to
O.N. harfr "harrow," and perhaps
connected with O.H.G. herbist
"harvest" (see harvest). Also possibly
from hergian (see harry).
harrow (v.) especially in harrowing of Hell in
Christian theology, from hergian (see
harry). In the figurative sense of "to
wound the feelings, distress greatly"
it is first attested c.1600 in
Shakespeare. Related: Harrowed;
harrowing.

So "harrowing" carries connotations of being more long-term, part of an ordeal, or how you might feel after being worked over by a rake (or a swarm of ants).

poignant late 14c., "painful to physical or mental feeling," from O.Fr. poignant (13c.), prp. of poindre "to prick, sting," from L. pungere "to prick" (see pungent). Related: Poignance; poignancy.

And "poignant" is sharper, more acute, possibly deeper.  It's the feeling of sudden loss or unexpected injury (like a scorpion sting).
Comment: "Poignant" is rarely used in the sense of "painful" nowadays.
Comment: Thank You, Klay!!! I think You really hit the mark here.


Memory dumping Android

Question: I need to evaluate the security of a cryptographic library. In particular I am targeting a part of the library where I believe the private key is exposed for a limited time in the RAM. Any ideas or pointers on how to go about checking the RAM for this key. I was thinking about dumping memory after some specific user interactions. But how do I start with this, any tools recommended? I am home in the security world, I know about memory layouts, usage, countermeasures against memory attacks etc. Just not in Android.
As for starter it is sufficient if the tools/techniques require custom kernel flashing or rooted devices. But in the end it should be applicable in real life situations where the target device is an out-of-the-box OEM device.
Comment: Both are within scope of my assessment. What are you thinking about?
Comment: Are you expecting a software-only solution (e.g. malware) or for the attacker to have physical access to the device?
Comment: The simplest way would be to gain kernel or root privs and simply read it off the FS. Otherwise, gain ptrace privs and rack the process memory for e.g. "BEGIN PRIVATE KEY" (depends on the key format). Then, there was this flush+reload attack, not sure whether it is applicable -- might be. I guess that's about it from the SW perspective. Note that the key will obviously be in memory since the library has to process it somehow, and this doesn't count as an issue. The issue would be not scrubbing memory after the processing is done.
Comment: Physical attacks would depend on whether the key was flushed from caches or not. If not, then sorry. If yes, then you could e.g. tap the traces and record the traffic, looking for access patterns specific to what the library does. Note this may be a bit convoluted due to caching and multitasking. Or, you could try halting the system and dumping the whole RAM chip. Both don't look very realistic to me, though, much easier to get the flash chip out and dump it, reading data from FS.
Comment: Since this looks like you first post, the very nature of this question make me wonder what you are really looking for...
Comment: How do you mean @KristoferA what are you insinuating? :-) Just healthy interest and interning as a security engineer :-) I have to start somewhere with my first post :-)
Comment: @4oxer just a hunch... your question is very targeted. Not trying to do anything illegal, right?
Comment: Interning as a security engineer :-) no worries. Checkout my  profile, I am very transparent. Although I could have forged that too ;-) anyhow thanks for your concern, but no it is fully legal.
Answer: I had the same need and after looking around I ended up writing my own program.
Usage:
memdump <pid>
memdump <pid> <ip-address> <port>

The former will output the entire process memory to stdout, and the latter to the TCP port of your choice (you'll likely use netcat on the other end).
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/ptrace.h>
#include <sys/socket.h>
#include <arpa/inet.h>

void dump_memory_region(FILE* pMemFile, unsigned long start_address, long length, int serverSocket)
{
    unsigned long address;
    int pageLength = 4096;
    unsigned char page[pageLength];
    fseeko(pMemFile, start_address, SEEK_SET);

    for (address=start_address; address < start_address + length; address += pageLength)
    {
        fread(&page, 1, pageLength, pMemFile);
        if (serverSocket == -1)
        {
            // write to stdout
            fwrite(&page, 1, pageLength, stdout);
        }
        else
        {
            send(serverSocket, &page, pageLength, 0);
        }
    }
}

int main(int argc, char **argv) {

    if (argc == 2 || argc == 4)
    {
        int pid = atoi(argv[1]);
        long ptraceResult = ptrace(PTRACE_ATTACH, pid, NULL, NULL);
        if (ptraceResult < 0)
        {
            printf("Unable to attach to the pid specified\n");
            return;
        }
        wait(NULL);

        char mapsFilename[1024];
        sprintf(mapsFilename, "/proc/%s/maps", argv[1]);
        FILE* pMapsFile = fopen(mapsFilename, "r");
        char memFilename[1024];
        sprintf(memFilename, "/proc/%s/mem", argv[1]);
        FILE* pMemFile = fopen(memFilename, "r");
        int serverSocket = -1;
        if (argc == 4)
        {
            unsigned int port;
            int count = sscanf(argv[3], "%d", &port);
            if (count == 0)
            {
                printf("Invalid port specified\n");
                return;
            }
            serverSocket = socket(AF_INET, SOCK_STREAM, 0);
            if (serverSocket == -1)
            {
                printf("Could not create socket\n");
                return;
            }
            struct sockaddr_in serverSocketAddress;
            serverSocketAddress.sin_addr.s_addr = inet_addr(argv[2]);
            serverSocketAddress.sin_family = AF_INET;
            serverSocketAddress.sin_port = htons(port);
            if (connect(serverSocket, (struct sockaddr *) &serverSocketAddress, sizeof(serverSocketAddress)) < 0)
            {
                printf("Could not connect to server\n");
                return;
            }
        }
        char line[256];
        while (fgets(line, 256, pMapsFile) != NULL)
        {
            unsigned long start_address;
            unsigned long end_address;
            sscanf(line, "%08lx-%08lx\n", &start_address, &end_address);
            dump_memory_region(pMemFile, start_address, end_address - start_address, serverSocket);
        }
        fclose(pMapsFile);
        fclose(pMemFile);
        if (serverSocket != -1)
        {
            close(serverSocket);
        }

        ptrace(PTRACE_CONT, pid, NULL, NULL);
        ptrace(PTRACE_DETACH, pid, NULL, NULL);
    }
    else
    {
        printf("%s <pid>\n", argv[0]);
        printf("%s <pid> <ip-address> <port>\n", argv[0]);
        exit(0);
    }
}

To cross-compile it for Android your Android.mk should look like this:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := memdump
LOCAL_SRC_FILES := memdump.c
include $(BUILD_EXECUTABLE)

Comment: What a great response!  To build this you need the android NDK.  Make a subfolder called 'jni', and in it place the first block in a file named 'memdump.c' and the second block in a file named 'Android.mk', then run ndk-build from the NDK
Comment: I had to change the `int main` to `void main` to make it work because for some reason my compiler was complaining that the `main` function was not returning anything. Without this small change, I was getting a couple of errors because of the many `return` statements without return variables.
Comment: See also LiME which allows memory dump of the entire device, rather than a specific process: https://github.com/504ensicsLabs/LiME
Answer: You can dump the memory info using the Android Debug Bridge (ADB) by using the following command:
adb shell dumpsys meminfo > mem.txt

To get info for a particular app, use this:
adb shell dumpsys meminfo 'your apps package name'

This answer gives a detailed overview of the dumpsys tool. Do take a look. Also, this blog post explains another method to dump the memory of a particular running process (just found it in my Google search result).
Comment: This doesn't actually dump memory, only prints some general statistics on memory usage.
Comment: that only dumps the amount of memory an app uses?
Comment: Updated my answer. Take a look.
Comment: This works if the device is not rooted?
Answer: You can use GameGuardian for this. Need root.
Memory editor tab - menu - memory dump - select range and folder - press ok - wait for toast "Dump end".
Here some video examples how to do this:

How to dump memory of any running processes in Android -
GameGuardian
How to dump odex file from memory on Android -
GameGuardian
How to dump deleted file from memory on Android -
GameGuardian
Answer: You also have a built-in tool in Android-Studio for that, which is called 'Profiler'.
You can profile from:

Attach the Profiler to the device (further explanation here)
hprof file (can be generated by the 'heapdump' command in the device shell)

Example of using the Profiler:
Comment: The picture you posted is too small to be useful. Did you accidentally post a thumbnail?
Comment: Thank you for the comment, I will fix it
Answer: There are techniques to capture the Android RAM into a memory file or dump much like you could with any desktop OS and analyze the mem dump using a framework like volatility.For Android it is more than likely that you have to root the device. If you have the time this is a great 2 part guide on extracting Android memory that starts here
https://www.youtube.com/watch?v=KN9kxn6htMU
Using volatility you could extract strings, see running process etc...
The volatility foundation has a great blog post here on identifying AES encryption keys for true crypt in a memory dump.
http://volatility-labs.blogspot.com/2014/01/truecrypt-master-key-extraction-and.html
It sounds like you could use a very similar methodology in your use case. I hope this can be of some assistance.

Memory dumping Android


How to run specific program with root privileges (Ubuntu OS) when no sudo user log into system?

Question: How do I run a specific program with root privileges (Ubuntu OS) when no sudo user is logged into the system? The program needs root privileges to function correctly. A normal user shouldn't be able to shutdown this process.
For example, I have two users, Admin and Client;
The program should start only when the client logs into the system. It needs root privileges and the Client shouldn't be able to shut this process down.
Answer: There are a few ways to do this.  Ubuntu's graphical login is provided by GDM (or KDM if you're using Kubuntu).  GDM is started by the Upstart subsystem.
The startup process follows these steps:

System boots.  Upstart starts services, including GDM (/etc/init/gdm).
GDM starts, initializes the X-server (/etc/gdm/Init/*), and presents the GUI login window.
A user logs in.

PAM authorization happens (/etc/pam.d/gdm)
GDM runs PostLogin script (/etc/gdm/PostLogin/*).
GDM runs PreSession script (/etc/gdm/PreSession/*).
GDM runs Xsession and xinit scripts
(/etc/gdm/Xsession, /etc/X11/xinit/xinitrc.d/*, /etc/X11/Xsession, /etc/X11/Xsession.d/*)

The user's desktop appears.

Where to run your script
Everything prior to XSession runs as root.  /etc/gdm/Xsession and everything after runs as the user.  This leaves you with three real options for where to run your script.

Modify GDM/KDM's PostLogin or PreSession scripts to run your program.  The username is available in the USER or USERNAME environment variables.
Use PAM to execute your script.  PAM will set the authorizing user in the PAM_USER environment variable.  Add this to /etc/pam.d/gdm to kick off your script:
<code>auth  required  pam_exec.so   /path/to/your/script
</code>

You might be able to use PAM to match a particular user (as in this answer), so the script would only run for that user and wouldn't need to match users itself.  I don't have the PAM expertise to explain how to do that.

Write an Upstart script to run your program.  Your script would start at user login, so we look for the desktop-session-start signal emitted by GDM's PreSession script.
So an Upstart script would detect that signal as the run trigger:
<code># start when GDM's PreSession script runs
start on desktop-session-start
</code>
The signal from PreSession doesn't pass along the username, so you'd need to tweak the signal.  In /etc/gdm/PreSession/Default, find the initctl line and change it to this.  You could also use USERNAME in place of USER.
<code># add USER variable so Upstart script can find it
initctl -q emit desktop-session-start DISPLAY_MANAGER=gdm USER=$USER
</code>
See the manpages for Upstart and its starting event for more details.

How to avoid the Admin user
Your script will need to examine the user/username in the environment variables it gets from one of these methods and use that to determine whether to abort or continue.  Standard shell-scripting methods will work.  Depending on which starting location you chose from the above list, the username may be available in the USER, USERNAME, or PAM_USER environment variables.
Answer: You could use setuid, to always run the program as root. From a security point of view, this is probably a very, very bad idea. If one of your users managed to exploit the setuid program it will give them root access to the whole server
Comment: that works if it's a program the user *wants* to run.  i don't think that's what this questioner is looking for tho.


Why does my stockbroker allow trading at the close but not at the open?

Question: I have an stock brokerage account at TD Ameritrade, and I noticed that it allows market-on-close (MOC) and limit-on-close (LOC) orders, but not market-on-open (MOO) and limit-on-open (LOO) orders. Is there a reason why a stock brokerage firm has support for trading at the close but not at the open? Is the opening auction somehow more expensive for brokerage firms?
Comment: What difference does the reason make?
Comment: @quid "What difference does the reason make?" No difference. I am asking the question out of curiosity. It seems a bit odd that the closing auction is supported, but not the opening auction.
Comment: Have you asked TD Ameritrade?
Comment: @base64 They did not supply a reason. They merely confirmed that they do not support on-open orders, and suggested that I place regular limit orders instead. From what I gather from forum posts around the world wide web, this has been the case for many years now.
Answer: If I understand everything correctly, TD Ameritrade does support market-on-open orders. Simply submit a market order while the market is closed, and it will be executed as a market-on-open order when the market opens.
In order to try to verify this, I looked at the fill prices of a couple of market orders I placed while the market was closed. I looked at two buy orders on different days, and both of them executed at that day's opening price listed on Yahoo Finance. I also looked at one sell order, and it executed at a price one cent better (higher) than that day's opening price.
It also seems to be possible to do a limit-on-open order by submitting a limit order with a fill-or-kill instruction while the market is closed. Presumably, when the market opens, if the opening price satisfies the order, then the order will be filled at that price, and if the opening price does not satisfy the order, then the order will be canceled.
Just now, I verified that it is possible to place such an order, but I have not confirmed that such an order will actually behave as expected.


Can you rebind the movement keys?

Question: When I played through the demo of Kingdoms of Amalur: Reckoning, I could never figure out how to rebind the movement keys.  I prefer to use ESDF instead of the standard WASD, and while I was willing to adapt to WASD for the duration of the demo, I do not plan on purchasing the game unless I can use ESDF.
Answer: Yes.
You can. From the menu, simply select Options > Controls > Controls and you're met with this screen:

By default:

F is Interact
E is Quick Mana Potion

You'll have to remap those keys first, followed by remapping the movement keys in the following order:

Right
Down
Left
Up

For some reason, mapping in another order bugs everything to F, rendering you immobile. If you follow this pattern, however, it works just fine!
Comment: Thanks for publishing the magic order in which keys must be bound. It was highly aggravating to see them stick together. And a hearty poke in the eyeball of whichever intern cobbled together the broken keybindings menu.

Can you rebind the movement keys?


Windows Programming: How to put a file that is frequently accessed in the OS cache?

Question: Windows Programming: How to put a file that is frequently accessed in the OS cache?
Comment: Why do you think the OS internal/automatic caching mechanisms are not enough?
Comment: I would say "read it once" and it should be in the cache already, no?
Answer: Disclaimer : I dont work all that much under Windows
In the general case, you shouldnt mess with your OS cache. It should be smart enough to cache data that are accessed often. If it isnt, you should use an application level cache. I dont know which language you are using, but most probably there is a good cache framework for your language.
Answer: If your in .net and the file is a dll, look into the Global Assembly Cache (GAC).
Answer: If your file is accessed frequently and isn't too large it will already be in a lot of different caches. Your language run-time (e.g. CRT) cache, the file system cache (or what I assume you mean with "OS cache") and your HDD cache.
If your file is small and accessed frequently and still isn't in the cache, it is either not small enough or not accessed frequently enough. You might be able to fix the first problem but don't try to fix the second since it basically means that other files are accessed more frequently than yours and most likely for a reason. For example the user is rather using another application than yours. Trust me, it's possible and it happens.


What is the first recorded instance of a stage name?

Question: To me, it seems as though stage names did not become very common until recently. Maybe I am wrong, but either way, this got me wondering what the first recorded instance of a stage name is. I am curious to see how far back in time it is and which culture it was in.
Answer: Not sure, whether actors are also asked for, given that this is Music Fans; if so
Turlupin (French Wikipedia) was a stage name of Henri Legrand, 1587-1637, so stage names seem not exactly to be a new appearance.
Answer: What is the first recorded instance of a stage name?
First I used Google Ngram Viewer
This gave the earliest use of "stage name" as around 1800.
Then I searched Google Books using "stage name" 1800 - Google Search
This returned English Literature and Books Printed in England Prior to 1800 books.google.co.uk › books
with the following extract:

Found inside – Page 47
... designed to commemorate the personality and distinguished acting career of M.-E. Joly ( 1761-1798 ) , was edited by Du Lomboy whom she married in 1781 ; she had insisted in continuing to use her maiden name as a stage name.

(emphasis mine)
So the earliest usage I can find is somewhere between 1761-1798 probably around 1781 by Marie Elisabeth Joly (a French Actress):

Marie Elisabeth Joly
Also known as
Marie Elisabeth Joly
primary name: Joly, Marie Elisabeth
other name: Joly, Marie
Details
individual; actor/entertainer; French; Female
Life dates
1761-1798
Biography
Actress; performed from an early age; debut at the Comédie-Française in 1781. Married cavalry officer Nicolas Fouquet Dulomboy.

Source: Collections Online | British Museum


How do listen to radio online

Question: How do I receive an online live radio broadcast feed in the U.S. using a laptop with Windows Vista?
Answer: Most sites will have a flash-based player available, so all you really need is a browser, flash player plugin, and some speakers.
Example: http://www.live365.com/index.live
http://www.edge.ca/ (click "Listen Live" at the top)
Comment: Depends how you define "convenient". Being in IT I have to hop around many different machines all day. 99% have flash player so I pop open a browser and I'm back listening to the radio station, no software install needed.
Comment: Many also use arguably more convenient [SHOUTcast](http://en.wikipedia.org/wiki/SHOUTcast) streams, for which you need a supporting client.
Answer: Apple's iTunes is a free download, runs on Vista and receives Internet radio stations.
Answer: Try http://di.fm
No additional software required.

How do listen to radio online


Disadvantages of heavier armour

Question: What are the disadvantages of heavier armour (other than the missed bonus from cat/griffin school techniques general abilities)?
Comment: I believe the heavier the armour the slower your stamina regens, meaning you'll not be able to use Signs as often as you would in light armour.
Comment: That's correct, @DavidYell. I'd mention that you'll get the Bear school technique bonus instead of the cat/griffin, too, so it's not so much missing as different.
Answer: The weight of your armour affects the rate at which your stamina regenerates.
So heavier armour, despite providing more damage resistance will prevent you using signs as frequently. Wearing lighter armour will not penalise your stamina regeneration, so you can use more signs.
Comment: Light armor not only doesn't penalize stam regen, it provides a bonus.
Answer: Armor weight class effects Stamina regen.
Light armor: bonus to stam regen
Medium/ no armor: normal stam regen
Heavy armor: penalty to stam regen
FWIW, the crafted armor sets have the same raw armor values at mastercrafted (save the wolf set, in that I don't know for sure that's true, not that it isn't true), so by level 30+ the question becomes which perk and corresponding armor set are best suited to your play style. You'll also have so much alcohol you'll be able to use tawny owl on cool down, so stamina ceases to be a concern.

Disadvantages of heavier armour


Can this equation be solved by squaring both sides first?

Question: The equation can be solved for $x$ by expanding the left side, grouping like terms and then squaring both sides. Can this equation be solved for $x$ by squaring both side first?  If not, why? I can't get past the last step. Thanks
$$\sqrt{a}(d - x) = \sqrt{b}x \Rightarrow$$
$$a(d^{2} - 2dx + x^{2}) = bx^{2} \Rightarrow$$
$$d^{2} - 2dx + x^{2} = x^{2} \frac{b}{a} \Rightarrow$$
$$\frac{d^{2} - 2dx + x^{2}}{x^{2}} = \frac{b}{a}$$
Comment: "The equation can be solved for $x$ by expanding the left side, grouping like terms and then **squaring both sides**." -- To square what? The grouped like terms would be $\sqrt a d = \left(\sqrt a+\sqrt b\right)x$, then division would give $x = \dfrac{\sqrt a d}{\sqrt a + \sqrt b}$.
Comment: @peterwhy Yeah, I don't know what I was thinking of. Maybe all those square roots threw me.
Answer: Yours is a linear equation it doesnt need to be squared.
$$\sqrt{a}(d - x) = \sqrt{b}x \implies (d-x)=x\sqrt{b/a}\implies  x(1+\sqrt{b/a})=d \implies x=\frac{d\sqrt{a}}{\sqrt{a}+\sqrt{b}}$$


Expresso Store "custom order status" message input field - as textarea?

Question: Is there a little modification to Expresso Store 2.5 that I can make that would turn the "custom order status" message input (that appears in the Order Status controls when you click "Edit Status", and displays on email notifications when you use {custom_order_status} ) to a textarea field of some size?
I have a client who often writes longer messages to clients when their order is shipped, and wants to use this field as the space for writing it. It would probably be more effective for this use if she had a textarea field to work with.
If it's more appropriate for them to be using some other method to put custom messages into Store notifications, I'd welcome being steered to that. (I suppose she can also just write the messages separately, if she needs to...)
Thanks!
Answer: it's a core hack, but yes. Open /store/views/orders/show.php and find line 56. Change:
lang('store.message').': '.form_input('message','','width=10%, style=width:50%').BR.BR.

To:
lang('store.message').': '.form_textarea('message','','width=10%, style=width:50%').BR.BR.


必殺技 scope of usage

Question: 必殺技 translates as "killer technique", but does this only apply to physical fighting or does it have a broader usage? For example, can I have a 必殺技 for making perfectly crispy roast potatoes? Would it be a natural usage?
Comment: 食戟のソーマでありそう(観たことないですが)
Comment: @Angelos Great anime. I don't want to end up sounding like Souma though. I'll have to watch again now and see if he uses that word.
Answer: I suppose 必殺技 can be used in a broader sense, but still in some sort of fighting/beating context.
For example, consider someone is a expert of specific technology (e.g. a particular technique of machine learning) and s/he uses it to solve a problem. Then one could say 彼(女)は必殺技で問題を解決した.
I guess making perfectly crispy roast potatoes itself is unlikely to be called a 必殺技. Rather, if it involves some techniques (right amount of oil, using something unusual etc.), then those could be called a 必殺技 (for beating the task of making roast potatoes).

必殺技 scope of usage


should you have separate application service methods for different roles

Question: Say I have a shipping service where I have both a driver and a dispatcher, but there are multiple roles and a user can belong to more than one role. Both the driver and dispatcher roles can mark a delivery as delivered, but a driver can only mark deliveries completed if they're assigned to those deliveries while a dispatcher can mark any deliveries completed so long as they're being delivered by their shipping company. In the application service (in a domain driven design sense) should you have separate methods for each of these actions e.g. completeDeliveryAsDispatcher and completeDeliveryAsDriver. This seems to make for much cleaner service methods because now I don't need to try to figure out what type of user I'm dealing with.
Answer: No, you should not.  You should handle the logic for different roles within the method.  In your example there will be one exposed method:
pubic void completeDelivery(User user) { ... }

There are a number of reasons for that:

Relying on the user to use your service responsibly is inviting someone to behave badly
It consolidates all the places that need to be updated if the requirements change based on roles
You don't have to change the public interfaces if a role is added, removed, or simply changed

If you want to delegate to internal methods that consolidate all the logic for a particular role, that's up to you.  It's just not part of the public service interface.
Comment: That seems reasonable, but I'm still unclear what should then be happening at the domain layer. Should there be separate actions for `completeDeliveryAsDispatcher` or even just `completeAssignedDelivery` there? If not where I am I doing the check to validate assignment - in a domain service? The reality is that I don't really need to be aware of the "role" or "actor" until this point because with the previous checks I can simply check if they have the permission to update any trips or update only assigned trips.
Comment: I was looking at this for inspiration, but it doesn't really deal with cases where there is more than one user that can do a particular action: https://github.com/VaughnVernon/IDDD_Samples/blob/master/iddd_collaboration/src/main/java/com/saasovation/collaboration/application/forum/PostApplicationService.java .. if I were to make the `driver` an optional argument in the domain model `completeTrip` method I'd be relying too much on the caller to have knowledge of the business logic around assignment
Comment: Keep in mind that my window into your application is as large as your question.  The question you asked is whether you should have `xxxAsRole()` style functions at the service layer.  The very first bullet relates to security.  The other bullets relates to the maintainability of your code.  You simply need the information passed in to your function that it needs to complete its logic.  If there is another way to get the user's role in that context, use it.  At the end of the day, I'm not the one maintaining this application.
Comment: Just make the best informed decisions you can, even if they don't agree with me.  Understand your trade-offs.  There are times I go against the commonly spouted "best practices", and I have the experience to understand when it's OK or an acceptable risk.


Long-term visit visa for UAE: after which date should I leave?

Question: I applied for a 90-day visa and got a long-term visit, single-entry tourist visa. The date given is 09-March-2015, and it's valid until 07-May-2015.
My agent says the 7th is the latest date I can travel to Dubai; once I enter I need to count 90 days. I entered on the 10th of March.
Is it true, or where can I get it checked?
Can I stay for another month, or do I need to leave before the 7th of May?
Comment: @edocetirwi Quite a few countries do actually issue visas like this: the validity date states when the visa must be *used* by, and the clock on the 90 days *in the country* only starts ticking when you enter the country.
Comment: I would highly doubt the claim made by your agent, about you being able to enter on the last day of your visa validity and to stay for a term of 90 days.
Comment: @jpatokal Good to kow. Thnx.
Comment: @edocetirwi One such country is the USA.
Answer: Yes, you can stay longer (up to 90 days!).  This is how the visa works.
They put a deadline on when you can enter, for a number a reasons - knowledge of numbers, validity of passport, relations between them and your country, whatever - but there's a final date on which you can enter.  That's the May 7th.
Once you arrive, your visa 'begins'.  It'll run for 90 days from when you arrive. Note the distinction - it's not three months, but 90 days, be careful when calculating.
If you'd like a slightly more official source than me, Emirates lists the visas and notes "  90 days from arrival date" as well.
Answer: After you entered UAE, you can check the validity here.


Accent on special words or characters can affect machine learning algorithms?

Question: Good evening, I wanted to ask this question about the accent in words or special characters can affect machine learning algorithms. I'm looking to do a job. I would like to know a recommendation for an article or book that I can use as a reference.
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Answer: The short answer is yes.
The long answer is the following. Machine learning (ML) algorithms are designed to build models from data, but there is a general motto among ML practitioners:

"garbage in, garbage out."

That said, if you have trained your model in an intelligent way to distinguish between strange accents on words, then testing the resulting model on sentences with such accents is a good practice; in particular, I'm thinking of Spanish and Italian words, for instance, where a missing accent could give a completely different semantics to such sentences. Nevertheless, a more practical approach in the field of natural language processing (NLP) is to perform a text normalization (e.g., lemmatization) of your text before learning since specific words are less frequent than more general lemmas. For your specific task, there is a post that has Python code that could remove accents from words if you are willing to drop the take this journey.
I hope that this gives you more insight into the complexity of NLP tasks.
EDIT
There are papers on accent-related researches, such as 1, 2, and 3, among many others.
Comment: Thank you very much, it helped a lot, I've been trying to research this for a while, but would you know a reference to a scientific article or book that I can use to prove this type of claim that affects the algorithm?
Comment: I don't want to get to withdraw, I want to compare two models one without performing this accent treatment in words and the other with treatment before passing it to a machine learning model. I wanted to see if there was something that could take this as an article and reference it
Comment: thanks, @Oxedu . I will read the articles. From the return, also finding a fragment of the article. Add here in the comments for the next
Answer: Yes, full stop. Characters with accents may look similar when displayed, but as data they're usually different characters, or additional characters combined with the original character. This is not to mention the other ways text can deviate from expectations, such as encoding errors or homoglyphs (can you tell the difference between E and E? because to the computer they're different characters), all of which should be identified and normalized (forced to a standard character/removed/what have you, whatever is most appropriate for your use case) before attempting to process any text.
Comment: Thank you very much, it helped a lot, I've been trying to research this for a while, but would you know a reference to a scientific article or book that I can use to prove this type of claim that affects the algorithm?
Comment: You're looking for a scientific article that tells you if your data isn't what you think it is, that your algorithms won't work as well?
Comment: yes, because this job and college. My guiding teacher asked for something that stated this, although I had to test it. I have to make reference on this subject.


What should be put into the project, folder and package

Question: I am a beginner to Java. I am using Eclipse now.
What makes me confused is that I am not clear with the dogma of putting files into a project, a folder and a package. If I build a new class, should I put it into the original package or create a new package or new folder or even new project and why?
Answer: This completely depends on application you are developing. If you are developing a large application with many modules in it you should create different projects, linked to each other.
But you say you are beginner, so the answer to your question would be: you should always have your classes classified in different package. The classification is entirely your choice - you can even classify alphabetically if you are comfortable with it. I normally classify them according to their functionalities, like all my Controller classes will be in one package, so are my Bean Classes, Listeners, Constants, Builders, utils, parsers, comparators, models, renderers and so on.
This Java Practices article would be helpful.
Answer: Project Structure
I would strongly advise you to follow Maven conventions for the structure : http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
They are the result of many years of experience.
However, designing such a structure is always a matter of compromise between extensibility and simplicity. The more you foresee, the more that will be complex to maintain, but the more you will get back your investment if it grow fast.
To be pragmatic, and even I'm not really convinced (because my job is to anticipate ;)), try KISS philosophy : http://en.wikipedia.org/wiki/KISS_principle.
Package Structure
As Amandeep Jiddewar said, packages must represents their own functionnality.
At least, they have to be reverse domain like : http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html. For instance, stackoverflow API should be :  com.stackoverflow.*
And maybe, in the first time, they diveded it into MVC pattern

com.stackoverflow.controler
com.stackoverflow.model
com.stackoverflow.view

and so on...
And when the project was mature ... or has grown too much, they splitted it into a war for presentation layer, and jar(s) for service layer ...
Further considerations
There is no specifi rule. As I said, you will always have to deal with compromise. Only experience will give you the hability to know when to change your configuration.
Look around Stack Overflow for more ideas : naming-conventions


What prevents someone from tainting the coin tumbling pool of the Wasabi wallet?

Question: Wasabi is a new type of wallet with a built in tumbler if I'm correct. What stops someone from tainting the tumbling pool of coins with non-approved coins? I'm weary of using these privacy tools as I don't want my coinbase account frozen just because someone mixed a bad coin in the lot.
Answer: Nobody prevents it. Tumbling however reduces the chances of getting taunted by increasing the BTC pool's size.
If you have problems with this method of coins mixing for any reason just don't use it.
Answer: AFAIK Coinbase looks for a five hops before / after incoming / outgoing TX. So adding extra hops will be enough for now. It can be automated with Samourai Wallet's Ricochet or my scripts for bitcoin-qt.
Comment: If everyone knows that coinbase analyzes 5 hops. Why can't they just detect this 5 hop pattern to see all the people using the samourai wallet?
Comment: Samourai Wallet's ricochet send is detectable, as it sends some small amount of BTC to Samourai Wallet's donation address. But there are other ways to do multi-hop send on blockchain too, as I mentioned.

Most important thing - it is asymmetric attack on blockchain analysis. Sender's costs are relatively little, but analysis to fight this needs to increase number of hops they analyze, and do that for all transactions, not single one.


Why do cats pat the area before they lay down?

Question: I've noticed that my cats pat the area where they intend to lay down for a pretty long time, 30 seconds to up to 3 minutes. Interestingly enough, this is only on soft surfaces, never on hard surfaces such as the floor. Why do they do this?
Comment: When I am hiking and come across a patch of muddy ground, I sometimes probe the ground ahead of me with a stick or my staff to see whether I am likely to sink in.  I do not know for certain, but I would guess it is similar.  The cat is using its paw to test whether a blanket or cushion will support its weight adequately.
Comment: They're checking for snakes...
Comment: Do you mean kneading? They can only knead soft surfaces. My cat falls down so suddenly on hard surfaces as if he got shot by a sniper :)
Answer: Your cat is kneading. In kittens, cats knead their mothers to get more milk out of them. An adult cat will knead when it's feeling content because it associates the motion with the comforts of nursing and its mom. Some cats even suckle on what they're kneading, though I've never seen my cat do it. Beware, though, as my cat sneaks into my bed at night and painfully kneads my face. It's less funny than it sounds.
Comment: My two want to kneed my belly for a while before curling up next to me to sleep. If I could just convince them to kneed my back instead, that would be more useful.
Comment: They can also ruin a nice pair of sheets. I recommend putting a soft blanket somewhere that will attract their kneading so they don't ruin your nice sheets and such.
Answer: This is an instinct every cat has. They only do this on soft surfaces and they do this to be sure the place can carry their weight. Out in nature, a very soft area is an unsafe area and it is not only cats that react to this. Humans do it too!
If you are out walking and suddenly step into a very soft ground you stop without thinking.
If your cat is on a hard surface it doesn't pat the area before laying down, it only walks in a circle or two and lays down.
Comment: I've seen cats do this for far longer than would be required to ensure that the surface could hold their weight. It can't possibly be the only reason behind the behavior.
Comment: Yea, it's defo the "making biscuits" that's happening more than making sure areas are safe. They don't do it on hard surfaces because they can't really push on it like their mama's belly. I've also seen cats put themselves into pretty unsafe situations without a "pat" in sight. I've also seen them do a couple of turns on a soft blanket in a box so yea not a safety check at all.


How to know which editor published a post programmatically?

Question: I have authors posting posts with a custom post type and have users with Editor roles publishing them. How can I get the editors who published them?
Answer: As far as I know, WordPress only stores original authors of the posts. If you want to also save the publisher's ID, you need to do a bit of custom coding, or use some 3rd party plugin.
Essentially what you need to do is to store the user ID whenever the post status is being changed to publish. For that you can use the publish_{your_post_type} action (replace {your_post_type} with your custom post type slug). If your CPT slug is project for example, your action should look like this:
function save_project_publisher_meta( $post_id ) {

    // Set current user ID as a post meta
    update_post_meta( $post_id, 'publisher_id', get_current_user_id() );
}
add_action( 'publish_project', 'save_project_publisher_meta', 10 );

Now the publisher ID should be stored as a post meta for each post, and you can access the user data whenever you need by retrieving the publisher ID using get_post_meta:
// Get WP_User object from ID
$publisher_id = get_post_meta( $post_id, 'publisher_id', true );
$publisher = get_user_by( 'id', $publisher_id );

// Get whatever user data you need
$publisher_email = $publisher->user_email;

Note this will only affect newly published posts. Posts that were published in the past won't have publisher IDs stored, until you re-publish them.
Comment: This is outstanding! I'll test it out now.
Answer: wordpress don't have native functionality to handle changes around post/page from users. You need to write / or use plugin to get them and control your authors.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


How does ejb 3.1 timer Service calculates the timeout?

Question: I want to know how the Ejb timer services calculates the timeout? Does it takes the system time and depending on it calculates the timeout or does it internally have mechanism to run a timer for itself. If it uses its own mechanish what is it and can we make some setting so that it can calculate the timeout depending on system Time?
I have searched for this information and didnt find any relevent information.I am currently using the TimerService in my code and programatically created the timers. But when I change the system time the timer does works as per that. Timeout occurs after the stepulated time when timer was created.
If I dont change the System time then the schedulers work perfectly fine..
Even if u can redirect me to any such information that will be gr8 help.
Any help will be really appriciated.
The code goes like this
<code>ScheduleExpression everyDayAtTenTwenty = new ScheduleExpression();
TimerConfig timerConfig =  new TimerConfig();
timerConfig.setPersistent(false);
timerConfig.setInfo("testTask");

everyDayAtTenTwenty.start(date).year("2011,2012").month("Jun").dayOfMonth("19").dayOfWeek("*").hour("16-23").minute("30"); timerConfig.setInfo("testTask : ");

timerKeeperBeanLocal.scheduleTimer(everyDayAtTenTwenty, timerConfig);

timerKeeperBeanLocal implementation

 @Resource
    private TimerService timerService;

Timer timer = this.timerService.createCalendarTimer(scheduleExpression, timerConfig);
</code>

Now here I want the scheduler to execute 19 June 2011 and 2012. Now the current Date is 19 June 2011 so today it executes and the same day I change the system date to 29 June 2011 along with proper time. In such case the scheduler doesnt work. The same can be tested with change is some hours.
Do I need to do something else to work as per system time.
Thanks in advance.
Answer: The Ejb timer service uses the Java SE time APIs which in turn are based on system time. See
http://download.oracle.com/javase/6/docs/api/java/util/Date.html
And this is a quote from the EJB 3.1 specs:

While timer durations are expressed in millisecond units, this is
  because the millisecond is the unit of time granularity used by the
  APIs of the Java SE platform.
Comment: My concern is that once the timer is created and after that if the system date time is changed does the same is reflected in already  created timers.

Thanks for thee reply :)
Comment: Yes, changing the system date will influence the currently created timers.
Comment: In my case it is not working in that way with EJB 3.1 Timer Service


Suggest regularly scheduled Chat Events

Question: I'd like to see more people using our Chatroom. What are some chat topics we could use for Chat Events to drive some activity to chat? What would you be interested in chatting with your fellow users with?
Comment: I was going to suggest chat events in your other [chat question](http://meta.workplace.stackexchange.com/questions/258/dont-forget-we-have-chat), but then I couldn't think of any interesting event...
Answer: I had a big long post being written, but went home to sleep on it and my computer rebooted so I lost it all.
In short, I'm interested in chat when there's activity there.
If you want to increase chat activity, you need to start working to make chat active. Even if its just two users talking, it still generates activity and other users are likely to stop by and visit to see whats going on.
Some suggestions for increasing activity in chat...

Discuss mod things in chat

Instead of just closing a question, post it in chat first, ask for opinions and solicit close votes from users. It could even be something like one mod asking, and another mod closing at first.
When a mod comes to you in TL about your site (such as migrating a question), make them talk to you in our chat room instead of TL (providing the issue isn't a sensitive one that should be kept private). Sure it might be a little more inconvenient at first, but it keeps the community involved in the moderation process, and the chat active.

Solicit opinions in chat before making a meta post asking for suggestions

For example, ask about chat events can be done in chat first, and them summarize the chat into a meta post to get more ideas

Link chat in comments whenever you close a "not constructive" question.

Tell users that we're available in chat to discuss their question and why it is being closed, to help them refine their question, or for subjective discussions that are not appropriate for SE's Q&A format

Say "hi" to users that come into chat

I know it might not seem like much, but every once in a while I'll poke my head into a chat room to see what activity is going on, and having someone say "hi" to me makes me stay around and sometimes take part in the conversation

Don't be serious all the time - have fun in chat too!

Chat shouldn't always be serious. Use it to just talk about whatever comes to mind with other users. Joke around, poke fun at the world's stupidity, star really funny comments out of context, etc but most of all, just have fun in there. Users like hanging around places that are fun :)

(Ben, I know you already do many of these things already, such as bringing moderation issues up in chat. Its great, and don't stop doing it! The sites still small)
But anyways, that doesn't answer your question at all.
For events, the only things I can think of are:

"Guest" visitors, where someone such as an HR expert, a high-rep Workplace user, or someone "famous" to SE or the Workplace will be available to answer talk in chat
"Townhall" styled events where mods are committed to be available in chat for a specific time once a month or so to address any questions users may have
Event to discuss site design, logo, tagline, etc

Suggest regularly scheduled Chat Events


3DS + and - charging contacts?

Question: I am trying to charge my 3DS without the original charger via USB cable (by stripping the wires). On the back of the 3DS, which metal contact is positive and which is negative?
Comment: The 3DS claims to take 4.6V input (as marked on the case and the charger). 5V input *may* cause damage or shorten life.
Comment: Didn't answer my question, but I checked it out and USB input should be fine.
Answer: When looking at the port like so:

The left hole is Negative and the right hole is positive. I also believe the pads are the same.

Left Pad (-)
Right Pad (+)

5V also shouldn't hurt it because the charging circuit inside the 3DS should prevent anything bad from happening. I see a lot of 3rd party chargers that are just straight through USB to charge-port.
Hope this helps!

3DS + and - charging contacts?


Start Mailchimp automated campaign after products shipped

Question: how can I start an automated Mailchimp campaign after shipping products?
Comment: Also iterested in this, however the question will probably be closed as offtopic (
Comment: I hope this question would not be closed. It is a question of how to trigger the start of the campaign. The Trigger information is only available at Magento.
Answer: Why not listen to the event sales_order_shipment_save_after. This event will give you the shipment object that you can work with. I am not sure what exactly you need to check but this event should give you enough information, but be careful as this will be fired on all saves and not just on create.


while consuming webservices in salesforce getting exception

Question: while consuming webservices in salesforce getting exception  " System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'"
Answer: Check the Service URL, seems like it isn't pointing to a service. Try it in a browser.
Some services return the WSDL when suffixed with ?wsdl, good way to validate that the URL is right via the browser.
Also another one to check would be that the service URL is white listed under Remote Site Settings.
Answer: Its likely some kind of failure in the Web Service you are calling. Some Web Servers are configured to return a HTML error page (for us humans to read) even if the request was a Web Service and in fact should deserve the SOAP XML response representing the error (which is the correct response and hence what Salesforce expects).
The best way to see what is being sent back it to enable the Apex Debug logs. These contain the full HTTP request and response for you to view. This should let you know the response that is coming back and how to correct your request.

A debug log can record database operations, system processes, and errors that occur when executing a transaction or running unit tests. Debug logs can contain information about:
  Database changes

HTTP callouts
Apex errors
Resources used by Apex
Automated workflow processes, such as:
Workflow rules
Assignment rules
Approval processes
Validation rules
Answer: Well webservice can be tricky to debug. Here is a list of items to check

Ensure that the webservice is hosted in internet. Salesforce cannot access a webservice that is in intranet
Since webservice is returning a HTML it can be page like 404 or authentication page. Make sure you are pointing to correct endpoint and using proper authentication
Also if there is firewall make sure you have whitelisted the salesforce IP