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 |
|---|---|---|---|---|---|
45,835,422 | I have the following code:
```
def getContentComponents: Action[AnyContent] = Action.async {
contentComponentDTO.list().map(contentComponentsFuture =>
contentComponentsFuture.foreach(contentComponentFuture =>
contentComponentFuture.typeOf match {
case 5 =>
... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45835422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4367019/"
] | You could try using the SIM Card in a normal 3G USB Dongle and an application called "[Gammu](https://wammu.eu/docs/manual/gammu/)" which can answer a call and sendDTMF codes i.e. number presses. I have only used Gammu on linux systems but I believe it works on Windows as well. | Another possible solution:
1. Setup voicemail for that SIM card, and when you are asked to leave your voicemail message (the message which is played to whoever gets to the voicemail) just press the button #3.
2. When you want, use call forwarding to redirect all calls to the voicemail. Alternatively, turn off the pho... |
69,981,157 | I have a text in flexbox item `.learn--text` which needs to be vertically centered, but `word-break: break-word` rule doesn't work.
This is the current state
[](https://i.stack.imgur.com/tgQ3I.png)
and desired state
[![enter image description here]... | 2021/11/15 | [
"https://Stackoverflow.com/questions/69981157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/968379/"
] | Erase all the flex settings from `learn--text` - they "divide" its content into two parts, the link and the following text, treating them as flex items and therefore units. If you erase that, the result is as follows:
```css
.learn {
display: flex;
flex: 0 0 50px;
margin-top: auto;
align-items: center;
heigh... | This, is the answer:
```css
.learn {
display: flex;
flex: 0 0 70px;
margin-top: auto;
align-items: center;
height: 70px;
border: 1px solid black;
width: 250px;
}
.learn--icon {
display: flex;
align-items: center;
justify-content: center;
padding: 0 6px;
}
.learn--text {
display: inl... |
43,241,784 | I'm struggling with achieving following goal: I have the API requests typed in a manner that they return either a desired value, or an error when the status code wasn't indicating success, or when the auth token has been invalid etc: `Either String r`.
Now, I don't want to care about it when I'm `eval`ing my component... | 2017/04/05 | [
"https://Stackoverflow.com/questions/43241784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590347/"
] | You have an exceptional case where the current thread can't continue, so the only thing to do would be to throw an exception in `Aff` using `throwError :: forall eff a. Error -> Aff eff a`. | I came to conclusion that what I wanted to achieve was undesirable in fact. Making components query evaluation oblivious to the fact that an error have happened is nothing good (in the light that component might not be interested in handling the error fully, but at least doing something with its state to not end up bro... |
35,362,301 | I want to order list1 based on the strings in list2. Any elements in list1 that don't correspond to list2 should be placed at the end of the correctly ordered list1.
For example:
```
list1 = ['Title1-Apples', 'Title1-Oranges', 'Title1-Pear', 'Title1-Bananas']
list2 = ['Bananas', 'Oranges', 'Pear']
list1_reordered_co... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35362301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5851615/"
] | Here's an idea:
```
>>> def keyfun(word, wordorder):
... try:
... return wordorder.index(word)
... except ValueError:
... return len(wordorder)
...
>>> sorted(list1, key=lambda x: keyfun(x.split('-')[1], list2))
['Title1-Bananas', 'Title1-Oranges', 'Title1-Pear', 'Title1-Apples']
```
To make... | This answer is conceptual rather than efficient.
```
st1dict = dict((t.split('-')[1],t) for t in st1) #keys->titles
list2titles = list(st1dict[k] for k in list2) #ordered titles
extras = list(t for t in st1 if t not in list2titles) #extra titles
print(list2titles+extras) #the desired answer
``` |
35,362,301 | I want to order list1 based on the strings in list2. Any elements in list1 that don't correspond to list2 should be placed at the end of the correctly ordered list1.
For example:
```
list1 = ['Title1-Apples', 'Title1-Oranges', 'Title1-Pear', 'Title1-Bananas']
list2 = ['Bananas', 'Oranges', 'Pear']
list1_reordered_co... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35362301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5851615/"
] | Here's an idea:
```
>>> def keyfun(word, wordorder):
... try:
... return wordorder.index(word)
... except ValueError:
... return len(wordorder)
...
>>> sorted(list1, key=lambda x: keyfun(x.split('-')[1], list2))
['Title1-Bananas', 'Title1-Oranges', 'Title1-Pear', 'Title1-Apples']
```
To make... | One liner.
```
sorted_list = sorted(list1, key=lambda x: list2.index(x.split('-')[1]) if x.split('-')[1] in list2 else len(list2) + 1)
``` |
35,362,301 | I want to order list1 based on the strings in list2. Any elements in list1 that don't correspond to list2 should be placed at the end of the correctly ordered list1.
For example:
```
list1 = ['Title1-Apples', 'Title1-Oranges', 'Title1-Pear', 'Title1-Bananas']
list2 = ['Bananas', 'Oranges', 'Pear']
list1_reordered_co... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35362301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5851615/"
] | Here's an idea:
```
>>> def keyfun(word, wordorder):
... try:
... return wordorder.index(word)
... except ValueError:
... return len(wordorder)
...
>>> sorted(list1, key=lambda x: keyfun(x.split('-')[1], list2))
['Title1-Bananas', 'Title1-Oranges', 'Title1-Pear', 'Title1-Apples']
```
To make... | Use code below to achieve desired sorting:
```
list1 = ['Title1-Apples', 'Title1-Oranges', 'Title1-Pear', 'Title1-Bananas']
list2 = ['Bananas', 'Pear']
# note: converting to set would improve performance of further look up
list2 = set(list2)
def convert_key(item):
return int(not item.split('-')[1] in list2)
pri... |
35,362,301 | I want to order list1 based on the strings in list2. Any elements in list1 that don't correspond to list2 should be placed at the end of the correctly ordered list1.
For example:
```
list1 = ['Title1-Apples', 'Title1-Oranges', 'Title1-Pear', 'Title1-Bananas']
list2 = ['Bananas', 'Oranges', 'Pear']
list1_reordered_co... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35362301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5851615/"
] | Here's an idea:
```
>>> def keyfun(word, wordorder):
... try:
... return wordorder.index(word)
... except ValueError:
... return len(wordorder)
...
>>> sorted(list1, key=lambda x: keyfun(x.split('-')[1], list2))
['Title1-Bananas', 'Title1-Oranges', 'Title1-Pear', 'Title1-Apples']
```
To make... | something like this would get you going on this.
```
l = ['Title1-Apples', 'Title1-Oranges', 'Title1-Pear', 'Title1-Bananas']
l2 = ['Bananas', 'Oranges', 'Pear']
l3 = []
for elem_sub in l2:
for elem_super in l:
if elem_sub in elem_super:
l3.append(elem_super)
print(l3 + list(set(l)-set(l3)))
... |
61,421,408 | I want to implement a profile popup like Books app on iOS. Do you know any package or something to make this? Thank a lot.
GIF below shows the behavior that I want to implement:
<https://gph.is/g/EvAxvVw> | 2020/04/25 | [
"https://Stackoverflow.com/questions/61421408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10398593/"
] | Use `in`: This will be simpler
```sh
if a in ('A', 'U'):
#do something
```
Understanding your code.
```sh
if (a == ("A" or "U")):
# do something
```
Python checks for `"A" or "U"` which `"A"` is return because of how truthfulness works. If the first is true, then the `or` is not evaluated. Since only emp... | It's not related to python. You can't further simplify the 2nd equation.
a == "A" is one boolean -> x
a == "U" is one boolean -> y
x || y -> simplified version.
Also, you can't apply distributive law to equality Operators(==, <, >).
You can use the membership operator `in` check achieve above.
```
if a in ["A"... |
61,421,408 | I want to implement a profile popup like Books app on iOS. Do you know any package or something to make this? Thank a lot.
GIF below shows the behavior that I want to implement:
<https://gph.is/g/EvAxvVw> | 2020/04/25 | [
"https://Stackoverflow.com/questions/61421408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10398593/"
] | **You can't check both the conditions using `(a == ("A" or "U"))`** because when you execute `"A" or "U"` in python interpreter you will get `"A"` (the first truthy value) similarly when you execute `"A" and "U"` you will get `"U"` (the last truthy value).
If you want simplified expression, you can use,
```
if a in (... | Use `in`: This will be simpler
```sh
if a in ('A', 'U'):
#do something
```
Understanding your code.
```sh
if (a == ("A" or "U")):
# do something
```
Python checks for `"A" or "U"` which `"A"` is return because of how truthfulness works. If the first is true, then the `or` is not evaluated. Since only emp... |
61,421,408 | I want to implement a profile popup like Books app on iOS. Do you know any package or something to make this? Thank a lot.
GIF below shows the behavior that I want to implement:
<https://gph.is/g/EvAxvVw> | 2020/04/25 | [
"https://Stackoverflow.com/questions/61421408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10398593/"
] | **You can't check both the conditions using `(a == ("A" or "U"))`** because when you execute `"A" or "U"` in python interpreter you will get `"A"` (the first truthy value) similarly when you execute `"A" and "U"` you will get `"U"` (the last truthy value).
If you want simplified expression, you can use,
```
if a in (... | It's not related to python. You can't further simplify the 2nd equation.
a == "A" is one boolean -> x
a == "U" is one boolean -> y
x || y -> simplified version.
Also, you can't apply distributive law to equality Operators(==, <, >).
You can use the membership operator `in` check achieve above.
```
if a in ["A"... |
41,887,434 | I have a data file ( users.dat) with entries like:
```
user1
user2
user4
user1
user2
user1
user4
...
user3
user2
```
which command I should ( grep? wc?) use to count how many times each word repeats and output it to user\_total.dat like this:
```
user1 80
user2 35
user3 18
user4 120
```
the issue is that I cannot... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41887434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3741790/"
] | Use the `uniq` command to count the repetitions of a line. It requires the input to be sorted, so use `sort` first.
```
sort users.dat | uniq -c > user_total.dat
``` | ```
sort <users.dat | uniq -c > user_total.dat
```
If you want it further in order of occurance pass it through sort a 2nd time using some form the -n argument (read man page on that).
(on edit: bah... didn't realize how dumb the system rendered that bit of code) |
25,259,336 | I am using this url to download the magento. I registered and login but nothing happening. Every time on download it shows me login popup.
```
http://www.magentocommerce.com/download
```
Please help to let me know if i am doing something wrong. | 2014/08/12 | [
"https://Stackoverflow.com/questions/25259336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1918324/"
] | The problem is apparently a local browser issue as I was able to log in, go to the downloads page, choose and be presented with the download popup.
If the downloads page is not working for you, you can always try the direct assets link with either a web browser or wget. For example, to get Magento 1.9.0.1:
<http://ww... | I have tried and able to download by using following URL :-
<http://www.magentocommerce.com/download/>
I am using Firefox & Chrome. |
25,259,336 | I am using this url to download the magento. I registered and login but nothing happening. Every time on download it shows me login popup.
```
http://www.magentocommerce.com/download
```
Please help to let me know if i am doing something wrong. | 2014/08/12 | [
"https://Stackoverflow.com/questions/25259336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1918324/"
] | Best way to download Magento (at least v2+) without going via gated email signup is:
<https://github.com/magento/magento2/releases> | I have tried and able to download by using following URL :-
<http://www.magentocommerce.com/download/>
I am using Firefox & Chrome. |
55,485,823 | I have an array of objects like so:
```js
[
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab'
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
]
```
I need to pass an object like this `{ id: ... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55485823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183384/"
] | I *think* you're looking for something like this? Would basically be doing a string.includes match on the value of each key in your filter object--if one of the key values matches then it will be included in the result. If you wanted the entire filter object to match you could do `.every` instead of `.some`...
```
con... | If I understand your question correctly, [startsWith](https://www.w3schools.com/jsref/jsref_startswith.asp) is the key term you looking for?
```js
const arr = [
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab',
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
];
const sea... |
55,485,823 | I have an array of objects like so:
```js
[
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab'
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
]
```
I need to pass an object like this `{ id: ... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55485823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183384/"
] | If I understand your question correctly, [startsWith](https://www.w3schools.com/jsref/jsref_startswith.asp) is the key term you looking for?
```js
const arr = [
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab',
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
];
const sea... | For the dynamic object filter. You can you `closure` and `reduce`
```js
const data = [
{id: 'a',name: 'Alan',age: 10},
{id: 'ab',name: 'alanis',age: 15},
{id: 'b',name: 'Alex',age: 13}
]
const queryObj = { id: 'a', name: 'al' }
const queryObj2 = { name: 'al', age: 13 }
const filterWith = obj => e => {
... |
55,485,823 | I have an array of objects like so:
```js
[
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab'
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
]
```
I need to pass an object like this `{ id: ... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55485823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183384/"
] | I *think* you're looking for something like this? Would basically be doing a string.includes match on the value of each key in your filter object--if one of the key values matches then it will be included in the result. If you wanted the entire filter object to match you could do `.every` instead of `.some`...
```
con... | You can create a custom method that receives and object with pairs of `(key, regular expression)` and inside the [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) iterater over the [Object.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re... |
55,485,823 | I have an array of objects like so:
```js
[
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab'
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
]
```
I need to pass an object like this `{ id: ... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55485823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183384/"
] | I *think* you're looking for something like this? Would basically be doing a string.includes match on the value of each key in your filter object--if one of the key values matches then it will be included in the result. If you wanted the entire filter object to match you could do `.every` instead of `.some`...
```
con... | For the dynamic object filter. You can you `closure` and `reduce`
```js
const data = [
{id: 'a',name: 'Alan',age: 10},
{id: 'ab',name: 'alanis',age: 15},
{id: 'b',name: 'Alex',age: 13}
]
const queryObj = { id: 'a', name: 'al' }
const queryObj2 = { name: 'al', age: 13 }
const filterWith = obj => e => {
... |
55,485,823 | I have an array of objects like so:
```js
[
{
id: 'a',
name: 'Alan',
age: 10
},
{
id: 'ab'
name: 'alanis',
age: 15
},
{
id: 'b',
name: 'Alex',
age: 13
}
]
```
I need to pass an object like this `{ id: ... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55485823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183384/"
] | You can create a custom method that receives and object with pairs of `(key, regular expression)` and inside the [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) iterater over the [Object.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re... | For the dynamic object filter. You can you `closure` and `reduce`
```js
const data = [
{id: 'a',name: 'Alan',age: 10},
{id: 'ab',name: 'alanis',age: 15},
{id: 'b',name: 'Alex',age: 13}
]
const queryObj = { id: 'a', name: 'al' }
const queryObj2 = { name: 'al', age: 13 }
const filterWith = obj => e => {
... |
3,997,905 | I have a webpage having four Checkboxes as follows:
```
<p>Buy Samsung 2230<label>
<input type="checkbox" name="checkbox1" id="checkbox1" />
</label></p>
<div id="checkbox1_compare" style="display: none;"><a href="#">Compair</a></div>
<p>Buy Nokia N 95<label>
<input type="checkbox" name="checkbox2" id="checkbox2" /></... | 2010/10/22 | [
"https://Stackoverflow.com/questions/3997905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/484156/"
] | This might be what you want:
```
$(function() {
$('input:checkbox').change(function() {
var $ck = $('input:checkbox:checked');
$('input:checkbox').each(function() {
$('#' + this.id + '_compare').hide();
});
if ($ck.length > 1) {
$ck.each(function() {
$('#' + this.id + '_compare').... | You should try a more general model, for instance have the checkboxes contain a certain class, then use `jQuery.each()` to loop through them, calculate the values, and render their children divs accordingly inside the loop: `jQuery(this).children('.hidden-div').show()`
More info: [jQuery.each()](http://api.jquery.com/... |
38,193,503 | I think I'm being dense here because I keep getting a `stack too deep` error...
I have a `Child` and a `Parent` relational objects. I want 2 things to happen:
* if you try to update the `Child`, you cannot update its `status_id` to `1` unless it has a `Parent` association
* if you create a `Parent` and then attach it... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38193503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2731253/"
] | There's a lot that I find confusing here, but it seems to me that you call `:set_complete` after\_update and within `set_complete` you are updating attributes, thus you seem to have a perpetual loop there. There might be other loops that I can't see but that one stands out to me. | One way to avoid a circularly recursive situation like this is to provide a *flag* as a parameter (or otherwise) that will stop the loop from continuing.
In this case, (though I am not sure about the case entirely) I think you could provide a flag indicating the origin of the call. If the origin of the update is a cha... |
38,193,503 | I think I'm being dense here because I keep getting a `stack too deep` error...
I have a `Child` and a `Parent` relational objects. I want 2 things to happen:
* if you try to update the `Child`, you cannot update its `status_id` to `1` unless it has a `Parent` association
* if you create a `Parent` and then attach it... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38193503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2731253/"
] | There's a lot that I find confusing here, but it seems to me that you call `:set_complete` after\_update and within `set_complete` you are updating attributes, thus you seem to have a perpetual loop there. There might be other loops that I can't see but that one stands out to me. | I faced a `stack level too deep` problem some time back when working with ActiveRecord callbacks.
In my case the problem was with `update_attribute` after the update goes through the callback i.e. `set_complete` in your case is called again in which the `update_attribute` is triggered again in turn and this repeats en... |
207,586 | I would like to have the words 'to mean' and the following mathematical statement to be on the same straight line. Thank you very much!
```
\documentclass[11pt,a4paper]{article}
\usepackage{blindtext}
\usepackage{mathtools}
\DeclareMathOperator{\sgn}{sgn}
\begin{document}
\begin{flalign*}
... | 2014/10/17 | [
"https://tex.stackexchange.com/questions/207586",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/61127/"
] | Try this.
```
\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{flalign*}
&3=+1+1+1 & \\
\intertext{to mean}
&(+1+1+1)=+1+1+1,&
\end{flalign*}
\end{document}
```
 | your code should be
```
\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
3 &=+1+1+1 \\
\intertext{to mean}\\
(+1+1+1) &=+1+1+1,
\end{align*}
\end{document}
```
 |
207,586 | I would like to have the words 'to mean' and the following mathematical statement to be on the same straight line. Thank you very much!
```
\documentclass[11pt,a4paper]{article}
\usepackage{blindtext}
\usepackage{mathtools}
\DeclareMathOperator{\sgn}{sgn}
\begin{document}
\begin{flalign*}
... | 2014/10/17 | [
"https://tex.stackexchange.com/questions/207586",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/61127/"
] | Try this.
```
\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{flalign*}
&3=+1+1+1 & \\
\intertext{to mean}
&(+1+1+1)=+1+1+1,&
\end{flalign*}
\end{document}
```
 | ```
\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
3 =+1+1+1 & \qquad \quad to~{} mean & (+1+1+1) =+1+1+1,
\end{align*}
\end{document}
```
 |
207,586 | I would like to have the words 'to mean' and the following mathematical statement to be on the same straight line. Thank you very much!
```
\documentclass[11pt,a4paper]{article}
\usepackage{blindtext}
\usepackage{mathtools}
\DeclareMathOperator{\sgn}{sgn}
\begin{document}
\begin{flalign*}
... | 2014/10/17 | [
"https://tex.stackexchange.com/questions/207586",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/61127/"
] | your code should be
```
\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
3 &=+1+1+1 \\
\intertext{to mean}\\
(+1+1+1) &=+1+1+1,
\end{align*}
\end{document}
```
 | ```
\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
3 =+1+1+1 & \qquad \quad to~{} mean & (+1+1+1) =+1+1+1,
\end{align*}
\end{document}
```
 |
12,419,812 | Is there any way to find the version of Jquery using normal plain javascript.
I know to do this using JQuery itself by using the following code.
```
jQuery.fn.jquery;
```
or
```
$().jquery;
```
But this wont works for me beacuse I am not allowed to use Jquery code. Please suggest any alternative methods using onl... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12419812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1648144/"
] | ```
jQuery.fn.jquery
```
is a plain JavaScript property. This has nothing to do with 'using jQuery', so that's a proper 'JavaScript' way of getting jQuery's version.
*Edit:* If you just need to check, if a version of jQuery already exists, you can simply test for `window.jQuery`:
```
if ("jQuery" in window) {
/... | What do you mean by 'jquery code' - it's all just JavaScript.
This is how you reference the JavaScript function named '$':
```
$
```
This is how you call that function:
```
$()
```
This is how you access the `jquery` property of the return value of that function:
```
$().jquery
```
Which gives you what you ne... |
12,419,812 | Is there any way to find the version of Jquery using normal plain javascript.
I know to do this using JQuery itself by using the following code.
```
jQuery.fn.jquery;
```
or
```
$().jquery;
```
But this wont works for me beacuse I am not allowed to use Jquery code. Please suggest any alternative methods using onl... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12419812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1648144/"
] | ```
jQuery.fn.jquery
```
is a plain JavaScript property. This has nothing to do with 'using jQuery', so that's a proper 'JavaScript' way of getting jQuery's version.
*Edit:* If you just need to check, if a version of jQuery already exists, you can simply test for `window.jQuery`:
```
if ("jQuery" in window) {
/... | Do you mean you can't use the word `$` or `jQuery` in your code?
What about:
```
window[String.fromCharCode(36)]()[String.fromCharCode(106,113,117,101,114,121)]
``` |
12,419,812 | Is there any way to find the version of Jquery using normal plain javascript.
I know to do this using JQuery itself by using the following code.
```
jQuery.fn.jquery;
```
or
```
$().jquery;
```
But this wont works for me beacuse I am not allowed to use Jquery code. Please suggest any alternative methods using onl... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12419812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1648144/"
] | Declare a variable and try to get the version using
```
var jVersion;
jVersion = jQuery.fn.jquery;
console.log(jVersion);
```
Use this method if you are using any normal JS code | What do you mean by 'jquery code' - it's all just JavaScript.
This is how you reference the JavaScript function named '$':
```
$
```
This is how you call that function:
```
$()
```
This is how you access the `jquery` property of the return value of that function:
```
$().jquery
```
Which gives you what you ne... |
12,419,812 | Is there any way to find the version of Jquery using normal plain javascript.
I know to do this using JQuery itself by using the following code.
```
jQuery.fn.jquery;
```
or
```
$().jquery;
```
But this wont works for me beacuse I am not allowed to use Jquery code. Please suggest any alternative methods using onl... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12419812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1648144/"
] | Declare a variable and try to get the version using
```
var jVersion;
jVersion = jQuery.fn.jquery;
console.log(jVersion);
```
Use this method if you are using any normal JS code | Do you mean you can't use the word `$` or `jQuery` in your code?
What about:
```
window[String.fromCharCode(36)]()[String.fromCharCode(106,113,117,101,114,121)]
``` |
599,960 | I guess `~/.config` (`XDG_CONFIG_HOME`) is not correct because that way users have to be constantly aware which files are safe to commit to their dotfiles repository. | 2020/07/23 | [
"https://unix.stackexchange.com/questions/599960",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/4393/"
] | You'd rather want:
```
grep -rilZ 'first_string' . | xargs -r0 grep -Hi 'second_string'
```
assuming GNU utilities (which you seem to be having as you're already using the `-r` GNU extension).
That is:
* use `-Z` and `xargs -0` to reliably pass the list of paths (which on Unix-like systems can contain any byte val... | `find . | perl -ne 'open($fh, $_); $s1=0; $s2=0; while($line = <$fh>) { $s1=1 if($line=~/string 1/); $s2=1 if($line=~/string 2/); } ; print $_ if($s1==1 and $s2 ==1); close $fh;' | sort | uniq`
(It's a bit long to see, but this goes all on 1 line)
**Edit:** Some explanation:
* `find . |` sends a list of all files i... |
6,707,720 | I would like to know how I can change the date in my "selectedDate" with jquery datepick. Here's my HTML where I want the magic to show
```
<h3>Historique des tâches (<span class="selectedDate"><?= date("Y-m-d");?></span>) <span class="chooseDate">Choisir date</span> <span class="taskDate"></span></h3>
```
And the j... | 2011/07/15 | [
"https://Stackoverflow.com/questions/6707720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/845217/"
] | Usually the downgrade in performance is only when creating the connection to the database. That operation is intensive for all provider types.
Someone please correct me if I'm wrong, but as of .NET4 Microsoft has created an Oracle driver which I believe allows LINQ to SQL. I know it was in the works at one point and I... | I can't discuss the performance, but do you store the connection string to the database in a configuration file? It seems to me that changing the connection mechanism is the more complicated solution to changing the connection string to find the correct server. |
6,707,720 | I would like to know how I can change the date in my "selectedDate" with jquery datepick. Here's my HTML where I want the magic to show
```
<h3>Historique des tâches (<span class="selectedDate"><?= date("Y-m-d");?></span>) <span class="chooseDate">Choisir date</span> <span class="taskDate"></span></h3>
```
And the j... | 2011/07/15 | [
"https://Stackoverflow.com/questions/6707720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/845217/"
] | Ok, I figured it out on my own. I did a benchmark of the code using the SQL driver against the same exact code using the ODBC driver.
My results are below.
* ODBC DRIVER: 100% connection success. Average duration 796
Millisecond.
* SQL DRIVER: 100% connection success! Average duration
641 Millisecond.
The ODBC drive... | I can't discuss the performance, but do you store the connection string to the database in a configuration file? It seems to me that changing the connection mechanism is the more complicated solution to changing the connection string to find the correct server. |
30,694,305 | This code gives me... array? with columns and data, as i understand
console.log
```
{ columns: [ 'n.name' ],
data: [ [ '(' ], [ 'node_name' ], [ ';' ], [ 'CREATE' ], [ ')' ] ] }
```
Code
```
function show() {
var cypher = [
'MATCH (n)-[r:CREATE_NODE_COMMAND]->(s)RETURN n.name'
].join('\n');
... | 2015/06/07 | [
"https://Stackoverflow.com/questions/30694305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4967368/"
] | If you want to return a map of `key : value` in the cypher result set you can change the return statement to something like this...
```
return { name : n.name }
``` | result.data.join('') by **jonpacker** <https://github.com/brikteknologier/seraph/issues/166> |
34,490 | I'm new to the Raspberry Pi community and to working with electricity, so I'm looking for some advice.
I've brought the WS2801 LED strip from eBay (but I think it's the same as this: <https://www.sparkfun.com/products/retired/11272>). Using a computer PSU I've connected the LED strip power to my 5V molex rail and data... | 2015/08/16 | [
"https://raspberrypi.stackexchange.com/questions/34490",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/33814/"
] | What you are suggesting sounds fine to me (but I'm not an electronics type so treat anything I say with caution).
As the Pi and LED strip will have a common ground you don't need to connect a Pi ground to the LED strip ground. If you ever use a separate power supply for the Pi and the LED strip you will have to join t... | Powering the Pi and the LED strip the way as shown in the schematics is possible. There is however one issue to consider: back feeding the supply voltage to the Pi via the GPIO pin connector bypasses the polyfuse of the Pi and might render the overvoltage protection (D16) non-operative.
Compare [schematics](https://we... |
14,286,230 | Is it possible to test two `EXISTS` conditions in a single `IF` SQL statement? I've tried the following.
```
IF EXIST (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 = @parm2)
OR
EXIST (SELECT * FROM tblTwo WHERE field1 = @parm5 AND field2 = @parm3)
```
I've tried playing with adding additional `IF` ... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14286230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1142433/"
] | If SQL Server
```
IF EXISTS (SELECT *
FROM tblOne
WHERE field1 = @parm1
AND field2 = @parm2)
OR EXISTS (SELECT *
FROM tblTwo
WHERE field1 = @parm5
AND field2 = @parm3)
PRINT 'YES'
```
Is fine, note the only thing... | You missed an S at the end of EXIST
EXIST**S**, not EXIST |
14,286,230 | Is it possible to test two `EXISTS` conditions in a single `IF` SQL statement? I've tried the following.
```
IF EXIST (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 = @parm2)
OR
EXIST (SELECT * FROM tblTwo WHERE field1 = @parm5 AND field2 = @parm3)
```
I've tried playing with adding additional `IF` ... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14286230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1142433/"
] | If SQL Server
```
IF EXISTS (SELECT *
FROM tblOne
WHERE field1 = @parm1
AND field2 = @parm2)
OR EXISTS (SELECT *
FROM tblTwo
WHERE field1 = @parm5
AND field2 = @parm3)
PRINT 'YES'
```
Is fine, note the only thing... | You could also write an IN statement
```
IF EXISTS (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 IN (@parm2,@parm3)
``` |
14,286,230 | Is it possible to test two `EXISTS` conditions in a single `IF` SQL statement? I've tried the following.
```
IF EXIST (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 = @parm2)
OR
EXIST (SELECT * FROM tblTwo WHERE field1 = @parm5 AND field2 = @parm3)
```
I've tried playing with adding additional `IF` ... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14286230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1142433/"
] | You missed an S at the end of EXIST
EXIST**S**, not EXIST | You could also write an IN statement
```
IF EXISTS (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 IN (@parm2,@parm3)
``` |
69,792,953 | I have Json Data through which I'm doing this .
```
fun getFact(context: Context) = viewModelScope.launch{
try {
val format = Json {
ignoreUnknownKeys = true
prettyPrint = true
isLenient = true
}
val factJson = context.assets.open("Facts.json").buffered... | 2021/11/01 | [
"https://Stackoverflow.com/questions/69792953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11630186/"
] | Composables can only recompose when you update state data. You aren't doing that. Your click event should return the new quote that you want to display. You then set `fact.value` to the new quote. Calling `fact.value` with a new value is what triggers a recompose:
```
when (val result = viewModel.uiState.collectAsStat... | `factsLists.shuffled()` returns a new list with the elements of this list randomly shuffled. |
37,310,398 | I want to make the length of one of my divs longer on a button click, however the jquery doesn't seem to be working. Here's the script.
```
<script type="text/javascript">
$(document).ready(function(){
function extendContainer() {
$('#thisisabutton').click(function() {
$('#one').animate({
... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37310398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6304516/"
] | The solution you came up with yourself for now is the best what you could do.
We discussed whether we should expose any other API for singular backlinks, but as there is no way to enforce their multiplicity on the data storage layer, it didn't made sense so far. In addition, you would still need a wrapper object, so t... | What about specifiying the relation the other way around?
* Specify the connection on the 'one'-side
* Do a query in the getter on the 'many'-side:
So it should read like this:
```
class Child: Object {
dynamic var name:String = ""
dynamic var parent:Parent? = nil
}
class Parent: Object {
dynamic var... |
18,561 | In the Pokemon School, you can create a group and other players can join. I created and some friends of mine joined. The NPC says something about syncing events.
What does being in a group do? What kind of things does it sync? | 2011/03/18 | [
"https://gaming.stackexchange.com/questions/18561",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/7902/"
] | >
> Joining a group is a feature introduced in Generation IV. Players in the same group encounter the same swarming Pokémon, weather conditions, changing Pokémon in the Great Marsh, Feebas location, and other things each day. Group members can compare records on the third floor of Jubilife TV.
>
>
>
Source: [Bulba... | I always created a group with my friend when we wanted to enter the Doubles Battle Tower together. I assume that "event" in this context refers to any multiplayer event that can be done with a friend in HGSS. They use groups for all of them so that it remains consistent. |
50,898,924 | I have coo\_matrix `X` and indexes `trn_idx` by which I would like to get access of that maxtrix
```
print (type(X ), X.shape)
print (type(trn_idx), trn_idx.shape)
<class 'scipy.sparse.coo.coo_matrix'> (1503424, 2795253)
<class 'numpy.ndarray'> (1202739,)
```
Calling this way:
```
X[trn_idx]
TypeError: only integ... | 2018/06/17 | [
"https://Stackoverflow.com/questions/50898924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1739325/"
] | The `coo_matrix` class does not support indexing. You'll have to convert it to a different sparse format.
Here's an example with a small `coo_matrix`:
```
In [19]: import numpy as np
In [20]: from scipy.sparse import coo_matrix
In [21]: m = coo_matrix([[0, 0, 0, 1], [2, 0, 0 ,0], [0, 0, 0, 0], [0, 3, 4, 0]])
```
... | Try reading this.
>
> <https://docs.scipy.org/doc/scipy-0.19.0/reference/generated/scipy.sparse.csr_matrix.todense.html>
>
>
>
You need to convert to a dense matrix before accessing via an index.
Try toarray() method on sparse matrix then you can access then by indexing. |
50,645,382 | I am creating several mobile applications in react-native that share common components. I have difficulties handling the dependencies. Here is what I do, which is tedious, is there a better way?
* A repository "common-modules" has shared components
* Several repositories include the common one as a dependency like thi... | 2018/06/01 | [
"https://Stackoverflow.com/questions/50645382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197181/"
] | I've heard of projects that share code being managed in a monorepo. That may help managing shared code but won't solve the problem of linking native modules N times for N apps.
However, there is `react-native link` that should automate the process, and ease linking the native modules a lot. Note there is no need to re... | Like you said yourself it is easier to work with a duplicated codebase. To deal with that you can create your own package manager for your shared components. Make a script for each component which will add it's dependencies to package.json and configure gradle and XCode. Add a simple GUI to include your components with... |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | In short, you wanted to do micro-batching calculations with in storm’s running tuples.
First you need to define/find key in tuple set.
Do field grouping(don't use shuffle grouping) between bolts using that key. This will guarantee related tuples will always send to same task of downstream bolt for same key.
Define cla... | I'm afraid there is no such built-in functionality as of today.
But you can use any kind of distributed cache, like memcached or Redis. Those caching solutions are really easy to use. |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | I'm afraid there is no such built-in functionality as of today.
But you can use any kind of distributed cache, like memcached or Redis. Those caching solutions are really easy to use. | There are a couple of approaches to do that but it depends on your system requirements, your team skills and your infrastructure.
You could use Apache Cassandra for you events storing and you pass the row's key in the tuple so the next bolt could retrieve it.
If your data is time series in nature, then maybe you woul... |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | I'm afraid there is no such built-in functionality as of today.
But you can use any kind of distributed cache, like memcached or Redis. Those caching solutions are really easy to use. | Uou can use CacheBuilder to remember your data within your extended BaseRichBolt (put this in the prepare method):
```
// init your cache.
this.cache = CacheBuilder.newBuilder()
.maximumSize(maximumCacheSize)
.expireAfterWrite(expireAfterWrite, TimeUnit.SECONDS)
... |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | I'm afraid there is no such built-in functionality as of today.
But you can use any kind of distributed cache, like memcached or Redis. Those caching solutions are really easy to use. | This question is a good candidate to demonstrate Apache Spark's in memory computation over the micro batches. However, your use case is trivial to implement in Storm.
1. Make sure the bolt uses fields grouping. It will consistently hash the incoming tuple to the same bolt so we do not lose out on any tuple.
2. Maintai... |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | In short, you wanted to do micro-batching calculations with in storm’s running tuples.
First you need to define/find key in tuple set.
Do field grouping(don't use shuffle grouping) between bolts using that key. This will guarantee related tuples will always send to same task of downstream bolt for same key.
Define cla... | There are a couple of approaches to do that but it depends on your system requirements, your team skills and your infrastructure.
You could use Apache Cassandra for you events storing and you pass the row's key in the tuple so the next bolt could retrieve it.
If your data is time series in nature, then maybe you woul... |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | In short, you wanted to do micro-batching calculations with in storm’s running tuples.
First you need to define/find key in tuple set.
Do field grouping(don't use shuffle grouping) between bolts using that key. This will guarantee related tuples will always send to same task of downstream bolt for same key.
Define cla... | Uou can use CacheBuilder to remember your data within your extended BaseRichBolt (put this in the prepare method):
```
// init your cache.
this.cache = CacheBuilder.newBuilder()
.maximumSize(maximumCacheSize)
.expireAfterWrite(expireAfterWrite, TimeUnit.SECONDS)
... |
28,249,388 | How to store the temporary data in Apache storm?
In storm topology, bolt needs to access the previously processed data.
```
Eg: if the bolt processes varaiable1 with result as 20 at 10:00 AM.
```
and again `varaiable1` is received as `50` at `10:15 AM` then the result should be `30 (50-20)`
later if varaiable1 re... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28249388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2431957/"
] | In short, you wanted to do micro-batching calculations with in storm’s running tuples.
First you need to define/find key in tuple set.
Do field grouping(don't use shuffle grouping) between bolts using that key. This will guarantee related tuples will always send to same task of downstream bolt for same key.
Define cla... | This question is a good candidate to demonstrate Apache Spark's in memory computation over the micro batches. However, your use case is trivial to implement in Storm.
1. Make sure the bolt uses fields grouping. It will consistently hash the incoming tuple to the same bolt so we do not lose out on any tuple.
2. Maintai... |
67,723,390 | **I'm trying to predict probability of X\_test and getting 2 values in an array. I need to compare those 2 values and make it 1.**
when I write code
```
y_pred = classifier.predict_proba(X_test)
y_pred
```
It gives output like
```
array([[0.5, 0.5],
[0.6, 0.4],
[0.7, 0.3],
...,
[0.5, 0.... | 2021/05/27 | [
"https://Stackoverflow.com/questions/67723390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15224778/"
] | Try
```
"string0;string1;string2".split(';')
```
Further reading:
<https://python-reference.readthedocs.io/en/latest/docs/str/split.html> | This should work:
```
raw_string = 2008-01;12.759358;6.297382
formatted = raw_string.split(';')
``` |
32,602,441 | I have 3 unread messages. For this reason, I have to show `3` at the top of a message like this picture:
[](https://i.stack.imgur.com/iSjcI.png)
How can I do this? PLease help me. | 2015/09/16 | [
"https://Stackoverflow.com/questions/32602441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1282443/"
] | I think this repo will help you.
<https://github.com/jgilfelt/android-viewbadger>
[](https://i.stack.imgur.com/ZEyse.png) | If you are using a relative layout to show your icons, than you can put another relative layout(rl2) over message icon with relative margins containing circular imageview and an textView above it, control the visibility of rl2 from activity along with the text of textview,
Suppose,
There is are 3 new messages, set vis... |
2,090,753 | I know that a symmetric tensor of symmetric rank $1$ can be viewed as a point on the so-called *Veronese variety*. A symmetric tensor of rank $r$ is then in the linear space spanned by $r$ points of the Veronese variety. My question is the following: can any given symmetric tensor of **rank $1$** ever reside in the lin... | 2017/01/09 | [
"https://math.stackexchange.com/questions/2090753",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/405499/"
] | Your question is: Can a given symmetric tensor of rank $1$ be written as a linear combination of other symmetric tensors of rank $1$? The answer is yes. Yes, a symmetric tensor of rank $1$ can be written as a linear combination of other symmetric tensors of rank $1$. This is true over the complex numbers, the real numb... | First let me make a point about the terminology. I believe what you mean by "rank-$1$ tensor" is what most people call a "pure" tensor: it is a tensor $t$ that can be written $v\_1\otimes\cdots\otimes v\_n$ for some possibly different vectors $v\_i$. I believe what you mean by "pure symmetric" is that all the $v\_i$ ar... |
308,615 | I am fairly new to JavaEE, so I have some concepts still missing.
I am learning Docker to use it in our DEV / CI Build environments. I could make it work on my machine. But for it to work in the CI server, my current approach would be to store the docker-compose.yml and dockerfiles in git and, in the CI server download... | 2016/01/28 | [
"https://softwareengineering.stackexchange.com/questions/308615",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/7764/"
] | For point 1. and 3. You could create private Ivy repository and fetch DB Drivers and Modules from it via your Build tool ( Mvn, Ant, Gradle support getting dependencies from Ivy repos ) when building your app.
And for `.xml` files - you can have git repository for your Test Environment config files. Or have them encry... | You need a reproducible build - this means you do not want your CI server downloading things from the internet on demand. You need to download them and otherwise collect everything needed for the build and store it somewhere accessible to the CI server.
Now the easiest and most future-proof way of doing that is to sto... |
35,214,887 | I have this call:
```
get_users('meta_key=main_feature&value=yes');
```
but the query is also returning users with the meta key 'featured' set to yes as well. I have a plugin that allows me to check all the user meta and have confirmed that the meta key for users that shouldn't be showing up is empty.
Is there som... | 2016/02/05 | [
"https://Stackoverflow.com/questions/35214887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
jQuery(document).ready(function($) {
var e = "mailto:jbob@live.com";
$("footer .copyright").append('<div> Website by <a href="' + e + '" target="_top">John Bob</a></div>');
});
```
Pretty close. | Another interesting & clean approach is to use [chaining](http://blog.pengoworks.com/index.cfm/2007/10/26/jQuery-Understanding-the-chain).
```
$("<a target='_top'>")
.text("John Bob")
.attr("href", "mailto:jbob@live.com")
.appendTo("<div>Website by </div>")
.parent()
.appendTo("footer .copyright")
.end();... |
65,044,704 | I am trying to write a test with the new cypress 6 interceptor method ([Cypress API Intercept](https://docs.cypress.io/api/commands/intercept.html)). For the test I am writing I need to change the reponse of one endpoint after some action was performed.
**Expectation:**
I am calling cy.intercept again with another fi... | 2020/11/27 | [
"https://Stackoverflow.com/questions/65044704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2844348/"
] | Slightly clumsy, but you can use one `cy.intercept()` with a [Function routeHandler](https://docs.cypress.io/api/commands/intercept.html#Intercepting-a-response), and count the calls.
Something like,
```
let interceptCount = 0;
cy.intercept('http://localhost:4200/testcall', (req) => {
req.reply(res => {
... | ```
const requestsCache = {};
export function reIntercept(type: 'GET' | 'POST' | 'PUT' | 'DELETE', url, options: StaticResponse) {
requestsCache[type + url] = options;
cy.intercept(type, url, req => req.reply(res => {
console.log(url, ' => ', requestsCache[type + url].fixture);
return res.send(r... |
65,044,704 | I am trying to write a test with the new cypress 6 interceptor method ([Cypress API Intercept](https://docs.cypress.io/api/commands/intercept.html)). For the test I am writing I need to change the reponse of one endpoint after some action was performed.
**Expectation:**
I am calling cy.intercept again with another fi... | 2020/11/27 | [
"https://Stackoverflow.com/questions/65044704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2844348/"
] | Slightly clumsy, but you can use one `cy.intercept()` with a [Function routeHandler](https://docs.cypress.io/api/commands/intercept.html#Intercepting-a-response), and count the calls.
Something like,
```
let interceptCount = 0;
cy.intercept('http://localhost:4200/testcall', (req) => {
req.reply(res => {
... | Cypress command [cy.intercept](https://on.cypress.io/intercept) has the
`times` parameter that you can use to create intercepts that only are used N times. In your case it would be
```js
cy.intercept('http://localhost:4200/testcall', {
fixture: 'example.json',
times: 1
});
...
cy.intercept('http://localhost:4200... |
65,044,704 | I am trying to write a test with the new cypress 6 interceptor method ([Cypress API Intercept](https://docs.cypress.io/api/commands/intercept.html)). For the test I am writing I need to change the reponse of one endpoint after some action was performed.
**Expectation:**
I am calling cy.intercept again with another fi... | 2020/11/27 | [
"https://Stackoverflow.com/questions/65044704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2844348/"
] | Slightly clumsy, but you can use one `cy.intercept()` with a [Function routeHandler](https://docs.cypress.io/api/commands/intercept.html#Intercepting-a-response), and count the calls.
Something like,
```
let interceptCount = 0;
cy.intercept('http://localhost:4200/testcall', (req) => {
req.reply(res => {
... | As of Cypress [v7.0.0](https://github.com/cypress-io/cypress/releases/tag/v7.0.0) released 04/05/2021, `cy.intercept()` allows over-riding.
>
> We introduced several breaking changes to cy.intercept().
>
>
> * Request handlers supplied to cy.intercept() are **now matched starting with the most recently defined requ... |
65,044,704 | I am trying to write a test with the new cypress 6 interceptor method ([Cypress API Intercept](https://docs.cypress.io/api/commands/intercept.html)). For the test I am writing I need to change the reponse of one endpoint after some action was performed.
**Expectation:**
I am calling cy.intercept again with another fi... | 2020/11/27 | [
"https://Stackoverflow.com/questions/65044704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2844348/"
] | Cypress command [cy.intercept](https://on.cypress.io/intercept) has the
`times` parameter that you can use to create intercepts that only are used N times. In your case it would be
```js
cy.intercept('http://localhost:4200/testcall', {
fixture: 'example.json',
times: 1
});
...
cy.intercept('http://localhost:4200... | ```
const requestsCache = {};
export function reIntercept(type: 'GET' | 'POST' | 'PUT' | 'DELETE', url, options: StaticResponse) {
requestsCache[type + url] = options;
cy.intercept(type, url, req => req.reply(res => {
console.log(url, ' => ', requestsCache[type + url].fixture);
return res.send(r... |
65,044,704 | I am trying to write a test with the new cypress 6 interceptor method ([Cypress API Intercept](https://docs.cypress.io/api/commands/intercept.html)). For the test I am writing I need to change the reponse of one endpoint after some action was performed.
**Expectation:**
I am calling cy.intercept again with another fi... | 2020/11/27 | [
"https://Stackoverflow.com/questions/65044704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2844348/"
] | As of Cypress [v7.0.0](https://github.com/cypress-io/cypress/releases/tag/v7.0.0) released 04/05/2021, `cy.intercept()` allows over-riding.
>
> We introduced several breaking changes to cy.intercept().
>
>
> * Request handlers supplied to cy.intercept() are **now matched starting with the most recently defined requ... | ```
const requestsCache = {};
export function reIntercept(type: 'GET' | 'POST' | 'PUT' | 'DELETE', url, options: StaticResponse) {
requestsCache[type + url] = options;
cy.intercept(type, url, req => req.reply(res => {
console.log(url, ' => ', requestsCache[type + url].fixture);
return res.send(r... |
44,879,049 | I do not want to manually type in thousands of posts from my old website on the front end of my new website. I simply want to merge the database from the old into the new website in phpmyadmin. I'll tweak the tables to suit the new software afterwards.
1. I think there are only four tables that need to be merged for m... | 2017/07/03 | [
"https://Stackoverflow.com/questions/44879049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1069432/"
] | **Setup**
Consider the dataframes `inventory` and `replace_with`
```
inventory = pd.DataFrame(dict(Partnumbers=['123AAA', '123BBB', '123CCC']))
replace_with = pd.DataFrame(dict(
oldPartnumbers=['123AAA', '123BBB', '123CCC'],
newPartnumbers=['123ABC', '123DEF', '123GHI']
))
```
**Option 1**
... | This solution is relatively fast - it uses pandas data alignment and the numpy "copyto" function.
```
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'partNumbers': ['123AAA', '123BBB', '123CCC', '123DDD']})
df2 = pd.DataFrame({'oldPartnumbers': ['123AAA', '123BBB', '123CCC'],
'newPartn... |
44,879,049 | I do not want to manually type in thousands of posts from my old website on the front end of my new website. I simply want to merge the database from the old into the new website in phpmyadmin. I'll tweak the tables to suit the new software afterwards.
1. I think there are only four tables that need to be merged for m... | 2017/07/03 | [
"https://Stackoverflow.com/questions/44879049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1069432/"
] | Let say you have 2 df as follows:
```
import pandas as pd
df1 = pd.DataFrame([[1,3],[5,4],[6,7]], columns = ['PN','name'])
df2 = pd.DataFrame([[2,22],[3,33],[4,44],[5,55]], columns = ['oldname','newname'])
```
df1:
```
PN oldname
0 1 3
1 5 4
2 6 7
```
df2:
```
oldname newname
0 2 2... | This solution is relatively fast - it uses pandas data alignment and the numpy "copyto" function.
```
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'partNumbers': ['123AAA', '123BBB', '123CCC', '123DDD']})
df2 = pd.DataFrame({'oldPartnumbers': ['123AAA', '123BBB', '123CCC'],
'newPartn... |
1,246,300 | So this is probably really simple but for some reason I can't figure it out. When I run the below code I can't get it to go into the `if` statement even though when I go into the debugger console in xcode and I execute `po [resultObject valueForKey:@"type"]` it returns `0`. What am I doing wrong? Thanks for your help!
... | 2009/08/07 | [
"https://Stackoverflow.com/questions/1246300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/149839/"
] | The result of `valueForKey:` is always an object — and the only object equal to 0 is nil. In the case of a numerical value, it will be an NSNumber. At any rate, I think you want to ask for `[[resultObject valueForKey:@"type"] intValue]`. | You could try casting the NSManagedObject to an int (if thats what it actually is...)
Also you don't need the extra parentheses around the [ ]
```
NSManagedObject *resultObject = [qResult objectAtIndex:i];
if ((int)[resultObject valueForKey:@"type"] == 0) {
//do something
}
``` |
71,860,572 | ```
#include <string>
void foo(int x, short y, int z) { std::cout << "normal int" << std::endl; } //F1
void foo(double x, int y, double z) { std::cout << "normal double" << std::endl; } //F2
int main()
{
short x = 2;
foo(5.0, x, 8.0);
}
```
Based on function overloading rules,
F1( Exact = 1, Promote = 0, Con... | 2022/04/13 | [
"https://Stackoverflow.com/questions/71860572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14250223/"
] | Overload resolution can get complicated. But here it's fairly straightforward. I'll rewrite the function prototypes to remove the third argument, since it doesn't affect the analysis.
```
void foo(int, short);
void foo(double, int);
double d = 1.0;
short s = 2;
f(d, s); // ambiguous
```
The rule is that you look a... | The ranking of conversion sequences matters only when comparing ranking of the conversion sequences applied to the same argument.
If one argument's conversion rank is better in the first overload than in the second one and the other way around for another argument's conversion rank, then neither overload is considered... |
71,860,572 | ```
#include <string>
void foo(int x, short y, int z) { std::cout << "normal int" << std::endl; } //F1
void foo(double x, int y, double z) { std::cout << "normal double" << std::endl; } //F2
int main()
{
short x = 2;
foo(5.0, x, 8.0);
}
```
Based on function overloading rules,
F1( Exact = 1, Promote = 0, Con... | 2022/04/13 | [
"https://Stackoverflow.com/questions/71860572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14250223/"
] | Overload resolution ranks the viable candidate functions by comparing how each argument of the call matches the corresponding parameter of the candidates. Moreover, for one candidate to be considered better than another, the **better candidate cannot have any of its parameters be a worse match than the
corresponding pa... | The ranking of conversion sequences matters only when comparing ranking of the conversion sequences applied to the same argument.
If one argument's conversion rank is better in the first overload than in the second one and the other way around for another argument's conversion rank, then neither overload is considered... |
71,860,572 | ```
#include <string>
void foo(int x, short y, int z) { std::cout << "normal int" << std::endl; } //F1
void foo(double x, int y, double z) { std::cout << "normal double" << std::endl; } //F2
int main()
{
short x = 2;
foo(5.0, x, 8.0);
}
```
Based on function overloading rules,
F1( Exact = 1, Promote = 0, Con... | 2022/04/13 | [
"https://Stackoverflow.com/questions/71860572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14250223/"
] | Overload resolution can get complicated. But here it's fairly straightforward. I'll rewrite the function prototypes to remove the third argument, since it doesn't affect the analysis.
```
void foo(int, short);
void foo(double, int);
double d = 1.0;
short s = 2;
f(d, s); // ambiguous
```
The rule is that you look a... | Overload resolution ranks the viable candidate functions by comparing how each argument of the call matches the corresponding parameter of the candidates. Moreover, for one candidate to be considered better than another, the **better candidate cannot have any of its parameters be a worse match than the
corresponding pa... |
19,724,319 | In JavaScript, I have complex objects comprising functions, variables and closures.
These objects are very large, very complex and created and destroyed over and over again. I will be working on a very low-powered, very low-memory device, so it's important to me that when the objects are deleted that they are really g... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19724319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681800/"
] | You will have the best effect by doing this
```
window.obj = null;
delete window.obj;
```
Setting objects to null removes any references to it. Also remember that the delete command has no effect on regular variables, only properties.
To better ensure object destruction you may consider not using the global context... | The only way to get rid of an object is for JavaScript to garbage-collect it, so making sure there really aren't any references to the object left and praying is the only way to go.
If you're repeatedly creating and destroying the same object, consider using an [object pool](http://www.html5rocks.com/en/tutorials/spee... |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | Top answer is correct. You can debug this with "Pause" option. Most common way to block main thread is to call `dispatch_sync` on the same thread you dispatching. Sometimes you call same code from `dispatch_once`. | I have similar case in my project and the reason was another developer who added `setNeedsLayout()` inside method `layoutSubviews()` and this make infinite loop and freeze the app. |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | Top answer is correct. You can debug this with "Pause" option. Most common way to block main thread is to call `dispatch_sync` on the same thread you dispatching. Sometimes you call same code from `dispatch_once`. | The same Issue Happened to me with ios 13.4 and then I tried the above solution but it doesn't solve it. so I had one element with break constraint on the storyboard. So after resolving the constraint it solve the problem. |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | It sounds like you've blocked the main thread somehow. To debug, run the app in the debugger and when the app freezes, hit the pause button above the log area at the bottom of Xcode. Then on the left side, you'll be able to see exactly what each thread is doing, and you can see where it's getting stuck.
[![pause butto... | I suggest checking your sizes especially in collection views if they are not fitted they will freeze your app and also check your constraints |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | Besides pausing and following the stacktrace I think as an additional thing to do, is to check in the code if there's any loop causing the app freezes.
I recently ran into a similar problem, but stack trace didn't help much, I figured out that I was having an eternal loop when calling a `reloadData()` inside layoutsu... | The same Issue Happened to me with ios 13.4 and then I tried the above solution but it doesn't solve it. so I had one element with break constraint on the storyboard. So after resolving the constraint it solve the problem. |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | I have similar case in my project and the reason was another developer who added `setNeedsLayout()` inside method `layoutSubviews()` and this make infinite loop and freeze the app. | The same Issue Happened to me with ios 13.4 and then I tried the above solution but it doesn't solve it. so I had one element with break constraint on the storyboard. So after resolving the constraint it solve the problem. |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | It sounds like you've blocked the main thread somehow. To debug, run the app in the debugger and when the app freezes, hit the pause button above the log area at the bottom of Xcode. Then on the left side, you'll be able to see exactly what each thread is doing, and you can see where it's getting stuck.
[![pause butto... | The same Issue Happened to me with ios 13.4 and then I tried the above solution but it doesn't solve it. so I had one element with break constraint on the storyboard. So after resolving the constraint it solve the problem. |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | It sounds like you've blocked the main thread somehow. To debug, run the app in the debugger and when the app freezes, hit the pause button above the log area at the bottom of Xcode. Then on the left side, you'll be able to see exactly what each thread is doing, and you can see where it's getting stuck.
[![pause butto... | Top answer is correct. You can debug this with "Pause" option. Most common way to block main thread is to call `dispatch_sync` on the same thread you dispatching. Sometimes you call same code from `dispatch_once`. |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | I have similar case in my project and the reason was another developer who added `setNeedsLayout()` inside method `layoutSubviews()` and this make infinite loop and freeze the app. | I suggest checking your sizes especially in collection views if they are not fitted they will freeze your app and also check your constraints |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | It sounds like you've blocked the main thread somehow. To debug, run the app in the debugger and when the app freezes, hit the pause button above the log area at the bottom of Xcode. Then on the left side, you'll be able to see exactly what each thread is doing, and you can see where it's getting stuck.
[![pause butto... | Besides pausing and following the stacktrace I think as an additional thing to do, is to check in the code if there's any loop causing the app freezes.
I recently ran into a similar problem, but stack trace didn't help much, I figured out that I was having an eternal loop when calling a `reloadData()` inside layoutsu... |
10,196,344 | Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?
Can anybody help me? I ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10196344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013554/"
] | It sounds like you've blocked the main thread somehow. To debug, run the app in the debugger and when the app freezes, hit the pause button above the log area at the bottom of Xcode. Then on the left side, you'll be able to see exactly what each thread is doing, and you can see where it's getting stuck.
[![pause butto... | I have similar case in my project and the reason was another developer who added `setNeedsLayout()` inside method `layoutSubviews()` and this make infinite loop and freeze the app. |
71,198,618 | ```
const howLong = 5
```
```
let special = [
"!",
"@",
"#",
"$",
"%",
"+",
"&",];
let finalPassword = []
for (let i = 0; i < howLong; i++) {
finalPassword += special[Math.floor(Math.random() * howLong)].push
}
```
console prints undefined 5x, my goal is to make it copy 5 random ... | 2022/02/20 | [
"https://Stackoverflow.com/questions/71198618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17978619/"
] | you should remove the .push call
```
const howLong = 5;
let special = [
"!",
"@",
"#",
"$",
"%",
"+",
"&",];
let finalPassword = "";
for (let i = 0; i < howLong; i++) {
finalPassword += special[Math.floor(Math.random() * howLong)]
}
... | In your example you simply have to remove `.push` it seems.
```js
let special = ["!", "@", "#", "$", "%", "+", "&"];
let finalPassword = [];
for (let i = 0; i < 5; i++) {
finalPassword += special[Math.floor(Math.random() * 5)];
}
console.log({ finalPassword });
``` |
71,198,618 | ```
const howLong = 5
```
```
let special = [
"!",
"@",
"#",
"$",
"%",
"+",
"&",];
let finalPassword = []
for (let i = 0; i < howLong; i++) {
finalPassword += special[Math.floor(Math.random() * howLong)].push
}
```
console prints undefined 5x, my goal is to make it copy 5 random ... | 2022/02/20 | [
"https://Stackoverflow.com/questions/71198618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17978619/"
] | Depending on what your expected output requirements are you can either concatenate "special" characters on to a string:
```js
const howLong = 5;
let special=["!","@","#","$","%","+","&"];
let finalPassword = '';
for (let i = 0; i < howLong; i++) {
const rnd = Math.floor(Math.random() * howLong);
finalPassword ... | In your example you simply have to remove `.push` it seems.
```js
let special = ["!", "@", "#", "$", "%", "+", "&"];
let finalPassword = [];
for (let i = 0; i < 5; i++) {
finalPassword += special[Math.floor(Math.random() * 5)];
}
console.log({ finalPassword });
``` |
71,198,618 | ```
const howLong = 5
```
```
let special = [
"!",
"@",
"#",
"$",
"%",
"+",
"&",];
let finalPassword = []
for (let i = 0; i < howLong; i++) {
finalPassword += special[Math.floor(Math.random() * howLong)].push
}
```
console prints undefined 5x, my goal is to make it copy 5 random ... | 2022/02/20 | [
"https://Stackoverflow.com/questions/71198618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17978619/"
] | In the for loop iteration, generate a random index and then access the special array in that index to fetch the special character.
```js
const howLong = 5;
let special = [
"!",
"@",
"#",
"$",
"%",
"+",
"&",];
let finalPassword = []
for (let i = 0; i < howLong; i++) {
const currentRa... | In your example you simply have to remove `.push` it seems.
```js
let special = ["!", "@", "#", "$", "%", "+", "&"];
let finalPassword = [];
for (let i = 0; i < 5; i++) {
finalPassword += special[Math.floor(Math.random() * 5)];
}
console.log({ finalPassword });
``` |
519,113 | Why I can write formula derivative $$ f'(x) = \lim\_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$ in this form: $$ f'(x)=\frac{f(x+h)-f(h)}{h}+O(h)$$
I know, that it's easy but unfortunately I forgot. | 2013/10/08 | [
"https://math.stackexchange.com/questions/519113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99324/"
] | The formula $f'(x) = \lim\_{h \to 0} \frac{f(x+h)-f(x)}{h}$ is equivalent to
$\lim\_{h \to 0} \frac{f(x+h)-f(x)-f'(x)h}{h} = 0$.
This in turn is equivalent to the function $g(h) = f(x+h)-f(x)-f'(x)h$ satisfying $\lim\_{h \to 0} \frac{g(h)}{h} = 0$.
Such a function is referred to as 'little o' or $o(h)$, and we say $... | By the definition of differentiability
$$f(x+h)-f(x)=f'(x)h+o(h),\,\,h\to{0}.$$
In your's second formula must be $o(1),$ not $O(h).$ |
519,113 | Why I can write formula derivative $$ f'(x) = \lim\_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$ in this form: $$ f'(x)=\frac{f(x+h)-f(h)}{h}+O(h)$$
I know, that it's easy but unfortunately I forgot. | 2013/10/08 | [
"https://math.stackexchange.com/questions/519113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99324/"
] | Let $f(x)=|x|^{3/2}$. Then $f'(0)=0$. But $\dfrac{|h|^{3/2}-0}{h}$ is not $O(h)$. | By the definition of differentiability
$$f(x+h)-f(x)=f'(x)h+o(h),\,\,h\to{0}.$$
In your's second formula must be $o(1),$ not $O(h).$ |
519,113 | Why I can write formula derivative $$ f'(x) = \lim\_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$ in this form: $$ f'(x)=\frac{f(x+h)-f(h)}{h}+O(h)$$
I know, that it's easy but unfortunately I forgot. | 2013/10/08 | [
"https://math.stackexchange.com/questions/519113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99324/"
] | The formula $f'(x) = \lim\_{h \to 0} \frac{f(x+h)-f(x)}{h}$ is equivalent to
$\lim\_{h \to 0} \frac{f(x+h)-f(x)-f'(x)h}{h} = 0$.
This in turn is equivalent to the function $g(h) = f(x+h)-f(x)-f'(x)h$ satisfying $\lim\_{h \to 0} \frac{g(h)}{h} = 0$.
Such a function is referred to as 'little o' or $o(h)$, and we say $... | $f'(x)=\frac{f(x+h)-f(x)}{h}+\Big(f'(x)-\frac{f(x+h)-f(x)}{h}\Big)=\frac{f(x+h)-f(x)}{h}+o(h)$, assuming $f'(x)$ exists (since $\Big(f'(x)-\frac{f(x+h)-f(x)}{h}\Big)$ goes to $0$ as $h\to 0$). It's true that if something is $o(h)$ it is also $O(h)$, so it's also true that $f'(x)=\frac{f(x+h)-f(x)}{h}+O(h)$. Also if $g(... |
519,113 | Why I can write formula derivative $$ f'(x) = \lim\_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$ in this form: $$ f'(x)=\frac{f(x+h)-f(h)}{h}+O(h)$$
I know, that it's easy but unfortunately I forgot. | 2013/10/08 | [
"https://math.stackexchange.com/questions/519113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99324/"
] | Let $f(x)=|x|^{3/2}$. Then $f'(0)=0$. But $\dfrac{|h|^{3/2}-0}{h}$ is not $O(h)$. | $f'(x)=\frac{f(x+h)-f(x)}{h}+\Big(f'(x)-\frac{f(x+h)-f(x)}{h}\Big)=\frac{f(x+h)-f(x)}{h}+o(h)$, assuming $f'(x)$ exists (since $\Big(f'(x)-\frac{f(x+h)-f(x)}{h}\Big)$ goes to $0$ as $h\to 0$). It's true that if something is $o(h)$ it is also $O(h)$, so it's also true that $f'(x)=\frac{f(x+h)-f(x)}{h}+O(h)$. Also if $g(... |
519,113 | Why I can write formula derivative $$ f'(x) = \lim\_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$ in this form: $$ f'(x)=\frac{f(x+h)-f(h)}{h}+O(h)$$
I know, that it's easy but unfortunately I forgot. | 2013/10/08 | [
"https://math.stackexchange.com/questions/519113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99324/"
] | The formula $f'(x) = \lim\_{h \to 0} \frac{f(x+h)-f(x)}{h}$ is equivalent to
$\lim\_{h \to 0} \frac{f(x+h)-f(x)-f'(x)h}{h} = 0$.
This in turn is equivalent to the function $g(h) = f(x+h)-f(x)-f'(x)h$ satisfying $\lim\_{h \to 0} \frac{g(h)}{h} = 0$.
Such a function is referred to as 'little o' or $o(h)$, and we say $... | Let $f(x)=|x|^{3/2}$. Then $f'(0)=0$. But $\dfrac{|h|^{3/2}-0}{h}$ is not $O(h)$. |
18,863 | I have this code
```
$collection = Mage::getModel("news/views");
->addFieldToSelect('post_id', array('eq' => $this->getRequest()->getParam("id")));
```
And when i'm trying to save my post i get en error:
>
> Invalid method Iv\_News\_Model\_Views::addFieldToSelect(Array ( [0] =>
> post\_id [1] => Array ( [eq] => ... | 2014/04/25 | [
"https://magento.stackexchange.com/questions/18863",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/6086/"
] | The `addFieldToSelect` is available for collection objects. It is defined in `Mage_Core_Model_Resource_Db_Collection_Abstract` so it is available in all its child classes.
You are calling it on a model object that most probably is a child of `Mage_Core_Model_Abstract`.
I think you meant to do this:
```
$collectio... | According to problem from comment the soulution was to change
```
AddFieldToSelect()
```
to
```
AddFieldToFilter()
```
and it worked. |
46,303,233 | I cannot find a solution to this particular demand.
I have a mysql dump on my computer and I want to import it in a web server using SSH.
How do I do that ?
Can I add the ssh connection to the mysql command ?
Edit :
I did it with SCP
```
scp -r -p /Users/me/files/dump.sql user@server:/var/www/private
mysql -hxxx -u... | 2017/09/19 | [
"https://Stackoverflow.com/questions/46303233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1787994/"
] | As the comment above says, the simplest solution is to scp the whole dump file up to your server, and then restore it normally. But that means you have to have enough free disk space to store the dump file on your webserver. You might not.
An alternative is to set up a temporary ssh tunnel to your web server. Read <ht... | You can try this solution for your problem :
**Login using SSH details :-**
```
SSH Host name : test.com
SSH User : root
SSH Password : 123456
```
**Connect SSH :-**
```
ssh root@test.com
enter password : 123456
```
**Login MySQL :-**
```
mysql -u [MySQL User] -p
Enter Password :- MySQL Password
```
**Used f... |
46,303,233 | I cannot find a solution to this particular demand.
I have a mysql dump on my computer and I want to import it in a web server using SSH.
How do I do that ?
Can I add the ssh connection to the mysql command ?
Edit :
I did it with SCP
```
scp -r -p /Users/me/files/dump.sql user@server:/var/www/private
mysql -hxxx -u... | 2017/09/19 | [
"https://Stackoverflow.com/questions/46303233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1787994/"
] | You can try this solution for your problem :
**Login using SSH details :-**
```
SSH Host name : test.com
SSH User : root
SSH Password : 123456
```
**Connect SSH :-**
```
ssh root@test.com
enter password : 123456
```
**Login MySQL :-**
```
mysql -u [MySQL User] -p
Enter Password :- MySQL Password
```
**Used f... | Yes, you can do it with one command, just use 'Pipeline' or 'Process Substitution'
**For your example with 'Pipeline':**
```
ssh user@server "cat /Users/me/files/dump.sql" | mysql -hxxx -uxxx -pxxx dbname
```
or use 'Process Substitution':
```
mysql -hxxx -uxxx -pxxx dbname < <(ssh user@server "cat /Users/me/files... |
46,303,233 | I cannot find a solution to this particular demand.
I have a mysql dump on my computer and I want to import it in a web server using SSH.
How do I do that ?
Can I add the ssh connection to the mysql command ?
Edit :
I did it with SCP
```
scp -r -p /Users/me/files/dump.sql user@server:/var/www/private
mysql -hxxx -u... | 2017/09/19 | [
"https://Stackoverflow.com/questions/46303233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1787994/"
] | As the comment above says, the simplest solution is to scp the whole dump file up to your server, and then restore it normally. But that means you have to have enough free disk space to store the dump file on your webserver. You might not.
An alternative is to set up a temporary ssh tunnel to your web server. Read <ht... | Yes, you can do it with one command, just use 'Pipeline' or 'Process Substitution'
**For your example with 'Pipeline':**
```
ssh user@server "cat /Users/me/files/dump.sql" | mysql -hxxx -uxxx -pxxx dbname
```
or use 'Process Substitution':
```
mysql -hxxx -uxxx -pxxx dbname < <(ssh user@server "cat /Users/me/files... |
17,058 | We have ants in our house, and nothing I've tried so far has been sufficiently successful. Now I'm considering using ant traps, but only under the kitchen cabinets behind the plinth, a place where neither my cats nor my kids (a baby and a toddler) would ever be able to reach them (no chance of them getting in there). W... | 2017/05/09 | [
"https://pets.stackexchange.com/questions/17058",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/2554/"
] | I don't think it is overstocked at the moment.
But these are all schooling fish and they might be happier if the schools are a bit bigger.
A better mix would be to remove 2 species (eg the tetra's and the barbs) and replace them with the other species (more corys and rainbows for example).
6-7 fish for a 's... | Yah. Not overstocked but it will be if you have their appropriate schools. Try two or three schools of the smaller species like zebra danios and turquoise rainbows. You could possibly put some guppies in if you are interested. |
17,058 | We have ants in our house, and nothing I've tried so far has been sufficiently successful. Now I'm considering using ant traps, but only under the kitchen cabinets behind the plinth, a place where neither my cats nor my kids (a baby and a toddler) would ever be able to reach them (no chance of them getting in there). W... | 2017/05/09 | [
"https://pets.stackexchange.com/questions/17058",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/2554/"
] | I don't think it is overstocked at the moment.
But these are all schooling fish and they might be happier if the schools are a bit bigger.
A better mix would be to remove 2 species (eg the tetra's and the barbs) and replace them with the other species (more corys and rainbows for example).
6-7 fish for a 's... | So, I'm going to slightly disagree with the idea to keep AND add to the rainbows pop. This is one of my favorite breeds of freshwater community fish too, so although my heart says keep those beauties, my experience says differently.
They get about 4" (10 cm) in length and need a decent sized school to be happy. It's s... |
17,058 | We have ants in our house, and nothing I've tried so far has been sufficiently successful. Now I'm considering using ant traps, but only under the kitchen cabinets behind the plinth, a place where neither my cats nor my kids (a baby and a toddler) would ever be able to reach them (no chance of them getting in there). W... | 2017/05/09 | [
"https://pets.stackexchange.com/questions/17058",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/2554/"
] | So, I'm going to slightly disagree with the idea to keep AND add to the rainbows pop. This is one of my favorite breeds of freshwater community fish too, so although my heart says keep those beauties, my experience says differently.
They get about 4" (10 cm) in length and need a decent sized school to be happy. It's s... | Yah. Not overstocked but it will be if you have their appropriate schools. Try two or three schools of the smaller species like zebra danios and turquoise rainbows. You could possibly put some guppies in if you are interested. |
5,058 | When running MSM add-on, how can I manage the file upload folders etc, via a config.php file?
Ideally I would want to use a hook to do it, but it doesn't seem to work.
Normally I would do this:
>
>
> ```
> $config['upload_preferences'] = array(
> 1 => array(
> 'name' => 'Images',
> ... | 2013/01/18 | [
"https://expressionengine.stackexchange.com/questions/5058",
"https://expressionengine.stackexchange.com",
"https://expressionengine.stackexchange.com/users/362/"
] | Actually, every upload location you create is going to have a different ID, be it one site or in multiple sites using MSM. You can thus safely keep everything in config.php becuse every upload location you define (even if you share physical folders) is going to have a different ID anyway.
Basically:
* Step 1: create ... | If you want to override MSM settings then you should move this code into the index.php file of the sites respectively.
```
$assign_to_config['upload_preferences'] = array(
1 => array(
'name' => 'Images',
'server_path' => $uploads_path . "/images/",
'url' => $u... |
71,595,153 | I made a simple 1 button LED dimmer and I would like to have the LED go back to full brightness after the button has not been touched for a set amount of time. But the code I came up with does not seem to be working as I cannot dim the LED
```
int buttonPin = 12;
int LEDPin = 3;
int buttonVal;
int LEDbright = 0;
int d... | 2022/03/23 | [
"https://Stackoverflow.com/questions/71595153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14318258/"
] | Your question doesn't seem to line up with how the code was written. It looks like you want to do the opposite (have the light get brighter when the button is held down, and then switch off 60 seconds after the button was released).
Here's the code I came up with to help with your stated problem:
```
int buttonPin = 1... | ```
int buttonPin = 12;
int LEDPin = 3;
int buttonVal;
unsigned int LEDbright = 0;
int dt = 500;
int fdt = 60000;
unsigned long whenButtonWasTouchedMs = 0;
void setup() {
// put your setup code here, to run once:
pinMode(buttonPin, INPUT);
pinMode(LEDPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
//sta... |
6,542,566 | How do you get last 3 words from the string?
I managed to get working doing like this:
```
$statusMessage = explode(" ", str_replace(' '," ",$retStatus->plaintext));
$SliceDate = array_slice($statusMessage, -3, 3);
$date = implode(" ", $SliceDate);
echo $date;
```
Is there a shorter way? Maybe there is a PHP f... | 2011/07/01 | [
"https://Stackoverflow.com/questions/6542566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622378/"
] | explode() is good, but once you've done that you can use
```
$size = sizeof($statusMessage);
```
and last 3 are
```
$statusmessage[$size-1];
$statusmessage[$size-2];
$statusmessage[$size-3];
``` | ```
preg_match('#(?:\s\w+){3}$#', $statusMessage );
``` |
6,542,566 | How do you get last 3 words from the string?
I managed to get working doing like this:
```
$statusMessage = explode(" ", str_replace(' '," ",$retStatus->plaintext));
$SliceDate = array_slice($statusMessage, -3, 3);
$date = implode(" ", $SliceDate);
echo $date;
```
Is there a shorter way? Maybe there is a PHP f... | 2011/07/01 | [
"https://Stackoverflow.com/questions/6542566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622378/"
] | explode() is good, but once you've done that you can use
```
$size = sizeof($statusMessage);
```
and last 3 are
```
$statusmessage[$size-1];
$statusmessage[$size-2];
$statusmessage[$size-3];
``` | preg\_match("/(?:\w+\s\*){1,3}$/", $input\_line, $output\_array);
this catches 1 to 3 words and if the row is only 3 long, other regex one was close |
6,542,566 | How do you get last 3 words from the string?
I managed to get working doing like this:
```
$statusMessage = explode(" ", str_replace(' '," ",$retStatus->plaintext));
$SliceDate = array_slice($statusMessage, -3, 3);
$date = implode(" ", $SliceDate);
echo $date;
```
Is there a shorter way? Maybe there is a PHP f... | 2011/07/01 | [
"https://Stackoverflow.com/questions/6542566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622378/"
] | ```
preg_match('#(?:\s\w+){3}$#', $statusMessage );
``` | preg\_match("/(?:\w+\s\*){1,3}$/", $input\_line, $output\_array);
this catches 1 to 3 words and if the row is only 3 long, other regex one was close |
64,037,433 | I have some code but I just found out it works on like 90% of the computers. Here is the distinguishedName:
*CN=2016-10-05T12:19:16-05:00{393DA5A5-4EEF-4394-90F7-CBD0D2F20CC9},CN=**Computer01-T2**,OU=Product,OU=Workstations,OU=KDUYA,DC=time,DC=local*
What I am trying to do is parse out just the ComputerName. 3 of the ... | 2020/09/23 | [
"https://Stackoverflow.com/questions/64037433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12201298/"
] | I don't think they have support for geometry buffers at this stage. ST\_AREA isn't going to help you. Last I heard they are working on improving their geospatial support.
That said, can you buffer your data somewhere else in your workflow? Such as using shapely buffer in python, or turf circle/buffer in javascript? | As said above you can find all geospatial functions here: <https://docs.snowflake.com/en/sql-reference/functions-geospatial.html>
Regarding ST\_BUFFER I think the function ST\_AREA sounds good: <https://docs.snowflake.com/en/sql-reference/functions/st_area.html> |
3,402,360 | Given any bounded set $E$ in $\mathbb{R}^{N}$, is there a general way to choose a sequence $(G\_{n})$ of open sets such that $\chi\_{G\_{n}}\downarrow\chi\_{E}$ pointwise?
Here $\chi$ denotes the characteristic/indicator function on $E$.
One may think of $G\_{n}:=E+B(0,1/n)$, but we have instead that $\chi\_{G\_{n}}\... | 2019/10/21 | [
"https://math.stackexchange.com/questions/3402360",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/284331/"
] | Let $\mu$ denote Lebesgue measure on $\Bbb R^N. $
If $E$ is $\mu$-measurable then there exists a sequence $(G\_n)\_n$ of open sets such that $E\subset \cap\_nG\_n$ and $\mu(\,(\cap\_nG\_n)\setminus E\,)=0.$
Let $H\_n=\cap \{G\_j:j\le n\}.$
If $p\in E$ then $\chi\_{H\_n}(p)=1=\chi\_E(p)$ for all $n.$
If $p\not \in ... | For arbitrary bounded set $E$, then $\text{Cap}(E)<\infty$ and hence by outer regularity, we have $G\_{n}\supseteq E$ such that $\text{Cap}(E)\leq\text{Cap}(G\_{n})<\text{Cap}(E)+1/n$ for each $n=1,2,...$
Then $E\subseteq\displaystyle\bigcap\_{n}G\_{n}$. But $\text{Cap}\left(\displaystyle\bigcap\_{n}G\_{n}-E\right)+\t... |
10,663 | I received a new iPhone yesterday and connected it to my home Wifi network.
On content heavy sites it runs perfectly fine, but if I use either the Youtube site or the Youtube app I can't watch anything. It takes forever to watch 5 seconds of video.
My first question is, how can I be sure that my phone is using local ... | 2011/03/22 | [
"https://apple.stackexchange.com/questions/10663",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1434/"
] | Yes, you can have both versions. In fact you can install the new Firefox in your home directory's Application folder (and it will be only accessible with your account). If you don't have ~/Applications folder, you can create it (and Finder will mark it with the same icon as the /Applications one). Note that you cannot ... | [OS X: Install and Run Firefox 3 and Firefox 4 on the Same Computer | Mozilla Firefox | Tech-Recipes](http://www.tech-recipes.com/rx/2828/os_x_install_firefox_2_firefox_3_same_computer/)
Or just make copies of `~/Library/Preferences/org.mozilla.firefox.plist` and `~/Library/Application Support/Firefox/`. |
10,663 | I received a new iPhone yesterday and connected it to my home Wifi network.
On content heavy sites it runs perfectly fine, but if I use either the Youtube site or the Youtube app I can't watch anything. It takes forever to watch 5 seconds of video.
My first question is, how can I be sure that my phone is using local ... | 2011/03/22 | [
"https://apple.stackexchange.com/questions/10663",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1434/"
] | Yes, you can have both versions. In fact you can install the new Firefox in your home directory's Application folder (and it will be only accessible with your account). If you don't have ~/Applications folder, you can create it (and Finder will mark it with the same icon as the /Applications one). Note that you cannot ... | Once you install it in separate directories, you can in fact **run them both simultaneously**.
It just takes a little Firefox flags magic as explained here in [this article](http://www.shankrila.com/firefox/howto-run-firefox4-firefox3-simultaneously/). |
10,663 | I received a new iPhone yesterday and connected it to my home Wifi network.
On content heavy sites it runs perfectly fine, but if I use either the Youtube site or the Youtube app I can't watch anything. It takes forever to watch 5 seconds of video.
My first question is, how can I be sure that my phone is using local ... | 2011/03/22 | [
"https://apple.stackexchange.com/questions/10663",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1434/"
] | [OS X: Install and Run Firefox 3 and Firefox 4 on the Same Computer | Mozilla Firefox | Tech-Recipes](http://www.tech-recipes.com/rx/2828/os_x_install_firefox_2_firefox_3_same_computer/)
Or just make copies of `~/Library/Preferences/org.mozilla.firefox.plist` and `~/Library/Application Support/Firefox/`. | Once you install it in separate directories, you can in fact **run them both simultaneously**.
It just takes a little Firefox flags magic as explained here in [this article](http://www.shankrila.com/firefox/howto-run-firefox4-firefox3-simultaneously/). |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.