qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
51,548,255 | I am running caret's neural network on the Bike Sharing dataset and I get the following error message:
>
> In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo,
> : There were missing values in resampled performance measures.
>
>
>
I am not sure what the problem is. Can anyone help please?
The... | 2018/07/26 | [
"https://Stackoverflow.com/questions/51548255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6769382/"
] | Answer by [@topepo](https://github.com/topepo/) (Caret package main developer). See detailed Github thread [here](https://github.com/topepo/caret/issues/905).
>
> It looks like it happens when you have one hidden unit and almost no
> regularization. What is happening is that the model is predicting a
> value very c... | The answer by @missuse is already very insightful to understand why this error happens.
So I just want to add some straightforward ways how to get rid of this error.
If in some cross-validation folds the predictions get zero variance, the model didn't converge. In such cases, you can try the neuralnet package which o... |
29,003,465 | My question is in Pydot how can I set the node order in a cluster?
My code is
```
import pydot
graph = pydot.Dot(graph_type='digraph', rankdir="LR")
graphlegend = pydot.Cluster(graph_name="legend", label="Legend", fontsize="15", color="red", style="filled", fillcolor="lightgrey")
legend1 = pydot.Node("Sample", styl... | 2015/03/12 | [
"https://Stackoverflow.com/questions/29003465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3943196/"
] | I finally found an alternative solution by using an invisible edge
the code is now:
```
graph = pydot.Dot(graph_type='digraph', rankdir="LR")
graphlegend = pydot.Cluster(graph_name="legend", label="Legend", fontsize="15", color="red", style="filled", fillcolor="lightgrey", rankdir="TB")
legend1 = pydot.Node("Sample"... | Most probably you want `rankdir="TB"` top to bottom ranking. Vertical ordering is done then by rank depending on visible or invisible edges. `rank="same"` may be needed if there are horizontal edges. |
17,689,211 | In playframework 2.1, is it possible to test an action to make sure the rendered view is the one I'm expecting for?
In ASP.NET MVC 3, `AssertViewRendered().ForView("view")` tests exactly that. Can we do it in play 2.1? How?
Very basic MVC 3 example of what I would like to achieve:
```
// Given the action GetUsers th... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17689211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1865075/"
] | The view rendering in Play is only a method call (the templates are compiled to simple Scala functions).
Nothing prevents you to implement the view rendering with a "manually-built" function.
Therefore, the `Result` returned by the Action don't know if the content comes from a template or anything else. That's why ... | Not sure to fully understand, but I think you can test your controller, and the rendered view by asserting that the rendered view contains some expected data.
From the [Playframework documentation](http://www.playframework.com/documentation/2.1.1/JavaFunctionalTest):
```
@Test
public void callIndex() {
Result res... |
67,014,621 | It's a very simple project to learn how to use mongodb with Rust. I'm using the official mongodb driver here: <https://github.com/mongodb/mongo-rust-driver>. The problem is that if I'm using `aggregate`, I cannot read the result
```
// main.rs
use mongodb::bson::{doc, Bson};
use mongodb::{options::AggregateOptions, op... | 2021/04/09 | [
"https://Stackoverflow.com/questions/67014621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1608979/"
] | I found it! Just add `use tokio::stream::StreamExt;` on top of the file and the rest is good to go.
>
> ...all the other methods that an Stream has are available on Cursor as
> well. This includes all of the functionality provided by StreamExt,
> which provides similar functionality to the standard library Iterator
>... | Fixed it by adding `use futures::stream::StreamExt;` |
28,810 | After asking [this question](https://emacs.stackexchange.com/questions/28740/zip-program-for-odt-export), I have downloaded [7zip for Windows](http://www.7-zip.org/).
When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."
What is ... | 2016/11/21 | [
"https://emacs.stackexchange.com/questions/28810",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/13432/"
] | After you have associated 7zip with files that have a give extension (e.g. `.zip`), in the usual way for MS Windows (I don't think that's your question), you can have Emacs open such files using that associated program.
To do that, start with the Emacs Wiki [Category W32](https://www.emacswiki.org/emacs/CategoryWThirt... | If you just need export `org` to `odt`, see [org-mode zip needed, how to over come?](https://stackoverflow.com/questions/8625306/org-mode-zip-needed-how-to-over-come/52034701#52034701).
If you need 7-Zip as your zip program, you need download [7-Zip Extra: standalone console version](https://www.7-zip.org/download.htm... |
28,810 | After asking [this question](https://emacs.stackexchange.com/questions/28740/zip-program-for-odt-export), I have downloaded [7zip for Windows](http://www.7-zip.org/).
When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."
What is ... | 2016/11/21 | [
"https://emacs.stackexchange.com/questions/28810",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/13432/"
] | After you have associated 7zip with files that have a give extension (e.g. `.zip`), in the usual way for MS Windows (I don't think that's your question), you can have Emacs open such files using that associated program.
To do that, start with the Emacs Wiki [Category W32](https://www.emacswiki.org/emacs/CategoryWThirt... | >
> When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."
>
>
>
Based on <https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00489.html>, you can use the zip package from following links
```
http://gnuwin32.sourceforg... |
28,810 | After asking [this question](https://emacs.stackexchange.com/questions/28740/zip-program-for-odt-export), I have downloaded [7zip for Windows](http://www.7-zip.org/).
When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."
What is ... | 2016/11/21 | [
"https://emacs.stackexchange.com/questions/28810",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/13432/"
] | Might be a little late for an answer but here it goes anyway. If you search `ox-odt.el` you can see that the error message you're getting comes from `org-odt--export-wrap` which is the macro called by `org-odt-export-to-odf` and `org-odt-export-to-odt` to create the actual `ODT` file. Inside `ox-odt--export-wrap` there... | If you just need export `org` to `odt`, see [org-mode zip needed, how to over come?](https://stackoverflow.com/questions/8625306/org-mode-zip-needed-how-to-over-come/52034701#52034701).
If you need 7-Zip as your zip program, you need download [7-Zip Extra: standalone console version](https://www.7-zip.org/download.htm... |
28,810 | After asking [this question](https://emacs.stackexchange.com/questions/28740/zip-program-for-odt-export), I have downloaded [7zip for Windows](http://www.7-zip.org/).
When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."
What is ... | 2016/11/21 | [
"https://emacs.stackexchange.com/questions/28810",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/13432/"
] | Might be a little late for an answer but here it goes anyway. If you search `ox-odt.el` you can see that the error message you're getting comes from `org-odt--export-wrap` which is the macro called by `org-odt-export-to-odf` and `org-odt-export-to-odt` to create the actual `ODT` file. Inside `ox-odt--export-wrap` there... | >
> When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."
>
>
>
Based on <https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00489.html>, you can use the zip package from following links
```
http://gnuwin32.sourceforg... |
39,139 | What do these two movements disagree on? Also what are the differences in the way each group seeks to study and understand the Bible? | 2015/03/15 | [
"https://christianity.stackexchange.com/questions/39139",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/20203/"
] | Although the Pentecostal movement originated from Wesleyans (an infant baptism movement) these days the large majority of Pentecostal churches are adult or believers' baptism, and is it reasonable to say that Pentecostalism is a sub-branch of the Baptist movement.
(My guess is that they shifted to believers' baptism b... | **What are the main differences between the baptist and Pentecostal traditions?**
The main difference would be in how the spiritual gifts described in the New Testament operate today. There are three main views.
1. Spiritual gifts were for the early church and none of them operate today.
2. Some spiritual gifts still... |
63,231,177 | I was expecting the following to return `2020-01-01T23:59:59`
But due to my time zone being GMT+2, it results in this `2020-01-01T21:59:59.`
How do I represent the end of the day as **23:59:59** from a date that is parsed using `moment.js`
```
var date = moment("2020-01-01").endOf("day").toDate();
``` | 2020/08/03 | [
"https://Stackoverflow.com/questions/63231177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/231821/"
] | Ciao try to call `.utc` in `moment` like:
```
var date = moment("2020-01-01").utc().endOf("day").toDate();
``` | I would keep the date as a moment object, up until you need to display it. Just simply call `format` on the object.
```js
console.log(moment.utc('2020-01-01').endOf('day').format('YYYY-MM-DDTHH:mm:ss'));
```
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js"></script>
``` |
74,051,932 | I'm trying to sort an excel file by datetime. This is my code:
```
import pandas as pd
from datetime import datetime
from datetime import date
dagStart = datetime.strptime(str(date.today())+' 06:00:00', '%Y-%m-%d %H:%M:%S')
dagEind = datetime.strptime(str(date.today())+' 23:00:00', '%Y-%m-%d %H:%M:%S')
data = pd.rea... | 2022/10/13 | [
"https://Stackoverflow.com/questions/74051932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8315585/"
] | You can do:
```
m = (df["Column 1"].notna()) & (
(df["Column 1"].shift(-1).isna()) | (df["Column 1"].shift().isna())
)
out = df.groupby(m.cumsum()).transform(
lambda x: x.fillna(0).mean() if x.isna().any() else x
)
```
print(out):
```
Index Column 1
0 1 10.0
1 2 12.0
2 3 12... | Why not using [interpolate](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.interpolate.html)? There is a `method=`s that would probably fitsyour desire
However, if you really want to do as you described above, you can do something like this. (Note that iterating over rows in pandas is considered bad pra... |
2,215,274 | I have this js object which I got from php through jason\_encode(). This object has 2 objects, Name and Video. Then through a for loop I distribute the names into divs. My problem is I need to create a link in each div that would create a dialog that displays the video.
I'm basing this idea from the jquery UI example... | 2010/02/07 | [
"https://Stackoverflow.com/questions/2215274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267572/"
] | This hasn't been tested, but it might work. **Edit: It actually is tested and does work now.** Note that this assumes that `Video` is a YouTube video ID, not a YouTube video URL. (ie. we're assuming `Video` is the part after the `?v=` in the YouTube URL)
```
for(var i=0;i<BodyWeight.length;i++) {
var exercise=Body... | I do not really know if this is what you need, I hope it will be usefull
```
for ( var i in BodyWeight ) {
var mydiv = $('<div class="ui-widget-content"></div>'),
myp = $('<p>'+BodyWeight[i]["ExerciseTitle"]+'</p>'),
mylink = $('<a>View video</a>'),
linkVideo = BodyWeight['linkToVideo'] ;
mylin... |
2,215,274 | I have this js object which I got from php through jason\_encode(). This object has 2 objects, Name and Video. Then through a for loop I distribute the names into divs. My problem is I need to create a link in each div that would create a dialog that displays the video.
I'm basing this idea from the jquery UI example... | 2010/02/07 | [
"https://Stackoverflow.com/questions/2215274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267572/"
] | This hasn't been tested, but it might work. **Edit: It actually is tested and does work now.** Note that this assumes that `Video` is a YouTube video ID, not a YouTube video URL. (ie. we're assuming `Video` is the part after the `?v=` in the YouTube URL)
```
for(var i=0;i<BodyWeight.length;i++) {
var exercise=Body... | Just a comment to andres and to mike (I prefer to put it here so that codes below are readable).
This block of codes:
```
if(BodyWeight[i]['Color'] == 'Red') {
mydiv.addClass("dragred").appendTo($('#redboxes'));
}
else if(BodyWeight[i]['Color'] == 'Blue') {
mydiv.addClass("dragblue").appendTo($('#blueb... |
67,776,563 | when I do a git push -f
My ignore files are also pushed to the online repository at <https://github.com/>
Is this a bug or I am doing something wrong?
I have added the file extensions to the .gitignore file like so;
.Web.config
Any pointers much appreciated. | 2021/05/31 | [
"https://Stackoverflow.com/questions/67776563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8533722/"
] | Not sure if I got your question, but as far as I got, you have something like this:
```
.
├── .gitignore
└── something.Web.config
```
And you want to ignore `something.Web.config` by adding it in the `.gitignore`
and you tried it by adding just `.Web.config` in the content of `.gitignore`
Well, if I got it right
... | I use \* as well, like so:
\*.pdf
\*.png
... and usually you don't need the -f flag for `git push`. |
67,776,563 | when I do a git push -f
My ignore files are also pushed to the online repository at <https://github.com/>
Is this a bug or I am doing something wrong?
I have added the file extensions to the .gitignore file like so;
.Web.config
Any pointers much appreciated. | 2021/05/31 | [
"https://Stackoverflow.com/questions/67776563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8533722/"
] | I use \* as well, like so:
\*.pdf
\*.png
... and usually you don't need the -f flag for `git push`. | Looks like if a file has been imported into git before it’s added to .gitignore you’re too late.
You have to remove the files from git using git rm and then commit and from then on, they will be ignored. |
67,776,563 | when I do a git push -f
My ignore files are also pushed to the online repository at <https://github.com/>
Is this a bug or I am doing something wrong?
I have added the file extensions to the .gitignore file like so;
.Web.config
Any pointers much appreciated. | 2021/05/31 | [
"https://Stackoverflow.com/questions/67776563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8533722/"
] | Not sure if I got your question, but as far as I got, you have something like this:
```
.
├── .gitignore
└── something.Web.config
```
And you want to ignore `something.Web.config` by adding it in the `.gitignore`
and you tried it by adding just `.Web.config` in the content of `.gitignore`
Well, if I got it right
... | Looks like if a file has been imported into git before it’s added to .gitignore you’re too late.
You have to remove the files from git using git rm and then commit and from then on, they will be ignored. |
4,469,416 | I have apply paging in GridView which is in UpdatePanel.When I move forward to the next result set full Postback occur on my Page.Do i need to do some modification in web.config file or in my code.
```
[ ASPX ]
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePane... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4469416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/503125/"
] | ```
$("a[track]").click(function()
{
...
});
```
This will bind a click event to every link with a `track` attribute.
An even better solution is to use live to limit the number of event handler:
```
$("a[track]").live("click", function()
{
...
});
``` | Use the attribute selector:
```
$("a[track]").click(function(e){
// Your code
});
```
Example: <http://jsfiddle.net/jonathon/uXwSF/>
As andre points out in the comments, if you want to get only links where `track='yes'` then do:
```
$("a[track='yes']").click(function(e){
// Your code
});
```
If you want to g... |
47,265,926 | Is it possible to prevent the enter key from submitting forms, but allowing the enter key to work inside input. (E.g. `textArea` newline)?
I tried so far:
* `e.preventDefault()`
* `e.stopPropagation()`
Both on the form tag `onkeyup="if (e.keyCode == 13))"`
This does prevent submission of the form on enter key, but ... | 2017/11/13 | [
"https://Stackoverflow.com/questions/47265926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3362317/"
] | You can test if the element focused is not your `textarea` like following :
```js
var area = document.getElementById('area');
document.getElementById('doesntSubmit').addEventListener('keydown', function (e) {
if (e.keyCode === 13 && e.target !== area) {
e.preventDefault();
}
});
```
```html
<form id="... | try below code:
```
if(event.keyCode === 13 && event.target.type !== 'textarea') {
event.preventDefault();
return false;
}
``` |
47,265,926 | Is it possible to prevent the enter key from submitting forms, but allowing the enter key to work inside input. (E.g. `textArea` newline)?
I tried so far:
* `e.preventDefault()`
* `e.stopPropagation()`
Both on the form tag `onkeyup="if (e.keyCode == 13))"`
This does prevent submission of the form on enter key, but ... | 2017/11/13 | [
"https://Stackoverflow.com/questions/47265926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3362317/"
] | Get keypress event then check if specialClass is not :focus and check the pressed key (13 = Enter key)
```js
$(document).keypress(function(e) {
if(!$(".specialClass").is(":focus")){
e.preventDefault();
if(e.which == 13) {
console.log('You pressed enter!');
}
}
});
```
```html
<script src="http... | try below code:
```
if(event.keyCode === 13 && event.target.type !== 'textarea') {
event.preventDefault();
return false;
}
``` |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Looking at the APIs, and ignoring differences in user experience, I'd say: not difficult but not trivial. Or, another way, more difficult than going from WPF to Silverlight but less difficult than WinForms to WPF.
* Most of the WP/Silverlight controls (minus pivot/panorama) exist, but they exist a [different namespace... | You can check out <http://msdn.microsoft.com/en-us/library/windows/apps/br229571(v=VS.85).aspx> and see if that helps. |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | You can check out <http://msdn.microsoft.com/en-us/library/windows/apps/br229571(v=VS.85).aspx> and see if that helps. | This answer is the same for WP7 & SL.
>
> On a scale of one to ten, it's a six or seven at best.
>
>
>
WinRT is just not the .Net framework, unfortunately. And that's WP7 & SL.
Having said that, if WP7 <-> W8 is a 7, WP8 <-> is a 9.9!
You will NEVER get 100%, by the way. Different form factors need different ... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Despite certain people in Microsoft claiming it will only require changing a couple of lines of code...
The only possible answer to how difficult it will be to port an app is **IT DEPENDS!**
* What does the phone app do?
* How much of that functionality is also available on Win8?
* What should be done done when it's ... | If you are familiar with the MVVM architecture, you can think about it this way:
* Both apps can share the same view-model (especially if you made the design choice of not letting the view model know anything about the view)
* You create a OS-specific view, the one you already have for Windows Phone and a new one for ... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Despite certain people in Microsoft claiming it will only require changing a couple of lines of code...
The only possible answer to how difficult it will be to port an app is **IT DEPENDS!**
* What does the phone app do?
* How much of that functionality is also available on Win8?
* What should be done done when it's ... | The biggest potential problem I experienced is if you happen to have chosen to develop with XNA/Silverlight on the Windows Phone. In that case you either have to decide to completely rewrite the application or try out an XNA replacement such as MonoGame. Having gone that route myself I can happily say that, at least at... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Looking at the APIs, and ignoring differences in user experience, I'd say: not difficult but not trivial. Or, another way, more difficult than going from WPF to Silverlight but less difficult than WinForms to WPF.
* Most of the WP/Silverlight controls (minus pivot/panorama) exist, but they exist a [different namespace... | If you are familiar with the MVVM architecture, you can think about it this way:
* Both apps can share the same view-model (especially if you made the design choice of not letting the view model know anything about the view)
* You create a OS-specific view, the one you already have for Windows Phone and a new one for ... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Despite certain people in Microsoft claiming it will only require changing a couple of lines of code...
The only possible answer to how difficult it will be to port an app is **IT DEPENDS!**
* What does the phone app do?
* How much of that functionality is also available on Win8?
* What should be done done when it's ... | This answer is the same for WP7 & SL.
>
> On a scale of one to ten, it's a six or seven at best.
>
>
>
WinRT is just not the .Net framework, unfortunately. And that's WP7 & SL.
Having said that, if WP7 <-> W8 is a 7, WP8 <-> is a 9.9!
You will NEVER get 100%, by the way. Different form factors need different ... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Despite certain people in Microsoft claiming it will only require changing a couple of lines of code...
The only possible answer to how difficult it will be to port an app is **IT DEPENDS!**
* What does the phone app do?
* How much of that functionality is also available on Win8?
* What should be done done when it's ... | You can check out <http://msdn.microsoft.com/en-us/library/windows/apps/br229571(v=VS.85).aspx> and see if that helps. |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | The biggest potential problem I experienced is if you happen to have chosen to develop with XNA/Silverlight on the Windows Phone. In that case you either have to decide to completely rewrite the application or try out an XNA replacement such as MonoGame. Having gone that route myself I can happily say that, at least at... | This answer is the same for WP7 & SL.
>
> On a scale of one to ten, it's a six or seven at best.
>
>
>
WinRT is just not the .Net framework, unfortunately. And that's WP7 & SL.
Having said that, if WP7 <-> W8 is a 7, WP8 <-> is a 9.9!
You will NEVER get 100%, by the way. Different form factors need different ... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | Despite certain people in Microsoft claiming it will only require changing a couple of lines of code...
The only possible answer to how difficult it will be to port an app is **IT DEPENDS!**
* What does the phone app do?
* How much of that functionality is also available on Win8?
* What should be done done when it's ... | Looking at the APIs, and ignoring differences in user experience, I'd say: not difficult but not trivial. Or, another way, more difficult than going from WPF to Silverlight but less difficult than WinForms to WPF.
* Most of the WP/Silverlight controls (minus pivot/panorama) exist, but they exist a [different namespace... |
7,429,283 | I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.
However I also know that WinRT is not Silverlight.
Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7429283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57159/"
] | The biggest potential problem I experienced is if you happen to have chosen to develop with XNA/Silverlight on the Windows Phone. In that case you either have to decide to completely rewrite the application or try out an XNA replacement such as MonoGame. Having gone that route myself I can happily say that, at least at... | You can check out <http://msdn.microsoft.com/en-us/library/windows/apps/br229571(v=VS.85).aspx> and see if that helps. |
332,160 | I have 2 files: `args` and `text`.
For example:
args: [contains arguments of a script]
```
life
happy
horse
```
text:
```
The horse has a happy life.
Life is fun.
Kids are happy.
```
I need a command that prints the lines from `text` that contain all the patterns from `args`. In this case: `The horse has a happ... | 2016/12/22 | [
"https://unix.stackexchange.com/questions/332160",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/206781/"
] | Use `awk`.
```
~$ cat textlist.txt | awk '/life/ && /happy/ && /horse/ { print; }'
The horse has a happy life
```
textlist.txt being the list of sentences you gave. | Perhaps this is not the most efficient way of doing this, but it seem to work:
```
# for a in $(cat args); do regex="$regex | grep '$a'"; done
# eval cat text "$regex"
The horse has a happy life.
``` |
332,160 | I have 2 files: `args` and `text`.
For example:
args: [contains arguments of a script]
```
life
happy
horse
```
text:
```
The horse has a happy life.
Life is fun.
Kids are happy.
```
I need a command that prints the lines from `text` that contain all the patterns from `args`. In this case: `The horse has a happ... | 2016/12/22 | [
"https://unix.stackexchange.com/questions/332160",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/206781/"
] | ### `git grep`
Here is the syntax using [`git grep`](https://git-scm.com/docs/git-grep) combining multiple patterns using Boolean expressions:
```
git grep -e "life" --and -e "happy" --and -e "horse"
```
The above command will print lines matching all the patterns at once.
If the files aren't under version control... | Use `awk`.
```
~$ cat textlist.txt | awk '/life/ && /happy/ && /horse/ { print; }'
The horse has a happy life
```
textlist.txt being the list of sentences you gave. |
332,160 | I have 2 files: `args` and `text`.
For example:
args: [contains arguments of a script]
```
life
happy
horse
```
text:
```
The horse has a happy life.
Life is fun.
Kids are happy.
```
I need a command that prints the lines from `text` that contain all the patterns from `args`. In this case: `The horse has a happ... | 2016/12/22 | [
"https://unix.stackexchange.com/questions/332160",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/206781/"
] | You can use `agrep` to apply the *AND* operation. Unfortunately it can't apply *AND* to a list of patterns in a file, so you have to expand that into a command argument first.
```
patterns=$(sed 's/;/\\;/' <args | tr '\n' ';' | sed 's/;$//')
agrep "$patterns" text
```
The munging to generate the list of patterns joi... | Perhaps this is not the most efficient way of doing this, but it seem to work:
```
# for a in $(cat args); do regex="$regex | grep '$a'"; done
# eval cat text "$regex"
The horse has a happy life.
``` |
332,160 | I have 2 files: `args` and `text`.
For example:
args: [contains arguments of a script]
```
life
happy
horse
```
text:
```
The horse has a happy life.
Life is fun.
Kids are happy.
```
I need a command that prints the lines from `text` that contain all the patterns from `args`. In this case: `The horse has a happ... | 2016/12/22 | [
"https://unix.stackexchange.com/questions/332160",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/206781/"
] | ### `git grep`
Here is the syntax using [`git grep`](https://git-scm.com/docs/git-grep) combining multiple patterns using Boolean expressions:
```
git grep -e "life" --and -e "happy" --and -e "horse"
```
The above command will print lines matching all the patterns at once.
If the files aren't under version control... | You can use `agrep` to apply the *AND* operation. Unfortunately it can't apply *AND* to a list of patterns in a file, so you have to expand that into a command argument first.
```
patterns=$(sed 's/;/\\;/' <args | tr '\n' ';' | sed 's/;$//')
agrep "$patterns" text
```
The munging to generate the list of patterns joi... |
332,160 | I have 2 files: `args` and `text`.
For example:
args: [contains arguments of a script]
```
life
happy
horse
```
text:
```
The horse has a happy life.
Life is fun.
Kids are happy.
```
I need a command that prints the lines from `text` that contain all the patterns from `args`. In this case: `The horse has a happ... | 2016/12/22 | [
"https://unix.stackexchange.com/questions/332160",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/206781/"
] | ### `git grep`
Here is the syntax using [`git grep`](https://git-scm.com/docs/git-grep) combining multiple patterns using Boolean expressions:
```
git grep -e "life" --and -e "happy" --and -e "horse"
```
The above command will print lines matching all the patterns at once.
If the files aren't under version control... | Perhaps this is not the most efficient way of doing this, but it seem to work:
```
# for a in $(cat args); do regex="$regex | grep '$a'"; done
# eval cat text "$regex"
The horse has a happy life.
``` |
7,028,422 | Essentially I need to group unique product data into a single row when:
* The supplier sku matches
* The price for the products match (or) 1 of the product lines is equal to '0.00'
Here is a sample dataset set along with a working query for what I'm trying to accomplish. I'm simply not entirely comfortable that this ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7028422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501494/"
] | This should produce the "desired output" but the desired output is not consistent with the textual objective. Why are quantity and price varchar. This solution assumes you convert quantity to integer on the SQL table.
```
SELECT SupplierSKU, Description, SUM(Quantity), P AS [Price]
FROM @test
Where [Pric... | ```
SELECT SupplierSKU, Description, SUM(Quantity) AS Qte, SUM(Price) AS Total
FROM @test t
GROUP BY SupplierSKU, Description
ORDER BY SupplierSKU
```
Does that gets you what you want? |
7,028,422 | Essentially I need to group unique product data into a single row when:
* The supplier sku matches
* The price for the products match (or) 1 of the product lines is equal to '0.00'
Here is a sample dataset set along with a working query for what I'm trying to accomplish. I'm simply not entirely comfortable that this ... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7028422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501494/"
] | First I repaired your own solution
```
SELECT SupplierSKU, Description, SUM(Quantity) AS [Quantity], MAX(cast(Price as money)) AS [Price]
FROM
(
SELECT SupplierSKU, Description, SUM(CAST(Quantity AS INT)) AS [Quantity],
(SELECT MAX(cast(PRICE as money)) from @test
where t.SupplierSKU = SupplierSKU and... | ```
SELECT SupplierSKU, Description, SUM(Quantity) AS Qte, SUM(Price) AS Total
FROM @test t
GROUP BY SupplierSKU, Description
ORDER BY SupplierSKU
```
Does that gets you what you want? |
45,619,288 | I'm making an app in React Native and I want align a circle with the end of page.
I want to make this:
[](https://i.stack.imgur.com/TM0lJ.png)
But it's currently like this and only stays this way:
[... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45619288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8446381/"
] | Lkke to suggest one thing that can help you with this problem
what you need to do is. Everthing is correct except the main view css
```js
<View style={flexDirection:'row',justifyContent : 'space-between'}>
<View style={style.circle} />
<View>
<Text style={style.unityName}>SUPERMERCADO MACC... | Fully Customisable chat in React Native
```
import React, {Component} from 'react';
import {
Text,
StyleSheet,
View,
TextInput,
TouchableOpacity,
SafeAreaView,
FlatList,
} from 'react-native';
export default class CustomChatScreen extends Component {
state = {
messages: [
{
msg: 'Hel... |
183,295 | I have a load of tools that are kept in the /opt directory. The tools are organised like this: /opt/toolname/tool.sh. My question is, how can I add the tools in my /opt folder to my path, so i can run them from any directory in a terminal.
I have managed to do this with some tools by creating a symlinks in /usr/bin; b... | 2015/02/06 | [
"https://unix.stackexchange.com/questions/183295",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/102134/"
] | The only correct way, is to make links in `/usr/bin` or `/usr/local/bin` as you described. Because in those folders in `/opt/toolname` there are normally many other files, not just executables. I would be grubby. Anyway, adding `/opt/*/` to the `$PATH` variable would not work.
If you have a list of the full paths to t... | You can add the folders to your path using the following command:
`export PATH=/path/to/folder:$PATH`
You should include this in a shell script that will be run *before* you open a terminal window (such as .bash\_profile in your home folder).
However, since path isn't recursive, you'll need to add each individual to... |
183,295 | I have a load of tools that are kept in the /opt directory. The tools are organised like this: /opt/toolname/tool.sh. My question is, how can I add the tools in my /opt folder to my path, so i can run them from any directory in a terminal.
I have managed to do this with some tools by creating a symlinks in /usr/bin; b... | 2015/02/06 | [
"https://unix.stackexchange.com/questions/183295",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/102134/"
] | There are many ways to do it:
1. Make a symlink in `/usr/bin` (or `/usr/local/bin`) directory `sudo cp -s /opt/toolname/tool.sh /usr/bin/[unique_Toolname]`
2. Add `/opt/toolname/tool.sh` to `$PATH` variable `export $PATH=$PATH:/opt/toolname/`
3. Combine the above but use `$HOME/.local/share/bin` instead system `/usr/b... | You can add the folders to your path using the following command:
`export PATH=/path/to/folder:$PATH`
You should include this in a shell script that will be run *before* you open a terminal window (such as .bash\_profile in your home folder).
However, since path isn't recursive, you'll need to add each individual to... |
183,295 | I have a load of tools that are kept in the /opt directory. The tools are organised like this: /opt/toolname/tool.sh. My question is, how can I add the tools in my /opt folder to my path, so i can run them from any directory in a terminal.
I have managed to do this with some tools by creating a symlinks in /usr/bin; b... | 2015/02/06 | [
"https://unix.stackexchange.com/questions/183295",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/102134/"
] | The only correct way, is to make links in `/usr/bin` or `/usr/local/bin` as you described. Because in those folders in `/opt/toolname` there are normally many other files, not just executables. I would be grubby. Anyway, adding `/opt/*/` to the `$PATH` variable would not work.
If you have a list of the full paths to t... | There are many ways to do it:
1. Make a symlink in `/usr/bin` (or `/usr/local/bin`) directory `sudo cp -s /opt/toolname/tool.sh /usr/bin/[unique_Toolname]`
2. Add `/opt/toolname/tool.sh` to `$PATH` variable `export $PATH=$PATH:/opt/toolname/`
3. Combine the above but use `$HOME/.local/share/bin` instead system `/usr/b... |
14,362,247 | I need to add new property to an object, when serializing to JSON. The value for the property is calculated on runtime and does not exist in the object. Also the same object can be used for creation of different JSON with different set ot fields (kind of having a base class with subclasses, but I don't want to create o... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14362247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/741404/"
] | Can you not just add a method in value class? Note that it does not have to be either public, or use getter naming convention; you could do something like:
```
public class MyStuff {
// ... the usual fields, getters and/or setters
@JsonProperty("sum") // or whatever name you need in JSON
private int calculat... | One option is to add a field for this property and set it on the object before writing to JSON. A second option, if the property can be computed from other object properties you could just add a getter for it, for example:
```
public String getFullName() {
return getFirstName() + " " + getLastName();
}
```
And eve... |
14,362,247 | I need to add new property to an object, when serializing to JSON. The value for the property is calculated on runtime and does not exist in the object. Also the same object can be used for creation of different JSON with different set ot fields (kind of having a base class with subclasses, but I don't want to create o... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14362247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/741404/"
] | Can you not just add a method in value class? Note that it does not have to be either public, or use getter naming convention; you could do something like:
```
public class MyStuff {
// ... the usual fields, getters and/or setters
@JsonProperty("sum") // or whatever name you need in JSON
private int calculat... | 2021 calling...
Simplest way I found to do this is [`@JsonUnwrapped`](https://github.com/FasterXML/jackson-annotations/blob/master/src/main/java/com/fasterxml/jackson/annotation/JsonUnwrapped.java):
```java
public class Envelope<T> {
@JsonUnwrapped // content's fields are promoted alongside the envelope's
public ... |
14,362,247 | I need to add new property to an object, when serializing to JSON. The value for the property is calculated on runtime and does not exist in the object. Also the same object can be used for creation of different JSON with different set ot fields (kind of having a base class with subclasses, but I don't want to create o... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14362247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/741404/"
] | 2021 calling...
Simplest way I found to do this is [`@JsonUnwrapped`](https://github.com/FasterXML/jackson-annotations/blob/master/src/main/java/com/fasterxml/jackson/annotation/JsonUnwrapped.java):
```java
public class Envelope<T> {
@JsonUnwrapped // content's fields are promoted alongside the envelope's
public ... | One option is to add a field for this property and set it on the object before writing to JSON. A second option, if the property can be computed from other object properties you could just add a getter for it, for example:
```
public String getFullName() {
return getFirstName() + " " + getLastName();
}
```
And eve... |
44,679,595 | i am using autocomplete to my project and it is working fine with displaying record like image below.
[](https://i.stack.imgur.com/KpIG8.png)
but when i enter more letter to textbox result remaining the same like image below.
[![enter image descrip... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44679595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4710899/"
] | This is a basic aggregate query. You group by `OBJ`. You have a condition at the group level, which means it should be in the `HAVING` clause. The condition is on the value of `STATUS` for the most recent `DATE`; this is done with the `FIRST/LAST` function (which for some reason seems unfamiliar to many developers, inc... | >
> select all the objects whose most recent action has the column status
> on 2
>
>
>
```
SELECT ID_OBJECT
FROM
(
SELECT ID_OBJECT,
CASE
WHEN ROW_NUMBER() -- most recent row
OVER (PARTITION BY ID_OBJECT
ORDER BY any_column_to_determine_most_recent D... |
44,679,595 | i am using autocomplete to my project and it is working fine with displaying record like image below.
[](https://i.stack.imgur.com/KpIG8.png)
but when i enter more letter to textbox result remaining the same like image below.
[![enter image descrip... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44679595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4710899/"
] | This is a basic aggregate query. You group by `OBJ`. You have a condition at the group level, which means it should be in the `HAVING` clause. The condition is on the value of `STATUS` for the most recent `DATE`; this is done with the `FIRST/LAST` function (which for some reason seems unfamiliar to many developers, inc... | You might try the following (I didn't test it; there might be some error):
```
SELECT *
FROM
(
SELECT act1.*
FROM actions act1
WHERE NOT EXISTS (SELECT act2.*
FROM actions act2
WHERE act2.id_object = act1.id_object
AND act2.action_date > act... |
3,448,139 | Given a positive integer $n$, let $P(n)$ be the product of the non-zero digits of $n$ (if $n$ is a one digit number, $P(n)$ is $n$ itself). Let $S=P(1)+P(2)+P(3)+\ldots+P(999)$. Then, what is the largest prime factor of $S$?
I could not find the way how to start this problem. Please help me out. | 2019/11/23 | [
"https://math.stackexchange.com/questions/3448139",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/728272/"
] | **Hint:** Show that:
$ S = (1+1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 )^3 - 1$
When you expand the expression, which term corresponds to the product of the digits in 000, 001, 123, 302, 999? | **A big hint**
Let the sum of your numbers $P(i)$ for $1\le i \le 99$ be $T$.
Then the sum of the $P(i)$ for $101\le i \le 199$ is also $T$.
The sum of the $P(i)$ for $201\le i \le 299$ is $2T$.
...
The sum of the $P(i)$ for $901\le i \le 999$ is $9T$.
The sum of the numbers I've listed is therefore $(1+1+2+...+9... |
3,448,139 | Given a positive integer $n$, let $P(n)$ be the product of the non-zero digits of $n$ (if $n$ is a one digit number, $P(n)$ is $n$ itself). Let $S=P(1)+P(2)+P(3)+\ldots+P(999)$. Then, what is the largest prime factor of $S$?
I could not find the way how to start this problem. Please help me out. | 2019/11/23 | [
"https://math.stackexchange.com/questions/3448139",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/728272/"
] | **Hint:** Show that:
$ S = (1+1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 )^3 - 1$
When you expand the expression, which term corresponds to the product of the digits in 000, 001, 123, 302, 999? | Define the function $$f(n)=\begin{cases}
1 & (n= 0) \\
n & (n\geq1)
\end{cases}
$$ Note that for a number of at most three digits $\overline{abc}$, $$P\left(\overline{abc}\right)=f\left(a\right)f\left(b\right)f\left(c\right).$$ Therefore, $$\sum\_{n=1}^{999}P(n)=\left(\sum\_{a=0}^9 \sum\_{b=0}^9 \sum\_{c=0}^9 f\lef... |
38,408,068 | I have a row of input text boxes. I want to bring in the below functionality.
a) If I enter a value in the first input, the value should automatically copied/updated to next all text box(s). i.e to 2 till 10
b) Suppose I enter/update a value in 5th box, the value must be copied/updated automatically to 6, 7,8,9,10 bu... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38408068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2324643/"
] | The tool to use for this is a version control system, and I will show (completely untested) git commands of how I would do it.
```
## Create repository ##
$ mkdir workdir
$ cd workdir
$ git init
$ touch .gitignore # \ Creates a first commit
$ git add .gitignore # > for the branches to
$ git c... | OpenSSH isn't "from" Ubuntu (or CentOS for that matter). Both use a specific version, and apply patches to it. The RPM spec-file lists the patches in the order that they are applied. Those patches are tuned to work with the specific version of OpenSSH used as a base version.
Without a good understanding of OpenSSH, yo... |
20,087,215 | I am currently studying objective-c and the basic c programming language.
I have a questions about a particular line of code:
```
if (!balance)
```
Balance is an object that is created. I understand that this code is checking to see if the object balance is nil or not, is this correct?
Could somebody please explai... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20087215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959094/"
] | In Objective-C, `nil` is roughly analogous to `0`, `NULL` or `false`, but for object pointers. In an `if` statement, it will behave the same as one of the aforementioned scalar values. For example, the following two `if` statements should produce the same results:
```
NSNumber *balance = nil;
if (!balance) {
// d... | NSLog should return (null) (which probably is description for nil), not NULL in console. Your check should look like this:
```
if (!controller)
{
// do some stuff here
}
``` |
20,087,215 | I am currently studying objective-c and the basic c programming language.
I have a questions about a particular line of code:
```
if (!balance)
```
Balance is an object that is created. I understand that this code is checking to see if the object balance is nil or not, is this correct?
Could somebody please explai... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20087215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959094/"
] | In Objective-C, `nil` is roughly analogous to `0`, `NULL` or `false`, but for object pointers. In an `if` statement, it will behave the same as one of the aforementioned scalar values. For example, the following two `if` statements should produce the same results:
```
NSNumber *balance = nil;
if (!balance) {
// d... | If `balance` is `nil` then it will be a pointer to `0x0`. That address is never used for a valid object.
In C anything within an `if` that evaluates to zero is considered a negative response, anything that evaluates to non-zero is a positive response.
Pointers evaluate to their address — exactly as if you cast them t... |
20,087,215 | I am currently studying objective-c and the basic c programming language.
I have a questions about a particular line of code:
```
if (!balance)
```
Balance is an object that is created. I understand that this code is checking to see if the object balance is nil or not, is this correct?
Could somebody please explai... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20087215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959094/"
] | In Objective-C, `nil` is roughly analogous to `0`, `NULL` or `false`, but for object pointers. In an `if` statement, it will behave the same as one of the aforementioned scalar values. For example, the following two `if` statements should produce the same results:
```
NSNumber *balance = nil;
if (!balance) {
// d... | First you need to understand how `if` works. Basically, any non-zero value is treated as true and a zero value is treated as false.
Something as simple as `if (10)` will be treated as true while `if (0)` is treated as false.
Any expression evaluates to either a value of zero or a non-zero value.
An object pointer is... |
21,463,928 | I have a `std::map`. Given a `<key, value>` pair, I need to:
* Modify the value in the map if the key exists, or
* Insert the pair into the map if the key does not exist yet.
I'm doing it like this:
```
if (map.find(key) == map.end()){
map.insert(std::pair<int, char>(key, value));
}
else {
map[key] = value;
... | 2014/01/30 | [
"https://Stackoverflow.com/questions/21463928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748450/"
] | There are various strategies.
The simplest is just to use `operator []`:
```
map[key] = value;
```
however it requires that `value` be default constructible *and* assignable. Furthermore, since those operations take place they might (in some case) lead to performance concerns.
Another solution:
```
auto const res... | For C++17 you can use the following code:
```
auto [iterator, inserted] = map.try_emplace(key, value);
if (!inserted) { iterator->second = value; }
```
Or even easier:
```
map.insert_or_assign(key, value);
```
It will work even for key and value types that are not default constructible or not copyable. |
73,577,302 | I would like the div (home) to be in the middle of the page. The problem with me is that when I shrink the browser window at the bottom, the footer moves up with it and then eventually disappears underneath. And should I reduce the page in the browser, so zoom out, then you can see that the logo and the text are not in... | 2022/09/02 | [
"https://Stackoverflow.com/questions/73577302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19479189/"
] | Just added some property in `.home` class
```css
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
min-height: 100vh;
position: relative;
display: flex;
flex-direction: column;
}
.home {
padding: 150px 0;
flex: 1;
align-items: center;
justify-content: center;... | Try like this.
Set `flex` property into `.wrapper`.
[Code](https://jsfiddle.net/fuo2qbry/13/) |
73,577,302 | I would like the div (home) to be in the middle of the page. The problem with me is that when I shrink the browser window at the bottom, the footer moves up with it and then eventually disappears underneath. And should I reduce the page in the browser, so zoom out, then you can see that the logo and the text are not in... | 2022/09/02 | [
"https://Stackoverflow.com/questions/73577302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19479189/"
] | Just added some property in `.home` class
```css
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
min-height: 100vh;
position: relative;
display: flex;
flex-direction: column;
}
.home {
padding: 150px 0;
flex: 1;
align-items: center;
justify-content: center;... | You can try this, remove `.home` class style, and add
```
.wrapper {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
``` |
9,305,183 | Despite my sincerest efforts, I cannot seem to locate the bug here. I am writing a vector to an ofstream. The vector contains binary data. However, for some reason, when a whitespace character (0x10, 0x11, 0x12, 0x13, 0x20) is supposed to be written, it is skipped.
I have tried using iterators, and a direct ofstream::... | 2012/02/16 | [
"https://Stackoverflow.com/questions/9305183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175683/"
] | You forgot to open the file in binary mode in the read\_file function. | I think 'a' is treated as new line. I still have to think how to get around this. |
9,305,183 | Despite my sincerest efforts, I cannot seem to locate the bug here. I am writing a vector to an ofstream. The vector contains binary data. However, for some reason, when a whitespace character (0x10, 0x11, 0x12, 0x13, 0x20) is supposed to be written, it is skipped.
I have tried using iterators, and a direct ofstream::... | 2012/02/16 | [
"https://Stackoverflow.com/questions/9305183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175683/"
] | Rather than muck around with writing vector<>s directly, `boost::serialization` is a more effective way, using `boost::archive::binary_oarchive`. | I think 'a' is treated as new line. I still have to think how to get around this. |
9,305,183 | Despite my sincerest efforts, I cannot seem to locate the bug here. I am writing a vector to an ofstream. The vector contains binary data. However, for some reason, when a whitespace character (0x10, 0x11, 0x12, 0x13, 0x20) is supposed to be written, it is skipped.
I have tried using iterators, and a direct ofstream::... | 2012/02/16 | [
"https://Stackoverflow.com/questions/9305183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175683/"
] | Rather than muck around with writing vector<>s directly, `boost::serialization` is a more effective way, using `boost::archive::binary_oarchive`. | You forgot to open the file in binary mode in the read\_file function. |
9,305,183 | Despite my sincerest efforts, I cannot seem to locate the bug here. I am writing a vector to an ofstream. The vector contains binary data. However, for some reason, when a whitespace character (0x10, 0x11, 0x12, 0x13, 0x20) is supposed to be written, it is skipped.
I have tried using iterators, and a direct ofstream::... | 2012/02/16 | [
"https://Stackoverflow.com/questions/9305183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175683/"
] | You forgot to open the file in binary mode in the read\_file function. | The istream\_iterator by design skips whitespace. Try replacing your std::copy with this:
```
std::copy(
std::istreambuf_iterator<char>(in),
std::istreambuf_iterator<char>(),
std::back_inserter(v));
```
The istreambuf\_iterator goes directly to the streambuf object, which will avoid the whitespace proces... |
9,305,183 | Despite my sincerest efforts, I cannot seem to locate the bug here. I am writing a vector to an ofstream. The vector contains binary data. However, for some reason, when a whitespace character (0x10, 0x11, 0x12, 0x13, 0x20) is supposed to be written, it is skipped.
I have tried using iterators, and a direct ofstream::... | 2012/02/16 | [
"https://Stackoverflow.com/questions/9305183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175683/"
] | Rather than muck around with writing vector<>s directly, `boost::serialization` is a more effective way, using `boost::archive::binary_oarchive`. | The istream\_iterator by design skips whitespace. Try replacing your std::copy with this:
```
std::copy(
std::istreambuf_iterator<char>(in),
std::istreambuf_iterator<char>(),
std::back_inserter(v));
```
The istreambuf\_iterator goes directly to the streambuf object, which will avoid the whitespace proces... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | ActionScript, like JavaScript, is based on the ECMAScript specification. In ECMAScript, all variables are untyped - it's a dynamically (and weakly) typed language. So as a matter of fact, the static type system of AS introduced in AS2 is a Macromedia addition - untyped variables have been there forever.
Now personall... | ActionScript is an extension of a **very old** version of java-script. At one point everyone was developing their one versions of java-script. Only two main versions went into common use
* **Jscript / java-script** by netscape was used by all web browers
* **ActionsScript** is used in flash etc.
The “var” keyword is... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | The plain answer to your question is that the specification of ActionScript3 was based on draft proposals for ECMAScript, 4th revision, and those drafts specified that data could be untyped. So, AS3 allows data to be untyped. As for the *rationale*, I'd say it's almost certainly some combination of allowing backwards c... | ActionScript is an extension of a **very old** version of java-script. At one point everyone was developing their one versions of java-script. Only two main versions went into common use
* **Jscript / java-script** by netscape was used by all web browers
* **ActionsScript** is used in flash etc.
The “var” keyword is... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | ActionScript, like JavaScript, is based on the ECMAScript specification. In ECMAScript, all variables are untyped - it's a dynamically (and weakly) typed language. So as a matter of fact, the static type system of AS introduced in AS2 is a Macromedia addition - untyped variables have been there forever.
Now personall... | To add to what oggy said:
Earlier in the days of AS1 (and even AS2), the main users of the language were flash designers who didn't have a deep programming background. So not having to worry about typing/casting might have been helpful for them.
Untyped arrays, dynamic classes (like Object and Array) where you can a... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | ActionScript, like JavaScript, is based on the ECMAScript specification. In ECMAScript, all variables are untyped - it's a dynamically (and weakly) typed language. So as a matter of fact, the static type system of AS introduced in AS2 is a Macromedia addition - untyped variables have been there forever.
Now personall... | I use them where I want someting generic. ActionScript does not allow you to create generics (although the new Vector type is pretty much a generic).
For example I was messing around and made a double linked list class that could hold any data type so the :\* is perfect for that. However its not exactly the nicest thi... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | ActionScript, like JavaScript, is based on the ECMAScript specification. In ECMAScript, all variables are untyped - it's a dynamically (and weakly) typed language. So as a matter of fact, the static type system of AS introduced in AS2 is a Macromedia addition - untyped variables have been there forever.
Now personall... | Although the use of untyped variables is rare in my work, which is best, there are situations where it can be useful and significantly simplify problems. I've actually just asked a question where this untyped nature of variables shows up. Being able to dynamically add properties to an object provides great flexibility ... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | The plain answer to your question is that the specification of ActionScript3 was based on draft proposals for ECMAScript, 4th revision, and those drafts specified that data could be untyped. So, AS3 allows data to be untyped. As for the *rationale*, I'd say it's almost certainly some combination of allowing backwards c... | ActionScript, like JavaScript, is based on the ECMAScript specification. In ECMAScript, all variables are untyped - it's a dynamically (and weakly) typed language. So as a matter of fact, the static type system of AS introduced in AS2 is a Macromedia addition - untyped variables have been there forever.
Now personall... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | The plain answer to your question is that the specification of ActionScript3 was based on draft proposals for ECMAScript, 4th revision, and those drafts specified that data could be untyped. So, AS3 allows data to be untyped. As for the *rationale*, I'd say it's almost certainly some combination of allowing backwards c... | To add to what oggy said:
Earlier in the days of AS1 (and even AS2), the main users of the language were flash designers who didn't have a deep programming background. So not having to worry about typing/casting might have been helpful for them.
Untyped arrays, dynamic classes (like Object and Array) where you can a... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | The plain answer to your question is that the specification of ActionScript3 was based on draft proposals for ECMAScript, 4th revision, and those drafts specified that data could be untyped. So, AS3 allows data to be untyped. As for the *rationale*, I'd say it's almost certainly some combination of allowing backwards c... | I use them where I want someting generic. ActionScript does not allow you to create generics (although the new Vector type is pretty much a generic).
For example I was messing around and made a double linked list class that could hold any data type so the :\* is perfect for that. However its not exactly the nicest thi... |
1,465,006 | Does anybody knows if it is possible to set up admin user accounts so every potential user of the admin panel has their own login details. | 2009/09/23 | [
"https://Stackoverflow.com/questions/1465006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151032/"
] | The plain answer to your question is that the specification of ActionScript3 was based on draft proposals for ECMAScript, 4th revision, and those drafts specified that data could be untyped. So, AS3 allows data to be untyped. As for the *rationale*, I'd say it's almost certainly some combination of allowing backwards c... | Although the use of untyped variables is rare in my work, which is best, there are situations where it can be useful and significantly simplify problems. I've actually just asked a question where this untyped nature of variables shows up. Being able to dynamically add properties to an object provides great flexibility ... |
253,349 | I have set up osm on ubuntu below is how my codes are. The issue the map appears perfectly on desktop browser but it doesnt appear on mobile phone browser. What could be issue? Is there any tweak needed for some those desktop or laptop and all mobile support?
```
<div id="map" style="pos... | 2017/08/25 | [
"https://gis.stackexchange.com/questions/253349",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/98708/"
] | It is not possible to convert these symbols to points but there is a [Create Random Points](http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/create-random-points.htm) tool available in ArcGIS Desktop which:
>
> Creates a specified number of random point features. Random points can
> be genera... | You could do it in Qgis:
1. Open your .shp file in Qgis
2. Go to Toolbox and search for ***Random points inside polygons***.
[](https://i.stack.imgur.com/2H4VB.png)
(excuse my Qgis version in Spanish)
There are two options: fixe... |
12,253,759 | When I put a integer list, how can I generate another random order but with constraint?
For example, I put integer 1, 2, 3, 4 into the collection and when I try to print result like be "1 2 3 4","1 2 4 3","1 3 2 4" ,"2 1 3 4",or "2 1 4 3"(1 must before 3, 2 must before 4)
thanks in advance | 2012/09/03 | [
"https://Stackoverflow.com/questions/12253759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1644583/"
] | One thing you can consider is swapping elements at random. You could pick a random position in your collection, then swap the element in that position with the next element. This way, you can prevent swapping 1 with 3, or 2 with 4. You can do this repetitively, until the numbers are properly scrambled:
`[1, 2, 3, 4]` ... | If you use it as a string then you could use [this](https://stackoverflow.com/questions/4240080/generating-all-permutations-of-a-given-string) answer's algorithm to swap all the numbers
When you enter all the numbers then just concatenate them together. There is no need to treat them as numbers or strings. All you wan... |
12,253,759 | When I put a integer list, how can I generate another random order but with constraint?
For example, I put integer 1, 2, 3, 4 into the collection and when I try to print result like be "1 2 3 4","1 2 4 3","1 3 2 4" ,"2 1 3 4",or "2 1 4 3"(1 must before 3, 2 must before 4)
thanks in advance | 2012/09/03 | [
"https://Stackoverflow.com/questions/12253759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1644583/"
] | One thing you can consider is swapping elements at random. You could pick a random position in your collection, then swap the element in that position with the next element. This way, you can prevent swapping 1 with 3, or 2 with 4. You can do this repetitively, until the numbers are properly scrambled:
`[1, 2, 3, 4]` ... | What you've defined here is known as a [partial order](http://en.wikipedia.org/wiki/Partially_ordered_set_). You wish to generate a random permutation which still satisfies the partial order, i.e. a random linear extension.
Luckily, the Java API specifies [`Collections.shuffle`](http://docs.oracle.com/javase/7/docs/ap... |
23,507,249 | I have a personal Django website hosted by Heroku and I'm trying to configure Facebook login. I'm using [django-socialregistration](http://django-socialregistration.readthedocs.org/en/latest/index.html#) which seems pretty straightforward. Whether I am looking at my site locally or in production, I keep getting the err... | 2014/05/07 | [
"https://Stackoverflow.com/questions/23507249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695507/"
] | please show us your facebook app configuration, I think it's the `App Domains` you have miss filled.
You need to create a **facebook app**, use the **+ Add platform**
Try these setteings :
>
> Basic >
>
>
> -App Domains : sitename.com
>
>
> -App on Facebook :
>
>
> --Canvas URL : <http://sitename.com/>
>
>
... | It's difficult to say anything if we can't see what settings you have in your fb app.
Try this:
```
Settings -> Basic -> Website platform -> Site URL: http://www.sitename.com/
Settings -> Advanced -> Security -> Valid OAuth redirect URIs: http://www.sitename.com/facebook/callback
``` |
144,433 | I am looking for a phone system that integrate well with an (almost) 100% Microsoft environment.
I would like something that can integrate with Exchange and Active Directory (in-phone searching/calling by name (is this possible using SIP ?), etc) and if possible something not too expensive (Bye bye Cisco !), what do y... | 2010/05/22 | [
"https://serverfault.com/questions/144433",
"https://serverfault.com",
"https://serverfault.com/users/35545/"
] | OCS is great if you can afford it. Remember that people wanting the phone to just act like an old phone system may not go for it. It really thinks in a new paradygm. If you cannot afford on premise OCS checkout hosted OCS. I've written an [article](http://windowspbx.blogspot.com/2010/03/hosted-microsoft-office-communic... | If you are looking at IP phones in a microsoft environment you sould consider OCS. If all you want is a phone system [OCS](http://www.microsoft.com/communicationsserver/en/us/default.aspx) does a pretty good job. as well as just phone you get conferncing and im/presence capabilities integrated into the product (Eg if I... |
144,433 | I am looking for a phone system that integrate well with an (almost) 100% Microsoft environment.
I would like something that can integrate with Exchange and Active Directory (in-phone searching/calling by name (is this possible using SIP ?), etc) and if possible something not too expensive (Bye bye Cisco !), what do y... | 2010/05/22 | [
"https://serverfault.com/questions/144433",
"https://serverfault.com",
"https://serverfault.com/users/35545/"
] | If you are looking at IP phones in a microsoft environment you sould consider OCS. If all you want is a phone system [OCS](http://www.microsoft.com/communicationsserver/en/us/default.aspx) does a pretty good job. as well as just phone you get conferncing and im/presence capabilities integrated into the product (Eg if I... | We use a product called [Swyx](http://www.swyx.com/). I'm not sure how you would classify "Not too expensive", but we've scaled it over multiple sites and to about a hundred users. It's got fantastic support, and was very reasonably priced compared to Cisco Callcentre (and as someone who used to work for Cisco's global... |
144,433 | I am looking for a phone system that integrate well with an (almost) 100% Microsoft environment.
I would like something that can integrate with Exchange and Active Directory (in-phone searching/calling by name (is this possible using SIP ?), etc) and if possible something not too expensive (Bye bye Cisco !), what do y... | 2010/05/22 | [
"https://serverfault.com/questions/144433",
"https://serverfault.com",
"https://serverfault.com/users/35545/"
] | OCS is great if you can afford it. Remember that people wanting the phone to just act like an old phone system may not go for it. It really thinks in a new paradygm. If you cannot afford on premise OCS checkout hosted OCS. I've written an [article](http://windowspbx.blogspot.com/2010/03/hosted-microsoft-office-communic... | We use a product called [Swyx](http://www.swyx.com/). I'm not sure how you would classify "Not too expensive", but we've scaled it over multiple sites and to about a hundred users. It's got fantastic support, and was very reasonably priced compared to Cisco Callcentre (and as someone who used to work for Cisco's global... |
32,854,254 | I'm having trouble with a basic c++ program assignment, and would greatly appreciate any help. The assignment is as follows:
Write a program that accepts input from the keyboard (with the input
terminated by pressing the Enter key) and counts the number of letters (A-Z and a-z), numerical digits (0-9), and other chara... | 2015/09/29 | [
"https://Stackoverflow.com/questions/32854254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5378504/"
] | As mentioned in the other answer, you need to initialize your variables, but you have also an error in this code:
```
if ((s[i] >= 'a' && s[i] <= 'z') || s[i] >= 'A' && (s[i] <= 'Z'))
```
the brackets are wrong. And as a result, you are not counting lowercase letters (i think) anyways it shoul be this (indented for ... | You need to set each integer to 0. As it is, your code only sets `otherChars = 0`. Make that line `numLet = 0, numChars = 0, otherChars = 0;`. |
990,358 | What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why? | 2014/10/25 | [
"https://math.stackexchange.com/questions/990358",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187221/"
] | The answer should be $$p=987654103.$$
As any number using all ten digits would by a multiple of $3$, we are left with only few nine-digit candidates $987654xyz$ that can be checked manually. | Hint: Suppose you had all ten digits - what would the sum of the digits be? |
990,358 | What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why? | 2014/10/25 | [
"https://math.stackexchange.com/questions/990358",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187221/"
] | Hint: Suppose you had all ten digits - what would the sum of the digits be? | This question depends on the number base being used. It is assumed that the OP meant base 10, but there is nothing special about that (or the answer) except that humans generally have ten fingers. Here are a few others in different bases:
* base 2: 10 (2)
* base 3: 201 (19)
* base 4: 103 (19, using all three non-zero ... |
990,358 | What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why? | 2014/10/25 | [
"https://math.stackexchange.com/questions/990358",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187221/"
] | Hint: Suppose you had all ten digits - what would the sum of the digits be? | If all the digits are used, it will be divisible by 3, right? Same also if you will use the digits 1-9. Therefore, the largest prime number with different digits is less than 10 digits. If it would be nine digits, O is included as one of the digits. |
990,358 | What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why? | 2014/10/25 | [
"https://math.stackexchange.com/questions/990358",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187221/"
] | The answer should be $$p=987654103.$$
As any number using all ten digits would by a multiple of $3$, we are left with only few nine-digit candidates $987654xyz$ that can be checked manually. | This question depends on the number base being used. It is assumed that the OP meant base 10, but there is nothing special about that (or the answer) except that humans generally have ten fingers. Here are a few others in different bases:
* base 2: 10 (2)
* base 3: 201 (19)
* base 4: 103 (19, using all three non-zero ... |
990,358 | What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why? | 2014/10/25 | [
"https://math.stackexchange.com/questions/990358",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187221/"
] | The answer should be $$p=987654103.$$
As any number using all ten digits would by a multiple of $3$, we are left with only few nine-digit candidates $987654xyz$ that can be checked manually. | If all the digits are used, it will be divisible by 3, right? Same also if you will use the digits 1-9. Therefore, the largest prime number with different digits is less than 10 digits. If it would be nine digits, O is included as one of the digits. |
990,358 | What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why? | 2014/10/25 | [
"https://math.stackexchange.com/questions/990358",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/187221/"
] | This question depends on the number base being used. It is assumed that the OP meant base 10, but there is nothing special about that (or the answer) except that humans generally have ten fingers. Here are a few others in different bases:
* base 2: 10 (2)
* base 3: 201 (19)
* base 4: 103 (19, using all three non-zero ... | If all the digits are used, it will be divisible by 3, right? Same also if you will use the digits 1-9. Therefore, the largest prime number with different digits is less than 10 digits. If it would be nine digits, O is included as one of the digits. |
6,798 | I've tried disabling WP's auto-paragraph thingy using
`remove_filter ('the_content', 'wpautop');`
but I am still getting my stuff wrapped in automatic `<p>` tags... What am I doing wrong?
Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in fun... | 2011/01/12 | [
"https://wordpress.stackexchange.com/questions/6798",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | Had same problem, fixed with css:
```
<style>
p:empty{
height: 0;
margin: 0;
padding: 0;
}
</style>
``` | Your code is absolutely correct. You can try this snippet in template to ensure it is being removed:
```
var_dump( $wp_filter['the_content'] );
```
If it's not it may be that code never reaches your filter removal (`return` above it for example) or filter is re-added later by some other code. |
6,798 | I've tried disabling WP's auto-paragraph thingy using
`remove_filter ('the_content', 'wpautop');`
but I am still getting my stuff wrapped in automatic `<p>` tags... What am I doing wrong?
Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in fun... | 2011/01/12 | [
"https://wordpress.stackexchange.com/questions/6798",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | Your code is absolutely correct. You can try this snippet in template to ensure it is being removed:
```
var_dump( $wp_filter['the_content'] );
```
If it's not it may be that code never reaches your filter removal (`return` above it for example) or filter is re-added later by some other code. | My problem was while developing a shortcode. Credits to Samuel Wood. See his advice here:
>
> Oh, and if you’re putting in shortcodes, use a shortcode block instead
> of typing them into a P block. Then you won’t have wrapper P tags.
>
>
>
<https://wordpress.org/support/topic/wpautop-not-working-on-wp_editor/> |
6,798 | I've tried disabling WP's auto-paragraph thingy using
`remove_filter ('the_content', 'wpautop');`
but I am still getting my stuff wrapped in automatic `<p>` tags... What am I doing wrong?
Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in fun... | 2011/01/12 | [
"https://wordpress.stackexchange.com/questions/6798",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | Had same problem, fixed with css:
```
<style>
p:empty{
height: 0;
margin: 0;
padding: 0;
}
</style>
``` | If you're using the TinyMCE Advanced plugin, try unchecking this advanced option:
>
> Stop removing the <p> and <br /> tags when saving and show them in the HTML editor
>
>
>
Unchecking that and using the `remove_filter ('the_content', 'wpautop');` code in my functions.php did the trick for me. |
6,798 | I've tried disabling WP's auto-paragraph thingy using
`remove_filter ('the_content', 'wpautop');`
but I am still getting my stuff wrapped in automatic `<p>` tags... What am I doing wrong?
Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in fun... | 2011/01/12 | [
"https://wordpress.stackexchange.com/questions/6798",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | If you're using the TinyMCE Advanced plugin, try unchecking this advanced option:
>
> Stop removing the <p> and <br /> tags when saving and show them in the HTML editor
>
>
>
Unchecking that and using the `remove_filter ('the_content', 'wpautop');` code in my functions.php did the trick for me. | My problem was while developing a shortcode. Credits to Samuel Wood. See his advice here:
>
> Oh, and if you’re putting in shortcodes, use a shortcode block instead
> of typing them into a P block. Then you won’t have wrapper P tags.
>
>
>
<https://wordpress.org/support/topic/wpautop-not-working-on-wp_editor/> |
6,798 | I've tried disabling WP's auto-paragraph thingy using
`remove_filter ('the_content', 'wpautop');`
but I am still getting my stuff wrapped in automatic `<p>` tags... What am I doing wrong?
Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in fun... | 2011/01/12 | [
"https://wordpress.stackexchange.com/questions/6798",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | Had same problem, fixed with css:
```
<style>
p:empty{
height: 0;
margin: 0;
padding: 0;
}
</style>
``` | My problem was while developing a shortcode. Credits to Samuel Wood. See his advice here:
>
> Oh, and if you’re putting in shortcodes, use a shortcode block instead
> of typing them into a P block. Then you won’t have wrapper P tags.
>
>
>
<https://wordpress.org/support/topic/wpautop-not-working-on-wp_editor/> |
61,231,809 | I am trying to map through the database and return certain variables. I want to be able to do this within a class if possible.
I have fetched from my database like this:
```
class MyDevices extends Component {
state = {
house: [],
selectedMovie: null
}
componentDidMount() {
fetch('https://api.herokua... | 2020/04/15 | [
"https://Stackoverflow.com/questions/61231809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11488710/"
] | A common practice to ensure safety across multiple threads (that is tasks running in parallell in the same process) is to use a [mutex](https://en.wikipedia.org/wiki/Mutual_exclusion). Since this will be ran in multiple processes the lock needs to be acquired outside of the process.
What you describe as a solution is ... | You can keep the design simple by having each parallel process write to a separate file. Then when all the processes are finished, have a final process gather all the results and combine them into a single output file. This is a common pattern for HPC processing pipelines. |
61,021,537 | Let's say I have a text file:
```
>>cat tmp.txt
1 1 1 1 1 -1 -1 -1 -1 -1 10 10 10 10 10
```
I want to find the number of unique occurrences of the number 1, -1, and 10. The following is what I have thus far:
```
awk -F '-1' '{print NF-1,NR}' tmp.txt | awk '{print $1}'
awk -F '10' '{print NF-1,NR}' tmp.txt | awk '{p... | 2020/04/03 | [
"https://Stackoverflow.com/questions/61021537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6241863/"
] | I found the bug, it was actually from my end.
When I was chunking, my indexes in chunks were preserving their indexes of actual array, and as it wasn't giving [0,1,2], it was causing the api call to fail.
`array_values($chunk);` should fix that issue.
*for Laravel's collection `$chunk->values()->toArray();`* | I've posted this as a comment, but the formatting didn't help.
Add following lines to `FacebookAds/Http/Adapter/CurlAdapter.php` just before `$raw_response = $this->getCurl()->exec();`.
```php
$fp = fopen("/temp/log_" . uniqid() . ".txt", "w"); // change this to any file, but make sure it changes between requests
cu... |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | Your regex is fine. You just need to read your email address inside the click listener as
```
btnchk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String email = edt.getText().toString().trim();
if (email.matches(emailPattern))
{
```
The issue ... | Try:
```
if(isEditTextContainEmail(edtEmailAddress))
{
Toast.makeText(getApplicationContext(),"valid email address",Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getApplicationContext(),"Invalid email address", Toast.LENGTH_SHORT).show();
}
```
Using this method:
```
publ... |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | I think that @Ravi has spotted the immediate cause of your problem. You are not validating the correct string.
However, your regex is also wrong, as it excludes numerous email addresses that are in fact valid. For example:
* the local part can be a quoted string
* the local part can include all sorts of non-alphanume... | Try:
```
if(isEditTextContainEmail(edtEmailAddress))
{
Toast.makeText(getApplicationContext(),"valid email address",Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getApplicationContext(),"Invalid email address", Toast.LENGTH_SHORT).show();
}
```
Using this method:
```
publ... |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | Your regex is fine. You just need to read your email address inside the click listener as
```
btnchk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String email = edt.getText().toString().trim();
if (email.matches(emailPattern))
{
```
The issue ... | Try this reg-ex:
```
[a-zA-Z0-9._-]+@[a-z]+\.[a-z]+
``` |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | I think that @Ravi has spotted the immediate cause of your problem. You are not validating the correct string.
However, your regex is also wrong, as it excludes numerous email addresses that are in fact valid. For example:
* the local part can be a quoted string
* the local part can include all sorts of non-alphanume... | Try this reg-ex:
```
[a-zA-Z0-9._-]+@[a-z]+\.[a-z]+
``` |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | Your regex is fine. You just need to read your email address inside the click listener as
```
btnchk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String email = edt.getText().toString().trim();
if (email.matches(emailPattern))
{
```
The issue ... | i think this is better solution for chek email validation try this..
```
public final static boolean isValidEmail(CharSequence yourEmail) {
if (yourEmail== null) {
return false;
} else {
return android.util.Patterns.EMAIL_ADDRESS.matcher(yourEmail).matches();
}
}
```
i hope to work for yo... |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | Your regex is fine. You just need to read your email address inside the click listener as
```
btnchk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String email = edt.getText().toString().trim();
if (email.matches(emailPattern))
{
```
The issue ... | I think that @Ravi has spotted the immediate cause of your problem. You are not validating the correct string.
However, your regex is also wrong, as it excludes numerous email addresses that are in fact valid. For example:
* the local part can be a quoted string
* the local part can include all sorts of non-alphanume... |
28,893,764 | I tried this simple example.
```
final String email = edt.getText().toString().trim();
//final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
final String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
btnchk.setOnClickListener(new OnClic... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28893764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351156/"
] | I think that @Ravi has spotted the immediate cause of your problem. You are not validating the correct string.
However, your regex is also wrong, as it excludes numerous email addresses that are in fact valid. For example:
* the local part can be a quoted string
* the local part can include all sorts of non-alphanume... | i think this is better solution for chek email validation try this..
```
public final static boolean isValidEmail(CharSequence yourEmail) {
if (yourEmail== null) {
return false;
} else {
return android.util.Patterns.EMAIL_ADDRESS.matcher(yourEmail).matches();
}
}
```
i hope to work for yo... |
70,516,967 | I am building a project and I am trying to declare class's name in variable before declaring variable.
But when I declare variable like :-
```
klassName = MyClass
class klassName(models.Model):
title = models.CharField(max_length=30)
```
then it is assigning with `KlassName` Not the variable I referenced to it... | 2021/12/29 | [
"https://Stackoverflow.com/questions/70516967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17131560/"
] | To create a class dynamically you can use the three argument form of `type`. To also dynamically create a variable or module member with the same name you can use `globals()` to create variables dynamically
```
globals()['className'] = type('className', (object,), {'foo': 'bar'})
```
To create a model dynamically ma... | in your example:
```
klassName = MyClass
class klassName(models.Model):
title = models.CharField(max_length=30)
```
klassName referenced to nothing, because MyClass is not defined.
You can say:
```
MyClass = klassName
class klassName(models.Model):
title = models.CharField(max_length=30)
``` |
29,148,362 | Im currently working with JDBC and Swing to create a GUI and getting values from a local database.I'm fetching data from the database and want to put it in a JComboBox but there is some kind of problem with transfering the data from one class to another. I've checked and the data is coming from the db correctly so that... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29148362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3428812/"
] | After training, if you have test data and labels, you could check accuracy and generate an ROC plot/ AUC score via:
```
from sklearn.metrics import classification_report
from sklearn.metrics import roc_curve, auc
import matplotlib.pyplot as plt
# overall accuracy
acc = clf.score(X_test,Y_test)
# get roc/auc info
Y_... | Some basic metrics that you could use are accuracy, f1 score, and Area Under the Receiver Operating Characteristic Curve, which are all available in the sklearn library.
You can find metrics available in the sklearn library [here](https://scikit-learn.org/stable/modules/classes.html#classification-metrics). |
640,169 | I am trying to remove the spaces from each line till the last word for each line in a file.
Example input file:
```
808 0 C01124 Amazon 45/234Birch 00 YYY
808 0 C01184 Flipkart 45/234Lotus 01 YYY
808 0 C01186 PrimeTime 45/2... | 2021/03/20 | [
"https://unix.stackexchange.com/questions/640169",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/461473/"
] | The are a number of ways. The most obvious, at least to me, is to use a loop inside sed.
```
sed -e :loop -e 's/ *\(.*YYY\)/\1/;t loop'
```
(there are two spaces after the first slash).
The `:loop` just is a label.
The `s/ *\(.*YYY\)/\1/` matches one or more spaces followed by something and then YYY and replaces ... | ```
sed -r "s/\s+//g" filename
output
8080C01124Amazon45/234Birch00YYY
8080C01184Flipkart45/234Lotus01YYY
8080C01186PrimeTime45/23XCCCCH08YYY
8080C01125DMART5/23PPPPPPP09YYY
awk '{gsub(" ","",$0);print }' filename
8080C01124Amazon45/234Birch00YYY
8080C01184Flipkart45/234Lotus01YYY
8080C01186PrimeTime45/23XCCCCH08Y... |
640,169 | I am trying to remove the spaces from each line till the last word for each line in a file.
Example input file:
```
808 0 C01124 Amazon 45/234Birch 00 YYY
808 0 C01184 Flipkart 45/234Lotus 01 YYY
808 0 C01186 PrimeTime 45/2... | 2021/03/20 | [
"https://unix.stackexchange.com/questions/640169",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/461473/"
] | The are a number of ways. The most obvious, at least to me, is to use a loop inside sed.
```
sed -e :loop -e 's/ *\(.*YYY\)/\1/;t loop'
```
(there are two spaces after the first slash).
The `:loop` just is a label.
The `s/ *\(.*YYY\)/\1/` matches one or more spaces followed by something and then YYY and replaces ... | Using **GNU sed** stream editor in extended regex mode `-E` , we strip away the internal spaces, those that see a nonwhitespace on both sides.
It needs a repeat as a single character nonwhitespace will stop the run.
```
sed -Ee '
s/(\S)\s+(\S)/\1\2/g
s//\1\2/g
' file
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.