qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
1,040,154 | Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected. I'm not sure whether this will work or not, but intuitively I think the answer is yes. | 2014/11/26 | [
"https://math.stackexchange.com/questions/1040154",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/53265/"
] | If we just want $(X,d)$ to be any subspace of a larger connected space, then sure: we don't even need metric then, just Tychonoff: every Tychonoff space embeds into a (connected) space $[0,1]^I$ for some set $I$.
If we want $X$ to be dense in the larger connected space $Y$, then $Y$ is called a connectification. In th... | Use Kuratowski embedding to embed your metric space isometrically into a Banach space. |
1,040,154 | Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected. I'm not sure whether this will work or not, but intuitively I think the answer is yes. | 2014/11/26 | [
"https://math.stackexchange.com/questions/1040154",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/53265/"
] | If we just want $(X,d)$ to be any subspace of a larger connected space, then sure: we don't even need metric then, just Tychonoff: every Tychonoff space embeds into a (connected) space $[0,1]^I$ for some set $I$.
If we want $X$ to be dense in the larger connected space $Y$, then $Y$ is called a connectification. In th... | Here is another way to embed any metric space $X$ in a connected metric space. For each pair of distinct points $x,y\in X$, adjoin to $X$ a path from $x$ to $y$, and extend the metric to points on the path by making the path have length $d(x,y)$ (so distances are defined by taking the least distance which can be achiev... |
1,040,154 | Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected. I'm not sure whether this will work or not, but intuitively I think the answer is yes. | 2014/11/26 | [
"https://math.stackexchange.com/questions/1040154",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/53265/"
] | In fact every metric space admits a canonical isometric embedding into a contractible metric space, as follows. If $X$ is a metric space, let $\hat{X}$ denote the space of weak contractions $X \to \mathbb{R}\_{\ge 0}$, where a *weak contraction* $X \to Y$ between two metric spaces is a map $f : X \to Y$ such that $d\_Y... | Use Kuratowski embedding to embed your metric space isometrically into a Banach space. |
1,040,154 | Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected. I'm not sure whether this will work or not, but intuitively I think the answer is yes. | 2014/11/26 | [
"https://math.stackexchange.com/questions/1040154",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/53265/"
] | In fact every metric space admits a canonical isometric embedding into a contractible metric space, as follows. If $X$ is a metric space, let $\hat{X}$ denote the space of weak contractions $X \to \mathbb{R}\_{\ge 0}$, where a *weak contraction* $X \to Y$ between two metric spaces is a map $f : X \to Y$ such that $d\_Y... | Here is another way to embed any metric space $X$ in a connected metric space. For each pair of distinct points $x,y\in X$, adjoin to $X$ a path from $x$ to $y$, and extend the metric to points on the path by making the path have length $d(x,y)$ (so distances are defined by taking the least distance which can be achiev... |
1,040,154 | Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected. I'm not sure whether this will work or not, but intuitively I think the answer is yes. | 2014/11/26 | [
"https://math.stackexchange.com/questions/1040154",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/53265/"
] | Use Kuratowski embedding to embed your metric space isometrically into a Banach space. | Here is another way to embed any metric space $X$ in a connected metric space. For each pair of distinct points $x,y\in X$, adjoin to $X$ a path from $x$ to $y$, and extend the metric to points on the path by making the path have length $d(x,y)$ (so distances are defined by taking the least distance which can be achiev... |
28,450,586 | I have an xml file that I have generated from an excel spreadsheet.
This xml represents the rows and columns of the spreadsheet.
For instance:
```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data-set xmlns="dummy.xsd">
<record>
<LastName>Smith</LastName>
<Sales>16753</Sales>
<... | 2015/02/11 | [
"https://Stackoverflow.com/questions/28450586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1264339/"
] | I finally achieve it doing so:
1. Activate the "Developer Pane" in the "Ribbon"
2. Open "XML Mapping Pane"
3. Choose "Developer > XML Mapping > Custom XML Part > Add new part (...)" and select the XML
4. Then select the XML file in the list "Custom XML Part" and on an item of the list right click and select "Insert Co... | My blog post [word-2013-repeatingsection-content-controls-ready-for-prime-time](http://www.docx4java.org/blog/2015/01/word-2013-repeatingsection-content-controls-ready-for-prime-time/)
may be of interest (including the [linked docx](https://github.com/plutext/docx4j/blob/master/docs/developer/w15RepeatingSection_cf_Ope... |
5,273,769 | >
> **Possible Duplicate:**
>
> [Could node.js replace Ruby on Rails completely in the future?](https://stackoverflow.com/questions/3436335/could-node-js-replace-ruby-on-rails-completely-in-the-future)
>
>
>
I'm doing bad in understanding the sense of node.js. I understand what it does regarding IO etc., but i... | 2011/03/11 | [
"https://Stackoverflow.com/questions/5273769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193643/"
] | >
> is it for example a ruby on rails replacement?
>
>
>
IMHO RoR has much longer history/experience/functionality for website development. Node.js itself is a lightweight (low level) framework from which you can take off to build various types of server-side applications (not just web oriented). One of its main a... | Node.js is a totally separate technology to Ruby on Rails, built on a different technology stack. In its current state it's not a replacement for Rails, and certainly not a drop-in replacement |
5,273,769 | >
> **Possible Duplicate:**
>
> [Could node.js replace Ruby on Rails completely in the future?](https://stackoverflow.com/questions/3436335/could-node-js-replace-ruby-on-rails-completely-in-the-future)
>
>
>
I'm doing bad in understanding the sense of node.js. I understand what it does regarding IO etc., but i... | 2011/03/11 | [
"https://Stackoverflow.com/questions/5273769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193643/"
] | >
> is it for example a ruby on rails replacement?
>
>
>
IMHO RoR has much longer history/experience/functionality for website development. Node.js itself is a lightweight (low level) framework from which you can take off to build various types of server-side applications (not just web oriented). One of its main a... | AIUI Node.js is a bit more low-level than that, in particular it has no support for typical high level web development (MVC model, db integration, etc). Look at it as a javascripty basis to write networking software on (including web frameworks).
There are some web frameworks out there built on Node.js. The only one I... |
5,273,769 | >
> **Possible Duplicate:**
>
> [Could node.js replace Ruby on Rails completely in the future?](https://stackoverflow.com/questions/3436335/could-node-js-replace-ruby-on-rails-completely-in-the-future)
>
>
>
I'm doing bad in understanding the sense of node.js. I understand what it does regarding IO etc., but i... | 2011/03/11 | [
"https://Stackoverflow.com/questions/5273769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193643/"
] | >
> is it for example a ruby on rails replacement?
>
>
>
IMHO RoR has much longer history/experience/functionality for website development. Node.js itself is a lightweight (low level) framework from which you can take off to build various types of server-side applications (not just web oriented). One of its main a... | Node.JS is to Javascript as EventMachine is to Ruby (and Twisted to Python). It's something completely different from Rails.
To illustrate: the Thin webserver that is often used to serve Rails application was built using EventMachine. So you would need a complete web framework on top of Node.JS to make it a Rails repl... |
5,273,769 | >
> **Possible Duplicate:**
>
> [Could node.js replace Ruby on Rails completely in the future?](https://stackoverflow.com/questions/3436335/could-node-js-replace-ruby-on-rails-completely-in-the-future)
>
>
>
I'm doing bad in understanding the sense of node.js. I understand what it does regarding IO etc., but i... | 2011/03/11 | [
"https://Stackoverflow.com/questions/5273769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193643/"
] | >
> is it for example a ruby on rails replacement?
>
>
>
IMHO RoR has much longer history/experience/functionality for website development. Node.js itself is a lightweight (low level) framework from which you can take off to build various types of server-side applications (not just web oriented). One of its main a... | You are comparing apples and pears.
Ruby on Rails is a MVC Framework to build websites.
Nodejs is a framework to build evented I/O operations.
You can build a port of RoR on top of nodejs if you want. |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | You can't do that way as Gerry mentioned. However, you know that $\log^2n\leq\sqrt n$ for $n$ big enough and that's why for big $n$ you have $\frac{(\log n)^2}{n^2}\leq \frac{1}{n\sqrt{n}}$. For the latter series do converge. | No, you can't do it that way. You have shown that the terms are bounded by $1$, but that's also true of the series $1+1+1+\dots$; does that series converge? |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | No, you can't do it that way. You have shown that the terms are bounded by $1$, but that's also true of the series $1+1+1+\dots$; does that series converge? | Let $\displaystyle a\_n = \frac{\log^2 n}{n^2}$.
Then
$$\lim\_{n\to\infty} n\left(\frac{a\_{n+1}}{a\_n}-1\right) = -2 < -1.$$
The series converges by [Raabe's test](http://en.wikipedia.org/wiki/Ratio_test#Raabe.27s_test). |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | You can't do that way as Gerry mentioned. However, you know that $\log^2n\leq\sqrt n$ for $n$ big enough and that's why for big $n$ you have $\frac{(\log n)^2}{n^2}\leq \frac{1}{n\sqrt{n}}$. For the latter series do converge. | What you did is wrong since you have to compare with the general term of a converging series.
You can try [Cauchy's Condensation Test](http://en.wikipedia.org/wiki/Cauchy_condensation_test)
$$\frac{2^nn^2\log^22}{2^{2n}}=\log^2\frac{n^2}{2^n}$$
and now it's easy to check that $\,\displaystyle{\sum\_{n=1}^\infty\frac... |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | You can't do that way as Gerry mentioned. However, you know that $\log^2n\leq\sqrt n$ for $n$ big enough and that's why for big $n$ you have $\frac{(\log n)^2}{n^2}\leq \frac{1}{n\sqrt{n}}$. For the latter series do converge. | Note that, by the [integral test](https://math.stackexchange.com/questions/357954/does-the-following-series-converge)
$$ \int\_{1}^{\infty} \frac{(\ln(x))^2}{x^2}dx = -{\frac { \left( \ln \left( x \right) \right) ^{2}}{x}}-2\,{\frac {
\ln \left( x \right) }{x}}-\frac{2}{x}
\Big|\_{x=1}^{\infty} =2 . $$
the series con... |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | You can't do that way as Gerry mentioned. However, you know that $\log^2n\leq\sqrt n$ for $n$ big enough and that's why for big $n$ you have $\frac{(\log n)^2}{n^2}\leq \frac{1}{n\sqrt{n}}$. For the latter series do converge. | Since $\log n\le n-1$ for all $n$, we get $\frac{1}{4}\log n \le \sqrt[4]{n}-1\le \sqrt[4]{n}$ for all $n$. So
$$\frac{\log^2 n}{n^2}\le \frac{16\sqrt{n}}{n^2}=\frac{16}{n\sqrt{n}}$$
and we know that $\sum \frac{16}{n\sqrt{n}}$ converges. So by comparison test, $\sum \frac{\log^2 n}{n^2}$ converges. |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | You can't do that way as Gerry mentioned. However, you know that $\log^2n\leq\sqrt n$ for $n$ big enough and that's why for big $n$ you have $\frac{(\log n)^2}{n^2}\leq \frac{1}{n\sqrt{n}}$. For the latter series do converge. | Let $\displaystyle a\_n = \frac{\log^2 n}{n^2}$.
Then
$$\lim\_{n\to\infty} n\left(\frac{a\_{n+1}}{a\_n}-1\right) = -2 < -1.$$
The series converges by [Raabe's test](http://en.wikipedia.org/wiki/Ratio_test#Raabe.27s_test). |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | What you did is wrong since you have to compare with the general term of a converging series.
You can try [Cauchy's Condensation Test](http://en.wikipedia.org/wiki/Cauchy_condensation_test)
$$\frac{2^nn^2\log^22}{2^{2n}}=\log^2\frac{n^2}{2^n}$$
and now it's easy to check that $\,\displaystyle{\sum\_{n=1}^\infty\frac... | Let $\displaystyle a\_n = \frac{\log^2 n}{n^2}$.
Then
$$\lim\_{n\to\infty} n\left(\frac{a\_{n+1}}{a\_n}-1\right) = -2 < -1.$$
The series converges by [Raabe's test](http://en.wikipedia.org/wiki/Ratio_test#Raabe.27s_test). |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | Note that, by the [integral test](https://math.stackexchange.com/questions/357954/does-the-following-series-converge)
$$ \int\_{1}^{\infty} \frac{(\ln(x))^2}{x^2}dx = -{\frac { \left( \ln \left( x \right) \right) ^{2}}{x}}-2\,{\frac {
\ln \left( x \right) }{x}}-\frac{2}{x}
\Big|\_{x=1}^{\infty} =2 . $$
the series con... | Let $\displaystyle a\_n = \frac{\log^2 n}{n^2}$.
Then
$$\lim\_{n\to\infty} n\left(\frac{a\_{n+1}}{a\_n}-1\right) = -2 < -1.$$
The series converges by [Raabe's test](http://en.wikipedia.org/wiki/Ratio_test#Raabe.27s_test). |
406,718 | $\sum\_{i=1}^{\infty} \frac{(\log n)^2}{n^2}$
I guess it is convergent, so I apply comparsion test for this.
$\frac{log^2}{n^2} < \frac{n^2}{n^2} = 1$
So it is bounded by 1 and hence it is convergent.
Can I do in this way? It kind of make sense, but I have never deal with constant in this case
Usually we do boun... | 2013/05/30 | [
"https://math.stackexchange.com/questions/406718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74735/"
] | Since $\log n\le n-1$ for all $n$, we get $\frac{1}{4}\log n \le \sqrt[4]{n}-1\le \sqrt[4]{n}$ for all $n$. So
$$\frac{\log^2 n}{n^2}\le \frac{16\sqrt{n}}{n^2}=\frac{16}{n\sqrt{n}}$$
and we know that $\sum \frac{16}{n\sqrt{n}}$ converges. So by comparison test, $\sum \frac{\log^2 n}{n^2}$ converges. | Let $\displaystyle a\_n = \frac{\log^2 n}{n^2}$.
Then
$$\lim\_{n\to\infty} n\left(\frac{a\_{n+1}}{a\_n}-1\right) = -2 < -1.$$
The series converges by [Raabe's test](http://en.wikipedia.org/wiki/Ratio_test#Raabe.27s_test). |
322,851 | Whenever we use man command it opens the manual corresponding to the command(if exists). Operations on it are almost same as that of the less command(like search forward using / or backward using ? or browse forward using d etc). I am just curious whether man command internally invokes less command to display the manua... | 2013/07/22 | [
"https://askubuntu.com/questions/322851",
"https://askubuntu.com",
"https://askubuntu.com/users/167622/"
] | By default, yes. This can be overridden via `$PAGER` and `$MANPAGER` in turn. | I would like to complement Ignacio's accepted answer.
Even the man utility has a [manual](http://man7.org/linux/man-pages/man1/man.1.html) that can be displayed by the man utility: **man man**.
The part answering your question:
>
> Controlling formatted output
>
>
>
> ```
> -P pager, --pager=pager
> ... |
28,989,870 | I use `JavaScriptSerializer` to serialize a json string to a specific Class
Here is the origin json string:
```
{
"status":0,
"data":[
{
"username":"yong6180212856@163.com",
"password":"r2166745"
},
{
"username":"xinnai1122139@163.com",
... | 2015/03/11 | [
"https://Stackoverflow.com/questions/28989870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2288944/"
] | There are lots of approaches here. The shortest path from where you are would be to change RetData to this:
```
public class RetData
{
public int status { get; set; }
public string msg { get; set; }
public List<Dictionary<object,object>> data { get; set; }
}
```
Then read the data like this:
```
RetData... | Use the `dynamic`key word to define the type of `data`:
```
class RetData
{
public int status { get; set; }
public string msg { get; set; }
public dynamic data { get; set; }
}
```
Note that this will take away intellisense and compiliation verifications, which means responsibility for checking the type i... |
28,989,870 | I use `JavaScriptSerializer` to serialize a json string to a specific Class
Here is the origin json string:
```
{
"status":0,
"data":[
{
"username":"yong6180212856@163.com",
"password":"r2166745"
},
{
"username":"xinnai1122139@163.com",
... | 2015/03/11 | [
"https://Stackoverflow.com/questions/28989870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2288944/"
] | When you deserialize JSON with [`JavaScriptSerializer`](https://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer%28v=vs.110%29.aspx) into an `object` property or field, the serializer will recursively choose the most appropriate representation to which to deserialize each JSON eleme... | Use the `dynamic`key word to define the type of `data`:
```
class RetData
{
public int status { get; set; }
public string msg { get; set; }
public dynamic data { get; set; }
}
```
Note that this will take away intellisense and compiliation verifications, which means responsibility for checking the type i... |
227,260 | [](https://i.stack.imgur.com/yfclx.jpg)Hi
I have tried to extract the transfer function of the filter above, as you see it a high order filter.
I have combined the \$C\_1\$ in parallel with \$R\$ & \$C\_2\$ then make a voltage divider in order to add ... | 2016/04/08 | [
"https://electronics.stackexchange.com/questions/227260",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/82352/"
] | 
[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fUKoJ2.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
*Figure 1. Current limiting simplicity: add R2.*
Let's check your maths: from \$ P = I^2R \$ we can get \... | You should place a series resistor to limit maximum current. Eventually could add an emitter follower to increase maximum current. |
61,869,755 | I am developing a small application that lists the customers of a store. I'm trying to retrieve the additional fields of the intermediate model because a contact can belong to several stores but depending on the store it is premium or not and if he is happy or not.
Here's the JSON response I'd like to get for a Store ... | 2020/05/18 | [
"https://Stackoverflow.com/questions/61869755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11183832/"
] | You must provide data to `MemberShipSerializer` . You can use [SerializerMethodField](https://www.django-rest-framework.org/api-guide/fields/#serializermethodfield). Like that:
```
class ContactSerializer(serializers.ModelSerializer):
infos = serializers.SerializerMethodField(read_only=True)
class Meta:
... | I tried kamilyrb's solution here's what I changed:
```
class MemberShipSerializer(serializers.ModelSerializer):
class Meta:
model = MemberShip
fields = ("contact", "store", "happy", "premium")
class StoreSerializer(serializers.ModelSerializer):
class Meta:
model = Store
fields ... |
571,566 | Suppose we have two transformers with same turns ratio, \$N\_2/N\_1\$. First transformer \$A\$ is of \$100:10\$ and the second transformer \$B\$ is \$1000:100\$. Both have same turns ratio so both can step down the voltage by 10 times theoretically. If we assume size of wires are identical at primary and secondary, cur... | 2021/06/17 | [
"https://electronics.stackexchange.com/questions/571566",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/171239/"
] | Obviously, B has some advantages indeed. Otherwise all transformers would use a tiny number of turns. More turns generate more magnetizing inductance \$L\_M \propto N^2\$.
Imagine a transformer with the secondary open, which is essentially a large inductor. If you connect an AC voltage with frequency \$f\$ to the prim... | Transformer design has to optimize a lot of different variables. And I am not an expert. But the transformer primary needs to have enough turns so that it acts like a big inductor and prevents excessive current from flowing. If you take a particular transformer core, you can either wind the primary with many turns of f... |
571,566 | Suppose we have two transformers with same turns ratio, \$N\_2/N\_1\$. First transformer \$A\$ is of \$100:10\$ and the second transformer \$B\$ is \$1000:100\$. Both have same turns ratio so both can step down the voltage by 10 times theoretically. If we assume size of wires are identical at primary and secondary, cur... | 2021/06/17 | [
"https://electronics.stackexchange.com/questions/571566",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/171239/"
] | Number of turns on a transformer matters greatly. The turns ratio is one of many considerations in designing a transformer. The following are high-level considerations when designing a transformer.
* As Tobalt stated, *magnetizing inductance* is important. Too few turns will consume excess current, even without a load... | Obviously, B has some advantages indeed. Otherwise all transformers would use a tiny number of turns. More turns generate more magnetizing inductance \$L\_M \propto N^2\$.
Imagine a transformer with the secondary open, which is essentially a large inductor. If you connect an AC voltage with frequency \$f\$ to the prim... |
571,566 | Suppose we have two transformers with same turns ratio, \$N\_2/N\_1\$. First transformer \$A\$ is of \$100:10\$ and the second transformer \$B\$ is \$1000:100\$. Both have same turns ratio so both can step down the voltage by 10 times theoretically. If we assume size of wires are identical at primary and secondary, cur... | 2021/06/17 | [
"https://electronics.stackexchange.com/questions/571566",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/171239/"
] | Number of turns on a transformer matters greatly. The turns ratio is one of many considerations in designing a transformer. The following are high-level considerations when designing a transformer.
* As Tobalt stated, *magnetizing inductance* is important. Too few turns will consume excess current, even without a load... | Transformer design has to optimize a lot of different variables. And I am not an expert. But the transformer primary needs to have enough turns so that it acts like a big inductor and prevents excessive current from flowing. If you take a particular transformer core, you can either wind the primary with many turns of f... |
571,566 | Suppose we have two transformers with same turns ratio, \$N\_2/N\_1\$. First transformer \$A\$ is of \$100:10\$ and the second transformer \$B\$ is \$1000:100\$. Both have same turns ratio so both can step down the voltage by 10 times theoretically. If we assume size of wires are identical at primary and secondary, cur... | 2021/06/17 | [
"https://electronics.stackexchange.com/questions/571566",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/171239/"
] | Any given core material, cross section and frequency has a maximum volts per turn. If you want to use the winding at a certain voltage, then you need enough turns to support that voltage.
For instance, low frequency mains transformer steel will only run up to a peak field of 1.7 T or so before it saturates. If you had... | Transformer design has to optimize a lot of different variables. And I am not an expert. But the transformer primary needs to have enough turns so that it acts like a big inductor and prevents excessive current from flowing. If you take a particular transformer core, you can either wind the primary with many turns of f... |
571,566 | Suppose we have two transformers with same turns ratio, \$N\_2/N\_1\$. First transformer \$A\$ is of \$100:10\$ and the second transformer \$B\$ is \$1000:100\$. Both have same turns ratio so both can step down the voltage by 10 times theoretically. If we assume size of wires are identical at primary and secondary, cur... | 2021/06/17 | [
"https://electronics.stackexchange.com/questions/571566",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/171239/"
] | Number of turns on a transformer matters greatly. The turns ratio is one of many considerations in designing a transformer. The following are high-level considerations when designing a transformer.
* As Tobalt stated, *magnetizing inductance* is important. Too few turns will consume excess current, even without a load... | Any given core material, cross section and frequency has a maximum volts per turn. If you want to use the winding at a certain voltage, then you need enough turns to support that voltage.
For instance, low frequency mains transformer steel will only run up to a peak field of 1.7 T or so before it saturates. If you had... |
25,954,841 | here is my config.xml
```
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<zee_Checkout>
<version>1.0</version>
</zee_Checkout>
</modules>
<global>
<models>
<zee_Checkout>zee_Checkout_Model</zee_Checkout>
<checkout>
<... | 2014/09/21 | [
"https://Stackoverflow.com/questions/25954841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1090463/"
] | change in config.xml
```
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Zee_Checkout> <!-- zee should be Zee -->
<version>1.0</version>
</Zee_Checkout>
</modules>
<global>
<models>
<zee_checkout>zee_Checkout_Model</zee_checkout>
<chec... | There is a mistake in setting alias for your models.
Try to change
```
<zee_checkout>Zee_Checkout_Model</zee_checkout>
```
To
```
<zee_checkout><class>Zee_Checkout_Model</class></zee_checkout>
``` |
25,954,841 | here is my config.xml
```
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<zee_Checkout>
<version>1.0</version>
</zee_Checkout>
</modules>
<global>
<models>
<zee_Checkout>zee_Checkout_Model</zee_Checkout>
<checkout>
<... | 2014/09/21 | [
"https://Stackoverflow.com/questions/25954841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1090463/"
] | Set Zee\_Checkout.xml Enable in folder app/etc/modules
```
<?xml version="1.0"?>
<config>
<modules>
<Zee_Checkout>
<active>true</active>
<codePool>local</codePool>
</Zee_Checkout>
</modules>
</config>
```
Set config.xml in Zee/Checkout/etc/config.xml
```
<?xml version="1.0" encoding=... | There is a mistake in setting alias for your models.
Try to change
```
<zee_checkout>Zee_Checkout_Model</zee_checkout>
```
To
```
<zee_checkout><class>Zee_Checkout_Model</class></zee_checkout>
``` |
44,409,717 | I have an application which logs entries with datetime format. Now I want to push that datetime string into db. So i have the query
```
db.query "update processing set start_time = STR_TO_DATE('2017053008:04:45', '%Y-%m-%d %H:%i:%s') where dated = '2017-06-07' and zone = 'W13';"
```
I have the datetime format in my... | 2017/06/07 | [
"https://Stackoverflow.com/questions/44409717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8124857/"
] | You could use dollar signs. From [the documentation:](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS)
>
> SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (\_). Subsequent charact... | Please, dont take this answer as advice for action. I think you are doing things that will make your life more complicated. But yet what you are looking for is doable. To get the list of accepted not quoted chars, I run:
```
t=# create schema s;
CREATE SCHEMA
Time: 0.931 ms
t=# do
$$
declare i record;
begin
for i in 1... |
44,409,717 | I have an application which logs entries with datetime format. Now I want to push that datetime string into db. So i have the query
```
db.query "update processing set start_time = STR_TO_DATE('2017053008:04:45', '%Y-%m-%d %H:%i:%s') where dated = '2017-06-07' and zone = 'W13';"
```
I have the datetime format in my... | 2017/06/07 | [
"https://Stackoverflow.com/questions/44409717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8124857/"
] | You could use dollar signs. From [the documentation:](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS)
>
> SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (\_). Subsequent charact... | Based on the answers here I've decided not to use a different character as a prefix delimiter. I'm going with a double underscore (`__`), which is nicely parsable.
I should have been more clear on why I ultimately wanted this. The various comments I've left here explain it.
Here is an example which is pretty close to... |
266,058 | I have a Macbook Air 13" (mid 2012) on which I installed Windows 10 via Bootcamp a while ago. It all runs smoothly and works fine except for the WiFi.
The internet connection breaks frequently (which means that I am not able to access the internet). I am though still connected to the WLAN network at any time (often i... | 2016/12/24 | [
"https://apple.stackexchange.com/questions/266058",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/216681/"
] | Deinstalling Cisco VPN Client fixed my problem.
There seems to be a problem with updating from Windows 8 to Windows 10 when Cisco VPN Client is installed (<https://superuser.com/questions/947651/no-network-connection-after-upgrading-to-windows-10>).
Although my Windows 10 was a fresh install, deinstalling Cisco VPN... | While I do not have specific experience with Win 10 on this model of MacBook, some people have good success with the OEM manufacturers drivers instead of the ones Apple provides.
So you would go into device manager and look for the make and model of WiFi hardware. (For example Broadcom 3502) and then go to the manufac... |
266,058 | I have a Macbook Air 13" (mid 2012) on which I installed Windows 10 via Bootcamp a while ago. It all runs smoothly and works fine except for the WiFi.
The internet connection breaks frequently (which means that I am not able to access the internet). I am though still connected to the WLAN network at any time (often i... | 2016/12/24 | [
"https://apple.stackexchange.com/questions/266058",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/216681/"
] | Deinstalling Cisco VPN Client fixed my problem.
There seems to be a problem with updating from Windows 8 to Windows 10 when Cisco VPN Client is installed (<https://superuser.com/questions/947651/no-network-connection-after-upgrading-to-windows-10>).
Although my Windows 10 was a fresh install, deinstalling Cisco VPN... | I had a similar problem on my iMac with Bootcamp (iMac 5k, Windows 10 build 1511, Bootcamp 6). Wlan and audio were not working after Windows Update. I resolved this by disabling Hyper-V:
1. Control Panel > Turn Windows Features On and Off
2. Uncheck the "Hyper-V" checkbox
3. Restart |
47,019,615 | How can enter two strings with scanf in C?, I want to use them as follow:
```
#include <stdio.h>
#include <string.h>
main()
{
char kid[25];
char color[10];
scanf( "%24[^\n]", kid); // kid name
scanf( "%9[^\n]", color);
printf("%s\'s favorite color is %s.\n", kid, color);
return 0;
}
``` | 2017/10/30 | [
"https://Stackoverflow.com/questions/47019615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8857400/"
] | You are reading input till a `\n` into `kid` with the first `scanf()`. But that `scanf()` won't read the `\n` and it will remain in the input buffer.
When the next `scanf()` is done, the first character it sees is the `\n` upon which it stops reading before anything is written to `color`.
You could do
```
scanf("%24... | Your problem is that this line does not read the `\n` character from the stream.
```
scanf( "%24[^\n]", kid); // kid name
```
So you read the kids name but don't remove the newline character. So the next `scanf()` just sees a return character on the input stream and thus you will get an empty color.
```
if (scanf( ... |
11,014,907 | So I have a xml document loaded in JavaScript variable.
Xml looks like this:
```
<root>
<pp>test<ii>sample italic</ii> text after italic</pp>
</root>
```
Then I have an input box where the content of `<pp>` element is written out.
Like this: `test<ii>sample italic</ii> text after italic`
Note that text in... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11014907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310080/"
] | Maybe you could look at this link it would probably help you : <http://www.ehow.com/how_5933380_change-values-xml-javascript.html>
Or here, those are two goo tutorial : <http://www.devguru.com/features/tutorials/xml_javascript/xml_javascript.asp>
Are you reading your xml from a file ?
**To create a node :**
var th... | You will need to send the data via Ajax to a server-side script, that handles the rewriting of the file. Client-side Javascript cannot solve this problem. |
50,667,278 | I have a website that builds simple Word files from details that users insert.
I need to create Word files and send them to email.
I know how to send files with email.
I know how to create Word files with php:
```
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Fi... | 2018/06/03 | [
"https://Stackoverflow.com/questions/50667278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9103677/"
] | Do you mean you don't know how to put the generated Word document into a physically file ? That you can then use with your email code that you already have ?
If the above code is an example of how you generate your Word document then you could do something like this.
```
<?PHP
// Get the generated MS Word document d... | This can be achieved through PHPMailer, set it up then add this to attach particular word file to your e-mail
You can get PHPMailer from [here][1]
```
$email = new PHPMailer();
$email->From = 'youremail@xyz.com';
$email->FromName = 'Name';
$email->Subject = 'Sub';
$email->Body = $body;
$email->AddAddress(... |
24,465,551 | I'm making a Pay Calculator for my companies employees. It takes Federal Tax, Social Security Tax, and Medicare Tax into consideration. However, some of the employees are independent contractors and do not pay certain taxes. Thus all of these taxes are on their separate switch button. I'm having trouble making the "if"... | 2014/06/28 | [
"https://Stackoverflow.com/questions/24465551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3782629/"
] | As Stefan suggested, I'd introduce `Purchase` nodes that have relationships with the products and also store the purchase value in that node. That way you can restrict the query to the purchases, without having to go deeper to reach the products.
```
(:Agent)-[:made]->(:Purchase {date: XXX, value: XXX})-[:HAS]->(:Prod... | I guess you frequently need to calculate the sum of all purchases bewteen a specfic agent A and product P. If so it might be beneficial to introduce a a `total_purchases` relationship between A and P holding the sum. Whenever you add a new purchase, make sure to update the existing `total_purchases` relationship.
Anot... |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | You can hide it using .hide():
```
$('#hidepara').hide();
``` | try
use `.filter()` to filter the selected element
```
var filterData = $("#chat-box-msg").children().filter(function (i, element) {
return element.id != "hidepara";
});
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | Try to exclude the element that you want and just invoke `.text()` function from the filtered collection,
```
var text = $('#chat-box-msg').children(':not("#hidepara")').text();
```
[DEMO](http://jsfiddle.net/95npg/)
---------------------------------- | You can hide it using .hide():
```
$('#hidepara').hide();
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | try something like this
```
var todos = $('#chat-box-msg').clone().find('#hidepara').remove().end().text();
``` | You can hide it using .hide():
```
$('#hidepara').hide();
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | Just hide element by id
```
$("#hidepara").hide();
``` | try
use `.filter()` to filter the selected element
```
var filterData = $("#chat-box-msg").children().filter(function (i, element) {
return element.id != "hidepara";
});
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | Try to exclude the element that you want and just invoke `.text()` function from the filtered collection,
```
var text = $('#chat-box-msg').children(':not("#hidepara")').text();
```
[DEMO](http://jsfiddle.net/95npg/)
---------------------------------- | Just hide element by id
```
$("#hidepara").hide();
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | try something like this
```
var todos = $('#chat-box-msg').clone().find('#hidepara').remove().end().text();
``` | Just hide element by id
```
$("#hidepara").hide();
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | Try to exclude the element that you want and just invoke `.text()` function from the filtered collection,
```
var text = $('#chat-box-msg').children(':not("#hidepara")').text();
```
[DEMO](http://jsfiddle.net/95npg/)
---------------------------------- | try
use `.filter()` to filter the selected element
```
var filterData = $("#chat-box-msg").children().filter(function (i, element) {
return element.id != "hidepara";
});
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | try something like this
```
var todos = $('#chat-box-msg').clone().find('#hidepara').remove().end().text();
``` | try
use `.filter()` to filter the selected element
```
var filterData = $("#chat-box-msg").children().filter(function (i, element) {
return element.id != "hidepara";
});
``` |
24,339,298 | So i have this Dynamic html in my code.
```
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24339298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449215/"
] | Try to exclude the element that you want and just invoke `.text()` function from the filtered collection,
```
var text = $('#chat-box-msg').children(':not("#hidepara")').text();
```
[DEMO](http://jsfiddle.net/95npg/)
---------------------------------- | try something like this
```
var todos = $('#chat-box-msg').clone().find('#hidepara').remove().end().text();
``` |
33,981,087 | Working on the algorithm puzzle of calculating the number of ways of representing n cents, using unlimited number of 25 cents, 10 cents, 5 cents and 1 cents. Referred a few different solutions and have a question about below solution, I am not sure why we are confident when `if (index >= denoms.length - 1)` there must ... | 2015/11/29 | [
"https://Stackoverflow.com/questions/33981087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850923/"
] | In the code you show here, the `prev()` selector actually does work. From what you describe, I assume that you say it is not working, because the video is not showing up. Is that right?
Don't know why you decided to use the `<embed>` tag to embed a youtube video. The prefered way would be to use an `iframe`. If you go... | If you don't have the same `div` in your document you can use:
```
$("#preview-box-img").css("display","none");
$("#preview-box-img").prev().fadeIn(600);
```
If this code don't work, you should be sure that your click handler is ok. |
33,981,087 | Working on the algorithm puzzle of calculating the number of ways of representing n cents, using unlimited number of 25 cents, 10 cents, 5 cents and 1 cents. Referred a few different solutions and have a question about below solution, I am not sure why we are confident when `if (index >= denoms.length - 1)` there must ... | 2015/11/29 | [
"https://Stackoverflow.com/questions/33981087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850923/"
] | You're using ids in the html, but then you use selectors like you were using classes. I prefer using classes but in your case given your ids it's simpler.
```
<script>
$(document).ready(function(){
$("#preview-box-playvideo-btn").click(function(){
$("#preview-box-img").hide();
$("#preview-box-video").fadeI... | If you don't have the same `div` in your document you can use:
```
$("#preview-box-img").css("display","none");
$("#preview-box-img").prev().fadeIn(600);
```
If this code don't work, you should be sure that your click handler is ok. |
33,981,087 | Working on the algorithm puzzle of calculating the number of ways of representing n cents, using unlimited number of 25 cents, 10 cents, 5 cents and 1 cents. Referred a few different solutions and have a question about below solution, I am not sure why we are confident when `if (index >= denoms.length - 1)` there must ... | 2015/11/29 | [
"https://Stackoverflow.com/questions/33981087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850923/"
] | You're using ids in the html, but then you use selectors like you were using classes. I prefer using classes but in your case given your ids it's simpler.
```
<script>
$(document).ready(function(){
$("#preview-box-playvideo-btn").click(function(){
$("#preview-box-img").hide();
$("#preview-box-video").fadeI... | In the code you show here, the `prev()` selector actually does work. From what you describe, I assume that you say it is not working, because the video is not showing up. Is that right?
Don't know why you decided to use the `<embed>` tag to embed a youtube video. The prefered way would be to use an `iframe`. If you go... |
10,940,434 | Right now users have to two ways to send data to my application: upload a CSV file via browser, or via our API.
It would dramatically reduce duplication to use the API in both instances. Is there a way they could use the existing upload form, but instead of storing the CSV on the server, it would be processed via Java... | 2012/06/07 | [
"https://Stackoverflow.com/questions/10940434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/320619/"
] | There is no way to do this with IE6 (and in my opinion there is no reason to even try this).
Possible workarounds:
* Embed the uploadform into a iframe (ugly)
* Use a FlashPlayer 9+/JavaApplet to perform the upload (requires plugin), but this also gives you the possibility to process the data before sending it. | Unfortunately, no, this is not possible with IE6. Reading local files is possible in HTML5, but IE has a long way to go...
Also- it is not required to store the CSV on the server. You can process the CSV dynamically in a servlet and use the API to store the data without storing the CSV on the server. |
24,875,096 | I discussed the performance issues of iterrows [previously](https://stackoverflow.com/questions/24870953/does-iterrows-have-performance-issues), and was given good general responses. This question is a specific case where I'd like your help in applying something better, as iterrows is SLOW.
I believe the question can ... | 2014/07/21 | [
"https://Stackoverflow.com/questions/24875096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3232824/"
] | To me, looks like the easiest thing is to merge on `letter` and then `groupby`.
```
import pandas as pd
import numpy as np
# Create the original tables
t1 = {'letter':['a','b'],
'number1':[50,-10]}
t2 = {'letter':['a','a','b','b'],
'number2':[0.2,0.5,0.1,0.4]}
table1 = pd.DataFrame(t1)
table2 = pd.DataF... | As I posted in [the other answer](https://stackoverflow.com/a/45695288/1115316), sometimes the problem isn't about the loops, but unnecessarily boxing data into DataFrame or Series.
```
def iterthrough():
ret = []
grouped = table2.groupby('letter', sort=False)
t2info = table2.to_records()
for index, l... |
73,697,635 | I have two tables:
| customers | | |
| --- | --- | --- |
| id | name | order\_id |
| orders | | | |
| --- | --- | --- | --- |
| id | customer\_id | date | amount |
I would like to get the first order for each customer so I used `inner join` & `min` on date. however, I'd like to get all order columns as well.
M... | 2022/09/13 | [
"https://Stackoverflow.com/questions/73697635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7045119/"
] | Use [distinct on](https://stackoverflow.com/questions/46566602/what-does-distinct-on-expression-do) w/o `group by`. You may see [this](https://stackoverflow.com/questions/9795660/postgresql-distinct-on-with-different-order-by) SO discussion for details.
```sql
SELECT distinct on (customers.id)
customers.id, custom... | ```
select oo.*,c.*,fo.* from
(select o.customer_id,min(o.date)order_date
from orders o
group by o.customer_id)fo
inner join orders oo on oo.customer_id=fo.customer_id and oo.date=fo.order_date
inner join customer c on c.id=oo.customer_id
```
I think this will help you.
In SQL Group by clause, you can only select g... |
73,697,635 | I have two tables:
| customers | | |
| --- | --- | --- |
| id | name | order\_id |
| orders | | | |
| --- | --- | --- | --- |
| id | customer\_id | date | amount |
I would like to get the first order for each customer so I used `inner join` & `min` on date. however, I'd like to get all order columns as well.
M... | 2022/09/13 | [
"https://Stackoverflow.com/questions/73697635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7045119/"
] | Use [distinct on](https://stackoverflow.com/questions/46566602/what-does-distinct-on-expression-do) w/o `group by`. You may see [this](https://stackoverflow.com/questions/9795660/postgresql-distinct-on-with-different-order-by) SO discussion for details.
```sql
SELECT distinct on (customers.id)
customers.id, custom... | Then don't use min at the main clause.
`min(orders.date)` means that you want to get the minimum date for one column.
You can filter order first before joining
```
SELECT
customers.id, customers.name,
orders.date, orders.id, orders.amount
FROM
customers
INNER JOIN
orders ON customers.id = orders.... |
40,475,890 | Is there any way to create TeamCity build parameter and fill it by some value from VCS? It can be maven property "project.version", some number taken from text file or so. Goal is to store version number **only** in VCS and not to have to change it on both places. | 2016/11/07 | [
"https://Stackoverflow.com/questions/40475890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3975626/"
] | You could use TeamCity [service messages](https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-servMsgsServiceMessages) to set parameter during build.
To set or update build parameter you should use following syntax:
```
##teamcity[setParameter name=... | You can find the answer to the exact same question in another post here: [Setting build parameters from external file in TeamCity](https://stackoverflow.com/questions/34593407/setting-build-parameters-from-external-file-in-teamcity).
Copied and pasted the answer:
You can define a parameters file which you check into ... |
71,168,255 | I am trying to interact with the coinbase api and keep getting "TypeError: Object of type method is not JSON serializable" when trying to print out this json data, I know the get request is correct as it returns a 200 when I remove the json.dumps().
```
import requests
import json
response = requests.get(... | 2022/02/18 | [
"https://Stackoverflow.com/questions/71168255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4595448/"
] | Your return is:
```json
{'data': {'base': 'BTC', 'currency': 'USD', 'amount': '40880.98'}}
```
It has a JSON syntax error
Try this
```
response = requests.get('https://api.coinbase.com/v2/prices/BTC-USD/buy')
data = response.json()
dataJson = json.dumps(data['data'])
print(dataJson)
``` | Try this:
```py
response = requests.get('https://api.coinbase.com/v2/prices/BTC-USD/buy')
data = json.loads(response.text)
print(data) # {'data': {'base': 'BTC', 'currency': 'USD', 'amount': '40935.10'}}
``` |
48,435,547 | For better or for worse, I have the following custom type and aggregate.
```
create type nanotime as (
seconds bigint,
nanos int
);
create function nanotime_max_sfunc(current_max nanotime, candidate nanotime)
returns nanotime
immutable
language plpgsql
as $$
declare
result nanotime;
begin
if (current_max.seco... | 2018/01/25 | [
"https://Stackoverflow.com/questions/48435547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425523/"
] | It is not clear what you mean with *executed in context to the time schema*, but I'll explain to you how schema resolution works in the context of functions. Then maybe you can figure out what's going on in your case.
When a PL/pgSQL function is first executed in a session, its queries are planned and the plans cached... | Thank you to Laurenz Albe! search\_path is documented at <https://www.postgresql.org/docs/9.3/static/sql-createfunction.html> under the heading 'Writing SECURITY DEFINER Functions Safely'. My resulting code, with the change annotated, is:
```
create type nanotime as (
seconds bigint,
nanos int
);
create function ... |
3,509,493 | >
> I'm trying to figure out how to avoid catastrophic cancellation for the following expression
> $$\sqrt{1+x} - 1$$
> for $x$ being a number *very* close to $0$.
>
>
>
Of course, the answer would come to $0$ unless the expression is changed around.
Any help is appreciated! Thanks! | 2020/01/15 | [
"https://math.stackexchange.com/questions/3509493",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/741976/"
] | You could use $$\sqrt{1+x}-1=\frac{x}{\sqrt{1+x}+1}$$ | If $x$ is seriously small, e.g. $\ x < 10^{-14}$, and you don't care too much about terms of order $O(10^{-28})$ then why not use:
$$\sqrt{1+x}\approx1+\frac{x}{2}$$ |
3,509,493 | >
> I'm trying to figure out how to avoid catastrophic cancellation for the following expression
> $$\sqrt{1+x} - 1$$
> for $x$ being a number *very* close to $0$.
>
>
>
Of course, the answer would come to $0$ unless the expression is changed around.
Any help is appreciated! Thanks! | 2020/01/15 | [
"https://math.stackexchange.com/questions/3509493",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/741976/"
] | You could use $$\sqrt{1+x}-1=\frac{x}{\sqrt{1+x}+1}$$ | If you want accurate results without computing any square root, you could use $[n,n]$ Padé approximants.
These could be
$$\sqrt{1+x}-1\sim \frac{2 x}{x+4}$$
$$\sqrt{1+x}-1\sim \frac{4 x (x+2)}{x (x+12)+16}$$ |
144,688 | This challenge is similar [to my previous one](https://codegolf.stackexchange.com/questions/144053/distances-to-coordinates), but has a twist that makes it significantly more difficult.
There are *n* people on a 2D plane. Using distances between them we're going to find their positions. You may make four assumptions:
... | 2017/10/08 | [
"https://codegolf.stackexchange.com/questions/144688",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/4162/"
] | [R](https://www.r-project.org/), score = 4.708859
=================================================
```r
require(vegan)
solve_mmds<-function(dpf,noise=0,wgs=rep(1,nrow(dpf))){
#MMDS
v = wcmdscale(dpf+noise,2,add=TRUE,w=wgs)
#center on first point
v = sweep(v,2,v[1,])
#rotate to adjust second point
alpha ... | [C++ (gcc)](https://gcc.gnu.org/), score = 5.94258
==================================================
```cpp
#ifndef _GLIBCXX_DEBUG
#define NDEBUG
#endif // _GLIBCXX_DEBUG
#include <iostream> //{ and more includes
#include <vector>
#include <string>
#include <sstream>
#include <array>
#include <cstdio>
#include <cmat... |
121,094 | I like stackoverflow because there are so many talented people helping each other out. I would like to know what is the best way to respond to a suggestion to my question, i.e., sharing the code changes from the suggestions. Do I post it as an "answer"? or do i post it as a comment? how would formatting be for `Code` i... | 2012/02/02 | [
"https://meta.stackexchange.com/questions/121094",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/177937/"
] | Code doesn't format well in comments.
If the new code answers the question directly, post it as an answer, with explanatory text included. But I would only do this once. Don't repeatedly post answers showing revisions to the code.
If the code merely clarifies an existing answer, or consolidates suggestions by severa... | You could put it as an update to your question. If you mark that section of your question as **Update** and then put the code changes below it, there should be a clear delineation between your original question and the updates you received from people. This should also format much better than attempting to put code in ... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | Other than inheritance, it depends on the scenario. Check [this code project article](http://www.codeproject.com/Articles/258173/Interfaces-Vs-Abstract-Classes) with an excellent example.
[From the article]
>
> Lets Assume you need to make three classes, first is CAR, second is
> MAN, third is WOMAN. Now you need a... | In the scenario you have mentioned, that there is only one method, which will have no definition, the best way to go for is interface.
The major advantage an interface gives in Java that you can implement more than one interfaces, but you can extend only one class. So if you are already extending the one abstract clas... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | In `Java` prefer `Interfaces` to `Abstract Classes`. Refer Item 18 in **Effective Java**

**Main Points** :
* Existing classes can be retroffited to implement a new interface.
* Interfaces are ideal for defining mixins.
* Interfaces allow the constr... | In this case, and assuming that your Abstract Class will only contain abstract methods, you should, in my opinion, go with the Interface. Abstract classes with abstract methods and interfaces serve the same purpose, however, you can extend only one class but implement as many as you want, thus making your code less pro... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | Other than inheritance, it depends on the scenario. Check [this code project article](http://www.codeproject.com/Articles/258173/Interfaces-Vs-Abstract-Classes) with an excellent example.
[From the article]
>
> Lets Assume you need to make three classes, first is CAR, second is
> MAN, third is WOMAN. Now you need a... | in c# it allows only single level inheritance. therefore interfaces can be use to do multiple inheritances
and also for more details :
<http://www.dotnetfunda.com/forums/thread4085-difference-between-interface-and-abstract-class.aspx>
<http://sadi02.wordpress.com/2008/05/08/what-is-difference-in-an-abstract-class-an... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | In `Java` prefer `Interfaces` to `Abstract Classes`. Refer Item 18 in **Effective Java**

**Main Points** :
* Existing classes can be retroffited to implement a new interface.
* Interfaces are ideal for defining mixins.
* Interfaces allow the constr... | **Advantage:**
Implementation of Abstract class is better than Interface because method looking up of abstract class is fast than interface. If you modify your interface , you have to update your implementation class but any modification of abstract class , no effect on implementation class.
**disadvantage:**
```
If... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | Other than inheritance, it depends on the scenario. Check [this code project article](http://www.codeproject.com/Articles/258173/Interfaces-Vs-Abstract-Classes) with an excellent example.
[From the article]
>
> Lets Assume you need to make three classes, first is CAR, second is
> MAN, third is WOMAN. Now you need a... | In this case there is no difference but CTest class has the only class which could be inherited as a Class . However ITest interface can be inherited by other class and interface at the same time. |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | In `Java` prefer `Interfaces` to `Abstract Classes`. Refer Item 18 in **Effective Java**

**Main Points** :
* Existing classes can be retroffited to implement a new interface.
* Interfaces are ideal for defining mixins.
* Interfaces allow the constr... | In this case there is no difference but CTest class has the only class which could be inherited as a Class . However ITest interface can be inherited by other class and interface at the same time. |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | Other than inheritance, it depends on the scenario. Check [this code project article](http://www.codeproject.com/Articles/258173/Interfaces-Vs-Abstract-Classes) with an excellent example.
[From the article]
>
> Lets Assume you need to make three classes, first is CAR, second is
> MAN, third is WOMAN. Now you need a... | In this case, and assuming that your Abstract Class will only contain abstract methods, you should, in my opinion, go with the Interface. Abstract classes with abstract methods and interfaces serve the same purpose, however, you can extend only one class but implement as many as you want, thus making your code less pro... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | In `Java` prefer `Interfaces` to `Abstract Classes`. Refer Item 18 in **Effective Java**

**Main Points** :
* Existing classes can be retroffited to implement a new interface.
* Interfaces are ideal for defining mixins.
* Interfaces allow the constr... | in c# it allows only single level inheritance. therefore interfaces can be use to do multiple inheritances
and also for more details :
<http://www.dotnetfunda.com/forums/thread4085-difference-between-interface-and-abstract-class.aspx>
<http://sadi02.wordpress.com/2008/05/08/what-is-difference-in-an-abstract-class-an... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | Other than inheritance, it depends on the scenario. Check [this code project article](http://www.codeproject.com/Articles/258173/Interfaces-Vs-Abstract-Classes) with an excellent example.
[From the article]
>
> Lets Assume you need to make three classes, first is CAR, second is
> MAN, third is WOMAN. Now you need a... | **Advantage:**
Implementation of Abstract class is better than Interface because method looking up of abstract class is fast than interface. If you modify your interface , you have to update your implementation class but any modification of abstract class , no effect on implementation class.
**disadvantage:**
```
If... |
11,839,724 | I have an abstract class say **CTest** which contains only the abstract method f1() and nothing else. Similiarly, i have a Interface **ITest** with the only method f1(). Here both the CTest abstract class and ITest interface does the same thing.
**The one difference is that**, the Interface provides the flexibility t... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11839724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552249/"
] | In `Java` prefer `Interfaces` to `Abstract Classes`. Refer Item 18 in **Effective Java**

**Main Points** :
* Existing classes can be retroffited to implement a new interface.
* Interfaces are ideal for defining mixins.
* Interfaces allow the constr... | For me it better to use interface here. Abstract class should be used when you could extract some code there (you could implement method or there is other stuff that want to invoke it). |
60,744,085 | I am trying to generate signed APK. but not able to generate it due to the lint error at the time of generating. I checked my lint report and it's showing error in my XML file.
Explanation for issues of type "NotSibling":
Layout constraints in a given ConstraintLayout or RelativeLayout should
reference other views w... | 2020/03/18 | [
"https://Stackoverflow.com/questions/60744085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12824549/"
] | Here is a simple example using two sheets rather than two workbooks, but see if you can adapt it for your set up.
```
Sub x()
Dim rFind1 As Range, s As String, rFind2 As Range
With Sheet1.Range("A1").CurrentRegion
Set rFind1 = .Find(what:=0.047, Lookat:=xlWhole, MatchCase:=False, SearchFormat:=False) 'look for v... | Try this code, please:
```
Sub findTurb()
Dim sh As Worksheet, sh2 As Worksheet, rng As Range, strTurb As String
Const timeSt As Double = 0.047
Set sh = ActiveSheet 'use here your sheet
Set sh2 = Worksheets("second") 'use here your sheet
Set rng = sh.UsedRange.Find(timeSt)
If Not rng... |
9,487,425 | I'm trying to port my application to Scala 2.10.0-M2. I'm seeing some nice improvements with better warnings from compiler. But I also got bunch of errors, all related to me mapping from `Enumeration.values`.
I'll give you a simple example. I'd like to have an enumeration and then pre-create bunch of objects and build... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9487425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/849402/"
] | It's basically a type mismatch error. You can work around it by first converting is to a list:
```
scala> Phrase.values.toList.map(p => (p, new Entity(p.toString))).toMap
res15: scala.collection.immutable.Map[Phrase.Value,Entity] = Map(My phrase 1 -> Entity@d0e999, My phrase 2 -> Entity@1987acd)
```
For more informa... | As you can see from your error, the ValueSet that holds the enums became a SortedSet at some point. It wants to produce a SortedSet on map, but can't sort on your Entity.
Something like this works with case class Entity:
```
implicit object orderingOfEntity extends Ordering[Entity] {
def compare(e1: Entity, e2: Ent... |
46,818,586 | I am learning how to code and I am having trouble with my class methods and testing these methods. Here is the problem:
In this lab, we will create a `Fraction` class. This class is used to represent a ratio of two integers. The main method of the `FractionDriver` class will contain the code that tests your Fraction c... | 2017/10/18 | [
"https://Stackoverflow.com/questions/46818586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8743714/"
] | Dividing an int by an int gives another int. You don't get halves etc.
See [Why is the result of 1/3 == 0?](https://stackoverflow.com/questions/4685450/why-is-the-result-of-1-3-0) | Your method to get value is VOID... so that's your problem.
It should be
```
//returning value of the numerator divided by a denominator as a double
public double getValue() {
divide = numerator / denominator;
this.divide = divide;
return this.divide;
}
```
But better to make it
```
public double g... |
48,637,745 | ```
column a column b
10 2
30 3
40 4
```
in r, how can i divide column B's value by previous row value of column A
like 3/10 and 4/30 | 2018/02/06 | [
"https://Stackoverflow.com/questions/48637745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8283293/"
] | Using Base R:
```
transform(dat,new=c(NA,head(column_a,-1))/column_b)
column_a column_b new
1 10 2 NA
2 30 3 3.333333
3 40 4 7.500000
``` | You can use `lead()` and `lag()`from `dplyr`, which finds the next or previous value in a vector:
```
library(dplyr)
df <- data.frame(a = c(10, 30, 40),
b = c(2, 3, 4))
```
First option: `lead()`
```
lead(df$b) / df$a
```
returns
```
[1] 0.3000000 0.1333333 NA
```
Second option: `lag()... |
48,637,745 | ```
column a column b
10 2
30 3
40 4
```
in r, how can i divide column B's value by previous row value of column A
like 3/10 and 4/30 | 2018/02/06 | [
"https://Stackoverflow.com/questions/48637745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8283293/"
] | Using Base R:
```
transform(dat,new=c(NA,head(column_a,-1))/column_b)
column_a column_b new
1 10 2 NA
2 30 3 3.333333
3 40 4 7.500000
``` | like this,
```
dta <- data.frame(column_a = c(10, 30, 40), column_b = c(2, 3, 4))
# install.packages(c("tidyverse""), dependencies = TRUE)
library(tidyverse)
tbl <- dta %>% as_tibble()
mutate(tbl, column_a_lag = lag(column_a), a_lag_div_b = column_a_lag/column_b)
#> # A tibble: 3 x 4
#> column_a column_b column... |
48,637,745 | ```
column a column b
10 2
30 3
40 4
```
in r, how can i divide column B's value by previous row value of column A
like 3/10 and 4/30 | 2018/02/06 | [
"https://Stackoverflow.com/questions/48637745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8283293/"
] | Using Base R:
```
transform(dat,new=c(NA,head(column_a,-1))/column_b)
column_a column_b new
1 10 2 NA
2 30 3 3.333333
3 40 4 7.500000
``` | Using data.table
```
dt[ , new:= column_b / shift(column_a)]
column_a column_b new
1: 10 2 NA
2: 30 3 0.3000000
3: 40 4 0.1333333
``` |
25,778,616 | According to this answer <https://stackoverflow.com/a/8001065/1586965> we can do this in Scala:
```
val _ = 5
```
Now I understand the point of ignored parameters in lambda expressions, but I cannot really imagine examples where I would ever want to declare a variable that by definition I cannot reference. The only ... | 2014/09/11 | [
"https://Stackoverflow.com/questions/25778616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1586965/"
] | It uses a value.
```
$ scala -Ywarn-value-discard
Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_11).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def f() = { println("I ran.") ; 42 }
f: ()Int
scala> def g(): Unit = { f() }
<console>:8: warning: ... | The other use case (that I can think of) is related to extraction (and is called out under "Wildcard patterns" in [the linked answer](https://stackoverflow.com/a/8001065/1586965)):
```
val getCartesianPoint = () => (1, 2, 3)
// We don't care about the z axis, so we assign it to _
val (x, y, _) = getCartesianPoint()
v... |
25,778,616 | According to this answer <https://stackoverflow.com/a/8001065/1586965> we can do this in Scala:
```
val _ = 5
```
Now I understand the point of ignored parameters in lambda expressions, but I cannot really imagine examples where I would ever want to declare a variable that by definition I cannot reference. The only ... | 2014/09/11 | [
"https://Stackoverflow.com/questions/25778616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1586965/"
] | I don't think that this is a feature at all. In any case, it is **not** an "ignored variable".
By which I mean that if `val _ = 5` really introduced an unnamed value, then you could declare as many as you want in the same single scope.
Not so:
```
scala> object Test {
| val _ = 5
| val _ = 7
| }
<co... | The other use case (that I can think of) is related to extraction (and is called out under "Wildcard patterns" in [the linked answer](https://stackoverflow.com/a/8001065/1586965)):
```
val getCartesianPoint = () => (1, 2, 3)
// We don't care about the z axis, so we assign it to _
val (x, y, _) = getCartesianPoint()
v... |
27,793,939 | I have Reporting\_officers Table.structure of table is below
```
R_id User_id Manager_id Managre2_id
1 4 3 3
2 3 2 2
3 5 3 2
```
now i want update user\_id 3 to 6 in this table, then it should reflect to manager\_id and manger2\_id which have 3
like be... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27793939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4422840/"
] | Ok... Use like below
```
AddColumn("dbo.Props", "Prop2", c => c.Int(nullable: false, defaultValue: 0));
```
set nullable:false in your code | You added the two fields as nullable in the db (nullable: true) but your model (object) has these type declared as non nullable. So EF is trying to assign a null value to non nulalble properties. Make the object properties nulallbe like so:
```
public class MyProp: PropBase
{
public double Prop10 { get; set; }
p... |
27,793,939 | I have Reporting\_officers Table.structure of table is below
```
R_id User_id Manager_id Managre2_id
1 4 3 3
2 3 2 2
3 5 3 2
```
now i want update user\_id 3 to 6 in this table, then it should reflect to manager\_id and manger2\_id which have 3
like be... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27793939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4422840/"
] | Please try
```
AddColumn("dbo.Props", "Prop1", c => c.Double());
AddColumn("dbo.Props", "Prop2", c => c.Int());
Sql("UPDATE dbo.Props SET Prop1 = 0, Prop2 = 0 WHERE Discriminator = 'MyProp'");
```
The idea is to update with not null value the old values from DB table with Discriminator "MyProp" | You added the two fields as nullable in the db (nullable: true) but your model (object) has these type declared as non nullable. So EF is trying to assign a null value to non nulalble properties. Make the object properties nulallbe like so:
```
public class MyProp: PropBase
{
public double Prop10 { get; set; }
p... |
27,793,939 | I have Reporting\_officers Table.structure of table is below
```
R_id User_id Manager_id Managre2_id
1 4 3 3
2 3 2 2
3 5 3 2
```
now i want update user\_id 3 to 6 in this table, then it should reflect to manager\_id and manger2\_id which have 3
like be... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27793939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4422840/"
] | Please try
```
AddColumn("dbo.Props", "Prop1", c => c.Double());
AddColumn("dbo.Props", "Prop2", c => c.Int());
Sql("UPDATE dbo.Props SET Prop1 = 0, Prop2 = 0 WHERE Discriminator = 'MyProp'");
```
The idea is to update with not null value the old values from DB table with Discriminator "MyProp" | Ok... Use like below
```
AddColumn("dbo.Props", "Prop2", c => c.Int(nullable: false, defaultValue: 0));
```
set nullable:false in your code |
47,923,210 | the issue i'm having is when i load this
UIViewController.removeSpinner(spinner: self.view)
it gives me a blank black view, and i don't know how to access sv variable from the button function:
let sv = UIViewController.displaySpinner(onView: self.view)
im using this extintion to load the spinner and remove
<http://... | 2017/12/21 | [
"https://Stackoverflow.com/questions/47923210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9093088/"
] | ```
public moderlist=[];
public notification1=[];
public createdon1=[];
public notificationlabel:any=[];
public createdonlabel:any=[];
public fourNotification:any=[];
getAllNotifications() {
debugger;
this.RedBenchService.getNotifications().subscribe(
results => {
// this.moderlist
... | Change the logic in the for loop as follows.
```
if(this.moderlist.length >= 4){
for(let i=this.moderlist.length-1; i>=this.moderlist.length-4;i--) {
this.notification1.push(this.moderlist[i].Notification1);
this.createdon1.push(this.moderlist[i].CreatedOn);
}
}
``` |
292,345 | After upgrading to Magento 2.3.3 product collections filtering with the is\_saleable attribute no longer appears to work and the following error is seen in templates calling the collection :
>
> The "is\_saleable" attribute name is invalid. Reset the name and try
> again.
>
>
>
What is the correct way to filter ... | 2019/10/10 | [
"https://magento.stackexchange.com/questions/292345",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/7863/"
] | When I raised similar question with theme devs for Porto theme which was getting error on the line
```
->addAttributeToFilter('is_saleable', 1, 'left')
```
citing 2nd attribute needed to be an array or null
they sent me back a patch simply removing the call to `->addAttributeToFilter('is_saleable', 1, 'left')` and ... | can confirm this
it seems is\_saleable is no attribute in 2.3.3 ..
the question is: what function had this attribute and what action did remove it?
i have udpated to 2.3.3 on all my webshops and can not look if it was inside in 2.3.2 and before
Best regards Markus |
292,345 | After upgrading to Magento 2.3.3 product collections filtering with the is\_saleable attribute no longer appears to work and the following error is seen in templates calling the collection :
>
> The "is\_saleable" attribute name is invalid. Reset the name and try
> again.
>
>
>
What is the correct way to filter ... | 2019/10/10 | [
"https://magento.stackexchange.com/questions/292345",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/7863/"
] | When I raised similar question with theme devs for Porto theme which was getting error on the line
```
->addAttributeToFilter('is_saleable', 1, 'left')
```
citing 2nd attribute needed to be an array or null
they sent me back a patch simply removing the call to `->addAttributeToFilter('is_saleable', 1, 'left')` and ... | Try to change
>
> ***magento/module-catalog/Model/ResourceModel/Product/Collection.php call addIsSaleableAttributeToFilter which require array argument.***
>
>
>
```
->addAttributeToFilter('is_saleable', 1, 'left')
by
->addAttributeToFilter('is_saleable', ['eq' => 1], 'left')
``` |
10,375,229 | I am a python newbie and would like help with the following task:
Given a h/cpp file i would like to replace each #define line with static const.
Of course the type of the variable should be correct (lets say only int or string).
How can i do that? | 2012/04/29 | [
"https://Stackoverflow.com/questions/10375229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/243967/"
] | ```
new = ""
file = open("file.cpp")
for line in file:
if "#define" in file:
splitline = line.split(" ")
new += "static const "
if '"' in line:
new += "string "
else:
new += "int "
new += splitline[1]
new += " = "
new += splitline[2]
... | ```
import sys
# Read in the file as an array of lines
lines = file(sys.argv[1], 'r').readlines()
# Loop over the lines and replace any instance of #define with 'static const'
for line_no in xrange(len(lines)):
lines[line_no] = lines[line_no].replace('#define', 'static const')
# Write the file back out
file(sys.... |
14,592,602 | I am in need of assistance, I've been looking all day in Google and so far I have not found an article for what I'm trying to do. I am working on a little project in C# using SharpDevelop as my IDE, in the user interface for my project I have several Labels, 11 of which indicate what the field is about (i.e. "Name:" , ... | 2013/01/29 | [
"https://Stackoverflow.com/questions/14592602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023240/"
] | Place all of the output controls in a panel (or identify them however you think is best) and then you can use the following code:
```
StringBuilder clipboard = new StringBuilder();
foreach (Label label in outputPanel.Controls.OfType<Label>())
clipboard.Append(label.Text + "\n");
Clipboard.SetText(clipboard.ToStri... | IF you are using Windows Forms you can use ContextMenuStrip , by naming an option "copy", then applying named ContextMenuStrip to each label option that says ContextMenuStrip
```
private void copyUserInfoToolStripMenuItem_Click(object sender, EventArgs e)
{
string UserInfo = $"{lblFirstName.Text}\n" +... |
31,046,530 | I am using EventFiringWebDriver and WebDriverEventListener. In listener I am implementing method after `clickOn(WebElement arg0, WebDriver arg1)` method.
```
WebElement myaccountLink =driver.findElement(By.cssSelector("div.footer>div.links>ul>li>a[title='My Account']"));
myaccountLink.click();
```
The listener:
```... | 2015/06/25 | [
"https://Stackoverflow.com/questions/31046530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4402580/"
] | You may try to build a custom class like this:
```
public class Selector {
public String name;
public By by;
public Selector(String name, By by){
this.name= name;
this.by = by;
}
public String getName(){
return name;
}
public By getBy(){
return by;
}
}... | I'm open to correction on this but as far as i know, it's not possible. Variable names aren't communicated in Java, only the values. |
5,764,679 | I'm trying to map out how the Play framework supports escaping.
This is a nice page spelling out the needed functionality:
<https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet>
So I'm trying to relate that to Play template features and fully understand what Play does and doesn't do.... | 2011/04/23 | [
"https://Stackoverflow.com/questions/5764679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277156/"
] | I've been looking into this so decided to write up my own answer based on what you already had, this [OWASP cheat sheet](https://www.owasp.org/index.php/Abridged_XSS_Prevention_Cheat_Sheet) and some experimentation of my own
**HTML escaping:**
* ${} or the escape() function
**Attribute escaping: (common attributes)*... | I think you are absolutely correct in your summary. Play gives you some of the solutions, but not all. However, in the two places where Play does not offer something (in the CSS and attribute), I cant actually find a need for it.
The OWASP standard specifies that you should escape untrusted code. So, the only way you ... |
58,289,375 | How to read a key-value pair file into an associative array when the value portion may have the delimiter in the value? So, split the line on the first occurrence of the delimiter, and store in an associative array.
Example KVP file contents:
```
key=value
key1=[SHA:]$value()%_&+=
```
I'd like to do something like
... | 2019/10/08 | [
"https://Stackoverflow.com/questions/58289375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/995297/"
] | You could use parameter expansion to remove everything *starting with* the first `=` for the key, and everything *up to* the first `=` for the value:
```
declare -A keyvals
while IFS= read -r line; do
keyvals["${line%%=*}"]=${line#*=}
done < "$KVP_FILE"
``` | Use `sed` to replace first separator to a newline. Then read two lines at a time.
```
KVP_FILE="./file.properties"
declare -A keyvals
while read -r key && read -r value; do
keyvals[$key]="$value"
done < <(sed 's/=/\n/' "$KVP_FILE")
``` |
12,956,735 | I know this is a newbie question, but I am all confused. How should I call class method from another class, or shouldn't I?
Here is my `ClassA` and `CoreDataHelper`:
```
#import <Foundation/Foundation.h>
@interface ClassA : NSObject {
}
@property (nonatomic, retain) NSString * sessionId;
@property (nonatomic, reta... | 2012/10/18 | [
"https://Stackoverflow.com/questions/12956735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/587669/"
] | You are calling a class method from another in the right way except the method signature is not the same as it is declared;
```
bool asd =[CoreDataHelper insertAllObjectsForEntity:@"Contact"
andContext:managedObjectContext
initCoreData:j... | Like:
```
[ClassName method];
```
Instead of:
```
[instance method];
```
In your example would be then:
```
[ClassA pullOfflineDataWithContext];
``` |
12,742,110 | I am using the mvc Editor features but it seems that the @something doesn't work. I don't know why.
```
@Html.EditorFor(model => model.Password, new { @Value = "xxx" })
```
This take the model value and not the "xxx".
Thanks a lot for your help ! | 2012/10/05 | [
"https://Stackoverflow.com/questions/12742110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396323/"
] | You don't need the @ in front of Value. As you have it already in front of Html. Remove it and it should work. | You have to remove the second @. if you want your value to come from model, you have to write something like this,
```
@Html.EditorFor(model => model.Password, new { value = Model.Password})
```
In either case you have to remove the second @ before value |
12,742,110 | I am using the mvc Editor features but it seems that the @something doesn't work. I don't know why.
```
@Html.EditorFor(model => model.Password, new { @Value = "xxx" })
```
This take the model value and not the "xxx".
Thanks a lot for your help ! | 2012/10/05 | [
"https://Stackoverflow.com/questions/12742110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396323/"
] | You don't need the @ in front of Value. As you have it already in front of Html. Remove it and it should work. | The `@Value` works for `TextBoxFor` but not `EditorFor` (since it is generic...). |
12,742,110 | I am using the mvc Editor features but it seems that the @something doesn't work. I don't know why.
```
@Html.EditorFor(model => model.Password, new { @Value = "xxx" })
```
This take the model value and not the "xxx".
Thanks a lot for your help ! | 2012/10/05 | [
"https://Stackoverflow.com/questions/12742110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396323/"
] | You have to remove the second @. if you want your value to come from model, you have to write something like this,
```
@Html.EditorFor(model => model.Password, new { value = Model.Password})
```
In either case you have to remove the second @ before value | The `@Value` works for `TextBoxFor` but not `EditorFor` (since it is generic...). |
16,858,325 | I have a Linked Server from SQL Server 2008 R2, to a DB2 Database (V4R5M0) using OLE DB provider "IBMDA400"
Linked Server Detials
```
EXEC master.dbo.sp_addlinkedserver
@server = N'JTEST', @srvproduct=N'IBM OLE DB Provider for DB2',
@provider=N'IBMDA400', @datasrc=N'TestName'
```
This works fine:
```
S... | 2013/05/31 | [
"https://Stackoverflow.com/questions/16858325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467848/"
] | Wouldn't FETCH FIRST need an ORDER BY? Otherwise, which 10 rows would it get?
As far as I can see in the DB2 SQL docs, it is supported on current and older versions, although it doesn't state (and it not clear) if ORDER BY is mandatory with FETCH FIRST | Fetch first clause work only from V5R1 OS400 version.
V4R5M0 is too old
There's a workaround:
select \* from (
SELECT syscolumns.\* , row\_number() over() as nre FROM syscolumns
ORDER BY COLUMN\_NAME ) as columns
where nre<10
You can try it
---
DEpe |
29,772,364 | I'm searching for a specific SQL Query.
I have two tables : "DOCUMENT" and "DOCUMENT\_CONTENT" similar to this :
```
DOCUMENT
Number | Date |
---------+-------------+
48796 | 21/04/2015 |
48797 | 21/04/2015 |
DOCUMENT_CONTENT
Number | Product_Code | Supplier | Quantity |
---------+-----... | 2015/04/21 | [
"https://Stackoverflow.com/questions/29772364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4396067/"
] | The trick here is to do aggregation and test the results in a case:
```
select d.*, dc.supplier
from DOCUMENT d join
(select dc.number,
(case when min(dc.Supplier) = max(dc.Supplier) then min(dc.Supplier)
else 'Several'
end) as supplier
from DOCUMENT_CONTENT dc
... | ```
Select Case when count(Supplier) = 1 then Max(supplier) else 'several' end
from DOCUMENT D Inner Join DOCUMENT_CONTENT DC on D.Number = DC.Number
Group by D.Date , D.Number
``` |
26,218,354 | I have an iframe loading on my page. The content of the iframe only loads after the rest of the content has loaded on the page. Is it possible to load the content within the iframe before the rest of the content on the main page?
Thanks | 2014/10/06 | [
"https://Stackoverflow.com/questions/26218354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2753924/"
] | ```
<iframe id="miiframe" src="http://www.apple.com"></iframe>
<!-- example -->
<div id="loading" style="position:fixed;background:red;width:100%;height:100%;top:0;left:0;z-index:2;"></div>
<img id="background" style="position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1;"/>
<script>
var loa... | Try
```
// hold `ready` event
$.holdReady(true);
var frame = $("<iframe>");
$(frame).load(function(e) {
// release `ready` event
$.holdReady(false)
});
// append `frame` to document
$("body").append(frame);
$(document).ready(function() {
// do stuff
// after `frame` loaded
$("body").append("done")
}... |
21,300,792 | -Mac OSX 10.7.5
-Python 2.7
-PostgreSQL 9.3.2 (set up via Heroku)
-Django 1.6
I've spent the entire day trying to solve this problem and have not been able to find a solution. I'm trying to get my Django app to recognize a Postgres database. The database setting in my django settings.py is
```
DATABASES = {
'defaul... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21300792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/961514/"
] | You should use the [enum.Parse](http://msdn.microsoft.com/en-us/library/essfb559(v=vs.110).aspx) Method:
```
MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), enumString);
```
I found the [code snippet](http://dotnet-snippets.de/snippet/string-zu-enum/1012). | I really would recommend storing the numerical values rather than the text values in the database. If you want the text values in the database too then add a table for it. Regardless, the Enum.Parse and .TryParse methods will convert a String and the .ToObject method will convert either text or numbers. |
21,300,792 | -Mac OSX 10.7.5
-Python 2.7
-PostgreSQL 9.3.2 (set up via Heroku)
-Django 1.6
I've spent the entire day trying to solve this problem and have not been able to find a solution. I'm trying to get my Django app to recognize a Postgres database. The database setting in my django settings.py is
```
DATABASES = {
'defaul... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21300792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/961514/"
] | You should use the [enum.Parse](http://msdn.microsoft.com/en-us/library/essfb559(v=vs.110).aspx) Method:
```
MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), enumString);
```
I found the [code snippet](http://dotnet-snippets.de/snippet/string-zu-enum/1012). | >
> How to make enum of preferencekey column which is string type in best optimized way
>
>
>
Well i am afraid you cannot use your preference key as enum for 2 reasons.
1. your preference key is starting with integer values making it an in-valid identifier.
2. it also contains **-** which is not allowed either.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.