qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
831,848 | I want to know how to install two bluestacks in a system and then run it.
Is it possible to run bluestacks in Virtualbox | 2014/10/26 | [
"https://superuser.com/questions/831848",
"https://superuser.com",
"https://superuser.com/users/383860/"
] | Bluestacks is an android emulator. As with any emulator it is very heavy on system resources. In addition, bluestacks installs services that remain active constantly.
For that reason, no, you cannot install 2 bluestacks next to eachother on a system. You might be able to run bluestacks from a different user and be abl... | You can run directly android on VirtualBox I have tested and it's working very well. the version 4.4 r2 is a good one
You can find some iso [here](http://www.android-x86.org/) |
831,848 | I want to know how to install two bluestacks in a system and then run it.
Is it possible to run bluestacks in Virtualbox | 2014/10/26 | [
"https://superuser.com/questions/831848",
"https://superuser.com",
"https://superuser.com/users/383860/"
] | **Running Bluestacks inside VirtualBox works.**
Out of curiosity I tried to do what OP asked: I created a windows 8.1 pro virtual machine, downloaded bluestacks, installed it and it just runs. The VM has 2048 MB RAM, 1 CPU Core and even without installed virtualbox guest tools speed isn't as bad as you might think. Th... | You can run directly android on VirtualBox I have tested and it's working very well. the version 4.4 r2 is a good one
You can find some iso [here](http://www.android-x86.org/) |
40,525,628 | Why js window.location is not accept a variable that assigned from json,
I hava checked my json, and the json is exist by console.log(myJsonCallback)
```
Object { status=1, action="update", id=90}
```
The code like this,
```
if(response.action === "update"){
var id = response.id;window.location.href=
... | 2016/11/10 | [
"https://Stackoverflow.com/questions/40525628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4452417/"
] | If what you expected to work would actually interpolate the variable, it would look like this:
```
/index.php?r=kasir%2Ftransaction%2Fview&90=90
```
But your string does not actually contain any variables. Try this instead:
```
if(response.action === "update") {
var id = response.id;
window.location.href = "/in... | In your code, `"/index.php?r=kasir%2Ftransaction%2Fview&id=id"`, this entire line is a single string without any variable. You will have to concatenate this string with the actual id.
Like this :
```
if(response.action === "update"){
var id = response.id;
window.location.href = "/index.php?r=kasir%2Ftransac... |
40,525,628 | Why js window.location is not accept a variable that assigned from json,
I hava checked my json, and the json is exist by console.log(myJsonCallback)
```
Object { status=1, action="update", id=90}
```
The code like this,
```
if(response.action === "update"){
var id = response.id;window.location.href=
... | 2016/11/10 | [
"https://Stackoverflow.com/questions/40525628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4452417/"
] | If what you expected to work would actually interpolate the variable, it would look like this:
```
/index.php?r=kasir%2Ftransaction%2Fview&90=90
```
But your string does not actually contain any variables. Try this instead:
```
if(response.action === "update") {
var id = response.id;
window.location.href = "/in... | Thanks all, my bad,
Perhaps not sleep until morning today.
this is the code
```
. 'if(response.action === "update"){'
. ' var id = response.id;'
. 'window.location.href= "' . Url::toRoute(['view']) . '&id=" + id'
. '}'
```
Please, up again |
40,525,628 | Why js window.location is not accept a variable that assigned from json,
I hava checked my json, and the json is exist by console.log(myJsonCallback)
```
Object { status=1, action="update", id=90}
```
The code like this,
```
if(response.action === "update"){
var id = response.id;window.location.href=
... | 2016/11/10 | [
"https://Stackoverflow.com/questions/40525628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4452417/"
] | In your code, `"/index.php?r=kasir%2Ftransaction%2Fview&id=id"`, this entire line is a single string without any variable. You will have to concatenate this string with the actual id.
Like this :
```
if(response.action === "update"){
var id = response.id;
window.location.href = "/index.php?r=kasir%2Ftransac... | Thanks all, my bad,
Perhaps not sleep until morning today.
this is the code
```
. 'if(response.action === "update"){'
. ' var id = response.id;'
. 'window.location.href= "' . Url::toRoute(['view']) . '&id=" + id'
. '}'
```
Please, up again |
64,271,237 | Basically, I want to pass the "filename" state from *child* component to the *parent* component. So that, I can use the "filename" state in the onSubmit function at parent. How can I achieve that? Currently filename at parent is not defined. Thanks a lot for your help.
Parent:
```
const AddLocation = ({ addLocation }... | 2020/10/08 | [
"https://Stackoverflow.com/questions/64271237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5892621/"
] | The following should work (considering that there is no occurence of these words with first character as lowercase (eg maxine) or there is and you want it to upper):
```
def format(s):
s=s.lower()
for i in ('maxine', 'flora', 'lindsey'):
if i in s:
s=s[:s.find(i)]+i[0].upper()+i[1:]+s[s.fin... | You're on the right track to use an `if` statement to check the word against a list of things to keep. Try something like this:
```py
def lowercase_some(words, exclude=[]):
# List of processed words
new_words = []
for word in words:
if word.lower() in exclude:
# If the word is in our li... |
64,271,237 | Basically, I want to pass the "filename" state from *child* component to the *parent* component. So that, I can use the "filename" state in the onSubmit function at parent. How can I achieve that? Currently filename at parent is not defined. Thanks a lot for your help.
Parent:
```
const AddLocation = ({ addLocation }... | 2020/10/08 | [
"https://Stackoverflow.com/questions/64271237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5892621/"
] | The following should work (considering that there is no occurence of these words with first character as lowercase (eg maxine) or there is and you want it to upper):
```
def format(s):
s=s.lower()
for i in ('maxine', 'flora', 'lindsey'):
if i in s:
s=s[:s.find(i)]+i[0].upper()+i[1:]+s[s.fin... | you can use this:
```
names = ['Maxine', 'Flora', 'Lindsey']
if item.title() in names:
return item.title()
else:
return item.title.lower()
``` |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | You don't need to write jQuery code. You can do this with HTML.
Change your HTML content as below:
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
Here is the JSFiddle: <http://jsfiddle.net/sjG4w/> | You can do this by
```
<label id="lblAssociateWithCheckBox" title="Check" OnClick="JavaScript:ClickedLabel('Check1')" ></label>
```
In `ClickedLabel` you can find the passed element and if it is checked do uncheck and if unchecked do check it. |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | You don't need to write jQuery code. You can do this with HTML.
Change your HTML content as below:
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
Here is the JSFiddle: <http://jsfiddle.net/sjG4w/> | If you always use `label` and `checkbox` then the user `for` attribute of `label` and `id` of checkbox as same. For example,
```
<label for="name">Name</label>
<input type="checkbox" id="name">
```
OR else
```
CheckCheckBox($('#lblAssociateWithCheckBox'), $(#'Checkbox1'));
function CheckCheckBox(lblID, chkID) {
... |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | You don't need to write jQuery code. You can do this with HTML.
Change your HTML content as below:
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
Here is the JSFiddle: <http://jsfiddle.net/sjG4w/> | There are two ways to do this without any JavaScript at all. Pavan explained the first way, which is to use the `for` attribute (match the checkbox id):
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
The other way, which I prefer is to wrap the checkbox within... |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | **Update:** Just saw your comment under Pavan's answer about wanting to use non-label elements as labels, e.g., span elements. My first response is *why*? But if you really want to you can do this easily without having to write lots of code and hardcode lots of element ids in your JavaScript (which seems to be the path... | You can do this by
```
<label id="lblAssociateWithCheckBox" title="Check" OnClick="JavaScript:ClickedLabel('Check1')" ></label>
```
In `ClickedLabel` you can find the passed element and if it is checked do uncheck and if unchecked do check it. |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | There are two ways to do this without any JavaScript at all. Pavan explained the first way, which is to use the `for` attribute (match the checkbox id):
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
The other way, which I prefer is to wrap the checkbox within... | You can do this by
```
<label id="lblAssociateWithCheckBox" title="Check" OnClick="JavaScript:ClickedLabel('Check1')" ></label>
```
In `ClickedLabel` you can find the passed element and if it is checked do uncheck and if unchecked do check it. |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | **Update:** Just saw your comment under Pavan's answer about wanting to use non-label elements as labels, e.g., span elements. My first response is *why*? But if you really want to you can do this easily without having to write lots of code and hardcode lots of element ids in your JavaScript (which seems to be the path... | If you always use `label` and `checkbox` then the user `for` attribute of `label` and `id` of checkbox as same. For example,
```
<label for="name">Name</label>
<input type="checkbox" id="name">
```
OR else
```
CheckCheckBox($('#lblAssociateWithCheckBox'), $(#'Checkbox1'));
function CheckCheckBox(lblID, chkID) {
... |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | **Update:** Just saw your comment under Pavan's answer about wanting to use non-label elements as labels, e.g., span elements. My first response is *why*? But if you really want to you can do this easily without having to write lots of code and hardcode lots of element ids in your JavaScript (which seems to be the path... | There are two ways to do this without any JavaScript at all. Pavan explained the first way, which is to use the `for` attribute (match the checkbox id):
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
The other way, which I prefer is to wrap the checkbox within... |
9,092,197 | I have a `checkbox` and a description of the checkbox in `label`. I want to `check` Checkbox when label is clicked.
Markup:
```
<input id="Checkbox1" type="checkbox" /></div>
<label id="lblAssociateWithCheckBox" title="Check"></label>
```
In jQuery I try:
```
$(document).ready(function() {
CheckCheckBo... | 2012/02/01 | [
"https://Stackoverflow.com/questions/9092197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | There are two ways to do this without any JavaScript at all. Pavan explained the first way, which is to use the `for` attribute (match the checkbox id):
```
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1" title="Check">Check ME</label>
```
The other way, which I prefer is to wrap the checkbox within... | If you always use `label` and `checkbox` then the user `for` attribute of `label` and `id` of checkbox as same. For example,
```
<label for="name">Name</label>
<input type="checkbox" id="name">
```
OR else
```
CheckCheckBox($('#lblAssociateWithCheckBox'), $(#'Checkbox1'));
function CheckCheckBox(lblID, chkID) {
... |
8,314,040 | I store pointers to all instances of class `Cell` in a linked list. The `std::list<Cell*> cells` is stored in a class named `Game`. The method `Game::update()` iterates trought all instances of `Cell` held in the list `cells`, and calls each cell's `Cell::update()` method. If the `Cell::update()` method finds out at so... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8314040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062874/"
] | I would probably pass a reference to the `Game` into `Cell::update()` and then tell the Game object to divide the cell, but other options may be better as I still don't think I have a full picture of what your overall goal is. | Pass a reference to `Game` into the `Cell` constructor. Then make a function that lets a `Cell` push other `Cell` objects onto the list (or make `Cell` a friend class of `Game` so that it can access the list directly).
This way, `Cell` can decide when it needs to split, but it can delegate the action to the `Game` obj... |
8,314,040 | I store pointers to all instances of class `Cell` in a linked list. The `std::list<Cell*> cells` is stored in a class named `Game`. The method `Game::update()` iterates trought all instances of `Cell` held in the list `cells`, and calls each cell's `Cell::update()` method. If the `Cell::update()` method finds out at so... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8314040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062874/"
] | I would probably pass a reference to the `Game` into `Cell::update()` and then tell the Game object to divide the cell, but other options may be better as I still don't think I have a full picture of what your overall goal is. | If Cell objects must know which Game object they belong to, derive a class from std::list<> and include a pointer to Game (Game \*) as a member of Cell. Cell object can then use this pointer to add another Cell to th Game.
```
class Game
{
class Cell
{
public:
Game *game;
};
... |
8,314,040 | I store pointers to all instances of class `Cell` in a linked list. The `std::list<Cell*> cells` is stored in a class named `Game`. The method `Game::update()` iterates trought all instances of `Cell` held in the list `cells`, and calls each cell's `Cell::update()` method. If the `Cell::update()` method finds out at so... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8314040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062874/"
] | I would not introduce an unnecessary dependence between `Cell` and `Game`, if all `Game` does is to call methods on `Cell`s and hold instances of them.
You could instead return new `Cell`s (or none) from `Cell::update()` and let `Game` decide what to do, most probably add them to the list. You could also define a new ... | I would probably pass a reference to the `Game` into `Cell::update()` and then tell the Game object to divide the cell, but other options may be better as I still don't think I have a full picture of what your overall goal is. |
8,314,040 | I store pointers to all instances of class `Cell` in a linked list. The `std::list<Cell*> cells` is stored in a class named `Game`. The method `Game::update()` iterates trought all instances of `Cell` held in the list `cells`, and calls each cell's `Cell::update()` method. If the `Cell::update()` method finds out at so... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8314040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062874/"
] | I would not introduce an unnecessary dependence between `Cell` and `Game`, if all `Game` does is to call methods on `Cell`s and hold instances of them.
You could instead return new `Cell`s (or none) from `Cell::update()` and let `Game` decide what to do, most probably add them to the list. You could also define a new ... | Pass a reference to `Game` into the `Cell` constructor. Then make a function that lets a `Cell` push other `Cell` objects onto the list (or make `Cell` a friend class of `Game` so that it can access the list directly).
This way, `Cell` can decide when it needs to split, but it can delegate the action to the `Game` obj... |
8,314,040 | I store pointers to all instances of class `Cell` in a linked list. The `std::list<Cell*> cells` is stored in a class named `Game`. The method `Game::update()` iterates trought all instances of `Cell` held in the list `cells`, and calls each cell's `Cell::update()` method. If the `Cell::update()` method finds out at so... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8314040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1062874/"
] | I would not introduce an unnecessary dependence between `Cell` and `Game`, if all `Game` does is to call methods on `Cell`s and hold instances of them.
You could instead return new `Cell`s (or none) from `Cell::update()` and let `Game` decide what to do, most probably add them to the list. You could also define a new ... | If Cell objects must know which Game object they belong to, derive a class from std::list<> and include a pointer to Game (Game \*) as a member of Cell. Cell object can then use this pointer to add another Cell to th Game.
```
class Game
{
class Cell
{
public:
Game *game;
};
... |
35,396 | In the movie Batman Begins, Batman goes into the Narrows to check where the drugs are going. He gets into a fight with Dr.Crane dressed with scarecrow mask and Batman is given the hallucinogenic spray by crane and is also set on fire.
After this Batman with great difficulty manages to reach the roof top and after that... | 2015/06/15 | [
"https://movies.stackexchange.com/questions/35396",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/9473/"
] | There's no help in the script or the novelisation. I assume the missing scene (where Alfred parks the car, heads up to the roof, spends some time looking for Bruce, then helps him down to the car) was ignored because it's trivial and doesn't advance the plot.
In the [screenplay](https://books.google.co.uk/books?id=C8y... | Alfred is an ex-military man who acquired a number of advanced and practical skills. Considering his capability with mechanics and engineering, it stands for reason that he is able to locate and retrieve wounded individuals.
However... this scene is glossed over in the movie for theatrical purposes. |
17,662,391 | What I am trying to do is to:
1. Create a `.exp` file, which will read from the `*.txt` file from the same directory and parse all the content in the text file into a string variable in the expect script.
2. Loop the string, which contains a series of host names, and excecute a series of command until the string is en... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17662391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373224/"
] | The code should read the contents of the two files into lists of lines, then iterate over them. It ends up like this:
```
# Set up various other variables here ($user, $password)
# Get the list of hosts, one per line #####
set f [open "host.txt"]
set hosts [split [read $f] "\n"]
close $f
# Get the commands to run, o... | I'd refactor a bit:
```
#!/usr/bin/expect
set timeout 20
set user test
set password test
proc check_host {hostname} {
global user passwordt
spawn ssh $user@$hostname
expect "password"
send "$password\r"
expect "% " ;# adjust to suit the prompt accordingly
send "some command\r"... |
17,662,391 | What I am trying to do is to:
1. Create a `.exp` file, which will read from the `*.txt` file from the same directory and parse all the content in the text file into a string variable in the expect script.
2. Loop the string, which contains a series of host names, and excecute a series of command until the string is en... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17662391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373224/"
] | I'd refactor a bit:
```
#!/usr/bin/expect
set timeout 20
set user test
set password test
proc check_host {hostname} {
global user passwordt
spawn ssh $user@$hostname
expect "password"
send "$password\r"
expect "% " ;# adjust to suit the prompt accordingly
send "some command\r"... | Using any of the two solutions here, I would also create a logfile that you can view at a later time. Makes it easy to troubleshoot any problems after the script is run, especially if you're configuring several hundred hosts.
Add:
>
> log\_file -a [log file name]
>
>
>
Before your loop.
Cheers,
K |
17,662,391 | What I am trying to do is to:
1. Create a `.exp` file, which will read from the `*.txt` file from the same directory and parse all the content in the text file into a string variable in the expect script.
2. Loop the string, which contains a series of host names, and excecute a series of command until the string is en... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17662391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373224/"
] | The code should read the contents of the two files into lists of lines, then iterate over them. It ends up like this:
```
# Set up various other variables here ($user, $password)
# Get the list of hosts, one per line #####
set f [open "host.txt"]
set hosts [split [read $f] "\n"]
close $f
# Get the commands to run, o... | Using any of the two solutions here, I would also create a logfile that you can view at a later time. Makes it easy to troubleshoot any problems after the script is run, especially if you're configuring several hundred hosts.
Add:
>
> log\_file -a [log file name]
>
>
>
Before your loop.
Cheers,
K |
12,056,940 | Is there a way get the list of changelists after a particular changelist for a particular branch?
```
p4 changes (some flag ?) (CL#) //depot/project
``` | 2012/08/21 | [
"https://Stackoverflow.com/questions/12056940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501387/"
] | ```
p4 changes "//depot/project/...@>nnn"
```
where nnn is your CL#. | If you're into Perforce Integration, and you need to get the next CL to Integrate (the CL right after the last one you've integrated, say @12345), try this:
```
p4 changes "//depot/branches/branch_name/...@>12345" | tail -1 | cut -d ' ' -f 2
``` |
12,056,940 | Is there a way get the list of changelists after a particular changelist for a particular branch?
```
p4 changes (some flag ?) (CL#) //depot/project
``` | 2012/08/21 | [
"https://Stackoverflow.com/questions/12056940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501387/"
] | This can be done with the following syntax (assuming you want to see all the changes submitted to this branch since changelist 12345 inclusive):
```
p4 changes //depot/project/...@12345,#head
```
---
To successfully use Perforce it is crucial to understand the intricacies of the [Perforce File Specifications](http:... | If you're into Perforce Integration, and you need to get the next CL to Integrate (the CL right after the last one you've integrated, say @12345), try this:
```
p4 changes "//depot/branches/branch_name/...@>12345" | tail -1 | cut -d ' ' -f 2
``` |
59,987,835 | We are working with Python 3, where we have a list of datetimes, which looks like this:
```
first_datetime = {2019-08-08 14:00:00, 2019-08-08 14:10:00, 2019-08-08 14:20:00, 2019-08-08 14:30:00, 2019-08-08 14:40:00, 2019-08-08 14:50:00, 2019-08-08 15:00:00}
```
What we want is to only append datetimes, where minutes ... | 2020/01/30 | [
"https://Stackoverflow.com/questions/59987835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9794574/"
] | You can check the minutes using `time.minute in [0, 20, 40]`, so your snippet of code could look like
```py
for i in range(len(first_datetime)):
time = datetime.datetime.strptime(first_datetime[i], '%Y-%m-%d %H:%M:%S')
if time != x and time.minute in [0, 20, 40]:
new_datetime_list.append(first_datetime... | You can use the `minute` operator from datetime:
```
import datetime
first_datetime = ['2019-08-08 14:00:00', '2019-08-08 14:10:00', '2019-08-08 14:20:00', '2019-08-08 14:30:00', '2019-08-08 14:40:00', '2019-08-08 14:50:00', '2019-08-08 15:00:00']
new_datetime_list = []
for i in first_datetime:
time = datetime.da... |
5,995 | I'm used to set marks with `m<char>` where `<char>` is any character I choose and then reaching the marks with `]`` or `[``.
I'm wondering if it is possible to use a command to set a mark with an **incremental index** instead of a character, avoiding to override marks previously set. | 2015/12/30 | [
"https://vi.stackexchange.com/questions/5995",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5707/"
] | There is nothing built in to vim, but you can script something like this:
```
fu! s:IncrementalMark() abort
let b:index_mark=get(b:, 'index_mark', -1)+1
" configure, which marks to use
let marks='abcdefghijklmnopqrstuvwxyz'
return 'm'.marks[b:index_mark%strlen(marks)]
endfu
nnoremap <silent><expr> <lea... | I'm not sure I understood what you wanted. But if you want to cycle through all the available local marks from `a` to `z`, then the following mapping should allow you to do so:
```
nnoremap <silent> <leader>m
\ :<c-u>if !exists('marklist') \|\| marklist == [] <bar>
\ let marklist = map(rang... |
40,806 | After Paul scolds the Corinthians for bearing people who preach things not according to Christ, he says:
>
> For I reckon that I am not a whit behind the very chiefest apostles.(ASV)
>
>
>
Paul proceeds to defend himself as not misusing them for financial gain and then in v13 refers to false apostles:
>
> For s... | 2019/05/23 | [
"https://hermeneutics.stackexchange.com/questions/40806",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/21547/"
] | **Q: ***Who are the "chiefest apostles" in 2 Cor.11:5?*****
The **supper-apostles** in (v5), Paul identifies in v-4 as those **who proclaim - “another Jesus; .a different Spirit; a different gospel,**” **not** the gospel preached by “Apostles - the twelves.”
They were itinerant, self-appointed Hebraic Jewish believer... | Some other translations of 2 Corinthians 11:5 -
>
> But I do not think I am in the least inferior to those "super apostles." (NIV)
>
>
> Yet I consider myself as in no way inferior to these [precious] extra-super [false] apostles. (AMP)
>
>
>
Verse 5 is referring to people who make themselves out to be apostle... |
40,806 | After Paul scolds the Corinthians for bearing people who preach things not according to Christ, he says:
>
> For I reckon that I am not a whit behind the very chiefest apostles.(ASV)
>
>
>
Paul proceeds to defend himself as not misusing them for financial gain and then in v13 refers to false apostles:
>
> For s... | 2019/05/23 | [
"https://hermeneutics.stackexchange.com/questions/40806",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/21547/"
] | **Q: ***Who are the "chiefest apostles" in 2 Cor.11:5?*****
The **supper-apostles** in (v5), Paul identifies in v-4 as those **who proclaim - “another Jesus; .a different Spirit; a different gospel,**” **not** the gospel preached by “Apostles - the twelves.”
They were itinerant, self-appointed Hebraic Jewish believer... | 2 Cor 11:5 uses the phrase "chiefest apostles" (Ὑπερλίαν ἀποστόλων) or even more literally, "hyper-apostles". Such an expression is unique in the NT and displays some of Paul's characteristic passion about the subject. I suggest it is a combination of the following meanings:
* A reference to 2 Cor 10:18 and its earlie... |
40,806 | After Paul scolds the Corinthians for bearing people who preach things not according to Christ, he says:
>
> For I reckon that I am not a whit behind the very chiefest apostles.(ASV)
>
>
>
Paul proceeds to defend himself as not misusing them for financial gain and then in v13 refers to false apostles:
>
> For s... | 2019/05/23 | [
"https://hermeneutics.stackexchange.com/questions/40806",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/21547/"
] | **Q: ***Who are the "chiefest apostles" in 2 Cor.11:5?*****
The **supper-apostles** in (v5), Paul identifies in v-4 as those **who proclaim - “another Jesus; .a different Spirit; a different gospel,**” **not** the gospel preached by “Apostles - the twelves.”
They were itinerant, self-appointed Hebraic Jewish believer... | >
> 2 Corinthians 11:5 I do not think I am in the least inferior to those "super-apostles."
>
>
>
super
Ὑπερλίαν (Hyperlian)
Adverb
Strong's Greek 5228: Gen: in behalf of; acc: above.
I detect sarcasm when Paul uses the prefix "super".
In the verse just before it:
>
> 4 For if someone comes to you and... |
38,577,440 | I have a class called Fractions that takes in a numerator and a denominator. It has three methods- frac, redfrac, dec- that print out the fraction, its reduced version, and its decimal form respectively.
As an example, if the numerator is 12 and the denominator is 4, I want to print out the result as so:
>
> Fractio... | 2016/07/25 | [
"https://Stackoverflow.com/questions/38577440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6565741/"
] | `"Fraction:" + a.frac` is not using string interpolation - it is using the + operator and trying to add a Fixnum to a String, which is impossible.
To use String interpolation, you can do it like this:
```
puts "Fraction: #{a.frac}"
```
You could also do this:
```
puts "Fraction: " + a.frac.to_s
```
Which convert... | You couldn't do string concatenation with `+` operator because the return value of `a.frac` is not a string.
You could explicitly convert it to string with `.to_s` and change your line:
```
puts "Fraction:" + a.frac.to_s
```
or, you could use Ruby's string interpolation like this:
```
puts "Fraction: #{a.frac}"
`... |
4,238,146 | Are there any websites that provides data (of any topic) to apply data mining techniques such as classification and association rules? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4238146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/515117/"
] | <http://www.fedstats.gov/> | A great source is [UCI Machine Learning Repositor](http://archive.ics.uci.edu/ml/) |
18,132 | At the time of writing this question, the [Turkish referendum](https://en.wikipedia.org/wiki/Turkish_constitutional_referendum,_2017) for changing the Constitution has just finished with approval of these changes (about 51% for "Yes").
According to [this source](https://www.pri.org/stories/2016-07-19/over-50000-people... | 2017/04/16 | [
"https://politics.stackexchange.com/questions/18132",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/11278/"
] | Yes, as the Office of the President is largely ceremonial now. In this referendum, there are a few notable changes to the constitution that will give the President more **official powers** as seen below.
1.
--
The **existing parliamentary system of government will be replaced with an executive presidency and a presid... | For Erdogan, it doesn't really affects much. Because the PEOPLE, more than half supports HIM. So he wins ANY kind of election or referandum and probably he will.
Practically he chose the prime minister and the all cabinet and the all parliament (of ruling party). And even he choses the (his party's) candidates of Mayo... |
64,985,380 | I was studying a linked list code and came across the fact that apart from using recursive, a for or while loop can also be used. Therefore, I tried changing the recursive into a while loop(i.e iterative) but it seems my logic is completely out of place..
I just want to change the `listing` function in the following c... | 2020/11/24 | [
"https://Stackoverflow.com/questions/64985380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11571022/"
] | The definition of a non-recursive function using the while loop is enough simple.
```
NODE listing( const char string[] )
{
NODE head = NULL;
NODE *current = &head;
while ( *string )
{
*current = ( struct linkedlist * )malloc( sizeof( linkedlist ) );
( *current ) -> first = *string++;
... | Try something like this :
```
NODE listing(char string[]){
NODE head;
head = (struct linkedlist *)malloc(sizeof(linkedlist));
NODE cur = head;
int i = 0;
while(string[i] != '\0')
{
cur->first = string[i];
if (string[i+1] != '\0') cur->second = (struct linkedlist *)malloc(sizeof... |
58,690 | Google analytics offers the nice feature of letting one know, where a user is coming from.
We are currently sending out emails containing links to our website and I would like to know how many people click on that link.
For that I was hoping that there exists some Web service which allows one to register a url www.... | 2014/02/25 | [
"https://webmasters.stackexchange.com/questions/58690",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/34299/"
] | You can use [Google Analytics URL builder](https://support.google.com/analytics/answer/1033867?hl=en) to construct your URL's in emails and then view visits to your website via these URL's in the 'Campaigns' section of Google Analytics and drill down, segment, create custom reports as you see fit. | I use `bitly.com` which gives me a breakdown of country, of websites, and the number of hits in each. With an upgrade can give me a lot more tracking visits info. I can also customise (tag) my new URL. There are many other shortening URL sites which do the same. Just Google URL shortning sites |
18,099,990 | I want to do a sql query like
```
select * where x = 10 and (y=12 or h=15)
```
How can I achieve that in CI ActiveRecord format? | 2013/08/07 | [
"https://Stackoverflow.com/questions/18099990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/456262/"
] | See [Active record](http://ellislab.com/codeigniter/user-guide/database/active_record.html#select) reference
```
$where="x = 10 and (y=12 or h=15)";
$this->db->select('*');
$this->db->from('mytable');
$this->db->where($where);
$query = $this->db->get();
``` | Try like
```
$sql = "SELECT * FROM TABLE_NAME WHERE x = 10 AND (y = 12 OR h = 15)";
$result = $this->db->query($sql);
```
Or like
```
$this->db->select('*');
$this->db->from('TABLE_NAME');
$this->db->where('x',10);
$this->db->AND('y',12);
$this->db->or_where('h',15);
$query = $this->db->get();
``` |
2,655,220 | I installed Mono and MonoDevelop 2.2 on my Windows PC.
Created a default C# ASP.NET Web Application project.
Here's the Default.aspx it created:
```
<%@ Page Language="C#" Inherits="test.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">... | 2010/04/16 | [
"https://Stackoverflow.com/questions/2655220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28098/"
] | Apparently the problem is in the Microsoft .NET runtime.
In MonoDevelop under Project menu there is sub-menu `Active Runtime`.
Switching it from Microsoft .NET to Mono fixes the problem! | I don't think this has to do with Mono. Change `<html>` to `<html xmlns='http://www.w3.org/1999/xhtml'>`. |
2,655,220 | I installed Mono and MonoDevelop 2.2 on my Windows PC.
Created a default C# ASP.NET Web Application project.
Here's the Default.aspx it created:
```
<%@ Page Language="C#" Inherits="test.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">... | 2010/04/16 | [
"https://Stackoverflow.com/questions/2655220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28098/"
] | Try this: [How to: Configure XHTML Rendering in ASP.NET Web Sites](http://msdn.microsoft.com/en-us/library/ms178159.aspx) | I don't think this has to do with Mono. Change `<html>` to `<html xmlns='http://www.w3.org/1999/xhtml'>`. |
54,348,660 | my data structure is the following:
```
all= {
'part1': {'act1': [0, 0], 'act2': [100, 0]},
'part2': {'act1': [25, 1], 'act2': [100, 1]},
'part3': {'act1': [25, 0], 'act2': [0, 1]},
'part4': {'act1': [0, 0], 'act2': [0, 1]}
}
```
My goal is to get the global sum of all the f... | 2019/01/24 | [
"https://Stackoverflow.com/questions/54348660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10962174/"
] | You can use the `sum` function with a generator expression that iterates through the values of the dict and the sub-dicts:
```
sum(n for d in a.values() for n, _ in d.values())
```
This returns:
```
250
```
Note that `all` is a built-in function name, so I've renamed the `all` variable in your question to `a` ins... | You can use a list comprehension with `sum`:
```
d = {'part1': {'act1': [0, 0], 'act2': [100, 0]}, 'part2': {'act1': [25, 1], 'act2': [100, 1]}, 'part3': {'act1': [25, 0], 'act2': [0, 1]}, 'part4': {'act1': [0, 0], 'act2': [0, 1]}}
_sum = sum(sum(a for a, *_ in c.values()) for c in d.values())
```
Output:
```
#[100... |
54,348,660 | my data structure is the following:
```
all= {
'part1': {'act1': [0, 0], 'act2': [100, 0]},
'part2': {'act1': [25, 1], 'act2': [100, 1]},
'part3': {'act1': [25, 0], 'act2': [0, 1]},
'part4': {'act1': [0, 0], 'act2': [0, 1]}
}
```
My goal is to get the global sum of all the f... | 2019/01/24 | [
"https://Stackoverflow.com/questions/54348660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10962174/"
] | The reason is that firstly
```
for partData in all.values():
depPart = 0
for act in partData.keys():
depPart += partData[act][0]
print(depPart)
```
on line 2 `depPart=0` each time you get a value from all `print(depPart)` prints value everytime it sums every value inside each value so your co... | You can use a list comprehension with `sum`:
```
d = {'part1': {'act1': [0, 0], 'act2': [100, 0]}, 'part2': {'act1': [25, 1], 'act2': [100, 1]}, 'part3': {'act1': [25, 0], 'act2': [0, 1]}, 'part4': {'act1': [0, 0], 'act2': [0, 1]}}
_sum = sum(sum(a for a, *_ in c.values()) for c in d.values())
```
Output:
```
#[100... |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Unfortunately, you can only side-step the issue by clicking the Albums tab > Faces, and select each found face & delete it. You cannot bulk select, so this must be done manually for each face.
You should log an enhancement request (or three) at the [Photos Feedback](http://www.apple.com/feedback/photos.html) page. | in search type 'face0' all the faces will come up. then select all and delete. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Many people say it is not possible to disable that feature. But there might be some workarounds depending on your needs.
If you (and other users of the computer) do not want that feature, you might want to forcibly stop the program that performs the face detection/photo analysis.
The process (or *program*) responsible... | You can find the option in **View > Hide Face Names**. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Unfortunately, you can only side-step the issue by clicking the Albums tab > Faces, and select each found face & delete it. You cannot bulk select, so this must be done manually for each face.
You should log an enhancement request (or three) at the [Photos Feedback](http://www.apple.com/feedback/photos.html) page. | You can find the option in **View > Hide Face Names**. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Apparently you can stop face recognition by quitting iPhotos, opening a terminal and typing the following (and press enter):
```
defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
```
I guess you'll then need to manually delete all the faces it's recognised thus far.
As for the new "Photos" app, I don't think... | Many people say it is not possible to disable that feature. But there might be some workarounds depending on your needs.
If you (and other users of the computer) do not want that feature, you might want to forcibly stop the program that performs the face detection/photo analysis.
The process (or *program*) responsible... |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Apparently you can stop face recognition by quitting iPhotos, opening a terminal and typing the following (and press enter):
```
defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
```
I guess you'll then need to manually delete all the faces it's recognised thus far.
As for the new "Photos" app, I don't think... | in search type 'face0' all the faces will come up. then select all and delete. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Many people say it is not possible to disable that feature. But there might be some workarounds depending on your needs.
If you (and other users of the computer) do not want that feature, you might want to forcibly stop the program that performs the face detection/photo analysis.
The process (or *program*) responsible... | in search type 'face0' all the faces will come up. then select all and delete. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Many people say it is not possible to disable that feature. But there might be some workarounds depending on your needs.
If you (and other users of the computer) do not want that feature, you might want to forcibly stop the program that performs the face detection/photo analysis.
The process (or *program*) responsible... | There is a way to do this now in Photos Version 3.0 (3271.13.150).
In the sidebar select People. Then select all the faces that show up and right click. There is an option to delete/reset all saved face data. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Apparently you can stop face recognition by quitting iPhotos, opening a terminal and typing the following (and press enter):
```
defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
```
I guess you'll then need to manually delete all the faces it's recognised thus far.
As for the new "Photos" app, I don't think... | You can find the option in **View > Hide Face Names**. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | Apparently you can stop face recognition by quitting iPhotos, opening a terminal and typing the following (and press enter):
```
defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
```
I guess you'll then need to manually delete all the faces it's recognised thus far.
As for the new "Photos" app, I don't think... | There is a way to do this now in Photos Version 3.0 (3271.13.150).
In the sidebar select People. Then select all the faces that show up and right click. There is an option to delete/reset all saved face data. |
182,568 | I don't like the feature that automatically detects faces in Photos for OS X because of the unnecessary CPU and disk space consumption. A photo library of 360 MB generated 50 MB of face detection data inside the Photos Library.
Is there any way to disable this feature in Photos for OS X? | 2015/04/25 | [
"https://apple.stackexchange.com/questions/182568",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/103667/"
] | There is a way to do this now in Photos Version 3.0 (3271.13.150).
In the sidebar select People. Then select all the faces that show up and right click. There is an option to delete/reset all saved face data. | You can find the option in **View > Hide Face Names**. |
2,146,406 | Given sequence:
$A\_1 = 0$
$A\_2 = 1$
$A\_3 = 3$
$A\_4 = 6$
$A\_5 = 10$ ...
And the recursive formula is given as $A\_n = A\_{n-1} + (n - 1)$
How can one find this sequence's explicit formula? | 2017/02/16 | [
"https://math.stackexchange.com/questions/2146406",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/323267/"
] | **Hint**. One may write
$$
A\_n - A\_{n-1} = (n - 1),\qquad n\ge2,
$$ then summing from $2$ to $N$ terms *telescope on the left hand side* getting
$$
A\_N - A\_1 = \sum\_{n=2}^N(n - 1)=\frac{N(N-1)}2.
$$ | Because $n-1=\frac{a\_{n}-a\_{n-1}}{n-(n-1)} \approx \frac{d}{dn} a\_n$ is linear, it is reasonable to guess that $a\_n$ is a quadratic because the integral of a linear function is a quadratic.
So guess $a\_n=an^2+bn+c$.
This means,
$$\left(an^2+bn+c \right)-\left(a(n-1)^2+b(n-1)+c \right)$$
$$=a(2n-1)+b$$
$$=\col... |
2,146,406 | Given sequence:
$A\_1 = 0$
$A\_2 = 1$
$A\_3 = 3$
$A\_4 = 6$
$A\_5 = 10$ ...
And the recursive formula is given as $A\_n = A\_{n-1} + (n - 1)$
How can one find this sequence's explicit formula? | 2017/02/16 | [
"https://math.stackexchange.com/questions/2146406",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/323267/"
] | **Hint**. One may write
$$
A\_n - A\_{n-1} = (n - 1),\qquad n\ge2,
$$ then summing from $2$ to $N$ terms *telescope on the left hand side* getting
$$
A\_N - A\_1 = \sum\_{n=2}^N(n - 1)=\frac{N(N-1)}2.
$$ | We recognise $0,1,3,6,10,\cdots$ as $\displaystyle \left[\binom 12\right], \binom 22, \binom 32,\binom42, \binom 52,\cdots $
and conjecture that $$\color{red}{A\_n=\binom n2}$$
Testing this in the recurrence relation given:
$$A\_n-A\_{n-1}=\binom n2-\binom {n-1}2=\frac {n(n-1)}2-\frac {(n-1)(n-2)}2=n-1\\
\Longrightarro... |
2,146,406 | Given sequence:
$A\_1 = 0$
$A\_2 = 1$
$A\_3 = 3$
$A\_4 = 6$
$A\_5 = 10$ ...
And the recursive formula is given as $A\_n = A\_{n-1} + (n - 1)$
How can one find this sequence's explicit formula? | 2017/02/16 | [
"https://math.stackexchange.com/questions/2146406",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/323267/"
] | We recognise $0,1,3,6,10,\cdots$ as $\displaystyle \left[\binom 12\right], \binom 22, \binom 32,\binom42, \binom 52,\cdots $
and conjecture that $$\color{red}{A\_n=\binom n2}$$
Testing this in the recurrence relation given:
$$A\_n-A\_{n-1}=\binom n2-\binom {n-1}2=\frac {n(n-1)}2-\frac {(n-1)(n-2)}2=n-1\\
\Longrightarro... | Because $n-1=\frac{a\_{n}-a\_{n-1}}{n-(n-1)} \approx \frac{d}{dn} a\_n$ is linear, it is reasonable to guess that $a\_n$ is a quadratic because the integral of a linear function is a quadratic.
So guess $a\_n=an^2+bn+c$.
This means,
$$\left(an^2+bn+c \right)-\left(a(n-1)^2+b(n-1)+c \right)$$
$$=a(2n-1)+b$$
$$=\col... |
12,383,558 | ```
int main(){
MyBase *mb;
int choice;
cout << "Select: ";
cin >> choice;
switch (choice) {
case 1:
mb = new Test1();
break;
case 2:
mb = new Test2();
break;
case 3:
mb = new Test3();
break;
case 4:
mb = new Test4();
break;
case 5:
... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12383558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460697/"
] | You haven't initialized `mb`; C++ doesn't do that for you; and for the case that `choice` is 6, `mb` doesn't get assigned any value, so it is uninitialized later on when you check it against 0, and can hold any random value (that random value could be 0, but in most cases it won't be; it will just contain whatever valu... | You need to initialise mb to `NULL`, otherwise in the case where `choice` is not in the range 1..5 `mb` will be undefined. Change:
```
MyBase *mb;
```
to:
```
MyBase *mb = NULL;
``` |
12,383,558 | ```
int main(){
MyBase *mb;
int choice;
cout << "Select: ";
cin >> choice;
switch (choice) {
case 1:
mb = new Test1();
break;
case 2:
mb = new Test2();
break;
case 3:
mb = new Test3();
break;
case 4:
mb = new Test4();
break;
case 5:
... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12383558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460697/"
] | When you declare variables inside function scope, they are normally whats called "stack variables". This means they reside in stack-memory which typically contains lots of "garbage" from previous use. Hence, when not initializing the 'mb' variable upon declaration, the initial value is undefined (whatever happened to b... | You haven't initialized `mb`; C++ doesn't do that for you; and for the case that `choice` is 6, `mb` doesn't get assigned any value, so it is uninitialized later on when you check it against 0, and can hold any random value (that random value could be 0, but in most cases it won't be; it will just contain whatever valu... |
12,383,558 | ```
int main(){
MyBase *mb;
int choice;
cout << "Select: ";
cin >> choice;
switch (choice) {
case 1:
mb = new Test1();
break;
case 2:
mb = new Test2();
break;
case 3:
mb = new Test3();
break;
case 4:
mb = new Test4();
break;
case 5:
... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12383558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460697/"
] | When you declare variables inside function scope, they are normally whats called "stack variables". This means they reside in stack-memory which typically contains lots of "garbage" from previous use. Hence, when not initializing the 'mb' variable upon declaration, the initial value is undefined (whatever happened to b... | You need to initialise mb to `NULL`, otherwise in the case where `choice` is not in the range 1..5 `mb` will be undefined. Change:
```
MyBase *mb;
```
to:
```
MyBase *mb = NULL;
``` |
35,768,995 | Hey Guys so Im struggling to get this right. This is my code for the menu. I have successfully changed the breakpoint of the menu but now it doesnt collapse untill it hits the original breakpoint.
```
<nav class="navbar navbar-default" id="navigation-top-affix">
<div class="navbar-header">... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35768995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4554732/"
] | if you want to solve your problem with bootstrap you have to define your custom responsive grid-float-breakpoint(@grid-float-breakpoint).To do this you have to customize bootstrap variables.less file. here is a [Instructions](https://www.gaslampmedia.com/common-bootstrap-customizations/) also [here](http://getbootstrap... | Just add #autocollapse to your nav tag. see code
```js
function autocollapse() {
var navbar = $('#autocollapse');
navbar.removeClass('collapsed');
if(navbar.innerHeight() > 50) // check if we've got 2 lines
navbar.addClass('collapsed');
}
```
```css
#autocollapse.collapsed .navbar-header {
... |
4,543,612 | Let us $X$ an vector space with inner product. To give some example where $x\_n\rightarrow x$, $y\_n\rightarrow y$ weakly both but $(\langle x\_n,y\_n\rangle)\_{n}$ is not convergent:
Well the excercise has a following hint: Consider $(e\_1,e\_2,\ldots)$ and $(e\_2,e\_2,e\_4,e\_4,\ldots)$ where $e\_i$ are orthonormal.... | 2022/10/02 | [
"https://math.stackexchange.com/questions/4543612",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/616791/"
] | A more straightforward way to solve this would be to use that two nonzero complex numbers are equal if and only if their modules are equal, and their arguments are equal modulo $2\pi$ in the following way.
Write
$$z=re^{i\theta},$$
and note that your equation then reads
$$r^ne^{in\theta}=1.$$
Since $r^n=\lvert z^n... | An easier way to solve would be:
$$
\begin{align\*}
z^{n} &= 1 \Rightarrow z^{n} = |z^{n}|\\
z &= |z| \cdot \mathrm{e}^{\arg(z) \cdot \mathrm{i}}
(|z| \cdot \mathrm{e}^{\arg(z) \cdot \mathrm{i}})^{n} &= 1\\
|z|^{n} \cdot (\mathrm{e}^{\arg(z) \cdot \mathrm{i}})^{n} &= 1\\
|z|^{n} \cdot \mathrm{e}^{n \cdot \arg(z) \cdot ... |
25,912,624 | i have textbox only allow decimals and '+'
it allow only 1 Decimal "12.332" i need to allow 1 decimal before '+' and 1 decimal after '+' Example i have 12.43+12.23 i can't type the 12(.) because i allow only 1 decimal i am using Split method to get 2 parts before and after
and it is my code
```
// checks to make su... | 2014/09/18 | [
"https://Stackoverflow.com/questions/25912624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526696/"
] | I would say use two text boxes like someone said in the comments but if you want to be stubborn here is a function to run inside an event that is called when the text changes in the text box.
```
void textbox_textChanged(object sender, EventArgs e)
{
string text = textBox.Text;
int pointCounter = 0... | I would recommend using a Regex to validate your textbox. I would also suggest that using the textbox Validating event would be better than using the Leave event. Here is an example of using a regex in the Validating event:
```
private void textBox1_Validating(object sender, CancelEventArgs e)
{
TextBox tbox = (Te... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | There are multiple ways for a program to fail. For example `grep` fails if it doesn't find the pattern looked for, or if it can't open one of the files specified.
Presently Unix allows 1 (unsigned) byte of value (the return code) to be passed back from a child to it's parent (I am ignoring the information about which ... | I can only think of this rationale and it seems quite strong to me.
The easiest way to translate boolean operations into computer arithmetic is to use `0` for `FALSE` and `1` for `TRUE`, and then all the operations with them make perfect sense, i.e.
```
TRUE && TRUE = TRUE ( 1 * 1 = 1)
TRUE && FALSE = FALSE ( 1 *... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | You are confusing two different things:
1. Integers as used as boolean.
A boolean is a response to a question: "Is this variable's value the same as this other variable's value?" The answer is a *false* or a *true*. These could be encoded as 0 or 1.
2. Integers as used as exit-status.
An exit-status is a statement o... | I can only think of this rationale and it seems quite strong to me.
The easiest way to translate boolean operations into computer arithmetic is to use `0` for `FALSE` and `1` for `TRUE`, and then all the operations with them make perfect sense, i.e.
```
TRUE && TRUE = TRUE ( 1 * 1 = 1)
TRUE && FALSE = FALSE ( 1 *... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | You are comparing apples to pears. They taste different. :-)
Arithmetic
==========
An **arithmetic** `0` means false[a] both in c and the shell:
```
$ if ((0)); then echo true; else echo false; fi
false
```
Or, in a more portable test, but somewhat more convoluted:
```
$ echo $(( 22 == 23 ))
0
```
[a] Actually,... | I can only think of this rationale and it seems quite strong to me.
The easiest way to translate boolean operations into computer arithmetic is to use `0` for `FALSE` and `1` for `TRUE`, and then all the operations with them make perfect sense, i.e.
```
TRUE && TRUE = TRUE ( 1 * 1 = 1)
TRUE && FALSE = FALSE ( 1 *... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | **The origin of true = 1 and false = 0**
If you want to know the historical context of why true is 1 and false is 0 then I would like to point out that boolean algebra was "invented" by George Bool in 1847.
This was way before the first electronic computers. Boolean algebra was published in "THE MATHEMATICAL ANALYSIS ... | I can only think of this rationale and it seems quite strong to me.
The easiest way to translate boolean operations into computer arithmetic is to use `0` for `FALSE` and `1` for `TRUE`, and then all the operations with them make perfect sense, i.e.
```
TRUE && TRUE = TRUE ( 1 * 1 = 1)
TRUE && FALSE = FALSE ( 1 *... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | There are multiple ways for a program to fail. For example `grep` fails if it doesn't find the pattern looked for, or if it can't open one of the files specified.
Presently Unix allows 1 (unsigned) byte of value (the return code) to be passed back from a child to it's parent (I am ignoring the information about which ... | You are confusing two different things:
1. Integers as used as boolean.
A boolean is a response to a question: "Is this variable's value the same as this other variable's value?" The answer is a *false* or a *true*. These could be encoded as 0 or 1.
2. Integers as used as exit-status.
An exit-status is a statement o... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | There are multiple ways for a program to fail. For example `grep` fails if it doesn't find the pattern looked for, or if it can't open one of the files specified.
Presently Unix allows 1 (unsigned) byte of value (the return code) to be passed back from a child to it's parent (I am ignoring the information about which ... | You are comparing apples to pears. They taste different. :-)
Arithmetic
==========
An **arithmetic** `0` means false[a] both in c and the shell:
```
$ if ((0)); then echo true; else echo false; fi
false
```
Or, in a more portable test, but somewhat more convoluted:
```
$ echo $(( 22 == 23 ))
0
```
[a] Actually,... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | There are multiple ways for a program to fail. For example `grep` fails if it doesn't find the pattern looked for, or if it can't open one of the files specified.
Presently Unix allows 1 (unsigned) byte of value (the return code) to be passed back from a child to it's parent (I am ignoring the information about which ... | **The origin of true = 1 and false = 0**
If you want to know the historical context of why true is 1 and false is 0 then I would like to point out that boolean algebra was "invented" by George Bool in 1847.
This was way before the first electronic computers. Boolean algebra was published in "THE MATHEMATICAL ANALYSIS ... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | You are comparing apples to pears. They taste different. :-)
Arithmetic
==========
An **arithmetic** `0` means false[a] both in c and the shell:
```
$ if ((0)); then echo true; else echo false; fi
false
```
Or, in a more portable test, but somewhat more convoluted:
```
$ echo $(( 22 == 23 ))
0
```
[a] Actually,... | You are confusing two different things:
1. Integers as used as boolean.
A boolean is a response to a question: "Is this variable's value the same as this other variable's value?" The answer is a *false* or a *true*. These could be encoded as 0 or 1.
2. Integers as used as exit-status.
An exit-status is a statement o... |
641,127 | I started a shell for another user on my system. However there's no systemd user instance for that user:
```
helloer@host $ sudo -u testusr bash
testusr@host $ systemctl --user status
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to c... | 2021/03/25 | [
"https://unix.stackexchange.com/questions/641127",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/462141/"
] | **The origin of true = 1 and false = 0**
If you want to know the historical context of why true is 1 and false is 0 then I would like to point out that boolean algebra was "invented" by George Bool in 1847.
This was way before the first electronic computers. Boolean algebra was published in "THE MATHEMATICAL ANALYSIS ... | You are confusing two different things:
1. Integers as used as boolean.
A boolean is a response to a question: "Is this variable's value the same as this other variable's value?" The answer is a *false* or a *true*. These could be encoded as 0 or 1.
2. Integers as used as exit-status.
An exit-status is a statement o... |
81,366 | I have two lights from B&Q which are normally battery powered but can be powered by a transformer with a regulated output of 6 V, 0.5 A DC. I would like to set up the lights to be powered off the same transformer but don't know how to calculate the voltage and current the transformer would be required to output (in eit... | 2013/09/05 | [
"https://electronics.stackexchange.com/questions/81366",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/28548/"
] | So, when you are connecting two lights in series, the current stays the same, but the voltage sums - U = 6 + 6 = 12V; I= 0.5A.
For parallel, the voltage is same, but the current is doubled - U = 6V; I = 0.5 + 0.5 = 1A | To power your two lights connected in parallel, you need a 6 volt, 1 amp power supply,based on the information you supplied. However, since the lights are designed for battery power, I suspect that they actually need much less than 0.5A each, so you may be able to run them both from an 0.5A supply - if you have an amme... |
1,729,558 | >
> Prove that there is no irreducible polynomial of degree 2 in $\mathbb C[x]$.
>
>
>
I know this result is true from the Fundamental Theorem of Algebra, which states that any polynomial in $\mathbb C[x]$ with degree $n\ge 1$, has at least $1$ root in $\mathbb C$.
However, this question is asked in the textbook ... | 2016/04/05 | [
"https://math.stackexchange.com/questions/1729558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/290425/"
] | I'm going to use $t$ instead of $f$.
The points $A + tB$ lie on a line through the point $A$ in the direction of the vector $B$. You are trying to find the values of $t$ that give you the intersections of this line with a circle $C$ of radius $M$ centered at the origin.
If the point $A$ lies inside the circle $C$, t... | Iterative approximation to the required value of $f$ seems to fit to your needs, if I understood well.
You want$$
\left( {x + f\,u} \right)^{\,2} + \left( {y + f\,v} \right)^{\,2} - M^{\,2} \le 0
$$
i.e.
$$
\,f^{\,2} + 2\,{{\left( {x\,u\, + \,y\,v} \right)} \over {\left( {u^{\,2} + \,v^{\,2} } \right)}}\,f + {{x^{\,2} ... |
1,729,558 | >
> Prove that there is no irreducible polynomial of degree 2 in $\mathbb C[x]$.
>
>
>
I know this result is true from the Fundamental Theorem of Algebra, which states that any polynomial in $\mathbb C[x]$ with degree $n\ge 1$, has at least $1$ root in $\mathbb C$.
However, this question is asked in the textbook ... | 2016/04/05 | [
"https://math.stackexchange.com/questions/1729558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/290425/"
] | I'm going to use $t$ instead of $f$.
The points $A + tB$ lie on a line through the point $A$ in the direction of the vector $B$. You are trying to find the values of $t$ that give you the intersections of this line with a circle $C$ of radius $M$ centered at the origin.
If the point $A$ lies inside the circle $C$, t... | Update: I tried playing with iterative approximation approaches (like G Cab mentioned) and doing a binary search to find a suitable value of $f$, but nothing could come close to the performance of simply calculating the equation directly.
I made sure to use any possible optimization (storing all intermediate steps of ... |
53,857,298 | I created a class template. Depending on its template arguments it supports different operations. The class template shall be (*implicitly*) instantiated for several combinations of template arguments. For some of those combinations there may be member functions that do not make sense (and also do not compile). However... | 2018/12/19 | [
"https://Stackoverflow.com/questions/53857298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2615118/"
] | >
> Are these conditionally invalid member functions a problem if I never need explicit instantiation?
>
>
>
Even templates from STL have "invalid" methods, for example: `std::vector<T>::resize(std::size_t)` with non default constructible `T`.
So, with "invalid" methods, your class is usable normally. Document yo... | I see at least the problem, that the design breaks type traits like the following, so you will probably get problems when SFINAE is used to decide which constructors will be called.
```
static_assert(!std::is_constructible<SuperSink<int, 1>, int, int>::value);
static_assert(!std::is_constructible<SuperSink<int, 2>, i... |
30,491,453 | I have an object make = {};
I created object methods ( make.a(), make.h1() ) where each method creates a tag element
I created a JSFiddle of what I did: [here](http://jsfiddle.net/cruzj/hpep8rfj/)
I want to create many tag elements like that.
Is there any way to avoid repeating
```
return document.createElemen... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3861555/"
] | Recursion is only needed when there is more then one element to process.
If there is one or zero elements then return. | your `mymestry` function seems to multiple `n` and `m`, and of course you could start from 1 instead of two and change your function to:
```
public int mymestry (int n, int m)
{
if(n==0)
return 0;
return m + mymestry(n-1, m);
}
```
but the one who wrote this code, consider `m*1` a trivial multiple an... |
30,491,453 | I have an object make = {};
I created object methods ( make.a(), make.h1() ) where each method creates a tag element
I created a JSFiddle of what I did: [here](http://jsfiddle.net/cruzj/hpep8rfj/)
I want to create many tag elements like that.
Is there any way to avoid repeating
```
return document.createElemen... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3861555/"
] | Based on the terminology you are using:
The "recursive condition" is the set of circumstances in which the function will call itself recursively to reduce the problem domain. When this happens, a new function call is added to the stack and the call goes "deeper"
The "stopping condition" is the set of circumstances wh... | Recursion is only needed when there is more then one element to process.
If there is one or zero elements then return. |
30,491,453 | I have an object make = {};
I created object methods ( make.a(), make.h1() ) where each method creates a tag element
I created a JSFiddle of what I did: [here](http://jsfiddle.net/cruzj/hpep8rfj/)
I want to create many tag elements like that.
Is there any way to avoid repeating
```
return document.createElemen... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3861555/"
] | Based on the terminology you are using:
The "recursive condition" is the set of circumstances in which the function will call itself recursively to reduce the problem domain. When this happens, a new function call is added to the stack and the call goes "deeper"
The "stopping condition" is the set of circumstances wh... | your `mymestry` function seems to multiple `n` and `m`, and of course you could start from 1 instead of two and change your function to:
```
public int mymestry (int n, int m)
{
if(n==0)
return 0;
return m + mymestry(n-1, m);
}
```
but the one who wrote this code, consider `m*1` a trivial multiple an... |
45,991,301 | I've been following the documentation here from react-router-dom's [Redirect](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Redirect.md). Right now, I have a component like that renders the following:
```
return <Redirect to={{ pathname: '/login', state: { previousPath: path... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45991301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2975084/"
] | One of your parent components should be `Route` with props: match, location, history. You should be able to use the state you created with `props.location.state` to access your `previousPath` value.
See [location](https://reacttraining.com/react-router/web/api/location) in the React Router docs. | Solved it using `ownProps` in [mapStateToProps](https://github.com/reactjs/react-redux/blob/master/docs/api.md):
In my `Login` component (where the Redirect goes), I added this to my `mapStateToProps`:
```
const mapStateToProps = (state, ownProps) => ({
...
previousPath: ownProps.location.state.previousPath... |
45,991,301 | I've been following the documentation here from react-router-dom's [Redirect](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Redirect.md). Right now, I have a component like that renders the following:
```
return <Redirect to={{ pathname: '/login', state: { previousPath: path... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45991301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2975084/"
] | One of your parent components should be `Route` with props: match, location, history. You should be able to use the state you created with `props.location.state` to access your `previousPath` value.
See [location](https://reacttraining.com/react-router/web/api/location) in the React Router docs. | according to <https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Redirect.md>:
```
<Redirect
to={{
pathname: "/login",
search: "?utm=your+face",
state: { referrer: currentLocation }
}}
/>
``` |
53,923,356 | *I'm new to flutter. I need help in the progress indicator. I have the code of my buttons with strings, I need to make the transition to "FirstScreen" through the indicator. So that when I click on the "Login" button, the progress indicator will pop up for 3 seconds and then disappear.*
Edit:
I was able to reach this... | 2018/12/25 | [
"https://Stackoverflow.com/questions/53923356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10830211/"
] | You can do This using `material.dart` library
```
import 'package:flutter/material.dart';
class LoadingDialog extends StatefulWidget{
LoadingDialogState state;
bool isShowing(){
return state!=null&&state.mounted;
}
@override
createState()=> state=LoadingDialogState();
}
class LoadingDialogState ext... | Try to use progress hud. It's work for me. Here is the link.
<https://pub.dartlang.org/packages/progress_hud> |
16,585,055 | I have installed Android Studio v0.1 on Mac. My project imported and built successfully. AVD shows up whenever I run or debug the project, even though my device is connected and shown in integrated DDMS. I have double checked with `adb devices` from command-line and it shows my connected device. Please help~ | 2013/05/16 | [
"https://Stackoverflow.com/questions/16585055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1885105/"
] | // the very First time it will always selected only emulator options
you need to change it in Create Run Configuration...
in that General Tab select Target Device
* Show chooser dialog
* USB Devices
* Emulator | Visual aid to @Padma Kumar's answer.


"Android Studio is not starting from Device", "Force to start Android Studio from Device" |
30,736,043 | I am trying to copy the style of this site <http://www.shouldigoout.com/> which has some text ( h1 p a ) centrally alligned vertically and horizontally on the page.
The page use the @media rule to adjust the sizing for different display sizes.
How can I simply achieve this effect using css?
The site seems to use jav... | 2015/06/09 | [
"https://Stackoverflow.com/questions/30736043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4852995/"
] | Since you have an array of `uchar`, you know that your elements will always be in the range `0:255`. After seeing Tamás Szabó's answer [here](https://stackoverflow.com/a/30812596/1377097) I realized that the null character is exceedingly unlikely in a text file, so I will just ignore it and use the range `1:255`. If yo... | **Note**: This answers the *original version* of the question (the data consists of 10 letters only; a histogram is wanted). The question was *completely changed* (the data consists of about 20 letters, and a histogram of the 10 most used letters is wanted).
---
If the ten letters are arbitrary and not known in advan... |
63,088,438 | Spoiler alert if you are doing code wars and haven't completed 5kyu Simple Pig Latin kata
All you must do here is:
>
> "Move the first letter of each word to the end of it, then add "ay" to
> the end of the word. Leave punctuation marks untouched"
>
>
>
For example for input 'Pig latin is cool' it should return ... | 2020/07/25 | [
"https://Stackoverflow.com/questions/63088438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13993565/"
] | `word[1:] + word[0] + "ay" if word not in ",!?" else word` This is a conditional expression also know as Ternary Operators and
you must put expression at the left of a for loop statement and if condition at the right side of a for loop statement in a list comprehension.
```
return " ".join(
[word[1:] + word[0] + "... | ```
def pig_it(text):
return " ".join([word[1:] + word[0] + "ay" if word[0:1] not in ",!?" else word for word in text.split()])
print(pig_it('?hello, world!'))
print(pig_it('hel?lo, ?world!'))
```
Is this your desired output? In case YES, since you need to remain puncts untouched, you have to add more if else st... |
1,679 | If we use action items for projects/meetings and we want to make an easy print overview, this seems to be impossible. Any ideas or suggestions? | 2010/03/03 | [
"https://sharepoint.stackexchange.com/questions/1679",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/-1/"
] | I went a slightly different route. I created a httpmodule that checks if the querystring "PrinterFriendly" is true and if so, it uses an alternate masterpage which I created specifically for printing.
```
class PrinterFriendlyMasterPage : IHttpModule
{
public void Init(HttpApplication context)
{
contex... | I have worked on a few dozen Task/Project Tracking systems over the years. I normally try and provide good working views that can be used to conduct the meeting (via a computer). For the most part I try and stay away from printing since it is a waste of paper.
In the cases where they need printing, there are a number ... |
68,428,639 | I am new to React. I have some code snippets written in React in which prop is passed from parent component to child component and I am using functional component ( const arrow function). However, there is a use of **any keyword** which I don't understand.
My parent component:
```
const text = {
title: "We Made Alw... | 2021/07/18 | [
"https://Stackoverflow.com/questions/68428639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14673832/"
] | Usually, there's no need to use loops for this kind of thing. Pivot the data into long form, do the calculation and then pivot it to wide form again:
```
library(magrittr)
dat %>%
dplyr::group_by(site, visit_no) %>%
dplyr::summarise(a = dplyr::if_else("Scarabaeidae" %in% family, 1, 0)) %>%
tidyr::pivot_... | You may do this in one line using `tapply()`.
```
with(dat, tapply(I(family == 'Scarabaeidae'), list(site, visit_no), sum))
# 1 2 3
# A1 1 1 0
# A2 1 1 NA
# A3 0 0 0
```
---
*Data:*
```
dat <- read.table(header=T, text=' site family visit_no
1 A1 Scarabaeidae 1
2 A1 Clambidae ... |
68,428,639 | I am new to React. I have some code snippets written in React in which prop is passed from parent component to child component and I am using functional component ( const arrow function). However, there is a use of **any keyword** which I don't understand.
My parent component:
```
const text = {
title: "We Made Alw... | 2021/07/18 | [
"https://Stackoverflow.com/questions/68428639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14673832/"
] | You can use only `pivot_wider` -
```
tidyr::pivot_wider(df, names_from = visit_no, values_from = family,
values_fn = function(x) as.integer("Scarabaeidae" %in% x))
# site `1` `2` `3`
# <chr> <int> <int> <int>
#1 A1 1 1 0
#2 A2 1 1 NA
#3 A3 0 0 0... | You may do this in one line using `tapply()`.
```
with(dat, tapply(I(family == 'Scarabaeidae'), list(site, visit_no), sum))
# 1 2 3
# A1 1 1 0
# A2 1 1 NA
# A3 0 0 0
```
---
*Data:*
```
dat <- read.table(header=T, text=' site family visit_no
1 A1 Scarabaeidae 1
2 A1 Clambidae ... |
292,090 | I'm attempting to design a theme for which all posts are always visible in a grid layout, using `index.php` as my single template. Even accessing a URL matching a single post would display all posts, only with the one matching the URL being highlighted in some way.
This works like a charm on the homepage (`http://exam... | 2018/01/24 | [
"https://wordpress.stackexchange.com/questions/292090",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/135491/"
] | I ended up using the request filter, just like in the [documentation](https://codex.wordpress.org/Plugin_API/Filter_Reference/request):
```
function filterRequest( $request ) {
global $single_post_slug;
$dummy_query = new WP_Query(); // the query isn't run if we don't pass any query vars
$dummy_query->pa... | Testing with a standard install and twentysixteen, the problem lies within WP::parse\_request. With your `pre_get_posts` action in place, simply removing that completely from the equation worked for me:
```
add_filter("do_parse_request", function ($original_value, $query, $extra_vars) {
$query->query_vars = array(... |
180,332 | When attempting to import a bunch of data into mysql tables using python and mysqldb, I run into the following error '2006 - mySQL Server has gone away', and then I am unable to reconnect again within the script.
I am iniitially re-using a connection object across transactions ( delineated by conn.commit() ), then whe... | 2010/09/12 | [
"https://serverfault.com/questions/180332",
"https://serverfault.com",
"https://serverfault.com/users/54031/"
] | * Included SMTP Service is fully capable of SENDING emails. Nothing else is needed. | www.blat.net - very flexible and widely used. |
10,368,806 | The following piece of code creates a text file and then reads it, overwrites it, and reads it again. Except the creation of the file the three I/O operations are performed using Node.js async readFile and writeFile.
I don't understand why the first read is returning **no error** but **no data** either. The output of ... | 2012/04/29 | [
"https://Stackoverflow.com/questions/10368806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446681/"
] | Your code is *asking* for race conditions. Your first sync write is probably writing the file, but then your first read, second write, and second read are put onto the event loop *simultaneously*.
What could have happened here? First read gets read permission from the filesystem, second write gets write permission fro... | I had a similar problem. I was writing text to a file and had a change-handler telling me when the file had changed at which point I tried to read it ASYNC to process the new content of the file further.
Most of the time that worked but in some cases the callback for the ASYNC-read returned an empty string. So perhap... |
852,078 | Can we have two real valued functions $f\_1$ and $f\_2$ defined on $[a,b]$ such that $f\_1(x)=f\_2(x)$ for infinitely many points and $f\_1(x)\neq f\_2(x)$ for infinitely many points. ? | 2014/06/30 | [
"https://math.stackexchange.com/questions/852078",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/160025/"
] | How about $f\_1(x)=0$ and $f\_2(x)=\begin{cases}x\sin\frac1x &\mbox{if } x\neq 0 \\ 0 &\mbox{if } x=0 \end{cases}$, on the interval $[-1,1]$?
In this case, the functions are both continuous, which is kind of cool. | Consider
$$f\_1:[a,b]\to \mathbb{R}:x \mapsto \left\{\begin{array}{l l} 1 & \text{if } a \leq x \leq \frac{a+b}{2} \\ 0 & \text{else}\end{array}\right.$$
and $$f\_2:[a,b]\to \mathbb{R}:x \mapsto \left\{\begin{array}{l l} 1 & \text{if } a \leq x \leq \frac{a+b}{2} \\ 2 & \text{else}\end{array}\right.$$
then $f\_1 ([a,\f... |
852,078 | Can we have two real valued functions $f\_1$ and $f\_2$ defined on $[a,b]$ such that $f\_1(x)=f\_2(x)$ for infinitely many points and $f\_1(x)\neq f\_2(x)$ for infinitely many points. ? | 2014/06/30 | [
"https://math.stackexchange.com/questions/852078",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/160025/"
] | $$f\_1(x)=|x|$$
$$f\_2(x)=x$$
where $x\in (-1,1)$.
$\forall x\in [0,1) \ f\_1(x)=f\_2(x)$ but $\forall x \in (-1,0) \ f\_1(x)\neq f\_2(x)$. Both intervals are dense, therefore have infinitely many points. | Consider
$$f\_1:[a,b]\to \mathbb{R}:x \mapsto \left\{\begin{array}{l l} 1 & \text{if } a \leq x \leq \frac{a+b}{2} \\ 0 & \text{else}\end{array}\right.$$
and $$f\_2:[a,b]\to \mathbb{R}:x \mapsto \left\{\begin{array}{l l} 1 & \text{if } a \leq x \leq \frac{a+b}{2} \\ 2 & \text{else}\end{array}\right.$$
then $f\_1 ([a,\f... |
852,078 | Can we have two real valued functions $f\_1$ and $f\_2$ defined on $[a,b]$ such that $f\_1(x)=f\_2(x)$ for infinitely many points and $f\_1(x)\neq f\_2(x)$ for infinitely many points. ? | 2014/06/30 | [
"https://math.stackexchange.com/questions/852078",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/160025/"
] | $$f\_1(x)=|x|$$
$$f\_2(x)=x$$
where $x\in (-1,1)$.
$\forall x\in [0,1) \ f\_1(x)=f\_2(x)$ but $\forall x \in (-1,0) \ f\_1(x)\neq f\_2(x)$. Both intervals are dense, therefore have infinitely many points. | How about $f\_1(x)=0$ and $f\_2(x)=\begin{cases}x\sin\frac1x &\mbox{if } x\neq 0 \\ 0 &\mbox{if } x=0 \end{cases}$, on the interval $[-1,1]$?
In this case, the functions are both continuous, which is kind of cool. |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | You need, at a minimum, to include the right-most column size for a 2-D array. You can declare it like this:
```
extern unsigned char LCD[][64];
```
Otherwise the compiler would not be able to compute the offset after the first row. | Try specifying the dimensions of the array. In C for a multidimensional array only one dimension can be left unspecified.
Like this:
```
extern unsigned char LCD[][64];
``` |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | You need, at a minimum, to include the right-most column size for a 2-D array. You can declare it like this:
```
extern unsigned char LCD[][64];
```
Otherwise the compiler would not be able to compute the offset after the first row. | With multidimensional arrays, all but the first dimension must be specified. So...
```
extern unsigned char LCD[][64];
```
Should do it. |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | In C an array does not contain information about the size of each one of its dimensions. Therefore, the compiler needs to know how large is each one of the dimensions except the first one. So, to correct this situation, do something like this:
LCD.h:
```
#define MINOR 64
extern unsigned char LCD[][MINOR];
```
LCD.c... | Add to the header file a declaration like:
```
extern unsigned char LCD[8][64];
``` |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | You need, at a minimum, to include the right-most column size for a 2-D array. You can declare it like this:
```
extern unsigned char LCD[][64];
```
Otherwise the compiler would not be able to compute the offset after the first row. | sizeof of LCD array will refused if you didn't define the size of the two dimension !
```
sizeof refused : extern unsigned char LCD[][64];
sizeof accepted : extern unsigned char LCD[8][64];
```
it depend what you want ! |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | With multidimensional arrays, all but the first dimension must be specified. So...
```
extern unsigned char LCD[][64];
```
Should do it. | Add to the header file a declaration like:
```
extern unsigned char LCD[8][64];
``` |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | With multidimensional arrays, all but the first dimension must be specified. So...
```
extern unsigned char LCD[][64];
```
Should do it. | sizeof of LCD array will refused if you didn't define the size of the two dimension !
```
sizeof refused : extern unsigned char LCD[][64];
sizeof accepted : extern unsigned char LCD[8][64];
```
it depend what you want ! |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | Try specifying the dimensions of the array. In C for a multidimensional array only one dimension can be left unspecified.
Like this:
```
extern unsigned char LCD[][64];
``` | sizeof of LCD array will refused if you didn't define the size of the two dimension !
```
sizeof refused : extern unsigned char LCD[][64];
sizeof accepted : extern unsigned char LCD[8][64];
```
it depend what you want ! |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | Try specifying the dimensions of the array. In C for a multidimensional array only one dimension can be left unspecified.
Like this:
```
extern unsigned char LCD[][64];
``` | Add to the header file a declaration like:
```
extern unsigned char LCD[8][64];
``` |
8,581,574 | We have this declaration in LCD.c:
```
unsigned char LCD[8][64] = {((unsigned char) 0)};
```
And in LCD.h we want to have something like:
```
extern unsigned char LCD[][];
```
We get this error:
```
Error[Pe098]: an array may not have elements of this type
``` | 2011/12/20 | [
"https://Stackoverflow.com/questions/8581574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106072/"
] | With multidimensional arrays, all but the first dimension must be specified. So...
```
extern unsigned char LCD[][64];
```
Should do it. | #include
using namespace std;
int main(){
```
int n;
cout<<"Enter The Number"<<endl;
cin>>n;
int m;
cout<<"Enter The Second Number"<<endl;
cin>>m;
int array[n][m];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin<<array[i][j]<<endl;
}
}
for (int i = 0; i < n; i++)
{
for (int j = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.