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 |
|---|---|---|---|---|---|
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | add tab bar item under view controller, if you embed in view controller in navigation controller tab bar item must be come under Navigation controller.
* View controller when icon not shown
 | [](https://i.stack.imgur.com/1SdX0.png)
First drop your image in the Assets or Images section then click on the image and show to option for Render As in the right side menu. So change the option from default to Original Image same as shown in... |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | I had this problem due to the tint color on my `UIBarButtonItem` this did the trick!
```swift
BarButtonItem.image = UIImage(named: "yourImage")?.withRenderingMode(.alwaysOriginal)
``` | [](https://i.stack.imgur.com/1SdX0.png)
First drop your image in the Assets or Images section then click on the image and show to option for Render As in the right side menu. So change the option from default to Original Image same as shown in... |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | When you click on a tab bar icon in one of your view controllers, on the right hand side is where you set the image. What's misleading is that there are two places to set the image in the right sidebar. Under `Tab Bar Item > System Item (custom)` below that selecting the custom image. Then right below that whole first ... | [](https://i.stack.imgur.com/1SdX0.png)
First drop your image in the Assets or Images section then click on the image and show to option for Render As in the right side menu. So change the option from default to Original Image same as shown in... |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | I had this problem due to the tint color on my `UIBarButtonItem` this did the trick!
```swift
BarButtonItem.image = UIImage(named: "yourImage")?.withRenderingMode(.alwaysOriginal)
``` | Just choose an image in the Bar item section. About the selectedImage, check this [selectedImage Apple developer documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/1617072-selectedimage) |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | If you follow `B B`'s answer, the image will always render in original form in all the places.
for my tabbar implementation i had to do the following
```
tabBarItem.selectedImage = UIImage(named: "home").withRenderingMode(.alwaysOriginal);
tabBarItem.image = = UIImage(named: "home");
```
So here the image will be ... | Just choose an image in the Bar item section. About the selectedImage, check this [selectedImage Apple developer documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/1617072-selectedimage) |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | Go to Assets folder.
Select your tab image.
On the right side under Attributes you will find "Render As".
Select "Original Image". | I had this problem due to the tint color on my `UIBarButtonItem` this did the trick!
```swift
BarButtonItem.image = UIImage(named: "yourImage")?.withRenderingMode(.alwaysOriginal)
``` |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | When you click on a tab bar icon in one of your view controllers, on the right hand side is where you set the image. What's misleading is that there are two places to set the image in the right sidebar. Under `Tab Bar Item > System Item (custom)` below that selecting the custom image. Then right below that whole first ... | If you follow `B B`'s answer, the image will always render in original form in all the places.
for my tabbar implementation i had to do the following
```
tabBarItem.selectedImage = UIImage(named: "home").withRenderingMode(.alwaysOriginal);
tabBarItem.image = = UIImage(named: "home");
```
So here the image will be ... |
40,102,554 | I uploaded an image to assets folder and assigned the image to 1x, 2x and 3x.
selected the table view controller of the respective tab bar item -> selected the Attributes -> assigned the image to the image field in the Bar Items section.
After running the application a Blue Square box is showing up on selection and ... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40102554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696729/"
] | Go to Assets folder.
Select your tab image.
On the right side under Attributes you will find "Render As".
Select "Original Image". | Just choose an image in the Bar item section. About the selectedImage, check this [selectedImage Apple developer documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/1617072-selectedimage) |
34,647,685 | I want to generate time sequence of a day by a minute difference using R like
```
00:00, 00:01, 00:02, ..., 23:59
```
For the same, I am using `timeBasedSeq` function of [xts](https://cran.r-project.org/web/packages/xts/index.html) package with following lines of code
```
timerange1<- paste('T00:00','/','T23:59',' ... | 2016/01/07 | [
"https://Stackoverflow.com/questions/34647685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3317829/"
] | Or from the comments,
```
format(seq(as.POSIXct("2013-01-01 00:00:00", tz="GMT"),
length.out=1440, by='1 min'), '%H:%M')
``` | You don't respect the required format: `CCYYMMDD HHMMSS`, in your case `CCYYMMDD HHMM`. Try:
```
library(xts)
timerange1 <- "20160106 0000/20160106 2359"
seqMinute <- format(timeBasedSeq(timerange1), "%H:%M")
length(seqMinute)
# [1] 1440
range(seqMinute)
# [1] "00:00" "23:59"
``` |
23,114,977 | EDITED QUESTION
I have the following method:
```
def stats_by_day(league)
league.days_of_league.collect do |day|
roster_for(league).collect do |celeb|
celeb.tweets_this_day(day).inject(0) {|sum, n| sum + n.retweet_count + n.favorite_count}
end
end
end
```
This gives me:
```
Day1, Day2, Day3 Day1 Day2 ... | 2014/04/16 | [
"https://Stackoverflow.com/questions/23114977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/886882/"
] | If the nested arrays are all of the same size you can use the [`Array#transpose`](http://ruby-doc.org/core-2.1.1/Array.html#method-i-transpose) method:
```
ary = [[:a1, :b1, :c1],[:a2, :b2, :c2],[:a3, :b3, :c3]]
ary.transpose
# => [[:a1, :a2, :a3], [:b1, :b2, :b3], [:c1, :c2, :c3]]
``` | You can do
```
a.flatten.group_by { |x| x[/[a-zA-Z]+/] }.values
=> [["a1", "a2", "a3"], ["b1", "b2", "b3"], ["c1", "c2", "c3"]]
``` |
63,765,646 | I want to contribute to a public repo with a pull request.
I can't seem to find a workaround for it, when I fork the public repo it shows up in my account as well.
However, I don't want that repo to be seen in my github account. | 2020/09/06 | [
"https://Stackoverflow.com/questions/63765646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14230640/"
] | To issue a PR on a public repository your fork must also be public. The repo you are issuing the pull request to must be able to access and view your fork. The PR will be public. If accepted, your commits will appear in the public repository.
>
> However, I don't want that repo to be seen in my github account.
>
>
... | Since September 2022, you can [make your GitHub profile private](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/setting-your-profile-to-private).
It won't prevent the forked repository from appearing on your profile, but at least your followers won't... |
63,765,646 | I want to contribute to a public repo with a pull request.
I can't seem to find a workaround for it, when I fork the public repo it shows up in my account as well.
However, I don't want that repo to be seen in my github account. | 2020/09/06 | [
"https://Stackoverflow.com/questions/63765646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14230640/"
] | Simple answer: **No**.
Github does not allow you to do that.
For more information, you can go to `Settings` of your repo, you will check that it is mentioned clearly inside Danger Zone area.
>
> You cannot change the visibility of a fork. [Please duplicate the
> repository](https://docs.github.com/articles/dupl... | Since September 2022, you can [make your GitHub profile private](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/setting-your-profile-to-private).
It won't prevent the forked repository from appearing on your profile, but at least your followers won't... |
325,500 | Got a bunch of txt files that need to be cleaned and parsed properly.
I need to break lines when pattern "SP." is found but not when pattern "ASSERT. SP." is found.
Sample content:
```
SP. 247 for specific issues no really solved
ASSERT. SP. 4532 no so valuable it depends on primary conditions
At first ... | 2016/11/23 | [
"https://unix.stackexchange.com/questions/325500",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/163676/"
] | Need a little tweak of `sed` solution posted in OP
```
sed -r 's/([^.] )(SP\. )/\1\n\2/g'
```
The issue with `s/([^\.] )(SP\. )/\nSP\. /g` is that it discards `([^\.] )`. Also `.` need not be escaped inside `[]` as well as in replacement section | Usually same tasks can be solved via substitution unhanged part by rare symbol then return it back
```
sed '
s/\(^\s*\|ASSERT\. \)SP\./\1\a/g
s/SP\./\n&/g
s/\a/SP./g
'
``` |
325,500 | Got a bunch of txt files that need to be cleaned and parsed properly.
I need to break lines when pattern "SP." is found but not when pattern "ASSERT. SP." is found.
Sample content:
```
SP. 247 for specific issues no really solved
ASSERT. SP. 4532 no so valuable it depends on primary conditions
At first ... | 2016/11/23 | [
"https://unix.stackexchange.com/questions/325500",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/163676/"
] | Need a little tweak of `sed` solution posted in OP
```
sed -r 's/([^.] )(SP\. )/\1\n\2/g'
```
The issue with `s/([^\.] )(SP\. )/\nSP\. /g` is that it discards `([^\.] )`. Also `.` need not be escaped inside `[]` as well as in replacement section | I would do this
```
sed -r '
# for lines without "ASSERT.", add a newline before "SP."
# unless it is only preceded by whitespace
/ASSERT\./! s/^(.*[^[:blank:]].*)(SP\.)/\1\n\2/
# for lines containing "ASSERT.", add a newline before the last "SP."
s/^(.*ASSERT\..*SP\..*)(SP\..*)/\1\n\2/
' file
``... |
325,500 | Got a bunch of txt files that need to be cleaned and parsed properly.
I need to break lines when pattern "SP." is found but not when pattern "ASSERT. SP." is found.
Sample content:
```
SP. 247 for specific issues no really solved
ASSERT. SP. 4532 no so valuable it depends on primary conditions
At first ... | 2016/11/23 | [
"https://unix.stackexchange.com/questions/325500",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/163676/"
] | Usually same tasks can be solved via substitution unhanged part by rare symbol then return it back
```
sed '
s/\(^\s*\|ASSERT\. \)SP\./\1\a/g
s/SP\./\n&/g
s/\a/SP./g
'
``` | I would do this
```
sed -r '
# for lines without "ASSERT.", add a newline before "SP."
# unless it is only preceded by whitespace
/ASSERT\./! s/^(.*[^[:blank:]].*)(SP\.)/\1\n\2/
# for lines containing "ASSERT.", add a newline before the last "SP."
s/^(.*ASSERT\..*SP\..*)(SP\..*)/\1\n\2/
' file
``... |
255,714 | Given $a,b,c \geq 0$ and $$a + b + c = 3$$
prove
$$\frac{a}{b^2 + 1} + \frac{b}{c^2 + 1} + \frac{c}{a^2 + 1} \geq \frac{3}{2}$$
One can prove the above using a great deal of "human" insight and equation manipulation, as shown [here](https://www.youtube.com/watch?v=O7W1ACX3TRM).
I would like to prove this with as mu... | 2021/09/16 | [
"https://mathematica.stackexchange.com/questions/255714",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/9735/"
] | This can be done as follows.
```
Resolve[ForAll[{a, b, c}, {a, b, c} >= 0,
Implies[a + b + c == 3, a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1) >= 3/2]], Reals]
```
>
> `True`
>
>
>
or/and
```
FindInstance[ a + b + c == 3 && {a, b, c} >= 0 &&
a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1) < 3/2, {a, b, c}, Reals]
```
... | ```
Minimize[{a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1), {a, b, c} > 0,
a + b + c == 3}, {a, b, c}]
```
>
> `{3/2, {a -> 1, b -> 1, c -> 1}}`
>
>
> |
255,714 | Given $a,b,c \geq 0$ and $$a + b + c = 3$$
prove
$$\frac{a}{b^2 + 1} + \frac{b}{c^2 + 1} + \frac{c}{a^2 + 1} \geq \frac{3}{2}$$
One can prove the above using a great deal of "human" insight and equation manipulation, as shown [here](https://www.youtube.com/watch?v=O7W1ACX3TRM).
I would like to prove this with as mu... | 2021/09/16 | [
"https://mathematica.stackexchange.com/questions/255714",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/9735/"
] | This can be done as follows.
```
Resolve[ForAll[{a, b, c}, {a, b, c} >= 0,
Implies[a + b + c == 3, a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1) >= 3/2]], Reals]
```
>
> `True`
>
>
>
or/and
```
FindInstance[ a + b + c == 3 && {a, b, c} >= 0 &&
a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1) < 3/2, {a, b, c}, Reals]
```
... | The **most straightforward** method involves `Simplify` with assumptions being its second argument:
```
Simplify[ a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1) >= 3/2,
a + b + c == 3 && a >= 0 && b >= 0 && c >= 0]
```
>
>
> ```
> True
>
> ```
>
>
The assumption that `a, b, c` are nonnegative is important... |
255,714 | Given $a,b,c \geq 0$ and $$a + b + c = 3$$
prove
$$\frac{a}{b^2 + 1} + \frac{b}{c^2 + 1} + \frac{c}{a^2 + 1} \geq \frac{3}{2}$$
One can prove the above using a great deal of "human" insight and equation manipulation, as shown [here](https://www.youtube.com/watch?v=O7W1ACX3TRM).
I would like to prove this with as mu... | 2021/09/16 | [
"https://mathematica.stackexchange.com/questions/255714",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/9735/"
] | ```
Minimize[{a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1), {a, b, c} > 0,
a + b + c == 3}, {a, b, c}]
```
>
> `{3/2, {a -> 1, b -> 1, c -> 1}}`
>
>
> | The **most straightforward** method involves `Simplify` with assumptions being its second argument:
```
Simplify[ a/(b^2 + 1) + b/(c^2 + 1) + c/(a^2 + 1) >= 3/2,
a + b + c == 3 && a >= 0 && b >= 0 && c >= 0]
```
>
>
> ```
> True
>
> ```
>
>
The assumption that `a, b, c` are nonnegative is important... |
46,649,115 | I am working with a face recognition using OpenCV in python. I want to close this window then open another window when the cam recognized a user. (Nevermind the opening of the window, i already did that) If I just open the another window, it loops and shows plenty of windows. I did search in the internet but no luck. C... | 2017/10/09 | [
"https://Stackoverflow.com/questions/46649115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8028650/"
] | In the Spring Documentation (<https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-logging.html>) it says:
>
> The various logging systems can be activated by including the
> appropriate libraries on the classpath, and further customized by
> providing a suitable configuration file **in the ... | Spring boot automatically loads application.properties and application.yaml from below locations, Values from lower-order overriding earlier ones
1. The classpath root
2. The classpath /config package
3. The current directory
4. The /config subdirectory in the current directory
5. Immediate child directories of the /c... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | It is possible, as long as they use the same power (or resistance).
However, it comes at a risk. If one of the bulbs uses less power (for whatever reason, maybe damaged/end of light ... see Ferrybig's remark below for a good reason), the other uses more, and will break (faster), so it's not a perfect solution.
Becaus... | In theory, if it's really no electronics bulbs, you can do this. The lifetime of the bulbs may be lower as they need not divide the power equally as they age, and larger power means larger wear.
In practise, yes, it will work and will do what you expect. Unless something goes wrong.
Still, it's very likely against th... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | Yes, that should work fine.
Back in the day, Christmas lights were 6 or 12V lights in series and there were thousands of those sold each year.
A slight caveat is that typically the threaded portion of the socket is connected to neutral. The second light bulb will have voltage on the threaded part of the socket, so yo... | It is possible, as long as they use the same power (or resistance).
However, it comes at a risk. If one of the bulbs uses less power (for whatever reason, maybe damaged/end of light ... see Ferrybig's remark below for a good reason), the other uses more, and will break (faster), so it's not a perfect solution.
Becaus... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | It is possible, as long as they use the same power (or resistance).
However, it comes at a risk. If one of the bulbs uses less power (for whatever reason, maybe damaged/end of light ... see Ferrybig's remark below for a good reason), the other uses more, and will break (faster), so it's not a perfect solution.
Becaus... | Yes, it's not Code legal (because the shell of the upper bulb socket will be hot), but it will work. This depends on the bulbs being equal; if they're not, one will burn out first.
However, given the Code violation and the general difficulty, I think you're barking up the wrong tree. Fluorescent technology has gotten... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | I feel that it is not a good idea as a standard practice. But conceptually, it would be fine to use two 120V filament type light bulbs in series on a 230V system. I have done it before, briefly, and the bulbs appeared pretty normal. So feel free to experiment. But in the long run, maybe the bulbs would not share voltag... | In theory, if it's really no electronics bulbs, you can do this. The lifetime of the bulbs may be lower as they need not divide the power equally as they age, and larger power means larger wear.
In practise, yes, it will work and will do what you expect. Unless something goes wrong.
Still, it's very likely against th... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | Yes, that should work fine.
Back in the day, Christmas lights were 6 or 12V lights in series and there were thousands of those sold each year.
A slight caveat is that typically the threaded portion of the socket is connected to neutral. The second light bulb will have voltage on the threaded part of the socket, so yo... | I feel that it is not a good idea as a standard practice. But conceptually, it would be fine to use two 120V filament type light bulbs in series on a 230V system. I have done it before, briefly, and the bulbs appeared pretty normal. So feel free to experiment. But in the long run, maybe the bulbs would not share voltag... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | I feel that it is not a good idea as a standard practice. But conceptually, it would be fine to use two 120V filament type light bulbs in series on a 230V system. I have done it before, briefly, and the bulbs appeared pretty normal. So feel free to experiment. But in the long run, maybe the bulbs would not share voltag... | Yes, it's not Code legal (because the shell of the upper bulb socket will be hot), but it will work. This depends on the bulbs being equal; if they're not, one will burn out first.
However, given the Code violation and the general difficulty, I think you're barking up the wrong tree. Fluorescent technology has gotten... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | Yes, that should work fine.
Back in the day, Christmas lights were 6 or 12V lights in series and there were thousands of those sold each year.
A slight caveat is that typically the threaded portion of the socket is connected to neutral. The second light bulb will have voltage on the threaded part of the socket, so yo... | In theory, if it's really no electronics bulbs, you can do this. The lifetime of the bulbs may be lower as they need not divide the power equally as they age, and larger power means larger wear.
In practise, yes, it will work and will do what you expect. Unless something goes wrong.
Still, it's very likely against th... |
165,259 | I'm considering to buy full spectrum incandescent bulbs in the US, to be used here in Europe. Here these types of bulbs are rare, since it's mostly LED these days.
First I thought I needed to step down the voltage, for instance with a travel converter for the US market. But someone made a side remark to switch it in s... | 2019/05/16 | [
"https://diy.stackexchange.com/questions/165259",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/-1/"
] | Yes, that should work fine.
Back in the day, Christmas lights were 6 or 12V lights in series and there were thousands of those sold each year.
A slight caveat is that typically the threaded portion of the socket is connected to neutral. The second light bulb will have voltage on the threaded part of the socket, so yo... | Yes, it's not Code legal (because the shell of the upper bulb socket will be hot), but it will work. This depends on the bulbs being equal; if they're not, one will burn out first.
However, given the Code violation and the general difficulty, I think you're barking up the wrong tree. Fluorescent technology has gotten... |
41,347,852 | In C++11, is there a DRY way to construct all elements of an array with some same set of parameters for all elements? (e.g. via a single initializer list?)
For example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
// This would construct just the first object with a parameter of 1.
/... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41347852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125997/"
] | c++14 - a little work will make this work for c++11
```
#include <iostream>
#include <array>
#include <utility>
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
namespace detail {
template<class Type, std::size_t...Is, class...Args>
auto generate_n_with(std::index_sequence<Is...>,... | You can construct a sequence of elements using an `std::index_sequence<...>` and expand that into the initializers of an array. I don't know of any approach avoiding an auxiliary function, though. Here is an example:
```
#include <iterator>
#include <algorithm>
#include <iostream>
struct S {
int value;
S(int ... |
41,347,852 | In C++11, is there a DRY way to construct all elements of an array with some same set of parameters for all elements? (e.g. via a single initializer list?)
For example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
// This would construct just the first object with a parameter of 1.
/... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41347852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125997/"
] | You can construct a sequence of elements using an `std::index_sequence<...>` and expand that into the initializers of an array. I don't know of any approach avoiding an auxiliary function, though. Here is an example:
```
#include <iterator>
#include <algorithm>
#include <iostream>
struct S {
int value;
S(int ... | Building on Richard's answer, it's also possible to define
```
template<class Type, std::size_t N, class...Args>
auto generate_n_with(const std::array<Type, N>&, const Args&...args)
{
return detail::generate_n_with<Type>(std::make_index_sequence<N>(), args...);
};
```
Allowing you to enter the array as a paramet... |
41,347,852 | In C++11, is there a DRY way to construct all elements of an array with some same set of parameters for all elements? (e.g. via a single initializer list?)
For example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
// This would construct just the first object with a parameter of 1.
/... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41347852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125997/"
] | c++14 - a little work will make this work for c++11
```
#include <iostream>
#include <array>
#include <utility>
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
namespace detail {
template<class Type, std::size_t...Is, class...Args>
auto generate_n_with(std::index_sequence<Is...>,... | By creating derived class, you can effectively create a new default value. It's a bit hackish, but may be less hackish than other solutions. Here's an example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
template <int init>
struct CInit : C { CInit() : C(init) {} };
CInit<1> ar2[3];... |
41,347,852 | In C++11, is there a DRY way to construct all elements of an array with some same set of parameters for all elements? (e.g. via a single initializer list?)
For example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
// This would construct just the first object with a parameter of 1.
/... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41347852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125997/"
] | By creating derived class, you can effectively create a new default value. It's a bit hackish, but may be less hackish than other solutions. Here's an example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
template <int init>
struct CInit : C { CInit() : C(init) {} };
CInit<1> ar2[3];... | Building on Richard's answer, it's also possible to define
```
template<class Type, std::size_t N, class...Args>
auto generate_n_with(const std::array<Type, N>&, const Args&...args)
{
return detail::generate_n_with<Type>(std::make_index_sequence<N>(), args...);
};
```
Allowing you to enter the array as a paramet... |
41,347,852 | In C++11, is there a DRY way to construct all elements of an array with some same set of parameters for all elements? (e.g. via a single initializer list?)
For example:
```
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
// This would construct just the first object with a parameter of 1.
/... | 2016/12/27 | [
"https://Stackoverflow.com/questions/41347852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125997/"
] | c++14 - a little work will make this work for c++11
```
#include <iostream>
#include <array>
#include <utility>
class C {
public:
C() : C(0) {}
C(int x) : m_x{x} {}
int m_x;
};
namespace detail {
template<class Type, std::size_t...Is, class...Args>
auto generate_n_with(std::index_sequence<Is...>,... | Building on Richard's answer, it's also possible to define
```
template<class Type, std::size_t N, class...Args>
auto generate_n_with(const std::array<Type, N>&, const Args&...args)
{
return detail::generate_n_with<Type>(std::make_index_sequence<N>(), args...);
};
```
Allowing you to enter the array as a paramet... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | Adding to the main answer, If you are stuck at
"*mysqld\_safe Starting mysqld daemon with databases from /var/lib/mysql*"
1 thing to remember that you have to use another terminal window to enter the following command.
```
$ sudo mysql --user=root mysql
```
If you try to do it in the same window, it will shut do... | Here's how to setup `mysql-server` with a **terminal password prompt** in Ubuntu 18.10.
1. Download The MySQL APT Repository via <https://dev.mysql.com/downloads/repo/apt/>
2. `cd` into your directory where you downloaded and run `dpkg -i mysql-apt-config_0.8.13-1_all.deb` (check your version number)
3. From the promp... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | You can recover or set root password without knowing the current one by starting mysql without loading the grant-tables.
Please note the **`$`** in the commands. This is specifying the terminal prompt you see when typing in the command. It's showing it's a line of text, but and actual typed terminal command. The "**`m... | 1. there is a default user account.
```
$ vim /etc/mysql/debian.cnf
```
you will get this account from it like this:
```
user = debian-sys-maint
password = nUZTARYslBsASzpw
```
2. you login with this account
```
$ mysql -u debian-sys-maint -p
```
3. edit you root password
```
mysql> show databases;
mysql>... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | It will not ask for the password while installing `mysql` in Ubuntu 16.04 but you can set it after successful installation in following way:
After completion of mysql installation, run command:
```
sudo mysql_secure_installation
```
It will show:
>
> NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL M... | After the installation just:
1. `sudo mysql`
(yes, no user no pass)
2. You are now in the mysql console.
Execute:
`ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my_new_pass';`
3. `FLUSH PRIVILEGES;`
That's it. You can now enter the console next time as usual:
```
mysql -u root -pmy_new_pas... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | You can recover or set root password without knowing the current one by starting mysql without loading the grant-tables.
Please note the **`$`** in the commands. This is specifying the terminal prompt you see when typing in the command. It's showing it's a line of text, but and actual typed terminal command. The "**`m... | Apparently the mysql-server installation on 16.04 (or any 5.7 installation?) allows root access not through password, but through the [auth\_socket](http://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html) plugin. Running `sudo mysql -u root` (n.b. w/o a password) will give you mysql console whereas ru... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | You can recover or set root password without knowing the current one by starting mysql without loading the grant-tables.
Please note the **`$`** in the commands. This is specifying the terminal prompt you see when typing in the command. It's showing it's a line of text, but and actual typed terminal command. The "**`m... | After the installation just:
1. `sudo mysql`
(yes, no user no pass)
2. You are now in the mysql console.
Execute:
`ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my_new_pass';`
3. `FLUSH PRIVILEGES;`
That's it. You can now enter the console next time as usual:
```
mysql -u root -pmy_new_pas... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | It will not ask for the password while installing `mysql` in Ubuntu 16.04 but you can set it after successful installation in following way:
After completion of mysql installation, run command:
```
sudo mysql_secure_installation
```
It will show:
>
> NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL M... | Adding to the main answer, If you are stuck at
"*mysqld\_safe Starting mysqld daemon with databases from /var/lib/mysql*"
1 thing to remember that you have to use another terminal window to enter the following command.
```
$ sudo mysql --user=root mysql
```
If you try to do it in the same window, it will shut do... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | It will not ask for the password while installing `mysql` in Ubuntu 16.04 but you can set it after successful installation in following way:
After completion of mysql installation, run command:
```
sudo mysql_secure_installation
```
It will show:
>
> NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL M... | Apparently the mysql-server installation on 16.04 (or any 5.7 installation?) allows root access not through password, but through the [auth\_socket](http://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html) plugin. Running `sudo mysql -u root` (n.b. w/o a password) will give you mysql console whereas ru... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | 1. there is a default user account.
```
$ vim /etc/mysql/debian.cnf
```
you will get this account from it like this:
```
user = debian-sys-maint
password = nUZTARYslBsASzpw
```
2. you login with this account
```
$ mysql -u debian-sys-maint -p
```
3. edit you root password
```
mysql> show databases;
mysql>... | Adding to the main answer, If you are stuck at
"*mysqld\_safe Starting mysqld daemon with databases from /var/lib/mysql*"
1 thing to remember that you have to use another terminal window to enter the following command.
```
$ sudo mysql --user=root mysql
```
If you try to do it in the same window, it will shut do... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | 1. there is a default user account.
```
$ vim /etc/mysql/debian.cnf
```
you will get this account from it like this:
```
user = debian-sys-maint
password = nUZTARYslBsASzpw
```
2. you login with this account
```
$ mysql -u debian-sys-maint -p
```
3. edit you root password
```
mysql> show databases;
mysql>... | Here's how to setup `mysql-server` with a **terminal password prompt** in Ubuntu 18.10.
1. Download The MySQL APT Repository via <https://dev.mysql.com/downloads/repo/apt/>
2. `cd` into your directory where you downloaded and run `dpkg -i mysql-apt-config_0.8.13-1_all.deb` (check your version number)
3. From the promp... |
766,928 | I've used an old Acer Travelmate 4000 laptop as my local server for ages with Ubuntu Desktop.
This year, I installed 16.04 i386 Server Edition and couldn't be happier. The entire working set of Linux, network stack and apache2 uses only 37MB of the 2GB onboard... No Swap For You!
Trouble is, issuing a reboot (or shut... | 2016/05/03 | [
"https://askubuntu.com/questions/766928",
"https://askubuntu.com",
"https://askubuntu.com/users/476635/"
] | Apparently the mysql-server installation on 16.04 (or any 5.7 installation?) allows root access not through password, but through the [auth\_socket](http://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html) plugin. Running `sudo mysql -u root` (n.b. w/o a password) will give you mysql console whereas ru... | Adding to the main answer, If you are stuck at
"*mysqld\_safe Starting mysqld daemon with databases from /var/lib/mysql*"
1 thing to remember that you have to use another terminal window to enter the following command.
```
$ sudo mysql --user=root mysql
```
If you try to do it in the same window, it will shut do... |
42,623,379 | I'm trying to put images(appr. 100+) into UIImageView within UICollectionViewCell. Since that's quite amount, I tried to make a plist file that contains names of the file and retrieve names from it.
itemCollectionViewController
```
//
// itemCollectionViewController.swift
// phdrink
//
// Created by Canor on 2017.... | 2017/03/06 | [
"https://Stackoverflow.com/questions/42623379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6058845/"
] | I suggest reading the documentation of UICollectionView first. It seems you don't understand how it is supposed to work.
In short, you can only assign one UIImage to an UIImageView. But in method `setGameDataIcon` you try to assign all images to one image view in a loop.
You could add a parameter to `setGameDataIcon`... | getting UIImageView to nil, indicates you might have not created an outlet of UIImageView in XiB.
Or you've to assign property as below.
```
@IBOutlet weak var gameIcon: UIImageView = UIImageView()
```
assign frame to UIImageView according to your requirement!
add gameIcon UIImageView instance to your cell co... |
42,623,379 | I'm trying to put images(appr. 100+) into UIImageView within UICollectionViewCell. Since that's quite amount, I tried to make a plist file that contains names of the file and retrieve names from it.
itemCollectionViewController
```
//
// itemCollectionViewController.swift
// phdrink
//
// Created by Canor on 2017.... | 2017/03/06 | [
"https://Stackoverflow.com/questions/42623379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6058845/"
] | You should not register cell if it is in uicollectionview . **remove** `self.collectionView!.register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)` | getting UIImageView to nil, indicates you might have not created an outlet of UIImageView in XiB.
Or you've to assign property as below.
```
@IBOutlet weak var gameIcon: UIImageView = UIImageView()
```
assign frame to UIImageView according to your requirement!
add gameIcon UIImageView instance to your cell co... |
37,589,491 | Result column should increment by 1 when you change a group of empID, DepID. Also the result column should get reset if the days between someDT of 2 consecutive rows is greater than 5 days.
```
CREATE TABLE tab
( "empid" NUMBER(5,0),
"depid" NUMBER(7,0),
"somedt" DATE
);
Insert into TAB (EMPID,DEPID,SOMEDT) valu... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37589491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6414182/"
] | ```
var listDoctors: [String] = []
func autoCompleteTextField(textField: MLPAutoCompleteTextField!, possibleCompletionsForString string: String!, completionHandler handler: ([AnyObject]!) -> ()) {
let appDelegate: AppDelegate = (UIApplication.sharedApplication().delegate as! AppDelegate)
var r... | You should create String array.
```
//Array with dummy names
var nameArray = ["Red","Raain","Rozi","Rozina","Rozinava", "Roy","Roy son","Rediss","Raj","Blue", "Yellow"]
//Get name from the Doctor object
var name = doctor.firstname
name = ((name ?? "").isEmpty ? "" : name!)//if string is empty retu... |
37,589,491 | Result column should increment by 1 when you change a group of empID, DepID. Also the result column should get reset if the days between someDT of 2 consecutive rows is greater than 5 days.
```
CREATE TABLE tab
( "empid" NUMBER(5,0),
"depid" NUMBER(7,0),
"somedt" DATE
);
Insert into TAB (EMPID,DEPID,SOMEDT) valu... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37589491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6414182/"
] | ```
var listDoctors: [String] = []
func autoCompleteTextField(textField: MLPAutoCompleteTextField!, possibleCompletionsForString string: String!, completionHandler handler: ([AnyObject]!) -> ()) {
let appDelegate: AppDelegate = (UIApplication.sharedApplication().delegate as! AppDelegate)
var r... | I correct my code now I add lastname arry listDoctors should be return name and lastname
```
var listDoctors: [String] = []
func autoCompleteTextField(textField: MLPAutoCompleteTextField!, possibleCompletionsForString string: String!, completionHandler handler: ([AnyObject]!) -> ()) {
let appDelegate:... |
71,103,401 | I was following a tutorial and my localhost is completely blank after importing {Link} from react-router-dom. Followed word for word but my local host is blank as soon as I added link in navbar.js.
```
import React from 'react';
import {Link} from 'react-router-dom';
function Navbar() {
return(
<nav class... | 2022/02/13 | [
"https://Stackoverflow.com/questions/71103401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15317259/"
] | Here's how you could do that (inspired by [this](https://github.com/encode/starlette/issues/874#issuecomment-1027743996)). Make sure to check the `Content-Type` of the response (as shown below), so that you can modify it by adding the `metadata`, only if it is of `application/json` type.
For the OpenAPI (Swagger UI) t... | You are substituting the body of the swagger html with json data taken from both middleware and response (html response in this case).
You'll end up with something like
```
{
"data": "<html>....</html>",
"metadata": {
"some_data_key_1": "some_data_value_1",
"some_data_key_2": "some_data_value_... |
69,197,325 | I have a data frame like this:
```
name number
A 287
B 1390
C 1595
D 369
```
I want to get a numeric data matrix like this:
```
287 369
1390 1595
```
with this sequence:
```
A D
B C
```
which means that A and B are on the left column and D and C are on the right column... | 2021/09/15 | [
"https://Stackoverflow.com/questions/69197325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16793219/"
] | We can `sort` the 'number' column and create the matrix with `matrix`
```
matrix(sort(df1$number), 2, 2,byrow = TRUE)
```
-output
```
[,1] [,2]
[1,] 287 369
[2,] 1390 1595
```
---
Or if it needs to be based on the 'name' column
```
library(dplyr)
library(tidyr)
library(data.table)
df1 %>%
mutate(grp ... | The following is also an option.
```
library(dplyr)
df %>%
filter(name %in% c('A', 'B')) %>%
bind_cols(filter(df, name %in% c('C', 'D'))) %>%
select(where(~is.integer(.))) %>%
as.matrix() %>%
unname()
# [,1] [,2]
# [1,] 287 1595
# [2,] 1390 369
```
Data
```
df <- structure(list(name = c("A", "B"... |
380,572 | Apologies for the simplicity of this question. I don't have the data at hand to tackle it. It's been bugging me since I thought of it.
If all the matter in the universe was packed into a ball with the density of a neutron star how large would it be, what would be its radius?
Obviously, there is two types of matter. ... | 2018/01/17 | [
"https://physics.stackexchange.com/questions/380572",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/7993/"
] | The energy density of the universe is $\sim 10^{-26}$ kg/m$^{3}$. Visible matter constitutes something of the order of a percent of this energy density. The energy density of a neutron star is $\sim 10^{17}$ kg/m$^{3}$. Therefore a neutron star is $\sim 10^{45}$ times denser than the visible matter. Compressing the sph... | Given that there are $N = 10^{80}$ baryons in the observable universe, and the nucleon radius is $R\_p=0.8\,{\mathrm{fm}}$, go with:
$$ R\_{all} \approx N^{\frac{1}{3}}R\_p = 2.5\ AU,$$
which is reasonably close to @Philo. |
6,832,374 | In a web application, I need the SessionID for some reason, so, I save it in the database. the application does two redirects before it starts, and I found that it acquires two SessionIDs. The second one remains.
Why this behavior ? Any idea? How can I prevent that to save in the DB one record.
Sorry because I can't... | 2011/07/26 | [
"https://Stackoverflow.com/questions/6832374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838774/"
] | There's a million possible reasons for losing / re-starting your session. Without your code, its difficult to offer advice.
One thing you can try on your own is to use the Session\_End event in your global.asax file, as long as you're using inProc session. Put some code in there to have it tell you when the session en... | Another possibility is that you might not be putting anything into your first session. By default, you'll get a new sessionID on each postback ***unless*** you put something in the session. |
16,086,769 | I have this code block I find particularly long and hard to udnerstood : the call stack is full of implicit functions and paramters implicitely added to it. in other words, i would like to clarify my code by separating the function called in the each from the each itself.
Look that example :
```
$(xml).find('group')... | 2013/04/18 | [
"https://Stackoverflow.com/questions/16086769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15619/"
] | Try passing function reference
**[Live Demo](http://jsfiddle.net/rajaadil/rDrAJ/)**
```
$(xml).find('group').each(myfun);
function myfun(i, item)
{
alert(item.id);
}
``` | You could also just do:
```
$(xml).find('group').each(function(){
yourFunction();
});
``` |
239,189 | I'm working on a set of automated tests that we use internally at work. Lately, we've been designing classes that implement interfaces in addition to inheritance.
As I understand it, interfaces in Java are used to fulfill a contract. A class that implements an interface must include implementations of any members of ... | 2014/05/15 | [
"https://softwareengineering.stackexchange.com/questions/239189",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/36853/"
] | Let's clarify a few things.
First, the primary purpose of an interface is to *allow multiple implementations.* If there's only one implementation, you don't need an interface; the class already defines its own public API. Some unit testing scenarios require interfaces, because *a mock is an alternate implementation.*
... | The main point of an interface is not to hide things so that evil contract programmers cannot exploit things they haven't paid for. It's to *simplify the conceptual task* of dealing with a module.
Knowing only the minimum about a class that is necessary for using its services is **good**. If the class exposed more de... |
58,253,306 | I have a database of medicare data with three tables: provider metadata (doctor's unique number, name, city, state, credentials, etc); hcpcs metadata (code, description, if it's for drugs or not); provider\_services (doctor's unique number, hcpcs code, number of services completed by that doctor, average cost)
I'm *tr... | 2019/10/06 | [
"https://Stackoverflow.com/questions/58253306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11718613/"
] | You can create a slide, add a shape and add a link to it using the following code:
```js
var presentationId = "<YOUR_PRESENTATION_ID>";
var newSlideId = Utilities.getUuid();
var newElementId = Utilities.getUuid();
var pt350 = {
magnitude: 350,
unit: 'PT'
};
var requests = [
{
createSlide... | Yes, it's possible. Checkout [Extending Google Slides](https://developers.google.com/apps-script/guides/slides) and [shape.setLinkUrl(url)](https://developers.google.com/apps-script/reference/slides/shape#setlinkurlurl) |
80,473 | How do I run a shell command from `.tmux.conf`, or otherwise automatically when tmux launches, without having to hit any other command?
How can I create an alias, a function, or a script which boils down to, for example
tmuxirc -> tmux + irssi | 2013/06/24 | [
"https://unix.stackexchange.com/questions/80473",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/13136/"
] | It sounds like you want to externally invoke tmux from your shell rather than doing this from within tmux, so `.tmux.conf` is the wrong place. You can use a shell alias (place this in your `.bashrc` for reuse):
```
alias tmuxirc='tmux new-session -s irc irssi'
``` | I do something similar with a script. When I want to fire up tmux with my development configuration I call it. The script itself looks like the following:
```
#!/bin/sh
tmux has-session -t development
if [ $? != 0 ]; then
tmux new-session -s development -n editor -d
tmux send-keys -t development 'cd /var/www/h... |
80,473 | How do I run a shell command from `.tmux.conf`, or otherwise automatically when tmux launches, without having to hit any other command?
How can I create an alias, a function, or a script which boils down to, for example
tmuxirc -> tmux + irssi | 2013/06/24 | [
"https://unix.stackexchange.com/questions/80473",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/13136/"
] | It sounds like you want to externally invoke tmux from your shell rather than doing this from within tmux, so `.tmux.conf` is the wrong place. You can use a shell alias (place this in your `.bashrc` for reuse):
```
alias tmuxirc='tmux new-session -s irc irssi'
``` | While it doesn't seem to be what you were looking for, the solution to:
>
> How do I run a shell command from .tmux.conf
>
>
>
is `run-shell`, or, in its abbreviated form, `run`. From the `tmux` man page:
>
>
> ```
> run-shell shell-command
> (alias: run)
> Execute shell-command in the ... |
80,473 | How do I run a shell command from `.tmux.conf`, or otherwise automatically when tmux launches, without having to hit any other command?
How can I create an alias, a function, or a script which boils down to, for example
tmuxirc -> tmux + irssi | 2013/06/24 | [
"https://unix.stackexchange.com/questions/80473",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/13136/"
] | It sounds like you want to externally invoke tmux from your shell rather than doing this from within tmux, so `.tmux.conf` is the wrong place. You can use a shell alias (place this in your `.bashrc` for reuse):
```
alias tmuxirc='tmux new-session -s irc irssi'
``` | There's a `display-message` command in `tmux`, from its man page:
>
>
> >
> > display-message [-p] [-c target-client] [-t target-pane] [message]
> >
> >
> > (alias: display)
> >
> >
> > Display a message. If -p is given, the output is printed to stdout, otherwise it is displayed in the target-client status line... |
80,473 | How do I run a shell command from `.tmux.conf`, or otherwise automatically when tmux launches, without having to hit any other command?
How can I create an alias, a function, or a script which boils down to, for example
tmuxirc -> tmux + irssi | 2013/06/24 | [
"https://unix.stackexchange.com/questions/80473",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/13136/"
] | While it doesn't seem to be what you were looking for, the solution to:
>
> How do I run a shell command from .tmux.conf
>
>
>
is `run-shell`, or, in its abbreviated form, `run`. From the `tmux` man page:
>
>
> ```
> run-shell shell-command
> (alias: run)
> Execute shell-command in the ... | I do something similar with a script. When I want to fire up tmux with my development configuration I call it. The script itself looks like the following:
```
#!/bin/sh
tmux has-session -t development
if [ $? != 0 ]; then
tmux new-session -s development -n editor -d
tmux send-keys -t development 'cd /var/www/h... |
80,473 | How do I run a shell command from `.tmux.conf`, or otherwise automatically when tmux launches, without having to hit any other command?
How can I create an alias, a function, or a script which boils down to, for example
tmuxirc -> tmux + irssi | 2013/06/24 | [
"https://unix.stackexchange.com/questions/80473",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/13136/"
] | I do something similar with a script. When I want to fire up tmux with my development configuration I call it. The script itself looks like the following:
```
#!/bin/sh
tmux has-session -t development
if [ $? != 0 ]; then
tmux new-session -s development -n editor -d
tmux send-keys -t development 'cd /var/www/h... | There's a `display-message` command in `tmux`, from its man page:
>
>
> >
> > display-message [-p] [-c target-client] [-t target-pane] [message]
> >
> >
> > (alias: display)
> >
> >
> > Display a message. If -p is given, the output is printed to stdout, otherwise it is displayed in the target-client status line... |
80,473 | How do I run a shell command from `.tmux.conf`, or otherwise automatically when tmux launches, without having to hit any other command?
How can I create an alias, a function, or a script which boils down to, for example
tmuxirc -> tmux + irssi | 2013/06/24 | [
"https://unix.stackexchange.com/questions/80473",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/13136/"
] | While it doesn't seem to be what you were looking for, the solution to:
>
> How do I run a shell command from .tmux.conf
>
>
>
is `run-shell`, or, in its abbreviated form, `run`. From the `tmux` man page:
>
>
> ```
> run-shell shell-command
> (alias: run)
> Execute shell-command in the ... | There's a `display-message` command in `tmux`, from its man page:
>
>
> >
> > display-message [-p] [-c target-client] [-t target-pane] [message]
> >
> >
> > (alias: display)
> >
> >
> > Display a message. If -p is given, the output is printed to stdout, otherwise it is displayed in the target-client status line... |
52,094,268 | I need to repeat `local notification` at specific time and specific days like 10:30 AM at sunday and Friday or selected week days (mon and sat).
```
switch repeatDays {
case .never:
dateComponents = Calendar.current.dateComponents([.hour, .minute], from: date)
flag = false
case .everyDay:
... | 2018/08/30 | [
"https://Stackoverflow.com/questions/52094268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9331686/"
] | Actually "Firebase rules are not filters", see <https://firebase.google.com/docs/database/security/securing-data#rules_are_not_filters>
It means that, to fetch this data, you have to use a query that is "aligned" with your security rules.
Like the following in JavaScript, see <https://firebase.google.com/docs/databas... | Try that:
```
{
"rules": {
"books": {
".read": "data.child('owner').val() === auth.uid",
".write": "auth != null"
}
}
}
``` |
52,094,268 | I need to repeat `local notification` at specific time and specific days like 10:30 AM at sunday and Friday or selected week days (mon and sat).
```
switch repeatDays {
case .never:
dateComponents = Calendar.current.dateComponents([.hour, .minute], from: date)
flag = false
case .everyDay:
... | 2018/08/30 | [
"https://Stackoverflow.com/questions/52094268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9331686/"
] | According to @AndréKool suggestion, this is how I solved this question:
In order to filter the response items, I used [query based security rule](https://firebase.google.com/docs/database/security/securing-data#query-based_rules):
```
{
"rules": {
"books": {
".read": "query.orderByChild == 'owner'... | Try that:
```
{
"rules": {
"books": {
".read": "data.child('owner').val() === auth.uid",
".write": "auth != null"
}
}
}
``` |
52,094,268 | I need to repeat `local notification` at specific time and specific days like 10:30 AM at sunday and Friday or selected week days (mon and sat).
```
switch repeatDays {
case .never:
dateComponents = Calendar.current.dateComponents([.hour, .minute], from: date)
flag = false
case .everyDay:
... | 2018/08/30 | [
"https://Stackoverflow.com/questions/52094268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9331686/"
] | Actually "Firebase rules are not filters", see <https://firebase.google.com/docs/database/security/securing-data#rules_are_not_filters>
It means that, to fetch this data, you have to use a query that is "aligned" with your security rules.
Like the following in JavaScript, see <https://firebase.google.com/docs/databas... | According to @AndréKool suggestion, this is how I solved this question:
In order to filter the response items, I used [query based security rule](https://firebase.google.com/docs/database/security/securing-data#query-based_rules):
```
{
"rules": {
"books": {
".read": "query.orderByChild == 'owner'... |
773,440 | Show that if the sequence ${a\_n}$ is bounded then the power series $\sum a\_nx^n$ converges absolutely for $|x|<1$.
I haven't the slightest idea how to prove this. Does anyone have any thoughts on this? | 2014/04/28 | [
"https://math.stackexchange.com/questions/773440",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105657/"
] | Suppose the $a\_n$ are uniformly bounded in absolute value by $M$. Then
$$\sum |a\_n x^n| = \sum |a\_n| |x|^n \le \sum M|x|^n = \frac{M}{1-x}$$
when $|x|<1$. | **Hint:** for all $N \geq 0$
$$
0 \leq \sum\_{n=0}^N \lvert a\_n x^n\rvert = \sum\_{n=0}^N \lvert a\_n\rvert \lvert x\rvert^n \leq \sum\_{n=0}^N \lVert a\rVert\_\infty \lvert x\rvert^n = \lVert a\rVert\_\infty\sum\_{n=0}^N \lvert x\rvert^n
$$
and conclude using the radius of convergence of the series $\sum \lvert x\rve... |
272,273 | The correct usage of the pilcrow sign "¶" (as I understand) is to begin a paragraph, or to indicate a paragraph on a page that is not laid out with ordinary paragraph line-breaks.
I'm writing a technical report and it happens that a page break coincides with a new paragraph, opening with a word that cannot be capitali... | 2015/09/05 | [
"https://english.stackexchange.com/questions/272273",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4385/"
] | The consensus seems to be that opening a paragraph with "¶" is archaic, or at best limited to niches like books of statutes (laws).
It's better to find some alternative — anything. | Short answer: maybe.
If you are concerned about comprehensibility, you could use the pilcrow sign as one of the endnote symbols. And, in the body text, use the pilcrow sign only to emphasize a paragraph break. One convention for [footnote symbols](https://duckduckgo.com/?t=ffab&q=footnote+symbols&ia=web) is: asterisk,... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Assuming you just want the usual non-pooled t confidence interval for each group you can do
```
require(dplyr)
alpha <- 0.05
data %>%
group_by(Group, Time) %>%
summarize(mean = mean(mean_PctPasses),
lower = mean(mean_PctPasses) - qt(1- alpha/2, (n() - 1))*sd(mean_PctPasses)/sqrt(n()),
... | You may be interested to reproduce the SPSS style with base R graphics.
```
library(DescTools)
z <- with(data,
aggregate(mean_PctPasses, list(Time, Group), MeanCI))
z <- xtabs(x ~ Group.1 + Group.2, z)
par(mar=c(5.1,4.1,4.1,8.1))
b <- barplot(z[,,1], beside=TRUE, ylim=c(0, 140),
col=c("royal... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Assuming you just want the usual non-pooled t confidence interval for each group you can do
```
require(dplyr)
alpha <- 0.05
data %>%
group_by(Group, Time) %>%
summarize(mean = mean(mean_PctPasses),
lower = mean(mean_PctPasses) - qt(1- alpha/2, (n() - 1))*sd(mean_PctPasses)/sqrt(n()),
... | Update tidyr 1.0.0
------------------
As an elegant alternative to the `summarise` solutions given before, it is good to know that the new [tidyr 1.0.0](https://www.tidyverse.org/blog/2019/09/tidyr-1-0-0/) contained a function often overlooked: `unnest_wider`.
With that, you can simplify the code to the following:
``... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Assuming you just want the usual non-pooled t confidence interval for each group you can do
```
require(dplyr)
alpha <- 0.05
data %>%
group_by(Group, Time) %>%
summarize(mean = mean(mean_PctPasses),
lower = mean(mean_PctPasses) - qt(1- alpha/2, (n() - 1))*sd(mean_PctPasses)/sqrt(n()),
... | Maybe it is easier to work on one variable at a time. There is a simpler way of doing this.
You need to install/load the Hmisc package using library()
```
my_data <- data %>%
group_by(Group, Time) %>%
summarise(N = n(), ci = list(enframe(Hmisc::smean.cl.normal(mean_PctPasses)))) %>%
unnest() %>%
sp... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Doing this with `R` is easy, too.
Another way, using `CI()` from `Rmisc`:
```
library(dplyr)
library(Rmisc)
library(ggplot2)
data <-
data %>%
group_by(Group, Time) %>%
dplyr::summarise(avg_PctPasses = mean(mean_PctPasses),
uci_PctPasses = CI(mean_PctPasses)[1],
lci_PctPasses = CI(me... | You may be interested to reproduce the SPSS style with base R graphics.
```
library(DescTools)
z <- with(data,
aggregate(mean_PctPasses, list(Time, Group), MeanCI))
z <- xtabs(x ~ Group.1 + Group.2, z)
par(mar=c(5.1,4.1,4.1,8.1))
b <- barplot(z[,,1], beside=TRUE, ylim=c(0, 140),
col=c("royal... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Doing this with `R` is easy, too.
Another way, using `CI()` from `Rmisc`:
```
library(dplyr)
library(Rmisc)
library(ggplot2)
data <-
data %>%
group_by(Group, Time) %>%
dplyr::summarise(avg_PctPasses = mean(mean_PctPasses),
uci_PctPasses = CI(mean_PctPasses)[1],
lci_PctPasses = CI(me... | Update tidyr 1.0.0
------------------
As an elegant alternative to the `summarise` solutions given before, it is good to know that the new [tidyr 1.0.0](https://www.tidyverse.org/blog/2019/09/tidyr-1-0-0/) contained a function often overlooked: `unnest_wider`.
With that, you can simplify the code to the following:
``... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Doing this with `R` is easy, too.
Another way, using `CI()` from `Rmisc`:
```
library(dplyr)
library(Rmisc)
library(ggplot2)
data <-
data %>%
group_by(Group, Time) %>%
dplyr::summarise(avg_PctPasses = mean(mean_PctPasses),
uci_PctPasses = CI(mean_PctPasses)[1],
lci_PctPasses = CI(me... | Maybe it is easier to work on one variable at a time. There is a simpler way of doing this.
You need to install/load the Hmisc package using library()
```
my_data <- data %>%
group_by(Group, Time) %>%
summarise(N = n(), ci = list(enframe(Hmisc::smean.cl.normal(mean_PctPasses)))) %>%
unnest() %>%
sp... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | You may be interested to reproduce the SPSS style with base R graphics.
```
library(DescTools)
z <- with(data,
aggregate(mean_PctPasses, list(Time, Group), MeanCI))
z <- xtabs(x ~ Group.1 + Group.2, z)
par(mar=c(5.1,4.1,4.1,8.1))
b <- barplot(z[,,1], beside=TRUE, ylim=c(0, 140),
col=c("royal... | Update tidyr 1.0.0
------------------
As an elegant alternative to the `summarise` solutions given before, it is good to know that the new [tidyr 1.0.0](https://www.tidyverse.org/blog/2019/09/tidyr-1-0-0/) contained a function often overlooked: `unnest_wider`.
With that, you can simplify the code to the following:
``... |
48,627,411 | ```
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
$x = (1==1 || 2==2);
$y = (3==3 || 4==4);
$z = (5==5);
foreach ($letters as $key => $letter) {
switch ($letter) {
case 'a':
echo "a";
break;
case 'b':
echo "b";
... | 2018/02/05 | [
"https://Stackoverflow.com/questions/48627411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9113120/"
] | Maybe it is easier to work on one variable at a time. There is a simpler way of doing this.
You need to install/load the Hmisc package using library()
```
my_data <- data %>%
group_by(Group, Time) %>%
summarise(N = n(), ci = list(enframe(Hmisc::smean.cl.normal(mean_PctPasses)))) %>%
unnest() %>%
sp... | Update tidyr 1.0.0
------------------
As an elegant alternative to the `summarise` solutions given before, it is good to know that the new [tidyr 1.0.0](https://www.tidyverse.org/blog/2019/09/tidyr-1-0-0/) contained a function often overlooked: `unnest_wider`.
With that, you can simplify the code to the following:
``... |
9,600 | When reading "[Ηow can I keep my jeans' zippers from unzipping on their own?](https://lifehacks.stackexchange.com/q/123/4490)", I remembered having a pair of jeans with buttons or rivets instead of a zipper, and that these always came undone. And fixing that, is kind of uncomfortable.
So, how can I keep the rivet fly ... | 2015/10/11 | [
"https://lifehacks.stackexchange.com/questions/9600",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/4490/"
] | I don't know if this qualifies as a hack, but just do the math:
* You need to have two ends to tie together of a somewhat appropriate length, estimated at 4 times the distance between the eyelet columns, or find a given constant you are satisified with
* The laces needs cross over at the bottom and top of the eyelets,... | Buy a 100-foot length of [**paracord**](https://en.wikipedia.org/wiki/Parachute_cord) and use that instead of laces. They are the ultimate shoelace, and might be the last you need without breaking again!
Cut to length, and form the aglet by melting the plastic with a lighter and rolling it with a wet thumb-and-finger.... |
4,174,030 | What is a good bit-twiddling routine to convert a number in the range [2^N,2^(N-1)-1] to N?
Some examples:
* f(1) -> 0
* f([2-3]) -> 1
* f([4-7]) -> 2
* f([8-15]) -> 3
Here is one implementation:
```
uint f(uint num)
{
for (uint shifts = 0; num; shifts++)
num >>= 1;
return (shifts - 1);
}
``` | 2010/11/13 | [
"https://Stackoverflow.com/questions/4174030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506538/"
] | Depending on how wide your data-type is, and how much memory you have available, a lookup-table is one possibility. It's almost certainly the fastest approach.
For other approaches, see <http://www-graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious>, and the subsequent sections. | Take a look at hacks for computing base 2 logarithm (or leading zero count, they are the same) on this page: <http://www-graphics.stanford.edu/~seander/bithacks.html>
You could also find useful the function `__builtin_clz` (or `_BitScanReverse` for VS) for x86. |
4,174,030 | What is a good bit-twiddling routine to convert a number in the range [2^N,2^(N-1)-1] to N?
Some examples:
* f(1) -> 0
* f([2-3]) -> 1
* f([4-7]) -> 2
* f([8-15]) -> 3
Here is one implementation:
```
uint f(uint num)
{
for (uint shifts = 0; num; shifts++)
num >>= 1;
return (shifts - 1);
}
``` | 2010/11/13 | [
"https://Stackoverflow.com/questions/4174030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506538/"
] | Depending on how wide your data-type is, and how much memory you have available, a lookup-table is one possibility. It's almost certainly the fastest approach.
For other approaches, see <http://www-graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious>, and the subsequent sections. | As most general approach, binary search may help. For values 0..31 it need only 5 stages.
```
y = 0;
if(x >= 0x10000<<y) y += 0x10;
if(x >= 0x100<<y) y += 0x08;
if(x >= 0x10<<y) y += 0x04;
if(x >= 0x4<<y) y += 0x02;
if(x >= 0x2<<y) y += 0x01;
``` |
4,174,030 | What is a good bit-twiddling routine to convert a number in the range [2^N,2^(N-1)-1] to N?
Some examples:
* f(1) -> 0
* f([2-3]) -> 1
* f([4-7]) -> 2
* f([8-15]) -> 3
Here is one implementation:
```
uint f(uint num)
{
for (uint shifts = 0; num; shifts++)
num >>= 1;
return (shifts - 1);
}
``` | 2010/11/13 | [
"https://Stackoverflow.com/questions/4174030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506538/"
] | As most general approach, binary search may help. For values 0..31 it need only 5 stages.
```
y = 0;
if(x >= 0x10000<<y) y += 0x10;
if(x >= 0x100<<y) y += 0x08;
if(x >= 0x10<<y) y += 0x04;
if(x >= 0x4<<y) y += 0x02;
if(x >= 0x2<<y) y += 0x01;
``` | Take a look at hacks for computing base 2 logarithm (or leading zero count, they are the same) on this page: <http://www-graphics.stanford.edu/~seander/bithacks.html>
You could also find useful the function `__builtin_clz` (or `_BitScanReverse` for VS) for x86. |
489,278 | I have noticed an interesting thing in double sequence $z\_{mn}$ and I can't see why such thing happens.
*Definition:* Double sequence $z\_{mn}$ is a mapping from $\mathbb{N}\times\mathbb{N}\rightarrow \mathbb{R}$
*Definition:* We say that a double sequence $\lim\_{m,n\to\infty}z\_{mn}=l$ where $l$ is finite if $\for... | 2013/09/10 | [
"https://math.stackexchange.com/questions/489278",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/91129/"
] | **Caveat:** The text of the question now underwent so many nontrivial modifications, *after* complete answers were posted, that answers addressing previous versions, such as the one below, run the risk of being offtopic with respect to the last version. This kind of situation is so obviously dysfunctional that one coul... | Better answers have probably been given above. Here is a layman's approach:
First theorem is wrong due to the assumption that $\{z\_{m,n} |\max(m,n) > N\} \subset \{z\_{m,n} | \sqrt{m^2+n^2} > N\}$ Because $\sqrt{m^2+n^2} > N$ does not imply that the highest of them is $> N$, but the other way around (however $\min(m,... |
54,884,748 | I am trying to write a data frame containing installed packages to a tab separated file using write.table:
```
ip <- as.data.frame(installed.packages())
rownames(ip) <- NULL
write.table(ip,file="installed_packages.tsv",quote = F,sep = "\t",row.names = F)
```
Unfortunately this seems to result in a file where commas... | 2019/02/26 | [
"https://Stackoverflow.com/questions/54884748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11118980/"
] | You are assigning an `AnonymousUser` object to the attribute `user` of an `ObjectViewed` instance. From the naming, my guess is that this happens in the `ObjectViewedMixin`.
For a more definite answer, you have to post the full stack trace and the relevant code. | This is because of you are accessing this view with out login (So it shows `AnonymousUser`) so you need to add `LoginRequiredMixin` to your class as below to ensure that only logged in users can visit this view.
```
from django.contrib.auth.mixins import LoginRequiredMixin
class ProductDetailSlugview(LoginRequiredMix... |
10,473,794 | I use a custom font for my application. The code is really simple to integrate it :
```
Typeface tf = Typeface.createFromAsset(getApplicationContext().getAssets(),
"fonts/PermanentMarker.ttf");
textview.setTypeface(tf);
```
However I have artifacts with some of my TextViews : <http://desmond.imagesha... | 2012/05/06 | [
"https://Stackoverflow.com/questions/10473794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326173/"
] | The error is coming from hardware acceleration. When forcing the TextView to use software rending, everything become fine. | I had the same issue, and made sure that it's not related to API level 21 view elevations, as it also appears below API-21.
For me a single artifact appears near the end/right edge of the `TextView` without intersecting with the text itself.
**I didn't came up with a root solution, but I had a work around:** I laid a... |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | ```
$("span").each(function(){
var thisId = $(this).attr('id');
// Do whatever you want with the Id, and go on to the next one.
});
```
:) | ```
$('span').each(function(){
alert($(this).attr('id'));
});
``` |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | ```
$("span").each(function(){
var thisId = $(this).attr('id');
// Do whatever you want with the Id, and go on to the next one.
});
```
:) | ```
$('span');
```
Will find all spans.
```
$('span').filter(function() {
return (/^q\_\d+$/i).test($(this).attr('id'));
});
```
Or only spans who's id matches the format |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | ```
$("span").each(function(){
var thisId = $(this).attr('id');
// Do whatever you want with the Id, and go on to the next one.
});
```
:) | to get an array if ids:
```
var a = $.map($('span'), function(s){ return s.id; });
``` |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | ```
$('span').each(function(){
alert($(this).attr('id'));
});
``` | ```
$('span');
```
Will find all spans.
```
$('span').filter(function() {
return (/^q\_\d+$/i).test($(this).attr('id'));
});
```
Or only spans who's id matches the format |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | I have a feeling you're actually asking how to select all elements that have an id that starts with "q\_". If so, the simplest way to do so is like this:
```
var qSpans = $('span[id^="q_"]');
```
[See example →](http://jsfiddle.net/u4MnZ/) | ```
$('span').each(function(){
alert($(this).attr('id'));
});
``` |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | I have a feeling you're actually asking how to select all elements that have an id that starts with "q\_". If so, the simplest way to do so is like this:
```
var qSpans = $('span[id^="q_"]');
```
[See example →](http://jsfiddle.net/u4MnZ/) | ```
$('span');
```
Will find all spans.
```
$('span').filter(function() {
return (/^q\_\d+$/i).test($(this).attr('id'));
});
```
Or only spans who's id matches the format |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | to get an array if ids:
```
var a = $.map($('span'), function(s){ return s.id; });
``` | ```
$('span');
```
Will find all spans.
```
$('span').filter(function() {
return (/^q\_\d+$/i).test($(this).attr('id'));
});
```
Or only spans who's id matches the format |
5,593,808 | I have a set of the span tags like .
```
<span id="q_1" >D1</span>
<span id="q_2" >D2</span>
<span id="q_3" >D3</span>
```
How can i get the ids of the span tags with the help of the jquery.The numbers 1,2,3 are generated run time.so the basic structure that i have is
```
<span id="q_" ></span>
``` | 2011/04/08 | [
"https://Stackoverflow.com/questions/5593808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401045/"
] | I have a feeling you're actually asking how to select all elements that have an id that starts with "q\_". If so, the simplest way to do so is like this:
```
var qSpans = $('span[id^="q_"]');
```
[See example →](http://jsfiddle.net/u4MnZ/) | to get an array if ids:
```
var a = $.map($('span'), function(s){ return s.id; });
``` |
23,135 | I want to know how people know that the Holy Quran expects its readers to know the Holy Bible.
One such claim is
"The Quran assumes familiarity with major narratives recounted in the Jewish and Christian scriptures."
Ref.: en.wikipedia.org/wiki/Quran | 2015/03/01 | [
"https://islam.stackexchange.com/questions/23135",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/12020/"
] | The Wikipedia [page](http://en.wikipedia.org/wiki/Quran) you referred to in comment, somewhat answers your question. Relevant lines from Wikipedia are
>
> "The Quran assumes familiarity with major narratives recounted in the Jewish and Christian scriptures. It summarizes some, dwells at length on others and, in some ... | It does not assume one to know the Bible by any way. But what it says is those who've read Bible(True Bible like Old Testament) find the same flavor even in the Qur'an, and also most of Qur'aninc verses confirm what's there in Bible(I mean the True Bible like Old Testament (or) the words of God aggregated in the Bible)... |
6,677,353 | I have following class for a form:
```
class Application_Form_ContactForm extends Zend_Form
{
public function init()
{
$this->setName('contact_us');
/*
I have also used follwing statements (one by one) to set name attribute
// $this->setAttrib('name', 'myForm-name');
// $this-... | 2011/07/13 | [
"https://Stackoverflow.com/questions/6677353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/625870/"
] | ```
((Outlook.ApplicationEvents_11_Event)Application).Quit
+= new Outlook.ApplicationEvents_11_QuitEventHandler(ThisAddIn_Quit);
void ThisAddIn_Quit()
{
System.Windows.Forms.MessageBox.Show("bye bye problem, I found the solution!!");
}
``` | Just try to give a solution: may be you can get **Outlook process** and listen for `Process.Exited` event. |
16,687,760 | I have a table which contain Column name Course and Status like below
```
Course Status
---------------------------
Math Complete
Math Complete
Math Complete
Science Incomplete
Science Complete
Science Complete
```
I want to a MySQL query who give following result
```
Course % Status_comp... | 2013/05/22 | [
"https://Stackoverflow.com/questions/16687760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2405033/"
] | ```
SELECT Course,
SUM(Status = 'Complete') / COUNT(*) * 1.0 AS STATUS_COMPLETE
FROM TableName
GROUP BY Course
```
* [SQLFiddle Demo](http://www.sqlfiddle.com/#!2/ee2eb/14)
* [SQLFiddle Demo (*with % symbol and ROUND()*)](http://www.sqlfiddle.com/#!2/ee2eb/13) | Use this:-
```
SELECT Course,
SUM(Status = 'Complete') / COUNT(*) * 100.0 as PercentageComplete,
SUM(Status = 'Incomplete') / COUNT(*) * 100.0 as PercentageIncomplete
FROM CourseTable
GROUP BY Course
```
Output :-
```
COURSE PERCENTAGECOMPLETE PERCENTAGEINCOMPLETE
Math 100 ... |
7,446,385 | I am sending a curl request but i am not setting the host header explicitly. What will be the host header as received by the remote url? Will it be my site's domain, or will be automatically be the domain of the remote url? | 2011/09/16 | [
"https://Stackoverflow.com/questions/7446385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409110/"
] | The `Host` header is automatically set based on the URL of your request.
And it's by definition the Internet hostname of the remote URL. | If you don't set it, remote server won't receive it. If you send the request as HTTP/1.1, the server should consider it a malformed request, so you'll probably receive an error code.
However, if the backend (e.g. Apache) performs some processing before passing the request to the script, it may set something according ... |
37,071,775 | I have this table:
```
// numbers
+---------+------------+
| id | numb |
+---------+------------+
| int(11) | bit(10) |
+---------+------------+
| 1 | 1001100111 |
| 2 | 0111000101 |
| 3 | 0001101010 |
| 4 | 1111111011 |
+---------+------------+
```
Now I'm trying to get third d... | 2016/05/06 | [
"https://Stackoverflow.com/questions/37071775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5259594/"
] | Although you could use `substr` after converting to `varchar`, a simpler approach for `BIT(...)` data type it to use bit operators.
Since according to your comment it is OK to extract 8-th bit from the right, rather than the third bit from the left, this will produce the expected result:
```
select id, (x>>7)&1
from ... | You could convert `BIT` to `VARCHAR` (*or `CHAR`*) and then use `SUBSTR` in following:
```
SELECT SUBSTR(CONVERT(VARCHAR(10),numb), 3, 1)
FROM numbers
```
Or using `LEFT` and `RIGHT`:
```
SELECT LEFT(RIGHT(CONVERT(VARCHAR(10),numb),8),1)
FROM numbers
``` |
37,071,775 | I have this table:
```
// numbers
+---------+------------+
| id | numb |
+---------+------------+
| int(11) | bit(10) |
+---------+------------+
| 1 | 1001100111 |
| 2 | 0111000101 |
| 3 | 0001101010 |
| 4 | 1111111011 |
+---------+------------+
```
Now I'm trying to get third d... | 2016/05/06 | [
"https://Stackoverflow.com/questions/37071775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5259594/"
] | Although you could use `substr` after converting to `varchar`, a simpler approach for `BIT(...)` data type it to use bit operators.
Since according to your comment it is OK to extract 8-th bit from the right, rather than the third bit from the left, this will produce the expected result:
```
select id, (x>>7)&1
from ... | If you have a bit column, then use bit operations.
These are documented [here](http://dev.mysql.com/doc/refman/5.7/en/bit-functions.html).
One method is:
```
select ( (numb & b'0010000000') > 0)
``` |
6,829,584 | I've a stream of updates just like a twitter stream.
```
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
<li>Fourth</li>
</ul>
<div id="pop-up"></div>
```
And the CSS
```
#pop-up {
position: absolute;
top: 125px;
left: center;
margin-left: -200px;
width: 960px;
min-height:... | 2011/07/26 | [
"https://Stackoverflow.com/questions/6829584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383393/"
] | >
> the list items is long and if I scroll down at the bottom and click on
> the last item of the list, the pop-up appears 150px from top and I've
> to scroll up?
>
>
>
To avoid this problem, you'll always have to stick with a `position:fixed` div. To make it scrollable, just add a quick `overflow: scroll` :) Ea... | ```
$('#pop-up').hover(function(){
$(this).css('position','absolute');
},function(){
$(this).css('position','fixed');
});
```
That way, it is scrollable, once you enter and is running with the page, when you're outside |
6,829,584 | I've a stream of updates just like a twitter stream.
```
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
<li>Fourth</li>
</ul>
<div id="pop-up"></div>
```
And the CSS
```
#pop-up {
position: absolute;
top: 125px;
left: center;
margin-left: -200px;
width: 960px;
min-height:... | 2011/07/26 | [
"https://Stackoverflow.com/questions/6829584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383393/"
] | Use `$(window).scrollTop()` to get number of scrolled pixels and add 150 to it - that gives you `top` value of your absolutely positioned popup. [Fiddle](http://jsfiddle.net/4zUeq/2/). | ```
$('#pop-up').hover(function(){
$(this).css('position','absolute');
},function(){
$(this).css('position','fixed');
});
```
That way, it is scrollable, once you enter and is running with the page, when you're outside |
98,575 | I know that light can be affected by gravity. But what if there was a planet where if you shone a light in a direction and it could hit your back. I'm talking about a planet where light is bent around the diameter of the planet and back to the starting point. But I am not incredibly good at math so I need help.
The pl... | 2017/11/23 | [
"https://worldbuilding.stackexchange.com/questions/98575",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/45020/"
] | The only place where stable photon orbits exist is the [Photon Sphere](https://en.m.wikipedia.org/wiki/Photon_sphere?wprov=sfti1). This is 3/2 of the Swarzchild radius of a black hole (or possibly an [ultra-compact neutron star](http://adsabs.harvard.edu/full/1993ApJ...406..590N), so there are three approaches to this,... | Sorry, it is impossible to do this with gravitational lensing without killing everyone.
There are ways to bend light other than gravity (e.g. prisms, reflective surfaces and fibre optics), but if you use gravity everyone dies a horrible death unless you want to change the law of physics and stick to magic.
The diam... |
98,575 | I know that light can be affected by gravity. But what if there was a planet where if you shone a light in a direction and it could hit your back. I'm talking about a planet where light is bent around the diameter of the planet and back to the starting point. But I am not incredibly good at math so I need help.
The pl... | 2017/11/23 | [
"https://worldbuilding.stackexchange.com/questions/98575",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/45020/"
] | Sorry, it is impossible to do this with gravitational lensing without killing everyone.
There are ways to bend light other than gravity (e.g. prisms, reflective surfaces and fibre optics), but if you use gravity everyone dies a horrible death unless you want to change the law of physics and stick to magic.
The diam... | Something similar to what you are asking is theoretically possible (see this [answer](https://physics.stackexchange.com/questions/350805/seeing-something-from-only-one-angle-means-you-have-only-seen-what-of-its-su/350814#350814))
>
> Consider a neutron star. If the radius falls below 1.76 times the Schwarzschild radi... |
98,575 | I know that light can be affected by gravity. But what if there was a planet where if you shone a light in a direction and it could hit your back. I'm talking about a planet where light is bent around the diameter of the planet and back to the starting point. But I am not incredibly good at math so I need help.
The pl... | 2017/11/23 | [
"https://worldbuilding.stackexchange.com/questions/98575",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/45020/"
] | Sorry, it is impossible to do this with gravitational lensing without killing everyone.
There are ways to bend light other than gravity (e.g. prisms, reflective surfaces and fibre optics), but if you use gravity everyone dies a horrible death unless you want to change the law of physics and stick to magic.
The diam... | You can’t do it with gravity, but you could have an atmosphere that refracts the light. Long ago, I once heard that Venus’s atmosphere would do this, if it were transparent. In reality, the refraction needs to bend it in the proper direction and that direction only, so you need a gradient of density or different layers... |
98,575 | I know that light can be affected by gravity. But what if there was a planet where if you shone a light in a direction and it could hit your back. I'm talking about a planet where light is bent around the diameter of the planet and back to the starting point. But I am not incredibly good at math so I need help.
The pl... | 2017/11/23 | [
"https://worldbuilding.stackexchange.com/questions/98575",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/45020/"
] | The only place where stable photon orbits exist is the [Photon Sphere](https://en.m.wikipedia.org/wiki/Photon_sphere?wprov=sfti1). This is 3/2 of the Swarzchild radius of a black hole (or possibly an [ultra-compact neutron star](http://adsabs.harvard.edu/full/1993ApJ...406..590N), so there are three approaches to this,... | Something similar to what you are asking is theoretically possible (see this [answer](https://physics.stackexchange.com/questions/350805/seeing-something-from-only-one-angle-means-you-have-only-seen-what-of-its-su/350814#350814))
>
> Consider a neutron star. If the radius falls below 1.76 times the Schwarzschild radi... |
98,575 | I know that light can be affected by gravity. But what if there was a planet where if you shone a light in a direction and it could hit your back. I'm talking about a planet where light is bent around the diameter of the planet and back to the starting point. But I am not incredibly good at math so I need help.
The pl... | 2017/11/23 | [
"https://worldbuilding.stackexchange.com/questions/98575",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/45020/"
] | The only place where stable photon orbits exist is the [Photon Sphere](https://en.m.wikipedia.org/wiki/Photon_sphere?wprov=sfti1). This is 3/2 of the Swarzchild radius of a black hole (or possibly an [ultra-compact neutron star](http://adsabs.harvard.edu/full/1993ApJ...406..590N), so there are three approaches to this,... | You can’t do it with gravity, but you could have an atmosphere that refracts the light. Long ago, I once heard that Venus’s atmosphere would do this, if it were transparent. In reality, the refraction needs to bend it in the proper direction and that direction only, so you need a gradient of density or different layers... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.