qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
58,866,240 | So I'd like to use a calculated or referenced value from another table as a y constant line in Power BI. I know there's no default way of doing it but I was wondering if there was a workaround. I have this:
[](https://i.stack.imgur.com/cCYTJ.png)
And... | 2019/11/14 | [
"https://Stackoverflow.com/questions/58866240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3348414/"
] | From the [docs](https://reactjs.org/docs/hooks-reference.html#usestate):
>
> Returns a stateful value, and a function to update it.
>
>
>
`setvisible` is a **function**, which allows you to update the state. You would need to call it like so:
```
setvisible({visible: true});
```
Since this is as simple as a bo... | For creating hooks as single value variable, you don't have to create hooks like this..
```
const [visible, setvisible] = useState({ visible: false });
```
Instead use this...
```
const [visible, setvisible] = useState(false);
```
Here setVisible is Hooks function not an object..
So you cannot set visible value b... |
72,580,755 | Assuming I have this string:
```py
TEST = 'GAMES HELLO VAUXHALL RUNS=15 TESTED=3'
```
if the text `'RUNS='` exists in `TEST`, I want to extract the value `15` into a variable, nothing else from that string. | 2022/06/10 | [
"https://Stackoverflow.com/questions/72580755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14502162/"
] | You can use `re` module:
```py
import re
s = "GAMES HELLO VAUXHALL RUNS=15 TESTED=3"
m = re.search(r"RUNS=(\d+)", s)
if m:
print("RUN=... found! The value is", m.group(1))
```
Prints:
```none
RUN=... found! The value is 15
``` | Just split the line and check if one of the items starts with your desired string:
```py
TEST = 'GAMES HELLO VAUXHALL RUNS=15 TESTED=3'
def extract(s: str):
for i in s.split():
if i.startswith("RUNS="):
return int(i.split("=")[1])
print(extract(TEST))
``` |
28,159,523 | Forgive me if I word the title wrong, I'm speculating on what my problem might be as I'm not a javascript coding expert. I have a series of divs that are generated by a php loop with unique ids created by adding the unique id contained in an auto increment column in the mysql db table that contains all the info for the... | 2015/01/26 | [
"https://Stackoverflow.com/questions/28159523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1704387/"
] | Call [FormValue](http://godoc.org/net/http#Request.FormValue) to get a query parameter:
```
token := req.FormValue("token")
```
`req` is a the `*http.Request`
An alternative is to call [ParseForm](http://godoc.org/net/http#Request.ParseForm) and access `req.Form` directly:
```
if err := req.ParseForm(); err != nil... | Depending on the way you want to parse the token , if its coming from the form or the URL.
The first answer can be used if the token is being sent from the form while in case of a URL, I would suggest using this. This works for me
```
token := req.URL.Query().Get("token")
``` |
28,159,523 | Forgive me if I word the title wrong, I'm speculating on what my problem might be as I'm not a javascript coding expert. I have a series of divs that are generated by a php loop with unique ids created by adding the unique id contained in an auto increment column in the mysql db table that contains all the info for the... | 2015/01/26 | [
"https://Stackoverflow.com/questions/28159523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1704387/"
] | Call [FormValue](http://godoc.org/net/http#Request.FormValue) to get a query parameter:
```
token := req.FormValue("token")
```
`req` is a the `*http.Request`
An alternative is to call [ParseForm](http://godoc.org/net/http#Request.ParseForm) and access `req.Form` directly:
```
if err := req.ParseForm(); err != nil... | For url query parameters:
```
mux.Vars(r)["token"]
``` |
28,159,523 | Forgive me if I word the title wrong, I'm speculating on what my problem might be as I'm not a javascript coding expert. I have a series of divs that are generated by a php loop with unique ids created by adding the unique id contained in an auto increment column in the mysql db table that contains all the info for the... | 2015/01/26 | [
"https://Stackoverflow.com/questions/28159523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1704387/"
] | Depending on the way you want to parse the token , if its coming from the form or the URL.
The first answer can be used if the token is being sent from the form while in case of a URL, I would suggest using this. This works for me
```
token := req.URL.Query().Get("token")
``` | For url query parameters:
```
mux.Vars(r)["token"]
``` |
64,976,798 | Imagine if there is a list of words like `words = ["hello","boy","cool"]` and a user input of a string `string = "helloboycool"`.
My question: Is there a way to use **Regular Expression** to find all the words in the "words" list that match a part of the input "string".
For example:
`list = ["123","hello","nice","red... | 2020/11/23 | [
"https://Stackoverflow.com/questions/64976798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14694936/"
] | Regex was made for finding things in *strings*, not lists.
I would suggest looping through the list and checking if each word is inside `string`:
```
words = ["123", "hello", "nice", "red", "boy"]
string = "helloboycool"
result = []
for word in words:
if word in string:
result.append(word)
print(result)
... | If you don't need to find overlapping matches, you can turn the list into a regular expression that uses `|` to match alternatives. Then use `re.findall()` to get all the matches.
```
import re
words = ["123","hello","nice","red","boy"]
string = "helloniceboy"
regex = re.compile('|'.join(re.escape(x) for x in words))... |
64,976,798 | Imagine if there is a list of words like `words = ["hello","boy","cool"]` and a user input of a string `string = "helloboycool"`.
My question: Is there a way to use **Regular Expression** to find all the words in the "words" list that match a part of the input "string".
For example:
`list = ["123","hello","nice","red... | 2020/11/23 | [
"https://Stackoverflow.com/questions/64976798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14694936/"
] | Regex was made for finding things in *strings*, not lists.
I would suggest looping through the list and checking if each word is inside `string`:
```
words = ["123", "hello", "nice", "red", "boy"]
string = "helloboycool"
result = []
for word in words:
if word in string:
result.append(word)
print(result)
... | Does it have to be a regex? It can be done easily like this:
```py
list = ["123", "hello", "red", "nice", "happy", "boy"]
input = "helloniceboy"
result = []
for i in list:
if i in input:
result.append(i)
print(result)
```
If it **has** to be regex, there is a built-in module called `re` which you can u... |
64,976,798 | Imagine if there is a list of words like `words = ["hello","boy","cool"]` and a user input of a string `string = "helloboycool"`.
My question: Is there a way to use **Regular Expression** to find all the words in the "words" list that match a part of the input "string".
For example:
`list = ["123","hello","nice","red... | 2020/11/23 | [
"https://Stackoverflow.com/questions/64976798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14694936/"
] | If you don't need to find overlapping matches, you can turn the list into a regular expression that uses `|` to match alternatives. Then use `re.findall()` to get all the matches.
```
import re
words = ["123","hello","nice","red","boy"]
string = "helloniceboy"
regex = re.compile('|'.join(re.escape(x) for x in words))... | Does it have to be a regex? It can be done easily like this:
```py
list = ["123", "hello", "red", "nice", "happy", "boy"]
input = "helloniceboy"
result = []
for i in list:
if i in input:
result.append(i)
print(result)
```
If it **has** to be regex, there is a built-in module called `re` which you can u... |
1,142,009 | I am trying to install Packet Tracer on Ubuntu 19.04, but it gives me the error below when I try to launch it:
```
./PacketTracer7: ./libcrypto.so.1.0.0: no version information available (required by ./PacketTracer7)
```
But when I try to install `libssl1.0.0` I get the following error:
```
**Reading package lists.... | 2019/05/10 | [
"https://askubuntu.com/questions/1142009",
"https://askubuntu.com",
"https://askubuntu.com/users/954549/"
] | You can try downloading one from [18.10 repository](https://packages.ubuntu.com/cosmic/amd64/libssl1.0.0/download), since it's yet to be available on 19.04.
```
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu6.2_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu6.2_amd64.deb
``... | I ran into some trouble getting PT to run on Ubuntu 19.04 and after a bit of research it looks like not only is the libpng12 package required but it needs further customization due to /lib being a symlink to /usr/lib now. While I appreciate the folks dropping links to custom .deb packages I wanted to roll my own
Assum... |
34,867,396 | In examples of interacting with the database in ASP.NET I always see
```
using ( SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString) )
{
// ... Do some stuff
}
```
but I'm wondering, shouldn't I just be connected all the time? It doesn't make sense why I w... | 2016/01/19 | [
"https://Stackoverflow.com/questions/34867396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5648283/"
] | `SqlConnection` is not thread-safe.
Since ASP.Net requests can arrive on multiple threads, you must not do that.
SqlConnection is [already pooled](https://msdn.microsoft.com/en-us/library/8xx3tyca.aspx); you don't have anything to worry about. | In my experience, you do not want to leave a connection open if you are not using it. It is much cleaner to use a Using statement when connecting to a DB. There is a good discussion here... [https://stackoverflow.com/questions/7072583/is-it-ok-to-leave-a-sql-connection-open](https://stackoverflow.com/questions/7072583/... |
16,835,417 | I want to get the address of the end of my program and check at compilation/linker time if I have enough space, after the code, to place some random data in execution time.
But as the symbols provided by PROVIDE keyword are like normal variables in C code, I can not verify it in compilation time.
In the linker script... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16835417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2075374/"
] | ```
_Static_assert(SIZE_I_WANT_TO_ASSURE <= AVAILABLE_MEM, "NOT ENOUGH MEMORY!!!");
error: expression in static assertion is not constant
```
The problem here is that you are trying to compare a "constant" generated during the linking phase of the build, in an expression that requires a compile time constant (that i... | You can create a custom linker script that has assertions in it. see here
<http://sourceware.org/binutils/docs/ld/Miscellaneous-Commands.html>
you want to use the 'ASSERT' mechanism. |
16,835,417 | I want to get the address of the end of my program and check at compilation/linker time if I have enough space, after the code, to place some random data in execution time.
But as the symbols provided by PROVIDE keyword are like normal variables in C code, I can not verify it in compilation time.
In the linker script... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16835417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2075374/"
] | ```
_Static_assert(SIZE_I_WANT_TO_ASSURE <= AVAILABLE_MEM, "NOT ENOUGH MEMORY!!!");
error: expression in static assertion is not constant
```
The problem here is that you are trying to compare a "constant" generated during the linking phase of the build, in an expression that requires a compile time constant (that i... | You can do it in the link script itself, something like this:
```
/* minimum amount of data required at end of .text */
_Min_Data_Left 0Xffff;
.text :
{
... all the usual stuff ...
PROVIDE (__data_end_rom = . );
. = . + _Min_Data_Left;
. = ALIGN(4);
} >FLASH
```
The linker will now tell you that FLASH has overflo... |
16,835,417 | I want to get the address of the end of my program and check at compilation/linker time if I have enough space, after the code, to place some random data in execution time.
But as the symbols provided by PROVIDE keyword are like normal variables in C code, I can not verify it in compilation time.
In the linker script... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16835417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2075374/"
] | You can create a custom linker script that has assertions in it. see here
<http://sourceware.org/binutils/docs/ld/Miscellaneous-Commands.html>
you want to use the 'ASSERT' mechanism. | You can do it in the link script itself, something like this:
```
/* minimum amount of data required at end of .text */
_Min_Data_Left 0Xffff;
.text :
{
... all the usual stuff ...
PROVIDE (__data_end_rom = . );
. = . + _Min_Data_Left;
. = ALIGN(4);
} >FLASH
```
The linker will now tell you that FLASH has overflo... |
8,735,325 | I want to erase an element from the `std::list` and then point back to this list but when I do it this way
```
for(std::list<CvRect>::iterator it = listOfCvRects.begin(); it != listOfCvRects.end(); it++)
{
for(std::list<CvRect>::iterator jt = listOfCvRects.begin(); jt != listOfCvRects.end(); jt++)
{
i... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8735325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/675100/"
] | I believe the problem is that in some cases (those where you delete an element), you are double incrementing the iterator. Your for loop looks like this:
```
for(std::list<T>::iterator jt = l.begin(); jt != l.end(); jt++) {
....
}
```
But inside of it you are doing something like this:
```
jt = l.erase(jt);
`... | Erasing an element from a list invalidates iterators that point at that element, but not other iterators. So you need to do the increment before the erase:
```
for(std::list<CvRect>::iterator it = listOfCvRects.begin(); it != listOfCvRects.end(); it++) {
std::list<CvRect>::iterator jt = listOfCvRects.begin();
... |
42,521,368 | I would like to know how to decrease the brightness of certain layout(I guess they did that)?
Like in this image:
[](https://i.stack.imgur.com/qwlDe.jpg)
I tried, setting the android:alpha to 0,6, but it isn't working.
I would appreciate any help.
**... | 2017/03/01 | [
"https://Stackoverflow.com/questions/42521368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6576875/"
] | If you use autocompletion, it will hold your hand through this process.
[](https://i.stack.imgur.com/UqsDc.png)
And when you get to that field, hit enter, and then go to the end, enter a `.` (as it's clearly an enumeration), and you can see the optio... | `CFURLRef` has been renamed to `CFURL`. `URL` is toll-free bridged to `CFURL`, all you need to do is cast an url to `CFURL` using `as`.
Here's the updated code for Swift 4:
```
let audioURL: URL = ...
var audioFile: AudioFileID?
let status = AudioFileOpenURL(audioURL as CFURL,
.readPermi... |
69,935 | Let $R$ be a commutative ring and $A$ and $B$ two $R$-module. Suppose that $A$ is free of rank $n$ with basis $a\_1,\dots,a\_n$. Then there is an isomorphism $\Phi: Hom\_R(A,B) \to Hom\_R(A,R)\otimes\_R B$ defined by $\Phi(\sigma)=\sum\_{i=1}^n \psi\_i\otimes \sigma\_i$, where $\sigma\_i=\sigma(a\_i)$ and $\psi\_i$ is ... | 2011/07/10 | [
"https://mathoverflow.net/questions/69935",
"https://mathoverflow.net",
"https://mathoverflow.net/users/4821/"
] | There was an École d'été sur la conjecture de Birch et Swinnerton-Dyer in Paris in the summer of 2002. The [videos](http://bsd-2002.institut.math.jussieu.fr/videos/) of the lectures (by P. Colmez, H. Darmon, B. Edixhoven, B. Mazur, J. Nekovár, J. Oesterlé, W. Stein, E. Urban and S. Zhang)
are available. | I checked that the BSD conference was held at DPMMS, not the Isaac Newton Institute (INI). Quite a lot of video lectures are kept online at the INI website, and there is much to be learned there on many subjects. Similarly, the Mathematical Sciences Research Institute at Berkeley (MSRI) has many video lectures availabl... |
69,935 | Let $R$ be a commutative ring and $A$ and $B$ two $R$-module. Suppose that $A$ is free of rank $n$ with basis $a\_1,\dots,a\_n$. Then there is an isomorphism $\Phi: Hom\_R(A,B) \to Hom\_R(A,R)\otimes\_R B$ defined by $\Phi(\sigma)=\sum\_{i=1}^n \psi\_i\otimes \sigma\_i$, where $\sigma\_i=\sigma(a\_i)$ and $\psi\_i$ is ... | 2011/07/10 | [
"https://mathoverflow.net/questions/69935",
"https://mathoverflow.net",
"https://mathoverflow.net/users/4821/"
] | There was an École d'été sur la conjecture de Birch et Swinnerton-Dyer in Paris in the summer of 2002. The [videos](http://bsd-2002.institut.math.jussieu.fr/videos/) of the lectures (by P. Colmez, H. Darmon, B. Edixhoven, B. Mazur, J. Nekovár, J. Oesterlé, W. Stein, E. Urban and S. Zhang)
are available. | it seems that the lectures were not recorded (there are only photos on the conference website);
so there is no point in searching for the videos.
However, there are a few video excerpts available from Professor Stein's channel..small consolation.
(1) [bsd1](http://www.youtube.com/watch?v=Vo9yWAhBxAs)
(2) [bsd2](h... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | You can take a look at this code.
```
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
//How many prime numbers you want to print?
String s = bf.readLine();
... | ```
import java.util.*;
class Prime
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter the no of prime nos want: ");
int n2 = sc.nextInt();
int flag = 1 ;
int count = 0 ;
for (int i =2; i<99999;i++ )
{
for (int j=2; j<i;j++ ... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | USe isPrime(int num) method in loop to generate prime numbers example is show below code
```
public class PrimeNumbersSeries
{
public boolean isPrime(int num)
{
boolean flag=true;
for(int i=2; i<=num/2; i++)
{
if(num%i==0)
{
flag=false;
... | Here is your working code:
```
import java.io.*;
class A
{
public static void main(String s[]) throws IOException
{
int count=2;
String st;
System.out.println("how many prime no. do you want");
BufferedReader obj= new BufferedReader (new InputStre... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | Here is your working code:
```
import java.io.*;
class A
{
public static void main(String s[]) throws IOException
{
int count=2;
String st;
System.out.println("how many prime no. do you want");
BufferedReader obj= new BufferedReader (new InputStre... | ```
import java.util.*;
class Prime
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter the no of prime nos want: ");
int n2 = sc.nextInt();
int flag = 1 ;
int count = 0 ;
for (int i =2; i<99999;i++ )
{
for (int j=2; j<i;j++ ... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | USe isPrime(int num) method in loop to generate prime numbers example is show below code
```
public class PrimeNumbersSeries
{
public boolean isPrime(int num)
{
boolean flag=true;
for(int i=2; i<=num/2; i++)
{
if(num%i==0)
{
flag=false;
... | You can take a look at this code.
```
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
//How many prime numbers you want to print?
String s = bf.readLine();
... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | USe isPrime(int num) method in loop to generate prime numbers example is show below code
```
public class PrimeNumbersSeries
{
public boolean isPrime(int num)
{
boolean flag=true;
for(int i=2; i<=num/2; i++)
{
if(num%i==0)
{
flag=false;
... | After correction i got the series of prime numbers.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1,count1=0;
String st;
System.out.println("how many prime no. do you want");
BufferedReader obj= new BufferedReader (new InputSt... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | USe isPrime(int num) method in loop to generate prime numbers example is show below code
```
public class PrimeNumbersSeries
{
public boolean isPrime(int num)
{
boolean flag=true;
for(int i=2; i<=num/2; i++)
{
if(num%i==0)
{
flag=false;
... | ```
import java.util.*;
class Prime
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter the no of prime nos want: ");
int n2 = sc.nextInt();
int flag = 1 ;
int count = 0 ;
for (int i =2; i<99999;i++ )
{
for (int j=2; j<i;j++ ... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | Problem is value of num is always 2 at the start of loop,even if you say `num++` again it takes `num=2` which is start statement and wont enter into for loop ever,hence so infinite loop.This will Work
```
int num=2;
while(count!=n) {
for(int i=2;i<num;i++) {
if(num%i==0) {
count++;
... | ```
import java.util.*;
class Prime
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter the no of prime nos want: ");
int n2 = sc.nextInt();
int flag = 1 ;
int count = 0 ;
for (int i =2; i<99999;i++ )
{
for (int j=2; j<i;j++ ... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | Problem is value of num is always 2 at the start of loop,even if you say `num++` again it takes `num=2` which is start statement and wont enter into for loop ever,hence so infinite loop.This will Work
```
int num=2;
while(count!=n) {
for(int i=2;i<num;i++) {
if(num%i==0) {
count++;
... | You can take a look at this code.
```
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
//How many prime numbers you want to print?
String s = bf.readLine();
... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | After correction i got the series of prime numbers.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1,count1=0;
String st;
System.out.println("how many prime no. do you want");
BufferedReader obj= new BufferedReader (new InputSt... | ```
import java.util.*;
class Prime
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter the no of prime nos want: ");
int n2 = sc.nextInt();
int flag = 1 ;
int count = 0 ;
for (int i =2; i<99999;i++ )
{
for (int j=2; j<i;j++ ... |
32,664,939 | This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
```
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1;
String st;
System.out.println("how many prime no. do ... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32664939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5352896/"
] | Problem is value of num is always 2 at the start of loop,even if you say `num++` again it takes `num=2` which is start statement and wont enter into for loop ever,hence so infinite loop.This will Work
```
int num=2;
while(count!=n) {
for(int i=2;i<num;i++) {
if(num%i==0) {
count++;
... | Here is your working code:
```
import java.io.*;
class A
{
public static void main(String s[]) throws IOException
{
int count=2;
String st;
System.out.println("how many prime no. do you want");
BufferedReader obj= new BufferedReader (new InputStre... |
67,930,942 | I have a spreadsheet table that contains some key-value pairs but in a set for example as shown below (the order of key values is not fixed):
```
Key Value Key Value Key Value
ABC 999 JKL 888 MNO 777
DEF 555 RST 666 XYZ 444
AAA 123 NN... | 2021/06/11 | [
"https://Stackoverflow.com/questions/67930942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15562816/"
] | Save the values as an object in the form:
```
const disabledValues = {
0: 'None',
2: 'Accept',
3: 'Send',
5: 'Delivered',
};
```
Later, during a comparison, **cast your `Estatus` into the number** (adding `+` at the beginning) and use it in the form:
```
if (disabledValues[+f.Estatus]) {
tabla +... | Maybe I'm misunderstanding the question, but it sounds like you now expect `.Estatus` to contain a string instead of a number, and you still want the button disabling to work? If that's the case just change
```
disabled = [0,2,3,5]
```
to
```
disabled = ['None', 'Accept', 'Send', 'Delivered']
```
or even
```
dis... |
67,930,942 | I have a spreadsheet table that contains some key-value pairs but in a set for example as shown below (the order of key values is not fixed):
```
Key Value Key Value Key Value
ABC 999 JKL 888 MNO 777
DEF 555 RST 666 XYZ 444
AAA 123 NN... | 2021/06/11 | [
"https://Stackoverflow.com/questions/67930942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15562816/"
] | Save the values as an object in the form:
```
const disabledValues = {
0: 'None',
2: 'Accept',
3: 'Send',
5: 'Delivered',
};
```
Later, during a comparison, **cast your `Estatus` into the number** (adding `+` at the beginning) and use it in the form:
```
if (disabledValues[+f.Estatus]) {
tabla +... | Initialise you array like below, where you can customize your message.
```
const valuesToDisable = [
{
value: 0,
note: 'None'
},
{
value: 2,
note: 'Accept'
},
{
value: 3,
note: 'Send'
},
{
value: 5,
note: 'Delivered'
}
]
`... |
67,930,942 | I have a spreadsheet table that contains some key-value pairs but in a set for example as shown below (the order of key values is not fixed):
```
Key Value Key Value Key Value
ABC 999 JKL 888 MNO 777
DEF 555 RST 666 XYZ 444
AAA 123 NN... | 2021/06/11 | [
"https://Stackoverflow.com/questions/67930942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15562816/"
] | Save the values as an object in the form:
```
const disabledValues = {
0: 'None',
2: 'Accept',
3: 'Send',
5: 'Delivered',
};
```
Later, during a comparison, **cast your `Estatus` into the number** (adding `+` at the beginning) and use it in the form:
```
if (disabledValues[+f.Estatus]) {
tabla +... | First, define your statuses in an object, give them a value how a button is disabled:
```
const statuses = {
None: true,
Receipment: false,
Accept: true,
Send: true,
Process: true,
Delivered: true,
Other: false,
};
```
Then tune your code as:
```
if ($tipoproveedor != '0') {
if (statuses[f.Estatus])... |
67,930,942 | I have a spreadsheet table that contains some key-value pairs but in a set for example as shown below (the order of key values is not fixed):
```
Key Value Key Value Key Value
ABC 999 JKL 888 MNO 777
DEF 555 RST 666 XYZ 444
AAA 123 NN... | 2021/06/11 | [
"https://Stackoverflow.com/questions/67930942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15562816/"
] | Save the values as an object in the form:
```
const disabledValues = {
0: 'None',
2: 'Accept',
3: 'Send',
5: 'Delivered',
};
```
Later, during a comparison, **cast your `Estatus` into the number** (adding `+` at the beginning) and use it in the form:
```
if (disabledValues[+f.Estatus]) {
tabla +... | Just a quick idea, can be optimised further:
Your array :
```
const disabled = [
{
id: 0,
text: 'None'
},
{
id: 2,
text: 'Accept'
},
{
id: 3,
text: 'Send'
},
{
id: 5,
text: 'Delivered'
}
];
```
A function to determinate ... |
67,930,942 | I have a spreadsheet table that contains some key-value pairs but in a set for example as shown below (the order of key values is not fixed):
```
Key Value Key Value Key Value
ABC 999 JKL 888 MNO 777
DEF 555 RST 666 XYZ 444
AAA 123 NN... | 2021/06/11 | [
"https://Stackoverflow.com/questions/67930942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15562816/"
] | Save the values as an object in the form:
```
const disabledValues = {
0: 'None',
2: 'Accept',
3: 'Send',
5: 'Delivered',
};
```
Later, during a comparison, **cast your `Estatus` into the number** (adding `+` at the beginning) and use it in the form:
```
if (disabledValues[+f.Estatus]) {
tabla +... | After reading the question and all the answers I failed to understand why it's not working.
By saying "I have been forced to change these same values for strings" if the questioner means,
now the array disabled = [ "0", "2", "3", "5" ]
and typeof f.Estatus === "string" then the solution is obvious.
```js
const disa... |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Work this end (XP).
Create a new file, call it test.vbs. Put this in it.
```
WScript.Sleep 1000
MsgBox "TEST"
```
Run it, notice the delay before the message box is shown.
Note, the number is in Milliseconds, so 1000 is 1 second. | ```
WScript.Sleep 100
```
The following code should work properly. |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Here's another alternative:
```
Sub subSleep(strSeconds) ' subSleep(2)
Dim objShell
Dim strCmd
set objShell = CreateObject("wscript.Shell")
'objShell.Run cmdline,1,False
strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"
objShell.Run strCmd,0,1
End Sub
``` | Time of Sleep Function is in milliseconds (ms)
if you want 3 minutes, thats the way to do it:
```
WScript.Sleep(1000 * 60 * 3)
``` |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Here's another alternative:
```
Sub subSleep(strSeconds) ' subSleep(2)
Dim objShell
Dim strCmd
set objShell = CreateObject("wscript.Shell")
'objShell.Run cmdline,1,False
strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"
objShell.Run strCmd,0,1
End Sub
``` | As stated in this [answer](https://stackoverflow.com/questions/1544526/how-to-pause-for-specific-amount-of-time-excel-vba):
```
Application.Wait (Now + TimeValue("0:00:01"))
```
will wait for 1 second |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Work this end (XP).
Create a new file, call it test.vbs. Put this in it.
```
WScript.Sleep 1000
MsgBox "TEST"
```
Run it, notice the delay before the message box is shown.
Note, the number is in Milliseconds, so 1000 is 1 second. | If you're trying to simulate a sleep delay in VBScript but WScript is not available (eg: your script is called from Microsoft's BGInfo tool), then try the following approach.
The example below will delay until 10 seconds from the moment the instruction is processed:
```
Dim dteWait
dteWait = DateAdd("s", 10, Now())
D... |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | If you're trying to simulate a sleep delay in VBScript but WScript is not available (eg: your script is called from Microsoft's BGInfo tool), then try the following approach.
The example below will delay until 10 seconds from the moment the instruction is processed:
```
Dim dteWait
dteWait = DateAdd("s", 10, Now())
D... | The following line will make your script to sleep for 5 mins.
```
WScript.Sleep 5*60*1000
```
Note that the value passed to sleep call is in milli seconds. |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Here's another alternative:
```
Sub subSleep(strSeconds) ' subSleep(2)
Dim objShell
Dim strCmd
set objShell = CreateObject("wscript.Shell")
'objShell.Run cmdline,1,False
strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"
objShell.Run strCmd,0,1
End Sub
``` | ```
WScript.Sleep 100
```
The following code should work properly. |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Here's another alternative:
```
Sub subSleep(strSeconds) ' subSleep(2)
Dim objShell
Dim strCmd
set objShell = CreateObject("wscript.Shell")
'objShell.Run cmdline,1,False
strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"
objShell.Run strCmd,0,1
End Sub
``` | Here is an update to the solution provided by @user235218 that allows you to specify number of milliseconds you require.
Note: The -n option is the number of retries and the -w is the timeout in milliseconds for ping. I chose the 127.255.255.254 address because it is in the loopback range and ms windows doesn’t respon... |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | If you're trying to simulate a sleep delay in VBScript but WScript is not available (eg: your script is called from Microsoft's BGInfo tool), then try the following approach.
The example below will delay until 10 seconds from the moment the instruction is processed:
```
Dim dteWait
dteWait = DateAdd("s", 10, Now())
D... | Here's another alternative:
```
Sub subSleep(strSeconds) ' subSleep(2)
Dim objShell
Dim strCmd
set objShell = CreateObject("wscript.Shell")
'objShell.Run cmdline,1,False
strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"
objShell.Run strCmd,0,1
End Sub
``` |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | Here is an update to the solution provided by @user235218 that allows you to specify number of milliseconds you require.
Note: The -n option is the number of retries and the -w is the timeout in milliseconds for ping. I chose the 127.255.255.254 address because it is in the loopback range and ms windows doesn’t respon... | As stated in this [answer](https://stackoverflow.com/questions/1544526/how-to-pause-for-specific-amount-of-time-excel-vba):
```
Application.Wait (Now + TimeValue("0:00:01"))
```
will wait for 1 second |
1,729,075 | How to set delay in vbscript?
`WScript.Sleep(100)` does not work on Windows XP, Vista. | 2009/11/13 | [
"https://Stackoverflow.com/questions/1729075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210443/"
] | if it is VBScript, it should be
```
WScript.Sleep 100
```
If it is JavaScript
```
WScript.Sleep(100);
```
Time in milliseconds. WScript.Sleep 1000 results in a 1 second sleep. | better use timer:
```
Sub wait (sec)
dim temp
temp=timer
do while timer-temp<sec
loop
end Sub
``` |
248,584 | Please refer to the image to see how Storage is showing me the space division.
[](https://i.stack.imgur.com/yT0xD.png)
Its showing amount of space available correctly but the division below is incorrect as you can see it is showing 249.72 GB for Apps... | 2016/08/07 | [
"https://apple.stackexchange.com/questions/248584",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/153345/"
] | I had a [similar problem](https://apple.stackexchange.com/questions/136591/storage-only-shows-other-fluctuating-storage), and [rebuilding my Spotlight index](https://apple.stackexchange.com/a/108557/21634) solved it for me.
Simply restarting my computer (a less time costly operation), has also worked in the past. | The spotlight database and indexing process does generate the data, so if you are able to use Activity Monitor to look at all processes (or `top -u -s 10` at the unix command prompt) you might let spotlight finish indexing and see if this is a temporary situation due to poor estimates of the files on the disk.
If this... |
10,023,683 | When I try to run the project or start Tomcat I keep getting this error:
```
SEVERE: Exception loading sessions from persistent storage
java.io.InvalidClassException: com.turktrust.iab.ebs.backingbeans.MetalCikisIslemleriBean; local class incompatible: stream classdesc serialVersionUID = 5362381638722129852, local cla... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10023683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/809807/"
] | I think that `com.turktrust.iab.ebs.backingbeans.MetalCikisIslemleriBean` has been changed by anyone else in SVN, so you are getting an `java.io.InvalidClassException`.
The problem is, that you have store data (your sessions?) with the *old* version of this class on any local storage and now you are trying to load it ... | It seems that Tomcat persisted a previous version of your compiled class when it was shut down some time. Later you deployed a recompiled updated version of your applicaton. When Tomcat wants to restore the persisted session it cannot do it because he notices from the `serialVersionUID` that the class changed. If there... |
47,873 | I have a field in a repeating table in Infopath 2007 and I've saved the form to the document library and connected fields in the form to columns in the SharePoint site. The only options I see in SharrePoint when choosing properties for the repeating field are first, last, and count. First being first row and last being... | 2012/10/12 | [
"https://sharepoint.stackexchange.com/questions/47873",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/10729/"
] | According to [How to set people and group column programmatically using Client Object Model](http://passionatetechie.blogspot.dk/2012/01/how-to-set-people-and-group-column.html) this is how you set single user fields:
```
SP.User _newUser = _ctx.Web.EnsureUser("domain\\username");
_ctx.Load(_newUser);
_ctx.ExecuteQ... | The Multiple User field is internally just a LookUp Field. The following code should work:
```
var users = new Array();
users.push(SP.FieldUserValue.fromUser("userName1"));
users.push(SP.FieldUserValue.fromUser("userName2"));
item.set_item(fieldName, users);
item.update();
```
Instead of `SP.FieldUserValue.fromUse... |
47,873 | I have a field in a repeating table in Infopath 2007 and I've saved the form to the document library and connected fields in the form to columns in the SharePoint site. The only options I see in SharrePoint when choosing properties for the repeating field are first, last, and count. First being first row and last being... | 2012/10/12 | [
"https://sharepoint.stackexchange.com/questions/47873",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/10729/"
] | According to [How to set people and group column programmatically using Client Object Model](http://passionatetechie.blogspot.dk/2012/01/how-to-set-people-and-group-column.html) this is how you set single user fields:
```
SP.User _newUser = _ctx.Web.EnsureUser("domain\\username");
_ctx.Load(_newUser);
_ctx.ExecuteQ... | The above solution didn't work for me. It is described here: [Add multiple people using Javascript Client Object Model to a Field of Type SPFieldUserValue](https://sharepoint.stackexchange.com/questions/55399/add-multiple-people-using-javascript-client-object-model-to-a-field-of-type-spfi/57257#57257)
This is what wor... |
47,873 | I have a field in a repeating table in Infopath 2007 and I've saved the form to the document library and connected fields in the form to columns in the SharePoint site. The only options I see in SharrePoint when choosing properties for the repeating field are first, last, and count. First being first row and last being... | 2012/10/12 | [
"https://sharepoint.stackexchange.com/questions/47873",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/10729/"
] | The Multiple User field is internally just a LookUp Field. The following code should work:
```
var users = new Array();
users.push(SP.FieldUserValue.fromUser("userName1"));
users.push(SP.FieldUserValue.fromUser("userName2"));
item.set_item(fieldName, users);
item.update();
```
Instead of `SP.FieldUserValue.fromUse... | The above solution didn't work for me. It is described here: [Add multiple people using Javascript Client Object Model to a Field of Type SPFieldUserValue](https://sharepoint.stackexchange.com/questions/55399/add-multiple-people-using-javascript-client-object-model-to-a-field-of-type-spfi/57257#57257)
This is what wor... |
8,446,007 | I have a form on my website. When this form is submitted ( to the same page ) , a file is uploaded and all the details in the form are entered into a database. Next thing is we need to redirect to paypal for payment. Whats the best way to design this?
My form has the following fields:
name, email, password, attached f... | 2011/12/09 | [
"https://Stackoverflow.com/questions/8446007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/447429/"
] | The error occurs because the other end has disconnected and your write has failed. If you read quickly enough, it hasn't determined the connection has been lost.
There are ways to avoid this error, but the simplest thing to do is to ignore it | Recently saw this error caused by a lack of proxy set in JBoss config (I.e. standalone.xml). Add a proxy to your system properties if necessary - you can check if you need them by calling the web service with SoapUI. |
51,414,072 | Hello friends i'm new on stack. I'll wait for your helps. , i have a problem with my project. I want to set my `.game-tags-main` div height same as the img next to it.
**Img height is responsive so i Want div height to be responsive as well**.
But I donot want to use javaScript in this project.
Below are the code sn... | 2018/07/19 | [
"https://Stackoverflow.com/questions/51414072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10103006/"
] | First of all, why do you have `.games-box > div`? This is not correct according to the rules of css. I saw that you nested the `img` inside the `games-box` class. Your tag says that you are supposed to be using `flexbox`, but there is no property in the CSS where you're saying `display: flex;`. You asked the question "... | Try this code:
```
.games-box > div > div {
position: relative;
}
.games-box > div .game-tags-main {
height: 100%;
background: red;
position: absolute;
}
if you want .game-tags-main is full width just add Width="100%"....
``` |
30,286,124 | I would like to display action button as dropdown in Yii 2 gridview. How can I achieve that without using any extension?
I have added the source code bellow-
```
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\Ser... | 2015/05/17 | [
"https://Stackoverflow.com/questions/30286124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4539690/"
] | Here is how I did it:
```php
use yii\bootstrap\ButtonDropdown;
// ... GridView configuration ...
[
'class' => 'yii\grid\ActionColumn',
'template' => '{all}',
'buttons' => [
'all' => function ($url, $model, $key) {
return ButtonDropdown::widget([
'encodeLabel' => false, ... | Google "Bootstrap Dropdowns" and then replace actions in 'template'=>'{view}{update}{delete}' with what you find. Leaving these three actions instead of text.
Regards. |
38,380,791 | I am trying to locally run the [EchoBot example of the MS Bot Framework](https://github.com/Microsoft/BotBuilder/tree/master/CSharp/Samples/EchoBot), following the [updates to SDK V3](http://docs.botframework.com/en-us/support/upgrade-to-v3/), and am unable to create a dialog.
At the call to
```
Conversation.SendAsy... | 2016/07/14 | [
"https://Stackoverflow.com/questions/38380791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3626595/"
] | Apparently you can do
```
ConfigurationManager.AppSettings["BotId"] = "test";
```
And it will work. I'm not sure what is supposed to set the "BotId" field, but if you're running into this issue and just need test locally, adding this line in `MessagesController.cs` before a call to `Conversation.SendAsync` is a work... | It needs to be in web.config or app.config
```
<appSettings>
<add key="BotId" value="[Your Id]" />
<add key="MicrosoftAppId" value="[The app id]" />
<add key="MicrosoftAppPassword" value="[The client secret]" />
</appSettings>
```
The autofac magic in BotBuilder picks it up from there, and *only* from there.
... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | Under the circumstances, you're almost certainly better off skipping the check for self-assignment -- when you're only assigning one member that seems to be a simple type (probably a double), it's generally faster to do that assignment than avoid it, so you'd end up with:
```
SimpleCircle & SimpleCircle::operator=(con... | it's right way to use operator overloading
now you get your object by reference
avoiding value copying. |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | Under the circumstances, you're almost certainly better off skipping the check for self-assignment -- when you're only assigning one member that seems to be a simple type (probably a double), it's generally faster to do that assignment than avoid it, so you'd end up with:
```
SimpleCircle & SimpleCircle::operator=(con... | this might be helpful:
```
// Operator overloading in C++
//assignment operator overloading
#include<iostream>
using namespace std;
class Employee
{
private:
int idNum;
double salary;
public:
Employee ( ) {
idNum = 0, salary = 0.0;
}
void setValues (int a, int b);
void operator= (Employee &emp );
};
void Emplo... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | The second is pretty standard. You often prefer to return a reference from an assignment operator so that statements like `a = b = c;` resolve as expected. I can't think of any cases where I would want to return a copy from assignment.
One thing to note is that if you aren't needing a deep copy it's sometimes consider... | this might be helpful:
```
// Operator overloading in C++
//assignment operator overloading
#include<iostream>
using namespace std;
class Employee
{
private:
int idNum;
double salary;
public:
Employee ( ) {
idNum = 0, salary = 0.0;
}
void setValues (int a, int b);
void operator= (Employee &emp );
};
void Emplo... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | There are no problems with the second version of the assignment operator. In fact, that is the standard way for an assignment operator.
**Edit**: Note that I am referring to the return type of the assignment operator, not to the implementation itself. As has been pointed out in comments, the implementation itself is a... | ```
#include<iostream>
using namespace std;
class employee
{
int idnum;
double salary;
public:
employee(){}
employee(int a,int b)
{
idnum=a;
salary=b;
}
void dis()
{
cout<<"1st emp:"<<endl<<"idnum="<<idnum<<endl<<"salary... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | Under the circumstances, you're almost certainly better off skipping the check for self-assignment -- when you're only assigning one member that seems to be a simple type (probably a double), it's generally faster to do that assignment than avoid it, so you'd end up with:
```
SimpleCircle & SimpleCircle::operator=(con... | ```
#include<iostream>
using namespace std;
class employee
{
int idnum;
double salary;
public:
employee(){}
employee(int a,int b)
{
idnum=a;
salary=b;
}
void dis()
{
cout<<"1st emp:"<<endl<<"idnum="<<idnum<<endl<<"salary... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | There are no problems with the second version of the assignment operator. In fact, that is the standard way for an assignment operator.
**Edit**: Note that I am referring to the return type of the assignment operator, not to the implementation itself. As has been pointed out in comments, the implementation itself is a... | Under the circumstances, you're almost certainly better off skipping the check for self-assignment -- when you're only assigning one member that seems to be a simple type (probably a double), it's generally faster to do that assignment than avoid it, so you'd end up with:
```
SimpleCircle & SimpleCircle::operator=(con... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | ```
#include<iostream>
using namespace std;
class employee
{
int idnum;
double salary;
public:
employee(){}
employee(int a,int b)
{
idnum=a;
salary=b;
}
void dis()
{
cout<<"1st emp:"<<endl<<"idnum="<<idnum<<endl<<"salary... | this might be helpful:
```
// Operator overloading in C++
//assignment operator overloading
#include<iostream>
using namespace std;
class Employee
{
private:
int idNum;
double salary;
public:
Employee ( ) {
idNum = 0, salary = 0.0;
}
void setValues (int a, int b);
void operator= (Employee &emp );
};
void Emplo... |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | The second is pretty standard. You often prefer to return a reference from an assignment operator so that statements like `a = b = c;` resolve as expected. I can't think of any cases where I would want to return a copy from assignment.
One thing to note is that if you aren't needing a deep copy it's sometimes consider... | it's right way to use operator overloading
now you get your object by reference
avoiding value copying. |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | There are no problems with the second version of the assignment operator. In fact, that is the standard way for an assignment operator.
**Edit**: Note that I am referring to the return type of the assignment operator, not to the implementation itself. As has been pointed out in comments, the implementation itself is a... | it's right way to use operator overloading
now you get your object by reference
avoiding value copying. |
10,076,285 | I have used the following code for assignment operator overloading:
```
SimpleCircle SimpleCircle::operator=(const SimpleCircle & rhs)
{
if(this == &rhs)
return *this;
itsRadius = rhs.getRadius();
return *this;
}
```
My Copy Constructor is this:
```
SimpleCircle::SimpleCircle(const SimpleCirc... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10076285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784929/"
] | There are no problems with the second version of the assignment operator. In fact, that is the standard way for an assignment operator.
**Edit**: Note that I am referring to the return type of the assignment operator, not to the implementation itself. As has been pointed out in comments, the implementation itself is a... | The second is pretty standard. You often prefer to return a reference from an assignment operator so that statements like `a = b = c;` resolve as expected. I can't think of any cases where I would want to return a copy from assignment.
One thing to note is that if you aren't needing a deep copy it's sometimes consider... |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | You can start Monit in verbose/debug mode by adding `MONIT_OPTS="-v"` to `/etc/default/monit` (don't forget to restart; `/etc/init.d/monit restart`).
You can then capture the output using `tail -f /var/log/monit.log`
```
[CEST Jun 4 21:10:42] info : Starting Monit 5.17.1 daemon with http interface at [*]:2812
[C... | By default, monit logs to your system message log and you can check there to see what's happening.
Also, depending on your config, you might be logging to a different place
```
tail -f /var/log/monit
```
<http://mmonit.com/monit/documentation/monit.html#LOGGING>
Assuming defaults (as of whatever old version of mo... |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | I've had the same problem. Using monit's verbose command-line option helps a bit, but I found the best way was to create an environment as similar as possible to the monit environment and run the start/stop program from there.
```
# monit runs as superuser
$ sudo su
# the -i option ignores the inherited environment
#... | By default, monit logs to your system message log and you can check there to see what's happening.
Also, depending on your config, you might be logging to a different place
```
tail -f /var/log/monit
```
<http://mmonit.com/monit/documentation/monit.html#LOGGING>
Assuming defaults (as of whatever old version of mo... |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | Be sure to always double check your conf and monitor your processes by hand before letting monit handle everything. systat(1), top(1) and ps(1) are your friends to figure out resource usage and limits. Knowing the process you monitor is essential too.
Regarding the start and stop scripts i use a wrapper script to redi... | You can start Monit in verbose/debug mode by adding `MONIT_OPTS="-v"` to `/etc/default/monit` (don't forget to restart; `/etc/init.d/monit restart`).
You can then capture the output using `tail -f /var/log/monit.log`
```
[CEST Jun 4 21:10:42] info : Starting Monit 5.17.1 daemon with http interface at [*]:2812
[C... |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | You can start Monit in verbose/debug mode by adding `MONIT_OPTS="-v"` to `/etc/default/monit` (don't forget to restart; `/etc/init.d/monit restart`).
You can then capture the output using `tail -f /var/log/monit.log`
```
[CEST Jun 4 21:10:42] info : Starting Monit 5.17.1 daemon with http interface at [*]:2812
[C... | `monit -c /path/to/your/config -v` |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | Yeah monit isn't too easy to debug.
Here a few best practices
* use a wrapper script that sets up your log file. Write your command arguments in there while you are at it:
shell:
```
#!/usr/bin/env bash
logfile=/var/log/myjob.log
touch ${logfile}
echo $$ ": ################# Starting " $(date) "########### pid " ... | You can also try running monit validate once processes are running, to try and find out if any of them are having problems (and sometimes get more information than you would get in the log files if there are any problems). Beyond that, there's not much more you can do. |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | Be sure to always double check your conf and monitor your processes by hand before letting monit handle everything. systat(1), top(1) and ps(1) are your friends to figure out resource usage and limits. Knowing the process you monitor is essential too.
Regarding the start and stop scripts i use a wrapper script to redi... | You can also try running monit validate once processes are running, to try and find out if any of them are having problems (and sometimes get more information than you would get in the log files if there are any problems). Beyond that, there's not much more you can do. |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | Be sure to always double check your conf and monitor your processes by hand before letting monit handle everything. systat(1), top(1) and ps(1) are your friends to figure out resource usage and limits. Knowing the process you monitor is essential too.
Regarding the start and stop scripts i use a wrapper script to redi... | `monit -c /path/to/your/config -v` |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | Be sure to always double check your conf and monitor your processes by hand before letting monit handle everything. systat(1), top(1) and ps(1) are your friends to figure out resource usage and limits. Knowing the process you monitor is essential too.
Regarding the start and stop scripts i use a wrapper script to redi... | By default, monit logs to your system message log and you can check there to see what's happening.
Also, depending on your config, you might be logging to a different place
```
tail -f /var/log/monit
```
<http://mmonit.com/monit/documentation/monit.html#LOGGING>
Assuming defaults (as of whatever old version of mo... |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | I've had the same problem. Using monit's verbose command-line option helps a bit, but I found the best way was to create an environment as similar as possible to the monit environment and run the start/stop program from there.
```
# monit runs as superuser
$ sudo su
# the -i option ignores the inherited environment
#... | Yeah monit isn't too easy to debug.
Here a few best practices
* use a wrapper script that sets up your log file. Write your command arguments in there while you are at it:
shell:
```
#!/usr/bin/env bash
logfile=/var/log/myjob.log
touch ${logfile}
echo $$ ": ################# Starting " $(date) "########### pid " ... |
3,356,476 | I find debugging monit to be a major pain. Monit's shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that I can find.
The problem is, if the start or stop command in the monit script fails, it is difficult to discern what is wrong with it. Often times ... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3356476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142571/"
] | Be sure to always double check your conf and monitor your processes by hand before letting monit handle everything. systat(1), top(1) and ps(1) are your friends to figure out resource usage and limits. Knowing the process you monitor is essential too.
Regarding the start and stop scripts i use a wrapper script to redi... | Yeah monit isn't too easy to debug.
Here a few best practices
* use a wrapper script that sets up your log file. Write your command arguments in there while you are at it:
shell:
```
#!/usr/bin/env bash
logfile=/var/log/myjob.log
touch ${logfile}
echo $$ ": ################# Starting " $(date) "########### pid " ... |
19,529,464 | I'm new to C++ and I keep getting a message saying something was not declared in the scope. How do I declare stuff in the scope?
This is a bit of code I wrote, when compiling I get the message that system and return0 where not declared in the scope, how do you fix the code? How do I declare stuff in the scope?
```
#i... | 2013/10/22 | [
"https://Stackoverflow.com/questions/19529464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2909054/"
] | Firstly, you must add the include for `system`:
```
#include <cstdlib>
```
Secondly you need to add a closing parentheses on the `system` call and then put a space between `return` and `0`. E.g.:
```
system("PAUSE");
return 0;
```
As has been suggested in the comments, the use of `system` is strongly discourage... | `system()` is declared in `<cstdlib>`, and you're missing a `)` at the end of the function call.
`return0` should be `return 0` |
68,240,787 | In a `switch` statement there are a few cases where I need to parse user input in the form a string into a Date object. I'm using `java.text.SimpleDateFormat`, but instead of instantiating and calling `parse` for each case, I'd like to encapsulate the date parsing in something of a utility method. It's important that t... | 2021/07/04 | [
"https://Stackoverflow.com/questions/68240787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7332065/"
] | This largely depends on what type you're returning, and what the `Exception` *means* in terms of your method's flow.
For example, in the following case, sending a notification of the result has failed, but you can still return the result:
```java
private final Notifier notifier;
public String getResult() {
final... | ```
class MainMenu {
// a bunch of other stuff
public static Date parseStrDate (String dateStr) {
String pattern = "yyyy/mm/dd";
SimpleDateFormat dateParser = new SimpleDateFormat (pattern);
Date date = new Date (0L);
try {
date = dateParser.parse (dateStr);
... |
68,240,787 | In a `switch` statement there are a few cases where I need to parse user input in the form a string into a Date object. I'm using `java.text.SimpleDateFormat`, but instead of instantiating and calling `parse` for each case, I'd like to encapsulate the date parsing in something of a utility method. It's important that t... | 2021/07/04 | [
"https://Stackoverflow.com/questions/68240787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7332065/"
] | As BeUndead's answer says, there is no sensible default, so throwing an exception is a good choice. I think it would be better to throw a checked exception to force the caller to handle a missing date. The fact that a date may not be returned is part of the function's API and should be exposed.
There is another reason... | ```
class MainMenu {
// a bunch of other stuff
public static Date parseStrDate (String dateStr) {
String pattern = "yyyy/mm/dd";
SimpleDateFormat dateParser = new SimpleDateFormat (pattern);
Date date = new Date (0L);
try {
date = dateParser.parse (dateStr);
... |
68,240,787 | In a `switch` statement there are a few cases where I need to parse user input in the form a string into a Date object. I'm using `java.text.SimpleDateFormat`, but instead of instantiating and calling `parse` for each case, I'd like to encapsulate the date parsing in something of a utility method. It's important that t... | 2021/07/04 | [
"https://Stackoverflow.com/questions/68240787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7332065/"
] | This largely depends on what type you're returning, and what the `Exception` *means* in terms of your method's flow.
For example, in the following case, sending a notification of the result has failed, but you can still return the result:
```java
private final Notifier notifier;
public String getResult() {
final... | As BeUndead's answer says, there is no sensible default, so throwing an exception is a good choice. I think it would be better to throw a checked exception to force the caller to handle a missing date. The fact that a date may not be returned is part of the function's API and should be exposed.
There is another reason... |
68,159,298 | I need to concat two json response (attach the second to the first)
because i have a model class which is a mix of fields from the first and second response.
My code:
```
List nextR = [];
final response = await dio.get(URL);
final result = response.data;
final response2 = await dio.get(URL);
final result2 = response2... | 2021/06/28 | [
"https://Stackoverflow.com/questions/68159298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can first form bins from `breaks.time` and then assign categories to `values.time` with these bins using [`pd.cut`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.cut.html):
```
import numpy as np
# intervals to fall into
bins = [-np.inf, *breaks.time, +np.inf]
# distinct labels of 0..N-1
labe... | I came up with the following, based on [Pandas split DataFrame by column value](https://stackoverflow.com/questions/33742588/pandas-split-dataframe-by-column-value)
```
sim_dist_right = pandas.read_csv('sim/dist_right.csv', comment='#')
sim_round_indicator = pandas.read_csv('sim/round_indicator.csv', comment='#')
rou... |
266,897 | This question was originally posted in [Elements of finite order in the group of arithmetic functions under Dirichlet convolution.](https://math.stackexchange.com/questions/265446/elements-of-finite-order-in-the-group-of-arithmetic-functions-under-dirichlet-co/266702#comment582643_266702)
and it goes as follows: Let G... | 2012/12/29 | [
"https://math.stackexchange.com/questions/266897",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14921/"
] | $G$ is a certain subgroup of the multiplicative group of the *ring* of all arithmetic functions under convolution and pointwise addition. This ring is isomorphic to the ring of formal [Dirichlet series](http://en.wikipedia.org/wiki/Dirichlet_series), which is in turn isomorphic to the ring of formal power series $\math... | Your definition must include that $f(1)\not= 0$, because $f^{-1}(n)$ is recursively defined in terms of $1/f(1)$. (The formula can be found on the [Wikipedia](http://en.wikipedia.org/wiki/Dirichlet_convolution#Dirichlet_inverse).) So, denote by $\mathcal{A}$ the group of all arithmetic functions with $f(1)\not= 0$.
Le... |
266,897 | This question was originally posted in [Elements of finite order in the group of arithmetic functions under Dirichlet convolution.](https://math.stackexchange.com/questions/265446/elements-of-finite-order-in-the-group-of-arithmetic-functions-under-dirichlet-co/266702#comment582643_266702)
and it goes as follows: Let G... | 2012/12/29 | [
"https://math.stackexchange.com/questions/266897",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14921/"
] | $G$ is a certain subgroup of the multiplicative group of the *ring* of all arithmetic functions under convolution and pointwise addition. This ring is isomorphic to the ring of formal [Dirichlet series](http://en.wikipedia.org/wiki/Dirichlet_series), which is in turn isomorphic to the ring of formal power series $\math... | "However my question is: What is known in the literature about the group structure of G ?"
JOURNAL ARTICLE
Groups of Arithmetical Functions
James E. Delany
Mathematics Magazine
Vol. 78, No. 2 (Apr., 2005), pp. 83-97 |
266,897 | This question was originally posted in [Elements of finite order in the group of arithmetic functions under Dirichlet convolution.](https://math.stackexchange.com/questions/265446/elements-of-finite-order-in-the-group-of-arithmetic-functions-under-dirichlet-co/266702#comment582643_266702)
and it goes as follows: Let G... | 2012/12/29 | [
"https://math.stackexchange.com/questions/266897",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14921/"
] | Your definition must include that $f(1)\not= 0$, because $f^{-1}(n)$ is recursively defined in terms of $1/f(1)$. (The formula can be found on the [Wikipedia](http://en.wikipedia.org/wiki/Dirichlet_convolution#Dirichlet_inverse).) So, denote by $\mathcal{A}$ the group of all arithmetic functions with $f(1)\not= 0$.
Le... | "However my question is: What is known in the literature about the group structure of G ?"
JOURNAL ARTICLE
Groups of Arithmetical Functions
James E. Delany
Mathematics Magazine
Vol. 78, No. 2 (Apr., 2005), pp. 83-97 |
24,708,346 | I have built my Shared Library using NDK, that has few other libs in it. My lib has few 'extern' function defined. As it is a lib, those 'extern' functions are then declared in project (.cpp) file. I have an issue, where application *builds just fine*, and crashes on the device with the following error:
**07-12 00:45:... | 2014/07/12 | [
"https://Stackoverflow.com/questions/24708346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3270717/"
] | First of all, don't allow `LOCAL_ALLOW_UNDEFINED_SYMBOLS` in your Android.mk. Then your problem will be visible at link step.
Which **.cpp** file defines the **RTEngineSetup**? Does it include the header file that declares it as **extern "C"**?
In NDK toolchain there is **nm** utility which can show the list of symbo... | Alex!
This is amazing! thank you very much. I am new to NDK and Android coding so had to hack for 3 days straight. When you said to use dlsym(), I had no idea what i it is. But I have figured it out and everything works just perfect now.
Solution:
If your Library has C++ functions (defined) as **extern** - *extern vo... |
64,369,449 | I am trying to use a dictionary to divide its elements in order to get a value. If that value is in my criteria I wish to stop. I have managed to make it work, but I feel there must be a shorter way. If you have any suggestions or advice I would appreciate it.
```
dict1 = {1:123, 2:220, 3:290, 4:300, 5:329}
prev = 1 ... | 2020/10/15 | [
"https://Stackoverflow.com/questions/64369449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14455111/"
] | ```
require(rtidy)
require(ggplot2)
result %>%
add_rownames("model") %>%
gather("Activity","value",-model) %>%
ggplot(aes(x=Activity,y=value,color=model,group=model)) + geom_line()
```
[](https://i.stack.imgur.com/6r1Ci.png) | You could transpose the data and use `pivot_longer` to create rows for each model.
Try:
```
library(tidyverse)
data <- t(result) %>% as.data.frame %>%
rownames_to_column() %>%
pivot_longer(cols = rownames(result),names_to = "model")
ggplot(data) + geom_line(aes(group = ... |
5,384,010 | i have a BST where i insert keys from 1...n randomly *(every permutation is done with 1/n! probability)*.
my question is why the resulting trees are not *uniform* even if the permutation are *uniform* ? | 2011/03/21 | [
"https://Stackoverflow.com/questions/5384010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/476101/"
] | A lot depends on the implementation of the tree. Is it self balancing? Consider the simple trees of 1 2 3 and 3 2 1
```
Very simple tree:
add 1
1
add 2
1
\
2
add 3
1
\
2
\
3
```
then 3 2 1
add 3
```
3
add 2
3
/
2
add 1
3
/
2
/
1
```
Now do 2 3 1
```
2
2
\
3
2... | a binary search tree is not just a uniform search tree... a tree is built in the order in which new values are saved in it. as glowcoder already showed, that doesnt guarantee uniformity...
having a uniform distribution of random numbers does not guarantee an order of values that is optimal to build a binary tree
to ... |
25,189,073 | I have a problem with wraping the `img`, when `div` is expanded on button click. Without styles of `myDiv` it wraps ok.
HTML:
```
<div>
<img width='300px' src='http://freefunnydogpictures.com/wp-content/uploads/2014/05/picture_1400053660.jpg'/>
<div class='myDiv'>Утверждён Перечень сельскохозяйственной продук... | 2014/08/07 | [
"https://Stackoverflow.com/questions/25189073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045723/"
] | Indices are 0-based, so you should write `listEditText.requestFocus(list.size() - 1);`.
`list.Size()` is the smallest index (greater than 0) that is off the end of the list. | Okay, everyone seems to be missing that you have a *list* of `EditText` views. `requestFocus(int)` expects a direction, not an index. The documentation for this:
>
> Call this to try to give focus to a specific view or to one of its
> descendants and give it a hint about what direction focus is heading.
> A view wi... |
38,715,147 | I would like to configure one (and only one) of my Controller to accept only `application/xml` requests.
In the past i used IControllerConfiguration to do that like described [here (Per-Controller configuration)](https://stackoverflow.com/a/17793213/479659).
How can i do that in Aspnet Core ? | 2016/08/02 | [
"https://Stackoverflow.com/questions/38715147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479659/"
] | You can use the `Consumes`-Annotation together with the accepted content type on Controller or Action level.
With
```
[Consumes("application/xml")]
public class MyController : Controller
{
public IActionResult MyAction([FromBody] CallModel model)
{
....
}
}
```
calls to this controller will only... | 1. You may simply check Request AcceptTypes / Content-Type headers (like `if request.AcceptTypes.Contains("application/xml")`) and stop request processing.
2. Accordingly to link you provided, seems like you just want to ignore content type and always return an XML result. In this case you may use a new [Produces](http... |
4,389,463 | my css drop down menu is hidden behind a flash element I have on my site. I have tried changing the z index but still nothing. Please help.... here is the page. www.cougarguide.com | 2010/12/08 | [
"https://Stackoverflow.com/questions/4389463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524057/"
] | You'll need to set the transparency for your embedded object:
```
<object>
<param name="wmode" value="transparent">
<embed type="application/x-shockwave-flash" wmode="transparent" ... />
</object>
``` | I don't think the window mode will happen. That just makes the flash background transparent.
You have a different issue - the menu is below the flash. I looked at the code, and it seems like you are using an iframe with whole new html wrapper. I don't know how you made that website, but the menu div comes AFTER the di... |
4,389,463 | my css drop down menu is hidden behind a flash element I have on my site. I have tried changing the z index but still nothing. Please help.... here is the page. www.cougarguide.com | 2010/12/08 | [
"https://Stackoverflow.com/questions/4389463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524057/"
] | You need to change the window mode of your swf to transparent. Here is a link : <http://kb2.adobe.com/cps/142/tn_14201.html> | I don't think the window mode will happen. That just makes the flash background transparent.
You have a different issue - the menu is below the flash. I looked at the code, and it seems like you are using an iframe with whole new html wrapper. I don't know how you made that website, but the menu div comes AFTER the di... |
4,589,641 | I have a list view in which I show data. When I click on a row of the list view, I want to display data for that row from web services. How do I do that? | 2011/01/04 | [
"https://Stackoverflow.com/questions/4589641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/512383/"
] | What you do is set the `ListView`'s [`OnItemClickListener`](http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html) with the [`setOnItemClickListener`](http://developer.android.com/reference/android/widget/AdapterView.html#setOnItemClickListener%28android.widget.AdapterView.OnItemCli... | ```
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(), ((TextVie... |
67,372,873 | Code:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvheight=400)
t = turtle.Turtle()
t.pensize(0)
t.shape('square')
t.color("black")
t.speed(0)
t.penup()
def moveu(num):
t.setheading(num)
t.forward(20)
s.onkey(lambda : moveu(90), 'w')
s.onkey(lambda :... | 2021/05/03 | [
"https://Stackoverflow.com/questions/67372873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15605589/"
] | >
> I don't know how to prevent the block from moving backward.
>
>
>
As it is, your block is only moving *forward*. If you change the shape of your block from `'square'` to `'arrow'` you'll see that it is always moving in the direction it is facing. If you desire to limit it in some manner, we'll need a better de... | Like [cdlane](https://stackoverflow.com/users/5771269/cdlane) said in their [answer](https://stackoverflow.com/a/67375590/843953), your turtle *does* only move forward. However, you always *ask* it to face the direction you want and then make it move forward. Instead, you should check its current direction, and allow i... |
67,372,873 | Code:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvheight=400)
t = turtle.Turtle()
t.pensize(0)
t.shape('square')
t.color("black")
t.speed(0)
t.penup()
def moveu(num):
t.setheading(num)
t.forward(20)
s.onkey(lambda : moveu(90), 'w')
s.onkey(lambda :... | 2021/05/03 | [
"https://Stackoverflow.com/questions/67372873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15605589/"
] | You can add the condition `if (t.heading() + 180) % 360 != num:`, meaning if the opposite direction of the turtle's current heading direction isn't the direction the number passed into the function, then proceed:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvh... | >
> I don't know how to prevent the block from moving backward.
>
>
>
As it is, your block is only moving *forward*. If you change the shape of your block from `'square'` to `'arrow'` you'll see that it is always moving in the direction it is facing. If you desire to limit it in some manner, we'll need a better de... |
67,372,873 | Code:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvheight=400)
t = turtle.Turtle()
t.pensize(0)
t.shape('square')
t.color("black")
t.speed(0)
t.penup()
def moveu(num):
t.setheading(num)
t.forward(20)
s.onkey(lambda : moveu(90), 'w')
s.onkey(lambda :... | 2021/05/03 | [
"https://Stackoverflow.com/questions/67372873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15605589/"
] | >
> I don't know how to prevent the block from moving backward.
>
>
>
As it is, your block is only moving *forward*. If you change the shape of your block from `'square'` to `'arrow'` you'll see that it is always moving in the direction it is facing. If you desire to limit it in some manner, we'll need a better de... | Solution
========
So, first issue is that I did not see `turtle.mainloop()` in the code. This means that it would not stay open. So, that is the first addition to the code.
Secondly, using a simple `if` statement might just be your answer. It is way simpler than you thought.
But, first, let's look at the directions.... |
67,372,873 | Code:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvheight=400)
t = turtle.Turtle()
t.pensize(0)
t.shape('square')
t.color("black")
t.speed(0)
t.penup()
def moveu(num):
t.setheading(num)
t.forward(20)
s.onkey(lambda : moveu(90), 'w')
s.onkey(lambda :... | 2021/05/03 | [
"https://Stackoverflow.com/questions/67372873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15605589/"
] | You can add the condition `if (t.heading() + 180) % 360 != num:`, meaning if the opposite direction of the turtle's current heading direction isn't the direction the number passed into the function, then proceed:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvh... | Like [cdlane](https://stackoverflow.com/users/5771269/cdlane) said in their [answer](https://stackoverflow.com/a/67375590/843953), your turtle *does* only move forward. However, you always *ask* it to face the direction you want and then make it move forward. Instead, you should check its current direction, and allow i... |
67,372,873 | Code:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvheight=400)
t = turtle.Turtle()
t.pensize(0)
t.shape('square')
t.color("black")
t.speed(0)
t.penup()
def moveu(num):
t.setheading(num)
t.forward(20)
s.onkey(lambda : moveu(90), 'w')
s.onkey(lambda :... | 2021/05/03 | [
"https://Stackoverflow.com/questions/67372873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15605589/"
] | Like [cdlane](https://stackoverflow.com/users/5771269/cdlane) said in their [answer](https://stackoverflow.com/a/67375590/843953), your turtle *does* only move forward. However, you always *ask* it to face the direction you want and then make it move forward. Instead, you should check its current direction, and allow i... | Solution
========
So, first issue is that I did not see `turtle.mainloop()` in the code. This means that it would not stay open. So, that is the first addition to the code.
Secondly, using a simple `if` statement might just be your answer. It is way simpler than you thought.
But, first, let's look at the directions.... |
67,372,873 | Code:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvheight=400)
t = turtle.Turtle()
t.pensize(0)
t.shape('square')
t.color("black")
t.speed(0)
t.penup()
def moveu(num):
t.setheading(num)
t.forward(20)
s.onkey(lambda : moveu(90), 'w')
s.onkey(lambda :... | 2021/05/03 | [
"https://Stackoverflow.com/questions/67372873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15605589/"
] | You can add the condition `if (t.heading() + 180) % 360 != num:`, meaning if the opposite direction of the turtle's current heading direction isn't the direction the number passed into the function, then proceed:
```
import turtle
import random
import time
s = turtle.getscreen()
turtle.screensize(canvwidth=400, canvh... | Solution
========
So, first issue is that I did not see `turtle.mainloop()` in the code. This means that it would not stay open. So, that is the first addition to the code.
Secondly, using a simple `if` statement might just be your answer. It is way simpler than you thought.
But, first, let's look at the directions.... |
13,012,394 | I'm writing a chat server for [Acani](http://www.acani.com), and I have some questions about [Scaling node.js](https://stackoverflow.com/questions/4710420/scaling-node-js) and [websockets with load balancer scalability](https://stackoverflow.com/questions/8627295/websockets-with-load-balancer-scalability).
1. What exa... | 2012/10/22 | [
"https://Stackoverflow.com/questions/13012394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/242933/"
] | Well, few answers for your question:
1. To load balance Node.js, it means exactly what you thought about what it is, except that you don't really need separate server, you can run more then one process of your node server on the same machine.
2. Each server/process of your node server will have it's own connections, t... | 2) Using Redis might not work to store connections: Redis can store data in string format, and if the connecion object has circular references (ie, Engine.IO) you won't be able serialise them
3) Creating a new Redis client for each client might not be a good approach so avoid that trap if you can
Consider using ZMQ n... |
53,266 | I have an custom attribute on each product called 'sidebar' which is a yes/no option. All the products that are set to 'yes' I would like to appear inside a div I have in 3columns.phtml. All I want to display is:
* title
* image (hyperlinked)
* price
I tried the answer in <https://stackoverflow.com/questions/1332742/... | 2015/01/25 | [
"https://magento.stackexchange.com/questions/53266",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/20376/"
] | Try using attribute **option id** rather than **option label value**.
Example:
```
$collection = Mage::getResourceModel('catalog/product_collection')
->addUrlRewrite()
->addPriceData()
->addAttributeToSelect('image')
->addAttributeToFilter('sidebar', array('eq' => 1));
foreach ($collection as $produc... | use also this
```
foreach ($collection as $product) {
Zend_Debug::dump($product->toArray())
}
```
exit;
now check your needed attribute// |
272,186 | The Riemann zeta function $ζ(s)$ is defined for all complex numbers $s ≠ 1$ with a simple pole at $s = 1$. It has zeros at the **negative even integers**, i.e., at $s = −2, −4, −6, ...$.
My question: How one can obtain these roots. | 2013/01/07 | [
"https://math.stackexchange.com/questions/272186",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/53124/"
] | These roots arise from that the Riemann zeta function satisfies the following *functional equation*
$$
\zeta(s)=2^s \pi^{s-1} sin(\frac{\pi s}{2}) \Gamma(1-s)\zeta(1-s)
$$
Thus, when s=-2n, we get that
$$
\zeta(-2n)=2^{-2n} \pi^{-(2n+1)} sin(-n\pi ) \Gamma(1+2n)\zeta(1+2n)
$$
which gives us
$$
\zeta(-2n) = 0
$$... | $$\zeta(-2)=\sum\_{k=1}^\infty \frac{1}{k^{-2}}$$
Consider the example: Zeta at negative integer $-2$. To me it is never zero, it is ever growing. |
8,902,406 | I have a solution with differents projects in it, One those is an MVC 3 project, and the other is a test project.
From the test project, I'm trying to test my controllers behavior. But when I'm running a test the system throws an error telling me this:
>
> System.IO.FileNotFoundException: Could not load file or asse... | 2012/01/17 | [
"https://Stackoverflow.com/questions/8902406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925714/"
] | From your exception:
>
> System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0
>
>
>
It is trying to load MVC version 1. You probably need to do an assembly binding redirect in your test project as well, same as the one in the web.config:
```xml
<runtime>
<assemb... | Or you can add a reference to the correct dll version in the test project. |
8,902,406 | I have a solution with differents projects in it, One those is an MVC 3 project, and the other is a test project.
From the test project, I'm trying to test my controllers behavior. But when I'm running a test the system throws an error telling me this:
>
> System.IO.FileNotFoundException: Could not load file or asse... | 2012/01/17 | [
"https://Stackoverflow.com/questions/8902406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925714/"
] | From your exception:
>
> System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0
>
>
>
It is trying to load MVC version 1. You probably need to do an assembly binding redirect in your test project as well, same as the one in the web.config:
```xml
<runtime>
<assemb... | I had the same error after I installed VS 2012, none of the projects in my solution references the System.Web.Mvc. The issue was resolved for me when I added the System.Web.Mvc.dll to the GAC.
Here are the steps I did:
1. Download System.Web.Mvc 1.0 dll file.
2. Click Start, click All Programs, click Visual Studio, ... |
8,902,406 | I have a solution with differents projects in it, One those is an MVC 3 project, and the other is a test project.
From the test project, I'm trying to test my controllers behavior. But when I'm running a test the system throws an error telling me this:
>
> System.IO.FileNotFoundException: Could not load file or asse... | 2012/01/17 | [
"https://Stackoverflow.com/questions/8902406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925714/"
] | From your exception:
>
> System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0
>
>
>
It is trying to load MVC version 1. You probably need to do an assembly binding redirect in your test project as well, same as the one in the web.config:
```xml
<runtime>
<assemb... | In case anyone is looking for a solution to this problem in Visual Studio 2012, this website helped me out:
<http://www.yeronimo.nl/post/2013/03/27/Error-1-Referencesvcmap-Could-not-load-file-or-assembly-xxxxxxx-etc>
(also: <http://www.christowles.com/2012/08/could-not-load-file-or-assembly.html>)
Right-click on the... |
8,902,406 | I have a solution with differents projects in it, One those is an MVC 3 project, and the other is a test project.
From the test project, I'm trying to test my controllers behavior. But when I'm running a test the system throws an error telling me this:
>
> System.IO.FileNotFoundException: Could not load file or asse... | 2012/01/17 | [
"https://Stackoverflow.com/questions/8902406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925714/"
] | I had the same error after I installed VS 2012, none of the projects in my solution references the System.Web.Mvc. The issue was resolved for me when I added the System.Web.Mvc.dll to the GAC.
Here are the steps I did:
1. Download System.Web.Mvc 1.0 dll file.
2. Click Start, click All Programs, click Visual Studio, ... | Or you can add a reference to the correct dll version in the test project. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.