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 |
|---|---|---|---|---|---|
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | [Python](https://www.python.org), ~~197~~ 195 bytes
===================================================
-2 bytes thanks to @Arnauld using `-~p//2` instead of `p//2+p%2`
```python
from random import*
def f(n,c,m,i=0,p=0,s=0):
l=len(c);v=-~c[x:=i%l]and[-1,0,p,~-p//2][i//l&(s<0)and randrange(4)];c[x]+=v
if~-l-c.count(... | [Python 3](https://docs.python.org/3/), ~~317 303 311 318 294~~ 270 bytes
=========================================================================
```python
def f(p,r):
m=len(p)
for k in p:p[k]-=1
for _ in range(r):
for i in p:
if p[i]<0:continue
x=randrange(4)
if x<1:p[i]+=m;m=0
if x<2:p[i]-=~m//2;m... |
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | [Python 3](https://docs.python.org/3/), ~~317 303 311 318 294~~ 270 bytes
=========================================================================
```python
def f(p,r):
m=len(p)
for k in p:p[k]-=1
for _ in range(r):
for i in p:
if p[i]<0:continue
x=randrange(4)
if x<1:p[i]+=m;m=0
if x<2:p[i]-=~m//2;m... | C `-m32`, ~~233~~ 220 bytes + 4 bytes = 224 bytes
=================================================
-9 bytes thanks to ceilingcat
(linebreaks for "readability")
```c
m;k;i;j;l;f(p,r)int*p;{
for(l=wcslen(p);k<l;k+=2)p[k]--;
for(srand(p);r--;m=l/2)
for(i=0;i<l;k=rand(i+=2)%4)
if(~p[i])if(k?k<2?p[i]+=m,m=0:k<3?p[i]+=j=... |
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | [Python](https://www.python.org), ~~197~~ 195 bytes
===================================================
-2 bytes thanks to @Arnauld using `-~p//2` instead of `p//2+p%2`
```python
from random import*
def f(n,c,m,i=0,p=0,s=0):
l=len(c);v=-~c[x:=i%l]and[-1,0,p,~-p//2][i//l&(s<0)and randrange(4)];c[x]+=v
if~-l-c.count(... | [Charcoal](https://github.com/somebody1234/Charcoal), 112 bytes
===============================================================
```
≔Lθζ≧×LθηUMθ⊖ιW∧η⊖LΦ謋κ⁰«≔§Eθλ±ηεF¬‹§θε⁰«≔‽⁴κ≔⎇‹κ²κ÷ζ~κκ§≔θε⁻§θεκF¬‹§θε⁰≧⁺κζ»F¬ζ«≔LΦθ›λ⁰ζUMθ⊖λ»≦⊖η»UMθ⎇›⁰ι⁰ι⭆¹θ`
```
[Attempt This Online!](https://ato.pxeger.com/run?1=hVLLTsMwEJS4ha-... |
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | [Charcoal](https://github.com/somebody1234/Charcoal), 112 bytes
===============================================================
```
≔Lθζ≧×LθηUMθ⊖ιW∧η⊖LΦ謋κ⁰«≔§Eθλ±ηεF¬‹§θε⁰«≔‽⁴κ≔⎇‹κ²κ÷ζ~κκ§≔θε⁻§θεκF¬‹§θε⁰≧⁺κζ»F¬ζ«≔LΦθ›λ⁰ζUMθ⊖λ»≦⊖η»UMθ⎇›⁰ι⁰ι⭆¹θ`
```
[Attempt This Online!](https://ato.pxeger.com/run?1=hVLLTsMwEJS4ha-... | C `-m32`, ~~233~~ 220 bytes + 4 bytes = 224 bytes
=================================================
-9 bytes thanks to ceilingcat
(linebreaks for "readability")
```c
m;k;i;j;l;f(p,r)int*p;{
for(l=wcslen(p);k<l;k+=2)p[k]--;
for(srand(p);r--;m=l/2)
for(i=0;i<l;k=rand(i+=2)%4)
if(~p[i])if(k?k<2?p[i]+=m,m=0:k<3?p[i]+=j=... |
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | [Python](https://www.python.org), ~~197~~ 195 bytes
===================================================
-2 bytes thanks to @Arnauld using `-~p//2` instead of `p//2+p%2`
```python
from random import*
def f(n,c,m,i=0,p=0,s=0):
l=len(c);v=-~c[x:=i%l]and[-1,0,p,~-p//2][i//l&(s<0)and randrange(4)];c[x]+=v
if~-l-c.count(... | JavaScript, ~~167~~ ~~165~~ 164 bytes
=====================================
Been a long, long time since I tried golfing anything this complex in JS. So much so that I made a complete *mess* of things in my initial solution! This version seems to work properly, although it's pretty hideous.
---
Takes the player data... |
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | JavaScript, ~~167~~ ~~165~~ 164 bytes
=====================================
Been a long, long time since I tried golfing anything this complex in JS. So much so that I made a complete *mess* of things in my initial solution! This version seems to work properly, although it's pretty hideous.
---
Takes the player data... | C `-m32`, ~~233~~ 220 bytes + 4 bytes = 224 bytes
=================================================
-9 bytes thanks to ceilingcat
(linebreaks for "readability")
```c
m;k;i;j;l;f(p,r)int*p;{
for(l=wcslen(p);k<l;k+=2)p[k]--;
for(srand(p);r--;m=l/2)
for(i=0;i<l;k=rand(i+=2)%4)
if(~p[i])if(k?k<2?p[i]+=m,m=0:k<3?p[i]+=j=... |
255,697 | Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of [Dreidel](https://en.wikipedia.or... | 2022/12/19 | [
"https://codegolf.stackexchange.com/questions/255697",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/47670/"
] | [Python](https://www.python.org), ~~197~~ 195 bytes
===================================================
-2 bytes thanks to @Arnauld using `-~p//2` instead of `p//2+p%2`
```python
from random import*
def f(n,c,m,i=0,p=0,s=0):
l=len(c);v=-~c[x:=i%l]and[-1,0,p,~-p//2][i//l&(s<0)and randrange(4)];c[x]+=v
if~-l-c.count(... | C `-m32`, ~~233~~ 220 bytes + 4 bytes = 224 bytes
=================================================
-9 bytes thanks to ceilingcat
(linebreaks for "readability")
```c
m;k;i;j;l;f(p,r)int*p;{
for(l=wcslen(p);k<l;k+=2)p[k]--;
for(srand(p);r--;m=l/2)
for(i=0;i<l;k=rand(i+=2)%4)
if(~p[i])if(k?k<2?p[i]+=m,m=0:k<3?p[i]+=j=... |
47,243,447 | I have an interval of integers and I need to find all unique cuboids which have a volume that falls within said interval.
I came up with a loop that goes over all uniqe combinations of 3 numbers (size of the cuboid) (1x1x1, 1x1x2, ...; also 2x1x1 is considered the same as 1x1x2) from 1 to the upper range of the interv... | 2017/11/11 | [
"https://Stackoverflow.com/questions/47243447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8925893/"
] | If your code is slow it's probably trying ranges of values that could be discarded immediately, or it's overly complicated and calculates square or cubic roots in loop conditions and such. Try something simple like the code example below, where I make sure a ≤ b ≤ c to avoid duplicates:
```js
if (Math.cbrt == undefin... | Define your target interval I = [A … B], giving you M=B-A+1 different integer volumes.
You'll have to consider each of these in isolation.
For any of these target volumes v, a naive algorithm (that's probably still better than yours) would be:
1. find the prime number factorization of that; let that yield Ω(n) fact... |
47,243,447 | I have an interval of integers and I need to find all unique cuboids which have a volume that falls within said interval.
I came up with a loop that goes over all uniqe combinations of 3 numbers (size of the cuboid) (1x1x1, 1x1x2, ...; also 2x1x1 is considered the same as 1x1x2) from 1 to the upper range of the interv... | 2017/11/11 | [
"https://Stackoverflow.com/questions/47243447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8925893/"
] | If your code is slow it's probably trying ranges of values that could be discarded immediately, or it's overly complicated and calculates square or cubic roots in loop conditions and such. Try something simple like the code example below, where I make sure a ≤ b ≤ c to avoid duplicates:
```js
if (Math.cbrt == undefin... | I would probably loop over pairs for the first two dimensions, then directly calculate the min and max values of the third dimension to get in the interval, and save earlier solutions based on the product of the first two dimensions. Something like:
```
volume_interval = (Vmin, Vmax)
solution_intervals = {}
for w = 1 ... |
66,119 | So I found this gem, it's cool and all, but it just doesn't have that oomph I'm looking for.
How can I upgrade it? Or failing that, what can I do with it that will help me to get a more powerful gem? | 2012/05/14 | [
"https://gaming.stackexchange.com/questions/66119",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/12087/"
] | You can combine 3 gems at the Jeweler to get 1 gem of the next higher quality level. Once you get to higher level gems, additional ingredients will also be required, such as Pages of Jewelcrafting or Tomes of Secrets. There are 14 tiers of gems in total.
See the [list of Jeweler recipes](http://us.battle.net/d3/en/art... | While the above answers about combining are true, the prices on the AH make low level gems cheaper to purchase outright via gold than by combining them. Aka, if it cost 500g to make a gem out of cheaper gems, that gem usually sells for far less than 500g. |
582,850 | The thin lens equation shows that when there is an object further than the focal point, there is a real image formed on the other side of the lens, and this principle is used for cameras, eyes, etc.
However, when I take a converging lens(that I got from some mobile VR headset), and hold it between me and an object, bo... | 2020/09/30 | [
"https://physics.stackexchange.com/questions/582850",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/211721/"
] | A converging lens (convex lens) will always create a *real inverted image* if the object is located at a point beyond the focal point (at a place on the opposite side of the lens). The only exception to this, is if the object is closer (to the lens) than the focal point is to the lens, in which case the image will *app... | You are seeing the real image, not a virtual image. If you placed a screen at the location where you believe the image to be it would be projected on the screen. Your eyes are focusing for the distance from you to that image. A screen is not necessary.
This is similar to the optical illusion of a small object like a c... |
4,692,030 | I'm storing some html-encoded data in a sql server database and I've written a script to output the data in a csv format minus the html tags and I'm getting a weird issue when html-decoding the remaining data. For example the data contains a quote character (which is html-encoded as `’`), but when I try to html-d... | 2011/01/14 | [
"https://Stackoverflow.com/questions/4692030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Those 3 weird characters are [how UTF-8 encodes the HTML entity `’`](http://www.fileformat.info/info/unicode/char/2019/index.htm). (They're actually the octets `0xE2 0x80 0x99`, and those bytes render as "’" in your computer's default charset `windows-1252`.) So I don't think you've got an issue with your encod... | If the data is read from the CSV files, open the csv file in notepad press Save As in the fiile menu, save the file as Encoding-UTF8. |
69,746,639 | So Im hitting an api and in the array of objects is an array of grades. Im mapping over the data but not sure how to go about getting the average grade and returning it in jsx. I tried the reduce method it didnt work and I just tried diving it by the length that didnt work either. I appreciate any help
```
data.map( (... | 2021/10/27 | [
"https://Stackoverflow.com/questions/69746639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14714235/"
] | There could be many ways to compute average, but this is one way using `reduce`.
```
const grades = [50, 40, 70];
const average = grades.reduce((acc, grades) => {
return acc + grades
}, 0) / grades.length;
console.log(average);
```
Answer:
```
53.333333333333336
``` | Piggy Backing off Jagrut, reduce is the most viable option for finding the average of a sum of numbers. I believe your execution of his solution might be why reduce wasn't working for you. Here is an example using an array of sample data to find the average grade. You provided us with no example of how the data looks i... |
42,168 | I need to test an sftp host for its cutoff of file size upload limitation. I wanted to make a series of files that were of increasingly larger sizes, to try to upload them all and see where they failed.
I was doing `for i in {10000..100000} ; do dd if=/dev/zero of=testfile$i bs=$i count=1 ; done ;`
but that was taking... | 2012/07/02 | [
"https://unix.stackexchange.com/questions/42168",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/394/"
] | From `dd(1)`:
>
> bs=BYTES
>
>
> /.../
>
>
> BLOCKS and BYTES may be followed by the following multiplicative
> suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000\*1000, M =1024\*1024
>
>
>
Alternatively, if you have a recent version of bash, the `{}` construct also takes a step parameter:
```
for i ... | For academic purposes, this would give a command 1k input files in increments of 1024 bytes by appending to the same file.
```
while ((++n<=1024)); do
printf '\0%.s' {1..1024} >&3
xxd -g 1 /dev/stdin; echo # sftp command here
done <<<'' 3>/dev/stdin
```
But... trial and error? I'd find a better way. |
32,501,747 | I have a doubt regarding how `equals()` method works for `ArrayList`. The below code snippet prints `true`.
```
ArrayList<String> s = new ArrayList<String>();
ArrayList<Integer> s1 = new ArrayList<Integer>();
System.out.println(s1.equals(s));
```
Why does it print `true`? | 2015/09/10 | [
"https://Stackoverflow.com/questions/32501747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/642551/"
] | Look the [doc](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.equals%28java.lang.Object%29) for the [equals()](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.equals%28java.lang.O... | The contract of the [`List.equals`](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#equals-java.lang.Object-) is that two lists are equal if all their elements are equal (in terms of `equals()`). Here, both are empty lists, so they are equal. The generic type is irrelevant, as there are anyway no list ele... |
32,501,747 | I have a doubt regarding how `equals()` method works for `ArrayList`. The below code snippet prints `true`.
```
ArrayList<String> s = new ArrayList<String>();
ArrayList<Integer> s1 = new ArrayList<Integer>();
System.out.println(s1.equals(s));
```
Why does it print `true`? | 2015/09/10 | [
"https://Stackoverflow.com/questions/32501747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/642551/"
] | Look the [doc](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.equals%28java.lang.Object%29) for the [equals()](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.equals%28java.lang.O... | Here is the ArrayList implementation of the equals method from the AbstractList
with a few commments what it actually does:
```
public boolean equals(Object o) {
if (o == this) // Not the same list so no return
return true;
if (!(o instanceof List)) // is an instance of List, so no return
return f... |
32,501,747 | I have a doubt regarding how `equals()` method works for `ArrayList`. The below code snippet prints `true`.
```
ArrayList<String> s = new ArrayList<String>();
ArrayList<Integer> s1 = new ArrayList<Integer>();
System.out.println(s1.equals(s));
```
Why does it print `true`? | 2015/09/10 | [
"https://Stackoverflow.com/questions/32501747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/642551/"
] | Look the [doc](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.equals%28java.lang.Object%29) for the [equals()](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.equals%28java.lang.O... | As previous answers pointed, equals returns true because both objects are instances of `List` and have the same size (0).
It's also worth mentioning that the fact that one `List` contains `Integer` and the other `String` does not affect the behaviour because of [type erasure](https://docs.oracle.com/javase/tutorial/ja... |
32,501,747 | I have a doubt regarding how `equals()` method works for `ArrayList`. The below code snippet prints `true`.
```
ArrayList<String> s = new ArrayList<String>();
ArrayList<Integer> s1 = new ArrayList<Integer>();
System.out.println(s1.equals(s));
```
Why does it print `true`? | 2015/09/10 | [
"https://Stackoverflow.com/questions/32501747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/642551/"
] | The contract of the [`List.equals`](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#equals-java.lang.Object-) is that two lists are equal if all their elements are equal (in terms of `equals()`). Here, both are empty lists, so they are equal. The generic type is irrelevant, as there are anyway no list ele... | Here is the ArrayList implementation of the equals method from the AbstractList
with a few commments what it actually does:
```
public boolean equals(Object o) {
if (o == this) // Not the same list so no return
return true;
if (!(o instanceof List)) // is an instance of List, so no return
return f... |
32,501,747 | I have a doubt regarding how `equals()` method works for `ArrayList`. The below code snippet prints `true`.
```
ArrayList<String> s = new ArrayList<String>();
ArrayList<Integer> s1 = new ArrayList<Integer>();
System.out.println(s1.equals(s));
```
Why does it print `true`? | 2015/09/10 | [
"https://Stackoverflow.com/questions/32501747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/642551/"
] | The contract of the [`List.equals`](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#equals-java.lang.Object-) is that two lists are equal if all their elements are equal (in terms of `equals()`). Here, both are empty lists, so they are equal. The generic type is irrelevant, as there are anyway no list ele... | As previous answers pointed, equals returns true because both objects are instances of `List` and have the same size (0).
It's also worth mentioning that the fact that one `List` contains `Integer` and the other `String` does not affect the behaviour because of [type erasure](https://docs.oracle.com/javase/tutorial/ja... |
124,865 | I am learning solidity. I want to ask how does the value of the token is calculated. Like how does the value of a coin increase and decrease in a programmatical way? which technology or method is used to calculate the value of a cryptocurrency. | 2022/03/28 | [
"https://ethereum.stackexchange.com/questions/124865",
"https://ethereum.stackexchange.com",
"https://ethereum.stackexchange.com/users/92051/"
] | Of course you can.
A better question is : should you ?
Probably not, because to do so you will have to write low level assembly code that's error-prone, difficult to debug / read and possibly make assumptions about the solidity compiler that might not hold over time.
Your input data will be :
* function identifier ... | The simple answer is no. This is how solidity encode the input. For details you can refer to the ABI encoding here - <https://docs.soliditylang.org/en/v0.8.12/abi-spec.html#formal-specification-of-the-encoding>
`0x65432121 ==> this is function selector`
`0x0000000000000000000000000000000000000000000000000000000000000... |
21,381,099 | I have created Google query job with my own job id successfully. And able to use the job id again and got successful results yesterday.
But the same Job id not working fine.
I have tried the job id with project Id in the google bigquery UI got the same error as '404' below
```
{
"error": {
"errors": [
{
"dom... | 2014/01/27 | [
"https://Stackoverflow.com/questions/21381099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057658/"
] | The error you're seeing is not a problem looking up the job but looking up the result table. As you noticed, `getQueryResults()` for a particular job will only work for up to 24 hours; after that the table that is created to store the results will expire and get cleaned up.
If you find that this happens within the 24... | Sometimes the problem is incorrect dataset location. In my code I have a config based on which I set the dataset location while executing a query. I messed up the location and started getting this error. After 2 hours of debugging finally found the issue.
Corrected the dataset location and it worked fine. |
47,741,273 | I am trying to achieve an effect where I can diagonally crop an image in a way that is displayed below. I am aware of clip path as a solution but it would not be suitable in this scenario since it is not supported by certain browsers which are essential for this particular task. (IE and Edge)
Additionally, the cropped... | 2017/12/10 | [
"https://Stackoverflow.com/questions/47741273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7770789/"
] | Maybe you could overlay the image with a rotated element (div or something) that you give a border and white background. This solution would work if you're okay with a solid background color.
Another solution, depending on your requirements, could be to simpy use a .png image with transparency. | Yes you can, it's a bit tricky to get the sizes of the divs correct. But here's generally how to do it:
HTML:
```
<div id="outerwrapper">
<div id="innerwrapper">
<div id="content">
<span>asdf</span>
</div>
</div>
</div>
```
CSS:
```
#content {
width: 100px;
height: 100px... |
162,082 | I'm about to submit a paper where one of the authors is a past student who got a master's degree at my university a few months ago (I was his advisor). He plans to apply for PhD positions at the next deadline, but is presently unemployed. What should we write on the manuscript for his institution? "Master's graduate, p... | 2021/02/01 | [
"https://academia.stackexchange.com/questions/162082",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/958/"
] | Whenever I co-write a paper with former students of mine, based on their MSc thesis, we typically put XXX University as affiliation of both the student and me. The bulk of the work has been done when both of us were affiliated with this university, so this seems appropriate. The fact that the student is no longer affil... | He performed the research activity while affiliated with your group. You do **not** need to be PhD/Professor/Dean/whatever-self-important-academic-title to submit a research for peer review. If you really need a *title*, it can be "scientific assistant", or "pre-graduate student" or any linear combination/contraption o... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | In the noble spirit of one immortal oratorm when he so colorfully advised our hero . . .
>
> This business is well ended.
>
> My liege, and madam, to expostulate
>
> What majesty should be, what duty is,
>
> Why day is day, night night, and time is time,
>
> Were nothing but to waste night, day and ti... | Last year the question [Word for a person who talks without content](https://english.stackexchange.com/q/242760/26083 "Word for a person who talks without content")
was closed as a duplicate of this one.
While I believe that my answer works for *this* question,
I believe that it works even better for [that one](https:... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | If you are actually talking about someone who waffles on long-windedly before getting to the point (rather than someone who doesn’t say things straight out and honestly, which is how I too would understand ‘straight talk’), the first idiom that comes to mind is ***beating around the bush***. | The opposite of *straight* is *crooked* (the adjective /'krʊkəd/, not the past participle /krʊkt/).
The opposite of *talking* is *thinking*, in the sense that what one says may not represent what one thinks. Particularly when the topic is lying.
So I'd say the opposite of ***straight talk*** would be ***crooked think... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | The opposite of a familiar and straightforward idiom would be a strange and impenetrable circumlocution. I suggest "obfuscatory tergiversation." | Last year the question [Word for a person who talks without content](https://english.stackexchange.com/q/242760/26083 "Word for a person who talks without content")
was closed as a duplicate of this one.
While I believe that my answer works for *this* question,
I believe that it works even better for [that one](https:... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | I'd suggest *pussyfoot* for the specific use you mentioned. In other uses, I might say an antonym for *straight talk* would be *euphemism* or the vulgar *B.S.* even. | Last year the question [Word for a person who talks without content](https://english.stackexchange.com/q/242760/26083 "Word for a person who talks without content")
was closed as a duplicate of this one.
While I believe that my answer works for *this* question,
I believe that it works even better for [that one](https:... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | If you are actually talking about someone who waffles on long-windedly before getting to the point (rather than someone who doesn’t say things straight out and honestly, which is how I too would understand ‘straight talk’), the first idiom that comes to mind is ***beating around the bush***. | Last year the question [Word for a person who talks without content](https://english.stackexchange.com/q/242760/26083 "Word for a person who talks without content")
was closed as a duplicate of this one.
While I believe that my answer works for *this* question,
I believe that it works even better for [that one](https:... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | In the noble spirit of one immortal oratorm when he so colorfully advised our hero . . .
>
> This business is well ended.
>
> My liege, and madam, to expostulate
>
> What majesty should be, what duty is,
>
> Why day is day, night night, and time is time,
>
> Were nothing but to waste night, day and ti... | The opposite of a familiar and straightforward idiom would be a strange and impenetrable circumlocution. I suggest "obfuscatory tergiversation." |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | In the noble spirit of one immortal oratorm when he so colorfully advised our hero . . .
>
> This business is well ended.
>
> My liege, and madam, to expostulate
>
> What majesty should be, what duty is,
>
> Why day is day, night night, and time is time,
>
> Were nothing but to waste night, day and ti... | I'd suggest *pussyfoot* for the specific use you mentioned. In other uses, I might say an antonym for *straight talk* would be *euphemism* or the vulgar *B.S.* even. |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | I'd suggest *pussyfoot* for the specific use you mentioned. In other uses, I might say an antonym for *straight talk* would be *euphemism* or the vulgar *B.S.* even. | The opposite of *straight* is *crooked* (the adjective /'krʊkəd/, not the past participle /krʊkt/).
The opposite of *talking* is *thinking*, in the sense that what one says may not represent what one thinks. Particularly when the topic is lying.
So I'd say the opposite of ***straight talk*** would be ***crooked think... |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | If you are actually talking about someone who waffles on long-windedly before getting to the point (rather than someone who doesn’t say things straight out and honestly, which is how I too would understand ‘straight talk’), the first idiom that comes to mind is ***beating around the bush***. | I'd suggest *pussyfoot* for the specific use you mentioned. In other uses, I might say an antonym for *straight talk* would be *euphemism* or the vulgar *B.S.* even. |
96,684 | What is the opposite for the *straight talk* idiom? How do I best call the activity when someone makes a very long preamble before he says what he wants? | 2013/01/04 | [
"https://english.stackexchange.com/questions/96684",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/26017/"
] | In the noble spirit of one immortal oratorm when he so colorfully advised our hero . . .
>
> This business is well ended.
>
> My liege, and madam, to expostulate
>
> What majesty should be, what duty is,
>
> Why day is day, night night, and time is time,
>
> Were nothing but to waste night, day and ti... | If you are actually talking about someone who waffles on long-windedly before getting to the point (rather than someone who doesn’t say things straight out and honestly, which is how I too would understand ‘straight talk’), the first idiom that comes to mind is ***beating around the bush***. |
73,813,195 | How to create a new variable in the dataframe with a sequence increasing by 0.002, starting at 0 and running until the end of the dataset. I was attempting with:
```
dataset$seq = seq(0, length(dataset), by = 0.002)
dataset$seq = seq(0, nrow(dataset), by = 0.002)
```
But both throw an error about wrong lengths. Than... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73813195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19974538/"
] | Another option:
```
dataset$seq <- seq(0, by = 0.002, length.out = nrow(dataset))
``` | One way:
```
library(dplyr)
df %>% mutate(seq = rep(.002, nrow(df)) * 1:nrow(df))
col1 col2 seq
1 a 1 0.002
2 b 2 0.004
3 c 3 0.006
4 d 4 0.008
5 e 5 0.010
6 f 6 0.012
7 g 7 0.014
8 h 8 0.016
9 i 9 0.018
10 j 10 0.020
```
Sure:
```
df %>% mut... |
73,813,195 | How to create a new variable in the dataframe with a sequence increasing by 0.002, starting at 0 and running until the end of the dataset. I was attempting with:
```
dataset$seq = seq(0, length(dataset), by = 0.002)
dataset$seq = seq(0, nrow(dataset), by = 0.002)
```
But both throw an error about wrong lengths. Than... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73813195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19974538/"
] | Another option:
```
dataset$seq <- seq(0, by = 0.002, length.out = nrow(dataset))
``` | Does it work?
```
set.seed(123)
df <- data.frame(x = rnorm(10), y = rnorm(10), z = rnorm(10))
df$seq <- seq(0, 0.002 * (nrow(df) - 1), 0.002)
x y z seq
1 -0.56047565 1.2240818 -1.0678237 0.000
2 -0.23017749 0.3598138 -0.2179749 0.002
3 1.55870831 0.4007715 -1.0260044 0.004
4 ... |
634,918 | I want to create a diagram on `tikz-qtree` that look something like this:
[](https://i.stack.imgur.com/WXACwm.png)
Where "alt", "a", and "s" are aligned at the base, and "R", "AF", and "AF" are also aligned at the base (note that I removed the last ... | 2022/02/23 | [
"https://tex.stackexchange.com/questions/634918",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/175002/"
] | With `forest` package is simple (for me, since I'm a bit more familiar with it than with `tikz-qtree`) :
```
\documentclass[border=3.141592]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree = {
% nodes styles
align = center,
font = \linespread{0.84}\selectfont,
inner sep ... | After fiddling with the code, I discovered that the code I had been using works; I simply had to move the `tikzset{}` portion from the preamble to inside the `tikzpicture` environment. I don't know why having these settings in the environment works but not when they're in the preamble, but it did. Below is my "new" cod... |
26,792,337 | If we have a list `s`, is there any difference between calling `list(s)` versus `s[:]`? It seems to me like they both create new list objects with the exact elements of `s`. | 2014/11/07 | [
"https://Stackoverflow.com/questions/26792337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3765966/"
] | In both cases, they *should* create a (shallow) copy of the list.
Note that there is one corner case (which is hardly worth mentioning) where it might be different...
```
list = tuple # Don't ever do this!
list_copy = list(some_list) # Oops, actually it's a tuple ...
actually_list_copy = some_list[:]
```
With tha... | list() is better - it's more readable. Other than that there is no difference. |
26,792,337 | If we have a list `s`, is there any difference between calling `list(s)` versus `s[:]`? It seems to me like they both create new list objects with the exact elements of `s`. | 2014/11/07 | [
"https://Stackoverflow.com/questions/26792337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3765966/"
] | In both cases, they *should* create a (shallow) copy of the list.
Note that there is one corner case (which is hardly worth mentioning) where it might be different...
```
list = tuple # Don't ever do this!
list_copy = list(some_list) # Oops, actually it's a tuple ...
actually_list_copy = some_list[:]
```
With tha... | I didn't realize, but as ventsyv mentioned, `s[:]` and `list(s)` both create a copy of `s`.
Note you can check if an object is the same using `is` and `id()` can be used to get the object's memory address to actually see if they are the same or not.
```
>>> s = [1,2,3]
>>> listed_s = list(s)
>>> id(s)
44056328
>>> id(... |
26,792,337 | If we have a list `s`, is there any difference between calling `list(s)` versus `s[:]`? It seems to me like they both create new list objects with the exact elements of `s`. | 2014/11/07 | [
"https://Stackoverflow.com/questions/26792337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3765966/"
] | In both cases, they *should* create a (shallow) copy of the list.
Note that there is one corner case (which is hardly worth mentioning) where it might be different...
```
list = tuple # Don't ever do this!
list_copy = list(some_list) # Oops, actually it's a tuple ...
actually_list_copy = some_list[:]
```
With tha... | The short answer is use `list()`. In google type `python [:]` then type `python list`.
If s is a list then there is no difference, but will s always be a list? Or could it be a sequence or a generator?
```
In [1]: nums = 1, 2, 3
In [2]: nums
Out[2]: (1, 2, 3)
In [3]: nums[:]
Out[3]: (1, 2, 3)
In [4]: list(nums)
... |
26,792,337 | If we have a list `s`, is there any difference between calling `list(s)` versus `s[:]`? It seems to me like they both create new list objects with the exact elements of `s`. | 2014/11/07 | [
"https://Stackoverflow.com/questions/26792337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3765966/"
] | list() is better - it's more readable. Other than that there is no difference. | I didn't realize, but as ventsyv mentioned, `s[:]` and `list(s)` both create a copy of `s`.
Note you can check if an object is the same using `is` and `id()` can be used to get the object's memory address to actually see if they are the same or not.
```
>>> s = [1,2,3]
>>> listed_s = list(s)
>>> id(s)
44056328
>>> id(... |
26,792,337 | If we have a list `s`, is there any difference between calling `list(s)` versus `s[:]`? It seems to me like they both create new list objects with the exact elements of `s`. | 2014/11/07 | [
"https://Stackoverflow.com/questions/26792337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3765966/"
] | The short answer is use `list()`. In google type `python [:]` then type `python list`.
If s is a list then there is no difference, but will s always be a list? Or could it be a sequence or a generator?
```
In [1]: nums = 1, 2, 3
In [2]: nums
Out[2]: (1, 2, 3)
In [3]: nums[:]
Out[3]: (1, 2, 3)
In [4]: list(nums)
... | I didn't realize, but as ventsyv mentioned, `s[:]` and `list(s)` both create a copy of `s`.
Note you can check if an object is the same using `is` and `id()` can be used to get the object's memory address to actually see if they are the same or not.
```
>>> s = [1,2,3]
>>> listed_s = list(s)
>>> id(s)
44056328
>>> id(... |
493,386 | I have a circuit that should operate as a voltage-controlled push-pull current driver, able to source or sink at least 2A (into a 1 ohm load). It has unexpected oscillations on the output current.
[](https://i.stack.imgur.com/Zb8Am.png)
... | 2020/04/15 | [
"https://electronics.stackexchange.com/questions/493386",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/249387/"
] | A significant factor when using power MOSFETS is their very large input capacitance - in this circuit it will add poles at the output of the opamp and the gate of Q2. Together with the very high loop gain in the circuit due to the added gain of Q1 will make it very difficult to stabilize. | With the inductive Zout of opamp in mind(perhaps +j100 at 1MHz), and the Miller-multiplied Cgatedrain of the first FET, why not dampen any opamp peaking by placing 100 ohms in gate of first FET. |
12,714,887 | Checking the LunarLander example it uses that code for resume the drawer thread:
```
public void surfaceCreated(SurfaceHolder holder) {
// start the thread here so that we don't busy-wait in run()
// waiting for the surface to be created
thread.setRunning(true);
thread.start();
}
```
and this for end... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12714887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/853836/"
] | Your thread is still running, you dont stop it correctly i guess.
You have to interrupt your thread or thats how i solved it. So instead of using setRunning and a boolean to make your thread run you use something like this:
to start it:
```
public void surfaceCreated(SurfaceHolder holder) {
thread.start();
}
```... | You can do it like this:
```
@Override
public void surfaceCreated(SurfaceHolder holder) {
if (!thread.isAlive()) {
thread.start();
}
}
``` |
12,714,887 | Checking the LunarLander example it uses that code for resume the drawer thread:
```
public void surfaceCreated(SurfaceHolder holder) {
// start the thread here so that we don't busy-wait in run()
// waiting for the surface to be created
thread.setRunning(true);
thread.start();
}
```
and this for end... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12714887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/853836/"
] | Your thread is still running, you dont stop it correctly i guess.
You have to interrupt your thread or thats how i solved it. So instead of using setRunning and a boolean to make your thread run you use something like this:
to start it:
```
public void surfaceCreated(SurfaceHolder holder) {
thread.start();
}
```... | This is how I solved this issue. In the surfaceCreated method, the state of the thread may have changed to TERMINATED. You need to create the thread a new.
```
@Override
public void surfaceCreated(SurfaceHolder holder) {
bgSurfaceThread = bgSurfaceThread.getState().equals(Thread.State.TERMINATED) ? bgSurfaceThre... |
31,055 | Could you please correct my text ?
虽然我会说一口流利的法语,但是我想说一口流利的汉语。
我的职业 是律师。
律师 的责任很大,因为他必须解决严重得实情。然后压力大。
可是在巴黎 律师逐渐增加。 因此招聘越来越少。 | 2018/08/11 | [
"https://chinese.stackexchange.com/questions/31055",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/20244/"
] | The a versions are acceptable I'm told. 2 needed no changes.
1. 虽然我会说一口流利的法语,但是我想说一口流利的汉语。(illogical 虽然。。。但是。。。)
1a. 我已经会说一口流利的法语,我希望我的汉语能像我的法语一样流利。
2. 我的职业是律师。
3. 律师的责任很大,因为他必须解决严重得实情。然后压力大。
3a. 作为律师,我的压力很大,责任很重,因为律师总得解决严重的事情。
4. 可是在巴黎 律师逐渐增加。 因此招聘越来越少。
4a. 在巴黎律师的数量越来越多,因此工作机会越来越少。 | 虽然我会说一口流利的法语,但是我想说一口流利的汉语。
我的职业是律师。
律师的责任很大,因为他必须解决严重**得实情**。然后压力大。
律师的责任很大,因为他必须**处理**严重**的案件**。然后压力**很**(1)大。
可是在巴黎,律师逐渐增加。因此**招聘**越来越少。
可是在巴黎,律师逐渐增加。因此**工作机会**越来越少。
(1) [很 - Chinese Grammar Wiki](https://resources.allsetlearning.com/chinese/grammar/%E5%BE%88) |
380,400 | Is it a common phrase 'Thanks for your trouble' ?
I read this sentence in some speaking books.
However, I think the phrase 'thanks for your effort' is better to express my
intentions, doesn't it? | 2017/03/27 | [
"https://english.stackexchange.com/questions/380400",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/226924/"
] | Yes, ***"Thanks for your trouble"*** or ***"Thank you for your trouble"*** is a very common phrase (In fact I use it quite often).
>
> It doesn't mean *He is creating the trouble*, it is *you* who is creating a *trouble/burden* for *him*. To elaborate, think of the sentence like
>
>
> * *"Thank you for (handling/ta... | Yes, "thanks for your trouble" is certainly common. This [Ngram](https://books.google.com/ngrams/graph?content=thanks%20for%20your%20trouble&year_start=1800&year_end=2019&corpus=26&smoothing=3&direct_url=t1%3B%2Cthanks%20for%20your%20trouble%3B%2Cc0#t1%3B%2Cthanks%20for%20your%20trouble%3B%2Cc0) shows that it was espec... |
8,421,325 | Okay, Ive searched around and found how this is supposed to be done. For example, finding [this question](https://stackoverflow.com/questions/6709449/run-php-function-once). However it is not working for me, so I must be doing something wrong, but darned if I know what.
Okay... here is my little code block:
```
<?ph... | 2011/12/07 | [
"https://Stackoverflow.com/questions/8421325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80209/"
] | When you say "**following** the `<html>` tag", you mean **before**, right?
`session_start()` must come before any output. | how do you test your code? It will work OK only in real browsers. So, if you using `wget` or `curl` to test - your conditional code will always run b/c wget & curl do not keep session cookies by default.
Also be sure that you do not block cookies in your browser. |
39,485 | I'm trying to fix the "failed to refresh: TfsOlapReport" error on the TFS project portal dashboards in SharePoint 2010. I've followed the instructions [here](http://blogs.technet.com/b/chrad/archive/2010/07/21/tfs-dashboards-in-moss-2010-return-access-denied-for-tfsolapreport-to-end-users.aspx) to make sure the Secure ... | 2012/06/26 | [
"https://sharepoint.stackexchange.com/questions/39485",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/9106/"
] | Since SharePoint 2010 and Analysis Services 2008 were on seperate machines, I could see the logon via Windows Authentication as DOMAIN\TFSReports was succeeding on the Analysis Services machine in Event Viewer\Security logs. So I knew Excel Services was getting that far...
Googling in general about the PF\_CHECK\_ERRO... | Please confirm the following as mentioned below
1. The ODC file specified in the workbook is in an accessible trusted data connection library, or configure the trusted file location where the workbook resides to allow embedded connections.
2. The unattended service account is configured in Excel Services Global Settin... |
553,590 | I just got my new Lenovo Flex 2-15 with preinstalled Windows 8 using which I do not want to use.
I would like to install Ubuntu on it but I never had experience with touch screens and I am wondering if it is a good idea at all and if it will have a proper touch screen support or if not, any other Linux distributions ... | 2014/11/25 | [
"https://askubuntu.com/questions/553590",
"https://askubuntu.com",
"https://askubuntu.com/users/351964/"
] | I have a Lenovo Flex 14 (series 1), I have installed Ubuntu 14.04 LTS alongside Windows 8. For me, the touch screen works a treat, although I am old school and never have the need to touch it during normal use, I prefer to use the mouse and keyboard.
Hope that helps. | When you asked this question, the answer would have been no. I was running only Ubuntu on this system with no issues. However I did have to reload Windows on here a couple of months ago and it upgraded to Windows 10. After that, I was able to go back to Ubuntu with no need for Windows (happy dance).
Now, here is wher... |
33,154,012 | I'm new to windowed functions. Here is the original table with 4 types of fruit.
```
fruit quantity
orange 100
banana 27
banana 20
orange 5
melon 5
apple 1
banana 10
banana 4
banana 36
banana 86
banana 47
apple 32
banana 7
banana 5
banana 3
```
Is it possible to turn this into the percentage each... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33154012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191190/"
] | Use a windowed `sum` of the aggregate `sum`.
```
SELECT Fruit ,
SUM(Quantity) AS Quantity ,
SUM(Quantity) / SUM(SUM(Quantity)) OVER () * 100
FROM @fruitbasket
GROUP BY Fruit;
``` | I believe this is what you're looking for:
```
declare @fruitbasket table
(
Fruit nvarchar(50),
Quantity decimal(19, 5)
);
insert into @fruitbasket
(Fruit, Quantity)
values (N'orange', 100),
(N'banana', 27),
(N'banana', 20),
(N'orange', 5),
(N'melon', 5),
... |
33,154,012 | I'm new to windowed functions. Here is the original table with 4 types of fruit.
```
fruit quantity
orange 100
banana 27
banana 20
orange 5
melon 5
apple 1
banana 10
banana 4
banana 36
banana 86
banana 47
apple 32
banana 7
banana 5
banana 3
```
Is it possible to turn this into the percentage each... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33154012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191190/"
] | I believe this is what you're looking for:
```
declare @fruitbasket table
(
Fruit nvarchar(50),
Quantity decimal(19, 5)
);
insert into @fruitbasket
(Fruit, Quantity)
values (N'orange', 100),
(N'banana', 27),
(N'banana', 20),
(N'orange', 5),
(N'melon', 5),
... | Using CTE (Common Table Expression) you can have the results like you wanted.
Overall CTE's do have better performance and are better readable.
```
WITH cte AS
(
SELECT DISTINCT
Fruit
,SUM(Quantity) OVER (PARTITION BY fruit ORDER BY fruit) AS sumProducts
,SUM(SUM(Quantity)) OVER () AS tot... |
33,154,012 | I'm new to windowed functions. Here is the original table with 4 types of fruit.
```
fruit quantity
orange 100
banana 27
banana 20
orange 5
melon 5
apple 1
banana 10
banana 4
banana 36
banana 86
banana 47
apple 32
banana 7
banana 5
banana 3
```
Is it possible to turn this into the percentage each... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33154012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191190/"
] | Use a windowed `sum` of the aggregate `sum`.
```
SELECT Fruit ,
SUM(Quantity) AS Quantity ,
SUM(Quantity) / SUM(SUM(Quantity)) OVER () * 100
FROM @fruitbasket
GROUP BY Fruit;
``` | Using CTE (Common Table Expression) you can have the results like you wanted.
Overall CTE's do have better performance and are better readable.
```
WITH cte AS
(
SELECT DISTINCT
Fruit
,SUM(Quantity) OVER (PARTITION BY fruit ORDER BY fruit) AS sumProducts
,SUM(SUM(Quantity)) OVER () AS tot... |
537,426 | I was hoping to do something like this:
```
echo 'foo' >&3 3| cat
```
Basically, I want to write '`foo`' to `3`, and then only pipe the data in `3` to `cat`. But the above doesn't work, I get:
```
bash: 3: Bad file descriptor
```
Does anyone understand what I am trying to do?
With Node.js, I have working examp... | 2019/08/26 | [
"https://unix.stackexchange.com/questions/537426",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/113238/"
] | ```sh
{ echo 'hello on fd3' >&3; } 3>&1 | cat
```
Here, `echo` writes to standard output, but we redirect it to file descriptor 3 (this corresponds to the writing to `w` that you do in your Node application). We then output the stream on file descriptor 3 to standard output to be able to send it over the pipe to `cat... | Not quite a pipe via process-substitution:
```
# cmd 3> >(cat)
```
Or, if you are ok to mix the output of fd3 and stdout,
```
# cmd 3>&1 | cat
``` |
537,426 | I was hoping to do something like this:
```
echo 'foo' >&3 3| cat
```
Basically, I want to write '`foo`' to `3`, and then only pipe the data in `3` to `cat`. But the above doesn't work, I get:
```
bash: 3: Bad file descriptor
```
Does anyone understand what I am trying to do?
With Node.js, I have working examp... | 2019/08/26 | [
"https://unix.stackexchange.com/questions/537426",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/113238/"
] | You can do it without process substitutions and without mixing fd 1 and 3 or fd 1 and 2:
```
producer(){ echo to_out; echo >&2 to_err; echo >&3 to_fd3; }
consumer(){ sed "s/^/consumer $@: /" >/dev/tty; }
{ producer 3>&1 >&4 | consumer 3; } 4>&1 | consumer 1
to_err
consumer 1: to_out
consumer 3: to_fd3
{ producer 3>&... | Not quite a pipe via process-substitution:
```
# cmd 3> >(cat)
```
Or, if you are ok to mix the output of fd3 and stdout,
```
# cmd 3>&1 | cat
``` |
537,426 | I was hoping to do something like this:
```
echo 'foo' >&3 3| cat
```
Basically, I want to write '`foo`' to `3`, and then only pipe the data in `3` to `cat`. But the above doesn't work, I get:
```
bash: 3: Bad file descriptor
```
Does anyone understand what I am trying to do?
With Node.js, I have working examp... | 2019/08/26 | [
"https://unix.stackexchange.com/questions/537426",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/113238/"
] | ```sh
{ echo 'hello on fd3' >&3; } 3>&1 | cat
```
Here, `echo` writes to standard output, but we redirect it to file descriptor 3 (this corresponds to the writing to `w` that you do in your Node application). We then output the stream on file descriptor 3 to standard output to be able to send it over the pipe to `cat... | So with bash, this does work:
```
exec 3<> >(cat > temp.sh)
echo a >&3 # write to it
exec 3>&- # close fd 3.
```
but I am wondering if there is a less verbose way to do it. And to do without process substitution, instead of using pipes. |
537,426 | I was hoping to do something like this:
```
echo 'foo' >&3 3| cat
```
Basically, I want to write '`foo`' to `3`, and then only pipe the data in `3` to `cat`. But the above doesn't work, I get:
```
bash: 3: Bad file descriptor
```
Does anyone understand what I am trying to do?
With Node.js, I have working examp... | 2019/08/26 | [
"https://unix.stackexchange.com/questions/537426",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/113238/"
] | You can do it without process substitutions and without mixing fd 1 and 3 or fd 1 and 2:
```
producer(){ echo to_out; echo >&2 to_err; echo >&3 to_fd3; }
consumer(){ sed "s/^/consumer $@: /" >/dev/tty; }
{ producer 3>&1 >&4 | consumer 3; } 4>&1 | consumer 1
to_err
consumer 1: to_out
consumer 3: to_fd3
{ producer 3>&... | So with bash, this does work:
```
exec 3<> >(cat > temp.sh)
echo a >&3 # write to it
exec 3>&- # close fd 3.
```
but I am wondering if there is a less verbose way to do it. And to do without process substitution, instead of using pipes. |
34,626,507 | I am in an environment that contains a `RollingWindow` class where `RollingWindow<T>` can be a collection of any type/object.
I would like to create a C# method to convert a `RollingWindow<T>` into a `List<T>`.
Essentially I'd use it in the following manner:
```
List<int> intList = new List<int>();
List<Record> = r... | 2016/01/06 | [
"https://Stackoverflow.com/questions/34626507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3655973/"
] | Based on the assumption that `RollingWindow<T>` implements `IEnumerable<T>` then;
```
List<int> intList = intWindow.ToList();
List<Record> recordList = recordWindow.ToList();
```
will work | I assume that the `RollingWindow<T>` is derived from `IEnumerable<T>`.
So this could be possible:
```
var enumerableFromWin = (IEnumerable<int>) intWindow;
intList = new List<int>(enumerableFromWin);
var enumRecFromWin = (IEnumerable<Record>) recordWindow;
recordList = new List<Record>(enumRecFromWin);
``` |
13,206,383 | I spend over 8 hours last night to check all the documentations, browsing various post etc and I almost fixed my problem, yet there is stil something missing that I can't understand.
I have a table which stores various user submissions with a unix timestamp (e.g. 1351867293). I am extracting this information and coun... | 2012/11/03 | [
"https://Stackoverflow.com/questions/13206383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1793672/"
] | Because the newly added elements doesn't exist on DOM when you bind that handler. Try using delegated events like below,
```
$(document).ready(function(){
$(document).on('click', '.testing', function(){
$(this).remove();
return false;
});
});
``` | try this ,it doesn't work because you are creating element dynamically, for dynamically created element use on or live of jquery.
```
$("body").on("click", ".testing", function(event){
$(this).remove();
return false;
});
``` |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | I can't really follow your code, could you post a working program?
Anyway, this is a simple tokenizer, without testing edge cases:
```
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void tokenize(vector<string>& tokens, const string& text, const string& del)
{
string::size_type sta... | It depends on whether you want the preceding delimiters, the following delimiters, or both, and what you want to do with strings at the beginning and end of the string that may not have delimiters before/after them.
I'm going to assume you want each word, with its preceding and following delimiters, but NOT any string... |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | The [C++ String Toolkit Library (StrTk)](http://www.partow.net/programming/strtk/index.html) has the following solution:
```
std::string str = "abc,123 xyz";
std::vector<std::string> token_list;
strtk::split(";., ",
str,
strtk::range_to_type_back_inserter(token_list),
strtk::incl... | I can't really follow your code, could you post a working program?
Anyway, this is a simple tokenizer, without testing edge cases:
```
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void tokenize(vector<string>& tokens, const string& text, const string& del)
{
string::size_type sta... |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | if the delimiters are characters and not strings, then you can use [strtok](http://www.cplusplus.com/reference/clibrary/cstring/strtok/). | It depends on whether you want the preceding delimiters, the following delimiters, or both, and what you want to do with strings at the beginning and end of the string that may not have delimiters before/after them.
I'm going to assume you want each word, with its preceding and following delimiters, but NOT any string... |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | I now this a little sloppy, but this is what I ended up with. I did not want to use boost since this is a school assignment and my instructor wanted me to use find\_first\_of to accomplish this.
Thanks for everyone's help.
```
vector<string> Tokenize(const string& strInput, const string& strDelims)
{
vector<string> ... | It depends on whether you want the preceding delimiters, the following delimiters, or both, and what you want to do with strings at the beginning and end of the string that may not have delimiters before/after them.
I'm going to assume you want each word, with its preceding and following delimiters, but NOT any string... |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | The [C++ String Toolkit Library (StrTk)](http://www.partow.net/programming/strtk/index.html) has the following solution:
```
std::string str = "abc,123 xyz";
std::vector<std::string> token_list;
strtk::split(";., ",
str,
strtk::range_to_type_back_inserter(token_list),
strtk::incl... | It depends on whether you want the preceding delimiters, the following delimiters, or both, and what you want to do with strings at the beginning and end of the string that may not have delimiters before/after them.
I'm going to assume you want each word, with its preceding and following delimiters, but NOT any string... |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | The [C++ String Toolkit Library (StrTk)](http://www.partow.net/programming/strtk/index.html) has the following solution:
```
std::string str = "abc,123 xyz";
std::vector<std::string> token_list;
strtk::split(";., ",
str,
strtk::range_to_type_back_inserter(token_list),
strtk::incl... | if the delimiters are characters and not strings, then you can use [strtok](http://www.cplusplus.com/reference/clibrary/cstring/strtok/). |
1,511,029 | I'm tokening with the following, but unsure how to include the delimiters with it.
```
void Tokenize(const string str, vector<string>& tokens, const string& delimiters)
{
int startpos = 0;
int pos = str.find_first_of(delimiters, startpos);
string strTemp;
while (string::npos != pos || string::npos !=... | 2009/10/02 | [
"https://Stackoverflow.com/questions/1511029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183276/"
] | The [C++ String Toolkit Library (StrTk)](http://www.partow.net/programming/strtk/index.html) has the following solution:
```
std::string str = "abc,123 xyz";
std::vector<std::string> token_list;
strtk::split(";., ",
str,
strtk::range_to_type_back_inserter(token_list),
strtk::incl... | I now this a little sloppy, but this is what I ended up with. I did not want to use boost since this is a school assignment and my instructor wanted me to use find\_first\_of to accomplish this.
Thanks for everyone's help.
```
vector<string> Tokenize(const string& strInput, const string& strDelims)
{
vector<string> ... |
6,582,553 | I have these two pieces of code, and I think they are ugly. How can I change them?
1
```
do_withs = Dowith.where(:friend_id => current_user.id)
@doweets = do_withs.collect { |f| f.doweet_id }
@doweets = @doweets.collect { |f| Doweet.find((F)) }
@doweets = @doweets + current_user.doweets
@doweets.flatten!
@doweets.so... | 2011/07/05 | [
"https://Stackoverflow.com/questions/6582553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827251/"
] | this simplifies things a tad (but my syntax might be off...
```
@doweets = Dowith.where(:friend_id => current_user.id).collect do |d|
[
Doweet.find(d.doweet_id)
]
end
@doweets << current_user.doweets
@doweets.sort! do |a,b| a.date <=> b.date end
``` | ```
@doweets = Dowith.where(:friend_id => current_user.id).collect &:doweet_id
@doweets = Doweet.find_all_by_id(@doweets)
@doweets = (@doweets + current_user.doweets).sort_by &:date
@current_user_doweets = current_user.doweets.limit(10)
@friendships = Friendship.where(:friend_id => current_user.id, :status => true)
@f... |
6,582,553 | I have these two pieces of code, and I think they are ugly. How can I change them?
1
```
do_withs = Dowith.where(:friend_id => current_user.id)
@doweets = do_withs.collect { |f| f.doweet_id }
@doweets = @doweets.collect { |f| Doweet.find((F)) }
@doweets = @doweets + current_user.doweets
@doweets.flatten!
@doweets.so... | 2011/07/05 | [
"https://Stackoverflow.com/questions/6582553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827251/"
] | this simplifies things a tad (but my syntax might be off...
```
@doweets = Dowith.where(:friend_id => current_user.id).collect do |d|
[
Doweet.find(d.doweet_id)
]
end
@doweets << current_user.doweets
@doweets.sort! do |a,b| a.date <=> b.date end
``` | 1) Take advantage of your model associations to reduce the number of database queries you generate by eager-loading with the `includes` method:
```
@doweets = Dowith.where(:friend_id => current_user.id).includes(:doweet).collect(&:doweet) + current_user.doweets
@doweets.sort! {|doweet1, doweet2| doweet1.date <=> dowee... |
6,582,553 | I have these two pieces of code, and I think they are ugly. How can I change them?
1
```
do_withs = Dowith.where(:friend_id => current_user.id)
@doweets = do_withs.collect { |f| f.doweet_id }
@doweets = @doweets.collect { |f| Doweet.find((F)) }
@doweets = @doweets + current_user.doweets
@doweets.flatten!
@doweets.so... | 2011/07/05 | [
"https://Stackoverflow.com/questions/6582553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827251/"
] | 1) Take advantage of your model associations to reduce the number of database queries you generate by eager-loading with the `includes` method:
```
@doweets = Dowith.where(:friend_id => current_user.id).includes(:doweet).collect(&:doweet) + current_user.doweets
@doweets.sort! {|doweet1, doweet2| doweet1.date <=> dowee... | ```
@doweets = Dowith.where(:friend_id => current_user.id).collect &:doweet_id
@doweets = Doweet.find_all_by_id(@doweets)
@doweets = (@doweets + current_user.doweets).sort_by &:date
@current_user_doweets = current_user.doweets.limit(10)
@friendships = Friendship.where(:friend_id => current_user.id, :status => true)
@f... |
14,781,659 | I finally got my Django app to deploy on Heroku, using Vagrant and Postgres for both local and production. The localhost is up and running, and I'm in the admin, adding users. But when I run
```
heroku run python manage.py syncdb
```
it barfs up this error:
psycopg2.OperationalError: could not connect to server: N... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14781659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1319434/"
] | Well, this part of the stack trace is your code:
```
java.lang.NullPointerException
at com.latlon.InitialSearchActivity.e(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.InitialSearchActivity.g(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.MyRes... | Check the documentation on Proguard (which is the tool that does the code obfusciation).
It is very likely that you "over-obfusciated", which can cause issues with the deployed code. Just like you are seeing.
You can turn off Proguard functionality by editing the "proguard-project.txt" file. To ensure no obfusciation... |
14,781,659 | I finally got my Django app to deploy on Heroku, using Vagrant and Postgres for both local and production. The localhost is up and running, and I'm in the admin, adding users. But when I run
```
heroku run python manage.py syncdb
```
it barfs up this error:
psycopg2.OperationalError: could not connect to server: N... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14781659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1319434/"
] | Well, this part of the stack trace is your code:
```
java.lang.NullPointerException
at com.latlon.InitialSearchActivity.e(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.InitialSearchActivity.g(Unknown Source)
at com.latlon.InitialSearchActivity.a(Unknown Source)
at com.latlon.MyRes... | Looks like you used some toole (like Proguard) to obfuscate your code.
Did you test your APK after obfuscation?
From the logs above a NullPointerException has occured in your code, you'd need to de-obfuscate your code using the key files generated by the obfuscating tool in order to find out the real place (line of c... |
14,781,659 | I finally got my Django app to deploy on Heroku, using Vagrant and Postgres for both local and production. The localhost is up and running, and I'm in the admin, adding users. But when I run
```
heroku run python manage.py syncdb
```
it barfs up this error:
psycopg2.OperationalError: could not connect to server: N... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14781659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1319434/"
] | Looks like you used some toole (like Proguard) to obfuscate your code.
Did you test your APK after obfuscation?
From the logs above a NullPointerException has occured in your code, you'd need to de-obfuscate your code using the key files generated by the obfuscating tool in order to find out the real place (line of c... | Check the documentation on Proguard (which is the tool that does the code obfusciation).
It is very likely that you "over-obfusciated", which can cause issues with the deployed code. Just like you are seeing.
You can turn off Proguard functionality by editing the "proguard-project.txt" file. To ensure no obfusciation... |
55,216 | I have a player of a gnome who tries to get almost everything from campaign setting books.
Should I grant him these thing without including the entire book?
For example: He tried to get the feat "Shadow weave magic", but I'm not going to include a god and a whole lot of zones of magic just because of one feat. He pro... | 2015/01/11 | [
"https://rpg.stackexchange.com/questions/55216",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/20811/"
] | The DM Can Allow Anything...
----------------------------
That is, if the DM wants to mix in elements from a variety of settings, he can. No RPG police will bust in if, for example, a DM puts dragonmarks and the Shadow Weave into his homebrew setting. In fact, because the typical individual character has limited resou... | **Answer: Unless there is a clash between your setting and the lore of whatever a player wants from a campaign book, there is no direct reason to disallow. Consider what is most fun for everyone.**
The two most important rules in D&D, its Golden Rule and Rule Zero:
* *"The GM makes the rules; don't argue with the GM"... |
55,216 | I have a player of a gnome who tries to get almost everything from campaign setting books.
Should I grant him these thing without including the entire book?
For example: He tried to get the feat "Shadow weave magic", but I'm not going to include a god and a whole lot of zones of magic just because of one feat. He pro... | 2015/01/11 | [
"https://rpg.stackexchange.com/questions/55216",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/20811/"
] | ### 3.5 as a system has a lot of flaws, and few advantages – enormous selection of material is the biggest one
If you are not taking advantage of the enormous selection of material available in 3.5 (and the flexibility of the system, which allows you to *use* that material, between feats, multiclassing, and so on), I ... | **Answer: Unless there is a clash between your setting and the lore of whatever a player wants from a campaign book, there is no direct reason to disallow. Consider what is most fun for everyone.**
The two most important rules in D&D, its Golden Rule and Rule Zero:
* *"The GM makes the rules; don't argue with the GM"... |
55,216 | I have a player of a gnome who tries to get almost everything from campaign setting books.
Should I grant him these thing without including the entire book?
For example: He tried to get the feat "Shadow weave magic", but I'm not going to include a god and a whole lot of zones of magic just because of one feat. He pro... | 2015/01/11 | [
"https://rpg.stackexchange.com/questions/55216",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/20811/"
] | The DM Can Allow Anything...
----------------------------
That is, if the DM wants to mix in elements from a variety of settings, he can. No RPG police will bust in if, for example, a DM puts dragonmarks and the Shadow Weave into his homebrew setting. In fact, because the typical individual character has limited resou... | ### 3.5 as a system has a lot of flaws, and few advantages – enormous selection of material is the biggest one
If you are not taking advantage of the enormous selection of material available in 3.5 (and the flexibility of the system, which allows you to *use* that material, between feats, multiclassing, and so on), I ... |
64,547,654 | I got this error
>
> 'InvokeCommandAction' cannot be added to a collection or dictionary of type 'TriggerActionCollection'
>
>
>
Xaml file as below
```
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prismI="clr-namespace:Prism.Interactivity;assembly=Prism.Wpf"
```
```
<i:Interaction.Triggers>
... | 2020/10/27 | [
"https://Stackoverflow.com/questions/64547654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492730/"
] | The types in *Prism's* interactitvity namespace are based on the `System.Windows.Interactivity` assembly. It is shipped with *Blend for Visual Studio*. If you install it, you can find the assembly in the path below. Prism does **not contain** these assemblies, it only provides types based on it.
```none
C:\Program Fil... | Prism 7.2.0.1422 brings it's own (old) version of the XAML Behaviors and you are mixing the new nuget package and the old version, that might be the issue. have you tried using
```
<i:InvokeCommandAction Command="{Binding testCmd}"/>
```
thus replaceing `prismI` with `i`? |
72,231,968 | Is there a function in Lua to generate a variable name with a string and a value?
For example, I have the first (string) part `"vari"` and the second (value) part, which can vary. So I want to generate `"vari1"`, `"vari2"`, `"vari3"` and so on. Something like this:
`"vari"..value = 42` should then be `vari1 = 42`.
Th... | 2022/05/13 | [
"https://Stackoverflow.com/questions/72231968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12076007/"
] | Yes, but it most likely is a bad idea (and this very much seems to be an XY-problem to me). If you need an enumerated "list" of variables, just use a table:
```lua
local var = { 42, 100, 30 }
var[4] = 33 -- add a fourth variable
print(var[1]) -- prints 42
```
if you really need to set a bunch of variables though (pe... | Yes. Call:
```
rawset(table, key, value)
```
Example:
```
rawset(_G, 'foo', 'bar')
print(foo)
-- Output: bar
-- Lets loop it and rawget() it too
-- rawset() returns table _G here to rawget()
-- rawset() is executed before rawget() in this case
for i = 1, 10 do
print(rawget(rawset(_G, 'var' .. i, i), 'var' .. i))
e... |
43,998,637 | ```
strings = ("name", "last", "middle")
file = ["name","blabla","middle"]
for line in file:
if any(s in line for s in strings):
print ("found")
```
I want to compare two lists and get check for the common strings, and **if and only if two or more** strings are same.
The above code works well for **one** ... | 2017/05/16 | [
"https://Stackoverflow.com/questions/43998637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7625226/"
] | First you can find number of matches using `list comprehension` and then `len > 2` or not
```
>>> num = 2
>>> l = [i for i in strings if i in file]
>>> if len(l) >= num:
print('found')
found
``` | If you like one-liners here's my proposition:
```
# If two or more elemnts from listA are present in listB returns TRUE
def two_or_more(listA, listB):
return sum(map(lambda x : x in listB, listA)) > 1
``` |
43,998,637 | ```
strings = ("name", "last", "middle")
file = ["name","blabla","middle"]
for line in file:
if any(s in line for s in strings):
print ("found")
```
I want to compare two lists and get check for the common strings, and **if and only if two or more** strings are same.
The above code works well for **one** ... | 2017/05/16 | [
"https://Stackoverflow.com/questions/43998637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7625226/"
] | You can use `set`s and [`intersection`](https://docs.python.org/3/library/stdtypes.html#set.intersection) if you want to check for the common items (and it's not important which ones).
```
if len(set(strings).intersection(file)) >= 2: # at least 2 common values
print('found')
```
If you want to look for fixed i... | First you can find number of matches using `list comprehension` and then `len > 2` or not
```
>>> num = 2
>>> l = [i for i in strings if i in file]
>>> if len(l) >= num:
print('found')
found
``` |
43,998,637 | ```
strings = ("name", "last", "middle")
file = ["name","blabla","middle"]
for line in file:
if any(s in line for s in strings):
print ("found")
```
I want to compare two lists and get check for the common strings, and **if and only if two or more** strings are same.
The above code works well for **one** ... | 2017/05/16 | [
"https://Stackoverflow.com/questions/43998637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7625226/"
] | You can use `set`s and [`intersection`](https://docs.python.org/3/library/stdtypes.html#set.intersection) if you want to check for the common items (and it's not important which ones).
```
if len(set(strings).intersection(file)) >= 2: # at least 2 common values
print('found')
```
If you want to look for fixed i... | If you like one-liners here's my proposition:
```
# If two or more elemnts from listA are present in listB returns TRUE
def two_or_more(listA, listB):
return sum(map(lambda x : x in listB, listA)) > 1
``` |
926,478 | I'm setting up a small mail server using postfix+dovecot. When running `oppenssl s_client -connect mail.myserver.com:993` (IMAP), the server's certificate is displayed and I'm able to get an email client to connect fine.
However, when I change the port to `25` (SMTP), I get the error
`SSL routines:ssl3_get_record:wron... | 2018/08/15 | [
"https://serverfault.com/questions/926478",
"https://serverfault.com",
"https://serverfault.com/users/483298/"
] | Your Postfix + Dovecot setup has two different server software performing different roles:
* Dovecot in your configuratoin is a *mail storage server*, responsible for IMAP. Additionally, Dovecot [provides SASL authentication](https://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL) for Postfix. The configuration file `/... | Port 25 do not use SSL by default. Client have to run `STARTTLS` command to begin the negotiations with server about cryptography. In opposite IMAPS on the port 993 begins SSL negotiations immediately on connect. You have to configure and try the SMTPS on the port 465 that acts exactly like IMAPS on 993. |
926,478 | I'm setting up a small mail server using postfix+dovecot. When running `oppenssl s_client -connect mail.myserver.com:993` (IMAP), the server's certificate is displayed and I'm able to get an email client to connect fine.
However, when I change the port to `25` (SMTP), I get the error
`SSL routines:ssl3_get_record:wron... | 2018/08/15 | [
"https://serverfault.com/questions/926478",
"https://serverfault.com",
"https://serverfault.com/users/483298/"
] | Your Postfix + Dovecot setup has two different server software performing different roles:
* Dovecot in your configuratoin is a *mail storage server*, responsible for IMAP. Additionally, Dovecot [provides SASL authentication](https://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL) for Postfix. The configuration file `/... | To test services, such as SMTP, that run both the clear text protocol as well as an TLS encrypted version of that protocol *on the same TCP port*, you need to instruct openssl to negotiate the TLS protocol upgrade with [STARTTLS](https://en.wikipedia.org/wiki/Opportunistic_TLS) and the [`-starttls protocol`](https://ww... |
5,430,862 | What is difference between `ContentObserver` and `DatasetObserver`?
When one or another should be used?
I get `Cursor` with single row. I want to be notified about data changes - eg. when row is updated.
Which observer class should I register? | 2011/03/25 | [
"https://Stackoverflow.com/questions/5430862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296427/"
] | If you are using a `ContentProvider` (via `ContentResolver` or `Activity.managedQuery()`) to get your data, simply attach a `ContentObserver` to your `Cursor`. The code in `onChange()` will be called whenever the `ContentResolver` broadcasts a notification for the `Uri` associated with your cursor.
```
Cursor myCursor... | From my last app developed I can say.
The main difference between ContentObserver and DataSetObserver, is that ContentObserver makes to Observer any change affects on ContentProvider. On the other hand, DataSetObserver Observer any change effect on the database. |
5,430,862 | What is difference between `ContentObserver` and `DatasetObserver`?
When one or another should be used?
I get `Cursor` with single row. I want to be notified about data changes - eg. when row is updated.
Which observer class should I register? | 2011/03/25 | [
"https://Stackoverflow.com/questions/5430862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296427/"
] | If you are using a `ContentProvider` (via `ContentResolver` or `Activity.managedQuery()`) to get your data, simply attach a `ContentObserver` to your `Cursor`. The code in `onChange()` will be called whenever the `ContentResolver` broadcasts a notification for the `Uri` associated with your cursor.
```
Cursor myCursor... | To provide the supplement to ptc's answer, `DataSetObserver` is used for handling content changes in the [Adapter](http://developer.android.com/intl/zh-cn/reference/android/widget/Adapter.html), for example, it can be used for [updating listview dynamically with Adapter](https://stackoverflow.com/questions/5320358/upda... |
5,430,862 | What is difference between `ContentObserver` and `DatasetObserver`?
When one or another should be used?
I get `Cursor` with single row. I want to be notified about data changes - eg. when row is updated.
Which observer class should I register? | 2011/03/25 | [
"https://Stackoverflow.com/questions/5430862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296427/"
] | If you are using a `ContentProvider` (via `ContentResolver` or `Activity.managedQuery()`) to get your data, simply attach a `ContentObserver` to your `Cursor`. The code in `onChange()` will be called whenever the `ContentResolver` broadcasts a notification for the `Uri` associated with your cursor.
```
Cursor myCursor... | I'm not sure if this question is still on anyone's radar. I have been struggling with the same question for a little while now. What I came up with as my litmus test for deciding whether to use a DataSet Observer or a ContentObserver is pretty straight-forward:
If I need to send a URI in my notification I use a Conten... |
5,430,862 | What is difference between `ContentObserver` and `DatasetObserver`?
When one or another should be used?
I get `Cursor` with single row. I want to be notified about data changes - eg. when row is updated.
Which observer class should I register? | 2011/03/25 | [
"https://Stackoverflow.com/questions/5430862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296427/"
] | To provide the supplement to ptc's answer, `DataSetObserver` is used for handling content changes in the [Adapter](http://developer.android.com/intl/zh-cn/reference/android/widget/Adapter.html), for example, it can be used for [updating listview dynamically with Adapter](https://stackoverflow.com/questions/5320358/upda... | From my last app developed I can say.
The main difference between ContentObserver and DataSetObserver, is that ContentObserver makes to Observer any change affects on ContentProvider. On the other hand, DataSetObserver Observer any change effect on the database. |
5,430,862 | What is difference between `ContentObserver` and `DatasetObserver`?
When one or another should be used?
I get `Cursor` with single row. I want to be notified about data changes - eg. when row is updated.
Which observer class should I register? | 2011/03/25 | [
"https://Stackoverflow.com/questions/5430862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296427/"
] | I'm not sure if this question is still on anyone's radar. I have been struggling with the same question for a little while now. What I came up with as my litmus test for deciding whether to use a DataSet Observer or a ContentObserver is pretty straight-forward:
If I need to send a URI in my notification I use a Conten... | From my last app developed I can say.
The main difference between ContentObserver and DataSetObserver, is that ContentObserver makes to Observer any change affects on ContentProvider. On the other hand, DataSetObserver Observer any change effect on the database. |
5,430,862 | What is difference between `ContentObserver` and `DatasetObserver`?
When one or another should be used?
I get `Cursor` with single row. I want to be notified about data changes - eg. when row is updated.
Which observer class should I register? | 2011/03/25 | [
"https://Stackoverflow.com/questions/5430862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296427/"
] | I'm not sure if this question is still on anyone's radar. I have been struggling with the same question for a little while now. What I came up with as my litmus test for deciding whether to use a DataSet Observer or a ContentObserver is pretty straight-forward:
If I need to send a URI in my notification I use a Conten... | To provide the supplement to ptc's answer, `DataSetObserver` is used for handling content changes in the [Adapter](http://developer.android.com/intl/zh-cn/reference/android/widget/Adapter.html), for example, it can be used for [updating listview dynamically with Adapter](https://stackoverflow.com/questions/5320358/upda... |
12,315,277 | I've follow the tutorial from this link:
<http://www.adobe.com/devnet/flashplayer/articles/creating-games-away3d.html>
But the code seem like got problems with it that I can't even load the 3D vase.
Here is the code:
```
package
{
import away3d.containers.View3D;
import away3d.events.LoaderEvent;
import... | 2012/09/07 | [
"https://Stackoverflow.com/questions/12315277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1213089/"
] | I would suggest you to use AssetLibrary to load your Model, its very simple and easy to handle all the things that models contains,
```
AssetLibrary.addEventListener( AssetEvent.ASSET_COMPLETE, onAssetComplete );
AssetLibrary.addEventListener( LoaderEvent.RESOURCE_COMPLETE, onResourceComplete );
AssetLibrary.addEvent... | delete "Parsers.enableAllBundled();"
try this:
AssetLibrary.enableParser(AWD1Parser)
or
AssetLibrary.enableParser(AWD2Parser)
or
var aWD2Parser:AWD2Parser=new AWD2Parser();
\_loader.load(new URLRequest('vase.awd'),null,"vase.awd",aWD2Parser); |
12,315,277 | I've follow the tutorial from this link:
<http://www.adobe.com/devnet/flashplayer/articles/creating-games-away3d.html>
But the code seem like got problems with it that I can't even load the 3D vase.
Here is the code:
```
package
{
import away3d.containers.View3D;
import away3d.events.LoaderEvent;
import... | 2012/09/07 | [
"https://Stackoverflow.com/questions/12315277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1213089/"
] | I would suggest you to use AssetLibrary to load your Model, its very simple and easy to handle all the things that models contains,
```
AssetLibrary.addEventListener( AssetEvent.ASSET_COMPLETE, onAssetComplete );
AssetLibrary.addEventListener( LoaderEvent.RESOURCE_COMPLETE, onResourceComplete );
AssetLibrary.addEvent... | The vase AWD file adobe has with their tutorial is no longer valid. The AWD spec changed and adobe never updated their tutorial. You will usually get an End Of File error if you try to load it. |
12,315,277 | I've follow the tutorial from this link:
<http://www.adobe.com/devnet/flashplayer/articles/creating-games-away3d.html>
But the code seem like got problems with it that I can't even load the 3D vase.
Here is the code:
```
package
{
import away3d.containers.View3D;
import away3d.events.LoaderEvent;
import... | 2012/09/07 | [
"https://Stackoverflow.com/questions/12315277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1213089/"
] | delete "Parsers.enableAllBundled();"
try this:
AssetLibrary.enableParser(AWD1Parser)
or
AssetLibrary.enableParser(AWD2Parser)
or
var aWD2Parser:AWD2Parser=new AWD2Parser();
\_loader.load(new URLRequest('vase.awd'),null,"vase.awd",aWD2Parser); | The vase AWD file adobe has with their tutorial is no longer valid. The AWD spec changed and adobe never updated their tutorial. You will usually get an End Of File error if you try to load it. |
72,232,908 | I am trying to parse what I originally suspected was a JSON config file from a server.
After some attempts I was able to navigate and collapse the sections within Notepad++ when I selected the formatter as JavaScript.
However I am stuck on how I can convert/parse this data to JSON/another format, no online tools have... | 2022/05/13 | [
"https://Stackoverflow.com/questions/72232908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807561/"
] | Here's something that converts the above configfile into dict/json in python. I'm just doing some regex as @zett42 suggested.
```
import re
import json
lines = open('configfile', 'r').read()
# Quotations around the keys (next 3 lines)
lines2 = re.sub(r'([a-zA-Z\d_*]+)\s?{', r'"\1": {', lines)
# Process k<v> as Key, ... | **Edit:** I've since come up with a [much simpler, PowerShell-only solution](https://stackoverflow.com/a/72274775/7571258) which I recommend to use.
I'll keep this answer alive as it might still be useful for other scenarios. Also there are propably differences in performance (I haven't measured).
---
[MYousefi](htt... |
72,232,908 | I am trying to parse what I originally suspected was a JSON config file from a server.
After some attempts I was able to navigate and collapse the sections within Notepad++ when I selected the formatter as JavaScript.
However I am stuck on how I can convert/parse this data to JSON/another format, no online tools have... | 2022/05/13 | [
"https://Stackoverflow.com/questions/72232908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807561/"
] | I've come up with an even simpler solution than my [previous one](https://stackoverflow.com/a/72241688/7571258) which uses **PowerShell** code only.
Using the [RegEx alternation operator](https://learn.microsoft.com/en-us/dotnet/standard/base-types/alternation-constructs-in-regular-expressions) `|` we combine all toke... | **Edit:** I've since come up with a [much simpler, PowerShell-only solution](https://stackoverflow.com/a/72274775/7571258) which I recommend to use.
I'll keep this answer alive as it might still be useful for other scenarios. Also there are propably differences in performance (I haven't measured).
---
[MYousefi](htt... |
72,955,820 | I have a dataframe with columns as mentioned
```
[-10800,
-9000,
-7200,
-5400,
-3600,
-1800,
0,
180,
300,
1200,
1800,
2400,
3600,
'-10800_R',
'-9000_R',
'-7200_R',
'-5400_R',
'-3600_R',
'-1800_R',
'0_R',
'180_R',
'300_R',
'1200_R',
'1800_R',
'2400_R',
'3600_R']
```
I want to only select the ... | 2022/07/12 | [
"https://Stackoverflow.com/questions/72955820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9620357/"
] | When executing an [`EXPLAIN ANALYSE` on the last query](https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=bb264a6c22078c879ecaffab12b43136), this is the output:
```none
-> Filter: ((T1.colA / T.col1) > 0) (cost=1.00 rows=0) (actual time=0.047..0.061 rows=3 loops=1)
-> Inner hash join (T.col2 = T1.colA) (cost=1.00 rows... | Some general rules in MySQL:
* AND'd clauses in WHERE are *usually* performed left to right.
* MATCH and SPATIAL tests will be performed before other tests.
* The Optimizer has limited smarts.
* The Optimizer may choose to start with any of the JOINed tables first.
* LEFT JOIN may *or may not* force the 'left' table t... |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | **Hint:** Without loss of generality, suppose $c$ is the largest side. Hence, $c<a+b$. Also,
$$\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}\leq\frac{a}{a+b}+\frac{b}{a+b}+\frac{c}{a+b}\,.$$
Note that the bound is sharp. In the limit $a\to 0$ and $b\to c$, we have the sum goes to $2$. | Since $a,b,c$ are the sides of a triangle, there exist $p,q,r\in\mathbb R^+$ such that $a=p+q$, $b=q+r$, $c=r+p$ ([Ravi substitution](https://mblog1024.wordpress.com/2011/02/14/ravi-substitution-explained/)).
$$\sum\_{\text{cyc}}\frac{a}{b+c}<2\iff \sum\_{\text{cyc}}\frac{p+q}{p+q+2r}<2$$
Now multiply both sides by $... |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | Since $a,b,c$ are the sides of a triangle, there exist $p,q,r\in\mathbb R^+$ such that $a=p+q$, $b=q+r$, $c=r+p$ ([Ravi substitution](https://mblog1024.wordpress.com/2011/02/14/ravi-substitution-explained/)).
$$\sum\_{\text{cyc}}\frac{a}{b+c}<2\iff \sum\_{\text{cyc}}\frac{p+q}{p+q+2r}<2$$
Now multiply both sides by $... | >
> Let $a,b,c$ be the lengths of the sides of a triangle. Prove that
>
>
> \begin{align}\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}&<2\tag{1}\label{1}.\end{align}
>
>
>
Let $\rho,\ r,\ R$
be the semiperimeter,
inradius and circumradius
of the triangle $ABC$, then
we can rewrite \eqref{1} as
\begin{align}
\frac ... |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | **Hint:** Without loss of generality, suppose $c$ is the largest side. Hence, $c<a+b$. Also,
$$\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}\leq\frac{a}{a+b}+\frac{b}{a+b}+\frac{c}{a+b}\,.$$
Note that the bound is sharp. In the limit $a\to 0$ and $b\to c$, we have the sum goes to $2$. | As @user236182 pointed out, we can write $a=p+q$, $b=q+r$, and $c=r+p$, with $p,q,r>0$. Letting $s = p+q+r$, we have
$$\frac{a}{b+c} = \frac{s-r}{s+r} = 1 - \frac{2r}{s+r} $$
and hence
$$\sum\limits\_{\text{cyc}}{\frac{a}{b+c}}< 2 \iff \sum\limits\_{\text{cyc}}{\left(1-\frac{2r}{s+r}\right)}< 2 \iff \sum\limits\_{\text... |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | As @user236182 pointed out, we can write $a=p+q$, $b=q+r$, and $c=r+p$, with $p,q,r>0$. Letting $s = p+q+r$, we have
$$\frac{a}{b+c} = \frac{s-r}{s+r} = 1 - \frac{2r}{s+r} $$
and hence
$$\sum\limits\_{\text{cyc}}{\frac{a}{b+c}}< 2 \iff \sum\limits\_{\text{cyc}}{\left(1-\frac{2r}{s+r}\right)}< 2 \iff \sum\limits\_{\text... | >
> Let $a,b,c$ be the lengths of the sides of a triangle. Prove that
>
>
> \begin{align}\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}&<2\tag{1}\label{1}.\end{align}
>
>
>
Let $\rho,\ r,\ R$
be the semiperimeter,
inradius and circumradius
of the triangle $ABC$, then
we can rewrite \eqref{1} as
\begin{align}
\frac ... |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | **Hint:** Without loss of generality, suppose $c$ is the largest side. Hence, $c<a+b$. Also,
$$\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}\leq\frac{a}{a+b}+\frac{b}{a+b}+\frac{c}{a+b}\,.$$
Note that the bound is sharp. In the limit $a\to 0$ and $b\to c$, we have the sum goes to $2$. | \begin{align\*}
\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b} & = \frac{2a}{2(b+c)}+\frac{2b}{2(c+a)}+\frac{2c}{2(a+b)} \\
&< \frac{2a}{a+b+c} + \frac{2b}{c+a+b} + \frac{2c}{a+b+c} \\
&= 2
\end{align\*} |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | **Hint:** Without loss of generality, suppose $c$ is the largest side. Hence, $c<a+b$. Also,
$$\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}\leq\frac{a}{a+b}+\frac{b}{a+b}+\frac{c}{a+b}\,.$$
Note that the bound is sharp. In the limit $a\to 0$ and $b\to c$, we have the sum goes to $2$. | >
> Let $a,b,c$ be the lengths of the sides of a triangle. Prove that
>
>
> \begin{align}\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}&<2\tag{1}\label{1}.\end{align}
>
>
>
Let $\rho,\ r,\ R$
be the semiperimeter,
inradius and circumradius
of the triangle $ABC$, then
we can rewrite \eqref{1} as
\begin{align}
\frac ... |
1,903,783 | The population of graduate students in the northern part of Evanston is given by the formula P(t)=(t^2+100) ln(t+2), where t represents the time in years since 2000. Using Python, find the rate of change of this population in 2006, as well as the year that the population will reach 500 graduate students.
For the fina... | 2016/08/25 | [
"https://math.stackexchange.com/questions/1903783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/362936/"
] | \begin{align\*}
\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b} & = \frac{2a}{2(b+c)}+\frac{2b}{2(c+a)}+\frac{2c}{2(a+b)} \\
&< \frac{2a}{a+b+c} + \frac{2b}{c+a+b} + \frac{2c}{a+b+c} \\
&= 2
\end{align\*} | >
> Let $a,b,c$ be the lengths of the sides of a triangle. Prove that
>
>
> \begin{align}\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b}&<2\tag{1}\label{1}.\end{align}
>
>
>
Let $\rho,\ r,\ R$
be the semiperimeter,
inradius and circumradius
of the triangle $ABC$, then
we can rewrite \eqref{1} as
\begin{align}
\frac ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.