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 |
|---|---|---|---|---|---|
318,590 | I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code).
Should I code this sequentially with a bunch of functions taking **very long** parameters... | 2008/11/25 | [
"https://Stackoverflow.com/questions/318590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40785/"
] | "SolvePotential" is a verb, and classes tend to be nouns with verbs attached. I don't know a lot about the details of your problem, but this may be a sign that a procedural approach would be clearer than OO here. In any case, it certainly seems like if you did create this class, it would be little more than packaging f... | If you're going for strict MartinFowler-esque refactoring, then you're on the right track. Look for metaphors for your code, define responsibilities and create classes which adhere to those divisions. This should make the code more readable if you create classes and members with clear and understandable names.
You'll ... |
318,590 | I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code).
Should I code this sequentially with a bunch of functions taking **very long** parameters... | 2008/11/25 | [
"https://Stackoverflow.com/questions/318590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40785/"
] | If you're going for strict MartinFowler-esque refactoring, then you're on the right track. Look for metaphors for your code, define responsibilities and create classes which adhere to those divisions. This should make the code more readable if you create classes and members with clear and understandable names.
You'll ... | Since you're using an object-oriented language, you should go for objects, assuming you could **reuse** those in the future.
Just one advice: try to design a good class diagram. What are the entities of you program? I'd see an "equation" class with a derived "differentialEquation" one, and so on. |
318,590 | I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code).
Should I code this sequentially with a bunch of functions taking **very long** parameters... | 2008/11/25 | [
"https://Stackoverflow.com/questions/318590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40785/"
] | Actually C++ is not just an OO language, it mixes other paradigms, including the procedural one. Being able to use classes don't make them more suitable for any problem.
In my opinion, functions make much more sense here since you are implementing mathematical **procedures** that are not based on a state and dont need... | Since you're using an object-oriented language, you should go for objects, assuming you could **reuse** those in the future.
Just one advice: try to design a good class diagram. What are the entities of you program? I'd see an "equation" class with a derived "differentialEquation" one, and so on. |
318,590 | I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code).
Should I code this sequentially with a bunch of functions taking **very long** parameters... | 2008/11/25 | [
"https://Stackoverflow.com/questions/318590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40785/"
] | "SolvePotential" is a verb, and classes tend to be nouns with verbs attached. I don't know a lot about the details of your problem, but this may be a sign that a procedural approach would be clearer than OO here. In any case, it certainly seems like if you did create this class, it would be little more than packaging f... | I vote for the class, as it wraps the data up in a much neater package, and makes your main() function quite clear.
In a sense, you've cleaned the main() function, and now have a messy class, which you can clean further at your discretion. Kind of a divide and conquer method. Or maybe a "cram all my junk in the attic"... |
318,590 | I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code).
Should I code this sequentially with a bunch of functions taking **very long** parameters... | 2008/11/25 | [
"https://Stackoverflow.com/questions/318590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40785/"
] | I vote for the class, as it wraps the data up in a much neater package, and makes your main() function quite clear.
In a sense, you've cleaned the main() function, and now have a messy class, which you can clean further at your discretion. Kind of a divide and conquer method. Or maybe a "cram all my junk in the attic"... | You've neglected to mention a middle-ground, which is to begin writing an object, but to pass parameters to its methods. Pseudocode-ly:
```
SolverPotential::solve(a, b, c, d){
SolvePotential::interpolate(a, b);
SolverPotential::compute_flux(b, c);
SolverPotential::compute_energy(c, d)
```
In this way, you begi... |
318,590 | I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code).
Should I code this sequentially with a bunch of functions taking **very long** parameters... | 2008/11/25 | [
"https://Stackoverflow.com/questions/318590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40785/"
] | Actually C++ is not just an OO language, it mixes other paradigms, including the procedural one. Being able to use classes don't make them more suitable for any problem.
In my opinion, functions make much more sense here since you are implementing mathematical **procedures** that are not based on a state and dont need... | I vote for the class, as it wraps the data up in a much neater package, and makes your main() function quite clear.
In a sense, you've cleaned the main() function, and now have a messy class, which you can clean further at your discretion. Kind of a divide and conquer method. Or maybe a "cram all my junk in the attic"... |
66,142,938 | Assuming I have the following numpy array (or list):
```
a = [0,0,1,2,4,1,0,1,2,0,0,0,1,3,0]
```
How can I split this into a list of separate lists, using the occurence of one or more zeros as the delimiter? The answer should be as follows:
```
ans = [ [1,2,4,1], [1,2], [1,3] ]
``` | 2021/02/10 | [
"https://Stackoverflow.com/questions/66142938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602117/"
] | Use `itertools.groupby`
```py
from itertools import groupby
a = [0,0,1,2,4,1,0,1,2,0,0,0,1,3,0]
[list(g) for k,g in groupby(a, key=lambda x: x!=0) if k!=0]
```
```
[[1, 2, 4, 1], [1, 2], [1, 3]]
``` | If you don't care about the performance:
```
ans = list(filter(None, ''.join(map(str, a)).split('0')))
ans = list(map(lambda x: list(map(int, x)), ans))
``` |
7,629 | I would like to compress file "./data/x.txt" to path "./data/x.7z".
When running
```
7z a ./data/x.txt.7z ./data/x.txt
```
The file "./data/x.txt" holds
```
data/x.txt
```
as opposed to just (what I want)
```
x.txt
```
However, I would like 7z to ignore the path "./data" directory inside of the x.7z file. To ... | 2011/02/18 | [
"https://unix.stackexchange.com/questions/7629",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/4874/"
] | One of possible solutions is to chdir to some directory before compressing.
For example:
```
$ cd data; 7z a ../test.7z *
$ 7z l ../test.7z
...
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2011-02-18 15:29:53 ....A 6... | what dr01 answered is generally correct, but why use 7z for compressing a single file at all?
I'd suggest you take a look at [`xz`](http://tukaani.org/xz/) or maybe even [`pxz`](http://jnovy.fedorapeople.org/pxz/pxz.html), if that's available on your distro.
`xz` works well with `tar`, newer versions of tar have the "... |
7,629 | I would like to compress file "./data/x.txt" to path "./data/x.7z".
When running
```
7z a ./data/x.txt.7z ./data/x.txt
```
The file "./data/x.txt" holds
```
data/x.txt
```
as opposed to just (what I want)
```
x.txt
```
However, I would like 7z to ignore the path "./data" directory inside of the x.7z file. To ... | 2011/02/18 | [
"https://unix.stackexchange.com/questions/7629",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/4874/"
] | Figured out an alternative that works for me. I am utilizing [subprocess](http://docs.python.org/library/subprocess.html) to call 7z. The cwd attribute changes the working directory for the subprocess command. The code below solves my example above, where 'data' is the path that I would like to add a file from.
```
ar... | what dr01 answered is generally correct, but why use 7z for compressing a single file at all?
I'd suggest you take a look at [`xz`](http://tukaani.org/xz/) or maybe even [`pxz`](http://jnovy.fedorapeople.org/pxz/pxz.html), if that's available on your distro.
`xz` works well with `tar`, newer versions of tar have the "... |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | `abc` is a jQuery object, so it doesn't have a `getAttribute()` function. it has an `attr()` function. | Just got into this problem. Agree with @Felix Kling
Try below:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
<script>
var abc = $('.map-marker:first');
var xyz = $(abc).attr("data-lng");
console.log(xyz);
</script>
``` |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | Try this may be:
```
var abc = $(".map-marker:first")[0];
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
Or this:
```
var abc = $(".map-marker:first");
var xyz = abc.data("lat");
console.log(xyz);
``` | Your trying to get "data-lat" but you only have "data-lng" defined. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | Try this may be:
```
var abc = $(".map-marker:first")[0];
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
Or this:
```
var abc = $(".map-marker:first");
var xyz = abc.data("lat");
console.log(xyz);
``` | >
> What have I done wrong?
>
>
>
You treated a *jQuery object* like a *DOM element*. jQuery objects don't have a `getAttribute` method. You can either use [`.attr`](http://api.jquery.com/attr/) or [`.data`](http://api.jquery.com/data/) instead. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | Try this may be:
```
var abc = $(".map-marker:first")[0];
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
Or this:
```
var abc = $(".map-marker:first");
var xyz = abc.data("lat");
console.log(xyz);
``` | Keep an eye out for accessing `this` in an event handler with dynamic scope.
Calling a function on `this` that does not exist can cause `node.getAttribute is not a function`. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | Try this may be:
```
var abc = $(".map-marker:first")[0];
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
Or this:
```
var abc = $(".map-marker:first");
var xyz = abc.data("lat");
console.log(xyz);
``` | `abc` is a jQuery object, so it doesn't have a `getAttribute()` function. it has an `attr()` function. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | >
> What have I done wrong?
>
>
>
You treated a *jQuery object* like a *DOM element*. jQuery objects don't have a `getAttribute` method. You can either use [`.attr`](http://api.jquery.com/attr/) or [`.data`](http://api.jquery.com/data/) instead. | Your trying to get "data-lat" but you only have "data-lng" defined. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | >
> What have I done wrong?
>
>
>
You treated a *jQuery object* like a *DOM element*. jQuery objects don't have a `getAttribute` method. You can either use [`.attr`](http://api.jquery.com/attr/) or [`.data`](http://api.jquery.com/data/) instead. | Keep an eye out for accessing `this` in an event handler with dynamic scope.
Calling a function on `this` that does not exist can cause `node.getAttribute is not a function`. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | `abc` is a jQuery object, so it doesn't have a `getAttribute()` function. it has an `attr()` function. | Your trying to get "data-lat" but you only have "data-lng" defined. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | `abc` is a jQuery object, so it doesn't have a `getAttribute()` function. it has an `attr()` function. | You are selecting multiple elements. The select function returns an array, and the array does not have a getAttribute function. You can use a for loop to iterate through the selection and get the attribute values, or you could use an indexer ([0], for example) to get the attribute of a particular one. |
18,163,213 | For the following code:
```
<span class="map-marker" data-lng="101.7113506794"></span>
<span class="map-marker" data-lng="101.6311097146"></span>
var abc = $('.map-marker:first');
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
I get the error message: `TypeError: abc.getAttribute is not a f... | 2013/08/10 | [
"https://Stackoverflow.com/questions/18163213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492767/"
] | Try this may be:
```
var abc = $(".map-marker:first")[0];
var xyz = abc.getAttribute("data-lat");
console.log(xyz);
```
Or this:
```
var abc = $(".map-marker:first");
var xyz = abc.data("lat");
console.log(xyz);
``` | You are selecting multiple elements. The select function returns an array, and the array does not have a getAttribute function. You can use a for loop to iterate through the selection and get the attribute values, or you could use an indexer ([0], for example) to get the attribute of a particular one. |
43,630,618 | Specifically, the calculation I'm doing right now is the following
```
Math.Pow(1527768,7)%7281809;
```
I know the answer to this is `1010101`, however, this is not the answer I am receiving. I believe this is due to the fact I am losing precision in the `Math.Pow()`. I am aware of `BigInteger` and I know this works... | 2017/04/26 | [
"https://Stackoverflow.com/questions/43630618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2550045/"
] | Try declaring it as,
```
private permissionCookie:Array<string>;
constructor() {
let a = this.permissionCookie.includes("22");
console.log(a);
}
```
tsconfig.json -->
```
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
// "moduleResolution": "node",
"sourceMap": true,
"emitD... | Add `"ES2017"` to your `"lib"` array in `tsconfig.json`:
```
{
"compilerOptions": {
...
"lib": ["dom", "es2017"],
...
}
}
```
This should work in TypeScript 2.1+.
A [related issue](https://github.com/Microsoft/TypeScript/issues/2340). |
16,262,484 | I'm trying to append the MainDisplay Variable to id div element called searchoutputtable
```
<div id="searchoutputtable">
</div>
```
Here is the code I use to do this:
```
$.getJSON(AddressAccess+Build,
function(data)
{
//Do a lot of manipulations to MainDisplay Variable
$('#searchoutputtable').app... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16262484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638809/"
] | When using the reflow table widget you have to definitely make sure that you use the `<thead>` and `<tbody>` tags when working with tables. Thus in the above example my MainDisplay variable had a standard table in it without the thead and tbody tags and hence the error. | @GiddyUpHorsey is right. Actullay things are also written on tutorial site of jquery mobile.
Have a look at - <http://www.w3schools.com/jquerymobile/jquerymobile_tables.asp>
In reflow example it is written in hint area. |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | You can also bind a keypress listener to the element or form. The iphone "Go" button is the same as the enter button on a computer, char 13.
```
$('someElem').bind("keypress", function(e){
// 'Go' key code is 13
if (e.which === 13) {
console.log("user pressed Go");
// submit your form with expli... | As of writing (11/19/2019), on iOS 13.1.3, the following scenarios change the `return` key label:
* The `INPUT` element must be wrapped in a `FORM` element, and the `FORM` element must have an `action` attribute. (It can be an empty string, i.e. `action=""`.)
* If the `INPUT` element has a `type` of `search`, the retu... |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | If there are more than one inputs and you want to hide the submit, the best seems:
```
<input type="submit" style="visibility:hidden;position:absolute"/>
``` | As of writing (11/19/2019), on iOS 13.1.3, the following scenarios change the `return` key label:
* The `INPUT` element must be wrapped in a `FORM` element, and the `FORM` element must have an `action` attribute. (It can be an empty string, i.e. `action=""`.)
* If the `INPUT` element has a `type` of `search`, the retu... |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | You can also bind a keypress listener to the element or form. The iphone "Go" button is the same as the enter button on a computer, char 13.
```
$('someElem').bind("keypress", function(e){
// 'Go' key code is 13
if (e.which === 13) {
console.log("user pressed Go");
// submit your form with expli... | GO button to submit is a default behaviour of iOS and don`t try to hack the keyboard because UIKeyboard is runtime header, however you can inject JS for your html in runtime and prevent GO button behaviour (GO acts like a Enter key),
Try this,
```
WKWebView *webView;
WKUserContentController *contentControll... |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | So, here was our specific issue:
We had a form with multiple user input fields, but not a true `<input type="submit">` (it was being submitted via JS).
As such, the GO button did nothing.
We then added an `<input type="submit">` and set it to `display: none` hoping that would do the trick. Nope. Didn't work.
On a w... | The code given by the others is correct.
If you are using jQuery Mobile then add
```
data-role="none"
```
to the submit input element. Like so:
```
<input type="submit" data-role="none" style="visibility: hidden; position: absolute;" />
``` |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | I could not work out why a very simple google maps form was not submitting using the iPhone Go button.
Turns out, after stripping it down, it does not work with `target="_blank"` on the form tag.
Removed that, and now the Go button works on iPhone.
Here's a [JSFiddle](https://jsfiddle.net/kmujqrms/4/) to try it | As of writing (11/19/2019), on iOS 13.1.3, the following scenarios change the `return` key label:
* The `INPUT` element must be wrapped in a `FORM` element, and the `FORM` element must have an `action` attribute. (It can be an empty string, i.e. `action=""`.)
* If the `INPUT` element has a `type` of `search`, the retu... |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | So, here was our specific issue:
We had a form with multiple user input fields, but not a true `<input type="submit">` (it was being submitted via JS).
As such, the GO button did nothing.
We then added an `<input type="submit">` and set it to `display: none` hoping that would do the trick. Nope. Didn't work.
On a w... | You can also bind a keypress listener to the element or form. The iphone "Go" button is the same as the enter button on a computer, char 13.
```
$('someElem').bind("keypress", function(e){
// 'Go' key code is 13
if (e.which === 13) {
console.log("user pressed Go");
// submit your form with expli... |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | The code given by the others is correct.
If you are using jQuery Mobile then add
```
data-role="none"
```
to the submit input element. Like so:
```
<input type="submit" data-role="none" style="visibility: hidden; position: absolute;" />
``` | Here's the submit button style that worked for me, with minimum side-effects on the page:
```
.... style="width: 0px ; height: 0px" ....
``` |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | So, here was our specific issue:
We had a form with multiple user input fields, but not a true `<input type="submit">` (it was being submitted via JS).
As such, the GO button did nothing.
We then added an `<input type="submit">` and set it to `display: none` hoping that would do the trick. Nope. Didn't work.
On a w... | Here's the submit button style that worked for me, with minimum side-effects on the page:
```
.... style="width: 0px ; height: 0px" ....
``` |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | The code given by the others is correct.
If you are using jQuery Mobile then add
```
data-role="none"
```
to the submit input element. Like so:
```
<input type="submit" data-role="none" style="visibility: hidden; position: absolute;" />
``` | Just enclosing my input type='search' in a form tag did the trick when I encountered this problem. Hopefully it might help others that had this problem as well. |
5,665,203 | Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?
I've been trying to narrow down the scenarios and this is what I've found:
* if FORM has only one user input field, go button automatically submits form
* if FORM has more than one user input fie... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5665203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172279/"
] | I could not work out why a very simple google maps form was not submitting using the iPhone Go button.
Turns out, after stripping it down, it does not work with `target="_blank"` on the form tag.
Removed that, and now the Go button works on iPhone.
Here's a [JSFiddle](https://jsfiddle.net/kmujqrms/4/) to try it | Just enclosing my input type='search' in a form tag did the trick when I encountered this problem. Hopefully it might help others that had this problem as well. |
13,043,812 | I have Three tables A, B, and C. A is a parent table with mutiple child records in B and C.
When I query into A I am getting too many records, as though FNH is doing a Cartesian product.
My query is of the form:
```
var list = session.Query<A>()
.Fetch(a=> a.Bs)
.Fetch(a=> a.Cs)
```
Where Bs is the IList prope... | 2012/10/24 | [
"https://Stackoverflow.com/questions/13043812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527516/"
] | To pass the touch from `UIScrollView`, use this code as a category:
```
@implementation UIScrollView (FixedApi)
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
NSLog(@"touch view = %@", [[touch view].class description]);
if ([[[touch vi... | disable horizontal scroling for each tableview via IB or code and set the `contentsize` of the base scroll view to be 960,`heightOfTableview` and you should be just fine... this should get you going. |
29,573,481 | I am trying to create a scatterplot of hundreds of datapoints, each with about 5 different attributes.
The data is loaded from a .csv as an array of objects, each of which looks like this:
`{hour: "02",yval: "63",foo: "33", goo:"0", bar:"1"},`
I want to display the scatterplot with the following attributes:
**Shape ... | 2015/04/11 | [
"https://Stackoverflow.com/questions/29573481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4024345/"
] | Just do all the logic and comparisons in a `function(d)` for each attribute.
First set up some helpers:
```
// symbol generators
var symbolTypes = {
"triangleDown": d3.svg.symbol().type("triangle-down"),
"circle": d3.svg.symbol().type("circle")
};
// colors for foo
var fooColors = d3.scale
.linear()
... | It's much simplier with nvd3.js
```
function prepareData (data) {
return [{
key: 'Group 1',
values: data.map(function (item) {
item.shape = item.bar == "0" ? 'circle' : 'triangle-down';
item.x = Number(item.hour);
item.y = Number(item.yval);
item... |
38,597,877 | I have viewController with slider inside and I need to change the position of slider programmatically. I am using following code:
```
mySliderOutlet.frame = CGRectMake(100, 250, mySliderOutlet.frame.size.width, mySliderOutlet.frame.size.height)
```
Problem is this doesn't do anything. Outlet is connected correctly,... | 2016/07/26 | [
"https://Stackoverflow.com/questions/38597877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4606485/"
] | Please make sure, following this are done before setting the frames on your slider
1. Autolayout is turned off and sizing classes are disabled in the storyboard.[Here is how to do it](http://i.stack.imgur.com/50IZc.png)
2. Turn off the 'auto resize subview' for the view inside the viewcontroller from storybaord.[Unche... | With `AffineTransform` you can rotate your `UISlider` `layer` try this code for this results
[](https://i.stack.imgur.com/Izo2b.png)
Swift
-----
```
class ViewController: UIViewController {
@IBOutlet weak var verticalSlider: UISlider!
func ... |
350,865 | I have a client who has a WordPress site on AWS. I'm wondering if I update WordPress core and plugins do I need to create a new AMI based on the current instance, create a new launch configuration using the new instance for the auto-scaling group? Do I then delete the old instance? I've tried reading the AWS documentat... | 2019/10/20 | [
"https://wordpress.stackexchange.com/questions/350865",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153685/"
] | From what I understood you want to override some particular CSS properties from style.css of a WordPress theme.
There might be two different situations here which needs different solutions:
1. If you are developing your own theme then you can simply edit your functions.php inside your theme files and add any JS or CS... | There's a specific hook you can use for the theme's stylesheet, [stylesheet\_uri](https://developer.wordpress.org/reference/hooks/stylesheet_uri/):
```
function wpse350851_override_stylesheet_uri( $stylesheet, $stylesheet_dir ) {
return 'http://external-host.com/css/style.css';
}
apply_filter( 'stylesheet_uri', 'w... |
78,878 | Is there a way to learn Category Theory without learning so many concepts of which you have never seen examples? | 2011/11/04 | [
"https://math.stackexchange.com/questions/78878",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/15690/"
] | There was a time,not so long ago,when you really couldn't-at least not in any great depth.This was because most of the important sources were quite advanced graduate level monographs that presumed at least a first year graduate student's knowledge of topology and algebra. MacLane's treatise, of course,is of this nature... | Yes, you just learn the category theory. Presumably what you mean, is that when reading Mac Lane or Herrlich/Strecker it seems as though you need to understand what $\mathbf{Grp,Rng,Ring,Top,Toph},R\text{-}\mathbf{Mod},\mathbf{Set},\mathbf{Ban},\mathbf{BooAlg}$,... means. Well, you don't really, but is seriously helps.... |
78,878 | Is there a way to learn Category Theory without learning so many concepts of which you have never seen examples? | 2011/11/04 | [
"https://math.stackexchange.com/questions/78878",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/15690/"
] | Yes, you just learn the category theory. Presumably what you mean, is that when reading Mac Lane or Herrlich/Strecker it seems as though you need to understand what $\mathbf{Grp,Rng,Ring,Top,Toph},R\text{-}\mathbf{Mod},\mathbf{Set},\mathbf{Ban},\mathbf{BooAlg}$,... means. Well, you don't really, but is seriously helps.... | I must strongly disagree with most of the answers here. Lawvere/Schanuel introduces CT via (di)graphs instead of "algebraic" objects. This means it's basically on the Plato's-slave level of naive, visceral understanding, like set theory or high-school geometry. It also means it would be a wise read for even experienced... |
78,878 | Is there a way to learn Category Theory without learning so many concepts of which you have never seen examples? | 2011/11/04 | [
"https://math.stackexchange.com/questions/78878",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/15690/"
] | There was a time,not so long ago,when you really couldn't-at least not in any great depth.This was because most of the important sources were quite advanced graduate level monographs that presumed at least a first year graduate student's knowledge of topology and algebra. MacLane's treatise, of course,is of this nature... | I must strongly disagree with most of the answers here. Lawvere/Schanuel introduces CT via (di)graphs instead of "algebraic" objects. This means it's basically on the Plato's-slave level of naive, visceral understanding, like set theory or high-school geometry. It also means it would be a wise read for even experienced... |
50,397,920 | I have had an issue with syntax highlighting/coloring since Xcode 9.3.0. I work in multiple tabs a lot. Sometimes I have the same file open in multiple tabs to either have reference to different parts of the file or if I'm using one with the debugger and the other for reference.
Since 9.3.0, when I launch my app with... | 2018/05/17 | [
"https://Stackoverflow.com/questions/50397920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2411311/"
] | When you call `groet("Rick")` it calls `groet()` which calls `groet()` which calls `groet()` which calls `groet()`...
Use the parameter like this.
```
function groet(naam){
console.log("Hey " + naam);
}
groet("Rick");
``` | Your function is recursive (it calls itself). You are missing a key requirement for the recursion to work, the base case. Base cases are conditions under which you don't call the function itself anymore. |
50,397,920 | I have had an issue with syntax highlighting/coloring since Xcode 9.3.0. I work in multiple tabs a lot. Sometimes I have the same file open in multiple tabs to either have reference to different parts of the file or if I'm using one with the debugger and the other for reference.
Since 9.3.0, when I launch my app with... | 2018/05/17 | [
"https://Stackoverflow.com/questions/50397920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2411311/"
] | When you call `groet("Rick")` it calls `groet()` which calls `groet()` which calls `groet()` which calls `groet()`...
Use the parameter like this.
```
function groet(naam){
console.log("Hey " + naam);
}
groet("Rick");
``` | Since the OP isn't responding to questions it's rather difficult to determine where their confusion lies. I guess they don't understand [recursion](http://pages.cs.wisc.edu/~calvin/cs110/RECURSION.html) (a function that calls itself):
```
function groet(naam){
var naam = groet();//Call to self
console.log("Hey " +... |
40,044,750 | I am trying to send the values of 7 jquery checkboxes to php via ajax. I am attempting to put the values in an array and serialize the array in ajax. Ultimately, I would like to use the values of the checkboxes as conditions in a MySQL WHERE clause. My ajax completes successfully but the value of the array is always nu... | 2016/10/14 | [
"https://Stackoverflow.com/questions/40044750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7003306/"
] | You are using a class selector while your checkboxes does not have class attributes | some changes in your code step by step
>
> html code
>
>
>
```
<input class="revenue" type="checkbox" name="revenue_checkboxes[]" id="production_select" value="Production">
```
set checkbox name array and add common class revenue add and selecter user by javascript code
>
> Ajax code
>
>
>
```
var revenu... |
40,044,750 | I am trying to send the values of 7 jquery checkboxes to php via ajax. I am attempting to put the values in an array and serialize the array in ajax. Ultimately, I would like to use the values of the checkboxes as conditions in a MySQL WHERE clause. My ajax completes successfully but the value of the array is always nu... | 2016/10/14 | [
"https://Stackoverflow.com/questions/40044750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7003306/"
] | You are using a class selector while your checkboxes does not have class attributes | To select the checkboxes by name:
```
j('[name=revenue_checkboxes]:checked').serialize()
``` |
81,726 | I have a library of 20,000+ JPG images and I've now decided it is time to clean up the collection: sort, edit, crop, straighten, delete etc.
So I have a few questions:
1. By editing a JPG and exporting the version, will I be losing image quality/data?
2. I don't want to keep two sets of JPGs – the original + version ... | 2016/08/06 | [
"https://photo.stackexchange.com/questions/81726",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/55539/"
] | Any 'exports' of a JPG image will result in a loss of data. This is because the JPG format is a 'lossy format'. So, every time you 'save' a change, the image quality will be impacted.
You can certainly overwrite JPG with an edited version, but bear in mind that doing so will likely result in less quality vs your 'ori... | I had a similar catalogue situation earlier this year. I solved my photo mess by using Lightroom. Lightroom does cost a few bucks, but I think it is worth it. It supports grouping of photos and you can easily weed out the duplicates, and it also has the option to keep or modify the metadata from the source file. And ye... |
67,723,162 | I need to write a linq based on the following query.
IN SQL Server,
```
select EXID,ID,NAME
from Table1 A
join Table2 B on A.BXID = B.BID
left outer join Table3 C ON C.AXID = A.ID
AND C.EXID = (some number/NULL)
```
This gives me 300 records
In LINQ,
```
try
{
using (var context = new cltrans... | 2021/05/27 | [
"https://Stackoverflow.com/questions/67723162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14591102/"
] | This query will create LEFT JOIN:
```cs
var query =
from A in context.Table1
join B in context.Table2 on A.BXID equals B.BID
from C in context.Table3.Where(C => A.ID == C.AXID && C.EXID == ...).DefaultIfEmpty()
select new Table1
{
ID = A.ID,
name = A.NAME + '-' B.Name
};
``` | This should do it
```
var query =
from A in context.Table1
join B in context.Table2 on A.BXID equals B.BID
join table3 in context.Table3.Where(X => x.EXID = 123) on A.ID == table3.AXID into table3Joined
from C in table3Joined.DefaultIfEmpty() // this is how we do the left join
select new Table1
... |
72,650,062 | I have a dataset with the first 4 columns and I want to create the last column. My dataset has millions of records.
| ID | Date | Code | Event of Interest | *Want to Create* |
| --- | --- | --- | --- | --- |
| 1 | 1/1/2022 | 101 | \* | 201 |
| 1 | 1/1/2022 | 201 | yes | 201 |
| 1 | 1/1/2022 | 301 | \* | 201 |
| 1 | 1/... | 2022/06/16 | [
"https://Stackoverflow.com/questions/72650062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5664466/"
] | Try this:
```
SELECT UserID
FROM Events
WHERE Event_Type IN ('A', 'B', 'C')
GROUP BY UserID
HAVING COUNT(*) = 2 AND MAX(Event_Type) <> 'C'
``` | Here's an alternative query:
```
SELECT UserID
FROM Events
WHERE Event_Type IN ('A', 'B', 'C')
GROUP BY UserID
HAVING GROUP_CONCAT(DISTINCT Event_Type ORDER BY Event_Type) = 'A,B';
```
The query given in Joel Coehoorn's answer would also work for your question as described, but mine does not rely on the one you want... |
1,470,825 | I've been struggling with the concept of proofs ever since I completed my introductory logic course "Axiomatic Systems". In that course it seemed to be easy. We were pretty much just using various logical methods to prove the properties of real numbers. Now it doesn't seem nearly as simple. I often find myself stumped ... | 2015/10/08 | [
"https://math.stackexchange.com/questions/1470825",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/278347/"
] | Induction is, in essence, a way of proving statements about integers. The "fact" that it works is really an axiom, and it says:
>
> If $P(n)$ is some property of natural number $n$ which satisfies the following conditions:
>
>
> 1. $P(1)$ is true.
> 2. $P(n)\implies P(n+1)$ is true.
> Then the statement $$\forall n... | If you want to really understand its full significance the principle of induction you should, in particular, not overlook that you can also show that if true for n also should apply to n-1 (not for "up" but for "down").
This is a modality that goes unnoticed by many people.
I recommend the Godement's book **Cours d'A... |
50,611,514 | I created a NuGet package and I was able to successfully install it in another .NET solution. But I'm not able to add a reference to the NuGet package from the other .NET solution.
For example, the NuGet package has a class with a namespace like `MyCorp.SecurityApi`. I'm currently not able to add a using directive for... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50611514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9393635/"
] | Make sure you double check the “namespace” name with the “References” in your solution explorer, whether it exists or not. If it doesn’t you should consider reinstalling. Use the following command in Nuget Package Manager Console:
```
Update-Package -Id <package_name> –reinstall
```
Or this to restrict the re-instal... | This is the first NuGet package that I've created. I figured out the issue and I'm posting this for other NuGet newbies. In "NuGet Package Explorer":
1. Content > Add > Lib Folder
2. Right-click "lib" folder and select "Add Existing File..."
3. In the select file dialog, select all files from bin\obj of the source sol... |
50,611,514 | I created a NuGet package and I was able to successfully install it in another .NET solution. But I'm not able to add a reference to the NuGet package from the other .NET solution.
For example, the NuGet package has a class with a namespace like `MyCorp.SecurityApi`. I'm currently not able to add a using directive for... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50611514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9393635/"
] | Make sure you double check the “namespace” name with the “References” in your solution explorer, whether it exists or not. If it doesn’t you should consider reinstalling. Use the following command in Nuget Package Manager Console:
```
Update-Package -Id <package_name> –reinstall
```
Or this to restrict the re-instal... | I would first try to do an
```
Update-Package -Id <package_name> –reinstall
```
as explained in Mikaal's answer.
But in some cases, this could also fail because the `packages` folder got corrupt. Depending on the platform, it is located in different paths:
* In **.NET**, this folder can be found within the project... |
50,611,514 | I created a NuGet package and I was able to successfully install it in another .NET solution. But I'm not able to add a reference to the NuGet package from the other .NET solution.
For example, the NuGet package has a class with a namespace like `MyCorp.SecurityApi`. I'm currently not able to add a using directive for... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50611514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9393635/"
] | Make sure you double check the “namespace” name with the “References” in your solution explorer, whether it exists or not. If it doesn’t you should consider reinstalling. Use the following command in Nuget Package Manager Console:
```
Update-Package -Id <package_name> –reinstall
```
Or this to restrict the re-instal... | A problem could be due to:
* Incompatible target framework of nuget package (MyCorp.SecurityApi) and aplication that attempts to use it
* Incompatible platform architecture (i.e. if MyCorp.SecurityApi is x64 only it can'not be used to build x86 application)
* Visibility of some classes i.e. if class is internal it can... |
50,611,514 | I created a NuGet package and I was able to successfully install it in another .NET solution. But I'm not able to add a reference to the NuGet package from the other .NET solution.
For example, the NuGet package has a class with a namespace like `MyCorp.SecurityApi`. I'm currently not able to add a using directive for... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50611514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9393635/"
] | I would first try to do an
```
Update-Package -Id <package_name> –reinstall
```
as explained in Mikaal's answer.
But in some cases, this could also fail because the `packages` folder got corrupt. Depending on the platform, it is located in different paths:
* In **.NET**, this folder can be found within the project... | This is the first NuGet package that I've created. I figured out the issue and I'm posting this for other NuGet newbies. In "NuGet Package Explorer":
1. Content > Add > Lib Folder
2. Right-click "lib" folder and select "Add Existing File..."
3. In the select file dialog, select all files from bin\obj of the source sol... |
50,611,514 | I created a NuGet package and I was able to successfully install it in another .NET solution. But I'm not able to add a reference to the NuGet package from the other .NET solution.
For example, the NuGet package has a class with a namespace like `MyCorp.SecurityApi`. I'm currently not able to add a using directive for... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50611514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9393635/"
] | A problem could be due to:
* Incompatible target framework of nuget package (MyCorp.SecurityApi) and aplication that attempts to use it
* Incompatible platform architecture (i.e. if MyCorp.SecurityApi is x64 only it can'not be used to build x86 application)
* Visibility of some classes i.e. if class is internal it can... | This is the first NuGet package that I've created. I figured out the issue and I'm posting this for other NuGet newbies. In "NuGet Package Explorer":
1. Content > Add > Lib Folder
2. Right-click "lib" folder and select "Add Existing File..."
3. In the select file dialog, select all files from bin\obj of the source sol... |
44,406,830 | I need to insert a finance\_entity for each club in a one to one relationship.
I decided to run this in the mysql server, because single inserts are even slower. How could I optimize this to run faster? Is there some way to hack insert select to do this?
I cannot put the club\_id on finance\_entity, since more then o... | 2017/06/07 | [
"https://Stackoverflow.com/questions/44406830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4670340/"
] | That's a simple one. You almost got it, but you forgot to actually create an instance of your new class Testme. You need to do this, even if the creation of an instance of a particular class doesn't take any parameters (as for Testme). But it's easier to forget than for a convolutional layer, to which you typically pas... | i have got this error because i made a simple thing in PyTorch I just put `(` `in a new line`
```
return nn.Sequential
( #Here is the Error
nn.Conv2d(input_ch,output_ch,kernal_size,strid),
nn.BatchNorm2d(output_ch),
nn.LeakyReLU(0.2,inplace=True)
)
```
to Fix just mo... |
458,469 | По сути ничего кроме окончания не отличается. Но изменение окончания должно как-то влиять на значение. | 2020/02/18 | [
"https://rus.stackexchange.com/questions/458469",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/195967/"
] | Смысл не меняется. В словарях указывается, что использование родительного падежа с этим предлогом — разговорный стиль (в нескольких значениях — устаревшее).
[http://gramota.ru/slovari/dic/?all=x&word=между](http://gramota.ru/slovari/dic/?all=x&word=%D0%BC%D0%B5%D0%B6%D0%B4%D1%83) | В обычных текстах употребляются обе формы, причем по семантике их различить трудно. Но частотность больше у формы ***между деревьями*** (500:90).
Исключение составляют фразеологизмы.
*Тропа петляла **между деревьев**. **Между деревьями** ― мраморные статуи, посеревшие от времени.*
Повтор вопроса:
[Предлоги и падеж... |
4,451,243 | Proof by contrapositive:
Let $x \in \mathbb{Z}$. Assume that $2 \nmid x$. Thus, $\forall k \in \mathbb{Z}$, $2k \neq x \Rightarrow (2k)^3 \neq x^3 \Rightarrow 8k^3 \neq x^3 \Rightarrow 2(4k^3) \neq x^3$. B/c $4k^3 \in \mathbb{Z}$, $2 \nmid x^3$. $\therefore 2 \nmid x \Rightarrow 2 \nmid x^3$, so the contrapositive $2 ... | 2022/05/15 | [
"https://math.stackexchange.com/questions/4451243",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1006779/"
] | This method is not valid. You showed that $2(4k^3)\neq x^3$ for all $k\in\mathbb Z$ correctly, but but to show that $2\nmid x^3$, you need to show that $2n\neq x^3$ for *all* integers $n$, not just integers of the form $4k^3$ for some $k\in\mathbb Z$.
To illustrate why this is important, consider the following (false)... | There are a couple issues:
* You didn't really show that $2$ does not divide $x^3$. Rather, you showed that, for all $k\in\Bbb Z$, $x^3\neq 2(4k^3)$. It's not clear why $x^3$ must be of the form $2(4k^3)$ if $2|x$.
* The statement $2k\neq x\implies (2k)^3\neq x^3$ is true, but only because $x\mapsto x^3$ is injective.... |
4,451,243 | Proof by contrapositive:
Let $x \in \mathbb{Z}$. Assume that $2 \nmid x$. Thus, $\forall k \in \mathbb{Z}$, $2k \neq x \Rightarrow (2k)^3 \neq x^3 \Rightarrow 8k^3 \neq x^3 \Rightarrow 2(4k^3) \neq x^3$. B/c $4k^3 \in \mathbb{Z}$, $2 \nmid x^3$. $\therefore 2 \nmid x \Rightarrow 2 \nmid x^3$, so the contrapositive $2 ... | 2022/05/15 | [
"https://math.stackexchange.com/questions/4451243",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1006779/"
] | This method is not valid. You showed that $2(4k^3)\neq x^3$ for all $k\in\mathbb Z$ correctly, but but to show that $2\nmid x^3$, you need to show that $2n\neq x^3$ for *all* integers $n$, not just integers of the form $4k^3$ for some $k\in\mathbb Z$.
To illustrate why this is important, consider the following (false)... | Suppose $2 \mid x^3$.
Assume $2 \nmid x$,
then $\exists r \in \mathbb{N}$ such that $x = 2r + 1$.
Then $$x^3 = (2r + 1)^3$$
$$=8r^3 + 12r^2 + 18r + 1$$
Since $2 \mid x^3$, then it follows that $2 \mid (8r^3 + 12r^2 + 18r + 1)$,
But, while $2 \mid 8r^3$, $2 \mid 12r^2$ and $2 \mid 18r$,
$$2 \nmid 1$$
Now we arrive ... |
4,451,243 | Proof by contrapositive:
Let $x \in \mathbb{Z}$. Assume that $2 \nmid x$. Thus, $\forall k \in \mathbb{Z}$, $2k \neq x \Rightarrow (2k)^3 \neq x^3 \Rightarrow 8k^3 \neq x^3 \Rightarrow 2(4k^3) \neq x^3$. B/c $4k^3 \in \mathbb{Z}$, $2 \nmid x^3$. $\therefore 2 \nmid x \Rightarrow 2 \nmid x^3$, so the contrapositive $2 ... | 2022/05/15 | [
"https://math.stackexchange.com/questions/4451243",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1006779/"
] | There are a couple issues:
* You didn't really show that $2$ does not divide $x^3$. Rather, you showed that, for all $k\in\Bbb Z$, $x^3\neq 2(4k^3)$. It's not clear why $x^3$ must be of the form $2(4k^3)$ if $2|x$.
* The statement $2k\neq x\implies (2k)^3\neq x^3$ is true, but only because $x\mapsto x^3$ is injective.... | Suppose $2 \mid x^3$.
Assume $2 \nmid x$,
then $\exists r \in \mathbb{N}$ such that $x = 2r + 1$.
Then $$x^3 = (2r + 1)^3$$
$$=8r^3 + 12r^2 + 18r + 1$$
Since $2 \mid x^3$, then it follows that $2 \mid (8r^3 + 12r^2 + 18r + 1)$,
But, while $2 \mid 8r^3$, $2 \mid 12r^2$ and $2 \mid 18r$,
$$2 \nmid 1$$
Now we arrive ... |
13,335,841 | Is there a more efficient way of drawing lines in WPF other than using
```
DrawingContext.DrawLine(pen, a, b); ?
```
Im doing a lot of line drawing in my application, and 99% of the time is spent in a loop making this call.
[a,b] come from a very large list of points which are continually changing. i dont need any ... | 2012/11/11 | [
"https://Stackoverflow.com/questions/13335841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1520910/"
] | you could try to freeze the Pen. Here is an overview on [freezable objects](http://msdn.microsoft.com/de-de/library/ms750509%28v=vs.85%29.aspx). | It appears that [StreamGeometry](http://msdn.microsoft.com/en-us/library/system.windows.media.streamgeometry.aspx) is the way to go. Even without freezing it, I still get a performance improvement. |
13,335,841 | Is there a more efficient way of drawing lines in WPF other than using
```
DrawingContext.DrawLine(pen, a, b); ?
```
Im doing a lot of line drawing in my application, and 99% of the time is spent in a loop making this call.
[a,b] come from a very large list of points which are continually changing. i dont need any ... | 2012/11/11 | [
"https://Stackoverflow.com/questions/13335841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1520910/"
] | you could try to freeze the Pen. Here is an overview on [freezable objects](http://msdn.microsoft.com/de-de/library/ms750509%28v=vs.85%29.aspx). | This question is really old but I found a way that improved the execution of my code which used DrawingContext.DrawLine aswell.
This was my code to draw a curve one hour ago:
```
DrawingVisual dv = new DrawingVisual();
DrawingContext dc = dv.RenderOpen();
foreach (SerieVM serieVm in _curve.Series) {
Pen seriePen... |
13,335,841 | Is there a more efficient way of drawing lines in WPF other than using
```
DrawingContext.DrawLine(pen, a, b); ?
```
Im doing a lot of line drawing in my application, and 99% of the time is spent in a loop making this call.
[a,b] come from a very large list of points which are continually changing. i dont need any ... | 2012/11/11 | [
"https://Stackoverflow.com/questions/13335841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1520910/"
] | This question is really old but I found a way that improved the execution of my code which used DrawingContext.DrawLine aswell.
This was my code to draw a curve one hour ago:
```
DrawingVisual dv = new DrawingVisual();
DrawingContext dc = dv.RenderOpen();
foreach (SerieVM serieVm in _curve.Series) {
Pen seriePen... | It appears that [StreamGeometry](http://msdn.microsoft.com/en-us/library/system.windows.media.streamgeometry.aspx) is the way to go. Even without freezing it, I still get a performance improvement. |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | Try the following:
```
var totalprice = 0;
$.each(data, function(key, obj){
items.push('<li id="' + obj.id + '">' + obj.title + '€' + obj.price + '</li>');
totalprice = totalprice + parseFloat(obj.price);
});
$('#addonPrice').html(parseFloat($('#addonPrice').text()) + totalprice);
```
You need to initialize... | You need to instantiate `totalprice` before the loop as the totalprice will cease to exist out of the context of `$.each`. |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | You should initialize `totalprice` to zero before the loop as well as apply `parseFloat()` to `obj.price` before adding it:
```
var totalprice = 0;
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + obj.title + '€' + obj.price + '</li>');
totalprice += parseFloat(obj.price);
});
$("#addo... | You need to instantiate `totalprice` before the loop as the totalprice will cease to exist out of the context of `$.each`. |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | There are a couple of things about this. First you haven't shown where and how is the `totalprice` variable being initialized. Normally this should be done outside of the loop. Secondly depending on the type of `obj.price`, the `+=` operator you are using might perform string concatenations instead of number additions.... | You need to instantiate `totalprice` before the loop as the totalprice will cease to exist out of the context of `$.each`. |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | try this :
```
totalprice += parseInt(obj.price);
``` | You need to instantiate `totalprice` before the loop as the totalprice will cease to exist out of the context of `$.each`. |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | Try the following:
```
var totalprice = 0;
$.each(data, function(key, obj){
items.push('<li id="' + obj.id + '">' + obj.title + '€' + obj.price + '</li>');
totalprice = totalprice + parseFloat(obj.price);
});
$('#addonPrice').html(parseFloat($('#addonPrice').text()) + totalprice);
```
You need to initialize... | You should initialize `totalprice` to zero before the loop as well as apply `parseFloat()` to `obj.price` before adding it:
```
var totalprice = 0;
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + obj.title + '€' + obj.price + '</li>');
totalprice += parseFloat(obj.price);
});
$("#addo... |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | Try the following:
```
var totalprice = 0;
$.each(data, function(key, obj){
items.push('<li id="' + obj.id + '">' + obj.title + '€' + obj.price + '</li>');
totalprice = totalprice + parseFloat(obj.price);
});
$('#addonPrice').html(parseFloat($('#addonPrice').text()) + totalprice);
```
You need to initialize... | There are a couple of things about this. First you haven't shown where and how is the `totalprice` variable being initialized. Normally this should be done outside of the loop. Secondly depending on the type of `obj.price`, the `+=` operator you are using might perform string concatenations instead of number additions.... |
7,773,966 | I am trying to add to a variable and get the total price at the end of the loop and add it to a value in a span tag and update it. I am unsure how to do with jquery, I usualy do it with php. This is what I have tried but I get nothing.
```
$.each(data, function(key, obj) {
items.push('<li id="' + obj.id + '">' + o... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7773966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652541/"
] | Try the following:
```
var totalprice = 0;
$.each(data, function(key, obj){
items.push('<li id="' + obj.id + '">' + obj.title + '€' + obj.price + '</li>');
totalprice = totalprice + parseFloat(obj.price);
});
$('#addonPrice').html(parseFloat($('#addonPrice').text()) + totalprice);
```
You need to initialize... | try this :
```
totalprice += parseInt(obj.price);
``` |
235,512 | What are some good ways to have patch management and systems/hardware inventory for a Windows (Server 2003 or 2008) network?
For example, at a minimum knowing the basics for all the machines out on the network such as OS version, patch level, what hotfixes they have, processor, ram, etc.
Even better would be knowing... | 2011/02/15 | [
"https://serverfault.com/questions/235512",
"https://serverfault.com",
"https://serverfault.com/users/41580/"
] | Take a look at OCS Inventory: <http://www.ocsinventory-ng.org/> . It does most of what you want, but be warned that the GUI is a little... rough. Something else to consider would be WSUS. It can definitely tell you hotfixes/patches/system information, but it can be a bit tricky to set up.
I suspect a combination of OC... | [SpiceWorks](http://www.spiceworks.com/) does a decent job of the inventory part of what you want, may be a big "bulky" for you however. For windows patching/updating, [WSUS](http://technet.microsoft.com/en-us/wsus/default) is made for your need. It's not too hard to setup, maybe an afternoon at most. |
235,512 | What are some good ways to have patch management and systems/hardware inventory for a Windows (Server 2003 or 2008) network?
For example, at a minimum knowing the basics for all the machines out on the network such as OS version, patch level, what hotfixes they have, processor, ram, etc.
Even better would be knowing... | 2011/02/15 | [
"https://serverfault.com/questions/235512",
"https://serverfault.com",
"https://serverfault.com/users/41580/"
] | Take a look at OCS Inventory: <http://www.ocsinventory-ng.org/> . It does most of what you want, but be warned that the GUI is a little... rough. Something else to consider would be WSUS. It can definitely tell you hotfixes/patches/system information, but it can be a bit tricky to set up.
I suspect a combination of OC... | If your environment is larger than 1,500 machines, the [Microsoft System Center](http://www.microsoft.com/systemcenter/en/us/configuration-manager/cm-overview.aspx) suite of products might be right for you. If you are a Microsoft Partner, it is a cost effective option for a smaller company. But if you actually purchase... |
235,512 | What are some good ways to have patch management and systems/hardware inventory for a Windows (Server 2003 or 2008) network?
For example, at a minimum knowing the basics for all the machines out on the network such as OS version, patch level, what hotfixes they have, processor, ram, etc.
Even better would be knowing... | 2011/02/15 | [
"https://serverfault.com/questions/235512",
"https://serverfault.com",
"https://serverfault.com/users/41580/"
] | Take a look at OCS Inventory: <http://www.ocsinventory-ng.org/> . It does most of what you want, but be warned that the GUI is a little... rough. Something else to consider would be WSUS. It can definitely tell you hotfixes/patches/system information, but it can be a bit tricky to set up.
I suspect a combination of OC... | For both purposes Microsoft offers freely available tools:
For inventory and assessment of your infrastructure you can use `MAP toolkit`, which works will almost all editions and version of Windows Desktop & Server OSs using WMI, and moreover it also can inventory **HP-UX**, **VMWare ESX(i)** and a variety of **Linux*... |
235,512 | What are some good ways to have patch management and systems/hardware inventory for a Windows (Server 2003 or 2008) network?
For example, at a minimum knowing the basics for all the machines out on the network such as OS version, patch level, what hotfixes they have, processor, ram, etc.
Even better would be knowing... | 2011/02/15 | [
"https://serverfault.com/questions/235512",
"https://serverfault.com",
"https://serverfault.com/users/41580/"
] | [SpiceWorks](http://www.spiceworks.com/) does a decent job of the inventory part of what you want, may be a big "bulky" for you however. For windows patching/updating, [WSUS](http://technet.microsoft.com/en-us/wsus/default) is made for your need. It's not too hard to setup, maybe an afternoon at most. | If your environment is larger than 1,500 machines, the [Microsoft System Center](http://www.microsoft.com/systemcenter/en/us/configuration-manager/cm-overview.aspx) suite of products might be right for you. If you are a Microsoft Partner, it is a cost effective option for a smaller company. But if you actually purchase... |
235,512 | What are some good ways to have patch management and systems/hardware inventory for a Windows (Server 2003 or 2008) network?
For example, at a minimum knowing the basics for all the machines out on the network such as OS version, patch level, what hotfixes they have, processor, ram, etc.
Even better would be knowing... | 2011/02/15 | [
"https://serverfault.com/questions/235512",
"https://serverfault.com",
"https://serverfault.com/users/41580/"
] | For both purposes Microsoft offers freely available tools:
For inventory and assessment of your infrastructure you can use `MAP toolkit`, which works will almost all editions and version of Windows Desktop & Server OSs using WMI, and moreover it also can inventory **HP-UX**, **VMWare ESX(i)** and a variety of **Linux*... | If your environment is larger than 1,500 machines, the [Microsoft System Center](http://www.microsoft.com/systemcenter/en/us/configuration-manager/cm-overview.aspx) suite of products might be right for you. If you are a Microsoft Partner, it is a cost effective option for a smaller company. But if you actually purchase... |
26,292,776 | How to change colour of drop down menu. Like if i have a drop down menu with 5 options, when ever i click an option i want that option to change colour so that i can keep track which options i have already selected. ( 5 here is hypothetical, i have bigger list with IP`s and ports as field so cannot remember all the fie... | 2014/10/10 | [
"https://Stackoverflow.com/questions/26292776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2541488/"
] | ```js
var select = document.getElementById('select');
select.onchange = function() {
select.options[select.selectedIndex].style.backgroundColor = 'red';
}
var clean = document.getElementById('clean');
clean.onclick = function() {
for(var i = 0; i < select.options.length; i++) {
select.options[i].sty... | Try this
```
$('yourdropdownid option:selected').css('background-color', 'red');
``` |
26,292,776 | How to change colour of drop down menu. Like if i have a drop down menu with 5 options, when ever i click an option i want that option to change colour so that i can keep track which options i have already selected. ( 5 here is hypothetical, i have bigger list with IP`s and ports as field so cannot remember all the fie... | 2014/10/10 | [
"https://Stackoverflow.com/questions/26292776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2541488/"
] | ```js
var select = document.getElementById('select');
select.onchange = function() {
select.options[select.selectedIndex].style.backgroundColor = 'red';
}
var clean = document.getElementById('clean');
clean.onclick = function() {
for(var i = 0; i < select.options.length; i++) {
select.options[i].sty... | Here you go: [DEMO
----](http://jsfiddle.net/a3ahb6pj/)
```
$('select option').click(function(){
$(this).css('background','yellow');
});
``` |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | `"String".intern()` creates a different instance of String stored in permgen or metaspace while the original instance is stored on regular heap. Therefore your comparison will always be false. | Always compare strings using `equals()`method!!! |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | You need to know that String literals are placed in string pool by default like
```
String s = "Hello";//this will be in string pool
```
but Strings created at runtime via `new String(...)` are not by default placed or retrieved from this pool.
```
String s2 = new String(s);// or even `new String("Hello")`
System.... | Always compare strings using `equals()`method!!! |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | I'm not really sure what you're facing, but if you want to compare the addresses of the strings by using the `intern()` method, this will also work:
```
if ("String ".trim().intern() == "String") {
System.out.println("Equals");
} else {
System.out.println("Unequal");
}
```
You only have to swap the `trim()` ... | Always compare strings using `equals()`method!!! |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | `"String".intern()` creates a different instance of String stored in permgen or metaspace while the original instance is stored on regular heap. Therefore your comparison will always be false. | Try something like this:
```
if("String ".trim().equals("String")){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
---
**Useful Link**
1. [==, .equals(), compareTo(), and compare()](http://www.ensta-paristech.fr/~diam/java/online/notes-java/data/expressions/22compareobjects.html)... |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | You need to know that String literals are placed in string pool by default like
```
String s = "Hello";//this will be in string pool
```
but Strings created at runtime via `new String(...)` are not by default placed or retrieved from this pool.
```
String s2 = new String(s);// or even `new String("Hello")`
System.... | Try something like this:
```
if("String ".trim().equals("String")){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
---
**Useful Link**
1. [==, .equals(), compareTo(), and compare()](http://www.ensta-paristech.fr/~diam/java/online/notes-java/data/expressions/22compareobjects.html)... |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | I'm not really sure what you're facing, but if you want to compare the addresses of the strings by using the `intern()` method, this will also work:
```
if ("String ".trim().intern() == "String") {
System.out.println("Equals");
} else {
System.out.println("Unequal");
}
```
You only have to swap the `trim()` ... | Try something like this:
```
if("String ".trim().equals("String")){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
---
**Useful Link**
1. [==, .equals(), compareTo(), and compare()](http://www.ensta-paristech.fr/~diam/java/online/notes-java/data/expressions/22compareobjects.html)... |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | You need to know that String literals are placed in string pool by default like
```
String s = "Hello";//this will be in string pool
```
but Strings created at runtime via `new String(...)` are not by default placed or retrieved from this pool.
```
String s2 = new String(s);// or even `new String("Hello")`
System.... | `"String".intern()` creates a different instance of String stored in permgen or metaspace while the original instance is stored on regular heap. Therefore your comparison will always be false. |
21,603,742 | ```
if("String ".intern().trim()=="String"){
System.out.println("Equals");
}else{
System.out.println("Unequal");
}
```
above code is showing `Unequal`. I don't understand why? Can someone explain it? | 2014/02/06 | [
"https://Stackoverflow.com/questions/21603742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279634/"
] | I'm not really sure what you're facing, but if you want to compare the addresses of the strings by using the `intern()` method, this will also work:
```
if ("String ".trim().intern() == "String") {
System.out.println("Equals");
} else {
System.out.println("Unequal");
}
```
You only have to swap the `trim()` ... | `"String".intern()` creates a different instance of String stored in permgen or metaspace while the original instance is stored on regular heap. Therefore your comparison will always be false. |
55,113,982 | I have been trying to use packer to create an AMI from Lambda for a particular use case. I am using bash custom runtime environment. I pulled the packer package and unzipped it.
But when I try to run the executable, Lambda throws me out with exit status 1 and the error is not descriptive too. I tried to fix this in a... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55113982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2720645/"
] | Don't try to run Packer in Lambda, use AWS ECS Fargate and run the [official docker image](https://hub.docker.com/r/hashicorp/packer). | if you want to create AMI using lambda at a particular time like triggering lambda with cron job and take AMI backup of ec2 you can follow my blog :
>
> <https://knowihave.blogspot.com/2018/09/aws-auto-ami-backup-across-all-region.html>
>
>
>
code also available on my git :
>
> <https://github.com/harsh4870/A... |
55,113,982 | I have been trying to use packer to create an AMI from Lambda for a particular use case. I am using bash custom runtime environment. I pulled the packer package and unzipped it.
But when I try to run the executable, Lambda throws me out with exit status 1 and the error is not descriptive too. I tried to fix this in a... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55113982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2720645/"
] | The Lambda execution environment is mounted on a read-only filesystem, except for `/tmp` which provides 512mb of scratch space. Add `cd /tmp` to the start of your Bash script to manipulate the downloaded file within the temp folder. | if you want to create AMI using lambda at a particular time like triggering lambda with cron job and take AMI backup of ec2 you can follow my blog :
>
> <https://knowihave.blogspot.com/2018/09/aws-auto-ami-backup-across-all-region.html>
>
>
>
code also available on my git :
>
> <https://github.com/harsh4870/A... |
55,113,982 | I have been trying to use packer to create an AMI from Lambda for a particular use case. I am using bash custom runtime environment. I pulled the packer package and unzipped it.
But when I try to run the executable, Lambda throws me out with exit status 1 and the error is not descriptive too. I tried to fix this in a... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55113982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2720645/"
] | Don't try to run Packer in Lambda, use AWS ECS Fargate and run the [official docker image](https://hub.docker.com/r/hashicorp/packer). | The Lambda execution environment is mounted on a read-only filesystem, except for `/tmp` which provides 512mb of scratch space. Add `cd /tmp` to the start of your Bash script to manipulate the downloaded file within the temp folder. |
23,027,548 | I have the following object:
```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again... | 2014/04/12 | [
"https://Stackoverflow.com/questions/23027548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1711789/"
] | Try-
```
dpsets.routes.push((currentSet));
alert(JSON.stringify(dpsets));
```
[fiddle](http://jsfiddle.net/vbN9P/) | Did you try to use the method concat()?
dpsets.concat(currentSet) |
23,027,548 | I have the following object:
```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again... | 2014/04/12 | [
"https://Stackoverflow.com/questions/23027548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1711789/"
] | Originally this didn't work:
`dpsets.routes.push(currentSet)`
However, after trying it again, it worked fine. | Try-
```
dpsets.routes.push((currentSet));
alert(JSON.stringify(dpsets));
```
[fiddle](http://jsfiddle.net/vbN9P/) |
23,027,548 | I have the following object:
```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again... | 2014/04/12 | [
"https://Stackoverflow.com/questions/23027548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1711789/"
] | Originally this didn't work:
`dpsets.routes.push(currentSet)`
However, after trying it again, it worked fine. | Did you try to use the method concat()?
dpsets.concat(currentSet) |
23,027,548 | I have the following object:
```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again... | 2014/04/12 | [
"https://Stackoverflow.com/questions/23027548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1711789/"
] | ```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again",
"with info"
]
}
]
};
var currentSet = {
"name": "N... | Did you try to use the method concat()?
dpsets.concat(currentSet) |
23,027,548 | I have the following object:
```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again... | 2014/04/12 | [
"https://Stackoverflow.com/questions/23027548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1711789/"
] | Originally this didn't work:
`dpsets.routes.push(currentSet)`
However, after trying it again, it worked fine. | ```
var dpsets = {
"routes": [
{
"name": "first",
"values": [
"info",
"more info",
"text"
]
},
{
"name": "second",
"values": [
"text again",
"with info"
]
}
]
};
var currentSet = {
"name": "N... |
8,941,726 | I'm using Anything slider (https://github.com/ProLoser/AnythingSlider/wiki) and I have edited it so that the visitor can see the next & previous images to be filtered into the middle. For the purposes of this post that middle slide is classed as the 'active' slide and the images either side are classed as inactive. See... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8941726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160619/"
] | Add the following:
```
.panel{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 8 */
filter: alpha(opacity=50); /* IE 5-7 */
opacity: 0.5; /* Other browsers */
}
.panel.activePage{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; /* IE 8 */
filter: alpha(opacity=... | Add the following lines to your css:
```
#slider .panel{
opacity: 0.1;
}
#slider .activePage{
opacity: 1;
}
``` |
56,820,386 | After searching various similar question on StackOverflow, I have determined that most people suffering from this issue are not properly scanning the module where their controller lives. Some solutions call for combining the files that are to be scanned into the same module as the Application (which works), but I do no... | 2019/06/29 | [
"https://Stackoverflow.com/questions/56820386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249424/"
] | Make your files this way:
**Project build.gradle** (removed spring plugin application to all module projects)
```html
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
}
}
subprojects {
... | I think if you want to pick up your controller from the "com.test" package use the basePackages option of the @ComponentScan:
```
@ComponentScan(basePackages = "com.test")
``` |
56,820,386 | After searching various similar question on StackOverflow, I have determined that most people suffering from this issue are not properly scanning the module where their controller lives. Some solutions call for combining the files that are to be scanned into the same module as the Application (which works), but I do no... | 2019/06/29 | [
"https://Stackoverflow.com/questions/56820386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249424/"
] | Make your files this way:
**Project build.gradle** (removed spring plugin application to all module projects)
```html
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
}
}
subprojects {
... | Your main application `Application.java` is under the directory `com.test.application` , which means that when the springboot application starts up by default the `@SpringBootApplication` annotation will look for beans and configurations under the packgae `com.test.application` . In the springboot [documentation](https... |
56,820,386 | After searching various similar question on StackOverflow, I have determined that most people suffering from this issue are not properly scanning the module where their controller lives. Some solutions call for combining the files that are to be scanned into the same module as the Application (which works), but I do no... | 2019/06/29 | [
"https://Stackoverflow.com/questions/56820386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249424/"
] | Make your files this way:
**Project build.gradle** (removed spring plugin application to all module projects)
```html
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
}
}
subprojects {
... | According to Spring Boot convention, controllers have to be in the `com.test.controller` package. |
5,580,089 | Is there a way of setting the default value of a method scope parameter to be the caller?
In AS3 you can set default values for method parameters like so:
```
function myFuntion(param1:String="hello",param2:int=3) {
```
And you can pass a reference to an object by saying:
```
//method of Class1
function myFuntion(... | 2011/04/07 | [
"https://Stackoverflow.com/questions/5580089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/665800/"
] | The only default function parameter value that is accepted for the type Object is 'null'.
```
function myFunction(obj:Object = null):void {};
var class1:Class1 = new Class1();
class1.myFunction();
``` | No, there isn't a way to what you ask, and that is a good thing for encapsulation and code readability. You should be forced to deliberately pass **this** so that it is clear to anyone reading Class2.as what your function is being given references to.
In general, you should ask yourself "why?" anytime you have a funct... |
5,289,766 | i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier
```
With smtp
.Host = "smtp.google.com"
.Port = 465
.UseDe... | 2011/03/13 | [
"https://Stackoverflow.com/questions/5289766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362461/"
] | Have you tried the answer at : [Sending email through Gmail SMTP server with C#](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c)
Just to see if that works.
Note that in the answer to his solution he mentions web.config changes lower in the post not accepted as the answer
... | The Port number is 587.
And also, try this order as per [this solution](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c/3797154#3797154)
```
With smtp
.UseDefaultCredentials = False
.Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "m... |
5,289,766 | i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier
```
With smtp
.Host = "smtp.google.com"
.Port = 465
.UseDe... | 2011/03/13 | [
"https://Stackoverflow.com/questions/5289766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362461/"
] | Have you tried the answer at : [Sending email through Gmail SMTP server with C#](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c)
Just to see if that works.
Note that in the answer to his solution he mentions web.config changes lower in the post not accepted as the answer
... | The port was right in the OP, but the host was wrong
```
With smtp
.Port = 465 '465 for ssl
.EnableSsl = True
.UseDefaultCredentials = False
.Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "yourpassword")
.Host = "smtp.gmail.com"
End With
```
An... |
5,289,766 | i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier
```
With smtp
.Host = "smtp.google.com"
.Port = 465
.UseDe... | 2011/03/13 | [
"https://Stackoverflow.com/questions/5289766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362461/"
] | Try
```
Dim myLogin As New NetworkCredential("username@gmail.com", "password")
Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText")
msg.IsBodyHtml = True
Try
Dim client As New SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.UseDefaultCrede... | Have you tried the answer at : [Sending email through Gmail SMTP server with C#](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c)
Just to see if that works.
Note that in the answer to his solution he mentions web.config changes lower in the post not accepted as the answer
... |
5,289,766 | i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier
```
With smtp
.Host = "smtp.google.com"
.Port = 465
.UseDe... | 2011/03/13 | [
"https://Stackoverflow.com/questions/5289766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362461/"
] | Have you tried the answer at : [Sending email through Gmail SMTP server with C#](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c)
Just to see if that works.
Note that in the answer to his solution he mentions web.config changes lower in the post not accepted as the answer
... | If you are using **TWO STEP VERIFICATION** for gmail, then disable it first and then try again with this code
```
Dim myLogin As New NetworkCredential("username@gmail.com", "password")
Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText")
msg.IsBodyHtml = True
Try
... |
5,289,766 | i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier
```
With smtp
.Host = "smtp.google.com"
.Port = 465
.UseDe... | 2011/03/13 | [
"https://Stackoverflow.com/questions/5289766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362461/"
] | The port was right in the OP, but the host was wrong
```
With smtp
.Port = 465 '465 for ssl
.EnableSsl = True
.UseDefaultCredentials = False
.Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "yourpassword")
.Host = "smtp.gmail.com"
End With
```
An... | The Port number is 587.
And also, try this order as per [this solution](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c/3797154#3797154)
```
With smtp
.UseDefaultCredentials = False
.Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "m... |
5,289,766 | i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier
```
With smtp
.Host = "smtp.google.com"
.Port = 465
.UseDe... | 2011/03/13 | [
"https://Stackoverflow.com/questions/5289766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362461/"
] | Try
```
Dim myLogin As New NetworkCredential("username@gmail.com", "password")
Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText")
msg.IsBodyHtml = True
Try
Dim client As New SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.UseDefaultCrede... | The Port number is 587.
And also, try this order as per [this solution](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c/3797154#3797154)
```
With smtp
.UseDefaultCredentials = False
.Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.