qid
int64
1
74.6M
question
stringlengths
45
24.2k
date
stringlengths
10
10
metadata
stringlengths
101
178
response_j
stringlengths
32
23.2k
response_k
stringlengths
21
13.2k
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
Line 141 of the code you page linked to is this: ``` 141 - done ``` You are not going anything with that variable and you do not end with a semi-colon. *(Since you are not using a Visual Studio editor, i suspect the program was working, then you introduced a compile time error. Now each time you run the program, yo...
My suggestion: use Nunit and write an unit test for it. Nunit will give expected and actual value and you'll see why this isn't working.
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
First of all: You have error in line 141. Delete that `done` word. I suggest it was just copy paste mistake. Second of all: Here you say your code is: ``` else if (type == "cups") { Console.WriteLine("Enter a number of liters to be converted into cups."); amount = Convert.ToDouble(Console.ReadL...
My suggestion: use Nunit and write an unit test for it. Nunit will give expected and actual value and you'll see why this isn't working.
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
I ran your code and (after fixing a simple error) it correctly enters the *else if* that you reference. You may want to echo back what you type in to make sure you are not mistyping your input. The error was that you have > > done > > > on a line by itself. Presumably you meant to assign a value.
Line 141 of the code you page linked to is this: ``` 141 - done ``` You are not going anything with that variable and you do not end with a semi-colon. *(Since you are not using a Visual Studio editor, i suspect the program was working, then you introduced a compile time error. Now each time you run the program, yo...
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
I ran your code and (after fixing a simple error) it correctly enters the *else if* that you reference. You may want to echo back what you type in to make sure you are not mistyping your input. The error was that you have > > done > > > on a line by itself. Presumably you meant to assign a value.
If the "If else" doesn't get hit, it means one of two things: Either a previous condition is true, or the condition is false. The '==' operator is case sensitive when comparing [strings](http://msdn.microsoft.com/en-us/library/362314fe%28v=vs.71%29.aspx) So be sure to take that into account . It is a more complex top...
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
First of all: You have error in line 141. Delete that `done` word. I suggest it was just copy paste mistake. Second of all: Here you say your code is: ``` else if (type == "cups") { Console.WriteLine("Enter a number of liters to be converted into cups."); amount = Convert.ToDouble(Console.ReadL...
I ran your code and (after fixing a simple error) it correctly enters the *else if* that you reference. You may want to echo back what you type in to make sure you are not mistyping your input. The error was that you have > > done > > > on a line by itself. Presumably you meant to assign a value.
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
Line 141 of the code you page linked to is this: ``` 141 - done ``` You are not going anything with that variable and you do not end with a semi-colon. *(Since you are not using a Visual Studio editor, i suspect the program was working, then you introduced a compile time error. Now each time you run the program, yo...
If the "If else" doesn't get hit, it means one of two things: Either a previous condition is true, or the condition is false. The '==' operator is case sensitive when comparing [strings](http://msdn.microsoft.com/en-us/library/362314fe%28v=vs.71%29.aspx) So be sure to take that into account . It is a more complex top...
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
First of all: You have error in line 141. Delete that `done` word. I suggest it was just copy paste mistake. Second of all: Here you say your code is: ``` else if (type == "cups") { Console.WriteLine("Enter a number of liters to be converted into cups."); amount = Convert.ToDouble(Console.ReadL...
Line 141 of the code you page linked to is this: ``` 141 - done ``` You are not going anything with that variable and you do not end with a semi-colon. *(Since you are not using a Visual Studio editor, i suspect the program was working, then you introduced a compile time error. Now each time you run the program, yo...
12,100,977
So I can't seem to get an else if to work right. What I've been doing is writing a unit converter to try and teach myself the basics of programming, I'm kind of new to it. So new as to say this is actually my first working while loop. So I've been writing the code, and then doing as a friend who is somewhat more exper...
2012/08/23
['https://Stackoverflow.com/questions/12100977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1620762/']
First of all: You have error in line 141. Delete that `done` word. I suggest it was just copy paste mistake. Second of all: Here you say your code is: ``` else if (type == "cups") { Console.WriteLine("Enter a number of liters to be converted into cups."); amount = Convert.ToDouble(Console.ReadL...
If the "If else" doesn't get hit, it means one of two things: Either a previous condition is true, or the condition is false. The '==' operator is case sensitive when comparing [strings](http://msdn.microsoft.com/en-us/library/362314fe%28v=vs.71%29.aspx) So be sure to take that into account . It is a more complex top...
8,062,712
I am using VS2005 C# and SQL Server 2005. I am currently doing an import for a .CSV excel file data into my SQL Server database. I am having some error, which I assume is related to my sql statement. Below is my code: ``` protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile)...
2011/11/09
['https://Stackoverflow.com/questions/8062712', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/872370/']
You need a space between FROM and the csv file! :) ``` OleDbCommand ExcelCommand = new OleDbCommand("SELECT [TABLES] FROM " + mycsv, ExcelConnection); ``` That's why I always use the string.Format method, you see much better how the final string will look: ``` OleDbCommand ExcelCommand = new OleDbCommand(string.For...
Seems like you need to place a blank between FROM and your CSV-File: '[Description] FROM 20111109164041.csv'
8,062,712
I am using VS2005 C# and SQL Server 2005. I am currently doing an import for a .CSV excel file data into my SQL Server database. I am having some error, which I assume is related to my sql statement. Below is my code: ``` protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile)...
2011/11/09
['https://Stackoverflow.com/questions/8062712', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/872370/']
You need a space between FROM and the csv file! :) ``` OleDbCommand ExcelCommand = new OleDbCommand("SELECT [TABLES] FROM " + mycsv, ExcelConnection); ``` That's why I always use the string.Format method, you see much better how the final string will look: ``` OleDbCommand ExcelCommand = new OleDbCommand(string.For...
If you are adding a string you should place it between single quotes ``` OleDbDataAdapter da = new OleDbDataAdapter("select * , '" + tempUid + "' as [UID] from [" + sheet1 + "]", conn); ```
8,062,712
I am using VS2005 C# and SQL Server 2005. I am currently doing an import for a .CSV excel file data into my SQL Server database. I am having some error, which I assume is related to my sql statement. Below is my code: ``` protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile)...
2011/11/09
['https://Stackoverflow.com/questions/8062712', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/872370/']
Seems like you need to place a blank between FROM and your CSV-File: '[Description] FROM 20111109164041.csv'
If you are adding a string you should place it between single quotes ``` OleDbDataAdapter da = new OleDbDataAdapter("select * , '" + tempUid + "' as [UID] from [" + sheet1 + "]", conn); ```
62,770,330
I have a list of words that I want to search in a string of large text.I have defined a function that returns each individual word but I dont know how to pass the function to re.findall(). I want to get any sentense that contains any word that is in words list. Can someone assist :) here is what I got: ``` strings = [...
2020/07/07
['https://Stackoverflow.com/questions/62770330', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13863930/']
The problem was with the `transform.rotation` that was not able to change the rotation from -90/270 to new rotation. I instead had to use `transform.localRotation` and it worked perfectly. ``` using UnityEngine; using System.Collections; public class ScaleAndRotate : MonoBehaviour { public int startSize = 3; ...
I think the problem is that you miss brackets when you use `if` statements: ``` if (Input.GetKeyDown (KeyCode.UpArrow)) ChangeSize (true); startRotation = true; if (Input.GetKeyDown (KeyCode.DownArrow)) ChangeSize (false); startRotation = false; ``...
3,647,548
I want to manually update the `contentOffset` of an `UIScrollView` during rotation changes. The scroll view fills the screen and has flexible width and flexible height. I'm currently trying to update the contentOffset in `willRotateToInterfaceOrientation`, like this: ``` - (void) willRotateToInterfaceOrientation:(UII...
2010/09/05
['https://Stackoverflow.com/questions/3647548', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/143378/']
Converting my comment to an answer :) Try changing `contentOffset` from within `willAnimateRotationToInterfaceOrientation:duration:` instead. An animation block should be in place by then, and the OS regards your changes to contentOffset as belonging to the changes caused by the rotation. If you change contentOffset ...
Following snippets does the trick when paging is enabled on UIScrollView and page offset is to be maintained. Declare a property which will calculate position of currentPage before rotation, and set it to -1 in `viewDidLoad` ``` @property (assign, nonatomic) NSInteger lastPageBeforeRotate; ``` Then override the `wi...
3,647,548
I want to manually update the `contentOffset` of an `UIScrollView` during rotation changes. The scroll view fills the screen and has flexible width and flexible height. I'm currently trying to update the contentOffset in `willRotateToInterfaceOrientation`, like this: ``` - (void) willRotateToInterfaceOrientation:(UII...
2010/09/05
['https://Stackoverflow.com/questions/3647548', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/143378/']
Converting my comment to an answer :) Try changing `contentOffset` from within `willAnimateRotationToInterfaceOrientation:duration:` instead. An animation block should be in place by then, and the OS regards your changes to contentOffset as belonging to the changes caused by the rotation. If you change contentOffset ...
Updated answer for iOS 8+ Implement viewWillTransitionToSize:withTransitionCoordinator: in your controller. Example: ``` -(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator { NSUInteger visiblePage = (NSInteger) self.scrollView.contentOffs...
23,089
I have a set of XML based services running on my network. The data in these services needs to be mirrored into a Table on an SQL Server 2008 instance. Getting the XML into a table is no problem I can already do that, but what I'm having to do at the moment is pass a huge long string of XML to a stored proc which then...
2012/08/24
['https://dba.stackexchange.com/questions/23089', 'https://dba.stackexchange.com', 'https://dba.stackexchange.com/users/8602/']
Use an external process that does the HTTP work and the inserts into the database. I explicitly advise against using SQLCLR for this. Hijacking precious SQL Server [workers](http://msdn.microsoft.com/en-us/library/ms187024%28v=sql.105%29.aspx) for the boring job of waiting for HTTP results will one day impact your serv...
There are a few ways to do this. You could use a custom driver and set up a web service as a linked server; you could use a CLR procedure to connect to the web service - or you could use SSIS which has the ability to do this built-in. If you prefer to do less work then SSIS is the way to go; however if you wanted som...
23,089
I have a set of XML based services running on my network. The data in these services needs to be mirrored into a Table on an SQL Server 2008 instance. Getting the XML into a table is no problem I can already do that, but what I'm having to do at the moment is pass a huge long string of XML to a stored proc which then...
2012/08/24
['https://dba.stackexchange.com/questions/23089', 'https://dba.stackexchange.com', 'https://dba.stackexchange.com/users/8602/']
I use sp\_OACreate extensively to do the sort of thing you are doing. I suspect that your problem may be that the size of the XML data you are receiving exceeds 8000 characters. (i.e. SQL may not be returning any data when you exceed 8000 characters). sp\_OAGetProperty and other extended stored procedures cannot pass ...
There are a few ways to do this. You could use a custom driver and set up a web service as a linked server; you could use a CLR procedure to connect to the web service - or you could use SSIS which has the ability to do this built-in. If you prefer to do less work then SSIS is the way to go; however if you wanted som...
23,089
I have a set of XML based services running on my network. The data in these services needs to be mirrored into a Table on an SQL Server 2008 instance. Getting the XML into a table is no problem I can already do that, but what I'm having to do at the moment is pass a huge long string of XML to a stored proc which then...
2012/08/24
['https://dba.stackexchange.com/questions/23089', 'https://dba.stackexchange.com', 'https://dba.stackexchange.com/users/8602/']
Use an external process that does the HTTP work and the inserts into the database. I explicitly advise against using SQLCLR for this. Hijacking precious SQL Server [workers](http://msdn.microsoft.com/en-us/library/ms187024%28v=sql.105%29.aspx) for the boring job of waiting for HTTP results will one day impact your serv...
Since you're a dev, you should have no trouble with SSIS. Create a data flow task and use a script component as source. Choose your language of preference (VB.net or C#) for the script component. You can probably reuse most of your CLR code that downloads the file from the web site. Then follow the layout in the foll...
23,089
I have a set of XML based services running on my network. The data in these services needs to be mirrored into a Table on an SQL Server 2008 instance. Getting the XML into a table is no problem I can already do that, but what I'm having to do at the moment is pass a huge long string of XML to a stored proc which then...
2012/08/24
['https://dba.stackexchange.com/questions/23089', 'https://dba.stackexchange.com', 'https://dba.stackexchange.com/users/8602/']
Use an external process that does the HTTP work and the inserts into the database. I explicitly advise against using SQLCLR for this. Hijacking precious SQL Server [workers](http://msdn.microsoft.com/en-us/library/ms187024%28v=sql.105%29.aspx) for the boring job of waiting for HTTP results will one day impact your serv...
I use sp\_OACreate extensively to do the sort of thing you are doing. I suspect that your problem may be that the size of the XML data you are receiving exceeds 8000 characters. (i.e. SQL may not be returning any data when you exceed 8000 characters). sp\_OAGetProperty and other extended stored procedures cannot pass ...
23,089
I have a set of XML based services running on my network. The data in these services needs to be mirrored into a Table on an SQL Server 2008 instance. Getting the XML into a table is no problem I can already do that, but what I'm having to do at the moment is pass a huge long string of XML to a stored proc which then...
2012/08/24
['https://dba.stackexchange.com/questions/23089', 'https://dba.stackexchange.com', 'https://dba.stackexchange.com/users/8602/']
I use sp\_OACreate extensively to do the sort of thing you are doing. I suspect that your problem may be that the size of the XML data you are receiving exceeds 8000 characters. (i.e. SQL may not be returning any data when you exceed 8000 characters). sp\_OAGetProperty and other extended stored procedures cannot pass ...
Since you're a dev, you should have no trouble with SSIS. Create a data flow task and use a script component as source. Choose your language of preference (VB.net or C#) for the script component. You can probably reuse most of your CLR code that downloads the file from the web site. Then follow the layout in the foll...
53,437,470
I have 3 UIStackViews laid as follows edge to edge: ``` SV1 ---- SV2 ---- SV3 ``` SV1 sits at a fixed distance of 5 points to superview leading, SV2 center is aligned with center of superview, and SV3 is at a fixed distance of 5 points to views trailing. Problem is on iPhone SE, SV2 is too wide and too close to S...
2018/11/22
['https://Stackoverflow.com/questions/53437470', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/917521/']
Setting max unavailable to 0 is a way to go and also, using nodepools can be a good workaround. ``` gcloud container node-pools create <nodepool> --node-taints=app=dask-scheduler:NoSchedule gcloud container node-pools create <nodepool> --node-labels app=dask-scheduler ``` This will create the nodepool with the label...
Are you specifying resource requests and limits?
1,623,321
I am trying to expand $\sqrt{x(1-x)}$ in order to find the order of it as $x\to0$. Using Taylor expansion to find the derivative of the equation as $x\to0$ gives each item $0$. Then how do we expand it? Thanks,
2016/01/23
['https://math.stackexchange.com/questions/1623321', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/206901/']
In general $$\lim\_{x \to 0} (1+x)^{\alpha} = 1 + \binom{\alpha}{1} x + \binom{\alpha}{2} x^2 + \binom{\alpha}{3} x^3 + \ldots = \sum\_{i = 0}^{n} \binom{\alpha}{i} x^{i} + O(x^n)$$ thus as $x \to 0$ \begin{align} \sqrt{x(1+x)}&=\sqrt{x} \cdot \sqrt{1+x} \\ &=x^{1/2} \cdot (1+x)^{1/2}\\ &=x^{1/2} \cdot \left( \sum\_{i ...
As Aditya Agarwal said: $\sqrt{x(1+x)}=x^{1/2}(1-x/2+...)$
1,623,321
I am trying to expand $\sqrt{x(1-x)}$ in order to find the order of it as $x\to0$. Using Taylor expansion to find the derivative of the equation as $x\to0$ gives each item $0$. Then how do we expand it? Thanks,
2016/01/23
['https://math.stackexchange.com/questions/1623321', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/206901/']
my answer: $\sqrt{x(1-x)}$ $=x^{1/2}(1-x)^{1/2}$ expand for $x\to 0$, $=x^{1/2}(1+\frac 12(-x)+\frac{\frac12(1-\frac{1}{2})}{2!}(-x)^2+...........)$ $=x^{1/2}-\frac 12x^{3/2}-\frac{1}{8}x^{5/2}+...........$
As Aditya Agarwal said: $\sqrt{x(1+x)}=x^{1/2}(1-x/2+...)$
1,623,321
I am trying to expand $\sqrt{x(1-x)}$ in order to find the order of it as $x\to0$. Using Taylor expansion to find the derivative of the equation as $x\to0$ gives each item $0$. Then how do we expand it? Thanks,
2016/01/23
['https://math.stackexchange.com/questions/1623321', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/206901/']
Find the derivatives of $$f(x)=\sqrt{1-x}$$ $$=\sqrt{1-0}+\frac{\frac{d}{dx}\left(\sqrt{1-x}\right)\left(0\right)}{1!}x+\frac{\frac{d^2}{dx^2}\left(\sqrt{1-x}\right)\left(0\right)}{2!}x^2+\frac{\frac{d^3}{dx^3}\left(\sqrt{1-x}\right)\left(0\right)}{3!}x^3+\ldots \:$$ Then $\sqrt{1-0}\quad :\quad 1$ $\frac{d}{dx}\left...
As Aditya Agarwal said: $\sqrt{x(1+x)}=x^{1/2}(1-x/2+...)$
1,623,321
I am trying to expand $\sqrt{x(1-x)}$ in order to find the order of it as $x\to0$. Using Taylor expansion to find the derivative of the equation as $x\to0$ gives each item $0$. Then how do we expand it? Thanks,
2016/01/23
['https://math.stackexchange.com/questions/1623321', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/206901/']
In general $$\lim\_{x \to 0} (1+x)^{\alpha} = 1 + \binom{\alpha}{1} x + \binom{\alpha}{2} x^2 + \binom{\alpha}{3} x^3 + \ldots = \sum\_{i = 0}^{n} \binom{\alpha}{i} x^{i} + O(x^n)$$ thus as $x \to 0$ \begin{align} \sqrt{x(1+x)}&=\sqrt{x} \cdot \sqrt{1+x} \\ &=x^{1/2} \cdot (1+x)^{1/2}\\ &=x^{1/2} \cdot \left( \sum\_{i ...
my answer: $\sqrt{x(1-x)}$ $=x^{1/2}(1-x)^{1/2}$ expand for $x\to 0$, $=x^{1/2}(1+\frac 12(-x)+\frac{\frac12(1-\frac{1}{2})}{2!}(-x)^2+...........)$ $=x^{1/2}-\frac 12x^{3/2}-\frac{1}{8}x^{5/2}+...........$
1,623,321
I am trying to expand $\sqrt{x(1-x)}$ in order to find the order of it as $x\to0$. Using Taylor expansion to find the derivative of the equation as $x\to0$ gives each item $0$. Then how do we expand it? Thanks,
2016/01/23
['https://math.stackexchange.com/questions/1623321', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/206901/']
In general $$\lim\_{x \to 0} (1+x)^{\alpha} = 1 + \binom{\alpha}{1} x + \binom{\alpha}{2} x^2 + \binom{\alpha}{3} x^3 + \ldots = \sum\_{i = 0}^{n} \binom{\alpha}{i} x^{i} + O(x^n)$$ thus as $x \to 0$ \begin{align} \sqrt{x(1+x)}&=\sqrt{x} \cdot \sqrt{1+x} \\ &=x^{1/2} \cdot (1+x)^{1/2}\\ &=x^{1/2} \cdot \left( \sum\_{i ...
Find the derivatives of $$f(x)=\sqrt{1-x}$$ $$=\sqrt{1-0}+\frac{\frac{d}{dx}\left(\sqrt{1-x}\right)\left(0\right)}{1!}x+\frac{\frac{d^2}{dx^2}\left(\sqrt{1-x}\right)\left(0\right)}{2!}x^2+\frac{\frac{d^3}{dx^3}\left(\sqrt{1-x}\right)\left(0\right)}{3!}x^3+\ldots \:$$ Then $\sqrt{1-0}\quad :\quad 1$ $\frac{d}{dx}\left...
1,623,321
I am trying to expand $\sqrt{x(1-x)}$ in order to find the order of it as $x\to0$. Using Taylor expansion to find the derivative of the equation as $x\to0$ gives each item $0$. Then how do we expand it? Thanks,
2016/01/23
['https://math.stackexchange.com/questions/1623321', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/206901/']
my answer: $\sqrt{x(1-x)}$ $=x^{1/2}(1-x)^{1/2}$ expand for $x\to 0$, $=x^{1/2}(1+\frac 12(-x)+\frac{\frac12(1-\frac{1}{2})}{2!}(-x)^2+...........)$ $=x^{1/2}-\frac 12x^{3/2}-\frac{1}{8}x^{5/2}+...........$
Find the derivatives of $$f(x)=\sqrt{1-x}$$ $$=\sqrt{1-0}+\frac{\frac{d}{dx}\left(\sqrt{1-x}\right)\left(0\right)}{1!}x+\frac{\frac{d^2}{dx^2}\left(\sqrt{1-x}\right)\left(0\right)}{2!}x^2+\frac{\frac{d^3}{dx^3}\left(\sqrt{1-x}\right)\left(0\right)}{3!}x^3+\ldots \:$$ Then $\sqrt{1-0}\quad :\quad 1$ $\frac{d}{dx}\left...
24,642,453
I'm trying to get Google Places Autocomplete API working on WorkLight, but it looks like there is something wrong. When using my computer's browser, once I start typing the name of a place, the Autocomplete suggestions works fine and I am able to pick one. But when running the app on a mobile device (either Android or...
2014/07/08
['https://Stackoverflow.com/questions/24642453', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1117919/']
I just tried it and it worked fine for me. This is what I did, let us know if you did anything different 1. Created a new Hybrid app 2. Added jquery.geocomplete.js to common/js folder 3. Updated the index.html code with the code sample provided by the api documentation 4. Tested on common preview (works fine) 5. Creat...
Have you tried to stop propagating the click event? > > $( "p" ).click(function( event ) { event.stopPropagation(); // Do > something }); > > >
24,642,453
I'm trying to get Google Places Autocomplete API working on WorkLight, but it looks like there is something wrong. When using my computer's browser, once I start typing the name of a place, the Autocomplete suggestions works fine and I am able to pick one. But when running the app on a mobile device (either Android or...
2014/07/08
['https://Stackoverflow.com/questions/24642453', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1117919/']
I just tried it and it worked fine for me. This is what I did, let us know if you did anything different 1. Created a new Hybrid app 2. Added jquery.geocomplete.js to common/js folder 3. Updated the index.html code with the code sample provided by the api documentation 4. Tested on common preview (works fine) 5. Creat...
Try Stopping propagation ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>event.stopImmediatePropagation demo</title> <style> p { height: 30px; width: 150px; background-color: #ccf; } div { height: 30px; width: 150px; background-color: #cfc; } </style> ...
24,642,453
I'm trying to get Google Places Autocomplete API working on WorkLight, but it looks like there is something wrong. When using my computer's browser, once I start typing the name of a place, the Autocomplete suggestions works fine and I am able to pick one. But when running the app on a mobile device (either Android or...
2014/07/08
['https://Stackoverflow.com/questions/24642453', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1117919/']
I just tried it and it worked fine for me. This is what I did, let us know if you did anything different 1. Created a new Hybrid app 2. Added jquery.geocomplete.js to common/js folder 3. Updated the index.html code with the code sample provided by the api documentation 4. Tested on common preview (works fine) 5. Creat...
If you use Ionic, the issue is caused by the css attribute "pointer-events:none" set by ionicModal; Try to add this to you css file: ``` .pac-container { pointer-events:auto; } ```
13,212,654
So, my data are stored in a file, called log.txt, and I want to view the content of it, in GUI. So i've got these two classes which i'm using, one is Engine, where I read the log.txt file, and the other one is GUI, where is used to apply the methods used in Engine. So, in my engine, I've got these codes: ``` public v...
2012/11/03
['https://Stackoverflow.com/questions/13212654', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1748691/']
Perhaps you want your loadLog method to *return* a String that holds the text that it read from the file, and then in the GUI call the method and display the returned String as you desire. Also, never have an empty catch block when doing I & O.
Forgive me if I am misunderstanding your question, but here goes nothing: You're going to want to read your text file line by line, and add each line to the JTextArea. ``` BufferedReader reader = new BufferedReader(new FileReader("pathToFile")); //This code creates a new buffered reader with the specified fi...
13,212,654
So, my data are stored in a file, called log.txt, and I want to view the content of it, in GUI. So i've got these two classes which i'm using, one is Engine, where I read the log.txt file, and the other one is GUI, where is used to apply the methods used in Engine. So, in my engine, I've got these codes: ``` public v...
2012/11/03
['https://Stackoverflow.com/questions/13212654', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1748691/']
File IO operations are considered blocking/time consuming. You should avoid running them in the Event Dispatching Thread, as this will prevent the UI from begin updated, making your application look like its hung/crashed You could use a [`SwingWorker`](http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker....
Perhaps you want your loadLog method to *return* a String that holds the text that it read from the file, and then in the GUI call the method and display the returned String as you desire. Also, never have an empty catch block when doing I & O.
13,212,654
So, my data are stored in a file, called log.txt, and I want to view the content of it, in GUI. So i've got these two classes which i'm using, one is Engine, where I read the log.txt file, and the other one is GUI, where is used to apply the methods used in Engine. So, in my engine, I've got these codes: ``` public v...
2012/11/03
['https://Stackoverflow.com/questions/13212654', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1748691/']
File IO operations are considered blocking/time consuming. You should avoid running them in the Event Dispatching Thread, as this will prevent the UI from begin updated, making your application look like its hung/crashed You could use a [`SwingWorker`](http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker....
Forgive me if I am misunderstanding your question, but here goes nothing: You're going to want to read your text file line by line, and add each line to the JTextArea. ``` BufferedReader reader = new BufferedReader(new FileReader("pathToFile")); //This code creates a new buffered reader with the specified fi...
355,820
Maybe related to [this question](https://math.stackexchange.com/questions/36308/expected-value-of-max-min-of-random-variables) In the comments of this question they say that it gets easier if the variables are identically and independently distributed. But i don't see how because in my case the variable is discrete *...
2013/04/09
['https://math.stackexchange.com/questions/355820', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/71720/']
For clarity, suppose that the dice have ID numbers $1,2,3,4$. Let $X\_i$ be the result on die $i$. Let $Y$ be the sum of the three largest of the $X\_i$, and let $W$ be the minimum of the $X\_i$. Then $Y=X\_1+X\_2+X\_3+X\_4-W$. By the **linearity of expectation**, it follows that $$E(Y)=E(X\_1)+E(X\_2)+E(X\_3)+E(X\_4...
Yes, your equation is correct, and this is a good and efficient way to perform this calculation. To find the expected value of the minimum, consider the hypercubes $[k,6]^4$ for $k=1,\dotsc,6$. The number of these hypercubes that a result is in is given by the minimum value of the dice. Thus we get the expected value o...
46,658,424
I require some help in creating a product slider in Shopify that allows you to add images and videos. At the moment the slider is working fine but I am having issues adding product videos to the slider. From what I have read you can use the alt tag to add a YouTube embed code that will overwrite the image and display ...
2017/10/10
['https://Stackoverflow.com/questions/46658424', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3492429/']
Why use javascript for this when you can use simply liquid? You just need to add check for the `alt` attribute if it contains `youtube` or something unique. So for example: ``` {% if image.alt contains 'youtube' %} <iframe width="500px" height="500px" src="{{image.alt}}?autoplay=1&amp;showinfo=0&amp;controls=0&a...
I just wanted to post the solution I arrived at based on the answer above by "drip". I hope this might help someone else down the track. ``` <!-- Product Slider w/ Video --> <div id="product-flexslider" class="flexslider product_gallery product-{{ product.id }}-gallery {% if product-images == blank %}product_slid...
4,504,132
I am occasionally getting odd behavior from boost::lower, when called on a std::wstring. In particular, I have seen the following assertion fail in a release build (but *not* in a debug build): ``` Assertion failed: !is_singular(), file C:\boost_1_40_0\boost/range/iterator_range.hpp, line 281 ``` I have also seen w...
2010/12/21
['https://Stackoverflow.com/questions/4504132', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/222329/']
After further debugging, I figured out what was going on. The cause of my trouble was that one project in the solution was not defining NDEBUG (despite being in release mode), while all the other modules were. Boost allocates some extra fields in its data structures, which it uses to store debug information (such as w...
An iterator range should only be singular if it's been constructed with the default constructor (stores singular iterators, i.e doesn't represent a range). As it's rather hard to believe that the boost's `to_lower` function manages to create a singular range, it suggests that the problem might also be elsewhere (a resu...
73,605
I'm looking to try and identify the year this bike was built. Currently struggling to add photo's. [![enter image description here](https://i.stack.imgur.com/ibxeW.jpg)](https://i.stack.imgur.com/ibxeW.jpg) I will try and add some more in a minute. The frame number of the bike is 14246 Many thanks Wesley
2020/11/27
['https://bicycles.stackexchange.com/questions/73605', 'https://bicycles.stackexchange.com', 'https://bicycles.stackexchange.com/users/53900/']
Nice bike - from the overall lines of the frame its definitely something from the 80s. The head tube is relatively short, so I'm guessing this is a smaller frame, maybe a 50cm or less. The pronounced curve of the front fork became straighter as time went on due to manufacturing changes. Also the right fork tine has a...
Falccon continued to make high class bikes into the early 80s, the Olympic was a good alternative to something like a Dawes Galaxy - but rode even better, ime. The one in the pic looks very well used - look at the teeth on the chainrings.
73,605
I'm looking to try and identify the year this bike was built. Currently struggling to add photo's. [![enter image description here](https://i.stack.imgur.com/ibxeW.jpg)](https://i.stack.imgur.com/ibxeW.jpg) I will try and add some more in a minute. The frame number of the bike is 14246 Many thanks Wesley
2020/11/27
['https://bicycles.stackexchange.com/questions/73605', 'https://bicycles.stackexchange.com', 'https://bicycles.stackexchange.com/users/53900/']
Adding information to Criggie's accurate answer. This is not the same bike but it is an Olympic and the style of decal matches your bike. Your frame has the wrap around stays and this one does not. [![enter image description here](https://i.stack.imgur.com/dqPpH.jpg)](https://i.stack.imgur.com/dqPpH.jpg) I don't ...
Falccon continued to make high class bikes into the early 80s, the Olympic was a good alternative to something like a Dawes Galaxy - but rode even better, ime. The one in the pic looks very well used - look at the teeth on the chainrings.
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
You can make your findMore method return a promise, so you can pass an array of those to Promise.all and handle the .then when all promises have finished. ``` function getData() { var options = { method: 'GET', uri: 'https://api.call1.com', qs: { access_token: _acce...
You want to use Promise.all. So first thing first, you need an array of promises. Inside your for each loop, set findMore to a variable, and make it return the promise. Then have a line where you do Promise.all(promiseArr).then(function(){console.log("done)}) Your code would look like this ``` function getData() { ...
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
A couple of things to think about: **If you care about the fate of a promise, always return it**. In your case, `findMore` does not return the promise from `request`, so `getData` has no handle to track the resolution (or rejection) of that promise. **You can track the resolution of multiple promises with [Promise.a...
You want to use Promise.all. So first thing first, you need an array of promises. Inside your for each loop, set findMore to a variable, and make it return the promise. Then have a line where you do Promise.all(promiseArr).then(function(){console.log("done)}) Your code would look like this ``` function getData() { ...
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
You can make your findMore method return a promise, so you can pass an array of those to Promise.all and handle the .then when all promises have finished. ``` function getData() { var options = { method: 'GET', uri: 'https://api.call1.com', qs: { access_token: _acce...
You need to use `Promise.all` to run all async requests in parallel. Also you *must* return the result of `findMore` and `getData` (they are promises). ``` function getData() { var options = {...}; return request(options) .then(function(apires) { console.log("complete 1"); var obj = JSON.parse(ap...
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
A couple of things to think about: **If you care about the fate of a promise, always return it**. In your case, `findMore` does not return the promise from `request`, so `getData` has no handle to track the resolution (or rejection) of that promise. **You can track the resolution of multiple promises with [Promise.a...
You need to use `Promise.all` to run all async requests in parallel. Also you *must* return the result of `findMore` and `getData` (they are promises). ``` function getData() { var options = {...}; return request(options) .then(function(apires) { console.log("complete 1"); var obj = JSON.parse(ap...
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
You can make your findMore method return a promise, so you can pass an array of those to Promise.all and handle the .then when all promises have finished. ``` function getData() { var options = { method: 'GET', uri: 'https://api.call1.com', qs: { access_token: _acce...
EDIT: As others have mentioned, using a Promise.all() is likely a better solution in this case. If you are open to using jQuery (a JavaScript library), then you can use the .ajaxStop() event handler and specify your own function. Sample code: ``` $(document).ajaxStop(function(){ alert("All AJAX requests are compl...
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
You can make your findMore method return a promise, so you can pass an array of those to Promise.all and handle the .then when all promises have finished. ``` function getData() { var options = { method: 'GET', uri: 'https://api.call1.com', qs: { access_token: _acce...
A couple of things to think about: **If you care about the fate of a promise, always return it**. In your case, `findMore` does not return the promise from `request`, so `getData` has no handle to track the resolution (or rejection) of that promise. **You can track the resolution of multiple promises with [Promise.a...
45,825,412
Hello I'm new to NodeJs and am trying to work out the best way to get this chain of events working. I have to do two API calls get all the information I need. The first API call is just a list of IDs, then the second API call I pass the ID to get the rest of the information for each object. However using the method b...
2017/08/22
['https://Stackoverflow.com/questions/45825412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4071548/']
A couple of things to think about: **If you care about the fate of a promise, always return it**. In your case, `findMore` does not return the promise from `request`, so `getData` has no handle to track the resolution (or rejection) of that promise. **You can track the resolution of multiple promises with [Promise.a...
EDIT: As others have mentioned, using a Promise.all() is likely a better solution in this case. If you are open to using jQuery (a JavaScript library), then you can use the .ajaxStop() event handler and specify your own function. Sample code: ``` $(document).ajaxStop(function(){ alert("All AJAX requests are compl...
11,760,258
Consider the following Java class definitions: ``` class Animal {} class Lion extends Animal {} ``` When defining a covariant `Cage` for `Animal`s I use this code in Java: ``` class Cage<T extends Animal> { void add(T animal) { System.out.println("Adding animal..."); } } ``` But the following Java example ... ``...
2012/08/01
['https://Stackoverflow.com/questions/11760258', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/297776/']
I think this question might answer that for you: [java generics covariance](https://stackoverflow.com/questions/2660827/java-generics-covariance) Basically, Java generics are not covariant. The best explanation I know for this comes, of course, from Effective Java 2nd Edition. You can read about it here: <http://...
If so, that is likely a bug in the Scala compiler. Odersky et al. write in [An Overview of the Scala Programming Language](http://www.scala-lang.org/docu/files/ScalaOverview.pdf): > > Scala’s type system ensures that variance annotations are > sound by keeping track of the positions where a type pa- > rameter is us...
11,760,258
Consider the following Java class definitions: ``` class Animal {} class Lion extends Animal {} ``` When defining a covariant `Cage` for `Animal`s I use this code in Java: ``` class Cage<T extends Animal> { void add(T animal) { System.out.println("Adding animal..."); } } ``` But the following Java example ... ``...
2012/08/01
['https://Stackoverflow.com/questions/11760258', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/297776/']
In java : ``` Cage<? extends Animal> animals = null; ``` This is a cage, but you don't know what kind of animals it accepts. ``` animals = lions; // Works! ``` Ok, you add no opinion about what sort of cage animals was, so lion violates no expectation. ``` animals.add(new Lion()); // Error! ``` You ...
I think this question might answer that for you: [java generics covariance](https://stackoverflow.com/questions/2660827/java-generics-covariance) Basically, Java generics are not covariant. The best explanation I know for this comes, of course, from Effective Java 2nd Edition. You can read about it here: <http://...
11,760,258
Consider the following Java class definitions: ``` class Animal {} class Lion extends Animal {} ``` When defining a covariant `Cage` for `Animal`s I use this code in Java: ``` class Cage<T extends Animal> { void add(T animal) { System.out.println("Adding animal..."); } } ``` But the following Java example ... ``...
2012/08/01
['https://Stackoverflow.com/questions/11760258', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/297776/']
When you *declare* your variable with this type: `Cage<? extends Animal>`; you're basically saying that your variable is a cage with some *unkown* class that inherits from `Animal`. It could be a `Tiger` or a `Whale`; so the compiler doesn't have enough information to let you add a `Lion` to it. To have what you want, ...
If so, that is likely a bug in the Scala compiler. Odersky et al. write in [An Overview of the Scala Programming Language](http://www.scala-lang.org/docu/files/ScalaOverview.pdf): > > Scala’s type system ensures that variance annotations are > sound by keeping track of the positions where a type pa- > rameter is us...
11,760,258
Consider the following Java class definitions: ``` class Animal {} class Lion extends Animal {} ``` When defining a covariant `Cage` for `Animal`s I use this code in Java: ``` class Cage<T extends Animal> { void add(T animal) { System.out.println("Adding animal..."); } } ``` But the following Java example ... ``...
2012/08/01
['https://Stackoverflow.com/questions/11760258', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/297776/']
In java : ``` Cage<? extends Animal> animals = null; ``` This is a cage, but you don't know what kind of animals it accepts. ``` animals = lions; // Works! ``` Ok, you add no opinion about what sort of cage animals was, so lion violates no expectation. ``` animals.add(new Lion()); // Error! ``` You ...
If so, that is likely a bug in the Scala compiler. Odersky et al. write in [An Overview of the Scala Programming Language](http://www.scala-lang.org/docu/files/ScalaOverview.pdf): > > Scala’s type system ensures that variance annotations are > sound by keeping track of the positions where a type pa- > rameter is us...
11,760,258
Consider the following Java class definitions: ``` class Animal {} class Lion extends Animal {} ``` When defining a covariant `Cage` for `Animal`s I use this code in Java: ``` class Cage<T extends Animal> { void add(T animal) { System.out.println("Adding animal..."); } } ``` But the following Java example ... ``...
2012/08/01
['https://Stackoverflow.com/questions/11760258', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/297776/']
In java : ``` Cage<? extends Animal> animals = null; ``` This is a cage, but you don't know what kind of animals it accepts. ``` animals = lions; // Works! ``` Ok, you add no opinion about what sort of cage animals was, so lion violates no expectation. ``` animals.add(new Lion()); // Error! ``` You ...
When you *declare* your variable with this type: `Cage<? extends Animal>`; you're basically saying that your variable is a cage with some *unkown* class that inherits from `Animal`. It could be a `Tiger` or a `Whale`; so the compiler doesn't have enough information to let you add a `Lion` to it. To have what you want, ...
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
If we want to extract the digits with `-` between the braces, one option is `str_extract`. If there are multiple patterns within a string, use `str_extract_all` ``` library(stringr) str_extract(str1, '(?<=\\()[0-9-]+(?=\\))') #[1] "123-456-789" str_extract_all(str2, '(?<=\\()[0-9-]+(?=\\))') ``` In the above cod...
or with `sub` from `base R`: ``` sub("[^(]+\\(([^)]+)\\).*", "\\1", "A B C (123-456-789)") #[1] "123-456-789" ``` Explanation: `[^(]+` : matches anything except an opening bracket `\\(` : matches an opening bracket, which is just before what you want `([^)]+)` : matches the pattern you want to capture (which ...
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
If we want to extract the digits with `-` between the braces, one option is `str_extract`. If there are multiple patterns within a string, use `str_extract_all` ``` library(stringr) str_extract(str1, '(?<=\\()[0-9-]+(?=\\))') #[1] "123-456-789" str_extract_all(str2, '(?<=\\()[0-9-]+(?=\\))') ``` In the above cod...
Try this also: ``` k<-"A B C (123-456-789)" regmatches(k,gregexpr("*.(\\d+).*",k))[[1]] [1] "(123-456-789)" ``` With suggestion from @Arun: ``` regmatches(k, gregexpr('(?<=\\()[^A-Z ]+(?=\\))', k, perl=TRUE))[[1]] ``` With suggestion from @akrun: ``` regmatches(k, gregexpr('[0-9-]+', k))[[1]] ```
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
If we want to extract the digits with `-` between the braces, one option is `str_extract`. If there are multiple patterns within a string, use `str_extract_all` ``` library(stringr) str_extract(str1, '(?<=\\()[0-9-]+(?=\\))') #[1] "123-456-789" str_extract_all(str2, '(?<=\\()[0-9-]+(?=\\))') ``` In the above cod...
The capture groups in `sub` will target your desired output: ``` sub('.*\\((.*)\\).*', '\\1', str1) [1] "123-456-789" ``` Extra check to make sure I pass @akrun's extended example: ``` sub('.*\\((.*)\\).*', '\\1', str2) [1] "123-425-478" "123-423-428" "123-423-498" "123-432-423" "124-233-848" ```
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
If we want to extract the digits with `-` between the braces, one option is `str_extract`. If there are multiple patterns within a string, use `str_extract_all` ``` library(stringr) str_extract(str1, '(?<=\\()[0-9-]+(?=\\))') #[1] "123-456-789" str_extract_all(str2, '(?<=\\()[0-9-]+(?=\\))') ``` In the above cod...
You may try these gsub functions. ``` > gsub("[^\\d-]", "", x, perl=T) [1] "123-456-789" > gsub(".*\\(|\\)", "", x) [1] "123-456-789" > gsub("[^0-9-]", "", x) [1] "123-456-789" ``` Few more... ``` > gsub("[0-9-](*SKIP)(*F)|.", "", x, perl=T) [1] "123-456-789" > gsub("(?:(?![0-9-]).)*", "", x, perl=T) [1] "123-456-7...
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
or with `sub` from `base R`: ``` sub("[^(]+\\(([^)]+)\\).*", "\\1", "A B C (123-456-789)") #[1] "123-456-789" ``` Explanation: `[^(]+` : matches anything except an opening bracket `\\(` : matches an opening bracket, which is just before what you want `([^)]+)` : matches the pattern you want to capture (which ...
Try this also: ``` k<-"A B C (123-456-789)" regmatches(k,gregexpr("*.(\\d+).*",k))[[1]] [1] "(123-456-789)" ``` With suggestion from @Arun: ``` regmatches(k, gregexpr('(?<=\\()[^A-Z ]+(?=\\))', k, perl=TRUE))[[1]] ``` With suggestion from @akrun: ``` regmatches(k, gregexpr('[0-9-]+', k))[[1]] ```
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
or with `sub` from `base R`: ``` sub("[^(]+\\(([^)]+)\\).*", "\\1", "A B C (123-456-789)") #[1] "123-456-789" ``` Explanation: `[^(]+` : matches anything except an opening bracket `\\(` : matches an opening bracket, which is just before what you want `([^)]+)` : matches the pattern you want to capture (which ...
You may try these gsub functions. ``` > gsub("[^\\d-]", "", x, perl=T) [1] "123-456-789" > gsub(".*\\(|\\)", "", x) [1] "123-456-789" > gsub("[^0-9-]", "", x) [1] "123-456-789" ``` Few more... ``` > gsub("[0-9-](*SKIP)(*F)|.", "", x, perl=T) [1] "123-456-789" > gsub("(?:(?![0-9-]).)*", "", x, perl=T) [1] "123-456-7...
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
The capture groups in `sub` will target your desired output: ``` sub('.*\\((.*)\\).*', '\\1', str1) [1] "123-456-789" ``` Extra check to make sure I pass @akrun's extended example: ``` sub('.*\\((.*)\\).*', '\\1', str2) [1] "123-425-478" "123-423-428" "123-423-498" "123-432-423" "124-233-848" ```
Try this also: ``` k<-"A B C (123-456-789)" regmatches(k,gregexpr("*.(\\d+).*",k))[[1]] [1] "(123-456-789)" ``` With suggestion from @Arun: ``` regmatches(k, gregexpr('(?<=\\()[^A-Z ]+(?=\\))', k, perl=TRUE))[[1]] ``` With suggestion from @akrun: ``` regmatches(k, gregexpr('[0-9-]+', k))[[1]] ```
31,292,853
Suppose I have a string like "A B C (123-456-789)", I'm wondering what's the best way to retrieve "123-456-789" from it. ``` strsplit("A B C (123-456-789)", "\\(") [[1]] [1] "A B C" "123-456-789)" ```
2015/07/08
['https://Stackoverflow.com/questions/31292853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3015453/']
The capture groups in `sub` will target your desired output: ``` sub('.*\\((.*)\\).*', '\\1', str1) [1] "123-456-789" ``` Extra check to make sure I pass @akrun's extended example: ``` sub('.*\\((.*)\\).*', '\\1', str2) [1] "123-425-478" "123-423-428" "123-423-498" "123-432-423" "124-233-848" ```
You may try these gsub functions. ``` > gsub("[^\\d-]", "", x, perl=T) [1] "123-456-789" > gsub(".*\\(|\\)", "", x) [1] "123-456-789" > gsub("[^0-9-]", "", x) [1] "123-456-789" ``` Few more... ``` > gsub("[0-9-](*SKIP)(*F)|.", "", x, perl=T) [1] "123-456-789" > gsub("(?:(?![0-9-]).)*", "", x, perl=T) [1] "123-456-7...
345,177
Just curious if the time you're stuck in a bury is the same for all attacks that cause you to be buried, or the amount of mashing needed to get out is the same? Examples include: * G&W down smash * KKR's down throw * DK's side special * Wii Fit trainer's neutral normal 3-hit combo * Pitfall items * etc.
2019/01/17
['https://gaming.stackexchange.com/questions/345177', 'https://gaming.stackexchange.com', 'https://gaming.stackexchange.com/users/18916/']
If you haven't heard of [Beefy Smash Dudes](https://www.youtube.com/channel/UCeCEq4Sz1nNK4wn3Z4Ozk2w), I highly suggest checking them out. They have some amazing technical Smash content, and they're always my go to for keeping up with new Smash techniques. Not to mention they just [put out a video on Smash Ultimate bur...
In previous games, bury time is purely based on knockback dealt (as in the amount of knockback that would have been applied if it weren't a bury attack). In Ultimate, it appears to also be based on current damage (though less so). The exact formula isn't known yet. Each input of mashing reduces bury time by 8 frames.
17,735,661
I need to parse log files and get some values to variable. The log file will have a string ``` String logStr = "21:19:03 -[ 8b4]- ERROR - Jhy AlarmOccure::OnAdd - Updated existing alarm: ID [StrValue1:StrValu2|StrValue3], Instance [4053], SetStatus [0], AckStatus [1], SetTime [DateValue4], ClearedTime [DateValue5]"; ...
2013/07/18
['https://Stackoverflow.com/questions/17735661', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/713328/']
Try regexp `([a-zA-z]+) \[([^\]]+)\]`. For string `21:19:03 -[ 8b4]- ERROR - Jhy AlarmOccure::OnAdd - Updated existing alarm: ID [StrValue1:StrValu2|StrValue3], Instance [4053], SetStatus [0], AckStatus [1], SetTime [DateValue4], ClearedTime [DateValue5]` it returns: * `ID` and `StrValue1:StrValu2|StrValue3` * `Insta...
I like more general solutions, but here is a very specific pattern you can use if it suits you. It will capture all of the values in a string as long as they are follow the same, very specific pattern. ``` ID (?:\[([^\]:]+):([^\]|]+)\|([^\]]+)\]).*?SetTime \[([^\]]+)\], ClearedTime \[([^\]]+)\] ``` Here is the resul...
17,735,661
I need to parse log files and get some values to variable. The log file will have a string ``` String logStr = "21:19:03 -[ 8b4]- ERROR - Jhy AlarmOccure::OnAdd - Updated existing alarm: ID [StrValue1:StrValu2|StrValue3], Instance [4053], SetStatus [0], AckStatus [1], SetTime [DateValue4], ClearedTime [DateValue5]"; ...
2013/07/18
['https://Stackoverflow.com/questions/17735661', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/713328/']
Good on you for the attempt! You're actually doing quite well. You need to escape square brackets that you don't mean as character classes, *i.e.* ``` .*?ID ?\[ ^ ``` And hopefully you are aware that by `([^]:]*)` you are meaning, "The longest possible string of characters *without* a closing square bracket o...
I like more general solutions, but here is a very specific pattern you can use if it suits you. It will capture all of the values in a string as long as they are follow the same, very specific pattern. ``` ID (?:\[([^\]:]+):([^\]|]+)\|([^\]]+)\]).*?SetTime \[([^\]]+)\], ClearedTime \[([^\]]+)\] ``` Here is the resul...
17,735,661
I need to parse log files and get some values to variable. The log file will have a string ``` String logStr = "21:19:03 -[ 8b4]- ERROR - Jhy AlarmOccure::OnAdd - Updated existing alarm: ID [StrValue1:StrValu2|StrValue3], Instance [4053], SetStatus [0], AckStatus [1], SetTime [DateValue4], ClearedTime [DateValue5]"; ...
2013/07/18
['https://Stackoverflow.com/questions/17735661', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/713328/']
Long story short, your regex lacks escaping some chars, like `[` and `|` (this one, if outside a character class - `[]`). So when you want to actually match the `[` char, you have to use `\[` (or `\\[` inside the java string). Also, the negation in the group `([^]:]*)` is not what it seems. You probably want just `([^...
I like more general solutions, but here is a very specific pattern you can use if it suits you. It will capture all of the values in a string as long as they are follow the same, very specific pattern. ``` ID (?:\[([^\]:]+):([^\]|]+)\|([^\]]+)\]).*?SetTime \[([^\]]+)\], ClearedTime \[([^\]]+)\] ``` Here is the resul...
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
Ok. Just for anyone wondering Just uninstalling and reinstalling the packages that were giving the error worked for me ``` pip uninstall matplotlib pip install matplotlib ```
Have you tried uninstalling it and reinstalling the latest python update and restarting you PC/Laptop?
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
I had the same issue - a Python program that was working fine before updating to Big Sur, and crashing with: ``` Segmentation fault: 11 ``` after updating. As previous responses have advised, just uninstalling and reinstalling the offending Python libraries fixed the problem. For me, that meant matplotlib: ``` pip...
Have you tried uninstalling it and reinstalling the latest python update and restarting you PC/Laptop?
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
Ok. Just for anyone wondering Just uninstalling and reinstalling the packages that were giving the error worked for me ``` pip uninstall matplotlib pip install matplotlib ```
I had the same issue - a Python program that was working fine before updating to Big Sur, and crashing with: ``` Segmentation fault: 11 ``` after updating. As previous responses have advised, just uninstalling and reinstalling the offending Python libraries fixed the problem. For me, that meant matplotlib: ``` pip...
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
Ok. Just for anyone wondering Just uninstalling and reinstalling the packages that were giving the error worked for me ``` pip uninstall matplotlib pip install matplotlib ```
I also had the same issue: **Segmentation fault: 11** I guess, it is because of the statement line: **plt.show()** As stated above, uninstallation and reinstallation of matplotlib worked for me. Thank you!
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
Ok. Just for anyone wondering Just uninstalling and reinstalling the packages that were giving the error worked for me ``` pip uninstall matplotlib pip install matplotlib ```
Reinstalling is the best option but you can also use: ``` import matplotlib as mpl mpl.use('MacOSX') import numpy as np import matplotlib.pyplot as plt ```
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
Ok. Just for anyone wondering Just uninstalling and reinstalling the packages that were giving the error worked for me ``` pip uninstall matplotlib pip install matplotlib ```
i had to drop my dpi from 400 to 50 on the OSX machine. none of these other approaches worked. fwiw, my update was to Catalina, not Big Sur.
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
I had the same issue - a Python program that was working fine before updating to Big Sur, and crashing with: ``` Segmentation fault: 11 ``` after updating. As previous responses have advised, just uninstalling and reinstalling the offending Python libraries fixed the problem. For me, that meant matplotlib: ``` pip...
I also had the same issue: **Segmentation fault: 11** I guess, it is because of the statement line: **plt.show()** As stated above, uninstallation and reinstallation of matplotlib worked for me. Thank you!
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
I had the same issue - a Python program that was working fine before updating to Big Sur, and crashing with: ``` Segmentation fault: 11 ``` after updating. As previous responses have advised, just uninstalling and reinstalling the offending Python libraries fixed the problem. For me, that meant matplotlib: ``` pip...
Reinstalling is the best option but you can also use: ``` import matplotlib as mpl mpl.use('MacOSX') import numpy as np import matplotlib.pyplot as plt ```
64,841,086
I am trying to below file operation using python input 1: unix shell cat command given below data file name: input1.txt ``` 11/13/2020 07:41:09 TREE count1: id1 green001 11/13/2020 07:43:09 TREE count1: id1 black001 11/13/2020 07:45:09 TREE count1: id2 black001 11/13/2020 07:45:09 PLAN count1: id3 green002 ``` Look...
2020/11/15
['https://Stackoverflow.com/questions/64841086', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14632454/']
I had the same issue - a Python program that was working fine before updating to Big Sur, and crashing with: ``` Segmentation fault: 11 ``` after updating. As previous responses have advised, just uninstalling and reinstalling the offending Python libraries fixed the problem. For me, that meant matplotlib: ``` pip...
i had to drop my dpi from 400 to 50 on the OSX machine. none of these other approaches worked. fwiw, my update was to Catalina, not Big Sur.
23,687,250
I have this code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView siteViewer = (WebView) findViewById(R.id.webView); if(siteViewer != null) siteViewer.loadUrl("http://www.website.com"); if (savedI...
2014/05/15
['https://Stackoverflow.com/questions/23687250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2016196/']
`siteViewer` is `null`, because there is no such element with id = `webView` found at the `activity_main.xml`. Please double check that you've typed it correctly.
did you set the permission to access the internet in manifest file? ``` <uses-permission android:name="android.permission.INTERNET" /> ```
23,687,250
I have this code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView siteViewer = (WebView) findViewById(R.id.webView); if(siteViewer != null) siteViewer.loadUrl("http://www.website.com"); if (savedI...
2014/05/15
['https://Stackoverflow.com/questions/23687250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2016196/']
In your Activity you are inflating main\_layout which doesn't contain a WebView at all. Therefore the findViewById won't find anything and siteViewer is null. Move your code to load the Url into your fragment. Since you'r using a PlaceHolderFragment I guess it will be replaced by a real one later. That's the place to ...
`siteViewer` is `null`, because there is no such element with id = `webView` found at the `activity_main.xml`. Please double check that you've typed it correctly.
23,687,250
I have this code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView siteViewer = (WebView) findViewById(R.id.webView); if(siteViewer != null) siteViewer.loadUrl("http://www.website.com"); if (savedI...
2014/05/15
['https://Stackoverflow.com/questions/23687250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2016196/']
I will answer from my knowledge since i didnt know the project heirarchy ... I) .suppose you have the activity in `package com.another.package` and your project package which is declared in the manifest is `com.main.package` now if you will try to access the webview using `R.id.webView` in package `com.another.package...
did you set the permission to access the internet in manifest file? ``` <uses-permission android:name="android.permission.INTERNET" /> ```
23,687,250
I have this code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView siteViewer = (WebView) findViewById(R.id.webView); if(siteViewer != null) siteViewer.loadUrl("http://www.website.com"); if (savedI...
2014/05/15
['https://Stackoverflow.com/questions/23687250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2016196/']
In your Activity you are inflating main\_layout which doesn't contain a WebView at all. Therefore the findViewById won't find anything and siteViewer is null. Move your code to load the Url into your fragment. Since you'r using a PlaceHolderFragment I guess it will be replaced by a real one later. That's the place to ...
did you set the permission to access the internet in manifest file? ``` <uses-permission android:name="android.permission.INTERNET" /> ```
23,687,250
I have this code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView siteViewer = (WebView) findViewById(R.id.webView); if(siteViewer != null) siteViewer.loadUrl("http://www.website.com"); if (savedI...
2014/05/15
['https://Stackoverflow.com/questions/23687250', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2016196/']
In your Activity you are inflating main\_layout which doesn't contain a WebView at all. Therefore the findViewById won't find anything and siteViewer is null. Move your code to load the Url into your fragment. Since you'r using a PlaceHolderFragment I guess it will be replaced by a real one later. That's the place to ...
I will answer from my knowledge since i didnt know the project heirarchy ... I) .suppose you have the activity in `package com.another.package` and your project package which is declared in the manifest is `com.main.package` now if you will try to access the webview using `R.id.webView` in package `com.another.package...
323,637
I would like to understand the best practices regarding nonce validation in REST APIs. I see a lot of people talking about `wp_rest` nonce for REST requests. But upon looking on WordPress core code, I saw that `wp_rest` is just a nonce to validate a logged in user status, if it's not present, it just runs the request ...
2018/12/22
['https://wordpress.stackexchange.com/questions/323637', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/27278/']
You should pass the special `wp_rest` nonce as part of the request. Without it, the `global $current_user` object will not be available in your REST class. You can pass this from several ways, from $\_GET to $\_POST to headers. The action nonce is optional. If you add it, you can't use the REST endpoint from an extern...
Building on what @lucas-bustamante wrote (which helped me a ton!), once you have the X-WP-Nonce header setup in your custom routes you can do the following: ```php register_rest_route('v1', '/my_post', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => [$this, 'create_post'], 'args' =>...
323,637
I would like to understand the best practices regarding nonce validation in REST APIs. I see a lot of people talking about `wp_rest` nonce for REST requests. But upon looking on WordPress core code, I saw that `wp_rest` is just a nonce to validate a logged in user status, if it's not present, it just runs the request ...
2018/12/22
['https://wordpress.stackexchange.com/questions/323637', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/27278/']
You should pass the special `wp_rest` nonce as part of the request. Without it, the `global $current_user` object will not be available in your REST class. You can pass this from several ways, from $\_GET to $\_POST to headers. The action nonce is optional. If you add it, you can't use the REST endpoint from an extern...
One thing to note about @Lucas Bustamante's answer is that the verification process described is user-based authentication. This means if you have an anonymous API end point which doesn't require a user, then by simply by not providing the `X-WP-NONCE` header you'll pass the described nonce check. Supplying an incorrec...
323,637
I would like to understand the best practices regarding nonce validation in REST APIs. I see a lot of people talking about `wp_rest` nonce for REST requests. But upon looking on WordPress core code, I saw that `wp_rest` is just a nonce to validate a logged in user status, if it's not present, it just runs the request ...
2018/12/22
['https://wordpress.stackexchange.com/questions/323637', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/27278/']
Building on what @lucas-bustamante wrote (which helped me a ton!), once you have the X-WP-Nonce header setup in your custom routes you can do the following: ```php register_rest_route('v1', '/my_post', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => [$this, 'create_post'], 'args' =>...
One thing to note about @Lucas Bustamante's answer is that the verification process described is user-based authentication. This means if you have an anonymous API end point which doesn't require a user, then by simply by not providing the `X-WP-NONCE` header you'll pass the described nonce check. Supplying an incorrec...
16,801,403
I'm looking for information/documentation on creating a custom icon for a document type in my iOS app. I am sure I have seen some Apple developer guide with information about this, but I have been searching and cannot find it! In the app's Info.plist I have specified a custom document type, and a corresponding exporte...
2013/05/28
['https://Stackoverflow.com/questions/16801403', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/429427/']
You already found the HIG documentation. I'm not certain if document icons show up in iTunes, but I doubt it. I've never seen this from any other app. From the [Information Property List Key Reference](https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundation...
Thanks @TomSwift for your answer help me a lot. I just add this if you have Xcode 6.3.2. You can not add icon files drag and drop or press "+" button inside info section, instead you must add the icon files names directly info.plist ![enter image description here](https://i.stack.imgur.com/aKGgS.png) You must add th...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
If the state changes are triggered asynchronously, `React` will not batch your multiple state updates. For eg, in your case since you are calling setState after resolving policiesService.getPolicyFormRequirements(policy), react won't be batching it. Instead if it is just the following way, React would have batched the...
**REACT 18 UPDATE** ------------------- With React 18, all state updates occurring together are automatically batched into a single render. This means it is okay to split the state into as many separate variables as you like. Source: [React 18 Batching](https://reactjs.org/blog/2022/03/29/react-v18.html#new-feature-a...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
If the state changes are triggered asynchronously, `React` will not batch your multiple state updates. For eg, in your case since you are calling setState after resolving policiesService.getPolicyFormRequirements(policy), react won't be batching it. Instead if it is just the following way, React would have batched the...
You can merge all states into one ``` function usePolicyFormRequirements(policy) { const [values, setValues] = useState({ addresses: [], pools: [], schedules: [], services: [], tunnels: [], zones: [], groups: [], advancedServices: [], profiles: [], }); React.useEffect(() => {...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
I thought I'd post this answer here since it hasn't already been mentioned. There is a way to force the batching of state updates. See [this article](https://blog.logrocket.com/simplifying-state-management-in-react-apps-with-batched-updates/) for an explanation. Below is a fully functional component that only renders ...
You can merge all states into one ``` function usePolicyFormRequirements(policy) { const [values, setValues] = useState({ addresses: [], pools: [], schedules: [], services: [], tunnels: [], zones: [], groups: [], advancedServices: [], profiles: [], }); React.useEffect(() => {...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
If the state changes are triggered asynchronously, `React` will not batch your multiple state updates. For eg, in your case since you are calling setState after resolving policiesService.getPolicyFormRequirements(policy), react won't be batching it. Instead if it is just the following way, React would have batched the...
> > Isn't there any way I could tell React, or React would know itself, that, after this setState another setState is coming along, so skip re-render until you find a second to breath. > > > You can't, React batches (as for React 17) state updates only on event handlers and lifecycle methods, therefore batching in...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
I thought I'd post this answer here since it hasn't already been mentioned. There is a way to force the batching of state updates. See [this article](https://blog.logrocket.com/simplifying-state-management-in-react-apps-with-batched-updates/) for an explanation. Below is a fully functional component that only renders ...
> > Isn't there any way I could tell React, or React would know itself, that, after this setState another setState is coming along, so skip re-render until you find a second to breath. > > > You can't, React batches (as for React 17) state updates only on event handlers and lifecycle methods, therefore batching in...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
If the state changes are triggered asynchronously, `React` will not batch your multiple state updates. For eg, in your case since you are calling setState after resolving policiesService.getPolicyFormRequirements(policy), react won't be batching it. Instead if it is just the following way, React would have batched the...
By the way, I just found out React 18 adds automatic update-batching out of the box. Read more: <https://github.com/reactwg/react-18/discussions/21>
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
I thought I'd post this answer here since it hasn't already been mentioned. There is a way to force the batching of state updates. See [this article](https://blog.logrocket.com/simplifying-state-management-in-react-apps-with-batched-updates/) for an explanation. Below is a fully functional component that only renders ...
By the way, I just found out React 18 adds automatic update-batching out of the box. Read more: <https://github.com/reactwg/react-18/discussions/21>
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
I thought I'd post this answer here since it hasn't already been mentioned. There is a way to force the batching of state updates. See [this article](https://blog.logrocket.com/simplifying-state-management-in-react-apps-with-batched-updates/) for an explanation. Below is a fully functional component that only renders ...
If the state changes are triggered asynchronously, `React` will not batch your multiple state updates. For eg, in your case since you are calling setState after resolving policiesService.getPolicyFormRequirements(policy), react won't be batching it. Instead if it is just the following way, React would have batched the...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
You can merge all states into one ``` function usePolicyFormRequirements(policy) { const [values, setValues] = useState({ addresses: [], pools: [], schedules: [], services: [], tunnels: [], zones: [], groups: [], advancedServices: [], profiles: [], }); React.useEffect(() => {...
**REACT 18 UPDATE** ------------------- With React 18, all state updates occurring together are automatically batched into a single render. This means it is okay to split the state into as many separate variables as you like. Source: [React 18 Batching](https://reactjs.org/blog/2022/03/29/react-v18.html#new-feature-a...
59,163,378
Suppose I have the following code: (which is too verbose) ``` function usePolicyFormRequirements(policy) { const [addresses, setAddresses] = React.useState([]); const [pools, setPools] = React.useState([]); const [schedules, setSchedules] = React.useState([]); const [services, setServices] = React.useState([])...
2019/12/03
['https://Stackoverflow.com/questions/59163378', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908277/']
I thought I'd post this answer here since it hasn't already been mentioned. There is a way to force the batching of state updates. See [this article](https://blog.logrocket.com/simplifying-state-management-in-react-apps-with-batched-updates/) for an explanation. Below is a fully functional component that only renders ...
**REACT 18 UPDATE** ------------------- With React 18, all state updates occurring together are automatically batched into a single render. This means it is okay to split the state into as many separate variables as you like. Source: [React 18 Batching](https://reactjs.org/blog/2022/03/29/react-v18.html#new-feature-a...
69,247,371
devs, I'm trying to deploy a simple cloud function to the firebase console, everything working very well (installation of npm & configuration & other stuff...). then I wrote a simple function in the **index.js** file : ``` 'use strict' const functions = require("firebase-functions"); const admin = require('firebase-a...
2021/09/19
['https://Stackoverflow.com/questions/69247371', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/15094547/']
try this ``` List<decimal> prices = new List<decimal>(); decimal price=0; int count=0; do { count++; Console.WriteLine("Item {0}", count); Console.WriteLine(" Enter Price: $ "); price = Convert.ToDecimal(Console.ReadLine()); prices.Add(...
I would store your prices in a dictionary as to ensure that prices for the same item have not been added. Here is a fiddle with an example: <https://dotnetfiddle.net/uZQqDp> ``` public static void Main() { Dictionary<int, decimal> prices = new Dictionary<int, decimal>(); int count = 0; bool finished = fal...
8,074,168
I am basically trying to convert a string similar to this one: "`2011-11-9 18:24:12.3`" into a format that I can insert into a database table claiming this particular column to be of the "datetime" type. I figured I could do something along the lines of `preparedStatement.setTimestamp(...)`, but I can't seem to get a T...
2011/11/10
['https://Stackoverflow.com/questions/8074168', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/967968/']
Ah, so, the problem is most likely not with the datetime of mysql but with the date. The `Date(Strings s)` constructor is [currently deprecated](http://download.oracle.com/javase/6/docs/api/java/util/Date.html#Date%28java.lang.String%29) and is recommended to use a [SimpleDateFormat](http://download.oracle.com/javase/...
Have you tried splitting and making it into a format you can use? This assumes that this is in the same format all the time. Create a new string that takes apart a split of the old string and rearranges it in a useful way. If this is a string provided by the end-user, you may have to validate it first and check to make...
56,815,600
I am using POM in automation and in the test I have 3 classes. let's say `test1, test2 and test3` tester is providing a class name in property file so if tester provide like `test1` in a property file, I have put conditions in java code to run class based on what tester provide in property file. But now I want to se...
2019/06/29
['https://Stackoverflow.com/questions/56815600', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4213132/']
Using the `includeFile` property of the Maven surefire plugin, you can explicitly say which Test classes should be run. You can provide this file from the command line (e.g. in Jenkins) by using an expression like `-Dsurefire.includesFile={yourfile}`.
You can proceed as before and let the tester provide the test class names in a file. That file is either already available on your system, or it can be uploaded by the tester when the Jenkins job builds. For that you have to parameterize the Jenkins job, and define a file upload parameter. See [Jenkins Wiki](https://wi...
32,862,638
Is there a `MIN` constant for `datetime`? I need it to represent the expiration date of a resource, and I want to have a `datetime` that represents "always expires" as default value (instead of `None` so I can use the same expiration comparison no matter what). So right now I'm using `datetime.datetime(datetime.MINY...
2015/09/30
['https://Stackoverflow.com/questions/32862638', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/90580/']
You can try - [`datetime.datetime.min`](https://docs.python.org/2/library/datetime.html#datetime.datetime.min) . According to [documentation](https://docs.python.org/2/library/datetime.html#datetime.datetime.min) - > > **`datetime.min`** > > > The earliest representable datetime, datetime(MINYEAR, 1, 1, tzinfo=None...
You could use `time.gmtime(0)` which is the epoch. [Time Documentation](https://docs.python.org/2/library/time.html) > > The epoch is the point where the time starts. On January 1st of that year, at 0 hours, the “time since the epoch” is zero. For Unix, the epoch is 1970. To find out what the epoch is, look at gmtim...
32,862,638
Is there a `MIN` constant for `datetime`? I need it to represent the expiration date of a resource, and I want to have a `datetime` that represents "always expires" as default value (instead of `None` so I can use the same expiration comparison no matter what). So right now I'm using `datetime.datetime(datetime.MINY...
2015/09/30
['https://Stackoverflow.com/questions/32862638', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/90580/']
You can try - [`datetime.datetime.min`](https://docs.python.org/2/library/datetime.html#datetime.datetime.min) . According to [documentation](https://docs.python.org/2/library/datetime.html#datetime.datetime.min) - > > **`datetime.min`** > > > The earliest representable datetime, datetime(MINYEAR, 1, 1, tzinfo=None...
`datetime.datetime.fromtimestamp(0)` it will gives you: ``` datetime.datetime(1970, 1, 1, 1, 0) ``` > > Return the local date corresponding to the POSIX timestamp, such as is > returned by time.time(). This may raise ValueError, if the timestamp > is out of the range of values supported by the platform C localtim...
63,563
I am confused in the difference between one to one function and one to one correspondence. Please help me out to distinguish between the two. Thanks
2011/09/11
['https://math.stackexchange.com/questions/63563', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/-1/']
a one to one function can be injective or bijective but a one to one correspondence can only be bijective
I would say (hand waveingly) a one to one function is a mapping from A to B that puts A & B into one-to-one correspondence with each other, for one to one and function as defined in your previous questions.
63,563
I am confused in the difference between one to one function and one to one correspondence. Please help me out to distinguish between the two. Thanks
2011/09/11
['https://math.stackexchange.com/questions/63563', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/-1/']
Hope this helps you understand things a bit better. I too had the same question a while ago... **Types of Mappings/Functions** a. **Injective mapping (injection)**: **one-to-one mapping** = is a function that preserves distinctness: it never maps distinct elements of its domain to the same element of its codomai...
I would say (hand waveingly) a one to one function is a mapping from A to B that puts A & B into one-to-one correspondence with each other, for one to one and function as defined in your previous questions.
63,563
I am confused in the difference between one to one function and one to one correspondence. Please help me out to distinguish between the two. Thanks
2011/09/11
['https://math.stackexchange.com/questions/63563', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/-1/']
I would say (hand waveingly) a one to one function is a mapping from A to B that puts A & B into one-to-one correspondence with each other, for one to one and function as defined in your previous questions.
1. one to one means injective (a mapping $f$ which maps distinct elements of its domain to distinct elements of its codomain, i.e. $f(x) \neq f(y)$ whenever $x \neq y$ ) 2. one to one correspondence means bijective (a mapping $f$ which is injective AND for every element $y$ in the codomain of $f$, there exists an eleme...
63,563
I am confused in the difference between one to one function and one to one correspondence. Please help me out to distinguish between the two. Thanks
2011/09/11
['https://math.stackexchange.com/questions/63563', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/-1/']
a one to one function can be injective or bijective but a one to one correspondence can only be bijective
1. one to one means injective (a mapping $f$ which maps distinct elements of its domain to distinct elements of its codomain, i.e. $f(x) \neq f(y)$ whenever $x \neq y$ ) 2. one to one correspondence means bijective (a mapping $f$ which is injective AND for every element $y$ in the codomain of $f$, there exists an eleme...
63,563
I am confused in the difference between one to one function and one to one correspondence. Please help me out to distinguish between the two. Thanks
2011/09/11
['https://math.stackexchange.com/questions/63563', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/-1/']
Hope this helps you understand things a bit better. I too had the same question a while ago... **Types of Mappings/Functions** a. **Injective mapping (injection)**: **one-to-one mapping** = is a function that preserves distinctness: it never maps distinct elements of its domain to the same element of its codomai...
1. one to one means injective (a mapping $f$ which maps distinct elements of its domain to distinct elements of its codomain, i.e. $f(x) \neq f(y)$ whenever $x \neq y$ ) 2. one to one correspondence means bijective (a mapping $f$ which is injective AND for every element $y$ in the codomain of $f$, there exists an eleme...
145,334
One of the players of the oneshot campaign that I'm writing chose the feat **Pierce Magical Concealment** (Complete Arcane, p.81), as a DM I'm not sure how it would work in an encounter I am planning. The manual states about the Pierce Magical Concealment feat: > > You ignore the miss chance provided by certain magi...
2019/04/17
['https://rpg.stackexchange.com/questions/145334', 'https://rpg.stackexchange.com', 'https://rpg.stackexchange.com/users/51527/']
The feat indeed doesn't specify if the character can or cannot see its target and the final decision would be up to the GM. However we still have some pieces of information to use to try to find a more satisfying answer. If you proceed logically, the 50% miss chance when attacking an invisible target results from the ...
No. You can negate the miss chance for concealment, but that doesn't mean you can see invisibility. It is not explained how this works, so there is no textual basis for believing you could distinguish between an unseen servant and an assassin. Perhaps you can see a glowing interface layer, perhaps there is some disto...