qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
16,857,365
Imagine we have the following code in an HTML file: ``` <script id='tag-1'> function foo(){ alert("this is foo-1"); } </script> <script id='tag-2'> function foo(){ alert("this is foo-2"); } </script> <script id='tag-3'> function foo(){ alert("this is foo-3"); } </script> ``` Is it possible ...
2013/05/31
[ "https://Stackoverflow.com/questions/16857365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353723/" ]
No, this isn't possible. All Javascript code in the same window shares the same namespace, so what you're doing in your example is simply overriding `foo`, meaning that in the end you only have "foo-3". iframes each have their own namespace but it wouldn't make sense to use iframes for something like this. If the fun...
How about something like this: ``` if (typeof (GenLib) == "undefined") GenLib = {}; GenLib.Tag1 = {}; GenLib.Tag2 = {}; GenLib.Tag3= {}; GenLib.Tag1.Foo = function () { alert("this is foo-1"); }; GenLib.Tag2.Foo = function () { alert("this is foo-2"); }; GenLib.Tag3....
16,857,365
Imagine we have the following code in an HTML file: ``` <script id='tag-1'> function foo(){ alert("this is foo-1"); } </script> <script id='tag-2'> function foo(){ alert("this is foo-2"); } </script> <script id='tag-3'> function foo(){ alert("this is foo-3"); } </script> ``` Is it possible ...
2013/05/31
[ "https://Stackoverflow.com/questions/16857365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353723/" ]
No, that's not possible without resorting to `eval()`. As each script block is evaluated by the browser the previous versions of the function are overwritten. You *can* access the text context of each `<script>` tag, but only if it's inline. Accessing the source of `<script src="...">` tags requires AJAX.
Javascript doesn't have function overloading. Every next declaration with the same name(variable or function) just re-declares it with new value provided. So in your case function from tag-3 will always be executed. Possible solution to what you want is 1. Give different names for each function. or 2. If you ...
16,857,365
Imagine we have the following code in an HTML file: ``` <script id='tag-1'> function foo(){ alert("this is foo-1"); } </script> <script id='tag-2'> function foo(){ alert("this is foo-2"); } </script> <script id='tag-3'> function foo(){ alert("this is foo-3"); } </script> ``` Is it possible ...
2013/05/31
[ "https://Stackoverflow.com/questions/16857365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353723/" ]
No, that's not possible without resorting to `eval()`. As each script block is evaluated by the browser the previous versions of the function are overwritten. You *can* access the text context of each `<script>` tag, but only if it's inline. Accessing the source of `<script src="...">` tags requires AJAX.
No, this isn't possible. All Javascript code in the same window shares the same namespace, so what you're doing in your example is simply overriding `foo`, meaning that in the end you only have "foo-3". iframes each have their own namespace but it wouldn't make sense to use iframes for something like this. If the fun...
16,857,365
Imagine we have the following code in an HTML file: ``` <script id='tag-1'> function foo(){ alert("this is foo-1"); } </script> <script id='tag-2'> function foo(){ alert("this is foo-2"); } </script> <script id='tag-3'> function foo(){ alert("this is foo-3"); } </script> ``` Is it possible ...
2013/05/31
[ "https://Stackoverflow.com/questions/16857365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353723/" ]
No, that's not possible without resorting to `eval()`. As each script block is evaluated by the browser the previous versions of the function are overwritten. You *can* access the text context of each `<script>` tag, but only if it's inline. Accessing the source of `<script src="...">` tags requires AJAX.
How about something like this: ``` if (typeof (GenLib) == "undefined") GenLib = {}; GenLib.Tag1 = {}; GenLib.Tag2 = {}; GenLib.Tag3= {}; GenLib.Tag1.Foo = function () { alert("this is foo-1"); }; GenLib.Tag2.Foo = function () { alert("this is foo-2"); }; GenLib.Tag3....
16,857,365
Imagine we have the following code in an HTML file: ``` <script id='tag-1'> function foo(){ alert("this is foo-1"); } </script> <script id='tag-2'> function foo(){ alert("this is foo-2"); } </script> <script id='tag-3'> function foo(){ alert("this is foo-3"); } </script> ``` Is it possible ...
2013/05/31
[ "https://Stackoverflow.com/questions/16857365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353723/" ]
Yes this is totally possible, but you should use a type other than text/javascript. ``` <script id='tag-1' type="myScriptHolder"> function foo(){ alert("this is foo-1"); } </script> <script id='tag-2' type="myScriptHolder"> function foo(){ alert("this is foo-2"); } </script> <script id='tag-3' type="...
Javascript doesn't have function overloading. Every next declaration with the same name(variable or function) just re-declares it with new value provided. So in your case function from tag-3 will always be executed. Possible solution to what you want is 1. Give different names for each function. or 2. If you ...
25,149,482
I have a python matrix ``` leafs = np.array([[1,2,3],[1,2,4],[2,3,4],[4,2,1]]) ``` I would like to compute for each couple of rows the number of time they have the same element. In this case I would get a 4x4 matrix proximity ``` proximity = array([[3, 2, 0, 1], [2, 3, 1, 1], ...
2014/08/05
[ "https://Stackoverflow.com/questions/25149482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2411173/" ]
Here's one way, using broadcasting. Be warned: the temporary array `eq` has shape `(nrows, nrows, ncols)`, so if `nrows` is 4000 and `ncols` is 1000, `eq` will require 16GB of memory. ``` In [38]: leafs Out[38]: array([[1, 2, 3], [1, 2, 4], [2, 3, 4], [4, 2, 1]]) In [39]: nrows, ncols = leafs.sh...
Warren Weckesser offered a very beautiful solution using broadcasting. However, even a straightforward approach using a loop can have comparable performance. `np.apply_along_axis` is slow in your initial solution because it does not take advantage of vectorization. However the following fixes it: ``` def proximity_1(l...
324,411
To demonstrate a specific issue with LDS cache, I have created simple lightning web component that displays list of accounts (filterable by *account type*) using `lightning-combobox` and `lightning-datatable`. The source code for this component can be accessed in this [git repo](https://github.com/arutj/lds-cache-demo)...
2020/10/23
[ "https://salesforce.stackexchange.com/questions/324411", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/55578/" ]
AFAIK, there is not much documentation on how exactly LDS manages its cache entries (other than details mentioned [here](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/data_ui_api), [here](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/reference_get_record_not...
I remember facing the same situation recently in Aura too, I simply used a aura If else to re-render the specific part of the component, its more like a refresh you see ,something similar of a refresh works in LWC too ... I did this as a workaround for LWC until I find something better ``` eval("$A.get('e.force:refres...
324,411
To demonstrate a specific issue with LDS cache, I have created simple lightning web component that displays list of accounts (filterable by *account type*) using `lightning-combobox` and `lightning-datatable`. The source code for this component can be accessed in this [git repo](https://github.com/arutj/lds-cache-demo)...
2020/10/23
[ "https://salesforce.stackexchange.com/questions/324411", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/55578/" ]
After testing out your code and quite a bit of research I was finally able to do it, I found it in the documentation and was able to update the cache values using a function: **getRecordNotifyChange()** [![enter image description here](https://i.stack.imgur.com/r4KO4.png)](https://i.stack.imgur.com/r4KO4.png) <https:...
I remember facing the same situation recently in Aura too, I simply used a aura If else to re-render the specific part of the component, its more like a refresh you see ,something similar of a refresh works in LWC too ... I did this as a workaround for LWC until I find something better ``` eval("$A.get('e.force:refres...
65,886
What is the best metric to evaluate highly imbalanaced binary classifiction? (such as fraud detection in credit card? I have examining several metrics precision recall F1 lassification Report (macro avg,weighted avg), ROC, AUC,.. but I do not know what is more acceptable to evaulate highly imbalanced binary classifica...
2020/01/05
[ "https://datascience.stackexchange.com/questions/65886", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/58433/" ]
Text summarization ***can*** be divided into two categories 1. Extractive Summarization and 2. Abstractive Summarization 1. **Extractive Summarization**: These methods rely on extracting several parts, such as phrases and sentences, from a piece of text and stack them together to create a summary. Therefore, identifyi...
Paper list for style transfer in text: * <https://github.com/fuzhenxin/Style-Transfer-in-Text>
72,277,244
I have an array list of hostnames that I need to do two things with. The first is to take the list of server names and make them lowercase. The second thing I need to do is append a domain suffix. I've gotten the array list created and made the list lowercase, but I'm having issues appending the domain suffix. Example ...
2022/05/17
[ "https://Stackoverflow.com/questions/72277244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19137886/" ]
Unless you have a specific need to use an [`ArrayList`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.arraylist?view=net-6.0), you can simply construct your [`Array`](https://learn.microsoft.com/en-us/dotnet/api/system.array?view=net-6.0) in one go using a loop of your choice, [`ForEach-Object`](https...
Try to do this : ``` $Stringarray = [System.Collections.ArrayList]@(“HOST1" ,"HOST2" , "HOST3", "HOST4") $Stringarray | % { "$($_.tolower()).contoso.com" } ```
14,444,913
How to specify listening address and port in [web.py](http://webpy.org/)? Something like: ``` web.application( urls, host="33.44.55.66", port=8080 ) ``` **Edit** I would like to avoid using the default web.py command line parsing
2013/01/21
[ "https://Stackoverflow.com/questions/14444913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497208/" ]
From API docmentation of [web.py](http://webpy.org/docs/0.3/api#web.httpserver): ``` **module web.httpserver** function runsimple(func,server_address=('0.0.0.0', 8080)) ``` Runs CherryPy WSGI server hosting WSGI app func. The directory static/ is hosted statically. **Example code** ``` import web class MyAp...
If you're using web.py's built-in webserver, you can just append the port to the command: ``` python app.py 8080 ``` I haven't tried ever with the listening address, but perhaps it will accept 1.2.3.4:8080 as the format.
14,444,913
How to specify listening address and port in [web.py](http://webpy.org/)? Something like: ``` web.application( urls, host="33.44.55.66", port=8080 ) ``` **Edit** I would like to avoid using the default web.py command line parsing
2013/01/21
[ "https://Stackoverflow.com/questions/14444913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497208/" ]
If you're using web.py's built-in webserver, you can just append the port to the command: ``` python app.py 8080 ``` I haven't tried ever with the listening address, but perhaps it will accept 1.2.3.4:8080 as the format.
``` URLS = ("/", index) class index: def GET: .... if __name__ == "__main__": app = web.application(URLS, globals()) web.httpserver.runsimple(app.wsgifunc(), ("0.0.0.0", 8888)) ```
14,444,913
How to specify listening address and port in [web.py](http://webpy.org/)? Something like: ``` web.application( urls, host="33.44.55.66", port=8080 ) ``` **Edit** I would like to avoid using the default web.py command line parsing
2013/01/21
[ "https://Stackoverflow.com/questions/14444913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497208/" ]
If you're using web.py's built-in webserver, you can just append the port to the command: ``` python app.py 8080 ``` I haven't tried ever with the listening address, but perhaps it will accept 1.2.3.4:8080 as the format.
you can see the follow code in wsgi.py: ``` server_addr = validip(listget(sys.argv, 1, '')) if os.environ.has_key('PORT'): # e.g. Heroku server_addr = ('0.0.0.0', intget(os.environ['PORT'])) return httpserver.runsimple(func, server_addr) ``` so, you can set the web server port by add environ variable: ``` impo...
14,444,913
How to specify listening address and port in [web.py](http://webpy.org/)? Something like: ``` web.application( urls, host="33.44.55.66", port=8080 ) ``` **Edit** I would like to avoid using the default web.py command line parsing
2013/01/21
[ "https://Stackoverflow.com/questions/14444913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497208/" ]
From API docmentation of [web.py](http://webpy.org/docs/0.3/api#web.httpserver): ``` **module web.httpserver** function runsimple(func,server_address=('0.0.0.0', 8080)) ``` Runs CherryPy WSGI server hosting WSGI app func. The directory static/ is hosted statically. **Example code** ``` import web class MyAp...
``` URLS = ("/", index) class index: def GET: .... if __name__ == "__main__": app = web.application(URLS, globals()) web.httpserver.runsimple(app.wsgifunc(), ("0.0.0.0", 8888)) ```
14,444,913
How to specify listening address and port in [web.py](http://webpy.org/)? Something like: ``` web.application( urls, host="33.44.55.66", port=8080 ) ``` **Edit** I would like to avoid using the default web.py command line parsing
2013/01/21
[ "https://Stackoverflow.com/questions/14444913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497208/" ]
From API docmentation of [web.py](http://webpy.org/docs/0.3/api#web.httpserver): ``` **module web.httpserver** function runsimple(func,server_address=('0.0.0.0', 8080)) ``` Runs CherryPy WSGI server hosting WSGI app func. The directory static/ is hosted statically. **Example code** ``` import web class MyAp...
you can see the follow code in wsgi.py: ``` server_addr = validip(listget(sys.argv, 1, '')) if os.environ.has_key('PORT'): # e.g. Heroku server_addr = ('0.0.0.0', intget(os.environ['PORT'])) return httpserver.runsimple(func, server_addr) ``` so, you can set the web server port by add environ variable: ``` impo...
56,870,891
This is what I'm trying but only `pagination-sm` class is working on all breakpoint ```php <ul class="pagination mb-0 pagination-sm pagination-lg" role="navigation"> <li class="page-item"><a href="#">Previous</a></li> <li class="page-item"><a href="#">1</a></li> <li class="page-item"><a href="#">2</a></li...
2019/07/03
[ "https://Stackoverflow.com/questions/56870891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9945624/" ]
`pagination-sm` is not a media query specific CSS. It means that the pagination items must be shown small in all views.If you need different styles for small and large devices, you will need to add some custom media query CSS to do so. ```css .pagination .page-link { padding: .25rem .5rem; } @media screen and (m...
**Solution with SASS** - better solution without JS but SASS (add this code after importing all bootstrap components): ``` @include media-breakpoint-between(xs,md) { .pagination { @include pagination-size($pagination-padding-y-sm, $pagination-padding-x-sm, $font-size-sm, $pagination-border-radius-sm); } } ```...
187,443
I have two categories * Category1 (ID = 1) * Category2 (ID = 2) I want to display posts Which are in Category2 and in (Category1 + Category2). If a post is only in Category1 then it should not display. I have used the following code. ``` 'category__in' => array(2) ``` It works but I think it is not the corre...
2015/05/06
[ "https://wordpress.stackexchange.com/questions/187443", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11985/" ]
This is very unusual case, and the only solution I can think of here is to get an array of category ids to include into `category__in` in order to skip posts that are **only** assigned to category `1` In order to achieve this, we must * use [`get_terms()`](https://codex.wordpress.org/Function_Reference/get_terms) to ...
I am only guessing, but sollution must be similar to ``` $args = array( 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'id', 'terms' => array(1, 2), 'operator' => 'AND' ) ) ); $results = new WP_Query( $args ); ```
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
This is what I've used some time ago. It works for texts longer than 3 words and with less than 3 non-recognized words. Of course, you can play with the settings, but for my use case (website **scraping**) those worked pretty well. ``` from enchant.checker import SpellChecker max_error_count = 4 min_text_length = 3 ...
``` import enchant def check(text): text=text.split() dictionary = enchant.Dict("en_US") #also available are en_GB, fr_FR, etc for i in range(len(text)): if(dictionary.check(text[i])==False): o = "False" break else: o = ("True") return o ```
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
Pretrained Fast Text Model Worked Best For My Similar Needs ----------------------------------------------------------- I arrived at your question with a very similar need. I appreciated Martin Thoma's answer. However, I found the most help from Rabash's answer part 7 [HERE](https://stackoverflow.com/questions/3914277...
Use the enchant library ``` import enchant dictionary = enchant.Dict("en_US") #also available are en_GB, fr_FR, etc dictionary.check("Hello") # prints True dictionary.check("Helo") #prints False ``` This example is taken directly from their [website](https://pythonhosted.org/pyenchant/tutorial.html)
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
Use the enchant library ``` import enchant dictionary = enchant.Dict("en_US") #also available are en_GB, fr_FR, etc dictionary.check("Hello") # prints True dictionary.check("Helo") #prints False ``` This example is taken directly from their [website](https://pythonhosted.org/pyenchant/tutorial.html)
If you want something lightweight, letter trigrams are a popular approach. Every language has a different "profile" of common and uncommon trigrams. You can google around for it, or code your own. Here's a sample implementation I came across, which uses "cosine similarity" as a measure of distance between the sample te...
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
You might be interested in my paper [The WiLI benchmark dataset for written language identification](https://arxiv.org/pdf/1801.07779.pdf). I also benchmarked a couple of tools. TL;DR: * CLD-2 is pretty good and extremely fast * [lang-detect](https://pypi.python.org/pypi/langdetect?) is a tiny bit better, but much sl...
Use the enchant library ``` import enchant dictionary = enchant.Dict("en_US") #also available are en_GB, fr_FR, etc dictionary.check("Hello") # prints True dictionary.check("Helo") #prints False ``` This example is taken directly from their [website](https://pythonhosted.org/pyenchant/tutorial.html)
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
Pretrained Fast Text Model Worked Best For My Similar Needs ----------------------------------------------------------- I arrived at your question with a very similar need. I appreciated Martin Thoma's answer. However, I found the most help from Rabash's answer part 7 [HERE](https://stackoverflow.com/questions/3914277...
This is what I've used some time ago. It works for texts longer than 3 words and with less than 3 non-recognized words. Of course, you can play with the settings, but for my use case (website **scraping**) those worked pretty well. ``` from enchant.checker import SpellChecker max_error_count = 4 min_text_length = 3 ...
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
You might be interested in my paper [The WiLI benchmark dataset for written language identification](https://arxiv.org/pdf/1801.07779.pdf). I also benchmarked a couple of tools. TL;DR: * CLD-2 is pretty good and extremely fast * [lang-detect](https://pypi.python.org/pypi/langdetect?) is a tiny bit better, but much sl...
Pretrained Fast Text Model Worked Best For My Similar Needs ----------------------------------------------------------- I arrived at your question with a very similar need. I appreciated Martin Thoma's answer. However, I found the most help from Rabash's answer part 7 [HERE](https://stackoverflow.com/questions/3914277...
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
There is a library called langdetect. It is ported from Google's language-detection available here: <https://pypi.python.org/pypi/langdetect> It supports 55 languages out of the box.
Pretrained Fast Text Model Worked Best For My Similar Needs ----------------------------------------------------------- I arrived at your question with a very similar need. I appreciated Martin Thoma's answer. However, I found the most help from Rabash's answer part 7 [HERE](https://stackoverflow.com/questions/3914277...
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
Pretrained Fast Text Model Worked Best For My Similar Needs ----------------------------------------------------------- I arrived at your question with a very similar need. I appreciated Martin Thoma's answer. However, I found the most help from Rabash's answer part 7 [HERE](https://stackoverflow.com/questions/3914277...
``` import enchant def check(text): text=text.split() dictionary = enchant.Dict("en_US") #also available are en_GB, fr_FR, etc for i in range(len(text)): if(dictionary.check(text[i])==False): o = "False" break else: o = ("True") return o ```
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
There is a library called langdetect. It is ported from Google's language-detection available here: <https://pypi.python.org/pypi/langdetect> It supports 55 languages out of the box.
``` import enchant def check(text): text=text.split() dictionary = enchant.Dict("en_US") #also available are en_GB, fr_FR, etc for i in range(len(text)): if(dictionary.check(text[i])==False): o = "False" break else: o = ("True") return o ```
43,377,265
I am using both [Nltk](http://www.nltk.org/) and [Scikit Learn](http://scikit-learn.org/stable/) to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: ``` [ "this is some text written in English", "this is some more ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4573703/" ]
There is a library called langdetect. It is ported from Google's language-detection available here: <https://pypi.python.org/pypi/langdetect> It supports 55 languages out of the box.
This is what I've used some time ago. It works for texts longer than 3 words and with less than 3 non-recognized words. Of course, you can play with the settings, but for my use case (website **scraping**) those worked pretty well. ``` from enchant.checker import SpellChecker max_error_count = 4 min_text_length = 3 ...
34,188,098
I am trying to install Spark on 3 node memsql cluster using MemSQL Ops but getting below error. Please suggest how to resolve this error. **Failed to deploy Spark. Could not get latest version of Spark: There are no SPARK files available.** Thanks.
2015/12/09
[ "https://Stackoverflow.com/questions/34188098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3222372/" ]
As there are `2**n` subsets (`n` is length of the list). You can create a counter from `0` to `2**(n-1)`. Then create a list (which is a subset) in each iteration by adding the elements who's corresponding bit is set to `1` in the counter binary form. ``` counter = 5 binary_form = 101 you create a subset using first a...
Essentially building the list of subsets is the same as building the list of all combinations of sizes 1 through to length of the input. So one solution involves using [itertools](https://docs.python.org/3/library/itertools.html): ``` import itertools def all_subsets(l): res = [] for subset_len in range(1, le...
34,188,098
I am trying to install Spark on 3 node memsql cluster using MemSQL Ops but getting below error. Please suggest how to resolve this error. **Failed to deploy Spark. Could not get latest version of Spark: There are no SPARK files available.** Thanks.
2015/12/09
[ "https://Stackoverflow.com/questions/34188098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3222372/" ]
As there are `2**n` subsets (`n` is length of the list). You can create a counter from `0` to `2**(n-1)`. Then create a list (which is a subset) in each iteration by adding the elements who's corresponding bit is set to `1` in the counter binary form. ``` counter = 5 binary_form = 101 you create a subset using first a...
As @sudomakeinstall2 mentioned, you can use a counter from `0` to `2**(n-1)` to iterate over the list, and use it as the mask to pick values from `alist`. ``` def partial(alist): result = [] for i in range(2 ** len(alist)): # iterate over all results tmp = [] for j in range(len(alist)): ...
34,188,098
I am trying to install Spark on 3 node memsql cluster using MemSQL Ops but getting below error. Please suggest how to resolve this error. **Failed to deploy Spark. Could not get latest version of Spark: There are no SPARK files available.** Thanks.
2015/12/09
[ "https://Stackoverflow.com/questions/34188098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3222372/" ]
As @sudomakeinstall2 mentioned, you can use a counter from `0` to `2**(n-1)` to iterate over the list, and use it as the mask to pick values from `alist`. ``` def partial(alist): result = [] for i in range(2 ** len(alist)): # iterate over all results tmp = [] for j in range(len(alist)): ...
Essentially building the list of subsets is the same as building the list of all combinations of sizes 1 through to length of the input. So one solution involves using [itertools](https://docs.python.org/3/library/itertools.html): ``` import itertools def all_subsets(l): res = [] for subset_len in range(1, le...
70,889,823
In the following code, is there an elegant way to find `it_end`? ``` #include <iostream> #include <algorithm> #include <vector> #include <iterator> #include <type_traits> template <class Iterator, class U = typename std::iterator_traits<Iterator>::value_type> void process(Iterator begin, Iterator end) { // first ...
2022/01/28
[ "https://Stackoverflow.com/questions/70889823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4381271/" ]
1. Using [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) will make it as simple as this: ```css .boxes { display: grid; grid-template-columns : repeat(5,1fr); gap : 2rem; } /* for having some visuals */ .boxes > div{ border:1px solid red; min-height : 100px } ``` ```html <div cl...
easy way to accomplish that is with css grid not flex ``` .boxes { display: grid; grid-template: "1 2 3 4 5" "6 7 8 9 10"; grid-gap: 6px; /*gap between child*/ } .boxes > div { /*set child's background color*/ background-color: darkcyan; } ```
70,889,823
In the following code, is there an elegant way to find `it_end`? ``` #include <iostream> #include <algorithm> #include <vector> #include <iterator> #include <type_traits> template <class Iterator, class U = typename std::iterator_traits<Iterator>::value_type> void process(Iterator begin, Iterator end) { // first ...
2022/01/28
[ "https://Stackoverflow.com/questions/70889823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4381271/" ]
1. Using [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) will make it as simple as this: ```css .boxes { display: grid; grid-template-columns : repeat(5,1fr); gap : 2rem; } /* for having some visuals */ .boxes > div{ border:1px solid red; min-height : 100px } ``` ```html <div cl...
```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Boxes</title> </head> <body> <table border="2px" style="width:100%"> <tbody> ...
18,056,333
I was wondering if my approach to a specific problem is thread-safe (probably not, that's why I'm asking). Suppose we have this code, running on a non-UI thread: ``` if (myMap != null) { runOnUiThread(new Runnable() { @Override public void run() { Something something = myMap....
2013/08/05
[ "https://Stackoverflow.com/questions/18056333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1958659/" ]
This is as simple as defining myMap before executing the code you have given: ``` Map<String, String> myMap = new Hashmap<String, String>(); //if (myMap != null) // { runOnUiThread(new Runnable() { @Override public void run() { Something som...
When you create a Runnable and pass it to the function "runOnUiThread()" if the current thread is main thread it will be executed immediately or will be put into the queue and will be executed later and that time the object can be not valid. It would be better if you check its validity in the worker thread (in run() me...
18,056,333
I was wondering if my approach to a specific problem is thread-safe (probably not, that's why I'm asking). Suppose we have this code, running on a non-UI thread: ``` if (myMap != null) { runOnUiThread(new Runnable() { @Override public void run() { Something something = myMap....
2013/08/05
[ "https://Stackoverflow.com/questions/18056333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1958659/" ]
Your general structure is not thread-safe The thread that initiates the whole process checks `myMap` and initiates execution in potentially another thread. ``` if (myMap != null) { doSomethingInAnotherThread(); } // something can set `myMap` to null here... ``` The code that is scheduled to run will at some poi...
When you create a Runnable and pass it to the function "runOnUiThread()" if the current thread is main thread it will be executed immediately or will be put into the queue and will be executed later and that time the object can be not valid. It would be better if you check its validity in the worker thread (in run() me...
41,788,933
I have table contains text and blob field and some other , I'm wondering if using these kind of data types would slow down the access to table ``` CREATE TABLE post ( id INT(11), person_id INT(11) , title VARCHAR(120) , date DATETIME , content TEXT, image BLOB , ); ``` let's say i have more...
2017/01/22
[ "https://Stackoverflow.com/questions/41788933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5136659/" ]
Yes or no. If you don't fetch the text/blob fields, they don't slow down `SELECTs`. If you do, then they slow things down in either or both of these ways: * In InnoDB, `TEXT` and `BLOB` data, if large enough, is stored in a separate area from the rest of the columns. This *may* necessitate an extra disk hit. (Or may ...
In my opinion, the short answer is yes. But there's more to it of course. If you have good indexes then mysql will locate the data very fast but because the data is big then it will take a longer time to send the data. In general smaller tables and use of numeric column types provides better performance. And never ...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The easy way: Take a simple PABX (small SOHO kind) to let your alarm call your PC. You can use your PC's modem to wait for a RING from your modem. (Use the System.IO.Ports.SerialPort class to accoumplish this.) You'll need to program your alarm system to call the internal number of your PC. Once you get a ring, you l...
I used to have a "Telephone Line Simulator" that allowed me to test modem configurations by letting one modem call another through a little black box that simulated the phone company's part of the bargain. Something like that should be easy to find, and would be an easy solution to your problem.
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I used to have a "Telephone Line Simulator" that allowed me to test modem configurations by letting one modem call another through a little black box that simulated the phone company's part of the bargain. Something like that should be easy to find, and would be an easy solution to your problem.
I don't know how familiar you are with electronics, but I almost wonder if your solution could be handled with a mix of software and hardware. My first thought was to have something like an Arduino hooked up to either the circuit that does the pump failure detection or the phone line and watches for whatever signal th...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The easy way: Take a simple PABX (small SOHO kind) to let your alarm call your PC. You can use your PC's modem to wait for a RING from your modem. (Use the System.IO.Ports.SerialPort class to accoumplish this.) You'll need to program your alarm system to call the internal number of your PC. Once you get a ring, you l...
Another option is a pySerial script written in Python. You can write a small listener that listens for phone calls from your pump modem. You will need to know some AT commands, which you can look up anywhere online. ``` import pySerial ser=serial.Serial('COM4',2400,timeout=1) #replace 2400 with your baudrate ser.o...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You're going to need more than a modem in your PC to accomplish what you've described. Both the sump pump and your PC have modems, which are the subscriber end of a telephone "loop". The CO end (Central office in telephony terms) provides functions that you're telephone and both the modems mentioned above. A big one i...
I used to have a "Telephone Line Simulator" that allowed me to test modem configurations by letting one modem call another through a little black box that simulated the phone company's part of the bargain. Something like that should be easy to find, and would be an easy solution to your problem.
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The easy way: Take a simple PABX (small SOHO kind) to let your alarm call your PC. You can use your PC's modem to wait for a RING from your modem. (Use the System.IO.Ports.SerialPort class to accoumplish this.) You'll need to program your alarm system to call the internal number of your PC. Once you get a ring, you l...
I'd probably keep the two programs separate. 1. I'd have HyperTerminal (assuming you're on a Windows machine) running against your modem, with ATA or something similar, upon activity, I'd have it write a file. 2. I'd have another program running as an automated task (like every 30 minutes), looking to see if that file...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You're going to need more than a modem in your PC to accomplish what you've described. Both the sump pump and your PC have modems, which are the subscriber end of a telephone "loop". The CO end (Central office in telephony terms) provides functions that you're telephone and both the modems mentioned above. A big one i...
I don't know how familiar you are with electronics, but I almost wonder if your solution could be handled with a mix of software and hardware. My first thought was to have something like an Arduino hooked up to either the circuit that does the pump failure detection or the phone line and watches for whatever signal th...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The easy way: Take a simple PABX (small SOHO kind) to let your alarm call your PC. You can use your PC's modem to wait for a RING from your modem. (Use the System.IO.Ports.SerialPort class to accoumplish this.) You'll need to program your alarm system to call the internal number of your PC. Once you get a ring, you l...
I don't know how familiar you are with electronics, but I almost wonder if your solution could be handled with a mix of software and hardware. My first thought was to have something like an Arduino hooked up to either the circuit that does the pump failure detection or the phone line and watches for whatever signal th...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Another option is a pySerial script written in Python. You can write a small listener that listens for phone calls from your pump modem. You will need to know some AT commands, which you can look up anywhere online. ``` import pySerial ser=serial.Serial('COM4',2400,timeout=1) #replace 2400 with your baudrate ser.o...
I don't know how familiar you are with electronics, but I almost wonder if your solution could be handled with a mix of software and hardware. My first thought was to have something like an Arduino hooked up to either the circuit that does the pump failure detection or the phone line and watches for whatever signal th...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I used to have a "Telephone Line Simulator" that allowed me to test modem configurations by letting one modem call another through a little black box that simulated the phone company's part of the bargain. Something like that should be easy to find, and would be an easy solution to your problem.
Do you need the sump pump to actually dial? Can you not just intercept the sump pump's check for the dialtone? Or better, maybe there is an electronics friend you have who can wire up a simple device that plugs into the sump pump and checks for a voltage edge that occurs when the pump fails. This is an event pre...
624,526
Ok, everybody get in your wayback machine. I need to have a phone dial into my computer's 56k modem. I need my computer to have the modem "on" and have an active dialtone. Here is why: I have a sump pump alarm that will call me on a pump failure. It only works with a landline. I want to stop paying for my landline to s...
2009/03/08
[ "https://Stackoverflow.com/questions/624526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Another option is a pySerial script written in Python. You can write a small listener that listens for phone calls from your pump modem. You will need to know some AT commands, which you can look up anywhere online. ``` import pySerial ser=serial.Serial('COM4',2400,timeout=1) #replace 2400 with your baudrate ser.o...
I'd probably keep the two programs separate. 1. I'd have HyperTerminal (assuming you're on a Windows machine) running against your modem, with ATA or something similar, upon activity, I'd have it write a file. 2. I'd have another program running as an automated task (like every 30 minutes), looking to see if that file...
15,076
In the description of one vacancy I read following: > > ...responsible for Internet and Mobile channels development, project > management, customer experience development. > > > What does **customer experience development** mean? I know what is [customer experience](http://en.wikipedia.org/wiki/Customer_experien...
2015/06/01
[ "https://pm.stackexchange.com/questions/15076", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/8417/" ]
It's like continuous quality improvement. It is about **continuous improvement of the customer experience**. Or the person is responsible to manage / develop / improve/ increase the customer experience, e.g. over the project lifecycle.
Customer experience (CX) development also involves strategic decisions about 'what to improve' so that customers perceive their experience as excellent. For instance, if a CX manager is working for an omnichannel retailer such as Target, he/she needs to develop CX initiatives across [nine primary CX factors in omnichan...
72,090,320
``` struct WordleWords<'a> { words: Vec<&'a str>, } impl WordleWords<'_> { pub fn new<'a>() -> WordleWords<'a> { let mut word_file = File::open("words.txt").expect("cant open file"); let mut raw_str = String::new(); word_file .read_to_string(&mut raw_str) .expect...
2022/05/02
[ "https://Stackoverflow.com/questions/72090320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11117124/" ]
Bash 5.0's `complete` command added a new `-I` option for this. According to `man bash` — > > * complete -pr [-DEI] [*name* ...] > > > [...] The `-I` option indicates that other supplied options and actions should apply to completion on the **initial non-assignment word** on the line, or after a command delimiter ...
Using @pynexj's answer, I came up with the following example that seems to work well enough: ```sh if [ "${BASH_VERSINFO[0]}" -ge "5" ]; then function _custom_initial_word_complete() { if [ "${2-}" != "" ]; then if [ "${2::2}" == "ls" ]; then COMPREPLY=($(compgen -c "${2}" | \grep -v ls_not_the_o...
22,540,383
I have been working on ways to flatten text into ascii. So **ā** -> **a** and **ñ** -> **n**, etc. `unidecode` has been fantastic for this. ``` # -*- coding: utf-8 -*- from unidecode import unidecode print(unidecode(u"ā, ī, ū, ś, ñ")) print(unidecode(u"Estado de São Paulo")) ``` Produces: ``` a, i, u, s, n Estado ...
2014/03/20
[ "https://Stackoverflow.com/questions/22540383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2673189/" ]
Use [codecs.open](http://docs.python.org/2/library/codecs.html) ``` with codecs.open("test.txt", 'r', 'utf-8') as inf: ``` Edit: The above was for Python 2.x. For Python 3 you don't need to use `codecs`, the encoding parameter has been added to regular `open`. ``` with open("test.txt", 'r', encoding='utf-8') as inf...
``` import codecs with codecs.open('test.txt', encoding='whicheveronethefilewasencodedwith') as f: ... ``` The [`codecs`](http://docs.python.org/2.7/library/codecs.html) module provides a function to open files with automatic Unicode encoding/decoding, among other things.
30,624,565
How to target the HTML elements that has Autocomplete off? I have the following HTML: ``` <input id="Password" name="Password" type="password" autocomplete="off"> ``` And I am using the following: ``` $('input[type="password"]').val(''); ``` But instead of targeting all inputs of type password I would like to ta...
2015/06/03
[ "https://Stackoverflow.com/questions/30624565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577805/" ]
Auto complete is an attribute like any other. Just use the [attribute selector](http://api.jquery.com/attribute-equals-selector/). ``` $('input[autocomplete="off"]') ``` See [JSFiddle](https://jsfiddle.net/t1jof6tf/) for an example.
This is done using jQueries [attribute equals selector](http://api.jquery.com/attribute-equals-selector/) You can select elements like: `#('.class[attr="value"]')`. In your case this would be `$('input[autocomplete="off"]')` to select all the elements that don't have autocomplete. Credits to @alan0xd7 for beating me ...
30,624,565
How to target the HTML elements that has Autocomplete off? I have the following HTML: ``` <input id="Password" name="Password" type="password" autocomplete="off"> ``` And I am using the following: ``` $('input[type="password"]').val(''); ``` But instead of targeting all inputs of type password I would like to ta...
2015/06/03
[ "https://Stackoverflow.com/questions/30624565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577805/" ]
Use an attribute selector: `$("input[autocomplete='off']")` <https://api.jquery.com/attribute-equals-selector/>
Auto complete is an attribute like any other. Just use the [attribute selector](http://api.jquery.com/attribute-equals-selector/). ``` $('input[autocomplete="off"]') ``` See [JSFiddle](https://jsfiddle.net/t1jof6tf/) for an example.
30,624,565
How to target the HTML elements that has Autocomplete off? I have the following HTML: ``` <input id="Password" name="Password" type="password" autocomplete="off"> ``` And I am using the following: ``` $('input[type="password"]').val(''); ``` But instead of targeting all inputs of type password I would like to ta...
2015/06/03
[ "https://Stackoverflow.com/questions/30624565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577805/" ]
Use an attribute selector: `$("input[autocomplete='off']")` <https://api.jquery.com/attribute-equals-selector/>
This is done using jQueries [attribute equals selector](http://api.jquery.com/attribute-equals-selector/) You can select elements like: `#('.class[attr="value"]')`. In your case this would be `$('input[autocomplete="off"]')` to select all the elements that don't have autocomplete. Credits to @alan0xd7 for beating me ...
8,324,391
I wrote a PHP script on my local server which needs to include path for the file where I need to write contents to the file using `file_put_contents` which was working without any problem on the localhost. I moved the files to the webserver where it has been configured with the path which has spaces in between for ex:...
2011/11/30
[ "https://Stackoverflow.com/questions/8324391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/809901/" ]
``` $path ="C:\ProgramFile(xxx)\Apache Software Foundation\Apache2.2\htdocs\writtencode\writefile\temp_1.cgf"; file_put_contents($path = str_replace(' ', '\ ', $path)); ```
Have you tried enclosing the path in quote marks? Also you may need to escape all backslashes so: `file_put_content(C:\ProgramFile(xxx)\ApacheSoftwareFoundation\Apache2.2\htdocs\writtencode\writefile\temp_1.cgf);` becomes: `file_put_content('C:\\ProgramFile(xxx)\\ApacheSoftwareFoundation\\Apache2.2\\htdocs\\writtenc...
67,212,262
i am new to react and what i want to have logger in react hook app.i have to use logger while calling microservices from backend if showhow error occurs it stores in the logger.i have no idea to implement it. i have used redux-logger middleware.it gives me prev state next state but it does not give anything if error oc...
2021/04/22
[ "https://Stackoverflow.com/questions/67212262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14744012/" ]
you can try with error boundary
The best way is to use **Loglevel** for logs in UI, and **Error Boundaries** in react to catch errors in your JavaScript application for the best result: 1. Loglevel: <https://github.com/pimterry/loglevel> 2. Error Boundaries: <https://reactjs.org/docs/error-boundaries.html>
67,212,262
i am new to react and what i want to have logger in react hook app.i have to use logger while calling microservices from backend if showhow error occurs it stores in the logger.i have no idea to implement it. i have used redux-logger middleware.it gives me prev state next state but it does not give anything if error oc...
2021/04/22
[ "https://Stackoverflow.com/questions/67212262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14744012/" ]
You can use the following pattern locally on your actions/requests: ``` try { // your action/request } catch (e) { logger(e) // your logger system } ```
you can try with error boundary
67,212,262
i am new to react and what i want to have logger in react hook app.i have to use logger while calling microservices from backend if showhow error occurs it stores in the logger.i have no idea to implement it. i have used redux-logger middleware.it gives me prev state next state but it does not give anything if error oc...
2021/04/22
[ "https://Stackoverflow.com/questions/67212262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14744012/" ]
You can use the following pattern locally on your actions/requests: ``` try { // your action/request } catch (e) { logger(e) // your logger system } ```
The best way is to use **Loglevel** for logs in UI, and **Error Boundaries** in react to catch errors in your JavaScript application for the best result: 1. Loglevel: <https://github.com/pimterry/loglevel> 2. Error Boundaries: <https://reactjs.org/docs/error-boundaries.html>
55,678,405
This is what I came up with ``` #include <iostream> using namespace std; int serialNumber = 1; ``` Would recursion be better? ``` int factorial(int n) { int k=1; for(int i=1;i<=n;++i) { k=k*i; } return k; } ``` How can I go about doing this in a single for loop? Or is this the best way...
2019/04/14
[ "https://Stackoverflow.com/questions/55678405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9856890/" ]
Get the `data` out of the object. And use like this ```js const state = { "data": [{ "val": 1, "other": 10 }, { "val": 11, "other": 100 }, { "val": 100, "other": 1000 } ] } const {data} = state; let res = { ...state, data:[ data[0], {...da...
You could assign parts of the array/objects. ```js var object = { data: [{ val: 1, other: 10 }, { val: 10, other: 100 }, { val: 100, other: 1000 }] }, result = { ...object, data: Object.assign( [...object.data], { 1: Object.assign( ...
55,678,405
This is what I came up with ``` #include <iostream> using namespace std; int serialNumber = 1; ``` Would recursion be better? ``` int factorial(int n) { int k=1; for(int i=1;i<=n;++i) { k=k*i; } return k; } ``` How can I go about doing this in a single for loop? Or is this the best way...
2019/04/14
[ "https://Stackoverflow.com/questions/55678405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9856890/" ]
Get the `data` out of the object. And use like this ```js const state = { "data": [{ "val": 1, "other": 10 }, { "val": 11, "other": 100 }, { "val": 100, "other": 1000 } ] } const {data} = state; let res = { ...state, data:[ data[0], {...da...
With a bit help of some functional helpers that is actually quite elegant: ``` const mapOne = (index, mapper) => array => array.map((it, i) => i === index ? mapper(it) : it); const lens = (key, mapper) => obj => ({ ...obj, [key]: mapper(obj[key]) }); // somewhere this.setState(mapOne(1, lens("val", it => it + 1))...
55,678,405
This is what I came up with ``` #include <iostream> using namespace std; int serialNumber = 1; ``` Would recursion be better? ``` int factorial(int n) { int k=1; for(int i=1;i<=n;++i) { k=k*i; } return k; } ``` How can I go about doing this in a single for loop? Or is this the best way...
2019/04/14
[ "https://Stackoverflow.com/questions/55678405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9856890/" ]
You could assign parts of the array/objects. ```js var object = { data: [{ val: 1, other: 10 }, { val: 10, other: 100 }, { val: 100, other: 1000 }] }, result = { ...object, data: Object.assign( [...object.data], { 1: Object.assign( ...
With a bit help of some functional helpers that is actually quite elegant: ``` const mapOne = (index, mapper) => array => array.map((it, i) => i === index ? mapper(it) : it); const lens = (key, mapper) => obj => ({ ...obj, [key]: mapper(obj[key]) }); // somewhere this.setState(mapOne(1, lens("val", it => it + 1))...
421,911
I use the following pseudo-script to create a TAR of my installed software ``` mkdir tmp ln -s /path/to/app1/bin tmp/app1 ln -s /and/path/going/to/the-app-2 tmp/app2 tar -c --dereference -f apps.tar tmp ``` I need the `--dereference` option here to follow the links I just made in `tmp`. The reason I m...
2012/08/28
[ "https://serverfault.com/questions/421911", "https://serverfault.com", "https://serverfault.com/users/1999/" ]
I don't think there is a way to do have just a partial dereference. You could do something like ``` tar -cf apps.tar /path/to/app1/bin /and/path/going/to/the-app-2 ``` and then to extract them to a different root using -C > > -C, --directory=DIR > > > > ``` > change to directory DIR > > ``` > > e.g...
Do you really need the directory structure in the tarball to be different than it is on disk? If not, then you can just tar them up as-is: ``` tar -cf file.tar /path/1 /path/2 ```
421,911
I use the following pseudo-script to create a TAR of my installed software ``` mkdir tmp ln -s /path/to/app1/bin tmp/app1 ln -s /and/path/going/to/the-app-2 tmp/app2 tar -c --dereference -f apps.tar tmp ``` I need the `--dereference` option here to follow the links I just made in `tmp`. The reason I m...
2012/08/28
[ "https://serverfault.com/questions/421911", "https://serverfault.com", "https://serverfault.com/users/1999/" ]
I don't think there is a way to do have just a partial dereference. You could do something like ``` tar -cf apps.tar /path/to/app1/bin /and/path/going/to/the-app-2 ``` and then to extract them to a different root using -C > > -C, --directory=DIR > > > > ``` > change to directory DIR > > ``` > > e.g...
Instead of linking, I could copy. Unfortunately it would add some more overhead (the files are rather big). Of course it would grow at most twice as big, since the tarring itself is also a form of copying.
421,911
I use the following pseudo-script to create a TAR of my installed software ``` mkdir tmp ln -s /path/to/app1/bin tmp/app1 ln -s /and/path/going/to/the-app-2 tmp/app2 tar -c --dereference -f apps.tar tmp ``` I need the `--dereference` option here to follow the links I just made in `tmp`. The reason I m...
2012/08/28
[ "https://serverfault.com/questions/421911", "https://serverfault.com", "https://serverfault.com/users/1999/" ]
I don't think there is a way to do have just a partial dereference. You could do something like ``` tar -cf apps.tar /path/to/app1/bin /and/path/going/to/the-app-2 ``` and then to extract them to a different root using -C > > -C, --directory=DIR > > > > ``` > change to directory DIR > > ``` > > e.g...
If you're `root` then your best bet is to use mount's bind command to basically hard link the directories you want to tar up, rather than symlinking to them. Then you won't need to use the dereference option. ``` mkdir tmp mount --bind /path/to/app-1 tmp/app-1 mount --bind /path/to/app-2 tmp/app-2 tar cf apps.tar tmp ...
6,177,645
I am using this [plug in](http://blog.egorkhmelev.com/2009/11/jquery-slider-safari-style/). All works well, but now i need to make a change. the callback always made the last condition - `else`, why? this condition for example never works. Any syntax error? ``` ($("#amount").val(value) == 400) ``` script ``` <sc...
2011/05/30
[ "https://Stackoverflow.com/questions/6177645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/564979/" ]
Looks like you want this: ``` function(value) { if (value == 400) { alert("nop"); $(html("-400 sdf")); } else if (value == 2000) { alert("nopp"); $(html("+2000 dfs")); } else { $(html(value)); //always working even if the value chosen is 400 or 2000 } } ```...
try this: ``` ($("#amount").val() == 400) ``` with ``` $("#amount").val(value) ``` you are setting the value of #amount to the variable "value", which will return the element #amount again. to do it within one line, you could use the following: ``` ($("#amount").val(value).val() == 400) ```
6,177,645
I am using this [plug in](http://blog.egorkhmelev.com/2009/11/jquery-slider-safari-style/). All works well, but now i need to make a change. the callback always made the last condition - `else`, why? this condition for example never works. Any syntax error? ``` ($("#amount").val(value) == 400) ``` script ``` <sc...
2011/05/30
[ "https://Stackoverflow.com/questions/6177645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/564979/" ]
Looks like you want this: ``` function(value) { if (value == 400) { alert("nop"); $(html("-400 sdf")); } else if (value == 2000) { alert("nopp"); $(html("+2000 dfs")); } else { $(html(value)); //always working even if the value chosen is 400 or 2000 } } ```...
It's because you are doing this: ``` if ($("#amount").val(value) == 400) ``` doing .val() returns the amount element, not the value you just set. You *could* do this: ``` if ($("#amount").val(value).val() == 400) ```
10,545,687
When enabling NuGet package restore, it adds the following to my solution: /.nuget /.nuget/NuGet.exe /.nuget/NuGet.targets As these are part of my solution, committing the solution to my repository without either of these files means I'll have missing references in my solution, but removing the folder or eithe...
2012/05/11
[ "https://Stackoverflow.com/questions/10545687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98389/" ]
The point behind committing the .nuget folder to the repository is that you can set up your solution to use package restore, using the exact same version of nuget.exe you installed when enabling this feature. Your project files depend on the nuget.targets MSBuild instructions that use nuget.exe, and both files are con...
You don't have to commit nuget.exe to source control. NuGet.targets downloads the latest NuGet.exe from nuget.org if it's missing.
10,545,687
When enabling NuGet package restore, it adds the following to my solution: /.nuget /.nuget/NuGet.exe /.nuget/NuGet.targets As these are part of my solution, committing the solution to my repository without either of these files means I'll have missing references in my solution, but removing the folder or eithe...
2012/05/11
[ "https://Stackoverflow.com/questions/10545687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98389/" ]
The point behind committing the .nuget folder to the repository is that you can set up your solution to use package restore, using the exact same version of nuget.exe you installed when enabling this feature. Your project files depend on the nuget.targets MSBuild instructions that use nuget.exe, and both files are con...
If you are following @Richard Szalay's answer (not committing nuget.exe), and for some reasons Visual Studio does not automatically download the nuget.exe, make sure you have the following set to **true** in the nuget.targets file: ``` <!-- Download NuGet.exe if it does not already exist --> <DownloadNuGetExe Conditi...
10,545,687
When enabling NuGet package restore, it adds the following to my solution: /.nuget /.nuget/NuGet.exe /.nuget/NuGet.targets As these are part of my solution, committing the solution to my repository without either of these files means I'll have missing references in my solution, but removing the folder or eithe...
2012/05/11
[ "https://Stackoverflow.com/questions/10545687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98389/" ]
The point behind committing the .nuget folder to the repository is that you can set up your solution to use package restore, using the exact same version of nuget.exe you installed when enabling this feature. Your project files depend on the nuget.targets MSBuild instructions that use nuget.exe, and both files are con...
For `.gitignore`, add below lines. ``` .nuget/ !.nuget/packages.config ```
10,545,687
When enabling NuGet package restore, it adds the following to my solution: /.nuget /.nuget/NuGet.exe /.nuget/NuGet.targets As these are part of my solution, committing the solution to my repository without either of these files means I'll have missing references in my solution, but removing the folder or eithe...
2012/05/11
[ "https://Stackoverflow.com/questions/10545687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98389/" ]
You don't have to commit nuget.exe to source control. NuGet.targets downloads the latest NuGet.exe from nuget.org if it's missing.
For `.gitignore`, add below lines. ``` .nuget/ !.nuget/packages.config ```
10,545,687
When enabling NuGet package restore, it adds the following to my solution: /.nuget /.nuget/NuGet.exe /.nuget/NuGet.targets As these are part of my solution, committing the solution to my repository without either of these files means I'll have missing references in my solution, but removing the folder or eithe...
2012/05/11
[ "https://Stackoverflow.com/questions/10545687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98389/" ]
If you are following @Richard Szalay's answer (not committing nuget.exe), and for some reasons Visual Studio does not automatically download the nuget.exe, make sure you have the following set to **true** in the nuget.targets file: ``` <!-- Download NuGet.exe if it does not already exist --> <DownloadNuGetExe Conditi...
For `.gitignore`, add below lines. ``` .nuget/ !.nuget/packages.config ```
184,239
I play a Death Domain cleric, with 1 level in wizard so I can cast the *find familiar* spell. For my familiar, I have a gelatinous ice cube (stats of a oblex spawn). At lower levels, it was super fun but we are now level 5 and with only AC 13 and 18 HP, it is dying in literally every single fight. I find myself using...
2021/04/22
[ "https://rpg.stackexchange.com/questions/184239", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/4362/" ]
### Combat familiars are a class feature of Pact of the Chain Warlocks. The basic familiar normally available to users of the spell *find familiar* is not well suited to battle, as you have observed. There are things you can do, such as using *shield of faith*, but even then, the familiar is still so squishy, your spe...
Normally, familiars have around 1 or 2 HP... because the normal familiar options are not that good. The best way to defend your familiar is mentioned in the description of [*find familiar*](https://www.dndbeyond.com/spells/find-familiar) itself: > > As an action, you can temporarily dismiss your familiar. It disappe...
184,239
I play a Death Domain cleric, with 1 level in wizard so I can cast the *find familiar* spell. For my familiar, I have a gelatinous ice cube (stats of a oblex spawn). At lower levels, it was super fun but we are now level 5 and with only AC 13 and 18 HP, it is dying in literally every single fight. I find myself using...
2021/04/22
[ "https://rpg.stackexchange.com/questions/184239", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/4362/" ]
### Combat familiars are a class feature of Pact of the Chain Warlocks. The basic familiar normally available to users of the spell *find familiar* is not well suited to battle, as you have observed. There are things you can do, such as using *shield of faith*, but even then, the familiar is still so squishy, your spe...
One minor improvement - *find familiar* can be cast as a ritual, so you can save those spell slots if you're willing to add an extra 10 minutes to the hour-long casting time. There's not much you can do about the 10 gp material component cost though.
184,239
I play a Death Domain cleric, with 1 level in wizard so I can cast the *find familiar* spell. For my familiar, I have a gelatinous ice cube (stats of a oblex spawn). At lower levels, it was super fun but we are now level 5 and with only AC 13 and 18 HP, it is dying in literally every single fight. I find myself using...
2021/04/22
[ "https://rpg.stackexchange.com/questions/184239", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/4362/" ]
### Combat familiars are a class feature of Pact of the Chain Warlocks. The basic familiar normally available to users of the spell *find familiar* is not well suited to battle, as you have observed. There are things you can do, such as using *shield of faith*, but even then, the familiar is still so squishy, your spe...
The answer is *magic* --------------------- The least intensive method for upping the defensive and offensive capabilities of your familiar will be in giving them fun new tools in the form of magic items, barding, and buff spells. Familiars [can attune to magic items](https://rpg.stackexchange.com/questions/107328) a...
184,239
I play a Death Domain cleric, with 1 level in wizard so I can cast the *find familiar* spell. For my familiar, I have a gelatinous ice cube (stats of a oblex spawn). At lower levels, it was super fun but we are now level 5 and with only AC 13 and 18 HP, it is dying in literally every single fight. I find myself using...
2021/04/22
[ "https://rpg.stackexchange.com/questions/184239", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/4362/" ]
Normally, familiars have around 1 or 2 HP... because the normal familiar options are not that good. The best way to defend your familiar is mentioned in the description of [*find familiar*](https://www.dndbeyond.com/spells/find-familiar) itself: > > As an action, you can temporarily dismiss your familiar. It disappe...
One minor improvement - *find familiar* can be cast as a ritual, so you can save those spell slots if you're willing to add an extra 10 minutes to the hour-long casting time. There's not much you can do about the 10 gp material component cost though.
184,239
I play a Death Domain cleric, with 1 level in wizard so I can cast the *find familiar* spell. For my familiar, I have a gelatinous ice cube (stats of a oblex spawn). At lower levels, it was super fun but we are now level 5 and with only AC 13 and 18 HP, it is dying in literally every single fight. I find myself using...
2021/04/22
[ "https://rpg.stackexchange.com/questions/184239", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/4362/" ]
Normally, familiars have around 1 or 2 HP... because the normal familiar options are not that good. The best way to defend your familiar is mentioned in the description of [*find familiar*](https://www.dndbeyond.com/spells/find-familiar) itself: > > As an action, you can temporarily dismiss your familiar. It disappe...
The answer is *magic* --------------------- The least intensive method for upping the defensive and offensive capabilities of your familiar will be in giving them fun new tools in the form of magic items, barding, and buff spells. Familiars [can attune to magic items](https://rpg.stackexchange.com/questions/107328) a...
42,794,928
I have added a jumbotron to my webpage, my page is now displaying the bottom and right scroll bar! Not sure how to resolve this. Any tip's or pointers much appreciated. url <http://tyrescanner.net/contact-us> ``` <div class="container-fluid"> <div class="row"> <d...
2017/03/14
[ "https://Stackoverflow.com/questions/42794928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5468938/" ]
Bitbucket Server (self-hosted) and Bitbucket Cloud (bitbucket.org) have slightly different features. If you're using Bitbucket Cloud, which it sounds like you are, it is not currently possible to disable HTTPS access. For more details, see: <https://bitbucket.org/site/master/issues/3775/add-the-option-to-disable-https...
**Bitbucket Server administration** is software provide by Atlassian. You should download and install at bellow link: <https://www.atlassian.com/software/bitbucket/download> I was setup on my computer and go to the setting page. You can see like this: [![](https://i.stack.imgur.com/1s1VD.png)](https://i.stack.imgur...
31,701,558
let's say i have the following data into table: ``` '1','nid' '1','step.nid' '2','step.nid' '3','step.nid' ``` that mean that each nid can have multiple steps, in that case for nid=1 we have 3 steps. How can I write the query in order to retrieve the following result: ``` '1','nid' '1','step.nid' '1','nid' '2','st...
2015/07/29
[ "https://Stackoverflow.com/questions/31701558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4511007/" ]
Yes it is possible you could use `exit 0` - success `exit 1` - failed(or any other number)
Id depends on how much call levels you currently on. Try executing several exit commands like: exit 0 exit 0 ...so on Alternatively see [Is there a way to write a bash function which aborts the whole execution, no matter how it is called?](https://stackoverflow.com/questions/9893667/is-there-a-way-to-write-a-bash-f...
36,589,923
What does `{...this.props}` mean in this code? ``` <div {...this.props} style={{ height: `100%`, }} ```
2016/04/13
[ "https://Stackoverflow.com/questions/36589923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5421539/" ]
I think it might be the **spread operator** (three dots) that are setting you off? :) [What does the three dots in react do?](https://stackoverflow.com/questions/31048953/what-does-the-three-dots-in-react-do) **Edit:** To elaborate, you're probably looking at a JSX template? Each property will in fact be a CSS proper...
{...this.props} means all of the props of current component. Let say you have object a and object b in props than {...this.props} means both a and b. You can pass all of your current component's props to another component by using this.
36,589,923
What does `{...this.props}` mean in this code? ``` <div {...this.props} style={{ height: `100%`, }} ```
2016/04/13
[ "https://Stackoverflow.com/questions/36589923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5421539/" ]
The `{...variable}` syntax is called "spread attributes". What this does is, basically, it takes every property of `this.props` (or any other passed variable) and applies them to the element. Example: ``` props = {className: 'big', href: 'http://example.com'}; <a {...props} /> // the above line is equal to the foll...
I think it might be the **spread operator** (three dots) that are setting you off? :) [What does the three dots in react do?](https://stackoverflow.com/questions/31048953/what-does-the-three-dots-in-react-do) **Edit:** To elaborate, you're probably looking at a JSX template? Each property will in fact be a CSS proper...
36,589,923
What does `{...this.props}` mean in this code? ``` <div {...this.props} style={{ height: `100%`, }} ```
2016/04/13
[ "https://Stackoverflow.com/questions/36589923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5421539/" ]
The `{...variable}` syntax is called "spread attributes". What this does is, basically, it takes every property of `this.props` (or any other passed variable) and applies them to the element. Example: ``` props = {className: 'big', href: 'http://example.com'}; <a {...props} /> // the above line is equal to the foll...
{...this.props} means all of the props of current component. Let say you have object a and object b in props than {...this.props} means both a and b. You can pass all of your current component's props to another component by using this.
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
It is only wise to invest in what you understand (ala Warren Buffett style). Depending on how much money you have, you might see fit to consult a good independent financial advisor instead of seeking advice from this website. A famous quote goes: “Those who say, do not know. Those who know, do not say”
One might hope for slightly more rationality in the platinum market. Rarely does one hear talk of "platinum bugs", rants about how every society on Earth has valued platinum as the One True Valuable Thing (tm), or seen presidential candidates call for the return to the platinum standard.
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[Platinum use](http://en.wikipedia.org/wiki/Platinum#Applications) is pretty heavily overweight in industrial areas; according to the linked Wikipedia article, 239 tonnes of platinum was sold in 2006, of which 130 tonnes went to vehicles emissions control devices and another 13.3 tonnes to electronics. [Gold sees subst...
One might hope for slightly more rationality in the platinum market. Rarely does one hear talk of "platinum bugs", rants about how every society on Earth has valued platinum as the One True Valuable Thing (tm), or seen presidential candidates call for the return to the platinum standard.
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[@Michael Kjörling](https://money.stackexchange.com/a/12753/4127) answered why platinum is in demand like it is. But it missed some of the significant risks so I will address some of them. Platinum is much more rare than gold. But not because there is less platinum than gold just that the known [existing platinum vein...
One might hope for slightly more rationality in the platinum market. Rarely does one hear talk of "platinum bugs", rants about how every society on Earth has valued platinum as the One True Valuable Thing (tm), or seen presidential candidates call for the return to the platinum standard.
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[Platinum use](http://en.wikipedia.org/wiki/Platinum#Applications) is pretty heavily overweight in industrial areas; according to the linked Wikipedia article, 239 tonnes of platinum was sold in 2006, of which 130 tonnes went to vehicles emissions control devices and another 13.3 tonnes to electronics. [Gold sees subst...
It is only wise to invest in what you understand (ala Warren Buffett style). Depending on how much money you have, you might see fit to consult a good independent financial advisor instead of seeking advice from this website. A famous quote goes: “Those who say, do not know. Those who know, do not say”
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[@Michael Kjörling](https://money.stackexchange.com/a/12753/4127) answered why platinum is in demand like it is. But it missed some of the significant risks so I will address some of them. Platinum is much more rare than gold. But not because there is less platinum than gold just that the known [existing platinum vein...
It is only wise to invest in what you understand (ala Warren Buffett style). Depending on how much money you have, you might see fit to consult a good independent financial advisor instead of seeking advice from this website. A famous quote goes: “Those who say, do not know. Those who know, do not say”
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
It is only wise to invest in what you understand (ala Warren Buffett style). Depending on how much money you have, you might see fit to consult a good independent financial advisor instead of seeking advice from this website. A famous quote goes: “Those who say, do not know. Those who know, do not say”
"[Why Investors Buy Platinum](https://web.archive.org/web/20110911064316/https://www.cpmgroup.com/free_library1/GENERAL_ARTICLES_AND_COMMENTARIES/Why_Investors_Buy_Platinum_October_1995.pdf)" is an old (1995) article but still interesting to understand the answer to your question.
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[Platinum use](http://en.wikipedia.org/wiki/Platinum#Applications) is pretty heavily overweight in industrial areas; according to the linked Wikipedia article, 239 tonnes of platinum was sold in 2006, of which 130 tonnes went to vehicles emissions control devices and another 13.3 tonnes to electronics. [Gold sees subst...
[@Michael Kjörling](https://money.stackexchange.com/a/12753/4127) answered why platinum is in demand like it is. But it missed some of the significant risks so I will address some of them. Platinum is much more rare than gold. But not because there is less platinum than gold just that the known [existing platinum vein...
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[Platinum use](http://en.wikipedia.org/wiki/Platinum#Applications) is pretty heavily overweight in industrial areas; according to the linked Wikipedia article, 239 tonnes of platinum was sold in 2006, of which 130 tonnes went to vehicles emissions control devices and another 13.3 tonnes to electronics. [Gold sees subst...
"[Why Investors Buy Platinum](https://web.archive.org/web/20110911064316/https://www.cpmgroup.com/free_library1/GENERAL_ARTICLES_AND_COMMENTARIES/Why_Investors_Buy_Platinum_October_1995.pdf)" is an old (1995) article but still interesting to understand the answer to your question.
12,728
I'm considering moving some of my investments into physical precious metals in case the world economy tanks further. Both gold and platinum are near historical highs, but platinum has been more volatile. What are the pros & cons of investing in gold vs. investing in platinum?
2012/01/02
[ "https://money.stackexchange.com/questions/12728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/5419/" ]
[@Michael Kjörling](https://money.stackexchange.com/a/12753/4127) answered why platinum is in demand like it is. But it missed some of the significant risks so I will address some of them. Platinum is much more rare than gold. But not because there is less platinum than gold just that the known [existing platinum vein...
"[Why Investors Buy Platinum](https://web.archive.org/web/20110911064316/https://www.cpmgroup.com/free_library1/GENERAL_ARTICLES_AND_COMMENTARIES/Why_Investors_Buy_Platinum_October_1995.pdf)" is an old (1995) article but still interesting to understand the answer to your question.
15,894,357
I am using mysql with asp.net to save data in DB . When I save data in DB after using server.HTMLEncode(), the data is saved after removing \ . This is how I am saving data ``` INSERT INTO Users(ID,Name) Values(1,Server.HTMLEncode(User.Identity.Name)) ``` In this case if name is XXX\ABC , it is being saved as XXXAB...
2013/04/09
[ "https://Stackoverflow.com/questions/15894357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512393/" ]
HTML encoding is not suitable for encoding data for storage in the database. The reason that the backslashes disappears is that you are pasting together SQL code, and encoding the text for display in the web page instead of escaping it for being text in an SQL query. The backslash is used as escape character in MySQL,...
You could use the following: ``` var sqlQueryString = "INSERT INTO Users(ID,Name) Values(@Id,@Name)"; var sqlCommand = new SqlCommand(sqlQueryString, sqlConnection); sqlCommand.Parameters.Add(new SqlParameter("Id", 1); sqlCommand.Parameters.Add(new SqlParameter("Name", User.Identity.Name); sqlCommand.ExecuteNonQuery()...
799,765
Suppose that $g$ is some continuous function on $[c,d]$. Now also suppose that $g(x) = 0$ almost everywhere on the closed interval $[c,d]$. We would like to prove that $g(x) = 0$, $\forall x\in [c,d]$. My proof is to do the following: The set $X = \{x \in [c,d] \mid f(x) \neq 0\}$ is of measure zero. Now, suppose $X...
2014/05/18
[ "https://math.stackexchange.com/questions/799765", "https://math.stackexchange.com", "https://math.stackexchange.com/users/123276/" ]
The key fact to use here is that a set of full measure is dense. This follows immediately from noticing that its complement cannot contain any open intervals; do you see why?
You said "$X$ is open". Now just cite the fact that open sets have positive measure.
799,765
Suppose that $g$ is some continuous function on $[c,d]$. Now also suppose that $g(x) = 0$ almost everywhere on the closed interval $[c,d]$. We would like to prove that $g(x) = 0$, $\forall x\in [c,d]$. My proof is to do the following: The set $X = \{x \in [c,d] \mid f(x) \neq 0\}$ is of measure zero. Now, suppose $X...
2014/05/18
[ "https://math.stackexchange.com/questions/799765", "https://math.stackexchange.com", "https://math.stackexchange.com/users/123276/" ]
The key fact to use here is that a set of full measure is dense. This follows immediately from noticing that its complement cannot contain any open intervals; do you see why?
Let $x \in X$ and $\epsilon > 0$ be given. By continuity, there exists $\delta > 0$ such that $|x - y| < \delta $ implies that $|f(x) - f(y)| < \epsilon$. For every $\delta > 0$, there exists $z \in N\_{\delta}(x) \cap X^{c}$ since $m(X) = 0$. Therefore $|g(x)| = |g(x) - g(z)| < \epsilon$. Since $x \in X$ and $\epsilon...
1,878,814
How would I get notified of a value of a NSDatePicker, when it's changed?
2009/12/10
[ "https://Stackoverflow.com/questions/1878814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/228524/" ]
I've only done it on the iPhone with UIDatePicker but it is similar on the Mac, you register as a delegate and receive messages. See [Apple's Docs here](http://developer.apple.com/mac/library/documentation/cocoa/Reference/NSDatePickerCellDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSDatePickerCellDe...
You can bind the picker's `value` binding to a property of your controller, or a property of a model object (through a controller).
1,878,814
How would I get notified of a value of a NSDatePicker, when it's changed?
2009/12/10
[ "https://Stackoverflow.com/questions/1878814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/228524/" ]
I've only done it on the iPhone with UIDatePicker but it is similar on the Mac, you register as a delegate and receive messages. See [Apple's Docs here](http://developer.apple.com/mac/library/documentation/cocoa/Reference/NSDatePickerCellDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSDatePickerCellDe...
The same you would any other control. Options are: * Target/Action * Binding * Observe notification * Delegate
1,878,814
How would I get notified of a value of a NSDatePicker, when it's changed?
2009/12/10
[ "https://Stackoverflow.com/questions/1878814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/228524/" ]
The same you would any other control. Options are: * Target/Action * Binding * Observe notification * Delegate
You can bind the picker's `value` binding to a property of your controller, or a property of a model object (through a controller).
105,305
Flash manufactures often (always) specify the power in watt-seconds (Ws), and not in the SI unit joules (J). See and example for the [Godox studie flash QT series](http://www.godox.com/EN/Products_Studio_Flash_QTII_Series.html). Since the unit conversion says that W = J / s, so Ws = (J / s) \* s = J, thus the unit J c...
2019/02/22
[ "https://photo.stackexchange.com/questions/105305", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/37275/" ]
Well, it's convention. And the convention makes sense since J is an energy unit associated with work and heat in general while Ws is in terms of power (specifically electrical power) and time which are units relevant to the photographer. If I can shoot with 1kW of lighting at 1/10 sec, I can equivalently use a flash w...
Watts is a measure of continuous power. A 100 watt bulb consumes 100 watts if for a minute, or if it burns for a week. It is a 100 watt rate either way. Watts is Not the same as total energy consumed or produced. Watt seconds is the energy consumed for a period of time. 100 watts for one second is 100 watt seconds (10...
105,305
Flash manufactures often (always) specify the power in watt-seconds (Ws), and not in the SI unit joules (J). See and example for the [Godox studie flash QT series](http://www.godox.com/EN/Products_Studio_Flash_QTII_Series.html). Since the unit conversion says that W = J / s, so Ws = (J / s) \* s = J, thus the unit J c...
2019/02/22
[ "https://photo.stackexchange.com/questions/105305", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/37275/" ]
Well, it's convention. And the convention makes sense since J is an energy unit associated with work and heat in general while Ws is in terms of power (specifically electrical power) and time which are units relevant to the photographer. If I can shoot with 1kW of lighting at 1/10 sec, I can equivalently use a flash w...
Electronic flash evolved from giant units that plugged into wall outlets to heavy shoulder-borne battery compartments to in-camera units powered by AA size batteries. When I was a cub, I carried a “Little Giant” strobe loaded with “B” batteries. In those days portable radios used a twin voltage system. The “A” batterie...
105,305
Flash manufactures often (always) specify the power in watt-seconds (Ws), and not in the SI unit joules (J). See and example for the [Godox studie flash QT series](http://www.godox.com/EN/Products_Studio_Flash_QTII_Series.html). Since the unit conversion says that W = J / s, so Ws = (J / s) \* s = J, thus the unit J c...
2019/02/22
[ "https://photo.stackexchange.com/questions/105305", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/37275/" ]
Watts is a measure of continuous power. A 100 watt bulb consumes 100 watts if for a minute, or if it burns for a week. It is a 100 watt rate either way. Watts is Not the same as total energy consumed or produced. Watt seconds is the energy consumed for a period of time. 100 watts for one second is 100 watt seconds (10...
Electronic flash evolved from giant units that plugged into wall outlets to heavy shoulder-borne battery compartments to in-camera units powered by AA size batteries. When I was a cub, I carried a “Little Giant” strobe loaded with “B” batteries. In those days portable radios used a twin voltage system. The “A” batterie...
12,926,678
I've seen posts here on how to make a dictionary that has multiple values per key, like one of the solutions presented in this link: [Multi Value Dictionary](https://stackoverflow.com/questions/3850930/multi-value-dictionary) it seems that I have to use a List<> as the value for the keys, so that a key can store mult...
2012/10/17
[ "https://Stackoverflow.com/questions/12926678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1751868/" ]
TylerOhlsen's answer is a step in the right direction, but it has 6 key lookups (calls to Remove, ContainsKey, and the indexer). This can be reduced to three by using TryGetValue: ``` private Dictionary<TKey, List<TValue>> mEventDict; public void Subscribe(TKey inEvent, TValue inCallbackMethod) { List<TValue> lis...
Will it work? Not exactly the way you intended... * Your method parameters will need to be of the generic types. * List(T).Remove does not throw an ArgumentNullException. * You might want to clean up your dictionary if your list becomes empty. * The caller might not care if the callback was ever subscribed when they u...
12,926,678
I've seen posts here on how to make a dictionary that has multiple values per key, like one of the solutions presented in this link: [Multi Value Dictionary](https://stackoverflow.com/questions/3850930/multi-value-dictionary) it seems that I have to use a List<> as the value for the keys, so that a key can store mult...
2012/10/17
[ "https://Stackoverflow.com/questions/12926678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1751868/" ]
Will it work? Not exactly the way you intended... * Your method parameters will need to be of the generic types. * List(T).Remove does not throw an ArgumentNullException. * You might want to clean up your dictionary if your list becomes empty. * The caller might not care if the callback was ever subscribed when they u...
@phoog - so I want to keep the Unsubscribe method as `void` . After modifying your code, this is what I came up with... ``` public void Unsubscribe(TKey inEvent, TValue inCallbackMethod) { List<TValue> list; bool mRemoved = false. if (mEventDict.TryGetValue(inEvent, out list)) { list.Remove(i...
12,926,678
I've seen posts here on how to make a dictionary that has multiple values per key, like one of the solutions presented in this link: [Multi Value Dictionary](https://stackoverflow.com/questions/3850930/multi-value-dictionary) it seems that I have to use a List<> as the value for the keys, so that a key can store mult...
2012/10/17
[ "https://Stackoverflow.com/questions/12926678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1751868/" ]
TylerOhlsen's answer is a step in the right direction, but it has 6 key lookups (calls to Remove, ContainsKey, and the indexer). This can be reduced to three by using TryGetValue: ``` private Dictionary<TKey, List<TValue>> mEventDict; public void Subscribe(TKey inEvent, TValue inCallbackMethod) { List<TValue> lis...
@phoog - so I want to keep the Unsubscribe method as `void` . After modifying your code, this is what I came up with... ``` public void Unsubscribe(TKey inEvent, TValue inCallbackMethod) { List<TValue> list; bool mRemoved = false. if (mEventDict.TryGetValue(inEvent, out list)) { list.Remove(i...
47,095,235
I have an existing laravel project. I am running it on windows 10 machine. I am running the following command ``` cd c:/xampp/htdocs/demo/ (A file called index.php is there inside demo folder) php -S localhost:8000 ``` index.php file has contents as follows ``` <?php $uri = parse_url($_SERVER['REQUEST_URI'], PHP_...
2017/11/03
[ "https://Stackoverflow.com/questions/47095235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2541366/" ]
You can replace one of slash with another after getting mixed string Example : ``` $requested = $paths['public'].$uri; $requested = str_replace("\\", "/", $requested); ``` This will replace all `\` with `/`.
You can play with `real_path()` <http://php.net/manual/en/function.realpath.php> Another solution would be not to hardcode neither slash or a backslash and use `DIRECTORY_SEPARATOR` instead. It will output OS-specific path no matter where you run your code. ``` function file_build_path(...$segments) { return joi...