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 |
|---|---|---|---|---|---|
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | In don't know of any setting to disable it.
handle the `onSelectedRowsChanged` event and do something like:
```
var selectedRows = grid.getSelectedRows();
if( selectedRows.length > 1 ) {
grid.setSelectedRows( [ selectedRows[ selectedRows.length - 1 ] ] );
}
``` | Remove the `muiltiple="multiple"` in the following line:
```
<select id="id" name="name" multiple="multiple">
```
So, it is as good as removing that attribute. I'd use jQuery. |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | In don't know of any setting to disable it.
handle the `onSelectedRowsChanged` event and do something like:
```
var selectedRows = grid.getSelectedRows();
if( selectedRows.length > 1 ) {
grid.setSelectedRows( [ selectedRows[ selectedRows.length - 1 ] ] );
}
``` | ```
<select multiple="multiple" size="3">
<option value="1" disabled>One</option>
<option value="2" disabled>Two</option>
<option value="3" disabled>Three</option>
</select>
``` |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | I know this is an old question, but updates to Slickgrid now allow you to disable multiSelect in the grid options:
```
var options = {
editable: false,
enableCellNavigation: true,
asyncEditorLoading: false,
multiSelect: false
};
```
With this option, clicking w... | with this code you can disable multiselect:
```
document.getElementById('mySelectBox').removeAttribute("multiple");;
```
... of a selectbox like this:
```
<select multiple="multiple" id="mySelectBox">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
... |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | Remove the `muiltiple="multiple"` in the following line:
```
<select id="id" name="name" multiple="multiple">
```
So, it is as good as removing that attribute. I'd use jQuery. | Regarding your question, disable to multiple select is quite simple? Isn't it?
```
<select multiple="multiple" disabled = "true">
<option value="1"> One
<option value="2"> Two
<option value="3"> Three
</select>
``` |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | with this code you can disable multiselect:
```
document.getElementById('mySelectBox').removeAttribute("multiple");;
```
... of a selectbox like this:
```
<select multiple="multiple" id="mySelectBox">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
... | Remove the `muiltiple="multiple"` in the following line:
```
<select id="id" name="name" multiple="multiple">
```
So, it is as good as removing that attribute. I'd use jQuery. |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | I know this is an old question, but updates to Slickgrid now allow you to disable multiSelect in the grid options:
```
var options = {
editable: false,
enableCellNavigation: true,
asyncEditorLoading: false,
multiSelect: false
};
```
With this option, clicking w... | Regarding your question, disable to multiple select is quite simple? Isn't it?
```
<select multiple="multiple" disabled = "true">
<option value="1"> One
<option value="2"> Two
<option value="3"> Three
</select>
``` |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | I know this is an old question, but updates to Slickgrid now allow you to disable multiSelect in the grid options:
```
var options = {
editable: false,
enableCellNavigation: true,
asyncEditorLoading: false,
multiSelect: false
};
```
With this option, clicking w... | ```
<select multiple="multiple" size="3">
<option value="1" disabled>One</option>
<option value="2" disabled>Two</option>
<option value="3" disabled>Three</option>
</select>
``` |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | with this code you can disable multiselect:
```
document.getElementById('mySelectBox').removeAttribute("multiple");;
```
... of a selectbox like this:
```
<select multiple="multiple" id="mySelectBox">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
... | ```
<select multiple="multiple" size="3">
<option value="1" disabled>One</option>
<option value="2" disabled>Two</option>
<option value="3" disabled>Three</option>
</select>
``` |
3,527,493 | Is there a way to disable multi select? | 2010/08/20 | [
"https://Stackoverflow.com/questions/3527493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425903/"
] | ```
<select multiple="multiple" size="3">
<option value="1" disabled>One</option>
<option value="2" disabled>Two</option>
<option value="3" disabled>Three</option>
</select>
``` | Regarding your question, disable to multiple select is quite simple? Isn't it?
```
<select multiple="multiple" disabled = "true">
<option value="1"> One
<option value="2"> Two
<option value="3"> Three
</select>
``` |
43,430,078 | In my knowledge the `%c` expects the int value (as `char` is treated as integer in **C**), and `%s` expects the `char *` as argument, but my doubt is, **does the %s need a pointer to a block of characters? Can it points to a single character in double quotes?**
For example:
```
char * s = "string";
printf("%s",s);/... | 2017/04/15 | [
"https://Stackoverflow.com/questions/43430078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5163725/"
] | >
> how compiler is able to figure out the block of memory where the
> string present and terminated by '\0' ?.
>
>
>
Because a string literal (x amount of characters between double quotes) gets the NUL terminator `\0` added to it by the compiler.
```
char * s = "string";
char foo = s[6]; // \0
```
So `printf... | The string is made up of character, just as the char array is made up if characters.
Compilers should be smart, and gcc must have a function that can identify which is which, and peform the appropriate operations (such as adding a null terminator)
And to answer your question, yes it will still print to the console, ... |
43,430,078 | In my knowledge the `%c` expects the int value (as `char` is treated as integer in **C**), and `%s` expects the `char *` as argument, but my doubt is, **does the %s need a pointer to a block of characters? Can it points to a single character in double quotes?**
For example:
```
char * s = "string";
printf("%s",s);/... | 2017/04/15 | [
"https://Stackoverflow.com/questions/43430078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5163725/"
] | A single character in double quote still is a C-String, actually containing two characters: The single character plus the terminating null character:
```
char const* str = "a"; // actually points to an array { 'a', '\0' }
```
So you still use it with `%s`. Actually, you *can* use it with `%c`, too, if you dereferenc... | The string is made up of character, just as the char array is made up if characters.
Compilers should be smart, and gcc must have a function that can identify which is which, and peform the appropriate operations (such as adding a null terminator)
And to answer your question, yes it will still print to the console, ... |
22,945,171 | I've got a sample project which uses Spring Data Neo4j's advanced mapping using aspectj. It's failing in a test with NullPointerException due to the entityState attribute being null at the time when the entity is being persisted.
I can also replicate this when the server itself is spun up and I execute:
```
curl -i ... | 2014/04/08 | [
"https://Stackoverflow.com/questions/22945171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3498750/"
] | Figured it out. The `Neo4jConfig` class previously extended the `Neo4jConfiguration` class. With the introduction of aspects, that superclass needed to be updated to be `Neo4jAspectConfiguration` to provide the additional `neo4jRelationshipBacking` and `neo4jNodeBacking` beans.
I've updated the github reference projec... | Which versions do you use?
You can use @JsonIgnore for the entityState attribute.
See: <http://forum.spring.io/forum/spring-projects/data/nosql/110063-unable-to-convert-nodeentity-object-to-json-with-jackson>
```
@JsonIgnoreProperties({"entityState", "nodeId", "persistentState", "relationshipTo", "template"})
``` |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | If you really need to do it this way, you have to re-cast the pointer. Something like this:
```
struct node *my_list = null;
addFirst((struct node *)&my_list, 123);
void addFirst(struct node *list, int value){
struct node **real_list = (struct node **)list;
struct node *new_node = (struct node*) malloc (sizeo... | I have learned @Vlad Lazarenko answer,and I made the code like this ,is it right?
```
addFirst((struct node**)head,123);
void addFirst(struct node **list,int value)
{
struct node *new_node=malloc(sizeof(struct node));
new_node->value=value;
new_node->next=*list;
list=&new_node;
}
``` |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | I have learned @Vlad Lazarenko answer,and I made the code like this ,is it right?
```
addFirst((struct node**)head,123);
void addFirst(struct node **list,int value)
{
struct node *new_node=malloc(sizeof(struct node));
new_node->value=value;
new_node->next=*list;
list=&new_node;
}
``` | All is good, but in the `void addFirst(struct node *list, int value)` function the `list` is passed by value. Which means that a pointer is being copied and assignment of a new address to that pointer inside `addFirst` function is not visible to the caller of `addFirst`. To solve it, you have to either pass a pointer b... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | If you really need to do it this way, you have to re-cast the pointer. Something like this:
```
struct node *my_list = null;
addFirst((struct node *)&my_list, 123);
void addFirst(struct node *list, int value){
struct node **real_list = (struct node **)list;
struct node *new_node = (struct node*) malloc (sizeo... | ```
void addFirst(struct node **list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node->next = *list;
*list = new_node;
}
```
This is the correct code. the problem is that the poineter `struct node *list` You are passing can't be chang... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | In C, if you want a function to be able to change a value it received in its arguments, you need to pass the address of that value. So, to change the value of the list pointer, you need to pass the address of the list pointer. Your addFirst() function should look like this :
```
void addFirst(struct node **list, int v... | ```
void addFirst(struct node **list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node->next = *list;
*list = new_node;
}
```
This is the correct code. the problem is that the poineter `struct node *list` You are passing can't be chang... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | If you really need to do it this way, you have to re-cast the pointer. Something like this:
```
struct node *my_list = null;
addFirst((struct node *)&my_list, 123);
void addFirst(struct node *list, int value){
struct node **real_list = (struct node **)list;
struct node *new_node = (struct node*) malloc (sizeo... | All is good, but in the `void addFirst(struct node *list, int value)` function the `list` is passed by value. Which means that a pointer is being copied and assignment of a new address to that pointer inside `addFirst` function is not visible to the caller of `addFirst`. To solve it, you have to either pass a pointer b... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | I have learned @Vlad Lazarenko answer,and I made the code like this ,is it right?
```
addFirst((struct node**)head,123);
void addFirst(struct node **list,int value)
{
struct node *new_node=malloc(sizeof(struct node));
new_node->value=value;
new_node->next=*list;
list=&new_node;
}
``` | ```
void addFirst(struct node **list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node->next = *list;
*list = new_node;
}
```
This is the correct code. the problem is that the poineter `struct node *list` You are passing can't be chang... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | In C, if you want a function to be able to change a value it received in its arguments, you need to pass the address of that value. So, to change the value of the list pointer, you need to pass the address of the list pointer. Your addFirst() function should look like this :
```
void addFirst(struct node **list, int v... | All is good, but in the `void addFirst(struct node *list, int value)` function the `list` is passed by value. Which means that a pointer is being copied and assignment of a new address to that pointer inside `addFirst` function is not visible to the caller of `addFirst`. To solve it, you have to either pass a pointer b... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | If you really need to do it this way, you have to re-cast the pointer. Something like this:
```
struct node *my_list = null;
addFirst((struct node *)&my_list, 123);
void addFirst(struct node *list, int value){
struct node **real_list = (struct node **)list;
struct node *new_node = (struct node*) malloc (sizeo... | In C, if you want a function to be able to change a value it received in its arguments, you need to pass the address of that value. So, to change the value of the list pointer, you need to pass the address of the list pointer. Your addFirst() function should look like this :
```
void addFirst(struct node **list, int v... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | If you really need to do it this way, you have to re-cast the pointer. Something like this:
```
struct node *my_list = null;
addFirst((struct node *)&my_list, 123);
void addFirst(struct node *list, int value){
struct node **real_list = (struct node **)list;
struct node *new_node = (struct node*) malloc (sizeo... | the node pointer could not be changed into the function in this way. in the function you are able to change the content of the pointer and not the address of the pointer. To do you have to pass your pointer of pointer `struct node **list`
here after how to do it:
```
void addFirst(struct node **list, int value){
... |
12,674,616 | I have created a linked list struct in c
```
struct node{
int value;
struct node* next;
};
```
a method to add a node at the start of the list :
```
void addFirst(struct node *list, int value){
struct node *new_node = (struct node*) malloc (sizeof (struct node));
new_node->value = value;
new_node... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038779/"
] | the node pointer could not be changed into the function in this way. in the function you are able to change the content of the pointer and not the address of the pointer. To do you have to pass your pointer of pointer `struct node **list`
here after how to do it:
```
void addFirst(struct node **list, int value){
... | All is good, but in the `void addFirst(struct node *list, int value)` function the `list` is passed by value. Which means that a pointer is being copied and assignment of a new address to that pointer inside `addFirst` function is not visible to the caller of `addFirst`. To solve it, you have to either pass a pointer b... |
28,881,354 | I have the issue of using GROUP BY when select all the column from the table and in result with the poor performance in term of speed.
```
Select * from employee
group by customer_id;
```
The query above wouldn't be change,it is mandatory and fixed.It takes 17720ms is to long and the result must take shorter time, w... | 2015/03/05 | [
"https://Stackoverflow.com/questions/28881354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2285295/"
] | For as simple as your query is, it appears almost pointless... You would not have duplicate employee IDs within an employee table, and doing a group by would still result in returning every row, every column.
However, that said, to optimize a GROUP BY, you would need an index on that column ... which I would think wou... | Column with heavy type LIKE BLOB, TEXT, NVARCHAR(200 or more) will slowdown your query by a lot if you have a lot of records. I suggest to check if it is really necessary to load them all from the start.
Also, you GROUP BY seem weird. What exactly are you trying to achieve with it? |
28,881,354 | I have the issue of using GROUP BY when select all the column from the table and in result with the poor performance in term of speed.
```
Select * from employee
group by customer_id;
```
The query above wouldn't be change,it is mandatory and fixed.It takes 17720ms is to long and the result must take shorter time, w... | 2015/03/05 | [
"https://Stackoverflow.com/questions/28881354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2285295/"
] | For as simple as your query is, it appears almost pointless... You would not have duplicate employee IDs within an employee table, and doing a group by would still result in returning every row, every column.
However, that said, to optimize a GROUP BY, you would need an index on that column ... which I would think wou... | The `GROUP BY` is not just weird, it is *wrong*. If you don't specify all the non-aggregate columns in the `GROUP BY`, you get seemingly random values for each column. Remove the GROUP BY or explain why you think you need it.
Or maybe the "\*" is not correct. OK, you cannot show us your real column names, at least sho... |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | i had the assets folder already, but mistakenly had kept on being in the android folder, doing `cd ..` helped me and the run the command `npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res` | First of all make **dir or folder** named as `assets`
inside `project/android/app/src/main/` **manually** or by running **command** below from root of project
```
npx mkdirp android/app/src/main/assets/
```
then run this command from root of project:
```
react-native bundle --platform android --dev false --entry-f... |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | For some reason I needed to create the **assets** folder as per below.
android/app/src/main/assets | * Go to `android/app/src/main/`
* Create one more folder of the name `assets`
It will look like `android/app/src/main/assets`
* Then run it. Absolutely workable. |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | * Go to `android/app/src/main/`
* Create one more folder of the name `assets`
It will look like `android/app/src/main/assets`
* Then run it. Absolutely workable. | First of all make **dir or folder** named as `assets`
inside `project/android/app/src/main/` **manually** or by running **command** below from root of project
```
npx mkdirp android/app/src/main/assets/
```
then run this command from root of project:
```
react-native bundle --platform android --dev false --entry-f... |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | For some reason I needed to create the **assets** folder as per below.
android/app/src/main/assets | You can use this command:
```
npx mkdirp android/app/src/main/assets/ && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
``` |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | For some reason I needed to create the **assets** folder as per below.
android/app/src/main/assets | We can use this command:`npx mkdirp android/app/src/main/assets/ && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/` |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | i had the assets folder already, but mistakenly had kept on being in the android folder, doing `cd ..` helped me and the run the command `npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res` | You should use this command to create assets folder in android.
Run this command in project directory.
```
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
```
Please use this, Its help me... |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | i had the assets folder already, but mistakenly had kept on being in the android folder, doing `cd ..` helped me and the run the command `npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res` | Right click the app folder New->Folder->Assests Folder
[](https://i.stack.imgur.com/PDWZY.png) |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | Right click the app folder New->Folder->Assests Folder
[](https://i.stack.imgur.com/PDWZY.png) | You should use this command to create assets folder in android.
Run this command in project directory.
```
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
```
Please use this, Its help me... |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | For some reason I needed to create the **assets** folder as per below.
android/app/src/main/assets | First of all make **dir or folder** named as `assets`
inside `project/android/app/src/main/` **manually** or by running **command** below from root of project
```
npx mkdirp android/app/src/main/assets/
```
then run this command from root of project:
```
react-native bundle --platform android --dev false --entry-f... |
58,767,147 | Get event coordinates on L.Draw.Event.DRAWVERTEX as i am not able to find any properties of the vertex
```
map.on(L.Draw.Event.DRAWVERTEX, function(e) {
console.log(e);
});
``` | 2019/11/08 | [
"https://Stackoverflow.com/questions/58767147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10842715/"
] | For some reason I needed to create the **assets** folder as per below.
android/app/src/main/assets | Right click the app folder New->Folder->Assests Folder
[](https://i.stack.imgur.com/PDWZY.png) |
27,916,869 | I have a very simple question. I have form input that I need to take in, and then redirect the browser based on that form input. I want to do it on the client side as the server is rather encumbered as it is. Here is my code, I have no clue why it's not working though. Any help is appreciated.
HTML:
```
<form action=... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27916869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2178438/"
] | You can use `onsubmit` in form to cancel redirecting action.
```
<form action="open" method="" onsubmit="SubmitFrm(); return false;">
```
Returning `false` in submit event will cancel default action, which is redirecting to form's `action`.
If you use `onsubmit` event, you don't need to put `onclick` event in submit... | Try to use a normal button instead of a form-submit, since a form submission will actually do a redirect to the given action itself. I'm not sure if your scriptcode is even fully processed before you are redirected to "open" action. Actually you don't even need a regular form for this.
Edit: What you could also do is ... |
7,329 | I know this is an old question with a lot of answers, most of them suggest editing the menu template but that does not work for me. There is no need to explain why, let's say I'm a bit OCD about doing things the "right" way.
This question may serve as material for others in need. Here goes.
Starting with Magento ... | 2013/08/29 | [
"https://magento.stackexchange.com/questions/7329",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/146/"
] | After struggling a bit here is the solution I found. I let my observer execute after the one in `Mage_Catalog` and decided to re-create the menu entirely.
The main idea is to get all the existing menu items put them in a temporary array, remove them from the menu then add my links between the existing items and in t... | >
> Since there is no way (not that I know of) to sort the order of the observers on an event ...I have a problem.
>
>
>
Ah, but there is! In your module declaration file, set the dependency of `Mage_Catalog` to your module, e.g.:
```
<modules>
<Your_Module>
<active>true</active>
<codePool>loc... |
7,329 | I know this is an old question with a lot of answers, most of them suggest editing the menu template but that does not work for me. There is no need to explain why, let's say I'm a bit OCD about doing things the "right" way.
This question may serve as material for others in need. Here goes.
Starting with Magento ... | 2013/08/29 | [
"https://magento.stackexchange.com/questions/7329",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/146/"
] | >
> Since there is no way (not that I know of) to sort the order of the observers on an event ...I have a problem.
>
>
>
Ah, but there is! In your module declaration file, set the dependency of `Mage_Catalog` to your module, e.g.:
```
<modules>
<Your_Module>
<active>true</active>
<codePool>loc... | 1. create new subcategory
2. change the link with javascript, ex your new category is "75"
>
>
> ```
> jQuery(document).ready(function(){
> document.getElementById("menu75").getElementsByTagName("a")[0].href =
>
> ```
>
> "<https://YourNewLinkink>";
> });
>
>
> |
7,329 | I know this is an old question with a lot of answers, most of them suggest editing the menu template but that does not work for me. There is no need to explain why, let's say I'm a bit OCD about doing things the "right" way.
This question may serve as material for others in need. Here goes.
Starting with Magento ... | 2013/08/29 | [
"https://magento.stackexchange.com/questions/7329",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/146/"
] | After struggling a bit here is the solution I found. I let my observer execute after the one in `Mage_Catalog` and decided to re-create the menu entirely.
The main idea is to get all the existing menu items put them in a temporary array, remove them from the menu then add my links between the existing items and in t... | 1. create new subcategory
2. change the link with javascript, ex your new category is "75"
>
>
> ```
> jQuery(document).ready(function(){
> document.getElementById("menu75").getElementsByTagName("a")[0].href =
>
> ```
>
> "<https://YourNewLinkink>";
> });
>
>
> |
67,904,146 | Could you please help me with this issue?
```
Encountered an error:
Compilation Error in model metrics_model (models\example\metrics_model.sql)
Model 'model.test_project.metrics_model' (models\example\metrics_model.sql) depends on a source named 'automate.metrics' which was not found
```
I am having this monotonou... | 2021/06/09 | [
"https://Stackoverflow.com/questions/67904146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16175677/"
] | This is due to the `automate.metrics` table missing from the database (either the dbt project’s target database or a different database on the same server). There should be a `source.yml` or `automate.yml` file somewhere in your project that defines the source. FYI `automate` is the schema name and `metrics` is the tab... | Are you seeing this in your dev environment? It's possible that you've not run `dbt run` after creating the `automate.metrics` which is preventing `metrics_model` from referencing it. |
67,904,146 | Could you please help me with this issue?
```
Encountered an error:
Compilation Error in model metrics_model (models\example\metrics_model.sql)
Model 'model.test_project.metrics_model' (models\example\metrics_model.sql) depends on a source named 'automate.metrics' which was not found
```
I am having this monotonou... | 2021/06/09 | [
"https://Stackoverflow.com/questions/67904146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16175677/"
] | For PostgreSQL database please check if the sources.yml file is defined as follows:
```
version: 2
sources:
- name: name_of the source
schema: name_of_the_schema
quoting:
database: false
schema: false
identifier: false
loader: stitch
tables:
- name: name_of_table1
- name... | Are you seeing this in your dev environment? It's possible that you've not run `dbt run` after creating the `automate.metrics` which is preventing `metrics_model` from referencing it. |
3,391,502 | I have to prove the following:
```
PREMISSES:
1. A IMPLIES ¬C
2. ¬ (B AND ¬A)
3. A OR B
CONCLUSION: ¬C
```
I've done the following so far:
```
^ AND
v OR
¬ NEG
-> IMP
4. C H
5. | A H
6. | | ¬C E-> 1,5
7. | | C Reit 4
8. | ¬A I¬ 5,6,7
9. | B H
1... | 2019/10/13 | [
"https://math.stackexchange.com/questions/3391502",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/651224/"
] | Combine the $\neg B$ with premise 3 to get $A$, which with premise 1 gives you $\neg C$, and thus the contradiction with $C$ you are looking for. | If you're using classical logic, then there's a quicker proof where you immediately use $\vee$ elimination on (3), deriving $A$ in both cases. (The case starting with $B$ requires both (2) and the double-negation law.) Then apply (1) and you're done.
But if you want to use only intuitionistic logic (which goes nicely ... |
3,391,502 | I have to prove the following:
```
PREMISSES:
1. A IMPLIES ¬C
2. ¬ (B AND ¬A)
3. A OR B
CONCLUSION: ¬C
```
I've done the following so far:
```
^ AND
v OR
¬ NEG
-> IMP
4. C H
5. | A H
6. | | ¬C E-> 1,5
7. | | C Reit 4
8. | ¬A I¬ 5,6,7
9. | B H
1... | 2019/10/13 | [
"https://math.stackexchange.com/questions/3391502",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/651224/"
] | Combine the $\neg B$ with premise 3 to get $A$, which with premise 1 gives you $\neg C$, and thus the contradiction with $C$ you are looking for. | $\def\fitch#1#2{\quad\begin{array}{|l}#1\\\hline#2\end{array}}$
Always keep your mind on the goal.
You are attempting to deduce $\neg C$ using a subproof with an assumption of $C$. The goal of this subproof is a contradiction.
The means of achieving that goal is using the third premise and $\vee$-elimination.
$$\fi... |
3,391,502 | I have to prove the following:
```
PREMISSES:
1. A IMPLIES ¬C
2. ¬ (B AND ¬A)
3. A OR B
CONCLUSION: ¬C
```
I've done the following so far:
```
^ AND
v OR
¬ NEG
-> IMP
4. C H
5. | A H
6. | | ¬C E-> 1,5
7. | | C Reit 4
8. | ¬A I¬ 5,6,7
9. | B H
1... | 2019/10/13 | [
"https://math.stackexchange.com/questions/3391502",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/651224/"
] | $\def\fitch#1#2{\quad\begin{array}{|l}#1\\\hline#2\end{array}}$
Always keep your mind on the goal.
You are attempting to deduce $\neg C$ using a subproof with an assumption of $C$. The goal of this subproof is a contradiction.
The means of achieving that goal is using the third premise and $\vee$-elimination.
$$\fi... | If you're using classical logic, then there's a quicker proof where you immediately use $\vee$ elimination on (3), deriving $A$ in both cases. (The case starting with $B$ requires both (2) and the double-negation law.) Then apply (1) and you're done.
But if you want to use only intuitionistic logic (which goes nicely ... |
58,630,427 | I am trying to make a pong like game in html, but every time one player try to move the other movement will stop.
```
//javaScript
var p1axis = 40;
var p2axis = 40;
function input(event)
{
var x = event.charCode || event.keyCode;
if(x == 115)
{
p1axis += 2;
document.getElementById("p1").... | 2019/10/30 | [
"https://Stackoverflow.com/questions/58630427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12282374/"
] | There is no such project available on PyPI currently: <https://pypi.org/project/pastebinit/>
`libraries.io` is not an authoritative source. It also shows no currently available release for this project anyway: <https://libraries.io/pypi/pastebinit/versions>
The forge for this software seems to be here: <https://launc... | Nop, it's not there. The URL <https://pypi.org/project/pastebinit/> returns error 404. Perhaps it was there but later was removed. |
2,475,271 | >
> Let $\lVert \cdot \rVert\_\*:\mathbb{R}^2 \to \mathbb{R}, (x,y) \rightarrow \sqrt{x^2+2xy+3y^2}$ be a norm.
>
>
> How can I find to constants $k,K \in \mathbb{R}^{>0}$ so that the following equivalence is given:$$k\lVert (x,y) \rVert\_2 \leq \Vert (x,y) \rVert\_\* \leq K\Vert (x,y) \rVert\_2.$$
>
>
>
**My id... | 2017/10/16 | [
"https://math.stackexchange.com/questions/2475271",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/492147/"
] | Here's a version that's more explicitly geometric, but whose underlying mathematics resemble Roberto's matrix diagonalization.
Rewrite the norm in rotated coordinates $(x', y')$, where $x = x' \cos \theta - y' \sin \theta$ and $y = x' \sin \theta + y' \cos \theta$. We'll choose $\theta$ at our convenience—specifically... | Note that
$$x^2 + 2xy + 3y^2 = \begin{pmatrix} x \\ y \end{pmatrix}^T \begin{pmatrix} 1 & 1 \\ 1 & 3 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}.$$
The eigenvalues of the matrix have sum 4 and product 2, so they are both stricly positive; let us call them $\lambda\_1$ and $\lambda\_2$. Since the matrix is symm... |
2,475,271 | >
> Let $\lVert \cdot \rVert\_\*:\mathbb{R}^2 \to \mathbb{R}, (x,y) \rightarrow \sqrt{x^2+2xy+3y^2}$ be a norm.
>
>
> How can I find to constants $k,K \in \mathbb{R}^{>0}$ so that the following equivalence is given:$$k\lVert (x,y) \rVert\_2 \leq \Vert (x,y) \rVert\_\* \leq K\Vert (x,y) \rVert\_2.$$
>
>
>
**My id... | 2017/10/16 | [
"https://math.stackexchange.com/questions/2475271",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/492147/"
] | (How to make simple things difficult...)
By Young's inequality, for every $a>0$ you have that
$$
2|xy| = 2(a|x|)(|y|/a) \leq a^2 x^2 + \frac{y^2}{a^2}
$$
hence, for every $a, b > 0$,
$$
- a^2 x^2 - \frac{y^2}{a^2} \leq 2xy \leq b^2 x^2 + \frac{y^2}{b^2}\,.
$$
These inequalities give
$$
(1-a^2) x^2 + \left(3 - \frac{1}... | Note that
$$x^2 + 2xy + 3y^2 = \begin{pmatrix} x \\ y \end{pmatrix}^T \begin{pmatrix} 1 & 1 \\ 1 & 3 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}.$$
The eigenvalues of the matrix have sum 4 and product 2, so they are both stricly positive; let us call them $\lambda\_1$ and $\lambda\_2$. Since the matrix is symm... |
2,475,271 | >
> Let $\lVert \cdot \rVert\_\*:\mathbb{R}^2 \to \mathbb{R}, (x,y) \rightarrow \sqrt{x^2+2xy+3y^2}$ be a norm.
>
>
> How can I find to constants $k,K \in \mathbb{R}^{>0}$ so that the following equivalence is given:$$k\lVert (x,y) \rVert\_2 \leq \Vert (x,y) \rVert\_\* \leq K\Vert (x,y) \rVert\_2.$$
>
>
>
**My id... | 2017/10/16 | [
"https://math.stackexchange.com/questions/2475271",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/492147/"
] | Here's a version that's more explicitly geometric, but whose underlying mathematics resemble Roberto's matrix diagonalization.
Rewrite the norm in rotated coordinates $(x', y')$, where $x = x' \cos \theta - y' \sin \theta$ and $y = x' \sin \theta + y' \cos \theta$. We'll choose $\theta$ at our convenience—specifically... | (How to make simple things difficult...)
By Young's inequality, for every $a>0$ you have that
$$
2|xy| = 2(a|x|)(|y|/a) \leq a^2 x^2 + \frac{y^2}{a^2}
$$
hence, for every $a, b > 0$,
$$
- a^2 x^2 - \frac{y^2}{a^2} \leq 2xy \leq b^2 x^2 + \frac{y^2}{b^2}\,.
$$
These inequalities give
$$
(1-a^2) x^2 + \left(3 - \frac{1}... |
31,779,005 | I want show keyboard when my EditText receives focus. I tried many methods but nothing not helped.
I tried:
1.
```
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT);
```
whith different flags.
2.`getWindow(... | 2015/08/03 | [
"https://Stackoverflow.com/questions/31779005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4781349/"
] | You can add flags to your activity as well which will show the keyboard automatically
```
<activity name="package.ActivityName" android:windowSoftInputMode="stateVisible"/>
```
this is mostly useful if you expect the focus to be applied when the activity launches
Also you can use in **Fragment**:
```
InputMethodMa... | Use WindowManager instead of InputMehtodManager inside onFocusChange listener of edittext, As Its reliable.
```
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
dialog.getWindow().setSoftInputMode(WindowMan... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Try this :
```
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
```
This checks if jQuery is available or not, if not it will add one dynamically from path specified.
Ref: [Simulate an "include\_once" for jQuery](https://stackoverflow.com/questions/7887735/simulate-a... | Even though you may have a head appending it may not work in all browsers. This was the only method I found to work consistently.
```
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Method 1:
```
if (window.jQuery) {
// jQuery is loaded
} else {
// jQuery is not loaded
}
```
Method 2:
```
if (typeof jQuery == 'undefined') {
// jQuery is not loaded
} else {
// jQuery is loaded
}
```
If jquery.js file is not loaded, we can force load it like so:
```
if (!window.jQuery) {... | ```
var f = ()=>{
if (!window.jQuery) {
var e = document.createElement('script');
e.src = "https://code.jquery.com/jquery-3.2.1.min.js";
e.onload = function () {
jQuery.noConflict();
console.log('jQuery ' + jQuery.fn.jquery + ' injected.');
};
document... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Method 1:
```
if (window.jQuery) {
// jQuery is loaded
} else {
// jQuery is not loaded
}
```
Method 2:
```
if (typeof jQuery == 'undefined') {
// jQuery is not loaded
} else {
// jQuery is loaded
}
```
If jquery.js file is not loaded, we can force load it like so:
```
if (!window.jQuery) {... | Even though you may have a head appending it may not work in all browsers. This was the only method I found to work consistently.
```
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Old post but I made an good solution what is tested on serval places.
<https://github.com/CreativForm/Load-jQuery-if-it-is-not-already-loaded>
CODE:
```
(function(url, position, callback){
// default values
url = url || 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js';
position = positi... | ```
var f = ()=>{
if (!window.jQuery) {
var e = document.createElement('script');
e.src = "https://code.jquery.com/jquery-3.2.1.min.js";
e.onload = function () {
jQuery.noConflict();
console.log('jQuery ' + jQuery.fn.jquery + ' injected.');
};
document... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Try this :
```
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
```
This checks if jQuery is available or not, if not it will add one dynamically from path specified.
Ref: [Simulate an "include\_once" for jQuery](https://stackoverflow.com/questions/7887735/simulate-a... | I am using CDN for my project and as part of fallback handling, i was using below code,
```
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
if ((typeof jQuery == 'undefined')) {
docum... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Maybe something like this:
```
<script>
if(!window.jQuery)
{
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "path/to/jQuery";
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>
``` | I am using CDN for my project and as part of fallback handling, i was using below code,
```
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
if ((typeof jQuery == 'undefined')) {
docum... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | You can check if jQuery is loaded or not by many ways such as:
```
if (typeof jQuery == 'undefined') {
// jQuery IS NOT loaded, do stuff here.
}
```
```
if (typeof jQuery == 'function')
//or
if (typeof $== 'function')
```
```
if (jQuery) {
// This will throw an error in STRICT MODE if jQuery is not loa... | ```
<script>
if (typeof(jQuery) == 'undefined'){
document.write('<scr' + 'ipt type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></scr' + 'ipt>');
}
</script>
``` |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Method 1:
```
if (window.jQuery) {
// jQuery is loaded
} else {
// jQuery is not loaded
}
```
Method 2:
```
if (typeof jQuery == 'undefined') {
// jQuery is not loaded
} else {
// jQuery is loaded
}
```
If jquery.js file is not loaded, we can force load it like so:
```
if (!window.jQuery) {... | Old post but I made an good solution what is tested on serval places.
<https://github.com/CreativForm/Load-jQuery-if-it-is-not-already-loaded>
CODE:
```
(function(url, position, callback){
// default values
url = url || 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js';
position = positi... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Method 1:
```
if (window.jQuery) {
// jQuery is loaded
} else {
// jQuery is not loaded
}
```
Method 2:
```
if (typeof jQuery == 'undefined') {
// jQuery is not loaded
} else {
// jQuery is loaded
}
```
If jquery.js file is not loaded, we can force load it like so:
```
if (!window.jQuery) {... | Try this :
```
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
```
This checks if jQuery is available or not, if not it will add one dynamically from path specified.
Ref: [Simulate an "include\_once" for jQuery](https://stackoverflow.com/questions/7887735/simulate-a... |
1,828,237 | Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.
something like
```
if(!jQuery) {
//load jquery file
}
``` | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155337/"
] | Try this :
```
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
```
This checks if jQuery is available or not, if not it will add one dynamically from path specified.
Ref: [Simulate an "include\_once" for jQuery](https://stackoverflow.com/questions/7887735/simulate-a... | You can check if jQuery is loaded or not by many ways such as:
```
if (typeof jQuery == 'undefined') {
// jQuery IS NOT loaded, do stuff here.
}
```
```
if (typeof jQuery == 'function')
//or
if (typeof $== 'function')
```
```
if (jQuery) {
// This will throw an error in STRICT MODE if jQuery is not loa... |
66,892 | I can't understand how can I display all tags in my homepage?
There's a workable solution to display a product's tags in a product page with this code:
```
<?php
// instantiate the tags class for products
$_tags = new Mage_Tag_Block_Product_List();
?>
<!-- ProductTags: -->
<ul class="product-tags">
<?php foreach($... | 2015/05/06 | [
"https://magento.stackexchange.com/questions/66892",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/26000/"
] | Add this to the Content section of your hopepage:
```
{{block type="tag/all" name="tags_all" template="tag/popular.phtml"}}
``` | to get programmatically popular tag use this code
```
$tagmodel = Mage::getModel('tag/tag');
$collection = $tagmodel->getResourceCollection()
->addPopularity()
->load();
foreach($collection as $tag)
{
... |
66,892 | I can't understand how can I display all tags in my homepage?
There's a workable solution to display a product's tags in a product page with this code:
```
<?php
// instantiate the tags class for products
$_tags = new Mage_Tag_Block_Product_List();
?>
<!-- ProductTags: -->
<ul class="product-tags">
<?php foreach($... | 2015/05/06 | [
"https://magento.stackexchange.com/questions/66892",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/26000/"
] | Add this to the Content section of your hopepage:
```
{{block type="tag/all" name="tags_all" template="tag/popular.phtml"}}
``` | updated
```
$tag_model= Mage::getModel('tag/tag');
$tag_collection= $tag_model->getResourceCollection()
->addPopularity()
->addStatusFilter($model->getApprovedStatus())
->addProductFilter($ProductId)
->setFlag('relation', true)
... |
66,892 | I can't understand how can I display all tags in my homepage?
There's a workable solution to display a product's tags in a product page with this code:
```
<?php
// instantiate the tags class for products
$_tags = new Mage_Tag_Block_Product_List();
?>
<!-- ProductTags: -->
<ul class="product-tags">
<?php foreach($... | 2015/05/06 | [
"https://magento.stackexchange.com/questions/66892",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/26000/"
] | Add this to the Content section of your hopepage:
```
{{block type="tag/all" name="tags_all" template="tag/popular.phtml"}}
``` | I am giving this answer because the other answers are not working for me. I archived in the following way:
```
<?php $tagblockobj = Mage::getBlockSingleton('tag/all');?>
<?php if( sizeof($tagblockobj ->getTags()) > 0 ): ?>
<?php foreach($tagblockobj ->getTags() as $tag):?>
<a href="<?php echo $tag->getTaggedP... |
66,892 | I can't understand how can I display all tags in my homepage?
There's a workable solution to display a product's tags in a product page with this code:
```
<?php
// instantiate the tags class for products
$_tags = new Mage_Tag_Block_Product_List();
?>
<!-- ProductTags: -->
<ul class="product-tags">
<?php foreach($... | 2015/05/06 | [
"https://magento.stackexchange.com/questions/66892",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/26000/"
] | to get programmatically popular tag use this code
```
$tagmodel = Mage::getModel('tag/tag');
$collection = $tagmodel->getResourceCollection()
->addPopularity()
->load();
foreach($collection as $tag)
{
... | updated
```
$tag_model= Mage::getModel('tag/tag');
$tag_collection= $tag_model->getResourceCollection()
->addPopularity()
->addStatusFilter($model->getApprovedStatus())
->addProductFilter($ProductId)
->setFlag('relation', true)
... |
66,892 | I can't understand how can I display all tags in my homepage?
There's a workable solution to display a product's tags in a product page with this code:
```
<?php
// instantiate the tags class for products
$_tags = new Mage_Tag_Block_Product_List();
?>
<!-- ProductTags: -->
<ul class="product-tags">
<?php foreach($... | 2015/05/06 | [
"https://magento.stackexchange.com/questions/66892",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/26000/"
] | to get programmatically popular tag use this code
```
$tagmodel = Mage::getModel('tag/tag');
$collection = $tagmodel->getResourceCollection()
->addPopularity()
->load();
foreach($collection as $tag)
{
... | I am giving this answer because the other answers are not working for me. I archived in the following way:
```
<?php $tagblockobj = Mage::getBlockSingleton('tag/all');?>
<?php if( sizeof($tagblockobj ->getTags()) > 0 ): ?>
<?php foreach($tagblockobj ->getTags() as $tag):?>
<a href="<?php echo $tag->getTaggedP... |
17,504,436 | I'm trying to retrieve album artwork from the Last.FM API using JSON and jQuery Ajax, but I'm having trouble accessing the data structure, which looks like:
```
"image":[
{
"#text":"http:\/\/userserve-ak.last.fm\/serve\/34s\/82993237.png",
"size":"small"
},
{
"#text":"http:\/\/... | 2013/07/06 | [
"https://Stackoverflow.com/questions/17504436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/717633/"
] | Have you tried to use bracket notation (instead of *dot*) for the problematic `#text`
and accessing the `image`'s `[4]` array place before targeting the object key
```
albumArtURL = data.album.image[4]["#text"];
``` | ```
$.each(images.image, function (i, item) {
var myvar = "text: " + item['#text'] + " size: " + item.size
})
```
here is a working example: [fiddle](http://jsfiddle.net/kemalemin/G5gv2/) |
21,908,617 | I have a column of data in excel that appears as follows:
```
aast<space>1<space>
qusw<space>3<space>
umw<space>18<space>
arst<space>50<space>
```
I will like to remove the numbers to have just the following:
```
aast
qusw
umw
arst
```
I tried regexp in both excel and notepad2++ to get this done without any succe... | 2014/02/20 | [
"https://Stackoverflow.com/questions/21908617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | Instead remove what you don't need. Replace
```
[0-9 ]*
```
with nothing. | ```
(.*)\s[0-9]+\s
```
See it in action [here](http://rubular.com/r/Sdb5PwzeTB) |
21,908,617 | I have a column of data in excel that appears as follows:
```
aast<space>1<space>
qusw<space>3<space>
umw<space>18<space>
arst<space>50<space>
```
I will like to remove the numbers to have just the following:
```
aast
qusw
umw
arst
```
I tried regexp in both excel and notepad2++ to get this done without any succe... | 2014/02/20 | [
"https://Stackoverflow.com/questions/21908617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | Instead remove what you don't need. Replace
```
[0-9 ]*
```
with nothing. | try this:
```
String regex = "[^\\s0-9\\<\\>\\s]";
``` |
21,908,617 | I have a column of data in excel that appears as follows:
```
aast<space>1<space>
qusw<space>3<space>
umw<space>18<space>
arst<space>50<space>
```
I will like to remove the numbers to have just the following:
```
aast
qusw
umw
arst
```
I tried regexp in both excel and notepad2++ to get this done without any succe... | 2014/02/20 | [
"https://Stackoverflow.com/questions/21908617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | You might consider Text to Columns on that column with space as the delimiter and then just delete all columns but the first.
Or use a formula such as:
```
=LEFT(A1,FIND(" ",A1)-1)
``` | ```
(.*)\s[0-9]+\s
```
See it in action [here](http://rubular.com/r/Sdb5PwzeTB) |
21,908,617 | I have a column of data in excel that appears as follows:
```
aast<space>1<space>
qusw<space>3<space>
umw<space>18<space>
arst<space>50<space>
```
I will like to remove the numbers to have just the following:
```
aast
qusw
umw
arst
```
I tried regexp in both excel and notepad2++ to get this done without any succe... | 2014/02/20 | [
"https://Stackoverflow.com/questions/21908617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | You might consider Text to Columns on that column with space as the delimiter and then just delete all columns but the first.
Or use a formula such as:
```
=LEFT(A1,FIND(" ",A1)-1)
``` | try this:
```
String regex = "[^\\s0-9\\<\\>\\s]";
``` |
13,255,746 | I have a procedure that pulls data from my database and uses MSDB.DBO.sp\_send\_dbmail to send out e-mails. The procedure itself runs without a hitch when I use 'EXEC myprocedure'. But when I set up a job for the procedure, the job fails with the following error
>
> 'Error formating query, probably invalid parameter... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13255746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1423787/"
] | You can add values to it though.
From [MSDN ProcessStartInfo.EnvironmentVariables Property](http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.environmentvariables.aspx):
>
> Although you cannot set the EnvironmentVariables property, you can
> modify the StringDictionary returned by the pro... | You can set environment variables using the indexer:
```
process.StartInfo.EnvironmentVariables['name'] = value;
``` |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The basic flaw in the reasoning is that it assumes that each of the 12 *possible* outcomes are equally likely -- because without such an assumption "same number of outcomes" does not translate into "equal probability".
In many simple probability situations we can get a plausible "all outcomes are equally likely" assum... | As another way to look at this, it might be helpful to think of a situation where it would be appropriate to use your calculation.
Suppose the game is played as follows: the player, the game studio, and Monty each secretly choose a door and write their choice on a piece of paper. A judge looks at the papers, and if Mo... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | As another way to look at this, it might be helpful to think of a situation where it would be appropriate to use your calculation.
Suppose the game is played as follows: the player, the game studio, and Monty each secretly choose a door and write their choice on a piece of paper. A judge looks at the papers, and if Mo... | If you want a set of outcomes with equal probability,
you need to account somehow for the fact that when the
contestant chooses the prize door on the first guess,
Monty has a choice of which door to open.
This is best modeled as a random variable with two equally likely outcomes.
We might as well assume Monty flips a ... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The reason that your numbers come out like that is because there are two possible doors for Monty to open if the contestant has already picked the right answer, but only one possible door for Monty to open if the contestant has picked wrongly. In the "two possible doors" case, switching to either of the doors loses, bu... | As another way to look at this, it might be helpful to think of a situation where it would be appropriate to use your calculation.
Suppose the game is played as follows: the player, the game studio, and Monty each secretly choose a door and write their choice on a piece of paper. A judge looks at the papers, and if Mo... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | In my opinion the reason why the Monty Hall problem is confusing is because people make the solution unnecessarily complicated. I have a very simple solution that goes like this.
**The player would win by switching doors if and only if (s)he chose the wrong door initially, which happens 2/3 of the time.** | If you want a set of outcomes with equal probability,
you need to account somehow for the fact that when the
contestant chooses the prize door on the first guess,
Monty has a choice of which door to open.
This is best modeled as a random variable with two equally likely outcomes.
We might as well assume Monty flips a ... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The basic flaw in the reasoning is that it assumes that each of the 12 *possible* outcomes are equally likely -- because without such an assumption "same number of outcomes" does not translate into "equal probability".
In many simple probability situations we can get a plausible "all outcomes are equally likely" assum... | In my opinion the reason why the Monty Hall problem is confusing is because people make the solution unnecessarily complicated. I have a very simple solution that goes like this.
**The player would win by switching doors if and only if (s)he chose the wrong door initially, which happens 2/3 of the time.** |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The basic flaw in the reasoning is that it assumes that each of the 12 *possible* outcomes are equally likely -- because without such an assumption "same number of outcomes" does not translate into "equal probability".
In many simple probability situations we can get a plausible "all outcomes are equally likely" assum... | The reason that your numbers come out like that is because there are two possible doors for Monty to open if the contestant has already picked the right answer, but only one possible door for Monty to open if the contestant has picked wrongly. In the "two possible doors" case, switching to either of the doors loses, bu... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | Monty does not have three choices, but only one or two. Initially before Monty opens a door the probabilities are as you expect:
* You choose A, prize behind A: probability $\frac19$
* You choose A, prize behind B: probability $\frac19$
* You choose A, prize behind C: probability $\frac19$
* You choose B, prize behin... | If you want a set of outcomes with equal probability,
you need to account somehow for the fact that when the
contestant chooses the prize door on the first guess,
Monty has a choice of which door to open.
This is best modeled as a random variable with two equally likely outcomes.
We might as well assume Monty flips a ... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The basic flaw in the reasoning is that it assumes that each of the 12 *possible* outcomes are equally likely -- because without such an assumption "same number of outcomes" does not translate into "equal probability".
In many simple probability situations we can get a plausible "all outcomes are equally likely" assum... | If you want a set of outcomes with equal probability,
you need to account somehow for the fact that when the
contestant chooses the prize door on the first guess,
Monty has a choice of which door to open.
This is best modeled as a random variable with two equally likely outcomes.
We might as well assume Monty flips a ... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The reason that your numbers come out like that is because there are two possible doors for Monty to open if the contestant has already picked the right answer, but only one possible door for Monty to open if the contestant has picked wrongly. In the "two possible doors" case, switching to either of the doors loses, bu... | Monty does not have three choices, but only one or two. Initially before Monty opens a door the probabilities are as you expect:
* You choose A, prize behind A: probability $\frac19$
* You choose A, prize behind B: probability $\frac19$
* You choose A, prize behind C: probability $\frac19$
* You choose B, prize behin... |
1,089,291 | I still do not believe the "correct" solution to the Monty Hall Problem.
Here is my reasoning:
The player can pick from $1$ of $3$ doors.
The prize can be behind $1$ of $3$ doors.
Monty will open $1$ of $3$ doors.
$3 \times 3 \times 3 = 27$ possible sequences of events.
In $15$ of those possible events, Monty either... | 2015/01/03 | [
"https://math.stackexchange.com/questions/1089291",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/204475/"
] | The basic flaw in the reasoning is that it assumes that each of the 12 *possible* outcomes are equally likely -- because without such an assumption "same number of outcomes" does not translate into "equal probability".
In many simple probability situations we can get a plausible "all outcomes are equally likely" assum... | Monty does not have three choices, but only one or two. Initially before Monty opens a door the probabilities are as you expect:
* You choose A, prize behind A: probability $\frac19$
* You choose A, prize behind B: probability $\frac19$
* You choose A, prize behind C: probability $\frac19$
* You choose B, prize behin... |
46,599,894 | I faced a bug with Android Studio 3.0 Preview. When I plug the device, small useful checkbox is missing.
[](https://i.stack.imgur.com/EDtiV.png)
Does anybody know how to enable it? | 2017/10/06 | [
"https://Stackoverflow.com/questions/46599894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4135511/"
] | I had the same issue. You need to disable instant run in your android studio settings, follow below steps:
* Open the Settings or Preferences dialog.
* Navigate to Build, Execution, Deployment > Instant Run
* Uncheck the box next to Enable Instant Run
After that you will have this option and if you will enable instan... | Other possibilities for AS 3.0 (limited to your current project AFAICS):
* Select the `Use same device for future launches` option in your project through `Run -> Edit Configurations... -> General -> Deployment Target Options -> Use same device for future launches` (`Target` should be set to `Open Select Deployment Ta... |
23,134,527 | no need for answer unless you feel you want to contribute :)
So I feel stupid as hell I been banging my head against a wall with this for an hour...
but for the sake of your head ill explain the problem,
I had a mark-up that looks like this
```
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MainSearch.aspx.... | 2014/04/17 | [
"https://Stackoverflow.com/questions/23134527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047956/"
] | This is a before filter
```
class YourController
before_filter :filter_scopes, only: :index
def index
@campaigns = Campaign.send(params[:scope] || 'all')
end
private
def filter_scopes
params[:scope] = nil unless ['ended','active'].include?(params[:scope])
end
end
```
that way you are sure that ... | You can whitelist your scopes, like this:
```
@campaigns = if %w(ended active).include?(params[:scope])
Campaign.public_send(params[:scope])
else
Campaign.all
end
``` |
23,134,527 | no need for answer unless you feel you want to contribute :)
So I feel stupid as hell I been banging my head against a wall with this for an hour...
but for the sake of your head ill explain the problem,
I had a mark-up that looks like this
```
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MainSearch.aspx.... | 2014/04/17 | [
"https://Stackoverflow.com/questions/23134527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047956/"
] | You can whitelist your scopes, like this:
```
@campaigns = if %w(ended active).include?(params[:scope])
Campaign.public_send(params[:scope])
else
Campaign.all
end
``` | I think that it is too insecure and cryptic to leave the scope application to the user input.
I would do it as follows
```
def index
@campaigns = Campaign.all
if params[:scope] == 'ended'
@campaign = @campaign.ended
elsif params[:scope] == 'active'
@campaign = @campaign.active
end
end
``` |
23,134,527 | no need for answer unless you feel you want to contribute :)
So I feel stupid as hell I been banging my head against a wall with this for an hour...
but for the sake of your head ill explain the problem,
I had a mark-up that looks like this
```
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MainSearch.aspx.... | 2014/04/17 | [
"https://Stackoverflow.com/questions/23134527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1047956/"
] | This is a before filter
```
class YourController
before_filter :filter_scopes, only: :index
def index
@campaigns = Campaign.send(params[:scope] || 'all')
end
private
def filter_scopes
params[:scope] = nil unless ['ended','active'].include?(params[:scope])
end
end
```
that way you are sure that ... | I think that it is too insecure and cryptic to leave the scope application to the user input.
I would do it as follows
```
def index
@campaigns = Campaign.all
if params[:scope] == 'ended'
@campaign = @campaign.ended
elsif params[:scope] == 'active'
@campaign = @campaign.active
end
end
``` |
8,278,293 | When Browser completes formatting a page using CSS and HTML etc.. Where will be all the output will be stored..? Is there any virtual location where it will store..
Can we access that content in the background..? | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008575/"
] | The text content will be stored in the context of the HTML structure, which is represented in memory as a mutable programming object known as the Document Object Model and accessed via reference in JavaScript to the "document" named object. | To add to austincheneys accurate summary (+1) this page explains the text nodes you content is in within the DOM he refers to: [w3C - Traversing the DOM](http://www.w3.org/community/webed/wiki/Traversing_the_DOM)
Particularly, look at the diagram halfway down the page. |
8,278,293 | When Browser completes formatting a page using CSS and HTML etc.. Where will be all the output will be stored..? Is there any virtual location where it will store..
Can we access that content in the background..? | 2011/11/26 | [
"https://Stackoverflow.com/questions/8278293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008575/"
] | It's stored in the DOM, which is the Document Object Model, which is a cross-platform and language agnostic convention that stores these objects that austincheney spoke about, which can then be manipulated by a scripting language like JavaScript.
The Wikipedia entry is a good place to start reading about it: <http://e... | To add to austincheneys accurate summary (+1) this page explains the text nodes you content is in within the DOM he refers to: [w3C - Traversing the DOM](http://www.w3.org/community/webed/wiki/Traversing_the_DOM)
Particularly, look at the diagram halfway down the page. |
191,255 | I'd be interested to receive suggestions about when to use "**factor scores**" over plain **sum of scores** when constructing scales. I.e. "Refined" over "non-refined" methods of scoring a factor. From DiStefano et al. (2009; [pdf](http://pareonline.net/pdf/v14n20.pdf)), emphasis added:
>
> There are two main classes... | 2016/01/18 | [
"https://stats.stackexchange.com/questions/191255",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/23607/"
] | I've been wrestling with this idea myself in some current projects. I think you need to ask yourself what is being estimated here. If a one-factor model fits, then the factor scores estimate the latent factor. The straight sum or mean of your manifest variables estimates something else, unless every observation loads e... | Summing or averaging items loaded by the common factor is a traditional way to reckon the construst score (the construct representing tha factor). It is a simplest version of the "coarse method" of [computing factor scores](https://stats.stackexchange.com/a/126985/3277); the method's main point stands in using *factor ... |
596,365 | So I am supposed to add some condition to the original proposition to make it true but I do not know what condition I need to add.
Original Proposition: If $x$ and $y$ are real numbers and $xy>0$, then:
$$(x+y)/2≥√xy$$
Proof: Let us assume the hypothesis to be true. Adding some condition to the original proposition w... | 2013/12/07 | [
"https://math.stackexchange.com/questions/596365",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/111702/"
] | You don't actually need that $x-y \geq 0$, as $(x-y)^2 \geq 0$ no matter the value of $x-y$. What you *do* need is that $x+y \geq 0$, as when you take the square root in the second to last step you need to know that $x+y$ is the positive one (and not $-(x+y)$).
When $xy > 0$ this is equivalent to $x,y \geq 0$. | One: (both $x,y$ must be positive)
Notice $$( \sqrt{x} - \sqrt{y})^2 = x - 2 \sqrt{xy} + y \geq 0 \implies \frac{x+y}{2} \geq \sqrt{xy} $$
Another solution follows from young inequality: If $x,y$ are positive and $m +n = 1 $, then
$$ x^my^n \leq xm + yn $$
Now, if we put $m = n = \frac{1}{2} $, then
$$ x^{1/2}y^{1... |
198,209 | So I was just wondering about this as I finished reading about Michelson-Morley's experiment which disproved the ether theory. My question is since the Universe is constantly expanding and that too with an accelerated rate does it somehow effect the experimental conditions? If so I wanna know how because I'm unable to ... | 2015/08/07 | [
"https://physics.stackexchange.com/questions/198209",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/44487/"
] | The expansion of the Universe has no effect on the local speed of light. Any local measurement of $c$ will yield $c$, and $c$ won't change.
There is one thing that often causes confusion about the speed of light or faster-than-light travel. A photon moving in an expanding space-time *appears* to move at an average spe... | The Michelson-Morley experiment indicated (contrarily to it's original intent), that the speed of light perceived by an observer is **not** dependent on their speed relative to anything.
Along these lines, our movement in space with respect to any arbitrary point has no impact on the speed of light measured in the ear... |
198,209 | So I was just wondering about this as I finished reading about Michelson-Morley's experiment which disproved the ether theory. My question is since the Universe is constantly expanding and that too with an accelerated rate does it somehow effect the experimental conditions? If so I wanna know how because I'm unable to ... | 2015/08/07 | [
"https://physics.stackexchange.com/questions/198209",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/44487/"
] | The expansion of the Universe has no effect on the local speed of light. Any local measurement of $c$ will yield $c$, and $c$ won't change.
There is one thing that often causes confusion about the speed of light or faster-than-light travel. A photon moving in an expanding space-time *appears* to move at an average spe... | >
> Does the accelerated rate of expansion of the Universe have any effect on the velocity of light?
>
>
>
This is the subject of some debate. Check out the Wikipedia [Variable Speed of Light](https://en.wikipedia.org/wiki/Variable_speed_of_light#Modern_VSL_theories_as_an_alternative_to_cosmic_inflation) article: ... |
1,804,097 | I'd like to understand the SQL Server 2008 Filtered Index Feature.
How does the Database Engine deal wih this concept ? And how is it going to help me get faster results than standard indexes while querying large tables ?
Can anybody help me on this ?
Thanks. | 2009/11/26 | [
"https://Stackoverflow.com/questions/1804097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/215604/"
] | It's WHERE clause on your index.
My real life plans for a million row table:
* I need an index on a column in a table, but 90% of the values are NULL. I need the index for the 10% non-null, but the index is bloated with the 90% NULL. So I add filter and save space.
* I want to unique the same column (eq unique on NON... | The easiest way I find to conceptualise the filtered index is an index with a constraint upon it, which only allows certain values into the index.
If your query is asking for values which all fall within the constraint then the engine knows it can use the filtered index instead of reverting to another index / underlyi... |
1,015,554 | **The Question**

**My Problem**
Part a is straight forward, just $C(35,32)$. I'm having a little difficulty with the restrictions and understanding what they mean. $x\_1 > 0$ means we shouldn't have any solutions of the form $(0 + 32)$? If that's t... | 2014/11/10 | [
"https://math.stackexchange.com/questions/1015554",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/159628/"
] | For part (b), $x\_i > 0$ for all $i$, let $y\_i = x\_i - 1$. Then the problem is equivalent to problem (a), only with a sum of 28 instead of 32 -- the answer is $C(31, 28) == C(31,3)$.
For part (c) let $y\_i = x\_i-5$ for $i\in \left\{ 1,2 \right\} $ and $y\_i = x\_i-7 $ otherwise. Then you have problem (a) again, wit... | For part f) we can use generating functions. The one that models f is
$$G(x)=\left(x+x^2+x^3+...+\right)^3 \left(x+x^2+...+x^{25}\right)$$
these are useful because they reduce combinatoric problems to computational ones. The above gf can be written:
$$g=\left(\frac{x}{1-x}\right)^3 \cdot \frac{ \left(x-x^{26}\right)... |
1,015,554 | **The Question**

**My Problem**
Part a is straight forward, just $C(35,32)$. I'm having a little difficulty with the restrictions and understanding what they mean. $x\_1 > 0$ means we shouldn't have any solutions of the form $(0 + 32)$? If that's t... | 2014/11/10 | [
"https://math.stackexchange.com/questions/1015554",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/159628/"
] | For part (b), $x\_i > 0$ for all $i$, let $y\_i = x\_i - 1$. Then the problem is equivalent to problem (a), only with a sum of 28 instead of 32 -- the answer is $C(31, 28) == C(31,3)$.
For part (c) let $y\_i = x\_i-5$ for $i\in \left\{ 1,2 \right\} $ and $y\_i = x\_i-7 $ otherwise. Then you have problem (a) again, wit... | $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
\newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
\newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
\newcommand{\dd}{{\rm d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{... |
1,015,554 | **The Question**

**My Problem**
Part a is straight forward, just $C(35,32)$. I'm having a little difficulty with the restrictions and understanding what they mean. $x\_1 > 0$ means we shouldn't have any solutions of the form $(0 + 32)$? If that's t... | 2014/11/10 | [
"https://math.stackexchange.com/questions/1015554",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/159628/"
] | $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
\newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
\newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
\newcommand{\dd}{{\rm d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{... | For part f) we can use generating functions. The one that models f is
$$G(x)=\left(x+x^2+x^3+...+\right)^3 \left(x+x^2+...+x^{25}\right)$$
these are useful because they reduce combinatoric problems to computational ones. The above gf can be written:
$$g=\left(\frac{x}{1-x}\right)^3 \cdot \frac{ \left(x-x^{26}\right)... |
3,938,623 | Solve differential equation $(y'')^2-5y'+6=0$
For there is no "x" in equation, I made substitution $y'=p(y)$ and $y''=p'p$
$(p'p)^2-5p+6=0$
What can I do with the squared member? | 2020/12/07 | [
"https://math.stackexchange.com/questions/3938623",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/411579/"
] | You have to use
$$ L\bigg\{\frac{f(t)}{t}\bigg\}=\int\_s^\infty F(\tau)d\tau $$
twice, where $F(s)=L\{f(t)\}$.
Let $f(t)=\frac{1-\cos t}{t}$ and then
\begin{eqnarray}
F(s)=L\{f(t)\}&=&\int\_s^\infty L\{1-\cos t\}(\tau)d\tau=\int\_s^\infty\bigg(\frac1\tau-\frac{\tau}{\tau^2+1}\bigg)d\tau\\
&=&\frac12\ln\bigg(\frac{\tau^... | Well, first thing I thaught of was to use the fact that : $$ \left(\forall x\in\mathbb{R}^{\*}\right),\ \frac{1-\cos{x}}{x^{2}}=\int\_{0}^{1}{\left(1-y\right)\cos{\left(xy\right)}\,\mathrm{d}y} $$
Then, with Fubini's theorem will, I shall find the result.
Let $ s>0 $, we have : \begin{aligned}\int\_{0}^{+\infty}{\mat... |
20,092,846 | What i want to do is search for a text/words within a long text like:
```
$txt = 'text das text dss text good text text bad text';
```
and i want to search for `good text` in this `$txt` without using PHP functions like `stripos()` or others, i want to use just `for` in PHP and make minimum loops as possible.
How c... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20092846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436998/"
] | ```
<?php
$txt = 'text das text dss text good text text bad text';
$search = 'good text';
$pos = -1;
$i = 0;
while (isset($txt{$i})) {
$j = 0;
$wrong = false;
while (isset($search{$j})) {
if ($search{$j} != $txt{$i + $j}) {
$wrong = true;
break;
}
$j++;
... | You can use `preg_match` here. do you want example related to this ? |
20,092,846 | What i want to do is search for a text/words within a long text like:
```
$txt = 'text das text dss text good text text bad text';
```
and i want to search for `good text` in this `$txt` without using PHP functions like `stripos()` or others, i want to use just `for` in PHP and make minimum loops as possible.
How c... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20092846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436998/"
] | ```
<?php
function findRemaining($needle, $haystack) {
$result = '';
for ($i = 0, $found = false; isset($haystack[$i]); $i += 1) {
if (!$found) {
for ($j = 0; isset($haystack[$i + $j], $needle[$j]); $j += 1) {
if ($haystack[$i + $j] !== $needle[$j]) {
continue 2;
}
}
... | ```
<?php
$txt = 'text das text dss text good text text bad text';
$search = 'good text';
$pos = -1;
$i = 0;
while (isset($txt{$i})) {
$j = 0;
$wrong = false;
while (isset($search{$j})) {
if ($search{$j} != $txt{$i + $j}) {
$wrong = true;
break;
}
$j++;
... |
20,092,846 | What i want to do is search for a text/words within a long text like:
```
$txt = 'text das text dss text good text text bad text';
```
and i want to search for `good text` in this `$txt` without using PHP functions like `stripos()` or others, i want to use just `for` in PHP and make minimum loops as possible.
How c... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20092846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436998/"
] | Try this one and let me know...
```
$txt = "text das text dss text good text text bad text";
function search_string($word, $text){
$parts = explode(" ", $text);
$result = array();
$word = strtolower($word);
foreach($parts as $v){
if(strpos(strtolower($v), $word) !== false){
$result[] = $v;
}
}
if(!empty... | You can use `preg_match` here. do you want example related to this ? |
20,092,846 | What i want to do is search for a text/words within a long text like:
```
$txt = 'text das text dss text good text text bad text';
```
and i want to search for `good text` in this `$txt` without using PHP functions like `stripos()` or others, i want to use just `for` in PHP and make minimum loops as possible.
How c... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20092846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436998/"
] | ```
<?php
function findRemaining($needle, $haystack) {
$result = '';
for ($i = 0, $found = false; isset($haystack[$i]); $i += 1) {
if (!$found) {
for ($j = 0; isset($haystack[$i + $j], $needle[$j]); $j += 1) {
if ($haystack[$i + $j] !== $needle[$j]) {
continue 2;
}
}
... | You can use `preg_match` here. do you want example related to this ? |
20,092,846 | What i want to do is search for a text/words within a long text like:
```
$txt = 'text das text dss text good text text bad text';
```
and i want to search for `good text` in this `$txt` without using PHP functions like `stripos()` or others, i want to use just `for` in PHP and make minimum loops as possible.
How c... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20092846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436998/"
] | ```
<?php
function findRemaining($needle, $haystack) {
$result = '';
for ($i = 0, $found = false; isset($haystack[$i]); $i += 1) {
if (!$found) {
for ($j = 0; isset($haystack[$i + $j], $needle[$j]); $j += 1) {
if ($haystack[$i + $j] !== $needle[$j]) {
continue 2;
}
}
... | Try this one and let me know...
```
$txt = "text das text dss text good text text bad text";
function search_string($word, $text){
$parts = explode(" ", $text);
$result = array();
$word = strtolower($word);
foreach($parts as $v){
if(strpos(strtolower($v), $word) !== false){
$result[] = $v;
}
}
if(!empty... |
1,552,926 | For positive reals $a,b,c$, with $abc=1$, prove that $$\frac{a^3+1}{b^2+1}+ \frac{b^3+1}{c^2+1}+\frac{c^3+1}{a^2+1} \geq 3$$ I tried the substitution $x/y,y/z,z/x$, but it didn't give me anything. What else to do? Thanks. | 2015/11/30 | [
"https://math.stackexchange.com/questions/1552926",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | By re-arrangement inequality, we have
$$\sum\_{cyc} \frac{a^3+1}{b^2+1} \ge \sum\_{cyc} \frac{a^3+1}{a^2+1}$$
So it is enough to show that for positive $x$, the function
$$f(x) = \frac{x^3+1}{x^2+1}-1-\frac12 \log x \ge 0$$
as the inequality is equivalent to $f(a)+f(b)+f(c) \ge 0$.
From $\displaystyle f'(x) = (x-1)\... | There is already a full and great answer. This is only an alternative
using AM-GM instead of the rearrangement inequality:
From the AM-GM inequality we have
$$
\frac 13 \left(\frac{a^3+1}{b^2+1}+ \frac{b^3+1}{c^2+1}+\frac{c^3+1}{a^2+1} \right) \ge
\left(\frac{a^3+1}{b^2+1} \cdot \frac{b^3+1}{c^2+1} \cdot \frac{c^3+1}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.