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 |
|---|---|---|---|---|---|
10,764,160 | How can I draw a simple BAR?
Like this:

Thank you. | 2012/05/26 | [
"https://Stackoverflow.com/questions/10764160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/962508/"
] | $date = date('d/m/Y');
$date = strtotime($date); //in unix time stamp format | Basically american date format is `MM/DD/YYYY` and you are providing `DD/MM/YYYY` so thats why `startotime()` returns you a null values on this input; and i prefer you must follow standard date format of american `(MM/DD/YYYY)` because if you are using mentioned format of date that will create more problems as well in ... |
10,764,160 | How can I draw a simple BAR?
Like this:

Thank you. | 2012/05/26 | [
"https://Stackoverflow.com/questions/10764160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/962508/"
] | Use MySQL's [`STR_TO_DATE()`](http://dev.mysql.com/doc/en/date-and-time-functions.html#function_str-to-date) function:
```
INSERT INTO my_table VALUES (STR_TO_DATE('26/5/12', '%e/%c/%y'))
``` | Try this:
```
$mysqldate = date("m/d/y g:i A", $datetime);
``` |
137,563 | What's the best way to place a page-sized figure including the correct caption numbering on the facing page of a chapter opening page?
Correct numbering means: if I put the figure before the chapter, the numbering of the previous chapter is continued and the list of figures shows it belonging to the previous chapter.... | 2013/10/12 | [
"https://tex.stackexchange.com/questions/137563",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/12493/"
] | You can (and should) define a command doing the work, rather than explicitly set all those commands for each chapter.
My idea is to define a `\chapterfigure` command that has one optional argument and two mandatory ones; the optional argument and the first mandatory one are used for `\includegraphics`, while the final... | Here is a simple approach that I used (thanks to some hints here) to putting a landscape figure opposite a Chapter page, and numbering it as the first figure in that chapter:
```
% For viewing in Adobe Reader, don’t forget to set View> Page Display > Show Cover Page in Two-Page View
\documentclass[draft,12pt,letterpa... |
21,840,504 | My confusion is not new here or arround the web, yet, i have some questions for which i did not find answers anywhere:
The first question is:
>
> Why is Inherits necessary on CodeFile and not on CodeBehind?
>
>
>
I read: <http://msdn.microsoft.com/en-us/library/vstudio/ms178138(v=vs.100).aspx> and some more pag... | 2014/02/17 | [
"https://Stackoverflow.com/questions/21840504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1646155/"
] | Not sure about rows, the rest can be found via the [Information Schema](http://technet.microsoft.com/en-us/library/ms186778.aspx)
```
select Table_Name, COUNT(Column_Name) As NumberOfColumns
from INFORMATION_SCHEMA.COLUMNS
where table_catalog = @DBName
group by Table_Name
``` | i think you are asking about number of rows in a table
look at this
```
$dbhost = 'localhost';
$dbname = 'modify this';
$dbuser = 'and this';
$dbpass = 'and this';
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die('can not connect to sql');
mysql_select_db($dbname) or die('can not select d... |
21,840,504 | My confusion is not new here or arround the web, yet, i have some questions for which i did not find answers anywhere:
The first question is:
>
> Why is Inherits necessary on CodeFile and not on CodeBehind?
>
>
>
I read: <http://msdn.microsoft.com/en-us/library/vstudio/ms178138(v=vs.100).aspx> and some more pag... | 2014/02/17 | [
"https://Stackoverflow.com/questions/21840504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1646155/"
] | This one gets the rows but won't show the column count:
```
sp_MSforeachtable @command1="select count(*) from ?"
```
(from here <http://www.sqlservercentral.com/Forums/Topic271576-5-1.aspx>) | i think you are asking about number of rows in a table
look at this
```
$dbhost = 'localhost';
$dbname = 'modify this';
$dbuser = 'and this';
$dbpass = 'and this';
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die('can not connect to sql');
mysql_select_db($dbname) or die('can not select d... |
4,769,973 | There are number of REST frameworks around for ASP.NET MVC. Which one is the most mature in your opinion? Following are few I briefly looked at, but I couldn't decide.
1. [Snooze](http://www.assembla.com/wiki/show/snooze)
2. [BistroMVC](http://bistroframework.org/index.php?title=Bistro_Framework_Home)
3. [Restful Serv... | 2011/01/22 | [
"https://Stackoverflow.com/questions/4769973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282566/"
] | Personally I would go with the default ASP.NET routing engine which is built and supported by Microsoft. This will ensure that you won't find yourself one day into the position of having to migrate some code which has become obsolete because the authors simply decided to abandon the project. Of course if there is somet... | I completely agree with Darin.
But if you're looking for something closer to what WCF offers (Web service, versus a typical Web site), I've been extremely happy with WCF REST.
There's a WCF REST Service Template available via Visual Studio's Extension Manager that will get you up and running fairly quickly. |
4,769,973 | There are number of REST frameworks around for ASP.NET MVC. Which one is the most mature in your opinion? Following are few I briefly looked at, but I couldn't decide.
1. [Snooze](http://www.assembla.com/wiki/show/snooze)
2. [BistroMVC](http://bistroframework.org/index.php?title=Bistro_Framework_Home)
3. [Restful Serv... | 2011/01/22 | [
"https://Stackoverflow.com/questions/4769973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282566/"
] | Personally I would go with the default ASP.NET routing engine which is built and supported by Microsoft. This will ensure that you won't find yourself one day into the position of having to migrate some code which has become obsolete because the authors simply decided to abandon the project. Of course if there is somet... | OpenRasta
Have been implementing RESTFul service using OR, only one word to describe it => "Pure Awesomeness" ....actually it's 2 words.
For me the simplicity is a plus, the framework is easy to use and adopt to. Some of it's conventions in my opinion really help me to understand Resful. Many integration points in th... |
4,769,973 | There are number of REST frameworks around for ASP.NET MVC. Which one is the most mature in your opinion? Following are few I briefly looked at, but I couldn't decide.
1. [Snooze](http://www.assembla.com/wiki/show/snooze)
2. [BistroMVC](http://bistroframework.org/index.php?title=Bistro_Framework_Home)
3. [Restful Serv... | 2011/01/22 | [
"https://Stackoverflow.com/questions/4769973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282566/"
] | Personally I would go with the default ASP.NET routing engine which is built and supported by Microsoft. This will ensure that you won't find yourself one day into the position of having to migrate some code which has become obsolete because the authors simply decided to abandon the project. Of course if there is somet... | I agree with Darin. Personally, I think [Apache Thrift](http://thrift.apache.org/) is also an option for doing client and server communication. |
47,663,333 | I want to go through my ArrayList of ArrayLists and remove all the ones that are empty. Is there a fast and efficient way to do this, other then I guess a for loop?
Example Ouput:
>
> [ [alec, joe, ray], [], [eric, jacob], [] ]
>
>
>
Would then look like this:
>
> [ [alec, joe, ray], [eric, jacob] ]
>
>
> | 2017/12/05 | [
"https://Stackoverflow.com/questions/47663333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6950859/"
] | something like this should suffice.
```
nestedArrayList = nestedArrayList.stream()
.filter(e -> !e.isEmpty())
.collect(Collectors.toCollection(ArrayList::new));
```
or as Zabuza has suggested, you could use `removeIf`:
```
nestedArrayList.removeIf(ArrayList::isEmpty);
```
IMHO I'd go with the second appro... | Lambdas above as posted by Aomine or iterator like this:
```
package com.company;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
public class Main {
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> lista = new ArrayList<>(){{
add(new ArrayLis... |
43,412 | I want to accomplish network shown in image. 
1.Local can access servers
2.internet can access servers with limited ports and cannot connect to local network
3.I have only 1 public static ip so i cannot place firewall between router and isp
4. My firewall is smal... | 2017/08/20 | [
"https://networkengineering.stackexchange.com/questions/43412",
"https://networkengineering.stackexchange.com",
"https://networkengineering.stackexchange.com/users/30186/"
] | Your stack switches should be connected to both routers. That way, you will have redundancy if a router fails. If possible, your servers should also be dual-homed to both routers. VRRP will do you no good unless you are connected to both routers.
Unless you intend to apply access lists to restrict data flows between u... | ATT usually hands off their network as a private address. You may be able to use layer 3 switches in place of the routers and do a combined core and distribution at those switches if the network isn't very big. It can save money, you can stack most with a modules or special cables, you get fast routing, less chance of ... |
43,412 | I want to accomplish network shown in image. 
1.Local can access servers
2.internet can access servers with limited ports and cannot connect to local network
3.I have only 1 public static ip so i cannot place firewall between router and isp
4. My firewall is smal... | 2017/08/20 | [
"https://networkengineering.stackexchange.com/questions/43412",
"https://networkengineering.stackexchange.com",
"https://networkengineering.stackexchange.com/users/30186/"
] | Your stack switches should be connected to both routers. That way, you will have redundancy if a router fails. If possible, your servers should also be dual-homed to both routers. VRRP will do you no good unless you are connected to both routers.
Unless you intend to apply access lists to restrict data flows between u... | "Also, I want to install Load Balancer but I don't know where should I put it, behind routers/switches or Firewall?"
As Ron Trunk mentioned, you didn't specify what you want to do with the load balancer. If you are using it for a combination of traffic and redundancy, then in-line behind the firewall would allow traff... |
39,648 | When I'm opening .avi files, I want to open them with VLC Media player, when right clicking the item, I see this:

As you can see QuickTime is the default player, I want to change it to VLC, so I change it:
 right click your file
2) choose "Get Info"
3) in the popup find the "Open with" strip (this is by default clos... | There's a great preference pane [RCDefaultApp](http://www.rubicode.com/Software/RCDefaultApp/). It should do what you want.
>
> RCDefaultApp is a Mac OS X 10.2 or higher preference pane that allows a user to set the default application used for various URL schemes, file extensions, file types, MIME types, and Uniform... |
39,648 | When I'm opening .avi files, I want to open them with VLC Media player, when right clicking the item, I see this:

As you can see QuickTime is the default player, I want to change it to VLC, so I change it:
. It should do what you want.
>
> RCDefaultApp is a Mac OS X 10.2 or higher preference pane that allows a user to set the default application used for various URL schemes, file extensions, file types, MIME types, and Uniform... | For anyone Googling for the same issue: as the venerable RCDefaultApp is now broken under 10.12 and later, there's a open-source equivalent [SwiftDefaultApp](https://github.com/Lord-Kamina/SwiftDefaultApps)
>
> This Preference pane is chiefly intended to be a modern replacement for the amazing RCDefaultApp developed ... |
39,648 | When I'm opening .avi files, I want to open them with VLC Media player, when right clicking the item, I see this:

As you can see QuickTime is the default player, I want to change it to VLC, so I change it:
 right click your file
2) choose "Get Info"
3) in the popup find the "Open with" strip (this is by default clos... | For anyone Googling for the same issue: as the venerable RCDefaultApp is now broken under 10.12 and later, there's a open-source equivalent [SwiftDefaultApp](https://github.com/Lord-Kamina/SwiftDefaultApps)
>
> This Preference pane is chiefly intended to be a modern replacement for the amazing RCDefaultApp developed ... |
65,084,907 | ```
if(edatevalue=="") // **checking if edatevalue is blank**
{
edatevalue = now; // **set edatevalue to now time**
}
else
{
edate = edatevalue; // **assign edatevalue to edate variable**
}
if(sdatevalue=="") // **check if sdatevalue is blank**
{
sdatevalue=0; // **assign 0 to sdatevalue**
}
else
{
sdate =... | 2020/12/01 | [
"https://Stackoverflow.com/questions/65084907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14519443/"
] | The reason why you are not able to remove all the elements is that when you are removing an element from the array the `j` value skips to the next value's next value instead of the next. So only the alternative values will be removed by this method.
```py
lis = [3,4,5,6]
for j in lis:
lis.remove(j)
print(j)
pr... | use clear to clear all the element of the list
```
lis =[3,4,5,6]
lis.clear()
print(lis)
```
Output:
```
[]
``` |
65,084,907 | ```
if(edatevalue=="") // **checking if edatevalue is blank**
{
edatevalue = now; // **set edatevalue to now time**
}
else
{
edate = edatevalue; // **assign edatevalue to edate variable**
}
if(sdatevalue=="") // **check if sdatevalue is blank**
{
sdatevalue=0; // **assign 0 to sdatevalue**
}
else
{
sdate =... | 2020/12/01 | [
"https://Stackoverflow.com/questions/65084907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14519443/"
] | The reason why you are not able to remove all the elements is that when you are removing an element from the array the `j` value skips to the next value's next value instead of the next. So only the alternative values will be removed by this method.
```py
lis = [3,4,5,6]
for j in lis:
lis.remove(j)
print(j)
pr... | A correct solution will be to create a shallow copy with the help of `list()` function.
```
lis =[3,4,5,6]
for j in list(lis):
lis.remove(j)
print(lis)
```
Output
```
[]
``` |
12,744,483 | Our control system has a lot of data files that have specific versions. The data files are "append only", so a higher version will always contain a superset of the definitions in the earlier versions.
In order to avoid "magic numbers" in our code, we have created a code generator that take a piece of data and turns it... | 2012/10/05 | [
"https://Stackoverflow.com/questions/12744483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80577/"
] | The static constructors for each of your nested classes won't run until those nested classes are referenced for the first time. That hasn't happened in your above code, hence the list is empty.
One way I could imagine you might be able to do this would be for a static initializer in the `GlobalConstants` class to use ... | For a somewhat simpler syntax, you could do it using attributes instead of static classes.
If you define an attribute;
```
public class UtilVersionAttribute : Attribute
{
private readonly string _versionInfo;
public UtilVersionAttribute(string versionInfo) { _versionInfo = versionInfo; }
public string V... |
28,671,753 | I'm trying to create mocks for my login procedure. I use POST method with a couple of fields and login object (with login, password, etc.)
For that I'm using JsonPath. Code below:
```
{
"request": {
"method": "POST",
"url": "/login",
"bodyPatterns" : [
{"matchesJsonPath" : "$.me... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28671753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1812056/"
] | Following worked for me.
`"matchesJsonPath" : "$.rootItem.itemA[0].item..[?(@.fieldName=='file')]"`
Json :
```
{
"rootItem" : {
"itemA" : [
{
"item" : {
"fieldName" : "file",
"name" : "test"
}
}
... | try with double dots operator (recursive)
```
$..params[?(@.clientVersion == "1")]
``` |
28,671,753 | I'm trying to create mocks for my login procedure. I use POST method with a couple of fields and login object (with login, password, etc.)
For that I'm using JsonPath. Code below:
```
{
"request": {
"method": "POST",
"url": "/login",
"bodyPatterns" : [
{"matchesJsonPath" : "$.me... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28671753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1812056/"
] | **Update Wiremock**. It should work with newer versions >= 2.0.0-beta. Its [JsonPath](https://github.com/jayway/JsonPath) dependency was very outdated ([GitHub #261](https://github.com/tomakehurst/wiremock/issues/261)).
Using the double dots operator is semantically not the same, as the filter will also match for elem... | try with double dots operator (recursive)
```
$..params[?(@.clientVersion == "1")]
``` |
28,671,753 | I'm trying to create mocks for my login procedure. I use POST method with a couple of fields and login object (with login, password, etc.)
For that I'm using JsonPath. Code below:
```
{
"request": {
"method": "POST",
"url": "/login",
"bodyPatterns" : [
{"matchesJsonPath" : "$.me... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28671753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1812056/"
] | It's working in my case :
wiremock:
```
"request": {
"urlPathPattern": "/api/authins-portail-rs/authins/inscription/infosperso",
"bodyPatterns" : [
{"matchesJsonPath" : "$[?(@.nir == '123456789')]"},
{"matchesJsonPath" : "$[?(@.nomPatronyme == 'aubert')]"},
{"matchesJsonPath" : "$[?(@.prenoms == 'christian')]"}... | try with double dots operator (recursive)
```
$..params[?(@.clientVersion == "1")]
``` |
28,671,753 | I'm trying to create mocks for my login procedure. I use POST method with a couple of fields and login object (with login, password, etc.)
For that I'm using JsonPath. Code below:
```
{
"request": {
"method": "POST",
"url": "/login",
"bodyPatterns" : [
{"matchesJsonPath" : "$.me... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28671753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1812056/"
] | It's working in my case :
wiremock:
```
"request": {
"urlPathPattern": "/api/authins-portail-rs/authins/inscription/infosperso",
"bodyPatterns" : [
{"matchesJsonPath" : "$[?(@.nir == '123456789')]"},
{"matchesJsonPath" : "$[?(@.nomPatronyme == 'aubert')]"},
{"matchesJsonPath" : "$[?(@.prenoms == 'christian')]"}... | Following worked for me.
`"matchesJsonPath" : "$.rootItem.itemA[0].item..[?(@.fieldName=='file')]"`
Json :
```
{
"rootItem" : {
"itemA" : [
{
"item" : {
"fieldName" : "file",
"name" : "test"
}
}
... |
28,671,753 | I'm trying to create mocks for my login procedure. I use POST method with a couple of fields and login object (with login, password, etc.)
For that I'm using JsonPath. Code below:
```
{
"request": {
"method": "POST",
"url": "/login",
"bodyPatterns" : [
{"matchesJsonPath" : "$.me... | 2015/02/23 | [
"https://Stackoverflow.com/questions/28671753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1812056/"
] | It's working in my case :
wiremock:
```
"request": {
"urlPathPattern": "/api/authins-portail-rs/authins/inscription/infosperso",
"bodyPatterns" : [
{"matchesJsonPath" : "$[?(@.nir == '123456789')]"},
{"matchesJsonPath" : "$[?(@.nomPatronyme == 'aubert')]"},
{"matchesJsonPath" : "$[?(@.prenoms == 'christian')]"}... | **Update Wiremock**. It should work with newer versions >= 2.0.0-beta. Its [JsonPath](https://github.com/jayway/JsonPath) dependency was very outdated ([GitHub #261](https://github.com/tomakehurst/wiremock/issues/261)).
Using the double dots operator is semantically not the same, as the filter will also match for elem... |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | In [k8s networkpolicy docs](https://kubernetes.io/docs/concepts/services-networking/network-policies/#isolated-and-non-isolated-pods) you read:
>
> By default, pods are non-isolated; they accept traffic from any
> source.
>
>
> Pods become isolated by having a NetworkPolicy that selects them. Once
> there is any Ne... | From the question, i am not getting ... completely confused.
statement 1 --> on same namespace, the pod can communicate with port 80
statement 2 --> does not allow access to Pods not listening on port 80
So, could someone clarify here ?
what exactly they are asking ? do we need to provide the 80 access to pod or no... |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | In [k8s networkpolicy docs](https://kubernetes.io/docs/concepts/services-networking/network-policies/#isolated-and-non-isolated-pods) you read:
>
> By default, pods are non-isolated; they accept traffic from any
> source.
>
>
> Pods become isolated by having a NetworkPolicy that selects them. Once
> there is any Ne... | Below yaml will help you to solve your problem, It did work for me.
the point is mainly to use only the port section of ingress array.
```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: network-policy
spec:
podSelector: {} #selects all the pods in the namespace deployed
policyTypes:
- I... |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | In [k8s networkpolicy docs](https://kubernetes.io/docs/concepts/services-networking/network-policies/#isolated-and-non-isolated-pods) you read:
>
> By default, pods are non-isolated; they accept traffic from any
> source.
>
>
> Pods become isolated by having a NetworkPolicy that selects them. Once
> there is any Ne... | statement 2 --> does not allow access to Pods not listening on port 80
How to not allow when a pod not listening this a TCP state of a server .. You can also have pods not listening on port 80 on same namespace . I don't think this is solved in your above yaml . |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | In [k8s networkpolicy docs](https://kubernetes.io/docs/concepts/services-networking/network-policies/#isolated-and-non-isolated-pods) you read:
>
> By default, pods are non-isolated; they accept traffic from any
> source.
>
>
> Pods become isolated by having a NetworkPolicy that selects them. Once
> there is any Ne... | 1. You need to label the namespace first
For e.g **kubectl label ns namespace-name env: testing**
2.
```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-from-namespace
namespace: staging
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelect... |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | 1. You need to label the namespace first
For e.g **kubectl label ns namespace-name env: testing**
2.
```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-from-namespace
namespace: staging
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelect... | From the question, i am not getting ... completely confused.
statement 1 --> on same namespace, the pod can communicate with port 80
statement 2 --> does not allow access to Pods not listening on port 80
So, could someone clarify here ?
what exactly they are asking ? do we need to provide the 80 access to pod or no... |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | 1. You need to label the namespace first
For e.g **kubectl label ns namespace-name env: testing**
2.
```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-from-namespace
namespace: staging
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelect... | Below yaml will help you to solve your problem, It did work for me.
the point is mainly to use only the port section of ingress array.
```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: network-policy
spec:
podSelector: {} #selects all the pods in the namespace deployed
policyTypes:
- I... |
64,153,049 | kubernetes V19
Create a new NetworkPolicy named allow-port-from-namespace that allows Pods in the existing namespace internal to connect to port 80 of other Pods in the same namespace.
Ensure that the new NetworkPolicy:
does not allow access to Pods not listening on port 80
does not allow access from Pods not in nam... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64153049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3584773/"
] | 1. You need to label the namespace first
For e.g **kubectl label ns namespace-name env: testing**
2.
```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-from-namespace
namespace: staging
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelect... | statement 2 --> does not allow access to Pods not listening on port 80
How to not allow when a pod not listening this a TCP state of a server .. You can also have pods not listening on port 80 on same namespace . I don't think this is solved in your above yaml . |
41,508,796 | I've searching the [moment.js docs](http://momentjs.com/docs/) and [stackoverflow](https://stackoverflow.com/) for a way to use the `fromNow()` function but returning everything in hours.
What I mean is:
```
moment([2017, 01, 05]).fromNow(); // a day ago
```
should be
```
moment([2017, 01, 05]).fromNow(); ... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41508796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4453976/"
] | You can use [`relativeTimeThreshold`](http://momentjs.com/docs/#/customization/relative-time-threshold/) to customize thresholds for moment relative time.
As the docs says:
>
> `duration.humanize` has thresholds which define when a unit is considered a minute, an hour and so on. For example, by default more than 45 ... | If you definitely want to use `fromNow()`, I don't see any way other than overriding moment's built-in function. For example, you can override it to return the difference in hours as follows:
```
moment.fn.fromNow = function (a) {
var duration = moment().diff(this, 'hours');
return duration;
}
```
Then you c... |
23,604,020 | First of all, excuse me if the code below does not contain an array but a list. I am new to VBA so I don't know all the basics yet. The code below retrieves an array (or a list) of all Excel files in a certain folder. The code is used to retrieve data from each file and is pasted in a master file.
Okay, here is my M... | 2014/05/12 | [
"https://Stackoverflow.com/questions/23604020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2851837/"
] | The variable `wbName` contains the filenames from the `Dir` command. Check to see if the string contains what you want to exlude.
Extend the line
```
While wbName <> ""
```
into
```
While wbName <> "" And InStr(1, UCase(wbName), "TEMPLATE") = 0
```
to exlude any filenames that contain `TEMPLATE`, regardless of c... | ```
Dim fNameList As Variant
Dim storFName As String
Dim i As Integer
Sub ReadDataFromAllWorkbooksInFolder()
Dim FolderName As String, wbName As String, wbCount As Integer
FolderName = "C:\Users\Robin\Desktop\Test"
wbCount = 0
wbName = Dir(FolderName & "\" & "*.xlsm")
While wbName <> ""
wbCount = wb... |
23,604,020 | First of all, excuse me if the code below does not contain an array but a list. I am new to VBA so I don't know all the basics yet. The code below retrieves an array (or a list) of all Excel files in a certain folder. The code is used to retrieve data from each file and is pasted in a master file.
Okay, here is my M... | 2014/05/12 | [
"https://Stackoverflow.com/questions/23604020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2851837/"
] | The variable `wbName` contains the filenames from the `Dir` command. Check to see if the string contains what you want to exlude.
Extend the line
```
While wbName <> ""
```
into
```
While wbName <> "" And InStr(1, UCase(wbName), "TEMPLATE") = 0
```
to exlude any filenames that contain `TEMPLATE`, regardless of c... | ```
Sub test()
Dim x() As String, i As Integer
x = ReadDataFromAllWorkbooksInFolder("C:\Users\Robin\Desktop\Test")
For i = 0 To UBound(x)
Debug.Print x(i)
Next i
End Sub
Private Function ReadDataFromAllWorkbooksInFolder(FolderName As String) As Variant
Dim wbName As String
Dim wbCount A... |
23,604,020 | First of all, excuse me if the code below does not contain an array but a list. I am new to VBA so I don't know all the basics yet. The code below retrieves an array (or a list) of all Excel files in a certain folder. The code is used to retrieve data from each file and is pasted in a master file.
Okay, here is my M... | 2014/05/12 | [
"https://Stackoverflow.com/questions/23604020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2851837/"
] | ```
Dim fNameList As Variant
Dim storFName As String
Dim i As Integer
Sub ReadDataFromAllWorkbooksInFolder()
Dim FolderName As String, wbName As String, wbCount As Integer
FolderName = "C:\Users\Robin\Desktop\Test"
wbCount = 0
wbName = Dir(FolderName & "\" & "*.xlsm")
While wbName <> ""
wbCount = wb... | ```
Sub test()
Dim x() As String, i As Integer
x = ReadDataFromAllWorkbooksInFolder("C:\Users\Robin\Desktop\Test")
For i = 0 To UBound(x)
Debug.Print x(i)
Next i
End Sub
Private Function ReadDataFromAllWorkbooksInFolder(FolderName As String) As Variant
Dim wbName As String
Dim wbCount A... |
32,510,319 | I have a right arrow that when clicked shows the hidden left arrow. There is text centered between the two arrows so the margin changes on the centered text when both arrows are visible so I removed the css styling on #completeList and am trying to add the css with JQuery. Here is the code that I am trying:
```
$('#co... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32510319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5322719/"
] | Docker generates a `config.json` file in `~/.docker/`
It looks like:
```
{
"auths": {
"index.docker.io/v1/": {
"auth": "ZmFrZXBhc3N3b3JkMTIK",
"email": "email@company.com"
}
}
}
```
what you actually want is:
```
{"https://index.docker.io/v1/": {"auth": "XXXXXXXXXXXXX... | I've been experiencing the same problem. What I did notice is that in the example (<https://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod>) .dockercfg has the following format:
```
{
"https://index.docker.io/v1/": {
"auth": "ZmFrZXBhc3N3b3JkMTIK",
"email": "jdoe@example.com... |
32,510,319 | I have a right arrow that when clicked shows the hidden left arrow. There is text centered between the two arrows so the margin changes on the centered text when both arrows are visible so I removed the css styling on #completeList and am trying to add the css with JQuery. Here is the code that I am trying:
```
$('#co... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32510319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5322719/"
] | Another possible reason why you might see "image not found" is if the namespace of your secret doesn't match the namespace of the container.
For example, if your Deployment yaml looks like
```
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mydeployment
namespace: kube-system
```
Then you must ... | I've been experiencing the same problem. What I did notice is that in the example (<https://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod>) .dockercfg has the following format:
```
{
"https://index.docker.io/v1/": {
"auth": "ZmFrZXBhc3N3b3JkMTIK",
"email": "jdoe@example.com... |
32,510,319 | I have a right arrow that when clicked shows the hidden left arrow. There is text centered between the two arrows so the margin changes on the centered text when both arrows are visible so I removed the css styling on #completeList and am trying to add the css with JQuery. Here is the code that I am trying:
```
$('#co... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32510319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5322719/"
] | Another reason you might see this error is due to using a kubectl version different than the cluster version (e.g. using kubectl 1.9.x against a 1.8.x cluster).
The format of the secret generated by the *kubectl create secret docker-registry* command has changed between versions.
A 1.8.x cluster expect a secret with ... | I've been experiencing the same problem. What I did notice is that in the example (<https://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod>) .dockercfg has the following format:
```
{
"https://index.docker.io/v1/": {
"auth": "ZmFrZXBhc3N3b3JkMTIK",
"email": "jdoe@example.com... |
32,510,319 | I have a right arrow that when clicked shows the hidden left arrow. There is text centered between the two arrows so the margin changes on the centered text when both arrows are visible so I removed the css styling on #completeList and am trying to add the css with JQuery. Here is the code that I am trying:
```
$('#co... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32510319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5322719/"
] | Docker generates a `config.json` file in `~/.docker/`
It looks like:
```
{
"auths": {
"index.docker.io/v1/": {
"auth": "ZmFrZXBhc3N3b3JkMTIK",
"email": "email@company.com"
}
}
}
```
what you actually want is:
```
{"https://index.docker.io/v1/": {"auth": "XXXXXXXXXXXXX... | Another reason you might see this error is due to using a kubectl version different than the cluster version (e.g. using kubectl 1.9.x against a 1.8.x cluster).
The format of the secret generated by the *kubectl create secret docker-registry* command has changed between versions.
A 1.8.x cluster expect a secret with ... |
32,510,319 | I have a right arrow that when clicked shows the hidden left arrow. There is text centered between the two arrows so the margin changes on the centered text when both arrows are visible so I removed the css styling on #completeList and am trying to add the css with JQuery. Here is the code that I am trying:
```
$('#co... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32510319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5322719/"
] | Another possible reason why you might see "image not found" is if the namespace of your secret doesn't match the namespace of the container.
For example, if your Deployment yaml looks like
```
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mydeployment
namespace: kube-system
```
Then you must ... | Another reason you might see this error is due to using a kubectl version different than the cluster version (e.g. using kubectl 1.9.x against a 1.8.x cluster).
The format of the secret generated by the *kubectl create secret docker-registry* command has changed between versions.
A 1.8.x cluster expect a secret with ... |
30,737,897 | I am using a UITextView that displays different text depending on the course of user actions. Some text includes hyperlinks and some does not, so I would like to retain the UITextView's default setting to detect links. However, once I switch back to text that does not have a hyperlink, the entire text field is converte... | 2015/06/09 | [
"https://Stackoverflow.com/questions/30737897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4678042/"
] | I have also experienced this exact issue.
Attempted different things to remedy the problem, but nothing worked.
Reported the issue to the Google AppEngine issue tracker:
<https://code.google.com/p/googleappengine/issues/detail?id=12105> | I'm not sure why the annotation processor is somehow injecting `this$0` as a path parameter. Does your API really need to have the `members` and `session` in part of the path? Or, can/should these both be query parameters instead (see the auto-generated code and how it has injected them there)? Try removing the `@Named... |
30,737,897 | I am using a UITextView that displays different text depending on the course of user actions. Some text includes hyperlinks and some does not, so I would like to retain the UITextView's default setting to detect links. However, once I switch back to text that does not have a hyperlink, the entire text field is converte... | 2015/06/09 | [
"https://Stackoverflow.com/questions/30737897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4678042/"
] | I have also experienced this exact issue.
Attempted different things to remedy the problem, but nothing worked.
Reported the issue to the Google AppEngine issue tracker:
<https://code.google.com/p/googleappengine/issues/detail?id=12105> | Given that this method is doing modification, it should be a POST. I would recommend not using @Named here. I would create an `AddGroupRequest` class that contains both parameters. This way they are passed in as a JSON body rather than as URL parameters. As mentioned, this is a bug, and you can file an issue at the App... |
50,747,747 | Instead of using physics bodies to detect collisions I am simply using enumerateChildNodes to check if SKSpriteNodes intersect. Its works great for me when the SKSpriteNodes are both children of the scene but it doesn't work when one of the SKSpriteNodes is a grandchild. I have tried using // and / before the name of t... | 2018/06/07 | [
"https://Stackoverflow.com/questions/50747747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9426356/"
] | Ana, I have watched your questions change over the past several iterations, and it is clear you know what pieces you need to put together, but you are somewhat making it more difficult on yourself than it needs to be by how you are trying to fit them together.
The purpose for dynamically allocating your structures or ... | Code as shown will not compile-build for the following reasons:
* The member`d->line1` does not exist in struct.
* The function `void alloc_Data(Data *d, int size)` has two arguments,
but the call: `alloc_Data(d);` has only 1 argument.
Also, since definition for the function `open_output(string, &output);` is not p... |
11,680,877 | I used to utilize the following:
```
public event EventHandler OnComplete = delegate { };
```
I'm not sure, how this is called, is this an "event default initializer"??
But the problem appeared to be when I derived from EventArgs, created my own EventHandler and decided to use the same approach. Please, see:
```
p... | 2012/07/27 | [
"https://Stackoverflow.com/questions/11680877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1467858/"
] | ```
public event MyEventHandler OnOperationComplete = (sender, args) => { return null; };
```
I also think you meant to say:
```
public delegate void MyEventHandler(object sender, MyEventArgs e);
```
not
```
public delegate EventHandler MyEventHandler(object sender, MyEventArgs e);
``` | ```
public event Action OnDied = delegate { };
```
The easiest method |
402,352 | Alright, I'm trying to create I guess an LED matrix display(?) so that I can make essentially a text display using 8x5 LEDs per letter, to make 11 letters in total. I'm definitely willing to learn a lot and NEED to learn a lot as I have little experience with something like this. My goal is to be able to display indivi... | 2018/10/21 | [
"https://electronics.stackexchange.com/questions/402352",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/193539/"
] | Common logic voltage levels are 3.3 V and 5 V, and many batteries have 4.2 V or 4.1 V. So the brown-out levels are obviously designed to be 0.7 V below these supply voltages.
In general, power supplies are assumed to have tolerances of ± 10 % (this is why the datasheet often says "4.5 V – 5.5 V"). And when your power ... | Actually when you use battery, your voltage drops gradually. and you dont want your system to stop working while voltage drops just a little bit. and as you can see in the diagram if your clock is 8mhz you can work with supply voltage as low as 2.7 and lower than that is unsafe or unstable. so you'd want brown out dete... |
402,352 | Alright, I'm trying to create I guess an LED matrix display(?) so that I can make essentially a text display using 8x5 LEDs per letter, to make 11 letters in total. I'm definitely willing to learn a lot and NEED to learn a lot as I have little experience with something like this. My goal is to be able to display indivi... | 2018/10/21 | [
"https://electronics.stackexchange.com/questions/402352",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/193539/"
] | You need to look at the **tolerance** of the brownout voltage threshold as well as the nominal value.
[](https://i.stack.imgur.com/58bWd.png)
The 2.6V setting (and really, any of the settings) is **useless** for a 3.3V nominal supply at any clock fr... | Actually when you use battery, your voltage drops gradually. and you dont want your system to stop working while voltage drops just a little bit. and as you can see in the diagram if your clock is 8mhz you can work with supply voltage as low as 2.7 and lower than that is unsafe or unstable. so you'd want brown out dete... |
3,000,921 | I'm trying to prove the following statement.
"Let $A$ be a (finite dimensional?) algebra over some field $K$. Then $Ae$ is indecomposable if and only if the idempotent $e$ is primitive."
It is clear to me that if $e=e\_1+e\_2$ for some orthogonal idempotents, then this will yield $Ae=Ae\_1\oplus Ae\_2$. I am however... | 2018/11/16 | [
"https://math.stackexchange.com/questions/3000921",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416046/"
] | **Hint:** It is clear that $\ker T^k\subset\ker T^{k+1}$. So, you have an increasing sequence of subspaces of a $n$-dimensional space. | $N(T^{k}) \subset N(T^{k+1})$. If equality does not hold then the dimension of $N(T^{k})$ must be smaller than that of $N(T^{k+1})$. If the assertion is not true you will get a strictly decreasing sequence of positive integers all less than or equal to the dimension of the space. This is a contradiction. |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | This answer is not definitive, but rather demonstrative of a different technique than those offered thus far. This leverages the fact that a function in Javascript is a first-class object, and as such, a) you can pass it as a value to another function and b) you can add properties to it. Combine these traits with funct... | I don't know if this will be useful. You do need to modify the original function but only once and you don't need to keep editing it for firing hooks
<https://github.com/rcorp/hooker> |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | This answer is not definitive, but rather demonstrative of a different technique than those offered thus far. This leverages the fact that a function in Javascript is a first-class object, and as such, a) you can pass it as a value to another function and b) you can add properties to it. Combine these traits with funct... | The following function will give you before and after hooks that can be stacked. So if you have a number of potential functions that need to run before the given function or after the given function then this would be a working solution. This solution does not require jQuery and uses native array methods (no shims requ... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Might not be pretty but it seems to work...
```
<script>
function A(x) { alert(x); return x; }
function B() { alert(123); }
function addHook(functionB, functionA, parent)
{
if (typeof parent == 'undefined')
parent = window;
for (var i in parent)
{
if (parent[i] === functionA)
{
... | The following function will give you before and after hooks that can be stacked. So if you have a number of potential functions that need to run before the given function or after the given function then this would be a working solution. This solution does not require jQuery and uses native array methods (no shims requ... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Take a look at [jQuery's AOP plugin](http://plugins.jquery.com/project/AOP). In general, google "javascript aspect oriented programming". | Here's what I did, might be useful in other applications like this:
```
//Setup a hooking object
a={
hook:function(name,f){
aion.hooks[name]=f;
}
}a.hooks={
//default hooks (also sets the object)
};
//Add a hook
a.hook('test',function(){
alert('test');
});
//Apply each Hook (can be done with... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | The following function will give you before and after hooks that can be stacked. So if you have a number of potential functions that need to run before the given function or after the given function then this would be a working solution. This solution does not require jQuery and uses native array methods (no shims requ... | Here's what I did, might be useful in other applications like this:
```
//Setup a hooking object
a={
hook:function(name,f){
aion.hooks[name]=f;
}
}a.hooks={
//default hooks (also sets the object)
};
//Add a hook
a.hook('test',function(){
alert('test');
});
//Apply each Hook (can be done with... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Very simple answer:
```
function someFunction() { alert("Bar!") }
var placeholder=someFunction;
someFunction=function() {
alert("Foo?");
placeholder();
}
``` | The following function will give you before and after hooks that can be stacked. So if you have a number of potential functions that need to run before the given function or after the given function then this would be a working solution. This solution does not require jQuery and uses native array methods (no shims requ... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Might not be pretty but it seems to work...
```
<script>
function A(x) { alert(x); return x; }
function B() { alert(123); }
function addHook(functionB, functionA, parent)
{
if (typeof parent == 'undefined')
parent = window;
for (var i in parent)
{
if (parent[i] === functionA)
{
... | This answer is not definitive, but rather demonstrative of a different technique than those offered thus far. This leverages the fact that a function in Javascript is a first-class object, and as such, a) you can pass it as a value to another function and b) you can add properties to it. Combine these traits with funct... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Take a look at [jQuery's AOP plugin](http://plugins.jquery.com/project/AOP). In general, google "javascript aspect oriented programming". | Very simple answer:
```
function someFunction() { alert("Bar!") }
var placeholder=someFunction;
someFunction=function() {
alert("Foo?");
placeholder();
}
``` |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Might not be pretty but it seems to work...
```
<script>
function A(x) { alert(x); return x; }
function B() { alert(123); }
function addHook(functionB, functionA, parent)
{
if (typeof parent == 'undefined')
parent = window;
for (var i in parent)
{
if (parent[i] === functionA)
{
... | Here's what I did, might be useful in other applications like this:
```
//Setup a hooking object
a={
hook:function(name,f){
aion.hooks[name]=f;
}
}a.hooks={
//default hooks (also sets the object)
};
//Add a hook
a.hook('test',function(){
alert('test');
});
//Apply each Hook (can be done with... |
789,630 | EDIT: OK, I believe the following solutions are valid:
1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function sandwich and reassigns it to the old function name. This causes nesting of functions with each new added hook.
If jQuery is not usable for you, just pillage... | 2009/04/25 | [
"https://Stackoverflow.com/questions/789630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96039/"
] | Might not be pretty but it seems to work...
```
<script>
function A(x) { alert(x); return x; }
function B() { alert(123); }
function addHook(functionB, functionA, parent)
{
if (typeof parent == 'undefined')
parent = window;
for (var i in parent)
{
if (parent[i] === functionA)
{
... | Very simple answer:
```
function someFunction() { alert("Bar!") }
var placeholder=someFunction;
someFunction=function() {
alert("Foo?");
placeholder();
}
``` |
33,601,182 | I have an assignment to make this Restaurant Program. it Consists of an Order Class a product class and the main class. Order has an ArrayList to hold the products. I create an instance of the Order and then I add items through my main method.A product has a name(string) a bar-code(string), and a price(float).
Then I ... | 2015/11/09 | [
"https://Stackoverflow.com/questions/33601182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3976788/"
] | In your session.php you have to destroy the session because it might be set still but without that the query can find a existing user?
To unset sessions do this:
`unset();` for all the session variables `unset($_SESSION['login_user']);` for a specific session
Please put that before redirecting to index.php.
Otherwi... | instead of : **header('Location: index.php');**
try to do it with javascript :
**echo '< script> document.location.href="index.php"< /script>';** |
46,087,971 | i want adding and subtracting this type of data: $12,587.30.which returns answer in same format.how can do this ?
Here is my code example:
```
print(int(col_ammount2.lstrip('$'))-int(col_ammount.lstrip('$')))
```
I removed $ sign and convert it to int but it gives me base 10 error. | 2017/09/07 | [
"https://Stackoverflow.com/questions/46087971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8368131/"
] | You mentioned you want to do arithmetic operations to the numbers (addition/subtraction) so you probably want them in `float` instead. The difference between an integer (`int`) and `float` is that integers do not carry decimal points.
Additionally, as @officialaimm mentioned you need to remove the commas too, for exam... | There are two things you are missing here. Firstly python `int(...)` cannot parse numbers with commas so you will need to remove commas as well by using `.replace(',','')`. Secondly `int()` cannot parse floating point values you will have to use `float(...)` first and after that maybe typecast it to int using `int` or ... |
18,524,290 | Okay so I need to check if an ip\_adress is already in my database if it is i need to update row 'visit' and add 1. if it doesnt exit then add the ip\_adress to my database in row 'ip\_adress' here is my code:
```
<?php include'connect.php';
//Test if it is a shared client
if (!empty($_SERVER['HTTP_CLIENT_IP'])){
$ip=... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18524290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2658101/"
] | You can do it like this
```
SELECT MIN(user_id) user_id,
MIN(friend_id) friend_id
FROM Table1
GROUP BY LEAST(user_id, friend_id),
GREATEST(user_id, friend_id)
HAVING COUNT(*) = 1
```
Given sample data
```
| USER_ID | FRIEND_ID |
|---------|-----------|
| 1 | 2 |
| 2 | ... | You can do this with the `not exists` clause:
```
select f.B as A, f.A as B
from friends f
where not exists (select 1
from friends f2
where f2.A = f.B and f2.B = f.A
);
```
The `select` clause gives you the ones that are missing. Personally, I would just do `selec... |
18,815,691 | I have a form that I'm doing a few simple calculations on. I can't get the calculation to run after I unhide the elements. I have proven that the calculations work outside this form but I'm trying to add it to a form that uses other libraries. I just can't figure out what I need to do to get the calculation to bind to ... | 2013/09/15 | [
"https://Stackoverflow.com/questions/18815691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1043630/"
] | You need to bind events after DOM ready. If I understood it correctly you need to put your code in document.ready event. Try:
```
$(document).ready(function(){
//put your jquery code here
});
```
As you are already using jQuery use `.keyup` and `.on` to bind events on DOM elements like:
```
$("input.<YOUR_DOM_CLASS... | Try this.
```
$(document).ready(function(){
$("input[name=pottopot]").change(function(){
//call your method that does the calculation.
pottopot();
});
});
```
Try to define all your variable. Avoid any console error.
JavaScript will stop executing if there is an error in the page like, variable not defines etc.
... |
19,242,690 | **HTML Code:**
```
<ul id="menu-controls">
<li><a target="_self" onclick="return displaySubMenu(0);" id="menu-controls-0" href="" class=""><span>Home</span></a></li>
<li><a target="_self" onclick="return displaySubMenu(1);" id="menu-controls-1" href="" class=""><span>Oleg Test</span></a></li>
<li><a target="_self" onc... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19242690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2738734/"
] | You can use `.index()` to determine position of your `a.active` :
```
$("#menu-controls li a").click(function () {
var myActive = $("a.active").parent().index();
var myClicked = $(this).parent().index()
if (myActive < myClicked) {
alert("Previous active was left")
} else if (myActive > myClic... | Don't know if I've understood your question correctly but if I'm right, try this.. Give a generic class(for eg. "items") to each of the anchor tags.. Now in the displaySubMenu function use this->
```
var flag = 0;
var th = $(this);
$(th).parent().find('.items').each(function(){
$(this).removeClass('left');
$(thi... |
19,242,690 | **HTML Code:**
```
<ul id="menu-controls">
<li><a target="_self" onclick="return displaySubMenu(0);" id="menu-controls-0" href="" class=""><span>Home</span></a></li>
<li><a target="_self" onclick="return displaySubMenu(1);" id="menu-controls-1" href="" class=""><span>Oleg Test</span></a></li>
<li><a target="_self" onc... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19242690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2738734/"
] | You can use `.index()` to determine position of your `a.active` :
```
$("#menu-controls li a").click(function () {
var myActive = $("a.active").parent().index();
var myClicked = $(this).parent().index()
if (myActive < myClicked) {
alert("Previous active was left")
} else if (myActive > myClic... | Here a [FIDDLE](http://jsfiddle.net/cgd6w/) that log if the active element is before or after the clicked one.
Change on HTML : new param in the function 'this'
```
<ul id="menu-controls">
<li><a target="_self" onclick="return displaySubMenu(0, this);" id="menu-controls-0" href="" class=""><span>Home</span></a></li>
... |
7,753 | Before building up a new frame, it's crucially important to ream/face the headtube and crown race seat (and the bottom bracket, if using press-fit cups). You should also ideally chase the threads of the BB and the derailleur hanger.
But why don't manufacturers (e.g., [Surly](http://surlybikes.com/info_hole/spew/spew_c... | 2012/01/18 | [
"https://bicycles.stackexchange.com/questions/7753",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/1442/"
] | **First** thing that comes to my mind is labour costs.
**Second** thing that comes to mind is that once you break that paint seal by reaming/facing you are allowing contact with the air and elements. As a good practice you should coat the threads with a little grease before assembly, meaning that when you get that ne... | It is important to note that most manufacturer's of quality frames do face and ream their frames before they assemble or ship. They often do it before paint because they do it with machinery to build/assemble their frames, which allow a level of precision which wasn't possible with a locally produced hand built frame. ... |
6,766 | The title pretty much sums up my question: is it more beneficial to take a hot (warm) shower after a workout or a cold one?
I've noticed that I tend to feel more relaxed while taking a warmer shower and my muscles loosen up, but when you see professional athletes, they seem to quickly ice themselves down.
So I was ... | 2012/06/12 | [
"https://fitness.stackexchange.com/questions/6766",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/3654/"
] | As athletes after a substantial workout ice baths (54 degrees Fahrenheit / 12 degrees Celsius and below) is good for the body to halt the excessive blood flow which you have induced through stress training. This allows for faster recovery and allows the body to recharge the nervous system for the subsequent day; in an ... | Cold showers/icing help reduce swelling and inflammation.
I view it the same way as treating acute injuries: you ice the first 24-48 hrs, *then* heat.
OTOH, I dislike cold showers, so my view, and my actions, aren't always in alignment. |
6,766 | The title pretty much sums up my question: is it more beneficial to take a hot (warm) shower after a workout or a cold one?
I've noticed that I tend to feel more relaxed while taking a warmer shower and my muscles loosen up, but when you see professional athletes, they seem to quickly ice themselves down.
So I was ... | 2012/06/12 | [
"https://fitness.stackexchange.com/questions/6766",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/3654/"
] | Cold showers/icing help reduce swelling and inflammation.
I view it the same way as treating acute injuries: you ice the first 24-48 hrs, *then* heat.
OTOH, I dislike cold showers, so my view, and my actions, aren't always in alignment. | Just to add some research evidence to back up the two other answers:
A Cochrane systematic review: Leeder, Jonathan, Conor Gissane, Ken van Someren, Warren Gregson, and Glyn Howatson. "Cold water immersion and recovery from strenuous exercise: a meta-analysis." British journal of sports medicine (2011): bjsports-2011.... |
6,766 | The title pretty much sums up my question: is it more beneficial to take a hot (warm) shower after a workout or a cold one?
I've noticed that I tend to feel more relaxed while taking a warmer shower and my muscles loosen up, but when you see professional athletes, they seem to quickly ice themselves down.
So I was ... | 2012/06/12 | [
"https://fitness.stackexchange.com/questions/6766",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/3654/"
] | As athletes after a substantial workout ice baths (54 degrees Fahrenheit / 12 degrees Celsius and below) is good for the body to halt the excessive blood flow which you have induced through stress training. This allows for faster recovery and allows the body to recharge the nervous system for the subsequent day; in an ... | Just to add some research evidence to back up the two other answers:
A Cochrane systematic review: Leeder, Jonathan, Conor Gissane, Ken van Someren, Warren Gregson, and Glyn Howatson. "Cold water immersion and recovery from strenuous exercise: a meta-analysis." British journal of sports medicine (2011): bjsports-2011.... |
60,204,201 | I have 3 sections. Each section has their height. JSFiddle at the end of the question.
**GOAL**: I want an img (rocket picture) to follow the user as he scrolls and **change positions (slide) from right to left** when he scrolls pass a section.
I've managed to make the rocket follow me as I scroll down. Now I want th... | 2020/02/13 | [
"https://Stackoverflow.com/questions/60204201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7232826/"
] | Don't use raw types (look at the diamond operator at the end of the declaration) and favor constructor over setter when you can :
```
final List<Student> studentList = new ArrayList<>();
studentList.add(new Student(value));
```
If the list is designed to be immutable, with Java 9 it would be just :
```
final List<... | ```
List<Student> list = Stream.of(new Student("name"))
.collect(Collectors.toList());
```
The name of the student would be passed in constructor instead of a setter.
Or via `Arrays` **(exists since JDK 1.5)**
```
List<Student> list = Arrays.asList(new Student("name"));
```
`Arrays.asList()` method can take... |
344,906 | For one dimensional non-relativistic quantum mechanics, the solutions to $\hat H\psi=E\psi$ seems not requiring the energy $E\_n$ to contain the "$n$" term without specific boundary conditions.
Does the quantization come from that the wave function $\psi$ should vanish at infinity?
That is the boundary condition:
$$... | 2017/07/10 | [
"https://physics.stackexchange.com/questions/344906",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/158306/"
] | I have no idea what you mean by "requiring a common n term" but it is very convenenient to think of quantization as resulting from imposing boundary conditions to solutions of the Schrodinger equation. This perspective is often found in elementary texts that present quantization by analogy to the appearance of (discret... | You are correct that typically only bound states (corresponding to the boundary condition that your wrote down) have discrete energy levels.
But you used the term "compact support" the wrong way. "Compact support" doesn't mean the boundary condition that you wrote down; it means that the wavefunction is *identically* ... |
214,017 | I have an ASP.NET MVC 4 solution that I'm putting together, leveraging IoC and the repository pattern using Entity Framework 5. I have a new requirement to be able to pull data from a second database (from another internal application) which I don't have control over.
There is no API available unfortunately for the se... | 2013/10/10 | [
"https://softwareengineering.stackexchange.com/questions/214017",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104543/"
] | When talking to an external system you are building an integration. When you integrate with someone, this someone does not become part of your domain model.
As you mentioned, you have no control of that other database. If one day they change something in their tables, your whole application will become unusable and th... | I think at some point you are going to have to write two adapters. Interfaces are a great way to tie things together, but each model needs to access its own data.
I think you are on the rigjt path by seperating out the data access. If you have both models interact through an interface, adding more models in the futur... |
214,017 | I have an ASP.NET MVC 4 solution that I'm putting together, leveraging IoC and the repository pattern using Entity Framework 5. I have a new requirement to be able to pull data from a second database (from another internal application) which I don't have control over.
There is no API available unfortunately for the se... | 2013/10/10 | [
"https://softwareengineering.stackexchange.com/questions/214017",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104543/"
] | When talking to an external system you are building an integration. When you integrate with someone, this someone does not become part of your domain model.
As you mentioned, you have no control of that other database. If one day they change something in their tables, your whole application will become unusable and th... | Taking a step back from your actual question, you could be in for a whole world of pain if the rug is pulled from under you by the other project changing it's schema.
You acknowledge the other system does not have an API for you to use. I would push for this to be created.
The other project may not be be in an active... |
58,760,818 | I want to replace last 2 values of one of the column with zero. I understand for NaN values, I am able to use .fillna(0), but I would like to replace row 6 value of the last column as well.
```
Weight Name Age d_id_max
0 45 Sam 14 2
1 88 Andrea 25 1
2 56 Alex 55 1
3 15 Robin ... | 2019/11/08 | [
"https://Stackoverflow.com/questions/58760818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11079456/"
] | Before pandas 0.20.0 (long time) it was job for `ix`, but [now it is deprecated](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#ix-indexer-is-deprecated). So you can use:
[`DataFrame.iloc`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html) for get last rows an... | Try `.iloc` and `get_loc`
```
df.iloc[[-1,-2], df.columns.get_loc('d_id_max')] = 0
Out[232]:
Weight Name Age d_id_max
0 45 Sam 14 2.0
1 88 Andrea 25 1.0
2 56 Alex 55 1.0
3 15 Robin 8 3.0
4 71 Kia 21 3.0
5 44 Sia 43 ... |
58,760,818 | I want to replace last 2 values of one of the column with zero. I understand for NaN values, I am able to use .fillna(0), but I would like to replace row 6 value of the last column as well.
```
Weight Name Age d_id_max
0 45 Sam 14 2
1 88 Andrea 25 1
2 56 Alex 55 1
3 15 Robin ... | 2019/11/08 | [
"https://Stackoverflow.com/questions/58760818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11079456/"
] | Before pandas 0.20.0 (long time) it was job for `ix`, but [now it is deprecated](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#ix-indexer-is-deprecated). So you can use:
[`DataFrame.iloc`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html) for get last rows an... | You can use:
```
df['d_id_max'].iloc[-2:] = 0
Weight Name Age d_id_max
0 45 Sam 14 2.0
1 88 Andrea 25 1.0
2 56 Alex 55 1.0
3 15 Robin 8 3.0
4 71 Kia 21 3.0
5 44 Sia 43 2.0
6 54 Ryan 45 0.0
7 ... |
12,744,613 | I am new to web service. I have given a task to write a client code which will call a authentication web service which is exposed on https. I need to pass username and password from client code to check for valid user. I also have keystore and trustore file. I don't know how to use these files. Can anyone please guide ... | 2012/10/05 | [
"https://Stackoverflow.com/questions/12744613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357784/"
] | thats because you're sending JSON
standard php $\_POST is build from key-value pairs
so you should post key1=value1&key2=value2
or you should read from
```
$HTTP_RAW_POST_DATA
```
or
```
<?php $postdata = file_get_contents("php://input"); ?>
```
and use
```
json_decode( $postdata );
```
PHP will not automa... | Try sending url encoded name/value pairs. You can also use `EntityUtils` to convert the response to a `String` for you.
```
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(page);
HttpParams httpParams = client.getParams();
httpParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 20000);... |
12,744,613 | I am new to web service. I have given a task to write a client code which will call a authentication web service which is exposed on https. I need to pass username and password from client code to check for valid user. I also have keystore and trustore file. I don't know how to use these files. Can anyone please guide ... | 2012/10/05 | [
"https://Stackoverflow.com/questions/12744613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1357784/"
] | Problem solved. There was a htaccess file that redirected all non www pages. | Try sending url encoded name/value pairs. You can also use `EntityUtils` to convert the response to a `String` for you.
```
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(page);
HttpParams httpParams = client.getParams();
httpParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 20000);... |
63,037,501 | I have some data with the following features: `id, group, sex, datebirth, date1, date2, date3, ctrl1, ctrl2, ctrl3, ab4v1, ab4v2, ab4v3`.
What I want is to transform this dataframe onto another one with the following columns in long format: `id, group, sex, datebirth, version, date, ctrl, ab4`.
(NOTE: `version` will ... | 2020/07/22 | [
"https://Stackoverflow.com/questions/63037501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13976843/"
] | We need the change the order of `names_to`. We could either use `names_sep` or `names_pattern`. The only difference is that `names_sep` directs to a delimiter. Here the delimiter is the boundary between a letter (`(?<=[A-Za-z])`) and a digit (`(?=[0-9]$)`). Here, it means check for the boundary that succeeds a letter a... | The following is ugly but I believe it might work. It's a sequence of `pivot_longer` statements, taking care of one variable in wide format at a time.
```
library(dplyr)
library(tidyr)
fun <- function(X, Var){
Vard <- paste0(Var, "\\d")
X %>%
select(1:4, matches( {{ Vard }} )) %>%
pivot_longer(
cols... |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbage which I would usually want to redirect to /dev/null. Occasionally though one will prompt the user for something. (With the prompt having no reliable format.) So my idea was:
* In a loop:
+ Drain ch... | You would typically just write to the pipe, or use select or poll. If you need a handshake mechanism you can do that out of band various ways or come up with and in-band protocol.
I don't know if there is a built-in way to know if a reader on the other end is blocking. Why do you need to know this? |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I don't think that's true: For example, *right before* calling read() on the reader side, the pipe would have a reader that isn't actually reading. | If I recall correctly, you can not have a pipe with no reader which means that you have either a read(2) or a select(2) syscal pending at all time. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | That sounds as if you were trying to supervise dpkg where occasionally some post-inst script queries the admin whether it may override some config file.
Anyway, you may want to look at how strace works:
```
strace -f -etrace=read your.program
```
Of course you need to keep track of which fds are the pipes you write... | You would typically just write to the pipe, or use select or poll. If you need a handshake mechanism you can do that out of band various ways or come up with and in-band protocol.
I don't know if there is a built-in way to know if a reader on the other end is blocking. Why do you need to know this? |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | That sounds as if you were trying to supervise dpkg where occasionally some post-inst script queries the admin whether it may override some config file.
Anyway, you may want to look at how strace works:
```
strace -f -etrace=read your.program
```
Of course you need to keep track of which fds are the pipes you write... | If I recall correctly, you can not have a pipe with no reader which means that you have either a read(2) or a select(2) syscal pending at all time. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | That sounds as if you were trying to supervise dpkg where occasionally some post-inst script queries the admin whether it may override some config file.
Anyway, you may want to look at how strace works:
```
strace -f -etrace=read your.program
```
Of course you need to keep track of which fds are the pipes you write... | I don't think that's true: For example, *right before* calling read() on the reader side, the pipe would have a reader that isn't actually reading. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You would typically just write to the pipe, or use select or poll. If you need a handshake mechanism you can do that out of band various ways or come up with and in-band protocol.
I don't know if there is a built-in way to know if a reader on the other end is blocking. Why do you need to know this? | If I recall correctly, you can not have a pipe with no reader which means that you have either a read(2) or a select(2) syscal pending at all time. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have these options:
* if you know that the child will need certain input (such as shell that will read a command), just write to a pipe
* if you assume the child won't read anything usually, but may do it sometimes, you probably need something like job control in the shell (use a terminal for communication with th... | If I recall correctly, you can not have a pipe with no reader which means that you have either a read(2) or a select(2) syscal pending at all time. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have these options:
* if you know that the child will need certain input (such as shell that will read a command), just write to a pipe
* if you assume the child won't read anything usually, but may do it sometimes, you probably need something like job control in the shell (use a terminal for communication with th... | I don't think that's true: For example, *right before* calling read() on the reader side, the pipe would have a reader that isn't actually reading. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbage which I would usually want to redirect to /dev/null. Occasionally though one will prompt the user for something. (With the prompt having no reliable format.) So my idea was:
* In a loop:
+ Drain ch... | I don't think that's true: For example, *right before* calling read() on the reader side, the pipe would have a reader that isn't actually reading. |
450,106 | I'm trying to find out if a child process is waiting for user input (without parsing its output). Is it possible, in C on Unix, to determine if a pipe's read end currently has a read() call blocking?
The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbag... | 2009/01/16 | [
"https://Stackoverflow.com/questions/450106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The thing is, I have no control over the programs exec'd in the child processes. They print all kinds of verbose garbage which I would usually want to redirect to /dev/null. Occasionally though one will prompt the user for something. (With the prompt having no reliable format.) So my idea was:
* In a loop:
+ Drain ch... | If I recall correctly, you can not have a pipe with no reader which means that you have either a read(2) or a select(2) syscal pending at all time. |
9,121,854 | Is it possible to use an LdapConnection from System.DirectoryServices.Protocols to query Active Directory?
I'm having issues instantiating a PrincipalContext. Here's my code, in case anyone can spot the issue:
```
private LdapConnection getLdapConnection(string username, string password, string ldapServer, bool s... | 2012/02/02 | [
"https://Stackoverflow.com/questions/9121854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/366038/"
] | As far as I understant the container parameter can't be `null` when you target a domain. Can you just try this constructor :
```
PrincipalContext domainContextMonou = new PrincipalContext(ContextType.Domain,
"server.domain.com :389",
... | I suspect part of your problem with the LDAP code is that you're using `AuthType.Basic`. Try `Negotiate` instead. |
3,719,626 | Provide an example of an infinity of dense subsets of a space $(X,d)$ such that the intersection of all of them is not a dense subset.
I have tried taking $(\mathbb{Q}, d\_{usual})$ and as dense subsets the intervals $(0,1), (1,2), (2,3), ...$
But it seems to me that it does not work, since the lock of each one of th... | 2020/06/14 | [
"https://math.stackexchange.com/questions/3719626",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/700522/"
] | For every $x\in\mathbb{Q}$, take $A\_x=\mathbb{Q}-\{x\}$. | Take $X= (0,\infty)$ with the usual metric. For $p$ a prime, define $D\_p$ be the set of quotients $n/p^k,$ where $n\in \mathbb N$ and $p$ are relatively prime, and $k\in\mathbb N.$ Then each $D\_p$ is dense in $X$ and the collection $\{D\_p\}$ is pairwise disjoint. |
55,102,552 | I have this class:
```
public class FooFileRepo {
@Override
public File getDirectory(String directoryPath) {
...
File directory = new File(directoryPath);
...
return directory;
}
@Override
public void mkdirs(File f) {
...
f.getParentFile().mkdirs();
}
public void writeFile(String path, ... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55102552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/453712/"
] | As a note, you'll never get this to function as perfectly as you may think. There are utilities for cleaning up garbage and unloading assets but even if you follow all best practices, you still might not get Unity to clean up all the garbage (it does a lot in the background that'll retain allocated memory and there's n... | *Please consider the @Foggzie Answer too for some best practices (I used some of them)!*
There was two issue with my code or testing procedeure.
1. Don't Use WWW.LoadFromCacheOrDownload
----------------------------------------
Unity Built-in WWW.LoadFromCacheOrDownload is crap! Seriously! Why ? [Ben Vinson](https://... |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | You got it reversed. Do this: <http://www.sqlfiddle.com/#!2/09239/3>
```
SELECT Brand
FROM
(
-- Oracle can't make a row without a table, need to use DUAL dummy table
select 'FORD' as Brand from dual union
select 'HYUNDAI' from dual union
select 'TOYOTA' fom dual union
select 'BMW' from dual
... | You should use [Except](http://technet.microsoft.com/en-us/library/ms188055.aspx): EXCEPT returns any distinct values from the left query that are not also found on the right query.
```
WITH SomeRows(datacol) --It will look for missing stuff here
AS( SELECT *
FROM ( VALUES ('FORD'),
('TOYOTA'... |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | You should use [Except](http://technet.microsoft.com/en-us/library/ms188055.aspx): EXCEPT returns any distinct values from the left query that are not also found on the right query.
```
WITH SomeRows(datacol) --It will look for missing stuff here
AS( SELECT *
FROM ( VALUES ('FORD'),
('TOYOTA'... | Contributing Excel code to make the typing of the answer easier:
Say column A has the values (Ford, Hyundai,...).
In column B, put this in every cell:
```
select 'x' as brand from dual union
```
In column C, write this formula, and copy it down.
`=REPLACE(A2,9,1,A1)`
All of the `select`/`union` statements shoul... |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | You got it reversed. Do this: <http://www.sqlfiddle.com/#!2/09239/3>
```
SELECT Brand
FROM
(
-- Oracle can't make a row without a table, need to use DUAL dummy table
select 'FORD' as Brand from dual union
select 'HYUNDAI' from dual union
select 'TOYOTA' fom dual union
select 'BMW' from dual
... | You can do:
```
SELECT a.val
FROM
(
SELECT 'FORD' val UNION ALL
SELECT 'HYUNDAI' UNION ALL
SELECT 'TOYOTA' UNION ALL
SELECT 'BMW' UNION ALL
etc...
etc...
) a
LEFT JOIN account b ON a.val = b.name
WHERE b.name IS NULL
``` |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | You got it reversed. Do this: <http://www.sqlfiddle.com/#!2/09239/3>
```
SELECT Brand
FROM
(
-- Oracle can't make a row without a table, need to use DUAL dummy table
select 'FORD' as Brand from dual union
select 'HYUNDAI' from dual union
select 'TOYOTA' fom dual union
select 'BMW' from dual
... | This worked perfectly, thanks Michael.
```
SELECT Brand
FROM
( -- Oracle can't make a row without a table, need to use DUAL dummy table
select 'FORD' as Brand from dual union
select 'HYUNDAI' from dual union
select 'TOYOTA' fom dual union
select 'BMW' from dual
)
where Brand not in (select Br... |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | You got it reversed. Do this: <http://www.sqlfiddle.com/#!2/09239/3>
```
SELECT Brand
FROM
(
-- Oracle can't make a row without a table, need to use DUAL dummy table
select 'FORD' as Brand from dual union
select 'HYUNDAI' from dual union
select 'TOYOTA' fom dual union
select 'BMW' from dual
... | Contributing Excel code to make the typing of the answer easier:
Say column A has the values (Ford, Hyundai,...).
In column B, put this in every cell:
```
select 'x' as brand from dual union
```
In column C, write this formula, and copy it down.
`=REPLACE(A2,9,1,A1)`
All of the `select`/`union` statements shoul... |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | You can do:
```
SELECT a.val
FROM
(
SELECT 'FORD' val UNION ALL
SELECT 'HYUNDAI' UNION ALL
SELECT 'TOYOTA' UNION ALL
SELECT 'BMW' UNION ALL
etc...
etc...
) a
LEFT JOIN account b ON a.val = b.name
WHERE b.name IS NULL
``` | Contributing Excel code to make the typing of the answer easier:
Say column A has the values (Ford, Hyundai,...).
In column B, put this in every cell:
```
select 'x' as brand from dual union
```
In column C, write this formula, and copy it down.
`=REPLACE(A2,9,1,A1)`
All of the `select`/`union` statements shoul... |
11,464,543 | How can I find a missing values from a set of values, using SQL (Oracle DB)
e.g.
```
SELECT NAME
FROM ACCOUNT
WHERE ACCOUNT.NAME IN ('FORD','HYUNDAI','TOYOTA','BMW'...)
```
(The "IN" clause may contain hundreds of values)
If 'HYUNDAI' is missing in the ACCOUNT table, I need to get the result as "HYUNDAI".
Currently... | 2012/07/13 | [
"https://Stackoverflow.com/questions/11464543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1522572/"
] | This worked perfectly, thanks Michael.
```
SELECT Brand
FROM
( -- Oracle can't make a row without a table, need to use DUAL dummy table
select 'FORD' as Brand from dual union
select 'HYUNDAI' from dual union
select 'TOYOTA' fom dual union
select 'BMW' from dual
)
where Brand not in (select Br... | Contributing Excel code to make the typing of the answer easier:
Say column A has the values (Ford, Hyundai,...).
In column B, put this in every cell:
```
select 'x' as brand from dual union
```
In column C, write this formula, and copy it down.
`=REPLACE(A2,9,1,A1)`
All of the `select`/`union` statements shoul... |
8,591,802 | I've been struggling for a long time with basic controls that Windows Forms offers to developers, but... right now, I am developing an application that requires more advanced control than normal "TextBox".
Since, at this time, my application is about memory management, I have to show in the form, the process memory in... | 2011/12/21 | [
"https://Stackoverflow.com/questions/8591802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907489/"
] | Using pure batch you could do this:
```
:LOOP
yourprogram.exe
ping 127.0.0.1 -n 61 >NUL
goto :LOOP
```
This means you don't have to install any other programs or create more scripts. It might not be pretty but it works! I have pinged 61 times as pinging the loopback seems to create a delayed second. | Download [unixutils for win32](http://unxutils.sourceforge.net/). In here, you will find **sleep.exe**. Put it somewhere in your path. (frex, in c:\windows)
Then, you can build a batch file similar to this
```
echo off
:here
sleep 60s
echo Exec app
rem your app goes here
goto here
``` |
28,295,013 | I have a UIDate Picker embedded in a static TableViewCell and at the moment I disabled most of the code except the code responsible for the date picker.
*I'm using the Date Picker as a Count Down Timer*
So this is kind of all, except some usual outlets and vars:
```
override func viewDidLoad() {
super.viewDidLoa... | 2015/02/03 | [
"https://Stackoverflow.com/questions/28295013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4069967/"
] | I came up the following solution to initialize the datePicker component (in countdown timer mode) with 0 hours and 1 minute and it responds directly at the first spin. Since this appears to be a bug and is very frustrating if you want a textlabel to update its value when the datePicker is changed and it does not at the... | None of these solutions work, when you use the DatePicker as an inputView for a textfield.
I have attached my code below. I am still searching for a good solution for this, because none of the above fixes the problem in my scenario.
```
self.durationDatePicker.datePickerMode = .countDownTimer
self.durationDatePicker.... |
28,295,013 | I have a UIDate Picker embedded in a static TableViewCell and at the moment I disabled most of the code except the code responsible for the date picker.
*I'm using the Date Picker as a Count Down Timer*
So this is kind of all, except some usual outlets and vars:
```
override func viewDidLoad() {
super.viewDidLoa... | 2015/02/03 | [
"https://Stackoverflow.com/questions/28295013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4069967/"
] | I came up the following solution to initialize the datePicker component (in countdown timer mode) with 0 hours and 1 minute and it responds directly at the first spin. Since this appears to be a bug and is very frustrating if you want a textlabel to update its value when the datePicker is changed and it does not at the... | I don't know if I got your problem, but Date picker works using the target-action pattern and it triggers this mechanism when you change a value.
So if the problem is the very first value shown, you should initialize your variable taking it as the "default" value. |
28,295,013 | I have a UIDate Picker embedded in a static TableViewCell and at the moment I disabled most of the code except the code responsible for the date picker.
*I'm using the Date Picker as a Count Down Timer*
So this is kind of all, except some usual outlets and vars:
```
override func viewDidLoad() {
super.viewDidLoa... | 2015/02/03 | [
"https://Stackoverflow.com/questions/28295013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4069967/"
] | I came up the following solution to initialize the datePicker component (in countdown timer mode) with 0 hours and 1 minute and it responds directly at the first spin. Since this appears to be a bug and is very frustrating if you want a textlabel to update its value when the datePicker is changed and it does not at the... | Actually, all you need is to **not** set `datePicker.countDownDuration` in `viewDidLoad` but add it to `viewDidAppear`, or later. |
28,295,013 | I have a UIDate Picker embedded in a static TableViewCell and at the moment I disabled most of the code except the code responsible for the date picker.
*I'm using the Date Picker as a Count Down Timer*
So this is kind of all, except some usual outlets and vars:
```
override func viewDidLoad() {
super.viewDidLoa... | 2015/02/03 | [
"https://Stackoverflow.com/questions/28295013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4069967/"
] | Time ago I found another problem that somehow resembles this one. It was about presenting a view controller from within the `tableView:didSelectRowAtIndexPath:` and the problem was that it was taking lots of time for the new controller to actually show up. One of the workarounds turned out to be using `dispatch_async` ... | I don't know if I got your problem, but Date picker works using the target-action pattern and it triggers this mechanism when you change a value.
So if the problem is the very first value shown, you should initialize your variable taking it as the "default" value. |
28,295,013 | I have a UIDate Picker embedded in a static TableViewCell and at the moment I disabled most of the code except the code responsible for the date picker.
*I'm using the Date Picker as a Count Down Timer*
So this is kind of all, except some usual outlets and vars:
```
override func viewDidLoad() {
super.viewDidLoa... | 2015/02/03 | [
"https://Stackoverflow.com/questions/28295013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4069967/"
] | I came up the following solution to initialize the datePicker component (in countdown timer mode) with 0 hours and 1 minute and it responds directly at the first spin. Since this appears to be a bug and is very frustrating if you want a textlabel to update its value when the datePicker is changed and it does not at the... | I think you should try implement this delegate instead
```
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.