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 |
|---|---|---|---|---|---|
1,101,487 | I've been a UNIX sysadmin for a long time, and aside from automating tasks with shell scripting, some light PHP work, and a few simple C programs, I've never done much in the way of programming. I recently decided to stretch my mind a bit and learn Common Lisp.
I'm half-way through Touretzky's "Gentle Intro" and, havi... | 2009/07/09 | [
"https://Stackoverflow.com/questions/1101487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125958/"
] | Let's assume you have emacs running and have checked out SLIME from
CVS and installed it. This should be easy with any Linux distro; `apt-get install emacs slime` does it for me. (You should also install SBCL, the best Common Lisp implementation.)
SLIME out of the box doesn't do much anymore, so it needs
configuration... | I can say that Emacs is a good environment for writing Lisp, since I used it in college to that end. The `*scratch*` buffer provides a good place for test code. The compiler docs should say how to call them, so you can write out your files to disk and then run them in a shell window, or use one of Emacs' modes to integ... |
1,101,487 | I've been a UNIX sysadmin for a long time, and aside from automating tasks with shell scripting, some light PHP work, and a few simple C programs, I've never done much in the way of programming. I recently decided to stretch my mind a bit and learn Common Lisp.
I'm half-way through Touretzky's "Gentle Intro" and, havi... | 2009/07/09 | [
"https://Stackoverflow.com/questions/1101487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125958/"
] | Let's assume you have emacs running and have checked out SLIME from
CVS and installed it. This should be easy with any Linux distro; `apt-get install emacs slime` does it for me. (You should also install SBCL, the best Common Lisp implementation.)
SLIME out of the box doesn't do much anymore, so it needs
configuration... | Well, a good place to start would be the [executing lisp](http://www.gnu.org/software/emacs/manual/html_node/emacs/Executing-Lisp.html) section of the *info* pages.
In general, when you work with an interpreted language in Emacs, you edit the source files, and interact with an inferior process (a new process spawned b... |
24,751,679 | I am developing an ADF Fusion Web Application and I want to be able to update and save the changes about entities into my database. Do I always have to drag and drop both Submit and Commit buttons together? I can not unserstand their difference implicitly. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24751679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3246402/"
] | The submit button actually does nothing special, it just does a submit of your form (like in normal HTML). It's the same functionality as every other button (except if you start using the immediate attribute, but not considering this here). The data from your form (or input components) will then be 'saved' in your mode... | User404 is correct. Lets go one step further. A lot of people do not want *separate* submit and commit buttons. [This](https://community.oracle.com/thread/2402124?start=0) may give an example of calling the commit programmatically from the ActionListener event handler of a button. |
1,188,525 | $F=[0,1] \subset \bigcup B\_{r\_j}(x\_j)$ where $\{x\_j\}$ is an arbitrary enumeration of rational numbers in $[0,1]$. $[0,1]$ is compact and thus must have a finite cover. $B\_{r\_j}(x\_j)$ is an open ball around $x\_j$ with radius $r\_j$.
Please show how to "extract" a finite cover from $\bigcup B\_{r\_j}(x\_j)$.
N... | 2015/03/13 | [
"https://math.stackexchange.com/questions/1188525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/100051/"
] | Given a countable covering $\{U\_1, U\_2, \ldots\}$ of a compact space, there is an easy algorithm to find a finite subcover: Check if $\{U\_1\}$ is a cover, then check if $\{U\_1,U\_2\}$ is a cover, and so on. Compactness guarantees that this process will terminate.
It is unlikely that we can do much better than this... | This is a (possibly) more efficient variation on Slade's algorithm elsewhere in this thread.
1. Let $x$ be the smallest point not yet covered; initially $x=0$.
2. Let $S$ be a partial finite subcover, initially $\emptyset$
3. Let $L$ be a list of the open intervals considered so far, initially $\emptyset$
4. Repeat un... |
46,230 | [<<---First clue](https://puzzling.stackexchange.com/questions/37784/i-am-an-expression-of-a-deer-mint-clue-one)
[<---Previous clue](https://puzzling.stackexchange.com/questions/45992/dance-a-jigsaw-clue-fifteen)
---
Inspiration from [here](https://puzzling.stackexchange.com/questions/40018/clue-web-1-lets-start).... | 2016/11/29 | [
"https://puzzling.stackexchange.com/questions/46230",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25966/"
] | Group 1
>
> ***bar (@Aethon)***
>
> **entry** gain, fee, no, point (@Sconibulus)
>
> **salad** tomato, egg, green, fruit (@Sconibulus)
>
> **bell** gong, liberty, Alexander, curve
>
> **dance** floor, ballroom, around, modern
>
>
>
Group 2
>
> ***smith***
>
> **black** white, midnight, cat, pi... | Partial answer
Group 1
>
> gain, fee, no, point
>
> tomato, egg, green, fruit
>
> gong, liberty, Alexander, curve -- BELL
>
> floor, ballroom, around, modern
>
>
>
Group 2 (tmpearce)
>
> white, midnight, cat, pitch -- BLACK
>
> lining, bullet, tongue, sterling -- SILVER
>
> key, horns, ca... |
46,230 | [<<---First clue](https://puzzling.stackexchange.com/questions/37784/i-am-an-expression-of-a-deer-mint-clue-one)
[<---Previous clue](https://puzzling.stackexchange.com/questions/45992/dance-a-jigsaw-clue-fifteen)
---
Inspiration from [here](https://puzzling.stackexchange.com/questions/40018/clue-web-1-lets-start).... | 2016/11/29 | [
"https://puzzling.stackexchange.com/questions/46230",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25966/"
] | Group 1
>
> ***bar (@Aethon)***
>
> **entry** gain, fee, no, point (@Sconibulus)
>
> **salad** tomato, egg, green, fruit (@Sconibulus)
>
> **bell** gong, liberty, Alexander, curve
>
> **dance** floor, ballroom, around, modern
>
>
>
Group 2
>
> ***smith***
>
> **black** white, midnight, cat, pi... | Group 1:
>
> Bar: (@Aethon)
>
> gain, fee, no, point: Entry
>
> tomato, egg, green, fruit: Salad
>
> gong, liberty, Alexander, curve: Bell
>
> floor, ballroom, around, modern: Dance
>
>
>
Group 2:
>
> Smith:
>
> white, midnight, cat, pitch: Black
>
> lining bullet tongue sterling: Silv... |
46,230 | [<<---First clue](https://puzzling.stackexchange.com/questions/37784/i-am-an-expression-of-a-deer-mint-clue-one)
[<---Previous clue](https://puzzling.stackexchange.com/questions/45992/dance-a-jigsaw-clue-fifteen)
---
Inspiration from [here](https://puzzling.stackexchange.com/questions/40018/clue-web-1-lets-start).... | 2016/11/29 | [
"https://puzzling.stackexchange.com/questions/46230",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25966/"
] | Group 1:
>
> Bar: (@Aethon)
>
> gain, fee, no, point: Entry
>
> tomato, egg, green, fruit: Salad
>
> gong, liberty, Alexander, curve: Bell
>
> floor, ballroom, around, modern: Dance
>
>
>
Group 2:
>
> Smith:
>
> white, midnight, cat, pitch: Black
>
> lining bullet tongue sterling: Silv... | Partial answer
Group 1
>
> gain, fee, no, point
>
> tomato, egg, green, fruit
>
> gong, liberty, Alexander, curve -- BELL
>
> floor, ballroom, around, modern
>
>
>
Group 2 (tmpearce)
>
> white, midnight, cat, pitch -- BLACK
>
> lining, bullet, tongue, sterling -- SILVER
>
> key, horns, ca... |
5,133,734 | I am reading some C text at the address:
<https://cs.senecac.on.ca/~lczegel/BTP100/pages/content/compu.html>
In the section: **Addressible Memory** they say that "*The maximum size of addressable primary memory depends upon the size of the address registers.*"
I do not understand why is that.
Can anyone give me a ... | 2011/02/27 | [
"https://Stackoverflow.com/questions/5133734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253656/"
] | If you have 32-bit registers, then the highest address you can store in a single register is 2^32-1, so you can address 2^32 units (in modern computers, units are almost always bytes). A larger number simply won't fit.
You can get around this by using memory addresses that are larger than a single register can hold (a... | If you have 1 address register, holding a 16 bit address, you can have a maximum of 2^16 - 1 addresses.
However many registers, the number of addresses they can point to will be limited by their width (number of bits).
Thus, the maximum size of addressable primary memory depends upon the size of the address registers... |
5,133,734 | I am reading some C text at the address:
<https://cs.senecac.on.ca/~lczegel/BTP100/pages/content/compu.html>
In the section: **Addressible Memory** they say that "*The maximum size of addressable primary memory depends upon the size of the address registers.*"
I do not understand why is that.
Can anyone give me a ... | 2011/02/27 | [
"https://Stackoverflow.com/questions/5133734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253656/"
] | If you have 32-bit registers, then the highest address you can store in a single register is 2^32-1, so you can address 2^32 units (in modern computers, units are almost always bytes). A larger number simply won't fit.
You can get around this by using memory addresses that are larger than a single register can hold (a... | Keeping it simple: the address registers are used to store and refer to addresses of memory; since their size and number is fixed, there is a *maximum address*.
Obviously you can't exploit more memory than what is addressable (because the machine wouldn't know how to refer to it), so the usable memory is in fact limit... |
2,009,836 | There are many chameleons in the zoo. Before breakfast some of them
were red and all the others were blue. After breakfast, half of the red chameleons
became blue. After dinner, half of all chameleons which were blue at that time
became red, bringing the total number of red chameleons to the before-breakfast
level. Wha... | 2016/11/11 | [
"https://math.stackexchange.com/questions/2009836",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/327825/"
] | HINT: Say that there are $n$ chameleons, of which $r$ were red before breakfast. After breakfast there were $\frac{r}2$ red chameleons and $n-\frac{r}2$ blue chameleons. After dinner
$$\frac12\left(n-\frac{r}2\right)=\frac{n}2-\frac{r}4$$
blue chameleons turned red, bringing the total number of red chameleons to
$$... | If you call $x$ and $y$ the proportions of red and blue chameleons before breakfast, then after breakfast, those proportions are
$$\left(\frac x2,y+\frac x2\right)$$
After dinner, they become
$$\left(\frac x2+\frac{y+\frac x2}{2},\frac{y+\frac x2}{2}\right)$$
So you have to solve
$$\frac x2+\frac{y+\frac x2}{2}=x$$
whi... |
43,049,769 | How to convert non-numbers in `DataFrame` to `NaN (numpy)`? For example, here is a `DataFrame`:
```
a b
--------
10 ...
4 5
... 6
```
How to covert it to:
```
a b
--------
10 NaN
4 5
NaN 6
``` | 2017/03/27 | [
"https://Stackoverflow.com/questions/43049769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7104926/"
] | IIUC you can just do
```
df = df.apply(lambda x: pd.to_numeric(x, errors='coerce') )
```
This will force the duff values to `NaN`, note that the presence of `NaN` will change the dtype to `float` as `NaN` cannot be represented by `int`
```
In [6]:
df = df.apply(pd.to_numeric, errors='coerce')
df
Out[6]:
a ... | You can can also `stack` then `unstack` the dataframe
```
pd.to_numeric(df.stack(), errors='coerce').unstack()
a b
0 10.0 NaN
1 4.0 5.0
2 NaN 6.0
``` |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | Both are quite difference.
Basically you are using [Multiple Selector (“selector1, selector2, selectorN”)](http://api.jquery.com/multiple-selector/) in the following line. So its simple
```
$('#full-sized-content, #full-sized-area')
```
Where as in line you are using context based selector, Here you are selecting ... | Your code:
```
var $fullContent = $('#full-sized-content', $fullArea);
```
it says find me `#full-sized-content` in `$fullArea`, because of the `,`. `,` makes a context for this.
---
This code:
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
is usually called a **muliple selector selectio... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | There is a difference,
**[Demo : Multiple selector](http://jsfiddle.net/93k2t/)**
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
Selects both the elements - **[Multiple selector](http://api.jquery.com/multiple-selector/)**: `$('#elem1,#elem2,...')`
---
**[Demo: Parent-child](http://jsfiddl... | Your code:
```
var $fullContent = $('#full-sized-content', $fullArea);
```
it says find me `#full-sized-content` in `$fullArea`, because of the `,`. `,` makes a context for this.
---
This code:
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
is usually called a **muliple selector selectio... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | Both are diffent here..
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
This one select element which has id "full-sized-content" under the #full-sized-area element
```
$(function() {
var $fullArea = $('#full-sized-area');
var... | Your code:
```
var $fullContent = $('#full-sized-content', $fullArea);
```
it says find me `#full-sized-content` in `$fullArea`, because of the `,`. `,` makes a context for this.
---
This code:
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
is usually called a **muliple selector selectio... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | ```
var $fullContent = $('#full-sized-content', $fullArea);
```
The above actually a context based selector. So, what is does in simple manner is:-
```
$fullArea // get the fullArea element
.find('#full-sized-content') // find all the descendants with this id inside it
```
While th... | Your code:
```
var $fullContent = $('#full-sized-content', $fullArea);
```
it says find me `#full-sized-content` in `$fullArea`, because of the `,`. `,` makes a context for this.
---
This code:
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
is usually called a **muliple selector selectio... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | Both are quite difference.
Basically you are using [Multiple Selector (“selector1, selector2, selectorN”)](http://api.jquery.com/multiple-selector/) in the following line. So its simple
```
$('#full-sized-content, #full-sized-area')
```
Where as in line you are using context based selector, Here you are selecting ... | Both are diffent here..
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
This one select element which has id "full-sized-content" under the #full-sized-area element
```
$(function() {
var $fullArea = $('#full-sized-area');
var... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | Both are quite difference.
Basically you are using [Multiple Selector (“selector1, selector2, selectorN”)](http://api.jquery.com/multiple-selector/) in the following line. So its simple
```
$('#full-sized-content, #full-sized-area')
```
Where as in line you are using context based selector, Here you are selecting ... | ```
var $fullContent = $('#full-sized-content', $fullArea);
```
The above actually a context based selector. So, what is does in simple manner is:-
```
$fullArea // get the fullArea element
.find('#full-sized-content') // find all the descendants with this id inside it
```
While th... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | There is a difference,
**[Demo : Multiple selector](http://jsfiddle.net/93k2t/)**
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
Selects both the elements - **[Multiple selector](http://api.jquery.com/multiple-selector/)**: `$('#elem1,#elem2,...')`
---
**[Demo: Parent-child](http://jsfiddl... | Both are diffent here..
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
This one select element which has id "full-sized-content" under the #full-sized-area element
```
$(function() {
var $fullArea = $('#full-sized-area');
var... |
24,284,458 | I know this isn't a code issue related question, but it's something I'd love to know and it may help others:
What's the difference between using this:
```
$(function() {
var $fullArea = $('#full-sized-area');
var $fullContent = $('#full-sized-content', $fullArea);
});
```
Over say this:
```
$(function() {
... | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421990/"
] | There is a difference,
**[Demo : Multiple selector](http://jsfiddle.net/93k2t/)**
```
var $fullContent = $('#full-sized-content, #full-sized-area');
```
Selects both the elements - **[Multiple selector](http://api.jquery.com/multiple-selector/)**: `$('#elem1,#elem2,...')`
---
**[Demo: Parent-child](http://jsfiddl... | ```
var $fullContent = $('#full-sized-content', $fullArea);
```
The above actually a context based selector. So, what is does in simple manner is:-
```
$fullArea // get the fullArea element
.find('#full-sized-content') // find all the descendants with this id inside it
```
While th... |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | Private members are just that - private. Only the class they belong to can access them. If you want to be able to retrieve their values, you need to either make them protected (and thus available to parent and children classes) or public (available to all classes). Another option is to write some getters, functions tha... | Those items are only accessible by the object itself. You will have to modify the code for that class and provide an accessor method, or change their scope.
<http://www.php.net/manual/en/language.oop5.properties.php> |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | Those items are only accessible by the object itself. You will have to modify the code for that class and provide an accessor method, or change their scope.
<http://www.php.net/manual/en/language.oop5.properties.php> | you should see first object oriented php <http://www.google.sk/url?sa=t&rct=j&q=object%20oriented%20php&source=web&cd=6&ved=0CGQQFjAF&url=http%3A%2F%2Ftalks.somabo.de%2F200703_montreal_oop.pdf&ei=k3EUT8HnGYHHswbi09A6&usg=AFQjCNEjsA2JgbGQfxnQ26XxTtFuHmvGIA&sig2=Vw4d7aD2GhulZYAM892EKA> |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | Private members are just that - private. Only the class they belong to can access them. If you want to be able to retrieve their values, you need to either make them protected (and thus available to parent and children classes) or public (available to all classes). Another option is to write some getters, functions tha... | You will need accessor method on each object in order to access the values. Since they are private they can only be accessed within each of the classes they belong. |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | You will need accessor method on each object in order to access the values. Since they are private they can only be accessed within each of the classes they belong. | you should see first object oriented php <http://www.google.sk/url?sa=t&rct=j&q=object%20oriented%20php&source=web&cd=6&ved=0CGQQFjAF&url=http%3A%2F%2Ftalks.somabo.de%2F200703_montreal_oop.pdf&ei=k3EUT8HnGYHHswbi09A6&usg=AFQjCNEjsA2JgbGQfxnQ26XxTtFuHmvGIA&sig2=Vw4d7aD2GhulZYAM892EKA> |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | Private members are just that - private. Only the class they belong to can access them. If you want to be able to retrieve their values, you need to either make them protected (and thus available to parent and children classes) or public (available to all classes). Another option is to write some getters, functions tha... | you should see first object oriented php <http://www.google.sk/url?sa=t&rct=j&q=object%20oriented%20php&source=web&cd=6&ved=0CGQQFjAF&url=http%3A%2F%2Ftalks.somabo.de%2F200703_montreal_oop.pdf&ei=k3EUT8HnGYHHswbi09A6&usg=AFQjCNEjsA2JgbGQfxnQ26XxTtFuHmvGIA&sig2=Vw4d7aD2GhulZYAM892EKA> |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | Private members are just that - private. Only the class they belong to can access them. If you want to be able to retrieve their values, you need to either make them protected (and thus available to parent and children classes) or public (available to all classes). Another option is to write some getters, functions tha... | The private properties just can be accessed from inside the object itself. To access try to use `$this->propertyName` |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | Private members are just that - private. Only the class they belong to can access them. If you want to be able to retrieve their values, you need to either make them protected (and thus available to parent and children classes) or public (available to all classes). Another option is to write some getters, functions tha... | This answer is for the scenario of trying to get around an imposed private data restriction, for instance if you are by chance working with a library which you don't have access to change the privilege level of the class member, then there is a work around. Presuming the object is serializable/unserializable then consi... |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | The private properties just can be accessed from inside the object itself. To access try to use `$this->propertyName` | you should see first object oriented php <http://www.google.sk/url?sa=t&rct=j&q=object%20oriented%20php&source=web&cd=6&ved=0CGQQFjAF&url=http%3A%2F%2Ftalks.somabo.de%2F200703_montreal_oop.pdf&ei=k3EUT8HnGYHHswbi09A6&usg=AFQjCNEjsA2JgbGQfxnQ26XxTtFuHmvGIA&sig2=Vw4d7aD2GhulZYAM892EKA> |
8,884,782 | EDIT: Thanks everyone. I didn't even notice it was private lol, so I changed them from private to public, now it should be accessible... question now is how can I access the value of say 'backpackPosition'? thanks again!
```
TF2Inventory Object
(
[fetchDate] => 123456123
[items] => Array
(
[60] => TF2Item ... | 2012/01/16 | [
"https://Stackoverflow.com/questions/8884782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152472/"
] | This answer is for the scenario of trying to get around an imposed private data restriction, for instance if you are by chance working with a library which you don't have access to change the privilege level of the class member, then there is a work around. Presuming the object is serializable/unserializable then consi... | you should see first object oriented php <http://www.google.sk/url?sa=t&rct=j&q=object%20oriented%20php&source=web&cd=6&ved=0CGQQFjAF&url=http%3A%2F%2Ftalks.somabo.de%2F200703_montreal_oop.pdf&ei=k3EUT8HnGYHHswbi09A6&usg=AFQjCNEjsA2JgbGQfxnQ26XxTtFuHmvGIA&sig2=Vw4d7aD2GhulZYAM892EKA> |
4,267,022 | I'm using an NSXMLParser to read data out of a XML, but how can I make my iPhone App storing data into this specific XML.
The case is that I want to create an app to display available dates and one that administrates this dates, whether they are available or not (I'm using an UISwitch to handle this).
Thanks for your... | 2010/11/24 | [
"https://Stackoverflow.com/questions/4267022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518801/"
] | If you have small amount of data, you can save them in a plist.
See [Property List Programming Guide](http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html#//apple_ref/doc/uid/10000048i) | There's a github project that let's you create XML DOM objects. You can save your XML to your documents folder on the phone.
<https://github.com/arashpayan/apxml/> |
39,178,480 | I want to set radio button checked by default in Log in activity as user log in at that time active button sets checked automatically and when user goes to setting activity and then changes the radio button selection at that time it saves the choice of button as user select in setting activity .
**Code:**
```
radioGr... | 2016/08/27 | [
"https://Stackoverflow.com/questions/39178480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6197659/"
] | You can use `SharedPreference` to store the value of the `CheckBox` and then load it again when `activity` is relaunched.
```
SharedPreferences preferences = getSharedPreferences("checkBox",MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("Active",active.isChecked(... | use SharedPreference to store checked as default value |
70,382,264 | I want the item to be replaced with an another item when the overridden function fires.
```java
@Override
public ActionResultType itemInteractionForEntity(ItemStack stack, PlayerEntity playerIn, LivingEntity target, Hand hand) {
if (!playerIn.world.isRemote()) {
// Replace an item with xyz... | 2021/12/16 | [
"https://Stackoverflow.com/questions/70382264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12229438/"
] | * Have you called the function yet?
* Don't use `list` as a name of the variable
* Update the function to return `True` only when all elements have a perfect square.
code:
```
num_list = [4, 9, 16]
def check_is_quadratic(x):
result = []
for i in x:
if math.sqrt(i).is_integer():
result.appen... | You are:
1. Not calling your function or printing anything
2. Using the global variable `list` inside your fucntion instead of the passed value
3. Using the reserved word `list` as a variable name, which is bad practice
4. Using return statement inside the if-else block here will give you only True/False once. What yo... |
63,162,645 | I am total newbie to Python. I am writing my first Python class this week to run Locust.io load test on our API.
I have setup the code below.
```
import random
from locust import HttpUser, SequentialTaskSet, task, between
from datetime import datetime
class CredentialLoadTest(SequentialTaskSet):
@task
def po... | 2020/07/29 | [
"https://Stackoverflow.com/questions/63162645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12476755/"
] | So I still could not get the sequential task set to work properly. So I kind of "hacked" a solution that is working for me. I basically created one task as my starting point and then it calls my other "tasks" which are just normal Python functions.
This is working perfectly for me, its running each of my API operations... | I see that you have executed locust with more than one user
`2 users at the rate 2 users/s`
So I assume that we see in your output prints from two parallel users.
It works in this way because task sequences are running in different threads. |
67,989,554 | Could someone tell me how to pass the output of one CURL GET to another CURL POST? I mean something like this:
```
curl --header "Content-Type: application/json" --request POST --data "{\"specification\": curl --header "Content-Type: application/json" --request GET "https://user:pass@anotherhost"}" "https://user:pass@... | 2021/06/15 | [
"https://Stackoverflow.com/questions/67989554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6825845/"
] | We can use a group by operation in `dplyr` i.e. grouped by 'ID', extract the 'code' where the 'type' value is "large" (assuming there are no duplicate values for 'type' within each 'ID'
```
library(dplyr)
df <- df %>%
group_by(ID) %>%
mutate(code2 = code[type == 'large']) %>%
ungroup
```
-output
```
df
# ... | A `data.table` option
```
> setDT(df)[, code2 := code[type == "large"], ID][]
ID type code code2
1: A1 small B9 [0,20]
2: A1 large [0,20] [0,20]
3: A2 small B9 [20,40]
4: A2 large [20,40] [20,40]
5: A3 large [0,20] [0,20]
6: A4 small B9 [40,60]
7: A4 large [40,60] [40,60]
``` |
1,986,902 | ```
/**
*
*/
package ORM;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* @author Gwilym
* @version 0.0
*/
public class DatabaseConnection {
private String userName="";
private String password="";
private String host="";
Connection conn;
/**
* @param use... | 2009/12/31 | [
"https://Stackoverflow.com/questions/1986902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/183749/"
] | This is a wrapped exception. What's the **root cause** of this exception? Look further in the stacktrace.
A very common root cause is `java.net.ConnectException: Connection refused`. I've seen this in almost 99% of the cases. If this is true in your case as well, then all the possible causes are:
1. IP address or ho... | In addition to the last post you should also do a low-level telnet test, this is the best way to verify connectivity. This test will tell you if there is a firewall or other software blocking access to that port.
telnet tel2.dur.ac.uk 3306 |
144,922 | I very much prefer caret for its parameter tuning ability and uniform interface, but I have observed that it always requires complete datasets (i. e. without NAs) even if the applied "naked" model allows NAs. That is very bothersome, regarding that one should apply laborous imputation methods, which are not necessary i... | 2015/04/05 | [
"https://stats.stackexchange.com/questions/144922",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/72735/"
] | To the train function in caret, you can pass the parameter na.action = na.pass, and no preprocessing (do not specify preProcess, leave it as its default value NULL). This will pass the NA values unmodified directly to the prediction function (this will cause prediction functions that do not support missing values to fa... | Have you tried recoding the NAs? Something >3 standard deviations outside your data (e.g. -12345) should encourage C5.0 to predict them separately, like it does with NAs. |
144,922 | I very much prefer caret for its parameter tuning ability and uniform interface, but I have observed that it always requires complete datasets (i. e. without NAs) even if the applied "naked" model allows NAs. That is very bothersome, regarding that one should apply laborous imputation methods, which are not necessary i... | 2015/04/05 | [
"https://stats.stackexchange.com/questions/144922",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/72735/"
] | To the train function in caret, you can pass the parameter na.action = na.pass, and no preprocessing (do not specify preProcess, leave it as its default value NULL). This will pass the NA values unmodified directly to the prediction function (this will cause prediction functions that do not support missing values to fa... | I think your solution would be to impute the values while using the *predict()* function.
See `?predict.train` for more details.
You can use `na.omit` to allow caret to impute values. For example:
```
## S3 method for class 'train':
predict((object, newdata = NULL, type = "raw", na.action = na.omit, ...)
``... |
14,563,058 | I were looking for a CSS Framework to help me built website, when I struck with *Compass*.
Now, while I understand what a CSS Framework is, I don't understand what's a CSS **Authoring** Framework.
Expecially, I don't understand if it "replaces" a CSS Framework (like blueprint) or you should use it **with** a CSS Fram... | 2013/01/28 | [
"https://Stackoverflow.com/questions/14563058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/312907/"
] | A CSS Framework is (in most cases) a fixed set of basic CSS definitions.
f.e. it brings definitions for some classes which make a basic div-based HTML-layout usable for different screen-widths. (aka liquid layout)
A CSS Authoring Framework (in meaning of Compass) brings no fixed set of CSS definitions. In opposite to ... | CSS frameworks are pre-prepared libraries that are meant to allow for easier, more standards-compliant styling of web pages using the Cascading Style Sheets language.
Layout-grid-related CSS frameworks include Bootstrap, Blueprint, 960 grid, YUI CSS, and other grids.
Like programming and scripting language libraries,... |
34,560,441 | Hello I am trying to implement Canonical huffman encoding but i dont understand wiki and google guides,
I need explain more abstractly...
I tried this:
1. Get list of regular huffman encoding length's codes. like this:
```
A - code: 110, length: 3.
B - code: 111, length: 3.
C - code: 10, length 2.
D - code: 01, lengt... | 2016/01/01 | [
"https://Stackoverflow.com/questions/34560441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5711723/"
] | Throw out the codes you get from the Huffman algorithm. You don't need those. Just keep the lengths.
Now assign the codes based on the lengths and the symbols. Sort by length, from shortest to longest, and within each length, sort the symbols in ascending order. (How you do that exactly doesn't matter, so long as ever... | You should sort symbols by there frequency, so most often would be on top and least often would be on bottom. (Overall frequency - 1):
```
A (0.5)
B (0.2)
C (0.15)
D (0.15)
```
Then mark one symbol with `0` and other with `1`, summ there frequencies and insert into proper position in list and again mark two least wi... |
34,609,329 | I'm currently developing an authentication app based on OpenId Connect and Chrome CustomTabs. During the authentication flow, the user is sent to a redirection URL and I'm encountering some issues here.
In my app I have have the following intent-filter :
```
<intent-filter>
<action android:name="android.intent.ac... | 2016/01/05 | [
"https://Stackoverflow.com/questions/34609329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3187128/"
] | Here's the solution I found: I had to use the escape character "\" to use the & character with ADB.
>
> $ adb shell am start "<http://www.example.com?param1=1>\¶m2=2"
>
>
> | Use Url Encoding as i can see there is a space after "&" occurrence which is causing this issue !! |
268,397 | We are looking for an open-source or low cost virtual machine management control panel. We require it to be able to manage up to dozens of hypervisors and thousands of virtual machines. It should be either Xen or KVM, and have an API to hook into, to create, delete, modify virtual machines. Also, it should be able to p... | 2011/05/10 | [
"https://serverfault.com/questions/268397",
"https://serverfault.com",
"https://serverfault.com/users/65061/"
] | You probably want [libvirt](http://www.libvirt.org/).
Supports Xen, KVM, Virtualbox, VMWare, etc. Has a stable API, multiple language bindings.
I've never written anything that uses libvirt, but I use the libvirt virtual machine manager (GUI); and virsh (CLI), which can be scripted. | Have you checked [RHEV](http://www.redhat.com/virtualization/rhev/) out? |
268,397 | We are looking for an open-source or low cost virtual machine management control panel. We require it to be able to manage up to dozens of hypervisors and thousands of virtual machines. It should be either Xen or KVM, and have an API to hook into, to create, delete, modify virtual machines. Also, it should be able to p... | 2011/05/10 | [
"https://serverfault.com/questions/268397",
"https://serverfault.com",
"https://serverfault.com/users/65061/"
] | It's not the most capable, but if you're looking for a GUI with quick and dirty viewing and monitoring you can go with [virt-manager](http://virt-manager.et.redhat.com) from a gnome desktop. It's a redhat-sponsored project but is available in the Ubuntu desktop repos through aptitude/synaptic/whatever as well.
We use... | Have you checked [RHEV](http://www.redhat.com/virtualization/rhev/) out? |
268,397 | We are looking for an open-source or low cost virtual machine management control panel. We require it to be able to manage up to dozens of hypervisors and thousands of virtual machines. It should be either Xen or KVM, and have an API to hook into, to create, delete, modify virtual machines. Also, it should be able to p... | 2011/05/10 | [
"https://serverfault.com/questions/268397",
"https://serverfault.com",
"https://serverfault.com/users/65061/"
] | Another option is [ConVirt Open Source](http://www.convirture.com/products_opensource.php). | Have you checked [RHEV](http://www.redhat.com/virtualization/rhev/) out? |
64,133,839 | I've tried all the ways but somehow I can't install java 11.
Showing my previous version of java
I did following steps:
**STEP 1:** I Installed : `jdk-11.0.8_linux-x64_bin.deb` file from Oracle website.
**STEP 2:** Run this command : `sudo dpkg -i jdk-11.0.8_linux-x64_bin.deb`
**STEP 3:** `sudo get update`
**STEP ... | 2020/09/30 | [
"https://Stackoverflow.com/questions/64133839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11616106/"
] | Just do this after installing,
```
sudo nano /etc/environment
JAVA_HOME="/usr/lib/jvm/jdk-11.0.8"
```
Note that, `/bin` is not to be included. Save and exit. Then,
```
source /etc/environment
```
Btw, why complicate a normal installation? | You can probably install java 11 by the following command
```
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install openjdk-11-jdk
```
You can refer this [link](https://stackoverflow.com/questions/52504825/how-to-install-jdk-11-under-ubuntu) to see how to install openjdk 11 on ubu... |
52,236 | Do any gliders come with a ground proximity warning system (GPWS)? I realise that, for a glider, a GPWS probably wouldn't be able to help quite as much as in a powered aircraft, since a glider, by definition, doesn't have any engines which it can apply TOGA power on (unless, of course, it's a motorglider), but it could... | 2018/06/03 | [
"https://aviation.stackexchange.com/questions/52236",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/22726/"
] | GPWS is mostly useful for aircraft flying in instrument conditions or at night when there is low visibility preventing a good view of the ground. Gliders [aren't designed to fly in these conditions](https://aviation.stackexchange.com/q/26808/1696) and they don't have the required instruments. They should be able to see... | I found [this video of a glider equipped with GPWS](https://www.youtube.com/watch?v=sDVCrcs7y8U), however, I doubt that such a system is very useful in glider, that isn't very complex and would consider it a gimmick.
Also because the sounds in the video are Boeing GPWS sounds, so it's probably self-built for fun.
So... |
52,236 | Do any gliders come with a ground proximity warning system (GPWS)? I realise that, for a glider, a GPWS probably wouldn't be able to help quite as much as in a powered aircraft, since a glider, by definition, doesn't have any engines which it can apply TOGA power on (unless, of course, it's a motorglider), but it could... | 2018/06/03 | [
"https://aviation.stackexchange.com/questions/52236",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/22726/"
] | Many glider pilots have a GPS flight computer that usually has terrain loaded in its database and can alert a glider pilot of terrain. This is not quite a GPWS but is cheaper and uses a lot less power (glider pilots rely on batteries for their electrical system). Most GA aircraft don't have a GPWS either and usually re... | I found [this video of a glider equipped with GPWS](https://www.youtube.com/watch?v=sDVCrcs7y8U), however, I doubt that such a system is very useful in glider, that isn't very complex and would consider it a gimmick.
Also because the sounds in the video are Boeing GPWS sounds, so it's probably self-built for fun.
So... |
52,236 | Do any gliders come with a ground proximity warning system (GPWS)? I realise that, for a glider, a GPWS probably wouldn't be able to help quite as much as in a powered aircraft, since a glider, by definition, doesn't have any engines which it can apply TOGA power on (unless, of course, it's a motorglider), but it could... | 2018/06/03 | [
"https://aviation.stackexchange.com/questions/52236",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/22726/"
] | I found [this video of a glider equipped with GPWS](https://www.youtube.com/watch?v=sDVCrcs7y8U), however, I doubt that such a system is very useful in glider, that isn't very complex and would consider it a gimmick.
Also because the sounds in the video are Boeing GPWS sounds, so it's probably self-built for fun.
So... | A glider will be usually flown according to VFR. So it is basically the task of the pilot to maintain adeqaute distance to terrain. The distance can be rather low, flying in mountains. As already mentioned, current onboard flight computers include terrain databases, that will provide you with AGL. Software like [XCSoar... |
52,236 | Do any gliders come with a ground proximity warning system (GPWS)? I realise that, for a glider, a GPWS probably wouldn't be able to help quite as much as in a powered aircraft, since a glider, by definition, doesn't have any engines which it can apply TOGA power on (unless, of course, it's a motorglider), but it could... | 2018/06/03 | [
"https://aviation.stackexchange.com/questions/52236",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/22726/"
] | GPWS is mostly useful for aircraft flying in instrument conditions or at night when there is low visibility preventing a good view of the ground. Gliders [aren't designed to fly in these conditions](https://aviation.stackexchange.com/q/26808/1696) and they don't have the required instruments. They should be able to see... | A glider will be usually flown according to VFR. So it is basically the task of the pilot to maintain adeqaute distance to terrain. The distance can be rather low, flying in mountains. As already mentioned, current onboard flight computers include terrain databases, that will provide you with AGL. Software like [XCSoar... |
52,236 | Do any gliders come with a ground proximity warning system (GPWS)? I realise that, for a glider, a GPWS probably wouldn't be able to help quite as much as in a powered aircraft, since a glider, by definition, doesn't have any engines which it can apply TOGA power on (unless, of course, it's a motorglider), but it could... | 2018/06/03 | [
"https://aviation.stackexchange.com/questions/52236",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/22726/"
] | Many glider pilots have a GPS flight computer that usually has terrain loaded in its database and can alert a glider pilot of terrain. This is not quite a GPWS but is cheaper and uses a lot less power (glider pilots rely on batteries for their electrical system). Most GA aircraft don't have a GPWS either and usually re... | A glider will be usually flown according to VFR. So it is basically the task of the pilot to maintain adeqaute distance to terrain. The distance can be rather low, flying in mountains. As already mentioned, current onboard flight computers include terrain databases, that will provide you with AGL. Software like [XCSoar... |
5,841,172 | I have the following code but I don't understand how I can reset the pointer to the starter position:
```
BufferedReader inp=new BufferedReader(new FileReader(file));
Scanner leggi=new Scanner(inp);
for(int i=0;i<nwords;i++){
while(leggi.hasNext())
if(leggi.next().equals(args[i+2]))
occorrenze[i]=occorre... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5841172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/465359/"
] | Paul,
I suggest you read through this old thread: [Java BufferedReader back to the top of a text file?](https://stackoverflow.com/q/262618/69224).
Personally I prefer Jon Skeet's response, which boils down to "Don't bother [unless you MUST]."
Cheers. Keith.
---
**EDIT:** Also you should ALLWAYS close that input fi... | You have two options:
* reset the FileReader (`FieldReader.reset`) instead and create a new bufferedreader.
* use mark functionaliy (try `BufferedReader.markSupported`)
I think what you tried is to call mark after you read the input. Instead do the following:
```
inp.mark(readAheadLimit);
// .... all your code p... |
5,841,172 | I have the following code but I don't understand how I can reset the pointer to the starter position:
```
BufferedReader inp=new BufferedReader(new FileReader(file));
Scanner leggi=new Scanner(inp);
for(int i=0;i<nwords;i++){
while(leggi.hasNext())
if(leggi.next().equals(args[i+2]))
occorrenze[i]=occorre... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5841172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/465359/"
] | Paul,
I suggest you read through this old thread: [Java BufferedReader back to the top of a text file?](https://stackoverflow.com/q/262618/69224).
Personally I prefer Jon Skeet's response, which boils down to "Don't bother [unless you MUST]."
Cheers. Keith.
---
**EDIT:** Also you should ALLWAYS close that input fi... | [`mark(int readAheadLimit)`](http://download.oracle.com/javase/6/docs/api/java/io/BufferedReader.html#mark%28int%29) takes a `readAheadLimit` parameter.
You should not set the `readAheadLimit` to 0. Try using a meaningful number that is larger than number of bytes you read in an iteration. |
72,116,761 | I have multiple service classes `ServiceTest1`, `ServiceTest2`, `SeviceTest3`
I have a factory class `UserFactory`, which creates a new `User` instance on every request
UserFactory has a method `createUser()` which gets called for every request
Currently, `createUser` looks something like this
```
public User creat... | 2022/05/04 | [
"https://Stackoverflow.com/questions/72116761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5829906/"
] | `Option`s [can be compared directly](https://doc.rust-lang.org/std/option/enum.Option.html#impl-Eq), so you can [simply return `a == b`](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=993156749b137711b81e7256a2538ba4). | Actually, if `T: PartialEq`, `Option<T>: PartialEq` and if `T: Eq`, `Option<T>: Eq`. See this example ([Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=53daa36619dbdf5fe977c91dbf894b42)):
```rust
fn main() {
assert_eq!(Some(3), Some(3));
assert_ne!(Some(3), None);
assert... |
48,999,606 | I'm trying to use NAudio to record 8 seconds of streaming audio, store it in `System.IO.MemoryStream`, and then play it back right after. To do this, I'm running the following code:
```
using System.IO;
using NAudio.Wave;
public class AudioCapture{
static WaveFileWriter wri;
static bool stopped = false;
... | 2018/02/27 | [
"https://Stackoverflow.com/questions/48999606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8026600/"
] | `WaveFileWriter` is (unfortunately) designed in a way that it *always* disposes stream it writes to when you dispose `WaveFileWriter`. It could have accepted some flag to control this behavior, but it does not. So if you need to use that stream later you need to either not dispose `WaveFileWriter` too early, or clone t... | There is no need to use `WaveFileReader` or `WaveFileWriter` in this scenario. Just write the audio received to the `MemoryStream` as it arrives:
```
static void waveIn_DataAvailable(object sender, WaveInEventArgs e){
if (sos != null) sos.Write(e.Buffer, 0, e.BytesRecorded);
}
```
And then when you've finished a... |
3,683 | I'm looking for examples of designs where there is special logic that prevents a title, heading, or landmark from being moved out of view, so that the user doesn't lose their context.
Examples:
* Excel's "Freeze top row"
* iOS UITableView (notice the "A" subheading floats)
 — selected table rows stick to the top of the window. | <http://corp.ign.com/> has a nice "sticky" top menu.
Also, check out the [floating sidebar on uxmag](http://uxmag.com/strategy/etrades-digital-customer-experience). |
3,683 | I'm looking for examples of designs where there is special logic that prevents a title, heading, or landmark from being moved out of view, so that the user doesn't lose their context.
Examples:
* Excel's "Freeze top row"
* iOS UITableView (notice the "A" subheading floats)
 — selected table rows stick to the top of the window. | **Gmail Application for Android**
The Gmail application for Android has these type of headers when viewing an email. The header changes as you scroll down based on what actions you can do with the message you are viewing (e.g. reply, forward, star). |
3,683 | I'm looking for examples of designs where there is special logic that prevents a title, heading, or landmark from being moved out of view, so that the user doesn't lose their context.
Examples:
* Excel's "Freeze top row"
* iOS UITableView (notice the "A" subheading floats)
 — selected table rows stick to the top of the window. | Themed tables in **Drupal 7 and 6**, e.g. the list of modules page.

Internally, this is thanks to the [theme\_table](http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_table/7) function which has a boolean option `$sticky`, so any p... |
13,377,887 | I have the following code which seems to work fine in all browsers except IE8 and below.
```
$("table.availability").each( function() {
var siteName = $(this).parent().siblings("h2").contents().filter(function() { return this.nodeType == Node.TEXT_NODE; }).text()
alert(sitename);
});
```
It gets the content ... | 2012/11/14 | [
"https://Stackoverflow.com/questions/13377887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/457148/"
] | The `TEXT_NODE` constant has a [value of 3](http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247). You can just use that:
```
return this.nodeType === 3;
```
Older versions of IE just don't implement the `Node` interface, but they do still follow the DOM spec and assign the correct `nodeType` property value... | I'm guessing that you're structure is something like this:
```
<h2>
text to filter
<span>other text</span>
</h2>
```
And you're trying to filter out the "other text" inside h2?
If so - why not add another tag wrapper around the text that you need, e.g.
```
<h2>
<span class="text-to-filter">text to filte... |
13,377,887 | I have the following code which seems to work fine in all browsers except IE8 and below.
```
$("table.availability").each( function() {
var siteName = $(this).parent().siblings("h2").contents().filter(function() { return this.nodeType == Node.TEXT_NODE; }).text()
alert(sitename);
});
```
It gets the content ... | 2012/11/14 | [
"https://Stackoverflow.com/questions/13377887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/457148/"
] | The `TEXT_NODE` constant has a [value of 3](http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247). You can just use that:
```
return this.nodeType === 3;
```
Older versions of IE just don't implement the `Node` interface, but they do still follow the DOM spec and assign the correct `nodeType` property value... | For IE8 and below version node does not work, changing `node` to `window` worked for me. |
13,377,887 | I have the following code which seems to work fine in all browsers except IE8 and below.
```
$("table.availability").each( function() {
var siteName = $(this).parent().siblings("h2").contents().filter(function() { return this.nodeType == Node.TEXT_NODE; }).text()
alert(sitename);
});
```
It gets the content ... | 2012/11/14 | [
"https://Stackoverflow.com/questions/13377887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/457148/"
] | For IE8 and below version node does not work, changing `node` to `window` worked for me. | I'm guessing that you're structure is something like this:
```
<h2>
text to filter
<span>other text</span>
</h2>
```
And you're trying to filter out the "other text" inside h2?
If so - why not add another tag wrapper around the text that you need, e.g.
```
<h2>
<span class="text-to-filter">text to filte... |
17,156,761 | Why am I getting a segmentation fault in the following code?
```
struct Cell
{
cellMode mode;
bool visited;
//bool scanned;
int rowIndex;
int colIndex;
Cell *neighbours;//if using Cell neighbours[3] i am getting a compilation error
Cell()
{
... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17156761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248266/"
] | You wrote an infinitely recursive function. Your `Cell::Cell` constructor indirectly calls itself thorough `new` expression, which in turn calls `Cell::Cell` again, again and again... This eventually leads to stack overflow and crash.
(Also, it is not possible to have an explicit array of `Cell` objects inside a `Cell... | If you `new` 3 `Cell`s in `Cell`'s constructor you are calling 3 more `Cell`'s constructors. Each of those 3 then calls 3 more, and so on. Until, a... wait for it... stack overflow. Hurrah. It's infinite. |
17,156,761 | Why am I getting a segmentation fault in the following code?
```
struct Cell
{
cellMode mode;
bool visited;
//bool scanned;
int rowIndex;
int colIndex;
Cell *neighbours;//if using Cell neighbours[3] i am getting a compilation error
Cell()
{
... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17156761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248266/"
] | If you `new` 3 `Cell`s in `Cell`'s constructor you are calling 3 more `Cell`'s constructors. Each of those 3 then calls 3 more, and so on. Until, a... wait for it... stack overflow. Hurrah. It's infinite. | Since the constructor is calling itself three times per instance, you are basically creating an infinite loop due to never-ending recursion. That's where your problem is. |
17,156,761 | Why am I getting a segmentation fault in the following code?
```
struct Cell
{
cellMode mode;
bool visited;
//bool scanned;
int rowIndex;
int colIndex;
Cell *neighbours;//if using Cell neighbours[3] i am getting a compilation error
Cell()
{
... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17156761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248266/"
] | You wrote an infinitely recursive function. Your `Cell::Cell` constructor indirectly calls itself thorough `new` expression, which in turn calls `Cell::Cell` again, again and again... This eventually leads to stack overflow and crash.
(Also, it is not possible to have an explicit array of `Cell` objects inside a `Cell... | Since the constructor is calling itself three times per instance, you are basically creating an infinite loop due to never-ending recursion. That's where your problem is. |
55,812,246 | I make a list program using Ionic 4 and I try to update the list using `BehaviorSubject` from **rxjs**. The list available to update during `ngOnInit()`, but the list won't update on `add()` callback.
I try to log the output and the subscribe method works (when I click add, the subscribe called), but Ionic UI won't up... | 2019/04/23 | [
"https://Stackoverflow.com/questions/55812246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11399779/"
] | Try to put this code on the constructor method:
```
import {Subscription} from 'rxjs';
subscription: Subscription; // this is a local variable
..........
this.devices.list();
this.subscription = this.devices.devices.subscribe( devices => {
this.data = devices;
console.log("this.data",this.data); /... | Try changing your `data = []` array to an array with predefined properties `name` and `id`. For example you could create:
```
export class Example {
nama: string;
id: string;
}
```
And then do:
```
data: Example [];
``` |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | I guess so far the best way is to put your debug output into alternate destinations:
In Launch Configuration Attributes the `console` setting can be set to one of the following: `internalConsole` (default, the builtin Debug Console) `externalTerminal` (external cmd window) or `integratedTerminal` (the VS Code terminal... | My Setup, coloured steps:
I think the main attribute to the colour here is `--format=node_modules/cucumber-pretty`
```
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=8... |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | See @ <https://stackoverflow.com/a/55493884/3645650> for lore and roleplay.
Here is just a no brain answer.
| | Versions |
| --- | --- |
| Tested up to | Visual Studio Code May 2021 (version `1.63`) |
### Text
```
console.log( "\u001b[1;31m Red message" );
console.log( "\u001b[1;32m Green message" );
console.log( ... | Adding the `--colors` argument worked for me. (I'm using jest).
```
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"args": ["--colors"],
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
"... |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | My Setup, coloured steps:
I think the main attribute to the colour here is `--format=node_modules/cucumber-pretty`
```
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=8... | Here's a little utility I wrote based on the answers here (and some googling):
```js
export const colored_console = {
/**
* @param color red | green | yellow | blue | purple | cyan | red_bg | green_bg | blue_bg | purple_bg | cyan_bg | yellow_bg | white_bg
* @param args things you want to log
*/
log: funct... |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | See @ <https://stackoverflow.com/a/55493884/3645650> for lore and roleplay.
Here is just a no brain answer.
| | Versions |
| --- | --- |
| Tested up to | Visual Studio Code May 2021 (version `1.63`) |
### Text
```
console.log( "\u001b[1;31m Red message" );
console.log( "\u001b[1;32m Green message" );
console.log( ... | Here's a little utility I wrote based on the answers here (and some googling):
```js
export const colored_console = {
/**
* @param color red | green | yellow | blue | purple | cyan | red_bg | green_bg | blue_bg | purple_bg | cyan_bg | yellow_bg | white_bg
* @param args things you want to log
*/
log: funct... |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | I guess so far the best way is to put your debug output into alternate destinations:
In Launch Configuration Attributes the `console` setting can be set to one of the following: `internalConsole` (default, the builtin Debug Console) `externalTerminal` (external cmd window) or `integratedTerminal` (the VS Code terminal... | ```
console.log("\u001b[1;32m" + 'This is your message!!!' + "\u001b[0m"); //Green message with escape
console.log("\u001b[1;31m" + 'This is your message!!!' + "\u001b[0m"); //Red message with escape
``` |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | I guess so far the best way is to put your debug output into alternate destinations:
In Launch Configuration Attributes the `console` setting can be set to one of the following: `internalConsole` (default, the builtin Debug Console) `externalTerminal` (external cmd window) or `integratedTerminal` (the VS Code terminal... | Here's a little utility I wrote based on the answers here (and some googling):
```js
export const colored_console = {
/**
* @param color red | green | yellow | blue | purple | cyan | red_bg | green_bg | blue_bg | purple_bg | cyan_bg | yellow_bg | white_bg
* @param args things you want to log
*/
log: funct... |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | I guess so far the best way is to put your debug output into alternate destinations:
In Launch Configuration Attributes the `console` setting can be set to one of the following: `internalConsole` (default, the builtin Debug Console) `externalTerminal` (external cmd window) or `integratedTerminal` (the VS Code terminal... | Adding the `--colors` argument worked for me. (I'm using jest).
```
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"args": ["--colors"],
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
"... |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | v1.45 is adding a bunch of debug theme colors, see <https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_45.md#new-debug-theme-colors>
`debugView.exceptionLabelForeground`: Foreground color for a label shown in the CALL STACK view when the debugger breaks on an exception
* `debugView.exceptionLabelBac... | Try using "colors" package from npm. It is very easy to use and you can use features like bold and underline as well. Here is the url for it's documentation:- <https://www.npmjs.com/package/colors> |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | To output coloured messages from nodejs in visual studio you can use formatted message in console.log method. for example :
```
console.log('\u001b[' + 32 + 'm' + 'hello stack' + '\u001b[0m')
```
as implemented in [Mocha](https://github.com/mochajs/). 32 is a color code. Other color codes and usage sample you can f... | Really quick and dirty for Java console from a Java noob:
```
private static void debugLog(String msg) {
if (msg.indexOf("Exception") > -1) {
System.out.println("\u001b[31m" + msg + "\u001b[0m");
} else {
System.out.println("\u001b[32m" + msg + "\u001b[0m");
}
}
``` |
43,528,123 | Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code? | 2017/04/20 | [
"https://Stackoverflow.com/questions/43528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186850/"
] | To output coloured messages from nodejs in visual studio you can use formatted message in console.log method. for example :
```
console.log('\u001b[' + 32 + 'm' + 'hello stack' + '\u001b[0m')
```
as implemented in [Mocha](https://github.com/mochajs/). 32 is a color code. Other color codes and usage sample you can f... | Click on Settings Icon on bottom left of Visual Studio
[](https://i.stack.imgur.com/DfNNo.png)
Click on Settings
[](https://i.stack.imgur.com/8nESn.png)
Search for `workbench` and under ... |
44,484,231 | I have a large dict: 600 keys with items = big list (about 10000-20000 elements).
My goal is to get pairs from each list in dict and merge it in one list.
E.g. i have:
```
d1 = {'key1': ['a', 'b', 'c', 'd'], 'key2': ['f', 'a']}
```
Expected result:
```
d2 = ['a_b', 'a_c', 'a_d', 'b_c', 'b_d', 'c_d', 'a_f']
```... | 2017/06/11 | [
"https://Stackoverflow.com/questions/44484231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7576900/"
] | What you describe is **not a `product`, but `combinations`**.
Furthermore **if memory is an issue, you better use a generator** so:
```
**from itertools import combinations**
def dic_comb_generator(d1):
for **v** in d1.**values()**:
for t in **combinations(sorted(v),2)**:
yield "%s_%s"%t
```
... | You could do something like this:
```
import itertools as it
for l in d1.values():
for t in it.combinations(sorted(l), 2):
print("_".join(t))
```
Displaying:
```
a_b
a_c
a_d
b_c
b_d
c_d
a_f
```
Note: If you do not want it to be sorted, simply take out the `sorted` function call. |
44,484,231 | I have a large dict: 600 keys with items = big list (about 10000-20000 elements).
My goal is to get pairs from each list in dict and merge it in one list.
E.g. i have:
```
d1 = {'key1': ['a', 'b', 'c', 'd'], 'key2': ['f', 'a']}
```
Expected result:
```
d2 = ['a_b', 'a_c', 'a_d', 'b_c', 'b_d', 'c_d', 'a_f']
```... | 2017/06/11 | [
"https://Stackoverflow.com/questions/44484231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7576900/"
] | What you describe is **not a `product`, but `combinations`**.
Furthermore **if memory is an issue, you better use a generator** so:
```
**from itertools import combinations**
def dic_comb_generator(d1):
for **v** in d1.**values()**:
for t in **combinations(sorted(v),2)**:
yield "%s_%s"%t
```
... | You could create a generator that doesn't involve `itertools`:
```
def dic_comb_generator(d):
for val in d.values():
v = sorted(val)
for i in range(len(v)):
for j in range(i+1, len(v)):
yield v[i] + '_' + v[j]
``` |
44,484,231 | I have a large dict: 600 keys with items = big list (about 10000-20000 elements).
My goal is to get pairs from each list in dict and merge it in one list.
E.g. i have:
```
d1 = {'key1': ['a', 'b', 'c', 'd'], 'key2': ['f', 'a']}
```
Expected result:
```
d2 = ['a_b', 'a_c', 'a_d', 'b_c', 'b_d', 'c_d', 'a_f']
```... | 2017/06/11 | [
"https://Stackoverflow.com/questions/44484231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7576900/"
] | You could do something like this:
```
import itertools as it
for l in d1.values():
for t in it.combinations(sorted(l), 2):
print("_".join(t))
```
Displaying:
```
a_b
a_c
a_d
b_c
b_d
c_d
a_f
```
Note: If you do not want it to be sorted, simply take out the `sorted` function call. | You could create a generator that doesn't involve `itertools`:
```
def dic_comb_generator(d):
for val in d.values():
v = sorted(val)
for i in range(len(v)):
for j in range(i+1, len(v)):
yield v[i] + '_' + v[j]
``` |
33,523,116 | I am very confused with this . can any one clear me why it was not allowing the code that i have placed n comments
```
package pack1;
public class A {
protected void m1() {
System.out.println("This is very imp point");
}
package pack2;
import pack1.A;
class B extends A {
public static void main(String arg[])... | 2015/11/04 | [
"https://Stackoverflow.com/questions/33523116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5524869/"
] | Method `m1` is `protected`, so it's accessible across packages to child classes.
Therefore, instances of `B` will be able to invoke or `@Override` `m1`.
Not so `main` `static` methods, even if pertaining to class `B`: the scope is different.
You can either make `m1` public in `A`, or invoke it within your instanc... | You can access the protected members declared in `A` within `B`, but only for instances of `B` or subclasses of `B`. Check out this [answer](https://stackoverflow.com/questions/18573016/understanding-javas-protected-modifier) |
16,903,440 | In this tiny sample app, why is `index-b.js` executing before `index-c.js`?
Since `index-c` is a dependency of `index-a`, and `index-a` is a set to load before `index-b`, it seems to me that `index-c` should execute first.
```
/* index.js */
define([ "./index-a", "./index-b" ], function(){
console.log("index ... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16903440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/720486/"
] | The order of the modules in your define() call in index.js does not imply any synchronous dependencies, so index-a is not really "set to load" before index-b. Your define() call in index.js is simply stating that the code in the callback function is dependent on index-a and index-b. If index-b is dependent on index-a, ... | Try including the dependencies in `shim` property of your config
```
'indexC': {
deps: ['index-a']
},
```
This makes sure `index-a` is loaded before loading `index-c`
```
requirejs.config({
baseUrl: "lib/",
paths: {
'jquery' : "vendor/jquery-2.0.2.min",
'in... |
50,590 | Considering upgrade of CMS to latest version- the process may take anywhere from 2 to 4 weeks.
May suggest - we need to work on live server, what we have planned:
* take exact replica of site and move to a test domain, but on live server
* Block Google, Bing, Yahoo - `User-agent: Google Disallow: /`, `User-agent: Bin... | 2013/07/10 | [
"https://webmasters.stackexchange.com/questions/50590",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/23721/"
] | You *must* make sure that this site is unavailable to search engines. The best way to do this is to put the entire dev site behind a login mechanism. [Basic Authentication](http://en.wikipedia.org/wiki/Basic_access_authentication) is the simplest and most effective way to do this. It makes it impossible for search engi... | You are describing a [staging site](http://en.wikipedia.org/wiki/Staging_site). As you suggest, you will replicate the site and its production environment locally and to a staging site for development and testing.
Also, as you have mentioned, you may restrict access to the staging site by filtering by UserAgent and a... |
50,590 | Considering upgrade of CMS to latest version- the process may take anywhere from 2 to 4 weeks.
May suggest - we need to work on live server, what we have planned:
* take exact replica of site and move to a test domain, but on live server
* Block Google, Bing, Yahoo - `User-agent: Google Disallow: /`, `User-agent: Bin... | 2013/07/10 | [
"https://webmasters.stackexchange.com/questions/50590",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/23721/"
] | You *must* make sure that this site is unavailable to search engines. The best way to do this is to put the entire dev site behind a login mechanism. [Basic Authentication](http://en.wikipedia.org/wiki/Basic_access_authentication) is the simplest and most effective way to do this. It makes it impossible for search engi... | John is correct about adding authentication. One alternative is to restrict the site to specific IPs (e.g. the IP of your office), and serve a 404 or 403 error to others.
Also, with regards to robots.txt, you should block *all* bots, which is much simpler:
```
User-agent: *
Disallow: /
```
Even if you only block vi... |
50,722,479 | I have a MySQL table with
Field A, Field B, Field C and Field D.
I would like to run a query that says IF "Field C" has the word "dog" then "Field A" will be copied to "Field B".
I can get "Field A" to copy over to "Field B" but I need it only to copy when "Field C" has the word "dog".
Hope the above makes sense. I... | 2018/06/06 | [
"https://Stackoverflow.com/questions/50722479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7211544/"
] | There are a couple of problems with your code:
1. You're using comma when binding multiple event handlers to the input box.
2. You're not converting the received value to a number before applying `toLocaleString` on it.
3. You're not setting the value of the textbox again after conversion.
Correcting these, here is a... | Parse value to specific Locale Currency
=======================================
The below function will try to parse any *gibberish* input value to a specific currency.
Useful if you don't want to force users to input values in a specific locale format.
**Caveat:**
Since the input can literally be gibberish like ... |
64,260,716 | I have a JSON file that I'd like to "overwrite" with data from another JSON, but keep anything that isn't changed. Is there a way to do this out of the box for Azure DevOps pipeline releases? There is a Config transform plugin thingy for it named [magic-chunks](https://github.com/sergeyzwezdin/magic-chunks), but its sy... | 2020/10/08 | [
"https://Stackoverflow.com/questions/64260716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5338928/"
] | >
> Overwrite JSON in TFS releases
>
>
>
As I know there's no such task from extensions that can be used to `Overwrite+Add node` at the same time.
One alternative way is to use [PS script to modify the Json content](https://stackoverflow.com/questions/37551366/update-json-file-using-powershell) like what **Krzysz... | This is an X/Y problem. You can specify multiple configuration files for a .NET Core application -- i.e. `appsettings.json` which contains general values and `appsettings.dev.json` that contains environment-specific overrides. Refer to the documentation on configuration. |
12,567 | I'm trying to set up a [Rules](https://www.drupal.org/project/rules) Action that can change the value of a field. I created an Action Set with a data type of Node. When I go to create a Rules Action, I have access to every default Drupal node field, but no fields.
Is this simply not possible? Do I need some other modu... | 2011/10/05 | [
"https://drupal.stackexchange.com/questions/12567",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/1693/"
] | You first need to add a condition to check if the field exist on that node, only then it is available to the actions. There is a specific condition to do this. | Using the "Entity has field" (or "content is of type") condition will make the fields become available with data selection in the Action "Set a data value". |
12,567 | I'm trying to set up a [Rules](https://www.drupal.org/project/rules) Action that can change the value of a field. I created an Action Set with a data type of Node. When I go to create a Rules Action, I have access to every default Drupal node field, but no fields.
Is this simply not possible? Do I need some other modu... | 2011/10/05 | [
"https://drupal.stackexchange.com/questions/12567",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/1693/"
] | You first need to add a condition to check if the field exist on that node, only then it is available to the actions. There is a specific condition to do this. | Not to contradict both prior answers, but IMO they are both missing (ignoring?) a crucial part of the question, which is "***...I created an Action Set...***". True, part of the solution is, pretty sure, "`Entity has field`" (as in the answer from [jcarballo](https://drupal.stackexchange.com/users/28406/jcarballo)). Bu... |
12,567 | I'm trying to set up a [Rules](https://www.drupal.org/project/rules) Action that can change the value of a field. I created an Action Set with a data type of Node. When I go to create a Rules Action, I have access to every default Drupal node field, but no fields.
Is this simply not possible? Do I need some other modu... | 2011/10/05 | [
"https://drupal.stackexchange.com/questions/12567",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/1693/"
] | Using the "Entity has field" (or "content is of type") condition will make the fields become available with data selection in the Action "Set a data value". | Not to contradict both prior answers, but IMO they are both missing (ignoring?) a crucial part of the question, which is "***...I created an Action Set...***". True, part of the solution is, pretty sure, "`Entity has field`" (as in the answer from [jcarballo](https://drupal.stackexchange.com/users/28406/jcarballo)). Bu... |
45,828,361 | Hey everyone so I'm pretty new when it comes to Jquery & javascript & i'm working with some code left over from a previous developer. I need the values that show in each dropdown menu to be dependent on the one above it, and only the correct values to show for each option. I've looked around and have found information ... | 2017/08/22 | [
"https://Stackoverflow.com/questions/45828361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8502913/"
] | Install all the optional tools for c++ development
then follow these steps ( Microsoft has updated its visual studio and there are some minor changes)
The new updated changed some things. Win32 Console Application is gone in the new update. Go to File -> New Project -> Visual C++ -> Windows Desktop -> [Windows Deskt... | You just need to install "Visual Studio C++ core features". Don't install everything about C++. It consumes too much storage and possibly slow down your IDE.
Steps:
* Open Visual Studio 2017 Installer.
* Select "Individual Components" tab.
* Select "Visual Studio C++ core features".
That's all.
If you are not int... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | I think the following is a little bit cleaner:
```
<input type="radio" name="geckoHatchling" value="1" @if(old('geckoHatchling')) checked @endif>
<input type="radio" name="geckoHatchling" value="0" @if(!old('geckoHatchling')) checked @endif>
```
`@if` is checking the truthiness of the old value and outputting `chec... | You can use `Form-helper`, but it doesn't come out of the box with Laravel. You should install it manually. [Please read the docs.](http://laravelcollective.com/docs/5.0/html)
**WITH FORM-HELPER**
**1. Blade**
```
{!! Form::radio('geckoHatchling', '1', (Input::old('geckoHatchling') == '1'), array('id'=>'geckoHatchli... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | You can use `Form-helper`, but it doesn't come out of the box with Laravel. You should install it manually. [Please read the docs.](http://laravelcollective.com/docs/5.0/html)
**WITH FORM-HELPER**
**1. Blade**
```
{!! Form::radio('geckoHatchling', '1', (Input::old('geckoHatchling') == '1'), array('id'=>'geckoHatchli... | I have tried the accepted answer's solution, it doesn't work for me,
I had to use this `{{}}` curly braces (which is blade template's echo) in order to use the conditional statement.
```
<input type="radio" name="geckoHatchling" id="geckoHatchlingYes" value="1" {{(old('geckoHatchling') == '1') ? 'checked' : ''}}>
`... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | You can use `Form-helper`, but it doesn't come out of the box with Laravel. You should install it manually. [Please read the docs.](http://laravelcollective.com/docs/5.0/html)
**WITH FORM-HELPER**
**1. Blade**
```
{!! Form::radio('geckoHatchling', '1', (Input::old('geckoHatchling') == '1'), array('id'=>'geckoHatchli... | I have stumbled across what I believe will be to be a more accurate and comprehensive answer to this question. The problem with the main answer provided is the last radio button will always be selected moving forward. However, I have provided a code example below to show how to resolve this issue. (PS - this works in L... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | You can use `Form-helper`, but it doesn't come out of the box with Laravel. You should install it manually. [Please read the docs.](http://laravelcollective.com/docs/5.0/html)
**WITH FORM-HELPER**
**1. Blade**
```
{!! Form::radio('geckoHatchling', '1', (Input::old('geckoHatchling') == '1'), array('id'=>'geckoHatchli... | befor Laravel 9
---------------
```
<input type"radio" name="active" value="1" {{old('active',user->active))?'checked',''}}/>
<input type"radio" name="active" value="0" {{old('active',user->active))?'','checked'}}/>
```
Laravel 9
---------
```
<input type"radio" name="active" value="1" @checked(old('active',$user->... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | I think the following is a little bit cleaner:
```
<input type="radio" name="geckoHatchling" value="1" @if(old('geckoHatchling')) checked @endif>
<input type="radio" name="geckoHatchling" value="0" @if(!old('geckoHatchling')) checked @endif>
```
`@if` is checking the truthiness of the old value and outputting `chec... | I have tried the accepted answer's solution, it doesn't work for me,
I had to use this `{{}}` curly braces (which is blade template's echo) in order to use the conditional statement.
```
<input type="radio" name="geckoHatchling" id="geckoHatchlingYes" value="1" {{(old('geckoHatchling') == '1') ? 'checked' : ''}}>
`... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | I think the following is a little bit cleaner:
```
<input type="radio" name="geckoHatchling" value="1" @if(old('geckoHatchling')) checked @endif>
<input type="radio" name="geckoHatchling" value="0" @if(!old('geckoHatchling')) checked @endif>
```
`@if` is checking the truthiness of the old value and outputting `chec... | I have stumbled across what I believe will be to be a more accurate and comprehensive answer to this question. The problem with the main answer provided is the last radio button will always be selected moving forward. However, I have provided a code example below to show how to resolve this issue. (PS - this works in L... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | I think the following is a little bit cleaner:
```
<input type="radio" name="geckoHatchling" value="1" @if(old('geckoHatchling')) checked @endif>
<input type="radio" name="geckoHatchling" value="0" @if(!old('geckoHatchling')) checked @endif>
```
`@if` is checking the truthiness of the old value and outputting `chec... | befor Laravel 9
---------------
```
<input type"radio" name="active" value="1" {{old('active',user->active))?'checked',''}}/>
<input type"radio" name="active" value="0" {{old('active',user->active))?'','checked'}}/>
```
Laravel 9
---------
```
<input type"radio" name="active" value="1" @checked(old('active',$user->... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | I have tried the accepted answer's solution, it doesn't work for me,
I had to use this `{{}}` curly braces (which is blade template's echo) in order to use the conditional statement.
```
<input type="radio" name="geckoHatchling" id="geckoHatchlingYes" value="1" {{(old('geckoHatchling') == '1') ? 'checked' : ''}}>
`... | I have stumbled across what I believe will be to be a more accurate and comprehensive answer to this question. The problem with the main answer provided is the last radio button will always be selected moving forward. However, I have provided a code example below to show how to resolve this issue. (PS - this works in L... |
33,141,057 | This is my `employeeshift.js` code and I can't figure out how to do a PHP code in a JavaScript file
This is my code inside the `employeeshift.js` but my `var inorno` is null
```
$(document).ready(function(){
var inorno= "<?php echo json_encode($inOrOut ); ?>";
if(inorno=="0"){
$('.Sales1').hide();
}else{
$('.Sal... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33141057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4260021/"
] | I have tried the accepted answer's solution, it doesn't work for me,
I had to use this `{{}}` curly braces (which is blade template's echo) in order to use the conditional statement.
```
<input type="radio" name="geckoHatchling" id="geckoHatchlingYes" value="1" {{(old('geckoHatchling') == '1') ? 'checked' : ''}}>
`... | befor Laravel 9
---------------
```
<input type"radio" name="active" value="1" {{old('active',user->active))?'checked',''}}/>
<input type"radio" name="active" value="0" {{old('active',user->active))?'','checked'}}/>
```
Laravel 9
---------
```
<input type"radio" name="active" value="1" @checked(old('active',$user->... |
46,790,176 | i know how to get Angles with atan2 between 2 Points in 2D, but how does this work in 3D?:
lets say i have 3 Points A,B,C (all are SCNVector3 with x,y,z coordinates
First Line Endpoints A and B
2nd Line Endpoints B and C
Now i want to get the angle between the 2 Lines... (in ios Swift)
I read something about the dot pr... | 2017/10/17 | [
"https://Stackoverflow.com/questions/46790176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319626/"
] | the [dot product](https://en.wikipedia.org/wiki/Dot_product#Geometric_definition) takes the norm (magnitude) of the vectors into account. Make sure you deal with unit vectors, or divide by the product of their norms.
```
import SceneKit
import simd
var vector1 = float3((pointArray[i].x - pointArray[i+1].x), (pointArr... | so for getting the direction i do now (thanks mnuages for the hint):
```
var vectorn = cross(normalize(vector1), normalize(vector2))
if (vectorn.y > 0) { //righ hand side }
else { //left hand side}
``` |
13,344,625 | * I have the path of an executable file (`C:\Test\n4.TestConsole.exe`).
* `File.Exists(path)` returns `true`.
* `File.OpenRead(path)` gets me its stream with no problem.
* `Process.Start(path)` throws a `System.ComponentModel.Win32Exception` with this message:
>
> The system cannot find the file specified.
>
> What... | 2012/11/12 | [
"https://Stackoverflow.com/questions/13344625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/704144/"
] | It's probably a missing DLL or other dependency. You might like to compare the PATH environment variable when you run it directly via `Process.Start(exe_path)` and when you run it via `Process.Start("cmd", "/k " + exe_path)`. | Try this:
```
private void button1_Click(object sender, EventArgs e)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.WorkingDirectory = @"C:\Test";
psi.FileName = "n4.TestConsole.exe";
Process.Start(psi);
}
``` |
32,271,553 | I'm importing CSV file in MySQL database with ColdFusion, my code works fine but I have one issue. I want to ignore double quotes around the words. So my csv looks like this: "John","Mark","Peter" . Every time after I insert CSV in database I'm getting double quotes around my words. Is there any command in ColdFusion t... | 2015/08/28 | [
"https://Stackoverflow.com/questions/32271553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3023588/"
] | You can use `cfhttp` to read a CSV file into a cfquery object. For example:
my.csv file contents:
```
"forename","surname","id"
"fred","blogs",1000
"jim","smith",2000
```
You can then read it in like so:
```
<cfhttp url="http://scratch.localhost/my.csv" method="get" name="mydata">
<cfdump var="#mydata#">
```
myd... | Well you can replace the double quotes by using the conveniently-named & imminently guessable [`replace()`](https://wikidocs.adobe.com/wiki/display/coldfusionen/Replace) function. However... you might not want to get rid of all of them. Double-quote string delimiters are how CSV deals with data values with embedded com... |
32,271,553 | I'm importing CSV file in MySQL database with ColdFusion, my code works fine but I have one issue. I want to ignore double quotes around the words. So my csv looks like this: "John","Mark","Peter" . Every time after I insert CSV in database I'm getting double quotes around my words. Is there any command in ColdFusion t... | 2015/08/28 | [
"https://Stackoverflow.com/questions/32271553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3023588/"
] | Loop over the fields and do something along these lines:
```
<cfset field = reReplace(field, '^"', '')>
<cfset field = reReplace(field, '"$', '')>
<cfset field = replace(field, '\"', '"', 'ALL')>
```
This will remove the surrounding quotes and unescape quotes within the field. | Well you can replace the double quotes by using the conveniently-named & imminently guessable [`replace()`](https://wikidocs.adobe.com/wiki/display/coldfusionen/Replace) function. However... you might not want to get rid of all of them. Double-quote string delimiters are how CSV deals with data values with embedded com... |
32,271,553 | I'm importing CSV file in MySQL database with ColdFusion, my code works fine but I have one issue. I want to ignore double quotes around the words. So my csv looks like this: "John","Mark","Peter" . Every time after I insert CSV in database I'm getting double quotes around my words. Is there any command in ColdFusion t... | 2015/08/28 | [
"https://Stackoverflow.com/questions/32271553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3023588/"
] | You can use `cfhttp` to read a CSV file into a cfquery object. For example:
my.csv file contents:
```
"forename","surname","id"
"fred","blogs",1000
"jim","smith",2000
```
You can then read it in like so:
```
<cfhttp url="http://scratch.localhost/my.csv" method="get" name="mydata">
<cfdump var="#mydata#">
```
myd... | Loop over the fields and do something along these lines:
```
<cfset field = reReplace(field, '^"', '')>
<cfset field = reReplace(field, '"$', '')>
<cfset field = replace(field, '\"', '"', 'ALL')>
```
This will remove the surrounding quotes and unescape quotes within the field. |
32,496,746 | I have to manually select the item from the dropdownlist that is in the datagridview column, but the issue is while selecting the item i need to click on the dropdownlist multiple times.
How to resolve this? Any help will be highly appreciated.
```
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cm... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32496746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4600820/"
] | You have to use
```
host.RunAndBlock();
```
instead of
```
host.Call(typeof(BankLineFileProcessorWebJob).GetMethod("ProcessQueueMessage"));
``` | Also, please take out the NoAutomaticTrigger attribute. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.