Is there a way to force SOAP to use TLS instead of SSL?

Question: When we do callout via SOAP, it uses either TLS or SSL. Can we restrict salesforce to use TLS instead of SSL.
Comment: Wouldn't the protocol used be defined by the SOAP web service? If the web service only supported TLS and not the older SSL then you should be set. Also, maybe incorrectly, I'd assume that Salesforce would use the most secure method possible (TLS).
Answer: Recent email from Salesforce

PRODUCT & SERVICE NOTIFICATION
As an administrator of a Salesforce org that may have recently been accessed using SSL 3.0 encryption, we want to inform you of a change regarding supported encryption protocols. Over the next two months, Salesforce will be disabling SSL 3.0 encryption in a phased approach to prevent it from being used to access the Salesforce platform.
Why is this happening?.
  At Salesforce, trust is our #1 value, and we take the protection of our customers' data very seriously. On October 15, Google researchers published details on a security vulnerability (CVE-2014-3566) that affects the Secure Socket Layer (SSL) 3.0 encryption protocol, also known as "POODLE," which may allow a man-in-the-middle attack to extract data from secure HTTP connections. Although the vulnerability is somewhat difficult to exploit, to further protect customers, we will be disabling SSL 3.0 to fully address this issue.
How do I know if we are ready for this change?
  After Salesforce disables SSL 3.0 encryption, any channels connecting to Salesforce will need to use TLS 1.0 encryption or higher. There are three different channels that require encryption to access Salesforce: internet browser, API (inbound) integrations and call-out (outbound) integrations. Here is an overview of each:

Internet Browsers: By default, all browsers supported by Salesforce have TLS 1.0 enabled. You and your users should not experience an impact accessing Salesforce in your browser(s) unless you are either using a non-supported browser or you have disabled TLS 1.0 in the browser. To quickly test your browser compatibility, you can visit https://developer.salesforce.com, which has SSL 3.0 disabled. If you are able to view the site without errors, access to Salesforce via your browser should not be impacted by this change.
  Internet Explorer (IE) 6, which is not officially supported by Salesforce, is capable of handling TLS 1.0 encryption, but it is not enabled by default. If you have users on IE 6 and would like assistance on how to enable TLS 1.0, please log a case via the Help & Training portal.
API (inbound) Integrations: API Integrations are interfaces or applications that are separate from Salesforce, but use Salesforce data. If you have any API Integrations, please ensure TLS 1.0 encryption or greater is enabled in the integration.
Call-out (outbound) Integrations: Call-outs are integrations where Salesforce refers to an outside source to either verify login credentials or pull data. Examples of call-outs include: Delegated Authentication Single-Sign-On (SSO), Outbound Messaging and Apex call outs. If you use call-out integrations, please ensure TLS 1.0 encryption or greater is enabled in the integration.

What action do I need to take?
  In order for users to continue to have seamless access to your Salesforce orgs, you need to ensure their browsers and integrations have TLS 1.0 encryption or higher enabled. If your browser or integration does not have TLS 1.0 or higher enabled after we make this change, then your users will not be able to access Salesforce.
  Additionally, we recommend you disable SSL 3.0 encryption in your own IT environment as soon as possible, unless you use call-out integrations. If you use call-out integrations, and you have not already disabled SSL 3.0, we recommend that you wait until after we have disabled SSL 3.0 for outbound requests in our environment.
When will Salesforce disable SSL 3.0 encryption?
  Salesforce plans to disable SSL 3.0 encryption according to the following schedule:
  For Inbound Encryption Requests (Internet Browsers and API Integrations)
Instances
  SSL 3.0 Disable Schedule
  All Sandbox InstancesFriday, November 7, 2014
  NA17, NA19, NA20Friday, November 14, 2014
  NA2, NA4, NA13, NA15, NA16, EU0, EU2, EU3Friday, November 21, 2014
  NA7, NA8, NA9, NA10, NA11, NA12, NA14, EU1Friday, November 29, 2014
  NA0, NA1, NA3, NA5, NA6Friday, December 5, 2014
  AP0, AP1Monday, December 15, 2014
For Outbound Encryption Requests (Call-out Integrations)
   Instances
  SSL 3.0 Disable Schedule
  All Sandbox InstancesWednesday, December 3, 2014
  All Production Instances Wednesday, December 10, 2014
Where can I get more information?
  You can review this Knowledge Article for more information. If you have any questions, please reach out to your Salesforce contact or log a case via the Help & Training portal.
Comment: @BaskaranS Since it is Salesforce calling out to SAP you need to ensure that the hosted SAP web services support TLS 1.0 at a minimum. Ideally they would also support higher versions such as TLS 1.2. This will ensure you will continue to receive callouts from Salesforce when SSL 3.0 support is turned off.  To be more secure you could be proactive and turn off SSL 3.0 support sooner. Try scanning the current service with https://www.ssllabs.com/ssltest/analyze.html
Comment: @BaskaranS Actually, I'd belay removing SSL 3.0 support if Salesforce is calling out it it. You could be connection errors until they completely remove support of the 10th of December. See [SSLv3 Poodle vulnerability & outbound messaging](https://developer.salesforce.com/forums/?id=906F0000000AmTZIA0)
Comment: Hi @Daniel Ballinger , we are making callouts to SAP system and get data from there. What changes should i made to SFDC side as well as SAP side? Please clarify it is very urgent for us so that we are in a position to tell our client.
Comment: Thanks a lot @Daniel for the nutshell information which i think definitely would help me in this issue. Thanks again.
Comment: I will appreciate if any one can refer me to the SF documentation where it is explicit that it uses only TLS as encryption protocol for callouts, I mean specifically: SF invokes a external/public web service (WSDL). Thanks


Can I hide date field if older than a certian time using Rules?

Question: I want to know if I can hide the values of a date field if the values are older than a certain time. The website is built with Drupal 7, and Display Suite.
Comment: I don't think Rules are the tool you need. Why do you ask specifically about Rules?
Answer: Use the Conditional Fields  module.

Conditional Fields allows you to manage sets of dependencies between fields. When a field is "dependent", it will only be available for editing and displayed if the state of the "dependee" field matches the right condition.
Comment: Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Comment: Hello MPD. No offense, but if someone knows Drupal slightly, then the link to the Conditional Field's module page is more than enough to get him/her started. The concept is simple and quite straight forward and the module's page has a link to the module's documentation page. Furthermore, there are numbers of [contributed modules that integrates with Conditional Fields](https://drupal.org/node/1645232) including the Date module. Whether of not the answer has enough reference, let Ghost be the judge.
Comment: The thing is, link-only answers are considered bad ones.  This isn't a unique policy here; it is pretty much the same at all Stack Exchange sites.  Links are acceptable (and encouraged), but they should support an answers, and not just be the answer.  Other sites will delete them outright.  Answers needs to be able to stand on their own.
Comment: We tolerate them somewhat, but at a minimum when recommending a module, we like people to quote the relevant portion from the project page (like how @FreeRadical edited in).  Ideally, some additional information on how it will solve the OPs question would  be nice, it it can't be gleaned from the excerpt.
Comment: Can you explain how I can do that with the Conditional Fields module as I haven't used it before.
Comment: Thanks MDP. I will edit my response to make it more verbose.
Answer: The field formatter conditions module allows you to configure your field formatters with various conditions.
One of the included conditions is "Hide date field if from/to has expired", which should cover your requirements.
The module also has rules integration, but that shouldn't be needed for your requirements.
[EDIT] Actually it only allows working based on current time, not an arbitrary time.
Comment: Note that the module needs some work on timezone handling for fields where you are displaying the date in a different timezone than UTC. See https://drupal.org/node/2240123


Spellcasting Multi-class options for level 3 Tiefling Paladin (Oath of Vengance)

Question: What spellcaster multiclass options exist for a level 3 tiefling paladin, oath of vengeance, ideally the character should be able to still wear armour and have access to more spells/spell-slots than a normal paladin.
Comment: No spellcasters (except possibly Druid) will take away your ability to wear heavy armor, and all spellcasters will give you more spells and spell slots. You may want to narrow your criteria.
Comment: Hello and welcome! If you have time you can take the [tour] to find out more about the site. Unfortunately, this question appears to be asking for suggestions which is incompatible with our stack format. As it stands I think it risks being closed for being opinion-based. We do provide a [list of forums](https://rpg.meta.stackexchange.com/q/5449/33707) which are more suitable to this sort of question. Happy gaming!
Comment: Are there more narrow criteria you can give us?
Comment: You've asked about multiclassing options and spell slots, all mechanical stuff, then mentioned at the end that pure paladin isn't working "for roleplaying purposes"; to properly answer this question, as it stands, we would need to know what about a pure paladin is affecting your roleplaying intentions to know what kind of spellcaster to suggest, or possibly to frame challenge the question and address the roleplaying directly.
Comment: Your question does not have a "right" answer, even after the edit. Good is entirely subjective, and this will just result in a bunch of list answers. What might work to get your question not closed is to define clearly what you want the character to do and why pure paladin isn't working for you, but even then, the odds are it'll still be opinion based.
Answer: Charisma based casters...
Your paladin likely already has a decently high charisma, as many of their attributes scale of charisma. As a result, you will want to multiclass into a charisma-scaling caster, which leaves you with three good options.
...Sorcerer, Bard or Warlock
All these classes scale with charisma. You can already wear armor as a paladin, you will not lose this ability if you multiclass into something else. There is however one thing you will need to remember:
Somatic & Material components
Many spells require material or somatic components, which makes wearing a shield difficult for your multiclassed paladin. The War Caster feat will bypass this problem for somatic components, but the material component will remain an issue, and you'll either want to not have two occupied hands, or pick only spells that lack a material component.
Comment: A humorous result of your edit: "Leaves you with two good options: Sorcerer, Bard Or Warlock"
Comment: Yes Bard seems very appropriate, college of Valor would mean I'd get the extra-attack and synergises well with smiting etc
Comment: Counting is for silly people! And while that is true, @KorvinStarmast, that would not work for spells from other classes. It only works for paladin spells. (Well, and cleric, who have a similar option.)
Answer: Sorcerer, Warlock or Bard
Sorcerer
is kind of the default option, with very good synergies. Quicken Spell (Metamagic) is huge.
Warlock
gives you even more smites, depending on how many short rests your DM allowes.
Bard
gives you the best spell options, including Healing Word.
Levels
You seem to be eager to take a different class, so multiclass at the next opportunity. However, after that I would return to Paladin until I get Aura of Protection. It is that good. Also Extra Attack would be sorely missed.


two verbs, past participle used as attribute

Question: Can I say, for instance, "[some people] conducted research supervised and guided by the committee"
Is it grammatical that there are two verbs?
Answer: You can use as many verbs as you like, although too many will look awkward. Some people conducted research sponsored, designed, supervised, monitored, guided and appraised by the committee. Police said a man was 'lucky to be alive' after being slapped, punched, kicked, stabbed, shot, and burned by a gang of thugs.


eigenvalues of sum of tensor product of matrices

Question: Lets say $A, B$ are  rank 1 hermitian real matrices. It follows immediately that $A\otimes A$ and $B\otimes B$ individually are rank 1. My question is how does the largest eigenvalue of $A+B$ relate to the largest eigenvalue of $A\otimes A+B\otimes B$. I have phrased the question as if A,B are 2 by 2 matrices, but I would like to know the intuition in general for arbitrary dimensions. Any references would also be appreciated!
Answer: As $A$ is rank-1 Hermitian, its only nonzero eigenvalue is $a=\operatorname{tr}(A)$. Define $b$ similarly for $B$.
Weyl's inequality states that if $X$ and $Y$ are Hermitian matrices of the same sizes, and $\lambda_k(\cdot)$ denotes the $k$-th smallest eigenvalue of a matrix, then
$$
\lambda_k(X)+\lambda_\min(Y)\le\lambda_k(X+Y)\le\lambda_k(X)+\lambda_\max(Y).\tag{1}
$$
It follows that
$$
\max\left\{\lambda_\max(X)+\lambda_\min(Y), \ \lambda_\max(Y)+\lambda_\min(X)\right\}\le\lambda_\max(X+Y)\le\lambda_\max(X)+\lambda_\max(Y).\tag{2}
$$
Now, as $a$ is the only nonzero eigenvalue of $A$, we have $\lambda_\max(A\otimes A)=a^2$ (even when $a$ is negative) and $\lambda_\min(A\otimes A)=0$ and similarly for $B\otimes B$. So, $(2)$ gives
$$
\max\{a^2,b^2\}\le\lambda_\max(A\otimes A+B\otimes B)\le a^2+b^2\tag{3}
$$
and both bounds are sharp: the lower bound is attained when $A=\operatorname{diag}(a,0,0,\ldots,0)$ and $B=\operatorname{diag}(0,b,0,\ldots,0)$, while the upper bound is attained if take $B=\operatorname{diag}(b,0,0,\ldots,0)$ instead.
Note that the eigenvalues of $A\otimes A+B\otimes B$ are not solely determined by $a$ and $b$. More specifically, by spectral decomposition, we can always write $A=auu^\ast$ and $B=bww^\ast$ for some unit vectors $u,w$. Let $w=cu+sv$ for some unit vector $v\perp u$. By picking some appropriate phase angles for $w$ and $v$, we may assume that $c$ and $s$ are real nonnegative and hence $s=\sqrt{1-c^2}$. So, by a change of basis, we may assume that
$$
A=\pmatrix{a&0\\ 0&0}\oplus0,\quad B=b\pmatrix{c^2&sc\\ sc&s^2}\oplus0.
$$
It follows that $c = \sqrt{\dfrac{\operatorname{tr}(ABA)}{aba}}$. Therefore, the eigenvalues of $A+B$ and $A\otimes A+B\otimes B$ are completely determined by $a,b$ and $c$.
Comment: Thanks for your detailed answer. Just to ensure we are on the same page, suppose a=b=1, then the eigen values of A+B are (1-c),(1+c)? (because the trace of A+B is 2 and the determinant is (1-c^2)). ALso could you give a little bit more information about the last step on how you could write A and B in terms of the direct sum of matrices? I sort of lost you there.
Comment: @Annonymous I don't get your comment. Why is the determinant of A+B equal to $1-c^2$?
Comment: Sry, that isnt right, determinant of A+B is ofcourse 0 cause it involves a direct sum with the 0 submatrix. The top left 2 x 2 submatrix has trace 2 and determinant $1-c^2$
Comment: @Annonymous I see. Yes, the only two possibly nonzero eigenvalues of $A+B$ are the two roots of $x^2-(a+b)x+ab(1-c^2)$. In the particular case where $a=b=1$, they become $1\pm c$. So, you see, they are not determined solely by $a$ and $b$. You also need $c$. The case for $A\otimes A+B\otimes B$ are similar. In an appropriate basis, it is the direct sum of a zero block and a $4\times4$ matrix, whose entries are determined by $a,b$ and $c$. So you also need $c$ to calculate its eigenvalues.
Comment: And you cannot infer its eigenvalues from the eigenvalues of $A+B$ because $A+B$ has only **two** nonzero eigenvalues, but you need **three** parameters a,b,c to determine the eigenvalues of $A\otimes A+B\otimes B$. In this sense, getting an inequality is the best we can do.
Comment: THanks for your replies. Before I accept your answer, could you enlighten me if the technique you mentioned (by decomposing into orthogonal subspaces), works in general if we had many matrices or wanted to analyze eigenvalues of $\sum_i A_i$ versus eigen values of $\sum_i A_i \otimes A_i$?
Answer: This is not a full answer, but I wish it can help.
Let $\lambda_{max}$ be the largest eigenvalue of $A+B$,
and  $\Lambda_{max}$ be the largest eigenvalue of $C=A \otimes A + B \otimes B$.
I have done extensive simulations (see Matlab program and accompanying figure: stars for $\Lambda_{max}$, circles for $\lambda_{max}$): something general and interesting can be conjectured about a certain threshold situated here around $s=1.75$, yielding broadly two cases:

either $s\leq\lambda_{max}\leq\Lambda_{max}$ or the reverse situation:
$\Lambda_{max}\leq\lambda_{max}\leq s$.
But this classification suffers exceptions that should be analysed in a more thorough manner.

Did you have a similar conjecture ?

The part of analysis I have done is as follows (but I have not enough time to devote to it).
The term hermitian can be replaced here by symmetric $n \times n$.
$A$ and $B$ being rank one, their resp.  spectra are $\{\lambda_A,0,0,\cdots,0\}$ and $\{\lambda_B,0,0,\cdots,0\}$ ($n-1$ zeros) with $\lambda_A,\lambda_B$ real because they are symmetric.
$A+B$, in general is thus a symmetric rank 2 matrix, meaning that it has two non zero real eigenvalues.
The spectra of $A \otimes A$ and $B \otimes B$ are thus resp. $\{\lambda_A^2,0,0,\cdots,0\}$ and $\{\lambda_B^2,0,0,\cdots,0\}$ (with $n^2-1$ zeros),  meaning that they are both rank 1 matrices.
Their sum $C=A \otimes A + B \otimes B$ is thus a rank 2 matrix in general.
Here is the Matlab program and (below) the graphical display
clear all;close all;hold on
i=complex(0,1);
for k=1:50
U=rand(3,1);
A=U*U';
KA=kron(A,A);
V=rand(3,1);
B=V*V';
KB=kron(B,B);
eKAB=eig(KA+KB);
I=find(abs(eKAB)>0.01);
LKAB=eKAB(I)';
eAB=eig(A+B);
I=find(abs(eAB)>0.0001);
LAB=eAB(I)';
plot(k*i+max(LAB),'or');
plot(k*i+max(LKAB),'*b');
plot(k*i+[max(LAB),max(LKAB)])
end;
Comment: Thanks for your answer. I am not quite sure I follow your 3 observations earlier on. From where did you get this  1.75, doesnt this constant seem too specific for a rather generic question of mine? I had conjectures similar to what you mention, but I wanted something more specific actually like the answer earlier by @user1551.
Comment: I agree for the 1.75 which indeed is very specific to the range of values of the entries of matrices $A$ and $B$ (it is the meaning of the word "here"). If I have confirmed a conjecture that you have done, at least, this has not been done for nothing...


Can "dislike" be used when you disagree with something

Question: Can the word "dislike" be used to disagree with a statement? Sometimes I've seen people write "I dislike that" after someone made a statement, and I don't understand if that means that they agree with the statement but they don't like/hate the fact that the statement is true (i.e. the true meaning of the word), or if it means that they do not agree with the statement. For example:
"He looks better on instagram."
"I dislike that."
I am not a native speaker so I don't know if it's common to say like this, I tried to google it but I couldn't find anything that supported that would be the case.
Comment: It's more usual to say "I don't like that". But it's fairly obvious what is meant either way. ("that" could theoretically refer to Instagram rather than the fact just stated, but you have to work that out by context and tone of voice.)
Answer: Normally, dislike means

to not like; to find someone or something unpleasant, difficult, etc.

and can be used to express that you although you don't like something, you still have to do it or go through it:

I dislike the idea of leaving him home alone all evening. (but I have to)
(Cambridge)

or that you don't agree with/favour a certain idea, attitude, policy etc. I dislike that is a variant of the collocation I dislike the idea (of doing something):

The outlook for those who dislike the idea of purchasing a conventional annuity is good.
Times, Sunday Times (2007) (Collins)

I dislike that is definitely a way of saying I disagree. The situations where you would freely choose something you dislike are rare, if any, only constraints will dictate such a choice.
M-W shows a connection between dislike and disapprove (which has disagree as a synonym among others):

dislike [verb]: to regard with dislike : DISAPPROVE

The tendency to answer with I dislike that must be new and not too common, as GNgram finds too few instances of it in comparison with I disagree.
Comment: Italy won the Eurocup over England. I might dislike that but, sigh, I cannot disagree.  (Strikes me that this might be the least appropriate group EVER for sports examples.)
Comment: @Royster Your example is very good, it explains what I said: here the result of the match that is already finished and can no longer be changed, constrains you to accept it as a reality and agree with it, though you dislike it.
Comment: "I dislike that is definitely a way of saying I disagree. The situations where you would freely choose something you dislike are rare, if any, only constraints will dictate such a choice." Is this definite? Do we have specific examples?
Comment: @GArthurBrown I think I had in mind cases where the possibility of choice is there. Unless you are constrained by some accomplished reality or circumstance, "I dislike that" and "I disagree" are close in meaning. Certainly, one could say that "dislike" has a more subjective, emotional connotation (of not liking something), whereas "disagree" is more cerebral.
Comment: @fev Without an example, I have no idea where these would be equivalent. "This policy will lead to widespread poverty." "I dislike that. That's a negative feature of the policy." "I disagree with that. The policy will actually reduce poverty."


about using "ing" after to

Question: is that correct to say "in order to optimum tracking the route"? I mean when we have another word between "to" and "verb", could we use the infinitive form of the verb (verb+ing)?
Comment: You can use "to+ing" when *to* is a preposition. "Guide to learning English" for example.
Answer: No, it would not be correct to use a verb ending with with "ing" in this context. Infinitives do not actually end in "ing", I believe you are thinking of a gerund. An infinitive is the basic form of a verb, such as "to see" or "to walk". So yes, using an infinitive here is fine!
However, you should change the order of the words a bit. An example sentence would be "... in order to provide optimum route tracking."

about using "ing" after to


Edit the header tag in SFMC Content Builder template

Question: I am trying to edit the  tag in a template I've built in content builder but it's all locked down.
I need to add a tracking tax for a software we use in the header and also I wanted to call in a font hosted on our website that I need to call from the head tag.
Is there a way to unlock this?  I do not want to move to HTML paste, I want to build a template that others in the company can drag and drop into but I have to be able to get to this.
Any ideas?
Comment: Can you provide some more info on what you have tried? E.g. Where are you looking that you are finding it locked? Is it in the email or in the template?
Comment: The template. For example:
Content Builder>Create Button>Email>Create Method:Template>Blank Page>Select>enter name, description, etc>next>Code view tab.
Here is where I'd like to edit that head tag but there is a little lock icon there and I can't type anything.
Answer: After poking around with Content builder, I realized that what I needed to do instead was create a template, not an email.
By Clicking Content Builder>Create>Template>From Existing Template>Empty Tab>Blank Page>Select
I was able to edit the head tag however I want to.
Then, build the email with Create>Email>Template>Saved Tab>The tempalte I just made> drag in my content blocks and there you have it...


Ocean Monuments on Xbox One

Question: I'm playing minecraft on my Xbox One, and it recently received an update, adding all sorts of new blocks including wet and dry sponges. I have searched in vain for an ocean monument, and I would like to know, are there even any ocean monuments at the newest update for Xbox One?
Comment: Are you playing on a new world or is this a migrated old world?  old worlds that have been updated to the new update don't include newer features such as ocean monuments in their world generation.  Try creating a new world and looking on there.
Comment: I have explored on creative, and in new worlds, but I never find anything cool.
Comment: Dare i suggest that you google search for xbox 1 seeds containing ocean monuments?  Or do you not like using seeds found online?
Comment: I just googled quickly and saw a few seeds but i don't have an xbox 1 so couldn't test them :/
Comment: @Jcraft153 will you tell me what they are so I can test it? but put it in answer form so I can accept it.
Answer: This is a seed for an ocean monument for Xbox one edition, seed: - 6183297696734005648  I found this on the Minecraft Xbox one edition subreddit , https://www.reddit.com/r/MinecraftOne/ this is a reddit that you may also find usefull for any other questions you have as all the people there are xbox one  players. (I think!)  ~Jay
Comment: Ah!, there are 2 seeds on the specific page i looked at, the link is here

Ocean Monuments on Xbox One


Is there any way to record and play mouse click in Photoshop?

Question: I'm trying to record a jsx using Photoshop scriptlistener plugin. Is there any way by which I can record the mouse click and play it again using scripting? I'm using the latest version of Photoshop.
Comment: What is it that you're trying to achieve with that?
Comment: If you want to record your screen including your cursor, PS is not the right tool. Look for screen recording software and maybe an extra mouse highlight tool that visualizes clicks like Mouseposé.
Comment: @Joonas I want to record coordinates of mouse click relative to the image so that i can perform various operation at that particular point using scripting. Some of these operations are quick selection, brush stroke, etc.
Answer: I Believe you are referencing to something that photoshop already does, This is what's known as an action. If you record an action, you will notice that it should also record the mouse clicks too. I hope this helps you.
Please let me know if there is anything else I can help with.
Comment: I tried it and though it's not exactly what I need but  it somewhat solves my purpose. My requirement is to capture mouse click on a point on image so that I can use it with any tool to click again on the same point. With actions, I can record a click but it also captures the tool being used, so when I play the action again, same tool is used again. My requirement is that it should play the click with currently selected tool. Hope you can help me with that too.


MAP and MLE estimation

Question: i stumbled upon the following formula that describes making predictions based on the MAP estimate. i understand that we "plug in" in the MAP estimate in the predictive posterior, but i do not understand how we get from the second line to the third line, and why we lose the integral and the second term. could anyone help me understand this? Many thanks in advance
Comment: Could you at least cite _where_ you stumbled on this calculation, and provide some context for what the various symbols are?
Comment: I guess it is from the tutorial "ML, MAP, and Bayesian — The Holy Trinity of Parameter Estimation and Data Prediction" by Avinash Kak from Purdue University.
Answer: Addressing only the question you asked, it's because once you plug in the MAP estimate the first probability no longer depends on theta. Since it doesn't (and the integral is in terms of theta) you can pull it out of the integral and the resulting integral goes to 1, leaving you with the third line.
Comment: Why do we plug it only in the first probability? Shouldn't we plug it in both two probabilities and integrate with respect to it?

MAP and MLE estimation


How i can use Funcunit or Qunit to test my jQuery code in ASP.NET MVC?

Question: How i can use FuncUnit or qunit to test my jQuery code.Can anyone exaplain how i can use one of them to test the jQuery code i write ?
Answer: Funcunit is better for acceptance tests. It simulates user actions (mouse clicking, typing on a keyboard). Funcunit is an extension of QUnit.
If you realy need to test only your JavaScript code, in this case you can use e.g. Jasmine. It is faster then QUnit, because it doesn't manipulate with the DOM.
jQuery code is tested well, so you need not to duplicate this work by using of QUnit.


Best items to protect from stunning

Question: Looking for items 15k or less that protect a character from stunning.
Answer: Your best resource for this kind of thing will always be Ernir's Lists of Necessary Magic Items, the author of which goes by @Ernir around here.
One of the lists he mentions is for Stun negation, because

Why you need it: Stun is one of those conditions that makes you unable to act. Which means that when you're stunned, your character is a sitting duck, and you're sitting at the table counting cheetos.

All of his entries for this fall within your price limit:

Third Eye Clarity (MIC). 3000GP, face slot. Once per day, negate the Stun as an immediate action. Can negate other nasty stuff too. Great pick.

Talisman of Undying Fortitude (MIC). 8000GP, held. Swift action activation, gives you lots of undead immunities for 3 rounds, including stun.

Banner of the Storm's Eye (MIC). 15000GP, held or shoulders slot. Negates stunning and other nasty stuff for you and your allies. Top pick.

Wakeful Mind graft (FoE). 14000GP, slotless. Other minor benefits, including no longer needing to sleep. Also makes you slightly less healthy and less knowledgeable, but that's the price you pay for having robot components embedded in your head.
Comment: @Ernir If you happen to stop by and see this, I would be happy to delete this in favor of your own answer. After all, I'm just reporting your work—you deserve the rep far more than I.

Best items to protect from stunning


Word Count Historical Fiction for Adults

Question: I am writing Historical Fiction for Adults.
What is the acceptable word limit.
Some places say 80K to 100K
Others say 150K
If it matters, I plan to submit to publishers who accept manuscript WITHOUT agent.
Answer: Novels, like movies, seem to be getting longer. This is not a criticism; it's merely an observation.
Ten years ago, I would have told you that a novel is anything of 80k words or more. Novellas are typically 50k words or less, and short stories are usually around the 10k mark.
But, I have read some books in recent times that were easily 150k, closer to 200k words. And these have been parts of a trilogy or series of other length. Some of these books are excellent. Others could have used a really good prune.
Here's my view, for what it's worth. Write your story first. Write it well. Then, count the number of words.
If you're at 60k, think about your story. Think about what character development you didn't do that you really wanted to, or what side plots would add context to your story, etc. Then write them.
If you're at 250k words, test whether or not your story needs to be that long, or alternatively whether it needs to be a single book.
Word counts are really good at defining whether the story we've told is a marketable product or not; if it doesn't fit within certain parameters, people might not want to buy it to read it. But, word counts are not a good indicator of whether we have a good story or not. That is a different matter entirely. Of course, your story won't get out there if we don't pander to the marketing and publishing groups, so you may have to tweak. You may have to add more context to your story to make it pass a publisher's thud test. On the other hand, you may have just written your sequel at the same time as the original novel. Either way, it shouldn't fundamentally change your story.
Check with the publishers, see what they publish. Check the average word counts. That will tell you what you really need to know. Don't send a publisher whose largest book was only 100k words a manuscript with 150k, unless you're absolutely sure it's really good. They probably have a bias against long books, thinking them as not getting to the point. Also, vice versa is also true, as some publishers probably don't think short books do justice to the character development.
In that sense, sending a manuscript to a publisher is very much like speaking in public; the first and most important rule is to know your audience, and pitch to them in language they are most comfortable with. Do that, and if your story is good, it will get published.
Answer: Typically novels are 50,000 words at minimum (per National Novel Writing Month's rules for the contest) though most publishers will look for more length than that to go with.  There is no hard rule on the minimum thought and as always, you should be focusing on telling the story you want to tell, not the length of the story or how much you should pad it to reach novel status.
Novellas are typically 10K to 50K and Short stories are under 10K.  Flash Fiction is anything under 1,000 words and Drabble is anything under 100 words.  The last two are more contest challenges to maximize story with minimum words.


IV applied to Buying Vs. Selling Option Contracts!

Question: Is low IV (Implied Volatility) good for selling or buying options?
Comment: More important than IV is liquidity. If you're looking to trade options, you want to be sure you can open/exit positions easily and efficiently.
Answer: It's not really "good" or "bad". Low IV simply means that the market does not expect the stock to move as much as one with higher IV.
You could think of options with low IV to be "cheap" since they have less excess cost over their "intrinsic" value, meaning what the option would pay off if it were exercised today, but that isn't always "good". It can be good if you buy the option "cheap" and the option's IV increases, meaning the options get more expensive, but that's only one factor. If you buy a "cheap" call option and the underlying price drops, that drop may reduce the value of the option more than any change in IV, and you would still have a loss.
On the other hand, options with higher IVs have larger probabilities (according to the market) of larger moves, making options like deep out-of-the-money options more likely to end up profitable.
So in general a lower IV can make options less expensive (versus equivalent options with higher IV), but it doesn't guarantee profit by any means.
Comment: Thanks guys. You've been really helpful.
Answer: Low IV - compared to what?
If you believe IV is low compared to HV over some time frame, it makes sense to buy low, sell high by going long vega, i.e. buying calls and/or puts.
Conversely, if you believe IV is relatively high you might want to sell options.
Answer: It is all relative.
Comparing IV to historical vol (HV) - also called realized volatility (RV) - is not necessarily useful for at least two reasons:
1 ) Empirically, IV tends to overestimate RV, commonly referred to as Volatility Risk Premium
2 ) IV is the only free parameter in the Black-Scholes-Merton (BSM) model. Higher IV  can be a result of compensation for tail risk.
Explanation
For 1 ), a simple explanation is that market participants tend to overestimate the likelihood of a significant market crash, which results in an increased demand for options as protection against an equity portfolio. This can be exploited, as for example demonstrated in Sullivan, R., Israelov, R., Ang, I., & Tummala, H. Understanding the Volatility Risk Premium. The authors show that the returns of an investor who sells the same 5% out-of-the money put option every month, delta hedges it and holds it to expiration generated 1.5% annualized returns with a Sharpe ratio of 0.68. Compared to the S&P Sharpe Ratio of 0.32 over the same observation period (1996-2016), this is an attractive strategy.

2 ) BSM asserts that IV is constant, and returns are normal. Both assumptions are unrealistic. However, option markets correct for this with the IVOL skew (smirk, smile). You can see some interesting examples on Voladynamics Website. If you have access to Bloomberg, OVDV is your get go tool (for FX, Commodity and Equity, Indices, Futures; for CDS Options it would be OMON, for IR it is VCUB).
A less sophisticated approach of fitting IVOLs compared to voladynamcis is the SABR model. The gif below uses Julia and the formulas 2.17 onwards from Hagan et al (2002, p. 89). In case you are interested in programming, you can find the code and details about the model here. Essentially, α mainly controls the overall height, ρ (correlation) controls the skew (for set beta) and ν (vol of vol) controls the smile.

In equity, it is not uncommon to see ATM 1M IVOL to be ~20-25, whereas 80% moneyness is  >70%. Looking at current IVOL at 80% moneyness in an isolated manner will tell you close to nothing about (expected) RV. For each strike and maturity there is a different implied volatility. This could be interpreted as the market's expectation of future volatility between today and the maturity date in the scenario implied by the strike.
What can be done to figure out if current IV is an outlier
You can get all sorts of relative comparisons from the vol surface. Empirically, IV does seem to be mean reverting and as such, large deviations will usually mean you will get back to the mean.

you can rank current IV (for several moneyness levels) in percentile of IV over some predefined period
you can fit a vol surface and compare individual option IV against the vol surface (fitting, especially for American options is difficult because put call parity does not hold and implied forwards and dividends are difficult to get - even if you have a well-defined vol surface, outliers may in fact just be a result of stale data or indicative quotes that you cannot execute)
you can look at risk reversal and butterfly vols (for several deltas for example 25D and 10D) to get an idea of skewness and kurtosis levels
you can compute implied correlations from ATM IV (in FX it is common to use the Law of cosines and Volatility Triangulation for example)

If you have access to Bloomberg, you can check VCA, which displays all of the above, tickerized to run it on a chart (GP) or in historical spread analysis (HS). For example, SPX 3M IC BVOL Index DES for implied correlation
SPX 3M RC  BVOL Index DES for realised correlation
You can use those in HS: SPX 3M IC BVOL Index SPX 3M RC BVOL Index HS
Products to consider:

Straddles: the price of a straddle is equal the mean absolute deviation (MAD) of the stock price, as a result the Straddle Price = 0.8 * Implied Vol * √(DTE/252) * Stock Price. The 0.8 is the mean absolute deviation of the normal distribution (the proof can be found here. If you are long, the straddle becomes more valuable when the underlying market moves away from the exercise price. You also exhibit the following characteristics.

+Gamma (desire for movement in the underlying contract)
–Theta (the value of the position declines as time passes)
+Vega (the value of the position increases as implied volatility rises)

Risk Reversals: if skewness is particularly pronounced, it may revert back to normal

...

Overall, options trading is very complex, and seldom profitable if not done with great care. I recommend Sheldon Natenberg as a very good, yet very simple book about volatility strategies. The figure below is from his book and relates the aforementioned results to more structures.


VIP Alert Notification

Question: Is there a way to set up VIP Alert Notifications to allow the sound even when my iPhone is on silent? I want to be able to receive notification of VIP emails during the night, but do not want the bother of a notification from someone calling/texting me.
Answer: As of iOS 11, you can only allow phone calls from specific contacts through a global silent mode (Do Not Disturb).
This is defined under Settings → Do Not Disturb → Allow Calls From.
There is no exception list for Emails or Messages yet, even though this feature has been requested for years.

VIP Alert Notification


Copy from one MySQL table to another MySQL table of same database

Question: I have around 40 million rows in a MySQL table and I want to copy this table to another table in same database. What is the most efficient way of doing this? How much time will it take (approx.)?
Comment: What is the Engine of your table ?
Comment: InnoDB Engine..
Answer: Suppose you have mydb.mytb and you want to create mydb.mytbcopy
I have five(5) approaches to doing this copy
APPROACH #1
In the mysql client, run the following
USE mydb
CREATE TABLE mytbcopy LIKE mytb;
INSERT INTO mytbcopy SELECT * FROM mytb;

APPROACH #2
MYSQL_USER=root
MYSQL_PASS=rootpassword
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
mysql ${MYSQL_CONN} -ANe"CREATE DATABASE IF NOT EXISTS test"
mysqldump ${MYSQL_CONN} mydb mytb | mysql ${MYSQL_CONN} -Dtest
mysql ${MYSQL_CONN} -ANe"ALTER TABLE test.mytb RENAME mydb.mytbcopy"

APPROACH #3
DUMPFILE=/some/path/tabledata.sql
MYSQL_USER=root
MYSQL_PASS=rootpassword
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
mysql ${MYSQL_CONN} -ANe"CREATE DATABASE IF NOT EXISTS test"
mysqldump ${MYSQL_CONN} mydb mytb > ${DUMPFILE}
mysql ${MYSQL_CONN} -Dtest < ${DUMPFILE}
rm -f ${DUMPFILE}
mysql ${MYSQL_CONN} -ANe"ALTER TABLE test.mytb RENAME mydb.mytbcopy"

APPROACH #4
MYSQL_USER=root
MYSQL_PASS=rootpassword
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
mysqldump ${MYSQL_CONN} mydb mytb | sed 's/mytb/mytbcopy' | mysql ${MYSQL_CONN} -Dmydb

APPROACH #5
DUMPFILE=/some/path/tabledata.sql
MYSQL_USER=root
MYSQL_PASS=rootpassword
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
mysqldump ${MYSQL_CONN} mydb mytb | sed 's/mytb/mytbcopy' > ${DUMPFILE}
mysql ${MYSQL_CONN} -Dmydb < ${DUMPFILE}
rm -f ${DUMPFILE}

ANALYSIS

APPROACH #1 is the easiest in terms of steps, but requires pushing 40 million rows into one transaction. This will be the most taxing on the InnoDB Storage Engine.
For the other approaches, mysqldump will send 40 million row in chucks of thousands of rows

APPROACH #2 and APPROACH #3 will mysqldump the table into the test database. After creating the table in the test database, it is subsequently renamed and moved into the original database
APPROACH #4 and APPROACH #5 rename the table using sed against the stream coming from the mysqldump as it echoes the INSERT commands
APPROACH #2 and APPROACH #4 use pipes instead of an output file
APPROACH #3 and APPROACH #5 use an outpuit file for subsequent reload

If you want to copy mydb.mytb to an already existing table mydb.mytbcopy, and the two tables have identical structures:
APPROACH #6
INSERT INTO mytbcopy SELECT * FROM mytb;

Like #APPROACH 1, #APPROACH 6 would have a single transaction of 40 million rows
APPROACH #7
MYSQL_USER=root
MYSQL_PASS=rootpassword
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
mysqldump ${MYSQL_CONN} -t mydb mytb | sed 's/mytb/mytbcopy' | mysql ${MYSQL_CONN} -Dmydb

This approaches does not drop the table. It simply generates the INSERTs
EPILOGUE
I cannot give you a time estimate since I do not know the make up of the DB Server, table structure, index layout, and things like these.
GIVE IT A TRY !!!
Answer: InnoDB tables, unlike MyISAM*, cannot be "just copied away", as part of its data dictionary (and potentially other structures the table is depending on, like the merge buffer) are located in memory (if the server is running) and in the common/main tablespace, a.k.a. that large file called ibdata1.
If you are using Percona Server >=5.1 or MySQL >= 5.6, there is support for transportable tablespaces, which allows you to export and import tables directly from the filesystem. Here it is the method for MySQL and for Percona. In both cases, it is required that you had created the table with the innodb_file_per_table option and involves the usage of DISCARD TABLESPACE/IMPORT TABLESPACE and/or Percona Xtrabakup (if you want the export to be done online). Please note that Percona Server or Xtrabakup are not available for Windows.
This method will be, speaking in general, as fast as copying the file using the filesystem commands (cp, rsync).
While there may be some cases that this could work in MySQL < 5.6 (in a hacky way) for restores, it will not work for a table copy. In those cases, one way to do it is by using SQL:
CREATE TABLE new_table LIKE old_table;
INSERT INTO new_table SELECT * FROM old_table;

This will be as fast as the InnoDB can execute  Handler_read_rnd_next and Handler_write, once per row. If you use this method, make sure that you disable, at least temporarily, the durability options and you have a large buffer pool and transaction log. Under those circumstances, it may reduce the importing time, but it definitely won't fit into memory fully, so expect a lot of time. Also, you are trying to import 40M rows in a single transaction, that may lead into problems.
My actual recommendation, in this second case, would be to use something like pt-archiver, as it will perform an operation similar to the one I just mentioned, but it will be done in "chunks", avoiding the transactional overhead (it may not be faster, but in the case of a failure, it won't try to rollback the whole table, taking forever). For the data sizes that you mention, this is probably the best way to go.
A final option would be to export and import using the CSV (or TSV) format, with a combination of SELECT INTO OUTFILE/mysqldump and LOAD DATA/mysqlimport. This was a very common option if you needed concurrency in certain old versions of mysql, as using sql created larger locks (not true anymore if done correctly). As mysqldump/import only works in a serialized way, I would recommend you to research options to parallelize it, very useful for large tables.
In any case, try to avoid multiple SQL sentences, as it will be your most important bottleneck if you execute many different queries (that have to be executed, parsed and optimized individually).

*MyISAM structures cannot be copied in a hot way, but it is very easy to sync them temporarily to disk with FTWRL.
Answer: to Move data from one table to another in schema
create table your_table_name select * from old_schema_table;


Why does Kurotsuchi Mayuri wear makeup?

Question: Is there some reason Kurotsuchi Mayuri in Bleach dresses the way he does, and wears a mask/makeup? Or is it just because he is somewhat crazy?
Comment: i think it's by choice. during the Rukia Rescue after loosing to Uryu and stabbing himself at the end we seem him reformed without his "makeup" and with blue hair and while i haven't seen up to it it appears later in the series he changes how his "makeup" looks and his blue hair is visible
Comment: @axel22 I think he just want to hide his scars, and he is somewhat crazy at his work. The scene in which Kurotsuchi Mayuri shows his scars is in chapter 172, around page 12-16. You can see them on this link http://mangafever.me/read2/bleach/172/14 .
Comment: Might just be to hide his scars.
Comment: Do you want to know how he got those scars?
Comment: No, but if you point me to the related episode/movie or manga, that'd be great. :)
Answer: Based on his demeanor, I think it's for psychological warfare purposes in order to frighten or intimidate his opponent. He's going for the whole "Otherworldly Mad-Scientist" vibe.
Comment: Please include relevant sources/references to support your answers.

Why does Kurotsuchi Mayuri wear makeup?


String to Byte or Char* in C++

Question: Okay, so I'm working on a memory editor in c++, I have a list of offsets and if I predefine what to change the offset too (0x68) then it works, but I was wondering if there was a way to convert string, as in, cin >> string, and it would split the string into bytes or char*s so it could use them in the offsets? Sorry if this doesn't make much sense.
Answer: The std::string class has two methods that can help you:

c_str(), that returns a \0-terminated char* string (AKA a "C"-style string);
data(), that returns the content of the string in a char const*, but without \0 termination; you have to retrieve the length separately with length() or size().
Answer: You can call c_str() to get a raw char array representing the string data as a c string.
Answer: You can use data() and memcpy() to copy all the bytes to another address, or access the bytes in the string by indexing the string object...
std::string x;
if (std::cin >> x) // note: read one whitespace-separated token, use getline for lines
{
    memcpy(p_dest, x.data(), x.size());  // to copy everything...
    // ...or...
    p_dest[offset] = x[i]; // copy one character, 0 <= i < x.size()
}

String to Byte or Char* in C++


Is there a word for a person that does things because people said they would be bad at it?

Question: Is there a word for a person that does things because people said they would be bad at it? Ex: The man was told he would be the worst husband in the world so he set out to be the best. I was told spite but there is no ill intention.
Comment: Hi Dylan, welcome to English Language & Usage. You might not be aware that there are strict rules for [tag:single-word-requests]: "To ensure your question is not closed as off-topic, please be specific about the intended use of the word. *You must include a sample sentence demonstrating how the word would be used.*"  You can add these details by clicking on the [edit] link.
Comment: @Kris Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.
Comment: @MetaEd There was never a thing that I considered an answer here. Your mileage may  vary. What I posted was a **comment** to me, with good reason. All said, you will probably not restore the comment. (I'm not saying "so be it" though.)
Answer: Contrary
As in "Mary, Mary, quite contrary". This might be relevant.
From Collins:

opposed in nature, position, etc: contrary ideas.
perverse; obstinate
(Nautical Terms) (esp of wind) adverse; unfavourable
(Botany) (of plant parts) situated at right angles to each other
(Logic) logic (of a pair of propositions) related so that they cannot both be true at once, although they may both be false together.

If someone was doing their best to prove me wrong, I'd say they were being contrary.
I'd also use perverse or obstinate as adjectives, too.
Unfortunately I can't see a way round the negative connotations. It seems that someone doing exactly the opposite of what is predicted/expected is inherently negative, even if there are no ill intentions. Another example would be to "defy expectations". "Defiance" also has less positive connotations.
Comment: or n. contrarian


Is there any content unavailable after beating the final boss in Breath of the Wild?

Question: Please keep the answer spoiler free if possible, I am curious how big the list of things to do before beating the final boss is if anything gets locked out after the final boss, or if the game reverts to a pre post game stage after beating the game.
Answer: No. After defeating calamity ganon, your save gets marked with a star, but will otherwise be reverted to where it was before you defeated calamity ganon.
Comment: fyi it doens't save weapon durability used in the fight.  I've broken weapons in that fight but got them back after the ending.
Comment: You also gain access to certain features after defeating ganon, so going for that star can be worth it
Comment: It might save weapon durability used in the fight, I don't know for sure
Answer: Your save reverts back to before the final battle (no, you don't get to keep the Bow of Light), except for one thing: any album pictures are saved. This means that you can get pictures of Calamity Ganon and Dark Beast Ganon naturally, as in without buying them from Purah.


How many ways are there to increase carrying capacity?

Question: How many ways, via feats, races, classes, etc are there to increase the carrying capacity of a PC?
Comment: You may also be interested in [this question.](https://rpg.stackexchange.com/q/57793/8610)
Comment: This question looks tedious but well-within scope. - from review.
Comment: ...I think this question is draining my reputation. Hey I Can Chan already answered it, so can I delete or something?
Comment: @user63468 Deleting a question once you have received an answer is discouraged as it also deletes the answers of the users you helped you, depriving them of reputation they deserve. It also goes against out mission to be a repository for knowledge. You have only received two downvotes, a downvote isn't the end of the world and cost less than a upvote gains you.
Answer: As a starter, this answer by HeyICanChan lists some items and spells:

The waist slot item belt of the wide earth (Magic Item Compendium 204).
The superior item framed pack (Arms and Equipment Guide 35, 36) - this is 3.0 material.
The illithid graft hauling back (FF 212)
The 2nd-level Clr spell lighten load [trans] (Dragon #317 78)
The feat Natural Heavyweight (Planar Handbook 40)
The feat Improved Encumbrance (Dragon #292 114)

The answer provides other ways to mitigate the effects of the load, such as using a Tenser's Floating Disc spell or using spells or items that let you be in light load even if you really should be in medium load.
These ways are not repeated here because they don't direclty answer your question, but I suggest you take a look at them all the same.
There are some spells, items or other conditions that were not relevant to that question, but are here.

Increase your Strenght
Quadrupeds gets a multiplier, and beasts with even more legs have better multipliers. Polymorph effects, some archetypes and some grafts can give you more legs.


How to make a skinnable application?

Question: Specifically, I want to know how the music player Muziic is skinnable.  Is it just image boxes in a panel that change depending on what the XML in the skin says? And how would I do something like this in C# or C++?
Answer: The very basic idea is that you would have some sort of user-editable configuration file.  This file could dictate things like textures to use for buttons/interfaces, or possibly even control positions.
when your app loads, you read the configuration, and set the properties accordingly.
It sort of depends on what your application needs to do, and what level of skinnability you need to provide
Answer: I've not got the answer but thought i'd let you know about a website that I came across when seaching for the same thing.
Take a look at Componentfactory.com.
You can download a free toolkit of controls that allow you to customise their look and feel. The look and feel can be changed dynamically using something called a palette which specifies how each control is drawn (with a common theme).
They have a very helpful forum answering questions on customising the code and the look and feel for your own use.
The source code is also available for a small price and may provide inspriation for your own work.
I have used this toolkit to create several applications and as relative novice in C# with deadlines to meet it has proved very helpful. Eventually I would like to take more control over the design of the controls - however the toolkit is pretty well done and would probably take a lot of time to match.

How to make a skinnable application?


Kohana ORM multiple relationships in models

Question: I'm new to this and working with a module in Gallery3 that has been abandoned and looking to add some functionality.  I've searched all over and haven't been able to find a solution.
I have the following tables.
Products {id, name, description, cost, discount_id, postage_id)
Discounts {id, name, threshold, amount, maxamount)
Postage_bands {id, name, flatrate, peritem)

I added the discounts to offer customers a discount based on amount spent.  I based it on the existing Postage table and copied the associated pages so they work with the new Discount functionality.  I want the admin page for the products to list which Discount and postage is associated with each product.
The admin pages for the Discounts work just fine.
What I am having problems with is the relationship between Products to Discounts and Postage.  I can only get one or the other working.
There are the models, each in their own file.
class Product_Model extends ORM {
  var $rules = array(
    "name" => "length[1,32]",
    "description" => "length[0,255]");
    protected $belongs_to=array('discount');
    protected $belongs_to=array('postage_band');
}

class Postage_Band_Model extends ORM {
    var $rules = array(
    "name" => "length[1,32]");
    protected $has_many=array('products');
}

class Discount_Model extends ORM {
    var $rules = array(
    "name" => "length[1,32]");
    protected $has_many=array('products');
}

The code in the views page that displays information relating to the Discount or Postage is
<?= html::clean($product->discount->name) ?>
or
<?= html::clean($product->postage_band->name) ?>

I can only get one or the other working by commenting out wither the Discount or Postage lines from the Products_model and the code to display it in the views page.
How can I get relationships of columns in one table to work with columns in two separate tables. In this case

Products.discount_id to Discounts.id, so I can point to the name field in the Discounts table.
Products.postage_id to Postage_bands.id, so I can point to the name field in the Postage_bands table.

or any other fields in those table if I need them.
Thanks in advance
Paul
Comment: Dont forget to accept correct answer
Answer: You are declaring $belongs_to twice. Try:
class Product_Model extends ORM {

    protected $belongs_to=array('discount', 'postage_band');
}

Also, I think it's $_belongs_to
Comment: Thanks, that solved the problem.  As for the "$_belongs_to" vs "$belongs_to", I'm not sure why, but Gallery 3 doesn't use the proceeding _.  When looking for the answer, I saw lots of posts where the _ was used and tried it, but didn't work at all.


Is there a way I can drag and drop files to applications in the dock using Gnome desktop environment?

Question: I am using the Gnome desktop environment and I see that it is lacking a lot of features that I think are not so hard to implement. One of these features is the ability to drag and drop files to applications opened in the dock. I simply want when I drag a file over an open app in the dock that the app gets displayed on the screen so that I can drop the file inside it. It is a very important feature for me and I think that it can be done with just a few lines of code. Also, another feature is the ability to see the opened windows of an app just by hovering with the mouse cursor on the app icon in the dock. So, is there any third party software or packages that do these functions? And if not, is there any guide on how to edit the Gnome source code to do so?
Answer: Well, Gnome itself doesn't provide any default dock. You are probably talking about some extension developed by the community, e.g. Dash to Dock or something similar. In that case, determine what extension are you using and create a new issue in the relevant issue tracker. It is always better to contact the developers first and only if they do not respond, create a question on the forums.
Comment: Yes, I am using das- to-dock extension
Comment: @ScientificMaster In that case you can ask [here](https://github.com/micheleg/dash-to-dock/issues).


In what episode of TNG is it established that Vulcan ships have no weapons?

Question: In what episode of TNG is it established that Vulcan ships have no weapons? Any other information on the Vulcan commitment to peacefulness and pacifism are welcome.
Comment: Just by a cursory search, I was able to find [Vulcan ships](https://memory-alpha.fandom.com/wiki/Vulcan_starship_classes) with weapons. Are you referring to a particular class or type of Vulcan ships?
Comment: If Vulcan ships had no weapons, how on earth would they manage to [say hello](https://memory-alpha.fandom.com/wiki/Vulcan_Hello)?
Answer: You are likely remembering
ST:TNG Unification Part 2
from http://www.chakoteya.net/NextGen/207.htm
The Bar Scene with the Ferengi weapons dealer...

RIKER: Commander William Riker, USS Enterprise.
OMAG: Am I supposed to stand up and salute?
RIKER: We're investigating the disappearance of a Vulcan ship.
OMAG: Well you've got the wrong Ferengi. I never trade in Vulcan ships.
RIKER: We know that you're involved.
OMAG: Who would want a Vulcan ship? Vulcans are pacifists. I deal in warships. Can somebody get me a napkin?
RIKER: Who would want a Vulcan ship?
OMAG: Hypothetically speaking?
RIKER: Hypothetically speaking.
OMAG: I never learned to speak hypothetical.

On Vulcan pacifism
ST:TOS The Savage Curtain
transcript from http://www.chakoteya.net/StarTrek/77.htm

SURAK: In my time on Vulcan, we also faced these same alternatives. We'd suffered devastating wars which nearly destroyed our planet. Another was about to begin. We were torn. But out of our suffering some of us found the discipline to act. We sent emissaries to our opponents to propose peace. The first were killed, but others followed. Ultimately we achieved peace, which has lasted since then.
KIRK: Circumstances were different then, Surak.
SURAK: The face of war has never changed, Captain. Surely it is more logical to heal than kill.
KIRK: I'm afraid that kind of logic doesn't apply here.
SURAK: That is precisely why we should not fight.
KIRK: My ship is at stake.
SURAK: I will not harm others, Captain.
SPOCK: His convictions are most profound in this matter, Captain.
KIRK: So are mine, Spock. If I believed that there was a peaceful way out of this
SURAK: The risk will be mine alone. If I fail, you lose nothing. After all, I'm no warrior.
SPOCK: The captain knows that I have fought at his side before and will do so now, if need be. However, I too, am a Vulcan, bred to peace. Let him attempt it.
KIRK: You saw how treacherously they acted.
SURAK: Oh, yes. But perhaps it's our belief in peace that is actually being tested.
KIRK: I have no authority over you. You may do as you think best.
Comment: The quote from TNG doesn't state that Vulcan ships don't carry weapons, it merely states that the Vulcan ships at that time aren't dedicated warships.
Comment: @KeithMorrison the original question is a false premise likely based on the episode quoted.
Answer: False they do have weapons. Although classified as science vessels, they can serve as war ships.  https://memory-alpha.fandom.com/wiki/Suurok_class
Comment: At the moment this is close to a link-only answer, could you [edit] in some supporting references?
Comment: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.  Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/183667)


Ruby on Rails capture webcam video and audio

Question: Is there any gem out there that can interact with users webcam to capture video and audio and upload it to the server?
Answer: Have you heard about navigator.getUserMedia()? That could the trick. More info: http://www.html5rocks.com/en/tutorials/getusermedia/intro/
They talk about it in the Mobile Web Development course in Udacity (lesson 10).
https://www.youtube.com/watch?v=j6mzYt5fJpg
Answer: Have you tried headshot ?
I just tried it yesterday, but ran into some trouble with the flash player, not beeing able to set permissions for camera use
try it out, its easy to add to your application, maybe you'll make it work.
and better backup your files before.


Why does lightning strike from the ground-up?

Question: The enlightening image below is of a lightning strike slowed down at 10,000 frames per second.   It can be seen that the most intense flash produced from the lightening occurs in the direction from the ground up.  Why does this final "ground-up" strike occur and why is it so much brighter and faster than the initial part of strike heading towards the ground?
Comment: With 2018 4k video technology, you can see the same thing in high definition. https://youtu.be/nBYZpsbu9ds?t=12
Comment: Those initial streamers are looking for a path of least resistance. When they find it; that stroke comes up from the ground.
Comment: I do want to answer this question and i can't !!! It is a highly active questionand needs 10 points experience to earn to answer this! Anyway the question is "Why does lightning strike from the ground-up" the most voted answer starts with "Does lightning strike from the sky down, or the ground up". Nice wiki answer but the question should be "Why does lightning strike from the ground up at this particular location in Earth and has it happened before?" Or "why does the downwards strike breaks into several paths but the upwards strike has a single path?"
Comment: consider also two things, electrical current is described as the flow from positive to negative but the opposite happens, electrons move. In addition electrical current when flowing metal resistors can heat up the metal (if the resistance is high) and change the color from a starting color of red until it reaches color white. Why do you actually think this does not happen to air? the more bright the spot the higher the resistance of the spot.
Answer:
Does lightning strike from the sky down, or the ground up?
The answer is both. Cloud-to-ground lightning comes from the sky down,
  but the part you see comes from the ground up. A typical
  cloud-to-ground flash lowers a path of negative electricity (that we
  cannot see) towards the ground in a series of spurts. Objects on the
  ground generally have a positive charge. Since opposites attract, an
  upward streamer is sent out from the object about to be struck. When
  these two paths meet, a return stroke zips back up to the sky. It is
  the return stroke that produces the visible flash, but it all happens
  so fast - in about one-millionth of a second - so the human eye
  doesn't see the actual formation of the stroke.
Source: National Severe Storms Laboratory

The reason is that when cloud-to-ground strike approaches the ground, the presence of opposite charges on the ground enhances the strength of the electric field and the "downward leader" strike creates bridge for the "return stroke"; this per the wiki page for Lightning.

Cloud to cloud and Intra-Cloud Lightning

Might be worth also noting that cloud-to-ground is not as common as Cloud to cloud (CC) and Intra-Cloud (IC):

Lightning discharges may occur between areas of cloud without
  contacting the ground. When it occurs between two separate clouds it
  is known as inter-cloud lightning, and when it occurs between areas of
  differing electric potential within a single cloud it is known as
  intra-cloud lightning. Intra-cloud lightning is the most frequently
  occurring type.

Ground-to-Cloud

Appears that ground-to-cloud is possible, though normally only a result of a man-made object creating "unnatural" electric potential, and is the least common type of lightning.
Comment: Appears that the reason is that when cloud-to-ground strike approaches the ground, the presence of opposite charges on the ground enhances the strength of the electric field and the "downward leader" strike creates bridge for the "return stroke"; this [per the wiki page for Lightning](http://en.wikipedia.org/wiki/Lightning#Upward_streamers). Also, appears that ground-to-cloud is possible, though normally only a result of man-made object creating "unnatural" electric potential.
Comment: although i do agree that cloud-to-ground lightnings are rarer, it seems a bit bold to affirm that they are "**normally only** a result of a man-made object creating "unnatural" electric potential". Do you have any sources for that affirmation?
Comment: +1 thanks for your answer.  I'll wait a few days to accept in case I get more specific answers on why the return flash is brighter and faster however.
Comment: @plannapus: See [Upward-moving lightning from TV towers, skyscrapers and other tall structures](http://stormhighway.com/tower.php) - also, FYI, you mean ground-to-cloud, not cloud-to-ground, right?
Comment: ah no i misread your sentence as talking about cloud-to-ground and not ground-to-cloud, my apologies.
Comment: This also explains why when you hair starts standing up on its own in a storm that is signalling it is time to go elsewhere (that E field has to come from somewhere, and you don't want to be in the vicinity of upward streamers that have the potential to become a CG strike).
Comment: This answer (and the other answers) don't seem to explain why the first movement is slow and downward, while the second movement is fast, bright and upward. There's interesting information there, but it doesn't seem to answer the question.
Comment: You actually see a ground to cloud lightning in this image? no such case here, sorry. Still ground to cloud do exist and many more fancy types of lightning, but not here. Take a better look in image please, don't be fooled by the light cause it only means more electrical resistance on that part of the ALREADY ESTABLISHED PATH.
Answer: Lightning happens when the potential difference between the clouds and the grounds becomes too large. Once the voltage reaches a critical strength, the atmosphere can no longer act as an electrical insulator. First, a stepped leader is created at the base of the cloud which is a channel through which electrons in the cloud can travel to the ground. But while moving towards the ground, it searches for the most efficient(minimum electrical resistance) route possible. It does so by traveling 50-100 meters at a time then stopping for about 50 microseconds, then traveling another 50-100 meters. In this process it also branches out looking for the best route. As the stepped leader gets close to the ground, a positively charged traveling spark is initiated on some tall object (trees, towers etc) on the ground. The traveling spark moves upward and eventually connects with the stepped leader. Once the stepped leader and the traveling spark have connected, then electrons from the cloud can flow to the ground, and positive charges can flow from the ground to the cloud. This is known as return stroke. But this flow unlike the flow from up has a well defined shortest route now. This massive flow of electrical current occurring during the return stroke combined with the rate at which it occurs (measured in microseconds) rapidly superheats the completed leader channel, forming a highly electrically-conductive plasma channel. The core temperature of the plasma during the return stroke may exceed 50,000 K, which makes it shine so bright.
In your image above as well, you can see a lot of time is lost in looking for the route, whereas the return stroke just runs through the well defined channel and hence is much faster.
Comment: "...and positive charges can flow from the ground to the cloud." Can you elaborate? What exactly is positevely charged and flowing? Positrons?
Comment: @Evgeni This is from semiconductor physics but I expect the principle is the same; [holes](http://en.wikipedia.org/wiki/Electron_hole) are the positively charged objects. An absence of an electron where there should be once can (in the right medium) behave as it is were a particle (with a mass etc)
Answer: In the video, the downward strike created an ionized path. The brightness was less as the current was less because it was travelling through un-ionized air. The upward strike took the ionized path. The upward strike's current (brightness) was much greater as the electrons flowed along the ionized path as it had the least resistance. The current equals the voltage divided by the resistance. The less the resistance, the higher the current.
The apparent speed difference is because the upward strike took a more direct path. The camera shows a two dimensional image and does not show the motion of the lightning away from or towards the camera. In a video when you see an object coming directly towards or away from the camera, you see the object get larger or smaller. The size differences in the video are not large enough to show the direction towards or away from the camera.
Comment: +1!!!! I was sure that that it was a depth issue, but didn't know for sure.
Answer: I'm pretty sure that lightning can go either way. We did the calculation in physics class, a bit of a back of the envelope calculation to be sure, but we came out with an electric field of 300,000 V/m being the electric field needed for lightning to form.
What that means is, an electric field is created between the clouds and the ground by a build up of electrons on one of the surfaces. I believe that the electron build up can occur on either side. Once the field strength gets high enough, electrons begin to "leak" from one side of the air-gap (air does not normally conduct electricity unless it is highly charged) and that is what lightning is. You see the same affect in a capacitor that is overcharged, only instead of a thin sheet of paper, you are inside the insulator between plates. That is why you get a lot of noise (thunder of course), see a lot of light, and wireless communications and some electronics are affected.
Comment: @SimonW I meant leaks as in electrons physically move from the one medium to the other, the way a capacitor leaks. I am unfamiliar with the mechanism or the state they are in when they move, only that it is the same mechanism as a capacitor, which is in my field of study.
Comment: Not quite - it's not so much that the charge leaks, as that the air ionises and becomes a plasma, which is highly conductive. So the charge flows. I'm not sure at exactly what stage this happens, though - whether it's just for the return stroke or whether the initial "feelers" use this mechanism too.
Answer: I won't repeat something provided in other answers. The only thing i would like to add is that we don't see a Ground To Cloud Lightning.
Theoretically speaking Ground To Cloud could be possible since lightning is a discharge between 2 points that have extreme voltage difference. So it is not a mystery "why this happens" as said in this video, but 'how this happens".
Is it a case of Geology of the location (like Lake Maracaibo or the lake of the thousand lightnings)? Yes and it is needed to examine more thoroughly since some effects do happen more frequently in certain geographical locations all it is needed to be understood is WHY (and it could be not just one factor).

Map of average yearly lightning strikes per sq km from 1995 to 2013 (Credit: NASA)

But to return to this picture

and please take a good look. Notice the bright flash on the top left corner at the beginning that spreads into several leaders reaching for the ground. No ground path been established until two of those leaders reach the ground. From those two paths one of them has less resistance leading to a momentary current path among the cloud and the ground. I do think that in this case we see a Cloud To Ground lightning but of these two types, positive and/or negative lightning on an already established path. The image is taken from an High Speed or Ultra High Speed Camera, capable of 10k-1m frames per second, what we see is very slow motion of a cloud discharge.
Furthermore one thing you should have in mind is that lightning is not just a static electricity discharge.

This discharge may produce a wide range of electromagnetic radiation,
  from very hot plasma created by the rapid movement of electrons to
  brilliant flashes of visible light in the form of black-body
  radiation. Lightning causes thunder, a sound from the shock wave which
  develops as gases in the vicinity of the discharge experience a sudden
  increase in pressure. Lightning occurs commonly during thunderstorms
  and other types of energetic weather systems, but volcanic lightning
  can also occur during volcanic eruptions. Wikipedia

Above is written that the discharge itself may produce wide range of electromagnetic radiation.
The majority of that radiation should be produced once the Cloud To Ground path has been established. In case we do have a combination of positive and negative lightning on that path then perhaps a differently filtered  view of this lightning (microwave, infrared, ultraviolet, or even X-ray range) would have been more enlightening.
I actually don't think that all the radiation comes from the discharge itself as written above.
It should be a combination of static electricity and radiation even before the discharge, only to be amplified at the moment of discharge.
An even more peculiar case than Ground To Cloud lightning is also the case of Ball Lightning. This video shows something that could be identified as ball lightning. One of the theories on how ball lightning occur indicate that Si element on soil could be a factor.
EDIT
In order to prove my point on this optical illusion in the above image i add a link of another optical illusion, of course on that video the train has one and only course but we see it to have both, in cases like that the human brain finds other ways to determine the direction.
Answer: It doesn't.
Based on observing this and other slow motion videos of cloud-earth lightning I observe the following:

Some low-intensity "pilot lightning" starts in the cloud, usually only at one point or at most a few points, and propagates in many directions away from that point, branching out much like a river delta or a tree branch.
The general direction of propagation is towards the ground, but not very strongly. The most consistent trait of the movement is away from the origin, but not even that is absolute (there are a few loops and upward branches).
Once one of the branches touches or gets close to the ground an intense arc forms between that point on the ground and the origin of the "pilot lighning". There is no clear indication of a direction, partly because of the unavoidable camera overload.

Hypothesis
The pilot lightning starts where the gradient of the inhomogeneous electric field is steepest, somewhere close to the concentrated collection of charge in the cloud. It does not start on the ground because the ground conducts comparatively well so that the charges dissipate, lowering the electric field strength.
The pilot lightning's propagation is driven by two factors: The electric field and a feedback mechanism. The feedback happens because the plasma corridor created by the emerging lightning bolt conducts electricity very well and thus facilitates propagation once it has started: Electrons and ions are accelerated and extend the corridor at its front. Apparently there is a chaotic element to this, possibly because turning air into plasma is an explosive process. This multi-directional explosive expansion is also responsible for the branching.
That the lightning roughly follows the field gradient explains the general direction. The feedback sustains the lightning once it has started. The explosive expansion of the heated air explains its chaotic parts.
When one of the pilot lightning branches gets close enough to the ground that an arc to the ground is completed there is a completely conductive connection between the separated charges which will lead to the runaway discharge known as a lightning bolt. (It's a runaway process because higher currents increase the arc's conductivity by turning more air into plasma, so the current grows until the charges are exhausted.)
I do not think that the eventual main lightning bolt has a different "direction" than the pilot lightning, and I cannot find observational evidence.  Even at 100,000 frames per second the intensifying appears instantaneous, and the main bolt is so bright that cameras are overloaded.
It may appear to the human perception as a "back strike" because it starts once the pilot lightning touches ground, much like a bounce-back event. But I think it's just that suddenly a lot of charges flow where only few charges were flowing a millisecond earlier, in the same direction.


Can I get a passport using expired state ID?

Question: Will my expired ID Card work? I also have an expired passport to show and have birth certificate with state seal and SS card.
Comment: I'm guessing for USA, is that correct?
Comment: How long ago did your expired passport expire?
Comment: You probably need only expired passport to get the new one.
Comment: Reply to Midavalo-YES
Comment: reply to mlc 1 year 2 months ago
Comment: reply to anish yes use old passport to get a new one but I need another form of identity  state ID that is expired
Comment: mlc my ID expired 1 yr 2mo ago my passport expired in 2005
Answer: The DoS states :

Your evidence must be an original or certified, physical copy. A certified copy is any document that has the seal or stamp of the
official issuing authority. You must submit one of the following
documents:

Full validity, undamaged U.S. passport (expired passports are accepted). Full validity means the document is/was valid for 10 years
for adults and 5 years for children under 16.
U.S. birth certificate that meets the following requirements:
Issued by the city, county, or state of birth
Lists your full name date of birth, and place of birth
Lists your parent(s)' full names
Has the date filed with registrar's office (must be within one year of birth)
Has the registrar's signature
Has the seal of the issuing authority
Consular Report of Birth Abroad or Certification of Birth
Certificate of Naturalization
Certificate of Citizenship

A State ID is not a citizenship proof of any means (99% of them don't even state your citizenship, this is excepted Enhanced DLs, but while they are valid for travel, they aren't a citizenship proof)
You can submit either your expired passport or your Birth Certificate
From @Dimitry Vulis in the comments :

Afditionally, if you're eligible to renew by mail using form DS-82 - it's easy, and your old expired passport is all you need. But if the old passport was issued >15 years ago , use DS-11 and apply in person.
Comment: Thanks I will apply in person
Answer: For the requirement to present ID, the adult US passport apply-in-person page, "Present ID" section, says:

You must present one of the following identification documents (IDs)
to the acceptance agent. The ID must readily identify you.

Valid or expired, undamaged U.S. passport book or passport card
In-state, fully valid driver's license or enhanced driver's license with photo
Certificate of Naturalization
Certificate of Citizenship
Government employee ID (city, county, state, or federal)
U.S. military or military dependent ID
Current (valid) foreign passport
Matricula Consular (Mexican Consular ID) - commonly used by a parent of a U.S. citizen child applicant
U.S. Permanent Resident Card (Green Card) - commonly used by a parent of a U.S. citizen child applicant
Trusted Traveler IDs (including valid Global Entry, FAST, SENTRI, and NEXUS cards)
Enhanced Tribal Cards and Native American tribal photo IDs
Note: you may be asked to present an additional ID when presenting one of these three documents: 1) In-state, fully-valid learner's
permit with photo, 2) In-state, fully-valid non-driver ID with photo,
or 3) temporary driver's license with photo.

If you cannot present one of the IDs above, or for more information,
please see Identification.

As you can see, if you present a state driver's license or state ID, it needs to be valid. However, one of the acceptable items is a valid or expired US passport. Since you have an expired US passport, that should be sufficient for the ID requirement.
Comment: This is only to identify you in-person, you still need to submit a proof of citizenship, which DLs aren't
Comment: @NicolasFormichella but expired passports are.  In this case the applicant will be relying on the expired passport as both proof of citizenship and proof of identity.  What's the point of mentioning the driver's license here?
Comment: Sorry ID, and yes indeed @phoog


How can I connect to an Arduino using WiFi?

Question: I'm working on building a solar powered, Arduino based weather station. The weather station consists of a temperature sensor and a photoresistor, and I plan to add an anemometer in the future. I would like to connect the weather station to my wireless network so that I can retrieve the sensor data from my computer without having to run wires (I live in a rental).
What are the different options for connecting the Arduino to WiFi? I've looked at ethernet shields, WiFi shields, and something called Xbee, but I don't understand what each of them are for.
I also have a wireless home router that I could use. Is it possible to connect my Arduino Uno to the router via the routers ethernet or USB port and then receive data from and send commands to the Arduino wirelessly over my home network? If so, how would this be accomplished?
I currently have a bare Arduino Uno.
Comment: Do you have an Ethernet shield?
Comment: You need to clarify your question: what does "communicate with it" mean? Upload sketches? Send commands to a sketch? Get data from a sketch?
Comment: I've attempted to add detail and context to the question. I do not have any shields currently.
Comment: I don't think any revision of the official Uno has an ethernet port. I guess you must have an Arduino Ethernet (which is similar), or perhaps an unofficial clone of some kind?
Comment: I've edited the question to specify the ethernet port on the wireless router. So the question is: [Arduino + ? + (Wireless Router OR ?) = Arduino sending data over my wireless network].
Comment: Also have a look at adafruit cc3000 wifi module. If you need to log data on internet server, wifi/ethernet is recommended, if you just need the data on your pc, a cheaper option would be using motinos from low power lab.
Answer: You have a few options for connecting your Arduino to the network/Internet.
Ethernet
Something like the Arduino Ethernet Shield allows you to plug in an Ethernet cable from the wall or router into your Arduino. Obviously, the main limitation is that your device is now tethered by the cable. For outdoor use, I wouldn't do this.
WiFi
The Arduino WiFi Shield allows you to connect to your home WiFi network. This is just like the Ethernet except its now wireless.
The ESP8266 is a cheaper alternative that, with the default firmware, has the same functionality as the WiFi Shield. Be careful that you power it with 3.3V and not 5V as the rest of the Arduino. It also uses 3.3V logic levels so don't connect the Arduino's TX pin directly to the ESP's RX pin; use a voltage divider.
RF
If you have a lot of sensors or other devices that need to communicate with each other, the best option is usually an RF module. You have many options here, XBee being one of them. Check out the Sparkfun XBee Buying Guide to look at all the options available. And that's just XBee. There are many other wireless options available, at all sorts of prices.
The thing with RF is that none of these will connect to the Internet. You will have all your devices communicate with each other or a base station, which will then be connected to the network by either a WiFi or Ethernet module.
Wireless Router Serial
Depending on what kind of wireless router you use, you can have the Arduino communicate directly with it and use that as your connection to a network.

Arduino - Cheap wifi connectivity
Converting your Ethernet Shield to a wireless shield
Comment: As for "RF" communication, you can also use the popular nRF24L01+ modules. There are some good libraries out there for this. The issue with the RF link is that you need to have another Arduino or Raspberry Pi etc. running as the "receiver" which then is connected to your computer where you want to store/view/analyze the data.
For Wifi there are now also CC3000 shields available  http://www.adafruit.com/products/1534
Comment: While researching the options you provided I came across the Yun. Would that be a more straightforward option? Thanks.
Comment: Maybe. never used it myself. The shields aren't hard to interface with and may be cheaper.
Answer: Marry OpenWrt and your Arduino
Get a small OpenWrt-capable router like "TP-Link TL-WR703N", flash it with the current stable version of OpenWrt and connect your Arduino to the router's USB port.
This solution ist half or less of the cost of WiFi-shields and has far more power.
...and cheaper as a YÙN.
Smart home automation webserver on OpenWRT router WR703N interfaced to Arduino, compared to Raspberry Pi and Ubuntu may be a starting point to read about this and your favorite search engine will find many more links about marrying WR703N and Arduinos...
(!) Please see https://arduino.stackexchange.com/a/1754/653 too....
Answer: ESP8266 is a cheap 5$ wifi module with UART, SPI connectivity. This can be integrated with Arduino seamlessly either through the stock firmware using AT commands, or by writing custom firmware using the SDK provided and GIPO available. For more reference http://www.esp8266.com/
Answer: I've been working with xbee on the arduino and raspberry pi for a few months now. Whilst it does have it's issues and quirks, it is a great tool in the communication chain. It's not perfect but given the mesh side of it, for me it reaches further than my wifi and can even be more reliable (my raspberry pi with wifi occasionally drops out, however the connected xbee continues to function in the background.
Specifically in my case it allows for a serial connection between my devices (being several arduinos, a raspberry pi (coordinator) and my mac (used primarily for monitoring but also occasionally injecting serial data)). In this case it's perfect. It doesn't allow internet access or access beyond the xbee framework, but that suits me perfectly since implementation is as simple as Serial.print and Serial.read with no Ethernet overhead.
Answer: I use Spark Core which is a very easy to use Arduino programming platform. This platform was built on the primus that WiFi should be easy to use and cheap. Can even program the Spark Core from anywhere, any time.
Comment: How does it compare to XBee in terms of: price (including Arduino connecting stuff such as a shield), distance range, programming (on Arduino)?
Answer: You could try a Arduino Yun, it is like a Uno but it has a WiFi directly on the board.
There is a part in the "Guide to the Arduino Yún" called "Configuring the onboard WiFi", that describes how to configure the WiFi.
Comment: Hi, could you edit your answer with some more information. OP already knows about the Yun so your answer would be more useful if, for example, it guided people to how to use the WiFi chip on it.
Answer: What you want is pretty easy to do, and the code exists already.  But the way I invision it, you won't connect the sensor Arduino to your wifi.  Instead, you'll use another Arduino as your gateway like this:
Sensor Arduino:  Located outside, connected to temperature sensor, wind speed, rain gauge?
Gateway Arduino: Located inside, w/ Wiznet 5001 ethernet shield
The Sensor Arduino and Gateway Arduino talks to each other using a VERY easy to use wireless transceiver, nRF24L01+.  The wireless modules are $3 each, and the library for use is very mature.  All the sensor data is easily communicated to the Gateway using this library.
The Gateway Arduino w/ the ethernet acts as a webserver, enabling any computer in your local network to open up a page and view current conditions.  Look at this page for the Arduino code:
http://arduino.cc/en/Tutorial/WebServer
You want to also save historical temperature/wind speed information right?  This is the best part! The Gateway Arduino can push data to a service like Xively, a free web-based data collection service that also gives you a nifty way to visualize/graph your data.  There is a little hiccup with using the Wiznet along with the nRF24L01 module.  The wireless module and ethernet shield both use the same bus to communicate, so take a look at this blog to see how you can use both at the same time:
http://www.heald.ca/content/arduino-ethernet-nrf24l01-and-pachubecosmxively
Xively also lets you make that data public or private, so you can chose to contribute your weather station data to the community.
Some other notes:
I like nRF24L01+ modules because they're dirt cheap.  Xbee modules cost more than the Arduinos themselves.  You can keep adding nRF24L01+ modules around the house once you establish a gateway.  The same cost problem exists with wifi shield - expensive.
Answer: If you want a cheaper alternative to add WiFi capabilities to Arduino look at ESP WiFi shield.
It works great with WiFiEsp library.
Programming model is exactly the same as Arduino WiFi Shield
Answer: Check ESP8266 wifi module , it's a cheap module and can be controlled using any microcontroller by AT commands , also it's Soc so you can use it standalone .
Answer: Using the ESP8266 AT cmd set is difficult and error prone.
Suggest you reflash the ESP8266-01 as a UART-WiFi bridge as described here
ESP8266 Wifi Add on for Arduino Made Simple
Note that setup also lets you re-configure your wifi settings without re-programming the ESP8266-01
Answer: Using the ESP8266 sield is error prone, requires an update that needs to be flashed, some soldering required, and it's not appropriate for a production environment. Also, there are issues with the power supply because you need to have a separate 3.3V power supply.  It's 2016 (!) and there are a bunch more options available now.
"The UNO WiFi board is the Arduino UNO with integrated WiFi." http://www.arduino.org/products/boards/arduino-uno-wifi
and
"The Star Otto is the first Arduino board featuring the STM32F469 processor with WiFi." http://www.arduino.org/products/boards/arduino-star-otto (Actually, as of October, it's still not available, "Coming Soon").
Please note these two boards are from the OTHER Arduino organization.
Answer: After several trials & errors in my IoT project, I would recommend working on ESP32 over ESP8266(and also Arduino Uno & Nano), except if you know very well the scope of your project.
Advantages of ESP32 over ESP8266:

Bigger RAM, ESP8266: 32KB instruction & 80 KB user data, ESP32: 520 KB

I'm working on an IoT project and trying to authenticate the device on GCP using a certificate. The root certificate of GCP is already about 120 KB, so it does not fit into ESP8266. There are alternatives but that complicates things.

ESP32 has bluetooth & ESP8266 not

Well at some point of your IoT project you might want bluetooth to connect your device with your phone ...

Some versions of ESP32 has integrated ports for the camera (search ESP32 CAM)

With ESP8266 you can surely use a camera but that will involve more coding & wiring and potentially worse performance.
And at last, I tried to wire a wifi chip with Arduino Uno & Nano but I encountered some bugs and problems with the AT commands. Thus now I'm quite happy with ESP32 because everything is integrated.


Gertboard programming atmega328p : can't define "board" to program

Question: Using RPi rev B, all software updated (raspbian). I have installed the Arduino IDE software per the instructions of https://projects.drogon.net/raspberry-pi/gertboard/ .  Originally the download gave errors, but upon subsequent downloads, the errors went away. Software reports that Arduino IDE is installed good.
  I have performed the "Initial Setup of the ATMega", per the instructions of the author of Gertboard ; https://projects.drogon.net/raspberry-pi/gertboard/  . . .
   I don't get any errors.
Now, to send a program (sketch) to the Arduino, I need to identify the "board to be programmed."
    I click on the "Tools",  "Board",  so as to identify the type of micro (328P) I would like to program, but there is nothing shown.  The pull down menu is "Tools, Board", which should show a device to be programmed, but there is no further menu.
   What additional information can I supply to you to help me make further progress with this problem ?
Answer: It is quite a while since I did this, but /usr/share/arduino/hardware/arduino/boards.txt should be customised to include sections for the following
gert328.name=Gertboard with ATmega328 (GPIO)

Comment: You are correct and problem solved. I had downloaded the boards.txt file. However, in moving the file to the folder you show, I omitted a dot (period) at the end of the mv (move) command  $ sudo mv /tmp/boards.txt .  -  also, the programmers.txt needs to be in same folder.  Hat Tip to you.