qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
55,114,172 | ```
import java.util.*;
import java.io.*;
class TreeSetPro
{
public static void main(String $[] )throws IOException
{
TreeSet<String> alpha=new TreeSet<String>();
alpha.add("apple");
alpha.add("Apple");
alpha.add("Ab");
alpha.add("applet");
System.out.println(a... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55114172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8234870/"
] | You're confusing a few things and are possibly confused about a few confusing things.
`__len__` is not referring to `len()`, rather `len(something)` will call the `__len__` method of `something`. Any object that has a `__len__` method can be asked for its length by calling `len(something)`. Note how this is different ... | Let's say you have a class `Person`
```
class Person:
name = "Samuel"
age = 50
country = "India"
def method1(self):
print("Method 1")
print(dir(Person))
```
The output of the above program looks like this:
```
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__',
'__for... |
55,114,172 | ```
import java.util.*;
import java.io.*;
class TreeSetPro
{
public static void main(String $[] )throws IOException
{
TreeSet<String> alpha=new TreeSet<String>();
alpha.add("apple");
alpha.add("Apple");
alpha.add("Ab");
alpha.add("applet");
System.out.println(a... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55114172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8234870/"
] | You're confusing a few things and are possibly confused about a few confusing things.
`__len__` is not referring to `len()`, rather `len(something)` will call the `__len__` method of `something`. Any object that has a `__len__` method can be asked for its length by calling `len(something)`. Note how this is different ... | Those are the methods that the object superclass has. And any object that inherits from this attains these properties. Now I think you are confusing yourself with `__len__()` and `len(something)`.
`len()` is a function that is brought into scope by default. What it simply does is it calls the `__len__()` function tha... |
45,750,921 | I have a virtual environment for python and hence i activate like this
```
#source myName/bin/activate
```
In the host machine, i have installed this package
```
#sudo pip install scikit-image
```
In the virtual environment, i m unable to access scikit-image. How can i get the newly added package into the existi... | 2017/08/18 | [
"https://Stackoverflow.com/questions/45750921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3796318/"
] | Use `pip`without `sudo` in order to install it in your environment. When you use `sudo` you become `root`, then your packages are installed as `root`. | Your [PATH becomes different](https://unix.stackexchange.com/a/169253) when running a program with `sudo` rights. Therefore, you install the package to your root python executable even though you activated the virtual env. To check this try:
```
source myName/bin/activate
which pip
sudo which pip
```
The last two ou... |
58,303,960 | I'm trapped by `php -r` and can't escape from the "`>`".
--------------------------------------------------------
---
I tried to run a simple PHP command from the terminal. Which was `$ php -r '<the PHP commands>'`, so to see what the results would be.
But **something went wrong and the terminal keeps showing me th... | 2019/10/09 | [
"https://Stackoverflow.com/questions/58303960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12102603/"
] | Related:
* [How can I write a QuadWord from AVX512 register zmm26 to the rax register?](https://stackoverflow.com/questions/31893523/how-can-i-write-a-quadword-from-avx512-register-zmm26-to-the-rax-register) - most of that applies to extracting 32 and 16-bit elements, too.
* [Move an int64\_t to the high quadwords of ... | To complete [Peter's answer](https://stackoverflow.com/a/58304982/2970186), here are implementations of 16 and 32 bit insert/extract methods:
```cpp
#if defined(__GNUC__)
int _mm512_cvtsi512_si32(__m512i a)
{
__v16si b = (__v16si) a;
return b[0];
}
#endif
__m512i _mm512_insert_epi16(__m512i target, const st... |
13,686,814 | I have an application, which runs all the time and receives some messages (rate of them varies from several per second to none per hour). Every message should be put into a SQLite database. What's the best way to do this?
Opening and closing the database on each message doesn't sound good: if there are tens of them pe... | 2012/12/03 | [
"https://Stackoverflow.com/questions/13686814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693369/"
] | It sounds like whatever you do, you'll have to make a trade-off.
If safety is your top-most concern, then update the database on each message and take the speed hit.
If you want a compromise, then update the database write every so many messages. For instance, maintain a buffer and every 100th message, issue an updat... | If your top rate is "several per second" then I dont see a real problem with opening and closing the db. This is especially true if its critical that the data be recorded right away in case of server failure.
We use SQLite in a reporting product and the best performance we have been able to eek out is recording rows i... |
13,686,814 | I have an application, which runs all the time and receives some messages (rate of them varies from several per second to none per hour). Every message should be put into a SQLite database. What's the best way to do this?
Opening and closing the database on each message doesn't sound good: if there are tens of them pe... | 2012/12/03 | [
"https://Stackoverflow.com/questions/13686814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693369/"
] | It sounds like whatever you do, you'll have to make a trade-off.
If safety is your top-most concern, then update the database on each message and take the speed hit.
If you want a compromise, then update the database write every so many messages. For instance, maintain a buffer and every 100th message, issue an updat... | There is an easy algorithm to adjust your application's behaviour to the message rate:
* When you have just written a message, check if there is any new message.
+ If yes, write that message too, and repeat.
* Only when you have run out of immediately available messages, commit the transaction and close the database.... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | One difficulty is that it's far from clear what the ideal dropout rate should be. Probably not zero, for two reasons:
1. Even the best students sometimes find that their interests change over time, in ways nobody could have predicted. Dropping out may become a quite sensible choice, in which case it's harmful for the ... | Pay, if you paid me what I would make working on an industry project I would have been a lot more compelled to stay.
At the moment, even looking purely at GRA hourly rate it's almost half the hourly rate of a junior engineer. The way current PhD system works is basically projects get subcontracted out to universities ... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | One difficulty is that it's far from clear what the ideal dropout rate should be. Probably not zero, for two reasons:
1. Even the best students sometimes find that their interests change over time, in ways nobody could have predicted. Dropping out may become a quite sensible choice, in which case it's harmful for the ... | I think that the problem is that often many professors underestimate the PhD student's will and personal scientific aims.
Often it happens that a perspective PhD student apply for PhD admission to work on a project X, and then, once he/she starts the doctorate program, professors say to him or her "Surely you will wor... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | I think that the problem is that often many professors underestimate the PhD student's will and personal scientific aims.
Often it happens that a perspective PhD student apply for PhD admission to work on a project X, and then, once he/she starts the doctorate program, professors say to him or her "Surely you will wor... | Possibly universities should be more careful about hiring PhD students in the first place. It's not enough that they are smart. Students need to be persistent and motivated and their motivations should be realistic. I think it helps a lot of if the students have had some time out of academia so they know early whether ... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | I think this is asking the wrong question. To me, the right question is, *what are the main reasons that students drop out, and what steps can be taken to address those reasons?* To properly examine this data would need to be gathered, but anecdotally I can think of a few reasons:
* **Student gets bored/loses interest... | As a person who dropped out from a part-time PhD programme in Engineering in the UK. I can add my reasons for dropping out.
1. Family - being a father and husband changes worldview and sometimes it becomes apparent that there are more effective ways to further one's career than PhD if your aim is not to be an academic... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | Possibly universities should be more careful about hiring PhD students in the first place. It's not enough that they are smart. Students need to be persistent and motivated and their motivations should be realistic. I think it helps a lot of if the students have had some time out of academia so they know early whether ... | Pay, if you paid me what I would make working on an industry project I would have been a lot more compelled to stay.
At the moment, even looking purely at GRA hourly rate it's almost half the hourly rate of a junior engineer. The way current PhD system works is basically projects get subcontracted out to universities ... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | I think that the problem is that often many professors underestimate the PhD student's will and personal scientific aims.
Often it happens that a perspective PhD student apply for PhD admission to work on a project X, and then, once he/she starts the doctorate program, professors say to him or her "Surely you will wor... | As a person who dropped out from a part-time PhD programme in Engineering in the UK. I can add my reasons for dropping out.
1. Family - being a father and husband changes worldview and sometimes it becomes apparent that there are more effective ways to further one's career than PhD if your aim is not to be an academic... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | One difficulty is that it's far from clear what the ideal dropout rate should be. Probably not zero, for two reasons:
1. Even the best students sometimes find that their interests change over time, in ways nobody could have predicted. Dropping out may become a quite sensible choice, in which case it's harmful for the ... | I think this is asking the wrong question. To me, the right question is, *what are the main reasons that students drop out, and what steps can be taken to address those reasons?* To properly examine this data would need to be gathered, but anecdotally I can think of a few reasons:
* **Student gets bored/loses interest... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | Possibly universities should be more careful about hiring PhD students in the first place. It's not enough that they are smart. Students need to be persistent and motivated and their motivations should be realistic. I think it helps a lot of if the students have had some time out of academia so they know early whether ... | As a person who dropped out from a part-time PhD programme in Engineering in the UK. I can add my reasons for dropping out.
1. Family - being a father and husband changes worldview and sometimes it becomes apparent that there are more effective ways to further one's career than PhD if your aim is not to be an academic... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | One difficulty is that it's far from clear what the ideal dropout rate should be. Probably not zero, for two reasons:
1. Even the best students sometimes find that their interests change over time, in ways nobody could have predicted. Dropping out may become a quite sensible choice, in which case it's harmful for the ... | Possibly universities should be more careful about hiring PhD students in the first place. It's not enough that they are smart. Students need to be persistent and motivated and their motivations should be realistic. I think it helps a lot of if the students have had some time out of academia so they know early whether ... |
1,378 | One of the major issues in universities with respect to PhD is the high dropout factor. Demotivated students cause a big loss to the university - a lot is spent on assistantships, but in the end, the students quit without making any meaningful contribution.
What steps do/should universities and faculty members take to... | 2012/05/03 | [
"https://academia.stackexchange.com/questions/1378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/411/"
] | I think this is asking the wrong question. To me, the right question is, *what are the main reasons that students drop out, and what steps can be taken to address those reasons?* To properly examine this data would need to be gathered, but anecdotally I can think of a few reasons:
* **Student gets bored/loses interest... | Possibly universities should be more careful about hiring PhD students in the first place. It's not enough that they are smart. Students need to be persistent and motivated and their motivations should be realistic. I think it helps a lot of if the students have had some time out of academia so they know early whether ... |
37,609,181 | **$result** contains a non specific amount of records.
I need to loop through $result, and after every 100 records, do something, and then continue the loop, but include 5 records from the previous loop (overlap).
Like this:
1. Get records 0-100
2. Do something with these records
3. Get records 95-195
4. Do somethin... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37609181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2199706/"
] | first of all I agree with the commentators. We are here to help with problems you've ran in, but not to write your script.
Neverthelesse I wrote a perlish solution of your problem:
```
$results; #your results
for($i = 0; $i <= @{$results}, $i++){ #loop through all results
my @tempList;
push(@tempList, @{$res... | ```
$slimit=0;
$flimit=100;
while($flimit<=total_records_in_your_table)
{
$q="select * from table_name limit $slimit,$flimit";
while($data=mysql_fetch_row($q))
{
//opration
}
$slimit=$flimit-6;
$flimit=$flimit+$slimit;
}
``` |
40,172 | There [are](https://academia.stackexchange.com/questions/29219/how-to-address-a-mistake-in-an-old-paper-in-a-very-prestigious-scientific-journa?rq=1) [several](https://academia.stackexchange.com/questions/520/how-do-you-make-corrections-to-a-published-paper?rq=1) [questions](https://academia.stackexchange.com/questions... | 2015/02/19 | [
"https://academia.stackexchange.com/questions/40172",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/185/"
] | A site which has some ambitions and potential in this direction is [PubPeer](https://pubpeer.com/), which aims to be a general "online journal club", but which has also become a place to dissect papers for errors and possible fraud, particularly in biomedical areas. It is thus one clearing house for discussing errors i... | As far as I know, the journals or publishers which publish a paper accept errors/erratums on their published papers. So, if the errors and mistakes are too problematic, you may look for errors in the journal in which the paper is published. If you can not find such papers on errors of a previously published papers, you... |
40,172 | There [are](https://academia.stackexchange.com/questions/29219/how-to-address-a-mistake-in-an-old-paper-in-a-very-prestigious-scientific-journa?rq=1) [several](https://academia.stackexchange.com/questions/520/how-do-you-make-corrections-to-a-published-paper?rq=1) [questions](https://academia.stackexchange.com/questions... | 2015/02/19 | [
"https://academia.stackexchange.com/questions/40172",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/185/"
] | A site which has some ambitions and potential in this direction is [PubPeer](https://pubpeer.com/), which aims to be a general "online journal club", but which has also become a place to dissect papers for errors and possible fraud, particularly in biomedical areas. It is thus one clearing house for discussing errors i... | It's been my experience that *electronic journals* are much more friendly to correcting errors than traditional, print-based journals. That's because print-space is at a premium and it costs them money to print an erratum to a previously published article. So, in the minds of the traditional publishers, they have to ju... |
27,773 | Suppose I sign a contract in front of witnesses, but then immediately tear it up.
Is the contract still binding? | 2018/04/18 | [
"https://law.stackexchange.com/questions/27773",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/3175/"
] | The contract remains valid.
Most contracts don't need to be written at all. Even if yours did need to be written under the Statute of Frauds or some other law, you're saying that it *was* made in writing, even though you later tore it up.
The fact that the contract is missing or destroyed doesn't change the fact that... | Signing a document is totally overrated. Is there an offer, is there consideration, is there a meeting of the minds, and was there acceptance? I assume that someone gave you a piece of paper with some mutual promises. You signing the contract is a form of proof of your acceptance. You signing a contract and then immedi... |
27,773 | Suppose I sign a contract in front of witnesses, but then immediately tear it up.
Is the contract still binding? | 2018/04/18 | [
"https://law.stackexchange.com/questions/27773",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/3175/"
] | The contract remains valid.
Most contracts don't need to be written at all. Even if yours did need to be written under the Statute of Frauds or some other law, you're saying that it *was* made in writing, even though you later tore it up.
The fact that the contract is missing or destroyed doesn't change the fact that... | The usual situation in which this occurs is where a contract existed where one party delivered immediately, and the other party has an ongoing obligation. The contract exists for the benefit of the party who still has to receive such compensation.
This party can usually decide to relinquish their claim. In these cases... |
27,773 | Suppose I sign a contract in front of witnesses, but then immediately tear it up.
Is the contract still binding? | 2018/04/18 | [
"https://law.stackexchange.com/questions/27773",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/3175/"
] | The only documents that lose their validity when the original is physically destroyed sufficiently are:
1. Last Wills and Testaments (this can be overcome if it is shown that it was destroyed without an intent to revoke the Will, e.g., in a house fire that also killed the testator or testatrix).
2. Currency.
3. Live c... | Signing a document is totally overrated. Is there an offer, is there consideration, is there a meeting of the minds, and was there acceptance? I assume that someone gave you a piece of paper with some mutual promises. You signing the contract is a form of proof of your acceptance. You signing a contract and then immedi... |
27,773 | Suppose I sign a contract in front of witnesses, but then immediately tear it up.
Is the contract still binding? | 2018/04/18 | [
"https://law.stackexchange.com/questions/27773",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/3175/"
] | Signing a document is totally overrated. Is there an offer, is there consideration, is there a meeting of the minds, and was there acceptance? I assume that someone gave you a piece of paper with some mutual promises. You signing the contract is a form of proof of your acceptance. You signing a contract and then immedi... | The usual situation in which this occurs is where a contract existed where one party delivered immediately, and the other party has an ongoing obligation. The contract exists for the benefit of the party who still has to receive such compensation.
This party can usually decide to relinquish their claim. In these cases... |
27,773 | Suppose I sign a contract in front of witnesses, but then immediately tear it up.
Is the contract still binding? | 2018/04/18 | [
"https://law.stackexchange.com/questions/27773",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/3175/"
] | The only documents that lose their validity when the original is physically destroyed sufficiently are:
1. Last Wills and Testaments (this can be overcome if it is shown that it was destroyed without an intent to revoke the Will, e.g., in a house fire that also killed the testator or testatrix).
2. Currency.
3. Live c... | The usual situation in which this occurs is where a contract existed where one party delivered immediately, and the other party has an ongoing obligation. The contract exists for the benefit of the party who still has to receive such compensation.
This party can usually decide to relinquish their claim. In these cases... |
377,668 | When is the function defined by $f(x)=x^2+e^{-2x}$ increasing? I know you have to take the derivative and use certain values of $x$, but I am confused on how to do this particular problem, and I would love it if any could help. Any help is appreciated thanks. | 2013/04/30 | [
"https://math.stackexchange.com/questions/377668",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/59443/"
] | First take the derivative:
$f'(x)=2x-2e^{-2x}$
Now consider the values when the derivative is equal to 0:
$2x-2e^{-2x}=0$
Now the function is increasing whenever $f'(x)$ is positive, and decreasing when it is negative. I.e., $f$ is increasing when:
\begin{align\*}
2x &> 2e^{-2x}\\
x &> e^{-2x}\\
\ln(x) &> -2x
\end... | $\frac{\delta f(x)}{\delta x}=-2e^{-2x}+2x$
Thus, the function is increasing when:
$2x>2e^{-2x}$
$x>\frac{1}{e^{2x}}$
A computational approach to solving this inequality provides the condition:
$x>.426$ |
7,589 | I've got some freshly constructed raised beds and I've filled them with a lovely load of well rotted horse manure.
The manure is so nice to work with, so rich and friable and easy to weed, that next year and the year after I'm going to want to repeat the process, adding in loads more. I've got no shortage of manure. ... | 2013/06/05 | [
"https://gardening.stackexchange.com/questions/7589",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/99/"
] | Good questions. :)
Plants most definitely take up nutrients from the soil. A heavy feeder like corn is hard on the soil - one of the reasons they rotate with soy on factory farms is that corn simply requires a LOT of nitrogen and won't grow well after repeatedly being sowed on the same plot of ground without replacing... | The only option is to remove old stuff before adding new manure in order to have similar level.
Personally, when I refill soil mixed with manure to my plants, I try to remove all unwanted old soil that looks unhealthy / rocky, which I think are just empty food plates :)
PS: I just work on upper layer of soil and don... |
7,589 | I've got some freshly constructed raised beds and I've filled them with a lovely load of well rotted horse manure.
The manure is so nice to work with, so rich and friable and easy to weed, that next year and the year after I'm going to want to repeat the process, adding in loads more. I've got no shortage of manure. ... | 2013/06/05 | [
"https://gardening.stackexchange.com/questions/7589",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/99/"
] | In practice, I don't think it will be a problem.
I wouldn't add substantial manure to every bed every year. Some plants simply don't want it -- your carrots, for example.
I'd add an inch or two for, say, zucchini/courgettes or celery. And, since you're rotating crops, you can plant potatoes or beans there next year t... | The only option is to remove old stuff before adding new manure in order to have similar level.
Personally, when I refill soil mixed with manure to my plants, I try to remove all unwanted old soil that looks unhealthy / rocky, which I think are just empty food plates :)
PS: I just work on upper layer of soil and don... |
7,589 | I've got some freshly constructed raised beds and I've filled them with a lovely load of well rotted horse manure.
The manure is so nice to work with, so rich and friable and easy to weed, that next year and the year after I'm going to want to repeat the process, adding in loads more. I've got no shortage of manure. ... | 2013/06/05 | [
"https://gardening.stackexchange.com/questions/7589",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/99/"
] | >
> How do I avoid overfilling raised beds if I'm adding substantial
> manure annually?
>
>
>
Easy. Don't add "substantial manure" annually. Straight composted manure is very nutrient rich and your plants will only use a small portion of it and much of it will not leach out so only add enough to bring your beds b... | The only option is to remove old stuff before adding new manure in order to have similar level.
Personally, when I refill soil mixed with manure to my plants, I try to remove all unwanted old soil that looks unhealthy / rocky, which I think are just empty food plates :)
PS: I just work on upper layer of soil and don... |
7,589 | I've got some freshly constructed raised beds and I've filled them with a lovely load of well rotted horse manure.
The manure is so nice to work with, so rich and friable and easy to weed, that next year and the year after I'm going to want to repeat the process, adding in loads more. I've got no shortage of manure. ... | 2013/06/05 | [
"https://gardening.stackexchange.com/questions/7589",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/99/"
] | In practice, I don't think it will be a problem.
I wouldn't add substantial manure to every bed every year. Some plants simply don't want it -- your carrots, for example.
I'd add an inch or two for, say, zucchini/courgettes or celery. And, since you're rotating crops, you can plant potatoes or beans there next year t... | Good questions. :)
Plants most definitely take up nutrients from the soil. A heavy feeder like corn is hard on the soil - one of the reasons they rotate with soy on factory farms is that corn simply requires a LOT of nitrogen and won't grow well after repeatedly being sowed on the same plot of ground without replacing... |
7,589 | I've got some freshly constructed raised beds and I've filled them with a lovely load of well rotted horse manure.
The manure is so nice to work with, so rich and friable and easy to weed, that next year and the year after I'm going to want to repeat the process, adding in loads more. I've got no shortage of manure. ... | 2013/06/05 | [
"https://gardening.stackexchange.com/questions/7589",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/99/"
] | In practice, I don't think it will be a problem.
I wouldn't add substantial manure to every bed every year. Some plants simply don't want it -- your carrots, for example.
I'd add an inch or two for, say, zucchini/courgettes or celery. And, since you're rotating crops, you can plant potatoes or beans there next year t... | >
> How do I avoid overfilling raised beds if I'm adding substantial
> manure annually?
>
>
>
Easy. Don't add "substantial manure" annually. Straight composted manure is very nutrient rich and your plants will only use a small portion of it and much of it will not leach out so only add enough to bring your beds b... |
227,970 | Bassicaly I work with the points in data and try to find clusters with different distance functions and show them in the grid.But,how can I add the plot markers `"OpenMarkers"` like with plot legend in the grid plot? Here is what I have done.
```
data = {{-1.1, 2.6}, {3.9, -0.8}, {4.2, -3.7}, {3.3, 3.5}, {3.9,
5.... | 2020/08/04 | [
"https://mathematica.stackexchange.com/questions/227970",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/43288/"
] | ```
nc = 2;
labels = {"cluster 1", "cluster 2"};
plots = ListPlot[FindClusters[data, 2, DistanceFunction -> #],
PlotMarkers -> "OpenMarkers"] & /@
{ChebyshevDistance, SquaredEuclideanDistance, EuclideanDistance};
legend = PointLegend[97,
MapThread[Style[##, 16] &, {labels, ColorData[97] /@ Range[Le... | If the intent is to have a common legend
```
Partition[
Append[
ListPlot[
FindClusters[data, 2,
DistanceFunction -> #],
PlotMarkers -> "OpenMarkers",
PlotLabel -> #] & /@
{ChebyshevDistance,
SquaredEuclideanDistance,
EuclideanDistance},
Column[{
Style["○ Cluster 1",... |
39,866,461 | here i am trying to get custName name if pirmaryCustCheck is true if not then i have to select false tag element , how can i achieve this
xml :
```
<Root>
<data>
<office>Mumba</office>
<officeId>1JC9FJBM</officeId>
<customer>
<custName>Yash</custName>
<pirmaryCustCheck>true</pirmaryCust... | 2016/10/05 | [
"https://Stackoverflow.com/questions/39866461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4250956/"
] | You can do something like this :
Use a for loop for your Numbers list and inside that **Use a handler** to maintain some time gap between each sent message, say 2 seconds and send the message.
OR
You can define a **Broadcast Receiver inside your Service** which will check for the Message Delivery Report and if Del... | try to send SMS OnPost Method or run your AsynTask on Main Thread.
follow [this link](https://stackoverflow.com/a/4918811/2032058) its help you |
53,157,397 | >
> Android dependency 'com.android.support:support-media-compat' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution
>
>
>
I have added List of plugins in my flutter app
```
dependencies:
flutter:
sdk: flutter
c... | 2018/11/05 | [
"https://Stackoverflow.com/questions/53157397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5996295/"
] | I added `implementation("com.android.support:support-v4:latest_version_number")` to my build.gradle and it worked.Hope this helps. | ```
cloud_firestore: ^0.8.2+3
firebase_auth: ^0.6.5
image_picker: 0.4.0
```
This works for me |
53,157,397 | >
> Android dependency 'com.android.support:support-media-compat' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution
>
>
>
I have added List of plugins in my flutter app
```
dependencies:
flutter:
sdk: flutter
c... | 2018/11/05 | [
"https://Stackoverflow.com/questions/53157397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5996295/"
] | You can solve this error with below code change in android>build.gradle
If your project config with kotlin then
```
ext.kotlin_version = '1.2.71'
replace with new version
ext.kotlin_version = '1.3.0'
```
and
```
dependencies {classpath 'com.android.tools.build:gradle:3.2.1'}
repl... | ```
cloud_firestore: ^0.8.2+3
firebase_auth: ^0.6.5
image_picker: 0.4.0
```
This works for me |
35,948,066 | I feel like this is really simple and I'm just missing it.
I have a very simple generic class based view detail.
When I do teh `get_object` I want to make sure that the `request.user` is in the set that belongs to the object. If not, redirect them to the login.
Here's my view:
```
class AwesomeDetail(LoginRequired... | 2016/03/11 | [
"https://Stackoverflow.com/questions/35948066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/198019/"
] | [`UserPassesTestMixin`](https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.mixins.UserPassesTestMixin) was introduced in Django 1.9.
You define a `test_func` method to return `True/Fales` depending on whether the test passes.
If the user fails the test they will be redirected to `settings.... | I'm not very sure about this, but sounds like `get` method is the one you should work on:
```
class AwesomeDetail(LoginRequiredMixin, DetailView):
"""
An awesome detail
"""
template_name = "awesomeness/detail.html"
def get(self, request, *args, **kwargs):
self.object = self.get_object()
... |
13,344,427 | After searching in Internet and trying some codes i exported data from Excel to Datatable with Interop. The Problem is, it's very slow. Can someone give me a key how can i make it quicker with Interop, not OLEDB or anything else?
My code:
```
object misValue = System.Reflection.Missing.Value;
Excel.Application xlApp... | 2012/11/12 | [
"https://Stackoverflow.com/questions/13344427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1682552/"
] | I'll give you an answer to a question you didn't ask. Use [NPOI library](http://code.google.com/p/npoi/downloads/list).
* it will be faster
* you won't have problems with forgetting to close your resources
* Excel will not be required or used in the background
Here's the relevant code for that: [NPOI : How To Read Fi... | My First thoughts on this are that you are looping through the Excel sheet and converting values one-by-one int your array to populate your structure.
Try something more along the lines of (Forgive my VB, but i'm sure oyu'll understand what I'm recommending):
```
Dim SpreadsheetVals(,) as object
SpreadhseetVals = xlW... |
14,089,363 | I want to change a JLabel dynamically with each new string produced by a simple Ping but can't figure out how to replace the existing string on the JLabel with each new string coming in as the Ping is executing. Below is what I have so far. So far it replaces the text of the JLabel but only after the Ping has finished ... | 2012/12/30 | [
"https://Stackoverflow.com/questions/14089363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1524652/"
] | Call setText on the event dispatching thread. Use SwingUtils.invokeLater for that. Do not execute long lasting operations from the EDT. This will cause your app to freeze, as you are experiencing. | Exactly, it will update it only after the ping finished. If you want to do it before it finished, you need to use a **different Thread** for it. |
14,089,363 | I want to change a JLabel dynamically with each new string produced by a simple Ping but can't figure out how to replace the existing string on the JLabel with each new string coming in as the Ping is executing. Below is what I have so far. So far it replaces the text of the JLabel but only after the Ping has finished ... | 2012/12/30 | [
"https://Stackoverflow.com/questions/14089363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1524652/"
] | Your code freezes EDT (Event Dispatch Thread). That's why JLabel text is updated after ping is finished. You should avoid doing that. Running long lasting operations in different thread and updating it using SwingUtils.invokeLater is one solution. Another is usage of SwingWorker class. You can find [tutorial](http://do... | Exactly, it will update it only after the ping finished. If you want to do it before it finished, you need to use a **different Thread** for it. |
14,089,363 | I want to change a JLabel dynamically with each new string produced by a simple Ping but can't figure out how to replace the existing string on the JLabel with each new string coming in as the Ping is executing. Below is what I have so far. So far it replaces the text of the JLabel but only after the Ping has finished ... | 2012/12/30 | [
"https://Stackoverflow.com/questions/14089363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1524652/"
] | Call setText on the event dispatching thread. Use SwingUtils.invokeLater for that. Do not execute long lasting operations from the EDT. This will cause your app to freeze, as you are experiencing. | Your code freezes EDT (Event Dispatch Thread). That's why JLabel text is updated after ping is finished. You should avoid doing that. Running long lasting operations in different thread and updating it using SwingUtils.invokeLater is one solution. Another is usage of SwingWorker class. You can find [tutorial](http://do... |
13,332,476 | I need to write a log system that will save all the domain names and time of visit (if possiable the closing time too) that was made using all browsers which are installed on windows.
for example:
<http://stackoverflow.com> 14:45 - 16:55
I couldnt find any implementation info on google, Please forward me or explain w... | 2012/11/11 | [
"https://Stackoverflow.com/questions/13332476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1454912/"
] | what you ask for is highly dependent on browser/browser version used (and potentially Windows version too)...
Since you don't describe what the goal is it is hard to come up with specific solutions/options...
One rather browser-agnostic option would be to implement a proxy and configure the system/browsers to use th... | See if you can read the history files for each browser and parse the details from there.
CHROME:
in xp = C:\Documents and Settings\USER\Local Settings\Application Data\Google\Chrome\User Data\Default\
in vista = C:\users\USER\Local Settings\Application Data\Google\Chrome\User Data\Default\
FIREFOX:
C:\Documents and... |
522,177 | I recently acquired a new laptop featuring hybrid graphics, namely a Toshiba P50T-B. I installed Ubuntu and at first I had lots of troubles to set up the graphics. The screen was turning black right after Grub, which was fixed through adding the option `nomodeset` and by installing the intel drivers.
Now, the Intel GP... | 2014/09/10 | [
"https://askubuntu.com/questions/522177",
"https://askubuntu.com",
"https://askubuntu.com/users/325342/"
] | With the release of Ubuntu 14.10, some of the problems related to this incompatibility issue appear to be solved. I succeeded to make both graphic cards to work as follows:
1) Install Ubuntu 14.10. In my case, I first tried updating from 14.04 but I messed up with the installation. I ended up doing a clean install fro... | I am posting this for other people, who may want to install Ubuntu on their Toshiba Satellite P50-B laptops. Please notice, I could install the ATI Radeon Graphics card on Ubuntu (I think is just unconfigured); so I did not answer @cloud10 question.
Installation instructions for Toshiba Satellite P50T-B, Windows 8.1 +... |
124,581 | My Samsung Galaxy s5 stopped showing anything on th screen after I dropped it. it still vibrates and makes noises but won't show anything on the screen. how can I fix it? | 2015/09/30 | [
"https://android.stackexchange.com/questions/124581",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/129694/"
] | If you wanna edit your contacts via webinterface you can do this at `https://contacts.google.com`.
Just for people who wanna know this today ;) | The person who picked up your phone is probably still using it. Delete all unnecessary contacts and afterwards immediately change your google password and logout from all devices for once. |
62,642 | Consider this example code which creates a 2x6 table where the 6 columns are formed from three name/value pairs:
```
\documentclass{article}
\usepackage[svgnames,table]{xcolor}
\usepackage{tabu}
\usepackage{booktabs}
\begin{document}
\begin{center}
\taburowcolors[1]{ForestGreen!40..ForestGreen!40}
\begin{tabu}{p{1cm... | 2012/07/08 | [
"https://tex.stackexchange.com/questions/62642",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/16350/"
] | You can create a *project* rather than just working with regular files. Each project has a "main file", so that when you "build the project", it builds the main file, which may be different from the actively selected window/tab.
Start a new project (menu option `File` > `New Project`) and specify the main file or chan... | You can also convert a regular TeX input file to a project as follows.
Step 1
------
Let `trash.tex` be your regular TeX input file. Open it as shown in the following figure.

Step 2
------
Choose `Project` and click `Create with active file as ma... |
61,776,453 | I have an MS Access query which returns records based on the following criterias:
1. Returns records where ID numbers IN[2,15,30...] this is a list of 106 numbers.
2. Returns all records NOT LIKE "\*\* LQ \*\*". This is currently returning 10 records.
I want this query to always return 116 records but the number that ... | 2020/05/13 | [
"https://Stackoverflow.com/questions/61776453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7583834/"
] | So since you are sure that you will get 106 records always from the filter
```
where ID_numbers IN [2,15,30...]
```
limit the Like filter output to top 10, and Union All the 2 sets
```
Select top 10 *
From #t
where FldContainingLQ NOT LIKE "** LQ **"
Union All
Select *
From #t
where ID_numbers IN [2,15,30...]... | If I understand correctly, this is about ordering the explicit list before the rest of the rows. You can use conditional logic in the `order by`:
```
select t.*
from t
order by iif(id in (2, 15, 30, . . . ), 1, 2)
``` |
61,776,453 | I have an MS Access query which returns records based on the following criterias:
1. Returns records where ID numbers IN[2,15,30...] this is a list of 106 numbers.
2. Returns all records NOT LIKE "\*\* LQ \*\*". This is currently returning 10 records.
I want this query to always return 116 records but the number that ... | 2020/05/13 | [
"https://Stackoverflow.com/questions/61776453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7583834/"
] | If I understand correctly, this is about ordering the explicit list before the rest of the rows. You can use conditional logic in the `order by`:
```
select t.*
from t
order by iif(id in (2, 15, 30, . . . ), 1, 2)
``` | Below query will adjust to return 10 records from ID condition if the records returned by **LQ** is less than 10.
```
Select * from
--Query 1 will return 10 records IF NOT LIKE **LQ** has 10 records that will be returned , else return 10 rows for ID condition
--When **LQ** returns less than 10 accordingly records fo... |
61,776,453 | I have an MS Access query which returns records based on the following criterias:
1. Returns records where ID numbers IN[2,15,30...] this is a list of 106 numbers.
2. Returns all records NOT LIKE "\*\* LQ \*\*". This is currently returning 10 records.
I want this query to always return 116 records but the number that ... | 2020/05/13 | [
"https://Stackoverflow.com/questions/61776453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7583834/"
] | So since you are sure that you will get 106 records always from the filter
```
where ID_numbers IN [2,15,30...]
```
limit the Like filter output to top 10, and Union All the 2 sets
```
Select top 10 *
From #t
where FldContainingLQ NOT LIKE "** LQ **"
Union All
Select *
From #t
where ID_numbers IN [2,15,30...]... | Below query will adjust to return 10 records from ID condition if the records returned by **LQ** is less than 10.
```
Select * from
--Query 1 will return 10 records IF NOT LIKE **LQ** has 10 records that will be returned , else return 10 rows for ID condition
--When **LQ** returns less than 10 accordingly records fo... |
62,290,901 | How I can return an array through valueOf method when I type plus before the function call ?
Example :
```js
function add(n){
add.valueOf = ()=>{
return n
}
return n
}
console.log(+add([1,2,3]))
``` | 2020/06/09 | [
"https://Stackoverflow.com/questions/62290901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11884052/"
] | You could take a function with a closure over an object and the array and take a stack for the collected `invoke` parts.
With calling of `value` get the value.
```js
function lazyChain(array) {
const
stack = [];
chain = {
invoke(...props) {
stack.push(props);
... | You can't. The entire point of the `+` operator is that it converts a value to a number.
If you don't want a number, don't use the `+` operator!! |
67,687 | Is it considered rude or negative to say that I am not challenged by my tasks I am responsible for in my role?
I currently work as a database developer (less than a year at this job). I have a good reputation and people are impressed with the work I produce. I rarely come across a task that I consider challenging or r... | 2016/05/24 | [
"https://workplace.stackexchange.com/questions/67687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/50433/"
] | There's no good way to say *"my job is not challenging"* because employers automatically equate it with *"he will go **find** work that's more challenging"*.
If you truly want to remain with that company it might be time to take a more proactive role and find project for yourself such optimizing a database, etc.
If ... | I'd put it this way: **your work is interesting and well within your abilities.**
It's the same thing really, it's just the way you put the words together. This is not unusual at all - there are good and smart people in every field, and I doubt everyone of them is doing challenging work every moment.
Of course, just ... |
67,687 | Is it considered rude or negative to say that I am not challenged by my tasks I am responsible for in my role?
I currently work as a database developer (less than a year at this job). I have a good reputation and people are impressed with the work I produce. I rarely come across a task that I consider challenging or r... | 2016/05/24 | [
"https://workplace.stackexchange.com/questions/67687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/50433/"
] | There's no good way to say *"my job is not challenging"* because employers automatically equate it with *"he will go **find** work that's more challenging"*.
If you truly want to remain with that company it might be time to take a more proactive role and find project for yourself such optimizing a database, etc.
If ... | Much of communication is about how you present the information. A good manager will want employees to be challenged (at least those that WANT to be challenged) and to give them opportunities for growth. Telling your manager, "my work is not challenging," focuses on the wrong thing. Nobody has work that is challenging A... |
67,687 | Is it considered rude or negative to say that I am not challenged by my tasks I am responsible for in my role?
I currently work as a database developer (less than a year at this job). I have a good reputation and people are impressed with the work I produce. I rarely come across a task that I consider challenging or r... | 2016/05/24 | [
"https://workplace.stackexchange.com/questions/67687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/50433/"
] | There's no good way to say *"my job is not challenging"* because employers automatically equate it with *"he will go **find** work that's more challenging"*.
If you truly want to remain with that company it might be time to take a more proactive role and find project for yourself such optimizing a database, etc.
If ... | The best place to bring this up is at annual review, where your objectives are discussed.
You can go through your performance, and if you have been absolutely nailing it so far, suggest that for the year ahead you set objectives **and** some stretch objectives: deliberately aimed at pushing you beyond your comfort zon... |
67,687 | Is it considered rude or negative to say that I am not challenged by my tasks I am responsible for in my role?
I currently work as a database developer (less than a year at this job). I have a good reputation and people are impressed with the work I produce. I rarely come across a task that I consider challenging or r... | 2016/05/24 | [
"https://workplace.stackexchange.com/questions/67687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/50433/"
] | I'd put it this way: **your work is interesting and well within your abilities.**
It's the same thing really, it's just the way you put the words together. This is not unusual at all - there are good and smart people in every field, and I doubt everyone of them is doing challenging work every moment.
Of course, just ... | Much of communication is about how you present the information. A good manager will want employees to be challenged (at least those that WANT to be challenged) and to give them opportunities for growth. Telling your manager, "my work is not challenging," focuses on the wrong thing. Nobody has work that is challenging A... |
67,687 | Is it considered rude or negative to say that I am not challenged by my tasks I am responsible for in my role?
I currently work as a database developer (less than a year at this job). I have a good reputation and people are impressed with the work I produce. I rarely come across a task that I consider challenging or r... | 2016/05/24 | [
"https://workplace.stackexchange.com/questions/67687",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/50433/"
] | The best place to bring this up is at annual review, where your objectives are discussed.
You can go through your performance, and if you have been absolutely nailing it so far, suggest that for the year ahead you set objectives **and** some stretch objectives: deliberately aimed at pushing you beyond your comfort zon... | Much of communication is about how you present the information. A good manager will want employees to be challenged (at least those that WANT to be challenged) and to give them opportunities for growth. Telling your manager, "my work is not challenging," focuses on the wrong thing. Nobody has work that is challenging A... |
41,840,254 | I am new to Scheme and I am trying to write a function which return a descending prefix of a list. Can someone explain where am I wrong with my code? I tested it with `(prefix (list 3 2 1 5))` and I continuously get this error:
```
cdr: contract violation
expected: pair?
given: '()
```
```
(define (prefix lst)
(de... | 2017/01/24 | [
"https://Stackoverflow.com/questions/41840254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7466246/"
] | Your embeddings are initialised using `tf.Variable` which are by default trainable. They will be updated. The problem might be with the way you are calculating loss. Look at these following lines
```
y1 = tf.nn.softmax(tf.matmul(y0, W1) + b1)
y_ = tf.placeholder(tf.float32, [None, out_layer])
cross_entropy = tf.reduce... | You need to initialize your `W` matrices to a random value.
Right now `y1` is always 0 due to zero initialization. |
41,840,254 | I am new to Scheme and I am trying to write a function which return a descending prefix of a list. Can someone explain where am I wrong with my code? I tested it with `(prefix (list 3 2 1 5))` and I continuously get this error:
```
cdr: contract violation
expected: pair?
given: '()
```
```
(define (prefix lst)
(de... | 2017/01/24 | [
"https://Stackoverflow.com/questions/41840254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7466246/"
] | Your embeddings are initialised using `tf.Variable` which are by default trainable. They will be updated. The problem might be with the way you are calculating loss. Look at these following lines
```
y1 = tf.nn.softmax(tf.matmul(y0, W1) + b1)
y_ = tf.placeholder(tf.float32, [None, out_layer])
cross_entropy = tf.reduce... | Your starting of algorithm is fine. But I have some confidence this approach don't work. Actually word to vector trick is became working after estimation approximations are found applicable for NLP . For example techniques called ***Importance Sampling*** and ***Noise-Contrastive Estimation***.
So why straight approa... |
9,917 | I am interested in energy conservation and would like some simple tips on ways I can reduce my water and energy use in the bathroom in particular, as I feel that this is the place that I use the most water (and spend the most time).
**Edit**
I found this article that has a lot of great answers:
<https://3pointsplum... | 2020/02/27 | [
"https://sustainability.stackexchange.com/questions/9917",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/8506/"
] | Others have already suggested [low flow fixtures](https://sustainability.stackexchange.com/a/9920/3379) and [reducing water usage](https://sustainability.stackexchange.com/a/9919/3379), but here are a few other ideas, from least to most expensive:
1. **Turn down your water heater.** The U.S. Department of Energy [reco... | Stick a water meter on your shower and bath taps. [This one looks adequate](https://www.amazon.co.uk/Bradas-Water-Smart-Flow-Meter/dp/B07GVRLB7D)
I don't know what the optimal time to spend in the shower is, or whether a long hot deep bath is more satisfying than a long hot shower, its personal taste. But with a meter... |
9,917 | I am interested in energy conservation and would like some simple tips on ways I can reduce my water and energy use in the bathroom in particular, as I feel that this is the place that I use the most water (and spend the most time).
**Edit**
I found this article that has a lot of great answers:
<https://3pointsplum... | 2020/02/27 | [
"https://sustainability.stackexchange.com/questions/9917",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/8506/"
] | Others have already suggested [low flow fixtures](https://sustainability.stackexchange.com/a/9920/3379) and [reducing water usage](https://sustainability.stackexchange.com/a/9919/3379), but here are a few other ideas, from least to most expensive:
1. **Turn down your water heater.** The U.S. Department of Energy [reco... | To save water get a low flow shower head and when using the sink use the lowest flow rate of water. If possible, spend less time in the shower.
To use less water in the laundry, consider using the bath towels for a few days instead of using clean one daily.
For energy savings, if possible do not use a ventilation fan... |
10,215,423 | My current design pattern includes a large number of database access methods in a single convenience class. When it's instantiated it grabs the connections it needs and waits for methods.
It was my thinking that opening a single connection when I'm about to run 10 methods with that connection would be better than open... | 2012/04/18 | [
"https://Stackoverflow.com/questions/10215423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/347368/"
] | Maybe you should not keep the connection in this convenience class, but pass it in on each method invocation. That way you will be able to control the lifetime of the connection, and - for example - use transactions in a useful way.
Also keeping this connection inside this convenience class increases the risk of shari... | I suggest that whenever you open a connection, you should register it to a service. You can then later on check with the service if the particular connection is open or already closed to take car of the leaks in the application. |
10,215,423 | My current design pattern includes a large number of database access methods in a single convenience class. When it's instantiated it grabs the connections it needs and waits for methods.
It was my thinking that opening a single connection when I'm about to run 10 methods with that connection would be better than open... | 2012/04/18 | [
"https://Stackoverflow.com/questions/10215423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/347368/"
] | Maybe you should not keep the connection in this convenience class, but pass it in on each method invocation. That way you will be able to control the lifetime of the connection, and - for example - use transactions in a useful way.
Also keeping this connection inside this convenience class increases the risk of shari... | >
> following good design practice
>
>
>
If you want that then don't re-invent the wheel. Use a [connection pool](http://en.wikipedia.org/wiki/Connection_pool). |
22,970,922 | I'm trying to create a navigation menu for users:
### HTML:
```
<ul class="nav nav-pills">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
```
### CSS:
```
.nav-pills > li {
float: left;
}
.nav-pills > li > a {
border-radius: 4px;
}
.n... | 2014/04/09 | [
"https://Stackoverflow.com/questions/22970922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3371183/"
] | Not entirely sure what you're trying to achive here. To change the style on your navigation tab when clicking them I would write you css like so:
```
.nav-pills > li {
float: left;
}
.nav-pills > li > a {
border-radius: 4px;
}
.nav-pills > li {
margin-left: 2px;
list-style:none;
}
.nav-pills > li > ... | You should change CSS class for active menu item - `active`. Now "Home" is active. |
72,688,825 | I need to make a function for removing subarray using pointer arithmetic in C. Function should return number of removed elements. Auxiliary arrays are not allowed.
```
#include <stdio.h>
int remove_subarray(int * first_start, int * first_end,const int * second_start,const int * second_end) {
int size_of_second = sec... | 2022/06/20 | [
"https://Stackoverflow.com/questions/72688825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18755135/"
] | There is a little mistake in your algorithm, It only compares the first item of the subarray to the array and if it matches it assumes that this is the starting of the subarray without seeing the following items.
**header files**
```
#include <stdio.h>
```
**function to remove sub array**
```c
int remove_sub(int *... | You might want to take advantage of memory function (memcmp, memcpy), which can speed up the code, and create more elegant solution. I'm not sure if "using pointer arithmetic" implied that arr\_start[i] is not allowed. If this is the case, then every reference to X[i] should be replaced with \*(X+i), effectively replac... |
72,688,825 | I need to make a function for removing subarray using pointer arithmetic in C. Function should return number of removed elements. Auxiliary arrays are not allowed.
```
#include <stdio.h>
int remove_subarray(int * first_start, int * first_end,const int * second_start,const int * second_end) {
int size_of_second = sec... | 2022/06/20 | [
"https://Stackoverflow.com/questions/72688825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18755135/"
] | The provided code is very hard to read and so is also hard to test. At least for me. May be the author could have used more meaningful names.
I think that the bug in the original code is that, after finding the first number of the sub\_array, if the search fails the program **must not** advance the pointer of the arra... | There is a little mistake in your algorithm, It only compares the first item of the subarray to the array and if it matches it assumes that this is the starting of the subarray without seeing the following items.
**header files**
```
#include <stdio.h>
```
**function to remove sub array**
```c
int remove_sub(int *... |
72,688,825 | I need to make a function for removing subarray using pointer arithmetic in C. Function should return number of removed elements. Auxiliary arrays are not allowed.
```
#include <stdio.h>
int remove_subarray(int * first_start, int * first_end,const int * second_start,const int * second_end) {
int size_of_second = sec... | 2022/06/20 | [
"https://Stackoverflow.com/questions/72688825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18755135/"
] | The provided code is very hard to read and so is also hard to test. At least for me. May be the author could have used more meaningful names.
I think that the bug in the original code is that, after finding the first number of the sub\_array, if the search fails the program **must not** advance the pointer of the arra... | You might want to take advantage of memory function (memcmp, memcpy), which can speed up the code, and create more elegant solution. I'm not sure if "using pointer arithmetic" implied that arr\_start[i] is not allowed. If this is the case, then every reference to X[i] should be replaced with \*(X+i), effectively replac... |
570,718 | I use Inkscape to create levels for my game. My problem is: I create rectangle and when I want to rotate it, it is changing the (x,y) position of the rectangle.
[Here is a video](http://www.youtube.com/watch?v=7raWns6Dsm0) of the coordinates changing in the object properties dialogue box. Why is this happening and how... | 2013/03/24 | [
"https://superuser.com/questions/570718",
"https://superuser.com",
"https://superuser.com/users/210093/"
] | The coordinates of an object is the lower left corner its bounding box (the smallest rectangle with edges parallel to the coordinate axes that contains the object). This bounding box is displayed in dashed lines and in your video you can see, how (and why) it changes when you rotate the square. If you rotate a square b... | that may because of the point of origin of the object set to left lower corner instead of its center, try if converting the object to a path helps |
53,383,749 | I need my code to find the 4th vertex of a rectangle. Tried to make something but as always failed. It works in some cases, bot not everytime. Could someone help me with it?
Also, it has to be done with 2 classes, one for vertices and other one for a whole rectangle.
Problem is that my code works for a certain vertex ... | 2018/11/19 | [
"https://Stackoverflow.com/questions/53383749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9524476/"
] | If you have three vertices, then you have half of the rectangle: a right triangle. First you need to determine which point is at the right angle. You can do this in different ways. A way is to apply Pythagoras theorem: find the two vertices which are the farthest apart. The remaining vertex is at the right angle (Anoth... | Having the coordinates of three of the four vertices of the rectangle, we can find the 4th vertex coordinates by the given below formula.
```
x4 = x1 ^ x2 ^ x3;
y4 = y1 ^ y2 ^ y3;
```
^ = bitwise XOR.
What happens here is that XORing them together causes the pair of coordinates that are the same to cancel.
I hop... |
53,383,749 | I need my code to find the 4th vertex of a rectangle. Tried to make something but as always failed. It works in some cases, bot not everytime. Could someone help me with it?
Also, it has to be done with 2 classes, one for vertices and other one for a whole rectangle.
Problem is that my code works for a certain vertex ... | 2018/11/19 | [
"https://Stackoverflow.com/questions/53383749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9524476/"
] | Working with vectors is a very interesting topic. Here are some good explainations about [vector](https://www.mathsisfun.com/algebra/vectors-dot-product.html)
**To answer your question:**
From 3 givens vertexs A, B and C, you have only three cases of the right angle : at A, at B or at C. If you found the right angle... | Having the coordinates of three of the four vertices of the rectangle, we can find the 4th vertex coordinates by the given below formula.
```
x4 = x1 ^ x2 ^ x3;
y4 = y1 ^ y2 ^ y3;
```
^ = bitwise XOR.
What happens here is that XORing them together causes the pair of coordinates that are the same to cancel.
I hop... |
919,364 | How can I evaluate following logarithmic integral:
$$\int\limits\_0^1 \frac{\ln x\ln ( 1 - zx )}{1 - x} dx$$ | 2014/09/04 | [
"https://math.stackexchange.com/questions/919364",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153037/"
] | Let
$$
I(z)=\int\_0^1 \frac{\ln x\ln ( 1 - zx )}{1 - x}\ dx\qquad;\qquad\text{for }\ z<1
$$
then
\begin{align}
I'(z)&=-\int\_0^1 \frac{x\ln x}{(1 - x)(1 - zx)}\ dx\\
&=-\frac{1}{1-z}\int\_0^1\left[\frac{x\ln x}{1-x}-\frac{zx\ln x}{1-zx}\right]\ dx\\
&=-\frac{1}{1-z}\int\_0^1\left[\sum\_{n=0}^\infty x^{n+1}\ln x-\sum\_{... | It appears that if $z$ is a negative integer number, $z=-m$,
$$\begin{eqnarray\*} I = &-&\zeta(2)\log(m+1)+\frac{1}{2}\log m\log^2(m+1)-\frac{1}{2}\log^3(m+1)\\&-&\log(m+1)\operatorname{Li}\_2\left(\frac{1}{m+1}\right)-\operatorname{Li}\_3\left(\frac{1}{m+1}\right)+\operatorname{Li}\_3\left(\frac{m}{m+1}\right)+\zeta(3... |
65,449,971 | I have an application that uses a slightly modified [`ObservableConcurrentDictionary`](https://github.com/dotnet/samples/blob/master/csharp/parallel/ParallelExtensionsExtras/CoordinationDataStructures/ObservableConcurrentDictionary.cs) (exposed Count & added constructor for `ConcurrentDictionary` comparer) for data bou... | 2020/12/25 | [
"https://Stackoverflow.com/questions/65449971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6688377/"
] | You shouldn't make it artificially complicated. Simply use common data binding and make use of collection indexers:
```
Dictionary<string, ItemValueData> Map { get; } = new Dictionary<string, ItemValueData>
{
{ "Key to value1", new ItemValueData() },
{ "Key to value2", new ItemValueData() }
};
<TextBlock Text="{B... | While the answer(s) provided have some interesting possibilities, they rely upon reflection and runtime compiler services.
What I eventually came up with below doesn't.
I misunderstood how a `MarkupExtension` / `IValueConverter` based class introduces its properties into the XAML within Converter and not the Converte... |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | so here i wrote a code to add the button on view.
**Swift 3:**
```
let button = UIButton(type: UIButtonType.System) as UIButton
// set the frame
button.frame = CGRectMake(100, 100, 100, 50)
// add image
button.setBackgroundImage(UIImage(named:"SearchIcon" ), forState: UIControlState.Normal)
// button title
button.s... | Simply set the button size with
```
findMeButton.frame.size = CGSizeMake(width, height)
```
Or you can specify the button location and the size with
```
findMeButton.frame = CGRectMake(x, y, width, height)
``` |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | **Swift 3**
```
findMeButton.frame.size = CGSize(width, height)
``` | Simply set the button size with
```
findMeButton.frame.size = CGSizeMake(width, height)
```
Or you can specify the button location and the size with
```
findMeButton.frame = CGRectMake(x, y, width, height)
``` |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | Simply set the button size with
```
findMeButton.frame.size = CGSizeMake(width, height)
```
Or you can specify the button location and the size with
```
findMeButton.frame = CGRectMake(x, y, width, height)
``` | The button layout may also be set by doing the following...
```
// Create button with half the size of and centered in parent view
parentView.addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
button.widthAnchor.constraint(equalTo: parentView.widthAnchor, multiplier: 0.5).isAct... |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | Simply set the button size with
```
findMeButton.frame.size = CGSizeMake(width, height)
```
Or you can specify the button location and the size with
```
findMeButton.frame = CGRectMake(x, y, width, height)
``` | Swift 5: I used NSLayoutConstraints to set width and height of UIButton. No need to set `button.frame`.
```
let playImage = UIImage(named: "Play")
playButton = UIButton(type: UIButton.ButtonType.custom) as UIButton
playButton.setBackgroundImage(playImage, for: .normal)
playButton.addTar... |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | so here i wrote a code to add the button on view.
**Swift 3:**
```
let button = UIButton(type: UIButtonType.System) as UIButton
// set the frame
button.frame = CGRectMake(100, 100, 100, 50)
// add image
button.setBackgroundImage(UIImage(named:"SearchIcon" ), forState: UIControlState.Normal)
// button title
button.s... | **Swift 3**
```
findMeButton.frame.size = CGSize(width, height)
``` |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | so here i wrote a code to add the button on view.
**Swift 3:**
```
let button = UIButton(type: UIButtonType.System) as UIButton
// set the frame
button.frame = CGRectMake(100, 100, 100, 50)
// add image
button.setBackgroundImage(UIImage(named:"SearchIcon" ), forState: UIControlState.Normal)
// button title
button.s... | The button layout may also be set by doing the following...
```
// Create button with half the size of and centered in parent view
parentView.addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
button.widthAnchor.constraint(equalTo: parentView.widthAnchor, multiplier: 0.5).isAct... |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | so here i wrote a code to add the button on view.
**Swift 3:**
```
let button = UIButton(type: UIButtonType.System) as UIButton
// set the frame
button.frame = CGRectMake(100, 100, 100, 50)
// add image
button.setBackgroundImage(UIImage(named:"SearchIcon" ), forState: UIControlState.Normal)
// button title
button.s... | Swift 5: I used NSLayoutConstraints to set width and height of UIButton. No need to set `button.frame`.
```
let playImage = UIImage(named: "Play")
playButton = UIButton(type: UIButton.ButtonType.custom) as UIButton
playButton.setBackgroundImage(playImage, for: .normal)
playButton.addTar... |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | **Swift 3**
```
findMeButton.frame.size = CGSize(width, height)
``` | The button layout may also be set by doing the following...
```
// Create button with half the size of and centered in parent view
parentView.addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
button.widthAnchor.constraint(equalTo: parentView.widthAnchor, multiplier: 0.5).isAct... |
37,474,237 | This is driving me nuts. I have looked everywhere and cannot figure this out. Check it out...
```
let findMeButton = UIButton(type: UIButtonType.System)
findMeButton.translatesAutoresizingMaskIntoConstraints = false
findMeButton.setImage(UIImage(named: "locateMe"), forState: UIControlState.Normal)
f... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37474237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657244/"
] | **Swift 3**
```
findMeButton.frame.size = CGSize(width, height)
``` | Swift 5: I used NSLayoutConstraints to set width and height of UIButton. No need to set `button.frame`.
```
let playImage = UIImage(named: "Play")
playButton = UIButton(type: UIButton.ButtonType.custom) as UIButton
playButton.setBackgroundImage(playImage, for: .normal)
playButton.addTar... |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | ### Description
The `Bitmap` is derived from `Image` so you can use Icon's `.ToBitmap()` method.
### Sample
```
Icon IEIcon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = IEIcon.ToBitmap();
```
### More Information
* [MSDN - Bitmap Class](http://msdn.microsoft.com/en-... | Could you use the `ToBitmap()` method.
[ToBitmap()](http://msdn.microsoft.com/en-us/library/system.drawing.icon.tobitmap.aspx) |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | Could you use the `ToBitmap()` method.
[ToBitmap()](http://msdn.microsoft.com/en-us/library/system.drawing.icon.tobitmap.aspx) | Original at : [Convert Icon to Image in C#](http://coders-project.blogspot.com/2008/04/convert-icon-to-image-in-c.html)
```
Icon a = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = a.ToBitmap()
``` |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | Could you use the `ToBitmap()` method.
[ToBitmap()](http://msdn.microsoft.com/en-us/library/system.drawing.icon.tobitmap.aspx) | Very simple. Icon has a method named `ToBitmap`.
```
Image converted_image = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe").ToBitmap()
``` |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | ### Description
The `Bitmap` is derived from `Image` so you can use Icon's `.ToBitmap()` method.
### Sample
```
Icon IEIcon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = IEIcon.ToBitmap();
```
### More Information
* [MSDN - Bitmap Class](http://msdn.microsoft.com/en-... | Original at : [Convert Icon to Image in C#](http://coders-project.blogspot.com/2008/04/convert-icon-to-image-in-c.html)
```
Icon a = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = a.ToBitmap()
``` |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | ### Description
The `Bitmap` is derived from `Image` so you can use Icon's `.ToBitmap()` method.
### Sample
```
Icon IEIcon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = IEIcon.ToBitmap();
```
### More Information
* [MSDN - Bitmap Class](http://msdn.microsoft.com/en-... | Very simple. Icon has a method named `ToBitmap`.
```
Image converted_image = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe").ToBitmap()
``` |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | ### Description
The `Bitmap` is derived from `Image` so you can use Icon's `.ToBitmap()` method.
### Sample
```
Icon IEIcon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = IEIcon.ToBitmap();
```
### More Information
* [MSDN - Bitmap Class](http://msdn.microsoft.com/en-... | For who wants to do the inverse: (VB.NET; myImage-> myIcon)
```
Dim tmpBmp As Bitmap
tmpBmp = myImage
Dim hIcon As IntPtr = tmpBmp.GetHicon
myIcon = Icon.FromHandle(hIcon)
```
I'm writing this here beacause by googling "*System.Drawing.Image' converted to 'System.Drawing.Icon*" brings here and I think it does not de... |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | For who wants to do the inverse: (VB.NET; myImage-> myIcon)
```
Dim tmpBmp As Bitmap
tmpBmp = myImage
Dim hIcon As IntPtr = tmpBmp.GetHicon
myIcon = Icon.FromHandle(hIcon)
```
I'm writing this here beacause by googling "*System.Drawing.Image' converted to 'System.Drawing.Icon*" brings here and I think it does not de... | Original at : [Convert Icon to Image in C#](http://coders-project.blogspot.com/2008/04/convert-icon-to-image-in-c.html)
```
Icon a = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
Image im = a.ToBitmap()
``` |
8,930,877 | I am working with Microsoft SQL Server 2008.
I want to perform a check for all alphabets from A to Z, special characters like: ":" and "-" for values in one column of my table.
I can work out the ":" and "-". How do I account for values between A to Z ?
I tried something like this but it does not perform the replace... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8930877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368892/"
] | For who wants to do the inverse: (VB.NET; myImage-> myIcon)
```
Dim tmpBmp As Bitmap
tmpBmp = myImage
Dim hIcon As IntPtr = tmpBmp.GetHicon
myIcon = Icon.FromHandle(hIcon)
```
I'm writing this here beacause by googling "*System.Drawing.Image' converted to 'System.Drawing.Icon*" brings here and I think it does not de... | Very simple. Icon has a method named `ToBitmap`.
```
Image converted_image = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe").ToBitmap()
``` |
17,100,234 | I have a text file with URLs and commas and numbers. How do I simply extract the url until the first comma??
Input:
```
google.com,1,2,3,4
youtube.com,5,6,7,8
facebook.com,9,9,1,2
```
Output:
```
google.com
youtube.com
facebook.com
``` | 2013/06/14 | [
"https://Stackoverflow.com/questions/17100234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1899415/"
] | with the command [cut](http://unixhelp.ed.ac.uk/CGI/man-cgi?cut):
```
cut -d, -f1 [FILE]
```
The `-d,` flag means that you want to split on commas and `-f1` means that you want the first field. e.g. taking input from a heredoc:
```
cut -d, -f1 <<EOF
google.com,1,2,3,4
youtube.com,5,6,7,8
facebook.com,9,9,1,2
EOF
... | `sed -e "s/\([^,]*\).*/\1/g" <file>`
Simpler solution:
`sed -e "s/,.*//g" <file>`
If you need to make changes **in** the file, add the `-i` option to `sed`. |
17,100,234 | I have a text file with URLs and commas and numbers. How do I simply extract the url until the first comma??
Input:
```
google.com,1,2,3,4
youtube.com,5,6,7,8
facebook.com,9,9,1,2
```
Output:
```
google.com
youtube.com
facebook.com
``` | 2013/06/14 | [
"https://Stackoverflow.com/questions/17100234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1899415/"
] | with the command [cut](http://unixhelp.ed.ac.uk/CGI/man-cgi?cut):
```
cut -d, -f1 [FILE]
```
The `-d,` flag means that you want to split on commas and `-f1` means that you want the first field. e.g. taking input from a heredoc:
```
cut -d, -f1 <<EOF
google.com,1,2,3,4
youtube.com,5,6,7,8
facebook.com,9,9,1,2
EOF
... | Pure `bash` solution:
```
while IFS=, read -r url _ ; do
echo "$url"
done < text_file
```
With `awk` it would be like:
```
awk -F, '{$0=$1}1' text_file
``` |
17,100,234 | I have a text file with URLs and commas and numbers. How do I simply extract the url until the first comma??
Input:
```
google.com,1,2,3,4
youtube.com,5,6,7,8
facebook.com,9,9,1,2
```
Output:
```
google.com
youtube.com
facebook.com
``` | 2013/06/14 | [
"https://Stackoverflow.com/questions/17100234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1899415/"
] | Pure `bash` solution:
```
while IFS=, read -r url _ ; do
echo "$url"
done < text_file
```
With `awk` it would be like:
```
awk -F, '{$0=$1}1' text_file
``` | `sed -e "s/\([^,]*\).*/\1/g" <file>`
Simpler solution:
`sed -e "s/,.*//g" <file>`
If you need to make changes **in** the file, add the `-i` option to `sed`. |
3,675,697 | is possible to write code(like any links or buttons) only for share text alone without any images & url's in [facebook](http://facebook.com).
thanks | 2010/09/09 | [
"https://Stackoverflow.com/questions/3675697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367229/"
] | You should make sure that you are importing the correct module and not a different one with the same name somewhere else in your path
try running your program with `python.exe -v SConstruct`
or
`print mymodule.__file__` right before `print mymodule.foo()` | Beware path manipulation; trouble will find you.
Take a look at <http://docs.python.org/tutorial/modules.html>
I've set up what I think you are trying to do below. This should work.
File structure:
```
/SConstruct.py
/custom_dir/
/custom_dir/__init__.py
/custom_dir/mymodule.py
```
/custom\_dir/\_\_init\_\_.py is ... |
3,675,697 | is possible to write code(like any links or buttons) only for share text alone without any images & url's in [facebook](http://facebook.com).
thanks | 2010/09/09 | [
"https://Stackoverflow.com/questions/3675697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367229/"
] | You should make sure that you are importing the correct module and not a different one with the same name somewhere else in your path
try running your program with `python.exe -v SConstruct`
or
`print mymodule.__file__` right before `print mymodule.foo()` | You can access SCons classes, e.g. Environment from modules other than SConstruct by including
```
from SCons.Script import *
```
See the documentation [here](http://www.scons.org/doc/1.2.0/HTML/scons-user/x3627.html#AEN3627).
Also, rather than using '.' to indicate the root of the build tree, you should be using [... |
3,675,697 | is possible to write code(like any links or buttons) only for share text alone without any images & url's in [facebook](http://facebook.com).
thanks | 2010/09/09 | [
"https://Stackoverflow.com/questions/3675697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367229/"
] | Beware path manipulation; trouble will find you.
Take a look at <http://docs.python.org/tutorial/modules.html>
I've set up what I think you are trying to do below. This should work.
File structure:
```
/SConstruct.py
/custom_dir/
/custom_dir/__init__.py
/custom_dir/mymodule.py
```
/custom\_dir/\_\_init\_\_.py is ... | You can access SCons classes, e.g. Environment from modules other than SConstruct by including
```
from SCons.Script import *
```
See the documentation [here](http://www.scons.org/doc/1.2.0/HTML/scons-user/x3627.html#AEN3627).
Also, rather than using '.' to indicate the root of the build tree, you should be using [... |
63,807,403 | I am trying to build a simple todo app using React, which contains a text input area for the user, and an "ADD" button that when clicked, adds the user's text input to an ordered list underneath. Below is a part of my entire code that I believe pertains to this issue:
```
import React from "react";
import TextBar from... | 2020/09/09 | [
"https://Stackoverflow.com/questions/63807403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6704137/"
] | You can use destructuring to concatenate everything into a temporary array, and then use filter to remove any empty elements before calling join on the lot.
```js
let var1 = "var1";
let arr1 = ["one", "", "two"];
let var2 = ""
const myString = "result:" + [var1, ...arr1, var2].filter(s => s).join(' ');
console.log(m... | You could try this:
`const cleanedResult = result.replace(/\s\s+/g, ' ').trim()`
This would remove multiple spaces in your variables as well though.
If you do not want that you can try out this solution:
```
const result = 'result:' + (var1 ? var1 + ' ' : '') + (arr1 ? arr1.join(' ') : '') + (var2 ? var2 + ' ' : ''... |
63,807,403 | I am trying to build a simple todo app using React, which contains a text input area for the user, and an "ADD" button that when clicked, adds the user's text input to an ordered list underneath. Below is a part of my entire code that I believe pertains to this issue:
```
import React from "react";
import TextBar from... | 2020/09/09 | [
"https://Stackoverflow.com/questions/63807403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6704137/"
] | Does this satisfy your requirements?
```js
const strArr = ['result:' + var1, ...arr1, var2].map((a) => a.trim()).join(' ')
```
**Update**
As suggested, following handles
1. empty string
2. string with multiple spaces
3. trim additional spaces
```js
const strArr = ['result:' + var1, ...arr1, var2].map((a) => a.tri... | You could try this:
`const cleanedResult = result.replace(/\s\s+/g, ' ').trim()`
This would remove multiple spaces in your variables as well though.
If you do not want that you can try out this solution:
```
const result = 'result:' + (var1 ? var1 + ' ' : '') + (arr1 ? arr1.join(' ') : '') + (var2 ? var2 + ' ' : ''... |
63,807,403 | I am trying to build a simple todo app using React, which contains a text input area for the user, and an "ADD" button that when clicked, adds the user's text input to an ordered list underneath. Below is a part of my entire code that I believe pertains to this issue:
```
import React from "react";
import TextBar from... | 2020/09/09 | [
"https://Stackoverflow.com/questions/63807403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6704137/"
] | You can use destructuring to concatenate everything into a temporary array, and then use filter to remove any empty elements before calling join on the lot.
```js
let var1 = "var1";
let arr1 = ["one", "", "two"];
let var2 = ""
const myString = "result:" + [var1, ...arr1, var2].filter(s => s).join(' ');
console.log(m... | Does this satisfy your requirements?
```js
const strArr = ['result:' + var1, ...arr1, var2].map((a) => a.trim()).join(' ')
```
**Update**
As suggested, following handles
1. empty string
2. string with multiple spaces
3. trim additional spaces
```js
const strArr = ['result:' + var1, ...arr1, var2].map((a) => a.tri... |
13,484,849 | I have a struct which I put in a `List<T>`, I want to edit some value in that struct at a specific position. Is this at all possible without making a copy of the struct, editing the copy, and replacing the entry in the List? | 2012/11/21 | [
"https://Stackoverflow.com/questions/13484849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/891856/"
] | No, to be able to do it you need reference to element of inner array which is not provided by `List`/`IList`.
You can do that with unsafe code and arrays if you have to. | From J.Richter's "CLR via C#", 3rd edition:
>
> Value types should be immutable: that is, they should not define any
> members that modify any of the type’s instance fields. In fact, I
> recommended that value types have their fields marked as readonly so
> that the compiler will issue errors should you accidental... |
13,484,849 | I have a struct which I put in a `List<T>`, I want to edit some value in that struct at a specific position. Is this at all possible without making a copy of the struct, editing the copy, and replacing the entry in the List? | 2012/11/21 | [
"https://Stackoverflow.com/questions/13484849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/891856/"
] | No, to be able to do it you need reference to element of inner array which is not provided by `List`/`IList`.
You can do that with unsafe code and arrays if you have to. | Your best bet is probably to have your structures expose their fields directly, and then use code like:
```
var temp = myList[3];
temp.X += 4;
myList[3] = temp;
```
I consider the failure of .net to provide any means of updating list items in place to be a significant weakness in .net, but would still conside... |
1,964,638 | guys. Just doing some homework and I came I across a problem that I did not know how to do, Could someone explain, Please and thank you.
Problem:
a group of 13 people is randomly selected to discuss products of the Yummy Company. It is determined that the mean number (per group) who recognize the Yummy brand name is 1... | 2016/10/12 | [
"https://math.stackexchange.com/questions/1964638",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/377525/"
] | If you wanted to prove to yourself that fewer than 7 people recognize the brand name, you could employ a 'one sample t-test'.
First, lets set up two hypotheses; $H\_o$ and $H\_a$.
We interpret the alternative hypothesis $H\_a$ as what the 'researcher' believes, which in this case is you.
So, as the researcher you... | I understand that you have already turned in this paper because this thread is almost a year old, however, for anyone else out there having issues, here is a simple answer:
**The formal definition of unusual is a data value more than 2 standard deviations away from the mean in either the positive or negative direction... |
1,964,638 | guys. Just doing some homework and I came I across a problem that I did not know how to do, Could someone explain, Please and thank you.
Problem:
a group of 13 people is randomly selected to discuss products of the Yummy Company. It is determined that the mean number (per group) who recognize the Yummy brand name is 1... | 2016/10/12 | [
"https://math.stackexchange.com/questions/1964638",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/377525/"
] | A general test is 'number of standard deviations from the mean' with about 3.5 or more starting to be considered unusual - in this case you have
$(10.2 - 7) / 0.84=3.8$
so it seems unusual | I understand that you have already turned in this paper because this thread is almost a year old, however, for anyone else out there having issues, here is a simple answer:
**The formal definition of unusual is a data value more than 2 standard deviations away from the mean in either the positive or negative direction... |
72,891,424 | I'm working on a simple shopping website with React.
I have a problem that every time I add an item to the cart and then go to a different section of the website the page reloads and I lose all the data saved in the cart.
I am not sure if the problem is because of the page reload?
Which is the best approach to try s... | 2022/07/07 | [
"https://Stackoverflow.com/questions/72891424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18711739/"
] | You have to use LocalStorage to save your state.
```js
const getLocalStorage = () => {
const userData = localStorage.getItem('cartdata')
if (cartData) {
return JSON.parse(cartData)
} else {
return []
}
}
const [cart, setCart] = useState(getLocalStorage())
```
```js
const addToCart = (product) => {
... | You are saving the products in the state which is memory cache. Every time you reload the page javascript will garbage collect all the data (wipe it out), so you loose it.
The best way to solve it is to store products added to the cart to the database, which requires backend logic and the database.
If this is not... |
72,891,424 | I'm working on a simple shopping website with React.
I have a problem that every time I add an item to the cart and then go to a different section of the website the page reloads and I lose all the data saved in the cart.
I am not sure if the problem is because of the page reload?
Which is the best approach to try s... | 2022/07/07 | [
"https://Stackoverflow.com/questions/72891424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18711739/"
] | You have to use LocalStorage to save your state.
```js
const getLocalStorage = () => {
const userData = localStorage.getItem('cartdata')
if (cartData) {
return JSON.parse(cartData)
} else {
return []
}
}
const [cart, setCart] = useState(getLocalStorage())
```
```js
const addToCart = (product) => {
... | I advise you to use localStorage or Cookies.
```
const [cart, setCart] = useState([]);
React.useEffect(() => {
localStorage.setItem('cart', JSON.stringify(cart)) // create
}, [cart])
```
then on the page where you want to get the items
```
JSON.parse(localStorage.cart) // data
``` |
68,219,903 | I've dataset as in following format :
```
df = pd.read_csv("data_processing.csv")
df
user_id volume
0 a {"BTCUSDT":1000,"USDTINR":20}
1 b {"BTCINR":30,"USDTINR":10,"ETHINR":15}
2 c {"XRPINR":10,"ETHUSDT":500,"XRPUSDT":200}
3 d {"ETHINR":5}
```
I want to convert the above dataset i... | 2021/07/02 | [
"https://Stackoverflow.com/questions/68219903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3367506/"
] | One Way:
```
df = pd.DataFrame({'user_id': {0: 'a', 1: 'b', 2: 'c', 3: 'd'},
'volume': {0: {'BTCUSDT': 1000, 'USDTINR': 20},
1: {'BTCINR': 30, 'USDTINR': 10, 'ETHINR': 15},
2: {'XRPINR': 10, 'ETHUSDT': 500, 'XRPUSDT': 200},
3: {'ETHINR': 5}}})
df = df.join(df.pop('volume').apply(pd.Series)).stack().reset_index... | You can also use `pd.DataFrame()` to expand the dict into columns. Then, use [.`stack()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.stack.html) to convert the expanded columns into rows, as follows:
```
df_out = (df.drop('volume', axis=1).join(pd.DataFrame(df['volume'].tolist(), index... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.