Why is the empty set bounded?

Question: Why is the empty set bounded below and bounded above? If it has no elements, how can you say that an upper or lower bound exists?
Comment: This is an instance of something being vacuously true.
Comment: Every number $b$ is both, an upper and a lower bound. For there is no $x \in \varnothing$ such that $x < b$ or $x > b$.
Comment: Note that $17$ is an upper bound. For it is true that every element of the empty set is $\lt 17$. Can you name one that isn't?
Comment: Definition: a subset $S$ of $\mathbb{R}$ is blue if there exists $s\in S$ such that $17s+\sqrt{3}$ is rational. Proposition: the empty set is not blue.
Answer: Recall that implication has the property that when the assumption is false, the implication is true. In other words, if $P$ is false, then $P\implies Q$ is true.
Let $S$ be a set of real numbers. Then $M$ is an upper bound for $S$ if the following implication holds, $$s\in S\implies s \leq M.$$ Now let us examine the case for the empty set, $\emptyset$.
Proposition Let $M$ be any real number. Then $M$ is an upper bound for the empty set (of real numbers).
Proof:
Since the statement, $s\in\emptyset$ is false, the implication, $$s\in\emptyset\implies s \leq M$$ is true.
Note: An almost identical proof works for the lower bound case.  A nice little slogan to remember here is
All things are true about the MEMBERS of the empty set.
Answer: Argue by contradiction. Suppose $\emptyset$ is unbounded. Then for every $M > 0$ there is a point $x \in \emptyset$ such that $|x| > M$. But this contradicts that the empty set has no elements.
Answer: Alternatively, a set $S$ is bounded if there exist numbers $a$ and $b$ such that:
$$S\subseteq[a,b]$$
Now, $\varnothing$ is a subset of every set, so…
Answer: A set in a metric space is bounded if, and only if, there exists a ball (of finite radius) containing it. Then trivially the empty set is contained in a ball (actually in every ball).
Answer: We can prove it by contradiction. Let S=∅ be the empty set and let S does not have any upper bound i.e. there exists no real number M such that M is greater than or equal to every x∈S, which implies there exist at least one element x∈S such that x>M, which is a contradiction since S is an empty set and has no elements.
Similarly if S does not have any lower bound then there exist no real number m which is smaller than or equal to every element of S, implies there exist at least one element x∈S such that x<m, again a contradiction since S is an empty set and has no elements.
Hence our assumption is wrong and S has both upper and lower bounds in fact every real number is an upper bound and every real number is a lower bound of an empty set S.
But an empty set has no least upper bound since we don't have any smallest real number, similarly an empty set has no greatest lower bound since there exists no greatest real number.
Comment: Welcome to MSE. Your answer adds nothing new to the already existing answers.
Answer:
In mathematical analysis and related areas of mathematics, a set is
  called bounded, if it is, in a certain sense, of finite size.
  Conversely, a set which is not bounded is called unbounded. - Wikipedia definition.

Now there is only one "nothing" just like there is only one 1, or only one 2, or say only one zero. There may be 2 cats or 2 dogs or 2 giraffes but 2 is 2. there is only one 2 along the entire number-line. similarly there are only one "nothing".
so the empty set, the content (nothing) is finite in number, which is 1.
so empty set should be finite.
please correct me i may make mistake im not math people.
Comment: The quote you provide says that a set is bounded "if it is, **in a certain sense**, of finite size."  This does not mean that the set is of finite cardinality.  This is not the "certain sense" alluded to in the quote.
Answer: Note: this is an informal explanation and not a rigorous proof. It's just meant to strengthen your intuition (I hope!)
It might help to think of upper and lower bounds as limits on the size of a set's elements. Sets are either unbounded or bounded.
Let's look first at an unbounded set, $A$. If $A$ is unbounded, its elements get arbitrarily large. Large positive and "large negative". They have no upper limit to their absolute value. They "go off to infinity, and to negative infinity."
Bounded sets are sets that don't do this.
A set $S$ has an upper bound $b$ if no element of $S$ is greater than $b$. $S$ doesn't "go off to infinity". It doesn't even get past $b$
The empty set certainly doesn't "go off to infinity or negative infinity". It doesn't have elements greater than $b$, no matter what number $b$ is. It doesn't have elements less than $b$ either.
Every number is both an upper and lower bound of the empty set, a size restriction so impossibly restrictive that no real numbers can obey.
The empty set is so tightly bound up, so tightly restricted, it doesn't even have any elements!
Answer: We can say that the empty set is bounded if its not in R; that is if the empty set is the complement of R then we can say is bounded, because it lies in the extension real numbers.But if the empty set is a subset of R then it may be bounded or unbounded. If we assume it finite then its bounded set but if we look at its supremum and its infimum we see that they are not real numbers so the set is unbounded. I see that the empty set is both bounded and unbounded.
Comment: This is a really bad way of looking at it. The supremum is $-\infty$; this means that *any extended real number* is an upper bound. Similarly the infimum is $+\infty$, which means that *any extended real number* is a lower bound. No other subset of $\mathbb{R}$ has either of these properties. In this sense the empty set is "more bounded" than any other set.

Why is the empty set bounded?


ArcGIS Operation Dashboard

Question: I am working on ArcGIS operation Dashboard. There is an widget on the top left corner " Model Manager". Here the Model manager will read the data from ForecastStage_MPT and ForecastTimePT database tables. These 2 database tables are in MS SQL server database. The data in these 2 tables are populated from NOAA. A script has been developed which will take the data from the NOAA website and populate the ForecastStage_MPT and ForecastTimePT database tables. My task is to read the data from the database tables into the ArcGIS operation dashboard model manager widget automatically. Do you have any idea how to read the MS SQL server database tables into the model manager widget? I am sending you 3 attachments and see if you can give me some directions.
Comment: yes , you can upload your sql data to your layer (feature service), just use post rest api call for (appluedits or add feature) inside windows service.
Comment: or use ArcGIS Server to host the tables as a service, should sync the edits ran by your script
Answer: Yes, you can upload your sql data to your layer (feature service), just use post rest api call for (appluedits or add feature) inside windows service.
Here is the fellow :

export your sql data to csv files .
import csv files to your arcgis online account.
now you have a layer or feature service contains your sql data , make your layer editable.
you can updates layers content by using API method like apllyedits and add features.

ArcGIS Operation Dashboard


上陸したよ. Is this slang?? How does it translate to meaningful English? Please see context in body

Question:
So this literally translates into "I landed it." Which is literally what Kamata-kun (this character from Shin Godzilla) did. But is that really all it means? Is it a Japanese double entendre or pun or have any other connotation other than he came up on land? In English we might say you "landed something" as in you got a good job or achieved something worthwhile. Is that it? Thanks for any help.
Comment: I don't think so.  Seems kind of just like he's saying, "I'm here!"
Comment: Yeah, also seems like that to me. I'm gonna leave slang interpretations (or lack thereof) up to native speakers, but this is intransitive land, not transitive - no "landing it".
Answer:
So this literally translates into "I landed it."

More like "I landed". 上陸 sounds like he came out of the sea, since the 上 implies upwards. For example aircraft etc. are 着陸 rather than 上陸.

In English we might say you "landed something" as in you got a good job or achieved something worthwhile. Is that it?

As far as I know such an expression doesn't exist in Japanese.
Comment: +1. 上陸 does not mean "to finish". (As an aside, 上陸 is used as a catchphrase like [this](https://japanese.stackexchange.com/a/72665/5010), in which case whether the product came by air or by sea does not matter.)
Comment: I don't know for sure but I think "I landed something" comes from fishing terminology so it's like 大漁 in Japanese.
Answer: Since I haven't watched this movie (I really liked godzilla vs mothra though), I hope I am not missing the context.
I need help of this entry for 蒲田{かまた}くん on ニコニコ大百科. There is a dialog(probably on the scene) on it.
「この巨大不明生物が上陸することはありませんので、どうかご安心ください」:
"Since this unknown giant creature is not going to land on here, please don't worry about that."
↓
「え、蒲田{かまた}に?」: "On Kamata? Really?"
Reading this dialog, I guess this「蒲田{かまた}くん」was really unlikely to land on Japan, but he landed (maybe done easily because their face seems not be getting exhaust).
So,「上陸したよ」would probably mean "(Don't be surprised!) I've made it to land here!".
The last「よ」is similar to 「ぜ」,but less emphatic.


One Compliance Server for multiple anchors?

Question: Is it possible to set up just 1 compliance server that can be called upon from multiple bridge servers? Or would you need a seperate compliance for every bridge server connecting to it?
Answer: In theory this should be possible, though I have not tested this out. In doing this however you will need to consider the following:

The multiple bridge servers should be able to connect to the compliance server internal port securely. You shouldn't make the internal port publicly accessible.
The callbacks you provide will need to be able to differentiate the request for the various anchors.
The anchors will all list the compliance URL as in their stellar.toml file.

If you do get to test it out, let us know how it goes.


When is the best time to use  and  in lieu of  and , if ever?

Question: Semantically speaking, is there an appropriate place in today's websites (late 2008+) where using the bold  and italic  tags are more useful than the more widely used  and  tags?
Answer: Never. They are removed in XHTML 2.0 as they are presentational tags.  CSS should be used to bold/italicise content.
edit: If you're looking for a purely presentational tag, that's what the SPAN tag with a class and a little CSS is for.
Comment: The point is, though, that they've essentially removed the old b/i tags and created new ones with the same names but actual semantic meanings. The old tag meanings - bold and italic - are no longer present.
Comment: @ceejayoz XHTML 2.0 is dead! Also, according to the next HTML specification (HTML5) you're wrong:  and  are still present, and they have semantic meanings.
Comment: @abernier This answer was written a year before the W3C allowed XHTML2 to expire, and HTML5 has essentially deprecated the old "bold" tag and replaced it with one with similar semantic meaning to the "strong" tag, as an odd dance intended to grandfather in the existing browser behaviour.
Comment: @ceejavoz see: http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-i-element it's not depreciated, it's more like a last resort element, but with meaning : "an alternate voice or mood, or otherwise offset from the normal prose"
Answer: While in general I would stay away from non-semantic tags like b and i, strong and em are not direct replacements for b and i.
I would use b or i when it's only presentation you're going for, and what you're marking up has no semantic meaning. For example, a logo like stackoverflow could be marked up with stackoverflow. The "overflow" portion has no semantic meaning over "stack", yet stackoverflow doesn't offer anything either.
Hope this helps.

Not sure how to comment (edit: need moar karma!), but this is in reply to Erik's comment.
Please read the HTML5 working draft. It gives a good explanation on when to use b.

The b element represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is boldened.

"overflow" does not have emphasis over "stack" in the logo, therefore wrapping "overflow" with em is semantically incorrect.
Comment: I don't agree. I would implement your example as stackoverflow. It's a header, emphasis is on overflow. Alternatively, you could use an image for the logo, and just let the text be.
Comment: I wasn't aware of this specification of the b and i tags. In that case, I think you are right. Although I don't know if I agree with the examples they give in the draft. I think this would be a better example.
Answer: According to the HTML 5 spec,  and  should be used when appropriate.
On the i:

[A] span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized.

On the b:

[A] span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is boldened.

Generally speaking, "when appropriate" is deemed to be as a last resort, when all other semantic options have been exhausted. "Presentational" though they may be, it would certainly be a disservice to their semantic cousins  and  to consider them always italic or bolded, respectively.
Comment: How can you possibly exhaust semantic options? A SPAN with a class of "keyword", "product_name", etc. would work in all the example situations.  That's the entire reason *for* the SPAN tag.
Comment: @ceejayoz See my example of a logo in my answer.
Answer: On http://www.webmasterworld.com/forum21/7095-1-15.htm there's a good comment:

"If page readers really read every
   tag in a strong voice, or
  really emphasize every  section on
  a page, then the poor user gets a page
  shouting at her or him on a regular
  basis.
I think this issue is really a
  no-brainer. If I am setting a bold or
  italic font for purposes of typography
  only, then I use  and . If
  there's a word or phrase that I want
  to emphasize as I would in speaking,
  then - and only then - do I use
   or ."
Comment: That's what SPAN is for, not B and I.
Answer: For markup generated by a WYSIWYG editor.
Answer: The  and  tags don't have semantic meaning, whereas  and  do. If a reader read the block of text aloud it would react to the  and  tags, whereas the  and  tags would be ignored, and treated and purely visual elements. I tend to regard  and  as deprecated.
Answer: Whenever you want to do things incorrectly ... just kidding.
The real answer is never, these tags have been deprecated by the W3C
Comment: actually, they're not deprecated, at least not in XHTML 1.0 - http://www.w3schools.com/tags/ref_byfunc.asp
Answer: Neither  nor  are semantic tags, so purists would say they should not be used.  Where I've seen their use justified are in things like putting online content in print where text was bolded or italicized as a matter of convention, but not as a manner of strengthening or emphasizing content.
The easy example is if you're putting online a magazine article that references a book by its title: you may want to put the book title in italics, but the italics are not for emphasis, so the  tag would be inappropriate.  You could use  here, but the semantic thing to do would be to use something like  and then use CSS to make booktitles italics.  You are referencing a title, not putting emphasis, and you wouldn't want a screen reader to put verbal emphasis on the title.
My personal opinion is to not use either  or  today, but using  or  as their substitutes when you aren't really looking to do anything besides bold or italicize the text is equally incorrect.
Comment: In your example, you'd actually want to use . :)
Answer: I think when you're trying to make your markup meaningful, these are rarely useful.
There are, however, new tags that produce some of the same results, but which provide even more semantic value. I like to use the  tag when I'm referring to the name of a book, for example, as it still gets italicised, but the HTML now carries meaning about why.
There are a variety of other semantic tags that can also affect formatting listed here:
http://www.w3.org/TR/xhtml2/mod-text.html
Answer: I've been using  for years to indicate key words on my web site.  I wrote a small utility that crawls the site looking for  tags and adds them to an index.  I use  when I want to bold a word without adding it to the index.  I have used this convention for years -- too late to quit now.
Answer: It could be argued that there is still a use for the  tag: when expressing the scientific name (aka the Latin name) of a species. The scientific name of a species is, by convention, usually presented in italics. Example. It is semantically incorrect to use  in this situation because one is not trying to emphasise the name but rather merely distinguish it visually. It may be more appropriate to use something like , but when one considers that most scientific names are composed of words of the italic languages, mainly Latin, the  tag becomes a rather sematically rich and convenient solution.
Answer: There are technical rules, but here are my two rules of thumb:
1) If you are writing something where, if spoken, you would emphasize a word,  and  are appropriate. (E.g., "You have got to be sh*tting me, Pyle!")
2) If you are emphasizing a word for a technical reason, but would not emphasize the word in spoken conversation,  and  are appropriate. (E.g., "He boarded the RMS Titanic and sailed away, never to be seen again.")
Don't leave out other tags like , though!
Answer: Officially,  and  are "presentational" and shouldn't be used. While many developers think that  and  are presentational, they are not. They are generally italicized and bolded resopectively, but the CSS can (and should, when appropriate) change how the emphasis and strongness could be displayed.
Similar things could be done with css on a  tag, and many consider that the preferred method, but it isn't substantiatable with the specification.
Answer: Some years have passed …
In HTML5 (W3C Recommendation), none of these four elements are deprecated/obsolete.
The (non-normative!) usage summary lists their purposes:

strong: importance
b: keywords
em: stress emphasis
i: alternative voice

Of course, if you want to use them, always refer to their normative definitions (which you can find by clicking on the element names) and verify that they are appropriate for your case.
Examples
The b element could be used for keywords in a text, where the other three elements would not be appropriate: such keywords are not stressed (em), nor are they offset (i), and there is also no need for distinguishing them from boilerplate etc. (strong).
The i element could be used for scientific names in Latin, where strong and em are not appropriate. While b seems to be appropriate, too, its definition explicitly excludes the cases handled by i.
There can of course be cases where you'd use several of these elements. For example, a scientific name could also be a keyword in a document (…).
Answer: When writing websites for mobile devices.  They don't always support the 'latest and greatest' standards, are depreciated but not deleted from all modern browsers, and simply take up less space and bandwidth (though in theory the streams are compressed by either the websites or the wireless browser, it can't be counted on).
-Adam
Comment: Are you aware of any mobile devices that can't handle STRONG or EM tags?
Comment: At the moment, no, however even if every single mobile device still being used supported these tags, the point about bandwidth still stands.  In most cases this would not be useful (compression, etc) but for a specific website catering to a specific user  and  might be the right choice.
Comment: If you've got enough I/B tags to make a bandwidth difference, even on a mobile phone, it's either a) too long of a page for a mobile phone anyways or b) you're bolding every other word and need to stop doing that. Heh.


How is a quartic oscillator solved in classical mechanics?

Question: Quantum mechanically, a quartic anharmonic oscillator with potential $$V(x)=\frac{1}{2}m\omega^2x^2+\lambda x^4$$ is dealt with perturbation theory- the approximate energies $E_n$ and energy eigenstates $|\phi_n\rangle$ are obtained using the  time-independent perturbation theory. Classically, the problem amounts to solving the trajectory $x(t)$. At this point, one is stuck with a nonlinear differential equation which cannot be solved in closed analytical form. How do we go about solving such problems, classically? Do we use similar perturbation technique to obtain corrections to the trajectory order by order? Any suggestions? In short. I am curious about the classical behaviour of this system.
Comment: https://physics.stackexchange.com/q/78415/
Comment: There is a 2d phase space and one conserved quantity. That's why. It gives t as a elliptic function of x and turning that the other way around may trouble you.
Comment: @AHusain Classically the problem is exactly solvable?
Comment: You can integrate the equations numerically.
Answer: This problem is discussed as an example of secular perturbation theory in

José, J. and Saletan, E., 2000. Classical dynamics: a contemporary approach.

For first order in $\epsilon$, the (rationalized) equation of motion
$$
\ddot{x}+\omega_0^2 x+\epsilon x^3=0
$$
has the approximate solution
$$
x(t)=a \cos(\omega_0 t)-\epsilon \frac{a^3}{8\omega_0^2}
\left(3\omega_0t \sin\omega_0 t +
\frac{1}{4}(\cos\omega_0 t- -\cos(3\omega_0t))\right)
$$
with the secular term (linear in $t$) appearing explicitly.
One can get rid of the secular term using Poincaré-Lindstedt theory, i.e. by introducing corrections to the unperturbed frequency $\omega_0$.
The same problem is used in José and Saletan as an example of canonical perturbation theory (or Hamilton-Jacobi perturbation theory), where the solution is to find successive canonical transformations.
using the unperturbed canonical variables
$$
\phi_0=\arctan(m\omega_0 q/p)\, ,\qquad J_0=\frac{1}{2}\left(\frac{p^2}{2\omega_0}+m\omega_0 q^2\right)\, .
$$
The first order correction to the frequency is $\omega\approx\omega_0+\epsilon
\frac{3a^2}{8\omega_0}$ when the initial conditions are $p(0)=0, q(0)=a$.
This problem, also as an example of the canonical perturbation approach, is similarly discussed in Example 8.3 of

Percival, I.C. and Richards, D., 1982. Introduction to dynamics. Cambridge University Press.
Comment: Yes, but note that these textbook exercises are in some sense artificial (and only presented as pedagogical examples), because the problem is completely integrable (in terms of elliptic functions). This also means that the easiest way to get the perturbative expansion is to take the exact answer and expand it out in powers of $\epsilon$.
Comment: @Thomas isn't this what you would do anyways to get something other than a purely numerical value for the elliptic integral?
Comment: Not really, I think. Canonical perturbation theory beyond leading order is very tedious, whereas there are fast and efficient ways of computing elliptic functions (based on the fact that they are double-periodic in the complex plane).
Comment: @ZeroTheHero Can you tell whether there is an exact solution? The pendulum problem, I think, has an exact solution even when the angular amplitude is large.
Comment: @mithusengupta123 there is an exact solution in terms of elliptic integrals, and this is useful for numerical work, but when it comes to analytical work I do not know of any solution expressible in terms of "simple" functions.


Buying and selling the same stock

Question: If I buy a stock for say $1 and that stock goes up to $2, can I sell my initial investment being $1 and then buy back into the same stock when it goes back down to $1 over and over only using my initial investment to accumulate shares without paying any tax? I hope this makes sense.
Comment: Why did you use the tag "shorting-securities"? Your title and question has nothing to do with shorting.
Comment: depends on your legislation, where are you located?
Comment: Can you also elaborate? You buy 1 share at $1, it goes up to $2. You sell this and get a profit of $1. You hold this till the share drop backs to $1, you buy this back. You wait till it goes down to $2 and sell it again. Now a profit of $2 and wait for it to go down to $1 and now buy 2 shares. When it reaches $2 you sell both for $4 and repeat?
Comment: This is speculation but the tag was probably used in reference to short term trades
Answer: Elaborating on kelsham's answer:
You buy 100 shares XYZ at $1, for a total cost of $100 plus commissions.
You sell 100 shares XYZ at $2, for a total income of $200 minus commissions.
Exclusive of commissions, your capital gain is $100 for this trade, and you will pay taxes on that.  Even if you proceed to buy 200 shares XYZ at $1, reinvesting all your income from the sale, you still owe taxes on that $100 gain.  The IRS has met this trick before.
Answer: Unfortunately, we don't know your country, but I'd guess "Not US" with the hint being your use of the word bugger in a comment.
Realized profits are taxed by all tax authorities I'm aware of, i.e. the Tax Man in every country. Annually, so that you can let the profits run during the year, and offset by the losses during that year.
The exception is within a qualified retirement account. Many countries offer accounts that will let you do just what you're suggesting, start with XXX number of Quatloos in your account, trade for decades, and only take the tax hit on withdrawal. In some cases there's an opportunity to fund the account post tax, and never pay tax again. But to repeat, this is with a retirement account, not the usual trading accounts.
Comment: Note that not all tax protected accounts are exclusively retirement accounts. TFSAs in Canada are post tax accounts that let you invest without paying any tax on the investment income. Since the amount you withdraw from a TFSA becomes contribution room the next year, I recommend that young people, like myself, saving for a house, wedding, or whatever else, do so with a conservative portfolio in their TFSA. When they withdraw they will have also permanently increased their maximum contribution room for when they are using the account for saving for retirement later.
Comment: I appreciate the education on the options my friends to the north have for tax favored investing.
Comment: Even dumping student loans as soon as you receive them into a liquid TFSA (taking care not to exceed contribution limits), like a standard bank savings account, can be a good idea in my opinion. With a decent bank you can also set your monthly budget and have automatic withdrawals from the TFSA to your chequing or everyday savings account, to limit your spending according to the amount you allot yourself. By the time you finish a degree you will likely have increased your TFSA contribution room by an extra $1000.
Comment: That could quickly become an extra $1000*2^200.
Answer: Sorry, no, any time you sell for a profit you owe tax.
Comment: Tax don't work that way. If you sell 1/2 of the shares for 2$, you get only your 1$ back, but that part of the share had originally only cost you 1/2 $, so you owe taxes on the 1/2 $. Every sale is compared to the same _number_ of shares you bought, not the amount you paid.
Comment: My snarky comment should be read "If you can make anything amazing happen, do it in your Roth."
Comment: And I was about to answer "yes. If you are in the US, do this in your Roth IRA. It's a great way to turn $1000 into 2^200 * $1000 after just 200 trades.
Comment: Wrong, US tax law allows offsetting taxable cap gains from one stock with cap loss from another, even one in the past year.
Comment: What I'm saying is that I am only using my initial $1 and leaving profit in the account and then buying back in when the share price goes down. So in saying that, I have not drawn on any profits and only using the $1 that I started with. Or doesn't it work that way?
Comment: @JoeTaxpayer: good point... if you can find a stock which predictably grows that way. There are still only two chances of that: slim and fat.
Comment: Priceless, @JoeTax.  Upvote!
Answer: If you buy for $1 and sell $1 when the price goes to $2, you would have sold only half of your initial investment. So your investment would now be worth $2 and you sell $1 leaving $1 still in the market.
This means you would have sold half your initial investment, making a profit of $0.50 on this half of your initial investment, and having to pay CGT on this amount.
Comment: You have drawn profits, proportionally. You don't get to redefine that. What you wanted to do, you can't.
Comment: @Roger - you buy and sell shares. If you buy 100 shares and it doubles in price and you want to take out your initial investment and leave your winning, you need to sell 50 of your shares. So even though you think you have taken out your initial deposit and left your winnings in the pot, you have actually sold half your shares to get your initial deposit out. So what has actually happened is that you have taken out half your initial investment and half your profits, and this is how it gets treated for tax.
Comment: Ok, so if I only draw (sell) the dollar amount of my initial outlay and leave any profits in the account I still have to pay CGT even though I haven't drawn on any profits? That's a bugger. What I wanted to do ID accumulate shares using my initial funds and not draw on any profits and in doing so avoid paying tax.
Answer: I think what you're asking is,

Can I buy 1000 shares of the stock at $1.  For $1000.
it goes up to $2, then sell 500 shares of the stock with proceeds of $1000, now
  having my original $1000 out of it, and still owning 500 shares.
And that not create a taxable event. Since all I
  did was take my cost basis back out, and didn't collect any gains.
And then I want to repeat that over and over.

Nope, not in the USA anyway.   Each sale is a separate taxable event. The first sale will have proceeds of $1000 and a cost basis of $500, with $500 of capital gains, and taxes owed at the time of that sale.
The remaining stock will have a cost basis of $500 and proceeds of whatever you sell it for in the future.
The next batch of stock will have a cost basis of whatever you pay for it.
The only thing that works anything like the way you're thinking, is a Roth IRA...   You can put your cost basis in, pull it back out, and put it back in again, all tax free.   But every time your cost basis cycles in, that counts towed your contribution limits unless you do it fast enough to call it a rollover.
Answer: No, you can not cheat the IRS. This question is also based on the assumption that the stock will return to $1 which isn't always a safe assumption and that it will continue to cycle like that repeatedly which is also likely a false assumption.

Buying and selling the same stock


What is the meaning of " such as" in this text?

Question: No difficulties had delayed the invaders but such as Nature had interposed to thwart them.
Comment: "...but (those) such as nature had interposed..."
Comment: It's really just "such", but you can replace the two words with the word "whatever" to get a sense of its meaning.
Comment: It's a somewhat archaic construction.
Answer: "Such" refers to a type of something previously mentioned, for example:

-Have you experienced any difficulties of nature?
  -I have experienecd no such difficulties.

"But" introduces an exception or a contrasting clause to what has already been mentioned. So, your sentence essentially means that no difficulties had delayed the invaders except the kind caused by nature.
Answer: Such is a fused-head construction in this sentence (the understood head of the noun phrase being difficulties). The prepositional phrase headed by as contains a comparative clause and modifies such.
such difficulties -> difficulties as Nature had interposed (difficulties)

No difficulties had delayed the invaders but such (difficulties) as
  Nature had interposed to thwart them.

This construction is very similar to a relative :

...but those which Nature had interposed to thwart them

There is no difference between the interpretation of the original and that with the relative constructions substituted. This use of such as is rare, definitely formal and probably bordering on archaic.

Then, going a few steps forward, he would pause at a heap, and begin
  counting cinders into his basket, as though it had been so much solid
  coin . Such as knew the broker heaved a sigh of compassion. (The Career of Puffer Hopkins; Mathews, Cornelius; 1842)

relative: Those who

No refuse or worked objects of any kind were found in this black
  earth, except in the recess in the east wall, as described, and in the
  upper portion immediately under the ashes . Such as existed
  outside the recess may have become mixed in the same way; that is, by
  being thrown on the top as it existed at the moment and being later
  covered by the water; or it may have worked in from the ashes above.
  (Archeological Investigations, Bureau of American Ethnology, Bulletin 76, 1922)

relative: Those which


Bbq pork ribs accidentally started cooking in crock pot on warm for 2 1/2 hours before noticed

Question: I put country style pork ribs in my crock pot this morning with bbq sauce and didn't realize I set the control to only warm. It was not noticed until it had been on warm for about 2 1/2 hours. I immediately turned it to high.  Will they be safe to eat after cooking on high for a few hours and low for a couple more?
Answer: It depends entirely on what the actual temperature for "warm" is.  If it is above 140F (i.e. outside of the "danger zone") you should be fine.
The limited research I've done on the "warm" temperatures of various crock pots seem to range from 145F to 200F, so it largely depends on the model.  You might want to read the manual or go to the manufacturer's web site and find out what the actual temperature for your specific model is.
However, if you can't actually find out what the warm temperature of your crock pot is, my usual rule with food safety is the proverbial "if in doubt, throw it out".  It's not worth the risk.
Comment: If the purpose of the "warm" function is to keep the contents serve-able over a long period of time, than wouldn't that require that the "warm" be outside the danger zone? Even the lowest temp in your search is above the 140 F mark for food safety.


Which is correct "having committed a crime" or "committing a crime"

Question: Which is correct and why,"The officer is accusing the individual of having committed a crime" or "The officer is accusing the individual of committing a crime"?
Comment: I read the first sentence, "The officer is accusing the individual of having committed a crime" somewhere and I confused it with the latter.Can we use them interchangeably?
Comment: Both may be correct depending on the frame of time involved. See *[How do the tenses and aspects in English correspond temporally to one another?](http://english.stackexchange.com/questions/21846)* at EL&U for a start.
Answer: These are both essentially correct, however there is one small difference:
(1) Accusing someone of having committed a crime can only refer to the past. That is, the policeman is referring to a crime that has already (allegedly) been committed:

She is accusing her neighbor of having poisoned her dog. (=the dog
  died three weeks ago, but she is accusing him now)

(2) Accusing someone of committing a crime, can refer to an act that is in progress at the time of the accusation (present):

She is accusing her neighbor of poisoning her dog. (=the dog has been
  sick and she suspects that the neighbor is (currently) feeding him tainted bits of food)

Note however, that (2) can be used to refer to the situation in (1) if the context is clear.


Soaked camera, completely broken?

Question: Some time ago I was on a small boat and we capsized. My camera (canon xti) got soaked in seawater and stopped working. I tried drying it and took out the battery and memory card, but it won't turn on. If I attach the lens to my new camera, will it break my new camera? Is there any hope for repairing or fixing my old camera? Thanks
Answer: Salt water is certainly one of the easiest way to destroy a camera. The salt can cause corrosion which is impossible to undo. I would avoid connecting anything to it as an internal short-circuit can damage the other item.
Something similar happened to me once where flash reader fell. I wanted to see if it still works, so I put in a Compact Flash card which got fried. Of course, I did not know and simply concluded that the fallen one was broken. I therefore inserted latter the CF card into another reader which short-circuited and starting outputting smoke. Needless to say, from one incident I ended writting off 3 items. The 1GB CF card cost $1000 CDN at the time :(
Answer: At this point, probably, the best bet would have been to submerge it completely in distilled water after the initial incident and then place it in either dry rice or with a bunch of silica gel packets after to suck out the moisture.
The point of the distilled water is to remove any salt or other mineral deposits that might cause damage and then the dry rice or silica gel is to get the moisture out of it.  It still isn't a particular promising prognosis in either case, but without removing the heavy salt content that would be deposited as the sea water dried inside your camera, large amounts of corrosion and potentially conductive mineral deposits would occur that would destroy both optics and electronics alike.
Now that it has been some time for corrosion and possibly moisture damage to become permanent, I wouldn't try attaching it to a new camera.  Any number of things could go wrong, from short circuits to spreading mold or fungus spores from the old lens in to the new camera body (from where it might go to a new lens).
If you want to find out for sure if your lens is toast, the best bet would be to send it in to Canon (or whoever made it) to have them test it.  They can test it without a camera body and see if it works.  They can also evaluate if it can be repaired, though if it was a cheap kit lens, you are probably better off to just get a new one.
Answer: Your camera and lens are almost certainly beyond repair.
For future reference, here is my approach. It's happened a few times with various items of electronic equipment. Sometimes it works, sometimes not. "All care, no responsibility".

Remove all batteries and other power source immediately.
You have seconds at best in most cases. A main LiIon battery must be removed asasap.
If there is a backup battery (coin cell etc) a little longer may be OK.
Power and a conductive path can led to rapid corrosion in seconds and death of electronic components. Getting power of asasap is THE most crucial first step.
Using clean hand-hot tap water scrub the equipment extensively and rinse repeatedly. Some items will be water-damageable :-(. Use a cleaning brush etc that will not cause damage. You want to clean as intensively as reasonable without overdoing it. Only you can be the judge of this.
Shake dry, towel dry, let what water will run out run out. Inspect for any water traps that retain large volumes.
Dry for a long long long time. Sunshine in a ventilated plastic bag is OK - gets warm and moisture can leave. Do not let it get so hot as to do damage.
I have placed equipment in a closed cardboard box with entry and exit holes and run warm air from a fan heater through it. Temperatures can be toasty but not so hot as to do damage. As a rule of thumb (or hand) if a hand placed in front of the incoming air stream finds the air "nice and warm but not overly hot" most gear will be OK.

Drying time can be hours for a simple device with no crevices and hidden holes through days or even weeks.
When you are CERTAIN that it is wholly dry, try a power up. Be prepared for death (of gear) smoke etc.
Does it work?:
I have saved
a pager dropped in saltwater (pocket, bend over, oops, run, stream ...),
a portable phone dropped into concentrated sodium hypochlorite solution (pool chlorine ...)
and a few other misc things.
I failed to save either a DSLR or its lens when a boat captain (apparently purposefully) thought it would be fun to broadside a wave and soak the dolphin spotters (and their cameras). I immediately took them to the galley and did the whole EXTERNAL cleanup procedure (as both appeared to have not internalised water and I was not too happy how they would survive it, but both died of internal corrosion some months later. The insurance company obliged with new gear of latest equivalent models :-).

Soaked camera, completely broken?


Construction of graph with given Wiener Index

Question: Given the sum of weights of shortest paths between all vertices in a graph, how can I construct a connected graph that satisfies the given sum? That is, how can a graph with a given wiener index be created?
Answer: This question is addressed on the Wikipedia page Wiener index. Gutman, Yeh and Chen showed that there are no (unweighted) graphs with Wiener index 2 or 5, but all other values are attainable. In a subsequent paper, Gutman and Yeh determine which Wiener indices are attainable on bipartite graphs, and on the way explain how to prove the earlier result, an explanation which we reiterate here.
Consider the clique on $n$ vertices. Its Wiener index is $\binom{n}{2}$. Pick a vertex $v$ from the clique. Suppose we remove $m$ edges $(x_1,y_1),\ldots,(x_m,y_m)$ not adjacent to $v$. Since $x_i,y_i$ are connected via $v$, each edge we remove increases the Wiener index by one, and so the resulting Wiener index is $\binom{n}{2} + m$. The maximal number of edges we can remove is $\binom{n-1}{2}$, which corresponds to a Wiender index of $\binom{n}{2} + \binom{n-1}{2} = (n-1)^2$. We deduce that for every $n$, there are graphs having Wiener index $\frac{n(n-1)}{2}$ to $(n-1)^2$. Let's list these ranges for small $n$, starting with $n = 2$:
$$ [1,1], \; [3,4], \; [6,9], \; [10,16], \; [15,25], \ldots $$
Denoting the intervals as $[a_n,b_n]$, starting with $n=5$ we have $a_{n+1} < b_n$, which is not hard to check directly. Therefore, in this way we can construct graphs of any Wiener index other than $2$ or $5$.
It remains to rule out 2 and 5. First, note that a graph of $n$ vertices has Wiener index at least $\binom{n}{2}$. Since $\binom{4}{2} = 6$, it is enough to consider all graphs on at most 3 vertices:

A path of length 1 has Wiener index 1.
A triangle has Wiener index 3.
A path of length 2 has Wiener index 4.

These are the only connected graphs on at most 3 vertices.


Teacher Forcing in RNNs

Question: I'm reading about teacher forcing for neural translation applications here and here , but I am a little confused on the method. Why does teacher forcing speed up training? Also why in the Kaggle link are they only doing teacher forcing a percentage of the time?
Comment: Updated with my source.
Comment: Reading where?  References might be good.  ArXiv? Medium?  Some random blog? YouTube?
Answer: Teacher forcing effectively means that instead of using the predictions of your neural network at time step t (i.e the output of your RNN), you are using the ground truth.
"Why does teacher forcing speed up training?"
Because if you don't use teacher forcing, it is autoregressive, meaning that you need to calculate the labels first before passing it at time step t.
"Also why in the Kaggle link are they only doing teacher forcing a percentage of the time?"
Because conditioning on the actual predictions might be more beneficial. Suppose that your RNN is unable to learn the input-output mapping to the desired precision. In that case, it is better to condition on its own faulty output so that it has a better chance of mitigating its own mistakes.
Related question: Is teacher forcing more accurate than using actual model output or just faster?
Comment: Hi! Thank you for your answer. What do you mean by "it is better to condition on its own faulty...better chance of mitigating its own mistakes."? Do you mean that we should not use teacher forcing 100% of the time so that we will have instances where mistakes are more likely, which is better for learning?
Comment: Yes, I mean that. There are good reasons to use teacher forcing, and I think in generic RNN training in PyTorch, it would be assumed that you are using teacher forcing because it is just faster. One way to look at is that you could have measurement error in your data, and the RNN functions like a filter trying to correct it. So if you want to introduce robustness to thee kind of measurement errors, it makes sense to sample both from the predicted and the observed samples. It is highly domain dependent whether it works but it can be treated as an additional hyperparameter.

Teacher Forcing in RNNs


Prove, using only the field axioms of real numbers, that $0/0$ is undefined.

Question: Prove, using only the field axioms of real numbers, that $0/0$ is undefined.  I have thought about it for a while and come up with an idea how to solve this. First, I would like to prove (using field axioms - again) that $x \cdot \frac{1}{y} = \frac{x}{y}$, (but I am still working on this - any hints would be most appreciated),therefore $\frac{0}{0} = 0 * \frac{1}{0}$ and then, say that - by virtue of one of the axioms there exists only one number $b$ satisfying the equation $ab = 1$ for all $a \ne 0$. Since in our case we want to take the reciprocal of 0 - the axiom clearly states that it does not exist.
Is this a good way to prove that the expression in question is undefined?
Comment: What does $\frac xy$ mean if it is not an abbreviation for $xy^{-1}$?
Comment: I am speaking on an "every step of the proof" level. Typically, the field operations are $+, \times, 0, 1$. Thus $\frac xy$ is not something you can formulate directly in the language of fields. Hence it must be defined. How is it defined?
Comment: @MeesdeVries
This is obvious, but as long as we are limited to the axioms, I like to think thoroughly through every step in my proof.
Comment: According to filed axioms $\dfrac 1 a$ is defined only for $a \ne 0$.
Comment: Thus, the issue is that $\dfrac 0 0 = 0 \times \dfrac 1 0$ is undefined because $\dfrac 1 0$ is undefined.
Comment: Agreed, but this relies on the proof that the equation $a \times 0 = 1$ has no solution.
Answer: Let $R$ be any ring with $1$.  Suppose that $0^{-1}$ makes sense.  Then that means $0 \cdot 0^{-1}=1 = 0^{-1}\cdot 0$.  Let $a \in R$ be arbitrary.  Then
$$
a = 1a = 0^{-1}0a = 0^{-1}0=0.
$$
Hence $R=\{0\}$.
Thus, if you want your ring to have more than one element, you better not let $0$ have an inverse.  So, not only should $\frac{0}{0}$ not make sense, no "fraction" of the form $\frac{a}{0}$ should make sense.
In case you do not believe that $a0=0$, we have
$$
a0 = a(0+0) = a0+a0.
$$
Now cancel an $a0$ from each side.  If you do not believe in subtraction/cancellation someone else will have to help you.
Comment: Your equations rely on $a \times 0 = 0$, but if you already know that then you're done (since $0 \neq 1$ in a field).
Comment: I disagree; I think it is the "difficult" part of the proof. But I will provide my own answer then.
Comment: I was avoiding assuming $1 \neq 0$ until the end.  Some people allow this, but either way, the argument above forces $R=\{0\}$ no matter what.
Comment: Fine, but your argument is still missing the proof that $a \times 0 = 0$.
Comment: I'm assuming that's not a dealbreaker/showstopper.  The OP can insert it.
Answer: The expression $\frac xy$ is not immediately in the language of fields, which only has the symbols $+,\times,-,0,1$. Thus we must define what $\frac xy$ means, and the fastest thing to do is as follows: if the equation $ya = x$ has a unique solution $a$, then $a = \frac xy$. (Typically you would define $y^{-1}$ first, and then set $\frac xy = xy^{-1}$, and we would have to rule out the existence of $0^{-1}$, but this route also works.)
Thus, let us show that $0 \times a = 0$ does not have a unique solution. In fact, for any $a$ we have
$$
0 \times a = (0 + 0) \times a = 0 \times a + 0 \times a.
$$
Now subtract $0 \times a$ from each side to obtain $0 = 0 \times a$. This means that the equation defining $\frac 00$ does not have a unique solution -- it has at least the solutions $0,1$ -- and thus $\frac 00$ is not well-defined.
Comment: How do you infer that because of the fact that $0 = 0 a$, the expression $0/0$ has more than one value?
Comment: Like I mentioned before, $\frac xy$ does not *a priori* mean anything. We have to give it meaning. The standard way to do this (without going via $y^{-1}$) would be to say: $\frac xy$ is defined if and only if $ya = x$ has a unique solution in $a$, and then that solution is $a = \frac xy$ by definition. Since $0 = 0a$ for at least two distinct $a$, we do not have a unique value for $\frac 00$.
Comment: Note that subtracting $0 \times a$ from each side relies on the existence and uniqueness of an additive inverse of every number, wich is one of the field axioms.
Answer: Suppose $\frac{0}{0}$ is defined.
Then, by the Existence of a Multiplicative Inverse, $\frac{0}{0}=1$
By the Existence of an Additive Inverse, we have $a+(-a)=0$. Using this with $a=1$, we can write:
$1-1=0 \Leftrightarrow \frac{0}{0} - \frac{0}{0} =0 \Leftrightarrow \frac{0-0}{0}=0 \Leftrightarrow \frac{0}{0}=0$
which leads to a contradiction by uniqueness of your multiplicative inverse.
Comment: Thanks, your answer is clear and hits the spot. However, I've got one question - you wrote that $0/0 - 0/0 = (0-0)/0$. But none of the axioms tells anything about fraction addition. Can I use it?
Comment: Consider the Distributivity of Multiplication over Addition that tells you $a\times(b+c)=a\times b+a\times c$ and let $a$ be the inverse of $0$.


How do I manage unit test resources in Kotlin, such as starting/stopping a database connection or an embedded elasticsearch server?

Question: In my Kotlin JUnit tests, I want to start/stop embedded servers and use them within my tests.
I tried using the JUnit @Before annotation on a method in my test class and it works fine, but it isn't the right behaviour since it runs every test case instead of just once.
Therefore I want to use the @BeforeClass annotation on a method, but adding it to a method results in an error saying it must be on a static method.  Kotlin doesn't appear to have static methods.  And then the same applies for static variables, because I need to keep a reference to the embedded server around for use in the test cases.
So how do I create this embedded database just once for all of my test cases?
class MyTest {
    @Before fun setup() {
       // works in that it opens the database connection, but is wrong
       // since this is per test case instead of being shared for all
    }

    @BeforeClass fun setupClass() {
       // what I want to do instead, but results in error because
       // this isn't a static method, and static keyword doesn't exist
    }

    var referenceToServer: ServerType // wrong because is not static either

    ...
}

Note: this question is intentionally written and answered by the author (Self-Answered Questions), so that the answers to commonly asked Kotlin topics are present in SO.
Comment: JUnit 5 may support non-static methods for that use case, see https://github.com/junit-team/junit5/issues/419#issuecomment-267815529 and feel free to +1 my comment to show Kotlin developers are interested in such improvements.
Answer: Your unit test class usually needs a few things to manage a shared resource for a group of test methods.  And in Kotlin you can use @BeforeClass and @AfterClass not in the test class, but rather within its companion object along with the @JvmStatic annotation.
The structure of a test class would look like:
class MyTestClass {
    companion object {
        init {
           // things that may need to be setup before companion class member variables are instantiated
        }

        // variables you initialize for the class just once:
        val someClassVar = initializer()

        // variables you initialize for the class later in the @BeforeClass method:
        lateinit var someClassLateVar: SomeResource

        @BeforeClass @JvmStatic fun setup() {
           // things to execute once and keep around for the class
        }

        @AfterClass @JvmStatic fun teardown() {
           // clean up after this class, leave nothing dirty behind
        }
    }

    // variables you initialize per instance of the test class:
    val someInstanceVar = initializer()

    // variables you initialize per test case later in your @Before methods:
    var lateinit someInstanceLateZVar: MyType

    @Before fun prepareTest() {
        // things to do before each test
    }

    @After fun cleanupTest() {
        // things to do after each test
    }

    @Test fun testSomething() {
        // an actual test case
    }

    @Test fun testSomethingElse() {
        // another test case
    }

    // ...more test cases
}

Given the above, you should read about:

companion objects - similar to the Class object in Java, but a singleton per class that is not static
@JvmStatic - an annotation that turns a companion object method into a static method on the outer class for Java interop
lateinit - allows a var property to be initialized later when you have a well defined lifecycle
Delegates.notNull() - can be used instead of lateinit for a property that should be set at least once before being read.

Here are fuller examples of test classes for Kotlin that manage embedded resources.
The first is copied and modified from Solr-Undertow tests, and before the test cases are run, configures and starts a Solr-Undertow server.  After the tests run, it cleans up any temporary files created by the tests.  It also ensures environment variables and system properties are correct before the tests are run.  Between test cases it unloads any temporary loaded Solr cores.  The test:
class TestServerWithPlugin {
    companion object {
        val workingDir = Paths.get("test-data/solr-standalone").toAbsolutePath()
        val coreWithPluginDir = workingDir.resolve("plugin-test/collection1")

        lateinit var server: Server

        @BeforeClass @JvmStatic fun setup() {
            assertTrue(coreWithPluginDir.exists(), "test core w/plugin does not exist $coreWithPluginDir")

            // make sure no system properties are set that could interfere with test
            resetEnvProxy()
            cleanSysProps()
            routeJbossLoggingToSlf4j()
            cleanFiles()

            val config = mapOf(...)
            val configLoader = ServerConfigFromOverridesAndReference(workingDir, config) verifiedBy { loader ->
                ...
            }

            assertNotNull(System.getProperty("solr.solr.home"))

            server = Server(configLoader)
            val (serverStarted, message) = server.run()
            if (!serverStarted) {
                fail("Server not started: '$message'")
            }
        }

        @AfterClass @JvmStatic fun teardown() {
            server.shutdown()
            cleanFiles()
            resetEnvProxy()
            cleanSysProps()
        }

        private fun cleanSysProps() { ... }

        private fun cleanFiles() {
            // don't leave any test files behind
            coreWithPluginDir.resolve("data").deleteRecursively()
            Files.deleteIfExists(coreWithPluginDir.resolve("core.properties"))
            Files.deleteIfExists(coreWithPluginDir.resolve("core.properties.unloaded"))
        }
    }

    val adminClient: SolrClient = HttpSolrClient("http://localhost:8983/solr/")

    @Before fun prepareTest() {
        // anything before each test?
    }

    @After fun cleanupTest() {
        // make sure test cores do not bleed over between test cases
        unloadCoreIfExists("tempCollection1")
        unloadCoreIfExists("tempCollection2")
        unloadCoreIfExists("tempCollection3")
    }

    private fun unloadCoreIfExists(name: String) { ... }

    @Test
    fun testServerLoadsPlugin() {
        println("Loading core 'withplugin' from dir ${coreWithPluginDir.toString()}")
        val response = CoreAdminRequest.createCore("tempCollection1", coreWithPluginDir.toString(), adminClient)
        assertEquals(0, response.status)
    }

    // ... other test cases
}

And another starting AWS DynamoDB local as an embedded database (copied and modified slightly from Running AWS DynamoDB-local embedded).  This test must hack the java.library.path before anything else happens or local DynamoDB (using sqlite with binary libraries) won't run.  Then it starts a server to share for all test classes, and cleans up temporary data between tests.  The test:
class TestAccountManager {
    companion object {
        init {
            // we need to control the "java.library.path" or sqlite cannot find its libraries
            val dynLibPath = File("./src/test/dynlib/").absoluteFile
            System.setProperty("java.library.path", dynLibPath.toString());

            // TEST HACK: if we kill this value in the System classloader, it will be
            // recreated on next access allowing java.library.path to be reset
            val fieldSysPath = ClassLoader::class.java.getDeclaredField("sys_paths")
            fieldSysPath.setAccessible(true)
            fieldSysPath.set(null, null)

            // ensure logging always goes through Slf4j
            System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.Slf4jLog")
        }

        private val localDbPort = 19444

        private lateinit var localDb: DynamoDBProxyServer
        private lateinit var dbClient: AmazonDynamoDBClient
        private lateinit var dynamo: DynamoDB

        @BeforeClass @JvmStatic fun setup() {
            // do not use ServerRunner, it is evil and doesn't set the port correctly, also
            // it resets logging to be off.
            localDb = DynamoDBProxyServer(localDbPort, LocalDynamoDBServerHandler(
                    LocalDynamoDBRequestHandler(0, true, null, true, true), null)
            )
            localDb.start()

            // fake credentials are required even though ignored
            val auth = BasicAWSCredentials("fakeKey", "fakeSecret")
            dbClient = AmazonDynamoDBClient(auth) initializedWith {
                signerRegionOverride = "us-east-1"
                setEndpoint("http://localhost:$localDbPort")
            }
            dynamo = DynamoDB(dbClient)

            // create the tables once
            AccountManagerSchema.createTables(dbClient)

            // for debugging reference
            dynamo.listTables().forEach { table ->
                println(table.tableName)
            }
        }

        @AfterClass @JvmStatic fun teardown() {
            dbClient.shutdown()
            localDb.stop()
        }
    }

    val jsonMapper = jacksonObjectMapper()
    val dynamoMapper: DynamoDBMapper = DynamoDBMapper(dbClient)

    @Before fun prepareTest() {
        // insert commonly used test data
        setupStaticBillingData(dbClient)
    }

    @After fun cleanupTest() {
        // delete anything that shouldn't survive any test case
        deleteAllInTable<Account>()
        deleteAllInTable<Organization>()
        deleteAllInTable<Billing>()
    }

    private inline fun <reified T: Any> deleteAllInTable() { ... }

    @Test fun testAccountJsonRoundTrip() {
        val acct = Account("123",  ...)
        dynamoMapper.save(acct)

        val item = dynamo.getTable("Accounts").getItem("id", "123")
        val acctReadJson = jsonMapper.readValue<Account>(item.toJSON())
        assertEquals(acct, acctReadJson)
    }

    // ...more test cases

}

NOTE: some parts of the examples are abbreviated with ...
Answer: Managing resources with before/after callbacks in tests, obviously, has it's pros:

Tests are "atomic". A test executes as a whole things with all the callbacks One won't forget to fire up a dependency service before the tests and shut it down after it's done. If done properly, executions callbacks will work on any environment.
Tests are self-contained. There is no external data or setup phases, everything is contained within a few test classes.

It has some cons too. One important of them is that it pollutes the code and makes the code violate single responsibility principle. Tests now not only test something, but perform a heavyweight initialization and resource management. It can be ok in some cases (like configuring an ObjectMapper), but modifying java.library.path or spawning another processes (or in-process embedded databases) are not so innocent.
Why not treat those services as dependencies for your test eligible for "injection", like described by 12factor.net.
This way you start and initialize dependency services somewhere outside of the test code.
Nowadays virtualization and containers are almost everywhere and most developers' machines are able to run Docker. And most of the application have a dockerized version: Elasticsearch, DynamoDB, PostgreSQL and so on. Docker is a perfect solution for external services that your tests need.

It can be a script that runs is run manually by a developer every time she wants to execute tests.
It can be a task run by build tool (e.g. Gradle has awesome dependsOn and finalizedBy DSL for defining dependencies). A task, of course, can execute the same script that developer executes manually using shell-outs / process execs.
It can be a task run by IDE before test execution. Again, it can use the same script.
Most CI / CD providers have a notion of "service" — an external dependency (process) that runs in parallel to your build and can be accessed via it's usual SDK / connector / API: Gitlab, Travis, Bitbucket, AppVeyor, Semaphore, …

This approach:

Frees your test code from initialization logic. Your tests will only test and do nothing more.
Decouples code and data. Adding a new test case can now be done by adding new data into dependency services with it's native toolset. I.e. for SQL databases you'll use SQL, for Amazon DynamoDB you'll use CLI to create tables and put items.
Is closer to a production code, where you obviously do not start those services when your "main" application starts.

Of course, it has it's flaws (basically, the statements I've started from):

Tests are not more "atomic". Dependency service must be started somehow prior test execution. The way it is started may be different in different environments: developer's machine or CI, IDE or build tool CLI.
Tests are not self-contained. Now your seed data may be even packed inside an image, so changing it may require rebuilding a different project.
Comment: Unit tests should not depend on external resources.
Comment: I mentioned that in pros section at the very top of the answer. But, believe or not, there may be another point of view on that, described below.
Comment: And, strictly speaking, unit tests should not use a database at all, it's more about higher level of testing pyramid.


Email Alias in Power Automate

Question: Having trouble with flow identifying email address with an alias behind it to trigger flow.  The flow runs yet ends up in a wait because the start and wait for an approval assigned to does not recognize how to handle alias behind the email address. any help or solution to solve this issue?
Comment: What is behind the alias? Is it a real person or is it a shared mailbox? Approvals need to have real people assigned. They cannot be processed by a shared mailbox address.
Answer: The values in Assigned to must be active users in the organization directory (Guests included). Groups including Microsoft 365 groups are not valid receipts as email receivers.
You can change this alias to an active user just to confirm.
Comment: It is an active account in the organization directory, as I type the email, the account appears in the assigned to field. It is redirected to a different recipient to take action.  The org wants it setup this way to facilitate one or more persons to manage the email address... There are real people behind all of the mailboxes in question, in some cases it is a shared mailbox of two or more people and in others it is just one person.
Comment: @tfitzhugh I'm sure you have valid users to manage these mailboxes, but shared mailboxes cannot be recognized in Flow and there is nothing we can do to fix it. You will have to give separate email addresses in this field so that the flow can send emails accordingly.

Email Alias in Power Automate


What is illegal about illegal street racing?

Question: Would an arrangement between two (or more) parties to get from point A to point B in the fastest way possible without breaking any laws and the fastest party would receive a price pool made up of equal deposits by all parties -taxes be considered illegal street racing?
Comment: Reminds of me Dominos pizza being sued because their policy encouraged drivers to break the law.
Answer: The usual law which pertains to (outlaws) racing is stated in terms of comparing speeds, and the speeds do not have to be above the legal limit. Washington law confuses people because it has the exception that

any comparison or contest of the accuracy with which motor vehicles
  may be operated in terms of relative speeds not in excess of the
  posted maximum speed does not constitute racing

Some locations (esp. Kent WA) have ordinances prohibiting presence in a street-racing area (there is a list), with fines for observers up to $1000. Simultaneously testing alternative routes (e.g. "I'll take 405, you take the back roads") is perfectly legal. The question of gambling is not so clear (it involves local law which is more variable). Skill is involved in the aforementioned activity. A sports pool may be legal, but there are many conditions on such a pool which make it unlikely that a "race" would qualify (for betting without a license). Since Washington law is fairly specific, I would assume that they interpret the lack of permission to have an pool on the outcome of a race as an activity requiring a license, though I can't find an explicit ban.
Answer: Street racing is illegal in most of the world, although the way laws deal with it may differ.
A couple of examples:
In Brazil a law was passed in 2014 to deal with "rachas" (street races) that modified both the road code. The road code (art. 173) forbids races ("disputar corrida") without more details, qualifies it as a very severe offence and punishes it with a fine, cancellation of drivers license and vehicle apprehension. If the race involves risk (art. 308), it becomes a crime punished with 6 months to 3 years imprisonment. If it has consequences the sentence can be longer.
In summary, in Brasil street racing is illegal even not breaking any other law and not causing risky situations. If risk is involved, it's a crime in addition of being illegal.
In Spain the road code (art. 22.5) forbids speed competition in public ways or public used ways. That is, it's a general prohibition similar to that of Brazil that works even if no other law is broken. It is also punished with fines.
Anyway, in both Spain and Brazil the law allows that for competitions in streets or roads to be authorized.


Understanding strong acid titrated with weak base graph

Question:
I don't understand why the conductivity doesn't change after the equivalence point. To my understanding, at the equivalence point there is $\ce{NH3}$, $\ce{NH4+}$ and $\ce{Cl-}$ in the solution. As more $\ce{NH3}$ is added it only partially dissociates, thus conductivity stays the same. But doesn't the concentration of $\ce{Cl-}$ ions also contribute to the conductivity, and its conductivity decreases are more aqueous $\ce{NH3}$ is added as it becomes more dilute? Where is the issue in my understanding. Thanks for the help.
Comment: I would not pay the chart too much attention, as it seems to me rather just illustrative, comparing trends before and after the equivalence point.
Comment: Source of image: https://www.tau.ac.il/~chemlaba/Files/conductometry-titrations.pdf
Answer: You are missing an important point. Conductometric titration is not just plotting the conductance after adding the titrant. One cannot plot conductance as it is, because you are significantly diluting the solution.  You have to apply a correction to take dilution into account. Once you apply a correction, the curve will remain flat because further addition of ammonia will not enhance conductivity.
See for example,

Conductometric titrations
Throughout a titration the volume of the solution is always increasing, unless the
conductance is corrected for this effect, non linear titration curves result. The
correction can be accomplished by multiplying the observed conductance either
by total volume (V+V') or by the factor (V+ V')/V, where V is the initial volume
of solution and V' is the total volume of the reagent added. The correction
presupposes that the conductivity is a linear function of dilution, this is true only
to a first approximation.
Comment: Thank you. We learnt it very briefly at school and this helped me make sense of it.
Answer: After equivalence point you add more and more NH3 solution (remember NH4OH does not exist). So you add a negligible amount of ions. As a consequence, the conductance does not change significantly. This is what your diagram shows.
Comment: But wouldn't conductivity decrease because of lowered Cl - concentration?
Comment: @Subbota It would and will, but see the other comment. Its decrease is insignificant, compared to replacing highly mobile hydronium ions by relatively slow ammonium ions.


Can we detect if a site is on CDN?

Question: Is there a way to detect if a site is on a Content Delivery Network and if yes, can we tell which service are they using?
Comment: possible duplicate of [Check CDN(Content Delivery Network) for a given website](http://stackoverflow.com/questions/3447187/check-cdncontent-delivery-network-for-a-given-website)
Comment: You may want to ask this stackexchange site http://webmasters.stackexchange.com/
Answer: A method that is achievable from the command line is using the 'host' command, with the -a flag  set to see the DNS record e.g.
host -a www.visitbritain.com

Returns:
www.visitbritain.com.   0   IN  CNAME   d18sjq5nyxcof4.cloudfront.net.

Here you can see that the CNAME entry tells us that the site is using cloudfront as the CDN.
Answer: Just take a look at the urls of the images (and other media) of the site.
Reverse lookup IP's of the hostnames you see there and you will see who own them.
Answer: I built this little tool to identify the CDN used by a site or a domain, feel free to try it.
The URL: http://www.whatsmycdn.com/
Comment: Unfortunately, I don't think this is working anymore, at least for me. Every time I put something in it just return a blank field
Answer: You might also be able to tell from the HTTP headers of the media if the URL doesn't give it away. For example, media served by SimpleCDN has Server: SimpleCDN 5.6a4 in its headers.
Answer: cdn planet now have their cdn finder tool on github
http://www.cdnplanet.com/blog/better-cdn-finder/   The tool  installs on the command line and allows you the feed in host names and check if they use a CDN.
Comment: Note that [link-only answers](http://meta.stackoverflow.com/tags/link-only-answers/info) are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which  tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference.
Answer: Apart from some excellent answers already posted here which include some direct methods which may or may not work for all the websites out there, there is also an indirect way to see if a CDN is there. And especially if its your own website and you want to know if you are getting what you are paying for !
The promise of a CDN is that connections from your users are terminated closer to them so that they get less TCP / TLS connection establishment overhead and static content is cached closet to them so that it loads faster, puts less strain on your origin servers.
To verify this, you can take measurements of site load times across the globe and see if all the users get similar loads times. No you dont have to get a machine everywhere in the world to do that ! Someone has already done that for you
Head to https://prober.tech/ and the URL you wish to test for load times.
Because this site itself is in Cloudflare's CDN, you can put that link itself in the test box and use it as baseline !
More information on using the tool can be found here
Answer: Yes you can find by
host -a www.website.com

Comment: How does this answer the question? Can you elaborate please?
Answer: If Website using GCP CDN you simply check it using curl
curl -I <https://site url>

In reponse you can find following headers there available
x-goog-metageneration: 2
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 17393
x-goog-meta-object-id: 11602
x-goog-meta-source-id: 013dea516b21eedfd422a05b96e2c3e4
x-goog-meta-file-hash: cf3690283997e18819b224c6c094f26c

Can we detect if a site is on CDN?


How does Wheatley recover after GLaDOS's crush?

Question: How does Wheatley reassemble himself after GLaDOS crushes him when she awakes? I have looked all over chapters 2 and 3 but I must be missing something.
Answer: It doesn't. You'll notice that since then, Wheatley's eye appears cracked. Take a gander.
Comment: It's not just his eye. His entire shell is also damaged, however it wasn't damaged beyond repair.
Comment: I thought his cracked eye was from being dropped.
Comment: I know this answer has been accepted, but it doesn't actually explain how he survived or got re-built - just that he wasn't quite as dead as we thought, and that there is evidence of his damage.
Comment: @Zibbobz We don't speculate about plot holes on this website.
Answer: When you first see him after he is crushed he rambles on about something while you jump up and down to hear it. I always assumed that the game developers intended to give you the impression he was telling you how, but he didn't realize you couldn't hear him between jumps. I think they did it this way to develop his character as someone who was incompetent.
What's interesting is that in "The Final Hours" they reveal that for the longest time they were going to have Wheatly die off when GLaDOS awakens, it's only in the last year of development that it was decided that the character should live and take on a larger role in the game.
Answer: While Wheatley obviously sustains some damage from GLaDOS's rough handling, he's not actually offline when she discards him and tosses you into the incinerator. As Wheatley's line in this video suggests ("There I was, just lying there, you thought I was done for, but—"), he's just playing dead.
Answer: You also see visable signs of damage on wheatley after his escape from crushing, He sparks a bit and his movement is a little jitty, Also his eye is cracked.
He rambles on about how he escaped in the test chamber with the broken faith plate, Something about birds
Answer: He maybe had a spare version of himself which had some sort of remote device where the spare would activate if the original was damaged. The spare maybe was also withered from age.
Answer: Wheatley is a computer. He can always switch forms, because a computer has no set hardware. Their code can be sent through different systems, like sending GLaDOS through a MacBook Pro.
Comment: This is incorrect. Moreover, Wheatley's hardware doesn't change (which is kind of the point of the question).
Answer: When Wheatly is rambling on about how he was saved as you jump up and down on the faith plate, the only clue he gives is something about a bird.   This is probably the black crow that is trapped in Aperture labs who keeps reappearing throughout the game. (carries off PotatOS, attacks Wheatly for destroying its eggs, etc.)  I'm not exactly sure how the bird would help him.  If I were to guess, I would say he was rebuilt by nanobots.  They aren't in the game much, but Wheatly briefly mentions them when he says they are rebuilding the elevator.  If they can rebuild elevators, why not personality cores?
Answer: I think the Half-Life wiki said that the official VALVe guide said that Wheatley somehow managed to reactivate himself using a spare core. I have no idea how he managed to do that while deactivated though


Can any spanning subset be reduced to a Hamel basis in infinite dimensions?

Question: As per this question, it is possible to extend any l.i. subset of vectors $A \subset V$ of a vector space to a (Hamel) basis, $B \subset V$. Is it likewise possible to delete vectors from a spanning subset $S\subset V$ ($span(S) = V$)? The argument is trivial in finite-dimensions, but it's not clear to me that this is possible in infinite dimensions. Even a sketch of the proof would be greatly appreciated.
Answer: Let $B$ be a maximal independent subset of $S$, which exists by Zorn's Lemma. Then we can show that $span(B) = span(S) = V$. For given $s \in S$, suppose $s \notin span(B)$. Then $B \cup \{s\}$ is a larger independent subset of $S$ than $B$ is; contradiction.
Also, note that we cannot prove this theorem without Zorn's Lemma (or some statement of the equivalent axiom of choice). In fact, over ZF, the claim that every vector space has a basis is equivalent to Zorn's Lemma. Clearly, your claim implies that all vector spaces have bases, as we can take $S = V$.
Comment: Ah, so to be clear you're saying that Zorn's lemma is not just equivalent to saying that $span(S) = V$ has a basis, but it's also equivalent to saying that I can choose that basis as coming from elements of $S$?
Comment: Yes. We just proved that Zorn's Lemma implies we can pick a basis from $S$. Trivially, we can thus find some basis for $V$. Far less trivially, we can then use this principle to prove Zorn's Lemma.


Should the user be given an option to turn off confirmations?

Question: Should users be given an option to turn off the confirmations across the whole website? An example could be to add a checkbox under user settings that turns the confirmations on and off for actions like leave an unsaved page, delete a record, etc.
Answer: If you don't provide the user the possibility to turn off a single confirmation, it looks to me like a bad idea as it will probably be used to turn off a single useless or annoying confirmation without being able to evaluate the whole impact of this action.
A better design may be to add a "Don't display this confirmation again" checkbox to each confirmation (or each non-critical confirmations) and save this setting per user.
Comment: I disagree on the "Don't display this confirmation again" checkbox. Their main problem is, that there is no obvious way to undo this choice. Even if you provide one, how do you expect your users to find it? It means the place to turn off the warning is different than where to turn it on again.
Comment: Also it's a good idea to include a note "you can later re-enable these confirmations from settings".
Comment: @André Turning the warning back on is a rare case, so it can be more difficult. The important thing is that the user knows his choice is not permanent, even if a bit more difficult.
Comment: There can be an user interface to enable / disable the confirmations user wise.
Answer: Confirmations are an important part of a user interface. They make sure that the state of the application is clear to a user. That said, you don't have to slap them in the face with these confirmations.
When designing your notifications you need check if each confirmation is actually necessary. Perhaps the application state is already obvious through other means. E.g. a deleted record might be removed from the screen or presented differently (strike-through), so that other confirmation is not required.
You could also provide a second, suppressed level of confirmation. Use subtle indicators for common confirmations or confirmations users have already seen.
If your confirmations are well-designed, there should be no reason for users to configure their behavior. Users should focus on accomplishing their tasks, and should not have to worry about configuring an application's behavior: that should be awesome, useful and friendly right out of the box.


Publishing service with Sitemap XML

Question: I've got the Sitemap XML package installed and I'm interested in using the new publishing service. Because the publish:end pipeline is no longer used with the publishing service, where would I put that call for the Sitemap XML now so it fires after the publishing service runs?
Comment: Which version of the publishing service are you using? I thought the latest one (2.0) does have the publish:end event.
Comment: I'm not using it yet, just been doing some reading. I just know it doesn't use the "classic" publish:end pipeline, or I thought it didn't at least.
Answer: In v2.0, the publishing service module exposes a new event in Sitecore: publishingservice:publishend
When the publishing service completes a publishing job, this event is triggered once for the entire job in addition to the three events from the existing publishing system:

publish:begin
publish:complete
publish:fail

So apparently the publish:end is not yet supported but you could use the new event from the service or the publish:complete.
I tested that last one and it works, but has a small bug: the published languages are not all send to the event (just the first one). That has been fixed in a hotfix though (can give the number as soon as I can access the support site again).
Be aware that the arguments for the events are not the same, so you will need to write the event code again.

Publishing service with Sitemap XML


How can someone evaluate llama index model?

Question: I have built a openAI llama index based model which takes multiple pdf and able to give chatbot based response. I want to evaluate the llm for accuracy. I already know method such as Rouge and Bleu. Is there any other way to evaluate model ?
Answer:
Is there any other way to evaluate model ?

Assuming you have a test set with gold answers, you can use a text generation metric. See Evaluation of Text Generation: A Survey. Typical metrics: TF-IDF cosine, Rouge, Bleu, BertScore, Sentence-Bert, and more recently, GPTScore and G-Eval. Note that they have some serious limitations when evaluating GPT output {1,2}.

More recent works:

JudgeLM: Fine-tuned Large Language Models are Scalable Judges. Code: https://github.com/baaivision/JudgeLM. Paper: https://arxiv.org/abs/2310.17631

References:

{1} Goyal, Tanya, Junyi Jessy Li, and Greg Durrett. "News Summarization and Evaluation in the Era of GPT-3." arXiv preprint arXiv:2209.12356 (2022).
{2} Tianyi Zhang, Faisal Ladhak, Esin Durmus, Percy Liang, Kathleen McKeown, Tatsunori B. Hashimoto. Benchmarking Large Language Models for News Summarization. arXiv:2301.13848.

Since comparing the semantic similarity of the predicted answer with a reference question has some limitations, one may look at complementing the analysis with a human evaluation. The following papers survey criteria used for human evaluation of generated texts (thanks Mengjiao Zhang for pointing me to refs {3,4}):

{3} A Survey of Evaluation Metrics Used for NLG Systems
{4} Perturbation CheckLists for Evaluating NLG Evaluation Metrics (unfortunately, they forgot about QA)

From {3}:


How can I fill these holes?

Question:
Previous owner of our house left some large-ish holes in the wall. The biggest one is 8cm in diameter and the smaller ones are from dry wall anchor (Molly) bolts that I removed. They are about an inch wide. What's the best way to go about filling these?
Comment: put in a circular piece of drywall, tape it and patch it ... if it looks good, then you are done ... if it does not look good, then it is just practice ... cut the hole square as suggested in the answer below
Comment: Or don't fix it and put a tv up there to hide the damage.
Answer: If this is drywall I would buy a small bucket of plaster and some drywall tape (the mesh kind), drywall knives and patch the smaller once that way. The bigger one I would cut a bigger square hole from stud to stud and cut a nicely fitting drywall piece to fit into the square. Fix it to the studs with drywall screws. Then use the same drywall compound and drywall tape to patch up the seems of the patch. All the stuff should be easy to get in the store. It takes some skills to get all of that smooth. Check out some drywall videos on youtube
Comment: @JM The large hole appears to have some sort of ring inside it. You need to cut that out as you won't be able to get a smooth patch over it. Once you are doing that, rectangles are a **lot** easier to match up than circles.
Comment: Thank you, so you wouldn't recommend cutting a piece of circular drywall to fit in the gap and using a piece of wood to bridge it?
Answer: The small holes are easily filled with drywall compound and a putty knife.
The large hole can be repaired as Ride Sun suggested (by going to the studs so you have something to screw into) or you can get a strip of wood about the size of a paint stirring stick and slide it behind the drywall so it crosses the hole, then screw through the drywall into the wood.  Then you can put a round piece of drywall in the hole and screw it to the wood.  You'll have to add drywall compound to fill the round gap, of course.

How can I fill these holes?


Mount ceiling fan box to underside of joist

Question: I want to install a ceiling fan outside under a porch. I would run new conduit up to the underside of the ceiling joist. The joists are covered by bead board which I could cut away from the joist. I found a box by Garvin, their 54171-FANNBWP. The instructions indicate it can be mounted directly underneath the ceiling joist. It is a fan rated, outdoor rated electrical box. I wanted to get some experienced opinions on whether this would be a problem.
Comment: If you are running conduit on the surface of  a beadboard ceiling, then you might want to just surface mount the fan box. This would put the conduit in the correct position to connect to the box. Just be sure that the screws that hold the box go into the joist and are long enough to go deep enough into the joist.
Comment: The instructions say use lag screws to secure the box to the joist. These are coarse threaded fairly large diameter screws which require predrilling.  Use a large enough drill so that the joist doesn't split and drill deep enough for the entire length of the screw. The threads should bite, but the shaft should not force the wood out.  I use lubricant to ease threading in. I would use 3.5 inch long 1/4 or 3/8 inch diameter.
Comment: The screws into the joist are the key here and the box in my opinion conduit is easy but a improper box can have lethal issues , can't remember the year but headlines were something like failed ceiling fan hits woman kills infant , I had kids back then and was licensed may not have always used listed boxes prior to this, now as a great grampa and still working so far always since I read that (no internet back then)+
Comment: Please see the photo of the  instructions. I have small kids so I did my best to make sure this would all be correctly done. Box is rated for a 70lb fan or 250lb static load.

In terms of screw length any recommendations?  I was thinking between 2.5 -4 inch grk screws.
Answer: The only real reason to cut into the ceiling would be if you needed to bring the wires down from inside the ceiling. Since that isn't the case, I would buy some 3" lag bolts with pan heads (something like this) and drive them through the bead board and into the joist.
The reason for the diagram is they want to emphasize the joist part (#2 in the list). Screwing this into bead board only would be a recipe for disaster.
Comment: If the screws used are true "self drilling" then predrilling may not be necessary. It can't hurt to predrill, but it's an extra step.


Simulation of typical cell in Poisson Voronoi tessellation

Question: I would like to simulate a typical cell in Poisson-Voronoi tessellation model. I want to save the Cartesian coordinates of all vertices of the typical cell for each realization. How to do it? Thank you in advance :D
Answer: Look in this link, especially pay attention to the great code by David Clark.


java.io.IOException: WSDL2Java emitter timed out (this often means the WSDL at the specified URL is inaccessible)!

Question: i'm getting following error when i "deploy ant" on the terminal.
i found some answer like change "timeout to -1" .But i'm still wondering where to change the time .
Is it build.xml file of Axis?
Answer: I assume you're using the NetSuite Java Samples? In that case you need to look for a file called build.xml in the bin folder. This is the ant build script. Near the bottom there is a node called axis-wsdl2java. Add an attribute like so: timeout="120000" <- 2 minutes.


How do I bulk up while remaining lean?

Question: I am a 19 year old male, 5' 7", 135 pounds. Up until last year I was focused solely on calisthenics as my body training and as a result of that I am extremely toned and lean but I have a skinny body. This year I've decided to start lifting weights and bulk up. The transition was relatively easy because I already had the strength for it but I feel like I haven't been putting all my effort into this new training plan due to a fear that I will gain to much weight (fat weight).
My question really boils down to this: how do I gain muscle weight and mass while retaining my "toneness" of my body? (Asking both about the eating aspect and the training aspect)
Thank you!
Answer: How many calories a day are you taking in now? Let's go with 2000 calories.
If you want to gain some muscle mass, you need to shift your calories to include more proteins (beef, chicken, fish) and good fats (avocados, nuts, olive oil).
But, if you are lean now, that will not be enough.
Add an extra 100 calories to your daily diet. 100 calories is minimal, and focus those calories on protein for muscle growth.
Give yourself time to see how your body responds to the extra calories. You are either going to apply that to muscle or you will be taking in too many and storing some of your total calories as fat.
If you are staying lean the way you want, you can add another 100 calories.
Again, give your body time to see how it responds to the extra intake.
Once you start noticing that your body is adding fat, cut back a little on your calories to a total calorie count that you can maintain.
Comment: Thanks! What exactly do you mean by calories, are you referring to carbs, protein, fats or a combination of the three? As of now I'm consuming roughly 160 grams of protein a day but I'm not really monitoring carbs and fat.
Comment: All 3. You need them all. Carbs give you energy, Fat lubricates the joints and provides a slow energy source, and Protein is what your body uses to build with.
Comment: @Maslin, if you have a smartphone, it is really easy these days to keep a record of your calories. For example, I use a free app called [Lose It!](https://play.google.com/store/apps/details?id=com.fitnow.loseit) because it has a big database of foods already entered and I can scan the barcode on something and pull up the nutritional information. It's good for counting total calories, but not the best at keeping up with Protein, Carbs, and Fat. There are many others.

How do I bulk up while remaining lean?


How to use 欢迎 in a sentence?

Question: How exactly does one use the verb 欢迎?
Like in the sentence, 欢迎您到北京来.
Does it require 到 when saying welcome to?  What is the purpose of 来 in the sentence?
Answer: 欢迎您"到"(arrive)北京"来"(come). = 欢迎您"来到"(to come to and arrive in)北京. - Welcome you to come to (and arrive in) Bejing.
The above sentence is the more formal way of greeting. Less formally, you can say:

欢迎您到北京 - Welcome you to arrive in Bejing.

欢迎您来北京 - Welcome you to come to Bejing.
Comment: 非常**欢迎**你的信任票. 謝謝! :)
Answer: 歡迎你到我家。
Wellcome you to my home.
You are welcome to visit our house.
歡迎你來拜訪我們家。
Answer: 歡迎 often means "welcome/greet (a guest etc.)" or a related meaning  "someone/something has a good reception"
Example of the first use in a standard way is saying "歡迎您到北京來!(we) welcome you to beijing!" note the formal nin, this is a fairly formal vocab in this form. Imagine going to greet a guest for pick up at the airport and make them feel welcome, sign and entourage and all: this encapsulates the mood of this word.
The second use can be casual or formal, often  in reviews and so on: an example is saying "這場電子遊戲深受公眾歡迎 this video game has been well received/is popular(with people in general or a specific group in context etc.)"
Answer: Though you asked for how it is used as a verb explicitly and others here have already provided good examples of this, there are ways it can be used as an adverb or adjective as well. Most of these can be found by looking up 歡迎 in the Pleco dictionary directly, with some example sentences below:

Visitors are welcome. 歡迎參觀。

The streets were lined with welcoming crowds. 大街兩旁擠滿了歡迎的人群。

Literary works of this kind are very popular. 這樣的文學作品很受群衆歡迎。

How to use 欢迎 in a sentence?


I would like to design an op Amp based 25Mhz Hartley oscillator

Question: Hello i am a beginner at this and i would like your guidance . I would like to design an op Amp based 25Mhz Hartley's oscillator . I did some calculations and came up with the oscillator below , but it doesn't oscillate please help me
Comment: Please show the calculations you did.
Comment: What is the most appropriate gain for this design . The ratio of R2/R1 . Should it be large or small ?? . Please help
Comment: The opamp has to drive a near-short in those inductors. Rescale the frequency-control network.
Answer: Andy aka has explained why the 741 type opamp is not a proper choice. You need an other opamp which has a unity gain bandwidth which is at least 10 times larger than your oscillation frequency. More than that, it must exhibit a very fast slew rate (large-signal bandwidth). This is not easy to find. For this reason, at this frequency a simple transistor stage may be a better choice.
However, besides these arguments: Even with a high-frequency opamp the shown circuit is not able to produce self-sustained oscillation. Look at the inductor L2 - what is its effect? It has (practically) no effect on the feedback network because it works just as a load impedance - nothing else.
Surprisingly, this error can be found in the literature rather often. The authors simply transfer the principle of transistor-based circuits to opamp based circuits - and they forget that the transistor acts as a current source, whereas the opamp is a voltage source.
Hence, it is important to add another resistor Ro between the opamp output and the common node of L2 and C1. In this case, we have a 3rd-order feedback path which allows the required 180 deg phase shift at the desired frequency (high pass Ro-L2-C1-L1)
Answer:
it doesn't oscillate please help me

Here's your schematic with a small red box around the type of op-amp: -

The 741 is a dinosaur and will never oscillate at 25 MHz under any reasonable circumstances.
The blue box shows the component values you have chosen and these are not well suited for this type of circuit. Inductance needs to be at least 10 times bigger and capacitance needs to be 10 times smaller to begin standing a chance.
Reasons not to use a 741 op-amp
Comment: What is the reason for the capacitance to be 10 times greater than the inductance
Comment: Inductance needs to be at least 10x bigger than 3.18 nH and capacitance at least 10x smaller than 6.36 nF for operating around 25 MHz. I say this through experience.