qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
103,550 | My son, who is 6, loves playing D&D with myself and his older brother. He is all for creating a full fledged character, and for the most part understands what is going on. However, during play, especially combat, it is difficult for him to make full use of his characters ability. Being 6 his ability to implement strate... | 2017/07/14 | [
"https://rpg.stackexchange.com/questions/103550",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/35608/"
] | >
> "...many times he has already decided his path and just wants to
> play".
>
>
>
*He's off to a great start*!
Are his decisions negatively impacting the experience for other players at the table? If not, **encourage his behaviour**. Allow your son to express WHAT he wants his character to do, and it's your j... | Is your son having fun? Is anyone else actually experiencing a problem related to this? Because if not, don't mess with his character. As you say…
>
> We will offer hints to help him, but many times **he has already decided his path and just wants to play**.
>
>
>
He knows what he wants to do and is doing it. If ... |
103,550 | My son, who is 6, loves playing D&D with myself and his older brother. He is all for creating a full fledged character, and for the most part understands what is going on. However, during play, especially combat, it is difficult for him to make full use of his characters ability. Being 6 his ability to implement strate... | 2017/07/14 | [
"https://rpg.stackexchange.com/questions/103550",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/35608/"
] | Is your son having fun? Is anyone else actually experiencing a problem related to this? Because if not, don't mess with his character. As you say…
>
> We will offer hints to help him, but many times **he has already decided his path and just wants to play**.
>
>
>
He knows what he wants to do and is doing it. If ... | **Leave him room to grow**
You think his tactics are in need of improving. Reducing his options will not improve his tactics for *him*, only *you*. While I'm assuming you mean well, this ends up having a net-selfish result, which is the opposite of your stated goals.
Keeping his options open allows you to, at various... |
103,550 | My son, who is 6, loves playing D&D with myself and his older brother. He is all for creating a full fledged character, and for the most part understands what is going on. However, during play, especially combat, it is difficult for him to make full use of his characters ability. Being 6 his ability to implement strate... | 2017/07/14 | [
"https://rpg.stackexchange.com/questions/103550",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/35608/"
] | Is your son having fun? Is anyone else actually experiencing a problem related to this? Because if not, don't mess with his character. As you say…
>
> We will offer hints to help him, but many times **he has already decided his path and just wants to play**.
>
>
>
He knows what he wants to do and is doing it. If ... | In my opinion, the simplest class for someone who isn't used to having a bunch of options at their disposal would be the **[basic Barbarian](https://roll20.net/compendium/dnd5e/Barbarian#content) which takes the [Path of the Unstoppable](https://www.dandwiki.com/wiki/Path_of_the_Unstoppable_(5e_Archetype))** when offer... |
103,550 | My son, who is 6, loves playing D&D with myself and his older brother. He is all for creating a full fledged character, and for the most part understands what is going on. However, during play, especially combat, it is difficult for him to make full use of his characters ability. Being 6 his ability to implement strate... | 2017/07/14 | [
"https://rpg.stackexchange.com/questions/103550",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/35608/"
] | >
> "...many times he has already decided his path and just wants to
> play".
>
>
>
*He's off to a great start*!
Are his decisions negatively impacting the experience for other players at the table? If not, **encourage his behaviour**. Allow your son to express WHAT he wants his character to do, and it's your j... | **Leave him room to grow**
You think his tactics are in need of improving. Reducing his options will not improve his tactics for *him*, only *you*. While I'm assuming you mean well, this ends up having a net-selfish result, which is the opposite of your stated goals.
Keeping his options open allows you to, at various... |
103,550 | My son, who is 6, loves playing D&D with myself and his older brother. He is all for creating a full fledged character, and for the most part understands what is going on. However, during play, especially combat, it is difficult for him to make full use of his characters ability. Being 6 his ability to implement strate... | 2017/07/14 | [
"https://rpg.stackexchange.com/questions/103550",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/35608/"
] | >
> "...many times he has already decided his path and just wants to
> play".
>
>
>
*He's off to a great start*!
Are his decisions negatively impacting the experience for other players at the table? If not, **encourage his behaviour**. Allow your son to express WHAT he wants his character to do, and it's your j... | In my opinion, the simplest class for someone who isn't used to having a bunch of options at their disposal would be the **[basic Barbarian](https://roll20.net/compendium/dnd5e/Barbarian#content) which takes the [Path of the Unstoppable](https://www.dandwiki.com/wiki/Path_of_the_Unstoppable_(5e_Archetype))** when offer... |
103,550 | My son, who is 6, loves playing D&D with myself and his older brother. He is all for creating a full fledged character, and for the most part understands what is going on. However, during play, especially combat, it is difficult for him to make full use of his characters ability. Being 6 his ability to implement strate... | 2017/07/14 | [
"https://rpg.stackexchange.com/questions/103550",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/35608/"
] | **Leave him room to grow**
You think his tactics are in need of improving. Reducing his options will not improve his tactics for *him*, only *you*. While I'm assuming you mean well, this ends up having a net-selfish result, which is the opposite of your stated goals.
Keeping his options open allows you to, at various... | In my opinion, the simplest class for someone who isn't used to having a bunch of options at their disposal would be the **[basic Barbarian](https://roll20.net/compendium/dnd5e/Barbarian#content) which takes the [Path of the Unstoppable](https://www.dandwiki.com/wiki/Path_of_the_Unstoppable_(5e_Archetype))** when offer... |
19,303,190 | I've a procedure which generates a tab delimited text file and also sends an email with a list of students as attachment using msdb.dbo.sp\_send\_dbmail.
When I execute the procedure thoruhg SQL server management studio, it sends only one email.
But I created a SSIS package and scheduled the job to run nightly. This... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19303190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2867378/"
] | Test for the property using [.hasOwnProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) to prevent getting the error
```
for ( var i = 0; i < len; i++ ) {
classes.push({
"id":data.post[i].id,
"location": data.content[i].location.hasOwnProperty("name... | Just do a check if `data.content[i].location.name != null` before doing your push
If you want something special to happen in the case where it is `null` you can do that in the `else`.
Or as you've indicated sometimes `location` is `null`, so check that too the same way. |
6,261,596 | Is there a way to optimize following query? It returns the right records but takes more than a minute to execute.
```
select STATUS, SUBNO, TRUNC(TRSF_DATE) TRSF_DATE
from
(
select STATUS, SUBNO, TRUNC(TRSF_DATE) TRSF_DATE
from tbl where
trsf_date is not null and
contrno in ('8', '8A', '8... | 2011/06/07 | [
"https://Stackoverflow.com/questions/6261596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631950/"
] | DBMSes treat NULLs as `unknown` when abiding by ANSI. This means that an expression like `Column = /value/` will automatically exclude NULLs with no further conditions. So the following simplified query should do the job:
```
SELECT
STATUS,
SUBNO,
TRUNC(TRSF_DATE) TRSF_DATE
FROM crm_user_info
WHERE
TRSF_DA... | You don't need an inner query. You can combine the WHERE conditions into 1 query:
```
select STATUS, SUBNO, TRUNC(TRSF_DATE) TRSF_DATE
from crm_user_info
where
trsf_date is not null and
trsf_date = to_date('5/21/2011', 'mm/dd/yyyy') and
contrno in ('8', '8A', '8B', '8C', '8D', '8E', '8PH3... |
6,261,596 | Is there a way to optimize following query? It returns the right records but takes more than a minute to execute.
```
select STATUS, SUBNO, TRUNC(TRSF_DATE) TRSF_DATE
from
(
select STATUS, SUBNO, TRUNC(TRSF_DATE) TRSF_DATE
from tbl where
trsf_date is not null and
contrno in ('8', '8A', '8... | 2011/06/07 | [
"https://Stackoverflow.com/questions/6261596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631950/"
] | DBMSes treat NULLs as `unknown` when abiding by ANSI. This means that an expression like `Column = /value/` will automatically exclude NULLs with no further conditions. So the following simplified query should do the job:
```
SELECT
STATUS,
SUBNO,
TRUNC(TRSF_DATE) TRSF_DATE
FROM crm_user_info
WHERE
TRSF_DA... | ```
select STATUS, SUBNO, TRSF_DATE
from crm_user_info
where isnull(trsf_date,'01/Jan/1753') = '07/Jun/2011'
and contrno in ('8', '8A', '8B', '8C', '8D', '8E', '8PH3A', '8PH3B', '8PH3C', '8PHD')
``` |
23,663 | I'm getting a compiler error for this test:
```
@isTest public class TestDirectMailFilter {
public static testMethod void testMyController() {
Campaign c = new Campaign(); c.Name = 'Jacob for president'; c.Type = 'Direct Mail'; insert c;
ApexPages.StandardController sc = new ApexPages.StandardController(c);
**Direc... | 2014/01/07 | [
"https://salesforce.stackexchange.com/questions/23663",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/5150/"
] | In your class the constructor is set up to take a StandardSetController
```
public DirectMailfilter(ApexPages.StandardsetController controller)
```
But in your test code, you are passing it a StandardController
```
ApexPages.StandardController sc = new ApexPages.StandardController(c);
DirectMailfilter dmf = new D... | For StandardSetController you should define the test like below or you can do it in the class or trigger.
```
PageReference myVfPage = Page.VisualForce API Name;
Test.setCurrentPage(myVfPage);
List<You Custom Object > MyStuff = [ select id from Your Custom Object Name];
ApexPages.StandardSetController setCon = new A... |
9,290,141 | in my system i should send notification mail after reviewing a list
i am using DNN
there is the Code i use
```
private void SendEmailNotification()
{
DotNetNuke.Services.Mail.Mail.SendMail("mail@gmail.com", "mail@ymail.com", String.Empty, "URL Test", "this is a test of dnnmail: <a href='http://www.dotn... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9290141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1109400/"
] | `SendMail` should return a `string`, which gives an error message if there's an error. You may also check the Event Viewer to see if anything was logged there. Can you send the test email from the SMTP section of the Host Settings page? Is your SMTP server setup to allow sending as gmail.com (or whatever domain you're ... | To add to the previous answers...
DNN will respect settings in the web.config file so even if the SMTP settings are configured in the CMS, they may be ignored depending on what is in the web.config. Specifically, if a pickup directory is specified in the web.config as is shown in the following snippet, it will overrid... |
9,290,141 | in my system i should send notification mail after reviewing a list
i am using DNN
there is the Code i use
```
private void SendEmailNotification()
{
DotNetNuke.Services.Mail.Mail.SendMail("mail@gmail.com", "mail@ymail.com", String.Empty, "URL Test", "this is a test of dnnmail: <a href='http://www.dotn... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9290141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1109400/"
] | When calling SendMail you are using the settings from the Host Settings section of the site. If the information is incorrect, you should get an exception out of this call.
Therefore, you might want to check to see if there is anything in Event Viewer indicating an error.
Additionally, depending on the from/to addres... | To add to the previous answers...
DNN will respect settings in the web.config file so even if the SMTP settings are configured in the CMS, they may be ignored depending on what is in the web.config. Specifically, if a pickup directory is specified in the web.config as is shown in the following snippet, it will overrid... |
43,170,414 | I'm trying to use urllib to get content from this url:"<https://blockexplorer.com/block-index/0>" . But when the browser load this link, it will be redirect to another link "<https://blockexplorer.com/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f>".
Here is my code:
```
import urllib
link = ... | 2017/04/02 | [
"https://Stackoverflow.com/questions/43170414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2740810/"
] | If you are willing to use the Python request module you could try the following code:
```
r = requests.get('https://blockexplorer.com/block-index/0', allow_redirects=True)
```
Which should give you the contents of the page after the request | The site you are trying to crawl does not accept the header `*/*` (default for urllib), but accept `text/html`. You can crawl with the following code:
```
import urllib2
link = "http://blockexplorer.com/block-index/0"
r = urllib2.Request(url=link)
r.add_header('Accept', 'text/html')
response = urllib2.urlopen(r)
prin... |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | While this does not appear to be a solution for you, this exact same error message appears if the chunk is not ended properly.
I experienced this error and traced it to ending chunk with `` instead of ```. Correcting the syntax of the chunk solved the problem I experienced with the same error message as you. | Are you sure that knitr is running from the directory you think it is? It appears that it is failing to find the file.
* use an absolute path, if that fixes it, you've found your problem
* once you've done that, you can use `opts_knit$set(root.dir = "...")` -- don't use `setwd(.)` if you want it (the cwd) to be mainta... |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | Are you sure that knitr is running from the directory you think it is? It appears that it is failing to find the file.
* use an absolute path, if that fixes it, you've found your problem
* once you've done that, you can use `opts_knit$set(root.dir = "...")` -- don't use `setwd(.)` if you want it (the cwd) to be mainta... | It may have to do with the "r" at the end of the triple backquotes demarcating your code chunk. There should be nothing after the triple backquotes, but I think the problem is specifically that the letter is "r".
The issue stems from the fact that R markdown processes backquoted statements starting with `r` as [inline... |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | Are you sure that knitr is running from the directory you think it is? It appears that it is failing to find the file.
* use an absolute path, if that fixes it, you've found your problem
* once you've done that, you can use `opts_knit$set(root.dir = "...")` -- don't use `setwd(.)` if you want it (the cwd) to be mainta... | You should use the following similar syntax, I had the same exact issue but got it fixed:
```
```{r views}
bank.df <- read.csv("C:/Users/User/Desktop/Banks.csv", header = TRUE) #load data
dim(bank.df) # to find dimension of data frame
head(bank.df) # show first six rows
```
```
the ``` has to be in the end of t... |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | Are you sure that knitr is running from the directory you think it is? It appears that it is failing to find the file.
* use an absolute path, if that fixes it, you've found your problem
* once you've done that, you can use `opts_knit$set(root.dir = "...")` -- don't use `setwd(.)` if you want it (the cwd) to be mainta... | In my case was that I finished the code with four comas, not three . Check this and If you finished with four comas too, try to delete one of them. |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | While this does not appear to be a solution for you, this exact same error message appears if the chunk is not ended properly.
I experienced this error and traced it to ending chunk with `` instead of ```. Correcting the syntax of the chunk solved the problem I experienced with the same error message as you. | It may have to do with the "r" at the end of the triple backquotes demarcating your code chunk. There should be nothing after the triple backquotes, but I think the problem is specifically that the letter is "r".
The issue stems from the fact that R markdown processes backquoted statements starting with `r` as [inline... |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | While this does not appear to be a solution for you, this exact same error message appears if the chunk is not ended properly.
I experienced this error and traced it to ending chunk with `` instead of ```. Correcting the syntax of the chunk solved the problem I experienced with the same error message as you. | You should use the following similar syntax, I had the same exact issue but got it fixed:
```
```{r views}
bank.df <- read.csv("C:/Users/User/Desktop/Banks.csv", header = TRUE) #load data
dim(bank.df) # to find dimension of data frame
head(bank.df) # show first six rows
```
```
the ``` has to be in the end of t... |
31,327,043 | I have lots of folders including images in it. Example:
```
C:\U2090_08
C:\U2111_08
C:\U2024_03
C:\U2024_08
C:\U2049_15
C:\U2049_35
```
There are 3-4 jpg files in every folder. I want to create a sub-folder called "kck" in every folder and move jpg files to this subfolder.
Example:
Before process:
```
C:\U2049... | 2015/07/09 | [
"https://Stackoverflow.com/questions/31327043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5100231/"
] | While this does not appear to be a solution for you, this exact same error message appears if the chunk is not ended properly.
I experienced this error and traced it to ending chunk with `` instead of ```. Correcting the syntax of the chunk solved the problem I experienced with the same error message as you. | In my case was that I finished the code with four comas, not three . Check this and If you finished with four comas too, try to delete one of them. |
221,428 | I am trying to **programmatically** create an SSIS package containing a simple data flow from table A to table B in the same database. I am using the example given [here](http://technet.microsoft.com/en-us/library/ms136020.aspx).
The package gets created and saved to a dtsx file, but when I open it in visual studio I s... | 2008/10/21 | [
"https://Stackoverflow.com/questions/221428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20358/"
] | Yes, this is one of my frustrations with SSIS: that they do not provide simple table or map of the new terminology.
You can use a small piece of code to discover components available for use.
The code is located here:
<http://msdn.microsoft.com/en-us/library/ms136106.aspx>
When I ran it, I found the moniker for cop... | I used to have a copy of [SQL Server 2005 Integration Services](http://www.wrox.com/WileyCDA/WroxTitle/Professional-SQL-Server-2005-Integration-Services.productCd-0764584359.html), a Wrox book. I am pretty sure it has a whole chapter or two dedicated to programmatically working with SSIS packages. You may want to check... |
221,428 | I am trying to **programmatically** create an SSIS package containing a simple data flow from table A to table B in the same database. I am using the example given [here](http://technet.microsoft.com/en-us/library/ms136020.aspx).
The package gets created and saved to a dtsx file, but when I open it in visual studio I s... | 2008/10/21 | [
"https://Stackoverflow.com/questions/221428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20358/"
] | If you don't want to use the DTS .net assemblies you can use EzApi which provides a simpler syntax to create SSIS package programmatically.
>
> EzAPI is a .NET library written in C# by Evgeny Koblov one of the testers on the SSIS team to abstracts away a lot of the cumbersome low-level coding needed to create SSIS pa... | I used to have a copy of [SQL Server 2005 Integration Services](http://www.wrox.com/WileyCDA/WroxTitle/Professional-SQL-Server-2005-Integration-Services.productCd-0764584359.html), a Wrox book. I am pretty sure it has a whole chapter or two dedicated to programmatically working with SSIS packages. You may want to check... |
221,428 | I am trying to **programmatically** create an SSIS package containing a simple data flow from table A to table B in the same database. I am using the example given [here](http://technet.microsoft.com/en-us/library/ms136020.aspx).
The package gets created and saved to a dtsx file, but when I open it in visual studio I s... | 2008/10/21 | [
"https://Stackoverflow.com/questions/221428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20358/"
] | Yes, this is one of my frustrations with SSIS: that they do not provide simple table or map of the new terminology.
You can use a small piece of code to discover components available for use.
The code is located here:
<http://msdn.microsoft.com/en-us/library/ms136106.aspx>
When I ran it, I found the moniker for cop... | If you don't want to use the DTS .net assemblies you can use EzApi which provides a simpler syntax to create SSIS package programmatically.
>
> EzAPI is a .NET library written in C# by Evgeny Koblov one of the testers on the SSIS team to abstracts away a lot of the cumbersome low-level coding needed to create SSIS pa... |
13,210,680 | I want to perform `[document doSomething]` as soon as `[document isBusy]` is false. What is the best way to do it? I tried it with a while-loop but that delays the following code, which is not what I want. | 2012/11/03 | [
"https://Stackoverflow.com/questions/13210680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852592/"
] | **If the action a semantic of your document model**
From your question both `isBusy` and `doSomething` are features of your document and the action to `doSomething` when `isBusy` goes false is appears to be a *semantic of your document model* and should therefore be implemented *by your document model*, i.e. something... | If `isBusy` has a associated setter method, you can call `doSomething` in that setter. A better option would be to use [Key Value Observing](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueObserving/) to observe the value of `isBusy` and take action when it changes. |
13,210,680 | I want to perform `[document doSomething]` as soon as `[document isBusy]` is false. What is the best way to do it? I tried it with a while-loop but that delays the following code, which is not what I want. | 2012/11/03 | [
"https://Stackoverflow.com/questions/13210680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852592/"
] | **If the action a semantic of your document model**
From your question both `isBusy` and `doSomething` are features of your document and the action to `doSomething` when `isBusy` goes false is appears to be a *semantic of your document model* and should therefore be implemented *by your document model*, i.e. something... | Use KVC/KVO (Key Value Coding and Key Value Observation). The subject is covered well in the Apple Documentation. KVO and KVC is a basic programming technique which provides may solutions to your problem. |
43,569,738 | Noodling around with Spark, using `union` to build up a suitably large test dataset. This works OK:
`val df = spark.read.json("/opt/spark/examples/src/main/resources/people.json")
df.union(df).union(df).count()`
But I'd like to do something like this:
`val df = spark.read.json("/opt/spark/examples/src/main/resources/p... | 2017/04/23 | [
"https://Stackoverflow.com/questions/43569738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/201657/"
] | If you use val on the dataset it becomes an immutable variable. That means you can't do any reassignments. If you change your definition to `var df` your code should work.
A functional approach without mutable data is:
```
val df = List(1,2,3,4,5).toDF
val bigDf = ( for (a <- 1 until 10) yield df ) reduce (_ union _)... | You could also do this with tail recursion using an arbitrary range:
```
@tailrec
def bigUnion(rng: Range, df: DataFrame): DataFrame = {
if (rng.isEmpty) df
else bigUnion(rng.tail, df.union(df))
}
val resultingBigDF = bigUnion(1.to(10), myDataFrame)
```
Please note this is untested code based on a similar things... |
655,218 | The base of S is an elliptical region with boundary curve $25x^2+16y^2=400$. Cross-sections perpendicular to the x-axis are isosceles right triangles with hypotenuse in the base.
i got 400/3
my work <http://puu.sh/6BPTe>

is this correct? | 2014/01/28 | [
"https://math.stackexchange.com/questions/655218",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/124586/"
] | Yes, your answer is fine!
This is because the area of an isosceles right triangle with hypotenuse on the base has area equal to $\displaystyle \frac{1}{2}h^2$, and when isolating $y$, you multiply the length of the hypotenuse by $2$ to compensate for the entire ellipse. | (aiming for this question to have an answer)
Looks fine to me (except for the $l$ and $y$ not written as maths where they are first defined ;) ). |
57,206,341 | I'm trying to import data from a database using Django. This was previously done using SQL, but now I'm trying to use Django instead of SQL. I'm not familiar with SQL really and am having trouble converting the SQL import to a Django one.
So far, I've converted `con = psycopg2.connect("dbname='mydatabase' user='mydata... | 2019/07/25 | [
"https://Stackoverflow.com/questions/57206341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We can use `complete`. Assuming that the OP's input data is `matrix` (because `data.frame` doesn't allow duplicate row names and assuming that there is row.names - wow lot of assumptions), create a data.frame with `as.data.frame` while `cbind`ing the row.names as a column, grouped by 'Subject', use `complete` to get th... | ```
> foo = function(x){
+ r = range(x)
+ as.numeric(seq(r[1], r[2]) %in% x)
+ }
> do.call(rbind, lapply(split(1:NROW(dat), row.names(dat)), function(i){
+ temp = dat[i,]
+ temp = temp[with(rle(cumsum(foo(temp[,"Day"]))), rep(seq_along(lengths), lengths)),]
+ temp[,"Day"] = ave(temp[, "Day"], temp[,... |
57,206,341 | I'm trying to import data from a database using Django. This was previously done using SQL, but now I'm trying to use Django instead of SQL. I'm not familiar with SQL really and am having trouble converting the SQL import to a Django one.
So far, I've converted `con = psycopg2.connect("dbname='mydatabase' user='mydata... | 2019/07/25 | [
"https://Stackoverflow.com/questions/57206341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We can use `complete`. Assuming that the OP's input data is `matrix` (because `data.frame` doesn't allow duplicate row names and assuming that there is row.names - wow lot of assumptions), create a data.frame with `as.data.frame` while `cbind`ing the row.names as a column, grouped by 'Subject', use `complete` to get th... | Slightly based on @akrun 's answer
```
library(tidyverse)
df <- cbind(Subject = row.names(dat), as.data.frame(dat))
df %>% group_by(Subject) %>%
mutate(day_diff = c(diff(Day), 1)) %>%
uncount(day_diff) %>%
mutate(Day = first(Day):last(Day)) %>%
ungroup()
``` |
41,938,244 | How can i filter this JSON by an element (in this case the id) without using the index?
```
ABC: [{
ID: home,
elementsHome: [
{
el1: x,
el2: y},
{
el3: d,
el4: s}]
},
{
ID: payments,
elementsPaymets: etc...
}];
```
An html with an ng-repeat like this doesn't... | 2017/01/30 | [
"https://Stackoverflow.com/questions/41938244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7301611/"
] | ```
ABC.filter(function(item) {
return item.id === 'whatever you want to check'
})
```
Array.prototype.filter iterates over an array and returns a new filtered array based on a function you provide. That function receives the array item, index and the array as parameters. Your function must return true or false. If... | ```
_.filter(ABC, { 'id': 'good' });
``` |
77,526 | I have two custom objects Event & it's child Event\_Attendee. Now I have a Mobile ID field on Event\_Attendee based on which I need below validation Rule.
```
OR(AND(Event_Attendee_Count__c > 1 ,
Mobile_ID_vod__c=null),AND(Event_Attendee_Count__c = 1,
Mobile_ID_vod__c!=null))
```
How to capture child object... | 2015/05/27 | [
"https://salesforce.stackexchange.com/questions/77526",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/10578/"
] | Judging from your question, you don't necessarily require the mobile ID field value but you want to know whether it's filled in any of the child records.
In order to find out, create an additional rollup summary field (e.g. `Mobile_ID_Count__c`) that does a count of Event\_Attendee\_\_c, but in the roll-up field's `fi... | I think you can do this by defining Event\_Attendee\_Count\_\_c as COUNT(RowCount), in other words, to count the number of Event\_Attendee records. |
19,952,405 | I my webapp I use about 30 js files, each file containing 1 function. All these function are now selfinvoking and have references to each other.
The problem with this is that the order of scripts in the index.jsp matters. If a method is called on a function which has not been invoked yet we get a undefined error.
Fo... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19952405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/628918/"
] | You could use [RequireJS](http://requirejs.org/) or similar loader, which would handle script dependencies for you.
You would need to modify each of JS file to make it a module in a similar fashion to this example:
```
// File: module3.js
define(["module1", "module2"], function(m1, m2) {
// Here, module1 and modu... | Try to build your server-side architecture to serve proper js files (and other static files) per page. Create 1 minified js file for page and initialize objects scope in html files. |
71,708,838 | I have table `reports`:
| id | file\_name |
| --- | --- |
| 1 | jan.xml |
| 2 | jan.csv |
| 3 | feb.csv |
In human language: there are reports for each month. Each report could be in XML or CSV format. There could be 1-2 reports for each month in unique format.
I want to select the reports for all months, picking on... | 2022/04/01 | [
"https://Stackoverflow.com/questions/71708838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8050208/"
] | As mentioned in the comments your data structure has a number of challenges. It really needs a column for ReportDate or something along those lines that is a date/datetime so you know which month the report belongs to. That would also give you something to sort by when you get your data back. Aside from those much need... | You may want to use a window function that ranks your rows by partitioning on the month and ordering by the format name, by working on the `file_name` field.
```
WITH ranked_reports AS (
SELECT
id,
file_name,
ROW_NUMBER() OVER(
PARTITION BY LEFT(file_name, 3)
ORDER... |
18,888,489 | My data is coming from the servers and I am storing it in a dictionary. There is a key called description in the dictionary which contains the HTML code for the description. I don't want to save the HTML code in a file because the dictionary contains a lot more dictionaries with similar description key within each. I w... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18888489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2640879/"
] | For example:
```
NSString *htmlString = [result objectforKey:@"HtmlValue"];
[webview loadHTMLString:htmlString baseURL:Nil];
``` | ```
[webview loadHTMLString:stringName baseURL:Nil];
```
Also Visit [here](https://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html) it will be more helpful for you |
18,888,489 | My data is coming from the servers and I am storing it in a dictionary. There is a key called description in the dictionary which contains the HTML code for the description. I don't want to save the HTML code in a file because the dictionary contains a lot more dictionaries with similar description key within each. I w... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18888489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2640879/"
] | For example:
```
NSString *htmlString = [result objectforKey:@"HtmlValue"];
[webview loadHTMLString:htmlString baseURL:Nil];
``` | Add file.html in your project resources.
Use this code to load in the web view:
```
NSString *path = [[NSBundle mainBundle]pathForResource:@"file" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[_helpWebView loadHTMLString:htmlString ba... |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | Try option -Ffull\_name, ex:
```
ssmtp login@mail.com -F"Look at me"
```
i'll change full name.
there is also -f for changing sender email, ex:
```
ssmtp -f"helper@world" -F"SuperHero" save@our.world
``` | Looks like FromLineOverride=YES doesn't work anymore.
I guess GMAIL is not allowing this now. But I am not sure. |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | You can set up a reverse alias in `/etc/ssmtp/revaliases`
`root:someone@yourdomain.tld`
it's hidden at the bottom of the [man page](http://linux.die.net/man/8/ssmtp). | Try option -Ffull\_name, ex:
```
ssmtp login@mail.com -F"Look at me"
```
i'll change full name.
there is also -f for changing sender email, ex:
```
ssmtp -f"helper@world" -F"SuperHero" save@our.world
``` |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | You can set up a reverse alias in `/etc/ssmtp/revaliases`
`root:someone@yourdomain.tld`
it's hidden at the bottom of the [man page](http://linux.die.net/man/8/ssmtp). | The `-F` option works if you are specifying the email params on the ssmtp command line, e.g.
`echo "Test email" | ssmtp -F"New name" -v to@gmail.com`
If you want all emails sent from root@ to come from a certain name, you can change the Linux user information as described in [this StackOverflow answer](https://stac... |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | Add the following in Your /etc/ssmtp/ssmtp.conf file and You will capable to set any name and email during runtime :
```
FromLineOverride=YES
``` | Change the 'From' text by editing `/etc/passwd` to receive mail from 'YOUR NAME HERE' instead of just 'root'.
```
chfn -f 'YOUR NAME HERE' root
```
Check it using `grep root /etc/passwd`
```
root:x:0:0:YOUR NAME HERE,,,:/root:/bin/bash
```
[Found it here](https://wiki.archlinux.org/index.php/SSMTP#Forward_to_a_Gm... |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | I suggest you switch from ssmtp to msmtp since ssmtp is not actively developed any more. msmtp provides all the same features as ssmtp plus more. In particular, with msmtp you can [set the from setting](http://msmtp.sourceforge.net/doc/msmtp.html#Envelope_002dfrom-address) to control who the mail appears to be sent fro... | Change the 'From' text by editing `/etc/passwd` to receive mail from 'YOUR NAME HERE' instead of just 'root'.
```
chfn -f 'YOUR NAME HERE' root
```
Check it using `grep root /etc/passwd`
```
root:x:0:0:YOUR NAME HERE,,,:/root:/bin/bash
```
[Found it here](https://wiki.archlinux.org/index.php/SSMTP#Forward_to_a_Gm... |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | Try option -Ffull\_name, ex:
```
ssmtp login@mail.com -F"Look at me"
```
i'll change full name.
there is also -f for changing sender email, ex:
```
ssmtp -f"helper@world" -F"SuperHero" save@our.world
``` | I'm also using **ssmtp** and, even though I tried the other solutions, none of them worked for me.
However, it worked for me with GMail by defining the "From" field as:
```
...
From: Your Name Here <your_email_here@gmail.com>
...
```
I hope this helps! |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | I suggest you switch from ssmtp to msmtp since ssmtp is not actively developed any more. msmtp provides all the same features as ssmtp plus more. In particular, with msmtp you can [set the from setting](http://msmtp.sourceforge.net/doc/msmtp.html#Envelope_002dfrom-address) to control who the mail appears to be sent fro... | I'm also using **ssmtp** and, even though I tried the other solutions, none of them worked for me.
However, it worked for me with GMail by defining the "From" field as:
```
...
From: Your Name Here <your_email_here@gmail.com>
...
```
I hope this helps! |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | Looks like FromLineOverride=YES doesn't work anymore.
I guess GMAIL is not allowing this now. But I am not sure. | I'm also using **ssmtp** and, even though I tried the other solutions, none of them worked for me.
However, it worked for me with GMail by defining the "From" field as:
```
...
From: Your Name Here <your_email_here@gmail.com>
...
```
I hope this helps! |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | Add the following in Your /etc/ssmtp/ssmtp.conf file and You will capable to set any name and email during runtime :
```
FromLineOverride=YES
``` | The `-F` option works if you are specifying the email params on the ssmtp command line, e.g.
`echo "Test email" | ssmtp -F"New name" -v to@gmail.com`
If you want all emails sent from root@ to come from a certain name, you can change the Linux user information as described in [this StackOverflow answer](https://stac... |
221,696 | My root user send emails with ssmtp. However I can't change "From: *root* ..." root name. Is there any way to send email with another name without using another user?
Tried:
echo 'From: "New name" ' | ssmtp to@gmail.com -v | 2011/01/12 | [
"https://serverfault.com/questions/221696",
"https://serverfault.com",
"https://serverfault.com/users/66637/"
] | Add the following in Your /etc/ssmtp/ssmtp.conf file and You will capable to set any name and email during runtime :
```
FromLineOverride=YES
``` | Try option -Ffull\_name, ex:
```
ssmtp login@mail.com -F"Look at me"
```
i'll change full name.
there is also -f for changing sender email, ex:
```
ssmtp -f"helper@world" -F"SuperHero" save@our.world
``` |
16,988,966 | The issue
---------
I'm trying to run apt-get on Ubuntu virtual box, but I keep getting connection and time-out errors. I'm not sure what is causing them because the proxies are set. Here is my system:
System config
-------------
```
HOST: Win 7 Enterprise, SP1 (64-bit OS)
RAM: 8 GB
CPU: Intel i5 2.6GHz
VirtualBox 4... | 2013/06/07 | [
"https://Stackoverflow.com/questions/16988966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1316396/"
] | I found out the answer. Here is the fix:
add these two lines to `/etc/apt/apt.conf` as sudo
```
Acquire::http::proxy "http://somecorpdom:8080/";
Acquire::https::proxy "https://somecorpdom:8080/";
```
then apt-get should work in your Ubuntu. (Change "somecorpdom" to your proxy) | You can just export the proxy as you did:
```
export http_proxy=http://proxy.somecorpdom:8080/
export https_proxy=https://proxy.somecorpdom:8080/
```
And then try `sudo -E apt-get update`. |
15,286,320 | I'm a complete stranger to ASP.NET. But, I've had a project to do using it & faced a problem.
It is :
1. I have a login.aspx File - Where Users provide login User name & Password
2. If Login details (match Data Base) OK then User automatically redirects to logged\_in.aspx.
3. There's a label (lbl\_show) in redirected... | 2013/03/08 | [
"https://Stackoverflow.com/questions/15286320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1664967/"
] | Android's [BaseMovementMethod](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/text/method/BaseMovementMethod.java) includes code for handling `ACTION_MULTIPLE` so presumably the event is generated for key auto-repeat when the user holds down an arrow key. | I'm not sure, but I would think that ACTION\_MULTIPLE would probably be triggered by actual buttons on a blutooth keyboard for instance. I think that the reason you're just getting ACTION\_UP and ACTION\_DOWN is because those are the pre-defined KeyEvents for your headset controls. I hope this helps. :) |
27,783,157 | I have a table like that
IVA
```
id - taxa - name - date
1 - 0.18 - normal - 1/1/2014
2 - 0 - none - 1/1/2014
3 - 0.23 - max - 1/1/2013
4 - 0.16 - normal - 1/1/2015
...
```
I have an `IVA.id` from a product and I want to know in current date what is the taxa.
So I have to query this table twice:
``... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27783157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1977936/"
] | Please try:
```
Select taxa
from IVA
where name in (Select a.name from IVA a where a.id = 1)
and date<='12/12/2015';
``` | Depends on the database engine you're using, but you may want to look up the UNION keyword for your database. |
27,783,157 | I have a table like that
IVA
```
id - taxa - name - date
1 - 0.18 - normal - 1/1/2014
2 - 0 - none - 1/1/2014
3 - 0.23 - max - 1/1/2013
4 - 0.16 - normal - 1/1/2015
...
```
I have an `IVA.id` from a product and I want to know in current date what is the taxa.
So I have to query this table twice:
``... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27783157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1977936/"
] | Please try:
```
Select taxa
from IVA
where name in (Select a.name from IVA a where a.id = 1)
and date<='12/12/2015';
``` | Why not use subqueries as below :
```
Select taxa
from IVA
where name=(select top 1 name from IVA where id = 1)
and date<='12/12/2015';
```
I have assumed that you might get different names in case there are duplicate IDs, hence Top 1.
In case you want to use all the names used IN clause as :
```
Select taxa
fr... |
27,783,157 | I have a table like that
IVA
```
id - taxa - name - date
1 - 0.18 - normal - 1/1/2014
2 - 0 - none - 1/1/2014
3 - 0.23 - max - 1/1/2013
4 - 0.16 - normal - 1/1/2015
...
```
I have an `IVA.id` from a product and I want to know in current date what is the taxa.
So I have to query this table twice:
``... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27783157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1977936/"
] | Please try:
```
Select taxa
from IVA
where name in (Select a.name from IVA a where a.id = 1)
and date<='12/12/2015';
``` | You might try the following:
```
SELECT i1.name, i1.taxa
FROM iva i1, iva i2
WHERE i1.date <= '12/12/2015'
AND i1.name = i2.name
AND i2.id = 1
```
You don't specify a DBMS in your question so I'm not entirely certain that the above date format will work. |
355,808 | I'm interested in running airodump-ng as a background task, since I only need the exported results and don't need to interact with it.
However, the following operation doesn't work:
airodump-ng wlan0 &
I tried digging into the code but the only solution I see would be to remove all output operations, which seems not... | 2017/04/04 | [
"https://unix.stackexchange.com/questions/355808",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/46450/"
] | I finally was able to run airodump-ng in background by using tmux the following way:
```
tmux new -d -> creates a new tmux window in background
tmux send -Rt 0 airodump-ng SPACE wlan0 ENTER -> sends the given keys to the backgound terminal
```
This way, airodump-ng works and doesn't take 100% CPU like with screen. | You can use screen to run command in background while still preserving it's output. Use something like
```
screen -d -m airodump-ng wlan0
```
You can later re-attach to the screen by running:
```
screen -r
```
and stop your command or do whatever else you need to do.
If you have more than one screens active, you... |
355,808 | I'm interested in running airodump-ng as a background task, since I only need the exported results and don't need to interact with it.
However, the following operation doesn't work:
airodump-ng wlan0 &
I tried digging into the code but the only solution I see would be to remove all output operations, which seems not... | 2017/04/04 | [
"https://unix.stackexchange.com/questions/355808",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/46450/"
] | You can use screen to run command in background while still preserving it's output. Use something like
```
screen -d -m airodump-ng wlan0
```
You can later re-attach to the screen by running:
```
screen -r
```
and stop your command or do whatever else you need to do.
If you have more than one screens active, you... | There is a hidden option that informs airodump-ng to run in a background. The interactive thread will not be started:
```
airodump-ng -K 1 wlan0
```
information found here: <https://forum.aircrack-ng.org/index.php?topic=648.0>
This should fix the high CPU usage bug. |
355,808 | I'm interested in running airodump-ng as a background task, since I only need the exported results and don't need to interact with it.
However, the following operation doesn't work:
airodump-ng wlan0 &
I tried digging into the code but the only solution I see would be to remove all output operations, which seems not... | 2017/04/04 | [
"https://unix.stackexchange.com/questions/355808",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/46450/"
] | I finally was able to run airodump-ng in background by using tmux the following way:
```
tmux new -d -> creates a new tmux window in background
tmux send -Rt 0 airodump-ng SPACE wlan0 ENTER -> sends the given keys to the backgound terminal
```
This way, airodump-ng works and doesn't take 100% CPU like with screen. | There is a hidden option that informs airodump-ng to run in a background. The interactive thread will not be started:
```
airodump-ng -K 1 wlan0
```
information found here: <https://forum.aircrack-ng.org/index.php?topic=648.0>
This should fix the high CPU usage bug. |
9,563,527 | I am using JSF 2.0 to develop a pretty big and complex page which contains numerous fields. Thre would be quit command button at the buttom of the page and when ever user selects the quit option I need to detect whether user has entered any value on one of the fields of the page.
I am using the null check of each fiel... | 2012/03/05 | [
"https://Stackoverflow.com/questions/9563527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220373/"
] | For that the `valueChangeListener` attribute is meant to be used.
```
<h:inputText ... valueChangeListener="#{bean.changed}" />
```
with
```
public void changed(ValueChangeEvent event) {
this.changed = true;
}
``` | Your field-values are probably linked to properties of the backing-bean. When the value is changed, the setter is invoked. Inside the setter you could set a boolean field of the bean to true, if the value actually changed.
```
public void setPropertyX(Type newValue) {
if(!newValue.equals(this.X)) {
this.X ... |
36,737,496 | My query is taking < 3 milli sec to execute. But the problem is, I am creating a pojo class objects from the cursor I got from query execution. This object creation and setting values to fields is taking too much time more than 140 milli sec. Pojo class has around 36 fields. Any suggestion to solve this problem.?
Than... | 2016/04/20 | [
"https://Stackoverflow.com/questions/36737496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3415862/"
] | I know that the `c.getColumnIndex()` method takes more time. The best method that I know to speed up the things is the following:
```
Cursor c = null;
try {
c = db.query(......);
if(c != null) {
int channelIdIndex = c.getColumnIndex(OptimizedMessage.CHANNEL_ID);
int clientIdIndex = c.getColumn... | How many objects are you instantiating?
36 fields doesn't seen too much.
If you have many objects, you could instantiate them in a separate thread. Of course you will have to set up some kind of callback to find out when everything is loaded |
47,536,156 | I have two arrays of strings that I am trying to combine into one array. The two arrays are in alphabetical order. I have to combine them into alphabetical order. The way I attempted to do this was to create the combined list as the first list followed by the second list, and then sort them. Unfortunately, my instructo... | 2017/11/28 | [
"https://Stackoverflow.com/questions/47536156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021097/"
] | You have to set the desired text when calling your second activity, as an extra in the calling intent.
```
Intent starterIntent = new Intent(FirstActivity.class.this,SecondActivity.class)
starterIntent.putExtra("text_key", "<your text>");
```
"text\_key" is the look up key that will let you retrieve the text in the ... | Pass the text as putextra while launching activity and then in onCreate of Activity getString and display to text view on the basis of your filteration. |
47,536,156 | I have two arrays of strings that I am trying to combine into one array. The two arrays are in alphabetical order. I have to combine them into alphabetical order. The way I attempted to do this was to create the combined list as the first list followed by the second list, and then sort them. Unfortunately, my instructo... | 2017/11/28 | [
"https://Stackoverflow.com/questions/47536156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021097/"
] | You have to set the desired text when calling your second activity, as an extra in the calling intent.
```
Intent starterIntent = new Intent(FirstActivity.class.this,SecondActivity.class)
starterIntent.putExtra("text_key", "<your text>");
```
"text\_key" is the look up key that will let you retrieve the text in the ... | It's unclear what do you want to achieve, do you want two textviews or same textview and two different text?
Nevertheless, I am going to answer for both the condition.
If you want to have multiple textviews then use the setVisibilty method to view or hide the other textview as :
```
// here btn is your button and tx... |
2,229,419 | How to prove
$$\int\_0^1 \frac{1}{1-t} \bigg( \frac{1}{\sqrt{1-4 x}}-\frac{1}{\sqrt{1-4 t
x}}\bigg) \, dt=\frac{2}{\sqrt{1-4x}}\log \bigg(\frac{1+\sqrt{1-4x}}{2\sqrt{1-4x}}\bigg)$$ | 2017/04/11 | [
"https://math.stackexchange.com/questions/2229419",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/159409/"
] | This is a weird one. Put $t = \frac{1}{4x}(1-u^2)$. The limits become $1$ and $\sqrt{1-4x}$. Then
$$ \frac{dt}{1-t} = \frac{2u \, du}{1-4x-u^2}, $$
while $1/\sqrt{1-4tx} = 1/u$. But $1-4x-u^2 = (\sqrt{1-4x}+u)(\sqrt{1-4x}-u)$, so we can cancel part of this with the numerator of
$$\frac{1}{\sqrt{1-4x}}-1/u = \frac{u-\sq... | Hint 1:
$$\sqrt{1-4xt}-\sqrt{1-4x}={4x(1-t)\over\sqrt{1-4xt}+\sqrt{1-4x}}$$
which suggests the change of variable $u=4xt$.
Hint 2: Letting $1-u=w^2$ (and abbreviating $\sqrt{1-4x}$ to $a$), we have
$$\int{du\over a\sqrt{1-u}(\sqrt{1-u}+a)}={1\over a}\int{-2wdw\over w(w+a)}$$
Now use partial fractions. |
55,055 | Most tutorials online show how to install PEAR by doing this:
```
sudo apt-get install php-pear
```
This installs version 1.6.1. It works great because it's super easy! My problem is that I want to install PHPUnit and it requires PEAR version 1.8.1 so my install of PHPUnit failed. So how do I install a newer version... | 2009/10/14 | [
"https://superuser.com/questions/55055",
"https://superuser.com",
"https://superuser.com/users/13663/"
] | First, install PEAR.
```
sudo apt-get install php-pear
```
Next, tell PEAR to update its own channel.
```
sudo pear channel-update pear.php.net
```
Then, tell PEAR to upgrade itself to the newest version.
```
sudo pear upgrade-all
```
You should now have the newest version of PEAR installed.
To install PHPUni... | Last versions of PhpUnit require ez/zeta components & symfony's YAML lib
```
sudo apt-get install php-pear
sudo pear channel-update pear.php.net
sudo pear upgrade-all
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear ins... |
55,055 | Most tutorials online show how to install PEAR by doing this:
```
sudo apt-get install php-pear
```
This installs version 1.6.1. It works great because it's super easy! My problem is that I want to install PHPUnit and it requires PEAR version 1.8.1 so my install of PHPUnit failed. So how do I install a newer version... | 2009/10/14 | [
"https://superuser.com/questions/55055",
"https://superuser.com",
"https://superuser.com/users/13663/"
] | First, install PEAR.
```
sudo apt-get install php-pear
```
Next, tell PEAR to update its own channel.
```
sudo pear channel-update pear.php.net
```
Then, tell PEAR to upgrade itself to the newest version.
```
sudo pear upgrade-all
```
You should now have the newest version of PEAR installed.
To install PHPUni... | If installation using above command failed, You might need to install `Net_URL2-0.3.1` and then `HTTP_Request2-2.0.0RC1` before installation of PHPUnit on Ubuntu.
Find the latest version of the above packages and install them.
Example:
`sudo apt-get install curl`
`sudo pear install pear/Net_URL2-0.3.1`
`sudo pear i... |
55,055 | Most tutorials online show how to install PEAR by doing this:
```
sudo apt-get install php-pear
```
This installs version 1.6.1. It works great because it's super easy! My problem is that I want to install PHPUnit and it requires PEAR version 1.8.1 so my install of PHPUnit failed. So how do I install a newer version... | 2009/10/14 | [
"https://superuser.com/questions/55055",
"https://superuser.com",
"https://superuser.com/users/13663/"
] | Last versions of PhpUnit require ez/zeta components & symfony's YAML lib
```
sudo apt-get install php-pear
sudo pear channel-update pear.php.net
sudo pear upgrade-all
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear ins... | If installation using above command failed, You might need to install `Net_URL2-0.3.1` and then `HTTP_Request2-2.0.0RC1` before installation of PHPUnit on Ubuntu.
Find the latest version of the above packages and install them.
Example:
`sudo apt-get install curl`
`sudo pear install pear/Net_URL2-0.3.1`
`sudo pear i... |
308,095 | Is the following consistent with $\text{ZF}$?
There exists a set $S=\{x\_1,x\_2,x\_3,...\}$ such that:
1. $|x\_{i+1}| < |x\_i|$
2. $\forall m,n \in S (|P(m)|=|P(n)|)$
Where cardinality $``||"$ is defined after Scott's. | 2018/08/12 | [
"https://mathoverflow.net/questions/308095",
"https://mathoverflow.net",
"https://mathoverflow.net/users/95347/"
] | Yes.
For silly reasons.
Suppose that $X$ is a Dedekind-finite set, then $S(X)$, the set of all injective finite *sequences* from $X$ is also Dedekind-finite. Let $S\_n(X)$ denote the subset of $S(X)$ of sequences whose domain is *at least* $n$. It is easy to see why $S\_n(X)$ surjects onto $S(X)$. Simply erase the fi... | This is consistent, at least under a rather tame large cardinal assumption. (One can also produce examples by manipulating Dedekind finite sets, but Asaf's answer addresses this. The answer here works even in the context of $\mathsf{DC}$.)
For instance, see
>
> [MR3612001](https://mathscinet.ams.org/mathscinet-getit... |
250,840 | I'm trying to start an about 10 years old PC computer. But nothing is shown on the screen, and it beeps everytime I press a key on the keyboard. I can press Ctrl+Alt+Del to reboot the computer. The monitor is newer and seem to work with other computers.
I don't see anything from POST/BIOS at start or later. I have tri... | 2011/02/26 | [
"https://superuser.com/questions/250840",
"https://superuser.com",
"https://superuser.com/users/27037/"
] | The BIOS emits a pattern of beeps at initialisation time for diagnosing the system when there is nothing on the monitor. Listen out for these when you power up. Typical patters are:
Single short beep
=================
The system has passed the BIOS power-on selft test.
Repeated long low-frequency beeps
=============... | Try reseating the power cables. Also, try clearing the BIOS using the jumpers. |
21,580 | I am a scriptwriter working on a science fiction story. As best as I can I like to reconcile my imaginary places to within the constraints of reality. Here is my problem:
Kettrah
[](https://i.stack.imgur.com/1ghPi.jpg)
Kettrah is by most means a tida... | 2015/07/30 | [
"https://worldbuilding.stackexchange.com/questions/21580",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/11251/"
] | Yes, this is possible; the rotation that keeps the pole pointed toward the star would be considered to be [precession](https://en.wikipedia.org/wiki/Precession). If this planet was in a close orbit around a red dwarf star, it would be close enough that it would be tidally locked, and gravity would provide the necessary... | No
An object rotating without any outside forces on it will have one stationary angular momentum vector. In order to have a precession of this angular momentum vector, torque must be applied. This torque added (integrated) over time will add to the current angular momentum vector to give the new angular momentum vecto... |
21,580 | I am a scriptwriter working on a science fiction story. As best as I can I like to reconcile my imaginary places to within the constraints of reality. Here is my problem:
Kettrah
[](https://i.stack.imgur.com/1ghPi.jpg)
Kettrah is by most means a tida... | 2015/07/30 | [
"https://worldbuilding.stackexchange.com/questions/21580",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/11251/"
] | Yes, this is possible; the rotation that keeps the pole pointed toward the star would be considered to be [precession](https://en.wikipedia.org/wiki/Precession). If this planet was in a close orbit around a red dwarf star, it would be close enough that it would be tidally locked, and gravity would provide the necessary... | I don't think it is possible to achieve this for a planet orbiting a star. But you could in effect achieve this with a **moon** that's tidally locked to a planet, which it orbits in a [sun-synchronous orbit](https://en.wikipedia.org/wiki/Sun-synchronous_orbit). This requires a fast-rotating planet (so it has a strong e... |
21,580 | I am a scriptwriter working on a science fiction story. As best as I can I like to reconcile my imaginary places to within the constraints of reality. Here is my problem:
Kettrah
[](https://i.stack.imgur.com/1ghPi.jpg)
Kettrah is by most means a tida... | 2015/07/30 | [
"https://worldbuilding.stackexchange.com/questions/21580",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/11251/"
] | No
An object rotating without any outside forces on it will have one stationary angular momentum vector. In order to have a precession of this angular momentum vector, torque must be applied. This torque added (integrated) over time will add to the current angular momentum vector to give the new angular momentum vecto... | I don't think it is possible to achieve this for a planet orbiting a star. But you could in effect achieve this with a **moon** that's tidally locked to a planet, which it orbits in a [sun-synchronous orbit](https://en.wikipedia.org/wiki/Sun-synchronous_orbit). This requires a fast-rotating planet (so it has a strong e... |
480,477 | How to see that given a joint cdf $F(x,y)$, we have $\lim\_{x\to\infty}F(x,y)=F(y)$ and $\lim\_{y\to\infty}=F(x)$ where $F(y)$ and $F(x)$ are marginal cdfs. | 2013/08/31 | [
"https://math.stackexchange.com/questions/480477",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/92457/"
] | By definition we have $F(x,y)=P(X\leq x,Y\leq y)$ for some random vector $(X,Y)$. For $y$ fixed, we have that $x\mapsto F(x,y)$ is increasing and hence
$$
\lim\_{x\to\infty}F(x,y)=\lim\_{n\to\infty} F(n,y),
$$
where $n$ runs through the natural numbers. By continuity of the probability measure we have
$$
\lim\_{n\to\in... | By definition, $F(x,y)=P(X<x,Y<y)$, thus $\lim\_{x->\infty}F(x,y)=\lim\_{x->\infty}P(X<x,Y<y)=P(Y<y)=F(y)$ |
16,862,397 | I made a simple chart and added an onTouchListener like this:
```
@Override
public boolean onTouch(View arg0, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mGraphPopup.isShowing()) {
//close popup window
} else {
SeriesSelection serie... | 2013/05/31 | [
"https://Stackoverflow.com/questions/16862397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825148/"
] | I have meet this problem too recently,and i have find a solution to solve it.Maybe you had solved the problem, I also answer it to help others who meet the problem in the future.Here is the solution:
```
paintBarView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouc... | In order to listen for events on your chart and retrieve clicked information, I suggest you do a `setOnClickListener` on your `chartView`. A good example is [this](http://code.google.com/p/achartengine/source/browse/trunk/achartengine/demo/org/achartengine/chartdemo/demo/chart/XYChartBuilder.java). |
11,864 | I have a package of Briess Golden Light DME, and I noticed on the back it had a date stamp of 130923 10:57, which I assume to mean it was produced on Sept. 23, 2013.
It got me wondering if DME actually had a shelf life. How long will a sealed package of DME remain useful as a brewing ingredient? | 2014/02/28 | [
"https://homebrew.stackexchange.com/questions/11864",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/6452/"
] | Stored cool, dry and out of sunlight, DME is good for 2+ years. The main issue is with it picking up moisture, when it then becomes clumpy. But once boiled it's still good and you can use it up to 5 years in small quantities (say 1-2lb/0.5-1kg in a 5 gallon batch.) | From the first item in the [search results for "briess dme shelf life":](https://www.google.com/search?q=briess+dme+shelf+life) [Briess "Product Information & Typical Analysis" sheet for a similar DME [PDF Warning]](http://www.brewingwithbriess.com/Assets/PDFs/Briess_PISB_CBWTradDarkDME.pdf)
```
STORAGE AND SHELF LIFE... |
2,501,348 | I really need some help with this as I have been trying to fix this for months and I can't figure it out.
I run an online chess site written in Silverlight 3.0
The architecture is Silverlight Client connecting to a WCF service that reads and writes data to a SQL Server database. It is hosted on Godaddy,
Once every ... | 2010/03/23 | [
"https://Stackoverflow.com/questions/2501348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/90793/"
] | >
> [...] the redirect ends up going to <http://subdomain.domain.com/.domain.com/test.php?id=13>.
>
>
>
Can you isolate the problem a little bit more? Is that url exactly what is returned by PHP or is it how browser (Chrome?) sees it?
Can you check the actual headers e.g. with curl:
```
$ curl --head --referer '... | `header("Location: ".$_SERVER['HTTP_REFERER']);`
**Edited:**
Check you .htaccess settings or if no solution found u can use preg\_replace to remove that last ".domain.com"
but it looks that is a not a php error.
OR use javascript to get the referer address...
then use window.location.href = url; to redirect ... |
2,501,348 | I really need some help with this as I have been trying to fix this for months and I can't figure it out.
I run an online chess site written in Silverlight 3.0
The architecture is Silverlight Client connecting to a WCF service that reads and writes data to a SQL Server database. It is hosted on Godaddy,
Once every ... | 2010/03/23 | [
"https://Stackoverflow.com/questions/2501348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/90793/"
] | I've recreated both your programs on my server
once with
```
header("Location: http://subdomain.domain.com/some/place");
```
and once with
```
header("Location: {$_SERVER['HTTP_REFERER']}");
```
and both give the corret result
```
curl --head --referer 'http://subdomain.domain.com/some/place' 'http://subdomain.d... | `header("Location: ".$_SERVER['HTTP_REFERER']);`
**Edited:**
Check you .htaccess settings or if no solution found u can use preg\_replace to remove that last ".domain.com"
but it looks that is a not a php error.
OR use javascript to get the referer address...
then use window.location.href = url; to redirect ... |
2,501,348 | I really need some help with this as I have been trying to fix this for months and I can't figure it out.
I run an online chess site written in Silverlight 3.0
The architecture is Silverlight Client connecting to a WCF service that reads and writes data to a SQL Server database. It is hosted on Godaddy,
Once every ... | 2010/03/23 | [
"https://Stackoverflow.com/questions/2501348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/90793/"
] | It seems that your nginx configuration is causing the problems.
Its totally possible that nginx is modifying the response headers. This is not by default - you could have a configuration that is aimed for it to behave as a reverse proxy etc.
Have you tried testing the redirect on a nginx with its default configuratio... | `header("Location: ".$_SERVER['HTTP_REFERER']);`
**Edited:**
Check you .htaccess settings or if no solution found u can use preg\_replace to remove that last ".domain.com"
but it looks that is a not a php error.
OR use javascript to get the referer address...
then use window.location.href = url; to redirect ... |
2,501,348 | I really need some help with this as I have been trying to fix this for months and I can't figure it out.
I run an online chess site written in Silverlight 3.0
The architecture is Silverlight Client connecting to a WCF service that reads and writes data to a SQL Server database. It is hosted on Godaddy,
Once every ... | 2010/03/23 | [
"https://Stackoverflow.com/questions/2501348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/90793/"
] | I've recreated both your programs on my server
once with
```
header("Location: http://subdomain.domain.com/some/place");
```
and once with
```
header("Location: {$_SERVER['HTTP_REFERER']}");
```
and both give the corret result
```
curl --head --referer 'http://subdomain.domain.com/some/place' 'http://subdomain.d... | >
> [...] the redirect ends up going to <http://subdomain.domain.com/.domain.com/test.php?id=13>.
>
>
>
Can you isolate the problem a little bit more? Is that url exactly what is returned by PHP or is it how browser (Chrome?) sees it?
Can you check the actual headers e.g. with curl:
```
$ curl --head --referer '... |
2,501,348 | I really need some help with this as I have been trying to fix this for months and I can't figure it out.
I run an online chess site written in Silverlight 3.0
The architecture is Silverlight Client connecting to a WCF service that reads and writes data to a SQL Server database. It is hosted on Godaddy,
Once every ... | 2010/03/23 | [
"https://Stackoverflow.com/questions/2501348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/90793/"
] | It seems that your nginx configuration is causing the problems.
Its totally possible that nginx is modifying the response headers. This is not by default - you could have a configuration that is aimed for it to behave as a reverse proxy etc.
Have you tried testing the redirect on a nginx with its default configuratio... | >
> [...] the redirect ends up going to <http://subdomain.domain.com/.domain.com/test.php?id=13>.
>
>
>
Can you isolate the problem a little bit more? Is that url exactly what is returned by PHP or is it how browser (Chrome?) sees it?
Can you check the actual headers e.g. with curl:
```
$ curl --head --referer '... |
8,012,063 | Since my other bug got solved, I'm posting a new question for this bug.
I made a Snake canvas game, but my snake tends to eat itself when you press two buttons at the same time.. I'm not sure how to explain it properly, but this is what happens:
Say my snake is moving towards the left, and I press down + right, it'll... | 2011/11/04 | [
"https://Stackoverflow.com/questions/8012063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/613721/"
] | You must retain the last direction is which the snake actually moved and determine allowedDirection based on that. Pressing a key only represents the intent to move in that direction, but it does not actually move when the key is pressed, but based on the speed of the game, i guess. | Your snake eating itself shows a problem with your hit detection (and hit detection handling) code. If you're hitting the snake, the game should end. A snake is not an apple! Nevermind, apparently I missed the part where the game *is* ending for you.
If you choose to allow pixel-granularity (I can't see your demo, my ... |
8,012,063 | Since my other bug got solved, I'm posting a new question for this bug.
I made a Snake canvas game, but my snake tends to eat itself when you press two buttons at the same time.. I'm not sure how to explain it properly, but this is what happens:
Say my snake is moving towards the left, and I press down + right, it'll... | 2011/11/04 | [
"https://Stackoverflow.com/questions/8012063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/613721/"
] | The problem is that if you push the keys quickly enough, its possible to trigger the event callback multiple times during one frame. Thus, if the snake is going down, it can turn right and then up in the same frame, thus reversing direction and eating itself. I'll suggest two ways to solve this problem:
The first is t... | Your snake eating itself shows a problem with your hit detection (and hit detection handling) code. If you're hitting the snake, the game should end. A snake is not an apple! Nevermind, apparently I missed the part where the game *is* ending for you.
If you choose to allow pixel-granularity (I can't see your demo, my ... |
8,012,063 | Since my other bug got solved, I'm posting a new question for this bug.
I made a Snake canvas game, but my snake tends to eat itself when you press two buttons at the same time.. I'm not sure how to explain it properly, but this is what happens:
Say my snake is moving towards the left, and I press down + right, it'll... | 2011/11/04 | [
"https://Stackoverflow.com/questions/8012063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/613721/"
] | The problem is that if you push the keys quickly enough, its possible to trigger the event callback multiple times during one frame. Thus, if the snake is going down, it can turn right and then up in the same frame, thus reversing direction and eating itself. I'll suggest two ways to solve this problem:
The first is t... | You must retain the last direction is which the snake actually moved and determine allowedDirection based on that. Pressing a key only represents the intent to move in that direction, but it does not actually move when the key is pressed, but based on the speed of the game, i guess. |
8,012,063 | Since my other bug got solved, I'm posting a new question for this bug.
I made a Snake canvas game, but my snake tends to eat itself when you press two buttons at the same time.. I'm not sure how to explain it properly, but this is what happens:
Say my snake is moving towards the left, and I press down + right, it'll... | 2011/11/04 | [
"https://Stackoverflow.com/questions/8012063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/613721/"
] | You must retain the last direction is which the snake actually moved and determine allowedDirection based on that. Pressing a key only represents the intent to move in that direction, but it does not actually move when the key is pressed, but based on the speed of the game, i guess. | I had the same problem, but I solved it by implementing a queue; each keypress sets the direction of the snake and that (new) direction is pushed to an array. Then, before I actually move the snake in the game loop, I check if there are any elements in my direction queue. If so, I shift it once via Array.shift. The ret... |
8,012,063 | Since my other bug got solved, I'm posting a new question for this bug.
I made a Snake canvas game, but my snake tends to eat itself when you press two buttons at the same time.. I'm not sure how to explain it properly, but this is what happens:
Say my snake is moving towards the left, and I press down + right, it'll... | 2011/11/04 | [
"https://Stackoverflow.com/questions/8012063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/613721/"
] | The problem is that if you push the keys quickly enough, its possible to trigger the event callback multiple times during one frame. Thus, if the snake is going down, it can turn right and then up in the same frame, thus reversing direction and eating itself. I'll suggest two ways to solve this problem:
The first is t... | I had the same problem, but I solved it by implementing a queue; each keypress sets the direction of the snake and that (new) direction is pushed to an array. Then, before I actually move the snake in the game loop, I check if there are any elements in my direction queue. If so, I shift it once via Array.shift. The ret... |
66,148,823 | I am trying to create a very simple cluster on aws with kops with one master and 2 worker nodes. But after creating, kops validate cluster complains that cluster is not healthy.
cluster created with:
```
kops create cluster --name=mycluster --zones=ap-south-1a --master-size="t2.micro" --node-size="t2.micro" --node-co... | 2021/02/11 | [
"https://Stackoverflow.com/questions/66148823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420284/"
] | You can use `lambda` or in other words use function `def`
NOTE: don't use `sum` as a variable name, because it is a built-in function in python.
```py
b=2
c=3
sum_ = lambda b,c: [[1, 4 + c, 0], [6, 2 + b + c, b]]
sum_(b,c)
```
```
[[1, 7, 0], [6, 7, 2]]
``` | What about:
```
sum = f"[[1, {4 + c}, 0], [6, {2 + b + c}, b]]"
```
Or this:
```
sum = str([[1, 4 + c, 0], [6, 2 + b + c, b]])
```
Or even this ([not very recommended](https://stackoverflow.com/questions/1832940/why-is-using-eval-a-bad-practice)):
```
sum = eval("[[1, 4 + c, 0], [6, 2 + b + c, b]]")
``` |
66,148,823 | I am trying to create a very simple cluster on aws with kops with one master and 2 worker nodes. But after creating, kops validate cluster complains that cluster is not healthy.
cluster created with:
```
kops create cluster --name=mycluster --zones=ap-south-1a --master-size="t2.micro" --node-size="t2.micro" --node-co... | 2021/02/11 | [
"https://Stackoverflow.com/questions/66148823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420284/"
] | This is pretty easy to do. You can use `eval()` to evaluate python expressions. From the documentation, for `eval`, `the source may be a string representing a Python expression or a code object as returned by compile()`. If I understood you correctly, you need to use for strings.
For example,
```
>>> b=2
>>> c=3
>>> ... | What about:
```
sum = f"[[1, {4 + c}, 0], [6, {2 + b + c}, b]]"
```
Or this:
```
sum = str([[1, 4 + c, 0], [6, 2 + b + c, b]])
```
Or even this ([not very recommended](https://stackoverflow.com/questions/1832940/why-is-using-eval-a-bad-practice)):
```
sum = eval("[[1, 4 + c, 0], [6, 2 + b + c, b]]")
``` |
48,782,788 | I want to get some data from my database. Example:
```
getCarIds: function (callback) {
db.query("SELECT Id FROM Cars;",
function (err, result) {
if (err) throw err;
result = JSON.stringify(result);
var cars = [];
for (var i = 0; i < result.length; i++) {
var cu... | 2018/02/14 | [
"https://Stackoverflow.com/questions/48782788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7029671/"
] | Say you have a result array of `RowDataPacket` from mysql called `results`. You can use Object.assign(). For example, if you wanted to convert the first element to a regular object:
```
var normalObj = Object.assign({}, results[0]);
```
or if you wanted the entire array converted to normal objects:
```
var normalRe... | >
> You don't need to `stringify` the `result`. Just Process the `result`
> as it is.
>
>
>
and use `currentCar.Id` instead of `currentCar.id`. |
28,839,352 | I've been trying to change the actionbar's color without any succes. I've been searching for a while now...
I tried the solution of this post:
[How to change ActionBar color?](https://stackoverflow.com/questions/15747943/how-to-change-actionbar-color)
This is my styles.xml:
```
<resources>
<!-- Base application theme... | 2015/03/03 | [
"https://Stackoverflow.com/questions/28839352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3625993/"
] | Try using the HTML tag.
```
> = >
< = <
``` | You should be able to do the follow according to XML specifications. I'm not clear why this would be part of a data source and I suspect the real answer would be different if I knew what you were actually doing.
```
"Name: <Name>, Address: <address>".
``` |
258 | 1. "...в аудитории началась дискуссия".
2. "...у меня возник интерес к этой проблеме".
3. "...требуются конкретные примеры".
4. "...мы имеем в виду главным оброзом его словарный запас". | 2011/12/27 | [
"https://rus.stackexchange.com/questions/258",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/114/"
] | Четвертый вариант будет правильным, только после слова "языка" должна быть запятая, так как предложение начинается с деепричастного оборота. | здесь вариант 4!) |
258 | 1. "...в аудитории началась дискуссия".
2. "...у меня возник интерес к этой проблеме".
3. "...требуются конкретные примеры".
4. "...мы имеем в виду главным оброзом его словарный запас". | 2011/12/27 | [
"https://rus.stackexchange.com/questions/258",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/114/"
] | Четвертый вариант будет правильным, только после слова "языка" должна быть запятая, так как предложение начинается с деепричастного оборота. | здесь вариант 4!) |
258 | 1. "...в аудитории началась дискуссия".
2. "...у меня возник интерес к этой проблеме".
3. "...требуются конкретные примеры".
4. "...мы имеем в виду главным оброзом его словарный запас". | 2011/12/27 | [
"https://rus.stackexchange.com/questions/258",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/114/"
] | Четвертый вариант будет правильным, только после слова "языка" должна быть запятая, так как предложение начинается с деепричастного оборота. | вариант 4, так как добавочное действие деепричастия говоря относится к определяемому слову, выраженному словосочетанием с глаголом имеем в виду. Но почему написано "оброзом"? |
258 | 1. "...в аудитории началась дискуссия".
2. "...у меня возник интерес к этой проблеме".
3. "...требуются конкретные примеры".
4. "...мы имеем в виду главным оброзом его словарный запас". | 2011/12/27 | [
"https://rus.stackexchange.com/questions/258",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/114/"
] | вариант 4, так как добавочное действие деепричастия говоря относится к определяемому слову, выраженному словосочетанием с глаголом имеем в виду. Но почему написано "оброзом"? | здесь вариант 4!) |
258 | 1. "...в аудитории началась дискуссия".
2. "...у меня возник интерес к этой проблеме".
3. "...требуются конкретные примеры".
4. "...мы имеем в виду главным оброзом его словарный запас". | 2011/12/27 | [
"https://rus.stackexchange.com/questions/258",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/114/"
] | вариант 4, так как добавочное действие деепричастия говоря относится к определяемому слову, выраженному словосочетанием с глаголом имеем в виду. Но почему написано "оброзом"? | здесь вариант 4!) |
15,332,845 | I have included file JSONValue from simpleJSON, which is used for parsing the json string.
While compiling I am getting this error that 'wcsncasecmp' was not declared in this scope.
on this line. While searching more i ot that wcsncasecmp is a GNU-specific function, I am using windows, so can anyone help me out.
```
... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15332845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147993/"
] | On windows there is `_wcsnicmp` that you can use.
More ref: [\_strnicmp, \_wcsnicmp, \_mbsnicmp, \_strnicmp\_l, \_wcsnicmp\_l, \_mbsnicmp\_l](http://msdn.microsoft.com/en-us/library/chd90w8e.aspx) | Please define WIN32 macro in your source or in Visual Studio please add it to the project / Properties / C/C++ / Preprocessor definition.
```
#define WIN32
```
Internally it will define **wcsncasecmp** as **\_wcsnicmp** like Rohan has already mentioned.
This is a known problem of SimpleJSON.
```
// Win32 incompatib... |
678,155 | I have a computer I use from time to time and the old admin made it impossible to do anything with this computer other than go on the internet. It's a windows xp system. the usual gpedit.msc tricks don't work because on the "only" profile there is has no admin powers. There is an admin acct, but it is hidden from the l... | 2013/11/20 | [
"https://superuser.com/questions/678155",
"https://superuser.com",
"https://superuser.com/users/275430/"
] | I recommend [Offline NT Password Editor](http://pogostick.net/~pnh/ntpasswd/). It allows you to clear passwords and enable users, e.g. the admin user. You will need to load it onto a USB drive, or CD if you prefer, and follow the directions in the **Download** section of the link provided. Once you make the disk bootab... | i think we can try some command line alternative. in your case to enable admin account:
open command prompt, & execute the following command
```
net user administrator /active:yes
```
Now admin account will be visible on Log in Screen.
if you forgot admin password then use
```
net user <username> <password>
```
... |
678,155 | I have a computer I use from time to time and the old admin made it impossible to do anything with this computer other than go on the internet. It's a windows xp system. the usual gpedit.msc tricks don't work because on the "only" profile there is has no admin powers. There is an admin acct, but it is hidden from the l... | 2013/11/20 | [
"https://superuser.com/questions/678155",
"https://superuser.com",
"https://superuser.com/users/275430/"
] | I recommend [Offline NT Password Editor](http://pogostick.net/~pnh/ntpasswd/). It allows you to clear passwords and enable users, e.g. the admin user. You will need to load it onto a USB drive, or CD if you prefer, and follow the directions in the **Download** section of the link provided. Once you make the disk bootab... | use [Hiren's boot cd](http://www.hirensbootcd.org/download/).Burn hiren image file to a disk. boot to hiren and select “[Offline NT/2000/XP/Vista/7 Password Changer](http://www.hirensbootcd.org/resetting-windows-password/)”. once entered select the windows folder and select user, then change password. |
22,045,435 | I'm trying to create a a simple shopping cart stored in localStorage as JSON, but I get this error when submitting the form to add item to cart.
>
> Uncaught TypeError: Object # has no method 'push' cart.js:11
>
>
>
Here's my script.
```
var cart = {"cart": {"tuote":{"id":"2", "count": "4"}}};
localStorage.setI... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22045435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can't push into an object, but into an array.
You might want to change the cart structure into something like this:
```
var cart = {"cart": [ {"tuote":{"id":"2", "count": "4"}} ] };
```
And then, to add to this cart, you'd do:
```
cart.cart.push(newStuff);
```
(of course, you're fetching your cart from local... | ```
var cart = {"cart": {"tuote":{"id":"2", "count": "4"}}};
```
`cart` is not an array instead it is an Object. You may change your base JSON like below
```
var cart = {"cart": [{"tuote":{"id":"2", "count": "4"}}]};
``` |
9,176,110 | Since `TextBox` doesn't allow smooth scrolling, I've used it as a `ListBoxItem`. It works great. But when I enter many lines, the cursor goes out of the view, down below the list box, because of it I'm unable to see the text which I am typing. To see the cursor, I have to manually swipe the `TextBox` up.
Here's the c... | 2012/02/07 | [
"https://Stackoverflow.com/questions/9176110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/861712/"
] | Nothing will happen to it. It will continue to use memory and you will have lost any means to use it or free it.
In C you have to explicitly `free` stuff you obtained via `malloc` when you're done with it, there's no such thing as reference counting or garbage collection. | In c if you don't `free` the memory you allocated via `malloc` it will just sit there doing nothing until the program execution ends.
Unlike Java, C has no garbage collection. |
9,176,110 | Since `TextBox` doesn't allow smooth scrolling, I've used it as a `ListBoxItem`. It works great. But when I enter many lines, the cursor goes out of the view, down below the list box, because of it I'm unable to see the text which I am typing. To see the cursor, I have to manually swipe the `TextBox` up.
Here's the c... | 2012/02/07 | [
"https://Stackoverflow.com/questions/9176110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/861712/"
] | Nothing will happen to it. It will continue to use memory and you will have lost any means to use it or free it.
In C you have to explicitly `free` stuff you obtained via `malloc` when you're done with it, there's no such thing as reference counting or garbage collection. | C does not have automatic garbage collection. If you lose track of an object, you have what is known as a 'memory leak'. The memory will still be allocated to the program as a whole, but nothing will be able to use it if you've lost the last pointer to it. Memory resource management is a key requirement on C programs. ... |
9,176,110 | Since `TextBox` doesn't allow smooth scrolling, I've used it as a `ListBoxItem`. It works great. But when I enter many lines, the cursor goes out of the view, down below the list box, because of it I'm unable to see the text which I am typing. To see the cursor, I have to manually swipe the `TextBox` up.
Here's the c... | 2012/02/07 | [
"https://Stackoverflow.com/questions/9176110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/861712/"
] | C does not have automatic garbage collection. If you lose track of an object, you have what is known as a 'memory leak'. The memory will still be allocated to the program as a whole, but nothing will be able to use it if you've lost the last pointer to it. Memory resource management is a key requirement on C programs. ... | In c if you don't `free` the memory you allocated via `malloc` it will just sit there doing nothing until the program execution ends.
Unlike Java, C has no garbage collection. |
2,684,422 | I was watching a talk of [Michael Jordan on Youtube](https://www.youtube.com/watch?v=VE2ITg_hGnI). In the lecture, he mentioned that for a convex-Lipschitz function $f$, the gradient descent
$$x^{k+1} = x^k - \beta \nabla f(x^k)$$ for a constant step-size achieves the following rate,
$$f(x^k) - f(x^\*) \leq O(1/k)$$
... | 2018/03/09 | [
"https://math.stackexchange.com/questions/2684422",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/174904/"
] | No, there is not. Because $\mathbb{R}^n$ *is* locally Euclidean. Therefore, any space which is homeomorphic to $\mathbb{R}^n$ will be locally Euclidean too. | Let $M$ be your space. If $\phi\colon M \to \Bbb R^n$ is a homeomorphism, for every $p \in M$ you can take the (topological) chart $(M, \phi)$ around $p$, so $M$ is locally Euclidean. |
67,000,995 | I have a table of items that I track inventory on daily basis (mysql)
```
| item_id | qty | created_at |
| ------- | -------| ---------- |
| 1 | 5 | 2021-04-08 |
| 1 | 30 | 2021-04-07 |
| 1 | 100 | 2021-04-06 |
| 2 | 100 | 2021-04-08 |
| 2 | 0 | 2021-04-07 |
| 2 ... | 2021/04/08 | [
"https://Stackoverflow.com/questions/67000995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1367551/"
] | Consider running SQL jobs on regular time schedule.
***Item is almost out of stock (5% limit)***
Well five percent of what total (I assume it's not always 100 pcs). Create table with item\_id and threshold value. If current stock is lower or equal to threshold value report it.
***Item just returned to stock.***
>
... | Just use `lag()` and some conditional logic:
```
select t.*,
(case when qty <= 5
then 'Almost out of stock'
when qty > 0 and lag(qty) over (partition by item_id order by created_at) = 0
then 'Just returned to stock'
when qty = 0 and lag(qty) over (partition by... |
48,865,109 | I am using Bootstrap framework and need to make an element at the end of the row.
```
<div class="row">
<div>div 1</div>
<div>div end</div>
</div>
```
These divs are in a row -it is desired. But I need the "end div" element to pull to the right corner of the row. I tried many Bootstrap classes. but somewhat ... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48865109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since Bootstrap 4 uses flexbox or `display: flex` on `row` class you can just use [`ml-auto`](https://getbootstrap.com/docs/4.0/utilities/flex/#auto-margins) on second div which will add `margin-left` auto and push that div to the right side.
```html
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap... | Try this.
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" ></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<link rel="styl... |
48,865,109 | I am using Bootstrap framework and need to make an element at the end of the row.
```
<div class="row">
<div>div 1</div>
<div>div end</div>
</div>
```
These divs are in a row -it is desired. But I need the "end div" element to pull to the right corner of the row. I tried many Bootstrap classes. but somewhat ... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48865109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since Bootstrap 4 uses flexbox or `display: flex` on `row` class you can just use [`ml-auto`](https://getbootstrap.com/docs/4.0/utilities/flex/#auto-margins) on second div which will add `margin-left` auto and push that div to the right side.
```html
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap... | This is from the Bootstrap docs. By default each column is `aligned`/`floated` left, but with this the space in between the columns is equally distributed:
```
<div class="row justify-content-between">
<div class="col-4">
<div> Div 1 </div>
</div>
<div class="col-4">
<div> Div End </div>
... |
48,865,109 | I am using Bootstrap framework and need to make an element at the end of the row.
```
<div class="row">
<div>div 1</div>
<div>div end</div>
</div>
```
These divs are in a row -it is desired. But I need the "end div" element to pull to the right corner of the row. I tried many Bootstrap classes. but somewhat ... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48865109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is from the Bootstrap docs. By default each column is `aligned`/`floated` left, but with this the space in between the columns is equally distributed:
```
<div class="row justify-content-between">
<div class="col-4">
<div> Div 1 </div>
</div>
<div class="col-4">
<div> Div End </div>
... | Try this.
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" ></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<link rel="styl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.