qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
48,830,793 | I have a VPC in AWS account and there are 5 subnets associated with that VPC. Subnets are of 2 types - Public and private. How to identify which subnet is public and which is private ? Each subnet has CIDR 10.249.?.? range.
Basically when I launch an EMR in that subnet with lists of ec2SubnetIds , it says
\*\*\*The s... | 2018/02/16 | [
"https://Stackoverflow.com/questions/48830793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1846749/"
] | I found this to be rather challenging. I hope others find this useful. This approach uses aws cli and jq. As of mid 2021 I'm using current versions of both. To caveat, this is specific to only IPv4, and VPCs with only 1 internet gateway.
From a bash shell start off by identifying the VPC in which you are considering t... | I was reading through this user guide [VPC with a single subnet](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenario1.html) and found this line helpful.
"A subnet that's associated with a route table that has a route to an internet gateway is known as a public subnet" |
3,449,347 | My book has this theorem on the limit of two composite functions:
>
> **Theorem**
>
>
> Let $(a,b)$ be a (possibly infinite) interval and let $u=a^{+}$ or
> $b^{-}$. If $g$ is defined on $(a,b)$ and $\lim\_{x \to u}{g(x)} = L$,
> $f$ is defined on an interval containing $L$ and the image of $g,$ and
> $f$ is con... | 2019/11/24 | [
"https://math.stackexchange.com/questions/3449347",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/390922/"
] | A possible way is to substitute $x= \arcsin t$ and consider $t \to 0^+$.
Just for convenience **flipping the sign** in the first expression we get
\begin{eqnarray\*} (1-\cos x)e^{\cot x}
& \stackrel{x= \arcsin t}{=} & \left(1-\sqrt{1-t^2}\right)e^{\frac{\sqrt{1-t^2}}{t}} \\
& \stackrel{u>0: e^u> \frac{u^4}{24}\; (ser... | We can use *equivalents*:
* As $\lim\_{x\to 0} \smash{\Bigl(\cot x-\dfrac 1x\Bigr)}=0$, we have
$$\mathrm e^{\cot x}\sim\_{0^+}\mathrm e^{\tfrac1x} $$
* Also $\cos x-1\sim\_0-\dfrac{x^2}2$, so
$$(\cos x-1)\mathrm e^{\cot x}\sim\_{0^+} -\frac{x^2}2\mathrm e^{\tfrac1x} =-\frac{\mathrm e^{\tfrac1x}}{\cfrac 2{x^2}}\to -\... |
3,449,347 | My book has this theorem on the limit of two composite functions:
>
> **Theorem**
>
>
> Let $(a,b)$ be a (possibly infinite) interval and let $u=a^{+}$ or
> $b^{-}$. If $g$ is defined on $(a,b)$ and $\lim\_{x \to u}{g(x)} = L$,
> $f$ is defined on an interval containing $L$ and the image of $g,$ and
> $f$ is con... | 2019/11/24 | [
"https://math.stackexchange.com/questions/3449347",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/390922/"
] | We have
$$(\cos x-1)e^{\cot x}= \frac{\cos x-1}{x^2}x^2e^{\cot x}\to -\infty$$
indeed by standard limits
* $\frac{\cos x-1}{x^2}\to -\frac12$
* $x^2e^{\cot x}= \frac{x^2}{\tan^2x}\cdot \frac{e^{\cot x}}{\cot^2x}\to 1\cdot \infty$ | We can use *equivalents*:
* As $\lim\_{x\to 0} \smash{\Bigl(\cot x-\dfrac 1x\Bigr)}=0$, we have
$$\mathrm e^{\cot x}\sim\_{0^+}\mathrm e^{\tfrac1x} $$
* Also $\cos x-1\sim\_0-\dfrac{x^2}2$, so
$$(\cos x-1)\mathrm e^{\cot x}\sim\_{0^+} -\frac{x^2}2\mathrm e^{\tfrac1x} =-\frac{\mathrm e^{\tfrac1x}}{\cfrac 2{x^2}}\to -\... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | You just need to call foo(), not el.foo(). (Unless I'm missing something about how you're using this.) | Because `foo` isn't a property of `el`. It's a variable.
You'd need:
```
var foo = function() {
//...
};
var boo = function() {
//...
foo();
}
```
It would work if you had:
```
var el = {};
el.foo = function() {
// ...
};
var boo = function() {
//...
el.foo();
}
``` |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | You just need to call foo(), not el.foo(). (Unless I'm missing something about how you're using this.) | In this instance it looks like `foo()` is a not a property of the object `el`. You defined the function, but from the example shown, it is probably a global function. If you want `foo()` to work on the variable `el`, then pass it to the function, like so:
```
var foo = function(element) {
//do something with th... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | You just need to call foo(), not el.foo(). (Unless I'm missing something about how you're using this.) | Since foo is not a function defined/attached to el hence you can't call foo from el's context.
You need to call foo directly.
```
var foo = function() {
...
};
var boo = function() {
...
foo();
}
```
However if you need to call foo attached to el's context then try this:
```
var boo = func... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | You just need to call foo(), not el.foo(). (Unless I'm missing something about how you're using this.) | If I understand you correctly, you need to create a jQuery plugin function:
```
jQuery.fn.foo = function(){
return this.each(function(){
// element-specific code here
});
};
var boo = function() {
...
el.foo();
}
``` |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | You just need to call foo(), not el.foo(). (Unless I'm missing something about how you're using this.) | I assume, if you are trying to call:
```
el.foo()
```
Then el is jQuery object, something like
```
var el = $("#smth");
el.foo();
```
In this case you need to define 'foo' as:
```
$.fn.foo = function() {
....
}
```
Otherwise, if you are just trying to call 'foo' from 'boo', then just call it without 'el':
... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | Because `foo` isn't a property of `el`. It's a variable.
You'd need:
```
var foo = function() {
//...
};
var boo = function() {
//...
foo();
}
```
It would work if you had:
```
var el = {};
el.foo = function() {
// ...
};
var boo = function() {
//...
el.foo();
}
``` | I assume, if you are trying to call:
```
el.foo()
```
Then el is jQuery object, something like
```
var el = $("#smth");
el.foo();
```
In this case you need to define 'foo' as:
```
$.fn.foo = function() {
....
}
```
Otherwise, if you are just trying to call 'foo' from 'boo', then just call it without 'el':
... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | In this instance it looks like `foo()` is a not a property of the object `el`. You defined the function, but from the example shown, it is probably a global function. If you want `foo()` to work on the variable `el`, then pass it to the function, like so:
```
var foo = function(element) {
//do something with th... | I assume, if you are trying to call:
```
el.foo()
```
Then el is jQuery object, something like
```
var el = $("#smth");
el.foo();
```
In this case you need to define 'foo' as:
```
$.fn.foo = function() {
....
}
```
Otherwise, if you are just trying to call 'foo' from 'boo', then just call it without 'el':
... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | Since foo is not a function defined/attached to el hence you can't call foo from el's context.
You need to call foo directly.
```
var foo = function() {
...
};
var boo = function() {
...
foo();
}
```
However if you need to call foo attached to el's context then try this:
```
var boo = func... | I assume, if you are trying to call:
```
el.foo()
```
Then el is jQuery object, something like
```
var el = $("#smth");
el.foo();
```
In this case you need to define 'foo' as:
```
$.fn.foo = function() {
....
}
```
Otherwise, if you are just trying to call 'foo' from 'boo', then just call it without 'el':
... |
4,844,739 | Why doesn't this work:
```
var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
```
?
I get a foo is undefined error. But I just defined it above... | 2011/01/30 | [
"https://Stackoverflow.com/questions/4844739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | If I understand you correctly, you need to create a jQuery plugin function:
```
jQuery.fn.foo = function(){
return this.each(function(){
// element-specific code here
});
};
var boo = function() {
...
el.foo();
}
``` | I assume, if you are trying to call:
```
el.foo()
```
Then el is jQuery object, something like
```
var el = $("#smth");
el.foo();
```
In this case you need to define 'foo' as:
```
$.fn.foo = function() {
....
}
```
Otherwise, if you are just trying to call 'foo' from 'boo', then just call it without 'el':
... |
66,756,582 | I have data as below
```
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------... | 2021/03/23 | [
"https://Stackoverflow.com/questions/66756582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14228996/"
] | Lets suppose this is you PDF array list,
```
pdfList = [
{name: 'Felipe Calderon', year: 2012},
{name: 'Rocio Calderon Martinez', year: 2012},
{name: 'Laura Martinez Calderon', year: 2012},
{name: 'Marcos Alberto Gonzales Calderon', year: 2012},
{name: 'Brenda Calderon Ibañez', year: 2012},
];
... | Nothing has helped me except this youtube [video](https://www.youtube.com/watch?v=jXgc6ctpEpo&ab_channel=ReactNativeTutorials). I'm going to keep this post up for anyone that hasn't had any luck creating a search filter bar in React Native because that video literally did everything I wanted my pdf list to perfectly. |
49,807,017 | Trying to test equality of two Maps (including order) by turning them into lists beforehand. There are probably better ways to do it, but I'd like to know why this error comes up. Here is the test:
```
@Test
public void sortedEntriesTest() {
List<Map.Entry<String, AtomicInteger>> actualList = stream.sortedEntries(... | 2018/04/12 | [
"https://Stackoverflow.com/questions/49807017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9552584/"
] | Try
```
Assert.assertThat(expectedList, is(equalTo(actualList)));
```
instead. | Explanation:
------------
You are comparing references of two different objects, which are (just as the objects) different. That is why You are getting the `AssertionError` - first reference is **not** the second reference.
Solution:
---------
Use the `equals` method ([link to the Java documentation for `List.equals... |
31,049,181 | I am trying to convert some UnityScript code to D# and I am getting the following error:
>
> Expression denotes a method group, where a `variable`, `value` or `type` was expected on the Getcomponent
>
>
>
```
void Update ()
{
float xVel = GetComponent().Rigidbody2D().velocity.x;
if( xVel < 18 && xVel > -... | 2015/06/25 | [
"https://Stackoverflow.com/questions/31049181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3664467/"
] | Your issue is with: `GetComponent().Rigidbody2D()` as that is not how you use GetComponent, the error you are seeing is probably because `GetComponent` requires a parameter or a specified type. The JS and C# GetComponent work a little different. You probably mean to do:
```
void Update ()
{
float xVel = GetCompon... | ```
float xVel = GetComponent<Rigidbody2D>().velocity.x;
```
GetComponent is used like this. |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | I was able to achieve Basic Authentication on **Windows Server 2012** doing the following:
Select your site within IIS and choose **Authentication**
[](https://i.stack.imgur.com/fVe5Q.png)
Ensure **Basic Authentication** is the only enabled option
[... | Unfortunatelly, for IIS installed on Windows 7/8 machines, there is no option to create users only for IIS authentification.
For Windows Server there is that option where you can add users from IIS Manager UI. These users have roles only on IIS, but not for the rest of the system.
[In this article](http://technet.mic... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | If you create a user with the advanced user management (from command line: `netplwiz`), then modify the group, remove users, and add iis\_users. They will be able to authenticate to your web page, but not the computer. | Just to add a note, since I can't comment without 50+ rep...
If you have FIPS enabled on the server, it doesn't allow you to create users. Because IIS v8 (and lower I would imagine) does not use FIPS encryption algorithms. It would be great if it supported it , because obviously a user account in windows is insecure c... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | I know this is a really old question but I wanted to add a bit of explanation that I discovered the hard way (this is n00b information).
"Basic Authentication" shares the same accounts that you have on your local computer or network. If you leave the domain and realm empty, local accounts are what are actually being u... | in iis manager click directory to protect.
choose authorization rules.
add deny anonymous users rule.
add allow all users rule.
go back to: "in iis manager click directory to protect"
click authentication disable all except basic authentication.
the directory is now protected. only people with user accounts can ac... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | I was able to achieve Basic Authentication on **Windows Server 2012** doing the following:
Select your site within IIS and choose **Authentication**
[](https://i.stack.imgur.com/fVe5Q.png)
Ensure **Basic Authentication** is the only enabled option
[... | It looks to me like Windows 8 and IIS 7 no longer provides any UI to create a user name and password for basic authentication that is NOT a windows local user account. It is clearly a superior approach to create an IIS-only user/password authentication pair, but it is not clear and easy how it is done.
Command line to... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | If you create a user with the advanced user management (from command line: `netplwiz`), then modify the group, remove users, and add iis\_users. They will be able to authenticate to your web page, but not the computer. | It looks to me like Windows 8 and IIS 7 no longer provides any UI to create a user name and password for basic authentication that is NOT a windows local user account. It is clearly a superior approach to create an IIS-only user/password authentication pair, but it is not clear and easy how it is done.
Command line to... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | I know this is a really old question but I wanted to add a bit of explanation that I discovered the hard way (this is n00b information).
"Basic Authentication" shares the same accounts that you have on your local computer or network. If you leave the domain and realm empty, local accounts are what are actually being u... | Just to add a note, since I can't comment without 50+ rep...
If you have FIPS enabled on the server, it doesn't allow you to create users. Because IIS v8 (and lower I would imagine) does not use FIPS encryption algorithms. It would be great if it supported it , because obviously a user account in windows is insecure c... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | Right click on Computer and choose "Manage" (or go to Control Panel > Administrative Tools > Computer Management) and under "Local Users and Groups" you can add a new user. Then, give that user permission to read the directory where the site is hosted.
**Note:** After creating the user, be sure to edit the user and re... | I was able to achieve Basic Authentication on **Windows Server 2012** doing the following:
Select your site within IIS and choose **Authentication**
[](https://i.stack.imgur.com/fVe5Q.png)
Ensure **Basic Authentication** is the only enabled option
[... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | Right click on Computer and choose "Manage" (or go to Control Panel > Administrative Tools > Computer Management) and under "Local Users and Groups" you can add a new user. Then, give that user permission to read the directory where the site is hosted.
**Note:** After creating the user, be sure to edit the user and re... | It looks to me like Windows 8 and IIS 7 no longer provides any UI to create a user name and password for basic authentication that is NOT a windows local user account. It is clearly a superior approach to create an IIS-only user/password authentication pair, but it is not clear and easy how it is done.
Command line to... |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | in iis manager click directory to protect.
choose authorization rules.
add deny anonymous users rule.
add allow all users rule.
go back to: "in iis manager click directory to protect"
click authentication disable all except basic authentication.
the directory is now protected. only people with user accounts can ac... | @Colin
"Local Users and Groups" is windows authentication |
5,373,497 | I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on [Configure Basic Authentication (IIS 7)](http://technet.microsoft.com/en-us/library/cc772009.aspx)
>
> ### To use the UI
>
>
> 1. Open IIS Manager and navigate to the level you want to manage. For information abou... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336939/"
] | Unfortunatelly, for IIS installed on Windows 7/8 machines, there is no option to create users only for IIS authentification.
For Windows Server there is that option where you can add users from IIS Manager UI. These users have roles only on IIS, but not for the rest of the system.
[In this article](http://technet.mic... | @Colin
"Local Users and Groups" is windows authentication |
2,306,697 | We have the following equation:
$$\frac{1 - 3^{k + 1}}{1 - 3} = \frac{3^{k + 1} - 1}{2}$$
Can you explain why the left-hand side of the question is equal to the right side of the equation? | 2017/06/02 | [
"https://math.stackexchange.com/questions/2306697",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/321396/"
] | Note that $1-3=-2$ and $1-3^{k+1}=-(3^{k+1}-1)$. | Realise that:
>
> **1-3=-2**
>
>
>
We can then take:
>
> **[-(3^(k+1)-1)]/-2**
>
>
>
The negatives cancel each other, thus the LHS=RHS equation. |
13,132,558 | If a HTML document has two doctypes, how will the doctypes affect the rendering of the page and which doctype would the browser pick? Is having two (or more) doctypes in a single document valid or confusing?
Example:
```
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
</html>
... | 2012/10/30 | [
"https://Stackoverflow.com/questions/13132558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/126039/"
] | Only a single doctype declaration is permitted. This follows rather directly from the HTML specifications as well the HTML5 drafts, and it can also be checked using a [validator](http://validator.w3.org).
Thus, there is no specification of what *should* happen. The natural expectation is that since browsers process th... | I believe the very first `DOCTYPE` is used by the browser and it's against the specification to have more than one in a document.
I think (not sure) that the only situation when multiple `DOCTYPE`-s *may* be valid is when using IE conditional comments. Browsers other than IE won't see those, of course.
I remember rea... |
13,132,558 | If a HTML document has two doctypes, how will the doctypes affect the rendering of the page and which doctype would the browser pick? Is having two (or more) doctypes in a single document valid or confusing?
Example:
```
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
</html>
... | 2012/10/30 | [
"https://Stackoverflow.com/questions/13132558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/126039/"
] | Only a single doctype declaration is permitted. This follows rather directly from the HTML specifications as well the HTML5 drafts, and it can also be checked using a [validator](http://validator.w3.org).
Thus, there is no specification of what *should* happen. The natural expectation is that since browsers process th... | If you have multiple **DOCTYPE**-s in your HTML page then browser will consider first one, browser parse the DOM line by line. Once browser get DOCTYPE then it will stop looking for other doctypes and will jump to search for HTML tag.
>
> In the above question HTML-5 DOCTYPE is mentioned first and then
> HTML-4, acc... |
26,553,690 | I know how to localize storyboard elements like label, buttons etc. However, I faced a problem where I need to localize the images that were setup in a storyboard in the attribute inspector for the Image View.
Is there a way to localize those without setting those images up in the code, in the viewDidLoad method and ... | 2014/10/24 | [
"https://Stackoverflow.com/questions/26553690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1585677/"
] | As commented by Erik there is no Html in RazorEngine (see the linked answer), however you can use `@Include("mytemplate")` instead.
If you want to be compatible with the `@Html.Partial()` syntax for some reason you can extend the RazorEngine syntax like [this](https://matthid.github.io/RazorEngine/TemplateBasics.html#... | Been annoyed by this for a long time. Wrote all the infrastructure classes to just get this working like you'd expect in MVC, without all the MVC burden:
```
var razor = RazorHelper.O;
var html = razor.RenderFromMvc(@"Views\RazorEngine\TestEmail.cshtml", vm);
```
<https://github.com/b9chris/RazorEngineComplete> |
39,833 | In the questions, [Are mouse movement coordinates useful as a seed for a RNG?](https://crypto.stackexchange.com/questions/3347/are-mouse-movement-coordinates-useful-as-a-seed-for-a-rng) and [Is this a good entropy collector and whitening technique?](https://crypto.stackexchange.com/questions/10794/is-this-a-good-entrop... | 2016/09/08 | [
"https://crypto.stackexchange.com/questions/39833",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/11293/"
] | The biggest problem with capturing mouse & keyboard input is that the number of likely things a user does within a small timeframe is limited.
Imagine that you hash 3 alphanumeric characters of userinput H(X1 + X2 + X3) (assuming + means concatenation and H is a cryptographic hashing function). The number of possibili... | **One should always apply a slow, one-way function to user input.** While it has no effect on the number of possible outputs, applying such a function (like an iterated hash) does help defend against attacks.
Imagine you ask the user to click on random locations. Upon each click, you record the location of the cursor.... |
66,591,140 | I created a many-to-many relationship between the tables `PRODUCT_TYPE` and `LABEL` by creating and intermediate table `PRODUCT_TYPE-LABELS`. I wanted to retrieve all the products that have the labels 'Gluten free' and 'Lactose free' and found help on a similar subject ([How to filter SQL results in a has-many-through ... | 2021/03/11 | [
"https://Stackoverflow.com/questions/66591140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15378757/"
] | According to [documentation](https://cloudinary.com/documentation/node_image_and_video_upload#node_js_image_upload), you can't just upload file. You will have to either save it somewhere first (for example locally on disk), or [convert it into base64](https://stackoverflow.com/questions/48762165/converting-image-file-i... | I am only posting this answer so others can benefit, I ended up going the array buffer route.
```
import formidable from "formidable";
const cloudinary = require("cloudinary").v2;
const fs = require("fs");
const path = require("path");
let streamifier = require('streamifier');
cloudinary.config({
cloud_name: proces... |
15,943,453 | Am having set of restricted keywords
in my comment / message posting block should not allow the restricted words which i defined.
Eg: keyword is "facebook".
f-a-c-e-b-o-o-k, FaceBook, f a c e b o o k, f\*a\*c\*e\*b\*o\*o\*k, f a c e b o o k, (face book),'facebook' these words should not allow to post.
Any ideas u... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15943453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1099355/"
] | I'm not sure this is a good idea but all the words you show could be detected using
```
var isFacebook = /f\W*a\W*c\W*e\W*b\W*o\W*o\W*k/i.test(str);
```
Note that you can easily generate such a pattern from a word, which makes it easy to extend with a dictionary :
```
var r = new RegExp("facebook".split('').join('... | Try this regex:
```
f[^a-zA-Z0-9]?a[^a-zA-Z0-9]?c[^a-zA-Z0-9]?e[^a-zA-Z0-9]?b[^a-zA-Z0-9]?o[^a-zA-Z0-9]?o[^a-zA-Z0-9]?k
```
It will match the following:
```
facebook
f a c e b o o k
f-a-c-e-b-o-o-k
f*a*c*e*b*o*o*k
```
But will not match the following:
```
facesbooks
ffaceebbookss
```
You can use a regex simila... |
15,943,453 | Am having set of restricted keywords
in my comment / message posting block should not allow the restricted words which i defined.
Eg: keyword is "facebook".
f-a-c-e-b-o-o-k, FaceBook, f a c e b o o k, f\*a\*c\*e\*b\*o\*o\*k, f a c e b o o k, (face book),'facebook' these words should not allow to post.
Any ideas u... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15943453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1099355/"
] | I'm not sure this is a good idea but all the words you show could be detected using
```
var isFacebook = /f\W*a\W*c\W*e\W*b\W*o\W*o\W*k/i.test(str);
```
Note that you can easily generate such a pattern from a word, which makes it easy to extend with a dictionary :
```
var r = new RegExp("facebook".split('').join('... | If you mean that you want to filter a given word, surrounded by word-boundary and with possible special characters separating the word's letters:
```
var keyword="facebook",
specialCharClass="[*-]",
regex;
regex= new RegExp("\\b" + keyword.replace(/(?:)/g,specialCharClass+'?') + "\\b",'g');
"hi(facebo-ok)pie"... |
15,943,453 | Am having set of restricted keywords
in my comment / message posting block should not allow the restricted words which i defined.
Eg: keyword is "facebook".
f-a-c-e-b-o-o-k, FaceBook, f a c e b o o k, f\*a\*c\*e\*b\*o\*o\*k, f a c e b o o k, (face book),'facebook' these words should not allow to post.
Any ideas u... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15943453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1099355/"
] | I'm not sure this is a good idea but all the words you show could be detected using
```
var isFacebook = /f\W*a\W*c\W*e\W*b\W*o\W*o\W*k/i.test(str);
```
Note that you can easily generate such a pattern from a word, which makes it easy to extend with a dictionary :
```
var r = new RegExp("facebook".split('').join('... | If your goal is to block, not to strip, I would implement this as a two step process.
1. Strip out all non-text, translate 1337 to normal text (say leet), etc
2. check for forbidden words, and block if any go wrong
That way you seperated your concerns of blocking a certain list of words, and making sure that you're c... |
7,822,640 | I don't want to in the output document to write out the element attribute if the value is missing or is an empty string.
How to do that?
That's in a biztalk mapping. | 2011/10/19 | [
"https://Stackoverflow.com/questions/7822640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219167/"
] | To suppress an element in the destination, use a value mapping functoid.
1. connect the element in question to a `LOGICAL EXISTENCE` functoid.
2. connect the `LOGICAL EXISTENCE` functoid to a `LOGICAL AND` functoid.
3. connect the element functoid to a `NOT EQUALS` functoid.
4. In the `NOT EQUALS` functoid, set the Co... | If you prefer doing the XSLT yourself:
(I'm checking for missing element, empty value, and `xsi:nil` - delete accordingly if not applicable)
```
<xsl:choose>
<xsl:when test="not(s0:inElement)
or s0:inElement[normalize-space(.) = '']
or string(s0:inElement/@xsi:nil) = 'true... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | If you need to mutate stuff, use `ArrayBuffer` or `LinkedBuffer` instead. However, it would be better to address this statement:
>
> I need to declare empty list or empty
> maps and some where later in the code
> need to fill them.
>
>
>
Instead of doing that, fill the list with code that returns the elements. ... | Per default collections in scala are immutable, so you have a + method which returns a new list with the element added to it.
If you really need something like an add method you need a mutable collection, e.g. <http://www.scala-lang.org/api/current/scala/collection/mutable/MutableList.html> which has a += method. |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | Per default collections in scala are immutable, so you have a + method which returns a new list with the element added to it.
If you really need something like an add method you need a mutable collection, e.g. <http://www.scala-lang.org/api/current/scala/collection/mutable/MutableList.html> which has a += method. | In your case I use: `val dm = ListBuffer[String]()` and `val dk = ListBuffer[Map[String,anyRef]]()` |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | As everyone already mentioned, this is not the best way of using lists in Scala...
```
scala> val list = scala.collection.mutable.MutableList[String]()
list: scala.collection.mutable.MutableList[String] = MutableList()
scala> list += "hello"
res0: list.type = MutableList(hello)
scala> list += "world"
res1: list.type... | Per default collections in scala are immutable, so you have a + method which returns a new list with the element added to it.
If you really need something like an add method you need a mutable collection, e.g. <http://www.scala-lang.org/api/current/scala/collection/mutable/MutableList.html> which has a += method. |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | If you need to mutate stuff, use `ArrayBuffer` or `LinkedBuffer` instead. However, it would be better to address this statement:
>
> I need to declare empty list or empty
> maps and some where later in the code
> need to fill them.
>
>
>
Instead of doing that, fill the list with code that returns the elements. ... | Maybe you can use ListBuffers in scala to create empty list and add strings later because ListBuffers are mutable. Also all the List functions are available for the ListBuffers in scala.
```
import scala.collection.mutable.ListBuffer
val dm = ListBuffer[String]()
dm: scala.collection.mutable.ListBuffer[String] = Lis... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | Scala lists are immutable by default. You cannot "add" an element, but you can form a new list by appending the new element in front. Since it is a *new* list, you need to reassign the reference (so you can't use a val).
```
var dm = List[String]()
var dk = List[Map[String,AnyRef]]()
.....
dm = "text" :: dm
dk = Ma... | As everyone already mentioned, this is not the best way of using lists in Scala...
```
scala> val list = scala.collection.mutable.MutableList[String]()
list: scala.collection.mutable.MutableList[String] = MutableList()
scala> list += "hello"
res0: list.type = MutableList(hello)
scala> list += "world"
res1: list.type... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | Scala lists are immutable by default. You cannot "add" an element, but you can form a new list by appending the new element in front. Since it is a *new* list, you need to reassign the reference (so you can't use a val).
```
var dm = List[String]()
var dk = List[Map[String,AnyRef]]()
.....
dm = "text" :: dm
dk = Ma... | Maybe you can use ListBuffers in scala to create empty list and add strings later because ListBuffers are mutable. Also all the List functions are available for the ListBuffers in scala.
```
import scala.collection.mutable.ListBuffer
val dm = ListBuffer[String]()
dm: scala.collection.mutable.ListBuffer[String] = Lis... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | If you need to mutate stuff, use `ArrayBuffer` or `LinkedBuffer` instead. However, it would be better to address this statement:
>
> I need to declare empty list or empty
> maps and some where later in the code
> need to fill them.
>
>
>
Instead of doing that, fill the list with code that returns the elements. ... | As mentioned in an above [answer](https://stackoverflow.com/a/6557304/1461060), the [Scala List](https://www.scala-lang.org/api/current/scala/collection/immutable/List.html) is an immutable collection. You can create an empty list with **`.empty[A]`**. Then you can use a method [`:+`](https://www.scala-lang.org/api/cur... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | As mentioned in an above [answer](https://stackoverflow.com/a/6557304/1461060), the [Scala List](https://www.scala-lang.org/api/current/scala/collection/immutable/List.html) is an immutable collection. You can create an empty list with **`.empty[A]`**. Then you can use a method [`:+`](https://www.scala-lang.org/api/cur... | Maybe you can use ListBuffers in scala to create empty list and add strings later because ListBuffers are mutable. Also all the List functions are available for the ListBuffers in scala.
```
import scala.collection.mutable.ListBuffer
val dm = ListBuffer[String]()
dm: scala.collection.mutable.ListBuffer[String] = Lis... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | Scala lists are immutable by default. You cannot "add" an element, but you can form a new list by appending the new element in front. Since it is a *new* list, you need to reassign the reference (so you can't use a val).
```
var dm = List[String]()
var dk = List[Map[String,AnyRef]]()
.....
dm = "text" :: dm
dk = Ma... | As mentioned in an above [answer](https://stackoverflow.com/a/6557304/1461060), the [Scala List](https://www.scala-lang.org/api/current/scala/collection/immutable/List.html) is an immutable collection. You can create an empty list with **`.empty[A]`**. Then you can use a method [`:+`](https://www.scala-lang.org/api/cur... |
6,557,169 | I have code like this:
```
val dm = List[String]()
val dk = List[Map[String,Object]]()
.....
dm.add("text")
dk.add(Map("1" -> "ok"))
```
but it throws runtime java.lang.UnsupportedOperationException.
I need to declare empty list or empty maps and some where later in the code need to fill them. | 2011/07/02 | [
"https://Stackoverflow.com/questions/6557169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/821764/"
] | As everyone already mentioned, this is not the best way of using lists in Scala...
```
scala> val list = scala.collection.mutable.MutableList[String]()
list: scala.collection.mutable.MutableList[String] = MutableList()
scala> list += "hello"
res0: list.type = MutableList(hello)
scala> list += "world"
res1: list.type... | As mentioned in an above [answer](https://stackoverflow.com/a/6557304/1461060), the [Scala List](https://www.scala-lang.org/api/current/scala/collection/immutable/List.html) is an immutable collection. You can create an empty list with **`.empty[A]`**. Then you can use a method [`:+`](https://www.scala-lang.org/api/cur... |
56,226,280 | I am trying to update the state from an other component to an other component.
I want on **header.jsx** the state **total** to be updated when i click on add to cart button on **product.jsx**
Here is my code
**index.jsx**
```
import React from 'react';
import { render } from 'react-dom';
import { BrowserR... | 2019/05/20 | [
"https://Stackoverflow.com/questions/56226280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4742487/"
] | You can do something like this to achieve this. But the more clean solution which is suggested by the React JS is to use the React Context API.
Am sharing a link from the React JS documentation which exactly have the same scenario that you want to tackle.
<https://reactjs.org/docs/context.html#updating-context-from-a... | you can use redux to manage state across multiple components.
[getting started with redux](https://redux.js.org/introduction/getting-started) |
56,226,280 | I am trying to update the state from an other component to an other component.
I want on **header.jsx** the state **total** to be updated when i click on add to cart button on **product.jsx**
Here is my code
**index.jsx**
```
import React from 'react';
import { render } from 'react-dom';
import { BrowserR... | 2019/05/20 | [
"https://Stackoverflow.com/questions/56226280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4742487/"
] | You can do something like this to achieve this. But the more clean solution which is suggested by the React JS is to use the React Context API.
Am sharing a link from the React JS documentation which exactly have the same scenario that you want to tackle.
<https://reactjs.org/docs/context.html#updating-context-from-a... | To Answer this:
There is no way by the help of which you can pass state between two react components, as state is private to a component.
props can help you in this regard. Props also can't be passed from child to parent it can always be from parent to child.
There is a twist by the help of which you can achieve this, ... |
57,595,282 | I'm getting started trying to understand Guzzle but one of my requests keeps returning an error, even though the exact same request when done using CURL works just fine.
I have a refresh\_token and want to get an access\_token from WEB API.
The Guzzle request that results in an error:
```php
$refresh_token = '<token... | 2019/08/21 | [
"https://Stackoverflow.com/questions/57595282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4629726/"
] | Your request becomes GET probably because of the "query" parameter.
Use form\_params instead of query.
See the documentation.
<http://docs.guzzlephp.org/en/stable/request-options.html#form-params> | This is correct! Tnx Jonnix!
```
$response = $client->request('POST', 'https://sso.tinkoff.ru/secure/token', [
'form_params' => [
'grant_type' => 'refresh_token',
'refresh_token' => $refresh_token
]
]);
``` |
61,999,247 | I have followed this article <https://cloud.google.com/blog/products/gcp/sharding-of-timestamp-ordered-data-in-cloud-spanner> and created a somewhat similar schema just without companyID:
```
CREATE TABLE Foo (
random_id STRING(22) NOT NULL,
shard_id INT64 NOT NULL,
timestamp_order TIMESTAM... | 2020/05/25 | [
"https://Stackoverflow.com/questions/61999247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13612221/"
] | You can get efficient execution of this query using the HAVING MIN construct.
Rewritten #2:
```
SELECT *
FROM
(
SELECT shard_id, ANY_VALUE(random_id HAVING MIN timestamp_order) AS random_id, MIN(timestamp_order) AS timestamp_order
FROM Foo@{FORCE_INDEX=OrderIndex}
GROUP BY shard_id
WHERE shard_id... | When you specify more than one shard id (or an expression that could yield more than one shard id), the theoretical result set at that point is no longer sorted by timestamp (whereas for a single shard it is), so it has to be resorted on timestamp (and every row has to be considered). A theoretical optimization when yo... |
61,999,247 | I have followed this article <https://cloud.google.com/blog/products/gcp/sharding-of-timestamp-ordered-data-in-cloud-spanner> and created a somewhat similar schema just without companyID:
```
CREATE TABLE Foo (
random_id STRING(22) NOT NULL,
shard_id INT64 NOT NULL,
timestamp_order TIMESTAM... | 2020/05/25 | [
"https://Stackoverflow.com/questions/61999247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13612221/"
] | I saw the comment about an arbitrary LIMIT. This was too long for a followup comment (not permitted) so I added another answer.
For an arbitrary LIMIT, a more complex query is required to get the highest efficiency. Here is a template using the filter "shard\_id < 1000" and LIMIT x.
The first side of the join will ef... | When you specify more than one shard id (or an expression that could yield more than one shard id), the theoretical result set at that point is no longer sorted by timestamp (whereas for a single shard it is), so it has to be resorted on timestamp (and every row has to be considered). A theoretical optimization when yo... |
61,999,247 | I have followed this article <https://cloud.google.com/blog/products/gcp/sharding-of-timestamp-ordered-data-in-cloud-spanner> and created a somewhat similar schema just without companyID:
```
CREATE TABLE Foo (
random_id STRING(22) NOT NULL,
shard_id INT64 NOT NULL,
timestamp_order TIMESTAM... | 2020/05/25 | [
"https://Stackoverflow.com/questions/61999247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13612221/"
] | I saw the comment about an arbitrary LIMIT. This was too long for a followup comment (not permitted) so I added another answer.
For an arbitrary LIMIT, a more complex query is required to get the highest efficiency. Here is a template using the filter "shard\_id < 1000" and LIMIT x.
The first side of the join will ef... | You can get efficient execution of this query using the HAVING MIN construct.
Rewritten #2:
```
SELECT *
FROM
(
SELECT shard_id, ANY_VALUE(random_id HAVING MIN timestamp_order) AS random_id, MIN(timestamp_order) AS timestamp_order
FROM Foo@{FORCE_INDEX=OrderIndex}
GROUP BY shard_id
WHERE shard_id... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | ```
var test = {};
Object.defineProperty(test, "hello", {
get : function () {
return this._hello;
},
set : function (val) {
alert(val);
this._hello = val;
}
});
test.hello = "world";
```
Something like that. But it will not work on old browsers.
You can find more options her... | you need a library that provides key-value observing and bindings.
[ember-metal is one such library.](http://toolbox.no.de/packages/ember-metal)
basically you create objects, and you can register observers on properties of those objects.
```
var obj = Em.Object.create({
val: null
valDidChange:function(){...}.o... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | If you really insist on keeping the `test.hello = "world"` syntax to detect changes **for existing properties**, then you'll have to wait a few years for `Object.watch` to become part of the next EcmaScript standard.
Luckily, you can do the same in EcmaScript 5 using `Object.defineProperty`. [Eli Grey made a nice `Obj... | you need a library that provides key-value observing and bindings.
[ember-metal is one such library.](http://toolbox.no.de/packages/ember-metal)
basically you create objects, and you can register observers on properties of those objects.
```
var obj = Em.Object.create({
val: null
valDidChange:function(){...}.o... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | try this example in chrome (as mentioned in previous comments it uses [ES6 Proxy](http://wiki.ecmascript.org/doku.php?id=harmony:proxies)):
```
var p = new Proxy(
{},
{
get: function(obj, name) {
console.log('read request to ' + name + ' property');
if (name == 'test_test') retu... | you need a library that provides key-value observing and bindings.
[ember-metal is one such library.](http://toolbox.no.de/packages/ember-metal)
basically you create objects, and you can register observers on properties of those objects.
```
var obj = Em.Object.create({
val: null
valDidChange:function(){...}.o... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | ```
var test = {};
Object.defineProperty(test, "hello", {
get : function () {
return this._hello;
},
set : function (val) {
alert(val);
this._hello = val;
}
});
test.hello = "world";
```
Something like that. But it will not work on old browsers.
You can find more options her... | What about something like this? [Here's a jsfiddle.](http://jsfiddle.net/lbstr/xKDRF/)
```
var objectManager = function(obj, setCallback){
this.obj = obj;
this.setCallback = setCallback;
};
objectManager.prototype.setProperty = function(prop, value){
this.obj[prop] = value;
this.setCallback(prop);
};
... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | If you really insist on keeping the `test.hello = "world"` syntax to detect changes **for existing properties**, then you'll have to wait a few years for `Object.watch` to become part of the next EcmaScript standard.
Luckily, you can do the same in EcmaScript 5 using `Object.defineProperty`. [Eli Grey made a nice `Obj... | What about something like this? [Here's a jsfiddle.](http://jsfiddle.net/lbstr/xKDRF/)
```
var objectManager = function(obj, setCallback){
this.obj = obj;
this.setCallback = setCallback;
};
objectManager.prototype.setProperty = function(prop, value){
this.obj[prop] = value;
this.setCallback(prop);
};
... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | try this example in chrome (as mentioned in previous comments it uses [ES6 Proxy](http://wiki.ecmascript.org/doku.php?id=harmony:proxies)):
```
var p = new Proxy(
{},
{
get: function(obj, name) {
console.log('read request to ' + name + ' property');
if (name == 'test_test') retu... | What about something like this? [Here's a jsfiddle.](http://jsfiddle.net/lbstr/xKDRF/)
```
var objectManager = function(obj, setCallback){
this.obj = obj;
this.setCallback = setCallback;
};
objectManager.prototype.setProperty = function(prop, value){
this.obj[prop] = value;
this.setCallback(prop);
};
... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | try this example in chrome (as mentioned in previous comments it uses [ES6 Proxy](http://wiki.ecmascript.org/doku.php?id=harmony:proxies)):
```
var p = new Proxy(
{},
{
get: function(obj, name) {
console.log('read request to ' + name + ' property');
if (name == 'test_test') retu... | ```
var test = {};
Object.defineProperty(test, "hello", {
get : function () {
return this._hello;
},
set : function (val) {
alert(val);
this._hello = val;
}
});
test.hello = "world";
```
Something like that. But it will not work on old browsers.
You can find more options her... |
11,552,078 | From my main view, i have a button that when pressed triggers a modal segue with curl effects, which in turn shows 3 buttons, which all have modal segues. When any of these buttons are pressed, they show another view, but i can't seem to get rid of the curled view. Any help is appreciated to get rid of the curled view ... | 2012/07/18 | [
"https://Stackoverflow.com/questions/11552078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536387/"
] | try this example in chrome (as mentioned in previous comments it uses [ES6 Proxy](http://wiki.ecmascript.org/doku.php?id=harmony:proxies)):
```
var p = new Proxy(
{},
{
get: function(obj, name) {
console.log('read request to ' + name + ' property');
if (name == 'test_test') retu... | If you really insist on keeping the `test.hello = "world"` syntax to detect changes **for existing properties**, then you'll have to wait a few years for `Object.watch` to become part of the next EcmaScript standard.
Luckily, you can do the same in EcmaScript 5 using `Object.defineProperty`. [Eli Grey made a nice `Obj... |
19,185,352 | I wan't to make a binary max heap through a given array. I can implement it in two ways:
1.Make a heap of the whole array and start heapifying through leaf nodes to the top.
2.Insert an element one-by-one into the heap from the array and heapifying simultaneously.
Both these methods give me a max heap, but are d... | 2013/10/04 | [
"https://Stackoverflow.com/questions/19185352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can implement the heap in either way and both are correct as they obey the basic rule of heap ordering that parent key has to be grater than either of child node. Though they might result in different heaps.
Method-1- Make a heap of the whole array and start heapifying through leaf nodes to the top.
By this method... | Look both are different:
1. When you are inserting one by one : Basically you are inserting in Binary tree which is already a heap and call heapify
2. When you are inserting everything in an array at once and then making it heap altogether then you are not using heapify (BuildHeap function). Because that is not a... |
595,682 | i am not able to rename the folder name. i tried these ways. please correct me,
```
[testuser@backupdev1-lnx backup]$ cd /opt/backup/
[testuser@backupdev1-lnx backup]$ ls -l
total 8
drwxrwxr-x 2 testuser testuser 4096 May 14 21:46 deployables
drwxrwxr-x 3 testuser testuser 4096 May 14 21:46 deployables_05_14_2013... | 2013/05/15 | [
"https://superuser.com/questions/595682",
"https://superuser.com",
"https://superuser.com/users/221599/"
] | This page at [www.tuxfiles.org](http://www.tuxfiles.org/linuxhelp/dirman.html) provides good information on manipulating directories in Linux. Since it appears you want delete the existing directory, the following command(s) will suffice:
```
rm -r deployables_$(date +"%m_%d_%Y"); mv deployables deployables_$(date +"%... | I got solved,
That my mistake, actually "deployables\_05\_14\_2013" folder already exist, so it not able to rename to the "deployables" to "deployables\_05\_14\_2013" again.
So it is not working. i added time and date both, then it working. |
11,837,742 | I've researched this subject thoroughly, including questions and answers on this website....
this is my basic code:
```
import java.util.Scanner;
class StringSplit {
public static void main(String[] args)
{
System.out.println("Enter String");
Scanner io = new Scanner(System.in);
String input... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11837742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580570/"
] | Sure:
```
System.out.println("keywords: " + Arrays.toString(keywords));
```
It's not the splitting that's causing you the problem (although it may not be doing what you want) - it's the fact that arrays don't override `toString`. | You could try using Java's [String.Split](http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#split%28java.lang.String%29):
Just give it a regular expression that will match one (or more) of the delimeters you want, and put your output into an array.
As for output, use a for loop or foreach look to go ... |
11,837,742 | I've researched this subject thoroughly, including questions and answers on this website....
this is my basic code:
```
import java.util.Scanner;
class StringSplit {
public static void main(String[] args)
{
System.out.println("Enter String");
Scanner io = new Scanner(System.in);
String input... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11837742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580570/"
] | Sure:
```
System.out.println("keywords: " + Arrays.toString(keywords));
```
It's not the splitting that's causing you the problem (although it may not be doing what you want) - it's the fact that arrays don't override `toString`. | This code should work:
```
String inputString = new String("hello, world, how, are, you, today");
Scanner scn = new Scanner(inputString);
scn.useDelimiter(",");
ArrayList<String> words = new ArrayList<String>();
while (scn.hasNext()) {
words.add(scn.next());
}
//To convert ArrayList to array
String[] keywords ... |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | `if(exp.matches(regExp))`
This alone is enough. You don't need a Pattern/Matcher unless you've some other needs. | First compile the regular expression then compare it using matcher..
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
``` |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | This pattern will work - it matches any number of upper or lower case letter then an underscore then any number of digits then an underscore then any number of upper or lower case letters. If you want to be more specific you can use `{n}` rather than `+` to match a specific number of characters.
```
public static void... | First compile the regular expression then compare it using matcher..
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
``` |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | The problem is: you accidentally swapped the use of the regexp pattern and the expression to check
```
String exp = "ABCD_123_abc";
String regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)";
```
Should be used
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
```
The [Pattern.compile(S... | Your regex is **perfectly fine**.
The problem comes from the fact that you swapped `exp` and `regExp` in your code. The function `compile` takes as argument a regular expression, whereas the function `matcher` takes the expression to match. |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | The problem is: you accidentally swapped the use of the regexp pattern and the expression to check
```
String exp = "ABCD_123_abc";
String regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)";
```
Should be used
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
```
The [Pattern.compile(S... | First compile the regular expression then compare it using matcher..
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
``` |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | Your regex is **perfectly fine**.
The problem comes from the fact that you swapped `exp` and `regExp` in your code. The function `compile` takes as argument a regular expression, whereas the function `matcher` takes the expression to match. | `if(exp.matches(regExp))`
This alone is enough. You don't need a Pattern/Matcher unless you've some other needs. |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | You're not compiling the regexp. You need
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
```
i.e. your above code is confusing the regexp and the input string. Your actual regexp is correct, however. | First compile the regular expression then compare it using matcher..
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
``` |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | `if(exp.matches(regExp))`
This alone is enough. You don't need a Pattern/Matcher unless you've some other needs. | In this case if you want to retrieve 123 use the following code :
```
System.out.println(matcher.group(2));
```
This prints output as : **123**
Your regex is perfectly fine. |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | Your regex is **perfectly fine**.
The problem comes from the fact that you swapped `exp` and `regExp` in your code. The function `compile` takes as argument a regular expression, whereas the function `matcher` takes the expression to match. | Your (edited) regexp is fine.
If you want to extract `123`, you can use `matcher.group(2)`. That method can **only** be invoked **after** `matches` or `find`. `matcher.group(n)` returns the n-th `capture group`. A capture group is a part of your regexp that is enclosed in parentheses. `matcher.group(0)` returns the ma... |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | Your regex is **perfectly fine**.
The problem comes from the fact that you swapped `exp` and `regExp` in your code. The function `compile` takes as argument a regular expression, whereas the function `matcher` takes the expression to match. | In this case if you want to retrieve 123 use the following code :
```
System.out.println(matcher.group(2));
```
This prints output as : **123**
Your regex is perfectly fine. |
15,495,997 | I am new to Java concept of Regular expression.
Could anyone please tell me the correct regular expression that I should use for the below string -
`String exp = "ABCD_123_abc".`
and the regular expression that I am using for the above string is:
`regExp = "([a-zA-Z]+)_([0-9]+)_([a-z]+)"`
But the output of the be... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15495997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185724/"
] | Your regex is **perfectly fine**.
The problem comes from the fact that you swapped `exp` and `regExp` in your code. The function `compile` takes as argument a regular expression, whereas the function `matcher` takes the expression to match. | First compile the regular expression then compare it using matcher..
```
Pattern pattern = Pattern.compile(regExp);
Matcher matcher = pattern.matcher(exp);
``` |
227,339 | I bought a server/droplet on Digital Ocean and [per its recommendations](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets) disabled password login so it could only be accessed by SSH key.
I understand the SSH security mechanism basically makes it so it can only be accesse... | 2015/09/03 | [
"https://unix.stackexchange.com/questions/227339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/19131/"
] | Python doesn't expand variables in strings in the same way as bash. If you have `VAR` in python and want to pass that to bash you could do
```
subprocess.call('echo {} | /path/to/script --args'.format(VAR), shell=True)
```
if `VAR` in python holds the name of a bash variable you want to expand you could do similar:
... | Calling `os.system()` is deprecated, though still valid. That functionality may be going away in the future (probably will be), so you might want to give serious consideration to refactoring those calls with the `subprocess` module, which has an very easy way to send data to a subprocess's STDIN and read from its STDOU... |
227,339 | I bought a server/droplet on Digital Ocean and [per its recommendations](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets) disabled password login so it could only be accessed by SSH key.
I understand the SSH security mechanism basically makes it so it can only be accesse... | 2015/09/03 | [
"https://unix.stackexchange.com/questions/227339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/19131/"
] | Don't use `os.system()`, it is deprecated in favor of `subprocess` module.
In your case you can use `subprocess` module directly and its better to not use the `shell=True` parameter as this is not safe to run commands directly into the shell. All the functionalities you need here like pipe can be emulated by the `subp... | Calling `os.system()` is deprecated, though still valid. That functionality may be going away in the future (probably will be), so you might want to give serious consideration to refactoring those calls with the `subprocess` module, which has an very easy way to send data to a subprocess's STDIN and read from its STDOU... |
227,339 | I bought a server/droplet on Digital Ocean and [per its recommendations](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets) disabled password login so it could only be accessed by SSH key.
I understand the SSH security mechanism basically makes it so it can only be accesse... | 2015/09/03 | [
"https://unix.stackexchange.com/questions/227339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/19131/"
] | Python doesn't expand variables in strings in the same way as bash. If you have `VAR` in python and want to pass that to bash you could do
```
subprocess.call('echo {} | /path/to/script --args'.format(VAR), shell=True)
```
if `VAR` in python holds the name of a bash variable you want to expand you could do similar:
... | I think the good practice is:
```
var = subprocess.Popen(['/bin/echo', var], stdout=subprocess.PIPE)
second = subprocess.Popen(['bash', '/path/to/script', '--args'],stdin=var.stdout, stdout=subprocess.PIPE)
var.stdout.close()
output = second.communicate()[0]
var.wait()
``` |
227,339 | I bought a server/droplet on Digital Ocean and [per its recommendations](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets) disabled password login so it could only be accessed by SSH key.
I understand the SSH security mechanism basically makes it so it can only be accesse... | 2015/09/03 | [
"https://unix.stackexchange.com/questions/227339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/19131/"
] | Don't use `os.system()`, it is deprecated in favor of `subprocess` module.
In your case you can use `subprocess` module directly and its better to not use the `shell=True` parameter as this is not safe to run commands directly into the shell. All the functionalities you need here like pipe can be emulated by the `subp... | I think the good practice is:
```
var = subprocess.Popen(['/bin/echo', var], stdout=subprocess.PIPE)
second = subprocess.Popen(['bash', '/path/to/script', '--args'],stdin=var.stdout, stdout=subprocess.PIPE)
var.stdout.close()
output = second.communicate()[0]
var.wait()
``` |
20,549,460 | I'm able to parse simple properties using JSON.NET with this C# code:
**Code C#**
```
WebClient c = new WebClient();
var data = c.DownloadString("http://localhost/json1.json");
JObject o = JObject.Parse(data);
listBox1.Items.Add(o["name"]);
listBox1.Items.Add(o["email"][0]);
listBox1.Items.Add... | 2013/12/12 | [
"https://Stackoverflow.com/questions/20549460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2756390/"
] | ```
yourjsonobject.faculty.department[0].name;
yourjsonobject.faculty.department[0].location;
```
Here is some jsfiddle to help you with this:
<http://jsfiddle.net/sCCrJ/>
```
var r = JSON.parse('{"name": "Fname Lname","email": [ "email@gmail.com", "email@hotmail.com"],"website":{ "blog": "example.com"... | Your problem is that `department` is an array of objects (though it happens to just contain one item here), but you're not accessing it like it is. You can use `o["faculty"]["department"][0]["name"]` to get your data.
You might want to use classes (here are ones auto-converted with <http://json2csharp.com/>) to more e... |
112,695 | [*Alarm*](https://www.dndbeyond.com/spells/alarm) description says
>
> Choose a door, a window, or an area within range that is no larger than a 20-foot cube... A mental alarm alerts you with a ping in your mind if you are within 1 mile of the warded area. (PHB 211)
>
>
>
If you can be over a mile away, a 20-foot... | 2018/01/02 | [
"https://rpg.stackexchange.com/questions/112695",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/41155/"
] | You can cast multiple instances of alarm
========================================
The general rules say that if you know the spell, have the slots, have the components, and meet any additional requirements, you can cast a spell.
You can even ignore the spell slots if you have the ritual casting feature and take 10 mi... | No larger than a 20ft cube =/= a 20ft cube
------------------------------------------
You don't have to create a huge cube, you can create a 1ft wide perimeter alarm wall around an area 200ft in length.
So:[](https://i.stack.imgur.com/73WQ1.png)
The... |
12,122,640 | I have a dumb question, first of all sorry for that. i am learning now 7 OSI Layer models and i stumble across one thing. The Ethernet which is in the second Data Link Layer provides the end-to-end connection via LANs, right? Does it mean that even if i connect to Internet thru WiFi, somewhere my connection is running ... | 2012/08/25 | [
"https://Stackoverflow.com/questions/12122640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903790/"
] | I am going to break my answer into points:
1.Lan is not necessary to connect to internet. You can have cable internet or internet through DSL connection etc. in which though the wire that comes and connect to your pc is the same cat5(for example) cable, there is no lan involved.
2.Internet through wireless router an ... | Your connection to the nearest router is using a wifi data link protocol (in the IEEE 802.11 family). But the connections to other routers and (eventually) hosts will use other data link protocols, likely including ethernet at least at the far end. |
12,122,640 | I have a dumb question, first of all sorry for that. i am learning now 7 OSI Layer models and i stumble across one thing. The Ethernet which is in the second Data Link Layer provides the end-to-end connection via LANs, right? Does it mean that even if i connect to Internet thru WiFi, somewhere my connection is running ... | 2012/08/25 | [
"https://Stackoverflow.com/questions/12122640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903790/"
] | Short answer is: most likely
In your case, you only know your direct connectivity is made possible thru WiFi. From your perspective, it's just a WiFi network. But behind WiFi network, it could be Ethernet, DSL, Cable, etc. And behind those, it could be T1, frame relay, ATM, 10G or maybe 100G Ethernet, etc.
For exampl... | Your connection to the nearest router is using a wifi data link protocol (in the IEEE 802.11 family). But the connections to other routers and (eventually) hosts will use other data link protocols, likely including ethernet at least at the far end. |
12,122,640 | I have a dumb question, first of all sorry for that. i am learning now 7 OSI Layer models and i stumble across one thing. The Ethernet which is in the second Data Link Layer provides the end-to-end connection via LANs, right? Does it mean that even if i connect to Internet thru WiFi, somewhere my connection is running ... | 2012/08/25 | [
"https://Stackoverflow.com/questions/12122640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903790/"
] | I am going to break my answer into points:
1.Lan is not necessary to connect to internet. You can have cable internet or internet through DSL connection etc. in which though the wire that comes and connect to your pc is the same cat5(for example) cable, there is no lan involved.
2.Internet through wireless router an ... | Short answer is: most likely
In your case, you only know your direct connectivity is made possible thru WiFi. From your perspective, it's just a WiFi network. But behind WiFi network, it could be Ethernet, DSL, Cable, etc. And behind those, it could be T1, frame relay, ATM, 10G or maybe 100G Ethernet, etc.
For exampl... |
49,530,528 | In GHCI, I have ran the below. The first expression gives the result very fast. The second doesn't (I interrupted it after 10 seconds). I want to understand why? Is there an infinite loop?
```
Prelude> sum (takeWhile (<10000) (filter odd (map (^2) [1..])))
166650
Prelude> sum (filter (<10000) (filter odd (map (^2) [1.... | 2018/03/28 | [
"https://Stackoverflow.com/questions/49530528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2056878/"
] | Yes there is a huge difference. If we read the documentation, we see:
>
> [**`takeWhile :: (a -> Bool) -> [a] -> [a]`**](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:takeWhile)
>
>
> `takeWhile`, applied to a predicate `p` and a list `xs`, returns the **longest prefix** (possibly empty) of `... | [`filter`](https://downloads.haskell.org/~ghc/latest/docs/html/libraries/base-4.10.1.0/Prelude.html#v:filter) just keeps going through the list you supply to find all elements that satisfy the predicate. Giving it an infinite list it will just keep churning.
[`takeWhile`](https://downloads.haskell.org/~ghc/latest/doc... |
91,495 | Ok, let's say I have an offline wallet for storing my bitcoin, now I have got a good amount of bitcoin, but i don't want to take out everything from the wallet, I only want to take out a small amount, is that possible? | 2019/11/05 | [
"https://bitcoin.stackexchange.com/questions/91495",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/100492/"
] | Yes, bitcoin is divisible to the 0.00000001 bitcoin, we call this small amount the "Satoshi" for example so even if you got less than 1 bitcoin you have a pretty wide margin on what amount you want to transfer it could be 200.0099 or 0.0005123 be careful of the fees though
For the transfer part I suggest you to use [e... | Yes, it is possible. Basically any bitcoin wallet application should allow you to choose exactly how much to send to another address. |
29,428,421 | Inside view I have
```
<a onclick="myAction(@item.Id)" id="myActionId">@actionText</a>
```
or
```
<a id="myActionId" onclick="myAction(21)">Activate</a>
```
fuction which sends id to mvc controller to process further. As a response from controller I'm getting string data which should be used to change button te... | 2015/04/03 | [
"https://Stackoverflow.com/questions/29428421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1765862/"
] | You may want to remove the CURLOPT\_CAINFO option and instead set CURLOPT\_SSL\_VERIFYPEER to false. Here is an example:
```
$request = curl_init();
curl_setopt_array($request, array
(
CURLOPT_URL => $url,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => http_build_query(array('cmd'=>'_notify_validate') + $_POST),
... | I was able to resolve this issue by reverting back to my old certificate file and pasting the "VeriSign Class 3 Public Primary Certification Authority - G5" certificate section into it (from cacert.pem). This feels like a bit of a hack, but I just couldn't get it to work when referencing cacert.pem.
I didn't feel comf... |
29,428,421 | Inside view I have
```
<a onclick="myAction(@item.Id)" id="myActionId">@actionText</a>
```
or
```
<a id="myActionId" onclick="myAction(21)">Activate</a>
```
fuction which sends id to mvc controller to process further. As a response from controller I'm getting string data which should be used to change button te... | 2015/04/03 | [
"https://Stackoverflow.com/questions/29428421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1765862/"
] | You may want to remove the CURLOPT\_CAINFO option and instead set CURLOPT\_SSL\_VERIFYPEER to false. Here is an example:
```
$request = curl_init();
curl_setopt_array($request, array
(
CURLOPT_URL => $url,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => http_build_query(array('cmd'=>'_notify_validate') + $_POST),
... | I had same issue. It seems old ssl libraries have issues with fresh cacert.pem. Resolved by using "an older ca-bundle from github" (the last CA bundle converted from before RSA-1024 removal):
<https://github.com/bagder/ca-bundle/blob/e9175fec5d0c4d42de24ed6d84a06d504d5e5a09/ca-bundle.crt> |
7,596,233 | this question has gone back and forth a bit as I have learnt some things about g++ about unix systems (sorry if I messed anyone about).
For a project I am currently trying to finish I would like to get [twitcurl](http://code.google.com/p/twitcurl/wiki/WikiHowToUseTwitcurlLibrary) running with Xcode and OpenFrameworks.... | 2011/09/29 | [
"https://Stackoverflow.com/questions/7596233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/849845/"
] | Yes you can use coffee command in production. I use it.
I can see two reasons why you would want to use app.js wrapper.
1. You want to use local installation of CoffeeScript. (different versions between apps)
2. You want to use the default *npm start* to launch your server :) See *npm help scripts*
Oh, and you don'... | I upvoted Epeli's answer, which is clear and excellent—using a .js "wrapper" rather than the `coffee` command saves you from potential path headaches—but since this is a subjective question, let me throw in a contrary opinion.
Many CoffeeScripters, myself included, recommend compiling non-trivial Node apps to JS befor... |
7,596,233 | this question has gone back and forth a bit as I have learnt some things about g++ about unix systems (sorry if I messed anyone about).
For a project I am currently trying to finish I would like to get [twitcurl](http://code.google.com/p/twitcurl/wiki/WikiHowToUseTwitcurlLibrary) running with Xcode and OpenFrameworks.... | 2011/09/29 | [
"https://Stackoverflow.com/questions/7596233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/849845/"
] | Yes you can use coffee command in production. I use it.
I can see two reasons why you would want to use app.js wrapper.
1. You want to use local installation of CoffeeScript. (different versions between apps)
2. You want to use the default *npm start* to launch your server :) See *npm help scripts*
Oh, and you don'... | I prefer to create main.js like this:
```
require("coffee-script");
require('./yourcoffeeapp');
```
And yourcoffeeapp.coffee like this:
```
http = require 'http'
on_request = (req, res) =>
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end "Hello World\n"
server = http.createServer on_request
server.... |
7,596,233 | this question has gone back and forth a bit as I have learnt some things about g++ about unix systems (sorry if I messed anyone about).
For a project I am currently trying to finish I would like to get [twitcurl](http://code.google.com/p/twitcurl/wiki/WikiHowToUseTwitcurlLibrary) running with Xcode and OpenFrameworks.... | 2011/09/29 | [
"https://Stackoverflow.com/questions/7596233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/849845/"
] | I upvoted Epeli's answer, which is clear and excellent—using a .js "wrapper" rather than the `coffee` command saves you from potential path headaches—but since this is a subjective question, let me throw in a contrary opinion.
Many CoffeeScripters, myself included, recommend compiling non-trivial Node apps to JS befor... | I prefer to create main.js like this:
```
require("coffee-script");
require('./yourcoffeeapp');
```
And yourcoffeeapp.coffee like this:
```
http = require 'http'
on_request = (req, res) =>
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end "Hello World\n"
server = http.createServer on_request
server.... |
74,137,272 | I am trying to add manually row (one by one) from one dataframe to the another:
```
path = "...csv"
data = pd.read_csv(path, na_values='NULL')
path2 = "...csv"
data2 = pd.read_csv(path2, na_values='NULL')
for row in data2.itertuples():
x = input("Do you want to add the row, please write Yes or No")
if ... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74137272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15029172/"
] | State updater functions should be [pure](https://en.wikipedia.org/wiki/Pure_function). Your state updater function isn't pure, because if called multiple times with the same arguments (in this case there are none), it produces/returns different results:
```
const temp = refObj.current.value; // "x" on the first call, ... | Don't forget that setting a State is asynchronous. You don't know exactly when it's called, therefore some of the values that you expect may not available or different, like in this case with the ref.
More info <https://reactjs.org/docs/state-and-lifecycle.html> |
74,137,272 | I am trying to add manually row (one by one) from one dataframe to the another:
```
path = "...csv"
data = pd.read_csv(path, na_values='NULL')
path2 = "...csv"
data2 = pd.read_csv(path2, na_values='NULL')
for row in data2.itertuples():
x = input("Do you want to add the row, please write Yes or No")
if ... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74137272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15029172/"
] | I'm not super sure if a callback function is necessary here in this case (might be wrong): I think you could just replace the function with this:
```
const onSubmit = (e) => {
e.preventDefault();
setData([...data, refObj.current.value]);
refObj.current.value = "";
};
```
Just tested this in the codesandb... | Don't forget that setting a State is asynchronous. You don't know exactly when it's called, therefore some of the values that you expect may not available or different, like in this case with the ref.
More info <https://reactjs.org/docs/state-and-lifecycle.html> |
74,137,272 | I am trying to add manually row (one by one) from one dataframe to the another:
```
path = "...csv"
data = pd.read_csv(path, na_values='NULL')
path2 = "...csv"
data2 = pd.read_csv(path2, na_values='NULL')
for row in data2.itertuples():
x = input("Do you want to add the row, please write Yes or No")
if ... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74137272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15029172/"
] | There is perfectly nothing wrong with working and non-working solutions.
They are all behaving as expected.
One thing to know is that the callback function runs two times during development. (That's why the criteria for that callback function is to be pure).
In the nonworking example, the temp variable is inside the... | Don't forget that setting a State is asynchronous. You don't know exactly when it's called, therefore some of the values that you expect may not available or different, like in this case with the ref.
More info <https://reactjs.org/docs/state-and-lifecycle.html> |
74,137,272 | I am trying to add manually row (one by one) from one dataframe to the another:
```
path = "...csv"
data = pd.read_csv(path, na_values='NULL')
path2 = "...csv"
data2 = pd.read_csv(path2, na_values='NULL')
for row in data2.itertuples():
x = input("Do you want to add the row, please write Yes or No")
if ... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74137272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15029172/"
] | State updater functions should be [pure](https://en.wikipedia.org/wiki/Pure_function). Your state updater function isn't pure, because if called multiple times with the same arguments (in this case there are none), it produces/returns different results:
```
const temp = refObj.current.value; // "x" on the first call, ... | I'm not super sure if a callback function is necessary here in this case (might be wrong): I think you could just replace the function with this:
```
const onSubmit = (e) => {
e.preventDefault();
setData([...data, refObj.current.value]);
refObj.current.value = "";
};
```
Just tested this in the codesandb... |
74,137,272 | I am trying to add manually row (one by one) from one dataframe to the another:
```
path = "...csv"
data = pd.read_csv(path, na_values='NULL')
path2 = "...csv"
data2 = pd.read_csv(path2, na_values='NULL')
for row in data2.itertuples():
x = input("Do you want to add the row, please write Yes or No")
if ... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74137272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15029172/"
] | There is perfectly nothing wrong with working and non-working solutions.
They are all behaving as expected.
One thing to know is that the callback function runs two times during development. (That's why the criteria for that callback function is to be pure).
In the nonworking example, the temp variable is inside the... | State updater functions should be [pure](https://en.wikipedia.org/wiki/Pure_function). Your state updater function isn't pure, because if called multiple times with the same arguments (in this case there are none), it produces/returns different results:
```
const temp = refObj.current.value; // "x" on the first call, ... |
74,137,272 | I am trying to add manually row (one by one) from one dataframe to the another:
```
path = "...csv"
data = pd.read_csv(path, na_values='NULL')
path2 = "...csv"
data2 = pd.read_csv(path2, na_values='NULL')
for row in data2.itertuples():
x = input("Do you want to add the row, please write Yes or No")
if ... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74137272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15029172/"
] | There is perfectly nothing wrong with working and non-working solutions.
They are all behaving as expected.
One thing to know is that the callback function runs two times during development. (That's why the criteria for that callback function is to be pure).
In the nonworking example, the temp variable is inside the... | I'm not super sure if a callback function is necessary here in this case (might be wrong): I think you could just replace the function with this:
```
const onSubmit = (e) => {
e.preventDefault();
setData([...data, refObj.current.value]);
refObj.current.value = "";
};
```
Just tested this in the codesandb... |
193,820 | I bought the PS4 White Bundle with destiny (<http://www.gamestop.com/ps4/consoles/playstation-4-white-destiny-hardware-bundle/115475>) a month ago. I turned on my new PlayStation 4, and popped in the disc. The disc itself only said "destiny ". No guardian edition, no ghosts edition, none of that. When I played the game... | 2014/11/30 | [
"https://gaming.stackexchange.com/questions/193820",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/93549/"
] | **You did not get ripped of. You got what you paid for.**
From what I could tell, I found that in the bundled items it displays:
* PlayStation®4 System (Glacier White)
* DualShock®4 Wireless Controller (Glacier White)
* **Destiny Video Game (Physical Disc)**
* 30-Day PlayStation Plus Trial
* HDMI Cable
* Power Cable
... | This is what you get with the Digital Guardian Edition of Destiny: Digital Download of Destiny, Early Access to the Vanguard Armory and Player Emblem pre-order bonus, Exclusive In-Game: Ghost Casing, Player Ship and Player Emblem. This also includes the Expansion Pass.
It seems like you received the standard physical ... |
9,017,487 | I have a JSF2 application. I have a login bean which is session scoped and a logout bean which is view scoped. When I login I use redirect and it works fine. However the logout fails with redirect. If I logout without redirect it works.
```
@ManagedBean
@ViewScoped
public class MbLogout extends BaseJsf {
private s... | 2012/01/26 | [
"https://Stackoverflow.com/questions/9017487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/366357/"
] | I would recommend using a Servlet rather than a bean for logout, a managed bean (especially view scoped) is not fitting for the purpose of logging out. For example:
```
@WebServlet(name = "LogoutServlet", urlPatterns = {"/logout"}) // Can be configured in web.xml aswell
public class LogoutServlet extends HttpServlet {... | It seems to be related to the bean being in the view scope which should by itself be serialized in the session. Make it request scoped instead. The view scope doesn't make much sense for logout anyway.
```
@ManagedBean
@RequestScoped
public class MbLogout extends BaseJsf {
// ...
}
``` |
833,371 | I want to make permanent changes to Openstack code that is installed via Landscape/Autopilot. Is there a way to disable hooks from overwriting these changes? | 2016/10/05 | [
"https://askubuntu.com/questions/833371",
"https://askubuntu.com",
"https://askubuntu.com/users/589773/"
] | A better approach is to use the charms deploy-from-source configuration and point them at branches you maintain with your patches. | There is no built-in facility for this. You could disable juju by stopping daemons, deleting files, etc (standard Unix things). |
833,371 | I want to make permanent changes to Openstack code that is installed via Landscape/Autopilot. Is there a way to disable hooks from overwriting these changes? | 2016/10/05 | [
"https://askubuntu.com/questions/833371",
"https://askubuntu.com",
"https://askubuntu.com/users/589773/"
] | A better approach is to use the charms deploy-from-source configuration and point them at branches you maintain with your patches. | A hacked up approach would be to make the changes in
>
> /var/lib/juju/agents/unit-charmname-unitnumber/charm/
>
>
>
This way the hooks wont overwrite your changes. |
62,547,904 | I was installing `rdkit` package from `https://www.rdkit.org/docs/GettingStartedInPython.html` with conda command.
However, there were some errors and it started to rollback. While doing so, I terminated the command.
After that, the `conda` command seemed to not work at all.
```
C:\Users\user>where conda
INFO: Could... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62547904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13803295/"
] | According to this older post: [How to install Tensorflow on Python 2.7 on Windows?](https://stackoverflow.com/questions/45316569/how-to-install-tensorflow-on-python-2-7-on-windows)
Tensorflow does not support python2.7 anymore.
This is the system requirement for Tensorflow available: <https://www.tensorflow.org/instal... | The easiest way of using tensorflow is to download anaconda and then download the packages of anaconda! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.