qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
15,862,863
I was wondering if anybody could help; I'm quite new to python. I'm currently creating a tool which analyses the text inputted by a user and shows which feedback to which list that phrase belongs to. So far the programme is on an infinite loop and counts how many expressions have been entered all together and then ho...
2013/04/07
[ "https://Stackoverflow.com/questions/15862863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2254554/" ]
You can do it in the following simple way. ``` s = input() # input() is a function that gets input from the user len(s.split()) # len() checks the length of a list, s.split() splits the users input into a word list. ``` Links: [input()](http://docs.python.org/3/library/functions.html#input) [len()](http://docs.pyth...
``` name = input () print len(name) ```
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
The C99 standard says this about modifying `argv` (and `argc`): > > The parameters argc and argv and the strings pointed to by the argv array shall be modifiable by the program, and retain their last-stored values between program startup and program termination. > > >
The original allocation of `argv` is left as a compiler/runtime choice. So it *may* not be safe to modify it willy-nilly. Many systems build it on the stack, so it is auto-deallocated when main returns. Other build it on the heap, and free it (or not) when main returns. It is safe to change the value of an argument, a...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
The latest draft of the C standard (N1256) states that there are two allowed forms of the `main` function: ``` int main (void); int main (int argc, char* argv[]); ``` but the crux is the clause "or in some other implementation-defined manner". This seems to me to be a loophole in the standard large enough to drive a...
The only time I would say that directly manipulating argv is a *bad* idea would be when an application changes its behavior depending on the contents of argv[0]. However, changing a program's behavior depending on argv[0] is in itself a very *bad* idea where portability is a concern. Other than that, you can treat it...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
Once argv has been passed into the main method, you can treat it like any other C array - change it in place as you like, just be aware of what you're doing with it. The contents of the array don't have an effect on the return code or execution of the program other than what you explicitly do with it in code. I can't t...
Some libraries do this! The initialization method provided by the glut opengl library [(GlutInit)](https://www.opengl.org/resources/libraries/glut/spec3/node10.html) scans for glut related arguments, and clears them by moving the subsequent elements in `argv` forward (moving the pointers, not the actual strings) and d...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
Empirically, functions such as GNU getopt() permute the argument list without causing problems. As @Tim says, as long as you play sensibly, you can manipulate the array of pointers, and even individual strings. Just don't overrun any of the implicit array boundaries.
The original allocation of `argv` is left as a compiler/runtime choice. So it *may* not be safe to modify it willy-nilly. Many systems build it on the stack, so it is auto-deallocated when main returns. Other build it on the heap, and free it (or not) when main returns. It is safe to change the value of an argument, a...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
The latest draft of the C standard (N1256) states that there are two allowed forms of the `main` function: ``` int main (void); int main (int argc, char* argv[]); ``` but the crux is the clause "or in some other implementation-defined manner". This seems to me to be a loophole in the standard large enough to drive a...
Empirically, functions such as GNU getopt() permute the argument list without causing problems. As @Tim says, as long as you play sensibly, you can manipulate the array of pointers, and even individual strings. Just don't overrun any of the implicit array boundaries.
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
Once argv has been passed into the main method, you can treat it like any other C array - change it in place as you like, just be aware of what you're doing with it. The contents of the array don't have an effect on the return code or execution of the program other than what you explicitly do with it in code. I can't t...
The latest draft of the C standard (N1256) states that there are two allowed forms of the `main` function: ``` int main (void); int main (int argc, char* argv[]); ``` but the crux is the clause "or in some other implementation-defined manner". This seems to me to be a loophole in the standard large enough to drive a...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
The latest draft of the C standard (N1256) states that there are two allowed forms of the `main` function: ``` int main (void); int main (int argc, char* argv[]); ``` but the crux is the clause "or in some other implementation-defined manner". This seems to me to be a loophole in the standard large enough to drive a...
The operating system push the argv and argc into the applicaton stack before executing it, and you can treat them like any other stack variables.
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
The latest draft of the C standard (N1256) states that there are two allowed forms of the `main` function: ``` int main (void); int main (int argc, char* argv[]); ``` but the crux is the clause "or in some other implementation-defined manner". This seems to me to be a loophole in the standard large enough to drive a...
Some libraries do this! The initialization method provided by the glut opengl library [(GlutInit)](https://www.opengl.org/resources/libraries/glut/spec3/node10.html) scans for glut related arguments, and clears them by moving the subsequent elements in `argv` forward (moving the pointers, not the actual strings) and d...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
Empirically, functions such as GNU getopt() permute the argument list without causing problems. As @Tim says, as long as you play sensibly, you can manipulate the array of pointers, and even individual strings. Just don't overrun any of the implicit array boundaries.
The only time I would say that directly manipulating argv is a *bad* idea would be when an application changes its behavior depending on the contents of argv[0]. However, changing a program's behavior depending on argv[0] is in itself a very *bad* idea where portability is a concern. Other than that, you can treat it...
963,493
My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to filter them in place but I am pretty sure that messing with argv array itself, or any of the data it points to, is probably not advisable. Any suggest...
2009/06/08
[ "https://Stackoverflow.com/questions/963493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66519/" ]
Some libraries do this! The initialization method provided by the glut opengl library [(GlutInit)](https://www.opengl.org/resources/libraries/glut/spec3/node10.html) scans for glut related arguments, and clears them by moving the subsequent elements in `argv` forward (moving the pointers, not the actual strings) and d...
The only time I would say that directly manipulating argv is a *bad* idea would be when an application changes its behavior depending on the contents of argv[0]. However, changing a program's behavior depending on argv[0] is in itself a very *bad* idea where portability is a concern. Other than that, you can treat it...
59,192,557
I'm looking for a way to get the border width of a Google Docs using the API? I have setup a test document that has two 1-cell tables. First one with default borders and the second one with 0-width borders and a third one with 3 pt border. <https://docs.google.com/document/d/1KOiw6bmsNhdOGGr9OZDWHNHrEID5RZncyCRRFFSU_...
2019/12/05
[ "https://Stackoverflow.com/questions/59192557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33236/" ]
From the [TableCellStyle documentation](https://developers.google.com/docs/api/reference/rest/v1/documents#tablecellstyle): > > Inherited table cell styles are represented as unset fields in this message. A table cell style can inherit from the table's style. > > > In this case, TableCellStyle inherits the defaul...
Starting with a new table the following applies in order. 1. Changing table border styles won't reflect in the API response. 2. Changes in individual cells, or all cells at once, will be reflected in the API response. 3. Once step 2 is performed, changes in table border style will now be reflected in the API response,...
59,192,557
I'm looking for a way to get the border width of a Google Docs using the API? I have setup a test document that has two 1-cell tables. First one with default borders and the second one with 0-width borders and a third one with 3 pt border. <https://docs.google.com/document/d/1KOiw6bmsNhdOGGr9OZDWHNHrEID5RZncyCRRFFSU_...
2019/12/05
[ "https://Stackoverflow.com/questions/59192557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33236/" ]
From the [TableCellStyle documentation](https://developers.google.com/docs/api/reference/rest/v1/documents#tablecellstyle): > > Inherited table cell styles are represented as unset fields in this message. A table cell style can inherit from the table's style. > > > In this case, TableCellStyle inherits the defaul...
Clearly, there is a bug in the google Document API. I found a bug report: (<https://issuetracker.google.com/186012454>) I produced a [document](https://docs.google.com/document/d/11AEkqC7RxMTqV4sAT4KDVTsHcierakHWdrCbMPi8jtA): there I increased the width and the color of the table borders. The TableCellStyle element o...
59,192,557
I'm looking for a way to get the border width of a Google Docs using the API? I have setup a test document that has two 1-cell tables. First one with default borders and the second one with 0-width borders and a third one with 3 pt border. <https://docs.google.com/document/d/1KOiw6bmsNhdOGGr9OZDWHNHrEID5RZncyCRRFFSU_...
2019/12/05
[ "https://Stackoverflow.com/questions/59192557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33236/" ]
Clearly, there is a bug in the google Document API. I found a bug report: (<https://issuetracker.google.com/186012454>) I produced a [document](https://docs.google.com/document/d/11AEkqC7RxMTqV4sAT4KDVTsHcierakHWdrCbMPi8jtA): there I increased the width and the color of the table borders. The TableCellStyle element o...
Starting with a new table the following applies in order. 1. Changing table border styles won't reflect in the API response. 2. Changes in individual cells, or all cells at once, will be reflected in the API response. 3. Once step 2 is performed, changes in table border style will now be reflected in the API response,...
19,090,276
Supposedly a trivial task to server 403/404/500 error pages when using django-cms. Followed instructions on an old forum post to create this: ``` from cms.views import details def custom_404(request): response = details(request, 'page-not-found') response.status_code = 404 return response ... ``` Urls.p...
2013/09/30
[ "https://Stackoverflow.com/questions/19090276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1711722/" ]
After walking into countless walls over-thinking the issues, I just went with using the basic 403/404/500 handlers: ``` from django.utils.functional import curry from django.views.defaults import * handler500 = curry(server_error, template_name='500.html') handler404 = curry(page_not_found, template_name='404.html') h...
Here is a working (with DEBUG at True or False) 404 handler: ``` def handler404(request): if hasattr(request, '_current_page_cache'): delattr(request, '_current_page_cache') response = details(request, '404') response.status_code = 404 return response ```
19,090,276
Supposedly a trivial task to server 403/404/500 error pages when using django-cms. Followed instructions on an old forum post to create this: ``` from cms.views import details def custom_404(request): response = details(request, 'page-not-found') response.status_code = 404 return response ... ``` Urls.p...
2013/09/30
[ "https://Stackoverflow.com/questions/19090276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1711722/" ]
After walking into countless walls over-thinking the issues, I just went with using the basic 403/404/500 handlers: ``` from django.utils.functional import curry from django.views.defaults import * handler500 = curry(server_error, template_name='500.html') handler404 = curry(page_not_found, template_name='404.html') h...
**EDIT / Easy solution** After more searching and thinking, an easier solution would be to create the default/standard 404.html, and therein use django-cms static placeholders...as easy as it gets! **Original (still working) Answer** After struggling updating my handler404 from an old cms project, and not finding an...
19,090,276
Supposedly a trivial task to server 403/404/500 error pages when using django-cms. Followed instructions on an old forum post to create this: ``` from cms.views import details def custom_404(request): response = details(request, 'page-not-found') response.status_code = 404 return response ... ``` Urls.p...
2013/09/30
[ "https://Stackoverflow.com/questions/19090276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1711722/" ]
Here is a working (with DEBUG at True or False) 404 handler: ``` def handler404(request): if hasattr(request, '_current_page_cache'): delattr(request, '_current_page_cache') response = details(request, '404') response.status_code = 404 return response ```
**EDIT / Easy solution** After more searching and thinking, an easier solution would be to create the default/standard 404.html, and therein use django-cms static placeholders...as easy as it gets! **Original (still working) Answer** After struggling updating my handler404 from an old cms project, and not finding an...
9,477
A profile (clay soil) was excavated to a depth of 100 cm in the north of Tunisia. We have found limestone nodules, colluvium and alluvium. What I would like to know is the nature of the bedrock of this soil. Can we assert that there is a limestone bedrock?
2017/01/18
[ "https://earthscience.stackexchange.com/questions/9477", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/7315/" ]
There are three possible sources for the reported limestone nodules from the clay horizon from colluvium and alluvium. First, as noted before, they could be either detrital gravel of limestone either eroded from limestone bedrock. Given that the bedrock source from which this gravel was eroded and transported from coul...
I can offer a counter-example. What if your soil sample is taken from the site of some lost ancient Roman buildings? The Romans built plenty in northern Tunisia, and like using [travertine limestone](http://tigerprints.clemson.edu/cgi/viewcontent.cgi?article=1909&context=all_theses). A few long-destroyed buildings woul...
255,107
Is Drupal is ready for [GDPR compliance](http://www.eugdpr.org)? Is there any patch or extension they need to apply for GDPR ready for all EU countries as this is the law for EU countries the come in effect on may 25, 2018.
2018/02/04
[ "https://drupal.stackexchange.com/questions/255107", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/82898/" ]
I don't think Drupal is "ready" for the [General Data Protection Regulation (GDPR)](http://www.eugdpr.org), at least not yet. However, help seems to be on its way ... go checkout what the [General Data Protection Regulation](https://www.drupal.org/project/gdpr) module *will be* (repeat: *will be*) about. From its proj...
Drupal is not ready and even if the Drupal project on GDPR is finished it is not enough to comply with GDPR. Every Organization has to do their due dilligence on that. Time is running out.
255,107
Is Drupal is ready for [GDPR compliance](http://www.eugdpr.org)? Is there any patch or extension they need to apply for GDPR ready for all EU countries as this is the law for EU countries the come in effect on may 25, 2018.
2018/02/04
[ "https://drupal.stackexchange.com/questions/255107", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/82898/" ]
I'm one of the maintainers of the [GDPR](https://www.drupal.org/project/gdpr) module. First of all I'd like to call your attention to the fact that GDPR is not an IT-related question solely. Personally I'd suggest stop considering *"adding an extension to my CMS will make me legally good"*. That's not that easy. You, ...
Drupal is not ready and even if the Drupal project on GDPR is finished it is not enough to comply with GDPR. Every Organization has to do their due dilligence on that. Time is running out.
24,101,549
I'm currently writing a short Python script to walk through some directories on a server, find what I'm looking for and save the data to an XML file. The problem is that some of the data is written in other languages such as "ハローワールド" or something of similar format. When trying to save this in an entry in my XML I get...
2014/06/07
[ "https://Stackoverflow.com/questions/24101549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1932559/" ]
you may use codecs library of python, and .decode('utf-8') to solve it. ``` import sys,codecs reload(sys) sys.setdefaultencoding("utf-8") ```
By default python will encode unicode into ASCII. As only 128 characters is supported in ASCII, it gonna raise exception value more than 128. So the solution is to encode your unicode into extended format such as latin1 or UTF8 or other ISO charset. I would suggest to encode in utf-8. The syntax would be: ``` u"Your u...
6,881,835
I am using this code for uploading image. I have given write permission to the folder where image will be stored. Following is my code: ``` Dim con As New System.Data.SqlClient.SqlConnection("Data Source=Biplob-PC\SQLEXPRESS; database =a;Integrated Security=True") Dim smemberid As Integer Dim photoid As Integ...
2011/07/30
[ "https://Stackoverflow.com/questions/6881835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/870440/" ]
You'll need to do it yourself, including the controls. You might use the transparent controls here: <http://brandonwalkin.com/bwtoolkit/>
This type of window is also seen in Quicktime Player, but according to these: <http://lists.apple.com/archives/cocoa-dev/2011/May/msg00257.html> <http://lists.apple.com/archives/cocoa-dev/2011/May/msg00259.html> it isn't available as option.
71,802,001
pandas throws err when i try to get max of a string column that has `np.nan`, since `np.nan` is `float` type and can't be compared to `str`. Any suggest how to handle this? ``` df = pd.DataFrame({'letters':['a', 'b', np.nan]}) df # letters # 0 a # 1 b # 2 NaN for e in df['letters']: print(e, type(e)) # a <clas...
2022/04/08
[ "https://Stackoverflow.com/questions/71802001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3939696/" ]
This is an issue as you use the default, `float` NaN. This works fine with the new [`pd.NA`](https://pandas.pydata.org/docs/user_guide/missing_data.html#experimental-na-scalar-to-denote-missing-values) type, which you can obtain using [`convert_dtypes`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.con...
Perhaps you could drop them first: ``` out = df['letters'].dropna().max() ``` If you need to find the max of multiple columns, then you could `stack` them; then use `groupby` + `max`: ``` out = df.stack().groupby(level=1).max() ``` Output: ``` 'b' ```
3,610,195
I am reading a proof from my professor (proof of convergence of Secant Method in Numerical Analysis), and she makes use of Taylor series. We have a function $f \in C^2(a, b)$, and a point $z \in (a, b)$. She writes $$f(z+h) = f(z) + f'(z)h + \dfrac {f''(z)}{2}h^2 + O(h^3).$$ However, I don't understand how we get thi...
2020/04/05
[ "https://math.stackexchange.com/questions/3610195", "https://math.stackexchange.com", "https://math.stackexchange.com/users/64460/" ]
I am not too sure what the problem actually is. I guess that it is about proving that $0=0^2$, $1=1^2$, ..., $k^2$ are distinct modulo $p$ if $k$ is the greatest integer less than $\frac12p$. So let $0\leq r<s<\frac12p$ two integers and assume that $r^2\equiv s^2\bmod p$. This happens exactly when $p\mid s^2-r^2$. B...
The problem is poorly stated but is probably asking you to show that no two members of $R$ are congruent modulo $p$. I suggest a proof by contradiction: suppose that $0\le r<s<\frac{p}2$ and $r^2\equiv s^2\pmod p$, and try to get a contradiction. Recall that the assumption that $r^2\equiv s^2\pmod p$ just means that $p...
48,544,175
I'm trying to select dates bigger than in javascript function. My function return empty array and I don't know wher I'm doing mistake ``` var arr = ["2018-01-24T17:43:03.000Z","2018-01-25T17:43:03.000Z","2018-01- 26T17:43:03.000Z","2018-01-27T17:43:03.000Z"] var biggerThanElements = arr.filter(x=>{ x = new Date(x); ...
2018/01/31
[ "https://Stackoverflow.com/questions/48544175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5383306/" ]
You could just compare directly with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) dates/time strings. ```js var arr = ["2018-01-24T17:43:03.000Z", "2018-01-25T17:43:03.000Z", "2018-01-26T17:43:03.000Z", "2018-01-27T17:43:03.000Z"], biggerThanElements = arr.filter(x => x > "2018-01-23T00:00:00.000Z"); cons...
You missed your return statement for change to `return x > element` ```js var arr = ["2018-01-24T17:43:03.000Z","2018-01-25T17:43:03.000Z","2018-01-26T17:43:03.000Z","2018-01-27T17:43:03.000Z"] var biggerThanElements = arr.filter(x=>{ x = new Date(x); element = new Date("2018-01-23T00:00:00.000Z"); return x...
48,544,175
I'm trying to select dates bigger than in javascript function. My function return empty array and I don't know wher I'm doing mistake ``` var arr = ["2018-01-24T17:43:03.000Z","2018-01-25T17:43:03.000Z","2018-01- 26T17:43:03.000Z","2018-01-27T17:43:03.000Z"] var biggerThanElements = arr.filter(x=>{ x = new Date(x); ...
2018/01/31
[ "https://Stackoverflow.com/questions/48544175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5383306/" ]
You missed your return statement for change to `return x > element` ```js var arr = ["2018-01-24T17:43:03.000Z","2018-01-25T17:43:03.000Z","2018-01-26T17:43:03.000Z","2018-01-27T17:43:03.000Z"] var biggerThanElements = arr.filter(x=>{ x = new Date(x); element = new Date("2018-01-23T00:00:00.000Z"); return x...
There are a few issues in your code: 1. You need to return the result `return x > element`. 2. You use the date `2018-01-23` and all your dates are "bigger". 3. It is highly recommended to declare all your variables (i.e. `element`). Try this: ```js var arr = ["2018-01-24T17:43:03.000Z", "2018-01-25T17:43:03.000Z", ...
48,544,175
I'm trying to select dates bigger than in javascript function. My function return empty array and I don't know wher I'm doing mistake ``` var arr = ["2018-01-24T17:43:03.000Z","2018-01-25T17:43:03.000Z","2018-01- 26T17:43:03.000Z","2018-01-27T17:43:03.000Z"] var biggerThanElements = arr.filter(x=>{ x = new Date(x); ...
2018/01/31
[ "https://Stackoverflow.com/questions/48544175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5383306/" ]
You could just compare directly with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) dates/time strings. ```js var arr = ["2018-01-24T17:43:03.000Z", "2018-01-25T17:43:03.000Z", "2018-01-26T17:43:03.000Z", "2018-01-27T17:43:03.000Z"], biggerThanElements = arr.filter(x => x > "2018-01-23T00:00:00.000Z"); cons...
There are a few issues in your code: 1. You need to return the result `return x > element`. 2. You use the date `2018-01-23` and all your dates are "bigger". 3. It is highly recommended to declare all your variables (i.e. `element`). Try this: ```js var arr = ["2018-01-24T17:43:03.000Z", "2018-01-25T17:43:03.000Z", ...
45,503,750
I have an Azure web application and need help with enforcing https. <https://www.example.com> to <https://example.com> <http://www.example.com> to <https://example.com> www.example.com to <https://example.com> example.com to <https://example.com> The current **web.config** is as below. This does not work for <http...
2017/08/04
[ "https://Stackoverflow.com/questions/45503750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3322160/" ]
According to your url rewrite rules, I assumed that there is no problem with your rules. Though I do not configure the custom domain, I just test it on my azure web app which just contains some static html files and the web.config file, then I force it redirect from `bruce-webapp.azurewebsites.net` to `https://azureweb...
You can do this with two separate rules. Set the below configuration in your web.config file. ``` <rewrite> <rules> <rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true"> <match url="(.*)" ignoreCase="false" /> <conditions> <add input="{HTTPS}" pat...
5,523,970
In color schemes, I would like to sort the hues, but would like to avoid 'big gaps', i.e. prefer `350,354,2,10,15` over `2,10,15,350,354` (when expressed as 0-360 degree values). What's the best approach of doing that (eg in php)? Is it finding the 'biggest gap' and start after that? Any better ideas?
2011/04/02
[ "https://Stackoverflow.com/questions/5523970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381636/" ]
Unless you specifically want to check only the very first superclass, it would be better to use: ``` return (action instanceof logic.UserBehavior); ``` Your method would be better with this: ``` action.getClass().getSuperClass().name().equals("logic.UserBehavior"); ``` The call to `toString()` is not the best ide...
`(action instanceof logic.UserBehaviour)` will return true if action is an object of a type that extends UserBehavior. An excerpt from <http://download.oracle.com/javase/tutorial/java/nutsandbolts/op2.html> > > The Type Comparison Operator > instanceof > > > The instanceof operator compares an > object to a spec...
5,523,970
In color schemes, I would like to sort the hues, but would like to avoid 'big gaps', i.e. prefer `350,354,2,10,15` over `2,10,15,350,354` (when expressed as 0-360 degree values). What's the best approach of doing that (eg in php)? Is it finding the 'biggest gap' and start after that? Any better ideas?
2011/04/02
[ "https://Stackoverflow.com/questions/5523970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381636/" ]
`(action instanceof logic.UserBehaviour)` will return true if action is an object of a type that extends UserBehavior. An excerpt from <http://download.oracle.com/javase/tutorial/java/nutsandbolts/op2.html> > > The Type Comparison Operator > instanceof > > > The instanceof operator compares an > object to a spec...
If you want to check only the very first superclass: ``` return action.getClass().getSuperclass() == logic.UserBehavior.class; ``` Otherwise: ``` return (action instanceof logic.UserBehaviour); ```
5,523,970
In color schemes, I would like to sort the hues, but would like to avoid 'big gaps', i.e. prefer `350,354,2,10,15` over `2,10,15,350,354` (when expressed as 0-360 degree values). What's the best approach of doing that (eg in php)? Is it finding the 'biggest gap' and start after that? Any better ideas?
2011/04/02
[ "https://Stackoverflow.com/questions/5523970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381636/" ]
Unless you specifically want to check only the very first superclass, it would be better to use: ``` return (action instanceof logic.UserBehavior); ``` Your method would be better with this: ``` action.getClass().getSuperClass().name().equals("logic.UserBehavior"); ``` The call to `toString()` is not the best ide...
If you want to check only the very first superclass: ``` return action.getClass().getSuperclass() == logic.UserBehavior.class; ``` Otherwise: ``` return (action instanceof logic.UserBehaviour); ```
26,943,143
I'm writing a toy os to learn the workings of it, here I came into a little problem. I want to do a long jump, just as follows: ``` ljmp $0x9000, *(%ax) ``` The section address is 0x9000, the offset address is stored in the register `ax` (currently I'm still under real mode), I've tried the following, none of them w...
2014/11/15
[ "https://Stackoverflow.com/questions/26943143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1031769/" ]
From perldoc: > > As another special case, split emulates the default behavior of the > command line tool awk when the PATTERN is either omitted or a literal > string composed of a single space character (such as ' ' or "\x20" , > but not e.g. / / ). In this case, any leading whitespace in EXPR is > removed befor...
If `$comparator` begins with spaces, the first element of the result of `split /\s+/, $comparator` will be an empty string. However, I can't explain why there are 5000 times. Would you give a more realistic code snippet? There're some obvious errors in the codes. (To increase the counters, we should use `$hash{$compar...
7,210,313
What I have: ------------ I'm using [node.js](http://nodejs.org/) with the [express framework](https://github.com/visionmedia/express) and I'm building a form where I can upload files, I'm using [node-formidable](https://github.com/felixge/node-formidable) for this. What's the problem ------------------ My problem i...
2011/08/26
[ "https://Stackoverflow.com/questions/7210313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380562/" ]
The correct way for doing this is: ``` request.pause(); response.status = 400; response.end('something went wrong...'); ``` Source: <https://groups.google.com/forum/?fromgroups=#!topic/nodejs/2gIsWPj43lI>
Try with following code: 1. When your server side validation fails, give a response like: `res.json({'IsFileUploaded':'false', 'requiredFileSize': '1000bytes', 'actualFileSize': '800bytes', 'AlertMsg':'File size should be at least 1000 bytes....'})` It closes connection as well as you can pass your data in JSON for...
42,453,583
Good day. Help needed please. Language used is python. The code below reads from a text file and then returns frequency of each word each on a new line. I got it from this site <https://rmtheis.wordpress.com/2012/09/26/count-word-frequency-with-python/> ``` import re from collections import Counter def openfile(filen...
2017/02/25
[ "https://Stackoverflow.com/questions/42453583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3761841/" ]
In cases like this it is most of the time a wrong training set. I would recommend you to take a look at the actual images and labels you feed into the network. Additionally look at the actual colorbar of the images. This means seeing how their values are distributed. This often leads to the solution. Anyways, if you ar...
why are the labels for 104 : `[10 10 1 10 4]` ? I believe it should be `[10 10 1 0 4]`, no? In my opinion : either you have a problem with the input data (the preparation might be wrong), or you have an architecture not suitable for this problem. It is training, you can see on the notebook there is a change of loss b...
42,453,583
Good day. Help needed please. Language used is python. The code below reads from a text file and then returns frequency of each word each on a new line. I got it from this site <https://rmtheis.wordpress.com/2012/09/26/count-word-frequency-with-python/> ``` import re from collections import Counter def openfile(filen...
2017/02/25
[ "https://Stackoverflow.com/questions/42453583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3761841/" ]
As my comment above, I'd suggest to avoid training a model to predict 5 digits combination. It would be far more efficient to train the model to predict a single number. I tried to build quick example based on Keras example [cifar10\_cnn.py](https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py) on [MNI...
In cases like this it is most of the time a wrong training set. I would recommend you to take a look at the actual images and labels you feed into the network. Additionally look at the actual colorbar of the images. This means seeing how their values are distributed. This often leads to the solution. Anyways, if you ar...
42,453,583
Good day. Help needed please. Language used is python. The code below reads from a text file and then returns frequency of each word each on a new line. I got it from this site <https://rmtheis.wordpress.com/2012/09/26/count-word-frequency-with-python/> ``` import re from collections import Counter def openfile(filen...
2017/02/25
[ "https://Stackoverflow.com/questions/42453583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3761841/" ]
As my comment above, I'd suggest to avoid training a model to predict 5 digits combination. It would be far more efficient to train the model to predict a single number. I tried to build quick example based on Keras example [cifar10\_cnn.py](https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py) on [MNI...
why are the labels for 104 : `[10 10 1 10 4]` ? I believe it should be `[10 10 1 0 4]`, no? In my opinion : either you have a problem with the input data (the preparation might be wrong), or you have an architecture not suitable for this problem. It is training, you can see on the notebook there is a change of loss b...
17,423
This is a basic question, but I cannot find the answer to it. In short, equilibria are often conditioned on a specific strategy. E.g., given A's strategy, B updates her beliefs to xyz. My problem is that often an action could be a part of the equilibrium path for many different strategies, so how does B know which stra...
2017/07/07
[ "https://economics.stackexchange.com/questions/17423", "https://economics.stackexchange.com", "https://economics.stackexchange.com/users/13861/" ]
Step 1, as it were, would be to write down the expenditure function (4x+y). Next, think about what happens if income is $0; the optimal choices of x and y are easy, as only (0,0) can be consumed. Then ask "what happens as income increases?" and you're off to the races!
The way I would attack this is to solve the utility function $u(x,y)=xy$ subject to the budget constraint: $4x+y=m$. This is using Lagrange method It turns out that $x=m/8$ and $y=m/2$. The Engel curve show the relationship between income and the quantity of the good demanded, so substitute values for $m$ and find the...
13,253,964
I use MVC 3 in C#, I have a class with this Attribute ``` [DisplayFormat(DataFormatString = "{0:dd MMM yyyy}", ApplyFormatInEditMode = true)] ``` I would like to enforce Validation when a User is in `EDIT MODE` Data in database is stored with type `datetime` formatted like this ``` 6/15/2009 1:45:30 PM ``` I ...
2012/11/06
[ "https://Stackoverflow.com/questions/13253964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379008/" ]
The `DisplayFormat` attribute is literally only for displaying the value. If you set the `ApplyFormatInEditMode` all it will do is also apply the format to the contents of your data when displayed in a textbox (intended for Editing). It's got nothing to do with validation. If you want to validate the input using the f...
`0:dd MMM yyyy` is going to expect a string like `06 JUN 2009` instead of `6/15/2009`. How are you entering the string when getting the `String Not in Correct Format` error?
296,109
Civilize, 2015 states that > > Specifically, these studies examine the effect of political cycles on > stock returns or the differences in stock returns under **left- or > right-wing governments** > > > I did search and see that Generally, the left-wing is characterized by an emphasis on "ideas such as freedom, e...
2021/08/27
[ "https://ell.stackexchange.com/questions/296109", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/132319/" ]
* 'Left-wing' and 'right-wing' refer to styles of *politics*. * Democracies, autocracies etc are types of *government*. The difference is important. Although politics and government are closely linked, they are not synonyms. Wikipedia gives this broad explanation of the difference between left and right wing politics...
No. This is a language site and not a political site, so I don't want to get into discussions of politics. But briefly, in 21st century political debate, "left-wing" is basically synonymous with "liberal" and "right-wing" with "conservative". People often say that liberals accept or favor change while conservatives w...
59,476,324
I'm getting a new Fastlane error after the command below the line: ``` bundle exec fastlane beta --verbose ``` And here is the error: `Could not receive the latest API key from App Store Connect, this might be a server issue`. I couldn't find any solution yet. Best
2019/12/25
[ "https://Stackoverflow.com/questions/59476324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4145420/" ]
Solution ======== Use the command below to recreate session for Fastlane: ``` fastlane spaceauth ``` it'll send **2 Factor authentication** code to your registered device. Then you'll get the message: ``` Successfully logged in to App Store Connect ``` then it'll request you to: ``` pass the following via the *...
Try to use the same command with `sudo`.
59,476,324
I'm getting a new Fastlane error after the command below the line: ``` bundle exec fastlane beta --verbose ``` And here is the error: `Could not receive the latest API key from App Store Connect, this might be a server issue`. I couldn't find any solution yet. Best
2019/12/25
[ "https://Stackoverflow.com/questions/59476324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4145420/" ]
Solution ======== Use the command below to recreate session for Fastlane: ``` fastlane spaceauth ``` it'll send **2 Factor authentication** code to your registered device. Then you'll get the message: ``` Successfully logged in to App Store Connect ``` then it'll request you to: ``` pass the following via the *...
I got this issue when the AppStore console was under scheduled maintenance, no workaround required, check if you're able to access the AppStore console and if not then you probably have to wait
59,476,324
I'm getting a new Fastlane error after the command below the line: ``` bundle exec fastlane beta --verbose ``` And here is the error: `Could not receive the latest API key from App Store Connect, this might be a server issue`. I couldn't find any solution yet. Best
2019/12/25
[ "https://Stackoverflow.com/questions/59476324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4145420/" ]
Solution ======== Use the command below to recreate session for Fastlane: ``` fastlane spaceauth ``` it'll send **2 Factor authentication** code to your registered device. Then you'll get the message: ``` Successfully logged in to App Store Connect ``` then it'll request you to: ``` pass the following via the *...
Using "App Store Connect API" is over `spaceauth`. Fastlane support App Store Connect API, and it has some benefits. <https://docs.fastlane.tools/app-store-connect-api/> You can create "App Store Connect API Key" in App Store Connect, and use it like below: ``` lane :release do api_key = app_store_connect_api_key(...
59,476,324
I'm getting a new Fastlane error after the command below the line: ``` bundle exec fastlane beta --verbose ``` And here is the error: `Could not receive the latest API key from App Store Connect, this might be a server issue`. I couldn't find any solution yet. Best
2019/12/25
[ "https://Stackoverflow.com/questions/59476324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4145420/" ]
Using "App Store Connect API" is over `spaceauth`. Fastlane support App Store Connect API, and it has some benefits. <https://docs.fastlane.tools/app-store-connect-api/> You can create "App Store Connect API Key" in App Store Connect, and use it like below: ``` lane :release do api_key = app_store_connect_api_key(...
Try to use the same command with `sudo`.
59,476,324
I'm getting a new Fastlane error after the command below the line: ``` bundle exec fastlane beta --verbose ``` And here is the error: `Could not receive the latest API key from App Store Connect, this might be a server issue`. I couldn't find any solution yet. Best
2019/12/25
[ "https://Stackoverflow.com/questions/59476324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4145420/" ]
Using "App Store Connect API" is over `spaceauth`. Fastlane support App Store Connect API, and it has some benefits. <https://docs.fastlane.tools/app-store-connect-api/> You can create "App Store Connect API Key" in App Store Connect, and use it like below: ``` lane :release do api_key = app_store_connect_api_key(...
I got this issue when the AppStore console was under scheduled maintenance, no workaround required, check if you're able to access the AppStore console and if not then you probably have to wait
21,174,931
I've gotten a whole bunch of angularJS, rest and entity stuff working together to be able to save form data via REST in my POSTGRES DB. However, I decided to try something different with one of the entity fields so that I can store longer bits of text in the DB. I wanted to use an Entity with a field as follows: ``` ...
2014/01/16
[ "https://Stackoverflow.com/questions/21174931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2035405/" ]
This should do it: ``` @user.posts.joins(:likes).count ```
``` Post.joins(:likes).where("likes.user_id = ?", user.id).count ```
21,174,931
I've gotten a whole bunch of angularJS, rest and entity stuff working together to be able to save form data via REST in my POSTGRES DB. However, I decided to try something different with one of the entity fields so that I can store longer bits of text in the DB. I wanted to use an Entity with a field as follows: ``` ...
2014/01/16
[ "https://Stackoverflow.com/questions/21174931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2035405/" ]
This should do it: ``` @user.posts.joins(:likes).count ```
In addition to the low-level answers, the high level answer is... ``` User.has_many :posts Post.has_many :likes User.has_many :likes, through: :posts ``` That way, a mere `@user.likes.count` will add up a single user's entire fan club. The low-level answers are good to know, and illustrate useful techniques. This a...
13,768,606
I have a problem that when c++ evaluates the while statement, it also evaluates the underlying if statement even if the while statement condition is not met. ite\_candidats is a custom iterator on a binary map tree. When there is no more nodes to visit, ite\_candidat evaluates to NULL. So the while ends. But, I get a ...
2012/12/07
[ "https://Stackoverflow.com/questions/13768606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114113/" ]
It is impossible. If it evaluates `if` then it enters into `while`. No ahead computation is `C++`. P.S. Why do you have two negations in `while`?
rough guess: ite\_candidats is incremented in the code. probably the end iterator is not evaluating to 0.
13,768,606
I have a problem that when c++ evaluates the while statement, it also evaluates the underlying if statement even if the while statement condition is not met. ite\_candidats is a custom iterator on a binary map tree. When there is no more nodes to visit, ite\_candidat evaluates to NULL. So the while ends. But, I get a ...
2012/12/07
[ "https://Stackoverflow.com/questions/13768606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114113/" ]
It is impossible. If it evaluates `if` then it enters into `while`. No ahead computation is `C++`. P.S. Why do you have two negations in `while`?
> > ite\_candidats is a custom iterator on a binary map tree. When there is no more nodes to visit, ite\_candidat evaluates to NULL. > > > Does it really evaluate to NULL? That's a bit dubious since you are using the dot operator rather than the dereference operator in `ite_candidats.clecourante()`. From the code ...
850,540
I am still moving some local accounts to domain accounts and today I am having issues with Outlook 2010. I have a local username with all the Outlook information in it. So I've exported all the information I wanted to a PST file saved in C: Then, in the domain username I went to Outlook and tried to import from *File...
2017/05/16
[ "https://serverfault.com/questions/850540", "https://serverfault.com", "https://serverfault.com/users/415693/" ]
Move the file to another location, such as D:\, then try again. I ever encountered similar issues when loading file from root system drive C:\, moving it to another drive fixed the issue.
“**Access denied**” error can happen if you have switched from logging on to your computer with a local account to a Microsoft account while the PST file was in use. **To fix it right-click the PST file,** **Choose Properties** >> **Security** >> **Edit** >> **choose your Microsoft account**, and **select Full cont...
18,172,297
Essentially, I have a numpy image array and I'm trying to find if it contains a 2x2 block of particular RGB pixel values. So, for example, if my (simplified) image array was something like: ``` A B C D E F G H I J K L M N O P Q R S T U V W X ``` I am trying to check if it contains, say: ``` J K P Q ``` I'm pr...
2013/08/11
[ "https://Stackoverflow.com/questions/18172297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2672297/" ]
How about this solution: 1) Identify all the locations of the upper-right left-hand element of the small array in the big array. 2) Check if the slice of the big array that corresponds to a every given element is exactly the same as the small array. Say if the upper left-hand corner element of the slice is 5, we wou...
You can efficiently do it using `np.in1d` using the flattened arrays of the main array, say `a` and the sub-array, say `b`. Suppose the example: ``` a = np.random.random((100,50)) i=4 j=8 m=12 n=16 b = a[i:j,m:n] ``` And adding some repeated incomplete patterns: ``` a[0,:3] = b[0,:3] a[4,40:44] = b[0,:] a[4,44:48]...
25,271,261
The problem I'm having is very similar to the post here: ["Global element 'configuration' has already been declared" in web config](https://stackoverflow.com/questions/20228392/global-element-configuration-has-already-been-declared-in-web-config) The solution for it is unclear to me though. When I open my web.config ...
2014/08/12
[ "https://Stackoverflow.com/questions/25271261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3629730/" ]
Open XML->Schemas... to get the current XML schema set. You probably have one or more duplicated or overlapping schema files selected. (e.g. DotNetConfig.xsd and DotNetConfig45.xsd). You only want one of them so make the other set to automatic under the "Use" column.
It is weird but for me this issue got fixed once I closed the file in the editor that was causing these warnings and recompiled.
13,600,012
i want to do processing for different file simultaneously in batch file the command i use is > > for %%f in (AXUD\*,DSET\*,APEC\*) do teqc +qc %%f > > > But from my observation, the program process one by one file, AXUD first, then after finish it process DSET file how can i make it process all 3 file simultaneo...
2012/11/28
[ "https://Stackoverflow.com/questions/13600012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1856740/" ]
Django only serves static files if DEBUG=True **and** it is running the development server. [Documentation](https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-in-development): > > This view is automatically enabled and will serve your static files at STATIC\_URL when you use the built-in ...
Using dbieber's [Django template for appfog](https://github.com/dbieber/django-appfog-helloworld) this is the approach that worked for me: 1. Create a directory for static files in your project directory, then set up a URL to have the appfog server serve these files: ``` cd <project> mkdir static ``` 2. In urls.py, ...
5,653,471
This appears to be undefined behavior ``` union A { int const x; float y; }; A a = { 0 }; a.y = 1; ``` The spec says > > Creating a new object at the storage location that a const object with static, thread, or automatic storage duration occupies or, at the storage location that such a const object used to oc...
2011/04/13
[ "https://Stackoverflow.com/questions/5653471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34509/" ]
The latest C++0x draft standard is explicit about this: > > In a union, at most one of the non-static data members can be active at any > time, that is, the value of at most one of the non-static data members can > be stored in a union at any time. > > > So your statement ``` a.y = 1; ``` is fine, because it...
If it's any consolation - the Microsoft Xbox 360 compiler (which is based on Visual Studio's compiler) does error out. Which is funny, because that's usually the most lenient of the bunch. ``` error C2220: warning treated as error - no 'object' file generated warning C4510: 'A' : default constructor could not be gener...
5,653,471
This appears to be undefined behavior ``` union A { int const x; float y; }; A a = { 0 }; a.y = 1; ``` The spec says > > Creating a new object at the storage location that a const object with static, thread, or automatic storage duration occupies or, at the storage location that such a const object used to oc...
2011/04/13
[ "https://Stackoverflow.com/questions/5653471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34509/" ]
It doesn't really make sense to have a `const` member of a `union`, and I'm surprised that the standard allows it. The purpose of all of the many limitations on what can go into a `union` is to arrive at a point where bitwise assignment will be a valid assignment operator for all members, and you can't use bitwise assi...
If it's any consolation - the Microsoft Xbox 360 compiler (which is based on Visual Studio's compiler) does error out. Which is funny, because that's usually the most lenient of the bunch. ``` error C2220: warning treated as error - no 'object' file generated warning C4510: 'A' : default constructor could not be gener...
5,653,471
This appears to be undefined behavior ``` union A { int const x; float y; }; A a = { 0 }; a.y = 1; ``` The spec says > > Creating a new object at the storage location that a const object with static, thread, or automatic storage duration occupies or, at the storage location that such a const object used to oc...
2011/04/13
[ "https://Stackoverflow.com/questions/5653471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34509/" ]
The latest C++0x draft standard is explicit about this: > > In a union, at most one of the non-static data members can be active at any > time, that is, the value of at most one of the non-static data members can > be stored in a union at any time. > > > So your statement ``` a.y = 1; ``` is fine, because it...
It doesn't really make sense to have a `const` member of a `union`, and I'm surprised that the standard allows it. The purpose of all of the many limitations on what can go into a `union` is to arrive at a point where bitwise assignment will be a valid assignment operator for all members, and you can't use bitwise assi...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
The answer to your question comes down to threat modeling. Using cryptographic protocols like HTTPS is a security mechanism to protect against certain threats. If those threats are relevant for you, must be analyzed: * **Are there potential threat actors in your internal network?** Based on your question you seem to a...
As a professional, you owe advises to your client, but should not take the decision yourself. The arguments to present to your client are: * what is the gain in using HTTPS inside the server network? If this network is isolated from any other system and only sysadmins can access it, you may argue the the gain can be ...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
Internal networks are not secure -------------------------------- In general, internal networks are more secure than public-facing systems, but they should not be considered as completely secure. A significant portion of attacks come from the inside - spearphishing, social engineering and insider attacks are all popul...
"https" not only secures the communications as it passes over the network, but also verifies the *certificate* that is presented by the server. This enables you to know that you really are talking to the correct site. And this, in my opinion, is the real advantage of "https." "letsencrypt.org," which issues signed cer...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
The answer to your question comes down to threat modeling. Using cryptographic protocols like HTTPS is a security mechanism to protect against certain threats. If those threats are relevant for you, must be analyzed: * **Are there potential threat actors in your internal network?** Based on your question you seem to a...
Internal networks are not secure -------------------------------- In general, internal networks are more secure than public-facing systems, but they should not be considered as completely secure. A significant portion of attacks come from the inside - spearphishing, social engineering and insider attacks are all popul...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
Mixing and matching HTTP and HTTPS is not a good idea - you will constantly be juggling configurations. Usually adding a component into a system should only be done if there is a very specific reason for it - just because someone thought it a good idea is not a specific reason. I'm not saying that HTTPS is a bad idea...
Encryption is cheap. Data leak or data loss are not. Use encryption between servers (and it is even better to use TLS auth between servers). And when I say cheap, it is cheap even considering the management of the keys and the certificates. It may be reasonable to issue a self-signed and long-lived certs to both serv...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
The answer to your question comes down to threat modeling. Using cryptographic protocols like HTTPS is a security mechanism to protect against certain threats. If those threats are relevant for you, must be analyzed: * **Are there potential threat actors in your internal network?** Based on your question you seem to a...
"https" not only secures the communications as it passes over the network, but also verifies the *certificate* that is presented by the server. This enables you to know that you really are talking to the correct site. And this, in my opinion, is the real advantage of "https." "letsencrypt.org," which issues signed cer...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
As a professional, you owe advises to your client, but should not take the decision yourself. The arguments to present to your client are: * what is the gain in using HTTPS inside the server network? If this network is isolated from any other system and only sysadmins can access it, you may argue the the gain can be ...
Encryption is cheap. Data leak or data loss are not. Use encryption between servers (and it is even better to use TLS auth between servers). And when I say cheap, it is cheap even considering the management of the keys and the certificates. It may be reasonable to issue a self-signed and long-lived certs to both serv...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
Mixing and matching HTTP and HTTPS is not a good idea - you will constantly be juggling configurations. Usually adding a component into a system should only be done if there is a very specific reason for it - just because someone thought it a good idea is not a specific reason. I'm not saying that HTTPS is a bad idea...
"https" not only secures the communications as it passes over the network, but also verifies the *certificate* that is presented by the server. This enables you to know that you really are talking to the correct site. And this, in my opinion, is the real advantage of "https." "letsencrypt.org," which issues signed cer...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
The answer to your question comes down to threat modeling. Using cryptographic protocols like HTTPS is a security mechanism to protect against certain threats. If those threats are relevant for you, must be analyzed: * **Are there potential threat actors in your internal network?** Based on your question you seem to a...
Mixing and matching HTTP and HTTPS is not a good idea - you will constantly be juggling configurations. Usually adding a component into a system should only be done if there is a very specific reason for it - just because someone thought it a good idea is not a specific reason. I'm not saying that HTTPS is a bad idea...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
Internal networks are not secure -------------------------------- In general, internal networks are more secure than public-facing systems, but they should not be considered as completely secure. A significant portion of attacks come from the inside - spearphishing, social engineering and insider attacks are all popul...
Encryption is cheap. Data leak or data loss are not. Use encryption between servers (and it is even better to use TLS auth between servers). And when I say cheap, it is cheap even considering the management of the keys and the certificates. It may be reasonable to issue a self-signed and long-lived certs to both serv...
227,020
I am building web applications for my customer's company. At the server side, there will be 2 kinds of server to server network communication. 1. Separated REST API servers making requests among each other. 2. Communication from application load balancers (AWS ALB specifically) to their auto-scaling EC2 instances. Cu...
2020/03/08
[ "https://security.stackexchange.com/questions/227020", "https://security.stackexchange.com", "https://security.stackexchange.com/users/228635/" ]
As a professional, you owe advises to your client, but should not take the decision yourself. The arguments to present to your client are: * what is the gain in using HTTPS inside the server network? If this network is isolated from any other system and only sysadmins can access it, you may argue the the gain can be ...
"https" not only secures the communications as it passes over the network, but also verifies the *certificate* that is presented by the server. This enables you to know that you really are talking to the correct site. And this, in my opinion, is the real advantage of "https." "letsencrypt.org," which issues signed cer...
53,202,525
This is my code: ``` public void playSound(String uri,int flag) { Uri uri1=Uri.parse(uri); ContestVoteFragment fragment = (ContestVoteFragment) fragments.get(0); if (fragment.playSound(flag)) { if (mediaPlayer==null) { mediaPlayer=new MediaPla...
2018/11/08
[ "https://Stackoverflow.com/questions/53202525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10528320/" ]
In your example it is impossible to find the discount for a value such as ***9.999***... it is greater than 9.99 and less than 10 and does not fit inside any of your ranges. I would start by changing your data to: ``` | From | To | Discount | |------|------|----------| | 0 | 10 | 0.05 | | 10 | 20 | 0.10...
We can try using `BETWEEN` here: ``` SELECT MAX(IIF(price BETWEEN FROM$ AND TO$, Discount, NULL)) AS Discount FROM yourTable; ``` We might more typically expect that your table of discounts would store information for multiple groups, e.g. products. In that case, we could write: ``` SELECT product, MAX(...
53,202,525
This is my code: ``` public void playSound(String uri,int flag) { Uri uri1=Uri.parse(uri); ContestVoteFragment fragment = (ContestVoteFragment) fragments.get(0); if (fragment.playSound(flag)) { if (mediaPlayer==null) { mediaPlayer=new MediaPla...
2018/11/08
[ "https://Stackoverflow.com/questions/53202525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10528320/" ]
Assuming you have no gaps in the ranges, I find that in many databases the most efficient method is: ``` select t.*, (select top 1 d.discount from discounts d where t.[$] <= d.[from$] -- the $ is for whatever column name you actually use order by d.[from$] desc ) as discount from...
We can try using `BETWEEN` here: ``` SELECT MAX(IIF(price BETWEEN FROM$ AND TO$, Discount, NULL)) AS Discount FROM yourTable; ``` We might more typically expect that your table of discounts would store information for multiple groups, e.g. products. In that case, we could write: ``` SELECT product, MAX(...
53,202,525
This is my code: ``` public void playSound(String uri,int flag) { Uri uri1=Uri.parse(uri); ContestVoteFragment fragment = (ContestVoteFragment) fragments.get(0); if (fragment.playSound(flag)) { if (mediaPlayer==null) { mediaPlayer=new MediaPla...
2018/11/08
[ "https://Stackoverflow.com/questions/53202525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10528320/" ]
In your example it is impossible to find the discount for a value such as ***9.999***... it is greater than 9.99 and less than 10 and does not fit inside any of your ranges. I would start by changing your data to: ``` | From | To | Discount | |------|------|----------| | 0 | 10 | 0.05 | | 10 | 20 | 0.10...
Assuming you have no gaps in the ranges, I find that in many databases the most efficient method is: ``` select t.*, (select top 1 d.discount from discounts d where t.[$] <= d.[from$] -- the $ is for whatever column name you actually use order by d.[from$] desc ) as discount from...
37,199,332
I have a corpus of a few 100-thousand legal documents (mostly from the European Union) – laws, commentary, court documents etc. I am trying to algorithmically make some sense of them. I have modeled the known relationships (temporal, this-changes-that, etc). But on the single-document level, I wish I had better tools ...
2016/05/13
[ "https://Stackoverflow.com/questions/37199332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4494/" ]
I see you have an interesting usecase. You've also mentioned the presence of a corpus(which a really good plus). Let me relate a solution that I had sketched for extracting the crux from research papers. To make sense out of documents, you need triggers to tell(or train) the computer to look for these "triggers". You...
Don't use triggers. What you need is a word sense disambiguation and domain adaptation. You want to make sense of is in the documents i.e understand the semantics to figure out the meaning. You can build a legal ontology of terms in skos or json-ld format represent it ontologically in a knowledge graph and use it with ...
37,199,332
I have a corpus of a few 100-thousand legal documents (mostly from the European Union) – laws, commentary, court documents etc. I am trying to algorithmically make some sense of them. I have modeled the known relationships (temporal, this-changes-that, etc). But on the single-document level, I wish I had better tools ...
2016/05/13
[ "https://Stackoverflow.com/questions/37199332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4494/" ]
In order to make sense out of documents you need to perform some sort of semantic analysis. You have two main possibilities with their exemples: Use Frame Semantics: <http://www.cs.cmu.edu/~ark/SEMAFOR/> Use Semantic Role Labeling (SRL): <http://cogcomp.org/page/demo_view/srl> Once you are able to extract informatio...
I see you have an interesting usecase. You've also mentioned the presence of a corpus(which a really good plus). Let me relate a solution that I had sketched for extracting the crux from research papers. To make sense out of documents, you need triggers to tell(or train) the computer to look for these "triggers". You...
37,199,332
I have a corpus of a few 100-thousand legal documents (mostly from the European Union) – laws, commentary, court documents etc. I am trying to algorithmically make some sense of them. I have modeled the known relationships (temporal, this-changes-that, etc). But on the single-document level, I wish I had better tools ...
2016/05/13
[ "https://Stackoverflow.com/questions/37199332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4494/" ]
In order to make sense out of documents you need to perform some sort of semantic analysis. You have two main possibilities with their exemples: Use Frame Semantics: <http://www.cs.cmu.edu/~ark/SEMAFOR/> Use Semantic Role Labeling (SRL): <http://cogcomp.org/page/demo_view/srl> Once you are able to extract informatio...
Don't use triggers. What you need is a word sense disambiguation and domain adaptation. You want to make sense of is in the documents i.e understand the semantics to figure out the meaning. You can build a legal ontology of terms in skos or json-ld format represent it ontologically in a knowledge graph and use it with ...
28,124,263
I get this error when I try running my app in the simulator. The error is: > > An error was encountered while running (Domain = LaunchServicesError, Code = 0) > > > I tried changing the name of the app and this happened. Furthermore, I tried cleaning the product and it didn't do anything, still having the same er...
2015/01/24
[ "https://Stackoverflow.com/questions/28124263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3553801/" ]
Do it twice, ``` for (int pageNum = 0; pageNum <= 20; pageNum++) { //templateFiles is list of files in that directory string expectedTemplateName1 = string.Format("{0}_{1}.txt", directoryName, pageNum.ToString()); string expectedTemplateName2 = string.Format("{0}_{1}.txt", directoryName, pageNum.ToStrin...
something like this: ``` var re = new Regex("_[\\d]."); var resultedFiles = templateFiles.Where(x => re.IsMatch(x)); ```
28,124,263
I get this error when I try running my app in the simulator. The error is: > > An error was encountered while running (Domain = LaunchServicesError, Code = 0) > > > I tried changing the name of the app and this happened. Furthermore, I tried cleaning the product and it didn't do anything, still having the same er...
2015/01/24
[ "https://Stackoverflow.com/questions/28124263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3553801/" ]
Do it twice, ``` for (int pageNum = 0; pageNum <= 20; pageNum++) { //templateFiles is list of files in that directory string expectedTemplateName1 = string.Format("{0}_{1}.txt", directoryName, pageNum.ToString()); string expectedTemplateName2 = string.Format("{0}_{1}.txt", directoryName, pageNum.ToStrin...
Regular expressions are probably not the best tool in this case, which is why I would just go with @kennyzx's straight forward approach. If you desperately want to use a regex, you could go with the following; But be aware that this is >800% slower than the direct string comparison - and not necessarily easier to under...
28,124,263
I get this error when I try running my app in the simulator. The error is: > > An error was encountered while running (Domain = LaunchServicesError, Code = 0) > > > I tried changing the name of the app and this happened. Furthermore, I tried cleaning the product and it didn't do anything, still having the same er...
2015/01/24
[ "https://Stackoverflow.com/questions/28124263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3553801/" ]
Regular expressions are probably not the best tool in this case, which is why I would just go with @kennyzx's straight forward approach. If you desperately want to use a regex, you could go with the following; But be aware that this is >800% slower than the direct string comparison - and not necessarily easier to under...
something like this: ``` var re = new Regex("_[\\d]."); var resultedFiles = templateFiles.Where(x => re.IsMatch(x)); ```
27,366,479
This code: ``` for root, dirs, files in os.walk('.'): print(root) ``` Gives me this error: ``` UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 27: surrogates not allowed ``` How do I walk through a file tree without getting toxic strings like this?
2014/12/08
[ "https://Stackoverflow.com/questions/27366479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131881/" ]
On Linux, filenames are 'just a bunch of bytes', and are not necessarily encoded in a particular encoding. Python 3 tries to turn everything into Unicode strings. In doing so the developers came up with a scheme to translate byte strings to Unicode strings and back without loss, and without knowing the original encodin...
I ended up passing in a byte string to `os.walk()` which will apparently return byte strings instead of incorrect unicode strings ``` for root, dirs, files in os.walk(b'.'): print(root) ```
27,366,479
This code: ``` for root, dirs, files in os.walk('.'): print(root) ``` Gives me this error: ``` UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 27: surrogates not allowed ``` How do I walk through a file tree without getting toxic strings like this?
2014/12/08
[ "https://Stackoverflow.com/questions/27366479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131881/" ]
On Linux, filenames are 'just a bunch of bytes', and are not necessarily encoded in a particular encoding. Python 3 tries to turn everything into Unicode strings. In doing so the developers came up with a scheme to translate byte strings to Unicode strings and back without loss, and without knowing the original encodin...
Filter with `sed` or `grep`: ``` set | sed -n '/^[a-zA-Z0-9_]*=/p' # ... or ... set | grep '^[a-zA-Z0-9_]*=' # ... or ... set | egrep '^[_[:alnum:]]+=' ``` This is sensitive to how crazy your variable names are. The last version should handle most crazy things.
27,366,479
This code: ``` for root, dirs, files in os.walk('.'): print(root) ``` Gives me this error: ``` UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 27: surrogates not allowed ``` How do I walk through a file tree without getting toxic strings like this?
2014/12/08
[ "https://Stackoverflow.com/questions/27366479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131881/" ]
On Linux, filenames are 'just a bunch of bytes', and are not necessarily encoded in a particular encoding. Python 3 tries to turn everything into Unicode strings. In doing so the developers came up with a scheme to translate byte strings to Unicode strings and back without loss, and without knowing the original encodin...
Try using this line of code: ``` "bad string".encode('utf-8', 'replace').decode() ```
27,366,479
This code: ``` for root, dirs, files in os.walk('.'): print(root) ``` Gives me this error: ``` UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 27: surrogates not allowed ``` How do I walk through a file tree without getting toxic strings like this?
2014/12/08
[ "https://Stackoverflow.com/questions/27366479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131881/" ]
I ended up passing in a byte string to `os.walk()` which will apparently return byte strings instead of incorrect unicode strings ``` for root, dirs, files in os.walk(b'.'): print(root) ```
Filter with `sed` or `grep`: ``` set | sed -n '/^[a-zA-Z0-9_]*=/p' # ... or ... set | grep '^[a-zA-Z0-9_]*=' # ... or ... set | egrep '^[_[:alnum:]]+=' ``` This is sensitive to how crazy your variable names are. The last version should handle most crazy things.
27,366,479
This code: ``` for root, dirs, files in os.walk('.'): print(root) ``` Gives me this error: ``` UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 27: surrogates not allowed ``` How do I walk through a file tree without getting toxic strings like this?
2014/12/08
[ "https://Stackoverflow.com/questions/27366479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131881/" ]
Try using this line of code: ``` "bad string".encode('utf-8', 'replace').decode() ```
Filter with `sed` or `grep`: ``` set | sed -n '/^[a-zA-Z0-9_]*=/p' # ... or ... set | grep '^[a-zA-Z0-9_]*=' # ... or ... set | egrep '^[_[:alnum:]]+=' ``` This is sensitive to how crazy your variable names are. The last version should handle most crazy things.
8,604,457
I want to refresh the same page and display the entered value in text box on the same page after clicking the link or button. I have the following code: ``` <?php echo '<h3>Fee Payment</h3>'; echo "<form id='myFormId' name='myFormName'>"; echo " <input type='text' name='myTextField'>"; echo "<a href='{$_SERVER...
2011/12/22
[ "https://Stackoverflow.com/questions/8604457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111768/" ]
``` <?php echo '<h3>Fee Payment</h3>'; if(isset($_POST['myTextField'])) $value=$_POST['myTextField']; else $value=''; echo "<form id='myFormId' name='myFormName' method='post'>"; echo " <input type='text' name='myTextField' value='$value'>"; echo "<a href='{$_SERVER['PHP_SELF']}?student_no=myTextField'> Search Stu...
1. You're using a link to submit the form, but you should be using a submit button. `<input type="submit" value="Search student" />` 2. You didn't close the `<form>` tag. 3. You're using `$_GET[student_no]` which will make PHP look for a definition of `student_no`. Since it's a string, express it as one. `$_GET['studen...
8,604,457
I want to refresh the same page and display the entered value in text box on the same page after clicking the link or button. I have the following code: ``` <?php echo '<h3>Fee Payment</h3>'; echo "<form id='myFormId' name='myFormName'>"; echo " <input type='text' name='myTextField'>"; echo "<a href='{$_SERVER...
2011/12/22
[ "https://Stackoverflow.com/questions/8604457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111768/" ]
What you want is AJAX. I am just providing you an example of how you can proceed by using [jQuery](http://jquery.com/), but you can use any other library / framework or any other way also. You can check [this article](http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/) al...
1. You're using a link to submit the form, but you should be using a submit button. `<input type="submit" value="Search student" />` 2. You didn't close the `<form>` tag. 3. You're using `$_GET[student_no]` which will make PHP look for a definition of `student_no`. Since it's a string, express it as one. `$_GET['studen...
8,604,457
I want to refresh the same page and display the entered value in text box on the same page after clicking the link or button. I have the following code: ``` <?php echo '<h3>Fee Payment</h3>'; echo "<form id='myFormId' name='myFormName'>"; echo " <input type='text' name='myTextField'>"; echo "<a href='{$_SERVER...
2011/12/22
[ "https://Stackoverflow.com/questions/8604457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111768/" ]
``` <?php echo '<h3>Fee Payment</h3>'; if(isset($_POST['myTextField'])) $value=$_POST['myTextField']; else $value=''; echo "<form id='myFormId' name='myFormName' method='post'>"; echo " <input type='text' name='myTextField' value='$value'>"; echo "<a href='{$_SERVER['PHP_SELF']}?student_no=myTextField'> Search Stu...
Why can't you submit the form? Do you want to have a link for searching instead of a button? You could configure the link to submit the form via javascript and change the form action to GET like this: ``` <?php echo '<h3>Fee Payment</h3>'; echo "<form id='myFormId' name='myFormName' action='{$_SERVER['PHP_SELF'...
8,604,457
I want to refresh the same page and display the entered value in text box on the same page after clicking the link or button. I have the following code: ``` <?php echo '<h3>Fee Payment</h3>'; echo "<form id='myFormId' name='myFormName'>"; echo " <input type='text' name='myTextField'>"; echo "<a href='{$_SERVER...
2011/12/22
[ "https://Stackoverflow.com/questions/8604457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111768/" ]
What you want is AJAX. I am just providing you an example of how you can proceed by using [jQuery](http://jquery.com/), but you can use any other library / framework or any other way also. You can check [this article](http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/) al...
Why can't you submit the form? Do you want to have a link for searching instead of a button? You could configure the link to submit the form via javascript and change the form action to GET like this: ``` <?php echo '<h3>Fee Payment</h3>'; echo "<form id='myFormId' name='myFormName' action='{$_SERVER['PHP_SELF'...
62,658,014
I passed personal information in js file using views.py. So, In the js file, I added the Django template for loop to iterate the personal information and pass the javascript function. but it's not working for me. I am new in this concept. **View file** ``` def sample(request): p=[] p.append({name:santhosh, ag...
2020/06/30
[ "https://Stackoverflow.com/questions/62658014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9614586/" ]
Your Django template is constructed in server site and javascript is a client side language. So in simple term You **can't** send Django template variable to javascript function. however there is a workaround. You can add your Django variable value as attribute. like for example ``` <span id='elId' userName="{{p.name...
Do the follwing, notice in the template the use of single quotes while passing function variable. **In Template** ``` <a href="#" class="some_class" onclick="someFunction('{{ row.item_id }}');">Do Something</a> ``` **In Jquery** ``` function someFunction(item_id) { alert(item_id) } ```
26,661,041
When I compile my Arduino sketch(language C), I get the error: ``` sketch_oct30b:2: error: ‘e’ was not declared in this scope sketch_oct30b:2: error: ‘z’ was not declared in this scope ``` This is the piece of code, `char z` is in the first line of the whole code. ``` char z[4] = "z_0"; int e = 0; char delta(e, z)...
2014/10/30
[ "https://Stackoverflow.com/questions/26661041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4191763/" ]
Ok, so apparently the issue was not with the prop/attr toggling "checked", but rather the property updating when viewing the browser's developer tools. When I inspect the checkbox, the checked property ALWAYS stays "checked", however the following code works to determine if the checkbox is actually checked or not (@War...
Use jQuery [.prop()](http://api.jquery.com/prop/) instead of [.attr()](http://api.jquery.com/attr/) Set the `.prop("checked", true)`. This is one of the greatest benefits of `.prop()` over `.attr()` since `.prop()` can set values that are non-strings. Here's a working example on how to use it: ```js setInterval(func...
39,432,232
Here is my code for my "Share" button: ``` ShareButton = UIButton(frame: CGRect(x: 0, y:0, width: view.frame.size.width / 3, height: 60)) ShareButton.center = CGPointMake(CGRectGetMidX(self.frame), 3*CGRectGetHeight(self.frame)/4) ShareButton.setTitle("Share", forState: UIControlState.Normal) ShareButton.setTitleCo...
2016/09/11
[ "https://Stackoverflow.com/questions/39432232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The first rule when making a SpriteKit game is to try to not use UIKit. All of your UI should be created directly in the SKScenes using SpriteKit APIs (SKLabelNodes, SKSpriteNodes, SKNodes etc). There are exceptions to this, like maybe using UICollectionViews for massive level select menus, but basic UI should never be...
As stated, you should try to not use UIKit as that's for UIKit applications and not necessarily games. You can use my [JKButtonNode](https://github.com/jozemite/JKButtonNode) class to create buttons. The class file is right [here](https://github.com/jozemite/JKButtonNode/blob/master/Project/JKButtonNode/JKButtonNode.s...
43,194,025
I have a CSV file with two columns (a and b) of data: ``` a b 30 3000.01 5 3000.02 1 3001.01 5 3001.02 ``` I am using pandas to try and select rows that only have the ".01" values in column "b". So output should be: ``` a b 30 3000.01 1 3001.01 ``` Basically is there a way to search/select r...
2017/04/03
[ "https://Stackoverflow.com/questions/43194025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5143432/" ]
To update anything in your cloudformation template you run an update-stack command with the new or update cloudformation template as an input parameter. AWS will then only alter the components you have changed. So if any line in the userData section has been altered when you run update-stack AWS will run through the en...
Userdata can be updated, but it would require stopping and starting of your EBS backed instance : <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata>
43,194,025
I have a CSV file with two columns (a and b) of data: ``` a b 30 3000.01 5 3000.02 1 3001.01 5 3001.02 ``` I am using pandas to try and select rows that only have the ".01" values in column "b". So output should be: ``` a b 30 3000.01 1 3001.01 ``` Basically is there a way to search/select r...
2017/04/03
[ "https://Stackoverflow.com/questions/43194025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5143432/" ]
Userdata can be updated, but it would require stopping and starting of your EBS backed instance : <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata>
``` "Fn::Join": [ "/n", [ "#!/bin/bash", "apt-get update", "apt-get -y upgrade", ] ``` actually this is the correct way. Don't know whether it is just a typo from your side
43,194,025
I have a CSV file with two columns (a and b) of data: ``` a b 30 3000.01 5 3000.02 1 3001.01 5 3001.02 ``` I am using pandas to try and select rows that only have the ".01" values in column "b". So output should be: ``` a b 30 3000.01 1 3001.01 ``` Basically is there a way to search/select r...
2017/04/03
[ "https://Stackoverflow.com/questions/43194025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5143432/" ]
To update anything in your cloudformation template you run an update-stack command with the new or update cloudformation template as an input parameter. AWS will then only alter the components you have changed. So if any line in the userData section has been altered when you run update-stack AWS will run through the en...
``` "Fn::Join": [ "/n", [ "#!/bin/bash", "apt-get update", "apt-get -y upgrade", ] ``` actually this is the correct way. Don't know whether it is just a typo from your side
122,239
Here is one of my programs that utilized memoization and array to improve performance and memory usage. The performance seems satisfactory but the memory usage is ridiculous and I can't figure out what's wrong: ``` {-# LANGUAGE BangPatterns #-} import Data.Functor import Data.Array (Array) import qualified Data.Array ...
2016/03/08
[ "https://codereview.stackexchange.com/questions/122239", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/99660/" ]
It doesn't use 300 megabytes of heap, it peaks at a little over 20 megabytes. Total allocation is not peak allocation and Haskell has cheap short-lived allocations so total alloc isn't always a good heuristic for GC time or steady-state heap usage. The heap profiling stuff is giving data designed for tuning code rather...
> > Here is one of my programs that utilized memoization and array to improve performance and memory usage. The performance seems satisfactory but the memory usage is ridiculous and I can't figure out what's wrong: > > > I don't actually know the answer, but I'd guess that you used memoization improperly. GHC alre...
25,150,467
I have this JavaScript code: ``` $(document).ready(function(){ $('#CustomersResellers').hide(); $('input.ShowResellerAccounts').on('click', function(){ if($(this).is(':checked')){ alert('checked'); } }); }); ``` which shows the alert when I check the box, but if the box is al...
2014/08/06
[ "https://Stackoverflow.com/questions/25150467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3908011/" ]
Of course it should not be shown, because nowhere in your code you attached event handler when checkbox is checked. So just add a hanlder, when checkbox is checked, like this ``` $(document).ready(function(){ $('#CustomersResellers').hide(); // Define a handle to avoid duplication function handler(){ ...
This is exactly the behavior I would expect. `if $(this).is(':checked')` means 'if this checkbox is checked' - then show the alert. But when you click to uncheck the box (`on('click'...)`), it becomes unchecked and alert does not show.
25,150,467
I have this JavaScript code: ``` $(document).ready(function(){ $('#CustomersResellers').hide(); $('input.ShowResellerAccounts').on('click', function(){ if($(this).is(':checked')){ alert('checked'); } }); }); ``` which shows the alert when I check the box, but if the box is al...
2014/08/06
[ "https://Stackoverflow.com/questions/25150467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3908011/" ]
Of course it should not be shown, because nowhere in your code you attached event handler when checkbox is checked. So just add a hanlder, when checkbox is checked, like this ``` $(document).ready(function(){ $('#CustomersResellers').hide(); // Define a handle to avoid duplication function handler(){ ...
Just make a **very slight change** and you're there: ``` $(document).ready(function(){ $('#CustomersResellers').hide(); $('input.ShowResellerAccounts').on('click', function(){ if($(this).is(':checked')){ alert('checked'); } }) .trigger('click'); //<<<===== This is all you n...
25,150,467
I have this JavaScript code: ``` $(document).ready(function(){ $('#CustomersResellers').hide(); $('input.ShowResellerAccounts').on('click', function(){ if($(this).is(':checked')){ alert('checked'); } }); }); ``` which shows the alert when I check the box, but if the box is al...
2014/08/06
[ "https://Stackoverflow.com/questions/25150467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3908011/" ]
Lets update the function: ``` var alertChecked = function() { if($(this).is(':checked')){ alert('checked'); } } // invoke the function when clicked $('input.ShowResellerAccounts').on('click', alertChecked); //invoke the function for all matching elements $('input.ShowResellerAccounts').each(alertChecked); ...
This is exactly the behavior I would expect. `if $(this).is(':checked')` means 'if this checkbox is checked' - then show the alert. But when you click to uncheck the box (`on('click'...)`), it becomes unchecked and alert does not show.
25,150,467
I have this JavaScript code: ``` $(document).ready(function(){ $('#CustomersResellers').hide(); $('input.ShowResellerAccounts').on('click', function(){ if($(this).is(':checked')){ alert('checked'); } }); }); ``` which shows the alert when I check the box, but if the box is al...
2014/08/06
[ "https://Stackoverflow.com/questions/25150467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3908011/" ]
Lets update the function: ``` var alertChecked = function() { if($(this).is(':checked')){ alert('checked'); } } // invoke the function when clicked $('input.ShowResellerAccounts').on('click', alertChecked); //invoke the function for all matching elements $('input.ShowResellerAccounts').each(alertChecked); ...
Just make a **very slight change** and you're there: ``` $(document).ready(function(){ $('#CustomersResellers').hide(); $('input.ShowResellerAccounts').on('click', function(){ if($(this).is(':checked')){ alert('checked'); } }) .trigger('click'); //<<<===== This is all you n...
402,936
I am doing a simple project with [MSP430FR6989](http://www.ti.com/product/MSP430FR6989), where I am converting an analog signal to a digital one, when it finishes conversion it will jump to an ISR and increment an integer. We can configure the ADC12\_B (ADC module for the microcontroller) to start sampling and convert...
2018/10/24
[ "https://electronics.stackexchange.com/questions/402936", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/139160/" ]
Table 6-12 in the datasheet also shows how the ADC trigger input is connected to the timer: ![MSP430FR6989 TA0 output](https://i.stack.imgur.com/ax57A.png) And this makes clear that the "timer output" is the same signal that would be output to a GPIO pin. In other words, this has nothing to do with the interrupt itse...
You could try to enable the timer interrupt and check that CCR1IF is going high and that SAMPCON is set afterwards. Also, you can check ADC registers as well, to determine its status, e.g. ADCBUSY bit. It is a good idea to use switch-case on ADC12IV and enable error-related interrupts to debug. Please let me know how ...
22,797,328
``` import math import time import random def sequential_search(key,sorted_list): for element in sorted_list: if element==key: return True else : return False def binary_search(key,sorted_list): l=0 r=len(sorted_list)-1 while l<=r: m=int(math.floor((l+r)...
2014/04/01
[ "https://Stackoverflow.com/questions/22797328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1760237/" ]
your code is too fast to profile that way (chances are its speed is fine) if you really want to speed profile it try this ``` def run_experiment(): print timeit.timeit("sequential_search(key,sorted_list)", "import random;from main import sequential_search; key=100...
From what I tested, your script runs very fast, in the same millisecond. You can follow [this answer](https://stackoverflow.com/questions/5998245/get-current-time-in-milliseconds-in-python) and convert your time to milliseconds to get a better accurate timing.
22,797,328
``` import math import time import random def sequential_search(key,sorted_list): for element in sorted_list: if element==key: return True else : return False def binary_search(key,sorted_list): l=0 r=len(sorted_list)-1 while l<=r: m=int(math.floor((l+r)...
2014/04/01
[ "https://Stackoverflow.com/questions/22797328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1760237/" ]
your code is too fast to profile that way (chances are its speed is fine) if you really want to speed profile it try this ``` def run_experiment(): print timeit.timeit("sequential_search(key,sorted_list)", "import random;from main import sequential_search; key=100...
The reason is that there are very little operations going on (from a computer perspective) in order to find the key and so the action completes almost immediately (thus the zero or close to zero time). If you want to check the relative efficiency of the different methods, call each function many times in a loop like s...
36,843,545
I'm trying to build a JSON backend for Elm. I only want to serve one page - elm.html, one js file - Main.js - and one css file. I tried [following these instructions](https://stackoverflow.com/questions/29919143/route-to-a-static-page-in-phoenix-framework/30032537) but there is not enough there to help a complete newb...
2016/04/25
[ "https://Stackoverflow.com/questions/36843545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1923190/" ]
``` find * -path "backoffice/target/" -prune -o -type f \( -name "*.groovy" -o -name "*.gsp" \) -print ```
Here is an answer, 99% of posted solutions to "excluding a sub-directory" seem to not work (for me at least). Interestingly, this is our attempt to get the list of source files for a grails project: ``` find * -type d \( -name "target" -o -name "test" \) -prune -o -type f \( -name "*.groovy" -o -name "*.gsp" -o -na...
19,773,500
I was looking at other questions about Spring custom validators but unfortunately I could not solve my problem with the proposed answers. My problem is the following: I have an entity (Account) and I created a custom validator (AccountValidator) which I use in a controller (RegisterController), but it is never invoked...
2013/11/04
[ "https://Stackoverflow.com/questions/19773500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1019997/" ]
I was facing the same issue and i fixed it by declaring the class **AccountValidator** in context xml file and using `@validated` in place of `@valid`.
After going through the source code, the only reason I can find for the `WebDataBinder` not to invoke your `Validator` is that your variable is `null`. This field ``` @Autowired private AccountValidator accountValidator; ``` must be `null`. I don't know how you got there, Spring would complain if it couldn't autowir...
19,773,500
I was looking at other questions about Spring custom validators but unfortunately I could not solve my problem with the proposed answers. My problem is the following: I have an entity (Account) and I created a custom validator (AccountValidator) which I use in a controller (RegisterController), but it is never invoked...
2013/11/04
[ "https://Stackoverflow.com/questions/19773500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1019997/" ]
I was facing the same issue and i fixed it by declaring the class **AccountValidator** in context xml file and using `@validated` in place of `@valid`.
I had this same problem and it turned out I was getting an SQL exception, seemingly bypassing my validator because I had my method annotated with @Transactional.