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 |
|---|---|---|---|---|---|
129,620 | In a galaxy far far away, during a fit of inspiration for a super massive marvel of technology, the Imperator dedicates an astounding 10% of energy and materials from his civilization's dyson sphere and solar materials processing units to attempt an innovative (and possibly insane) plan to create a matryoshka world. By... | 2018/11/08 | [
"https://worldbuilding.stackexchange.com/questions/129620",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/57129/"
] | This has been said in some of the comments to the answers, but no one has stated it outright:
**Why does a civilization capable of producing a Dyson Sphere require this boondoggle?**
If it's a vanity project, because the Imperator wants to build one, sure, no problem. But the inner (or outer, depending on star type) ... | Your comments suggest your already aware of Septerra Core, so maybe use it's solutions.
The upper shells are a desert, the top being a polar desert, the second being a warmer windy desert, and the bottom being a warm dark jungle with plants competing for the little light available and the heat coming from the lava on ... |
129,620 | In a galaxy far far away, during a fit of inspiration for a super massive marvel of technology, the Imperator dedicates an astounding 10% of energy and materials from his civilization's dyson sphere and solar materials processing units to attempt an innovative (and possibly insane) plan to create a matryoshka world. By... | 2018/11/08 | [
"https://worldbuilding.stackexchange.com/questions/129620",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/57129/"
] | This has been said in some of the comments to the answers, but no one has stated it outright:
**Why does a civilization capable of producing a Dyson Sphere require this boondoggle?**
If it's a vanity project, because the Imperator wants to build one, sure, no problem. But the inner (or outer, depending on star type) ... | You want to insulate the outside layer and let heat through to the inside layer.
The outside layer is going to have a temperature dominated by the cold of space, at something like -270C. It's really cold. Heat is going to constantly flow through it. You need to make sure that the energy from 1 star can pass through th... |
37,409 | I'm trying to upgrade CiviCRM on my Wordpress website from 5.25.0 to 5.28.0.
I've already completed upgrade in the past, so I know how to do it.
When I try to update the database, upgrade stay stuck on "[Executed: Rebuild Multilingal Schema]", and then become after few minutes "[Executed: undefined]".
* I try to upda... | 2020/08/18 | [
"https://civicrm.stackexchange.com/questions/37409",
"https://civicrm.stackexchange.com",
"https://civicrm.stackexchange.com/users/5669/"
] | End date alone does not determine if the relationship is 'active' or not. It will remain active until the scheduled job kicks in and makes it inactive. Examples include inherited memberships (membership by relationship). If you look in the advanced search you can see a radio option for active/inactive relationships. It... | (apologies if i am missing some deeper levels to this question)
if a Relationships passes its End Date then the job sets it to be not is\_active
is\_active is a setting you can use to disable a Relationship that may not have an End Date |
22,679,787 | In OpenLayers, we can create a object by using the following syntax:
```
var obj = new OpenLayers.Layer.WMS(... ...);
```
How to define that inheritance? I know the prototype mechanism but I have no idea about how to implement this inheritance. | 2014/03/27 | [
"https://Stackoverflow.com/questions/22679787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2827406/"
] | You define the each successive object like this:
```
var OpenLayers = {};
OpenLayers.Layer = {};
OpenLayers.Layer.WMS = function() {}
```
The whole thing could be defined in one javascript literal like this:
```
var OpenLayers = {
Layer: {
WMS: function() {}
}
}
```
These are generally called name... | We can achieve inheritance like this:
```
var obj = Object.create(Object name);
``` |
34,458,349 | I'm working on Processing to create my own API, with buttons and such. Yet I did the button, and I did everything about testing when your mouse is over the button,... But the thing is, I don't really know how to launch a method for the action of the button.
I saw how the basic Java API is doing -with ActionListener an... | 2015/12/24 | [
"https://Stackoverflow.com/questions/34458349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5666171/"
] | It happens because some controller tries to use the `web` middleware group.
<https://laravel.com/docs/5.2/middleware#middleware-groups>
You can define this group in you `Http\Kernel.php` to fix the problem:
```
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
... | **Change in composer.json this:**
"acacha/admin-lte-template-laravel": "1.\*"
**for this:**
"acacha/admin-lte-template-laravel": "1.0.5"
**And run:**
composer update
**More info here:**
<https://github.com/acacha/adminlte-laravel/issues/35> |
71,867 | I'd like to access my Grub Menu at boot by pressing `Shift`.
After I press `Shift` I see a message saying "Grub loading.."
but then no menu appears and the computer keeps booting normally
into my Ubuntu Installation.
Do you know how I can access the Grub Menu at boot?
Thanks a lot for your help! | 2011/10/25 | [
"https://askubuntu.com/questions/71867",
"https://askubuntu.com",
"https://askubuntu.com/users/28014/"
] | The issue is solved by modifying the parameter `GRUB_HIDDEN_TIMEOUT` in the `/etc/default/grub` file (need to be super user to modify it), and (as always to apply configuration changes made in this file) running `sudo update-grub`.
Changing the value from 0 to some positive value allows to enter the GRUB menu by press... | This finally worked for me :
1. Goto your BOOT menu and then go to BOOT settings - change "BOOT MODE" to "Legacy" from "UEFI" --> Save
2. Shut Down and restart.
3. In my case, it showed "No operating system found"
4. Quick shut down your system(by pressing the power button continuously for 15 secs)
5. Goto the Boot me... |
65,753 | I uploaded around 600 pictures in different galleries in wordpress without setting the titles and alt attributes. I need to edit them, I was wondering a way to edit them by album, let's say the title of the pictures in the album soccer would be soccer1, soccer2 etc.. but without doing it manually? | 2012/09/19 | [
"https://wordpress.stackexchange.com/questions/65753",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | **You can use the 'wp\_get\_attachment\_image\_attributes' hook**
```
add_filter(
'wp_get_attachment_image_attributes',
'image_attributes',
20,
2
);
function image_attributes( $attr, $attachment )
{
// Get post parent
$parent = get_post_field( 'post_parent', $attachment );
// Get post titl... | I think the better way to use this plugin - <http://wordpress.org/plugins/faster-image-insert/>
We have a photo website and we use this plugin for a bulk uploading and bulk editing image attributes. You can run action that will change all your titles in way soccer1, soccer2. You also can change the order of your image... |
60,533,068 | Imagine that you have a query and you want to only show that one who has ALL the values of a subquery. For example, we have the following table:
```
CREATE TABLE test
(
code VARCHAR2(4),
year VARCHAR2(4),
action VARCHAR2(50),
CONSTRAINT pk PRIMARY KEY (code, year)
);
```
And the following registers:
```
INSERT INTO... | 2020/03/04 | [
"https://Stackoverflow.com/questions/60533068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | With a little bit expanded sample data, where `CODE`s 1 and 3 have both Arrival and Departure:
```
SQL> with test (code, year, action) as
2 (select 1, 2020, 'Departure' from dual union all
3 select 1, 2021, 'Arrival' from dual union all
4 select 2, 2020, 'Departure' from dual union all
5 --
... | As a general solution, I'd look for an opportunity to use `HAVING count(*) = #`. Roughly,
>
> SELECT code FROM table WHERE action in (SUBSELECT) GROUP BY code HAVING count(\*) = (SELECT count(\*) from SUBSELECT)
>
>
>
Of course if you can have multiple `Arrival` for a single `code`, you have to include a `DISTINC... |
60,533,068 | Imagine that you have a query and you want to only show that one who has ALL the values of a subquery. For example, we have the following table:
```
CREATE TABLE test
(
code VARCHAR2(4),
year VARCHAR2(4),
action VARCHAR2(50),
CONSTRAINT pk PRIMARY KEY (code, year)
);
```
And the following registers:
```
INSERT INTO... | 2020/03/04 | [
"https://Stackoverflow.com/questions/60533068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | With a little bit expanded sample data, where `CODE`s 1 and 3 have both Arrival and Departure:
```
SQL> with test (code, year, action) as
2 (select 1, 2020, 'Departure' from dual union all
3 select 1, 2021, 'Arrival' from dual union all
4 select 2, 2020, 'Departure' from dual union all
5 --
... | Enclose your query inside a CTE like this:
```
with cte as (
<your query here>
)
select t.*
from test t
where
t.action in (select action from cte)
and
code in (
select code
from test
where action in (select action from cte)
group by code
having count(distinct action) = (select count(*) fr... |
70,344,614 | I've multiple external JAR files, which include special proceedings for my application. The application itself just needs one proceeding at the time, depending on the proceeding name entered by the user.
With that beeing said, I've created a `config.properties` file, which contains relevant informations about each pro... | 2021/12/14 | [
"https://Stackoverflow.com/questions/70344614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16047487/"
] | The correct explanation is that you can't remove a commit *at all*. It doesn't matter whether the commit has a tag or a branch name associated with it, as far as its *existence* goes. And it does not matter whether a commit *exists* either! What matters to `git log` is whether `git log` can *find the commit*.
Obviousl... | [`git log`](https://git-scm.com/docs/git-log) will display any commit *reachable*.
Meaning:
* reachable from a branch HEAD
* or from a tag
You would therefore need to delete the tag, not just the branch
```
git tag -d br2-tag
```
Note that all those steps are for your local repository only.
If you had also pus... |
54,865,337 | I'm Learning Linq by converting the sql queries into linq. I have a table which has time intervals. I want to add the time intervals
Input:
```
Total Time
00:00:14
00:00:55
00:00:40
```
output:
```
Total TIme Taken
00:01:49
```
The sql query which i used to convert the above Input to output
```
SELECT... | 2019/02/25 | [
"https://Stackoverflow.com/questions/54865337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10334082/"
] | I believe this should suffice.
Given table name *Table*, Column name *TotalTime*:
```
TimeSpan ts = new TimeSpan(Table.Select(x => TimeSpan.Parse(x.TotalTime).Ticks).Sum());
```
`ts` object will contain the sum of the values.
**Although as a lot of other people pointed out, long term resolution is definitely not s... | Maybe it is not very wise to store date/time informations as `varchar`. So you should think about using the `datetime` column type. Also you should maybe use an OR mapper (like EntityFramework) to interact with your database, so that you don't have to hassle with the plumbing details about SQL security, etc.
Neverthel... |
396,505 | I apologize in advance if this question is not up to the level of research level questions on Math overflow. I am a complete outsider to invariant theory/representation theory and would like someone more knowledgeable than me to direct me to where I should read.
Let $Sym^k(\mathbb{R}^n)$ be the vector space of symmetr... | 2021/06/30 | [
"https://mathoverflow.net/questions/396505",
"https://mathoverflow.net",
"https://mathoverflow.net/users/32135/"
] | In hopes that some commenters will post their suggestions as answers, let me post this recommendation here.
An increasingly important aspect of contemporary mathematics is the role of computers and experimental mathematics. One article addressing this is Marjin Heule and Oliver Kullmann's 2017 [The Science of Brute Fo... | An interesting (and topical!) topic would be the commentary on the status and philosophy of mathematics by [Nikolai V. Ivanov](https://en.wikipedia.org/wiki/Nikolai_Ivanov_(mathematician)) a.k.a. *Owl,* as expounded in his blog [Stop Timothy Gowers](http://owl-sowa.blogspot.com/). While it was active only for a couple ... |
396,505 | I apologize in advance if this question is not up to the level of research level questions on Math overflow. I am a complete outsider to invariant theory/representation theory and would like someone more knowledgeable than me to direct me to where I should read.
Let $Sym^k(\mathbb{R}^n)$ be the vector space of symmetr... | 2021/06/30 | [
"https://mathoverflow.net/questions/396505",
"https://mathoverflow.net",
"https://mathoverflow.net/users/32135/"
] | In hopes that some commenters will post their suggestions as answers, let me post this recommendation here.
An increasingly important aspect of contemporary mathematics is the role of computers and experimental mathematics. One article addressing this is Marjin Heule and Oliver Kullmann's 2017 [The Science of Brute Fo... | For the philosophy of mathematics, a standard reference is Benacerraf and Putnam's anthology [*Philosophy of Mathematics: Selected Readings*](https://doi.org/10.1017/CBO9781139171519). This will provide a good introduction to some of the "traditional" topics in the subject such as logicism, intuitionism, formalism, and... |
396,505 | I apologize in advance if this question is not up to the level of research level questions on Math overflow. I am a complete outsider to invariant theory/representation theory and would like someone more knowledgeable than me to direct me to where I should read.
Let $Sym^k(\mathbb{R}^n)$ be the vector space of symmetr... | 2021/06/30 | [
"https://mathoverflow.net/questions/396505",
"https://mathoverflow.net",
"https://mathoverflow.net/users/32135/"
] | For the philosophy of mathematics, a standard reference is Benacerraf and Putnam's anthology [*Philosophy of Mathematics: Selected Readings*](https://doi.org/10.1017/CBO9781139171519). This will provide a good introduction to some of the "traditional" topics in the subject such as logicism, intuitionism, formalism, and... | An interesting (and topical!) topic would be the commentary on the status and philosophy of mathematics by [Nikolai V. Ivanov](https://en.wikipedia.org/wiki/Nikolai_Ivanov_(mathematician)) a.k.a. *Owl,* as expounded in his blog [Stop Timothy Gowers](http://owl-sowa.blogspot.com/). While it was active only for a couple ... |
43,089 | Every week I hop on a treadmill and figure out how long I need to run. I am given the pace:
Pace = 7:41/mile = (7 minutes + 41 seconds) per mile
I need to add this up to calculate how long I should run to run 1.5 miles. I use the formula
7:41 + (7:41/2) = ? 1.5 mile
I find this somewhat difficult to calculate in my... | 2011/06/03 | [
"https://math.stackexchange.com/questions/43089",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/7613/"
] | I understand your question as this: "How do I efficiently divide numbers by $2$ in sexagismal. (Base 60)"
Suppose you have $a\*60+b$ as your time. In your case, $a=7$, $b=41$. To divide by two, just do it the way you normally would, but carrying is by $60$ instead of $10$. (Base $60$ instead of base $10$)
Divide $a$ ... | I recommend splitting it up in your head. 7:41 is 7 minutes and 41 seconds. We know that half of 7 minutes is 3 minutes and a half. Half of 41 is about 20. So we add these to get 3:50 or so, and add that to 7:41. Even when I add them, I take 10 seconds from 7:41 (getting 7:31) and add it to 3:50 (getting 4:00) so that ... |
43,089 | Every week I hop on a treadmill and figure out how long I need to run. I am given the pace:
Pace = 7:41/mile = (7 minutes + 41 seconds) per mile
I need to add this up to calculate how long I should run to run 1.5 miles. I use the formula
7:41 + (7:41/2) = ? 1.5 mile
I find this somewhat difficult to calculate in my... | 2011/06/03 | [
"https://math.stackexchange.com/questions/43089",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/7613/"
] | I recommend splitting it up in your head. 7:41 is 7 minutes and 41 seconds. We know that half of 7 minutes is 3 minutes and a half. Half of 41 is about 20. So we add these to get 3:50 or so, and add that to 7:41. Even when I add them, I take 10 seconds from 7:41 (getting 7:31) and add it to 3:50 (getting 4:00) so that ... | My answer is going to be more specific to the calculation you're doing (a + 1/2 \* a), so if you have the pace 7:41 and you want to find 7:41 + 1/2 \* 7:41.
First you do 7/2 = 3.5, and add it to the original time 7:41+3.5 = 10.5:41, then if necessary, normalize the .5 to 10:71
Second you add the seconds 10:71 + 41/2 ... |
43,089 | Every week I hop on a treadmill and figure out how long I need to run. I am given the pace:
Pace = 7:41/mile = (7 minutes + 41 seconds) per mile
I need to add this up to calculate how long I should run to run 1.5 miles. I use the formula
7:41 + (7:41/2) = ? 1.5 mile
I find this somewhat difficult to calculate in my... | 2011/06/03 | [
"https://math.stackexchange.com/questions/43089",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/7613/"
] | I understand your question as this: "How do I efficiently divide numbers by $2$ in sexagismal. (Base 60)"
Suppose you have $a\*60+b$ as your time. In your case, $a=7$, $b=41$. To divide by two, just do it the way you normally would, but carrying is by $60$ instead of $10$. (Base $60$ instead of base $10$)
Divide $a$ ... | My answer is going to be more specific to the calculation you're doing (a + 1/2 \* a), so if you have the pace 7:41 and you want to find 7:41 + 1/2 \* 7:41.
First you do 7/2 = 3.5, and add it to the original time 7:41+3.5 = 10.5:41, then if necessary, normalize the .5 to 10:71
Second you add the seconds 10:71 + 41/2 ... |
13,886,097 | I realized Smartphone applications with Google News API. And I want to know if it's possible (I mean legal) to add advertisements on these apps ?
I used the RSS feed (the API is deprecated). In this [link](http://support.google.com/news/bin/news/bin/answer.py?hl=en&hlrm=fr&answer=40796) it says : "We invite you to mak... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13886097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376219/"
] | Checkout deliver (<http://github.com/krausefx/deliver>), which lets you upload screenshots for all devices in different languages from the command line.
It uses the `itmstransporter` under the hood: <https://github.com/KrauseFx/deliver/blob/master/lib/deliver/itunes_transporter.rb> | Would like to know about such batch uploader too!
My ways for speeding up the upload:
1. open the pages with different languages in several tabs or browsers and uploading them in parallel (may be it is better to create several copies of folders with screenshots, so that every tab will turn to its own folder, because ... |
5,882,204 | I want to loop over a plot and put the result of the plot in a `PDF`.
The following code is used to do this:
What this does is loop 3 times and plot 3 different plots from the iris dataset. Then it should save it to the `C:/` drive. The `PDF` files are created, but are corrupted.
```
for(i in 1:3){
pdf(paste("c:/"... | 2011/05/04 | [
"https://Stackoverflow.com/questions/5882204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/717132/"
] | To drawn lattice plots on the device, one needs to print the object produced by a call to one of the lattice graphics functions. Normally, in interactive use, R auto prints objects if not assigned. In loops however, auto printing does not work, so one must arrange for the object to be printed, usually by wrapping it in... | Is a file name that contains "c:/" a valid file name on your OS? That looks like part of the working directory that you'd want to set before calling `pdf`. I get an error telling me it can't open that file:
```
Error in pdf(paste("c:/", i, ".pdf", sep = "")) :
cannot open file 'c:/1.pdf'
```
If I drop the "c:/" b... |
56,297,596 | I got a WPF application which finds locations of latitude and longitude, and display them to the user inside the app. The app got a button that when clicked, is supposed to open a map using the Google maps API and display these locations on the map using markers.
I got this below script inside an HTML which as of now... | 2019/05/24 | [
"https://Stackoverflow.com/questions/56297596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164004/"
] | Use GET semantics in the file open command.
You must use a URI as the command: `"file://pathToHtmlFile?lat=" + Lat + "&lng=" + Long"`
Add a function to the script block:
```
function get(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent... | A different approach is to build the html file on the fly. This supports an arbitrarily large number of markers (Maximum of 256 to ~5000+, depending on memory and API constraints).
Split the `HTML` file into two parts, top and bottom (see the code below), on where the data needs to be inserted between.
1. Load the "t... |
23,827,435 | I've been braking my head whole morning how to do this.
So lets say this is my data set
```
set.seed(1)
temp <- as.data.frame(cbind(Key = letters[1:5], sapply(1:12, function(x) sample(c(0, 1), 5, replace = T))))
names(temp)[2:13] <- month.abb
temp
# Key Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# 1 a 0 ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23827435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3001626/"
] | In pseudocode, represent each column as a binary number.
E.g. Jan = 0b00110 and Feb = 0b11110.
Your formula for Jan is then
```
Bitcount(Jan AND Feb) / Bitcount(Jan)
```
Where `AND` is the bitwise `AND` operator and `Bitcount` counts the number of 1 bits in the number. (I can supply a way of bit counting if you n... | ```
length(which(!xor(data["Feb"],data["Mar"]) & data["Feb"]==1)) / length(which(data["Feb"]==1))
```
`!xor` is the negated exclusive or.
`length(which(...))` gives the number of true values in a logical vector. |
23,827,435 | I've been braking my head whole morning how to do this.
So lets say this is my data set
```
set.seed(1)
temp <- as.data.frame(cbind(Key = letters[1:5], sapply(1:12, function(x) sample(c(0, 1), 5, replace = T))))
names(temp)[2:13] <- month.abb
temp
# Key Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# 1 a 0 ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23827435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3001626/"
] | Unless I'm missing something, the following looks valid:
```
#just to remove 'factor's from "temp"
tmp = do.call(cbind.data.frame, c(temp[1], lapply(temp[-1], function(x) as.numeric(as.character(x)))))
sapply(head(seq_len(ncol(tmp))[-1], -1),
function(i) sum(tmp[[i]] & tmp[[i+1]]) / sum(tmp[[i]]))
#[1] 1.0000... | In pseudocode, represent each column as a binary number.
E.g. Jan = 0b00110 and Feb = 0b11110.
Your formula for Jan is then
```
Bitcount(Jan AND Feb) / Bitcount(Jan)
```
Where `AND` is the bitwise `AND` operator and `Bitcount` counts the number of 1 bits in the number. (I can supply a way of bit counting if you n... |
23,827,435 | I've been braking my head whole morning how to do this.
So lets say this is my data set
```
set.seed(1)
temp <- as.data.frame(cbind(Key = letters[1:5], sapply(1:12, function(x) sample(c(0, 1), 5, replace = T))))
names(temp)[2:13] <- month.abb
temp
# Key Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# 1 a 0 ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23827435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3001626/"
] | Unless I'm missing something, the following looks valid:
```
#just to remove 'factor's from "temp"
tmp = do.call(cbind.data.frame, c(temp[1], lapply(temp[-1], function(x) as.numeric(as.character(x)))))
sapply(head(seq_len(ncol(tmp))[-1], -1),
function(i) sum(tmp[[i]] & tmp[[i+1]]) / sum(tmp[[i]]))
#[1] 1.0000... | ```
length(which(!xor(data["Feb"],data["Mar"]) & data["Feb"]==1)) / length(which(data["Feb"]==1))
```
`!xor` is the negated exclusive or.
`length(which(...))` gives the number of true values in a logical vector. |
23,827,435 | I've been braking my head whole morning how to do this.
So lets say this is my data set
```
set.seed(1)
temp <- as.data.frame(cbind(Key = letters[1:5], sapply(1:12, function(x) sample(c(0, 1), 5, replace = T))))
names(temp)[2:13] <- month.abb
temp
# Key Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# 1 a 0 ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23827435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3001626/"
] | First fix up `temp` so that the 0/1 columns are numeric rather than factor. Then apply `overlap` to each pair of columns:
```
temp[-1] <- lapply(temp[-1], function(x) as.numeric(as.character(x)))
overlap <- function(x, y) mean(y[x == 1])
data.frame(Month = month.abb[-12],
Overlap = sapply(2:12, function(i... | ```
length(which(!xor(data["Feb"],data["Mar"]) & data["Feb"]==1)) / length(which(data["Feb"]==1))
```
`!xor` is the negated exclusive or.
`length(which(...))` gives the number of true values in a logical vector. |
23,827,435 | I've been braking my head whole morning how to do this.
So lets say this is my data set
```
set.seed(1)
temp <- as.data.frame(cbind(Key = letters[1:5], sapply(1:12, function(x) sample(c(0, 1), 5, replace = T))))
names(temp)[2:13] <- month.abb
temp
# Key Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# 1 a 0 ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23827435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3001626/"
] | Unless I'm missing something, the following looks valid:
```
#just to remove 'factor's from "temp"
tmp = do.call(cbind.data.frame, c(temp[1], lapply(temp[-1], function(x) as.numeric(as.character(x)))))
sapply(head(seq_len(ncol(tmp))[-1], -1),
function(i) sum(tmp[[i]] & tmp[[i+1]]) / sum(tmp[[i]]))
#[1] 1.0000... | First fix up `temp` so that the 0/1 columns are numeric rather than factor. Then apply `overlap` to each pair of columns:
```
temp[-1] <- lapply(temp[-1], function(x) as.numeric(as.character(x)))
overlap <- function(x, y) mean(y[x == 1])
data.frame(Month = month.abb[-12],
Overlap = sapply(2:12, function(i... |
140,321 | What's the difference between Building and Compiling. | 2012/03/18 | [
"https://softwareengineering.stackexchange.com/questions/140321",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49979/"
] | Compiling is *part* of a build process.
A build process can include testing, packaging and other activities apart from compilation. | These terms are often used interchangeably, but I would differentiate them in the following way:
* Building is done when preparing an application for release, which includes compiling, packaging, testing, etc.
* Compiling is done at any time the compiler is involved in translating programming language code to machine ... |
140,321 | What's the difference between Building and Compiling. | 2012/03/18 | [
"https://softwareengineering.stackexchange.com/questions/140321",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49979/"
] | Compiling is *part* of a build process.
A build process can include testing, packaging and other activities apart from compilation. | "Building" is a fairly general term, and it can refer to anything that is needed to go from editable source material (source code, scripts, raw data files, etc.) to a shippable software product. Building can (and usually does) involve several steps, such as pre-processing, compiling, linking, converting data files, run... |
140,321 | What's the difference between Building and Compiling. | 2012/03/18 | [
"https://softwareengineering.stackexchange.com/questions/140321",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49979/"
] | Compiling is *part* of a build process.
A build process can include testing, packaging and other activities apart from compilation. | Compiling is done by compiler, build can be more complex process.
Eg. in C++ to make a build of a project you need preprocessor (preprocessing of source files); compiler (compiling of source files); linker (merging everything into executable - compiled code, icons, strings, other resources together)
So generally comp... |
140,321 | What's the difference between Building and Compiling. | 2012/03/18 | [
"https://softwareengineering.stackexchange.com/questions/140321",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49979/"
] | "Building" is a fairly general term, and it can refer to anything that is needed to go from editable source material (source code, scripts, raw data files, etc.) to a shippable software product. Building can (and usually does) involve several steps, such as pre-processing, compiling, linking, converting data files, run... | These terms are often used interchangeably, but I would differentiate them in the following way:
* Building is done when preparing an application for release, which includes compiling, packaging, testing, etc.
* Compiling is done at any time the compiler is involved in translating programming language code to machine ... |
140,321 | What's the difference between Building and Compiling. | 2012/03/18 | [
"https://softwareengineering.stackexchange.com/questions/140321",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49979/"
] | These terms are often used interchangeably, but I would differentiate them in the following way:
* Building is done when preparing an application for release, which includes compiling, packaging, testing, etc.
* Compiling is done at any time the compiler is involved in translating programming language code to machine ... | Compiling is done by compiler, build can be more complex process.
Eg. in C++ to make a build of a project you need preprocessor (preprocessing of source files); compiler (compiling of source files); linker (merging everything into executable - compiled code, icons, strings, other resources together)
So generally comp... |
140,321 | What's the difference between Building and Compiling. | 2012/03/18 | [
"https://softwareengineering.stackexchange.com/questions/140321",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49979/"
] | "Building" is a fairly general term, and it can refer to anything that is needed to go from editable source material (source code, scripts, raw data files, etc.) to a shippable software product. Building can (and usually does) involve several steps, such as pre-processing, compiling, linking, converting data files, run... | Compiling is done by compiler, build can be more complex process.
Eg. in C++ to make a build of a project you need preprocessor (preprocessing of source files); compiler (compiling of source files); linker (merging everything into executable - compiled code, icons, strings, other resources together)
So generally comp... |
8,721,848 | Let's consider the following simple code in Java.
```java
package temppkg;
interface Interface
{
@Override
public abstract boolean equals(java.lang.Object arg);
@Override
public abstract String toString();
public void show();
}
final class Demo implements Interface
{
public void show()
... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8721848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | In `Interface` you're not actually *overriding* anything - an interface by definition can not provide implementations for any of its methods. The class `Demo` just inherits the `equals` and `toString` implementation from `Object`.
In essence an interface in Java contains a set of zero or more method signatures (all of... | `@Override` can only be used for functions defined in the base class, Object. Object defines `equals` and `toString`, so you can use `@Override` with them, but not with, say, the function show. It indicates a relationship between the `@Override` functions in a class and its base classes, not it's derived classes. |
8,721,848 | Let's consider the following simple code in Java.
```java
package temppkg;
interface Interface
{
@Override
public abstract boolean equals(java.lang.Object arg);
@Override
public abstract String toString();
public void show();
}
final class Demo implements Interface
{
public void show()
... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8721848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | Check out [JLS 9.2](http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html):
>
> If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method *m* with signature *s*, return type *r*, and throws clause *t* corresponding to each public instance met... | In `Interface` you're not actually *overriding* anything - an interface by definition can not provide implementations for any of its methods. The class `Demo` just inherits the `equals` and `toString` implementation from `Object`.
In essence an interface in Java contains a set of zero or more method signatures (all of... |
8,721,848 | Let's consider the following simple code in Java.
```java
package temppkg;
interface Interface
{
@Override
public abstract boolean equals(java.lang.Object arg);
@Override
public abstract String toString();
public void show();
}
final class Demo implements Interface
{
public void show()
... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8721848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | >
> The Java Language Specification clearly says that the members of an
> interface are those which are declared in the interface and those
> which are inherited from direct super interfaces. If an interface has
> no direct superinterface then the interface implicitly declares a
> public abstract member method cor... | In `Interface` you're not actually *overriding* anything - an interface by definition can not provide implementations for any of its methods. The class `Demo` just inherits the `equals` and `toString` implementation from `Object`.
In essence an interface in Java contains a set of zero or more method signatures (all of... |
8,721,848 | Let's consider the following simple code in Java.
```java
package temppkg;
interface Interface
{
@Override
public abstract boolean equals(java.lang.Object arg);
@Override
public abstract String toString();
public void show();
}
final class Demo implements Interface
{
public void show()
... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8721848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | Check out [JLS 9.2](http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html):
>
> If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method *m* with signature *s*, return type *r*, and throws clause *t* corresponding to each public instance met... | `@Override` can only be used for functions defined in the base class, Object. Object defines `equals` and `toString`, so you can use `@Override` with them, but not with, say, the function show. It indicates a relationship between the `@Override` functions in a class and its base classes, not it's derived classes. |
8,721,848 | Let's consider the following simple code in Java.
```java
package temppkg;
interface Interface
{
@Override
public abstract boolean equals(java.lang.Object arg);
@Override
public abstract String toString();
public void show();
}
final class Demo implements Interface
{
public void show()
... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8721848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | >
> The Java Language Specification clearly says that the members of an
> interface are those which are declared in the interface and those
> which are inherited from direct super interfaces. If an interface has
> no direct superinterface then the interface implicitly declares a
> public abstract member method cor... | `@Override` can only be used for functions defined in the base class, Object. Object defines `equals` and `toString`, so you can use `@Override` with them, but not with, say, the function show. It indicates a relationship between the `@Override` functions in a class and its base classes, not it's derived classes. |
8,721,848 | Let's consider the following simple code in Java.
```java
package temppkg;
interface Interface
{
@Override
public abstract boolean equals(java.lang.Object arg);
@Override
public abstract String toString();
public void show();
}
final class Demo implements Interface
{
public void show()
... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8721848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | >
> The Java Language Specification clearly says that the members of an
> interface are those which are declared in the interface and those
> which are inherited from direct super interfaces. If an interface has
> no direct superinterface then the interface implicitly declares a
> public abstract member method cor... | Check out [JLS 9.2](http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html):
>
> If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method *m* with signature *s*, return type *r*, and throws clause *t* corresponding to each public instance met... |
36,872,802 | Suppose I create a small component that takes an input and sets a label to show it.
*app/components/testComponent/testComponent.xml:*
```
<Label id="someLabel" loaded="onLoad"/>
```
*app/components/testComponent/testComponent.js:*
```
exports.onLoad = args => {
const obj = args.object;
const label = obj.g... | 2016/04/26 | [
"https://Stackoverflow.com/questions/36872802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1825727/"
] | Yes, the Declarative UI (i.e. xml) is actually a building system that parses the xml and generates the JS so you don't have to.
So if you wanted to manually do this you would leave your component code alone and you would change your main screen code to be like this:
```
<Page xmlns="http://schemas.nativescript.org/t... | where filepath is a script - or even a class the callback function can create an instance of.
This is as if its loaded at page load and shows in most developer tool consoles.
```
var uuid='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c =... |
16,885,809 | I already implement my own apps with google map v2 and it was working. after updating ADT and SDK everything is getting worse. I can't find the google\_play\_service\_lib.jar in C:\Users\\android-sdks\extras\google\google\_play\_services\libproject. The funny things in Eclipse it shows me that Google Play services is i... | 2013/06/02 | [
"https://Stackoverflow.com/questions/16885809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/628213/"
] | It is normal that you can not find the file google\_play\_services.jar because it does not exist. `google_play_services` is a library of the form of a draft that you must integrate into your application this way:
* Properties (in your project)
* Android
* Add a library project
If you cant't find your library, do this... | There is nothing named "google\_play\_services.jar" anymore. You have to include the Google Play Services project as a reference in your Android Project. You can find details [here](http://developer.android.com/google/play-services/setup.html) about how to setup your project with the new Google Play Services structure.... |
16,885,809 | I already implement my own apps with google map v2 and it was working. after updating ADT and SDK everything is getting worse. I can't find the google\_play\_service\_lib.jar in C:\Users\\android-sdks\extras\google\google\_play\_services\libproject. The funny things in Eclipse it shows me that Google Play services is i... | 2013/06/02 | [
"https://Stackoverflow.com/questions/16885809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/628213/"
] | It is normal that you can not find the file google\_play\_services.jar because it does not exist. `google_play_services` is a library of the form of a draft that you must integrate into your application this way:
* Properties (in your project)
* Android
* Add a library project
If you cant't find your library, do this... | * When you are importing `google_play_services` lib in your workspace, make sure you copied it as well.
* Do not forget to keep the library open... We usually have a habit of keeping the projects close.. so just an advise.. |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | I'd recommend using Java generics to create re-usable column formatter that takes any `java.text.Format`. This cuts down on the amount of boilerplate code...
```
private class ColumnFormatter<S, T> implements Callback<TableColumn<S, T>, TableCell<S, T>> {
private Format format;
public ColumnFormatter(Format f... | You can easily pipe Properties of different type and put a formatter or converter in between.
```
//from my model
ObjectProperty<Date> valutaProperty;
//from my view
TableColumn<Posting, String> valutaColumn;
valutaColumn.setCellValueFactory(
cellData -> {
SimpleStr... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | I needed to do this recently -
```
dateAddedColumn.setCellValueFactory(
new Callback<TableColumn.CellDataFeatures<Film, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(TableColumn.CellDataFeatures<Film, String> film) {
SimpleStringProperty property = new Sim... | An universal solution could be as simple as that:
```
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
public interface AbstractConvertCellFactory<E, T> extends Callback<TableColumn<E, T>, TableCell<E, T>> {
@Override
default TableCell<E, T> call(Ta... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | I'd recommend using Java generics to create re-usable column formatter that takes any `java.text.Format`. This cuts down on the amount of boilerplate code...
```
private class ColumnFormatter<S, T> implements Callback<TableColumn<S, T>, TableCell<S, T>> {
private Format format;
public ColumnFormatter(Format f... | This is what i did and i worked perfectly.
```
tbColDataMovt.setCellFactory((TableColumn<Auditoria, Timestamp> column) -> {
return new TableCell<Auditoria, Timestamp>() {
@Override
protected void updateItem(Timestamp item, boolean empty) {
super.updateItem(item, empty);
if (... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | I needed to do this recently -
```
dateAddedColumn.setCellValueFactory(
new Callback<TableColumn.CellDataFeatures<Film, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(TableColumn.CellDataFeatures<Film, String> film) {
SimpleStringProperty property = new Sim... | The `StringConverter` classes are another mechanism.
`TextFieldTableCell` has a constructor as follows: `public TextFieldTableCell(StringConverter<T> converter)`.
... and `StringConverter`s consist of subclasses such as `LocalDateStringConverter`. A default implementation would then be:
```
new TextFieldTableCell( n... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | An universal solution could be as simple as that:
```
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
public interface AbstractConvertCellFactory<E, T> extends Callback<TableColumn<E, T>, TableCell<E, T>> {
@Override
default TableCell<E, T> call(Ta... | You can easily pipe Properties of different type and put a formatter or converter in between.
```
//from my model
ObjectProperty<Date> valutaProperty;
//from my view
TableColumn<Posting, String> valutaColumn;
valutaColumn.setCellValueFactory(
cellData -> {
SimpleStr... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | I'd recommend using Java generics to create re-usable column formatter that takes any `java.text.Format`. This cuts down on the amount of boilerplate code...
```
private class ColumnFormatter<S, T> implements Callback<TableColumn<S, T>, TableCell<S, T>> {
private Format format;
public ColumnFormatter(Format f... | An universal solution could be as simple as that:
```
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
public interface AbstractConvertCellFactory<E, T> extends Callback<TableColumn<E, T>, TableCell<E, T>> {
@Override
default TableCell<E, T> call(Ta... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | I needed to do this recently -
```
dateAddedColumn.setCellValueFactory(
new Callback<TableColumn.CellDataFeatures<Film, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(TableColumn.CellDataFeatures<Film, String> film) {
SimpleStringProperty property = new Sim... | This is what i did and i worked perfectly.
```
tbColDataMovt.setCellFactory((TableColumn<Auditoria, Timestamp> column) -> {
return new TableCell<Auditoria, Timestamp>() {
@Override
protected void updateItem(Timestamp item, boolean empty) {
super.updateItem(item, empty);
if (... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | Update for Java FX8:
(I'm not sure it is the good place for that answer, but I get the problem in JavaFX8 and some things have changed, like java.time package)
Some differences with the previous answers:
I keep the date type on the column, so I need to use both cellValueFactory and cellFactory.
I Make a generic reus... | You can easily pipe Properties of different type and put a formatter or converter in between.
```
//from my model
ObjectProperty<Date> valutaProperty;
//from my view
TableColumn<Posting, String> valutaColumn;
valutaColumn.setCellValueFactory(
cellData -> {
SimpleStr... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | If you want to preserve the sorting capabilities of your TableColumn, none of the solutions above is valid: if you convert your Date to a String and show it that way in your TableView; the table will sort it as such (so incorrectly).
The solution I found was subclassing the Date class in order to override the toString... | An universal solution could be as simple as that:
```
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
public interface AbstractConvertCellFactory<E, T> extends Callback<TableColumn<E, T>, TableCell<E, T>> {
@Override
default TableCell<E, T> call(Ta... |
11,412,360 | ```
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
```
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object. | 2012/07/10 | [
"https://Stackoverflow.com/questions/11412360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249571/"
] | You can accomplish that through Cell Factories. See
<https://stackoverflow.com/a/10149050/682495>
<https://stackoverflow.com/a/10700642/682495>
Although the 2nd link is about `ListCell`, the same logic is totally applicable to `TableCell`s too.
P.S. Still if you need some sample code, kindly will attach here... | This is what i did and i worked perfectly.
```
tbColDataMovt.setCellFactory((TableColumn<Auditoria, Timestamp> column) -> {
return new TableCell<Auditoria, Timestamp>() {
@Override
protected void updateItem(Timestamp item, boolean empty) {
super.updateItem(item, empty);
if (... |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | ```
if (preg_match('/[^|]/', $string)) {
// string contains characters other than |
}
```
or:
```
if (strlen(str_replace('|', '', $string)) > 0) {
// string contains characters other than |
}
``` | Yes, you can use regular expressions:
```
if(! preg_match('/[^\|]/', $string)) {
$string = NULL;
}
``` |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | ```
if (preg_match('/[^|]/', $string)) {
// string contains characters other than |
}
```
or:
```
if (strlen(str_replace('|', '', $string)) > 0) {
// string contains characters other than |
}
``` | Fastest and simplest way is possibly the stripos function. It returns the position of a string inside another, or false if it can't be found:
```
if (false === stripos($string, '|')) {
$string = null;
}
```
The `false ===` is needed for strict type comparison, since stripos could return a zero indicating that th... |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | ```
if (preg_match('/[^|]/', $string)) {
// string contains characters other than |
}
```
or:
```
if (strlen(str_replace('|', '', $string)) > 0) {
// string contains characters other than |
}
``` | I wanted to check if a string only contains certain characters. To prevent double negation (because I find them harder te read) I decided to use the following regex:
```
preg_match('/^[|]+$/', $string)
```
This checks a string from beginning to end to only contain `|` characters (at least one). |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | ```
if (preg_match('/[^|]/', $string)) {
// string contains characters other than |
}
```
or:
```
if (strlen(str_replace('|', '', $string)) > 0) {
// string contains characters other than |
}
``` | If the string has length after trimming pipes from the front of the string, then it has at least one non-pipe character.
```
if (strlen(ltrim($string, '|')) {
// has non-pipe characters
}
``` |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | Yes, you can use regular expressions:
```
if(! preg_match('/[^\|]/', $string)) {
$string = NULL;
}
``` | Fastest and simplest way is possibly the stripos function. It returns the position of a string inside another, or false if it can't be found:
```
if (false === stripos($string, '|')) {
$string = null;
}
```
The `false ===` is needed for strict type comparison, since stripos could return a zero indicating that th... |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | Yes, you can use regular expressions:
```
if(! preg_match('/[^\|]/', $string)) {
$string = NULL;
}
``` | If the string has length after trimming pipes from the front of the string, then it has at least one non-pipe character.
```
if (strlen(ltrim($string, '|')) {
// has non-pipe characters
}
``` |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | I wanted to check if a string only contains certain characters. To prevent double negation (because I find them harder te read) I decided to use the following regex:
```
preg_match('/^[|]+$/', $string)
```
This checks a string from beginning to end to only contain `|` characters (at least one). | Fastest and simplest way is possibly the stripos function. It returns the position of a string inside another, or false if it can't be found:
```
if (false === stripos($string, '|')) {
$string = null;
}
```
The `false ===` is needed for strict type comparison, since stripos could return a zero indicating that th... |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | If the string has length after trimming pipes from the front of the string, then it has at least one non-pipe character.
```
if (strlen(ltrim($string, '|')) {
// has non-pipe characters
}
``` | Fastest and simplest way is possibly the stripos function. It returns the position of a string inside another, or false if it can't be found:
```
if (false === stripos($string, '|')) {
$string = null;
}
```
The `false ===` is needed for strict type comparison, since stripos could return a zero indicating that th... |
10,248,107 | I need to check a string to determine if it contains any characters other than `|`, in order to assign those variables that have nothing except `|` a value of NULL (there could be theoretically any number of `|` characters but it likely will not be more than 5-6). Like `||||`
I could see looping through each character... | 2012/04/20 | [
"https://Stackoverflow.com/questions/10248107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/530585/"
] | I wanted to check if a string only contains certain characters. To prevent double negation (because I find them harder te read) I decided to use the following regex:
```
preg_match('/^[|]+$/', $string)
```
This checks a string from beginning to end to only contain `|` characters (at least one). | If the string has length after trimming pipes from the front of the string, then it has at least one non-pipe character.
```
if (strlen(ltrim($string, '|')) {
// has non-pipe characters
}
``` |
1,201,723 | My confusion is:
$(-9)^{2/3} = ((-9)^{2})^{1/3} = ((-9)^{(1/3)})^{2} = 4.32$
But my calculator shows math error, and google says:
$(-9)^{2/3} = 2.16+3.74i$ | 2015/03/22 | [
"https://math.stackexchange.com/questions/1201723",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/113769/"
] | When we want to take a number to an integer power, we can simply multiply repeatedly and/or take reciprocals. When we want to take a positive real number to an arbitrary power, we usually use logarithms.
---
**Logarithms and Exponentials**
When considering raising a positive real number, $a$, to an arbitrary power, ... | It is because it is showing one of the three possible roots, one of them being $4.32$, and the other two are $2.16 + 3.74i$ and its conjugate |
19,869,414 | Environment:
Windows 2008 R2, SQL Server 2008 SP1
Problem:
Table inner Join Query with 9 tables gets "Reason for Early Termination of Statement: TimeOut" in Actual Execution Plan.
Wrong Memory Grant is assigned.
Sorting was done in tempdb instead of ram even there is plenty of ram available.
Performance is slow... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19869414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1222172/"
] | Your issue is here:
```
if len(str) == 0 or 1 :
```
should be
```
if len(str) == 0 or len(str) == 1:
```
By just doing `if len(str) == 0 or 1` it is evaluating to `True` *always* as it is interpreted as `(len(str) == 0) or 1`
Also, I would rename `str` to something else, as `str` is a builtin type | Any function that calls itself is technically a recursive function.
Any function that checks its arguments for a "base case", and otherwise calls itself with a "smaller" version of its arguments, is a usefully recursive function.
Of course a recursive function can still be broken, or even pointless. For example, cons... |
19,869,414 | Environment:
Windows 2008 R2, SQL Server 2008 SP1
Problem:
Table inner Join Query with 9 tables gets "Reason for Early Termination of Statement: TimeOut" in Actual Execution Plan.
Wrong Memory Grant is assigned.
Sorting was done in tempdb instead of ram even there is plenty of ram available.
Performance is slow... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19869414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1222172/"
] | Your issue is here:
```
if len(str) == 0 or 1 :
```
should be
```
if len(str) == 0 or len(str) == 1:
```
By just doing `if len(str) == 0 or 1` it is evaluating to `True` *always* as it is interpreted as `(len(str) == 0) or 1`
Also, I would rename `str` to something else, as `str` is a builtin type | You don't need to do this recursively, but you can, particularly if you don't mind a lot of extra space and poor performance for long strings.
Here are two nonrecursive ways:
```
#!/usr/bin/python3
def is_palindrome1(string1):
string2_list = list(string1)
string2_list.reverse()
string2 = ''.join(string2_... |
17,704,189 | I found this example:
The Idea is to get the **checked** checkbox **value**, and use it further as avariable:
Maybe this example is not the best, but I only found this one as it is much closer to what I want.
See [FIDDLE](http://jsfiddle.net/vaKWs/6/)
```
<div id="pakker">
<input type="checkbox" checked="checked" v... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17704189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2591386/"
] | There is a good video on YouTube called [Building a geospatial processing pipeline using Hadoop and HBase with Monsanto](http://www.youtube.com/watch?v=_JCPf89s-NI) that describes one approach to integrating geospatial data with Hadoop and HBase. They combine GDAL with MapReduce "to convert all geospatial datasets to a... | Does [GIS Tools for Hadoop](http://esri.github.io/gis-tools-for-hadoop/) provide what you are looking for? |
17,704,189 | I found this example:
The Idea is to get the **checked** checkbox **value**, and use it further as avariable:
Maybe this example is not the best, but I only found this one as it is much closer to what I want.
See [FIDDLE](http://jsfiddle.net/vaKWs/6/)
```
<div id="pakker">
<input type="checkbox" checked="checked" v... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17704189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2591386/"
] | There is a good video on YouTube called [Building a geospatial processing pipeline using Hadoop and HBase with Monsanto](http://www.youtube.com/watch?v=_JCPf89s-NI) that describes one approach to integrating geospatial data with Hadoop and HBase. They combine GDAL with MapReduce "to convert all geospatial datasets to a... | In addition to Esri' GIS Tools for Hadoop <http://esri.github.io/gis-tools-for-hadoop/>. You can also check SpatialHadoop from CS Department at University of Minnesota <http://spatialhadoop.cs.umn.edu/> |
17,439,944 | In my project(working on Spring and hibernate) i need to keep around 22 HTML dropdown for a form, each dropdown have around 30,000+ entries every dropdown fetching data from database because of this page loading getting delayed (40+ sec) now i wanted to replace dropdown to similar function one, now i thought to keep au... | 2013/07/03 | [
"https://Stackoverflow.com/questions/17439944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210064/"
] | Rather than a `switch` statement, you'd probably be better off with:
```
RadioButton1.Checked = (val == 1);
RadioButton2.Checked = (val == 2);
RadioButton3.Checked = (val == 3);
// and so on ...
RadioButton10.Checked = (val == 10);
```
This way, everything gets set to `false` *except* for the `RadioButton` equal to ... | Assign groupname property to both the radiobuttons controls.
Radio buttons need to have identical group name property , if not they behave as checkboxes . |
26,939,019 | I know with Perl I can do things like this:
```
bash$> perl -e 'print "\x48"x40;'
=> HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
```
Trying to do this in Ruby:
```
bash$> ruby -e "40.times{ print("0x48") }"
=> 72727272727272727272727272727272727272727272727272727272727272727272727272727272
....
bash$> ruby -e "40.... | 2014/11/14 | [
"https://Stackoverflow.com/questions/26939019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2057388/"
] | If you're trying to print the ASCII character associated with a particular hex value like you did with Perl:
```
40.times{ print "\x48" }
# >> HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
```
or
```
print "\x48" * 40
# >> HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
```
That means you can do:
```
ruby -e 'print "\x48" *... | You can also use the following:
```
ruby -e "print('48'.hex.chr)"
``` |
51,590 | I chose SSL for registration in the game client. The client communicates with the game server which stores a salted/hashed password.
If I use SSL to authenticate users on login but the game does all of it's communication with UDP packets, how does the server know that the UDP packets it's receiving is from the authent... | 2014/02/15 | [
"https://security.stackexchange.com/questions/51590",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/38268/"
] | The safe method is to use [DTLS](http://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security): that's SSL/TLS applied to UDP.
The less safe method is to invent your own protocol. In this case, since you worry about authentication only, things would go that way:
* Client and server make some normal SSL and run an a... | I don't think you have something unclear. To make SSL authenticate, who is the certificate holder, client or the server?
It seems client holding the certificate is reasonable. In such case, server must have public key of this certificate. Thus an easy way to approach authentication is to encrypt the sequence number of ... |
1,110,783 | I successfully installed XAMPP on Mac OS X EL Capitan Version 10.11.1. Apache Server, ProFTPD and MySQL Database are running.
I followed XAMPP's How-to-guide to transfer files via the proFTPD server / configure FTP access, so I can also use a FTP client like Filezilla to access the htdocs/ subdirectory of the XAMPP in... | 2016/08/07 | [
"https://superuser.com/questions/1110783",
"https://superuser.com",
"https://superuser.com/users/627146/"
] | Thanks to all for helping.
Editing the proftpd.conf file did not work nor did work following the steps listed in the how-to-guides that asks you to use Terminal to chown and chmod files.
That's what did work for me in the end:
Enable Remote Login for Mac user profile
Don't use FTP and Port 21, but only SFTP and Po... | In FileZilla, select **Edit** > **Directory access permissions**.
Add the directories that you want FileZilla Pro to access. |
3,904,647 | For example the function
$$f(x) = \sum\frac{1}{2^n}\sin(2^nx)$$
we can see that the function uniformly converges
Can I know that the Fourier coefficients are $$\hat{f}(x)=\frac{1}{2^n}$$
if so why is that possible? | 2020/11/12 | [
"https://math.stackexchange.com/questions/3904647",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/848719/"
] | If $z=1+h$ with $h\in(0,\infty)$, then$$\frac{\overline z-1}{z-1}=\frac hh=1.$$This, together what you did, shows that the limit doesn't exist. | How about, approach along a diagonal?
$$ \lim\_{x \rightarrow 0} \frac{(1+x) - \mathrm{i}x - 1}{(1+x) + \mathrm{i}x - 1} = -\mathrm{i} \text{.} $$ |
3,904,647 | For example the function
$$f(x) = \sum\frac{1}{2^n}\sin(2^nx)$$
we can see that the function uniformly converges
Can I know that the Fourier coefficients are $$\hat{f}(x)=\frac{1}{2^n}$$
if so why is that possible? | 2020/11/12 | [
"https://math.stackexchange.com/questions/3904647",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/848719/"
] | Consider $z = 1 + \varepsilon i$, where $\varepsilon > 0$. Then $\frac{\overline z - 1}{z - 1} = -1.$
Now consider $z = 1 + \varepsilon$, where $\varepsilon > 0$. Then $\frac{\overline z - 1}{z-1} = 1$.
Clearly, $1 \neq -1$. | How about, approach along a diagonal?
$$ \lim\_{x \rightarrow 0} \frac{(1+x) - \mathrm{i}x - 1}{(1+x) + \mathrm{i}x - 1} = -\mathrm{i} \text{.} $$ |
4,414,885 | I have two local mercurial repos, let's call them product and skunkworks. Skunkworks is a clone of product and has a lot of recent commit activity against it. I need to be able to package up the diffs from one small part of the directory tree and pull those out as a patch file.
I've got the following layout on disk:
... | 2010/12/11 | [
"https://Stackoverflow.com/questions/4414885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3489/"
] | This can be done pretty easily, but first lemme suggest that the next time you're doing to independent bits of work (the build work and the rest of skunkworks) you do them in separate heads -- then you can push the buildwork directly to product using hg push w/o moving skunkworks over there too. That pattern would look... | I think all you want is to run in skunkworks `hg diff buildstuff -r <rev>` where `<rev>` is the last revision matching the product repo.
Below creates a number of files and directories representing the original repository:
```
C:\>hg init test
C:\>cd test
C:\test>echo >file1
C:\test>echo >file2
C:\test>md dir1
C:\tes... |
20,583,356 | I try to make a cloth designer application within a structure based on layers just like in the Photoshop app.
I'm using an image with alpha channel and beneath it I'm placing div with different background colors. As a result, I expect changing the color of the image.
But I don't have any idea how to put over that image... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20583356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1613791/"
] | A canvas should be fast, maybe the slowness has to do with algorithm in use.
But, if you tried with a canvas, it means that you are targeting modern browsers. So probably SVG will work :)
Changing the color with SVG is very easy (see <http://jsfiddle.net/diegof79/kkxP3/>):
```
<svg width="100" height="100">
<circl... | Another solution, with limited browser support, but very easy to implement, is to set the images with only a color but having the posibility to use saturation and luminance changes.
then apply
```
-webkit-filter: hue-rotate(xdeg);
```
To change to any color.
Doing the same, but with an svg filter, can have more su... |
20,583,356 | I try to make a cloth designer application within a structure based on layers just like in the Photoshop app.
I'm using an image with alpha channel and beneath it I'm placing div with different background colors. As a result, I expect changing the color of the image.
But I don't have any idea how to put over that image... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20583356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1613791/"
] | Thanks for everybody!
I solved my problem through the canvas.
I just used [**globalCompositeOperation**](https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html) property.
```
..
ctx.drawImage(original, 0, 0);
ctx.globalCompositeOperation = "source-in";
ctx.drawImage(fill, 0, 0);
ctx.global... | Another solution, with limited browser support, but very easy to implement, is to set the images with only a color but having the posibility to use saturation and luminance changes.
then apply
```
-webkit-filter: hue-rotate(xdeg);
```
To change to any color.
Doing the same, but with an svg filter, can have more su... |
29,383,044 | I am a beginner in c programming. I am trying to reference the following functions in an array function pointer as shown in processGrades 4 element array. I am having trouble getting the grades array 3 x 4 to pass through to the functions. I am trying to use pointers but I do not seem to be formating the pointer proper... | 2015/04/01 | [
"https://Stackoverflow.com/questions/29383044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4736576/"
] | The first argument type of the pointer is incorrect. You should change `int` to `int[][EXAMS]`. | Try this
```
typedef void (*processGrades)(int[][MAX], size_t, size_t);
``` |
69,716 | I am concerned that saying "Google" (גוגל) is chukat ha-goyim and that I should definitely be saying "Giggle" (גיגל) instead.
Kal v'chomer, I have heard many, l'havdil, Modern Orthodox and secular Jews saying "Google."
---
This question is [Purim Torah](http://en.wikipedia.org/wiki/Purim_Torah) and is not intended t... | 2016/03/25 | [
"https://judaism.stackexchange.com/questions/69716",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/1516/"
] | You ask a gitte shaileh und a gitte kasheh.
Mimaileh, it's nuhr a Hungarian yid that says "a Gigel." Sez nusich kulei alma to say "a Gugel."
Ba-soif, a yid should only mention Gugel to say that the internet is a treifene medineh, not chas ve shulem because a yid is surfink der web.
A Freilichen Shishin Pirim. | Among many Jews, for whom the internet is pas nisht, they don't know from "Google". So, if you said, "I'm looking for something on Google", they would think you meant to say you're looking for something in the kugel."
On the other hand, some people pronounce "kugel" as "kigel", so you could run into the same problem.
... |
69,716 | I am concerned that saying "Google" (גוגל) is chukat ha-goyim and that I should definitely be saying "Giggle" (גיגל) instead.
Kal v'chomer, I have heard many, l'havdil, Modern Orthodox and secular Jews saying "Google."
---
This question is [Purim Torah](http://en.wikipedia.org/wiki/Purim_Torah) and is not intended t... | 2016/03/25 | [
"https://judaism.stackexchange.com/questions/69716",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/1516/"
] | You ask a gitte shaileh und a gitte kasheh.
Mimaileh, it's nuhr a Hungarian yid that says "a Gigel." Sez nusich kulei alma to say "a Gugel."
Ba-soif, a yid should only mention Gugel to say that the internet is a treifene medineh, not chas ve shulem because a yid is surfink der web.
A Freilichen Shishin Pirim. | It's more hymish to say giggle but more heimish to say google |
69,716 | I am concerned that saying "Google" (גוגל) is chukat ha-goyim and that I should definitely be saying "Giggle" (גיגל) instead.
Kal v'chomer, I have heard many, l'havdil, Modern Orthodox and secular Jews saying "Google."
---
This question is [Purim Torah](http://en.wikipedia.org/wiki/Purim_Torah) and is not intended t... | 2016/03/25 | [
"https://judaism.stackexchange.com/questions/69716",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/1516/"
] | It's more hymish to say giggle but more heimish to say google | Among many Jews, for whom the internet is pas nisht, they don't know from "Google". So, if you said, "I'm looking for something on Google", they would think you meant to say you're looking for something in the kugel."
On the other hand, some people pronounce "kugel" as "kigel", so you could run into the same problem.
... |
15,716,188 | Im making a small loader for the game PSOBB but for the offline version, im lazy to go in a folder called "servers" and launch all 3 server executable files, so thats y im making this program. So my problem is that i made a button that launches the .exe from another folder (a sub dir).
```
private void startLoginServe... | 2013/03/30 | [
"https://Stackoverflow.com/questions/15716188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959933/"
] | You will need to use **Reflection**.
Have a look at the following code and references:
See here: [Set object property using reflection](https://stackoverflow.com/questions/619767/net-reflection-set-object-property)
Also, here: <http://www.dotnetspider.com/resources/19232-Set-Property-value-dynamically-using-Reflecti... | You could use `dynamic` properties. Which would mean that, `userControl.drModuleSettings` will be of type `dynamic`.
You can then assign it a value at runtime like
```
userControl.drModuleSettings = new {SomeProperty = "foo", AnotherProperty = "bar"};
```
More about dynamic keyword and DynamicObject [here](http://... |
55,857,134 | I am following [this](https://pytorch.org/tutorials/beginner/data_loading_tutorial.html) tutorial, and I stumbled upon something I don't understand.
The idea is to have a function, that plots an image. This function is then called in a loop where subplots are defined:
### minimal example
```
%matplotlib inline
impor... | 2019/04/25 | [
"https://Stackoverflow.com/questions/55857134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6817245/"
] | The reason you see several rows is that for each loop run a new figure is produced. Independent figures are placed below each other in a jupyter output cell.
This in turn is caused by the one from the last loop iteration being drawn on screen and hence when `plt.subplot` is called another time, no active figure is p... | I think it would work if you use `plt.show()` after the for loop but in JuPyTer notebook, the plotting is `inline`. A work around solution could be to use `time.sleep(0.001)`. You may try and see if it serves your purpose.
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import time
def s... |
371,647 | There is a circle $x^2+y^2=a^2$. On any line that cuts the circle in two distinct points(it is a secant), the points of intersection with circle are taken and at those two points I draw the tangents that intersect at some point, say $(\alpha,\beta)$. It's given that the tangents intersect at right angles at the point $... | 2013/04/24 | [
"https://math.stackexchange.com/questions/371647",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/62525/"
] | Spotted the mistake, sorry for assurance before.
You can't put $X=x-\alpha,Y=y-\beta$ before adding the leading coefficients to zero .
1)Using transforming back, your curve is no longer a homogenized curve .
2)That pair of lines will not for sure subtend a right angle at the origin formed by $(x,y)$ system . bcoz t... | Parameterize circle as $(a \cos \alpha, a \sin \alpha)$ with $\alpha \in \left[ 0 , 2 \pi \right]$, now the tangent vector is given as $(-a \sin \alpha , a \cos \alpha)$. Let the two points correspond to end of chord be at angle $\alpha$ and at angle $\beta$, then:
$$ (a \cos \alpha, a \sin \alpha) \cdot ( a \cos \bet... |
371,647 | There is a circle $x^2+y^2=a^2$. On any line that cuts the circle in two distinct points(it is a secant), the points of intersection with circle are taken and at those two points I draw the tangents that intersect at some point, say $(\alpha,\beta)$. It's given that the tangents intersect at right angles at the point $... | 2013/04/24 | [
"https://math.stackexchange.com/questions/371647",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/62525/"
] | You must be knowing that the director circle subtends right angle tangents to the the circle.
Here the director circle for [x^2 + y^2 = a^2] is [x^2 + y^2 = 2a^2] (you may prove it by simple geometry)
1.From an arbitary point on DC, P(a\*sqrt2\*cos(w),a\*sqrt2\*sin(w)) make a Chord Of Contact on original circle as T=0... | Parameterize circle as $(a \cos \alpha, a \sin \alpha)$ with $\alpha \in \left[ 0 , 2 \pi \right]$, now the tangent vector is given as $(-a \sin \alpha , a \cos \alpha)$. Let the two points correspond to end of chord be at angle $\alpha$ and at angle $\beta$, then:
$$ (a \cos \alpha, a \sin \alpha) \cdot ( a \cos \bet... |
15,567,315 | I have been told that I can use \* to make a width fill out the remaining space, ex. with several `div`s within another `div`.
It works when I write it in the code as well, but... I need a relevant source before I am allowed to use it in my semester project, can anyone help me out?
```
div {
width:*;
}
``` | 2013/03/22 | [
"https://Stackoverflow.com/questions/15567315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2198641/"
] | It is not valid to use `*`. See the [CSS3 spec](http://www.w3.org/TR/CSS21/visudet.html#propdef-width).
You can define `width` as an absolute value (like in pixels), percentage, `auto` or `inherit`.
Extract from the spec:
```
Values have the following meanings:
<length> - Specifies the width of the content area usi... | The asterisk (\*) character is a wildcard selector that will apply a set of styles to every element on the page. For example:
```
*
{
color:red;
}
```
The above will set the colour of the text of all elements on the page to "red".
Usually it is not a good idea to use it because it can take a while for the brows... |
15,567,315 | I have been told that I can use \* to make a width fill out the remaining space, ex. with several `div`s within another `div`.
It works when I write it in the code as well, but... I need a relevant source before I am allowed to use it in my semester project, can anyone help me out?
```
div {
width:*;
}
``` | 2013/03/22 | [
"https://Stackoverflow.com/questions/15567315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2198641/"
] | It is not valid to use `*`. See the [CSS3 spec](http://www.w3.org/TR/CSS21/visudet.html#propdef-width).
You can define `width` as an absolute value (like in pixels), percentage, `auto` or `inherit`.
Extract from the spec:
```
Values have the following meanings:
<length> - Specifies the width of the content area usi... | You can't use `*` on rules, when you're trying to do `width:*;`
You can use it in selectors though. When used on a selector it means "anything". For example, the following targets anything that has an `<li>` as an ancestor.
```
li * {
/* */
}
``` |
15,567,315 | I have been told that I can use \* to make a width fill out the remaining space, ex. with several `div`s within another `div`.
It works when I write it in the code as well, but... I need a relevant source before I am allowed to use it in my semester project, can anyone help me out?
```
div {
width:*;
}
``` | 2013/03/22 | [
"https://Stackoverflow.com/questions/15567315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2198641/"
] | You can't use `*` on rules, when you're trying to do `width:*;`
You can use it in selectors though. When used on a selector it means "anything". For example, the following targets anything that has an `<li>` as an ancestor.
```
li * {
/* */
}
``` | The asterisk (\*) character is a wildcard selector that will apply a set of styles to every element on the page. For example:
```
*
{
color:red;
}
```
The above will set the colour of the text of all elements on the page to "red".
Usually it is not a good idea to use it because it can take a while for the brows... |
22,476,942 | I have a form in my Rails app which contains a select. Each option in the select has a data attribute `data-contact` with additional info I want to use in Javascript. The info is in JSON format, so if you look in the HTML code it looks like this:
```
<option data-contact="{"street"=>"Postbus 123", "street_number"=>"12... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22476942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/481554/"
] | You want the contents of the first child of `h2` so try
```
$("p").text(function () {
return $("h2").prop('firstChild').nodeValue;
})
```
Demo: [Fiddle](http://jsfiddle.net/arunpjohny/DkSLs/) | You are getting the `<a>`'s text instead of the `<h2>`'s.
Corrected version:
```
$( "p" ).text(function(){
var h2 = $( "h2" );
h2.find( "a" ).remove();
return h2.text();
});
```
Corrected fiddle: <http://jsfiddle.net/3fptd/2/> |
22,476,942 | I have a form in my Rails app which contains a select. Each option in the select has a data attribute `data-contact` with additional info I want to use in Javascript. The info is in JSON format, so if you look in the HTML code it looks like this:
```
<option data-contact="{"street"=>"Postbus 123", "street_number"=>"12... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22476942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/481554/"
] | You want the contents of the first child of `h2` so try
```
$("p").text(function () {
return $("h2").prop('firstChild').nodeValue;
})
```
Demo: [Fiddle](http://jsfiddle.net/arunpjohny/DkSLs/) | Check out this
```
$( "p" ).text(function(){
header = $( "h2" ).find( "a" ).remove();
return $( "h2" ).text();
})
```
<http://jsfiddle.net/chetangawai/3fptd/5/> |
22,476,942 | I have a form in my Rails app which contains a select. Each option in the select has a data attribute `data-contact` with additional info I want to use in Javascript. The info is in JSON format, so if you look in the HTML code it looks like this:
```
<option data-contact="{"street"=>"Postbus 123", "street_number"=>"12... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22476942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/481554/"
] | You want the contents of the first child of `h2` so try
```
$("p").text(function () {
return $("h2").prop('firstChild').nodeValue;
})
```
Demo: [Fiddle](http://jsfiddle.net/arunpjohny/DkSLs/) | You got `<a>` removed becouse method remove delete the full element. That is what you were doing:
1. Get the text of `<a>` element.
2. Delete `<a>` element.
I think that's you asking for...
```
$( "p" ).text(function(){
var header = $("h2").text().split("Add new");
return header[0];
})
``` |
22,476,942 | I have a form in my Rails app which contains a select. Each option in the select has a data attribute `data-contact` with additional info I want to use in Javascript. The info is in JSON format, so if you look in the HTML code it looks like this:
```
<option data-contact="{"street"=>"Postbus 123", "street_number"=>"12... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22476942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/481554/"
] | You are getting the `<a>`'s text instead of the `<h2>`'s.
Corrected version:
```
$( "p" ).text(function(){
var h2 = $( "h2" );
h2.find( "a" ).remove();
return h2.text();
});
```
Corrected fiddle: <http://jsfiddle.net/3fptd/2/> | Check out this
```
$( "p" ).text(function(){
header = $( "h2" ).find( "a" ).remove();
return $( "h2" ).text();
})
```
<http://jsfiddle.net/chetangawai/3fptd/5/> |
22,476,942 | I have a form in my Rails app which contains a select. Each option in the select has a data attribute `data-contact` with additional info I want to use in Javascript. The info is in JSON format, so if you look in the HTML code it looks like this:
```
<option data-contact="{"street"=>"Postbus 123", "street_number"=>"12... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22476942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/481554/"
] | You are getting the `<a>`'s text instead of the `<h2>`'s.
Corrected version:
```
$( "p" ).text(function(){
var h2 = $( "h2" );
h2.find( "a" ).remove();
return h2.text();
});
```
Corrected fiddle: <http://jsfiddle.net/3fptd/2/> | You got `<a>` removed becouse method remove delete the full element. That is what you were doing:
1. Get the text of `<a>` element.
2. Delete `<a>` element.
I think that's you asking for...
```
$( "p" ).text(function(){
var header = $("h2").text().split("Add new");
return header[0];
})
``` |
22,476,942 | I have a form in my Rails app which contains a select. Each option in the select has a data attribute `data-contact` with additional info I want to use in Javascript. The info is in JSON format, so if you look in the HTML code it looks like this:
```
<option data-contact="{"street"=>"Postbus 123", "street_number"=>"12... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22476942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/481554/"
] | Check out this
```
$( "p" ).text(function(){
header = $( "h2" ).find( "a" ).remove();
return $( "h2" ).text();
})
```
<http://jsfiddle.net/chetangawai/3fptd/5/> | You got `<a>` removed becouse method remove delete the full element. That is what you were doing:
1. Get the text of `<a>` element.
2. Delete `<a>` element.
I think that's you asking for...
```
$( "p" ).text(function(){
var header = $("h2").text().split("Add new");
return header[0];
})
``` |
81,173 | When callenged to a duel by Voldemort in the graveyard in book 4, Harry swears to "go down fighting". And yet he uses his least offensive battle spell, not even trying to cause actual harm.
I don't mean he should've instantly resorted to Avada Kedavra, but even something like Stupefy would've gotten Voldemort out of ... | 2015/02/07 | [
"https://scifi.stackexchange.com/questions/81173",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/38452/"
] | I'd like to go a bit deeper into Richard's comment on his answer about being under pressure and on how Rowling constructed the scene.
In that particular scene, there's this very telling paragraph about what's going on in Harry's mind.
>
> ...Harry remembered,...the dueling club at Hogwarts he had attended briefly tw... | In short, it's because Harry doesn't use magic offensively (or when he does, he does so with extreme reluctance). Note that in all seven books, he never directly kills **anyone**.
Also, it's arguably his "signature spell". He feels very comfortable with it and knows precisely how to use it to best effect:
>
> *‘So y... |
81,173 | When callenged to a duel by Voldemort in the graveyard in book 4, Harry swears to "go down fighting". And yet he uses his least offensive battle spell, not even trying to cause actual harm.
I don't mean he should've instantly resorted to Avada Kedavra, but even something like Stupefy would've gotten Voldemort out of ... | 2015/02/07 | [
"https://scifi.stackexchange.com/questions/81173",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/38452/"
] | In short, it's because Harry doesn't use magic offensively (or when he does, he does so with extreme reluctance). Note that in all seven books, he never directly kills **anyone**.
Also, it's arguably his "signature spell". He feels very comfortable with it and knows precisely how to use it to best effect:
>
> *‘So y... | At the moment when Harry did cast the spell, he didn't think he has any chance to survive:
>
> And as he heard Voldemort draw nearer still, he knew one thing only, and it was beyond fear or reason: He was not going to die crouching here like a child playing hide-and-seek; he was not going to die kneeling at Voldemort... |
81,173 | When callenged to a duel by Voldemort in the graveyard in book 4, Harry swears to "go down fighting". And yet he uses his least offensive battle spell, not even trying to cause actual harm.
I don't mean he should've instantly resorted to Avada Kedavra, but even something like Stupefy would've gotten Voldemort out of ... | 2015/02/07 | [
"https://scifi.stackexchange.com/questions/81173",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/38452/"
] | I'd like to go a bit deeper into Richard's comment on his answer about being under pressure and on how Rowling constructed the scene.
In that particular scene, there's this very telling paragraph about what's going on in Harry's mind.
>
> ...Harry remembered,...the dueling club at Hogwarts he had attended briefly tw... | At the moment when Harry did cast the spell, he didn't think he has any chance to survive:
>
> And as he heard Voldemort draw nearer still, he knew one thing only, and it was beyond fear or reason: He was not going to die crouching here like a child playing hide-and-seek; he was not going to die kneeling at Voldemort... |
42,441,791 | Following the well accepted answer to this question [Do rvalue references allow dangling references?](https://stackoverflow.com/questions/3716277/do-rvalue-references-allow-dangling-references) It would seem that xvalues do not have their lifetime extended when assigned to a rvalue reference lvalue like in the question... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42441791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5501675/"
] | Lifetime extension doesn't care about value categories. As stated by [class.temporary]/p6:
>
> The temporary to which the reference is bound or the temporary that is the complete object of a **subobject to which the reference is bound** persists for the lifetime of the reference
>
>
>
Emphasis added.
This says n... | >
> If value categories do not determine when the lifetime of an rvalue will be extended then what does? I am having a hard time understanding when the lifetime of an rvalue is extended in C++
>
>
>
Note that value categories describe *expressions* not objects. Value categories ( xvalue, prvalue, or whatever ) won... |
5,765 | In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much
* Falls (almost literally) into the trap set for him
* Loses a duel against Darth Vader
* Loses his (father's) lightsaber
* Gets his hand crudely amputated
And
* Is barely saved by those he came to rescue
So my... | 2011/09/23 | [
"https://scifi.stackexchange.com/questions/5765",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2841/"
] | In Luke's force vision he saw bad outcomes for both Han and Leia. By going to Cloud City he changed that vision, because Leia was ultimately able to escape with the help of Lando. If Luke hadn't shown up for the trap, something probably would have happened to Leia. Certainly if Vader wasn't preoccupied with waiting for... | Cloud City is an unmitigated disaster from Luke's POV. Well, almost unmitigated; he survives. As DampeS8N comments, Yoda tried to stop him. Yoda knew Luke wasn't ready to face Vader. Not skilled enough in the Force and not emotionally ready.
That which doesn't kill us makes us stronger, so the saying goes. It is absol... |
5,765 | In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much
* Falls (almost literally) into the trap set for him
* Loses a duel against Darth Vader
* Loses his (father's) lightsaber
* Gets his hand crudely amputated
And
* Is barely saved by those he came to rescue
So my... | 2011/09/23 | [
"https://scifi.stackexchange.com/questions/5765",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2841/"
] | Cloud City is an unmitigated disaster from Luke's POV. Well, almost unmitigated; he survives. As DampeS8N comments, Yoda tried to stop him. Yoda knew Luke wasn't ready to face Vader. Not skilled enough in the Force and not emotionally ready.
That which doesn't kill us makes us stronger, so the saying goes. It is absol... | Not really. As Obi-Wan said to Luke on Dagobah when Yoda died "You accomplished little by rushing back prematurely. Luke then said "But I had to help my friends".. Obi-wan said "And did you help them?? It was they who had to save you"
Obi-Wan then further explained that that event was all part of his training. But as ... |
5,765 | In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much
* Falls (almost literally) into the trap set for him
* Loses a duel against Darth Vader
* Loses his (father's) lightsaber
* Gets his hand crudely amputated
And
* Is barely saved by those he came to rescue
So my... | 2011/09/23 | [
"https://scifi.stackexchange.com/questions/5765",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2841/"
] | Luke learned the truth about Darth Vader being his father. I don't know that there's any reason to think that Yoda or Obi-Wan were ever going to tell him, having kept it from him for so long.
And getting his hand cut off gave him empathy with his father at a key point during their confrontation. When Luke cuts off his... | Not really. As Obi-Wan said to Luke on Dagobah when Yoda died "You accomplished little by rushing back prematurely. Luke then said "But I had to help my friends".. Obi-wan said "And did you help them?? It was they who had to save you"
Obi-Wan then further explained that that event was all part of his training. But as ... |
5,765 | In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much
* Falls (almost literally) into the trap set for him
* Loses a duel against Darth Vader
* Loses his (father's) lightsaber
* Gets his hand crudely amputated
And
* Is barely saved by those he came to rescue
So my... | 2011/09/23 | [
"https://scifi.stackexchange.com/questions/5765",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2841/"
] | He showed that he valued his friends over completing his Jedi training and thus, supposedly he values them more than learning the powers he would need to defeat Vader. To me, this shows that he was on the right path, balancing the desires of his heart (Annakin's downfall) over the strict adherence to Jedi rules (Yoda's... | Luke literally accomplished Act Two. Star Wars is not only a trilogy, but a tragedy, even a tragic comedy, in a very traditional sense. ANH sets the premise and introduces the protagonist and other characters. Empire is the second act, in which the protagonist reaches his or her lowest point in a dramatic way. Jedi bri... |
5,765 | In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much
* Falls (almost literally) into the trap set for him
* Loses a duel against Darth Vader
* Loses his (father's) lightsaber
* Gets his hand crudely amputated
And
* Is barely saved by those he came to rescue
So my... | 2011/09/23 | [
"https://scifi.stackexchange.com/questions/5765",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2841/"
] | If Luke had stayed with Yoda, perhaps the princess and Chewbacca would have saved Han in time.
Precious moments are wasted while the bounty hunter is firing at Luke and the princess is warning him of the imminent trap. Shortly thereafter, Lando frees Chewbacca and the princess, but they arrive to the launch pad just ... | Not really. As Obi-Wan said to Luke on Dagobah when Yoda died "You accomplished little by rushing back prematurely. Luke then said "But I had to help my friends".. Obi-wan said "And did you help them?? It was they who had to save you"
Obi-Wan then further explained that that event was all part of his training. But as ... |
5,765 | In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much
* Falls (almost literally) into the trap set for him
* Loses a duel against Darth Vader
* Loses his (father's) lightsaber
* Gets his hand crudely amputated
And
* Is barely saved by those he came to rescue
So my... | 2011/09/23 | [
"https://scifi.stackexchange.com/questions/5765",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2841/"
] | Luke learned the truth about Darth Vader being his father. I don't know that there's any reason to think that Yoda or Obi-Wan were ever going to tell him, having kept it from him for so long.
And getting his hand cut off gave him empathy with his father at a key point during their confrontation. When Luke cuts off his... | Given that Lando aided in their escape and they managed to do just that.....Luke's arrival didn't do much. But serve as a lesson for what Yoda had duly warned; Do not take the easy way. By suspending his training he fought against a clearly superior opponent and lost.
In Joseph Campbells Hero of a thousand faces, the s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.