qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
57,290,142
Given a list of prices, I want to find the *index* of the the largest price that exceeds a certain minimum. My current solution looks like this: ``` public class Price { public static Integer maxPriceIndex(List<Integer> prices, Integer minPrice) { OptionalInt maxPriceIndexResult = IntStream.range(0, price...
2019/07/31
[ "https://Stackoverflow.com/questions/57290142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
Apart from `filter`ing the stream as you process, you can perform a `max` based on the custom comparator instead of `reduce` as: ``` return IntStream.range(0, prices.size()) .filter(i -> prices.get(i) > minPrice) .boxed() .max(Comparator.comparingInt(prices::get)) ...
First filter all values greater than `minPrice` and then sort them in `reverseOrder`, next get the index of first max element using `findFirst` value or if list is empty return `null` ``` return list.stream() .filter(i->i>minPrice) .sorted(Comparator.reverseOrder()) .findFirst() ...
57,290,142
Given a list of prices, I want to find the *index* of the the largest price that exceeds a certain minimum. My current solution looks like this: ``` public class Price { public static Integer maxPriceIndex(List<Integer> prices, Integer minPrice) { OptionalInt maxPriceIndexResult = IntStream.range(0, price...
2019/07/31
[ "https://Stackoverflow.com/questions/57290142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
Judging from all the answers you got, it's easy to make poorly performing implementations by accident. Not one of the other answers is as fast as the code you originally wrote. (@MikeFHay's is pretty good, though) Maybe just do: ``` int index = IntStream.range(0, prices.size()) .reduce((a, b) -> prices.get(a)...
First filter all values greater than `minPrice` and then sort them in `reverseOrder`, next get the index of first max element using `findFirst` value or if list is empty return `null` ``` return list.stream() .filter(i->i>minPrice) .sorted(Comparator.reverseOrder()) .findFirst() ...
67,253,267
It's been 5 days since I'm struggling with this problem and tried all the solution on StackOverflow but still can't open the app on Chrome : What I have tried. I really appreciate it if you can help with that. 0. I have tried HTML files, chrome opens seamlessly but flutter got problem. 1. Installing live server extens...
2021/04/25
[ "https://Stackoverflow.com/questions/67253267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11440211/" ]
Since flutter doctor is not showing any errors with the environment. It is possible that the error is taking place while the application is starting up or while initializing the plugins. 1. Check the chrome browser if there are any messages displayed on the console 2, Ensure you have set up all plugins as per the inst...
First, check in Command Prompt/cmd with this line `flutter doctor` if run this perfectly. Then, 1. Write in your Android Studio terminal `flutter config --enable-web` then close your Android Studio/IDE 2. also you can check in cmd `flutter devices` as this image [flutter devices](https://i.stack.imgur.com/wzJQJ.png) 3...
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
I encountered the same problem. First I thought that devtool as REPL does not need stdin and was a simple bug in windows build. GitHub repo owners fix it just ignoring stdin on startup but, as you had discovered, devtool is broken and you can not do anything with stdin in windows. As a proof of concept I create a si...
There is [another question](https://stackoverflow.com/questions/23281098/iisnode-unknown-stdin-file-type) pointing to the same problem. One of the comments states that it's a [known `iisnode` issue](https://github.com/tjanczuk/iisnode/issues/337) and also suggests a work around by wrapping all calls to `process.stdin` ...
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
I encountered the same problem. First I thought that devtool as REPL does not need stdin and was a simple bug in windows build. GitHub repo owners fix it just ignoring stdin on startup but, as you had discovered, devtool is broken and you can not do anything with stdin in windows. As a proof of concept I create a si...
Reading through the [libuv source code](https://github.com/libuv/libuv/blob/v1.x/src/win/handle.c#L31) which is what nodejs uses for certain low-level operations, seems that the reason is that the type of buffer or handle cannot be determined specifically for windows. The [`GetFileType`](https://msdn.microsoft.com/en-u...
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
I encountered the same problem. First I thought that devtool as REPL does not need stdin and was a simple bug in windows build. GitHub repo owners fix it just ignoring stdin on startup but, as you had discovered, devtool is broken and you can not do anything with stdin in windows. As a proof of concept I create a si...
I've had this error when trying to start electron up from a console window; it was odd because it had been working fine. I have realised today that the only thing I changed was to launch a terminal window from Visual Studio Code (with add-on). If I use a Terminal created from VS Code (terminal addon) then when I try t...
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
I encountered the same problem. First I thought that devtool as REPL does not need stdin and was a simple bug in windows build. GitHub repo owners fix it just ignoring stdin on startup but, as you had discovered, devtool is broken and you can not do anything with stdin in windows. As a proof of concept I create a si...
A super simple workaround would be to just force devtool to run in its own console window. So instead of running: ``` devtool ``` Run this: ``` start devtool ``` It should pop up in a new window and not be confused about the input pipe. The same trick works with a lot of Node packages.
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
There is [another question](https://stackoverflow.com/questions/23281098/iisnode-unknown-stdin-file-type) pointing to the same problem. One of the comments states that it's a [known `iisnode` issue](https://github.com/tjanczuk/iisnode/issues/337) and also suggests a work around by wrapping all calls to `process.stdin` ...
I've had this error when trying to start electron up from a console window; it was odd because it had been working fine. I have realised today that the only thing I changed was to launch a terminal window from Visual Studio Code (with add-on). If I use a Terminal created from VS Code (terminal addon) then when I try t...
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
Reading through the [libuv source code](https://github.com/libuv/libuv/blob/v1.x/src/win/handle.c#L31) which is what nodejs uses for certain low-level operations, seems that the reason is that the type of buffer or handle cannot be determined specifically for windows. The [`GetFileType`](https://msdn.microsoft.com/en-u...
I've had this error when trying to start electron up from a console window; it was odd because it had been working fine. I have realised today that the only thing I changed was to launch a terminal window from Visual Studio Code (with add-on). If I use a Terminal created from VS Code (terminal addon) then when I try t...
35,820,422
I've been struggling with this errors for 2 days and can't realize why electron renderer `process.stdin` fails in windows os. How to reproduce: type `npm install devtool -g` then type `devtool` inside the console type `process.stdin` and there will be an error message will be two errors, one at line 127 and the ot...
2016/03/05
[ "https://Stackoverflow.com/questions/35820422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242389/" ]
A super simple workaround would be to just force devtool to run in its own console window. So instead of running: ``` devtool ``` Run this: ``` start devtool ``` It should pop up in a new window and not be confused about the input pipe. The same trick works with a lot of Node packages.
I've had this error when trying to start electron up from a console window; it was odd because it had been working fine. I have realised today that the only thing I changed was to launch a terminal window from Visual Studio Code (with add-on). If I use a Terminal created from VS Code (terminal addon) then when I try t...
282,434
I was using one Linux server with CentOS7 installed for testing and installing some tools. And now I don't remember how many packages I installed. I want to remove all that packages so my server would be like new as it was. I don't want to search for every package and remove one by one. Is there any way to remove the...
2016/05/11
[ "https://unix.stackexchange.com/questions/282434", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/138782/" ]
List all the files in the reverse order of their installation date into a file: ``` rpm -qa --last >list ``` You'll get lines like ``` atop-2.1-1.fc22.x86_64 Wed Apr 13 07:35:27 2016 telnet-server-0.17-60.fc22.x86_64 Mon Apr 11 20:10:43 2016 mhddfs-0.1.39-3.fc22.x86_64 ...
You can also try with `yum history` and usually you get a numbered list of what has been installed, like : ``` [root@localhost ~]# yum history Loaded plugins: product-id, refresh-packagekit, subscription-manager Updating Red Hat repositories. ID | Login user | Date and time | Action(s) | Altered ...
282,434
I was using one Linux server with CentOS7 installed for testing and installing some tools. And now I don't remember how many packages I installed. I want to remove all that packages so my server would be like new as it was. I don't want to search for every package and remove one by one. Is there any way to remove the...
2016/05/11
[ "https://unix.stackexchange.com/questions/282434", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/138782/" ]
List all the files in the reverse order of their installation date into a file: ``` rpm -qa --last >list ``` You'll get lines like ``` atop-2.1-1.fc22.x86_64 Wed Apr 13 07:35:27 2016 telnet-server-0.17-60.fc22.x86_64 Mon Apr 11 20:10:43 2016 mhddfs-0.1.39-3.fc22.x86_64 ...
In order to rollback every history transactions, you could use the o-liner below: ``` # yum history list|awk '$1 ~ /[0-9]+/ {print $1}'| while read a; do yum history undo -y $a; done ``` Be cautious while running this command, because it will remove all your installed packages! If you want confirmation, you can remo...
282,434
I was using one Linux server with CentOS7 installed for testing and installing some tools. And now I don't remember how many packages I installed. I want to remove all that packages so my server would be like new as it was. I don't want to search for every package and remove one by one. Is there any way to remove the...
2016/05/11
[ "https://unix.stackexchange.com/questions/282434", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/138782/" ]
You can also try with `yum history` and usually you get a numbered list of what has been installed, like : ``` [root@localhost ~]# yum history Loaded plugins: product-id, refresh-packagekit, subscription-manager Updating Red Hat repositories. ID | Login user | Date and time | Action(s) | Altered ...
In order to rollback every history transactions, you could use the o-liner below: ``` # yum history list|awk '$1 ~ /[0-9]+/ {print $1}'| while read a; do yum history undo -y $a; done ``` Be cautious while running this command, because it will remove all your installed packages! If you want confirmation, you can remo...
104,732
Is there a way to predict the electron configuration of an element, for example Copper is 1s^2 2s^2 2p^6 3s^2 3p^6 4s^1 3d^10 ?
2014/03/23
[ "https://physics.stackexchange.com/questions/104732", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/43087/" ]
In theory, yes: If you assume a point-like positive nucleus and use Feynman's QED theory, you can predict the electron configuration of any element. Feynman even gives some rough examples in his Lectures on Physics, which now are online (yahoo!... as in yippee!, versus a certain web site). Since this is a homework ques...
Terry is correct that to be sure of the configuration requires a complex calculation. However for the vast majority of the known elements the electron configuration is correctly predicted by the [Madelung rule](http://en.wikipedia.org/wiki/Aufbau_principle#The_Madelung_energy_ordering_rule). This gives the order in whi...
66,190
A friend of mine has a really (selectively) bad memory, and often gets things muddled. He's trying to recall the titles of these movies / series, but all he can give me is a very brief synopsis of each. However, he remembers exactly how many words are in each title. Can you help us out? > > 1. A tough police inspecto...
2018/05/24
[ "https://puzzling.stackexchange.com/questions/66190", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/15629/" ]
A tough police inspector tracks down a psychopath with magic (3) > > Dirty Harry Potter (Dirty Harry + Harry Potter) > > > A nurse and a Frenchman sing while battling leviathans (3) > > South Pacific Rim (South Pacific + Pacific Rim) > > > A large and hairy suburban father cools his temper to win over a t...
Is 10 > > Die Another Day After Tomorrow Never Dies (Die Another Day, The Day After Tomorrow, Tomorrow Never Dies). > > >
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
### It's already been established that all of the Flashes can move past light-speed via the Speed Force. As for Superman, he's never shown to move at light-speed while running inside a planetary atmosphere. * This image should answer your question, though. This scan was taken from *Flash v2*, #220. [![Superman and Fl...
Everyone here doesn't realize Flash is faster then Superman by a lot no matter space or Earth. People are saying Flash can run at the speed of light and Superman can do it, then others are saying Superman flies faster in space. Regardless Flash is able to run so fast he can go back in time and he can travel through dim...
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
False, Superman can move faster than lightspeed. On Earth he won't fly at lightspeed because this could be catastrophic to the planet Earth, Flash doesn't have that problem because part of his powers prevent any damage to the planet. In space Superman does not have that limitation and can let it rip. In a recent issue ...
In *Smallville* there is an episode where the character Impulse beats Clark in a running race. By a considerable margin.
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
In [*The Flash: The Human Race* (1998)](https://dc.fandom.com/wiki/The_Flash_Vol_2_138), the Cosmic Gamblers get the Flash to run in a race for the fastest being in existence, where losing means the destruction of planet Earth. The Flash counter bets with the Gamblers that he can run faster than they can teleport. The ...
Everyone here doesn't realize Flash is faster then Superman by a lot no matter space or Earth. People are saying Flash can run at the speed of light and Superman can do it, then others are saying Superman flies faster in space. Regardless Flash is able to run so fast he can go back in time and he can travel through dim...
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
### It's already been established that all of the Flashes can move past light-speed via the Speed Force. As for Superman, he's never shown to move at light-speed while running inside a planetary atmosphere. * This image should answer your question, though. This scan was taken from *Flash v2*, #220. [![Superman and Fl...
In *Smallville* there is an episode where the character Impulse beats Clark in a running race. By a considerable margin.
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
### It's already been established that all of the Flashes can move past light-speed via the Speed Force. As for Superman, he's never shown to move at light-speed while running inside a planetary atmosphere. * This image should answer your question, though. This scan was taken from *Flash v2*, #220. [![Superman and Fl...
In *Superman #309*, Superman flies 11 light-years in a couple of minutes/hours -- that is: **thousands** of times lightspeed. Not sure if Flash ever did that. [![Superman flies at spaceships surrounding Earth, he destroys one by flying through it and then sets off away from Earth with the other spaceships following hi...
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
False, Superman can move faster than lightspeed. On Earth he won't fly at lightspeed because this could be catastrophic to the planet Earth, Flash doesn't have that problem because part of his powers prevent any damage to the planet. In space Superman does not have that limitation and can let it rip. In a recent issue ...
In [*The Flash: The Human Race* (1998)](https://dc.fandom.com/wiki/The_Flash_Vol_2_138), the Cosmic Gamblers get the Flash to run in a race for the fastest being in existence, where losing means the destruction of planet Earth. The Flash counter bets with the Gamblers that he can run faster than they can teleport. The ...
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
False, Superman can move faster than lightspeed. On Earth he won't fly at lightspeed because this could be catastrophic to the planet Earth, Flash doesn't have that problem because part of his powers prevent any damage to the planet. In space Superman does not have that limitation and can let it rip. In a recent issue ...
Everyone here doesn't realize Flash is faster then Superman by a lot no matter space or Earth. People are saying Flash can run at the speed of light and Superman can do it, then others are saying Superman flies faster in space. Regardless Flash is able to run so fast he can go back in time and he can travel through dim...
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
In *Superman #309*, Superman flies 11 light-years in a couple of minutes/hours -- that is: **thousands** of times lightspeed. Not sure if Flash ever did that. [![Superman flies at spaceships surrounding Earth, he destroys one by flying through it and then sets off away from Earth with the other spaceships following hi...
In *Smallville* there is an episode where the character Impulse beats Clark in a running race. By a considerable margin.
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
### It's already been established that all of the Flashes can move past light-speed via the Speed Force. As for Superman, he's never shown to move at light-speed while running inside a planetary atmosphere. * This image should answer your question, though. This scan was taken from *Flash v2*, #220. [![Superman and Fl...
False, Superman can move faster than lightspeed. On Earth he won't fly at lightspeed because this could be catastrophic to the planet Earth, Flash doesn't have that problem because part of his powers prevent any damage to the planet. In space Superman does not have that limitation and can let it rip. In a recent issue ...
80,312
I have heard from many people that the Flash is faster than Superman. But how do we know this? Have we ever seen them head-to-head?
2015/01/28
[ "https://scifi.stackexchange.com/questions/80312", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35071/" ]
In *Superman #309*, Superman flies 11 light-years in a couple of minutes/hours -- that is: **thousands** of times lightspeed. Not sure if Flash ever did that. [![Superman flies at spaceships surrounding Earth, he destroys one by flying through it and then sets off away from Earth with the other spaceships following hi...
Everyone here doesn't realize Flash is faster then Superman by a lot no matter space or Earth. People are saying Flash can run at the speed of light and Superman can do it, then others are saying Superman flies faster in space. Regardless Flash is able to run so fast he can go back in time and he can travel through dim...
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
You can use [`strings.Join(arr \[\]string, separator string) string`](https://golang.org/pkg/strings/#Join).
It can be done easily using Join function by importing strings package. You need to pass the slice of strings and the separator you need to separate the elements in the string. (examples: space or comma) ``` func Join(elems []string, sep string) string ``` *Example Code :* ``` package main import ( "fmt" "...
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
This is a simple example, which you can paste into the main function: ``` stringArray := []string {"Hello","world","!"} justString := strings.Join(stringArray," ") fmt.Println(justString) ``` And link to [working example](https://play.golang.org/p/ITduafyfx0) on playground. Or using very simple function [simple fun...
> > Will `Sprint` do it? > > > **Yes indeed!** > > > Here is another way to convert to a string if all you care about is that it is a string and not specifically how it looks (see answers above with `strings.Join` for a little more flexibility). The advantage of this method (or variations such as `Sprintf`), is...
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
This is a simple example, which you can paste into the main function: ``` stringArray := []string {"Hello","world","!"} justString := strings.Join(stringArray," ") fmt.Println(justString) ``` And link to [working example](https://play.golang.org/p/ITduafyfx0) on playground. Or using very simple function [simple fun...
``` package main import ( "fmt" "reflect" "strings" ) func main() { str1 := []string{"Trump", "In", "India", "On", "Feb 25"} fmt.Println(str1) fmt.Println(reflect.TypeOf(str1)) str2 := strings.Join(str1, " ") fmt.Println(str2) fmt.Println(reflect.TypeOf(str2)) str3 := strings.Join(str1, ", ") fmt.Println(str3) fmt....
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
> > Will `Sprint` do it? > > > **Yes indeed!** > > > Here is another way to convert to a string if all you care about is that it is a string and not specifically how it looks (see answers above with `strings.Join` for a little more flexibility). The advantage of this method (or variations such as `Sprintf`), is...
``` package main import ( "fmt" "reflect" "strings" ) func main() { str1 := []string{"Trump", "In", "India", "On", "Feb 25"} fmt.Println(str1) fmt.Println(reflect.TypeOf(str1)) str2 := strings.Join(str1, " ") fmt.Println(str2) fmt.Println(reflect.TypeOf(str2)) str3 := strings.Join(str1, ", ") fmt.Println(str3) fmt....
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
You can use [`strings.Join(arr \[\]string, separator string) string`](https://golang.org/pkg/strings/#Join).
``` package main import ( "fmt" "reflect" "strings" ) func main() { str1 := []string{"Trump", "In", "India", "On", "Feb 25"} fmt.Println(str1) fmt.Println(reflect.TypeOf(str1)) str2 := strings.Join(str1, " ") fmt.Println(str2) fmt.Println(reflect.TypeOf(str2)) str3 := strings.Join(str1, ", ") fmt.Println(str3) fmt....
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
You can use [`strings.Join(arr \[\]string, separator string) string`](https://golang.org/pkg/strings/#Join).
If you don't care about the separator, you can use `path`: ``` package main import "path" func main() { a := []string{"south", "north"} s := path.Join(a...) println(s == "south/north") } ``` <https://golang.org/pkg/path#Join>
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
You can use [`strings.Join(arr \[\]string, separator string) string`](https://golang.org/pkg/strings/#Join).
> > Will `Sprint` do it? > > > **Yes indeed!** > > > Here is another way to convert to a string if all you care about is that it is a string and not specifically how it looks (see answers above with `strings.Join` for a little more flexibility). The advantage of this method (or variations such as `Sprintf`), is...
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
This is a simple example, which you can paste into the main function: ``` stringArray := []string {"Hello","world","!"} justString := strings.Join(stringArray," ") fmt.Println(justString) ``` And link to [working example](https://play.golang.org/p/ITduafyfx0) on playground. Or using very simple function [simple fun...
If you don't care about the separator, you can use `path`: ``` package main import "path" func main() { a := []string{"south", "north"} s := path.Join(a...) println(s == "south/north") } ``` <https://golang.org/pkg/path#Join>
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
You can use [`strings.Join(arr \[\]string, separator string) string`](https://golang.org/pkg/strings/#Join).
This is a simple example, which you can paste into the main function: ``` stringArray := []string {"Hello","world","!"} justString := strings.Join(stringArray," ") fmt.Println(justString) ``` And link to [working example](https://play.golang.org/p/ITduafyfx0) on playground. Or using very simple function [simple fun...
41,756,412
I see some people create a `for` loop and run through the slice as to create a string, is there an easier way to convert a `[]string` to a `string`? Will `sprintf` do it?
2017/01/20
[ "https://Stackoverflow.com/questions/41756412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888307/" ]
This is a simple example, which you can paste into the main function: ``` stringArray := []string {"Hello","world","!"} justString := strings.Join(stringArray," ") fmt.Println(justString) ``` And link to [working example](https://play.golang.org/p/ITduafyfx0) on playground. Or using very simple function [simple fun...
It can be done easily using Join function by importing strings package. You need to pass the slice of strings and the separator you need to separate the elements in the string. (examples: space or comma) ``` func Join(elems []string, sep string) string ``` *Example Code :* ``` package main import ( "fmt" "...
3,197,901
> > Let $f:\mathbb R\to\mathbb R$ is defined by > $$f(x)= > \begin{cases} > e^\frac{-1}{x}&&x>0\\ > 0&&x\le0 > \end{cases}$$ > > > How do I check differentiability of $f(x)$ at $x=0$? I have tried to use first principle but cannot proceed.
2019/04/23
[ "https://math.stackexchange.com/questions/3197901", "https://math.stackexchange.com", "https://math.stackexchange.com/users/242402/" ]
First principles: From the perhaps most important inequality for the exponential, $e^t\ge 1+t$ for all $t\in\Bbb R$, we find $e^t=(e^{t/2})^2\ge (1+\frac12t)^2=1+t+\frac14t^2$ for $t\ge 0$. Thus for $x>0$, $$\frac{f(x)-f(0)}x=\frac 1xe^{-\frac1x}=\frac1{xe^{1/x}}\le\frac1{x(1+\frac1x+\frac1{4x^2})}=\frac{x}{x^2+x+\fra...
You apply repeatedly the fact that if $f$ is defined in a nbd of $x\_0$ and the derivative $f'(x)$ has a limit as $x\to x\_0$ then $f$ is differentiable at $x\_0$, because by Darboux's theorem, the derivative function cannot have removable discontinuities.
3,197,901
> > Let $f:\mathbb R\to\mathbb R$ is defined by > $$f(x)= > \begin{cases} > e^\frac{-1}{x}&&x>0\\ > 0&&x\le0 > \end{cases}$$ > > > How do I check differentiability of $f(x)$ at $x=0$? I have tried to use first principle but cannot proceed.
2019/04/23
[ "https://math.stackexchange.com/questions/3197901", "https://math.stackexchange.com", "https://math.stackexchange.com/users/242402/" ]
You apply repeatedly the fact that if $f$ is defined in a nbd of $x\_0$ and the derivative $f'(x)$ has a limit as $x\to x\_0$ then $f$ is differentiable at $x\_0$, because by Darboux's theorem, the derivative function cannot have removable discontinuities.
This function is actually indefinitely derivable on $\mathbb{R}$. By induction, you can show the k-th derivative exists on $\mathbb{R}^\*$ and is given * on $(-\infty, 0)$ by $x\mapsto 0$, * on $(0,+\infty)$ by a function $x \mapsto P(1/x)e^{-1/x}$, for some polynomial $P\in \mathbb{R}[t]$. Then by induction, you can...
3,197,901
> > Let $f:\mathbb R\to\mathbb R$ is defined by > $$f(x)= > \begin{cases} > e^\frac{-1}{x}&&x>0\\ > 0&&x\le0 > \end{cases}$$ > > > How do I check differentiability of $f(x)$ at $x=0$? I have tried to use first principle but cannot proceed.
2019/04/23
[ "https://math.stackexchange.com/questions/3197901", "https://math.stackexchange.com", "https://math.stackexchange.com/users/242402/" ]
First principles: From the perhaps most important inequality for the exponential, $e^t\ge 1+t$ for all $t\in\Bbb R$, we find $e^t=(e^{t/2})^2\ge (1+\frac12t)^2=1+t+\frac14t^2$ for $t\ge 0$. Thus for $x>0$, $$\frac{f(x)-f(0)}x=\frac 1xe^{-\frac1x}=\frac1{xe^{1/x}}\le\frac1{x(1+\frac1x+\frac1{4x^2})}=\frac{x}{x^2+x+\fra...
Use L'Hôpital's rule repeatedly as you approach $x = 0$ from the right: \begin{align\*} \lim\limits\_{x \to 0^+}f'(x) &= \lim\limits\_{x \to 0^+}\frac{e^{-\frac{1}{x}}}{x^2} \\ &= \lim\limits\_{x \to 0^+}\frac{\frac{1}{x^2}}{e^{\frac{1}{x}}} \quad\text{limit of the form $\frac{\infty}{\infty}$} \\ &= \lim\limits\_{x \t...
3,197,901
> > Let $f:\mathbb R\to\mathbb R$ is defined by > $$f(x)= > \begin{cases} > e^\frac{-1}{x}&&x>0\\ > 0&&x\le0 > \end{cases}$$ > > > How do I check differentiability of $f(x)$ at $x=0$? I have tried to use first principle but cannot proceed.
2019/04/23
[ "https://math.stackexchange.com/questions/3197901", "https://math.stackexchange.com", "https://math.stackexchange.com/users/242402/" ]
Use L'Hôpital's rule repeatedly as you approach $x = 0$ from the right: \begin{align\*} \lim\limits\_{x \to 0^+}f'(x) &= \lim\limits\_{x \to 0^+}\frac{e^{-\frac{1}{x}}}{x^2} \\ &= \lim\limits\_{x \to 0^+}\frac{\frac{1}{x^2}}{e^{\frac{1}{x}}} \quad\text{limit of the form $\frac{\infty}{\infty}$} \\ &= \lim\limits\_{x \t...
This function is actually indefinitely derivable on $\mathbb{R}$. By induction, you can show the k-th derivative exists on $\mathbb{R}^\*$ and is given * on $(-\infty, 0)$ by $x\mapsto 0$, * on $(0,+\infty)$ by a function $x \mapsto P(1/x)e^{-1/x}$, for some polynomial $P\in \mathbb{R}[t]$. Then by induction, you can...
3,197,901
> > Let $f:\mathbb R\to\mathbb R$ is defined by > $$f(x)= > \begin{cases} > e^\frac{-1}{x}&&x>0\\ > 0&&x\le0 > \end{cases}$$ > > > How do I check differentiability of $f(x)$ at $x=0$? I have tried to use first principle but cannot proceed.
2019/04/23
[ "https://math.stackexchange.com/questions/3197901", "https://math.stackexchange.com", "https://math.stackexchange.com/users/242402/" ]
First principles: From the perhaps most important inequality for the exponential, $e^t\ge 1+t$ for all $t\in\Bbb R$, we find $e^t=(e^{t/2})^2\ge (1+\frac12t)^2=1+t+\frac14t^2$ for $t\ge 0$. Thus for $x>0$, $$\frac{f(x)-f(0)}x=\frac 1xe^{-\frac1x}=\frac1{xe^{1/x}}\le\frac1{x(1+\frac1x+\frac1{4x^2})}=\frac{x}{x^2+x+\fra...
This function is actually indefinitely derivable on $\mathbb{R}$. By induction, you can show the k-th derivative exists on $\mathbb{R}^\*$ and is given * on $(-\infty, 0)$ by $x\mapsto 0$, * on $(0,+\infty)$ by a function $x \mapsto P(1/x)e^{-1/x}$, for some polynomial $P\in \mathbb{R}[t]$. Then by induction, you can...
5,133,774
Why wont this command work if it has space in it? I wanna use this like `alani hur up` and `alani hur down` but it dont work, i tried renaming the command to `alanihur` just to see if its some other problem but it worked then i did that so. Why cant i have space? blabla.h ``` bool Levitate(Creature* creature, const...
2011/02/27
[ "https://Stackoverflow.com/questions/5133774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/636528/" ]
I think you just copied the code examples that use [typographic quotation marks](http://en.wikipedia.org/wiki/Quotation_mark) instead of the “simple” quotation marks `"` and `'`. The code should read: ``` preg_match ('#<!-- START '. $tag . ' -->(.+?)<!-- END '.$tag . ' -->#si', $this->content, $tor); $tor = str_replac...
In PHP, strings are delimited by quotes *(either double or simple)*. Here, you are using some sort of comma as a string delimiter -- which is wrong, and explains the syntax error. For more informations, and as a reference, you should take a look at the [**Strings section of the PHP manual**](http://fr.php.net/manual/...
45,018,364
I am a newbie in Windows batch scripting and probably this is a common question, answered multiple times. The problem I have is with the following script: ``` @echo off setlocal ENABLEDELAYEDEXPANSION set var1=1 echo var1 = %var1% set var2=var1 init value : %var1%, var1 delayed value : !var1! set var1=2 echo var1 =...
2017/07/10
[ "https://Stackoverflow.com/questions/45018364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8285096/" ]
You mean somehng like this: ``` @echo off setlocal ENABLEDELAYEDEXPANSION set var1=1 echo var1 = %var1% set var2=var1 init value : %var1%, var1 delayed value : %%var1%% set var1=2 echo var1 = %var1% call echo var2 = %var2% endlocal ``` Sample output: ``` var1 = 1 var1 = 2 var2 = var1 init value : 1, var1 delay...
In first place, this is *not* a "common newbie question"; what you want to do is somewhat unusual... You need to do two small changes in your code: * In this line: `set var2=var1 init value : %var1%, var1 delayed value : !var1!` the values of both normal `%var1%` and delayed `!var1!` expansions are *the same*. You wa...
5,721
How to, using PHP scripting or WordPress overwrite all of the posts (permamently, so it takes effect on database) with some static text such as "Content removed."?
2010/12/21
[ "https://wordpress.stackexchange.com/questions/5721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1454/" ]
Do not run this on a live site until you're tested it on a backup or local installation and confirmed valid results, i won't take any resposibility for lost data, should that occur. SQL Query ========= To run from PhpMyAdmin ``` UPDATE wp_posts SET post_content = 'your_content' WHERE post_type = 'post' ``` Inside ...
Another option, if you need further control of the query or the replacement function, is to use more of the WP APIs, like this: ``` $args = array( 'post_type' => "post", 'numberposts' => -1 // additional arguments ); foreach ( get_posts( $args ) as $thispost ) wp_update_post( array( 'ID' =...
28,325,665
I have a project created on Xcode 6.1.1 - using Asset Catalogs. Targeted for iOS 7. iPad only application. My icons are showing fine in the simulator and on a device. But when I archive the project, the icons do not show up in the organizer. And subsequently do not show up in Test Flight or Crashlytics. Icon files ar...
2015/02/04
[ "https://Stackoverflow.com/questions/28325665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1736560/" ]
A `lambda` expression is a very limited way of creating a function, you can't have multiple lines/expressions (per [the tutorial](https://docs.python.org/2/tutorial/controlflow.html#lambda-expressions), *"They are syntactically restricted to a single expression"*). However, you can nest standard function `def`initions:...
You can't have a multiline lambda expression in Python, but you can return a lambda or a full function: ``` def get_function1(x): f = lambda y: x + y return f def get_function2(x): def f(y): return x + y return f ```
28,325,665
I have a project created on Xcode 6.1.1 - using Asset Catalogs. Targeted for iOS 7. iPad only application. My icons are showing fine in the simulator and on a device. But when I archive the project, the icons do not show up in the organizer. And subsequently do not show up in Test Flight or Crashlytics. Icon files ar...
2015/02/04
[ "https://Stackoverflow.com/questions/28325665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1736560/" ]
A `lambda` expression is a very limited way of creating a function, you can't have multiple lines/expressions (per [the tutorial](https://docs.python.org/2/tutorial/controlflow.html#lambda-expressions), *"They are syntactically restricted to a single expression"*). However, you can nest standard function `def`initions:...
It looks like what you're actually trying to do is [partial function application](http://en.wikipedia.org/wiki/Partial_application), for which [`functools`](https://docs.python.org/3/library/functools.html#functools.partial) provides a solution. For example, if you have a function `multiply()`: ``` def multiply(a, b):...
28,325,665
I have a project created on Xcode 6.1.1 - using Asset Catalogs. Targeted for iOS 7. iPad only application. My icons are showing fine in the simulator and on a device. But when I archive the project, the icons do not show up in the organizer. And subsequently do not show up in Test Flight or Crashlytics. Icon files ar...
2015/02/04
[ "https://Stackoverflow.com/questions/28325665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1736560/" ]
It looks like what you're actually trying to do is [partial function application](http://en.wikipedia.org/wiki/Partial_application), for which [`functools`](https://docs.python.org/3/library/functools.html#functools.partial) provides a solution. For example, if you have a function `multiply()`: ``` def multiply(a, b):...
You can't have a multiline lambda expression in Python, but you can return a lambda or a full function: ``` def get_function1(x): f = lambda y: x + y return f def get_function2(x): def f(y): return x + y return f ```
34,762,674
I have a ruby class in which I am making Net::HTTP.start call inside perform method.This is the code: ``` class Poller def self.perform(args) uri = URI('http://localhost:8081/adhoc/dummy_poll?noAuth=true') begin Net::HTTP.start(uri.host, uri.port, :read_timeout=>30) do |http| request = Net::HTTP::Get.new uri ...
2016/01/13
[ "https://Stackoverflow.com/questions/34762674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165873/" ]
try explicitly connecting to the loop back address. There may be resolution issues with localhost. ``` uri = URI('http://127.0.0.1:8081/adhoc/dummy_poll?noAuth=true') ```
It's likely you do not have any server running on `port 8081` which is why the connection will be refused. Check it with `lsof -i` and look for programs bound to 8081 on a linux machine.
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
There are many different reasons that people are protesting the ever continuing lock-downs across the country. Many believe restrictions to be too burdensome, arbitrary, or creating more problems than they are solving. Specifically for Michigan, which is currently one of the most affected states. The protest there was...
Don't discount the number of Trump supporters (clearly some, probably all) in that group. Most of the people pushing to reopen the economy are Trump boosters (Fox News, etc.) and his die-hard (no pun intended) supporters. The thinking is, the sooner we put this behind us, the sooner we will forget it, and the less dama...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
> > “I think that to live is inherently to take risks. I’m not concerned about this virus any more than I am about the flu.” > > > To explain this: when you live, you are taking risks. For example: * By going to work, you are traveling. By traveling you are running the risk of being knocked down by a car. * By wa...
Don't discount the number of Trump supporters (clearly some, probably all) in that group. Most of the people pushing to reopen the economy are Trump boosters (Fox News, etc.) and his die-hard (no pun intended) supporters. The thinking is, the sooner we put this behind us, the sooner we will forget it, and the less dama...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
First, a disclaimer: This is my theory. I've heard some radio shows that mix news and politics that were in tacit support of this kind of stuff. A good way to apply the scientific principle and test the theory would be to talk to one of those who attended. Maybe you could find someone who participated and talk to them ...
Don't discount the number of Trump supporters (clearly some, probably all) in that group. Most of the people pushing to reopen the economy are Trump boosters (Fox News, etc.) and his die-hard (no pun intended) supporters. The thinking is, the sooner we put this behind us, the sooner we will forget it, and the less dama...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
> > “I think that to live is inherently to take risks. I’m not concerned about this virus any more than I am about the flu.” > > > To explain this: when you live, you are taking risks. For example: * By going to work, you are traveling. By traveling you are running the risk of being knocked down by a car. * By wa...
First, a disclaimer: This is my theory. I've heard some radio shows that mix news and politics that were in tacit support of this kind of stuff. A good way to apply the scientific principle and test the theory would be to talk to one of those who attended. Maybe you could find someone who participated and talk to them ...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
This particular protest is far more localized and gained publicity because of the unusual circumstances surrounding it. Most states have closed "non-essential" businesses. That usually includes stores that only sell things like clothing, electronics, furniture, etc. Grocery stores are, of course, essential and are all...
There are many different reasons that people are protesting the ever continuing lock-downs across the country. Many believe restrictions to be too burdensome, arbitrary, or creating more problems than they are solving. Specifically for Michigan, which is currently one of the most affected states. The protest there was...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
In addition they probably don't care about infecting and killing others much. The fact that infecting others is a (negative) externality is being much discussed by economists in such context; see [related q here](https://politics.stackexchange.com/a/52798/18373). And the propagation of memes like "boomer doomer" etc. a...
Don't discount the number of Trump supporters (clearly some, probably all) in that group. Most of the people pushing to reopen the economy are Trump boosters (Fox News, etc.) and his die-hard (no pun intended) supporters. The thinking is, the sooner we put this behind us, the sooner we will forget it, and the less dama...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
This particular protest is far more localized and gained publicity because of the unusual circumstances surrounding it. Most states have closed "non-essential" businesses. That usually includes stores that only sell things like clothing, electronics, furniture, etc. Grocery stores are, of course, essential and are all...
Don't discount the number of Trump supporters (clearly some, probably all) in that group. Most of the people pushing to reopen the economy are Trump boosters (Fox News, etc.) and his die-hard (no pun intended) supporters. The thinking is, the sooner we put this behind us, the sooner we will forget it, and the less dama...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
This particular protest is far more localized and gained publicity because of the unusual circumstances surrounding it. Most states have closed "non-essential" businesses. That usually includes stores that only sell things like clothing, electronics, furniture, etc. Grocery stores are, of course, essential and are all...
First, a disclaimer: This is my theory. I've heard some radio shows that mix news and politics that were in tacit support of this kind of stuff. A good way to apply the scientific principle and test the theory would be to talk to one of those who attended. Maybe you could find someone who participated and talk to them ...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
> > “I think that to live is inherently to take risks. I’m not concerned about this virus any more than I am about the flu.” > > > To explain this: when you live, you are taking risks. For example: * By going to work, you are traveling. By traveling you are running the risk of being knocked down by a car. * By wa...
In addition they probably don't care about infecting and killing others much. The fact that infecting others is a (negative) externality is being much discussed by economists in such context; see [related q here](https://politics.stackexchange.com/a/52798/18373). And the propagation of memes like "boomer doomer" etc. a...
52,849
With regards to President Trump's defunding of the WHO, here's my question to get a bit more context: With respect to the stated objectives with regards to US national interests, what is the difference between the CDC (Center for Disease Control) and the WHO? Could the CDC conceivably within their mandate take over all...
2020/04/17
[ "https://politics.stackexchange.com/questions/52849", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/22118/" ]
> > “I think that to live is inherently to take risks. I’m not concerned about this virus any more than I am about the flu.” > > > To explain this: when you live, you are taking risks. For example: * By going to work, you are traveling. By traveling you are running the risk of being knocked down by a car. * By wa...
This particular protest is far more localized and gained publicity because of the unusual circumstances surrounding it. Most states have closed "non-essential" businesses. That usually includes stores that only sell things like clothing, electronics, furniture, etc. Grocery stores are, of course, essential and are all...
14,558,387
I have a numpy array of dtype = object (which are actually lists of various data types). So it makes a 2D array because I have an array of lists (?). I want to copy every row & only certain columns of this array to another array. I stored data in this array from a csv file. This csv file contains several fields(columns...
2013/01/28
[ "https://Stackoverflow.com/questions/14558387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1259621/" ]
Use [pandas](http://pandas.pydata.org/). Also it seems to me, that for various type of data as yours, the `pandas.DataFrame` may be better fit. ``` from StringIO import StringIO from pandas import * import numpy as np data = """column1 column2 column3 column4 column5 1 none 2 'gona' 5.3 2 ...
You can use range selection. Eg. to remove column3, you can use: ``` data = np.zeros((401125,), dtype = object) for i, row in enumerate(csv_file_object): data[i] = row[:2] + row[3:] ``` This will work, assuming that csv\_file\_object yields lists. If it is e.g. a simple `file` object created with `csv_file_objec...
14,558,387
I have a numpy array of dtype = object (which are actually lists of various data types). So it makes a 2D array because I have an array of lists (?). I want to copy every row & only certain columns of this array to another array. I stored data in this array from a csv file. This csv file contains several fields(columns...
2013/01/28
[ "https://Stackoverflow.com/questions/14558387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1259621/" ]
Assuming you're reading the CSV rows and sticking them into a `numpy` array, the easiest and best solution is almost definitely preprocessing the data before it gets to the array, as Maciek D.'s answer shows. (If you want to do something more complicated than "remove column 3" you might want something like `[value for ...
You can use range selection. Eg. to remove column3, you can use: ``` data = np.zeros((401125,), dtype = object) for i, row in enumerate(csv_file_object): data[i] = row[:2] + row[3:] ``` This will work, assuming that csv\_file\_object yields lists. If it is e.g. a simple `file` object created with `csv_file_objec...
14,558,387
I have a numpy array of dtype = object (which are actually lists of various data types). So it makes a 2D array because I have an array of lists (?). I want to copy every row & only certain columns of this array to another array. I stored data in this array from a csv file. This csv file contains several fields(columns...
2013/01/28
[ "https://Stackoverflow.com/questions/14558387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1259621/" ]
Use [pandas](http://pandas.pydata.org/). Also it seems to me, that for various type of data as yours, the `pandas.DataFrame` may be better fit. ``` from StringIO import StringIO from pandas import * import numpy as np data = """column1 column2 column3 column4 column5 1 none 2 'gona' 5.3 2 ...
Assuming you're reading the CSV rows and sticking them into a `numpy` array, the easiest and best solution is almost definitely preprocessing the data before it gets to the array, as Maciek D.'s answer shows. (If you want to do something more complicated than "remove column 3" you might want something like `[value for ...
43,605
Are any supergiants translucent? Some have volumes thousands of times more than the Sun's while having maybe twenty times the mass of the Sun which makes them sound rather diffuse. If there was a very bright distant star behind the supergiant would we be able to see it?
2021/04/30
[ "https://astronomy.stackexchange.com/questions/43605", "https://astronomy.stackexchange.com", "https://astronomy.stackexchange.com/users/38613/" ]
Although I will only tackle one part of the question, I find the following part of a [picture from NRAO/AUI/NSF, S. Dagnello, cited from space.com](https://www.space.com/supergiant-star-antares-map-atmosphere.html) worth sharing: [![NRAO/AUI/NSF, S. Dagnello](https://i.stack.imgur.com/phNiM.png)](https://i.stack.imgur...
No mass blob of stellar mass is transparent at any wavelength of interest. Opacities $\kappa\_{\nu}$(inverse transparency) as function of wavelength becomes really high and broad band at pressures above > 0.1 bars, for all wavelengths. This leads to the optical depths $\tau\_{\nu}$ being enormous and as transmission...
51,634,293
This is a code snippet for authentication using passports js, which is as follow, ``` // Middleware passport.use('local-login', new LocalStrategy({ usernameField: 'email', passwordField: 'password', passReqToCallback: true }, function(req, email, password, done){ User.findOne({ email: email }, function...
2018/08/01
[ "https://Stackoverflow.com/questions/51634293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961479/" ]
> > how can I know what this callback will do > > > The passport documentation should tell you everything you *need* to know in order to use it properly. > > or where is it is defined > > > Somewhere in the source code to `passport`.
Passport is a connect based framework. When you define a middle-ware like this `done` is the next function in the pipeline. For example in a express route we can use middlewares like this. ``` app.use('/route', middleWare1, middleWare2,..., route) ``` now the middlewares are kinda defined like this ``` const mid...
51,634,293
This is a code snippet for authentication using passports js, which is as follow, ``` // Middleware passport.use('local-login', new LocalStrategy({ usernameField: 'email', passwordField: 'password', passReqToCallback: true }, function(req, email, password, done){ User.findOne({ email: email }, function...
2018/08/01
[ "https://Stackoverflow.com/questions/51634293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961479/" ]
> > how can I know what this callback will do > > > The passport documentation should tell you everything you *need* to know in order to use it properly. > > or where is it is defined > > > Somewhere in the source code to `passport`.
According with <http://www.passportjs.org/docs/basic-digest/> you call "done" function to provide an user to passport. If you want to know where fuction is defined, you can read source code of "use" method
51,634,293
This is a code snippet for authentication using passports js, which is as follow, ``` // Middleware passport.use('local-login', new LocalStrategy({ usernameField: 'email', passwordField: 'password', passReqToCallback: true }, function(req, email, password, done){ User.findOne({ email: email }, function...
2018/08/01
[ "https://Stackoverflow.com/questions/51634293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961479/" ]
You don't need to worry about where the "done" callback is called. It is an internal callback that is used by "passport" That is your code way to tell "passport" the result of the "login action" Is the user verified? * if so, call the callback with error=null and user data * if not, call the callback with the error
Passport is a connect based framework. When you define a middle-ware like this `done` is the next function in the pipeline. For example in a express route we can use middlewares like this. ``` app.use('/route', middleWare1, middleWare2,..., route) ``` now the middlewares are kinda defined like this ``` const mid...
51,634,293
This is a code snippet for authentication using passports js, which is as follow, ``` // Middleware passport.use('local-login', new LocalStrategy({ usernameField: 'email', passwordField: 'password', passReqToCallback: true }, function(req, email, password, done){ User.findOne({ email: email }, function...
2018/08/01
[ "https://Stackoverflow.com/questions/51634293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961479/" ]
You don't need to worry about where the "done" callback is called. It is an internal callback that is used by "passport" That is your code way to tell "passport" the result of the "login action" Is the user verified? * if so, call the callback with error=null and user data * if not, call the callback with the error
According with <http://www.passportjs.org/docs/basic-digest/> you call "done" function to provide an user to passport. If you want to know where fuction is defined, you can read source code of "use" method
51,634,293
This is a code snippet for authentication using passports js, which is as follow, ``` // Middleware passport.use('local-login', new LocalStrategy({ usernameField: 'email', passwordField: 'password', passReqToCallback: true }, function(req, email, password, done){ User.findOne({ email: email }, function...
2018/08/01
[ "https://Stackoverflow.com/questions/51634293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961479/" ]
Passport is a connect based framework. When you define a middle-ware like this `done` is the next function in the pipeline. For example in a express route we can use middlewares like this. ``` app.use('/route', middleWare1, middleWare2,..., route) ``` now the middlewares are kinda defined like this ``` const mid...
According with <http://www.passportjs.org/docs/basic-digest/> you call "done" function to provide an user to passport. If you want to know where fuction is defined, you can read source code of "use" method
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
In Laravel use **Carbon** its good ``` {{ \Carbon\Carbon::parse($user->from_date)->format('d/m/Y')}} ```
You can check `Date Mutators`: <https://laravel.com/docs/5.3/eloquent-mutators#date-mutators> You need set in your `User` model column `from_date` in `$dates` array and then you can change format in `$dateFormat` The another option is also put this method to your `User` model: ``` public function getFromDateAttribut...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
In your Model set: ``` protected $dates = ['name_field']; ``` after in your view : ``` {{ $user->from_date->format('d/m/Y') }} ``` works
You can check `Date Mutators`: <https://laravel.com/docs/5.3/eloquent-mutators#date-mutators> You need set in your `User` model column `from_date` in `$dates` array and then you can change format in `$dateFormat` The another option is also put this method to your `User` model: ``` public function getFromDateAttribut...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
Try this: ``` date('d-m-Y', strtotime($user->from_date)); ``` It will convert date into `d-m-Y` or whatever format you have given. **Note:** This solution is a general solution that works for php and any of its frameworks. For a Laravel specific method, try the solution provided by [Hamelraj](https://stackoverflow....
You can use `Carbon::createFromTimestamp` **BLADE** ``` {{ \Carbon\Carbon::createFromTimestamp(strtotime($user->from_date))->format('d-m-Y')}} ```
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
**Method One:** Using the `strtotime()` to time is the best format to change the date to the given format. `strtotime()` - Parse about any English textual datetime description into a Unix timestamp The function expects to be given a string containing an English date format and will try to parse that format into a Un...
I suggest using `isoFormat` for better appearance on the web pages. ``` {{ \Carbon\Carbon::parse($blog->created_at)->isoFormat('MMM Do YYYY')}} ``` The result is > > Jan 21st 2021 > > > [Carbon Extension](https://carbon.nesbot.com/docs/)
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
You can check `Date Mutators`: <https://laravel.com/docs/5.3/eloquent-mutators#date-mutators> You need set in your `User` model column `from_date` in `$dates` array and then you can change format in `$dateFormat` The another option is also put this method to your `User` model: ``` public function getFromDateAttribut...
**Method One:** Using the `strtotime()` to time is the best format to change the date to the given format. `strtotime()` - Parse about any English textual datetime description into a Unix timestamp The function expects to be given a string containing an English date format and will try to parse that format into a Un...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
You can use `Carbon::createFromTimestamp` **BLADE** ``` {{ \Carbon\Carbon::createFromTimestamp(strtotime($user->from_date))->format('d-m-Y')}} ```
For a more natural date format used everywhere outside of the US, with time that includes hours, minutes and seconds: > > 07/03/2022 19:00:00 > > > ``` {{ \Carbon\Carbon::parse($transaction->created_at)->format('d/m/Y H:i:s')}} ``` Or if you'd prefer to use a more natural 12-hour-clock-based time format like t...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
Try this: ``` date('d-m-Y', strtotime($user->from_date)); ``` It will convert date into `d-m-Y` or whatever format you have given. **Note:** This solution is a general solution that works for php and any of its frameworks. For a Laravel specific method, try the solution provided by [Hamelraj](https://stackoverflow....
You can check `Date Mutators`: <https://laravel.com/docs/5.3/eloquent-mutators#date-mutators> You need set in your `User` model column `from_date` in `$dates` array and then you can change format in `$dateFormat` The another option is also put this method to your `User` model: ``` public function getFromDateAttribut...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
In your Model set: ``` protected $dates = ['name_field']; ``` after in your view : ``` {{ $user->from_date->format('d/m/Y') }} ``` works
I had a similar problem, I wanted to change the format, but I also wanted the flexibility of being able to change the format in the blade template engine too. I, therefore, set my model up as the following: ```php <?php namespace App; use Illuminate\Database\Eloquent\Model; \Carbon\Carbon::setToStringFormat('d-m-Y...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
**Method One:** Using the `strtotime()` to time is the best format to change the date to the given format. `strtotime()` - Parse about any English textual datetime description into a Unix timestamp The function expects to be given a string containing an English date format and will try to parse that format into a Un...
In Laravel 8 you can use the Date Casting: <https://laravel.com/docs/8.x/eloquent-mutators#date-casting> In your Model just set: ``` protected $casts = [ 'my_custom_datetime_field' => 'datetime' ]; ``` And then in your blade template you can use the `format()` method: ``` {{ $my_custom_datetime_field->format('...
40,038,521
I want to change the date format which is fetched from database. now I got 2016-10-01`{{$user->from_date}}` .I want to change the format 'd-m-y' in laravel 5.3 ``` {{ $user->from_date->format('d/m/Y')}} ```
2016/10/14
[ "https://Stackoverflow.com/questions/40038521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3386779/" ]
In your Model set: ``` protected $dates = ['name_field']; ``` after in your view : ``` {{ $user->from_date->format('d/m/Y') }} ``` works
In Laravel you can add a function inside app/Helper/helper.php like ``` function formatDate($date = '', $format = 'Y-m-d'){ if($date == '' || $date == null) return; return date($format,strtotime($date)); } ``` And call this function on any controller like this ``` $start_date = formatDate($start_da...
15,821,388
I'm not trying to do anything fancy... just want the content of the "noshowuntilchangevelocity" class to toggle between shown and hidden when it's specific checkbox state changes. ``` $(document).ready(function() { $("input#velocity").change(function() { $('#noshowuntilchangevelocity').t...
2013/04/04
[ "https://Stackoverflow.com/questions/15821388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1556160/" ]
I'll focus on explaining what the error means, there are too few hints in the question to provide a simple answer. A "stub" is used in COM when you make calls across an execution boundary. It wasn't stated explicitly in the question but your Ada program is probably an EXE and implements an out-of-process COM server. C...
If it suddenly stopped working happily on XP, the first culprit I'd look for is type mismatches. It is possible that "long" on such systems is now 64-bits, while your Ada COM code (and/or perhaps your C ints) are exepecting 32-bits. With a traditionally-compiled system this would have been checked for you by your compi...
15,821,388
I'm not trying to do anything fancy... just want the content of the "noshowuntilchangevelocity" class to toggle between shown and hidden when it's specific checkbox state changes. ``` $(document).ready(function() { $("input#velocity").change(function() { $('#noshowuntilchangevelocity').t...
2013/04/04
[ "https://Stackoverflow.com/questions/15821388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1556160/" ]
I'll focus on explaining what the error means, there are too few hints in the question to provide a simple answer. A "stub" is used in COM when you make calls across an execution boundary. It wasn't stated explicitly in the question but your Ada program is probably an EXE and implements an out-of-process COM server. C...
This [Related Post](https://stackoverflow.com/questions/65097/windows-server-2008-com-error-0x800706f7-the-stub-received-bad-data?rq=1) suggests you need padding in your struct, as marshalling code may expect more data than you actually send (which is a bug, of course). Your struct contains 9 bytes (assuming 4 bytes fo...
15,821,388
I'm not trying to do anything fancy... just want the content of the "noshowuntilchangevelocity" class to toggle between shown and hidden when it's specific checkbox state changes. ``` $(document).ready(function() { $("input#velocity").change(function() { $('#noshowuntilchangevelocity').t...
2013/04/04
[ "https://Stackoverflow.com/questions/15821388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1556160/" ]
I'll focus on explaining what the error means, there are too few hints in the question to provide a simple answer. A "stub" is used in COM when you make calls across an execution boundary. It wasn't stated explicitly in the question but your Ada program is probably an EXE and implements an out-of-process COM server. C...
I am also suggesting that the problem is due to a padding issue in your structure. I don't know whether you can control this using a #pragma, but it might be worth looking at your documentation. I think it would be a good idea to try and patch your struct so that the resulting type library struct is a multiple of four...
24,912,042
There seems to be a lot of functionality in R around `eval()` (at least more than I'm used to). Is there a way to test if a string (`str`) will evaluate to a function? Looking for the follow functionality, ``` R> is.strFun("boo(x)") TRUE R> is.strFun("boo") FALSE R> is.strFun("boo(baz(Y))") TRUE ``` I would rather ...
2014/07/23
[ "https://Stackoverflow.com/questions/24912042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/808713/" ]
Here's another way that will work for prefix calls, but not for infix calls, such as `%in%`. ``` is.prefix.call <- function(text) { d <- getParseData(parse(text=text)) with(d, token[id == 1] == 'SYMBOL_FUNCTION_CALL') } is.prefix.call("boo(x)") # TRUE is.prefix.call("boo") # FALSE is.prefix.call("boo(baz(Y))"...
This is far from perfect but it is short and maybe its good enough: ``` isFunCall <- function(x) grepl("[()]", x) & grepl("^[()[:alnum:]_.]+$", x) isFunCall("a(b)") ## [1] TRUE isFunCall("a(b(c))") ## [1] TRUE isFunCall("d") ## [1] FALSE ```
31,421,237
This is an example taken from o' reilly - [real world haskell](https://github.com/cyga/real-world-haskell/blob/master/ch15/MovieReview.hs#L34). ``` maybeReview alist = do title <- lookup1 "title" alist return (MovieReview title)' lookup1 key alist = case lookup key alist of Just (Just s@(_:_...
2015/07/15
[ "https://Stackoverflow.com/questions/31421237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`_` is a wildcard. It says make sure there is a value here but I don't want to bind it to any variable. `:` is the constructor for a list. On the left is one value and the right is the rest of the list. The rest of the list can be empty. So if you do something like this: ``` (x:xs) ``` x is the first element of the ...
An explanation by examples... Let "the pattern" refer to `Just (Just s@(_:_))`. Below is a list of various values and whether or not those values match the pattern. If there is a match then `s` will be set to a part of the value and can be used on the RHS of the pattern guard. 1. value = `Nothing` - does not match 2....
33,979,743
How do I declare a variable of type Node? Node is an inner class of LinkedList, and in my main method of the program I'm writing, I want to create a Node variable. But in the final line in the code snippet below I get the error message "Nose has private access in LinkedList". Why can't I use the Node type? ``` import ...
2015/11/29
[ "https://Stackoverflow.com/questions/33979743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4010409/" ]
> > Why can't I use the `Node` type? > > > Because it is declared as `private`. It is an internal implementation detail of the `LinkedList` class and you should have no reason to create instances. Clearly, this was a deliberate design decision on the part of the Java team that is intended to keep the APIs clean an...
`Node` is a class which is used internally by the `LinkedList` class to store values of each node in the `LinkedList` and is defined as private class, hence you cannot reference it from outside the class. To defined Node type for classes like LinkedList in Java we use Generics. You can define your variable like below ...
3,417,334
Given a function $f\colon [0,1] \cup (2, 3] \to [0, 2]$ defined by $$f(x)=\begin{cases} x & 0 \le x \le 1 \\ x-1 & 2 < x \le 3 \end{cases}$$ My question is that is $f$ is continuous or not continuous ? My attempt : Suppose if i take $c=0$ , then for every $\epsilon >0$ , there is exist $\delta$ such that $|x-c| < \...
2019/11/01
[ "https://math.stackexchange.com/questions/3417334", "https://math.stackexchange.com", "https://math.stackexchange.com/users/557708/" ]
I'm going to guess that what you are actually asking is how this definition leads to the equation of a quadratic function that you're used to seeing for a parabola. For simplicity's sake, let's assume that the focus lies on the y-axis, say its coordinates are $\,(0,\alpha),\,$ and that the directrix is the horizontal l...
It's not an answer. Let me add some comments. First of all, please note that one of the simplest ways of defining conic is the following: Let S be a fixed point on the plane, and AB be a straight line that does not pass the given fixed point S. Now, consider the locus of a point P such that SP/PM is constant, where MP...
6,147,140
I'm trying to do division on a `uint128_t` that is made up of 2 `uint64_t`s. Weirdly enough, the function works for `uint64_t`s with only the lower value set and the upper value = 0. I don't understand why. Here's the code for the division and bit shift ``` class uint128_t{ private: uint64_t UPPER, LOWER; ...
2011/05/27
[ "https://Stackoverflow.com/questions/6147140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341683/" ]
`out = uint128_t(LOWER << (64 - shift), 0);` is wrong - it should be `shift - 64` instead. As a style note, ALL\_CAPITALS are usually reserved for constants only. Variables and members should use mostly lowercase.
try this: ``` // some bit operations stuff const unsigned char de_brujin_bit_map_64 [] = { 0,1,2,7,3,13,8,19,4,25,14,28,9,34,20,40,5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57, 63,6,12,18,24,27,33,39,16,37,45,47,30,53,49,56,62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58 }; inline uint8_t trailing_zero_coun...
6,147,140
I'm trying to do division on a `uint128_t` that is made up of 2 `uint64_t`s. Weirdly enough, the function works for `uint64_t`s with only the lower value set and the upper value = 0. I don't understand why. Here's the code for the division and bit shift ``` class uint128_t{ private: uint64_t UPPER, LOWER; ...
2011/05/27
[ "https://Stackoverflow.com/questions/6147140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341683/" ]
`out = uint128_t(LOWER << (64 - shift), 0);` is wrong - it should be `shift - 64` instead. As a style note, ALL\_CAPITALS are usually reserved for constants only. Variables and members should use mostly lowercase.
anyway, this version is a little bit faster :) ensure, 4000 iterations against 127: ``` uint128_t divident = uint128_t(0xffffffffffffffffULL, 0xffffffffffffffffULL); uint128_t divisor = 10; { uint32_t iter_count = 0; uint128_t copyn(divident), quotient = 0; while (copyn >= divisor) { ++iter_co...
11,333,411
Does anyone have recommendations on a cross platform GUI Library for Ruby. I have looked at <https://github.com/brixen/wxruby> and it seems like its dead (the last code push is more than 2 years ago), but I need something on similar lines. The goal is to build a native app for Windows/OS X and Linux. My other option cu...
2012/07/04
[ "https://Stackoverflow.com/questions/11333411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/859829/" ]
I'd look into [qtruby](http://rubyforge.org/projects/korundum/). It's actively developed, works on Windows, OSX and Linux and there even is [an (old) ebook about it](http://pragprog.com/book/ctrubyqt/rapid-gui-development-with-qtruby).
I will try: <http://shoesrb.com/>
66,705,727
Im very new to python and trying to figure out how to graph out some data which can have missing data for any given date. The data is number of jobs completed (y), their rating (secondary Y), and date (x). The graph looks how id like however jobs dont get completed each day so there are days where there is no data an...
2021/03/19
[ "https://Stackoverflow.com/questions/66705727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5584428/" ]
I think you are looking for [Dataframe.fillna()](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.fillna.html). ``` df.fillna(method='ffill') ``` Forward Fill ('ffill') will use the last valid observation in place of a missing value.
to fill your data you can use pandas [fill.na](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.fillna.html) and use 'method=ffill' to propagate the last valid value. Check the documentation to see what method fits best.
10,727,283
I am looking for a way to simplify a regular expression which consists of values (e.g. 12345), relation signs (<,>,<=,>=) and junctors (&,!). E.g. the expression: ``` >= 12345 & <=99999 & !55555 ``` should be matched. I have this regular expression: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & >...
2012/05/23
[ "https://Stackoverflow.com/questions/10727283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1413457/" ]
Starting from your regex, you can do this simplification steps: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>|&| &| & |$))* ``` 1. Move the anchor out of the alternation ``` ^(<=|<= |>= |>= |<|>|< |> |)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>...
You can make all the spaces optional (with question marks) so you don't have to explicitly list all the possibilities. Also you can group the equality/inequality symbols in a character set ([ ]). Like this, I think ``` (^[<>]=?\s?)((!|)([0-9]{1,5}))(\s?&\s?[<>]=?\s|$)* ```
10,727,283
I am looking for a way to simplify a regular expression which consists of values (e.g. 12345), relation signs (<,>,<=,>=) and junctors (&,!). E.g. the expression: ``` >= 12345 & <=99999 & !55555 ``` should be matched. I have this regular expression: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & >...
2012/05/23
[ "https://Stackoverflow.com/questions/10727283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1413457/" ]
Starting from your regex, you can do this simplification steps: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>|&| &| & |$))* ``` 1. Move the anchor out of the alternation ``` ^(<=|<= |>= |>= |<|>|< |> |)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>...
How about `[<>]=?|\d{1,5}|[&!\|]` That takes care of your > / >= / < / <= repetition. Seems to work for me. Let me know if this answers your question, or needs work.
10,727,283
I am looking for a way to simplify a regular expression which consists of values (e.g. 12345), relation signs (<,>,<=,>=) and junctors (&,!). E.g. the expression: ``` >= 12345 & <=99999 & !55555 ``` should be matched. I have this regular expression: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & >...
2012/05/23
[ "https://Stackoverflow.com/questions/10727283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1413457/" ]
Starting from your regex, you can do this simplification steps: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>|&| &| & |$))* ``` 1. Move the anchor out of the alternation ``` ^(<=|<= |>= |>= |<|>|< |> |)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>...
I have a two-step procedure in mind. First break by junctor, then check individual parts. ``` final String expr = ">= 12345 & <=99999 & !55555".replaceAll("\\s+", ""); for (String s : expr.split("[|&]")) if (!s.matches("([<>]=?|=|!)?\\d+")) { System.out.println("Invalid"); return; } System.out.println("Valid"); ```...
10,727,283
I am looking for a way to simplify a regular expression which consists of values (e.g. 12345), relation signs (<,>,<=,>=) and junctors (&,!). E.g. the expression: ``` >= 12345 & <=99999 & !55555 ``` should be matched. I have this regular expression: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & >...
2012/05/23
[ "https://Stackoverflow.com/questions/10727283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1413457/" ]
Starting from your regex, you can do this simplification steps: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>|&| &| & |$))* ``` 1. Move the anchor out of the alternation ``` ^(<=|<= |>= |>= |<|>|< |> |)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>...
you seem to be spending a lot of effort matching optional spaces. something like `\s?` (0 - 1) or `\s*` (0 - many) would be better. also, repeated items separated by something are always difficult. it's best to make a regexp for the "thing" to simplify the repetition. ``` limit = '\s*([<>]=?|!)\s*\d{1,5}\s*' one_or_m...
10,727,283
I am looking for a way to simplify a regular expression which consists of values (e.g. 12345), relation signs (<,>,<=,>=) and junctors (&,!). E.g. the expression: ``` >= 12345 & <=99999 & !55555 ``` should be matched. I have this regular expression: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & >...
2012/05/23
[ "https://Stackoverflow.com/questions/10727283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1413457/" ]
Starting from your regex, you can do this simplification steps: ``` (^<=|^<= | ^>= | ^>= |^<|^>|^< |^> |^)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>|&| &| & |$))* ``` 1. Move the anchor out of the alternation ``` ^(<=|<= |>= |>= |<|>|< |> |)((!|)([0-9]{1,5}))( & > | & < |& >=|&>=|&<=||&<=|&>=|&<|&>...
This is what you want: ``` ^(\s*([<>]=?)?\s*!?\d{1,5}\s*(&|$))* ``` These explanations of sum sub expressions should help you understand the whole thing: `\s*`: 0 or more spaces `([<>]=?)?`: A `<` or `>` sign optionally followed by an `=`, all optional `!?`: And optional `!` `\d{1,5}`: 1-5 digits `(&|$)...
10,977,126
Is there something like AlarmManager(Android) in WindowsPhone7 mango, which will launch the app when the alarm goes off ? Like in android we have <http://developer.android.com/reference/android/app/AlarmManager.html> But in WindowsPhone7 we have this <http://msdn.microsoft.com/en-us/library/hh202965(v=vs.92).aspx>
2012/06/11
[ "https://Stackoverflow.com/questions/10977126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1448531/" ]
In PHP, private / protected callbacks are only accesible if called from the right context (e.g. within the class that has access to those callbacks) - see [here](https://stackoverflow.com/questions/1028035/can-i-use-private-instance-methods-as-callbacks) for discussion. In your case, the GearmanClient class will not h...
Of course we can. Just wrap it around closure: ``` $this->gearmanClient->setCompleteCallback(function () { $this->JobComplete(); }); ```
14,151,901
Say I declare a template class `A` in `a.h` ``` #include <iostream> template<bool b> class A { public: void print(std::ostream& out); }; ``` And define the print method in `a.cpp` (with explicit instatiation for `true` and `false`) ``` #include "a.h" template<bool b> void A<b>::print(std::ostream& out) { ou...
2013/01/04
[ "https://Stackoverflow.com/questions/14151901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1406686/" ]
I don't think there is a good *natural* explanation for why this is so. Clearly, the compiler could see the definition of the member function even if it is provided after the explicit instantiation – because it is located in the same file. However, compilers are not required to this; it is in fact explicitly forbidden...
``` template class A<true>; template class A<false>; ``` The **same reason** why it is typically expected that template code is defined in the header itself. To perform explicit instantiation, you (the compiler) need to be able to **see the entire definition** of the template class, which isn't possible from your `ma...
71,509,232
Yesterday I was wondering how to access to dictionary keys in a DataFrame column ([link](https://stackoverflow.com/questions/71500328/retrieving-a-list-from-a-specific-value-with-a-dictionnary-as-column-type)). The solution was to use `.str[<key>]` on the pandas Series and call the `tolist()` method afterwards. However...
2022/03/17
[ "https://Stackoverflow.com/questions/71509232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13897851/" ]
UseDapp has a recent addition for this, a hook named `useLogs`. I invite you to [take a look](https://usedapp-docs.netlify.app/docs/API%20Reference/Hooks#uselogs) and see if it works for your use case. ### Example This will download all `Transfer` events from an instance of a `token` contract, and print out transact...
The best way to listen to events is by using [The Graph](https://thegraph.com/docs/en/).
37,135,604
Following the W3Schools, i tried the following to trigger a resize event : ``` $(window).ready(function(){ $(window).resize(function(){ if($(".formEvent").length){ // If element exist addEventForm($("span.active")); // resize process } }); console.log($(window).data("events")); ...
2016/05/10
[ "https://Stackoverflow.com/questions/37135604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6033520/" ]
[See here](http://developer.android.com/intl/es/reference/android/app/FragmentManager.html#executePendingTransactions()) > > After a `FragmentTransaction` is committed with `FragmentTransaction.commit()`, it is scheduled to be executed asynchronously on the process's main thread. If you want to immediately executing ...
Each time you call `getFragmentManager().beginTransaction()` a new `FragmentTransaction` instance is created. You never commit the first transaction: > > getFragmentManager().beginTransaction().add(ibf, InboxFragment.TAG); > > > but only the second (empty) one: > > getFragmentManager().beginTransaction().commi...
19,637
Can anyone help me with this problem: I am having problem with Right-to-Left writing with the Old Turkic font. Turkish is written with extended Latin letters left-to-right but: Old Turkic is a Turkish variation which is written Right-to-Left, defined in ``` Unicode Standard 5.2 Range 10C00-10C4F (Central Asian Lang...
2013/07/18
[ "https://graphicdesign.stackexchange.com/questions/19637", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/14137/" ]
I have something like this in my blog. It's a photoshop script that repairs text layers written in Arabic or Ottoman which writes from right to left. It is for Arabic or Ottoman language, but I hope it will work on Göktürk language. You can [download it from here](http://www.ferdicildiz.net/wp-content/uploads/2013/02/...
It's a good question. I think it's not the problem of language but problem is in your Photoshop Software. On the other hand, I have noticed in your screen shot when you type on Illustrator then you select your Local front but when you type in Photoshop then you are not. It cloud be a problem. And finally when you Sol...
59,814,442
Is there anyway to use paging for the media results obtained using the Instagram Basic Display API? I've read the following documentations but they don't have any examples for using pagination: * <https://developers.facebook.com/docs/instagram-basic-display-api/reference/media/children> * <https://developers.facebook...
2020/01/19
[ "https://Stackoverflow.com/questions/59814442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5283618/" ]
Found an answer by playing around with the pagination parameters from this documentation: <https://developers.facebook.com/docs/graph-api/using-graph-api#paging> Currently, the Basic Display API returns the most recent 20 media by default. If you want to return more or less than this, use the following url: <https://...
I was not able to get things working with the answer by CDS. Instead, used an approach that looks for the "next" tag in the returned json formatted string, and used that directly. In my case, I have built a Storage Access Framework implementation for Instagram, and so here is the flow: In the "add rows" call that the...
59,814,442
Is there anyway to use paging for the media results obtained using the Instagram Basic Display API? I've read the following documentations but they don't have any examples for using pagination: * <https://developers.facebook.com/docs/instagram-basic-display-api/reference/media/children> * <https://developers.facebook...
2020/01/19
[ "https://Stackoverflow.com/questions/59814442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5283618/" ]
Found an answer by playing around with the pagination parameters from this documentation: <https://developers.facebook.com/docs/graph-api/using-graph-api#paging> Currently, the Basic Display API returns the most recent 20 media by default. If you want to return more or less than this, use the following url: <https://...
**Here is the simple python function I have created on @CDS answer.** ```py import requests def get_user_data2(user_id, access_token, max_limit=100): fields = 'caption, id, username, media_type' all_posts = [] paging_url = f'https://graph.instagram.com/{user_id}/media?fields={fields}&access_token={access_...
68,366,893
``` export function fetchNews(data) { const news = [] var numOfArticlesArray = fetchNewsPreprocessing(data) data.map((interest, index) => { fetch(`https://newsapi.org/v2/top-headlines?country=us&category=${interest}&apiKey=`) .then(res => res.json()) .then(res => res.articles) ...
2021/07/13
[ "https://Stackoverflow.com/questions/68366893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10314484/" ]
Do you want to execute your `fetch()` calls serially, or in parallel? If you want to execute them serially then something like this will work: ```js export function fetchNews(data) { const news = []; const numOfArticlesArray = fetchNewsPreprocessing(data); data.map( async (interest, index) => { ...
You should put `await` in front of `fetch()` instead. For example, this piece of code will output the `news` array with the `test` element: ```js async function fetchNews(data) { let news = []; await fetch(url).then(() => news.push('test')); console.log(news) } ```