qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
109,263
I have been trying to imitate the gold standard of curries; The British Indian Restaurant (BIR) Chicken Madras and have had some success. I have made the base-curry sauce as per the books and it works out OK but there is a lot of preparation and the taste is not quite there. One thing about BIR Madras is that is it a...
2020/06/24
[ "https://cooking.stackexchange.com/questions/109263", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/84475/" ]
Let me try to at least start this one off… Your recipe, as it stands, isn't bad for the finalisation stage of the curry, but what you are seriously missing is the base sauce. The base sauce has all your depth, & a fair proportion of your texture & mouth-feel. Your 'tweaks' are just what is needed to get the chicken r...
This is a difficult question to answer, as there's a lot of things that can potentially make a difference, including ingredient selection. I'm going to run through a things that I think might improve your dish (although, it might not give you exactly what you're trying to emulate). I wouldn't recommend putting in the ...
109,263
I have been trying to imitate the gold standard of curries; The British Indian Restaurant (BIR) Chicken Madras and have had some success. I have made the base-curry sauce as per the books and it works out OK but there is a lot of preparation and the taste is not quite there. One thing about BIR Madras is that is it a...
2020/06/24
[ "https://cooking.stackexchange.com/questions/109263", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/84475/" ]
Let me try to at least start this one off… Your recipe, as it stands, isn't bad for the finalisation stage of the curry, but what you are seriously missing is the base sauce. The base sauce has all your depth, & a fair proportion of your texture & mouth-feel. Your 'tweaks' are just what is needed to get the chicken r...
The other answers have some great ideas for how to deepen the flavor of your curry! However, even if you are not interested in significantly changing your process, I think we can solve your immediate problem: > > my curry is too sour > > > Let's take a look at the acidic ingredients you are using. I see three: 1...
109,263
I have been trying to imitate the gold standard of curries; The British Indian Restaurant (BIR) Chicken Madras and have had some success. I have made the base-curry sauce as per the books and it works out OK but there is a lot of preparation and the taste is not quite there. One thing about BIR Madras is that is it a...
2020/06/24
[ "https://cooking.stackexchange.com/questions/109263", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/84475/" ]
Let me try to at least start this one off… Your recipe, as it stands, isn't bad for the finalisation stage of the curry, but what you are seriously missing is the base sauce. The base sauce has all your depth, & a fair proportion of your texture & mouth-feel. Your 'tweaks' are just what is needed to get the chicken r...
I'm a bit of a heretic when it comes to curries, but I think they turn out great. In addition to using stock instead of water, I suggest you try beef stock instead of chicken (unless cows are holy to you), or possibly mushroom stock. I also improve the taste of my curries by adding a small amount of soy sauce; like o...
109,263
I have been trying to imitate the gold standard of curries; The British Indian Restaurant (BIR) Chicken Madras and have had some success. I have made the base-curry sauce as per the books and it works out OK but there is a lot of preparation and the taste is not quite there. One thing about BIR Madras is that is it a...
2020/06/24
[ "https://cooking.stackexchange.com/questions/109263", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/84475/" ]
This is a difficult question to answer, as there's a lot of things that can potentially make a difference, including ingredient selection. I'm going to run through a things that I think might improve your dish (although, it might not give you exactly what you're trying to emulate). I wouldn't recommend putting in the ...
I'm a bit of a heretic when it comes to curries, but I think they turn out great. In addition to using stock instead of water, I suggest you try beef stock instead of chicken (unless cows are holy to you), or possibly mushroom stock. I also improve the taste of my curries by adding a small amount of soy sauce; like o...
109,263
I have been trying to imitate the gold standard of curries; The British Indian Restaurant (BIR) Chicken Madras and have had some success. I have made the base-curry sauce as per the books and it works out OK but there is a lot of preparation and the taste is not quite there. One thing about BIR Madras is that is it a...
2020/06/24
[ "https://cooking.stackexchange.com/questions/109263", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/84475/" ]
The other answers have some great ideas for how to deepen the flavor of your curry! However, even if you are not interested in significantly changing your process, I think we can solve your immediate problem: > > my curry is too sour > > > Let's take a look at the acidic ingredients you are using. I see three: 1...
I'm a bit of a heretic when it comes to curries, but I think they turn out great. In addition to using stock instead of water, I suggest you try beef stock instead of chicken (unless cows are holy to you), or possibly mushroom stock. I also improve the taste of my curries by adding a small amount of soy sauce; like o...
42,424,999
I'm new to C# but trying to use an enum. The enum is as follows: ``` public enum PARAM : int { ROLL = 1, PITCH, YAW, MAGX, MAGY, MAGZ, BCA, OAT, IAS, TAS, VOLTS, AOA }; ``` I'm using it as follows: ``` AhrsCom.setCommand("$out=" + PARAM.PITCH + ",10\n\r"); ``` However, it passes the following string to `setComman...
2017/02/23
[ "https://Stackoverflow.com/questions/42424999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7613263/" ]
you need ``` AhrsCom.setCommand("$out=" + (int)PARAM.PITCH + ",10\n\r"); ``` to say you want the number, not the string
You can cast this way: ``` AhrsCom.setCommand("$out=" + (int)PARAM.PITCH + ",10\n\r"); ```
42,424,999
I'm new to C# but trying to use an enum. The enum is as follows: ``` public enum PARAM : int { ROLL = 1, PITCH, YAW, MAGX, MAGY, MAGZ, BCA, OAT, IAS, TAS, VOLTS, AOA }; ``` I'm using it as follows: ``` AhrsCom.setCommand("$out=" + PARAM.PITCH + ",10\n\r"); ``` However, it passes the following string to `setComman...
2017/02/23
[ "https://Stackoverflow.com/questions/42424999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7613263/" ]
You can cast the enum to an `int` to gets it numeric value: ``` AhrsCom.setCommand("$out=" + (int)PARAM.PITCH + ",10\n\r"); ```
You can cast this way: ``` AhrsCom.setCommand("$out=" + (int)PARAM.PITCH + ",10\n\r"); ```
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
During 2 days, i tried many ways : - responseEntity - httpheaders - XML etc... For a JSON (default behavior), the project need a library with all Spring library. Here the library to declare in Maven project. ``` <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> ...
Actually you have to use REST web service that carry JSON/XML format as Objects representation. I prefer JSON because this is very light weight. First you need to add dependency in your Pom.xml ``` <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.7.1</version...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
Yes, when your controller method in annotated with `@ResponseBody`, Spring transforms returned data into [JSON](http://json.org/).
@ResponseBody will automatically encode the object you return to appropriate formats based on the Accept header of the request and the presence of JSON and/or XML libraries in the classpath. It can be easier/safer to define your own object to wrap the list in though rather than returning the list directly - as that gi...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
You should rather use `ResponseEntity` for that. `@ResponseBody` gives you absolutely no control over the response.
You can build REST services using spring mvc framework. It will return JSON / XML. And call those services using HTTP clients / rest templates and use returned JSON to display information. Spring controllers can return an object, list of objects as well. And some mappings (Jackson and JAXB) will allow it to convert ob...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
Yes, when your controller method in annotated with `@ResponseBody`, Spring transforms returned data into [JSON](http://json.org/).
You should rather use `ResponseEntity` for that. `@ResponseBody` gives you absolutely no control over the response.
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
Yes, when your controller method in annotated with `@ResponseBody`, Spring transforms returned data into [JSON](http://json.org/).
You can build REST services using spring mvc framework. It will return JSON / XML. And call those services using HTTP clients / rest templates and use returned JSON to display information. Spring controllers can return an object, list of objects as well. And some mappings (Jackson and JAXB) will allow it to convert ob...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
Yes, when your controller method in annotated with `@ResponseBody`, Spring transforms returned data into [JSON](http://json.org/).
Actually you have to use REST web service that carry JSON/XML format as Objects representation. I prefer JSON because this is very light weight. First you need to add dependency in your Pom.xml ``` <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.7.1</version...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
You should rather use `ResponseEntity` for that. `@ResponseBody` gives you absolutely no control over the response.
Actually you have to use REST web service that carry JSON/XML format as Objects representation. I prefer JSON because this is very light weight. First you need to add dependency in your Pom.xml ``` <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.7.1</version...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
During 2 days, i tried many ways : - responseEntity - httpheaders - XML etc... For a JSON (default behavior), the project need a library with all Spring library. Here the library to declare in Maven project. ``` <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> ...
You can build REST services using spring mvc framework. It will return JSON / XML. And call those services using HTTP clients / rest templates and use returned JSON to display information. Spring controllers can return an object, list of objects as well. And some mappings (Jackson and JAXB) will allow it to convert ob...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
The `@ResponseBody` annotation tells Spring that we will be returning data in the response body rather than rendering a JSP. When the `@ResponseBody` annotation is used, Spring will return the data in a format that is acceptable to the client. That is, if the client request has a header to accept json and Jackson-Mapp...
Actually you have to use REST web service that carry JSON/XML format as Objects representation. I prefer JSON because this is very light weight. First you need to add dependency in your Pom.xml ``` <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.7.1</version...
20,515,607
We would like to create a "WebService" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients library. At this moment, if we call the webservice from Firefox, an 406 error page appears. Do we have to use JSON or XML to transfert the list ? H...
2013/12/11
[ "https://Stackoverflow.com/questions/20515607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540241/" ]
The `@ResponseBody` annotation tells Spring that we will be returning data in the response body rather than rendering a JSP. When the `@ResponseBody` annotation is used, Spring will return the data in a format that is acceptable to the client. That is, if the client request has a header to accept json and Jackson-Mapp...
You should rather use `ResponseEntity` for that. `@ResponseBody` gives you absolutely no control over the response.
5,952,200
I got a Makefile like the following: ``` .PHONY: all all: aaa.2 bbb.2 aaa.2 : aaa.1 common.1 create_2 $@ bbb.2 : bbb.1 common.1 create_2 $@ ``` The program create\_2 takes long time to start, but is able to create several %.2 files at once, therefore I would like to invoke create\_2 only once. For exampl...
2011/05/10
[ "https://Stackoverflow.com/questions/5952200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/685961/" ]
Make is basically file-oriented, and what you want is something process-oriented, so... maybe that excuses the fact that this is a horrible kludge: ``` .PHONY: all all: marker aaa.2 : aaa.1 common.1 @touch $@ bbb.2 : bbb.1 common.1 @touch $@ marker: aaa.2 bbb.2 create_2 $? @touch $@ ``` Note that...
This hack might help you out: ``` .PHONY: all all: file1 file2 >---@if [ -f work ]; then \ >--->---touch file1 file2; \ >--->---echo "touch file1 file 2"; \ >---fi >---rm -f work file1: >---touch work file2: >---touch work ``` This causes both files to be rebuilt if any of them need rebuilding. You could probably ...
52,008,743
I want to know if a certain ID has a certain function turned on. but the functions are in other table. Table 1: ``` userID Name 1 aaa 2 bbb 3 ccc ``` Table 2: ``` functionID useID 1 1 2 1 2 2 3 2 1 3 3 3 ``` Table3 ```...
2018/08/24
[ "https://Stackoverflow.com/questions/52008743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10270581/" ]
You can try to use `JOIN` with conditional aggregate function ``` create table Table1( userID int, Name varchar(50) ); insert into Table1 values (1,'aaa'); insert into Table1 values (2,'bbb'); insert into Table1 values (3,'ccc'); create table Table2( functionID int, userID int ); insert into Table2 values...
``` SELECT t1.userID, t1.Name , CASE WHEN COUNT(CASE WHEN t2.functionID = 1 THEN 1 ELSE NULL END) > 0 THEN 'True' ELSE 'False' END AS function1Enabled , CASE WHEN COUNT(CASE WHEN t2.functionID = 2 THEN 1 ELSE NULL END) > 0 THEN 'True' ELSE 'False' END AS function2Enabled .... and so on FROM table1 AS t1 LEFT J...
35,468,570
I get a 'Cordova/CDVViewController.h' file not found build error when creating a new configuration for a Cordova project. I did try adding "$(OBJROOT)/UninstalledProducts/$(PLATFORM\_NAME)/include" to the project Header Search Paths as suggested in many forums, no luck. I'm using: * Cordova 3.4.1 * Xcode 7.2.1 Steps...
2016/02/17
[ "https://Stackoverflow.com/questions/35468570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427425/" ]
I had the same problem for a couple of weeks. Now I found the answer [here](https://cordovablogsblogs.wordpress.com/2015/12/29/cdvplugin-h-file-not-found-in-cordova-as-component-cleaver/) If you want to add a new configuration by duplicating for example "Debug" to be able to change some build setting, you have to add ...
For me the `$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include` was already in the *Header Search Paths* (using XCode 8). I then added to *User Header Search Paths* the specific path to `CordovaLib` folder, with `recursive` option enabled (for unexperienced XCode users like myself, select the project in the tree v...
35,468,570
I get a 'Cordova/CDVViewController.h' file not found build error when creating a new configuration for a Cordova project. I did try adding "$(OBJROOT)/UninstalledProducts/$(PLATFORM\_NAME)/include" to the project Header Search Paths as suggested in many forums, no luck. I'm using: * Cordova 3.4.1 * Xcode 7.2.1 Steps...
2016/02/17
[ "https://Stackoverflow.com/questions/35468570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427425/" ]
I had the same problem for a couple of weeks. Now I found the answer [here](https://cordovablogsblogs.wordpress.com/2015/12/29/cdvplugin-h-file-not-found-in-cordova-as-component-cleaver/) If you want to add a new configuration by duplicating for example "Debug" to be able to change some build setting, you have to add ...
In my case, it turned out that something had gone wrong when adding the ios platform (I had a missing image file). I removed the platform with: ``` ionic platform rm ios ``` And then added it back with: ``` ionic platform add ios ``` If this doesn't work, make sure you have the latest Xcode (update using the app ...
35,468,570
I get a 'Cordova/CDVViewController.h' file not found build error when creating a new configuration for a Cordova project. I did try adding "$(OBJROOT)/UninstalledProducts/$(PLATFORM\_NAME)/include" to the project Header Search Paths as suggested in many forums, no luck. I'm using: * Cordova 3.4.1 * Xcode 7.2.1 Steps...
2016/02/17
[ "https://Stackoverflow.com/questions/35468570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427425/" ]
In my case, it turned out that something had gone wrong when adding the ios platform (I had a missing image file). I removed the platform with: ``` ionic platform rm ios ``` And then added it back with: ``` ionic platform add ios ``` If this doesn't work, make sure you have the latest Xcode (update using the app ...
For me the `$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include` was already in the *Header Search Paths* (using XCode 8). I then added to *User Header Search Paths* the specific path to `CordovaLib` folder, with `recursive` option enabled (for unexperienced XCode users like myself, select the project in the tree v...
5,936,403
how can we convert html to well formed xhtml by using Http class api,if possible please give a demonstration code....thanks
2011/05/09
[ "https://Stackoverflow.com/questions/5936403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/660464/" ]
I just did it using Jsoup, if it works for you: ``` private String htmlToXhtml(final String html) { final Document document = Jsoup.parse(html); document.outputSettings().syntax(Document.OutputSettings.Syntax.xml); return document.html(); } ``` Some useful content where my solution came from: * [Is it p...
Have a look at J-Tidy: <http://jtidy.sourceforge.net/> It usually does a quite good job cleaning up messy html and converting it to xhtml.
5,936,403
how can we convert html to well formed xhtml by using Http class api,if possible please give a demonstration code....thanks
2011/05/09
[ "https://Stackoverflow.com/questions/5936403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/660464/" ]
Have a look at J-Tidy: <http://jtidy.sourceforge.net/> It usually does a quite good job cleaning up messy html and converting it to xhtml.
You can use the following method to get xhtml from html ``` public static String getXHTMLFromHTML(String inputFile, String outputFile) throws Exception { File file = new File(inputFile); FileOutputStream fos = null; InputStream is = null; try { fos = new FileOut...
5,936,403
how can we convert html to well formed xhtml by using Http class api,if possible please give a demonstration code....thanks
2011/05/09
[ "https://Stackoverflow.com/questions/5936403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/660464/" ]
I just did it using Jsoup, if it works for you: ``` private String htmlToXhtml(final String html) { final Document document = Jsoup.parse(html); document.outputSettings().syntax(Document.OutputSettings.Syntax.xml); return document.html(); } ``` Some useful content where my solution came from: * [Is it p...
You can use the following method to get xhtml from html ``` public static String getXHTMLFromHTML(String inputFile, String outputFile) throws Exception { File file = new File(inputFile); FileOutputStream fos = null; InputStream is = null; try { fos = new FileOut...
146,715
I was trying use span and style tags in pages, rather than in CSS and it seems that Drupal is configured to strip them out whether the input format is *Filtered HTML*, i.e. they are applied to *Full HTML*. Is that something which can be fixed only by editing the core files, or are the some modules or settings in Drupa...
2015/02/07
[ "https://drupal.stackexchange.com/questions/146715", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3258/" ]
Go to Configuration -> Content Authoring -> Text formats. Here you can configure what tags are allowed. All unallowed tags are stripped out, is always stripped out. Check out <https://www.drupal.org/project/wysiwyg_filter> for more advanced filtering.
To configure Text Formats you can go to /admin/config/content/formats > > A text format contains filters that change the user input, for example stripping out malicious HTML or making URLs clickable. Filters are executed from top to bottom and the order is important, since one filter may prevent another filter from ...
146,715
I was trying use span and style tags in pages, rather than in CSS and it seems that Drupal is configured to strip them out whether the input format is *Filtered HTML*, i.e. they are applied to *Full HTML*. Is that something which can be fixed only by editing the core files, or are the some modules or settings in Drupa...
2015/02/07
[ "https://drupal.stackexchange.com/questions/146715", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3258/" ]
Go to Configuration -> Content Authoring -> Text formats. Here you can configure what tags are allowed. All unallowed tags are stripped out, is always stripped out. Check out <https://www.drupal.org/project/wysiwyg_filter> for more advanced filtering.
Are you using a WYSIWYG module like "CKEditor - WYSIWYG HTML"? It appears to be this module or the CKEditor itself that is wrongly stripping out correct HTML such as inline styles, not Drupal. There is a bug report open here <https://www.drupal.org/node/778200> My current workaround is to disable the editor when add...
146,715
I was trying use span and style tags in pages, rather than in CSS and it seems that Drupal is configured to strip them out whether the input format is *Filtered HTML*, i.e. they are applied to *Full HTML*. Is that something which can be fixed only by editing the core files, or are the some modules or settings in Drupa...
2015/02/07
[ "https://drupal.stackexchange.com/questions/146715", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3258/" ]
Go to Configuration -> Content Authoring -> Text formats. Here you can configure what tags are allowed. All unallowed tags are stripped out, is always stripped out. Check out <https://www.drupal.org/project/wysiwyg_filter> for more advanced filtering.
As authtentictech noted above, disabling the editor can work (I create a text format of Full HTML-No Editor) to deal with the edge cases where this can pop up. Here, it's only straight code that is put in--no WYSIWYG editor is allowed for that format). It can get really annoying when having to collaborate with editors...
146,715
I was trying use span and style tags in pages, rather than in CSS and it seems that Drupal is configured to strip them out whether the input format is *Filtered HTML*, i.e. they are applied to *Full HTML*. Is that something which can be fixed only by editing the core files, or are the some modules or settings in Drupa...
2015/02/07
[ "https://drupal.stackexchange.com/questions/146715", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3258/" ]
Are you using a WYSIWYG module like "CKEditor - WYSIWYG HTML"? It appears to be this module or the CKEditor itself that is wrongly stripping out correct HTML such as inline styles, not Drupal. There is a bug report open here <https://www.drupal.org/node/778200> My current workaround is to disable the editor when add...
To configure Text Formats you can go to /admin/config/content/formats > > A text format contains filters that change the user input, for example stripping out malicious HTML or making URLs clickable. Filters are executed from top to bottom and the order is important, since one filter may prevent another filter from ...
146,715
I was trying use span and style tags in pages, rather than in CSS and it seems that Drupal is configured to strip them out whether the input format is *Filtered HTML*, i.e. they are applied to *Full HTML*. Is that something which can be fixed only by editing the core files, or are the some modules or settings in Drupa...
2015/02/07
[ "https://drupal.stackexchange.com/questions/146715", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3258/" ]
As authtentictech noted above, disabling the editor can work (I create a text format of Full HTML-No Editor) to deal with the edge cases where this can pop up. Here, it's only straight code that is put in--no WYSIWYG editor is allowed for that format). It can get really annoying when having to collaborate with editors...
To configure Text Formats you can go to /admin/config/content/formats > > A text format contains filters that change the user input, for example stripping out malicious HTML or making URLs clickable. Filters are executed from top to bottom and the order is important, since one filter may prevent another filter from ...
541
I certainly don't think inquiries about Magento 2 belong in the magento.stackexchange; can we hurry up and confirm/enforce this? I feel all inquiries should be directed at the brand and/or the repository.
2015/03/15
[ "https://magento.meta.stackexchange.com/questions/541", "https://magento.meta.stackexchange.com", "https://magento.meta.stackexchange.com/users/5506/" ]
Magento 2 questions are allowed. They should just be tagged with the proper version to make a difference between pre-alpha, alpha, beta, rc and official release.
I think some question which fit squarely into the "issues" bucket *belong* on GitHub. But for questions which do not rise to the level of "hey something's broken" or "hey I have an architectural suggestion / improvement" are noise in a GitHub context. My opinion of course, and curious to hear the opinions of others.
541
I certainly don't think inquiries about Magento 2 belong in the magento.stackexchange; can we hurry up and confirm/enforce this? I feel all inquiries should be directed at the brand and/or the repository.
2015/03/15
[ "https://magento.meta.stackexchange.com/questions/541", "https://magento.meta.stackexchange.com", "https://magento.meta.stackexchange.com/users/5506/" ]
Magento 2 questions are allowed. They should just be tagged with the proper version to make a difference between pre-alpha, alpha, beta, rc and official release.
Here is my two cents. Magento 2 is the newest edition of Magento. If a question clearly states it is related to Magento 2 I see absolutely no reason why it does not belong on magento.stackexchange.com.
541
I certainly don't think inquiries about Magento 2 belong in the magento.stackexchange; can we hurry up and confirm/enforce this? I feel all inquiries should be directed at the brand and/or the repository.
2015/03/15
[ "https://magento.meta.stackexchange.com/questions/541", "https://magento.meta.stackexchange.com", "https://magento.meta.stackexchange.com/users/5506/" ]
I think some question which fit squarely into the "issues" bucket *belong* on GitHub. But for questions which do not rise to the level of "hey something's broken" or "hey I have an architectural suggestion / improvement" are noise in a GitHub context. My opinion of course, and curious to hear the opinions of others.
Here is my two cents. Magento 2 is the newest edition of Magento. If a question clearly states it is related to Magento 2 I see absolutely no reason why it does not belong on magento.stackexchange.com.
31,311,625
I cast a string to int, like this: ``` <tr class="@(item.Id == (int)(Session["Id"] ?? 0) ? "sfs-selected sfs-selectable" : String.Empty)"> ``` item.Id is a int But then I get this error: ``` Specified cast is not valid. ``` Thank you This is my Index method: ``` [Route("sort/{SortColumn}/{SortOrder?}", Name...
2015/07/09
[ "https://Stackoverflow.com/questions/31311625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4870602/" ]
all you need is below :- ``` <tr class="@(item.Id == Convert.ToInt32(Session["Id"]) ? "sfs-selected sfs-selectable" : String.Empty)"> ``` Because Convert.ToInt32(null) returns 0 in c#
I think you should cast it like this ``` int.Parse(Session["Id"].ToString()) ``` **Edit** As Neel noted Use `.TryParse()` to avoid excception in case of `Session["id"]` is `null` ``` int.TryParse(Session["Id"].ToString(), out someIntVariable) ```
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
**Hint:** Alternately, by AM-GM, note $x^4+\frac14x^2\geqslant x^3$ and $\frac12x^2+\frac12\geqslant x$, so $x^4-x^3+x^2-x+1 \geqslant \frac14x^2+\frac12>\frac12$ as equality is not possible.
So you have done some good work. Now the function is always positive for $x \not \in (0,1)$. Now lets analyse in this interval. In $(0,1)$, $x^2+1$ lies in $(1,2)$ and $x(x-1)$ has a minimum of only $-1/4$ at $x=1/2$. Thats enough to conclude that $x(x-1)(x^2+1) > -1/2$.
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
So you have done some good work. Now the function is always positive for $x \not \in (0,1)$. Now lets analyse in this interval. In $(0,1)$, $x^2+1$ lies in $(1,2)$ and $x(x-1)$ has a minimum of only $-1/4$ at $x=1/2$. Thats enough to conclude that $x(x-1)(x^2+1) > -1/2$.
We have to prove $$x^4-x^3+x^2-x+0.5>0\forall x\in\mathbb{R}$$ So let $$f(x)=\frac{1}{2}\bigg[2x^4-2x^3+2x^2-2x+1\bigg]$$ $$f(x)=\frac{1}{2}\bigg[x^4+(x^2-x)^2+(x-1)^2\bigg]>0\forall x\in\mathbb{R}$$
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
**Hint:** Alternately, by AM-GM, note $x^4+\frac14x^2\geqslant x^3$ and $\frac12x^2+\frac12\geqslant x$, so $x^4-x^3+x^2-x+1 \geqslant \frac14x^2+\frac12>\frac12$ as equality is not possible.
We have to prove $$x^4-x^3+x^2-x+0.5>0\forall x\in\mathbb{R}$$ So let $$f(x)=\frac{1}{2}\bigg[2x^4-2x^3+2x^2-2x+1\bigg]$$ $$f(x)=\frac{1}{2}\bigg[x^4+(x^2-x)^2+(x-1)^2\bigg]>0\forall x\in\mathbb{R}$$
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
**Hint:** Alternately, by AM-GM, note $x^4+\frac14x^2\geqslant x^3$ and $\frac12x^2+\frac12\geqslant x$, so $x^4-x^3+x^2-x+1 \geqslant \frac14x^2+\frac12>\frac12$ as equality is not possible.
You can note that the inequality holds for $x=-1$. For $x\ne-1$ it is equivalent to $$ \frac{x^5+1}{x+1}>\frac{1}{2} $$ that can be rewritten as $$ \frac{2x^5-x+1}{x+1}>0 $$ Let's analyze $f(x)=2x^5-x+1$, with $f'(x)=10x^4-1$, which vanishes for $x=\pm10^{-1/4}$. So $f$ has a relative maximum at $-10^{-1/4}$ and a rela...
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
Factorise and complete the square of the first bit to understand function: $$\begin{align\*} x^4-x^3+x^2-x+0.5&=x^4+x^2-(x^3+x)+\frac12\\ &=x(x^2+1)(x-1)+\frac12\\ &=(x^2+1)(x^2-1)+\frac12\\ &=(x^2+1)\left[(x-\frac12)^2-\frac14\right]+\frac12 \end{align\*}$$ Then $(x^2+1)\left[(x-\frac12)^2-\frac14\right]\geq-\frac14$,...
We have to prove $$x^4-x^3+x^2-x+0.5>0\forall x\in\mathbb{R}$$ So let $$f(x)=\frac{1}{2}\bigg[2x^4-2x^3+2x^2-2x+1\bigg]$$ $$f(x)=\frac{1}{2}\bigg[x^4+(x^2-x)^2+(x-1)^2\bigg]>0\forall x\in\mathbb{R}$$
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
Ok you already proved it if $x \in (-\infty ,0]\cup [1,+\infty) $ , it suffice to prove it for $x\in (0,1)$ to conclude : you can write it as , $(x^{2}-\frac{x}{2})^{2}+\frac{3x^{2}}{4}-x+\frac{1}{2}=(x^{2}-\frac{x}{2})^{2}+\frac{x^{2}}{4}+\frac{1}{2} (x-1)^{2}$
We have to prove $$x^4-x^3+x^2-x+0.5>0\forall x\in\mathbb{R}$$ So let $$f(x)=\frac{1}{2}\bigg[2x^4-2x^3+2x^2-2x+1\bigg]$$ $$f(x)=\frac{1}{2}\bigg[x^4+(x^2-x)^2+(x-1)^2\bigg]>0\forall x\in\mathbb{R}$$
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
**Hint:** Alternately, by AM-GM, note $x^4+\frac14x^2\geqslant x^3$ and $\frac12x^2+\frac12\geqslant x$, so $x^4-x^3+x^2-x+1 \geqslant \frac14x^2+\frac12>\frac12$ as equality is not possible.
For $0 \leqslant x \leqslant 1$,$$ x(x - 1)(x^2 + 1) \geqslant \left(-\frac{1}{4}\right)(x^2 + 1) > \left(-\frac{1}{4}\right) \times 2 = -\frac{1}{2}. $$ For $x < 0$ or $x > 1$,$$ x(x - 1)(x^2 + 1) > 0 > -\frac{1}{2}. $$
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
**Hint:** Alternately, by AM-GM, note $x^4+\frac14x^2\geqslant x^3$ and $\frac12x^2+\frac12\geqslant x$, so $x^4-x^3+x^2-x+1 \geqslant \frac14x^2+\frac12>\frac12$ as equality is not possible.
Ok you already proved it if $x \in (-\infty ,0]\cup [1,+\infty) $ , it suffice to prove it for $x\in (0,1)$ to conclude : you can write it as , $(x^{2}-\frac{x}{2})^{2}+\frac{3x^{2}}{4}-x+\frac{1}{2}=(x^{2}-\frac{x}{2})^{2}+\frac{x^{2}}{4}+\frac{1}{2} (x-1)^{2}$
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
**Hint:** Alternately, by AM-GM, note $x^4+\frac14x^2\geqslant x^3$ and $\frac12x^2+\frac12\geqslant x$, so $x^4-x^3+x^2-x+1 \geqslant \frac14x^2+\frac12>\frac12$ as equality is not possible.
Factorise and complete the square of the first bit to understand function: $$\begin{align\*} x^4-x^3+x^2-x+0.5&=x^4+x^2-(x^3+x)+\frac12\\ &=x(x^2+1)(x-1)+\frac12\\ &=(x^2+1)(x^2-1)+\frac12\\ &=(x^2+1)\left[(x-\frac12)^2-\frac14\right]+\frac12 \end{align\*}$$ Then $(x^2+1)\left[(x-\frac12)^2-\frac14\right]\geq-\frac14$,...
2,670,433
> > Show that > $$x^4-x^3+x^2-x+1>\frac{1}{2}. \quad \forall x \in \mathbb{R}$$ > > > Let $x \in \mathbb{R}$, \begin{align\*} &\mathrel{\phantom{=}}x^4-x^3+x^2-x+1-\frac{1}{2}=x^4-x^3+x^2-x+\dfrac{1}{2}\\ &=x^2(x^2-x)+(x^2-x)+\dfrac{1}{2}=(x^2-x)(x^2+1)+\dfrac{1}{2}\\ &=x(x-1)(x^2+1)+\dfrac{1}{2}. \end{align\*} ...
2018/02/28
[ "https://math.stackexchange.com/questions/2670433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76444/" ]
For $0 \leqslant x \leqslant 1$,$$ x(x - 1)(x^2 + 1) \geqslant \left(-\frac{1}{4}\right)(x^2 + 1) > \left(-\frac{1}{4}\right) \times 2 = -\frac{1}{2}. $$ For $x < 0$ or $x > 1$,$$ x(x - 1)(x^2 + 1) > 0 > -\frac{1}{2}. $$
We have to prove $$x^4-x^3+x^2-x+0.5>0\forall x\in\mathbb{R}$$ So let $$f(x)=\frac{1}{2}\bigg[2x^4-2x^3+2x^2-2x+1\bigg]$$ $$f(x)=\frac{1}{2}\bigg[x^4+(x^2-x)^2+(x-1)^2\bigg]>0\forall x\in\mathbb{R}$$
63,162,910
I previously created code to clean out a spreadsheet. It worked perfectly but it seems that O365 updated and the code broke. I am still recuperating from COVID and I am having a hard time reading this as my vision was imapcted permanenetly. Could anyone help me understand why it's breaking and where I went wrong? I've...
2020/07/29
[ "https://Stackoverflow.com/questions/63162910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9608869/" ]
> > Do I have to request a download URL every time I want to retrieve an image from storage? > > > No, you can use the same URL repeatedly. Store that URL anywhere you like. But you will always pay the cost for egress every time the URL is accessed. There are no free downloads after the free allowance. > > Is th...
Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources.", "status": "ACCESS\_BUCKET"
106,434
**How many monitors can be hooked up to a Mac Mini?** I've only ever hooked a Mac Mini up to 2 monitors, but I'm interested in going up to at least 4. Is this even possible? According to [Apple's Mac Mini feature description page](http://www.apple.com/mac-mini/features.html "Apple's Mac Mini features description site...
2013/10/23
[ "https://apple.stackexchange.com/questions/106434", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/60251/" ]
Only one Mac Mini (to date) has supported three simultaneous monitors. The Mid 2011 Mac Mini (Macmini5,2) came with an AMD Radeon HD 6630M that was powerful enough to drive two Thunderbolt displays while simultaneously driving an HDMI display. [1](http://support.apple.com/kb/HT5219#dispnum) The current Late 2012 Mac M...
Intel Haswell can support 3 monitors, so when the new 2013 Mac Mini is finally released it may support 3 monitors as well.
50,535,622
I've got some data like this: ``` const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] ``` The length of `items` is always different. Now I need to get all unique reference strings in a single array. So the result should be ``` ['abc', 'def'] ...
2018/05/25
[ "https://Stackoverflow.com/questions/50535622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3142695/" ]
If you wanna do a functional style (map-reduce), you can do it like this ```js const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] // extract references and put them into a single array const references = items .map(x => x.refere...
If you want to use Sets, you can use `Set.add`, and [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax): ```js const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] var references = new S...
50,535,622
I've got some data like this: ``` const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] ``` The length of `items` is always different. Now I need to get all unique reference strings in a single array. So the result should be ``` ['abc', 'def'] ...
2018/05/25
[ "https://Stackoverflow.com/questions/50535622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3142695/" ]
If you want to use Sets, you can use `Set.add`, and [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax): ```js const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] var references = new S...
This is similar to other solutions here, but creates a reusable function: ```js const uniqRefs = items => [...items.reduce((s, i) => s.add(...i.reference), new Set())] const items = [{"_id": "1", "reference": ["abc"]}, {"_id": "2", "reference": ["def"]}, {"_id": "3", "reference": ["abc"]}] console.log(uniqRefs(...
50,535,622
I've got some data like this: ``` const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] ``` The length of `items` is always different. Now I need to get all unique reference strings in a single array. So the result should be ``` ['abc', 'def'] ...
2018/05/25
[ "https://Stackoverflow.com/questions/50535622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3142695/" ]
If you wanna do a functional style (map-reduce), you can do it like this ```js const items = [ { _id: '1', reference: ['abc'] }, { _id: '2', reference: ['def'] }, { _id: '3', reference: ['abc'] } ] // extract references and put them into a single array const references = items .map(x => x.refere...
This is similar to other solutions here, but creates a reusable function: ```js const uniqRefs = items => [...items.reduce((s, i) => s.add(...i.reference), new Set())] const items = [{"_id": "1", "reference": ["abc"]}, {"_id": "2", "reference": ["def"]}, {"_id": "3", "reference": ["abc"]}] console.log(uniqRefs(...
64,946,675
I'm using RxJS to process an event stream. Quite a few events could be dispatched and the end processing code is "relatively expensive", eg. Load a file, do some work, save some stuff to a database. ```js const rx = require("rxjs") // simulate a lot of events const observable = rx.interval(1) // subscribe to the eve...
2020/11/21
[ "https://Stackoverflow.com/questions/64946675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96338/" ]
You want `concatMap` (<https://www.learnrxjs.io/learn-rxjs/operators/transformation/concatmap>). `concatMap` will map the value emitted from a source Observable to a value emitted by some inner Observable, and it won't move on to the next value from the source until the inner Observable completes. ``` const source = ...
Will's solution does not work for me. I've written a [TaskQueue] to make sure every single action can be triggered by certain rules, even with multiple observables. Here's a demo: <https://codesandbox.io/s/task-queue-for-rxjs-g1prs6?file=/src/App.js> Code is here: <https://github.com/captain-martin/task-queue-for-rxj...
12,308,161
I'm using an event `PreviewKeyDown`, and am adding the key in a list of key, as shown in the example below: ``` List<Key> keys = new List<Key>(); private void MDIChildBackground_PreviewKeyDown(object sender, KeyEventArgs e) { keys.Add(e.Key); } ``` Then I wanted to take the keys from...
2012/09/06
[ "https://Stackoverflow.com/questions/12308161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1620961/" ]
You could use the [KeyInterop.VirtualKeyFromKey](http://msdn.microsoft.com/en-us/library/system.windows.input.keyinterop.virtualkeyfromkey%28v=vs.100%29) method to convert a WPF Key into a Win32 Virtual-Key. It will return the integer value of the pressed key. For example, if you hit the `T` key it will return 84.
If you're sure that you're only dealing with number keys, then the following should work (I'm not that familiar with Windows.Input - is that WPF stuff?); ``` int Number = -1; if( keys[0] >= Key.D0 && keys[0] <= Key.D9 ) Number = keys[0] - Key.D0; ``` Repeat for other keys in list.
26,394,829
According to [this guide](http://rocketgeek.com/plugins/wp-members/users-guide/filter-hooks/wpmem_register_form_rows/) I can add classes to inputs or labels, however I'm unsure how to get it work. The example make me feel like the code below should work, but clearly it's wrong. ``` add_filter( 'wpmem_register_form_row...
2014/10/16
[ "https://Stackoverflow.com/questions/26394829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1784289/" ]
The lack of access modifier indicates [package private](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html). The single `private` modifier applies to the `typeID` field. The single `public` modifier applies to the `setTypeId` method. Whitespace and indentation is meaningless in Java. (It doesn't ma...
The typId attribute was defined as private, setTypeId was defined as public, and others attributes and methods are as default visible only for members of same package (package private). In java each instruction end with ';' terminator; What is more like what you think is this: ``` public String name, description; ...
18,979,407
I'm designing a page that is supposed to allow users to submit possible computing science projects and at one stage the user will have to enter a duration that the project will run over. To make things easier on the user the I'm trying to fill out the from: to: fields using jQuery's datepicker method however I cannot g...
2013/09/24
[ "https://Stackoverflow.com/questions/18979407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2810641/" ]
Currently you are using the default theme that's because you are not getting the background color as `Dark holo theme` I would suggest if you want a consistent theme on all the devices then you should declare buttons in the xml file itself and then use it accordingly. This would be the best and right approach in my exp...
As per your requirement u have to design custom dialog layout this layout contains one textview and 2 buttons which look as default alert dialog. and write listeners for two buttons and design buttons according to your requirement .
18,979,407
I'm designing a page that is supposed to allow users to submit possible computing science projects and at one stage the user will have to enter a duration that the project will run over. To make things easier on the user the I'm trying to fill out the from: to: fields using jQuery's datepicker method however I cannot g...
2013/09/24
[ "https://Stackoverflow.com/questions/18979407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2810641/" ]
you can see the next [example](http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout). **Creating a Custom Layout** If you want a custom layout in a dialog, create a layout and add it to an AlertDialog by calling setView() on your AlertDialog.Builder object. By default, the custom layout fills the d...
As per your requirement u have to design custom dialog layout this layout contains one textview and 2 buttons which look as default alert dialog. and write listeners for two buttons and design buttons according to your requirement .
18,979,407
I'm designing a page that is supposed to allow users to submit possible computing science projects and at one stage the user will have to enter a duration that the project will run over. To make things easier on the user the I'm trying to fill out the from: to: fields using jQuery's datepicker method however I cannot g...
2013/09/24
[ "https://Stackoverflow.com/questions/18979407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2810641/" ]
Here You can declare the two buttons in the layout files of `myediteddialog.xml` ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="150dp" android:orientation="vertical" android:background="@drawable/delete" > <TextView andro...
As per your requirement u have to design custom dialog layout this layout contains one textview and 2 buttons which look as default alert dialog. and write listeners for two buttons and design buttons according to your requirement .
18,979,407
I'm designing a page that is supposed to allow users to submit possible computing science projects and at one stage the user will have to enter a duration that the project will run over. To make things easier on the user the I'm trying to fill out the from: to: fields using jQuery's datepicker method however I cannot g...
2013/09/24
[ "https://Stackoverflow.com/questions/18979407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2810641/" ]
I have done this in my way using few xml and not changing anything else.Thought to share with you guys who are going for the solution. First i have created a custom selector drawable xml file for my button here it is ``` <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_p...
As per your requirement u have to design custom dialog layout this layout contains one textview and 2 buttons which look as default alert dialog. and write listeners for two buttons and design buttons according to your requirement .
18,979,407
I'm designing a page that is supposed to allow users to submit possible computing science projects and at one stage the user will have to enter a duration that the project will run over. To make things easier on the user the I'm trying to fill out the from: to: fields using jQuery's datepicker method however I cannot g...
2013/09/24
[ "https://Stackoverflow.com/questions/18979407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2810641/" ]
Use custom dialog , here is the best example [custom dialog](http://www.mkyong.com/android/android-custom-dialog-example/)
As per your requirement u have to design custom dialog layout this layout contains one textview and 2 buttons which look as default alert dialog. and write listeners for two buttons and design buttons according to your requirement .
350,101
It is said that having two anti-virus software is bad for one's computer. But, I want to know if it is also bad to have an anti-spyware and a separate anti-virus at the same time. Should I just use the former that also offers anti-virus service but with a fee?
2011/10/24
[ "https://superuser.com/questions/350101", "https://superuser.com", "https://superuser.com/users/102621/" ]
This is a mis-understood topic... (that I have probably also written wrongly in the past). It is not bad to have more than one Antivirus on a single machine - it is bad to have more than one active scanner on a machine. It just happens that nearly every antivirus product out there that you purchase are active scanner...
The point is when you have 2 or more antiviral tools on the same machine, they start conflicting with each other because each tool treats the other one as a threat. Basically, you can have multiple programs installed, but make sure there's only 1 tool that is active and all the other ones are switched off.
10,423,596
I want to create an app that allows a user to find the nearby other users location using GPS coordinates who are Logged in to the same app .Also it can be track the location of the devices(Logged in to the same app) which are moving in a car . Can someone give me an overview of how I can accomplish this. is there any ...
2012/05/03
[ "https://Stackoverflow.com/questions/10423596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1175050/" ]
Danielbeard is correct - you would need to be continually storing/updating locations on a server somewhere. Your app does get some running time when it is in the background, but I'm not sure it would be enough to run the web traffic that you'd need. Check out this post: [Running app in background and send frequent htt...
In iOS7 MultiPeerConnectivity was introduced to find near by applications, so if you have a coffee shop and someone walks by or in they could get the latest deals, or, you walk into a room and the music changes to what you like as your device exchanges information with another. <http://nshipster.com/multipeer-connecti...
70,247,385
I am using Azure data factory to copy source data into landing zone (adls gen2) and then using auto-loader to load into bronze delta tables. everything works perfectly except I am not able to derive pipeline\_name, runid and trigger\_time as derived columns in parquet file along with input source table. schema here is...
2021/12/06
[ "https://Stackoverflow.com/questions/70247385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4411316/" ]
Like you have read from the [documentation](https://cloud.google.com/sql/docs/postgres/users#superuser_restrictions), these commands require `superuser` privileges, which are not available to users in CloudSQL yet. > > Because Cloud SQL for PostgreSQL is a managed service, it restricts access to certain system proced...
Actually you don't need superuser to issue ``` SET session_replication_role = replica; SET session_replication_role = default; ``` you just need REPLICATION ( I just tested it ) ``` ALTER ROLE <your user> REPLICATION; ```
58,416,220
I am calling a method which is ``` public IHttpActionResult GetData(int id) { ... List<MyData> dataList = getArrayOfRecords(); return Ok(dataList .ToList()); } ``` In my calling method, I am trying to recast the returned array as followed ``` List<MyData> result = (List<MyData> result)myFunction.get(1); ```...
2019/10/16
[ "https://Stackoverflow.com/questions/58416220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1250264/" ]
> > Can I have something like a schedule plan in MySQL to delete those records? or even in PHP? > > > Usually this sort of thing is done using your server's "cron" feature (or "Scheduled Tasks" if your server is running Windows). You can write a PHP script that clears these abandoned carts when run, and configure ...
> > ...so if user close the payment gateway browser's tab, wanted items are reduced from stock items count and never returns. > > > This is the wrong way to look at this problem. Consider these scenarios: * User accidentally closes their browser, re-opens it, and tries to finish purchasing * User loses internet a...
21,431,849
``` < script > $(function () { $('#contact-form').validate({ submitHandler: function (form) { $(form).ajaxSubmit({ url: 'process.php', success: function () { $('#contact-form').append("<p>Thanks! Your request has been sent.</p>"); ...
2014/01/29
[ "https://Stackoverflow.com/questions/21431849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3248759/" ]
1. The OS actually does this when you `fork` a process. In this situation, the memory area where the actual code resides is shared between the two process (until the child process wants to write on its memory, it also shares the region where data resides. This mechanism is called copy-on-write). When using using a thre...
Your text is confusing. Firstly, shared memory has little to do itself with CPU caches (L1, L2...). The effects of CPU caches on accessing a memory region from multiple processes or multiple threads will always be the same regardless of if the memory is shared via shm\* or some other way. This is a very advanced topic...
21,431,849
``` < script > $(function () { $('#contact-form').validate({ submitHandler: function (form) { $(form).ajaxSubmit({ url: 'process.php', success: function () { $('#contact-form').append("<p>Thanks! Your request has been sent.</p>"); ...
2014/01/29
[ "https://Stackoverflow.com/questions/21431849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3248759/" ]
1. The OS actually does this when you `fork` a process. In this situation, the memory area where the actual code resides is shared between the two process (until the child process wants to write on its memory, it also shares the region where data resides. This mechanism is called copy-on-write). When using using a thre...
No, there is no automatic mechanism for unrelated programs. What you want to do is to define a file path that both programs know to use for shared memory. Then you'll use `mmap` to map pages of the file to memory. I would suggest mapping multiples of 4096 byte blocks.
12,856,620
I have a bash script process which at some point executes a long-running subprocess synchronously. During the run of that subprocess, a signal is sent directly to the bash script process requesting the script to terminate. Is there any way to intercept that signal, terminate the subprocess and then exit the bash proces...
2012/10/12
[ "https://Stackoverflow.com/questions/12856620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/216410/" ]
See the man page of bash, chapter **SIGNALS**: If bash is waiting for a command to complete and receives a signal for which a trap has been set, **the trap will not be executed until the command completes**. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a tr...
Yes, the signal can be intercepted with the `trap` command. See the example below: ``` #!/bin/bash function wrap { local flag=0 trap "flag=1" SIGINT SIGTERM xeyes & subppid=$! while : do if [ $flag -ne 0 ] ; then kill $subppid break fi sleep 1 done...
12,856,620
I have a bash script process which at some point executes a long-running subprocess synchronously. During the run of that subprocess, a signal is sent directly to the bash script process requesting the script to terminate. Is there any way to intercept that signal, terminate the subprocess and then exit the bash proces...
2012/10/12
[ "https://Stackoverflow.com/questions/12856620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/216410/" ]
Here's a bash utility function I wrote to handle this. It's proved useful and robust. I hope you find it useful. ``` # Run a command in a way that can be interrupted by a signal (eg SIGTERM) # # When bash receives a SIGTERM it normally simply exits. If it's executing a subprocess # that subprocess isn't signaled. (Typ...
Yes, the signal can be intercepted with the `trap` command. See the example below: ``` #!/bin/bash function wrap { local flag=0 trap "flag=1" SIGINT SIGTERM xeyes & subppid=$! while : do if [ $flag -ne 0 ] ; then kill $subppid break fi sleep 1 done...
12,856,620
I have a bash script process which at some point executes a long-running subprocess synchronously. During the run of that subprocess, a signal is sent directly to the bash script process requesting the script to terminate. Is there any way to intercept that signal, terminate the subprocess and then exit the bash proces...
2012/10/12
[ "https://Stackoverflow.com/questions/12856620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/216410/" ]
See the man page of bash, chapter **SIGNALS**: If bash is waiting for a command to complete and receives a signal for which a trap has been set, **the trap will not be executed until the command completes**. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a tr...
Here's a bash utility function I wrote to handle this. It's proved useful and robust. I hope you find it useful. ``` # Run a command in a way that can be interrupted by a signal (eg SIGTERM) # # When bash receives a SIGTERM it normally simply exits. If it's executing a subprocess # that subprocess isn't signaled. (Typ...
4,809,166
I have 3 tables setup (items, reviews, ratings). I want to count the total number of ratings and the total number of reviews for each item, then combine them for total number of interactions, then output the top items based on interactions. I am struggling with the query a bit. `SELECT item.id, count(reviews.review_i...
2011/01/26
[ "https://Stackoverflow.com/questions/4809166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/490239/" ]
``` SELECT *, total_reviews + total_ratings AS total_interactions FROM ( SELECT id, ( SELECT COUNT(*) FROM reviews WHERE item_id = i.id ) AS total_reviews, ( SELECT COUNT(*) ...
I'll try to just fix your original query, instead of writing another one: ``` SELECT item.id, count(distinct reviews.review_id) AS total_reviews, count(distinct ratings.rating_id) AS total_ratings, count(distinct reviews.review_id) + count(distinct ratings.rating_id) AS total_interactions FROM item...
33,134
I have a master slave setup using MySQL 5.0. I have very frequent writes to the master and slave is used only for backup purpose (no explicit writes). In my current configuration, the slave database is synced with the master by MySQL automatically via VPN. But if the system (win 7) consisting of Master goes down for ...
2013/01/18
[ "https://dba.stackexchange.com/questions/33134", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/7462/" ]
I assume you've restored entire partitions, but the partition drive letters are now wrong. If SQL is looking for I: then you have three choices a) Fix the drive letter of the partition that's now got the data. You said this is not an option. Is that because I: is already taken, or because something else is now lookin...
At the very least, you need to change your drive letter back as in the original configuration. But if *reinstalled* (not *repaired*) Windows then you basically have a new machine and you must re-install SQL and everything else on it.
33,134
I have a master slave setup using MySQL 5.0. I have very frequent writes to the master and slave is used only for backup purpose (no explicit writes). In my current configuration, the slave database is synced with the master by MySQL automatically via VPN. But if the system (win 7) consisting of Master goes down for ...
2013/01/18
[ "https://dba.stackexchange.com/questions/33134", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/7462/" ]
I don't know about the other services, but for the main database service you can go into SQL Server Configuration Manager (start - all programs - microsoft sql server 2008 - configuration tools - sql server configuration manager) and change where the master database is located. Right click SQL Server(MSSQLSERVER)[pare...
At the very least, you need to change your drive letter back as in the original configuration. But if *reinstalled* (not *repaired*) Windows then you basically have a new machine and you must re-install SQL and everything else on it.
6,270,827
I am trying to write a method that sorts the elements in a doubly linked list. The list is made up of structs with a forward and backward pointer (flink, blink) to the next element. head->blink should be null, tail->flink should be null (aka not circular). I tried a selection sort approach but I keep getting a segmenta...
2011/06/07
[ "https://Stackoverflow.com/questions/6270827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/785302/" ]
Looks like `listNode2` can be `NULL` after that `for` loop. You should check that before you try to access `listNode2->flink`.
``` FTFY: still pretty ugly hack but should work --- 2.c 2011-06-07 13:03:48.000000000 -0700 +++ 1.c 2011-06-07 13:49:18.000000000 -0700 @@ -7,7 +7,8 @@ int num; } DblLinkList; -struct _DblLinkList *head, *tail; +struct _DblLinkList *head = NULL; +struct _DblLinkList *tail = NULL; struct _DblLinkList *init(in...
6,270,827
I am trying to write a method that sorts the elements in a doubly linked list. The list is made up of structs with a forward and backward pointer (flink, blink) to the next element. head->blink should be null, tail->flink should be null (aka not circular). I tried a selection sort approach but I keep getting a segmenta...
2011/06/07
[ "https://Stackoverflow.com/questions/6270827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/785302/" ]
``` for(;listNode2 != NULL; listNode2 = listNode2->flink) ``` This loop **only exits when listNode2 is `NULL`**. So we've established that at this point `listNode2 == NULL`. > > Thou shalt not follow the NULL > pointer, for chaos and madness await > thee at its end. > > > And here is what you're doing, break...
``` FTFY: still pretty ugly hack but should work --- 2.c 2011-06-07 13:03:48.000000000 -0700 +++ 1.c 2011-06-07 13:49:18.000000000 -0700 @@ -7,7 +7,8 @@ int num; } DblLinkList; -struct _DblLinkList *head, *tail; +struct _DblLinkList *head = NULL; +struct _DblLinkList *tail = NULL; struct _DblLinkList *init(in...
6,270,827
I am trying to write a method that sorts the elements in a doubly linked list. The list is made up of structs with a forward and backward pointer (flink, blink) to the next element. head->blink should be null, tail->flink should be null (aka not circular). I tried a selection sort approach but I keep getting a segmenta...
2011/06/07
[ "https://Stackoverflow.com/questions/6270827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/785302/" ]
I can see a few problems in the code: 1. You keep inserting the same chunk of memory, `temp` when you are moving nodes around. 2. When you are moving `listnode` away, `listnode->flink->blink` (before the move) still points to `listnode`. 3. Same as #2, but for `listnode->blink->flink` 4. When you move listnode, you po...
``` FTFY: still pretty ugly hack but should work --- 2.c 2011-06-07 13:03:48.000000000 -0700 +++ 1.c 2011-06-07 13:49:18.000000000 -0700 @@ -7,7 +7,8 @@ int num; } DblLinkList; -struct _DblLinkList *head, *tail; +struct _DblLinkList *head = NULL; +struct _DblLinkList *tail = NULL; struct _DblLinkList *init(in...
3,775,297
> > Let $f(x) = \sum\_{n=1}^{\infty} \frac{x^{3/2}\cos(nx)}{n^{5/2}}$ on $(0, \infty)$. > > > > > (i) Is $f(x)$ differentiable on $(0, \infty)$? > > > > > (ii) Does the series uniformly converge to $f$ on $(0, \infty)$? > > > Any help or hints will be appreciated. $\\\\\\$ Edit: What I know about the d...
2020/07/31
[ "https://math.stackexchange.com/questions/3775297", "https://math.stackexchange.com", "https://math.stackexchange.com/users/406325/" ]
This general type of representation (sum of fractions with numerator 1 and no repeat denominators) is called [Egyptian fractions](http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fractions/egyptian.html). You'll find a lot of further facts in the cited page. Knowing what to search for will net you lots of further tid...
If you have $$a\_1=2\qquad \text{and} \qquad a\_{n+1}=a\_n^2 -a\_n+2$$ adding a few terms, the sequence of ${a\_n}$ is $$\{2,4,14,184,33674,1133904604,1285739649838492214,\cdots,\}$$ and, graphing, you couls notice that $$\log(\log(a\_n)) \sim \alpha + \log(2) n$$ which means that the reciprocals will go to very small ...
45,943,519
I have a model which over timer will have several thousand to tens of thousands of instances. Each of those is unique. In the Django Admin interface I can see all the instances and access them etc. Is there a way for me to limit the number of instances I can see to lets say 20 or 50 sorted in whichever order and I can ...
2017/08/29
[ "https://Stackoverflow.com/questions/45943519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1648484/" ]
You can set the number of items with `list_per_page` in your ModelAdmin: <https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_per_page> The ordering within the admin by default is as defined by in the models options: <https://docs.djangoproject.com/en/1.11/ref/models/options/...
You have to set the every single Field to be truncated: e.g i want to truncate field: content ``` # in model from django.template.defaultfilters import truncatechars class Article(models.Model): """infor for manage every single news""" title = models.CharField(max_length=150, default='') slug = models....
4,167,077
is there a common pattern in Java to avoid mongoDB injection attacks? Thanks
2010/11/12
[ "https://Stackoverflow.com/questions/4167077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298406/" ]
Use one of the supported drivers. Don't deserialize strings as JSON and pass them as queries, e.g. dont' do this (in Ruby): ``` collection.send(query_type, JSON.parse(parameters)) ``` where `query_type` and `parameters` are strings coming from a form. You would have to be criminally stupid to do this though. Since ...
Most of the drivers are setup where you construct queries as the languages representation of BSON documents. What languages do you intend to use mongo in?
4,167,077
is there a common pattern in Java to avoid mongoDB injection attacks? Thanks
2010/11/12
[ "https://Stackoverflow.com/questions/4167077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298406/" ]
You can build MongoDB querys with Javascript in the where clause and here injection can happen. Here explanation how to prevent this: <https://docs.mongodb.com/manual/faq/fundamentals/#how-does-mongodb-address-sql-or-query-injection>
Most of the drivers are setup where you construct queries as the languages representation of BSON documents. What languages do you intend to use mongo in?
4,167,077
is there a common pattern in Java to avoid mongoDB injection attacks? Thanks
2010/11/12
[ "https://Stackoverflow.com/questions/4167077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298406/" ]
Use one of the supported drivers. Don't deserialize strings as JSON and pass them as queries, e.g. dont' do this (in Ruby): ``` collection.send(query_type, JSON.parse(parameters)) ``` where `query_type` and `parameters` are strings coming from a form. You would have to be criminally stupid to do this though. Since ...
You can build MongoDB querys with Javascript in the where clause and here injection can happen. Here explanation how to prevent this: <https://docs.mongodb.com/manual/faq/fundamentals/#how-does-mongodb-address-sql-or-query-injection>
4,167,077
is there a common pattern in Java to avoid mongoDB injection attacks? Thanks
2010/11/12
[ "https://Stackoverflow.com/questions/4167077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298406/" ]
Use one of the supported drivers. Don't deserialize strings as JSON and pass them as queries, e.g. dont' do this (in Ruby): ``` collection.send(query_type, JSON.parse(parameters)) ``` where `query_type` and `parameters` are strings coming from a form. You would have to be criminally stupid to do this though. Since ...
yes there is, by using regex search. Ex: lets say you do check by username and you are not using EQ op. If i pass [a-z] for example i will bypass your login action :). But anyway, it very much depends on the logic of how things are implemented in the solution.
4,167,077
is there a common pattern in Java to avoid mongoDB injection attacks? Thanks
2010/11/12
[ "https://Stackoverflow.com/questions/4167077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298406/" ]
You can build MongoDB querys with Javascript in the where clause and here injection can happen. Here explanation how to prevent this: <https://docs.mongodb.com/manual/faq/fundamentals/#how-does-mongodb-address-sql-or-query-injection>
yes there is, by using regex search. Ex: lets say you do check by username and you are not using EQ op. If i pass [a-z] for example i will bypass your login action :). But anyway, it very much depends on the logic of how things are implemented in the solution.
53,762,773
I have one PHP file like below which I run in command prompt using below command ``` php myfile.php ``` and its working fine. I want keep running it 24/7 and its running but sometime if there any error come, its stop working so I want reload file in same command prompt. I am using it in centos, and I want see result...
2018/12/13
[ "https://Stackoverflow.com/questions/53762773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10684203/" ]
Here is an example based on your code ( The stop condition should be improved ) ```js progress = 0; function slideSwitch() { var myInterval = setTimeout(slideSwitch,100); progress++; var calc = progress * 10; if (progress > 100 ) clearInterval(myInterval); $("#bottom_status").width(calc); } slideSwitch()...
A little adjustements from [Vladu Ionut](https://stackoverflow.com/users/4327861/vladu-ionut)'s answer: ``` var progress = 0; function slideSwitch() { var myInterval = setTimeout(slideSwitch,100); progress++; var calc = progress * 10; if (progress > 100 ) { clearInterval(myInterval); progress = 0...
53,762,773
I have one PHP file like below which I run in command prompt using below command ``` php myfile.php ``` and its working fine. I want keep running it 24/7 and its running but sometime if there any error come, its stop working so I want reload file in same command prompt. I am using it in centos, and I want see result...
2018/12/13
[ "https://Stackoverflow.com/questions/53762773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10684203/" ]
Here is an example based on your code ( The stop condition should be improved ) ```js progress = 0; function slideSwitch() { var myInterval = setTimeout(slideSwitch,100); progress++; var calc = progress * 10; if (progress > 100 ) clearInterval(myInterval); $("#bottom_status").width(calc); } slideSwitch()...
You need to use setInterval to update progressbar and clearInerval when the desidered time has passed ``` function slideSwitch() { var maxtime = 3000; var incremental = 500; var actualtime = 0; var interval = setInterval(function() { actualtime += incremental; var percentage = 100 / maxtime * actual...
53,762,773
I have one PHP file like below which I run in command prompt using below command ``` php myfile.php ``` and its working fine. I want keep running it 24/7 and its running but sometime if there any error come, its stop working so I want reload file in same command prompt. I am using it in centos, and I want see result...
2018/12/13
[ "https://Stackoverflow.com/questions/53762773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10684203/" ]
Here is an example based on your code ( The stop condition should be improved ) ```js progress = 0; function slideSwitch() { var myInterval = setTimeout(slideSwitch,100); progress++; var calc = progress * 10; if (progress > 100 ) clearInterval(myInterval); $("#bottom_status").width(calc); } slideSwitch()...
A bit more dynamic and error-proof solution: * No fixed widths to worry about * Everything is calculated based on width * Smooth 16 frames per second (variable) ```js const wrapper = document.getElementById('wrapper'); const status = document.getElementById('status'); let interval; function slideSwitch(time) { ...
17,413,907
I was following the instructions in this answer: [View deleted console output](https://stackoverflow.com/questions/10929235/view-deleted-console-output) (to set up a file in which Eclipse will record everything that goes to the console (too bad that is not done by default!)), and under: * Run Configurations + Java A...
2013/07/01
[ "https://Stackoverflow.com/questions/17413907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1276140/" ]
The proper syntax for this is: ${workspace\_loc:/myworkspacesubfolder/test.txt} Make sure that you manually create test.txt file in that location. I is not created automatically by eclipse.
The correct syntax is `${workspace_loc:/myworkspacesubfolder}/test.txt`. This works even when the file does not already exist. See [this Eclipse bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=235166) for an explanation of why `${workspace_loc:/myworkspacesubfolder/test.txt}` doesn't work when the file doesn't alre...
60,947,381
I am having a hard time with a dataset that currently have rows showing like the first table, and i would like to change it to look like the bottom table (see picture). Is this possible in SQL? Example data:: ![Example data](https://i.stack.imgur.com/UFMho.jpg) In the case where a customer has not bought a specifi...
2020/03/31
[ "https://Stackoverflow.com/questions/60947381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13153368/" ]
A `DateTime[]` is not an `object[]`; that isn't how array variance works - so: if you pass a `DateTime[]` array to `string.Format`, it isn't using the `Format(string, object[])` overload - you're *effectively* using passing the entire `DateTime[]` as a *single* object to `Format(string, object)`, hence from `Format`'s ...
`var format = "{0:MMM}{1:MMM}";` expects three arguments supplied for `string.Format()` - one for format and two arguments for values. Like ``` string.Format(format, array[0], array[1]) ``` another option is to change array from `DateTime[]` to `object[]` array
73,718,635
I'm making a simple parser, which is taking some information and putting it into the variable (`heroes_list`). So, using it outside the loop is giving me only last value, not all of them. How can I use `heroes` variable outside the loop? (Inside the loop I get `heroes_list = Abaddon, Alchemist..... Zeus`, but outside t...
2022/09/14
[ "https://Stackoverflow.com/questions/73718635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19787406/" ]
you didn't declare the list before the loop started, try this: ``` import requests import fake_useragent from bs4 import BeautifulSoup response = requests.get('https://www.dotabuff.com/heroes', headers = {'User-agent': fake_useragent.UserAgent().random}) soup = BeautifulSoup(response.content, 'html.parser') heroes = ...
You can create a list before the loop and keep appending to it: ``` import requests import fake_useragent from bs4 import BeautifulSoup as BS import itertools response = requests.get('https://www.dotabuff.com/heroes', headers = {'User-agent': fake_useragent.UserAgent().random}) soup = BS(response.content, 'html.parse...
73,718,635
I'm making a simple parser, which is taking some information and putting it into the variable (`heroes_list`). So, using it outside the loop is giving me only last value, not all of them. How can I use `heroes` variable outside the loop? (Inside the loop I get `heroes_list = Abaddon, Alchemist..... Zeus`, but outside t...
2022/09/14
[ "https://Stackoverflow.com/questions/73718635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19787406/" ]
you didn't declare the list before the loop started, try this: ``` import requests import fake_useragent from bs4 import BeautifulSoup response = requests.get('https://www.dotabuff.com/heroes', headers = {'User-agent': fake_useragent.UserAgent().random}) soup = BeautifulSoup(response.content, 'html.parser') heroes = ...
what you need to do is create the variable as an array outside the loop and inside the for loop add the values ​​to it with append, then display each of the values ``` heroes_list = []; for name in soup.select(".name"): try: heroes = (str(name.text)) heroes_list.append(heroes) except requests.e...
20,766,260
I am trying to use [Jekyll](http://jekyllrb.com/) with [Vagrant](http://www.vagrantup.com/) and for some reason when I try to use the `jekyll serve -w` command it will start the server and build everything fine, but when I try and edit a file it will not rebuild.
2013/12/24
[ "https://Stackoverflow.com/questions/20766260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478191/" ]
Since version 2.0.0 [1] of Jekyll you can use `--force_polling` with `--watch` in order for Jekyll to pick up changes outside of Vagrant. [1] <https://github.com/jekyll/jekyll/blob/master/History.markdown>
If you're on OS X with python v2.7.6 (check with `python -V`) you need to downgrade to 2.7: ``` brew update brew install pyenv echo 'if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi' >> ~/.bashrc source ~/.bashrc pyenv install 2.7 pyenv global 2.7 ```
38,504,768
Given square matrix `m` as follows (`nxn`): ``` m <- matrix(1:5,ncol = 5,nrow = 5,byrow = F) [,1] [,2] [,3] [,4] [,5] [1,] 1 1 1 1 1 [2,] 2 2 2 2 2 [3,] 3 3 3 3 3 [4,] 4 4 4 4 4 [5,] 5 5 5 5 5 ``` I want to extract the respective upper ...
2016/07/21
[ "https://Stackoverflow.com/questions/38504768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1505504/" ]
Much more easily: ``` f <- m/(m+t(m)) #> f # [,1] [,2] [,3] [,4] [,5] #[1,] 0.5000000 0.3333333 0.2500000 0.2000000 0.1666667 #[2,] 0.6666667 0.5000000 0.4000000 0.3333333 0.2857143 #[3,] 0.7500000 0.6000000 0.5000000 0.4285714 0.3750000 #[4,] 0.8000000 0.6666667 0.5714286 0.5000000 0.4444...
Combining the `lower.tri` with the transpose `t()` we can get the `upper.tri` in the order you wanted ``` t(m)[lower.tri(t(m))] #[1] 1 1 1 1 2 2 2 3 3 4 ``` --- To get the desired output we use the same strategy ``` #lower.tri and upper.tri matrices lt <- m[lower.tri(m)] ut <- t(m)[lower.tri(t(m))] #defining the f...
38,504,768
Given square matrix `m` as follows (`nxn`): ``` m <- matrix(1:5,ncol = 5,nrow = 5,byrow = F) [,1] [,2] [,3] [,4] [,5] [1,] 1 1 1 1 1 [2,] 2 2 2 2 2 [3,] 3 3 3 3 3 [4,] 4 4 4 4 4 [5,] 5 5 5 5 5 ``` I want to extract the respective upper ...
2016/07/21
[ "https://Stackoverflow.com/questions/38504768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1505504/" ]
Much more easily: ``` f <- m/(m+t(m)) #> f # [,1] [,2] [,3] [,4] [,5] #[1,] 0.5000000 0.3333333 0.2500000 0.2000000 0.1666667 #[2,] 0.6666667 0.5000000 0.4000000 0.3333333 0.2857143 #[3,] 0.7500000 0.6000000 0.5000000 0.4285714 0.3750000 #[4,] 0.8000000 0.6666667 0.5714286 0.5000000 0.4444...
This is another solution using `combn` (it helps to extract the elements of the upper-triangle in the desired order.): ``` out <- m inds <- t(combn(ncol(m),2)) # > inds # [,1] [,2] # [1,] 1 2 # [2,] 1 3 # [3,] 1 4 # [4,] 1 5 # [5,] 2 3 # [6,] 2 4 # [7,] 2 5 # [...
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
**Correct answer is:** ``` TextMesh*Pro/ ``` --- ``` **/TestMesh Pro/ ``` Should also work
It seems that you have missed one of the spaces between Text and Mesh. Try adding ``` Assets/Text\ Mesh\ Pro/ ``` to your .gitignore
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
It seems that you have missed one of the spaces between Text and Mesh. Try adding ``` Assets/Text\ Mesh\ Pro/ ``` to your .gitignore
Add to `Sky Labyrinth\Assets\.gitignore` ``` /TextMesh\ Pro/ ``` "Trying to ignore the annoyingly-named "TextMesh Pro" directory" * `/` matches a literal path, not a pattern is escaped using `\` -> `\` "underneath an "Assets" folder" * put the `.gitignore` in `Assests`
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
It seems that you have missed one of the spaces between Text and Mesh. Try adding ``` Assets/Text\ Mesh\ Pro/ ``` to your .gitignore
If the files in question are in your git repo, you'll need to delete them and push that change before the .gitignore will work.
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
It seems that you have missed one of the spaces between Text and Mesh. Try adding ``` Assets/Text\ Mesh\ Pro/ ``` to your .gitignore
In my project, the TextMesh Pro folder is inside the Assets folder. Adding the following line to my .gitignore worked for me: ``` /Assets/TextMesh\ Pro/ ```
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
**Correct answer is:** ``` TextMesh*Pro/ ``` --- ``` **/TestMesh Pro/ ``` Should also work
Add to `Sky Labyrinth\Assets\.gitignore` ``` /TextMesh\ Pro/ ``` "Trying to ignore the annoyingly-named "TextMesh Pro" directory" * `/` matches a literal path, not a pattern is escaped using `\` -> `\` "underneath an "Assets" folder" * put the `.gitignore` in `Assests`
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
**Correct answer is:** ``` TextMesh*Pro/ ``` --- ``` **/TestMesh Pro/ ``` Should also work
If the files in question are in your git repo, you'll need to delete them and push that change before the .gitignore will work.
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
**Correct answer is:** ``` TextMesh*Pro/ ``` --- ``` **/TestMesh Pro/ ``` Should also work
In my project, the TextMesh Pro folder is inside the Assets folder. Adding the following line to my .gitignore worked for me: ``` /Assets/TextMesh\ Pro/ ```
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
Add to `Sky Labyrinth\Assets\.gitignore` ``` /TextMesh\ Pro/ ``` "Trying to ignore the annoyingly-named "TextMesh Pro" directory" * `/` matches a literal path, not a pattern is escaped using `\` -> `\` "underneath an "Assets" folder" * put the `.gitignore` in `Assests`
In my project, the TextMesh Pro folder is inside the Assets folder. Adding the following line to my .gitignore worked for me: ``` /Assets/TextMesh\ Pro/ ```
43,310,179
Goal ==== Trying to ignore the annoyingly-named "TextMesh Pro" directory, underneath an "Assets" folder (full path from the root where .gitignore resides is "Sky Labyrinth\Assets\Text Mesh Pro\"). Attempted ========= I followed the suggestions in 3 threads ([one](https://stackoverflow.com/questions/19684620/gitignor...
2017/04/09
[ "https://Stackoverflow.com/questions/43310179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340070/" ]
If the files in question are in your git repo, you'll need to delete them and push that change before the .gitignore will work.
In my project, the TextMesh Pro folder is inside the Assets folder. Adding the following line to my .gitignore worked for me: ``` /Assets/TextMesh\ Pro/ ```
62,312,151
I thought addresses are 4 bytes big, why is this address 6 bytes? Im compiling with gcc on a virtual machine with Ubuntu 20.04 and I got an x64 processor if this matters. ``` #include <stdio.h> int main() { char char_array[3] = {'a', 'b', 'c'}; printf("Address of char_array: %p\n", char_array); } `...
2020/06/10
[ "https://Stackoverflow.com/questions/62312151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11127624/" ]
First of all C pointers are oftentimes either 4-byte (32-bit) or 8-byte (64-bit) but this is not guaranteed and should not be assumed. Secondly you can’t count the digits in a hexadecimal memory address and assume that the number of digits divided by two is the number of bytes the system uses for a pointer, because le...
The virtual address space on x64 is 48 bits (6 bytes) long. <https://en.wikipedia.org/wiki/64-bit_computing>
62,312,151
I thought addresses are 4 bytes big, why is this address 6 bytes? Im compiling with gcc on a virtual machine with Ubuntu 20.04 and I got an x64 processor if this matters. ``` #include <stdio.h> int main() { char char_array[3] = {'a', 'b', 'c'}; printf("Address of char_array: %p\n", char_array); } `...
2020/06/10
[ "https://Stackoverflow.com/questions/62312151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11127624/" ]
First of all C pointers are oftentimes either 4-byte (32-bit) or 8-byte (64-bit) but this is not guaranteed and should not be assumed. Secondly you can’t count the digits in a hexadecimal memory address and assume that the number of digits divided by two is the number of bytes the system uses for a pointer, because le...
%8p to show all 8 bytes of address. also ``` fprintf(stdout, "%d %d", sizeof(char_array), sizeof(&(char_array[0]))); ``` The second use of sizeof() depends on your compiler...