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 |
|---|---|---|---|---|---|
31,541,814 | There are topics online that are discussing this problem however, I couldn't find any tidy explanation of the problem or any solid answers for the question. What I am trying to achieve is connecting Laravel 5.1 to MySQL Database of MAMP.
---
In my ***config>app.php:***
```
'default' => env('DB_CONNECTION', 'mysql... | 2015/07/21 | [
"https://Stackoverflow.com/questions/31541814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4705339/"
] | On mac or unix you have to include the socket path in the configuration database.php file
i.e `'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',` | The most important thing for me was defining the UNIX socket. Because I have another MYSQL on my machine - Laravel was trying to connect to a database in that MYSQL process.
Defining the UNIX for the MAMP database to be used worked perfectly. Try adding this to your MYSQL configuration in database.php
```
'mysql'... |
31,541,814 | There are topics online that are discussing this problem however, I couldn't find any tidy explanation of the problem or any solid answers for the question. What I am trying to achieve is connecting Laravel 5.1 to MySQL Database of MAMP.
---
In my ***config>app.php:***
```
'default' => env('DB_CONNECTION', 'mysql... | 2015/07/21 | [
"https://Stackoverflow.com/questions/31541814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4705339/"
] | The most important thing for me was defining the UNIX socket. Because I have another MYSQL on my machine - Laravel was trying to connect to a database in that MYSQL process.
Defining the UNIX for the MAMP database to be used worked perfectly. Try adding this to your MYSQL configuration in database.php
```
'mysql'... | As far as I am concerned it doesn't make any sense to set in **database.php** as many of them suggested.
Since this change would be mostly required in the **development mode**. So the proper way of setting the **unix\_socket** is as below
file: **.env**
```
DB_SOCKET='/Applications/MAMP/tmp/mysql/mysql.sock'
```
... |
31,541,814 | There are topics online that are discussing this problem however, I couldn't find any tidy explanation of the problem or any solid answers for the question. What I am trying to achieve is connecting Laravel 5.1 to MySQL Database of MAMP.
---
In my ***config>app.php:***
```
'default' => env('DB_CONNECTION', 'mysql... | 2015/07/21 | [
"https://Stackoverflow.com/questions/31541814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4705339/"
] | On mac or unix you have to include the socket path in the configuration database.php file
i.e `'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',` | As far as I am concerned it doesn't make any sense to set in **database.php** as many of them suggested.
Since this change would be mostly required in the **development mode**. So the proper way of setting the **unix\_socket** is as below
file: **.env**
```
DB_SOCKET='/Applications/MAMP/tmp/mysql/mysql.sock'
```
... |
21,328,507 | I want to generate sequential outcomes for a 3X5 slot machine.
I have 5 reels of different length, e.g:
```
reel1 = [1,2,3,4,5],
reel2 = [2,3,4,5,6,7],
reel3 = [3,4,5,6,7,8,9],
reel4 = [4,5,6,7,8,9,0,1],
reel5 = [0,1,2].
```
Right now I'm using Python for loop to generate the result, but I think it may not be a... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21328507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2774993/"
] | If you want random outcomes, you can use [`random.choice`](http://docs.python.org/2.7/library/random.html#random.choice):
```
from random import choice
reels = [reel1, reel2, ...]
outcome = [choice(reel) for reel in reels]
```
If you want all outcomes, use [`itertools.product`](http://docs.python.org/2/library/itert... | Not sure what you call "to generate sequential outcomes". If what you have in mind is the enumeration of all possible outcomes, keep using the five loops: there will be 5 x 6 x 7 x 8 x 3 = 5040 different combinations, not such a big number.
Even 5 reels of 20 digits would remain quite manageable using Python (3200000 ... |
1,191,444 | I'd like to ask if there's a way to make chrome extension ONLY activated in incognito mode.
I only want the extension activated in incognito mode and disabled in normal browsing.
I do hope there's a way and thanks in advance. | 2017/03/23 | [
"https://superuser.com/questions/1191444",
"https://superuser.com",
"https://superuser.com/users/710152/"
] | You can't do exactly this.
Closest way is to create a separate Chrome Profile and install extensions there. | You can do this but for that you require Opera Browser. Activating Extensions Only in Incognito is not possible in Chrome, Switch to Opera. |
5,862,229 | I have an application that displays the contents of messages in an MSMQ message queue. There is a problem with MSMQ on Windows 7 not preserving the true object type of the data in the message body. In the example, I send a byte[], and then later when I receive it, it's no longer a byte array, but the wrapped XML contai... | 2011/05/02 | [
"https://Stackoverflow.com/questions/5862229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/735072/"
] | Use the Message.BodyStream property if you want to send an array of bytes:
```
System.Messaging.MessageQueue queue = new MessageQueue(queueFormatName, false, true, QueueAccessMode.Send);
System.Messaging.Message msg = new System.Messaging.Message();
msg.BodyStream = new MemoryStream(buffer);
queue.Send(msg, MessageQ... | Use `Message.BodyStream` property for sending and receiving message, take a look at code below you can send and receive `byte[]` using it.
```
public void SendMessage()
{
MessageQueue myQueue = new MessageQueue(".\\QUEUE");
byte[] msg = new byte[2];
msg[0] = 29;
// Send the array to the ... |
9,997,550 | I have seen several post regarding making a build in Jenkins fail if the unit test execution fail (e.g. this [one](https://stackoverflow.com/questions/6681880/how-to-make-jenkins-display-fail-if-one-of-the-ant-tests-fail)). It turns out that by default Jenkins reports builds with failing tests as `unstable` and some pe... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9997550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108032/"
] | You have two options:
Either use the `AsyncTask`'s method `get(long timeout, TimeUnit unit)` like that:
```
task.get(1000, TimeUnit.MILLISECONDS);
```
This will make your main thread wait for the result of the `AsyncTask` at most 1000 milliseconds (as per @user1028741 comment: actually there is also infinetly waiti... | ```
intent = new Intent(this, OrdineCreaActivity.class);
context.startActivityForResult(intent, R.id.buttonPagamenti);
```
Write the above lines in onPostExecute() of you AysncTask. Because if we are using AsyncTask it wont wait there until the task complete. |
9,997,550 | I have seen several post regarding making a build in Jenkins fail if the unit test execution fail (e.g. this [one](https://stackoverflow.com/questions/6681880/how-to-make-jenkins-display-fail-if-one-of-the-ant-tests-fail)). It turns out that by default Jenkins reports builds with failing tests as `unstable` and some pe... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9997550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108032/"
] | You have two options:
Either use the `AsyncTask`'s method `get(long timeout, TimeUnit unit)` like that:
```
task.get(1000, TimeUnit.MILLISECONDS);
```
This will make your main thread wait for the result of the `AsyncTask` at most 1000 milliseconds (as per @user1028741 comment: actually there is also infinetly waiti... | try using
```
if (AppHelper.isOnline(this))
{
while(!task.isCancelled()){
// waiting until finished protected String[] doInBackground(Void... params)
}
intent = new Intent(this, OrdineCreaActivity.class);
this.startActivityForResult(in... |
9,997,550 | I have seen several post regarding making a build in Jenkins fail if the unit test execution fail (e.g. this [one](https://stackoverflow.com/questions/6681880/how-to-make-jenkins-display-fail-if-one-of-the-ant-tests-fail)). It turns out that by default Jenkins reports builds with failing tests as `unstable` and some pe... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9997550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108032/"
] | You have two options:
Either use the `AsyncTask`'s method `get(long timeout, TimeUnit unit)` like that:
```
task.get(1000, TimeUnit.MILLISECONDS);
```
This will make your main thread wait for the result of the `AsyncTask` at most 1000 milliseconds (as per @user1028741 comment: actually there is also infinetly waiti... | Rafiq's response did not work for me - the app hung. I think the reason has to do with the nature of isCancelled(): "Returns true if this task was cancelled before it completed normally." If the task completes normally (i.e. is not cancelled) then `while(!task.isCancelled()) { }` will loop forever.
To solve this creat... |
9,997,550 | I have seen several post regarding making a build in Jenkins fail if the unit test execution fail (e.g. this [one](https://stackoverflow.com/questions/6681880/how-to-make-jenkins-display-fail-if-one-of-the-ant-tests-fail)). It turns out that by default Jenkins reports builds with failing tests as `unstable` and some pe... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9997550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108032/"
] | try using
```
if (AppHelper.isOnline(this))
{
while(!task.isCancelled()){
// waiting until finished protected String[] doInBackground(Void... params)
}
intent = new Intent(this, OrdineCreaActivity.class);
this.startActivityForResult(in... | ```
intent = new Intent(this, OrdineCreaActivity.class);
context.startActivityForResult(intent, R.id.buttonPagamenti);
```
Write the above lines in onPostExecute() of you AysncTask. Because if we are using AsyncTask it wont wait there until the task complete. |
9,997,550 | I have seen several post regarding making a build in Jenkins fail if the unit test execution fail (e.g. this [one](https://stackoverflow.com/questions/6681880/how-to-make-jenkins-display-fail-if-one-of-the-ant-tests-fail)). It turns out that by default Jenkins reports builds with failing tests as `unstable` and some pe... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9997550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108032/"
] | Rafiq's response did not work for me - the app hung. I think the reason has to do with the nature of isCancelled(): "Returns true if this task was cancelled before it completed normally." If the task completes normally (i.e. is not cancelled) then `while(!task.isCancelled()) { }` will loop forever.
To solve this creat... | ```
intent = new Intent(this, OrdineCreaActivity.class);
context.startActivityForResult(intent, R.id.buttonPagamenti);
```
Write the above lines in onPostExecute() of you AysncTask. Because if we are using AsyncTask it wont wait there until the task complete. |
16,377 | My cat catches a lot of mice and birds. It always leaves the heart, perfectly intact. My question is, what about the tails of the mice, the feathers of the birds? I sometimes find some feathers but never all of them. Does the cat eat it, and why does it leave the heart? | 2017/02/10 | [
"https://pets.stackexchange.com/questions/16377",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/-1/"
] | Cats are very picky with what they eat. Although hearts have a lot of good nutrients for cats, if a cat doesnt like the texture or taste, it might just reject it. Cats most likely won't eat the feathers or the tails, as they are harder to digest, but might occasionally eat a few.
Although this is unrelated, and not a... | Maybe the hearts are too tough to eat even with their sharp teeth, or maybe they are actually poisonous and therefore inedible. If either is the case, the cat knows, and therefore leaves it alone. As for the feathers, I think they are discarded since they're most likely as useless to the cat as the hearts. |
16,377 | My cat catches a lot of mice and birds. It always leaves the heart, perfectly intact. My question is, what about the tails of the mice, the feathers of the birds? I sometimes find some feathers but never all of them. Does the cat eat it, and why does it leave the heart? | 2017/02/10 | [
"https://pets.stackexchange.com/questions/16377",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/-1/"
] | Cats remove the feathers by licking them, and they’ll inevitably swallow some of them in the process; their mouth structure doesn’t really allow spitting stuff out like ours does.
If it’s “your” cat, I assume you feed them? If so, they hunt primarily because their instincts tell them to, not for nutrition. They may ea... | Maybe the hearts are too tough to eat even with their sharp teeth, or maybe they are actually poisonous and therefore inedible. If either is the case, the cat knows, and therefore leaves it alone. As for the feathers, I think they are discarded since they're most likely as useless to the cat as the hearts. |
16,377 | My cat catches a lot of mice and birds. It always leaves the heart, perfectly intact. My question is, what about the tails of the mice, the feathers of the birds? I sometimes find some feathers but never all of them. Does the cat eat it, and why does it leave the heart? | 2017/02/10 | [
"https://pets.stackexchange.com/questions/16377",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/-1/"
] | Cats are very picky with what they eat. Although hearts have a lot of good nutrients for cats, if a cat doesnt like the texture or taste, it might just reject it. Cats most likely won't eat the feathers or the tails, as they are harder to digest, but might occasionally eat a few.
Although this is unrelated, and not a... | Cats remove the feathers by licking them, and they’ll inevitably swallow some of them in the process; their mouth structure doesn’t really allow spitting stuff out like ours does.
If it’s “your” cat, I assume you feed them? If so, they hunt primarily because their instincts tell them to, not for nutrition. They may ea... |
21,289,637 | Hello I am trying to insert into a database and I am getting the error:
```
SQL Exception: java.sql.SQLException: Parameter index out of range (6 > number of parameters, which is 5).
```
The code causing this is:
```
PreparedStatement st = connection.prepareStatement("INSERT INTO Members VALUES ('?','?','?','?',... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3211740/"
] | You should not quote your `?` placeholders, even if they represent string data. Quoted question marks will be intrepreted as literal `'?'` strings. It's probably interpreted as 5 parameters because your 6th to last parameter has two `'` characters, so your last 5 `?`s are interpreted as outside of single-quotes.
Try
... | You do not need the `'` surrounding the `?`'s.
```
PreparedStatement st = connection.prepareStatement("INSERT INTO Members VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
```
`BUT` the real problem here is you double single quoted one of the `?` to look like :`'?'',` |
21,289,637 | Hello I am trying to insert into a database and I am getting the error:
```
SQL Exception: java.sql.SQLException: Parameter index out of range (6 > number of parameters, which is 5).
```
The code causing this is:
```
PreparedStatement st = connection.prepareStatement("INSERT INTO Members VALUES ('?','?','?','?',... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3211740/"
] | You should not quote your `?` placeholders, even if they represent string data. Quoted question marks will be intrepreted as literal `'?'` strings. It's probably interpreted as 5 parameters because your 6th to last parameter has two `'` characters, so your last 5 `?`s are interpreted as outside of single-quotes.
Try
... | There is a mistake in your sample code at line
`preparedStatement` if you have done the same mistake in your original code then it will not work!
Check out the question marks and `'` you don't need `'` |
21,289,637 | Hello I am trying to insert into a database and I am getting the error:
```
SQL Exception: java.sql.SQLException: Parameter index out of range (6 > number of parameters, which is 5).
```
The code causing this is:
```
PreparedStatement st = connection.prepareStatement("INSERT INTO Members VALUES ('?','?','?','?',... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3211740/"
] | You should not quote your `?` placeholders, even if they represent string data. Quoted question marks will be intrepreted as literal `'?'` strings. It's probably interpreted as 5 parameters because your 6th to last parameter has two `'` characters, so your last 5 `?`s are interpreted as outside of single-quotes.
Try
... | replace '?' by ?
```
INSERT INTO Members VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
``` |
30,746,586 | I have some scala futures. I can easily run them in parallel with `Future.sequence`. I can also run them one-after-another with something like this:
```
def serFut[A, B](l: Iterable[A])(fn: A ⇒ Future[B]) : Future[List[B]] =
l.foldLeft(Future(List.empty[B])) {
(previousFuture, next) ⇒
for {
previou... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30746586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/662694/"
] | You should accumulate the results in a dictionary. You should use the values of 'a' and 'b' to form a key of this dictionary
Here, I have used a `defaultdict` to accumulate the entries
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e':... | My approach is to sort the the combined list by the *key*, which is keys `a` + `b`. After that, for each group of dictionaries with similar key, combine them:
```
from itertools import groupby
def ab_key(dic):
return dic['a'], dic['b']
def combine_lists_of_dicts(list_of_dic1, list_of_dic2, keyfunc):
for key,... |
30,746,586 | I have some scala futures. I can easily run them in parallel with `Future.sequence`. I can also run them one-after-another with something like this:
```
def serFut[A, B](l: Iterable[A])(fn: A ⇒ Future[B]) : Future[List[B]] =
l.foldLeft(Future(List.empty[B])) {
(previousFuture, next) ⇒
for {
previou... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30746586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/662694/"
] | You should accumulate the results in a dictionary. You should use the values of 'a' and 'b' to form a key of this dictionary
Here, I have used a `defaultdict` to accumulate the entries
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e':... | Simple list operations would do the thing for you as well:
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
l3 = []
for i in range(len(l1)):
for j in range(len(l2)):
if l1[i]['a'] == l2[j]['a'] and l1[i]['b'] == l2[... |
30,746,586 | I have some scala futures. I can easily run them in parallel with `Future.sequence`. I can also run them one-after-another with something like this:
```
def serFut[A, B](l: Iterable[A])(fn: A ⇒ Future[B]) : Future[List[B]] =
l.foldLeft(Future(List.empty[B])) {
(previousFuture, next) ⇒
for {
previou... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30746586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/662694/"
] | You should accumulate the results in a dictionary. You should use the values of 'a' and 'b' to form a key of this dictionary
Here, I have used a `defaultdict` to accumulate the entries
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e':... | One can achieve a nice and quick solution using pandas.
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
import pandas as pd
pd.DataFrame(l1).merge(pd.DataFrame(l2), on=['a','b']).to_dict('records')
``` |
30,746,586 | I have some scala futures. I can easily run them in parallel with `Future.sequence`. I can also run them one-after-another with something like this:
```
def serFut[A, B](l: Iterable[A])(fn: A ⇒ Future[B]) : Future[List[B]] =
l.foldLeft(Future(List.empty[B])) {
(previousFuture, next) ⇒
for {
previou... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30746586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/662694/"
] | Simple list operations would do the thing for you as well:
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
l3 = []
for i in range(len(l1)):
for j in range(len(l2)):
if l1[i]['a'] == l2[j]['a'] and l1[i]['b'] == l2[... | My approach is to sort the the combined list by the *key*, which is keys `a` + `b`. After that, for each group of dictionaries with similar key, combine them:
```
from itertools import groupby
def ab_key(dic):
return dic['a'], dic['b']
def combine_lists_of_dicts(list_of_dic1, list_of_dic2, keyfunc):
for key,... |
30,746,586 | I have some scala futures. I can easily run them in parallel with `Future.sequence`. I can also run them one-after-another with something like this:
```
def serFut[A, B](l: Iterable[A])(fn: A ⇒ Future[B]) : Future[List[B]] =
l.foldLeft(Future(List.empty[B])) {
(previousFuture, next) ⇒
for {
previou... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30746586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/662694/"
] | My approach is to sort the the combined list by the *key*, which is keys `a` + `b`. After that, for each group of dictionaries with similar key, combine them:
```
from itertools import groupby
def ab_key(dic):
return dic['a'], dic['b']
def combine_lists_of_dicts(list_of_dic1, list_of_dic2, keyfunc):
for key,... | One can achieve a nice and quick solution using pandas.
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
import pandas as pd
pd.DataFrame(l1).merge(pd.DataFrame(l2), on=['a','b']).to_dict('records')
``` |
30,746,586 | I have some scala futures. I can easily run them in parallel with `Future.sequence`. I can also run them one-after-another with something like this:
```
def serFut[A, B](l: Iterable[A])(fn: A ⇒ Future[B]) : Future[List[B]] =
l.foldLeft(Future(List.empty[B])) {
(previousFuture, next) ⇒
for {
previou... | 2015/06/10 | [
"https://Stackoverflow.com/questions/30746586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/662694/"
] | Simple list operations would do the thing for you as well:
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
l3 = []
for i in range(len(l1)):
for j in range(len(l2)):
if l1[i]['a'] == l2[j]['a'] and l1[i]['b'] == l2[... | One can achieve a nice and quick solution using pandas.
```
l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
import pandas as pd
pd.DataFrame(l1).merge(pd.DataFrame(l2), on=['a','b']).to_dict('records')
``` |
58,947,053 | I am confused about what is business logic. I assume that it is written in Controller but then I search it on internet but i found that many person say that it refers to model. I am highly confused. And somee community meembers give me suggestions that my question is same but you are doing mistake. I am confused by the... | 2019/11/20 | [
"https://Stackoverflow.com/questions/58947053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12302811/"
] | You can use `array_filter` with `callback` to return only type which is checkbox.
```
$filtered = array_filter($array, function($v){return $v['type'] == 'checkbox' && $v['is_active'] == 1;});
```
Working example :- <https://3v4l.org/idAR4> | Edit of answer @Rakesh Jakhar
One more condition added as per the question
```
<?php
// Your code here!
$actions = array(
array(
'type' => 'checkbox',
'id' => 'f0',
'is_active' => 1
),
array(
'type' => 'checkbox',
'id' => 'f1',
'is_ac... |
58,947,053 | I am confused about what is business logic. I assume that it is written in Controller but then I search it on internet but i found that many person say that it refers to model. I am highly confused. And somee community meembers give me suggestions that my question is same but you are doing mistake. I am confused by the... | 2019/11/20 | [
"https://Stackoverflow.com/questions/58947053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12302811/"
] | You can use `array_filter` with `callback` to return only type which is checkbox.
```
$filtered = array_filter($array, function($v){return $v['type'] == 'checkbox' && $v['is_active'] == 1;});
```
Working example :- <https://3v4l.org/idAR4> | You also can sue `array_reduce`, [Demo](https://3v4l.org/CnX47)
```
$filtered = array_reduce($array, function($a,$b){
if($b['type'] == 'checkbox' && $b['is_active'] == 1){
$a[] = $b;
return $a;
}else{
return $a;
}},[]);
print_r($filtered);
``` |
58,947,053 | I am confused about what is business logic. I assume that it is written in Controller but then I search it on internet but i found that many person say that it refers to model. I am highly confused. And somee community meembers give me suggestions that my question is same but you are doing mistake. I am confused by the... | 2019/11/20 | [
"https://Stackoverflow.com/questions/58947053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12302811/"
] | Edit of answer @Rakesh Jakhar
One more condition added as per the question
```
<?php
// Your code here!
$actions = array(
array(
'type' => 'checkbox',
'id' => 'f0',
'is_active' => 1
),
array(
'type' => 'checkbox',
'id' => 'f1',
'is_ac... | You also can sue `array_reduce`, [Demo](https://3v4l.org/CnX47)
```
$filtered = array_reduce($array, function($a,$b){
if($b['type'] == 'checkbox' && $b['is_active'] == 1){
$a[] = $b;
return $a;
}else{
return $a;
}},[]);
print_r($filtered);
``` |
11,424 | Me and my sister in law bought a house. We asked her help to acquire the loan. She signed the mortgage loan for a 5 year contract, and we got the house. Me and my wife paid all the expenses and down payment for the house, my sister in law never gave a single cent for acquiring the house.
The title stated she has 5% sh... | 2016/07/07 | [
"https://law.stackexchange.com/questions/11424",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/-1/"
] | I can't help with the relationship issues: here are the legal issues.
1. She legally owns 5% of the house and you own 95%
2. I presume that the loan agreement is a contract between you, her and the lender so removing her name from the loan is at the discretion of the lender, not you or her. I would be very surprised i... | You don't need to do anything - (or I won't) let her move to perfect her claimed interest. You have facts to show pattern of payment (600 that sets a contract) and other facts which would result in minimum costs - 1st get a comparable value of the house -in order to determine what 5% represents - let's say, the house n... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | Without seeing the exact problem that you are running into I would suggest using
```
GDK_SCALE=x
```
or
```
GDK_DPI_SCALE=x
```
Before starting each application. You will likely have to manually change `.desktop` files or run from your shell prefixing the commands with `GDK_SCALE=x`
`GDK_SCALE` only allow inter... | [Vncdesk](https://github.com/feklee/vncdesk "VNCdesk") gives you a solution based on a local VNC client-server (see [here](https://unix.stackexchange.com/questions/192493/how-to-use-xfig-on-high-dpi-screen))
It is not a complete solution for me because it gives some problems if the app need a window manager. |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | I finally managed to find a solution that scales old applications without any noticeable visual or performance degradation.
Thanks to kaueraal, you can now scale old applications using `run_scaled`. You can obtain the script from either his [GitHub page](https://github.com/kaueraal/run_scaled) or as part of the `xpra`... | Without seeing the exact problem that you are running into I would suggest using
```
GDK_SCALE=x
```
or
```
GDK_DPI_SCALE=x
```
Before starting each application. You will likely have to manually change `.desktop` files or run from your shell prefixing the commands with `GDK_SCALE=x`
`GDK_SCALE` only allow inter... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | Without seeing the exact problem that you are running into I would suggest using
```
GDK_SCALE=x
```
or
```
GDK_DPI_SCALE=x
```
Before starting each application. You will likely have to manually change `.desktop` files or run from your shell prefixing the commands with `GDK_SCALE=x`
`GDK_SCALE` only allow inter... | I have an application that spawns many windows, and I cannot at the moment use `xpra` as is required by the accepted run\_scaled solution. I also can't tolerate gnome-tweak-tool's 2x scaling. Too huge. Need 1.5x.
I have discovered that the tigerVNC java client supports client-side display scaling of 150%.
So I start ... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | Without seeing the exact problem that you are running into I would suggest using
```
GDK_SCALE=x
```
or
```
GDK_DPI_SCALE=x
```
Before starting each application. You will likely have to manually change `.desktop` files or run from your shell prefixing the commands with `GDK_SCALE=x`
`GDK_SCALE` only allow inter... | I think I've found a GPU-accelerated solution! Install `weston` and run this:
```
weston --xwayland --scale=2
DISPLAY=:1 your_app
```
That's it!
Tuning
------
Note 1: You may have noticed a magical number has been used, `DISPLAY=:1`. The underlying assumption here was that your main xorg display is `:0`. If it's n... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | I finally managed to find a solution that scales old applications without any noticeable visual or performance degradation.
Thanks to kaueraal, you can now scale old applications using `run_scaled`. You can obtain the script from either his [GitHub page](https://github.com/kaueraal/run_scaled) or as part of the `xpra`... | [Vncdesk](https://github.com/feklee/vncdesk "VNCdesk") gives you a solution based on a local VNC client-server (see [here](https://unix.stackexchange.com/questions/192493/how-to-use-xfig-on-high-dpi-screen))
It is not a complete solution for me because it gives some problems if the app need a window manager. |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | [Vncdesk](https://github.com/feklee/vncdesk "VNCdesk") gives you a solution based on a local VNC client-server (see [here](https://unix.stackexchange.com/questions/192493/how-to-use-xfig-on-high-dpi-screen))
It is not a complete solution for me because it gives some problems if the app need a window manager. | I think I've found a GPU-accelerated solution! Install `weston` and run this:
```
weston --xwayland --scale=2
DISPLAY=:1 your_app
```
That's it!
Tuning
------
Note 1: You may have noticed a magical number has been used, `DISPLAY=:1`. The underlying assumption here was that your main xorg display is `:0`. If it's n... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | I finally managed to find a solution that scales old applications without any noticeable visual or performance degradation.
Thanks to kaueraal, you can now scale old applications using `run_scaled`. You can obtain the script from either his [GitHub page](https://github.com/kaueraal/run_scaled) or as part of the `xpra`... | I have an application that spawns many windows, and I cannot at the moment use `xpra` as is required by the accepted run\_scaled solution. I also can't tolerate gnome-tweak-tool's 2x scaling. Too huge. Need 1.5x.
I have discovered that the tigerVNC java client supports client-side display scaling of 150%.
So I start ... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | I finally managed to find a solution that scales old applications without any noticeable visual or performance degradation.
Thanks to kaueraal, you can now scale old applications using `run_scaled`. You can obtain the script from either his [GitHub page](https://github.com/kaueraal/run_scaled) or as part of the `xpra`... | I think I've found a GPU-accelerated solution! Install `weston` and run this:
```
weston --xwayland --scale=2
DISPLAY=:1 your_app
```
That's it!
Tuning
------
Note 1: You may have noticed a magical number has been used, `DISPLAY=:1`. The underlying assumption here was that your main xorg display is `:0`. If it's n... |
950,794 | I am running Gnome Shell with a 4k monitor and there are a few applications that I use that don't scale at all with the high resolution.
Here is an example of LMMS, an application that hasn't yet been ported Qt 5, so it doesn't have high dpi scaling capabilities:
[](h... | 2015/08/04 | [
"https://superuser.com/questions/950794",
"https://superuser.com",
"https://superuser.com/users/61024/"
] | I have an application that spawns many windows, and I cannot at the moment use `xpra` as is required by the accepted run\_scaled solution. I also can't tolerate gnome-tweak-tool's 2x scaling. Too huge. Need 1.5x.
I have discovered that the tigerVNC java client supports client-side display scaling of 150%.
So I start ... | I think I've found a GPU-accelerated solution! Install `weston` and run this:
```
weston --xwayland --scale=2
DISPLAY=:1 your_app
```
That's it!
Tuning
------
Note 1: You may have noticed a magical number has been used, `DISPLAY=:1`. The underlying assumption here was that your main xorg display is `:0`. If it's n... |
57,059,368 | I have a pointer `uvw(:,:)` which is two-dimensional, and I got a 1d buffer array `x(:)`.
Now I need to point `uvw(1,:)=>x(1:ncell)` and `uvw(2,:)=>x(ncell+1:ncell*2)` etc.
I made a very simple example. I know that array of pointers does not work, but does anybody have an idea how this can be worked around?
PS: F... | 2019/07/16 | [
"https://Stackoverflow.com/questions/57059368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8889824/"
] | You are trying to perform *pointer bounds remapping*, but you have the incorrect syntax and approach.
Pointer bounds remapping is a way to have the shape of the pointer different from that of the target. In particular, the rank of the pointer and target may differ. However, in such an assignment it is necessary to exp... | If you prefer avoiding a pointer, then the UNION/MAP is an option depending on compiler. It was added to gfortran a while ago... then you can think of the array as a rank=2 but also use the vector (Rank=1) for SIMD operations.
All this assumes that one wants to avoid pointers... |
30,893,505 | I've been making a game with Corona SDK. I'm trying display an image in the middle of the screen, but it displays in the random location. Image that I'm trying to display is circle.png. Please help me if you can.
Here is the code:
local composer = require( "composer" )
```
strong textlocal scene = composer.newScen... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30893505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5019687/"
] | Just try this ,
```
local cirlce = display.newImageRect(sceneGroup, "images/gamescreen/circle.png", 184, 179)
cirlce.x = display.viewableContentWidth/2
cirlce.y = display.viewableContentHeight/2
``` | Give This a try.
```
local cirlce = display.newImageRect("images/gamescreen/circle.png", 184, 179)
cirlce.x = centerX
cirlce.y = centerY
``` |
82,435 | When I train a neural network, I observe an increasing validation loss, while at the same time, the validation accuracy is also increased.
I have read explanations related to the phenomenon, and it seems an increasing validation loss and validation accuracy signifies an overfitted model.
However, I have not really gr... | 2020/10/01 | [
"https://datascience.stackexchange.com/questions/82435",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/103610/"
] | Consider a simple example where the cost function to be a parabola $y=x^2$ which is convex(ideal case) with a one global minima at $x=0$
Here your $y$ is the independent variable and $x$ is the dependent variable, analogus to the weights of model that you are trying to learn.
This is how it would look like.
[![enter... | Computing the gradient gives you the direction where the function increases the most. Consider f: x -> x^2 , the gradient in x=1 is 2, if you want to minimize the function you need to go in the direction of -2, same with x=-1 as the gradient is -2.
And as gradients are usually vectors, I don't know what a positive or ... |
82,435 | When I train a neural network, I observe an increasing validation loss, while at the same time, the validation accuracy is also increased.
I have read explanations related to the phenomenon, and it seems an increasing validation loss and validation accuracy signifies an overfitted model.
However, I have not really gr... | 2020/10/01 | [
"https://datascience.stackexchange.com/questions/82435",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/103610/"
] | Consider a simple example where the cost function to be a parabola $y=x^2$ which is convex(ideal case) with a one global minima at $x=0$
Here your $y$ is the independent variable and $x$ is the dependent variable, analogus to the weights of model that you are trying to learn.
This is how it would look like.
[![enter... | Let $F : \mathbb{R}^{n} \rightarrow \mathbb{R}$ be a continuous differentiable function and $d \in \mathbb{R}^{n}$. Then $d$ is called a descent direction at position $p \in \mathbb{R}^{n}$, if there is a $R > 0 $ such that $F(p+rd) < F(p)$ for all $r \in (0,R)$.
In simple terms: If we move $p$ in direction of $d$ we ... |
82,435 | When I train a neural network, I observe an increasing validation loss, while at the same time, the validation accuracy is also increased.
I have read explanations related to the phenomenon, and it seems an increasing validation loss and validation accuracy signifies an overfitted model.
However, I have not really gr... | 2020/10/01 | [
"https://datascience.stackexchange.com/questions/82435",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/103610/"
] | Let $F : \mathbb{R}^{n} \rightarrow \mathbb{R}$ be a continuous differentiable function and $d \in \mathbb{R}^{n}$. Then $d$ is called a descent direction at position $p \in \mathbb{R}^{n}$, if there is a $R > 0 $ such that $F(p+rd) < F(p)$ for all $r \in (0,R)$.
In simple terms: If we move $p$ in direction of $d$ we ... | Computing the gradient gives you the direction where the function increases the most. Consider f: x -> x^2 , the gradient in x=1 is 2, if you want to minimize the function you need to go in the direction of -2, same with x=-1 as the gradient is -2.
And as gradients are usually vectors, I don't know what a positive or ... |
44,971,813 | Code:
```
int x = 2;
int* pointerone = &x;
int* pointertwo = pointerone;
```
So the address of `pointerone` is assigned to `pointertwo`, but is the copy constructor being called and the object that holds the address is copied into the address object of the other pointer, like all the default copy constructors on oth... | 2017/07/07 | [
"https://Stackoverflow.com/questions/44971813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There are no constructors involved here. In fact this code is pure C code.
```
int x = 2;
// pointerone points to the memory address of x
int* pointerone = &x;
// pointertwo points to the same address than pointerone,
// therefore it points also to the memory address of x
int* pointertwo = pointerone;
```
That's a... | You could pretend, for symmetry, that the pointer's copy constructor is being invoked (and this would involve the copying of a single numerical "memory address").
In reality, pointers are of a built-in type and don't have constructors *per se*. The compiler has built-in logic that tells it what to make the program do. |
44,971,813 | Code:
```
int x = 2;
int* pointerone = &x;
int* pointertwo = pointerone;
```
So the address of `pointerone` is assigned to `pointertwo`, but is the copy constructor being called and the object that holds the address is copied into the address object of the other pointer, like all the default copy constructors on oth... | 2017/07/07 | [
"https://Stackoverflow.com/questions/44971813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There are no constructors involved here. In fact this code is pure C code.
```
int x = 2;
// pointerone points to the memory address of x
int* pointerone = &x;
// pointertwo points to the same address than pointerone,
// therefore it points also to the memory address of x
int* pointertwo = pointerone;
```
That's a... | When you initialize a pointer with the value of another pointer you are just making another variable for the same memory address, as @Michael just said.
But be careful doing this. If you delete one of the pointer and you dereference the other one in another point of the program, it will raise an exception, and if not ... |
21,289,707 | I'm using Backbone together with require.js and jQuery.
What I'm trying to do is to simply bind an event to a container which should show (mouseover) or hide (mouseout) a video. The event fires but unfortunately too many times (I've several children inside `.intro-content`). I tried using `ev.stopPropagation()` (as see... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529585/"
] | You're definitely along the right lines, but you can simplify your loop and use [.each()](http://api.jquery.com/jquery.each/) function to iterate over all of the `$('.content-block')` elements on your page. You're alos only setting the random colour once, so you can move that into the each function:
```
$('.content-b... | change this
`contentBlock.addClass(colors[randomColor]);`
to this:
```
contentBlock[i].addClass(colors[randomColor]);
```
Hope it helps. |
21,289,707 | I'm using Backbone together with require.js and jQuery.
What I'm trying to do is to simply bind an event to a container which should show (mouseover) or hide (mouseout) a video. The event fires but unfortunately too many times (I've several children inside `.intro-content`). I tried using `ev.stopPropagation()` (as see... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529585/"
] | You're definitely along the right lines, but you can simplify your loop and use [.each()](http://api.jquery.com/jquery.each/) function to iterate over all of the `$('.content-block')` elements on your page. You're alos only setting the random colour once, so you can move that into the each function:
```
$('.content-b... | It will work 100% and it is made of pure Javascript.
```js
for (var i = 0; i <= 5; i++) {
var r = Math.floor(Math.random()*255);
var g = Math.floor(Math.random()*255);
var b = Math.floor(Math.random()*255);
var div = document.getElementsByClassName("div")[i].style.backgroundColor = "rgb("+r+","+g+","+b+")"... |
21,289,707 | I'm using Backbone together with require.js and jQuery.
What I'm trying to do is to simply bind an event to a container which should show (mouseover) or hide (mouseout) a video. The event fires but unfortunately too many times (I've several children inside `.intro-content`). I tried using `ev.stopPropagation()` (as see... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529585/"
] | It looks like the problem might be with how you are incrementing your random color:
```
colors[randomColor]++
```
That isn't the correct way. You probably just want to increment the index in the array:
```
randomColor++
```
You also need to make sure you are staying within the bounds of your color array. I would ... | change this
`contentBlock.addClass(colors[randomColor]);`
to this:
```
contentBlock[i].addClass(colors[randomColor]);
```
Hope it helps. |
21,289,707 | I'm using Backbone together with require.js and jQuery.
What I'm trying to do is to simply bind an event to a container which should show (mouseover) or hide (mouseout) a video. The event fires but unfortunately too many times (I've several children inside `.intro-content`). I tried using `ev.stopPropagation()` (as see... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21289707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529585/"
] | It looks like the problem might be with how you are incrementing your random color:
```
colors[randomColor]++
```
That isn't the correct way. You probably just want to increment the index in the array:
```
randomColor++
```
You also need to make sure you are staying within the bounds of your color array. I would ... | It will work 100% and it is made of pure Javascript.
```js
for (var i = 0; i <= 5; i++) {
var r = Math.floor(Math.random()*255);
var g = Math.floor(Math.random()*255);
var b = Math.floor(Math.random()*255);
var div = document.getElementsByClassName("div")[i].style.backgroundColor = "rgb("+r+","+g+","+b+")"... |
302,220 | I saw that a chatroom event is going to be held. What is special about chatroom events? Aren't they just the same as the usual chatting? I went to the FAQ and the Help Center, but I see no useful information there. | 2015/08/11 | [
"https://meta.stackoverflow.com/questions/302220",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/5133585/"
] | Chatroom events are just easy ways for moderators of a room to communicate a scheduled function. They can be created with any purpose in mind, much like their real life counterparts.
In the StackOverflow Python chat, we typically schedule our [room meetings as events](https://chat.stackoverflow.com/rooms/info/6/python... | They're just like real-life meetings, which are ultimately just people talking as they usually would. The difference is that the people are talking about something specific, in a pre-determined place, at a pre-determined time. If you didn't do that, you would not be able to guarantee that all interested parties were pr... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | You can use `cin >> char_variable;` to get the value.
Don't forget:
```
#include <iostream>
using namespace std;
``` | Your program is quite simple & easy. It goes like this :-
```
#include <iostream>
using namespace std;
int main()
{
char ch='y';
do
{
// compute....
cout<<"do you want to continue ?: "<<flush;
cin>>ch;
}while (ch=='y' || ch=='Y'); // don't for get the semicolon
return 0;
}... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | You can use `cin >> char_variable;` to get the value.
Don't forget:
```
#include <iostream>
using namespace std;
``` | If you used cin.get, you probably had the following problem. If you run this code:
```
cout << "give a number:";
int n;
cin >> n;
cout << "give a char:";
char c;
cin.get(c);
cout << "number=" << n << endl;
```
you'll get the scenario
```
give a number:12
give a char:number=12
```
where it seems the `cin.get()` wa... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | You can use `cin >> char_variable;` to get the value.
Don't forget:
```
#include <iostream>
using namespace std;
``` | I wrote it this way. I used `cin` for get `char` value from user.
```
#include <iostream>
using namespace std ;
int main ()
{
char more;
cout<<"Do you want to do another computation? y/n ";
cin>>more;
while(more=='y'){
cout<<"Do you want to do another computation? y/n ";
cin>>more;
... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | You can use a do-while loop, which basically runs the loop *at least* once. It runs, then checks the conditional, unlike the plain while loop which checks the conditional then runs. Example:
```
bool playAgain; //conditional of the do-while loop
char more; //Choice to play again: 'y' or 'n'
string input; /*In this ex... | Your program is quite simple & easy. It goes like this :-
```
#include <iostream>
using namespace std;
int main()
{
char ch='y';
do
{
// compute....
cout<<"do you want to continue ?: "<<flush;
cin>>ch;
}while (ch=='y' || ch=='Y'); // don't for get the semicolon
return 0;
}... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | You can use a do-while loop, which basically runs the loop *at least* once. It runs, then checks the conditional, unlike the plain while loop which checks the conditional then runs. Example:
```
bool playAgain; //conditional of the do-while loop
char more; //Choice to play again: 'y' or 'n'
string input; /*In this ex... | If you used cin.get, you probably had the following problem. If you run this code:
```
cout << "give a number:";
int n;
cin >> n;
cout << "give a char:";
char c;
cin.get(c);
cout << "number=" << n << endl;
```
you'll get the scenario
```
give a number:12
give a char:number=12
```
where it seems the `cin.get()` wa... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | You can use a do-while loop, which basically runs the loop *at least* once. It runs, then checks the conditional, unlike the plain while loop which checks the conditional then runs. Example:
```
bool playAgain; //conditional of the do-while loop
char more; //Choice to play again: 'y' or 'n'
string input; /*In this ex... | I wrote it this way. I used `cin` for get `char` value from user.
```
#include <iostream>
using namespace std ;
int main ()
{
char more;
cout<<"Do you want to do another computation? y/n ";
cin>>more;
while(more=='y'){
cout<<"Do you want to do another computation? y/n ";
cin>>more;
... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | If you used cin.get, you probably had the following problem. If you run this code:
```
cout << "give a number:";
int n;
cin >> n;
cout << "give a char:";
char c;
cin.get(c);
cout << "number=" << n << endl;
```
you'll get the scenario
```
give a number:12
give a char:number=12
```
where it seems the `cin.get()` wa... | Your program is quite simple & easy. It goes like this :-
```
#include <iostream>
using namespace std;
int main()
{
char ch='y';
do
{
// compute....
cout<<"do you want to continue ?: "<<flush;
cin>>ch;
}while (ch=='y' || ch=='Y'); // don't for get the semicolon
return 0;
}... |
33,067,964 | I need to write a program in C++ where the user can do some computation, and when the computation is done, the program will ask the user if he wants to do another computation. I know how to write this in Python:
```
more = "y"
while (more == "y"):
// computation code
print "Do you want to do another computatio... | 2015/10/11 | [
"https://Stackoverflow.com/questions/33067964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3906984/"
] | I wrote it this way. I used `cin` for get `char` value from user.
```
#include <iostream>
using namespace std ;
int main ()
{
char more;
cout<<"Do you want to do another computation? y/n ";
cin>>more;
while(more=='y'){
cout<<"Do you want to do another computation? y/n ";
cin>>more;
... | Your program is quite simple & easy. It goes like this :-
```
#include <iostream>
using namespace std;
int main()
{
char ch='y';
do
{
// compute....
cout<<"do you want to continue ?: "<<flush;
cin>>ch;
}while (ch=='y' || ch=='Y'); // don't for get the semicolon
return 0;
}... |
4,631,569 | How would you go about opening an .xml file that is within a .jar and edit it?
I know that you can do...
```
InputStream myStream = this.getClass().getResourceAsStream("xmlData.xml");
```
But how would you open the xmlData.xml, edit the file, and save it in the .jar? I would find this useful to know and don't want ... | 2011/01/08 | [
"https://Stackoverflow.com/questions/4631569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/516664/"
] | Jar files are just .zip files with different file suffix, and naming convention for contents. So use classes from under `java.util.zip` to read and/or write contents.
Modifying contents is not guaranteed (or even likely) to effect running system, as class loader may cache contents as it sees fit.
So it might be good ... | If you app. has a GUI and you have access to a web site/server, JWS might be the answer. The JNLP API that is available to JWS apps. provides services such as the PersistenceService. Here is a small [demo. of the PersistenceService](http://pscode.org/jws/api.html#ps).
The idea would be to check for the XML in the JWS ... |
6,234,333 | I want to display "goodbye" for 1 second, fade it out, replace it with
"hello", and then fade back in. Why doesn't this snippetwork? (jQuery
is loaded):
```
<div id="foo">x</div>
<script type="text/javascript">
$('#foo').fadeOut().html('goodbye').fadeIn().delay(1000).fadeOut().html('hello').fadeIn();
</script>
... | 2011/06/04 | [
"https://Stackoverflow.com/questions/6234333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have tried your code.just look at this fiddle:<http://jsfiddle.net/anish/cZf6g/> | try putting your statement in
```
$(document).ready(function(){
/*code here*/
});
```
or putting it in a function then calling that function |
6,234,333 | I want to display "goodbye" for 1 second, fade it out, replace it with
"hello", and then fade back in. Why doesn't this snippetwork? (jQuery
is loaded):
```
<div id="foo">x</div>
<script type="text/javascript">
$('#foo').fadeOut().html('goodbye').fadeIn().delay(1000).fadeOut().html('hello').fadeIn();
</script>
... | 2011/06/04 | [
"https://Stackoverflow.com/questions/6234333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You want to make the `fadeIn` part of the callback function of `fadeOut`. So...
```
$('#foo').fadeOut('slow', function(){
$('#foo').fadeIn('slow').html('Hello');
});
```
Change `slow` to `1000` for 1 second or whatever is desired.
<http://jsfiddle.net/qK26W/> | try putting your statement in
```
$(document).ready(function(){
/*code here*/
});
```
or putting it in a function then calling that function |
6,234,333 | I want to display "goodbye" for 1 second, fade it out, replace it with
"hello", and then fade back in. Why doesn't this snippetwork? (jQuery
is loaded):
```
<div id="foo">x</div>
<script type="text/javascript">
$('#foo').fadeOut().html('goodbye').fadeIn().delay(1000).fadeOut().html('hello').fadeIn();
</script>
... | 2011/06/04 | [
"https://Stackoverflow.com/questions/6234333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You want to make the `fadeIn` part of the callback function of `fadeOut`. So...
```
$('#foo').fadeOut('slow', function(){
$('#foo').fadeIn('slow').html('Hello');
});
```
Change `slow` to `1000` for 1 second or whatever is desired.
<http://jsfiddle.net/qK26W/> | I have tried your code.just look at this fiddle:<http://jsfiddle.net/anish/cZf6g/> |
42,038,334 | Excuse me if this has been answered previously, but I can't seem to find an answer.
How do I convert a string of numbers (e.g "50") into a single char with an ASCII value of the same number, in this case '2'. Is there a way to do this conversion?
Alternatively, could I do the same by converting the string to an int f... | 2017/02/04 | [
"https://Stackoverflow.com/questions/42038334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7501819/"
] | Here for some languages:
C/C++
```
int i = 65;
char c = i;
printf("%c", c); // prints A
```
JS
```
var c = String.fromCharCode(66);
console.log(c); // prints B
```
C#/Java
```
char c = (char)67;
// For Java use System.out.println(c)
Console.WriteLine(c) // prints C
```
Python
```
c = chr(68) # for Python 2 u... | ```
String s = "50";
try {
char c = (char) Integer.valueOf(s);
... c
} catch (NumberFormatException e) {
...
}
```
With catching the NumberFormatException and checking the integer range the code might be made rock-solid. |
69,372,101 | I want to do something like this:
```
ArrayList<String> strings = new ArrayList<>();
//build a collection of Strings
callMethod(strings);
```
The "callMethod" is legacy (in a legacy project), so I cannot change it.
It's signature is this:
```
private void callMethod(String... input){
// and so forth...
```
Ho... | 2021/09/29 | [
"https://Stackoverflow.com/questions/69372101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17031679/"
] | Just convert the list to an array of Strings ([varargs turns into an array under the hood](https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.4.1): *"If the formal parameter is a variable arity parameter, then the declared type is an array type specified by §10.2."*):
```
callMethod(strings.toArray(ne... | Convert the list of strings into arrays of strings.
```
ArrayList<String> strings = new ArrayList<>();
callMethod(strings.toArray(new String[strings.size()]));
``` |
69,372,101 | I want to do something like this:
```
ArrayList<String> strings = new ArrayList<>();
//build a collection of Strings
callMethod(strings);
```
The "callMethod" is legacy (in a legacy project), so I cannot change it.
It's signature is this:
```
private void callMethod(String... input){
// and so forth...
```
Ho... | 2021/09/29 | [
"https://Stackoverflow.com/questions/69372101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17031679/"
] | Just convert the list to an array of Strings ([varargs turns into an array under the hood](https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.4.1): *"If the formal parameter is a variable arity parameter, then the declared type is an array type specified by §10.2."*):
```
callMethod(strings.toArray(ne... | If you have a method with varargs (variable arguments), you have 2 options:
1. pass each item of the collection as a single argument or
2. pass the collection as an array
Example method:
```java
/**
* <p>
* Prints the {@link String}s passed
* </p>
*
* @param item the bunch of character sequences to be printed
... |
69,372,101 | I want to do something like this:
```
ArrayList<String> strings = new ArrayList<>();
//build a collection of Strings
callMethod(strings);
```
The "callMethod" is legacy (in a legacy project), so I cannot change it.
It's signature is this:
```
private void callMethod(String... input){
// and so forth...
```
Ho... | 2021/09/29 | [
"https://Stackoverflow.com/questions/69372101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17031679/"
] | Just convert the list to an array of Strings ([varargs turns into an array under the hood](https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.4.1): *"If the formal parameter is a variable arity parameter, then the declared type is an array type specified by §10.2."*):
```
callMethod(strings.toArray(ne... | ```
public void method() {
ArrayList<String> strings = new ArrayList<>();
//1. calling method by passing the array
callMethod(strings.toArray(new String[strings.size()]));
//2. Using stream method to convert list into array
callMethod(strings.stream().toArray(String[]::new... |
55,744,147 | Calendars have a owner and have a `ManyToMany` field 'assistants'
i have a Calendar who has 2 assistants one of which is its owner.
I think these 3 lines of code in the django shell can explain the weird behaviour quite well.
```py
In [17]: Calendar.objects.filter(assistants=customer).exclude(owner=customer) ... | 2019/04/18 | [
"https://Stackoverflow.com/questions/55744147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2696242/"
] | Assuming this is for django 1.11+:
`|` does not represent a union. It represents an OR-combination (which maintains **all** joins; hence aliz showing up twice) of two querysets .
`qs1.filter(x=1) | qs2.exclude(x=1)` translates to:
```
SELECT STUFF FROM TABLES_AND_JOINS WHERE (x = 1 OR NOT (x = 1))
```
While `qs1... | What you are doing is `OR`-ing the `WHERE` clauses of both queries, which is different from a union (and a bit tricky when joining is involved; here, the ORM switches from an inner join in queryset #1 to an outer join in queryset #3 to account for the second query that has no joins). See the relevant [docs](https://doc... |
14,042,251 | I am trying to make buttons with different gradients programmatically. I use ShapeDrawable and it works like a charm.
```
RoundRectShape rs = new RoundRectShape(new float[] { 12f, 12f, 12f, 12f, 12f, 12f, 12f, 12f }, null, null);
ShapeDrawable sd = new ShapeDrawable(rs);
ShapeDrawable.ShaderFactory sf = new ShapeDraw... | 2012/12/26 | [
"https://Stackoverflow.com/questions/14042251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1005194/"
] | >
> However I would like to add a shadow to the button, not the button
> text programmatically.
>
>
>
I guess you want the shadow behind the current drawable you built. If yes then make a [`LayerDrawable`](http://developer.android.com/reference/android/graphics/drawable/LayerDrawable.html) along with another `Dra... | A more clean way to do it is using `Paint.setShadowLayer` as in [Jack's answer](https://stackoverflow.com/a/26356439/2313889) |
18,425,419 | Hoping someone could let me know if this is possible as I have searched and couldn't come up with the desired effect I wanted.
I basically want to have the border hover to be centred so when you mouse over the links the border-bottom is centred. I would like the border width to be a fixed size around 20px and centere... | 2013/08/25 | [
"https://Stackoverflow.com/questions/18425419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1722242/"
] | Use [`:after`](https://developer.mozilla.org/en-US/docs/Web/CSS/%3a%3aafter) pseudo selector in combination with `hover` pseudo selector.
```
#nav a:hover:after{
content: "";
color:#212121;
display:block;
width:20px;
margin:0 auto;
border-bottom:3px solid #000;
}
```
[**Working Fiddle**](http... | Add a span, center it and give it the bottom border inside your `a`. Show on hover.
[jsfiddle](http://jsfiddle.net/pCQLN/7/)
```
<div id="wrap">
<div id="nav">
<ul>
<li><a href="#">Home<span class="line"></span></a></li>
<li><a href="#">About<span class="line"></span></a></li>
<li>... |
18,425,419 | Hoping someone could let me know if this is possible as I have searched and couldn't come up with the desired effect I wanted.
I basically want to have the border hover to be centred so when you mouse over the links the border-bottom is centred. I would like the border width to be a fixed size around 20px and centere... | 2013/08/25 | [
"https://Stackoverflow.com/questions/18425419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1722242/"
] | Use [`:after`](https://developer.mozilla.org/en-US/docs/Web/CSS/%3a%3aafter) pseudo selector in combination with `hover` pseudo selector.
```
#nav a:hover:after{
content: "";
color:#212121;
display:block;
width:20px;
margin:0 auto;
border-bottom:3px solid #000;
}
```
[**Working Fiddle**](http... | You can try something like this:
```
<li><a href="#">Home</a><span class="hovered"></span></li>
.hovered {
margin: 0;
height: 3px;
width: 20px;
background-color:transparent;
display: inline-block;
}
#nav a:hover + .hovered {
background-color: black;
}
```
<http://jsfiddle.net/pCQLN/9/> |
18,425,419 | Hoping someone could let me know if this is possible as I have searched and couldn't come up with the desired effect I wanted.
I basically want to have the border hover to be centred so when you mouse over the links the border-bottom is centred. I would like the border width to be a fixed size around 20px and centere... | 2013/08/25 | [
"https://Stackoverflow.com/questions/18425419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1722242/"
] | Add a span, center it and give it the bottom border inside your `a`. Show on hover.
[jsfiddle](http://jsfiddle.net/pCQLN/7/)
```
<div id="wrap">
<div id="nav">
<ul>
<li><a href="#">Home<span class="line"></span></a></li>
<li><a href="#">About<span class="line"></span></a></li>
<li>... | You can try something like this:
```
<li><a href="#">Home</a><span class="hovered"></span></li>
.hovered {
margin: 0;
height: 3px;
width: 20px;
background-color:transparent;
display: inline-block;
}
#nav a:hover + .hovered {
background-color: black;
}
```
<http://jsfiddle.net/pCQLN/9/> |
408,115 | I'm looking for an elementary proof of the fact that $\ell(nP) = \dim L(nP) = n$, where $L(nP)$ is the linear (Riemann-Roch) space of certain rational functions associated to the divisor $nP$, where $n > 0$ is an integer and $P$ is a point on a curve of genus 1.
This fact is used to prove that every elliptic curve is ... | 2013/06/01 | [
"https://math.stackexchange.com/questions/408115",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/23180/"
] | Let $X$ be an elliptic curve over $k$, and $P \in X$. We have to prove that for $D=nP$ we have
$$
l(D)=\deg(D)=n
$$
If $D$ satisfies the above equation, and $E$ is a divisor such that $E \geq D$, then we have $l(E)=\deg(E)$ (cf. [Fulton](http://www.math.lsa.umich.edu/~wfulton/CurveBook.pdf), Corollary 8.3.1). Hence it... | Here is an elementary solution in a very special case. It assumes that the curve is already embedded in the plane using a Weierstrass-like equation, so you can't use it to later prove that every elliptic curve can be given by a Weierstrass equation, but perhaps it will still be instructive.
We assume the base field is... |
53,676,235 | My software builds use `-Xlint -Werror` so I routinely run across compiler warnings that break my build. Every once in a while I run across a warning that I need to suppress, but it's always difficult to figure out which `Xlint` option suppresses the warning I am seeing.
I'll give you a concrete example. I recently ra... | 2018/12/07 | [
"https://Stackoverflow.com/questions/53676235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14731/"
] | One way to do that, if somehow you're not able to access the [online documentation](https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9) could be using the command
```
javac --help-extra
```
This would list out the possible warnings that you could enable/disable. For... | Alan Bateman pointed me in the right direction. It seems that the maven-compiler-plugin suppressing vital information. Here is the output from javac 11.0.1:
```
C:\Users\Gili\Documents\requirements\java\src\main\java\module-info.java:16: warning: [module] module not found: org.bitbucket.cowwoc.requirements.guava
... |
31,929,963 | On my html page I have a button, and a number being displayed. I want the number to increase by 1 every time the button is pressed. This is the code that I have so far, but for some it doesn't work.
mypage.html
```html
<form method='get' action='#'>
<input type="submit" value="add" name="add"/>
</form>
<h1>{{ p }... | 2015/08/10 | [
"https://Stackoverflow.com/questions/31929963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5131031/"
] | On every request a new instance of the python script is run which would result in your global variable not being retained. You should store the count in a database and recall the value on every request. There are options other than a database but the basic idea of needing some sort of persistent storage still exists.
... | The p value needs to be kept track of across requests.
2 possibilities are
* resend the data every request
* store the data in a session and just make increment /decrement requests
Should the variable be shared between all users? Or just the current user? |
31,929,963 | On my html page I have a button, and a number being displayed. I want the number to increase by 1 every time the button is pressed. This is the code that I have so far, but for some it doesn't work.
mypage.html
```html
<form method='get' action='#'>
<input type="submit" value="add" name="add"/>
</form>
<h1>{{ p }... | 2015/08/10 | [
"https://Stackoverflow.com/questions/31929963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5131031/"
] | On every request a new instance of the python script is run which would result in your global variable not being retained. You should store the count in a database and recall the value on every request. There are options other than a database but the basic idea of needing some sort of persistent storage still exists.
... | It should work if there is a single instance of django running (although it is not the recommended approach like other's have suggested).
It didn't appear to work is because you used `action='#'`, and the browser refused to resubmit the form when your URL already ends with `#`. Instead you can use the following templat... |
196,904 | Without warning, a wizard casts *telepathy* targeting a friend who is on a different continent.
>
> You create a telepathic link between yourself and a willing creature with which you are familiar.
>
>
>
How is it decided whether the target is willing? Does the wizard get 6 seconds to quickly introduce herself? D... | 2022/03/18 | [
"https://rpg.stackexchange.com/questions/196904",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/46827/"
] | ### Short answer, you will need to establish an agreement ahead of time. As the check occurs before the connection is ever established.
This is apparently not a spell used for cold calling.
As explained by @Fie (emphasis theirs)
>
> according to the spell targetting rules in XGE (pp. 85–6), the validity of the targ... | The rules don't specify the exact mechanism, so the GM will need to adjudicate.
If the target of the spell is a PC, the GM will need to give the player enough information to decide if the player is willing.
If the target of the spell is an NPC, the GM will need to decide for the NPC.
The GM may want to establish hou... |
196,904 | Without warning, a wizard casts *telepathy* targeting a friend who is on a different continent.
>
> You create a telepathic link between yourself and a willing creature with which you are familiar.
>
>
>
How is it decided whether the target is willing? Does the wizard get 6 seconds to quickly introduce herself? D... | 2022/03/18 | [
"https://rpg.stackexchange.com/questions/196904",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/46827/"
] | On further review, later in the spell description it says (emphasis added):
>
> Until the spell ends, you and the target can instantaneously share words, images, sounds, and other sensory messages with one another through the link, **and the target recognizes you as the creature it is communicating with**.
>
>
>
... | The rules don't specify the exact mechanism, so the GM will need to adjudicate.
If the target of the spell is a PC, the GM will need to give the player enough information to decide if the player is willing.
If the target of the spell is an NPC, the GM will need to decide for the NPC.
The GM may want to establish hou... |
66,273,005 | I am trying to integrate my spring boot application with docusign for sending the documents and getting it signed from the users. I am not able to do it because I am not getting as how to get the JWT token to call the API's. I have downloaded the java code example from the docusign and configured accordingly. I am able... | 2021/02/19 | [
"https://Stackoverflow.com/questions/66273005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6057802/"
] | I have figured out the solution myself. It's the issue with the session management and security in the example code. If I call any API from rest template there is no session at the beginning and it requires a JWT. So I need to pass a session Id in the header which is active and holds the value of the current user. | The Code Example Launchers that we have for Java do operate on SpringBoot and has an example framework for creating JWT tokens, they should work for you out of the box.
Usually when we see someone getting stuck at a 302 it's because the application isn't following provided redirects -- most commonly when the baseUrl b... |
1,679,371 | I have an ID (number format) that has trailing decimals in the source data. I need to retain the rounded number (see example attached) and have the trailing decimals removed from the data. The decimals are causing upload issues/error into a system that I use.
I have tried formatting to number and removing decimal plac... | 2021/10/01 | [
"https://superuser.com/questions/1679371",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | All of IP addresses 1 - 7 may well exist only between your laptop and the 4G modem. As the whole path is wired, there's no way to set up a MITM in between; unless there's another way to access your firewall. The 4G modem requires connection to a service provider, and it will only connect to the provider who provided th... | Your carrier is free to use any rfc1918 (ie private soace) in their network for parts you dont need to be able to reach - indeed doing this can save real IP space. You have not pointed out where your world routable or CGN IP is defined, and doing this could be useful in you understanding how tnings fit together.
Also ... |
24,399,292 | I have made a client-server application which can connect over the internet. I have hard coded in my client the server's IP which is fixed.
My question is that I want a way that will not take a lot of processing and memory.
I want my client to check if internet is available and then try to connect to the server if its... | 2014/06/25 | [
"https://Stackoverflow.com/questions/24399292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3677907/"
] | An array of T when used in most expressions will decay to a pointer of type "pointer to T" and have the value equal to the address of the first element of the array.
If `Str` is declared as:
```
char Str[3][5];
```
Then `Str` will decay to `char (*)[5]`, and have the value of `&Str[0]`. If passing to a function, yo... | [Pointer address in a C multidimensional array](https://stackoverflow.com/questions/2003745/pointer-address-in-a-c-multidimensional-array)
To expand on this answer to a similar question, when we type to get addresses of arrays. The name of the array is actually a pointer to the first variable in the array.
You can't ... |
48,479,065 | I have a code given below. when I run the code, all x1,x2 and x3 having same values.As per logic x1 should have random numbers, x2 also random numbers , x3 should have 0s and 1s.
```
import numpy as np
def reluDerivative(x):
yy=x;
yy[yy<=0] = 0
yy[yy>0] = 1
return yy
x1=np.random.uniform(-1, 1,10)
x2... | 2018/01/27 | [
"https://Stackoverflow.com/questions/48479065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7425709/"
] | You should think of python variables as **labels**, hence when you do `x2=x1` you are just creating a new label for the same data in memory, this differs in behaviour for mutable and immutable objects, for example:
```
x1 = []
x2 = x1
x2.append(10)
print(x2)
print(x1)
```
will result on printing:
```
[10]
[10]
```... | You just give the same list `x1` another name: `x2` that bot point to the same data. modifying one is modifying the data that the other one points to as well.
You need to (shallow) copy:
```
import numpy as np
def reluDerivative(yy):
return [0 if x <=0 else 1 for x in yy ]
x1 = np.random.uniform(-1, 1,10)
x2 = x... |
65,838,713 | I was looking to download kdiff for windows from
<https://download.kde.org/stable/kdiff3/>
and I noticed the latest package is
kdiff3-1.8.5-windows-64-cl.exe
while the next-latest is
kdiff3-1.8.4-windows-64.exe
Does the -cl signify anything like a library I need or stability or ???
There is 0 documentation that I c... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65838713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2407039/"
] | It was built using the MSVC command line compiler (cl.exe) that comes with Visual Studio.
See: <https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options?view=msvc-160> | I can't say what the `-cl` stands for, but it has been a suffix before, for example for version 1.8.2. I'm currently running 1.8.5 (from that location, the one with the `-cl` suffix) and it works fine. |
10,751,076 | I'm new to django and for practice I'm trying to program my own version of the all familiar 'todo list' app.
I have some page that displays all todo list items the user has entered, along with a button to edit each one. The edit button sends the user to another page with a form to enter in the changes to the item.
I... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10751076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1322179/"
] | In case someone else has the same question
**So instead of doing this:**
*template*
```
<form method="post" action="/list/saving/">
<!--- form fields --->
<button type="submit" name="save" value='{{ item.pk }}'>Save</button>
</form>
```
*url.py*
```
(r'^list/saving/$', save)
```
*views.py*
```
def sav... | If you really need to, just use hidden inputs. But, this is unnecessary anyways. The user may be able to change "everything" about the item, but they can't change the `pk` (or at least they *shouldn't* be able to... don't give them the option to). The `pk` is what Django uses to identify an object, so this is already h... |
356,472 | What do the matching "L" shapes (near `.5` and `20`) mean in this forumla?

The document where I found this formula can be found here: <http://www.cs.cmu.edu/~hcwong/Pdfs/icip02.ps> | 2013/04/09 | [
"https://math.stackexchange.com/questions/356472",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/13360/"
] | The bracketing symbol means Floor (see <http://en.wikipedia.org/wiki/Floor_and_ceiling_functions>)
The definition of Floor is $\lfloor x \rfloor$ = Largest integer less than x. This is very similar to rounding down as $\lfloor 2.3 \rfloor = \lfloor 2.999 \rfloor = 2$. However, the subtlety is that for negative numbers... | Floor function: Round down to the nearest integer. |
4,346,191 | hey :)
ok im looking for a way to create a large number of panels in wxpython and append a hold to them in a list but am not sure how best to do this. for example
for i in list:
wx.Panel(self, -1, pos, size) #create the panel
somehow store a hold to it e.g
==============================
anotherlist.append(a) #where a... | 2010/12/03 | [
"https://Stackoverflow.com/questions/4346191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527204/"
] | Some people solve these sorts of things by creating the ids at the beginning of the file:
```
panelOneId = wx.NewId()
panelTwoId = wx.NewId()
```
And then doing something like myPanel = wx.FindWindowById(panelOneId). Of course, if all you're doing is setting panel attributes, it might just behoove you to create a he... | A simple solution is to use a dictionary to map ids to panels
```
panels = {}
for i in range(100):
id = wx.NewId()
panels[id] = wx.Panel(parent, id, ...)
```
You then have access to a list of ids (`.keys()`), a list of panels (`.values()`) and a mapping from id to panel. |
49,152,669 | I have an android app that gets my devices location and adds a marker. It also tracks the location and the marker moves. I want to add a marker on the map each time the location changes, so I can then draw a Polyline between them at a later date. I am not using firebase or a DBHelper. Just looking for a simple way to d... | 2018/03/07 | [
"https://Stackoverflow.com/questions/49152669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9385851/"
] | The config variables are created using the firebase cli.
If you type `firebase --help` you will get an output which includes the following:
```
functions:config:clone [options] clone environment config from another project
functions:config:get [path] fetch environment config stored at the giv... | What are you trying to achieve exactly ?
I think you missed a step, this part uses the cloud function from firebase.
You can see here "Extending Cloud Firestore with Cloud Functions" <https://cloud.google.com/firestore/docs/extend-with-functions>
Which will help you to extend firestore with cloud functions, and here... |
49,152,669 | I have an android app that gets my devices location and adds a marker. It also tracks the location and the marker moves. I want to add a marker on the map each time the location changes, so I can then draw a Polyline between them at a later date. I am not using firebase or a DBHelper. Just looking for a simple way to d... | 2018/03/07 | [
"https://Stackoverflow.com/questions/49152669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9385851/"
] | I get the feeling that the reasons the other answers may not be working for you is that you are looking for how to SET the config, as opposed to retrieving it.
If you don't have it already, you'll need to install the Firebase CLI, as per the steps in <https://firebase.google.com/docs/cli/> .
with it installed, you ca... | What are you trying to achieve exactly ?
I think you missed a step, this part uses the cloud function from firebase.
You can see here "Extending Cloud Firestore with Cloud Functions" <https://cloud.google.com/firestore/docs/extend-with-functions>
Which will help you to extend firestore with cloud functions, and here... |
49,152,669 | I have an android app that gets my devices location and adds a marker. It also tracks the location and the marker moves. I want to add a marker on the map each time the location changes, so I can then draw a Polyline between them at a later date. I am not using firebase or a DBHelper. Just looking for a simple way to d... | 2018/03/07 | [
"https://Stackoverflow.com/questions/49152669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9385851/"
] | I get the feeling that the reasons the other answers may not be working for you is that you are looking for how to SET the config, as opposed to retrieving it.
If you don't have it already, you'll need to install the Firebase CLI, as per the steps in <https://firebase.google.com/docs/cli/> .
with it installed, you ca... | The config variables are created using the firebase cli.
If you type `firebase --help` you will get an output which includes the following:
```
functions:config:clone [options] clone environment config from another project
functions:config:get [path] fetch environment config stored at the giv... |
676,518 | C#: In the keydown event of a textbox, how do you detect currently pressed modifiers + keys?
I did the following, but I'm not too familiar with these operators so I'm not sure if and what I'm doing wrong.
```
private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == (Keys.Al... | 2009/03/24 | [
"https://Stackoverflow.com/questions/676518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | according to msdn [linkt](http://support.microsoft.com/kb/839201)
```
private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
{
if (e.Alt || e.Control || e.Shift))
{
lbLogger.Items.Add(e.ToString() + " + " +
"show non-modifier key being pressed here");
}
... | The [documentation](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.modifierkeys.aspx) says it is a bitwise combination, but you're doing a logical OR.
Try:
```
if (e.Modifiers & (Keys.Alt | Keys.Control | Keys.Shift))
{
lbLogger.Items.Add(e.Modifiers.ToString() + " + " +
"show non-m... |
3,003,349 | The problem was this: radius is $2$, tangent to the $x$ axis, passes through $(1, -1)$. I don't know how to solve this, and my math teacher didnt teach this yet. | 2018/11/18 | [
"https://math.stackexchange.com/questions/3003349",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/617065/"
] | Given the conditions you gave, there is only two circle that works: their center is $\left(\begin{array}{cc} 1-\sqrt{3}\\ -2 \end{array}\right)$ and $\left(\begin{array}{cc} 1+\sqrt{3}\\ -2 \end{array}\right)$, their radius is $2$.
So their respective equation are:
$(x - 1+\sqrt{3})^2 + (y+2)^2 = 4$ and $(x-1-\sqrt{3... | Since the circle is tangent to the x-axis and passes through $(1,-1)$ with radius $2$ we know the center is below the x-axis and $2$ units away from it.
Thus the center is a point $ C(x,-2)$ which is $2$ unit apart from $(1,-1)$
That gives us $$(x-1)^2 + (-1)^2 =4$$ which implies $x=1\pm \sqrt 3 $
There are two cir... |
56,854,614 | [](https://i.stack.imgur.com/CGEth.png)When I install redux-thunk it shows an error and you can see attached image for more info -
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\siddharth.vyas\Desktop\react-native\_Proj\AwesomeProjec... | 2019/07/02 | [
"https://Stackoverflow.com/questions/56854614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8039805/"
] | try removing node\_modules and do `npm install`. If it doesn't work, delete node\_modules, add "redux-thunk": "^2.3.0" to your dependencies, then run `npm install -i` | I have faced similar issues in windows. this looks more of a permission issue.
Try running the cmd window in run as administrator mode. this should mostly give permission to npm to execute the script.
if that does not work, then the option would be to delete the folder redux-thunk from node\_modules directory and try... |
67,719 | I'm currently following a tutorial to rig a character.
All goes well until I go to Pose Mode to see if my rig moves (I can do that before or after doing the automatic weight things, it changes nothing).
[](https://i.stack.imgur.com/3kqsV.png)
What happens is most stra... | 2016/11/21 | [
"https://blender.stackexchange.com/questions/67719",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32816/"
] | Judging from your second screenshot, I'd suppose you've got `Manipulate Center Points` activated. While this is useful on multiple selected objects or bones, when bones are **not** connected, it leads to the behavior you describe in your Question. See the GIF below on how to deactivate this feature:
[](https://i.stack.imgur.com/HD086.png) |
19,097,562 | Which is a better approach to building a complex object (eager loading). A single call to a stored procedure that returns multiple result sets or multiple calls to stored procedures with one result set each? I'm building my DAL using T4/text templates in .NET so I'm leaning towards to latter.
Thanks! | 2013/09/30 | [
"https://Stackoverflow.com/questions/19097562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57106/"
] | For a pass to install, the following criteria have to be met:
* The link must be https
* The URL must return a valid `.pkpass` bundle
* The `Content-Type` header must be `application/vnd.apple.pkpass`
Unfortunately, these requirements are not yet documented, but they are mentioned in the WWDC session [What's new in P... | The URL contained in the QR code must return a valid PKPASS file and have the correct MIME type in the HTTP response.
Does that help? |
10,617,363 | I have
```
SharedPreferences myPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
```
and
```
myPreferences.getBoolean("checkbox", true)
```
So, how can my main activity know when user change preferences state?
For example if user don't wont to get notifications any more.
Thank... | 2012/05/16 | [
"https://Stackoverflow.com/questions/10617363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159613/"
] | You could either re-read all the preferences in `Activity.onResume()`, or as long as your main activity launches the preferences activity (e.g. from a menu), you could launch with `startActivityForResult(Intent, int)` and re-read all the preferences in `onActivityResult(int, int, Intent)`.
I have also found it suffici... | You can create a static boolean that is changed whenever a preference is changed, or when your preference activity is started. The purpose of this boolean is to let your main activity know the preferences are dirty and need to be reloaded. They should be reloaded `onResume` if the `mDirty` flag is true.
Another option... |
10,617,363 | I have
```
SharedPreferences myPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
```
and
```
myPreferences.getBoolean("checkbox", true)
```
So, how can my main activity know when user change preferences state?
For example if user don't wont to get notifications any more.
Thank... | 2012/05/16 | [
"https://Stackoverflow.com/questions/10617363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159613/"
] | You need to implement the onSharedPreferenceChangeListener interface. Then register to receive change updates in your onCreate/onStart:
```
myPreferences.registerOnSharedPreferenceChangeListener();
```
In your listener you do something like this:
```
@Override
public void onSharedPreferenceChanged(SharedPreferences... | You can create a static boolean that is changed whenever a preference is changed, or when your preference activity is started. The purpose of this boolean is to let your main activity know the preferences are dirty and need to be reloaded. They should be reloaded `onResume` if the `mDirty` flag is true.
Another option... |
41,063,941 | I am writing a Rule Engine based on ANTLR 4 for C# (I am using the [Sam Harwell alternative](https://github.com/tunnelvisionlabs/antlr4cs)) but I can't get my grammar correctly parsing my inputs about two rules very similar.
There are probably several others mistakes, but I am stuck with this one for the moment. Also... | 2016/12/09 | [
"https://Stackoverflow.com/questions/41063941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183236/"
] | Using inconsistent naming of tokens makes analysis of the rules harder for you (parser/lexer won't mind). So it is just suggestion for easier (manual) reading the rules -- when I read my grammar, when I see two rules with different tokens all in caps (terminal) I know for sure they are different at that point. In your ... | The `FACT` lexer rule will not match `Fact1`
```
FACT: [a-zA-Z](([a-zA-Z0-9] | '.' | '_')*[a-zA-Z0-9])?;
```
The kleene star in the middle is nominally a greedy operator. So, all terminal numbers will be captured, leaving nothing to complete the rule.
Just make it non-greedy:
```
FACT: [a-zA-Z](([a-zA-Z0-9] | '.' ... |
7,244,836 | I have tabbar application, in first tab I have a webView, so when user open the website and going to download some song mp3 format, it push another View which takes the title from the user.
after giving the title I just change the tabbarSelectController to one title for song
and the downloading begins and shown on th... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7244836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/868703/"
] | You may start using:
m2e ( maven to eclipse integration ) -> <http://www.eclipse.org/m2e/>
Eclipse WTP ( web tools platform ) -> <http://www.eclipse.org/webtools/>
WTP will allow you to run Tomcat from eclipse and m2e will take care of converting your Maven build into Eclipse project and integrating it with WTP. | If you are using `eclipse` then you need not to use `mvn -o compile war:exploded` every time. But yes, you need to use `mvn install` each time you make a change in your application.
This is what you need to do:
* Open `Server View`
* Open expected tomcat server settings. A settings window for tomcat will be opened.
*... |
21,420,252 | I have a live video stream from FFMpeg, and I am having a hard time viewing the stream using my own custom Java application. Before someone tells me to use VLC or something like that I do want to use my own application. The stream I am trying to read is a H.264 encoded Mpeg-ts stream streamed over UDP. I do know how to... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21420252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1618141/"
] | Try this on:
`d = collections.OrderedDict({ i:'*'*i for i in range(8) })`
**EDIT**
`pprint.pprint(list(d.items()))` | If you are specifically targeting CPython\* 3.6 or later, then you can [just use regular dictionaries](https://docs.python.org/3.6/whatsnew/3.6.html#whatsnew36-compactdict) instead of `OrderedDict`. You'll miss out on a few [methods exclusive to `OrderedDict`](https://docs.python.org/3.6/library/collections.html#collec... |
21,420,252 | I have a live video stream from FFMpeg, and I am having a hard time viewing the stream using my own custom Java application. Before someone tells me to use VLC or something like that I do want to use my own application. The stream I am trying to read is a H.264 encoded Mpeg-ts stream streamed over UDP. I do know how to... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21420252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1618141/"
] | Try this on:
`d = collections.OrderedDict({ i:'*'*i for i in range(8) })`
**EDIT**
`pprint.pprint(list(d.items()))` | I realize this is sort of necroposting, but I thought I'd post what I use. Its main virtue is that its aoutput can be read back into python, thus allowing, for instance, to shutlle between representations (which I use, for instance, on JSON files). Of course it breaks pprint encapsulation, by ripping some code off its ... |
21,420,252 | I have a live video stream from FFMpeg, and I am having a hard time viewing the stream using my own custom Java application. Before someone tells me to use VLC or something like that I do want to use my own application. The stream I am trying to read is a H.264 encoded Mpeg-ts stream streamed over UDP. I do know how to... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21420252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1618141/"
] | I found a relatively simple solution for this, but it includes the risk of making the output for your ordered dictionary appear exactly as if it were a regular `dict` object.
The original solution for using a context manager to prevent `pprint` from sorting dictionary keys comes from [this answer](https://stackoverflo... | If you are specifically targeting CPython\* 3.6 or later, then you can [just use regular dictionaries](https://docs.python.org/3.6/whatsnew/3.6.html#whatsnew36-compactdict) instead of `OrderedDict`. You'll miss out on a few [methods exclusive to `OrderedDict`](https://docs.python.org/3.6/library/collections.html#collec... |
21,420,252 | I have a live video stream from FFMpeg, and I am having a hard time viewing the stream using my own custom Java application. Before someone tells me to use VLC or something like that I do want to use my own application. The stream I am trying to read is a H.264 encoded Mpeg-ts stream streamed over UDP. I do know how to... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21420252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1618141/"
] | I found a relatively simple solution for this, but it includes the risk of making the output for your ordered dictionary appear exactly as if it were a regular `dict` object.
The original solution for using a context manager to prevent `pprint` from sorting dictionary keys comes from [this answer](https://stackoverflo... | I realize this is sort of necroposting, but I thought I'd post what I use. Its main virtue is that its aoutput can be read back into python, thus allowing, for instance, to shutlle between representations (which I use, for instance, on JSON files). Of course it breaks pprint encapsulation, by ripping some code off its ... |
21,420,252 | I have a live video stream from FFMpeg, and I am having a hard time viewing the stream using my own custom Java application. Before someone tells me to use VLC or something like that I do want to use my own application. The stream I am trying to read is a H.264 encoded Mpeg-ts stream streamed over UDP. I do know how to... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21420252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1618141/"
] | If you are specifically targeting CPython\* 3.6 or later, then you can [just use regular dictionaries](https://docs.python.org/3.6/whatsnew/3.6.html#whatsnew36-compactdict) instead of `OrderedDict`. You'll miss out on a few [methods exclusive to `OrderedDict`](https://docs.python.org/3.6/library/collections.html#collec... | I realize this is sort of necroposting, but I thought I'd post what I use. Its main virtue is that its aoutput can be read back into python, thus allowing, for instance, to shutlle between representations (which I use, for instance, on JSON files). Of course it breaks pprint encapsulation, by ripping some code off its ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.