qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | Something no one else has mentioned yet: the **class** keyword has two different uses.
Declaring a class:
```
class Test{};
```
and indicating a class literal:
```
Class<Test> testClass = Test.class;
``` | As all the other answers have stated, there are many keywords that server multiple purposes depending on context. I just wanted to add that there is a reason for this: There is a strong aversion to adding keywords because such additions break existing code, so when new features are added existing keywords are used if t... |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | The `default` keyword is not used as an access specifier. The absence of `private`, `protected` and `public` means use of `default`.
Example:
```
class Test { // default access for class.
int A; // default access for the class member.
}
```
Some examples of Java keywords which find different use are:
* `final` :... | You can think of the following things
1. Default
2. final
3. super
4. "**:**" (colon) used at different places , which has a different meaning at different places |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | The `static` keyword associates methods and fields with a class instead of instances of that class, but it's also used to signify static initialization sections as in:
```
public class MyClass
{
private static int a;
static
{
a = 1;
}
public static void doSomethingCool()
{
...
}
}
`... | The "extends" keyword can be for single inheritance (either implementation or "pure abstract class" aka "interface inheritance" in Java).
The "extends" keyword can also be used for multiple (interface) inheritance.
The ones who always argue that Java doesn't support multiple inheritance will hence have a hard time ar... |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | The "default" in the case of access modifier isn't a keyword - you don't write:
`default void doSomething()`
However, when specifying the default value of an attribute of annotations - it is.
```
switch (a) {
default: something();
}
```
and
```
public @interface MyAnnotation {
boolean bool() default tru... | *final* has different uses:
* in a variable declaration it means a variable can't be changed.
* In a method signature it means a method can't be overridden
* In a parameter list it means a variable can't be altered in a method. |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | You can't use `default` as an access specifier, so I don't think even that counts. (EDIT: As Bozho pointed out, it can be used in annotations.)
`final` means "can't be derived from / overridden" and "is read-only" which are two different - but related - meanings. | The `final` keyword can mean different things.
* When modifying `classes` is means that the class cannot be subclassed.
* When modifying a `method`, it means that the method cannot be Overridden.
* When modifying a `variable`, it means that the variable cannot point to any other variable. |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | * **`default`** can be used both in a switch and as a default value in an annotation (as pointed out by Bozho)
* **`final`** means "can't be derived from / overridden" and "is read-only" which are two different - but related - meanings (as pointed out by Jon)
* **`extends`** can be used both to specify the supertype of... | Something no one else has mentioned yet: the **class** keyword has two different uses.
Declaring a class:
```
class Test{};
```
and indicating a class literal:
```
Class<Test> testClass = Test.class;
``` |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | * **`default`** can be used both in a switch and as a default value in an annotation (as pointed out by Bozho)
* **`final`** means "can't be derived from / overridden" and "is read-only" which are two different - but related - meanings (as pointed out by Jon)
* **`extends`** can be used both to specify the supertype of... | *final* has different uses:
* in a variable declaration it means a variable can't be changed.
* In a method signature it means a method can't be overridden
* In a parameter list it means a variable can't be altered in a method. |
2,402,433 | As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes | 2010/03/08 | [
"https://Stackoverflow.com/questions/2402433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241717/"
] | The `static` keyword associates methods and fields with a class instead of instances of that class, but it's also used to signify static initialization sections as in:
```
public class MyClass
{
private static int a;
static
{
a = 1;
}
public static void doSomethingCool()
{
...
}
}
`... | As all the other answers have stated, there are many keywords that server multiple purposes depending on context. I just wanted to add that there is a reason for this: There is a strong aversion to adding keywords because such additions break existing code, so when new features are added existing keywords are used if t... |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | look for this in your standalone.xml
socket-binding name="management-native" interface="management" port="9999"
Source:
<http://youtrack.jetbrains.com/issue/IDEA-77592> | Please make sute you had provided valid configuration file, may be your configuration file contains misplaced tag/element entries. |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | In my case, `standalone.xml` was corrupted (probably cause Idea froze and had to do hard shutdown). So I went to `standalone_xml_history` and copied `standalone.xml` from the day before. And it started to work normally again. | In my case:
I typed 9990 in port offset of Run/Debug Configurations and it solved. :) |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | It seems that IntelliJ IDEA was not able to read offset value from "standalone.xml".
to solve it, just set Port offset to 0 in Configuration window, it will manually add additional VM option: -Djboss.socket.binding.port-offset=0
[](https://i.stack.img... | I had the same problem, but have no idea what your setup looks like so the solution might not be the same. Also since your question is quite old you've probably figured out the answer by now.
Anyways.. In case anyone else happens to stumble upon this issue, I solved it this way:
We use Puppet in our project and I had... |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | In my case, `standalone.xml` was corrupted (probably cause Idea froze and had to do hard shutdown). So I went to `standalone_xml_history` and copied `standalone.xml` from the day before. And it started to work normally again. | This is likely to be happening due to a parsing error in your configuration files.
Start your JBoss/WildFly in the command line, so that you would see more details if this is happening because of a configuration (or parsing) error.
* On Windows run `{JBOSS_HOME}/bin/standalone.bat` file so that it would open up a co... |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | In my case, `standalone.xml` was corrupted (probably cause Idea froze and had to do hard shutdown). So I went to `standalone_xml_history` and copied `standalone.xml` from the day before. And it started to work normally again. | As shown below, adding the VM options to point to standalone config files fixed my issue
```
/Users/XXX/dev/apps/wildfly/wildfly-16.0.0.Final.XXX.2019.152-node1/standalone/configuration/
``` |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | Possible cause maybe an invalid configuration file "standalone.xml" or any other config file that you are using.
I've put a tag at the wrong place and got the same error. | I had the same problem, but have no idea what your setup looks like so the solution might not be the same. Also since your question is quite old you've probably figured out the answer by now.
Anyways.. In case anyone else happens to stumble upon this issue, I solved it this way:
We use Puppet in our project and I had... |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | In my case, `standalone.xml` was corrupted (probably cause Idea froze and had to do hard shutdown). So I went to `standalone_xml_history` and copied `standalone.xml` from the day before. And it started to work normally again. | I had the same error "Management Port Configuration not found" when i was trying to boot up my jboss.
In my case i had accidentally deleted my standalone.xml. When i put it back all went fine. Another person had same issue turned out was some malformed tag in the standalone.xml. |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | It seems that IntelliJ IDEA was not able to read offset value from "standalone.xml".
to solve it, just set Port offset to 0 in Configuration window, it will manually add additional VM option: -Djboss.socket.binding.port-offset=0
[](https://i.stack.img... | In my case:
I typed 9990 in port offset of Run/Debug Configurations and it solved. :) |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | look for this in your standalone.xml
socket-binding name="management-native" interface="management" port="9999"
Source:
<http://youtrack.jetbrains.com/issue/IDEA-77592> | This is likely to be happening due to a parsing error in your configuration files.
Start your JBoss/WildFly in the command line, so that you would see more details if this is happening because of a configuration (or parsing) error.
* On Windows run `{JBOSS_HOME}/bin/standalone.bat` file so that it would open up a co... |
22,729,795 | i has a layout:
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="@+id/l... | 2014/03/29 | [
"https://Stackoverflow.com/questions/22729795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3158925/"
] | Your standalone xml may be malformed in some way. Check to see if you have special characters that you will have to escape or extra closing or opening tags etc. | In my case, `standalone.xml` was corrupted (probably cause Idea froze and had to do hard shutdown). So I went to `standalone_xml_history` and copied `standalone.xml` from the day before. And it started to work normally again. |
4,377,066 | Let's consider the Coulomb Hamiltonian
$$
-\Delta - \frac{1}{|x|}$$
in $\mathbb{R}^3$.
It is known that eigenvalues of the Coulomb Hamiltonian are negative.
I know it has negative eigenvalues, but I can't prove it hasn't nonnegative eigenvalues.
That is, I want to prove the following.
If smooth function $u$ satis... | 2022/02/08 | [
"https://math.stackexchange.com/questions/4377066",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1017662/"
] | Let $V(x) = -\frac{1}{|x|}$ be the potential and $H = -\Delta + V$. We know that $H$ is a self-adjoint operator on $H^2(\mathbb{R}^3)$. Let $U(t)\psi(x) = e^{-\frac{3t}{2}}\psi(e^{-t}x)$. $U$ is a strongly continuous unitary group (dilation).
Now let $\lambda$ be an eigenvalue of $H$. Since $H$ is self-adjoint and $U$... | As I recall, there's a theorem that bound states with potentials that go to zero at infinity necessarily have negative total energy, otherwise the wave function is not normalizable. This implies eigenvalues of the energy will be non-positive. The remaining question is whether the ground state has 0 energy. Waves in a b... |
1,279,443 | >
> Solve $$ 3-\frac{4}{9^x}-\frac{4}{81^x}=0 $$
>
>
>
I had this question for an exam today and I want to find out if my answer was correct. | 2015/05/12 | [
"https://math.stackexchange.com/questions/1279443",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/112498/"
] | Substitute $t = 2 / 9^x$, then you get simple quadratic: $t^2 + 2t - 3 = 0$ ...
**UPDATE:** I want to update my answer regarding the solution of the equation:
The question does not specify if only real solutions are required. If that is the case there is a single solution: $ \ln2 / \ln9 $. However, this is not the onl... | So if we let the common denominator be $81^x$, we would get this:
$$\frac{81^x\times 3 - 4\times9^x - 4}{81^x} = 0$$
Use the quadratic formula on the numerator while letting $y = 9^x$, and we get
$$y = 9^x = \frac{2\pm 4}{3}$$
So $$x = \frac{\ln 2}{\ln 9}$$
since $\ln \frac{-2}{3}$ does not exist. |
7,050,584 | Hi this may be a silly question, but I can't find the answer anywhere.
I'm writing a chrome extension, all I need is to read in the html of the current page so I can extract some data from it.
here's what I have so far:
```
<script>
window.addEventListener("load", windowLoaded, false);
function windowLoaded()... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7050584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/892545/"
] | ```
function windowLoaded() {
alert('<html>' + document.documentElement.innerHTML + '</html>');
}
addEventListener("load", windowLoaded, false);
```
~~Notice how `windowLoaded` is created before it is used, not after, which won't work.~~
Also notice how I am getting the innerHTML of `document.documentElement`, w... | ```
window.addEventListener("load", windowLoaded, false);
function windowLoaded() {
alert(document.documentElement.innerHTML);
}
```
You had a `}` with no purpose, and the `});` should just be `}`. These are syntax errors.
Also, it's `document.documentElement.innerHTML`, since it's not a property of `document`. |
7,050,584 | Hi this may be a silly question, but I can't find the answer anywhere.
I'm writing a chrome extension, all I need is to read in the html of the current page so I can extract some data from it.
here's what I have so far:
```
<script>
window.addEventListener("load", windowLoaded, false);
function windowLoaded()... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7050584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/892545/"
] | >
> I'm writing a chrome extension, all I need is to read in the html of
> the current page so **I can extract some data** from it.
>
>
>
I think an important answer here is not the correct code to use to alert the `innerHTML` but **how to get the data you need from what's already been rendered**.
As [pimvdb](ht... | ```
window.addEventListener("load", windowLoaded, false);
function windowLoaded() {
alert(document.documentElement.innerHTML);
}
```
You had a `}` with no purpose, and the `});` should just be `}`. These are syntax errors.
Also, it's `document.documentElement.innerHTML`, since it's not a property of `document`. |
7,050,584 | Hi this may be a silly question, but I can't find the answer anywhere.
I'm writing a chrome extension, all I need is to read in the html of the current page so I can extract some data from it.
here's what I have so far:
```
<script>
window.addEventListener("load", windowLoaded, false);
function windowLoaded()... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7050584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/892545/"
] | ```
function windowLoaded() {
alert('<html>' + document.documentElement.innerHTML + '</html>');
}
addEventListener("load", windowLoaded, false);
```
~~Notice how `windowLoaded` is created before it is used, not after, which won't work.~~
Also notice how I am getting the innerHTML of `document.documentElement`, w... | Use `document.documentElement.outerHTML`. (Note that this is not supported in Firefox; irrelevant in your case.) However, this is still not perfect as it doesn't return nodes outside the root element (`!doctype` and possibly some comments or processing instructions). The `document.innerHTML` property is, AFAIK, specifi... |
7,050,584 | Hi this may be a silly question, but I can't find the answer anywhere.
I'm writing a chrome extension, all I need is to read in the html of the current page so I can extract some data from it.
here's what I have so far:
```
<script>
window.addEventListener("load", windowLoaded, false);
function windowLoaded()... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7050584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/892545/"
] | ```
function windowLoaded() {
alert('<html>' + document.documentElement.innerHTML + '</html>');
}
addEventListener("load", windowLoaded, false);
```
~~Notice how `windowLoaded` is created before it is used, not after, which won't work.~~
Also notice how I am getting the innerHTML of `document.documentElement`, w... | >
> I'm writing a chrome extension, all I need is to read in the html of
> the current page so **I can extract some data** from it.
>
>
>
I think an important answer here is not the correct code to use to alert the `innerHTML` but **how to get the data you need from what's already been rendered**.
As [pimvdb](ht... |
7,050,584 | Hi this may be a silly question, but I can't find the answer anywhere.
I'm writing a chrome extension, all I need is to read in the html of the current page so I can extract some data from it.
here's what I have so far:
```
<script>
window.addEventListener("load", windowLoaded, false);
function windowLoaded()... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7050584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/892545/"
] | >
> I'm writing a chrome extension, all I need is to read in the html of
> the current page so **I can extract some data** from it.
>
>
>
I think an important answer here is not the correct code to use to alert the `innerHTML` but **how to get the data you need from what's already been rendered**.
As [pimvdb](ht... | Use `document.documentElement.outerHTML`. (Note that this is not supported in Firefox; irrelevant in your case.) However, this is still not perfect as it doesn't return nodes outside the root element (`!doctype` and possibly some comments or processing instructions). The `document.innerHTML` property is, AFAIK, specifi... |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | My two cents to the above answers..
I see most of the answers has mentioned only about the hostnames but no port. If we haven't specified ports, then server will dynamically assign RMI port. There wont be any issues, if both the servers are in same subnet or no firewall issues. If there is any concerns, we can add bel... | The following worked for me, thanks to @Arpit Agarwal. Added this additional jvm parameter which worked for me.
```
-Djava.rmi.server.hostname=192.168.1.16
```
Complete list which worked for me.
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=21845
-Dcom.sun.management.jmxremote.ssl=f... |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | My two cents to the above answers..
I see most of the answers has mentioned only about the hostnames but no port. If we haven't specified ports, then server will dynamically assign RMI port. There wont be any issues, if both the servers are in same subnet or no firewall issues. If there is any concerns, we can add bel... | look in /etc/hosts if you don't have a wrong IP for your machine
example :
127.0.0.1 localhost
127.0.0.2 your\_machine
185.12.58.2 your\_machine (the good IP for your machine)
JMX take the IP 127.0.0.2 and forget the other |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | I experienced the problem where it said 'Adding ' forever and didn't seem to be able to connect. I got passed the problem by changing the jvisualvm proxy settings (Tools->options->network). Once I changed the option to No Proxy, I was able to connect. My jvm was started with the following options:
```
-Dcom.sun.manage... | If you run `jar` file (via -jar option), you must specifie all other jvm options before `-jar` option! |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | I experienced the problem where it said 'Adding ' forever and didn't seem to be able to connect. I got passed the problem by changing the jvisualvm proxy settings (Tools->options->network). Once I changed the option to No Proxy, I was able to connect. My jvm was started with the following options:
```
-Dcom.sun.manage... | The following worked for me, thanks to @Arpit Agarwal. Added this additional jvm parameter which worked for me.
```
-Djava.rmi.server.hostname=192.168.1.16
```
Complete list which worked for me.
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=21845
-Dcom.sun.management.jmxremote.ssl=f... |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | In addition to listening to the port you specified (1100) the JMX server also listens to a randomly chosen (ephemeral) port. Check, e.g. with `lsof -i|grep java` if you are on linux/osx, which ports the java process listens to and make sure your firewall is open for the ephemeral port as well. | The following worked for me, thanks to @Arpit Agarwal. Added this additional jvm parameter which worked for me.
```
-Djava.rmi.server.hostname=192.168.1.16
```
Complete list which worked for me.
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=21845
-Dcom.sun.management.jmxremote.ssl=f... |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | If you run `jar` file (via -jar option), you must specifie all other jvm options before `-jar` option! | The following worked for me, thanks to @Arpit Agarwal. Added this additional jvm parameter which worked for me.
```
-Djava.rmi.server.hostname=192.168.1.16
```
Complete list which worked for me.
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=21845
-Dcom.sun.management.jmxremote.ssl=f... |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | Add `-Djava.rmi.server.hostname = host ip`. Even i faced the same problem and this did the trick.
Addition of this `-Djava.rmi.server.hostname = host ip` forces RMI service to use the host ip instead of 127.0.0.1 | look in /etc/hosts if you don't have a wrong IP for your machine
example :
127.0.0.1 localhost
127.0.0.2 your\_machine
185.12.58.2 your\_machine (the good IP for your machine)
JMX take the IP 127.0.0.2 and forget the other |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | These are the steps that worked for me (Debian behind firewall on the server side was reached over VPN from my local Mac):
1. Check server public ip
`ifconfig`
2. Use JVM params:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=[jmx port]
-Dcom.sun.management.jmxremote.local.only=fa... | If you run `jar` file (via -jar option), you must specifie all other jvm options before `-jar` option! |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | I had a similar issue when using port forwarding.
I have a remote machine with Tomcat listening for JMX interactions on `localhost:9000`.
From my local machine, I'm used to do port-forwarding with:
```
ssh -L 9001:localhost:9000 tomcat.example.com
```
(so remote port 9000 is forwarded to my local machine's port 90... | look in /etc/hosts if you don't have a wrong IP for your machine
example :
127.0.0.1 localhost
127.0.0.2 your\_machine
185.12.58.2 your\_machine (the good IP for your machine)
JMX take the IP 127.0.0.2 and forget the other |
11,628,595 | For some weird reason I am not able to connect using `VisualVM` or `jconsole` to a JMX.
The parameters used to start the VM to be monitored:
```
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1100
```
I ch... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11628595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99834/"
] | My two cents to the above answers..
I see most of the answers has mentioned only about the hostnames but no port. If we haven't specified ports, then server will dynamically assign RMI port. There wont be any issues, if both the servers are in same subnet or no firewall issues. If there is any concerns, we can add bel... | I found the problem, my rmi service was running on the host ip which was "127.0.0.1". To connect remotely to the jvm I had to bind the external ip to the hostname. To do this in unix systems use command `hostname` to get the name of the hostname. Then check the ip that is assigned to the hostname, to find out this use ... |
10,336,550 | I'm in the process of trying to understand recursion better, so I decided to write a program to determine the shortest paths to all fields on an N \* N game board, using recursion (I know BFS would be faster here, this is just for the sake of learning):
```
void visit(int x, int y, int moves)
{
if (x < 0 || x >= n |... | 2012/04/26 | [
"https://Stackoverflow.com/questions/10336550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359067/"
] | ```
else if (board[y][x] != -1) {
// already visited, check if path is shorter
if (moves < board[y][x]) board[y][x] = moves;
return;
}
```
Returning here is wrong. You've just lowered the score on this path—there are probably other paths in the area whose scores could be lowered:
```
void visit(int x,... | You are doing a depth first search which may find sub-optimal paths to some squares.
To get optimal paths, if your path is shorter you should still visit from it, even if it is already visited. |
10,336,550 | I'm in the process of trying to understand recursion better, so I decided to write a program to determine the shortest paths to all fields on an N \* N game board, using recursion (I know BFS would be faster here, this is just for the sake of learning):
```
void visit(int x, int y, int moves)
{
if (x < 0 || x >= n |... | 2012/04/26 | [
"https://Stackoverflow.com/questions/10336550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359067/"
] | ```
else if (board[y][x] != -1) {
// already visited, check if path is shorter
if (moves < board[y][x]) board[y][x] = moves;
return;
}
```
Returning here is wrong. You've just lowered the score on this path—there are probably other paths in the area whose scores could be lowered:
```
void visit(int x,... | This would work.
```
void visit(int x, int y, int moves)
{
if (x < 0 || x >= n || y < 0 || y >= n) {
return; // out of board
}
else if ( board[y][x] == -1 || moves < board[y][x])
{
board[y][x] = moves;
visit(x + 1, y, moves + 1);
visit(x, y + 1, moves + 1);
visit(x, y - 1, moves + 1);
... |
23,282,280 | For the following code,
```
class A
{
private:
virtual void f() = 0;
virtual void g() = 0;
...
public:
A()
{
}
...
}
class B : public A
{
private:
void f()
{
...
}
void g()
{
...
... | 2014/04/25 | [
"https://Stackoverflow.com/questions/23282280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1069252/"
] | You can implement your function `h()` as a member of `A`.
The pure virtual function call would only be an issue if `h()` gets executed during the body of `A::A()` (or other `A` constructors or `A::~A()`). Inside the body of `B::B()` or `C::C()`, the polymorphic type of `*this` is `B` or `C` respectively, so your virtu... | Sure, add an intermediate class D which only implements that function and inherits from A. Then B and C can inherit from D. |
25,415,146 | Adding a `mailto:` link on my site, but it occurred to me that it's possible the user may not have a client set up to handle it
I found [this](https://stackoverflow.com/questions/7591474/has-anyone-ever-come-up-with-a-way-to-detect-the-email-program-a-recipient-is-us) thread from 3 years ago and was hoping there's som... | 2014/08/20 | [
"https://Stackoverflow.com/questions/25415146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266542/"
] | No. =(
The answer in your link still stands today. The knowledge that something was even capable of handling the event is way to much information to give to a browser. | No, `mailto:` is very limited, the information is beyond the scope of the browser |
25,415,146 | Adding a `mailto:` link on my site, but it occurred to me that it's possible the user may not have a client set up to handle it
I found [this](https://stackoverflow.com/questions/7591474/has-anyone-ever-come-up-with-a-way-to-detect-the-email-program-a-recipient-is-us) thread from 3 years ago and was hoping there's som... | 2014/08/20 | [
"https://Stackoverflow.com/questions/25415146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266542/"
] | No. =(
The answer in your link still stands today. The knowledge that something was even capable of handling the event is way to much information to give to a browser. | The answer is no. However, you can get a free account with jotform.com and use that. It works GREAT. Hopefully this can help. |
25,415,146 | Adding a `mailto:` link on my site, but it occurred to me that it's possible the user may not have a client set up to handle it
I found [this](https://stackoverflow.com/questions/7591474/has-anyone-ever-come-up-with-a-way-to-detect-the-email-program-a-recipient-is-us) thread from 3 years ago and was hoping there's som... | 2014/08/20 | [
"https://Stackoverflow.com/questions/25415146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266542/"
] | No, `mailto:` is very limited, the information is beyond the scope of the browser | The answer is no. However, you can get a free account with jotform.com and use that. It works GREAT. Hopefully this can help. |
245,272 | Dr. Lapham speaks to Malorie:
>
> Dr. Lapham: But if that's not what you want, **there are plenty of
> couples who are desperate to adopt a child**. There are no judgments
> here. You can make whatever choice you want.
>
>
>
Why did Dr Lapham suggest that Malorie put her child up for adoption? | 2021/03/31 | [
"https://scifi.stackexchange.com/questions/245272",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/139481/"
] | In the [original script](https://www.scriptslug.com/assets/uploads/scripts/bird-box-2018.pdf), it was Malorie that was considering putting her child up for adoption. She's suffering from anxiety and is in a state of denial about the pregnancy. She sees an adoption leaflet and takes it from the doctor's office.
In the ... | In the United States, [there are more couples looking to adopt an infant than there are infants](https://adoptionnetwork.com/adoption-myths-facts/domestic-us-statistics/) (the statistics change as a child gets older). Therefore, when faced with someone expecting a child who isn't certain that they want to raise them fo... |
35,764,231 | I am implementing custom list view in alert dialog. It's not showing up any view.
I have created one query to get the list of titles from table. I want to show this list in alert dialog.
What's going wrong?
alert dialog :
```
selectTable.setOnClickListener(new View.OnClickListener() {
@Override
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35764231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5881997/"
] | It is for forward declarations; imagine two classes having a pointer or mention to each other's instances:
```
class A;
class B;
class A {
class B*ptr;
int x;
/// etc
};
class B : A {
std::string s;
std::vector<A> v;
//// etc
};
```
It is also useful for readability; you might want to list ... | That is a [forward declaration](https://stackoverflow.com/questions/553682/when-can-i-use-a-forward-declaration), which is a method for dealing with circular dependencies in header files.
For example if two classes each hold a pointer to another, then you need to forward declare the class that is defined further down ... |
35,764,231 | I am implementing custom list view in alert dialog. It's not showing up any view.
I have created one query to get the list of titles from table. I want to show this list in alert dialog.
What's going wrong?
alert dialog :
```
selectTable.setOnClickListener(new View.OnClickListener() {
@Override
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35764231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5881997/"
] | That is a [forward declaration](https://stackoverflow.com/questions/553682/when-can-i-use-a-forward-declaration), which is a method for dealing with circular dependencies in header files.
For example if two classes each hold a pointer to another, then you need to forward declare the class that is defined further down ... | You are asking about need for forward declaration.
Imagine following hypothetical example:
```
class Man
{
Woman mySpouse;
};
class Woman
{
Man mySpouse;
};
```
>
> we must definite a class before we use it.
>
>
>
Yes. So you can see for above example, this is impossible chicken-egg situation (aka circ... |
35,764,231 | I am implementing custom list view in alert dialog. It's not showing up any view.
I have created one query to get the list of titles from table. I want to show this list in alert dialog.
What's going wrong?
alert dialog :
```
selectTable.setOnClickListener(new View.OnClickListener() {
@Override
... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35764231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5881997/"
] | It is for forward declarations; imagine two classes having a pointer or mention to each other's instances:
```
class A;
class B;
class A {
class B*ptr;
int x;
/// etc
};
class B : A {
std::string s;
std::vector<A> v;
//// etc
};
```
It is also useful for readability; you might want to list ... | You are asking about need for forward declaration.
Imagine following hypothetical example:
```
class Man
{
Woman mySpouse;
};
class Woman
{
Man mySpouse;
};
```
>
> we must definite a class before we use it.
>
>
>
Yes. So you can see for above example, this is impossible chicken-egg situation (aka circ... |
46,007,887 | I want to highlight tiles in range of a unit which is placed in a system of hexagonal tiles. For example if I place a unit with range=2 on 6|5, I want to highlight 5|4, 6|4, 7|4, 7|5, 6|6, 5|5, 4|5, 4|4, 5|3 and so on...
[](https://i.stack.imgur.com/Kp2vy.jpg)
How ca... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46007887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1760135/"
] | Recursion. Same as you would for illuminating which hexes you can reach by movement. | Thanks to MartinB, I tried the recursive approach and it worked like a charm. :)
```
private void HighlightRange(int originX, int originY, int range, bool greenRange = true)
{
if (range > 0)
{
List<Tuple<int, int>> hexCoordinates = new List<Tuple<int, int>>();
... |
16,506,851 | I am searching a vector of vectors for a specific int.
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val x = vectors.indexWhere(_.indexWhere(_ == i))
val y = vectors(x).indexOf(y)
(x, y)
}
```
You can see I get the y twice. Firstly when computing x and then again when computing y.
N... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16506851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114773/"
] | The one approach you can take is to just iterate all vectors:
```
def searchVectors(x: Int, vec: Vector[Vector[Int]]) =
for {
i <- 0 until vec.size
j <- 0 until vec(i).size
if vec(i)(j) == x
} yield (i, j)
```
Vector also have `zipWithIndex` method, which adds index to each element of the collection ... | Here is a more functional approach to do it:
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val outer = vectors.toStream map (_.indexOf(i))
outer.zipWithIndex.filter(_._1 != -1).headOption map (_.swap)
}
```
EDIT: I think I like this even better:
```
def searchVectors(i: Int, vectors: Vector[Ve... |
16,506,851 | I am searching a vector of vectors for a specific int.
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val x = vectors.indexWhere(_.indexWhere(_ == i))
val y = vectors(x).indexOf(y)
(x, y)
}
```
You can see I get the y twice. Firstly when computing x and then again when computing y.
N... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16506851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114773/"
] | The one approach you can take is to just iterate all vectors:
```
def searchVectors(x: Int, vec: Vector[Vector[Int]]) =
for {
i <- 0 until vec.size
j <- 0 until vec(i).size
if vec(i)(j) == x
} yield (i, j)
```
Vector also have `zipWithIndex` method, which adds index to each element of the collection ... | This bothered me too. You may have already thought of this, but if you are willing to violate the functional programming principle of immutable state etc. here is one possible approach:
```
val v = Vector(Vector(1,2,3), Vector(4, 5, 6))
var c: Int = -1
val r = v.indexWhere(r => {c = r.indexOf(6); c != -1})
(r, c)
``` |
16,506,851 | I am searching a vector of vectors for a specific int.
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val x = vectors.indexWhere(_.indexWhere(_ == i))
val y = vectors(x).indexOf(y)
(x, y)
}
```
You can see I get the y twice. Firstly when computing x and then again when computing y.
N... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16506851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114773/"
] | The one approach you can take is to just iterate all vectors:
```
def searchVectors(x: Int, vec: Vector[Vector[Int]]) =
for {
i <- 0 until vec.size
j <- 0 until vec(i).size
if vec(i)(j) == x
} yield (i, j)
```
Vector also have `zipWithIndex` method, which adds index to each element of the collection ... | Here's a easy-to-understand solution
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]): (Int, Int) = {
val row = vectors.indexWhere(_.contains(i)) // Try to get index of vector containing element
if (row > -1) (row, vectors(row).indexOf(i)) // (row, col)
else (-1, -1)
}
``` |
16,506,851 | I am searching a vector of vectors for a specific int.
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val x = vectors.indexWhere(_.indexWhere(_ == i))
val y = vectors(x).indexOf(y)
(x, y)
}
```
You can see I get the y twice. Firstly when computing x and then again when computing y.
N... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16506851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114773/"
] | Here is a more functional approach to do it:
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val outer = vectors.toStream map (_.indexOf(i))
outer.zipWithIndex.filter(_._1 != -1).headOption map (_.swap)
}
```
EDIT: I think I like this even better:
```
def searchVectors(i: Int, vectors: Vector[Ve... | Here's a easy-to-understand solution
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]): (Int, Int) = {
val row = vectors.indexWhere(_.contains(i)) // Try to get index of vector containing element
if (row > -1) (row, vectors(row).indexOf(i)) // (row, col)
else (-1, -1)
}
``` |
16,506,851 | I am searching a vector of vectors for a specific int.
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]) = {
val x = vectors.indexWhere(_.indexWhere(_ == i))
val y = vectors(x).indexOf(y)
(x, y)
}
```
You can see I get the y twice. Firstly when computing x and then again when computing y.
N... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16506851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114773/"
] | This bothered me too. You may have already thought of this, but if you are willing to violate the functional programming principle of immutable state etc. here is one possible approach:
```
val v = Vector(Vector(1,2,3), Vector(4, 5, 6))
var c: Int = -1
val r = v.indexWhere(r => {c = r.indexOf(6); c != -1})
(r, c)
``` | Here's a easy-to-understand solution
```
def searchVectors(i: Int, vectors: Vector[Vector[Int]]): (Int, Int) = {
val row = vectors.indexWhere(_.contains(i)) // Try to get index of vector containing element
if (row > -1) (row, vectors(row).indexOf(i)) // (row, col)
else (-1, -1)
}
``` |
18,318,272 | This is probably a very easy question but let's say I have a php json\_encoded javascript object of this form:
```
var js_objet = {
"1": {
"Users": {
"id": "14",
"name": "Peter"
},
"Children": [
{
id: 17,
name: "Paul... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18318272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/765368/"
] | Here's such a custom function as mentioned earlier.
```
function getChildrenById(id){
for (var child in js_objet[1].Children){
if(id == js_objet[1].Children[child].id){
return js_objet[1].Children[child].name;
}
}
return false;
}
```
running `getChildrenById(18)` would return ... | You can do it like this:
```
var name = js_objet["1"].Children[1].name;
```
[JSFiddle available here](http://jsfiddle.net/4uRRk/) |
18,318,272 | This is probably a very easy question but let's say I have a php json\_encoded javascript object of this form:
```
var js_objet = {
"1": {
"Users": {
"id": "14",
"name": "Peter"
},
"Children": [
{
id: 17,
name: "Paul... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18318272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/765368/"
] | Here's such a custom function as mentioned earlier.
```
function getChildrenById(id){
for (var child in js_objet[1].Children){
if(id == js_objet[1].Children[child].id){
return js_objet[1].Children[child].name;
}
}
return false;
}
```
running `getChildrenById(18)` would return ... | This is how I would approach this problem:
```
var id = 18;
var name = '';
var jsObjIndex = "1";
var jsObjAttr = "Children"
for (var i = 0; i < js_objet[jsObjIndex][jsObjAttr].length; i++)
{
if (js_objet[jsObjIndex][jsObjAttr][i].id == id)
{
name = js_objet[jsObjIndex][jsObjAttr][i].name;
break... |
18,318,272 | This is probably a very easy question but let's say I have a php json\_encoded javascript object of this form:
```
var js_objet = {
"1": {
"Users": {
"id": "14",
"name": "Peter"
},
"Children": [
{
id: 17,
name: "Paul... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18318272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/765368/"
] | Here's such a custom function as mentioned earlier.
```
function getChildrenById(id){
for (var child in js_objet[1].Children){
if(id == js_objet[1].Children[child].id){
return js_objet[1].Children[child].name;
}
}
return false;
}
```
running `getChildrenById(18)` would return ... | This really is a comment, but I don't have enough reputation (but it's relevant as I recently encountered the same issue): This would probably be easier to do if you can change the JSON format to use the ID as the key for each child object:
```
var js_objet = {
"1": {
"Users": {
"id": "14",
"name":... |
31,172,861 | I have two arrays of the same length, say array x and array y. I want to find the value of y corresponding to x=0.56. This is not a value present in array x.
I would like python to find by itself the closest value larger than 0.56 (and its corresponding y value) and the closest value smaller than 0.56 (and its corresp... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31172861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2813228/"
] | Does Numpy `interp` do what you want?:
```
import numpy as np
x = [0,1,2]
y = [2,3,4]
np.interp(0.56, x, y)
Out[81]: 2.56
``` | Given your two arrays, `x` and `y`, you can do something like the following using SciPy.
```
from scipy.interpolate import InterpolatedUnivariateSpline
spline = InterpolatedUnivariateSpline(x, y, k=5)
spline(0.56)
```
The keyword `k` must be between 1 and 5, and [controls the degree of the spline](http://docs.scipy... |
47,245 | I have a big insert script I need to run. Its about 55,000 records and 160 columns. The script is already created and I can't create it again.
The problem I have is that this runs for about 4 hours or so, and during that time the system that uses this database gets really slow and timeout a lot.
I would not care if ... | 2013/07/29 | [
"https://dba.stackexchange.com/questions/47245",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/20328/"
] | Break the operation into chunks of separate transactions.
```
BEGIN TRANSACTION;
INSERT ...
INSERT ...
-- maybe 1000 or 2500 of these
COMMIT TRANSACTION;
GO
WAITFOR DELAY '00:00:01';
GO
BEGIN TRANSACTION;
INSERT ...
INSERT ...
-- maybe 1000 or 2500 more of these
COMMIT TRANSACTION;
```
This will preven... | Without knowing more about the system, doing small batches and then wait for a few milli seconds will usually significantly reduce contention. However, you need to be aware that it will significantly slow down the insert.
Make sure you do not have transactions that span your batches or you will make things much worse. |
22,417,958 | I encounter the problem that even though after installing gdb Eclipse still gives out the error message 'Error with command --gdb version' whenever I try to compile my code.
I exactly followed this guide: [Eclipse GDB MacOSX Mavericks](https://stackoverflow.com/questions/19877047/eclipse-gdb-macosx-mavericks), but it d... | 2014/03/15 | [
"https://Stackoverflow.com/questions/22417958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3421936/"
] | As indicated in the answer from where you took that code, Apple recommends to refresh the receipt if validation fails. This is what `RMStore` does to validate a receipt/transaction:
```
RMAppReceipt *receipt = [RMAppReceipt bundleReceipt];
const BOOL verified = [self verifyTransaction:transaction inReceipt:receipt suc... | I'll just add one thing here - took me a while to figure out why my hash is mismatching...
receipt bundleId example:
ASN1 OCTET STRING (27 byte) 0C19636F6D2E706177656C6B6C61707563682E536B696E4578616D
Which is actually made of Identifier (0C), length (19) and value (63..6D).
**For comparing app.bundleId == receipt.bu... |
10,903,164 | I am new to Python.
First, the code is supposed to take an input (in the form of "x/y/z" where x,y, and z are any positive integer) and split it into three different variables.
```
input = raw_input()
a, b, c = input.split("/", 2)
```
I want the second part of my code to take these three variables and sort them bas... | 2012/06/05 | [
"https://Stackoverflow.com/questions/10903164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438105/"
] | The issue is that you are sorting strings, and expecting them to be sorted like integers. First convert your list of strings to a list of ints if you would like numerical sorting.
```
>>> sorted(['23', '9', '2'])
['2', '23', '9']
>>> sorted(map(int, ['23', '9', '2']))
[2, 9, 23]
```
Here is how you could rewrite you... | You are sorting strings but you should be sorting integers. So you have to convert each string to an integer using `int`:
```
order = [int(a), int(b), int(c)]
``` |
23,135,187 | I was implementing a Java application when I came across this scenario and couldn't find which way is better to do it and why. following is the scenario.
I have a static list that will load data on application startup.
In my ApplicationStartup class I have
```
public static List<Map<String,Object>> stockSymbolsList... | 2014/04/17 | [
"https://Stackoverflow.com/questions/23135187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045515/"
] | Although this question has been answered, please allow me to add a few things:
When examining the source of `and`, you get:
```
and :: [Bool] -> Bool
and = foldr (&&) True
```
First thing to notice is that `and` takes a list of Boolean variables, and returns a single Boolean variable, and that the expression `x mod ... | `and` performs a *logical and* operation on all elements of a list.
Primes are only divisible by one and themselves; this means that as soon as a divisor (without a remainder) exists between 2 inclusive and your `x` exclusive, the number is not a prime.
The list comprehension generates a list of Boolean values that c... |
23,135,187 | I was implementing a Java application when I came across this scenario and couldn't find which way is better to do it and why. following is the scenario.
I have a static list that will load data on application startup.
In my ApplicationStartup class I have
```
public static List<Map<String,Object>> stockSymbolsList... | 2014/04/17 | [
"https://Stackoverflow.com/questions/23135187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045515/"
] | Although this question has been answered, please allow me to add a few things:
When examining the source of `and`, you get:
```
and :: [Bool] -> Bool
and = foldr (&&) True
```
First thing to notice is that `and` takes a list of Boolean variables, and returns a single Boolean variable, and that the expression `x mod ... | The expression
```
[x `mod` y /= 0 | y <- [2..(x - 1)]
```
is a list of `Bool`s because `mod x y /= 0` (prefix notation because of backtick formatting) returns a `Bool`. The `and` function just does a logical AND of every element in a list, so
```
and [True, False] == False
and [True, True] == True
``` |
54,993,833 | I've debated with my friend about the difference between data structure stack and hardware stack(call stack). I thought they are perfectly same because they both have 'push' and 'pop' that can deal with only the latest element. But my friend said that they're not same at all, but they share only the same name, 'stack'.... | 2019/03/05 | [
"https://Stackoverflow.com/questions/54993833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
<?php
$table='<table>
<tr>
<th>Id</th>
<th>Name</th>
<th>Serial</th>
</tr>';
$servername = "localhost";
$username = "";
$password = "";
$dbname = "verify";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname)... | ```
<table>
<tr>
<th>Id</th>
<th>Name</th>
<th>Serial</th>
</tr>
<?php
$servername = "localhost";
$username = "";
$password = "";
$dbname = "verify";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection... |
30,400,601 | I want to get the result of this query but I'm getting the following error
>
> Arithmetic overflow error converting expression to data type int
>
>
>
```
SELECT d.name,
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30400601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1593500/"
] | Try converting to bigint:
```
SELECT d.name,
ROUND(SUM(convert(bigint,mf.size)) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4
GROUP BY d.name
ORDER BY d.name
``` | It's breaking because when you sum mf.size, it exceeds the max number datatype int can hold which is 2,147,483,647. To fix it, just cast mf.size and alternatively \*8/1024 can be written as /128.0 like so:
```
SELECT d.name,
ROUND(SUM(CAST(mf.size AS bigint))/128.0, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.... |
30,400,601 | I want to get the result of this query but I'm getting the following error
>
> Arithmetic overflow error converting expression to data type int
>
>
>
```
SELECT d.name,
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30400601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1593500/"
] | Try converting to bigint:
```
SELECT d.name,
ROUND(SUM(convert(bigint,mf.size)) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4
GROUP BY d.name
ORDER BY d.name
``` | Try this:
```
SELECT d.name,
ROUND(SUM(CAST(mf.size as bigint)) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4
GROUP BY d.name
ORDER BY d.name
``` |
30,400,601 | I want to get the result of this query but I'm getting the following error
>
> Arithmetic overflow error converting expression to data type int
>
>
>
```
SELECT d.name,
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30400601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1593500/"
] | Try converting to bigint:
```
SELECT d.name,
ROUND(SUM(convert(bigint,mf.size)) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4
GROUP BY d.name
ORDER BY d.name
``` | Just replace `8` by `8.0` to cast result to numeric datatype. The error is because
`size` column is `int` and `8` is also `int` so result of multiplication is `int`, but as `size` is close to `int type` upper bound 2147483647 you are overflowing the type by multiplication.
```
SELECT d.name,
ROUND(SUM(mf.size) * 8.0 /... |
30,400,601 | I want to get the result of this query but I'm getting the following error
>
> Arithmetic overflow error converting expression to data type int
>
>
>
```
SELECT d.name,
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30400601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1593500/"
] | Just replace `8` by `8.0` to cast result to numeric datatype. The error is because
`size` column is `int` and `8` is also `int` so result of multiplication is `int`, but as `size` is close to `int type` upper bound 2147483647 you are overflowing the type by multiplication.
```
SELECT d.name,
ROUND(SUM(mf.size) * 8.0 /... | It's breaking because when you sum mf.size, it exceeds the max number datatype int can hold which is 2,147,483,647. To fix it, just cast mf.size and alternatively \*8/1024 can be written as /128.0 like so:
```
SELECT d.name,
ROUND(SUM(CAST(mf.size AS bigint))/128.0, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.... |
30,400,601 | I want to get the result of this query but I'm getting the following error
>
> Arithmetic overflow error converting expression to data type int
>
>
>
```
SELECT d.name,
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30400601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1593500/"
] | Just replace `8` by `8.0` to cast result to numeric datatype. The error is because
`size` column is `int` and `8` is also `int` so result of multiplication is `int`, but as `size` is close to `int type` upper bound 2147483647 you are overflowing the type by multiplication.
```
SELECT d.name,
ROUND(SUM(mf.size) * 8.0 /... | Try this:
```
SELECT d.name,
ROUND(SUM(CAST(mf.size as bigint)) * 8 / 1024, 0) Size_MBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4
GROUP BY d.name
ORDER BY d.name
``` |
52,439,235 | Im confused as to when a component should be used to render part of a page in react and when a function should be used. As per: [React Docs](https://reactjs.org/docs/jsx-in-depth.html) functions can be used within the render function which leads to one question:
When should functions like this be used:
```js
... | 2018/09/21 | [
"https://Stackoverflow.com/questions/52439235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10395461/"
] | Ultimately, whether you define a new component for your data or generate more HTML in an existing component is a design decision you have to make on a case-by-case bases. But there are some guiding principles:
* [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single_responsibility_principle) - Does the... | Components should be used when you have "repeat code" such as a custom button or listview item. Anything else can be used as a typical function. This helps with readability and makes it easier to know what is page specific vs app "standard". |
52,439,235 | Im confused as to when a component should be used to render part of a page in react and when a function should be used. As per: [React Docs](https://reactjs.org/docs/jsx-in-depth.html) functions can be used within the render function which leads to one question:
When should functions like this be used:
```js
... | 2018/09/21 | [
"https://Stackoverflow.com/questions/52439235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10395461/"
] | Ultimately, whether you define a new component for your data or generate more HTML in an existing component is a design decision you have to make on a case-by-case bases. But there are some guiding principles:
* [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single_responsibility_principle) - Does the... | In the return part of the render function.
```
import ListWrapper from "./ListWrapper";
// components should be used directly
showList() {
return <li>item</li>;
}
// function or constants should be wrapped with `{}`
render() {
const inputValue = "value";
return (
<ListWrapper>
{ this.sh... |
136,114 | In order to solve a quite large system of differential equations, I have the habit to use the `NDSolve` command without changing any options.
As I wanted more precision, I increased the number of points to integrate. There I get an error and suggestion to use `Method -> {"EquationSimplification" -> "Residual"}` in `NDS... | 2017/01/24 | [
"https://mathematica.stackexchange.com/questions/136114",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/18982/"
] | This post contains several code blocks, you can copy them easily with the help of [`importCode`](https://mathematica.stackexchange.com/a/3537/1871).
---
As mentioned in the comment above, the answer is hidden in [this tutorial](http://reference.wolfram.com/language/tutorial/NDSolveDAE.html). Given the tutorial is a b... | When you choose the Method "Residual", Mathematica will convert an explicit equation like
x''[t]==y'[t]+z[t]
into the form
0==y'[t]+z[t]-x''[t]
and use the solutions numerically closest to 0, since rounding errors would cause contradictions between the various explicit definitions in a set of long and numerically e... |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Yes, it's safe to say there is no such thing (Update: [look at that](https://photo.stackexchange.com/questions/5329/open-source-highly-scriptable-photo-management-platform-for-power-users-like/5339#5339), there might be, but with the level of performance you are asking?). Even [Gimp](http://www.gimp.org/) is not remote... | Darktable (which you can download for OSX [here](http://www.darktable.org/install/#osx)) is probably the software that comes closest to what you are looking for. The workflow still has some rough edges, compared to Lightroom or Aperture, but quite usable especially if you are looking for a scripting interface. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Wow, that's a long list.
I think we can all be pretty safe in saying that there sure isn't anything like that now.
One of the most interesting project that shares a lot of your goals is [F-Spot](http://f-spot.org/Goals) -- you might want to look at [getting involved](http://f-spot.org/Get_Involved) there. It's also w... | Here is my [import-and-mangle script](http://reidster.net/software/ptp-acquire); it's nothing special, but perhaps useful to look at. The mangling could be extended to include whatever exiftool can get its hands on. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Have you taken a look at [Darktable](http://darktable.sourceforge.net/)? It seems to be open-source and Linux-only.
Feature description
-------------------
### It needs to be fast
It is quite quick and supports computations on the GPU using OpenCL.
### Scriptability
It supports scripting using LUA. This is a prett... | Here is my [import-and-mangle script](http://reidster.net/software/ptp-acquire); it's nothing special, but perhaps useful to look at. The mangling could be extended to include whatever exiftool can get its hands on. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Yes, it's safe to say there is no such thing (Update: [look at that](https://photo.stackexchange.com/questions/5329/open-source-highly-scriptable-photo-management-platform-for-power-users-like/5339#5339), there might be, but with the level of performance you are asking?). Even [Gimp](http://www.gimp.org/) is not remote... | Here is my [import-and-mangle script](http://reidster.net/software/ptp-acquire); it's nothing special, but perhaps useful to look at. The mangling could be extended to include whatever exiftool can get its hands on. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Have you taken a look at [Darktable](http://darktable.sourceforge.net/)? It seems to be open-source and Linux-only.
Feature description
-------------------
### It needs to be fast
It is quite quick and supports computations on the GPU using OpenCL.
### Scriptability
It supports scripting using LUA. This is a prett... | Not a complete answer, but Exiftool is a perl library/command line tool photo metadata reader/writer. Theoretically some of what you want could be scripted with it, especially auto-tagging images and setting file names and directories. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Have you taken a look at [Darktable](http://darktable.sourceforge.net/)? It seems to be open-source and Linux-only.
Feature description
-------------------
### It needs to be fast
It is quite quick and supports computations on the GPU using OpenCL.
### Scriptability
It supports scripting using LUA. This is a prett... | Yes, it's safe to say there is no such thing (Update: [look at that](https://photo.stackexchange.com/questions/5329/open-source-highly-scriptable-photo-management-platform-for-power-users-like/5339#5339), there might be, but with the level of performance you are asking?). Even [Gimp](http://www.gimp.org/) is not remote... |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Have you taken a look at [Darktable](http://darktable.sourceforge.net/)? It seems to be open-source and Linux-only.
Feature description
-------------------
### It needs to be fast
It is quite quick and supports computations on the GPU using OpenCL.
### Scriptability
It supports scripting using LUA. This is a prett... | I would add [DigiKam](https://www.digikam.org/ "digiKam") (KDE photograph management and editing tool) and [LightZone](http://www.lightzoneproject.org/) (editing tool) to the list to examine. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Wow, that's a long list.
I think we can all be pretty safe in saying that there sure isn't anything like that now.
One of the most interesting project that shares a lot of your goals is [F-Spot](http://f-spot.org/Goals) -- you might want to look at [getting involved](http://f-spot.org/Get_Involved) there. It's also w... | I would add [DigiKam](https://www.digikam.org/ "digiKam") (KDE photograph management and editing tool) and [LightZone](http://www.lightzoneproject.org/) (editing tool) to the list to examine. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Yes, it's safe to say there is no such thing (Update: [look at that](https://photo.stackexchange.com/questions/5329/open-source-highly-scriptable-photo-management-platform-for-power-users-like/5339#5339), there might be, but with the level of performance you are asking?). Even [Gimp](http://www.gimp.org/) is not remote... | I would add [DigiKam](https://www.digikam.org/ "digiKam") (KDE photograph management and editing tool) and [LightZone](http://www.lightzoneproject.org/) (editing tool) to the list to examine. |
5,329 | Short version of the question:
Does anyone know of any good open-source photo management/editing suites, a la [Aperture](http://www.apple.com/aperture/) or [Lightroom](http://www.adobe.com/products/photoshoplightroom/)?
I'd want it to run on MacOS X, by the way, though options that are (more or less) cross-platform w... | 2010/12/01 | [
"https://photo.stackexchange.com/questions/5329",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/2425/"
] | Have you taken a look at [Darktable](http://darktable.sourceforge.net/)? It seems to be open-source and Linux-only.
Feature description
-------------------
### It needs to be fast
It is quite quick and supports computations on the GPU using OpenCL.
### Scriptability
It supports scripting using LUA. This is a prett... | Darktable (which you can download for OSX [here](http://www.darktable.org/install/#osx)) is probably the software that comes closest to what you are looking for. The workflow still has some rough edges, compared to Lightroom or Aperture, but quite usable especially if you are looking for a scripting interface. |
9,995,262 | >
> **Possible Duplicate:**
>
> [how to use sql join in mysql](https://stackoverflow.com/questions/9993227/how-to-use-sql-join-in-mysql)
>
>
>
table name: tbl\_schedule
```
tr_id(P.K.) mr_id(F.K.) sch_date doctor_id
----------- ----------- -------- ----------
1 2 01/01/2012 ... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9995262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180150/"
] | You want to write a `SELECT`: <http://dev.mysql.com/doc/refman/5.0/en/select.html>
In your select you are looking to `JOIN` the two tables:
<http://dev.mysql.com/doc/refman/5.0/en/join.html>
Finally you want to use the `COUNT()`- aggregate function in conjunction with a `GROUP BY` (on user id):
<http://dev.mysql.com/... | ```
SELECT
mr_fname,
mr_lname,
COUNT(DISTINCT tr_id)
FROM
tbl_user
INNER JOIN
tbl_schedule USING (mr_id)
GROUP BY
mr_id
``` |
325,535 | Does someone know why the indentation specified in the beginning of the document is lost after the table/figure? How could I fix this? My simplified piece of code is:
```
\documentclass[10pt,a4paper,twoside]{report}
\usepackage{caption}
\usepackage{pgfplots}
\setlength{\parindent}{4em}
\begin{document}
\chapter{A}
\s... | 2016/08/19 | [
"https://tex.stackexchange.com/questions/325535",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112333/"
] | It is the command `\captionof` that causes the indentation fail. Try to comment it and the indentation is correct. In the documentation of `caption` it is said that "you should use both `\captionof` and `\captionof*` only inside boxes or environments". There is also given a warning during the compilation. That means yo... | I guess you're doing
```
\captionof{table}{caption here}
\begin{center}
\begin{tabular}{cccc}
```
in order to get some vertical space between the caption and the table, but this is wrong: `\captionof` should be in the same environment as the table.
In order to get the vertical spacing, issue
```
\captionsetup{posi... |
64,178,441 | I was trying to clean "NaN" variables in a given array example;
My input array A is:
```
float A[] = { 5.0f, NAN, 1.5f, 0.0f, 1.75f };
```
Expected output array A is:
```
{5.0f,1.5f, 0.0f, 1.75f}
```
I can delete each NAN and shift the elements one time to left.
But if the array is too big to handle, it will beco... | 2020/10/02 | [
"https://Stackoverflow.com/questions/64178441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14382172/"
] | There is an `O(n)` solution using [two pointers technique](https://leetcode.com/articles/two-pointer-technique/?page=1#). It's posible to swap all `NaN` terms to the end of the array while preserving relative ordering of non `NaN` terms.
`p` keeps the record of how many non `NaN` terms are encountered and its return... | >
> Eliminating NaN Values from an array in C
>
>
>
There is little special here about NaN. To eliminate a value from an array, walk the array.
```
// `isnan()`
#include <math.h>
// In place solution
float A[] = { 5.0f, NAN, 1.5f, 0.0f, 1.75f };
size_t n = sizeof A/sizeof A[0];
size_t w = 0;
for (size_t r = 0; ... |
55,209,914 | I am trying to do a very simple calculation of `11.000 + 5.000` expecting to have `16.000` then dividing it by `2` expecting to get a final result of `8.000`. It was working ok in another language (ahk) but I'm having unexpected results trying it in javascript (Not a Number, 5.5 and 5.50025)
**How should I write this ... | 2019/03/17 | [
"https://Stackoverflow.com/questions/55209914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5875416/"
] | Here `A + B` is doing actually string concationation not simple addition. you need to change them to number first
```js
var A = "11.000";
var B = "5.000";
var resultA = ((+A) + (+B)) / 2;
console.log(resultA);
// You can use toFixed if you three decimal digit
console.log(resultA.toFixed(3));
``` | Here A and B are in string format and Once you do A + B the result will be "11.000" + "5.000" = "11.0005.000" (string concatenation). So to get expected result you should parse each string value to Float/Int then do the addition operation.
Try, `var resultD = (parseFloat(A) + parseFloat(B)) /2` |
55,209,914 | I am trying to do a very simple calculation of `11.000 + 5.000` expecting to have `16.000` then dividing it by `2` expecting to get a final result of `8.000`. It was working ok in another language (ahk) but I'm having unexpected results trying it in javascript (Not a Number, 5.5 and 5.50025)
**How should I write this ... | 2019/03/17 | [
"https://Stackoverflow.com/questions/55209914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5875416/"
] | Here `A + B` is doing actually string concationation not simple addition. you need to change them to number first
```js
var A = "11.000";
var B = "5.000";
var resultA = ((+A) + (+B)) / 2;
console.log(resultA);
// You can use toFixed if you three decimal digit
console.log(resultA.toFixed(3));
``` | Just remove the quotation marks and the vars will be recognized as number not as string so you'll get the expected result.
```js
var A = 11.000;
var B = 5.000;
//1st try
var resultA = (A + B) / 2;
alert(resultA);
//2nd try
var resultB = parseInt(A + B) / 2;
alert(resultB);
//3nd try
var resultC = parseFloa... |
55,209,914 | I am trying to do a very simple calculation of `11.000 + 5.000` expecting to have `16.000` then dividing it by `2` expecting to get a final result of `8.000`. It was working ok in another language (ahk) but I'm having unexpected results trying it in javascript (Not a Number, 5.5 and 5.50025)
**How should I write this ... | 2019/03/17 | [
"https://Stackoverflow.com/questions/55209914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5875416/"
] | Here A and B are in string format and Once you do A + B the result will be "11.000" + "5.000" = "11.0005.000" (string concatenation). So to get expected result you should parse each string value to Float/Int then do the addition operation.
Try, `var resultD = (parseFloat(A) + parseFloat(B)) /2` | Just remove the quotation marks and the vars will be recognized as number not as string so you'll get the expected result.
```js
var A = 11.000;
var B = 5.000;
//1st try
var resultA = (A + B) / 2;
alert(resultA);
//2nd try
var resultB = parseInt(A + B) / 2;
alert(resultB);
//3nd try
var resultC = parseFloa... |
29,076,024 | I have managed to disable a set of text boxes using "disabled" tag. but I want all the text boxes enabled using a on-click in button. I tried this but it doesn't work.
```
$(document).ready(function(){
$('#btnSaveGenInfo').click(function(){
$('#textfieldToClose').prop('disabled', false)
});
});
``` | 2015/03/16 | [
"https://Stackoverflow.com/questions/29076024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> "True/False: The Java interpreter converts files from a byte-code format to executable files".
>
>
>
The answer is false1.
The Java interpreter is one of the two components of the JVM that is responsible for executing Java code. It does it by "emulating" the execution of the Java Virtual Machine instructions... | The Java compiler converts the source code to bytecode. This bytecode is then interpreted (or just-in-time-compiled and then executed) by the JVM. This bytecode is a kind of [intermediate language](http://en.wikipedia.org/wiki/Intermediate_language) that has not platform dependence. The virtual machine then is the laye... |
29,076,024 | I have managed to disable a set of text boxes using "disabled" tag. but I want all the text boxes enabled using a on-click in button. I tried this but it doesn't work.
```
$(document).ready(function(){
$('#btnSaveGenInfo').click(function(){
$('#textfieldToClose').prop('disabled', false)
});
});
``` | 2015/03/16 | [
"https://Stackoverflow.com/questions/29076024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> "True/False: The Java interpreter converts files from a byte-code format to executable files".
>
>
>
The answer is false1.
The Java interpreter is one of the two components of the JVM that is responsible for executing Java code. It does it by "emulating" the execution of the Java Virtual Machine instructions... | The answer is `false`
**reason**:
`JIT-just in time compiler` and `java interpreter` does a same thing in different way but as per performance JIT wins. The main task is to convert the given `bytecode` into machine dependent `Assembly language` as of abstract information.`Assembly level language` is a low level langua... |
29,076,024 | I have managed to disable a set of text boxes using "disabled" tag. but I want all the text boxes enabled using a on-click in button. I tried this but it doesn't work.
```
$(document).ready(function(){
$('#btnSaveGenInfo').click(function(){
$('#textfieldToClose').prop('disabled', false)
});
});
``` | 2015/03/16 | [
"https://Stackoverflow.com/questions/29076024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> "True/False: The Java interpreter converts files from a byte-code format to executable files".
>
>
>
The answer is false1.
The Java interpreter is one of the two components of the JVM that is responsible for executing Java code. It does it by "emulating" the execution of the Java Virtual Machine instructions... | False for regular JVMs. No executable files are created. The conversion from bytecode to native code for that platform takes place on the fly during execution. If the program is stopped, the compiled code is gone (was in memory only).
The new Android JVM ART does compile the bytecode into executables before to have b... |
40,571,363 | I have a MySQL table with 6 columns. Some of the columns contain long JSON strings that have newlines and spaces. When I list the content of the table with the SELECT statement, the output is very messy.
Is there a command (or default setting I can change), to limit the output of each column to the first few meaningfu... | 2016/11/13 | [
"https://Stackoverflow.com/questions/40571363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7147892/"
] | You need to replace `L == int` and `L == str` (which will be always valuated to False) with the folowing:
```
all(isinstance(item, str) for item in L) # L == str
all(isinstance(item, int) for item in L) # L == int
``` | You can try this:
Have a function that checks if the elements inside is a number or a string.
```
def isNumber(s): # Helper function to check if it is a Number or a string
try:
float(s)
return True
except ValueError:
return False
def find_index_of_min(L):
"""
Parameter: a lis... |
24,079,203 | I want to use *Universal Image Loader* library in my project I am using `ImageLoader` but it's not working well.
I have to use for grid view and User Profile Image. My `ImageLoader` is not working and is giving me a size problem.
Please tell me how to use Univarsel Library in my project .
here Is my Activity For Prof... | 2014/06/06 | [
"https://Stackoverflow.com/questions/24079203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3709878/"
] | As far as I know, you **can't** use prepared statements nor bind values with Joomla.
If you read the Secure Coding Guideliness from the Joomla documentation (<http://docs.joomla.org/Secure_coding_guidelines#Constructing_SQL_queries>), they don't talk about prepared statements, only about using casting or quoting to av... | In Joomla there is normally the `check()`, `bind()`, `store()` triple from JTable that prevents injection.
`JDatabaseQueryPreparable` has a bind method that you may want to look at. You may also want to look at the docblocks for `JDatabaseQueryLimitable`.
One thing I would suggest is that when you get that error, u... |
24,079,203 | I want to use *Universal Image Loader* library in my project I am using `ImageLoader` but it's not working well.
I have to use for grid view and User Profile Image. My `ImageLoader` is not working and is giving me a size problem.
Please tell me how to use Univarsel Library in my project .
here Is my Activity For Prof... | 2014/06/06 | [
"https://Stackoverflow.com/questions/24079203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3709878/"
] | As far as I know, you **can't** use prepared statements nor bind values with Joomla.
If you read the Secure Coding Guideliness from the Joomla documentation (<http://docs.joomla.org/Secure_coding_guidelines#Constructing_SQL_queries>), they don't talk about prepared statements, only about using casting or quoting to av... | From Joomla4, binding data to named parameters is possible with the `bind()` method. This has been asked for for many years and finally it has come to the CMS.
* Early reference in Joomla Docs: <https://docs.joomla.org/J4.x:Moving_Joomla_To_Prepared_Statements>
* Proper Joomla Documenation: <https://docs.joomla.org/J4... |
48,069,223 | I am trying to compare between two tables and test the results using Gherkin but I don't know how to make it declare two lists in the @when section instead of one, like how it is shown below:
```
@When("^the integer table :$")
public void the_integer_table_(List<Integer> comp1, List<Integer> comp2) {
for(int i =... | 2018/01/02 | [
"https://Stackoverflow.com/questions/48069223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7138725/"
] | Untested but should do what you want:
```
Private Sub Worksheet_Calculate()
Const MAIN_WS_NAME As String = "PDP Base" 'use a constant for fixed values
Dim ws As Worksheet, mainws As Worksheet, wb As Workbook
Dim x As Long, y As Long 'Long not Single
Dim tVar As Double
Set wb = ActiveWorkbook
... | Its been a bit since I posted the original question, but I've gotten much further since then and just wanted to post my progress for others to use incase they need something similar.
There is still a lot of cleaning that could be done, and its not finished, but the basic idea works really *really* well. The code takes... |
42,209,594 | Why if I give those command lines:
```
ip rule add from 10.222.192.0/25 table pdl
ip route add 10.104.44.0/24 via 10.222.193.17 table pdl
```
everything works,
while if I execute this script:
```
#!/bin/sh
IPRULEADD=$(/sbin/ip rule add)
IPROUTEADD=$(/sbin/ip route add)
#
#
#----------- pdl ------------------... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42209594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7558870/"
] | You can either `export` it on server.js or make it a `global` or pass it as a parameter.
```
export app;
import { app } from './server';
```
or
```
global.app = app;
```
or:
```
app.use('/login', login(app));
```
login.js
```
function(app) {
// login stuff here
}
``` | In your server.js just use `require('login')(app);`
In your login.js:-
```
module.exports = function (app) {
app.get('/', function(req, res) {
res.render('login.jade');
});
};
``` |
42,209,594 | Why if I give those command lines:
```
ip rule add from 10.222.192.0/25 table pdl
ip route add 10.104.44.0/24 via 10.222.193.17 table pdl
```
everything works,
while if I execute this script:
```
#!/bin/sh
IPRULEADD=$(/sbin/ip rule add)
IPROUTEADD=$(/sbin/ip route add)
#
#
#----------- pdl ------------------... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42209594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7558870/"
] | in ES6(ecmascript6):
```
server.js
export const app = express()
login.js
import { app } from '../server'
```
in ES5:
```
server.js
module.exports: {
app: express()
}
login.js
var app = require('path').app
``` | In your server.js just use `require('login')(app);`
In your login.js:-
```
module.exports = function (app) {
app.get('/', function(req, res) {
res.render('login.jade');
});
};
``` |
73,628,868 | ###### Updated
Let's suppose that you got octal escape sequences in a stream:
```
backslash \134 is escaped as \134134
single quote ' and double quote \042
linefeed `\012` and carriage return `\015`
%s &
etc...
```
**note:** The escaped characters are limited to `0x01-0x1F 0x22 0x5C 0x7F`
How can you revert those ... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73628868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3387716/"
] | Using GNU awk for `strtonum()` and lots of meaningfully-named variables to show what each step does:
```
$ cat tst.awk
function octs2chars(str, head,tail,oct,dec,char) {
head = ""
tail = str
while ( match(tail,/\\[0-7]{3}/) ) {
oct = substr(tail,RSTART+1,RLENGTH-1)
dec = strtonum(0... | With `GNU awk` which supports `strtonum()` function, would you
please try:
```
awk '{
while (match($0, /\\[0-7]{1,3}/)) {
printf("%s", substr($0, 1, RSTART - 1)) # print the substring before the match
printf("%c", strtonum("0" substr($0, RSTART + 1, RLENGTH))) # convert the oc... |
73,628,868 | ###### Updated
Let's suppose that you got octal escape sequences in a stream:
```
backslash \134 is escaped as \134134
single quote ' and double quote \042
linefeed `\012` and carriage return `\015`
%s &
etc...
```
**note:** The escaped characters are limited to `0x01-0x1F 0x22 0x5C 0x7F`
How can you revert those ... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73628868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3387716/"
] | With `GNU awk` which supports `strtonum()` function, would you
please try:
```
awk '{
while (match($0, /\\[0-7]{1,3}/)) {
printf("%s", substr($0, 1, RSTART - 1)) # print the substring before the match
printf("%c", strtonum("0" substr($0, RSTART + 1, RLENGTH))) # convert the oc... | this separate post is made specifically to showcase how to extend the octal lookup reference tables in `gawk` `unicode`-mode to ***`all 256 bytes`*** without external dependencies or warning messages:
* `ASCII` bytes reside in table `o2bL`
* 8-bit bytes reside in table `o2bH`
.
```
# gawk profile, created Fri Sep... |
73,628,868 | ###### Updated
Let's suppose that you got octal escape sequences in a stream:
```
backslash \134 is escaped as \134134
single quote ' and double quote \042
linefeed `\012` and carriage return `\015`
%s &
etc...
```
**note:** The escaped characters are limited to `0x01-0x1F 0x22 0x5C 0x7F`
How can you revert those ... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73628868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3387716/"
] | Using GNU awk for `strtonum()` and lots of meaningfully-named variables to show what each step does:
```
$ cat tst.awk
function octs2chars(str, head,tail,oct,dec,char) {
head = ""
tail = str
while ( match(tail,/\\[0-7]{3}/) ) {
oct = substr(tail,RSTART+1,RLENGTH-1)
dec = strtonum(0... | *I got my own POSIX `awk` solution, so I post it here for reference.*
The main idea is to build a hash that translates an octal escape sequence to its corresponding character. You can then use it while splitting the line during the search for escape sequences:
```bash
LANG=C awk '
BEGIN {
for ( i = 1; i <... |
73,628,868 | ###### Updated
Let's suppose that you got octal escape sequences in a stream:
```
backslash \134 is escaped as \134134
single quote ' and double quote \042
linefeed `\012` and carriage return `\015`
%s &
etc...
```
**note:** The escaped characters are limited to `0x01-0x1F 0x22 0x5C 0x7F`
How can you revert those ... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73628868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3387716/"
] | Using GNU awk for `strtonum()` and lots of meaningfully-named variables to show what each step does:
```
$ cat tst.awk
function octs2chars(str, head,tail,oct,dec,char) {
head = ""
tail = str
while ( match(tail,/\\[0-7]{3}/) ) {
oct = substr(tail,RSTART+1,RLENGTH-1)
dec = strtonum(0... | UPDATE :: about `gawk`'s `strtonum()` in unicode mode :
```
echo '\666' |
LC_ALL='en_US.UTF-8' gawk -e '
$++NF = "<( "(sprintf("%c", strtonum((_=_<_) substr($++_, ++_))))" )>"'
0000000 909522524 539507744 690009798 2622
\ 6 6 6 < ( ƶ ** ) >... |
73,628,868 | ###### Updated
Let's suppose that you got octal escape sequences in a stream:
```
backslash \134 is escaped as \134134
single quote ' and double quote \042
linefeed `\012` and carriage return `\015`
%s &
etc...
```
**note:** The escaped characters are limited to `0x01-0x1F 0x22 0x5C 0x7F`
How can you revert those ... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73628868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3387716/"
] | Using GNU awk for `strtonum()` and lots of meaningfully-named variables to show what each step does:
```
$ cat tst.awk
function octs2chars(str, head,tail,oct,dec,char) {
head = ""
tail = str
while ( match(tail,/\\[0-7]{3}/) ) {
oct = substr(tail,RSTART+1,RLENGTH-1)
dec = strtonum(0... | this separate post is made specifically to showcase how to extend the octal lookup reference tables in `gawk` `unicode`-mode to ***`all 256 bytes`*** without external dependencies or warning messages:
* `ASCII` bytes reside in table `o2bL`
* 8-bit bytes reside in table `o2bH`
.
```
# gawk profile, created Fri Sep... |
73,628,868 | ###### Updated
Let's suppose that you got octal escape sequences in a stream:
```
backslash \134 is escaped as \134134
single quote ' and double quote \042
linefeed `\012` and carriage return `\015`
%s &
etc...
```
**note:** The escaped characters are limited to `0x01-0x1F 0x22 0x5C 0x7F`
How can you revert those ... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73628868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3387716/"
] | *I got my own POSIX `awk` solution, so I post it here for reference.*
The main idea is to build a hash that translates an octal escape sequence to its corresponding character. You can then use it while splitting the line during the search for escape sequences:
```bash
LANG=C awk '
BEGIN {
for ( i = 1; i <... | this separate post is made specifically to showcase how to extend the octal lookup reference tables in `gawk` `unicode`-mode to ***`all 256 bytes`*** without external dependencies or warning messages:
* `ASCII` bytes reside in table `o2bL`
* 8-bit bytes reside in table `o2bH`
.
```
# gawk profile, created Fri Sep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.