qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `for..in` is not designed to iterate over Arrays. Use a C-style for loop instead.
Reference: [MDC](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in#Description) | The `for .. in` loop in Javascript iterates through the *properties* of the object. In Javascript, property names are strings and arrays are just objects with a bunch of properties that happen to look like numbers. |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It's because you're looping through the array using `for...in` which is generally used for looping over properties of objects. The javascript engine is probably casting to a string because the string type is suitable for names of object properties.
Try this more traditional approach:
```
stuff = [];
stuff[0] = 3;
fo... | The `for .. in` loop in Javascript iterates through the *properties* of the object. In Javascript, property names are strings and arrays are just objects with a bunch of properties that happen to look like numbers. |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `for..in` is not designed to iterate over Arrays. Use a C-style for loop instead.
Reference: [MDC](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in#Description) | The `for...in` statement should be used to iterate over *object properties*, for Arrays use a simple `for` loop:
```
var stuff = [];
stuff.push(3);
for(var i = 0; i < stuff.length; i++) {
alert(stuff[i]);
}
```
Why shouldn't use `for...in` with arrays?
1. It crawls up the prototype chain, it will iterate over pr... |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It's because you're looping through the array using `for...in` which is generally used for looping over properties of objects. The javascript engine is probably casting to a string because the string type is suitable for names of object properties.
Try this more traditional approach:
```
stuff = [];
stuff[0] = 3;
fo... | `for..in` is not designed to iterate over Arrays. Use a C-style for loop instead.
Reference: [MDC](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in#Description) |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It's because you're looping through the array using `for...in` which is generally used for looping over properties of objects. The javascript engine is probably casting to a string because the string type is suitable for names of object properties.
Try this more traditional approach:
```
stuff = [];
stuff[0] = 3;
fo... | Avoid for-in in [performance-critical](http://dev.opera.com/articles/view/efficient-javascript/?page=2) functions.
* `The for-in loop requires the script engine to build a list of all the enumerable properties`, and check for duplicates in that list, before it can start the enumeration.
* `The for-in loop breaks when ... |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The `for .. in` loop in Javascript iterates through the *properties* of the object. In Javascript, property names are strings and arrays are just objects with a bunch of properties that happen to look like numbers. | The problem is that it is very easy in JavaScript to switch to associative arrays, which are in fact not arrays but objects. The `for..in` loop however works on objects, which indices are strings. |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The `for...in` statement should be used to iterate over *object properties*, for Arrays use a simple `for` loop:
```
var stuff = [];
stuff.push(3);
for(var i = 0; i < stuff.length; i++) {
alert(stuff[i]);
}
```
Why shouldn't use `for...in` with arrays?
1. It crawls up the prototype chain, it will iterate over pr... | The problem is that it is very easy in JavaScript to switch to associative arrays, which are in fact not arrays but objects. The `for..in` loop however works on objects, which indices are strings. |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It's because you're looping through the array using `for...in` which is generally used for looping over properties of objects. The javascript engine is probably casting to a string because the string type is suitable for names of object properties.
Try this more traditional approach:
```
stuff = [];
stuff[0] = 3;
fo... | The `for...in` statement should be used to iterate over *object properties*, for Arrays use a simple `for` loop:
```
var stuff = [];
stuff.push(3);
for(var i = 0; i < stuff.length; i++) {
alert(stuff[i]);
}
```
Why shouldn't use `for...in` with arrays?
1. It crawls up the prototype chain, it will iterate over pr... |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `for..in` is not designed to iterate over Arrays. Use a C-style for loop instead.
Reference: [MDC](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in#Description) | Avoid for-in in [performance-critical](http://dev.opera.com/articles/view/efficient-javascript/?page=2) functions.
* `The for-in loop requires the script engine to build a list of all the enumerable properties`, and check for duplicates in that list, before it can start the enumeration.
* `The for-in loop breaks when ... |
1,886,179 | This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number.
```
stuff = [];
stuff[0] = 3;
for(var x in stuff) {
alert(typeof x);
}
``` | 2009/12/11 | [
"https://Stackoverflow.com/questions/1886179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Avoid for-in in [performance-critical](http://dev.opera.com/articles/view/efficient-javascript/?page=2) functions.
* `The for-in loop requires the script engine to build a list of all the enumerable properties`, and check for duplicates in that list, before it can start the enumeration.
* `The for-in loop breaks when ... | The problem is that it is very easy in JavaScript to switch to associative arrays, which are in fact not arrays but objects. The `for..in` loop however works on objects, which indices are strings. |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | I went to this [page](https://launchpad.net/~c-korn/+archive/ppa/+packages) and downloaded the `xautoclick_0.20-1~ppa1_amd64.deb (14.3 KiB)`
and it works great :D

Thanks to Kat Amsterdam for finding xautoclick | In **Lucid 10.04 LTS**
1. Open Ubuntu Software Center
2. In the search box, type in autoclick
3. Download xautoclick
For **Precise 12.04LTS** the package has been removed from the Ubuntu Repositories and is only available via GetDeb.
[xautoclick instructions for install in precise](http://www.ubuntuupdates.org/ppa/g... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | In **Lucid 10.04 LTS**
1. Open Ubuntu Software Center
2. In the search box, type in autoclick
3. Download xautoclick
For **Precise 12.04LTS** the package has been removed from the Ubuntu Repositories and is only available via GetDeb.
[xautoclick instructions for install in precise](http://www.ubuntuupdates.org/ppa/g... | For even more automation you can use [sikuli](http://sikuli.org/).
Sikuli has integrated tool that allows you to very simply write any form of interaction (mouse clicking or keyboard) by visual processing where is what on screen.
You simply select where you want your click to occur by visually selecting screen part... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | Edit: `xdotool click --delay 5000 --repeat 200 1`
For 200 clicks with mouse
---
Open terminal, install xdotool
```
sudo apt-get install xdotool
```
Also, open the window you want to click side by side with terminal. Select terminal (as active window) and **move the mouse over the point where you want to click**. ... | In **Lucid 10.04 LTS**
1. Open Ubuntu Software Center
2. In the search box, type in autoclick
3. Download xautoclick
For **Precise 12.04LTS** the package has been removed from the Ubuntu Repositories and is only available via GetDeb.
[xautoclick instructions for install in precise](http://www.ubuntuupdates.org/ppa/g... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | I went to this [page](https://launchpad.net/~c-korn/+archive/ppa/+packages) and downloaded the `xautoclick_0.20-1~ppa1_amd64.deb (14.3 KiB)`
and it works great :D

Thanks to Kat Amsterdam for finding xautoclick | For even more automation you can use [sikuli](http://sikuli.org/).
Sikuli has integrated tool that allows you to very simply write any form of interaction (mouse clicking or keyboard) by visual processing where is what on screen.
You simply select where you want your click to occur by visually selecting screen part... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | Edit: `xdotool click --delay 5000 --repeat 200 1`
For 200 clicks with mouse
---
Open terminal, install xdotool
```
sudo apt-get install xdotool
```
Also, open the window you want to click side by side with terminal. Select terminal (as active window) and **move the mouse over the point where you want to click**. ... | I went to this [page](https://launchpad.net/~c-korn/+archive/ppa/+packages) and downloaded the `xautoclick_0.20-1~ppa1_amd64.deb (14.3 KiB)`
and it works great :D

Thanks to Kat Amsterdam for finding xautoclick |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | I went to this [page](https://launchpad.net/~c-korn/+archive/ppa/+packages) and downloaded the `xautoclick_0.20-1~ppa1_amd64.deb (14.3 KiB)`
and it works great :D

Thanks to Kat Amsterdam for finding xautoclick | With xdotool installed: (`apt-get install xdotool` (As root or with `sudo`))
This will click in the current mouse position every 5 seconds for 100000 times (That is somewhere between 5 and 6 days...)
```bsh
xdotool click --delay 5000 --repeat 100000 1 # (assuming the mouse is left where it needs to click).
```
To c... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | Edit: `xdotool click --delay 5000 --repeat 200 1`
For 200 clicks with mouse
---
Open terminal, install xdotool
```
sudo apt-get install xdotool
```
Also, open the window you want to click side by side with terminal. Select terminal (as active window) and **move the mouse over the point where you want to click**. ... | For even more automation you can use [sikuli](http://sikuli.org/).
Sikuli has integrated tool that allows you to very simply write any form of interaction (mouse clicking or keyboard) by visual processing where is what on screen.
You simply select where you want your click to occur by visually selecting screen part... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | With xdotool installed: (`apt-get install xdotool` (As root or with `sudo`))
This will click in the current mouse position every 5 seconds for 100000 times (That is somewhere between 5 and 6 days...)
```bsh
xdotool click --delay 5000 --repeat 100000 1 # (assuming the mouse is left where it needs to click).
```
To c... | For even more automation you can use [sikuli](http://sikuli.org/).
Sikuli has integrated tool that allows you to very simply write any form of interaction (mouse clicking or keyboard) by visual processing where is what on screen.
You simply select where you want your click to occur by visually selecting screen part... |
179,581 | I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less? | 2012/08/23 | [
"https://askubuntu.com/questions/179581",
"https://askubuntu.com",
"https://askubuntu.com/users/34385/"
] | Edit: `xdotool click --delay 5000 --repeat 200 1`
For 200 clicks with mouse
---
Open terminal, install xdotool
```
sudo apt-get install xdotool
```
Also, open the window you want to click side by side with terminal. Select terminal (as active window) and **move the mouse over the point where you want to click**. ... | With xdotool installed: (`apt-get install xdotool` (As root or with `sudo`))
This will click in the current mouse position every 5 seconds for 100000 times (That is somewhere between 5 and 6 days...)
```bsh
xdotool click --delay 5000 --repeat 100000 1 # (assuming the mouse is left where it needs to click).
```
To c... |
21,316,746 | Can i paint with graphics g on a Jpanel and if i can how does it work?
```
JPanel Game = new JPanel();
Game.setLayout(null);
Game.setLocation(0,0);
Game.setSize(500,700);
Game.setBackground(Color.WHITE);
Game.setBorder(BorderFactory.createLineBorder(Color.black));
```
how can i add paintcompo... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21316746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3212504/"
] | Yes, for custom painting you have to subclass your `JPanel` then you have to override `paintComponent` calling in first line `super.paintComponent(..)`.
Example :
```
JPanel game = new JPanel(){
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
//custom painting he... | If you want to implement your own custom painting on a component you will have to make your own class which extends that component. You will start with something like
```
public class MyPanel extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
//Add your custom painti... |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | >
> **ngValue**
>
>
> Binds the given expression to the value of or input[radio], so that when the element is selected, the ngModel of that element is set to the bound value.
>
>
>
You can take a look in this [documentation](https://docs.angularjs.org/api/ng/directive/ngValue).
So basically, the one you're doin... | Just assign one variable to another:
```
// in the controller
$scope.CopyDisplayName = $scope.DisplayName;
```
If you need to keep them in sync (and for some reason, you don't want to just use the same variable), then you can keep them updated via `ng-change`:
```
<input type="Text" ng-model="DisplayName" ng-change... |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | Just assign one variable to another:
```
// in the controller
$scope.CopyDisplayName = $scope.DisplayName;
```
If you need to keep them in sync (and for some reason, you don't want to just use the same variable), then you can keep them updated via `ng-change`:
```
<input type="Text" ng-model="DisplayName" ng-change... | You can add `$watch` on `DisplayName` as:
```
$scope.$watch('DisplayName',function(newValue, oldValue){
console.log(newValue +":"+oldValue)
$scope.CopyDisplayName = newValue;
});
``` |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | Just assign one variable to another:
```
// in the controller
$scope.CopyDisplayName = $scope.DisplayName;
```
If you need to keep them in sync (and for some reason, you don't want to just use the same variable), then you can keep them updated via `ng-change`:
```
<input type="Text" ng-model="DisplayName" ng-change... | To have copy updated you need copy value by reference. For that you need to wrap `displayName` to object:
`$scope.model = {DisplayName: 'val'};` and make a copy of it: `$scope.modelCopy = $scope.model;`
```
<input type="Text" ng-model="model.DisplayName" ng-disabled="true" />
<input type="Text" ng-model="modelCopy.... |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | Just assign one variable to another:
```
// in the controller
$scope.CopyDisplayName = $scope.DisplayName;
```
If you need to keep them in sync (and for some reason, you don't want to just use the same variable), then you can keep them updated via `ng-change`:
```
<input type="Text" ng-model="DisplayName" ng-change... | what you can do in controller is watch the model and copy that value whenever it is changed($watch will do that for you) you dont need ngChange on the HTML.
```
$scope.$watch('displayName', function() {
$scope.copyDisplayName = $scope.displayName;
});
``` |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | >
> **ngValue**
>
>
> Binds the given expression to the value of or input[radio], so that when the element is selected, the ngModel of that element is set to the bound value.
>
>
>
You can take a look in this [documentation](https://docs.angularjs.org/api/ng/directive/ngValue).
So basically, the one you're doin... | You can add `$watch` on `DisplayName` as:
```
$scope.$watch('DisplayName',function(newValue, oldValue){
console.log(newValue +":"+oldValue)
$scope.CopyDisplayName = newValue;
});
``` |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | >
> **ngValue**
>
>
> Binds the given expression to the value of or input[radio], so that when the element is selected, the ngModel of that element is set to the bound value.
>
>
>
You can take a look in this [documentation](https://docs.angularjs.org/api/ng/directive/ngValue).
So basically, the one you're doin... | To have copy updated you need copy value by reference. For that you need to wrap `displayName` to object:
`$scope.model = {DisplayName: 'val'};` and make a copy of it: `$scope.modelCopy = $scope.model;`
```
<input type="Text" ng-model="model.DisplayName" ng-disabled="true" />
<input type="Text" ng-model="modelCopy.... |
32,581,652 | I'm having an issue on updating or assigning the value or data into the model using ng-value.
I would like to copy any values in the DisplayName model to CopyDisplayName and using below directives i was able to do that, But the problem is the model CopyDisplayName doesn't have any value when I submit my changes. It ca... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32581652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4184405/"
] | >
> **ngValue**
>
>
> Binds the given expression to the value of or input[radio], so that when the element is selected, the ngModel of that element is set to the bound value.
>
>
>
You can take a look in this [documentation](https://docs.angularjs.org/api/ng/directive/ngValue).
So basically, the one you're doin... | what you can do in controller is watch the model and copy that value whenever it is changed($watch will do that for you) you dont need ngChange on the HTML.
```
$scope.$watch('displayName', function() {
$scope.copyDisplayName = $scope.displayName;
});
``` |
34,547,581 | I have a multi-module Maven project with 2 Spring Boot applications
parent
* fooApp
* barApp
* test
How to set up a test where you can load separate spring boot applications, each with its own configuration context, in the same process.
```
public abstract class AbstractIntegrationTest {//test module
protected... | 2015/12/31 | [
"https://Stackoverflow.com/questions/34547581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1158626/"
] | I agree with @rainerhahnekamp who said that what you are trying to achieve is more like a system/integration test.
However if you still want to do your test this way, I think it's still doable.
**First, one important things to know** :
Importing both `fooApp` and `barApp` project inside `test` project will make co... | Given two packages com.foo.module1, and com.foo.module2 you have to create a Configuration class per package.
For example for module1:
```
@SpringBootApplication public class Config1 {}
```
If you want to run the application by using only Spring beans of a single package you can do that by using the SpringApplicatio... |
34,547,581 | I have a multi-module Maven project with 2 Spring Boot applications
parent
* fooApp
* barApp
* test
How to set up a test where you can load separate spring boot applications, each with its own configuration context, in the same process.
```
public abstract class AbstractIntegrationTest {//test module
protected... | 2015/12/31 | [
"https://Stackoverflow.com/questions/34547581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1158626/"
] | YOU need to configure `@ContextConfiguration` to point both apps | Given two packages com.foo.module1, and com.foo.module2 you have to create a Configuration class per package.
For example for module1:
```
@SpringBootApplication public class Config1 {}
```
If you want to run the application by using only Spring beans of a single package you can do that by using the SpringApplicatio... |
34,547,581 | I have a multi-module Maven project with 2 Spring Boot applications
parent
* fooApp
* barApp
* test
How to set up a test where you can load separate spring boot applications, each with its own configuration context, in the same process.
```
public abstract class AbstractIntegrationTest {//test module
protected... | 2015/12/31 | [
"https://Stackoverflow.com/questions/34547581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1158626/"
] | I agree with @rainerhahnekamp who said that what you are trying to achieve is more like a system/integration test.
However if you still want to do your test this way, I think it's still doable.
**First, one important things to know** :
Importing both `fooApp` and `barApp` project inside `test` project will make co... | YOU need to configure `@ContextConfiguration` to point both apps |
36,582,425 | Is this the only possible way of using RxJava's `compose` with `ThreadTransformer` in Kotlin? I just don't like the `<MyType>` part in `compose` function. Is it possible to omit it?
```
override fun call(): Observable<MyType> {
return Observable.just(getData())
.compose(threadTransformer.applySchedulers... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36582425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/397991/"
] | `Observable.compose` is a workaround for the lack of extension functions in Java. There is no need to use `Observable.compose` in Kotlin because it supports extension functions out of the box:
```
// default schedulers
fun <T> Observable<T>.applySchedulers(): Observable<T> {
return subscribeOn(Schedulers.computation... | Based on Vladimir Mironov's answer. Extend this to your needs:
```
//Observable
fun <T> Observable<T>.applyIoScheduler() = applyScheduler(Schedulers.io())
fun <T> Observable<T>.applyComputationScheduler() = applyScheduler(Schedulers.computation())
private fun <T> Observable<T>.applyScheduler(scheduler: Scheduler) =
... |
54,289,014 | I know about the distinction between the two kinds of variables in GNU Make.
I am currently writing a build system where certain variables are defined in sub directories (e.g., VERSION). To make the life simpler for authors of subdirectories, I do not want to force them to make their variables globally unique. I also ... | 2019/01/21 | [
"https://Stackoverflow.com/questions/54289014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3031069/"
] | It looks as if you simply want [target-specific variables](https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html),
e.g.
**Makefile**
```
.PHONY: Bar test2
Bar: FOO := Bar
Bar:
@echo $(FOO)
test2: FOO := Definitely not Bar
test2: Bar
@echo $(FOO)
```
which runs like:
```
$ make test2... | You can write some nicely functional code (pun intended) using `$(eval …)`. You get to write closures, and decide what gets expanded when.
Consider this variable:
```
define rule =
PHONY: ${FOO}
${FOO}:
@echo $$@ ${FOO}
endef
```
Nothing strange here. But look what happens when we pass it to *eval*:
```
FO... |
40,521,763 | I have to choose image either from Gallery or capture from Camera, I want to crop image which I have got,
So, I am using following code to call crop intent,
```
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(imageUri, "image/*");
//set crop p... | 2016/11/10 | [
"https://Stackoverflow.com/questions/40521763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2919232/"
] | You are missing the **return** statement when mapping the result of the post request.
In es6 and ts:
* When an arrow function is defined using brackets, return statement is mandatory.
* When an arrow function is defined without brackets, es6 autogenerate a return statement returning the value of the expression provi... | Accepting answer from Gunter:
`user1 => this.currentUser = user1`, is a function that is called when the data arrives. Code at the place where you have your comment is executed loooong before that |
43,355,116 | I have a list A of coordinates (latitute, longitute in decimal form) with ~10.000 points and a second list B of coordinates of the same type with ~1 million points.
I want to find the closest point in list A for each element in list B.
What I have already done is create the cartesian product of the two lists and fi... | 2017/04/11 | [
"https://Stackoverflow.com/questions/43355116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2618541/"
] | If you have already created the cross product and worked out all the haversine distances, then you have already done the majority of the work, so I will assume the question is about what to do if you have new sets A and B.
To repeatedly find the closest point in A I would build some sort of tree structure containing t... | the nncross function from the spatstat package can be used to find the distances of points from two different datasets.Using this function will reduce the time taken to a great extent.
<https://www.rdocumentation.org/packages/spatstat/versions/1.53-2/topics/nncross> |
14,977,324 | I am making a lightweight responsive jQuery slider for my site, and am using the very common markup:
**HTML:**
```
<div id="slider">
<ul>
<li><img class="active" src="slide1.jpg" alt=""></li>
<li><img src="slide2.jpg" alt=""></li>
<li><img src="slide3.jpg" alt=""></li>
</ul>
</div>
```
**CSS:**
```... | 2013/02/20 | [
"https://Stackoverflow.com/questions/14977324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1411025/"
] | There are many different ways to achieve a slider/carousel system (in terms or Markup, JavaScript and CSS), if you are finding one way isn't quite working, it is normally a good idea to rethink approach. As far as I'm aware what you are asking with `:before` and `:after` wont work, because as soon as an element is abso... | For a clearfix, try this CSS:
```
#slider img:after {
clear: both;
}
#slider img:before, #slider img:after {
content: " ";
display: block;
height: 0;
overflow: hidden;
visibility: hidden;
width: 0;
}
``` |
12,288,781 | I'm making an application for food recipes and am trying to do the same html in the recipe and include comments in a modal window, the problem is that when I give I submit template fails and does not save the comment on the data base
urls.py
```
urlpatterns = patterns('recetas.apps.menus.views',
url(r'^recetas/$'... | 2012/09/05 | [
"https://Stackoverflow.com/questions/12288781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1650032/"
] | I believe the problem is in your `view.py`. Specifically in this part:
```
if request.POST.get('cancel', id_receta):
return HttpResponseRedirect('/receta/{0}'.format(id_receta))
```
That `if` will never result in a `False` value and, hence, your comment will never be saved. This has to do with how the [dict.get]... | Thanks for help me Cesar, your answer help me, but my error is in the variable in receta.html
is `{{ receta.id }}` and in the button is the same the correct is
```
<form action="/receta/{{ receta.id }}" method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Grabar"/>
<input type="... |
49,145,666 | I have created an API in Django and inside that calling a third party API which accepts XML data. With 30 rows of XML it is working fine, for more rows throwing the error "Connection aborted.', error(104, 'Connection reset by peer')". The third party also provided a UI so I can test that up to 5000 rows they are accept... | 2018/03/07 | [
"https://Stackoverflow.com/questions/49145666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3129610/"
] | Try replacing "params=querystring" with "data=querystring"
```
response = requests.request("POST", url, headers=headers, data=querystring)
```
params seems to be for GET requests and may by your request URL becomes too long after 30 lines of XML.
From docs at : <http://docs.python-requests.org/en/master/user/quick... | I had a similar case. This error was given by the console when I accessed the delete method via the my API. The problem was solved by fixing the delete function in the `view.py` file, namely the `status` argument of Response function that this method returned |
1,165,758 | I installed openjdk 1.8\_222 on ubuntu 18.04 but cannot find the ControlPanel or jcontrol on my computer. | 2019/08/14 | [
"https://askubuntu.com/questions/1165758",
"https://askubuntu.com",
"https://askubuntu.com/users/944046/"
] | You have openjdk-8-jdk installed in Ubuntu 18.04. You can use exactly the same command line utilities with OpenJDK as with Oracle JDK, but ControlPanel and jcontrol do not exist in openjdk-8-jdk in Ubuntu 18.04.
The GUI in openjdk-8-jdk in Ubuntu 18.04 is named JConsole. The JConsole graphical user interface is a mon... | in bash run
```
locate itweb-settings
```
and than run what it found, for example
```
/etc/alternatives/itweb-settings
``` |
50,224,036 | I've come across code that looks like the following:
```
public List<Triple<String, String, Instant>> methodName() {
// Do something
}
```
What is the `Triple`, how should It be used? | 2018/05/08 | [
"https://Stackoverflow.com/questions/50224036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4652101/"
] | [Triple](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/tuple/Triple.html) is useful when you want to save 3 values at a time and you can pass different data types. If you just want to learn then below is an example of its usage but if you want to use in code then I would suggest you to... | Think "tuple" for 3 values!
Many programming languages provide means to efficiently deal with lists of a "fixed" length but different types for each entry.
That Triple class is the Java way of providing you something like that. Like a Pair, but one more entry.
At its core, a fixed length tuple allows you to "loosel... |
50,224,036 | I've come across code that looks like the following:
```
public List<Triple<String, String, Instant>> methodName() {
// Do something
}
```
What is the `Triple`, how should It be used? | 2018/05/08 | [
"https://Stackoverflow.com/questions/50224036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4652101/"
] | [Triple](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/tuple/Triple.html) is useful when you want to save 3 values at a time and you can pass different data types. If you just want to learn then below is an example of its usage but if you want to use in code then I would suggest you to... | When you need a data structure to deal with a list of three entities, you might use a Triple. Here's a small example:
```java
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.Triple;
public class Test {
public static void main(String[] args) {
List<Triple<Integer, ... |
50,224,036 | I've come across code that looks like the following:
```
public List<Triple<String, String, Instant>> methodName() {
// Do something
}
```
What is the `Triple`, how should It be used? | 2018/05/08 | [
"https://Stackoverflow.com/questions/50224036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4652101/"
] | Think "tuple" for 3 values!
Many programming languages provide means to efficiently deal with lists of a "fixed" length but different types for each entry.
That Triple class is the Java way of providing you something like that. Like a Pair, but one more entry.
At its core, a fixed length tuple allows you to "loosel... | When you need a data structure to deal with a list of three entities, you might use a Triple. Here's a small example:
```java
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.Triple;
public class Test {
public static void main(String[] args) {
List<Triple<Integer, ... |
20,496,679 | Say I have this dictionary:
```
"pools": {
"JP": {
"longName": "Jackpot",
"poolTotal": 318400,
"shortName": "Jpot",
"sortOrder": 9
}
},
```
How would I output this so I have it like this:
```
pool_JP_longname: Jackpot
pool_JP_poolTotal: 318400
etc
... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20496679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/228660/"
] | This will recursively flatten your dictionaries:
```
def flatten_dict(dct, output=None, prefix=None):
if output is None:
output = {}
if prefix is None:
prefix = []
for key in dct:
if isinstance(dct[key], dict):
flatten_dict(dct[key], output, prefix + [key])
else:... | A simple solution could look like this:
```
d = { ... }
def flatten(dic, stack=None):
if not stack: stack = []
for key,value in dic.iteritems():
new_stack = stack[:] + [key]
if isinstance(value, dict):
for result in flatten(value, new_stack):
yield result
e... |
20,496,679 | Say I have this dictionary:
```
"pools": {
"JP": {
"longName": "Jackpot",
"poolTotal": 318400,
"shortName": "Jpot",
"sortOrder": 9
}
},
```
How would I output this so I have it like this:
```
pool_JP_longname: Jackpot
pool_JP_poolTotal: 318400
etc
... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20496679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/228660/"
] | This will recursively flatten your dictionaries:
```
def flatten_dict(dct, output=None, prefix=None):
if output is None:
output = {}
if prefix is None:
prefix = []
for key in dct:
if isinstance(dct[key], dict):
flatten_dict(dct[key], output, prefix + [key])
else:... | This is a basic recursion problem (*or one that can be solved with recursion*):
Here is a contrived example that satisfies your first example (*more or less*):
```
d = {
"pools": {
"JP": {
"longName": "Jackpot",
"poolTotal": 318400,
"shortName": "Jpot",
"sor... |
20,496,679 | Say I have this dictionary:
```
"pools": {
"JP": {
"longName": "Jackpot",
"poolTotal": 318400,
"shortName": "Jpot",
"sortOrder": 9
}
},
```
How would I output this so I have it like this:
```
pool_JP_longname: Jackpot
pool_JP_poolTotal: 318400
etc
... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20496679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/228660/"
] | A simple solution could look like this:
```
d = { ... }
def flatten(dic, stack=None):
if not stack: stack = []
for key,value in dic.iteritems():
new_stack = stack[:] + [key]
if isinstance(value, dict):
for result in flatten(value, new_stack):
yield result
e... | This is a basic recursion problem (*or one that can be solved with recursion*):
Here is a contrived example that satisfies your first example (*more or less*):
```
d = {
"pools": {
"JP": {
"longName": "Jackpot",
"poolTotal": 318400,
"shortName": "Jpot",
"sor... |
28,696,604 | I am trying to process a file (1.5GB) with a bash loop to iterate each line. I used `cut` for its simplicity (relative) and ended up with:
```
while read line
do
echo "$(echo $line | cut -d' ' -f 2-3)" "$(echo $line | cut -d'"' -f 20)"
done < TEST.log > IDS.log
```
This is very slow and only does about 2KB/sec. ... | 2015/02/24 | [
"https://Stackoverflow.com/questions/28696604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/948550/"
] | The bottleneck is likely that you spawn several processes for every line of data. As for a replacement, this awk should be equivalent:
```
awk '{ split($0, a, "\""); print $2, $3, a[20] }' TEST.log > IDS.log
``` | Perl is usually very fast:
```
perl -nE 'say join " ", (split " ")[1,2], (split /"/)[19]' TEST.log > IDS.log
```
Perl arrays are indexed starting with 0. |
28,696,604 | I am trying to process a file (1.5GB) with a bash loop to iterate each line. I used `cut` for its simplicity (relative) and ended up with:
```
while read line
do
echo "$(echo $line | cut -d' ' -f 2-3)" "$(echo $line | cut -d'"' -f 20)"
done < TEST.log > IDS.log
```
This is very slow and only does about 2KB/sec. ... | 2015/02/24 | [
"https://Stackoverflow.com/questions/28696604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/948550/"
] | The bottleneck is likely that you spawn several processes for every line of data. As for a replacement, this awk should be equivalent:
```
awk '{ split($0, a, "\""); print $2, $3, a[20] }' TEST.log > IDS.log
``` | The biggest bottleneck here is spinning off the subprocesses for your pipelines. You can get a substantial (read: orders-of-magnitude) performance improvement just by getting rid of the command substitutions and pipelines.
```
while IFS=$'\x01' read -r ss1 ss2 ss3 _ <&3 && \
IFS='"' read -r -a quote_separated_fi... |
28,696,604 | I am trying to process a file (1.5GB) with a bash loop to iterate each line. I used `cut` for its simplicity (relative) and ended up with:
```
while read line
do
echo "$(echo $line | cut -d' ' -f 2-3)" "$(echo $line | cut -d'"' -f 20)"
done < TEST.log > IDS.log
```
This is very slow and only does about 2KB/sec. ... | 2015/02/24 | [
"https://Stackoverflow.com/questions/28696604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/948550/"
] | Perl is usually very fast:
```
perl -nE 'say join " ", (split " ")[1,2], (split /"/)[19]' TEST.log > IDS.log
```
Perl arrays are indexed starting with 0. | The biggest bottleneck here is spinning off the subprocesses for your pipelines. You can get a substantial (read: orders-of-magnitude) performance improvement just by getting rid of the command substitutions and pipelines.
```
while IFS=$'\x01' read -r ss1 ss2 ss3 _ <&3 && \
IFS='"' read -r -a quote_separated_fi... |
97,779 | I've heard phrases like `take a taxi/bus`. I wonder if it's also common to say `take a bike`.
For example:
>
> I take a bike to school.
>
>
>
rather than
>
> I ride a bike to school.
>
>
> | 2016/07/27 | [
"https://ell.stackexchange.com/questions/97779",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/2120/"
] | When talking about transport, [take](http://dictionary.cambridge.org/dictionary/english/take) can have at least two meanings:
>
> 1) to travel somewhere by using a particular form of transport or a particular vehicle, route, etc.
>
> 2) to move something or someone from one place to another
>
>
>
We normally ... | Both are actually fine. You could also state: "I bike to school."
One of the definitions of the word take is:
>
> Use as a route or a means of transportation
>
>
>
However, "take a bike" generally implies that you are carrying it rather than riding it.
Most people would use "I ride a bike" opposed to "I take ... |
52,056,358 | I have created an project in vuejs using vue-cli3. It working fine on chrome browser but in IE-11 version blank screen is shown with the following error in console as mentioned in this link: <https://drive.google.com/file/d/1QaNwK1ekI2BwFsFyjvgbSsvwHBCmlcAD/view?usp=drivesdk>
On clicking console error that I have point... | 2018/08/28 | [
"https://Stackoverflow.com/questions/52056358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9563742/"
] | I finally ended up with the solution of above issue. To run project on IE-11 version just follow the 2 steps:
1. Install babel-polyfill using command "npm install --save babel-polyfill".
2. Import babel-polyfill in your main.js or index.js file at the top of above all imported packages. For e.g Here is your **main.js*... | Another solution: use the power of vue-cli-3 to leverage browser support: <https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode>
Just one option when building and you're done once you've chosen browserslist to support :-)
This should work well for building an app. |
48,993,116 | I'm trying to send out an email with two seprate tables.
How do I do that?
Adding sample data, per someone's request.
This is what the email should look like
Items
```
Item Price
Apples 1.25
Oranges 2.24
Banana 0.29
```
Sales
```
Month Item Sold
Feb Apples $5.00
Feb Oranges $10.00
```
Here is the cod... | 2018/02/26 | [
"https://Stackoverflow.com/questions/48993116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I usually use an HTML table to do this. This will create an email with multiple tables.
```
DECLARE @NewLineChar AS CHAR(2) = CHAR(13) + CHAR(10);
If
(
SELECT
COUNT(*)
FROM
#TABLE_YOU_WANT_DATA_FROM
) = 0
BEGIN
SET @tableHTML = @NewLineChar
END
SET @tableHTML =
... | Poor solution, but this is as close as you can get using send\_dbmail. It only works if you have the same columns in both tables:
SET @nvquery = 'SELECT \* FROM #TME1 UNION ALL SELECT \* FROM #TME1 WHERE 1=2 UNION ALL SELECT \* FROM #TME2' |
28,947,989 | I am writing unit Tests in Visual Studio 2013 and having trouble on my code coverage analysis. Language is C# and using the default Microsoft.VisualStudio.TestTools.UnitTesting.
```
if (exsistingNode.NodeState > NodeState.Edit)
{
if (existingNode.NodeName != updatedNode.NodeName)
{
throw m_Diagnostics.... | 2015/03/09 | [
"https://Stackoverflow.com/questions/28947989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4572218/"
] | If your activity extends ActionBarActivity then change
```
actionBar = getActionBar();
```
to
```
actionBar = getSupportedActionBar();
``` | \*\*change in AndroidManifest file theme to @android:style/Theme.Holo.Light |
28,947,989 | I am writing unit Tests in Visual Studio 2013 and having trouble on my code coverage analysis. Language is C# and using the default Microsoft.VisualStudio.TestTools.UnitTesting.
```
if (exsistingNode.NodeState > NodeState.Edit)
{
if (existingNode.NodeName != updatedNode.NodeName)
{
throw m_Diagnostics.... | 2015/03/09 | [
"https://Stackoverflow.com/questions/28947989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4572218/"
] | If your activity extends ActionBarActivity then change
```
actionBar = getActionBar();
```
to
```
actionBar = getSupportedActionBar();
``` | change the theme for your activity
like this
android:theme="@android:style/Theme.Holo.Light.DialogWhenLarge"
it is worked for me. |
71,627 | Using any of the wonders of modern cryptographic technology, how is it possible to package a tweet-sized plaintext, which is to be encrypted with a proper one-time pad, to ensure its integrity and give it authentication? For these last two services we aim for **at least a 128-bit level** of assurance. We also want to i... | 2019/06/28 | [
"https://crypto.stackexchange.com/questions/71627",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/55560/"
] | If you want to be consistent with OTP usage, then you should use a One Time MAC. Currently it seems the easiest path for that is to simply use Poly1305, but remember that you must never reuse keys for Poly1305, just like you can't reuse keys in OTP. (In particular, don't use the key generation routine used by ChaCha20-... | Another way is to go weird, and do
$$nonce||\operatorname{AES-ECB\_k}(m)||H \big(\operatorname{AES-ECB\_k}(m)\big)$$
where $m$ is the message that is pre-encrypted with a OTP. This is a good example of code book mode working properly, due to the OPT. No cuddly polar creatures appear, and it follows the recommended e... |
27,191,116 | I can't package my Android Wear app, when it's installed on phone, wear version are not on watch.
There is my gradle files (wear) :
```
buildscript {
dependencies {
}
}
apply plugin: 'com.android.application'
def versionMajor = Integer.parseInt(APP_VERSION_MAJOR)
def versionMinor = Integer.parseInt(APP_VERSIO... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27191116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541867/"
] | 1. Do you use release key for signing? You have to use it, debug keys don't work here.
2. Check your final apk file. If you properly included wear project to mobile, you should have android\_wear\_micro\_apk.apk in your res/raw folder | I had the same problem but solve it with checking permissions.
Could you check that the wearable and mobile apps has exactly the same permissions ? |
27,191,116 | I can't package my Android Wear app, when it's installed on phone, wear version are not on watch.
There is my gradle files (wear) :
```
buildscript {
dependencies {
}
}
apply plugin: 'com.android.application'
def versionMajor = Integer.parseInt(APP_VERSION_MAJOR)
def versionMinor = Integer.parseInt(APP_VERSIO... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27191116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541867/"
] | 1. Do you use release key for signing? You have to use it, debug keys don't work here.
2. Check your final apk file. If you properly included wear project to mobile, you should have android\_wear\_micro\_apk.apk in your res/raw folder | If you are building with Android Studio using gradle, just make the wearable app as a module in your phone project. Then you have to make sure you have done the following configurations:
1. The phone manifest and the wearable manifest should declare exactly the same permissions.
2. Ensure that both the wearable and ha... |
47,072,951 | I have switched to android studio 3. after many problem that I fixed, I got this error:
color/colorPrimary but i go this error:Error:(87, 5) error: expected color but got (raw string) color/gray
[](https://i.stack.imgur.com/DOUpU.png) | 2017/11/02 | [
"https://Stackoverflow.com/questions/47072951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4345934/"
] | You forgot to add **`@`** before `color/colorPrimary`
change it like **`@color/colorPrimary`**
**sample code**
```
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorP... | Color value should be a `hex` color code like `#A5D3F4` OR a color reference with `@` sign, like `@color/colorPrimary`. before use these reference, you must create resources like `res/values/color.xml`.
```
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color nam... |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I struggled with this for several days, and finally put what I had learned into the following fairly simple solution, which puts a button and a progressbar on an HTML page.
When the button is clicked, javascript starts a count, and updates the progress bar as the count progresses. The count is set to a default value o... | ```
$("#progressbar").progressbar({ value: i });
``` |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I struggled with this for several days, and finally put what I had learned into the following fairly simple solution, which puts a button and a progressbar on an HTML page.
When the button is clicked, javascript starts a count, and updates the progress bar as the count progresses. The count is set to a default value o... | I know the post is old, but just in case someone needs it some time:
```
$("progress").val(i);
```
will change the progress value base on value `i`.
---
As an example, for uploading an image you can use the jquery-form library `<script src="http://malsup.github.com/jquery.form.js"></script>`. So, you can update yo... |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I would do it like that for a dummy progressbar :
**Html**
```
<div id="progress">
<span class="progress-text"></span>
<div class="progress-bar"></div>
</div>
```
**Css**
```
#progress {
position:relative;
width:250px;
height:20px;
border:1px solid red;
}
#progress .progress-bar {
back... | Beware the "must be enough" timeouts, they highly depend on each machine's speed.
I discovered that `$('progress#id').text(Math.random())` forces the UI to redraw. |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I would do it like that for a dummy progressbar :
**Html**
```
<div id="progress">
<span class="progress-text"></span>
<div class="progress-bar"></div>
</div>
```
**Css**
```
#progress {
position:relative;
width:250px;
height:20px;
border:1px solid red;
}
#progress .progress-bar {
back... | ```
$("#progressBar").prop("value",i);
```
should set the property value to whatever i is in that loop |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I would do it like that for a dummy progressbar :
**Html**
```
<div id="progress">
<span class="progress-text"></span>
<div class="progress-bar"></div>
</div>
```
**Css**
```
#progress {
position:relative;
width:250px;
height:20px;
border:1px solid red;
}
#progress .progress-bar {
back... | I struggled with this for several days, and finally put what I had learned into the following fairly simple solution, which puts a button and a progressbar on an HTML page.
When the button is clicked, javascript starts a count, and updates the progress bar as the count progresses. The count is set to a default value o... |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I would do it like that for a dummy progressbar :
**Html**
```
<div id="progress">
<span class="progress-text"></span>
<div class="progress-bar"></div>
</div>
```
**Css**
```
#progress {
position:relative;
width:250px;
height:20px;
border:1px solid red;
}
#progress .progress-bar {
back... | ```
$("#progressbar").progressbar({ value: i });
``` |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | You need to write an asynchronous loop using setTimeout like this:
```
var counter = 0;
(function asyncLoop() {
$('#progressBar').val(counter++);
if (counter <= 100) {
setTimeout(asyncLoop, 50);
}
})();
``` | Beware the "must be enough" timeouts, they highly depend on each machine's speed.
I discovered that `$('progress#id').text(Math.random())` forces the UI to redraw. |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | You need to write an asynchronous loop using setTimeout like this:
```
var counter = 0;
(function asyncLoop() {
$('#progressBar').val(counter++);
if (counter <= 100) {
setTimeout(asyncLoop, 50);
}
})();
``` | ```
$("#progressbar").progressbar({ value: i });
``` |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | I struggled with this for several days, and finally put what I had learned into the following fairly simple solution, which puts a button and a progressbar on an HTML page.
When the button is clicked, javascript starts a count, and updates the progress bar as the count progresses. The count is set to a default value o... | Beware the "must be enough" timeouts, they highly depend on each machine's speed.
I discovered that `$('progress#id').text(Math.random())` forces the UI to redraw. |
14,774,245 | I have html code. And i need some javascript code for update value on every iteration
```
<progress id="progressBar" max="100" value="0"></progress>
for (i = 0; i <= 100; i ++) {
//update progress bar
}
```
I try to do something like this:
```
var progressBar = document.getElementById("progressBar");
progressB... | 2013/02/08 | [
"https://Stackoverflow.com/questions/14774245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147482/"
] | You need to write an asynchronous loop using setTimeout like this:
```
var counter = 0;
(function asyncLoop() {
$('#progressBar').val(counter++);
if (counter <= 100) {
setTimeout(asyncLoop, 50);
}
})();
``` | I know the post is old, but just in case someone needs it some time:
```
$("progress").val(i);
```
will change the progress value base on value `i`.
---
As an example, for uploading an image you can use the jquery-form library `<script src="http://malsup.github.com/jquery.form.js"></script>`. So, you can update yo... |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.
Something like this:
```
/**
return string containing first MAC address on computer
requires adding Iphlpapi.lib to project
*/
string GetMac()
{
char data[4096];
ZeroMemory( data, 4096 );
... | I tried doing something similar a few years ago and failed. I tried using a combination of hardware ID's that I could read. Most CPU's have a CPUID, a unique number that is used to uniquely identify and track them. However the problem is that its not garunteed that each CPU out there will have this ID. In fact, when I ... |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.
Something like this:
```
/**
return string containing first MAC address on computer
requires adding Iphlpapi.lib to project
*/
string GetMac()
{
char data[4096];
ZeroMemory( data, 4096 );
... | If such a thing were easy and reliable, Microsoft would have found and patented it long ago.
There have been attempts to protect software by some hardware doo-dad, including shipping a thing called [**a 'dongle'**](http://en.wikipedia.org/wiki/Software_protection_dongle) with every licensed software package. Hey Va... |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | If you only need to generate it once, the a GUID will be unique to the machine that created it. The problem is you'll get a different value every time you generate one. But if it's a one-off per machine, a GUID will work.
If it needs to be the same per machine and generated multiple times, the the MAC address is the u... | If such a thing were easy and reliable, Microsoft would have found and patented it long ago.
There have been attempts to protect software by some hardware doo-dad, including shipping a thing called [**a 'dongle'**](http://en.wikipedia.org/wiki/Software_protection_dongle) with every licensed software package. Hey Va... |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.
Something like this:
```
/**
return string containing first MAC address on computer
requires adding Iphlpapi.lib to project
*/
string GetMac()
{
char data[4096];
ZeroMemory( data, 4096 );
... | Maybe this method will help you.
<http://www.codeproject.com/Articles/319181/Haephrati-Searching-for-a-reliable-Hardware-ID> |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.
Something like this:
```
/**
return string containing first MAC address on computer
requires adding Iphlpapi.lib to project
*/
string GetMac()
{
char data[4096];
ZeroMemory( data, 4096 );
... | One of many options is to use CPU ID. Better than Windows Registry, or network card, for example. You don't want users to bother you each time they change network card etc. I think [cpuid](http://www.ka9q.net/code/cpuid/) project can be used as an example and starting point. |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.
Something like this:
```
/**
return string containing first MAC address on computer
requires adding Iphlpapi.lib to project
*/
string GetMac()
{
char data[4096];
ZeroMemory( data, 4096 );
... | If you only need to generate it once, the a GUID will be unique to the machine that created it. The problem is you'll get a different value every time you generate one. But if it's a one-off per machine, a GUID will work.
If it needs to be the same per machine and generated multiple times, the the MAC address is the u... |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | I tried doing something similar a few years ago and failed. I tried using a combination of hardware ID's that I could read. Most CPU's have a CPUID, a unique number that is used to uniquely identify and track them. However the problem is that its not garunteed that each CPU out there will have this ID. In fact, when I ... | Maybe this method will help you.
<http://www.codeproject.com/Articles/319181/Haephrati-Searching-for-a-reliable-Hardware-ID> |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | I tried doing something similar a few years ago and failed. I tried using a combination of hardware ID's that I could read. Most CPU's have a CPUID, a unique number that is used to uniquely identify and track them. However the problem is that its not garunteed that each CPU out there will have this ID. In fact, when I ... | If such a thing were easy and reliable, Microsoft would have found and patented it long ago.
There have been attempts to protect software by some hardware doo-dad, including shipping a thing called [**a 'dongle'**](http://en.wikipedia.org/wiki/Software_protection_dongle) with every licensed software package. Hey Va... |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | I tried doing something similar a few years ago and failed. I tried using a combination of hardware ID's that I could read. Most CPU's have a CPUID, a unique number that is used to uniquely identify and track them. However the problem is that its not garunteed that each CPU out there will have this ID. In fact, when I ... | One of many options is to use CPU ID. Better than Windows Registry, or network card, for example. You don't want users to bother you each time they change network card etc. I think [cpuid](http://www.ka9q.net/code/cpuid/) project can be used as an example and starting point. |
6,131,126 | I have a very annoying problem, which I'm trying to solve. I have an iPhone app that sends several forms of data to a server. The server-side processes the data and responds, with PHP. With small lengths of data this goes fine, but one of the requests is pretty large and this doesn't go so well. The requests seems well... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6131126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413540/"
] | If you only need to generate it once, the a GUID will be unique to the machine that created it. The problem is you'll get a different value every time you generate one. But if it's a one-off per machine, a GUID will work.
If it needs to be the same per machine and generated multiple times, the the MAC address is the u... | Maybe this method will help you.
<http://www.codeproject.com/Articles/319181/Haephrati-Searching-for-a-reliable-Hardware-ID> |
21,354 | My employer is sending me to an industry conference to promote a product of theirs, and for my education. At this conference there will be several companies I'd be very interested to work for. Is it ethical to pursue these opportunities?
* I went to the same conference last year with no intention of looking for a job
... | 2014/03/26 | [
"https://workplace.stackexchange.com/questions/21354",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/17907/"
] | It is ethical, so long as you are professional about it.
You are there to promote the company's product and to educate yourself. You should not take time away from the time that you have committed to these activities to pursue potential job opportunities.
It should not be obvious to others that you are looking for ... | Sure it is, just make sure you are being thoughtful of the function you are there to do for your current employer. Fulfill your responsibilities there first, but keep a watchful eye out for opportunities to network for yourself!
Tech conference are sometimes attended by a couple of recruiters, but mostly technical emp... |
22,627,955 | I have a rake task that populates my database from a CSV file:
```
require 'csv'
namespace :import_data_csv do
desc "Import teams from csv file"
task import_data: :environment do
CSV.foreach(file, :headers => true) do |row|
#various import tasks
```
This had been working properly, but with a new CSV file, I'm g... | 2014/03/25 | [
"https://Stackoverflow.com/questions/22627955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2977778/"
] | Here is what is generated in VS2013
```
public class Rootobject
{
public string PersonId { get; set; }
public string Name { get; set; }
public Hobbiescollection HobbiesCollection { get; set; }
}
public class Hobbiescollection
{
public Hobby[] Hobby { get; set; }
}
public class Hobby
{
public stri... | There is a online tool you can make C# class from your String
[JSON to Csharp](http://json2csharp.com/#)
```
public class Hobby
{
public string type { get; set; }
public int id { get; set; }
public string description { get; set; }
}
public class HobbiesCollection
{
public List<Hobby> Hobby { get; se... |
892,647 | Want clean the `/private/var/folders/*` at the OS X boot, [by creating](https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html) an `launchd` entry. (**AFAIK**, the OS X doesn't supports the `rc.conf` `rc.d` - everything must be done by creating an entry... | 2015/03/22 | [
"https://superuser.com/questions/892647",
"https://superuser.com",
"https://superuser.com/users/83626/"
] | **TL;DR**: `/var/folders` contains folders for per-user caches and temporary files. You can access your own folders, but not those of other users. Deleting files that are not currently in-use should be safe, but deleting files that are in-use will probably cause problems. If you want to purge them, you should reboot af... | Normally `/var/folders` should be properly purged and regulated by the system when necessary. Removing some things from there without knowing what's removed can likely cause some unexpected and highly undesirable results.
If you're talking about cleaning this folder manually at reboot, I think it should be safe as it'... |
892,647 | Want clean the `/private/var/folders/*` at the OS X boot, [by creating](https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html) an `launchd` entry. (**AFAIK**, the OS X doesn't supports the `rc.conf` `rc.d` - everything must be done by creating an entry... | 2015/03/22 | [
"https://superuser.com/questions/892647",
"https://superuser.com",
"https://superuser.com/users/83626/"
] | Normally `/var/folders` should be properly purged and regulated by the system when necessary. Removing some things from there without knowing what's removed can likely cause some unexpected and highly undesirable results.
If you're talking about cleaning this folder manually at reboot, I think it should be safe as it'... | For what it is worth (meaning decide worth yourself :-), doing this is dangerous on Catalina (10.15). I did this on a Macbook Air after the upgrade to Catalina. It would not restart, and what a pain to recovery from Time Machine with bad internal screen.
I also had another bad screen Macbook Air (and bad keyboard, an... |
892,647 | Want clean the `/private/var/folders/*` at the OS X boot, [by creating](https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html) an `launchd` entry. (**AFAIK**, the OS X doesn't supports the `rc.conf` `rc.d` - everything must be done by creating an entry... | 2015/03/22 | [
"https://superuser.com/questions/892647",
"https://superuser.com",
"https://superuser.com/users/83626/"
] | **TL;DR**: `/var/folders` contains folders for per-user caches and temporary files. You can access your own folders, but not those of other users. Deleting files that are not currently in-use should be safe, but deleting files that are in-use will probably cause problems. If you want to purge them, you should reboot af... | For what it is worth (meaning decide worth yourself :-), doing this is dangerous on Catalina (10.15). I did this on a Macbook Air after the upgrade to Catalina. It would not restart, and what a pain to recovery from Time Machine with bad internal screen.
I also had another bad screen Macbook Air (and bad keyboard, an... |
18,816,968 | I am outputting the data in `JSON` format from MySQL database in **controller** like this,
```
function byId(){
$this -> load -> model('usermodel');
$data['user'] = $this -> usermodel -> getById($this->uri->slash_segment(3));
$this -> output -> set_content_type('application/json');
$th... | 2013/09/15 | [
"https://Stackoverflow.com/questions/18816968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2608635/"
] | The reason you see an extra `[]` around the individual "user" objects is because of the `$data[]` array in the `getById()` method. You are returning an array with other arrays inside them and by default `json_encode` will convert numerically indexed arrays (starting from 0) as javascript arrays.
Now it depends what's ... | Try replacing the line
```
$data['user'] = $this -> usermodel -> getById($this->uri->slash_segment(3));
```
with this
```
$data['user'] = $this -> usermodel -> getById($this->uri->slash_segment(3))[0];
```
`[{ ... }]` is an array containing a single object. `[0]` should grab the first element in that array rather... |
51,811,012 | How do I override the default active color for a button text in a toolbar:
```
v-btn(:to="item.path" active-class="v-btn--active toolbar-btn-active") {{item.meta.title}}
```
I created this class to try to override it:
```
.toolbar-btn-active {
background-color: white;
&::before {
background-color: white;
... | 2018/08/12 | [
"https://Stackoverflow.com/questions/51811012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2475569/"
] | `v-btn--active` is default active class(can be changed with `active-class` prop).
So we can target active-class and modify CSS like so:
```
.v-btn--active .v-btn__content {
color: red
}
```
Note in scoped style we need to use deep selectors `>>>`:
```
>>> .v-btn--active .v-btn__content
``` | If you want to apply changes to specified button in html you can add class to v-btn
```
<v-btn class="primary">Button</v-btn>
<style>
.primary {
color: yellow !important;
background-color: blue !important;
}
</style>
``` |
32,245,279 | I'm stuck on what is the best way to re-arrange my ruby hash.
The main goal is to group results from mysql by month and count.
To do it, i make this request:
```
@data = Model.find(params[:id])
.jobs
.group('year(created_at)')
.group('month(created_at)')
.count(:i... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32245279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4146283/"
] | Given you already have your hash in `@data`, you might:
```
@data.inject({}) do |memo, ((y, m), cnt)|
(memo[y] ||= {})[m] = cnt
memo
end
#⇒ {
# 2013 => {12 => 9},
# 2014 => {1 => 4, 10 => 2, 3 => 3, 4 => 1, 6 => 1, 7 => 1}
# }
```
As it was noted by @Surya in comments, it should be hash `Year => Hash[... | ```
@data.to_a.group_by{|ym, c| ym.first }.map{|year, months| [year,months.map{|m,cnt| [m.last, cnt] }] }.to_h
=> {2013=>[[12, 9]], 2014=>[[1, 4], [3, 3], [4, 1], [6, 1], [7, 1], [10, 2]]}
``` |
32,245,279 | I'm stuck on what is the best way to re-arrange my ruby hash.
The main goal is to group results from mysql by month and count.
To do it, i make this request:
```
@data = Model.find(params[:id])
.jobs
.group('year(created_at)')
.group('month(created_at)')
.count(:i... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32245279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4146283/"
] | The answer proposed by @mudosobwa might be correct, but because your target is a json file, you may want some 'named' keys. I suggest you this one :
```
formated_results = @data.group_by{|k, v| k[0]}.collect{|k,v| {year: k, datas: v.collect{|vv| {month: vv.first.last, count: vv.last}}}}
# {:year=>2013, :datas=>[{:mont... | Given you already have your hash in `@data`, you might:
```
@data.inject({}) do |memo, ((y, m), cnt)|
(memo[y] ||= {})[m] = cnt
memo
end
#⇒ {
# 2013 => {12 => 9},
# 2014 => {1 => 4, 10 => 2, 3 => 3, 4 => 1, 6 => 1, 7 => 1}
# }
```
As it was noted by @Surya in comments, it should be hash `Year => Hash[... |
32,245,279 | I'm stuck on what is the best way to re-arrange my ruby hash.
The main goal is to group results from mysql by month and count.
To do it, i make this request:
```
@data = Model.find(params[:id])
.jobs
.group('year(created_at)')
.group('month(created_at)')
.count(:i... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32245279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4146283/"
] | The answer proposed by @mudosobwa might be correct, but because your target is a json file, you may want some 'named' keys. I suggest you this one :
```
formated_results = @data.group_by{|k, v| k[0]}.collect{|k,v| {year: k, datas: v.collect{|vv| {month: vv.first.last, count: vv.last}}}}
# {:year=>2013, :datas=>[{:mont... | ```
@data.to_a.group_by{|ym, c| ym.first }.map{|year, months| [year,months.map{|m,cnt| [m.last, cnt] }] }.to_h
=> {2013=>[[12, 9]], 2014=>[[1, 4], [3, 3], [4, 1], [6, 1], [7, 1], [10, 2]]}
``` |
352,476 | EDIT: Edited in response to question in comment (1)
I'm trying to work through some examples from Carmine Noviello's book, *Mastering STM32*. In the chapter introducing timers, I adapted his very first example and am getting an "undefined reference" error for the function `HAL_TIM_Base_Init`. I have other errors too, ... | 2018/01/27 | [
"https://electronics.stackexchange.com/questions/352476",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/110761/"
] | You need to add all used HAL .c files to your project. The easiest way:
Download the CubeMx. Create the project for your micro. Configure the clock. You can also configure another peripherals (including the timers) - but you probably want to learn how to configure them - so do not use the Cube for it.
Next generate t... | Check in your `stm32l4xx_hal_conf.h` that
```
#define HAL_TIM_MODULE_ENABLED
```
is not commented out. If it is, you can remove the `/* */` manually, or enable a timer in CubeMX, and let it generate the source again. Then you can omit `#include "stm32l4xx_hal_tim.h"` from your code, because it will be already includ... |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | Keep your code organized. Use namespaces to break it down into logical modules. It might also be wise to look for common interaction patterns and develop generic reusable code.
I try to write every new feature as a jQuery plugin. That forces me to write reusable code that is not so coupled with the style and markup. | If it's getting too complex you are doing too much so keep it simple (ie: break it into manageable and reusable chunks so instead of having one Titanic you have many compact lifeboats). This might be the best non-technical advice anyone can give you--and it's valid. |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | Any time a program starts to slip away from you you need to stop and take a close look at how to break it into pieces. Think about breaking the js into separate files so you don't have to keep the whole thing in your head at once. Anything you can treat as "done" can be made into an interface where you don't care about... | Use a good JavaScript debugger like Firebug and the debugger statement to add breakpoints to your JavaScript. Just be careful to remove them after you're done. |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | I worked in a Web2.0 with many javaScript and etc.. I`ll give some tips that helped me:
Try **[aptana](http://www.aptana.com)**, help with code complete,validations, etc. (have ext-je,Jquery plugins)
Try **[JSLint](http://www.jslint.com/)**, helps me allot to solve problems specially when dealing with Internet Expl... | Any time a program starts to slip away from you you need to stop and take a close look at how to break it into pieces. Think about breaking the js into separate files so you don't have to keep the whole thing in your head at once. Anything you can treat as "done" can be made into an interface where you don't care about... |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | Keep your code organized. Use namespaces to break it down into logical modules. It might also be wise to look for common interaction patterns and develop generic reusable code.
I try to write every new feature as a jQuery plugin. That forces me to write reusable code that is not so coupled with the style and markup. | I worked in a Web2.0 with many javaScript and etc.. I`ll give some tips that helped me:
Try **[aptana](http://www.aptana.com)**, help with code complete,validations, etc. (have ext-je,Jquery plugins)
Try **[JSLint](http://www.jslint.com/)**, helps me allot to solve problems specially when dealing with Internet Expl... |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | I worked in a Web2.0 with many javaScript and etc.. I`ll give some tips that helped me:
Try **[aptana](http://www.aptana.com)**, help with code complete,validations, etc. (have ext-je,Jquery plugins)
Try **[JSLint](http://www.jslint.com/)**, helps me allot to solve problems specially when dealing with Internet Expl... | One thing that helped me get a handle on a complex JavaScript code base that I inherited was the [AOP package in dojo.](http://lazutkin.com/blog/2008/may/18/aop-aspect-javascript-dojo/). Using it, you can get a nicely formatted execution path of your code (kind of like Firebug's profile but in a list in the order the m... |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | You might want to invesigate introducing actual unit tests into your code. There are a variety of javacscript unit test platforms available, such as [fireunit](http://fireunit.org/). If your already have FireBug installed this is a pretty short jump to the happy comfort zone!
Give it a shot, even small amounts of unit... | If it's getting too complex you are doing too much so keep it simple (ie: break it into manageable and reusable chunks so instead of having one Titanic you have many compact lifeboats). This might be the best non-technical advice anyone can give you--and it's valid. |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | I worked in a Web2.0 with many javaScript and etc.. I`ll give some tips that helped me:
Try **[aptana](http://www.aptana.com)**, help with code complete,validations, etc. (have ext-je,Jquery plugins)
Try **[JSLint](http://www.jslint.com/)**, helps me allot to solve problems specially when dealing with Internet Expl... | If it's getting too complex you are doing too much so keep it simple (ie: break it into manageable and reusable chunks so instead of having one Titanic you have many compact lifeboats). This might be the best non-technical advice anyone can give you--and it's valid. |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | You might want to invesigate introducing actual unit tests into your code. There are a variety of javacscript unit test platforms available, such as [fireunit](http://fireunit.org/). If your already have FireBug installed this is a pretty short jump to the happy comfort zone!
Give it a shot, even small amounts of unit... | One thing that helped me get a handle on a complex JavaScript code base that I inherited was the [AOP package in dojo.](http://lazutkin.com/blog/2008/may/18/aop-aspect-javascript-dojo/). Using it, you can get a nicely formatted execution path of your code (kind of like Firebug's profile but in a list in the order the m... |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | Keep your code organized. Use namespaces to break it down into logical modules. It might also be wise to look for common interaction patterns and develop generic reusable code.
I try to write every new feature as a jQuery plugin. That forces me to write reusable code that is not so coupled with the style and markup. | Use a good JavaScript debugger like Firebug and the debugger statement to add breakpoints to your JavaScript. Just be careful to remove them after you're done. |
1,149,172 | I'm using Firebug to help figure out what's going on in my JavaScript (+JQuery) code. I'm mainly using it to print out tons of `console.log` statements. This is probably not the most efficient way to stay on top of the project. As it has grown from just a few functions to over a hundred I am starting to get confused ab... | 2009/07/19 | [
"https://Stackoverflow.com/questions/1149172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140861/"
] | You might want to invesigate introducing actual unit tests into your code. There are a variety of javacscript unit test platforms available, such as [fireunit](http://fireunit.org/). If your already have FireBug installed this is a pretty short jump to the happy comfort zone!
Give it a shot, even small amounts of unit... | You might want to think about using GWT.
* Superior support.
* Classes
* Ability to refactoring.
* No name space conventions - use packages.
For a more comprehensive list of "reasons" read those given by the GWT team. |
41,699,160 | I have an activity with coordinator layout.inside activity there is a fragment with Recycler view and float button.how can I show/hide float button when Scroll Recycler view and avoid to use fab behavior?!
in activity layout:
CoordinatorLayout----->AppBarLayout---->Toolbar and FrameLayout and Bottom bar view
in fragm... | 2017/01/17 | [
"https://Stackoverflow.com/questions/41699160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5723268/"
] | This code works just fine:
```
mRecycler.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if(dy > 0){
mFab.hide();
} else{
... | I modified Leondro's method such that the FAB will hide when there's scrolling and show when the scrolling stops.
```
scrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch (newState) {
case Recyc... |
41,699,160 | I have an activity with coordinator layout.inside activity there is a fragment with Recycler view and float button.how can I show/hide float button when Scroll Recycler view and avoid to use fab behavior?!
in activity layout:
CoordinatorLayout----->AppBarLayout---->Toolbar and FrameLayout and Bottom bar view
in fragm... | 2017/01/17 | [
"https://Stackoverflow.com/questions/41699160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5723268/"
] | This code works just fine:
```
mRecycler.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if(dy > 0){
mFab.hide();
} else{
... | Here is working solution:
```
class HideOnScrollFabBehavior(context: Context?, attrs: AttributeSet?) : FloatingActionButton.Behavior() {
// changes visibility from GONE to INVISIBLE when fab is hidden because
// due to CoordinatorLayout.onStartNestedScroll() implementation
// child view's (here, fab) onSt... |
41,699,160 | I have an activity with coordinator layout.inside activity there is a fragment with Recycler view and float button.how can I show/hide float button when Scroll Recycler view and avoid to use fab behavior?!
in activity layout:
CoordinatorLayout----->AppBarLayout---->Toolbar and FrameLayout and Bottom bar view
in fragm... | 2017/01/17 | [
"https://Stackoverflow.com/questions/41699160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5723268/"
] | This code works just fine:
```
mRecycler.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if(dy > 0){
mFab.hide();
} else{
... | You can add this property in your floating action button:
app:layout\_behavior="@string/hide\_bottom\_view\_on\_scroll\_behavior" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.