qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
148,103 | [](https://i.stack.imgur.com/VlYZM.png)
I have a fictional world, consisting of a federation of 17 provinces (in blue on the map extract). Currently, it is in the late 1920's. The Dzevogurski and Quidthovitse provinces are on the brink of war. H... | 2019/05/31 | [
"https://worldbuilding.stackexchange.com/questions/148103",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/6500/"
] | **It depends**
I would say that if the question is purely about semantics, we do not have an internationally accepted definition of civil war. I think that the conflict between two provinces in a federation is not a civil war. Presumably, there is some sort of a federal government, and it's not taking part in it in th... | There are plenty of historical examples to confirm that such conflicts can exist. Provinces of the [Ottoman Empire](https://en.m.wikipedia.org/wiki/Ottoman_Empire) frequently feuded with each other. And in the US there was the third [Pennamite War](https://en.m.wikipedia.org/wiki/Pennamite%E2%80%93Yankee_War) between P... |
148,103 | [](https://i.stack.imgur.com/VlYZM.png)
I have a fictional world, consisting of a federation of 17 provinces (in blue on the map extract). Currently, it is in the late 1920's. The Dzevogurski and Quidthovitse provinces are on the brink of war. H... | 2019/05/31 | [
"https://worldbuilding.stackexchange.com/questions/148103",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/6500/"
] | There are plenty of historical examples to confirm that such conflicts can exist. Provinces of the [Ottoman Empire](https://en.m.wikipedia.org/wiki/Ottoman_Empire) frequently feuded with each other. And in the US there was the third [Pennamite War](https://en.m.wikipedia.org/wiki/Pennamite%E2%80%93Yankee_War) between P... | Yes, it is not only possible to have neutral parties in internal conflicts, it has happened historically.
This would probably classified as a [Low Intensity Conflicts](https://en.wikipedia.org/wiki/Low_intensity_conflict) due to the localized nature and limited scale of fighting. While "Low Intensity" might not seem t... |
148,103 | [](https://i.stack.imgur.com/VlYZM.png)
I have a fictional world, consisting of a federation of 17 provinces (in blue on the map extract). Currently, it is in the late 1920's. The Dzevogurski and Quidthovitse provinces are on the brink of war. H... | 2019/05/31 | [
"https://worldbuilding.stackexchange.com/questions/148103",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/6500/"
] | **It depends**
I would say that if the question is purely about semantics, we do not have an internationally accepted definition of civil war. I think that the conflict between two provinces in a federation is not a civil war. Presumably, there is some sort of a federal government, and it's not taking part in it in th... | Yes, it is not only possible to have neutral parties in internal conflicts, it has happened historically.
This would probably classified as a [Low Intensity Conflicts](https://en.wikipedia.org/wiki/Low_intensity_conflict) due to the localized nature and limited scale of fighting. While "Low Intensity" might not seem t... |
69,850,831 | I have a dataframe which looks something like the following (for example):
```
set.seed(42) ## for sake of reproducibility
n <- 6
dat <- data.frame(date=seq.Date(as.Date("2020-12-26"), as.Date("2020-12-31"), "day"),
category=rep(LETTERS[1:2], n/2),
daily_count=sample(18:100, n, rep... | 2021/11/05 | [
"https://Stackoverflow.com/questions/69850831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17033294/"
] | In this answer:
* I've created a much bigger sample
* I'm using `yearmonth` from `tsibble` for simplicity
* I've solved the issue with the vertical line
* I cleaned up a bit the use of labs for a cleaner code
```r
set.seed(42)
dates <- seq.Date(as.Date("2012-08-01"), as.Date("2014-08-30"), "day")
n <- length(dates)
d... | I think there is no need to do any "expansion"... This in NOT my solution, but a modified solution by @dario. I think the problem was in aesthetics.
```
ggplot(dat, aes(y=daily_count,
x=date,
fill=category)) +
geom_boxplot() +
labs(x = 'Month & Year', ylab= 'Count', fill = "Category... |
13,612,837 | I'm using boost::regex to parse some formatting string where '%' symbol is escape character. Because I do not have much experience with boost::regex, and with regex at all to be honest I do some trial and error. This code is some kind of prototype that I came up with.
```
std::string regex_string =
"(?:%d... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13612837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1788633/"
] | You can use [`boost::sub_match::matched`](http://www.boost.org/doc/libs/release/libs/regex/doc/html/boost_regex/ref/sub_match.html#boost_regex.sub_match.matched) bool member:
```
if(match[index_of_time_group].matched) process_it(match);
```
It is also possible to use named groups in regexp like: `(?<name_of_group>.*... | Dynamically build `regex_string` from pairs of name/pattern, and return a name->index mapping as well as the regex. Then write some code that determines if the match comes from a given name.
If you are insane, you can do it at compile time (the mapping from tag to index that is). It isn't worth it. |
38,817 | In Windows Vista, whenever I open a folder, the selection of columns is nonsensical: album, date taken, etc., for folders that contain no music or pictures whatsoever. I can select the correct columns for a particular folder, but all the other folders are still wrong, even when I go in to Folder Options and click the b... | 2009/09/10 | [
"https://superuser.com/questions/38817",
"https://superuser.com",
"https://superuser.com/users/10624/"
] | eZine Article: [Setup a Default Folder View in Windows Vista](http://ezinearticles.com/?Solved---Setup-a-Default-Folder-View-in-Windows-Vista!&id=1465143) talks about some registry stuff along with the points in `Daniel`'s answer. Below is from this link
>
> One of the problems many people face once they have install... | First you set the columns the way you want in one folder, then on the Tools menu (`Alt`+`t` if the menu is hidden by default), click Folder Options... and then go to the View tab, click Apply to Folders. After confirming, you will see that all your folders (at least of that type) have been changed.
PS. Thanks for aski... |
38,817 | In Windows Vista, whenever I open a folder, the selection of columns is nonsensical: album, date taken, etc., for folders that contain no music or pictures whatsoever. I can select the correct columns for a particular folder, but all the other folders are still wrong, even when I go in to Folder Options and click the b... | 2009/09/10 | [
"https://superuser.com/questions/38817",
"https://superuser.com",
"https://superuser.com/users/10624/"
] | First you set the columns the way you want in one folder, then on the Tools menu (`Alt`+`t` if the menu is hidden by default), click Folder Options... and then go to the View tab, click Apply to Folders. After confirming, you will see that all your folders (at least of that type) have been changed.
PS. Thanks for aski... | See this article from annoyances.org : ["Default Folder Template Patch"](http://www.annoyances.org/exec/show/choosetemplate), which says:
>
> Windows Vista has a bug that prevents
> it from choosing the correct view for
> a folder based on its contents, which
> is why you may see thumbnails when
> they're not app... |
38,817 | In Windows Vista, whenever I open a folder, the selection of columns is nonsensical: album, date taken, etc., for folders that contain no music or pictures whatsoever. I can select the correct columns for a particular folder, but all the other folders are still wrong, even when I go in to Folder Options and click the b... | 2009/09/10 | [
"https://superuser.com/questions/38817",
"https://superuser.com",
"https://superuser.com/users/10624/"
] | eZine Article: [Setup a Default Folder View in Windows Vista](http://ezinearticles.com/?Solved---Setup-a-Default-Folder-View-in-Windows-Vista!&id=1465143) talks about some registry stuff along with the points in `Daniel`'s answer. Below is from this link
>
> One of the problems many people face once they have install... | See this article from annoyances.org : ["Default Folder Template Patch"](http://www.annoyances.org/exec/show/choosetemplate), which says:
>
> Windows Vista has a bug that prevents
> it from choosing the correct view for
> a folder based on its contents, which
> is why you may see thumbnails when
> they're not app... |
113,574 | In D&D 5th edition, there is a continuity among the spells that deal with returning life to the dead. Virtually all of them require an expenditure of diamond or diamond dust.
* **Revivify** diamonds worth 300 gp
* **Raise Dead** diamond worth at least 500 gp
* **Resurrection** a diamond worth at least 1,000 gp
* **Tr... | 2018/01/17 | [
"https://rpg.stackexchange.com/questions/113574",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/28927/"
] | Yes, some material components are thematically related to types of spells
-------------------------------------------------------------------------
I found [this spreadsheet](https://docs.google.com/spreadsheets/d/1KSibOeWub0_f79GYSnMu7om8kWwog1ob8dRY9LLoDAE/edit#gid=0) from this [reddit post](https://www.reddit.com/r... | Thanks to someone on Reddit doing most of the legwork ([here](https://www.reddit.com/r/DnD/comments/5fz3k0/spreadsheet_all_material_spell_components_in_dd_5e/)), I found a couple common themes for components:
1. Water is a common component for water and ice spells (surprising, I know). See *conjure elemental (water), ... |
38,461,449 | My Mac app has an NSMenu whose delegate functions `validateMenuItem` and `menuWillOpen` are never called. So far none of the solutions online have helped.
It seems like I'm doing everything right:
* The menu item's selectors are in the same class.
* The class managing it inherits from NSMenuDelegate
I suppose the be... | 2016/07/19 | [
"https://Stackoverflow.com/questions/38461449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3517395/"
] | `menuWillOpen:` belongs to the `NSMenuDelegate` protocol; for it to be called the menu in question needs a delegate:
```
let statusBarMenu = NSMenu(title: "")
statusBarMenu.delegate = self
```
---
`validateMenuItem:` belongs to the `NSMenuValidation` informal protocol; for it to be called the relevant menu *items* ... | The above (accepted) answer states that a target *must* be set, is a bit misleading. It is not required to set a target. You can (for example) also make the first responder, without explicitly setting a target.
Details can be found in the appel documentation, which can be found here: <https://developer.apple.com/libr... |
10,858,505 | I'm trying to run around 15000 soap requests through JMeter. I have 15000 individual soap files in a folder.
I know that the [WebService(SOAP) Request](http://jmeter.apache.org/usermanual/component_reference.html#WebService%28SOAP%29_Request) component has the option to point to a folder.
But, the problem is that the... | 2012/06/01 | [
"https://Stackoverflow.com/questions/10858505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/499635/"
] | I would use [the JSR223 Sampler](http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler) to run a script (e.g. Groovy) to iterate through the files in the directory and store the text of each file in a String.
See, for example, [this other answer](https://stackoverflow.com/a/9733568/62667) about u... | You could put the data into a csv file and read it in using a CSV Data Set Config. If you need unique values over multiple threads then you have to create multiple files, one per thread.
You could also put the data in a database and use a JDBC Config/Sampler to access it, making sure to either a: delete the data after... |
64,231,141 | For tableviews, I have never had an issue with a text label persisting after a cell is reused.
When you reload a tableview after the datasource has changed, the tableviewcells get the latest data and draw themselves accordingly.
However, I am now having this problem with an attributed label. After removing an item fr... | 2020/10/06 | [
"https://Stackoverflow.com/questions/64231141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6631314/"
] | I just stumbled upon the exact same issue with `NSUnderlineStyleAttributeName`. I have to underline some text in a `UILabel` inside a `UITableViewCell` only if a condition is met. After scrolling through the cell, the label keeps reusing the attributes.
I tried several workaround, by setting `label.text` and `label.at... | `label.attributedText` will have styling properties of the string as well.
Before reusing, I mean before setting the `attributedText` property even once, the styling property would be set to default. If you use a `xib/storyboard`, you can see the default style for the label in attribute inspector or if you have edited... |
22,934,720 | I have a problem about create a query for text-searching starting at begining of column character. For example: I have a table 'BOOK' with a column 'TITLE'. I have 3 rows in 'BOOK' table with 'TITLE' values are: 'ANDROID APPLICATION', 'ANDROID APP DEVELOPMENT' and 'ANDROID APPLICATION PROGRAMMING'.
Now when my input ... | 2014/04/08 | [
"https://Stackoverflow.com/questions/22934720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1679361/"
] | FTS cannot search from the beginning of a column value.
(Actually, it can, but this is undocumented and not enabled in Android.)
To search from the beginning, you have to use `LIKE 'pattern%'`.
If you want this to be efficient, you have to use this with a normal table and a case-insensitive index ([COLLATE NOCASE](htt... | Try below:
```
String name = your book name which entered by search box;
String sql ="select "+TITLE+" from "+BOOK+" where TITLE like '"+ name +"%'";
``` |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | Formally it would be "the city from which you came", "the city whence you came" (except that 'whence' is definitely archaic), "your native city", or perhaps "your city of origin" or "original city".
Colloquially, in a sentence I would say "The city you came from" instead of "The city where you came from". If I were wr... | Erm. Isn't it "The city THAT you come from?" as in "The city that you originate from".
The other way is practically an innuendo.
[This may be my tenuous grasp of english afforded by being a Mancunian.] |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | If this is a form field in an application (to make it vaguely programming related :-) ), "Country of origin" seems to me more natural. | In *spoken* US English, it's fine with or without `where` -- **but** I wouldn't use either on a website. **Here's why**:
I am a native US English speaker. I would only say `I come from America` if I was traveling in another country, or if I had moved to another country and was THERE ALREADY. I would never say it while... |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | Where is required for written English (UK), but would commonly be dropped in spoken (colloquial) English. | In *spoken* US English, it's fine with or without `where` -- **but** I wouldn't use either on a website. **Here's why**:
I am a native US English speaker. I would only say `I come from America` if I was traveling in another country, or if I had moved to another country and was THERE ALREADY. I would never say it while... |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | **The city from which you came.**
"From" is a preposition. It's a grammatical error to end a sentence with a preposition.
However, used in the context of an input form, "[City or Country] of Origin" would be more suitable. | The complete form would be `The city from which you come`. As it's a relative clause with the pronoun as its object, you can leave it out. ("contact clause") |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | Erm. Isn't it "The city THAT you come from?" as in "The city that you originate from".
The other way is practically an innuendo.
[This may be my tenuous grasp of english afforded by being a Mancunian.] | In *spoken* US English, it's fine with or without `where` -- **but** I wouldn't use either on a website. **Here's why**:
I am a native US English speaker. I would only say `I come from America` if I was traveling in another country, or if I had moved to another country and was THERE ALREADY. I would never say it while... |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | Formally it would be "the city from which you came", "the city whence you came" (except that 'whence' is definitely archaic), "your native city", or perhaps "your city of origin" or "original city".
Colloquially, in a sentence I would say "The city you came from" instead of "The city where you came from". If I were wr... | In *spoken* US English, it's fine with or without `where` -- **but** I wouldn't use either on a website. **Here's why**:
I am a native US English speaker. I would only say `I come from America` if I was traveling in another country, or if I had moved to another country and was THERE ALREADY. I would never say it while... |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | Formally it would be "the city from which you came", "the city whence you came" (except that 'whence' is definitely archaic), "your native city", or perhaps "your city of origin" or "original city".
Colloquially, in a sentence I would say "The city you came from" instead of "The city where you came from". If I were wr... | I believe the way you have it is correct - "where" is optional. |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | **The city from which you came.**
"From" is a preposition. It's a grammatical error to end a sentence with a preposition.
However, used in the context of an input form, "[City or Country] of Origin" would be more suitable. | Erm. Isn't it "The city THAT you come from?" as in "The city that you originate from".
The other way is practically an innuendo.
[This may be my tenuous grasp of english afforded by being a Mancunian.] |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | **The city from which you came.**
"From" is a preposition. It's a grammatical error to end a sentence with a preposition.
However, used in the context of an input form, "[City or Country] of Origin" would be more suitable. | In *spoken* US English, it's fine with or without `where` -- **but** I wouldn't use either on a website. **Here's why**:
I am a native US English speaker. I would only say `I come from America` if I was traveling in another country, or if I had moved to another country and was THERE ALREADY. I would never say it while... |
872,891 | I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail:
**The country [where] you come from.**
The question is: is this "where" needed there, can be used there (optional) or cannot ... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62830/"
] | Where is required for written English (UK), but would commonly be dropped in spoken (colloquial) English. | I believe the way you have it is correct - "where" is optional. |
37,727 | As we all know that Upanishads were written to understand Vedas. Some great scholars also said that they are the branches of Vedas. My question is related to it. Yesterday in a library, I was reading some books and then I found a book written by Dr. Surendra KR Sharma. The name of the book was in Hindi **Kya baloo ki b... | 2020/01/04 | [
"https://hinduism.stackexchange.com/questions/37727",
"https://hinduism.stackexchange.com",
"https://hinduism.stackexchange.com/users/19001/"
] | We should also read the next verse (1:1:6) in continuation for understanding Mundak Upanishad 1.1.5
Please [read the following](https://www.swami-krishnananda.org/mundak1/mundak1_1.html):
>
> We cannot go to the Veda directly and understand anything out of it
> unless we are proficient in these six auxiliary shastr... | The Upanishad verse in question refers to the Vedas interpreted only ritualistically, as inferior. It does not negate the importance of Vedic knowledge itself. Because we see the same Upanishad talk about the Vedas in high regard.
2.1.6:
>
> तस्मादृचः साम यजूंषि दीक्षा यज्ञाश्च सर्वे क्रतवो दक्षिणाश्च
>
>
> Fr... |
37,727 | As we all know that Upanishads were written to understand Vedas. Some great scholars also said that they are the branches of Vedas. My question is related to it. Yesterday in a library, I was reading some books and then I found a book written by Dr. Surendra KR Sharma. The name of the book was in Hindi **Kya baloo ki b... | 2020/01/04 | [
"https://hinduism.stackexchange.com/questions/37727",
"https://hinduism.stackexchange.com",
"https://hinduism.stackexchange.com/users/19001/"
] | The Vedas are divisible into two parts which are [Purva Mimamsa](https://en.wikipedia.org/wiki/M%C4%ABm%C4%81%E1%B9%83s%C4%81) or Karma Mimamsa dealing with rituals for Dharma, Artha, Kama and Gyana Kanda or Uttara Mimamsa/Upanishads for Moksha. Dharma, Artha, Kama and Moksha together are [Purusartha](https://en.wikipe... | The Upanishad verse in question refers to the Vedas interpreted only ritualistically, as inferior. It does not negate the importance of Vedic knowledge itself. Because we see the same Upanishad talk about the Vedas in high regard.
2.1.6:
>
> तस्मादृचः साम यजूंषि दीक्षा यज्ञाश्च सर्वे क्रतवो दक्षिणाश्च
>
>
> Fr... |
37,727 | As we all know that Upanishads were written to understand Vedas. Some great scholars also said that they are the branches of Vedas. My question is related to it. Yesterday in a library, I was reading some books and then I found a book written by Dr. Surendra KR Sharma. The name of the book was in Hindi **Kya baloo ki b... | 2020/01/04 | [
"https://hinduism.stackexchange.com/questions/37727",
"https://hinduism.stackexchange.com",
"https://hinduism.stackexchange.com/users/19001/"
] | Vedic karma Kanda and Jnana Kanda are both far below spiritual experience.
>
> They study the Vedas and discuss. **But they do not realize the Ultimate
> Reality just as a spoon does not know the taste of food**.
>
>
> The head
> carries the flowers, the nose knows the scent. The people study the
> Vedas. But, very... | The Upanishad verse in question refers to the Vedas interpreted only ritualistically, as inferior. It does not negate the importance of Vedic knowledge itself. Because we see the same Upanishad talk about the Vedas in high regard.
2.1.6:
>
> तस्मादृचः साम यजूंषि दीक्षा यज्ञाश्च सर्वे क्रतवो दक्षिणाश्च
>
>
> Fr... |
34,102,231 | Good evening!
I'm a beginner programmer and am finishing up my first semester of C++. Currently I'm looking a final exam review sheet my professor gave us and I just don't understand exactly what it's asking me to do. I feel like if I saw an example I would get it immediately but as is I am rather lost.
Here's the re... | 2015/12/05 | [
"https://Stackoverflow.com/questions/34102231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5026229/"
] | Think of the credit card as the real world object. And it will have the attributes of name,number,limit.
So, you have to do is set the values of these each in the constructor method, as because when we create a credit card we have these values assigned to them, like this
```
CreditCard::CreditCard(string & no, string ... | This code is the definition of a class, the blueprint of an object. It is an introduction to the strong object-oriented programming of C++ and contains some key concepts.
You have the elements of a basic object.
```
class CreditCard {
public:
// Constructor.(to construct an object).
CreditCard(... |
34,102,231 | Good evening!
I'm a beginner programmer and am finishing up my first semester of C++. Currently I'm looking a final exam review sheet my professor gave us and I just don't understand exactly what it's asking me to do. I feel like if I saw an example I would get it immediately but as is I am rather lost.
Here's the re... | 2015/12/05 | [
"https://Stackoverflow.com/questions/34102231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5026229/"
] | Strictly speaking, the C++ language doesn't have "methods". It has "member functions", and perhaps that's the terminology that you're more familiar with. But many other languages do use the term "method", so it's actually fairly common for C++ programmers to say "methods" when what they're really talking about is membe... | Think of the credit card as the real world object. And it will have the attributes of name,number,limit.
So, you have to do is set the values of these each in the constructor method, as because when we create a credit card we have these values assigned to them, like this
```
CreditCard::CreditCard(string & no, string ... |
34,102,231 | Good evening!
I'm a beginner programmer and am finishing up my first semester of C++. Currently I'm looking a final exam review sheet my professor gave us and I just don't understand exactly what it's asking me to do. I feel like if I saw an example I would get it immediately but as is I am rather lost.
Here's the re... | 2015/12/05 | [
"https://Stackoverflow.com/questions/34102231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5026229/"
] | Strictly speaking, the C++ language doesn't have "methods". It has "member functions", and perhaps that's the terminology that you're more familiar with. But many other languages do use the term "method", so it's actually fairly common for C++ programmers to say "methods" when what they're really talking about is membe... | This code is the definition of a class, the blueprint of an object. It is an introduction to the strong object-oriented programming of C++ and contains some key concepts.
You have the elements of a basic object.
```
class CreditCard {
public:
// Constructor.(to construct an object).
CreditCard(... |
20,950,967 | I know that `UNIQUE` can be used for unique value on table creating.
I read in a database management book that
>
> When we apply UNIQUE to a subquery, the
> resulting condition returns true if no row appears twice in the answer to the
> subquery that is, there are no duplicates; in particular, it returns true if ... | 2014/01/06 | [
"https://Stackoverflow.com/questions/20950967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2040375/"
] | `UNIQUE` is defined by *SQL92* Section 8.9: `<unique predicate> ::= UNIQUE <table subquery>` so it certainly exists but is not widely supported by vendors.
As an alternative you could use EXISTS with a HAVING COUNT. | The UNIQUE constraint is typically used for defining table based constraints.
You should consider using `Select Distinct` for queries.
The following link provides details regarding the `Unique` and `Distinct` keywords.
<http://psoug.org/definition/DISTINCT.htm> |
37,866,905 | I'm wondering in which format the compiled source code of an program written (in C or Rust for example) will result.
I know that the output file is a binary coded file in machine language (like every handbook and documentation explains). I thought that opening the file with an editor of my choice like VIM should show ... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37866905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2349787/"
] | Found the solution:
```
OkHttpClient client = new OkHttpClient.Builder().proxy(proxyTest).build();
```
If we use the builder to input the proxy, it will work like a charm =D | okhttp version:`3.11.0`. SOCKS proxy example
```
String hostname = "localhost"/*127.0.0.1*/;
int port = 1080;
Proxy proxy = new Proxy(Proxy.Type.SOCKS,
new InetSocketAddress(hostname, port));
OkHttpClient client = new OkHttpClient.Builder()
.proxy(proxy)
.build();
``` |
37,866,905 | I'm wondering in which format the compiled source code of an program written (in C or Rust for example) will result.
I know that the output file is a binary coded file in machine language (like every handbook and documentation explains). I thought that opening the file with an editor of my choice like VIM should show ... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37866905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2349787/"
] | Found the solution:
```
OkHttpClient client = new OkHttpClient.Builder().proxy(proxyTest).build();
```
If we use the builder to input the proxy, it will work like a charm =D | SOCKS5 Auth example
I think it's the easiest working soulution. But it seems to me that it can be not 100% safe. I took this code from this code [from here](https://stackoverflow.com/a/16340273/9466638) and modified it because my proxy's RequestorType is SERVER.
Actually, java has a strange api for proxies, you shoul... |
19,280,494 | ```
<html>
<head></head>
<body>
<h1>Welcome to Our Website!</h1>
<hr/>
<h2>News</h2>
<h4><?=$data['title'];?></h4>
<p><?=$data['content'];?></p>
</body>
</html>
```
Can anyone tell me what's the "=" ... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19280494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2802552/"
] | `<?=$a?>` is the shortcut for `<? echo $a ?>`, they are called "short tags" in PHP terminology
Check PHP documentation [Escaping from HTML](http://www.php.net/manual/en/language.basic-syntax.phpmode.php) example #2 3rd item, and related ini setting [short-open-tag](http://www.php.net/manual/en/ini.core.php#ini.short-o... | This tag is interpreted as `<?php echo`.
You can check it by writing `<?= ?>`, you'll receive error. |
576,538 | So, a little background. I work for a company that has a number of extremely important, non-public facing websites. People's safety and livelihoods depend on these staying up. We have very little downtime, but there are always catastrophic situations that mean restoring from bare metal.
Our current setup is inadequate... | 2014/02/18 | [
"https://serverfault.com/questions/576538",
"https://serverfault.com",
"https://serverfault.com/users/209899/"
] | * Leverage VMware SRM, or at least VMware Replication. It will drastically reduce the amount of time it takes you to come online in a secondary datacenter. (Hyper-V Replica and HVRM are the equivalent in the Microsoft stack.
* Separate your front-end from your back-end. It sounds like you need a web tier and a database... | I've seen the second setup more often than the first, especially when your DR site doesn't have the same capacity as your primary site. However, I think this question isn't really appropriate for SF, since it's very much opinion based (although I'm not going to flag it as such since I see some value to the question). |
54,910,019 | I am new to Angular and I have two collapse div elements and when I click on button1 then div element-1 need to collapse and element-2 need to be hide.
And when I click button2 then div element-2 need to collapse and element-1 need to be hide, but it's not working using below code.
```
<div class="container">
<h2>S... | 2019/02/27 | [
"https://Stackoverflow.com/questions/54910019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5571461/"
] | Try using single quote marks inside the ternary
```
<div
class='@(Model.HeroBannerImageSmall ? "--imageSmall" : "--image")'
style='@(Model.isSelected ? "background-position-x:@Model.CropPositionX" % "background-position-y:@Model.CropPositionY"&; : "background-position:@Model.UniformCropPosition"&;')
backgroun... | You've gotta mix and match your single and double quotes to make this work! For example:
```
class='@(Model.HeroBannerImageSmall ? "--imageSmall" : "--image")'
```
Potentially might be easier to read if you pulled it out into a code branch ahead of the div. ie:
```
@{
var imageClass = Model.HeroBannerImageSmall... |
50,574,593 | I am trying to do a simple thing , navigate to an external url
```
<a href="http://18.217.228.108/angularapp1/book/"> Class Books </a>
```
However I am getting a 404 because the Http// portion is being deleted I am not sure if this is an mvc thing or html thing. Here is link <http://18.217.228.108/angularapp1>.
H... | 2018/05/28 | [
"https://Stackoverflow.com/questions/50574593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8066170/"
] | I do not agree to the formula "after certain number of words".
Note that the first target line has 4 words, whereas remaining 2 have
5 words each.
Actually you need to replace each comma and following sequence of
spaces (if any) with a comma and `\n`.
So the intuitive way to do it is:
```
$x =~ s/,\s*/,\n/g;
``` | You probably want to use regular expressions. You can do this:
```
$x =~ s/^(\S+\s+){3}\K/\n/;
```
Or if this is about the commas and not the spaces:
```
$x =~ s/^([^,]+,+){2}\s*\K/\n/;
```
(in this case I also remove any potential space that would be after the comma)
You can also configure separately how many w... |
50,574,593 | I am trying to do a simple thing , navigate to an external url
```
<a href="http://18.217.228.108/angularapp1/book/"> Class Books </a>
```
However I am getting a 404 because the Http// portion is being deleted I am not sure if this is an mvc thing or html thing. Here is link <http://18.217.228.108/angularapp1>.
H... | 2018/05/28 | [
"https://Stackoverflow.com/questions/50574593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8066170/"
] | The simplest way is to split the string on `comma followed by a space` and then
join the word groups with a `comma followed by a newline`.
```
my $x = "This a variable, start a new line here, This is a new line.";
print join(",\n", split /, /, $x) . "\n";
```
**output**
```
This a variable,
start a new line here,... | You probably want to use regular expressions. You can do this:
```
$x =~ s/^(\S+\s+){3}\K/\n/;
```
Or if this is about the commas and not the spaces:
```
$x =~ s/^([^,]+,+){2}\s*\K/\n/;
```
(in this case I also remove any potential space that would be after the comma)
You can also configure separately how many w... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | This doesn't fit case 3 exactly, but I don't know if any of your cases capture a very common problem used to teach dynamic programming: [Matrix Chain Multiplication](http://en.wikipedia.org/wiki/Matrix_chain_multiplication).
To solve this problem, (and many others, this is just the canonical one) we fill up the matrix ... | This is exactly not the search space you are looking for but i've an idea of the top of my head which might be of help.
**Problem :**
Given a $n × n$ matrix say, $M$ with distinct integers in which the entries of each row (from left to right) and each column (from top to bottom) are both sorted in increasing order an... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | There are plenty of other examples of dynamic programming algorithms that don't fit your pattern at all.
* The longest increasing subsequence problem requires only a one-dimensional table.
* There are several natural dynamic programming algorithms whose tables require three or even more dimensions. For example: Find t... | This is exactly not the search space you are looking for but i've an idea of the top of my head which might be of help.
**Problem :**
Given a $n × n$ matrix say, $M$ with distinct integers in which the entries of each row (from left to right) and each column (from top to bottom) are both sorted in increasing order an... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | I know its a silly example, but I think a simple iterative problem like
>
> Find the sum of the numbers in a square matrix
>
>
>
might qualify. The the traditional "for each row for each column" kinda looks like your case 3. | This is exactly not the search space you are looking for but i've an idea of the top of my head which might be of help.
**Problem :**
Given a $n × n$ matrix say, $M$ with distinct integers in which the entries of each row (from left to right) and each column (from top to bottom) are both sorted in increasing order an... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | Computing Ackermann function is in this spirit. To compute $A(m,n)$ you need to know $A(m,n-1)$ and $A(m-1,k)$ for some large $k$. Either the second coordinate decreases, or the first decreases, and second potentially increases.
This does not ideally fit the requirements, since the number of columns is infinite, and t... | This is exactly not the search space you are looking for but i've an idea of the top of my head which might be of help.
**Problem :**
Given a $n × n$ matrix say, $M$ with distinct integers in which the entries of each row (from left to right) and each column (from top to bottom) are both sorted in increasing order an... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | There are plenty of other examples of dynamic programming algorithms that don't fit your pattern at all.
* The longest increasing subsequence problem requires only a one-dimensional table.
* There are several natural dynamic programming algorithms whose tables require three or even more dimensions. For example: Find t... | This doesn't fit case 3 exactly, but I don't know if any of your cases capture a very common problem used to teach dynamic programming: [Matrix Chain Multiplication](http://en.wikipedia.org/wiki/Matrix_chain_multiplication).
To solve this problem, (and many others, this is just the canonical one) we fill up the matrix ... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | This doesn't fit case 3 exactly, but I don't know if any of your cases capture a very common problem used to teach dynamic programming: [Matrix Chain Multiplication](http://en.wikipedia.org/wiki/Matrix_chain_multiplication).
To solve this problem, (and many others, this is just the canonical one) we fill up the matrix ... | I know its a silly example, but I think a simple iterative problem like
>
> Find the sum of the numbers in a square matrix
>
>
>
might qualify. The the traditional "for each row for each column" kinda looks like your case 3. |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | There are plenty of other examples of dynamic programming algorithms that don't fit your pattern at all.
* The longest increasing subsequence problem requires only a one-dimensional table.
* There are several natural dynamic programming algorithms whose tables require three or even more dimensions. For example: Find t... | I know its a silly example, but I think a simple iterative problem like
>
> Find the sum of the numbers in a square matrix
>
>
>
might qualify. The the traditional "for each row for each column" kinda looks like your case 3. |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | There are plenty of other examples of dynamic programming algorithms that don't fit your pattern at all.
* The longest increasing subsequence problem requires only a one-dimensional table.
* There are several natural dynamic programming algorithms whose tables require three or even more dimensions. For example: Find t... | Computing Ackermann function is in this spirit. To compute $A(m,n)$ you need to know $A(m,n-1)$ and $A(m-1,k)$ for some large $k$. Either the second coordinate decreases, or the first decreases, and second potentially increases.
This does not ideally fit the requirements, since the number of columns is infinite, and t... |
196 | I have been working on dynamic programming for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/item/default.asp?ttype... | 2012/03/10 | [
"https://cs.stackexchange.com/questions/196",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/98/"
] | Computing Ackermann function is in this spirit. To compute $A(m,n)$ you need to know $A(m,n-1)$ and $A(m-1,k)$ for some large $k$. Either the second coordinate decreases, or the first decreases, and second potentially increases.
This does not ideally fit the requirements, since the number of columns is infinite, and t... | I know its a silly example, but I think a simple iterative problem like
>
> Find the sum of the numbers in a square matrix
>
>
>
might qualify. The the traditional "for each row for each column" kinda looks like your case 3. |
28,872,375 | ```
SQL> desc invoices
Name Null? Type
----------------------------------------- -------- ----------------------------
INVOICE_ID NOT NULL NUMBER(6)
COMPANY_ID NUMBER(6)
STUDENT_ID ... | 2015/03/05 | [
"https://Stackoverflow.com/questions/28872375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4592364/"
] | you have to enter an existed `STUDENT_ID` from `students` table and an existed `COMPANY_ID` from `compaies` table to invoices.
Consider you have data like next
```
COMPANY_ID COMPANY_NAME ADDRESS CONTACT_NO NO_OF_EMP
----------- ------------ -------- ---------- ---------
1 Bl... | You need to first enter companies in "companies", and students in "students". Then use those ID's for [what1] and [what2] |
28,872,375 | ```
SQL> desc invoices
Name Null? Type
----------------------------------------- -------- ----------------------------
INVOICE_ID NOT NULL NUMBER(6)
COMPANY_ID NUMBER(6)
STUDENT_ID ... | 2015/03/05 | [
"https://Stackoverflow.com/questions/28872375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4592364/"
] | you have to enter an existed `STUDENT_ID` from `students` table and an existed `COMPANY_ID` from `compaies` table to invoices.
Consider you have data like next
```
COMPANY_ID COMPANY_NAME ADDRESS CONTACT_NO NO_OF_EMP
----------- ------------ -------- ---------- ---------
1 Bl... | [what1] is ID of COMPANY\_ID
[what2] is ID of STUDENT\_ID
if table Student and Company are empty, you must Insert the record to both tables before Insert |
20,319,813 | In my for loop, my code generates a list like this one:
```
list([0.0,0.0]/sum([0.0,0.0]))
```
The loop generates all sort of other number vectors but it also generates `[nan,nan]`, and to avoid it I tried to put in a conditional to prevent it like the one below, but it doesn't return true.
```
nan in list([0.0,0.... | 2013/12/02 | [
"https://Stackoverflow.com/questions/20319813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1610626/"
] | I think this makes sense because of your pulling `numpy` into scope indirectly via the star import.
```
>>> import numpy as np
>>> [0.0,0.0]/0
Traceback (most recent call last):
File "<ipython-input-3-aae9e30b3430>", line 1, in <module>
[0.0,0.0]/0
TypeError: unsupported operand type(s) for /: 'list' and 'int'
... | You should use the [`math`](http://docs.python.org/2/library/math.html) module.
```
>>> import math
>>> math.isnan(item)
``` |
20,319,813 | In my for loop, my code generates a list like this one:
```
list([0.0,0.0]/sum([0.0,0.0]))
```
The loop generates all sort of other number vectors but it also generates `[nan,nan]`, and to avoid it I tried to put in a conditional to prevent it like the one below, but it doesn't return true.
```
nan in list([0.0,0.... | 2013/12/02 | [
"https://Stackoverflow.com/questions/20319813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1610626/"
] | You should use the [`math`](http://docs.python.org/2/library/math.html) module.
```
>>> import math
>>> math.isnan(item)
``` | May be this is what you are looking for...
```
a = [2,3,np.nan]
b = True if True in np.isnan(np.array(a)) else False
print(b)
``` |
20,319,813 | In my for loop, my code generates a list like this one:
```
list([0.0,0.0]/sum([0.0,0.0]))
```
The loop generates all sort of other number vectors but it also generates `[nan,nan]`, and to avoid it I tried to put in a conditional to prevent it like the one below, but it doesn't return true.
```
nan in list([0.0,0.... | 2013/12/02 | [
"https://Stackoverflow.com/questions/20319813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1610626/"
] | I think this makes sense because of your pulling `numpy` into scope indirectly via the star import.
```
>>> import numpy as np
>>> [0.0,0.0]/0
Traceback (most recent call last):
File "<ipython-input-3-aae9e30b3430>", line 1, in <module>
[0.0,0.0]/0
TypeError: unsupported operand type(s) for /: 'list' and 'int'
... | May be this is what you are looking for...
```
a = [2,3,np.nan]
b = True if True in np.isnan(np.array(a)) else False
print(b)
``` |
109,317 | I have been reading quite a bit in order to make the following choice: which path-finding solution should one implement in a game where the world proceduraly generated, of really large dimensions?
Here is how I see the main solutions and their pros/cons:
1) grid-based path-finding - this is the only option that would... | 2015/10/06 | [
"https://gamedev.stackexchange.com/questions/109317",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/72314/"
] | Given that the rooms are procedural built, portals created and then populated, I have a couple of ideas.
A\* works really well on navigation meshes, and works hierarchically as well. I would consider building a pathfinding system that works at two levels - first, the room by room level, and second within each room, fr... | I'm going to take a stab and recommend a **hierarchical pathfinding algorithm**, such as [**HPA\***](http://aigamedev.com/open/review/near-optimal-hierarchical-pathfinding/). Even though I'm not an expert in AI, I'm fairly confident in this guess because your generator sounds almost identical to [the one in a game I'm ... |
44,179,585 | I have installed LAMP in CentOS 7
When I placed my files in the default directory (var/www/html in my case)
I receive the following when I access my page:
>
> Erreur : PB de connexion au serveur mysql de la langue : fr
> Erreur : PB de connexion � la base de donn�es de la langue : fr
> Erreur SQL : SELECT \* FROM... | 2017/05/25 | [
"https://Stackoverflow.com/questions/44179585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8064758/"
] | It seems using a simple `import 'angular-ui-router'` works. | You can set `allowSyntheticDefaultImports` to true in your `tsconfig.json` to continue importing `import uibootstrap from 'angular-ui-bootstrap';` as if `angular-ui-bootstrap` had a default export.
```
"compilerOptions": {
"allowSyntheticDefaultImports": true
}
``` |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | I need the same functionality. At the moment I'm considering reading using data from NSLocale as default, but adding a setting in settings.app for user to customise this if it does not match.
This function is taken from [an answer to another question of mine](https://stackoverflow.com/questions/2639684/itunes-music-st... | You should probably use
```
[[userDefaults dictionaryRepresentation] objectForKey:@"NSLocaleCode"];
```
This will return a language code like en\_US or en\_UK or en\_AU or even zh\_CN, zh\_MY, jp\_JP and so on.
Parse the correct codes which you support and direct them accordingly. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | The approach of getting the country code of the user's locale will work ... but only if the user's iTunes store is the same as their locale. This won't always be the case.
If you create an in-app purchase item, you can use Apple's StoreKit APIs to find out the user's actual iTunes country even if it's different from ... | A hard way to get this function is to set up up a single app for every app store country. Each app holds it's own country store information. This assumes, that a user sticks to one store, which should be true for most people. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | I suggest you try iTunes [deep links](http://developer.apple.com/iphone/appstore/marketing.html#deeplinks). For example, <http://itunes.com/apps/appname> should take the user to the local App Store where she spends money. | You should probably use
```
[[userDefaults dictionaryRepresentation] objectForKey:@"NSLocaleCode"];
```
This will return a language code like en\_US or en\_UK or en\_AU or even zh\_CN, zh\_MY, jp\_JP and so on.
Parse the correct codes which you support and direct them accordingly. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | The approach of getting the country code of the user's locale will work ... but only if the user's iTunes store is the same as their locale. This won't always be the case.
If you create an in-app purchase item, you can use Apple's StoreKit APIs to find out the user's actual iTunes country even if it's different from ... | I need the same functionality. At the moment I'm considering reading using data from NSLocale as default, but adding a setting in settings.app for user to customise this if it does not match.
This function is taken from [an answer to another question of mine](https://stackoverflow.com/questions/2639684/itunes-music-st... |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | The approach of getting the country code of the user's locale will work ... but only if the user's iTunes store is the same as their locale. This won't always be the case.
If you create an in-app purchase item, you can use Apple's StoreKit APIs to find out the user's actual iTunes country even if it's different from ... | I suggest you try iTunes [deep links](http://developer.apple.com/iphone/appstore/marketing.html#deeplinks). For example, <http://itunes.com/apps/appname> should take the user to the local App Store where she spends money. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | So far you can use 2 methods with their pros and cons:
**StoreFront**
->SDK >= 13
->The **three-letter** code representing the country associated with the App Store storefront
```
if let storeFront = SKPaymentQueue.default().storefront{
print("StoreFront CountryCode = ", storeFront.countryCode)
}
else {
p... | You should probably use
```
[[userDefaults dictionaryRepresentation] objectForKey:@"NSLocaleCode"];
```
This will return a language code like en\_US or en\_UK or en\_AU or even zh\_CN, zh\_MY, jp\_JP and so on.
Parse the correct codes which you support and direct them accordingly. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | So far you can use 2 methods with their pros and cons:
**StoreFront**
->SDK >= 13
->The **three-letter** code representing the country associated with the App Store storefront
```
if let storeFront = SKPaymentQueue.default().storefront{
print("StoreFront CountryCode = ", storeFront.countryCode)
}
else {
p... | A hard way to get this function is to set up up a single app for every app store country. Each app holds it's own country store information. This assumes, that a user sticks to one store, which should be true for most people. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | So far you can use 2 methods with their pros and cons:
**StoreFront**
->SDK >= 13
->The **three-letter** code representing the country associated with the App Store storefront
```
if let storeFront = SKPaymentQueue.default().storefront{
print("StoreFront CountryCode = ", storeFront.countryCode)
}
else {
p... | I suggest you try iTunes [deep links](http://developer.apple.com/iphone/appstore/marketing.html#deeplinks). For example, <http://itunes.com/apps/appname> should take the user to the local App Store where she spends money. |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | Since iOS 13.0, Apple introduced the [SKStorefront](https://developer.apple.com/documentation/storekit/skstorefront) API.
It allows you to check the current AppStore country the user is connected to.
>
> **SKStorefront**: An object containing the location and unique identifier of an Apple App Store storefront.
>
> ... | I need the same functionality. At the moment I'm considering reading using data from NSLocale as default, but adding a setting in settings.app for user to customise this if it does not match.
This function is taken from [an answer to another question of mine](https://stackoverflow.com/questions/2639684/itunes-music-st... |
2,540,530 | I'd like to be able to determine which store the user connects to from inside my app, so that I can direct them to some appropriate content for their device AND store. Does anyone know how to get this information?
Basically, if the user is in the UK, and connects to the UK store, I want my function/method to return GB... | 2010/03/29 | [
"https://Stackoverflow.com/questions/2540530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186184/"
] | So far you can use 2 methods with their pros and cons:
**StoreFront**
->SDK >= 13
->The **three-letter** code representing the country associated with the App Store storefront
```
if let storeFront = SKPaymentQueue.default().storefront{
print("StoreFront CountryCode = ", storeFront.countryCode)
}
else {
p... | I need the same functionality. At the moment I'm considering reading using data from NSLocale as default, but adding a setting in settings.app for user to customise this if it does not match.
This function is taken from [an answer to another question of mine](https://stackoverflow.com/questions/2639684/itunes-music-st... |
36,312,509 | I wanted to first say this is a really nice plugin (<https://github.com/katzer/cordova-plugin-local-notifications>) but having some difficulties getting it working.
I am using an Android and Phonegap CLI. I have tried both CLI 5.0 and now Phonegap 3.5.0, this is my config.xml:
`<preference name="phonegap-version" val... | 2016/03/30 | [
"https://Stackoverflow.com/questions/36312509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/596952/"
] | I too have spent many hours trying to get this plugin working & I have, but i do find it to be one of the most temperamental.
Within your js -
```
var testNotifications = function () {
document.addEventListener("deviceready", function () {
console.warn("testNotifications Started");
// Checks for permission
... | **Answer 1 :for version 3.5.0**
have a look at [plugin's plugin.xml](https://github.com/katzer/cordova-plugin-local-notifications/blob/master/plugin.xml). see line 22
```
<engine name="cordova" version=">=3.6.0" />
```
that means plugin **only supports version greater than 3.6.0** and you are using 3.5.0
**Ans... |
6,319 | Ever since upgrading to Google Maps 5.1.0 on my Droid X, I have often had Google Maps bog down and freeze to the point of completely crashing the phone. Anyone else seeing this crash? Anyone find a solution? | 2011/02/23 | [
"https://android.stackexchange.com/questions/6319",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/3078/"
] | You can usually uninstall updates from the app's page in the market. However, previous updates to Google Maps had similar problems for users that never turned their phones off. Try just restarting your phone. | Another option is to go to `Settings` -> `Applications` -> `Manage applications` -> `All` (tab at top) -> `Maps` -> `Clear data` and/or `Clear cache`.
If somehow something is corrupted in there, this will more-or-less reset things as if Google Maps was just installed but was never used. |
6,319 | Ever since upgrading to Google Maps 5.1.0 on my Droid X, I have often had Google Maps bog down and freeze to the point of completely crashing the phone. Anyone else seeing this crash? Anyone find a solution? | 2011/02/23 | [
"https://android.stackexchange.com/questions/6319",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/3078/"
] | You can usually uninstall updates from the app's page in the market. However, previous updates to Google Maps had similar problems for users that never turned their phones off. Try just restarting your phone. | Upgrade to Google Maps 5.2.1, released today. |
6,319 | Ever since upgrading to Google Maps 5.1.0 on my Droid X, I have often had Google Maps bog down and freeze to the point of completely crashing the phone. Anyone else seeing this crash? Anyone find a solution? | 2011/02/23 | [
"https://android.stackexchange.com/questions/6319",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/3078/"
] | Upgrade to Google Maps 5.2.1, released today. | Another option is to go to `Settings` -> `Applications` -> `Manage applications` -> `All` (tab at top) -> `Maps` -> `Clear data` and/or `Clear cache`.
If somehow something is corrupted in there, this will more-or-less reset things as if Google Maps was just installed but was never used. |
11,385,214 | By default Gson uses fields as a basis for it's serialization. Is there a way to get it to use accessors instead? | 2012/07/08 | [
"https://Stackoverflow.com/questions/11385214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1089998/"
] | The developers of Gson [say](https://groups.google.com/forum/#!topic/google-gson/4G6Lv9PghUY) that they never felt swayed by the requests to add this feature and they were worried about murkying up the api to add support for this.
One way of adding this functionality is by using a TypeAdapter (I apologize for the gna... | **Note:** I'm the [**EclipseLink JAXB (MOXy)**](http://www.eclipse.org/eclipselink/moxy.php) lead and a member of the [**JAXB (JSR-222)**](http://jcp.org/en/jsr/detail?id=222) expert group.
If you can't get Gson to do what you want, below is how you can accomplish this using MOXy's native JSON binding. MOXy like any J... |
21,006,390 | I need to consume the services of a number of third party systems on my applications homepage. The data pertaining to these downstream systems are updated at different intervals and ideally my system will surface the latest data. It's not a scalable solution for my system to generate requests to each of these downstrea... | 2014/01/08 | [
"https://Stackoverflow.com/questions/21006390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24481/"
] | Have the method accept an expression, just as the method you're passing it to does:
```
public class Foo
{
public void UpdateEmployeeOrders(IEnumerable<Employee> employees,
Expression<Func<Employee, object>> selector)
{
foreach (var employee in employees)
{
UpdateSpecificEm... | You have the answer in your answer... you're using lambdas... so pass a delegate in your method.
```
public void SaveEmployeeDisplayOrder<T>(ICollection<Employee> employees, Func<Employee, T> fetchProperty)
{
//some code
foreach( var employee in employees)
{
UpdateSpecificEmployeeOrder(employee.id, fe... |
60,362 | I'm coming from an understanding of the continuous-time Fourier Transform, and the effects of doing a DFT and the inverse DFT are mysterious to me.
I have created a noiseless signal as:
```
import numpy as np
def f(x):
return x*(x-0.8)*(x+1)
X = np.linspace(-1,1,50)
y = f(X)
```
Now, if I were to perform a *c... | 2019/08/26 | [
"https://dsp.stackexchange.com/questions/60362",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/33763/"
] | Let me summarize my understanding of what you're trying to do. You have a real-valued sequence $x[n]$, obtained by sampling a real-valued continuous function, and you computed its DFT $X[k]$. The sequence can be expressed in terms of its DFT coefficients:
$$x[n]=\frac{1}{N}\sum\_{k=0}^{N-1}X[k]e^{j2\pi nk/N},\qquad n\... | I have looked at your image (and didn't read the post) and its explanation is as follows.
Let the data in the blue curve be $x[n]$, and the data in the red curve be $y[n]$; then it can be seen and shown that:
$$y[n] = \tfrac12 ( x[n] + (-1)^n x[n] ) $$
In the DTFT domain this relationship becomes :
$$ Y(e^{j\omega}... |
7,060 | recently I bought 3 solar panels rated at 5V 200 mA each. I want to use them to charge a 5V battery bank to charge a phone. Thinking about the proper way to put them, I thought i can connect all in parallel to get maximum current, but realized that if the sun light was a little weak it will no generate full 5v thus pre... | 2016/01/23 | [
"https://engineering.stackexchange.com/questions/7060",
"https://engineering.stackexchange.com",
"https://engineering.stackexchange.com/users/1736/"
] | Putting a single panel in series with two other panels that are in parallel does not accomplish what you think it does. The overall current of such a setup is limited by the single panel to 200 mA, so the three panels will not produce any more power than you'd get by just putting two panels in series.
A single solar c... | That's a mess, and your labels about what is + and what is - out of each panel seem inconsistant.
For the most effective use of the panels, wire them all in series. That will put out around 15 V under full sun. Now use a buck converter to make a regulated 5 V from that.
There are many buck converter chips available o... |
73,665,822 | Currently struggling to add the .is-active class to my header via javascript. If you add "is-active" to the header classes it works well. But I can't seem to work it out in javascript.
I just want the class to be added as soon as you start scrolling, and then removed when returning to the top.
Appreciate all the help... | 2022/09/09 | [
"https://Stackoverflow.com/questions/73665822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17472782/"
] | Try this code:
```
window.addEventListener("scroll", function(){
var header = document.querySelector(".header");
header.classList.toggle("is-active", window.scrollY > 0);
})
``` | Try to use more semantic HTML, this will help you in building the site.
```
<div class="menu">
<ul>
<li><a href="#home">Home</a></li>
</ul>
</div>
<section id="home">
<div class="wrapper">
</div>
</section>
```
---
You can also add some initial CSS settings to help you build your site, like ... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | Suppose you throw a ball up into the air. You could ask how the ball manages to move upwards when gravity is pulling it down, and the answer is that it started with an upwards velocity. Gravity pulls on the ball and slows it down so it will eventually reach a maximum height and fall back, but the ball manages to move u... | update: the accepted answer has now been updated to make my answer superfluous.
**we totally don't know.**
we don't know why the universe started expanding at the beginning of time. we basically just shrug and say "it seems like there was this big bang". your question seems to imply that gravity should have stopped t... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | update: the accepted answer has now been updated to make my answer superfluous.
**we totally don't know.**
we don't know why the universe started expanding at the beginning of time. we basically just shrug and say "it seems like there was this big bang". your question seems to imply that gravity should have stopped t... | Everything is measured with atoms (upon atomic properties)
oooooo < these are atoms in the lab now
|\_\_\_\_\_| This space at left is $\approx 5\ $ units long .
**OOOOOO** < the very same atoms in the past
radiated at longer wavelengths (redshifted).
|\_\_\_\_\_| This space at left is $\approx 3.5\ $ units ... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | Something the other answers don't really delve into is this: **Space itself is what's expanding**
Let's think about a regular Newtonian Spacetime with zero expansion, borrowing Jim's example of a car on the road. You're sitting completely still, as is a friend you're following on a roadtrip, with about a hundred feet ... | Everything is measured with atoms (upon atomic properties)
oooooo < these are atoms in the lab now
|\_\_\_\_\_| This space at left is $\approx 5\ $ units long .
**OOOOOO** < the very same atoms in the past
radiated at longer wavelengths (redshifted).
|\_\_\_\_\_| This space at left is $\approx 3.5\ $ units ... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | update: the accepted answer has now been updated to make my answer superfluous.
**we totally don't know.**
we don't know why the universe started expanding at the beginning of time. we basically just shrug and say "it seems like there was this big bang". your question seems to imply that gravity should have stopped t... | >
> How can the universe expand if there is gravitation?
>
>
>
Because gravity alters the motion of light and matter through space. But *it doesn't make space fall down*.
>
> We live in an expanding universe - so I'm told. But how can that be possible?
>
>
>
Because the expanding universe is something like ... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | Something the other answers don't really delve into is this: **Space itself is what's expanding**
Let's think about a regular Newtonian Spacetime with zero expansion, borrowing Jim's example of a car on the road. You're sitting completely still, as is a friend you're following on a roadtrip, with about a hundred feet ... | The attraction of any two objects is proportional to the product of their masses times the distance between them squared. This force always accelerates the objects toward each other. But that "distance between them squared" term means that the force drops off faster than the velocity does. This means that any two objec... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | update: the accepted answer has now been updated to make my answer superfluous.
**we totally don't know.**
we don't know why the universe started expanding at the beginning of time. we basically just shrug and say "it seems like there was this big bang". your question seems to imply that gravity should have stopped t... | The attraction of any two objects is proportional to the product of their masses times the distance between them squared. This force always accelerates the objects toward each other. But that "distance between them squared" term means that the force drops off faster than the velocity does. This means that any two objec... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | Ok I am no professional physicist, so feel free to scrap this if you want to, but as I have had explained to me: the expansion of space is the phenomenon that distances increase, *without* relating to any motion.
It is the space in between atoms and galaxies that gets "stretched", not that objects "move" away from ea... | I would like to start by clarifying a couple of misconceptions you have.
1)Everything is NOT attracted to a "**bigger** thing". Everything IS attracted to **everything**.
2)For the expansion of our universe to be caused by a "bigger thing," the thing would have to be a "shell" bigger than our universe, and the sh... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | Something the other answers don't really delve into is this: **Space itself is what's expanding**
Let's think about a regular Newtonian Spacetime with zero expansion, borrowing Jim's example of a car on the road. You're sitting completely still, as is a friend you're following on a roadtrip, with about a hundred feet ... | update: the accepted answer has now been updated to make my answer superfluous.
**we totally don't know.**
we don't know why the universe started expanding at the beginning of time. we basically just shrug and say "it seems like there was this big bang". your question seems to imply that gravity should have stopped t... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | After the Big Bang, the universe was left already expanding. Imagine sitting in a car. You step on the gas and get it to top speed. Then you put it in neutral and turn off the engine. What happens? You keep moving forward. But why? The car can't take off by itself. Friction should prevent it from moving. This answer is... | Ok I am no professional physicist, so feel free to scrap this if you want to, but as I have had explained to me: the expansion of space is the phenomenon that distances increase, *without* relating to any motion.
It is the space in between atoms and galaxies that gets "stretched", not that objects "move" away from ea... |
276,351 | We live in an expanding universe - so I'm told. But how can that be possible? Everything imaginable is attracted by a bigger thing. So, why can't gravitation stop the expansion of the universe? I know the "Big Bang" theory, but is it possible that the expansion of the universe is caused by the attraction of a bigger ob... | 2016/08/25 | [
"https://physics.stackexchange.com/questions/276351",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45820/"
] | Suppose you throw a ball up into the air. You could ask how the ball manages to move upwards when gravity is pulling it down, and the answer is that it started with an upwards velocity. Gravity pulls on the ball and slows it down so it will eventually reach a maximum height and fall back, but the ball manages to move u... | Something the other answers don't really delve into is this: **Space itself is what's expanding**
Let's think about a regular Newtonian Spacetime with zero expansion, borrowing Jim's example of a car on the road. You're sitting completely still, as is a friend you're following on a roadtrip, with about a hundred feet ... |
2,798,089 | I would need to get tweets from my twitter account on my wordpress site. Okey, the basics i could do, but there is one special need. I would need to get only certain tweets. Tweets that have some #hashstag for example only tweets with hashtag #myss would show up on my wordpress site.
Is there ready made plugin for thi... | 2010/05/09 | [
"https://Stackoverflow.com/questions/2798089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336676/"
] | The twitter API is pretty good at doing this sort of thing.
You could use the Twitter Search API to construct a url like the following:
```
http://search.twitter.com/search.json?q=from:yourusername+AND+#hashtag
```
You could easily write some javascript to parse this.
```
$.getJSON('http://search.twitter.com/sear... | Go to <http://search.twitter.com/> and enter the hashtag you want. Then click on 'Feed for this query' in the top right hand corner to get a URL. Then add a normal RSS widget to your wordpress site adding the URL you got previously. That should work. |
2,798,089 | I would need to get tweets from my twitter account on my wordpress site. Okey, the basics i could do, but there is one special need. I would need to get only certain tweets. Tweets that have some #hashstag for example only tweets with hashtag #myss would show up on my wordpress site.
Is there ready made plugin for thi... | 2010/05/09 | [
"https://Stackoverflow.com/questions/2798089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336676/"
] | The twitter API is pretty good at doing this sort of thing.
You could use the Twitter Search API to construct a url like the following:
```
http://search.twitter.com/search.json?q=from:yourusername+AND+#hashtag
```
You could easily write some javascript to parse this.
```
$.getJSON('http://search.twitter.com/sear... | There is a plugin called :
**Twitter Hash Tag Widget** : A widget for displaying the most recent twitter status updates for a particular hash tag.
<http://sivel.net/2009/06/twitter-hash-tag-widget/>
and
**Twitter tools** :
Twitter Tools is a plugin that creates a complete integration between your WordPress blog a... |
1,241,853 | I have written some code to experiment with opengl programming on Ubuntu, its been a little while but I used to have a reasonable understanding of C. Since c++ i'm told is the language of choice for games programming I am trying to develop with it.
This is my first real attempt at opengl with sdl and I have gotten to ... | 2009/08/06 | [
"https://Stackoverflow.com/questions/1241853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152122/"
] | Remove the glLoadIdentity() call from DrawCube(). Replace it with glPushMatrix() at the beginning and glPopMatrix() at the end. Now pressing 'w' does something. (I am not entirely sure what it is supposed to do.)
The problem is glLoadIdentity clears all the previous transformations set up with glTranslatef and the lik... | Try rendering the camera before drawing the cube. Right now the camera translation is working fine, but you're drawing the cube in the same position relative to the camera. If you draw the cube first, then move the camera, you should see the translation you were expecting. |
4,923,084 | I am working in an ISP company. We are developing a speed tester for our customers, but running into some issues with TCP speed testing.
One client had a total time duration on 102 seconds transferring 100 MB with a packet size of 8192. 100.000.000 / 8192 = 12.202 packets. If the client sends an ACK every other packet... | 2011/02/07 | [
"https://Stackoverflow.com/questions/4923084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527992/"
] | **HTML5 is still a draft**. Firefox 3.6 doesn't completely support HTML5 yet.
And according to the [HTML4 spec](http://www.w3.org/TR/REC-html40/struct/global.html#edef-ADDRESS), `address` can only contain `inline` elements:
```
<!ELEMENT ADDRESS - - (%inline;)* -- information on author -->
<!ATTLIST ADDRESS
%attrs;... | Add display block to CSS. And then, add the clear\_both div before closing the address.
This will fix **any** problems with block elements inside an inline ones.
Your CSS:
```
#header-container address {display: block; float: right; margin-top: 25px;}
.clear { clear: both; }
```
HTML:
```
<div id="header-container... |
4,923,084 | I am working in an ISP company. We are developing a speed tester for our customers, but running into some issues with TCP speed testing.
One client had a total time duration on 102 seconds transferring 100 MB with a packet size of 8192. 100.000.000 / 8192 = 12.202 packets. If the client sends an ACK every other packet... | 2011/02/07 | [
"https://Stackoverflow.com/questions/4923084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527992/"
] | **HTML5 is still a draft**. Firefox 3.6 doesn't completely support HTML5 yet.
And according to the [HTML4 spec](http://www.w3.org/TR/REC-html40/struct/global.html#edef-ADDRESS), `address` can only contain `inline` elements:
```
<!ELEMENT ADDRESS - - (%inline;)* -- information on author -->
<!ATTLIST ADDRESS
%attrs;... | An unordered list cannot be wrapped inside of a address tag. I checked using firebug and Firefox moves the close address tag before the unordered list. |
4,923,084 | I am working in an ISP company. We are developing a speed tester for our customers, but running into some issues with TCP speed testing.
One client had a total time duration on 102 seconds transferring 100 MB with a packet size of 8192. 100.000.000 / 8192 = 12.202 packets. If the client sends an ACK every other packet... | 2011/02/07 | [
"https://Stackoverflow.com/questions/4923084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527992/"
] | An unordered list cannot be wrapped inside of a address tag. I checked using firebug and Firefox moves the close address tag before the unordered list. | Add display block to CSS. And then, add the clear\_both div before closing the address.
This will fix **any** problems with block elements inside an inline ones.
Your CSS:
```
#header-container address {display: block; float: right; margin-top: 25px;}
.clear { clear: both; }
```
HTML:
```
<div id="header-container... |
29,346,480 | I want to implement a logic for creating a three column table using foreach loop. A sample code will look like this.
```
$array = ['0','1','2','3','4','5','6'];
$table = '<table class="table"><tbody>';
foreach($array as $a=>$v){
//if 0th or 3rd???????????wht should be here?
$table .= '<tr>';
$table .= ... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29346480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775597/"
] | This should work for you:
(See that I added a `tr` at the start and end before and after the foreach loop. Also I changed the quotes to double quotes and made sure you append the text everywhere.)
```
<?php
$array = ['0','1','2','3','4','5','6'];
$table = "<table class='table'><tbody><tr>";
... | Use this you may looking for this
```
<?php
echo('<table><tr>');
$i = 0;
foreach( $array as $product )
{
$i++;
echo '<td>'.$product .'</td>';
if($i % 3==0)
{
echo '</tr><tr>';
}
}
echo'</tr></table>';
?>
```
**Result Here:**
```
<table>
<tr>
<td>data1</td>
<td>data2</td>
<... |
29,346,480 | I want to implement a logic for creating a three column table using foreach loop. A sample code will look like this.
```
$array = ['0','1','2','3','4','5','6'];
$table = '<table class="table"><tbody>';
foreach($array as $a=>$v){
//if 0th or 3rd???????????wht should be here?
$table .= '<tr>';
$table .= ... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29346480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775597/"
] | Use this you may looking for this
```
<?php
echo('<table><tr>');
$i = 0;
foreach( $array as $product )
{
$i++;
echo '<td>'.$product .'</td>';
if($i % 3==0)
{
echo '</tr><tr>';
}
}
echo'</tr></table>';
?>
```
**Result Here:**
```
<table>
<tr>
<td>data1</td>
<td>data2</td>
<... | Here is an easy solution with incrementing that works with a dynamically generated table like the one in Magento product view page to help display product attributes in two table columns preceded by attribute label -> practically we have 4 table columns together with attribute labels. This is useful for products with m... |
29,346,480 | I want to implement a logic for creating a three column table using foreach loop. A sample code will look like this.
```
$array = ['0','1','2','3','4','5','6'];
$table = '<table class="table"><tbody>';
foreach($array as $a=>$v){
//if 0th or 3rd???????????wht should be here?
$table .= '<tr>';
$table .= ... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29346480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775597/"
] | This should work for you:
(See that I added a `tr` at the start and end before and after the foreach loop. Also I changed the quotes to double quotes and made sure you append the text everywhere.)
```
<?php
$array = ['0','1','2','3','4','5','6'];
$table = "<table class='table'><tbody><tr>";
... | Here is an easy solution with [`array_chunk()`](http://php.net/manual/en/function.array-chunk.php):
```
<?php
$array = array('0','1','2','3','4','5','6');
$d = array_chunk($array, 3);
$table = "<table border='1' class='table'><tbody>";
foreach($d as $v)
$table .= "<tr><td>" . implode("</td><... |
29,346,480 | I want to implement a logic for creating a three column table using foreach loop. A sample code will look like this.
```
$array = ['0','1','2','3','4','5','6'];
$table = '<table class="table"><tbody>';
foreach($array as $a=>$v){
//if 0th or 3rd???????????wht should be here?
$table .= '<tr>';
$table .= ... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29346480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775597/"
] | This should work for you:
(See that I added a `tr` at the start and end before and after the foreach loop. Also I changed the quotes to double quotes and made sure you append the text everywhere.)
```
<?php
$array = ['0','1','2','3','4','5','6'];
$table = "<table class='table'><tbody><tr>";
... | Here is an easy solution with incrementing that works with a dynamically generated table like the one in Magento product view page to help display product attributes in two table columns preceded by attribute label -> practically we have 4 table columns together with attribute labels. This is useful for products with m... |
29,346,480 | I want to implement a logic for creating a three column table using foreach loop. A sample code will look like this.
```
$array = ['0','1','2','3','4','5','6'];
$table = '<table class="table"><tbody>';
foreach($array as $a=>$v){
//if 0th or 3rd???????????wht should be here?
$table .= '<tr>';
$table .= ... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29346480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775597/"
] | Here is an easy solution with [`array_chunk()`](http://php.net/manual/en/function.array-chunk.php):
```
<?php
$array = array('0','1','2','3','4','5','6');
$d = array_chunk($array, 3);
$table = "<table border='1' class='table'><tbody>";
foreach($d as $v)
$table .= "<tr><td>" . implode("</td><... | Here is an easy solution with incrementing that works with a dynamically generated table like the one in Magento product view page to help display product attributes in two table columns preceded by attribute label -> practically we have 4 table columns together with attribute labels. This is useful for products with m... |
70,053,288 | I have a **timeseries data** of **5864 ICU Patients** and my dataframe is like this. Each row is the ICU stay of respective patient at a particular hour.
| HR | SBP | DBP | ICULOS | Sepsis | P\_ID |
| --- | --- | --- | --- | --- | --- |
| 92 | 120 | 80 | 1 | 0 | 0 |
| 98 | 115 | 85 | 2 | 0 | 0 |
| 93 | 125 | 75 | 3 | ... | 2021/11/21 | [
"https://Stackoverflow.com/questions/70053288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I edited my suggestion.. hope I understood better what u looking for. | After you initial code, here's the suggestion:
n=3
init\_n=1
while len(l) > n+init\_n:
```
l.pop(n+init_n-1)
init_n = init_n + n -1
```
print (list) |
18,794,793 | How can I compare a single character from a string, and another string (which may or may not be greater than one character)
This program gives me almost 300 lines of random errors. The errors don't reference a specific line number either, just a lot of stuff about "char\* ", "", or "std::to\_string".
```
#include <io... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521753/"
] | You're mixing types. It doesn't know how to compare a string (`test`) to a char (`str[4]`).
If you change test to a `char` that will work fine. Or reference the specific character within test you want to compare such as `if (test[0] == str[4])` it should compile and run.
However, as this is merely an example and not... | Also you need `"D"` to be a char value not a string value if you are comparing it like that.
```
std::string myString = "Hello World";
const char *myStringChars = myString.c_str();
```
You have to turn it into a char array before can access it. Unless you do.
```
str.at(i);
```
which you can also write as
`str[... |
18,794,793 | How can I compare a single character from a string, and another string (which may or may not be greater than one character)
This program gives me almost 300 lines of random errors. The errors don't reference a specific line number either, just a lot of stuff about "char\* ", "", or "std::to\_string".
```
#include <io... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521753/"
] | You need to convert str[4] (which is a char) to a string before you can compare it to another string. Here's a simple way to do this
```
if (test == string(1, str[4])) {
``` | You're mixing types. It doesn't know how to compare a string (`test`) to a char (`str[4]`).
If you change test to a `char` that will work fine. Or reference the specific character within test you want to compare such as `if (test[0] == str[4])` it should compile and run.
However, as this is merely an example and not... |
18,794,793 | How can I compare a single character from a string, and another string (which may or may not be greater than one character)
This program gives me almost 300 lines of random errors. The errors don't reference a specific line number either, just a lot of stuff about "char\* ", "", or "std::to\_string".
```
#include <io... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521753/"
] | `str[4]` is a `char` type, which will not compare with a `string`.
Compare apples with apples.
Use
```
test[0] == str[4]
```
instead. | I think you might be mixing python with c++. In c++ `'g'` refers to a single character `g` not a string of length 1. "g" refers to an array (string) which is 1 character long and looks like ['g']. So as you can see, if you compare a single character to an array of characters no matter if the array is a single character... |
18,794,793 | How can I compare a single character from a string, and another string (which may or may not be greater than one character)
This program gives me almost 300 lines of random errors. The errors don't reference a specific line number either, just a lot of stuff about "char\* ", "", or "std::to\_string".
```
#include <io... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521753/"
] | You're mixing types. It doesn't know how to compare a string (`test`) to a char (`str[4]`).
If you change test to a `char` that will work fine. Or reference the specific character within test you want to compare such as `if (test[0] == str[4])` it should compile and run.
However, as this is merely an example and not... | I think you might be mixing python with c++. In c++ `'g'` refers to a single character `g` not a string of length 1. "g" refers to an array (string) which is 1 character long and looks like ['g']. So as you can see, if you compare a single character to an array of characters no matter if the array is a single character... |
18,794,793 | How can I compare a single character from a string, and another string (which may or may not be greater than one character)
This program gives me almost 300 lines of random errors. The errors don't reference a specific line number either, just a lot of stuff about "char\* ", "", or "std::to\_string".
```
#include <io... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521753/"
] | `str[4]` is a `char` type, which will not compare with a `string`.
Compare apples with apples.
Use
```
test[0] == str[4]
```
instead. | You're comparing a char to a std::string, this is not a valid comparison.
You're looking for std::string::find, as follows:
```
if( test.find( str[4] ) != std::string::npos ) cout << test << "\n";
```
Note that this will return true if test *contains* `str[4]`. |
18,794,793 | How can I compare a single character from a string, and another string (which may or may not be greater than one character)
This program gives me almost 300 lines of random errors. The errors don't reference a specific line number either, just a lot of stuff about "char\* ", "", or "std::to\_string".
```
#include <io... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18794793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521753/"
] | You need to convert str[4] (which is a char) to a string before you can compare it to another string. Here's a simple way to do this
```
if (test == string(1, str[4])) {
``` | I think you might be mixing python with c++. In c++ `'g'` refers to a single character `g` not a string of length 1. "g" refers to an array (string) which is 1 character long and looks like ['g']. So as you can see, if you compare a single character to an array of characters no matter if the array is a single character... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.