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 |
|---|---|---|---|---|---|
7,266,915 | Consider the following:
```
class A
{
private:
A() {}
public:
A(int x = 0) {}
};
int main()
{
A a(1);
return 0;
}
```
I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ... | 2011/09/01 | [
"https://Stackoverflow.com/questions/7266915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/911575/"
] | Your code compiles because there is no ambiguity. You created a class with two constructors, one which always takes 0 arguments, and one which always takes one argument, an int. You then unambiguously called the constructor taking an int value. That this int has a default value does not matter, it is still a completely... | Declaring potentially ambiguous functions in C++ does not produce any ambiguity errors. Ambiguity takes place when you attempt to *refer* to these functions in an ambiguous way. In your example ambiguity will occur if you try to default-construct your object.
Strictly speaking, it is perfectly normal to have declarati... |
32,640 | Are there gases that are not transparent at room temperature (i.e. at temperature below the point where the substance starts to radiate visible light due to heating)? | 2015/06/09 | [
"https://chemistry.stackexchange.com/questions/32640",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/9831/"
] | First, a little bit of background. Transparency is not an absolute property of a material. *Every* substance is opaque, so long as light has to pass through enough of it, and opacity also changes according to ambient conditions. Some substances, such as most metals, are opaque even in $100\ \mathrm{nm}$ thin films, whi... | I'd separate ***transparent*** and *colorless*.
Most gases are transparent or very nearly so because the concentration is low and absorptions are often weak.
[Chlorine](http://en.wikipedia.org/wiki/Chlorine), though is yellow-green, and has a noticeable color (from Wikipedia)
? | 2015/06/09 | [
"https://chemistry.stackexchange.com/questions/32640",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/9831/"
] | I'd separate ***transparent*** and *colorless*.
Most gases are transparent or very nearly so because the concentration is low and absorptions are often weak.
[Chlorine](http://en.wikipedia.org/wiki/Chlorine), though is yellow-green, and has a noticeable color (from Wikipedia)
? | 2015/06/09 | [
"https://chemistry.stackexchange.com/questions/32640",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/9831/"
] | First, a little bit of background. Transparency is not an absolute property of a material. *Every* substance is opaque, so long as light has to pass through enough of it, and opacity also changes according to ambient conditions. Some substances, such as most metals, are opaque even in $100\ \mathrm{nm}$ thin films, whi... | The answer to your question is yes, there are non-transparent gases, however, it depends upon the wavelength at which you are observing and how much gas you are looking through. At some wavelengths the gas is opaque at others transparent. The amount of light absorbed depends on its concentration, the path-length throug... |
6,285,137 | If you have a server that you made in C running and then connect to it as a client with a web browser, how would you display an HTML page to the client?
I tried just writing html code to the client, but it didn't work, the page is blank. | 2011/06/08 | [
"https://Stackoverflow.com/questions/6285137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789882/"
] | Sleepycat was acquired by Oracle in 2006. The product continues to be available under the original open source license and continues to be enhanced. You can find the source code on [Oracle's web site](http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html) here in both .zip and .tar formats. The dis... | You can find the source code on [Launchpad](https://launchpad.net/berkeley-db). |
6,285,137 | If you have a server that you made in C running and then connect to it as a client with a web browser, how would you display an HTML page to the client?
I tried just writing html code to the client, but it didn't work, the page is blank. | 2011/06/08 | [
"https://Stackoverflow.com/questions/6285137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789882/"
] | You can find the source code on [Launchpad](https://launchpad.net/berkeley-db). | It is not currently possible to download the source without creating an account. |
6,285,137 | If you have a server that you made in C running and then connect to it as a client with a web browser, how would you display an HTML page to the client?
I tried just writing html code to the client, but it didn't work, the page is blank. | 2011/06/08 | [
"https://Stackoverflow.com/questions/6285137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789882/"
] | Sleepycat was acquired by Oracle in 2006. The product continues to be available under the original open source license and continues to be enhanced. You can find the source code on [Oracle's web site](http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html) here in both .zip and .tar formats. The dis... | It is not currently possible to download the source without creating an account. |
27,434,873 | How do I update all rows with calculated data derived from the values in two other columns of the same record?
Here's the situation:
I have a table called `customers`. It had 4 columns - `Customer_ID`, `Customer_Name`, `Coordinate_X` and `Coordinate_Y`'. Since creating and filling the table with data I have added an... | 2014/12/12 | [
"https://Stackoverflow.com/questions/27434873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4352168/"
] | The query is simpler than what you are doing:
```
update customers
set distance = SQRT(Power(coordinate_x, 2) + Power(coordinate_y, 2))
``` | Gordon's answer is correct. However, for this particular example, it's better to use a virtual column and you won't have to update the distance after changing a customer's coordinates:
```
create table customers (
customer_id number,
customer_name varchar(255),
coordinate_x number,
coordinate_y number,
dista... |
28,725,159 | I'm creating a book archival program, and one of the data members says if the book is read or not. However I can't get the program to write "Yes" to the screen, so I'm guessing it is never changed, even though I say 'Y' when asked if I have read the book. Can anyone see what I have done wrong?
```
cout << "\n\tEnter t... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28725159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4202447/"
] | ```
haveRead == true
```
Is a comparison, not an assignment. Remove one = from both clauses
```
if(toupper(ch) == 'Y')
haveRead = true;
else
haveRead = false;
``` | The operator `==` is a comparison operator, used to compare things. Here you just want to assign, so you need the assignment operator that is `=`. |
48,308,080 | Im trying to create a small JavaScript timer in which a user has a limited amount of time to answer a question, and if the user does not answer in time, they will be directed back to the main page. All I get back from my code in terms of the timer is literally " [ ] ".
My code:
```
<DOCTYPE! html>
<html>
<head... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48308080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6849240/"
] | Just use [`setInterval()`](https://www.w3schools.com/jsref/met_win_setinterval.asp), it's pretty much designed for this:
**UPDATE:** Remember to stop the setinterval process when the time is up.
Use this method [`clearInterval()`](https://www.w3schools.com/jsref/met_win_clearinterval.asp) to stop the process.
```js
v... | spelling mistake
>
> rename time to timer
>
>
>
```
<html>
<head>
<link rel="stylesheet" type="text/css" href="style_q1.css">
<script type="text/javascript">
var timer="60";
var min="0";
var sec="0";
function startTimer() {
min=parseInt(timer/60);
sec=parseInt(timer%60);
if(timer<1){
... |
48,308,080 | Im trying to create a small JavaScript timer in which a user has a limited amount of time to answer a question, and if the user does not answer in time, they will be directed back to the main page. All I get back from my code in terms of the timer is literally " [ ] ".
My code:
```
<DOCTYPE! html>
<html>
<head... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48308080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6849240/"
] | Just use [`setInterval()`](https://www.w3schools.com/jsref/met_win_setinterval.asp), it's pretty much designed for this:
**UPDATE:** Remember to stop the setinterval process when the time is up.
Use this method [`clearInterval()`](https://www.w3schools.com/jsref/met_win_clearinterval.asp) to stop the process.
```js
v... | * Your code has an error with the variable `time`
* You can use setInterval to accomplish your scenario.
* Remember to stop the setinterval process when the time is up.
```js
var timer = 10;
var min = 0;
var sec = 0;
var refreshIntervalId;
function startTimer() {
min=parseInt(timer / 60);
sec=parseI... |
48,308,080 | Im trying to create a small JavaScript timer in which a user has a limited amount of time to answer a question, and if the user does not answer in time, they will be directed back to the main page. All I get back from my code in terms of the timer is literally " [ ] ".
My code:
```
<DOCTYPE! html>
<html>
<head... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48308080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6849240/"
] | A few things to note:
* `<!DOCTYPE>` instead of `<DOCTYPE!>`
* id attributes should be unique, you have two declared
* `<center>` is deprecated. Find a solution using CSS.
* Rather than adding an `onload` attribute to your `<body>` I would suggest adding an `DOMContentLoaded` event listener to your document.
```
<lin... | spelling mistake
>
> rename time to timer
>
>
>
```
<html>
<head>
<link rel="stylesheet" type="text/css" href="style_q1.css">
<script type="text/javascript">
var timer="60";
var min="0";
var sec="0";
function startTimer() {
min=parseInt(timer/60);
sec=parseInt(timer%60);
if(timer<1){
... |
48,308,080 | Im trying to create a small JavaScript timer in which a user has a limited amount of time to answer a question, and if the user does not answer in time, they will be directed back to the main page. All I get back from my code in terms of the timer is literally " [ ] ".
My code:
```
<DOCTYPE! html>
<html>
<head... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48308080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6849240/"
] | A few things to note:
* `<!DOCTYPE>` instead of `<DOCTYPE!>`
* id attributes should be unique, you have two declared
* `<center>` is deprecated. Find a solution using CSS.
* Rather than adding an `onload` attribute to your `<body>` I would suggest adding an `DOMContentLoaded` event listener to your document.
```
<lin... | * Your code has an error with the variable `time`
* You can use setInterval to accomplish your scenario.
* Remember to stop the setinterval process when the time is up.
```js
var timer = 10;
var min = 0;
var sec = 0;
var refreshIntervalId;
function startTimer() {
min=parseInt(timer / 60);
sec=parseI... |
19,592,096 | I have the following MySQL query:
```
SELECT t.date_time, COUNT(t.submission_id) AS click_count, s.title, s.first_name, s.family_name, s.email, ut.ukip_name, a.advertiser_name
FROM recards.tracking t
INNER JOIN submissions s ON t.submission_id = s.submission_id
INNER JOIN form_settings fs ON t.form_id = fs.form_id ... | 2013/10/25 | [
"https://Stackoverflow.com/questions/19592096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1894453/"
] | Turns out I was just forgetting the `AS` after the `MAX()`, with `MAX(t.date_time) AS top_time` it works fine.
My full query working:
```
SELECT MAX(t.date_time) AS top_time, COUNT(t.submission_id) AS click_count, s.title, s.first_name, s.family_name, s.email, ut.ukip_name, a.advertiser_name
FROM recards.tracking t ... | You are just grouping by t.submission\_id and nothing else, so this query will not work. The other attributes need to be added to the `GROUP BY` or need to be eliminated from the `SELECT`.
As far as ordering add `MAX(t.date_time)` or `MIN(t.date_time)` to your `SELECT` and then `ORDER BY` that result either ascending ... |
53,164 | Hi,
I have a couple of open source PHP libraries on Google Code. Someone who uses one of them recently suggested I create a forum for users to post questions/answers (or at the very least, allow me to post my answers somewhere public so other people can learn from them). This is something Google Code doesn't offer.
... | 2010/06/10 | [
"https://meta.stackexchange.com/questions/53164",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/134642/"
] | I believe it's becoming reasonably common to use Stack Overflow for "how do I do X" questions, but *also* to have a mailing list for forum for more detailed questions, discussions, feature requests etc. Basically consider whether a topic could be answered reasonably by other users of your libraries, or whether it's rea... | Which libraries? You should link to them here so we can take a look. (I looked in your profile hoping to find them. FYI, you should put links to your work in there.)
I think as long as you have your users tag the questions appropriately with the name of the tool and language, it should be fine. One thing you should wa... |
53,164 | Hi,
I have a couple of open source PHP libraries on Google Code. Someone who uses one of them recently suggested I create a forum for users to post questions/answers (or at the very least, allow me to post my answers somewhere public so other people can learn from them). This is something Google Code doesn't offer.
... | 2010/06/10 | [
"https://meta.stackexchange.com/questions/53164",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/134642/"
] | I believe it's becoming reasonably common to use Stack Overflow for "how do I do X" questions, but *also* to have a mailing list for forum for more detailed questions, discussions, feature requests etc. Basically consider whether a topic could be answered reasonably by other users of your libraries, or whether it's rea... | >
> I only ask because although many of the questions are about broad subjects such as XPath etc., some are very specific to code I've written, which only I could answer (probably), and I don't want to hijack Stack Overflow for my own private Q&A site. There's also the bit in the FAQ that says "software tools commonly... |
53,164 | Hi,
I have a couple of open source PHP libraries on Google Code. Someone who uses one of them recently suggested I create a forum for users to post questions/answers (or at the very least, allow me to post my answers somewhere public so other people can learn from them). This is something Google Code doesn't offer.
... | 2010/06/10 | [
"https://meta.stackexchange.com/questions/53164",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/134642/"
] | Which libraries? You should link to them here so we can take a look. (I looked in your profile hoping to find them. FYI, you should put links to your work in there.)
I think as long as you have your users tag the questions appropriately with the name of the tool and language, it should be fine. One thing you should wa... | >
> I only ask because although many of the questions are about broad subjects such as XPath etc., some are very specific to code I've written, which only I could answer (probably), and I don't want to hijack Stack Overflow for my own private Q&A site. There's also the bit in the FAQ that says "software tools commonly... |
63,521,299 | I'm working on a React component that uses drag and drop to upload a file based on this tutorial: <https://blog.logrocket.com/create-a-drag-and-drop-component-with-react-dropzone/>
and I am not too familiar with React Hooks component types.
In my customization, I want to hide the drag and drop container once the file ... | 2020/08/21 | [
"https://Stackoverflow.com/questions/63521299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1391595/"
] | * Check if the output you're getting from *from\_usd\_to\_eur(usd)* isn't
too long to be displayed. Also try with "//" instead of "/". The
first one giving you an int instead of a float.
* You misspelled "usd" as "usr" when you called the command, maybe
that's the reason. | Thanks guys, your answer will be my next step to study. At the moment the small program work. I run for a second time and now /usd (thanks @nordmanden) work correctly |
49,927,053 | I'm trying to get value="3474636382675" from:
`<input class="lst" value="3474636382675" title="Zoeken" autocomplete="off" id="sbhost" maxlength="2048" name="q" type="text"`>
I've tried
```
response.css(".lst >value").extract()
```
This one works but i'm getting everything back and i just need the value.
```
respo... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49927053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9595180/"
] | With CSS you select the attribute you want like this:
```
response.css(".lst::attr(value)").extract()
```
You can read more about the selectors in Scrapy’s [documentation](https://doc.scrapy.org/en/latest/topics/selectors.html) | I use beautiful soup to parse html. Here's an example that grabs stock prices from yahoo finance.
```
import urllib.request
from bs4 import BeautifulSoup
def getPrice(tag):
source = "https://finance.yahoo.com/quote/"+tag
filehandle = urllib.request.urlopen(source)
soup = BeautifulSoup(filehandle.read(), "... |
49,927,053 | I'm trying to get value="3474636382675" from:
`<input class="lst" value="3474636382675" title="Zoeken" autocomplete="off" id="sbhost" maxlength="2048" name="q" type="text"`>
I've tried
```
response.css(".lst >value").extract()
```
This one works but i'm getting everything back and i just need the value.
```
respo... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49927053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9595180/"
] | With CSS you select the attribute you want like this:
```
response.css(".lst::attr(value)").extract()
```
You can read more about the selectors in Scrapy’s [documentation](https://doc.scrapy.org/en/latest/topics/selectors.html) | Not quite sure about css. But [here is one](https://stackoverflow.com/questions/21181628/python-scrapy-get-href-using-css-selector) from another SO answer. Alternatively try xpath:
```
response.xpath('//input[@class="lst"]/@value').extract()
```
or if you need only one value:
```
response.xpath('//input[@class="lst... |
1,592,442 | I Have a text file that is like the following:
[group1]
value1
value2
value3
[group2]
value1
value2
[group3]
value3
value 4
etc
What I want to be able to do, is load the values into an array (or list?) based on a passed in group value. eg. If i pass in "group2", then it would return a list of "value1" and "value2"... | 2009/10/20 | [
"https://Stackoverflow.com/questions/1592442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192829/"
] | This is a home work question?
Use the StreamReader class to read the file (you will need to probably use .EndOfStream and ReadLine()) and use the String class for the string manipulation (probably .StartsWith(), .Substring() and .Split().
As for the better way to store them "IT DEPENDS". How many groups will you have... | ok, here is what I edned up coding:
```
Public Function FillFromFile(ByVal vFileName As String, ByVal vGroupName As String) As List(Of String)
' open the file
' read the entire file into memory
' find the starting group name
Dim blnFoundHeading As Boolean = False
Dim lstValue... |
1,592,442 | I Have a text file that is like the following:
[group1]
value1
value2
value3
[group2]
value1
value2
[group3]
value3
value 4
etc
What I want to be able to do, is load the values into an array (or list?) based on a passed in group value. eg. If i pass in "group2", then it would return a list of "value1" and "value2"... | 2009/10/20 | [
"https://Stackoverflow.com/questions/1592442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192829/"
] | This is a home work question?
Use the StreamReader class to read the file (you will need to probably use .EndOfStream and ReadLine()) and use the String class for the string manipulation (probably .StartsWith(), .Substring() and .Split().
As for the better way to store them "IT DEPENDS". How many groups will you have... | Regarding a possible better way to store the data: you might find XML useful. It is ridiculously easy to read XML data into a DataTable object.
Example:
```
Dim dtTest As New System.Data.DataTable
dtTest.ReadXml("YourFilePathNameGoesHere.xml")
``` |
1,592,442 | I Have a text file that is like the following:
[group1]
value1
value2
value3
[group2]
value1
value2
[group3]
value3
value 4
etc
What I want to be able to do, is load the values into an array (or list?) based on a passed in group value. eg. If i pass in "group2", then it would return a list of "value1" and "value2"... | 2009/10/20 | [
"https://Stackoverflow.com/questions/1592442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192829/"
] | ok, here is what I edned up coding:
```
Public Function FillFromFile(ByVal vFileName As String, ByVal vGroupName As String) As List(Of String)
' open the file
' read the entire file into memory
' find the starting group name
Dim blnFoundHeading As Boolean = False
Dim lstValue... | Regarding a possible better way to store the data: you might find XML useful. It is ridiculously easy to read XML data into a DataTable object.
Example:
```
Dim dtTest As New System.Data.DataTable
dtTest.ReadXml("YourFilePathNameGoesHere.xml")
``` |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | object is the base for everything. *Anything* can be assigned to a variable of type object. | object obj = ... here may refer to a Collection. It's not said that the difference usage of 'object' here refers to the same type of object. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | object is the base for everything. *Anything* can be assigned to a variable of type object. | An array of objects is an object, but this is indeed weird. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | object is the base for everything. *Anything* can be assigned to a variable of type object. | In
```
object obj = new object[] { ...}
```
The right hand part does yield a reference of type `object[]` but that type, like any other type, is assignment-compatible with `object`. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | In
```
object obj = new object[] { ...}
```
The right hand part does yield a reference of type `object[]` but that type, like any other type, is assignment-compatible with `object`. | object obj = ... here may refer to a Collection. It's not said that the difference usage of 'object' here refers to the same type of object. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | It compiles because an "object" can be anything, therefore it can be a reference to an array of object. The code below using strings to make the distinction a little clearer, might help. So:
```
List<string> myStrings = new List<string>() { "aa", "bb" };
// Now we have an array of strings, albeit an empty one
string[]... | object obj = ... here may refer to a Collection. It's not said that the difference usage of 'object' here refers to the same type of object. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | In
```
object obj = new object[] { ...}
```
The right hand part does yield a reference of type `object[]` but that type, like any other type, is assignment-compatible with `object`. | An array of objects is an object, but this is indeed weird. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | It compiles because an "object" can be anything, therefore it can be a reference to an array of object. The code below using strings to make the distinction a little clearer, might help. So:
```
List<string> myStrings = new List<string>() { "aa", "bb" };
// Now we have an array of strings, albeit an empty one
string[]... | An array of objects is an object, but this is indeed weird. |
2,340,604 | ```
object obj = new object[] { new object(), new object() };
```
How does this compile? It seems confusing.
Seems it should either be
```
object[] obj = new object[] { new object(), new object() };
```
or
```
object[] obj = { new object(), new object() };
``` | 2010/02/26 | [
"https://Stackoverflow.com/questions/2340604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35026/"
] | It compiles because an "object" can be anything, therefore it can be a reference to an array of object. The code below using strings to make the distinction a little clearer, might help. So:
```
List<string> myStrings = new List<string>() { "aa", "bb" };
// Now we have an array of strings, albeit an empty one
string[]... | In
```
object obj = new object[] { ...}
```
The right hand part does yield a reference of type `object[]` but that type, like any other type, is assignment-compatible with `object`. |
6,514,794 | There are tons of online suggestions for setting MSMQ permissions programmatically using .net System.Messaging.MessageQueue SetPermissions method. But I cannot find any system.messaging property that lets me read the permissions currently configured on existing queues.
I'm trying to write a powershell audit script to... | 2011/06/29 | [
"https://Stackoverflow.com/questions/6514794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/761599/"
] | Here's a simple example handler, which needs a login.html template containing a username/password form. I don't have a sign up example, but it's quite similar, on the post you validate the input and insert the user record rather than authenticating.
```
class BaseHandler(tornado.web.RequestHandler):
def get_login... | I started using Cole's example but realised I was creating an account for accessing the database which might not be the same thing as an account for our webapp.
I've changed the above example to use bcrpyt. Now a user's connection to our webapp is different from our webapp's connection to the database. [My sample app ... |
5,907,070 | ```
Array
(
[0] => Array
(
[accountNo] => 208773
)
)
Array
(
[0] => Array
(
[accountNo] => 9415238
)
)
Array
(
)
```
how can i unset the last array so that it must display only first 2 array.
please help
thanks | 2011/05/06 | [
"https://Stackoverflow.com/questions/5907070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/729022/"
] | If these 3 arrays are the content of one array, let's call it `$array`:
```
array_pop($array);
```
Will remove the last one, and optionally return it's value.
>
> array\_pop — Pop the element off the end of array
>
>
>
<http://php.net/manual/function.array-pop.php>
---
This does the same thing as `unset()` h... | try this ( if i understand your problem)
```
$output =array();
foreach($input as $k=>$v){
if(!empty($v)){
$output[$k]=$v;
}
}
```
[WORKING DEMO](http://codepad.org/eIWXd8z1)
------------------------------------------- |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Double check the opacity of the active layer. If it's set to zero, the created stroke won't be shown after drawing, by it will be visible when drawing | Be sure that `X-Ray` mode is disabled on the object you are drawing on. Having it on will make the object's geometry draw on top of any grease pencil strokes you make on it.
[](https://i.stack.imgur.com/y39T4.png) |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Double check the opacity of the active layer. If it's set to zero, the created stroke won't be shown after drawing, by it will be visible when drawing | I met the same problem today.Maybe you pressed H accidentally. Go to the edit Mode and then try press Alt+H see if it works. |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Check to make sure you don't have the [Grease Pencil layers] and [Grease Pencil Colors] set to invisible (eye icon). I spent an hour trying to figure out why, but forgot that I turned them off.
For the new players:
N to open the right hand menu.
Uncollapse the ▼ ☑Grease Pencil and ▼Grease Pencil Colors
Look to make su... | I'm using a 3D mouse for zooming, so my grease pencil drawing planes are created in weird angles. As a quick fix, I set *Scale Y* to $0$.
When I then draw a stroke, it instantly shrinks to an invisible point at the drawing plane origin.
This does not happen, if I set *Scale Y* to $0.001$
[. I spent an hour trying to figure out why, but forgot that I turned them off.
For the new players:
N to open the right hand menu.
Uncollapse the ▼ ☑Grease Pencil and ▼Grease Pencil Colors
Look to make su... | Maybe in somehow your stroke keyframe location changed!
check the time line or the dope sheet, i found mine in 173 |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Check to make sure you don't have the [Grease Pencil layers] and [Grease Pencil Colors] set to invisible (eye icon). I spent an hour trying to figure out why, but forgot that I turned them off.
For the new players:
N to open the right hand menu.
Uncollapse the ▼ ☑Grease Pencil and ▼Grease Pencil Colors
Look to make su... | I met the same problem today.Maybe you pressed H accidentally. Go to the edit Mode and then try press Alt+H see if it works. |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Check to make sure you don't have the [Grease Pencil layers] and [Grease Pencil Colors] set to invisible (eye icon). I spent an hour trying to figure out why, but forgot that I turned them off.
For the new players:
N to open the right hand menu.
Uncollapse the ▼ ☑Grease Pencil and ▼Grease Pencil Colors
Look to make su... | Double check the opacity of the active layer. If it's set to zero, the created stroke won't be shown after drawing, by it will be visible when drawing |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Double check the opacity of the active layer. If it's set to zero, the created stroke won't be shown after drawing, by it will be visible when drawing | Check to see that you didn't accidentally go to a new frame in the dope sheet. |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | Double check the opacity of the active layer. If it's set to zero, the created stroke won't be shown after drawing, by it will be visible when drawing | I just had this problem and found that it was caused by being in *Wireframe* shading mode. I just switched from *Wireframe* to *Solid* and it works correctly. |
67,513 | Everytime I press `D` + `LMB` I see the pencil as cursor and the indication that I'm about to draw something, but every time I draw a line, the line disappears. | 2016/11/18 | [
"https://blender.stackexchange.com/questions/67513",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/32712/"
] | I'm using a 3D mouse for zooming, so my grease pencil drawing planes are created in weird angles. As a quick fix, I set *Scale Y* to $0$.
When I then draw a stroke, it instantly shrinks to an invisible point at the drawing plane origin.
This does not happen, if I set *Scale Y* to $0.001$
[=Im(L)$ and $Ker(T)=Ker(L)$ show that $L = T$
Since they are linear operators
$$T:V\to V \mbox{ and } L:V\to V$$
Base is $ \{\alpha\_{1},\cdots,\alpha\_{r}\} $ of $Ker(T)$ base completed of $V$ wiht $ \{\alpha\_{r+1},\cdots,\alpha\_{n}\} $ and $ ... | 2016/10/26 | [
"https://math.stackexchange.com/questions/1985367",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378669/"
] | This is just not true as stated. Take two maps $\mathbb{R} \rightarrow \mathbb{R}$, the first being multiplication by 1 and the second being multiplication by 2. The maps have the same kernel $\{0\}$ and the same image $\mathbb{R}$ but are clearly not the same map. | Take an invertible linear transformation from $V$ to $V$. The kernal is $\{0\}$ and image is $V$. So if you can find two distinct inverible linear transformations you can see that your question is wrong.
One can also give examples with two non-invertible ones having same kernel and image.
Let $L$ be a non-invertible... |
156,373 | I'm writing a custom Processing script that needs to know which database connection a vector layer resides in. I can't find anywhere in the API a function to return this information from a layer. So I guess I have two questions:
1. Is there a Python function (either from qgis.core or from Processing tools) that easily... | 2015/07/30 | [
"https://gis.stackexchange.com/questions/156373",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/7809/"
] | I ended up writing a small module to extract information out of the string that source() returns:
```
import re
class LayerDbInfo:
def __init__(self, layerInfo):
if layerInfo[:6] == 'dbname':
layerInfo = layerInfo.replace('\'','"')
vals = dict(re.findall('(\S+)="?(.*?)"? ',layerInf... | I think you could use the following code to obtain source information for your layer. Select a layer from the layer window and input the code into the Python Console:
```
layer = qgis.utils.iface.activeLayer()
print layer.source()
```
You should receive information about the layer.
Hope this helps! |
32,409,449 | I have the model that uses paperclip like this
```
has_attached_file :image, styles: { :medium => "50x50>" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
def image_url
image.url(:medium)
end
```
I need it Json, So in my controller,
```
respond_to do |format|
format.json { render ... | 2015/09/05 | [
"https://Stackoverflow.com/questions/32409449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5287288/"
] | Try this.
Create module:
```
module WithDomain
def domain
@domain
end
def domain=(val)
@domain = val
end
def domain?
@domain.present?
end
end
```
Change you model accordingly:
```
class Celebtiry < ActiveRecord::Base
include WithDomain
# existing staff
def image_url
if domain?... | ### Solution 1: (with existing code)
You can use [asset\_url](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html#method-i-asset_url) from `ActionView::Helpers::AssetUrlHelper` module which will give you the absolute url of your image. Just `include ActionView::Helpers::AssetUrlHelper` this in yo... |
1,557,140 | Let $A$ and $B$ be two sets such that $B \subset A$ and there is an injection $f \colon A \to B$. Then how to show that $A$ and $B$ have the same cardinality?
Munkres' Hint:
We define $A\_1 \colon= A$, $B\_1 \colon= B$, and, for $n > 1$, we define $A\_n \colon= f(A\_{n-1})$ and $B\_n \colon= f(B\_{n-1})$.
Thus, w... | 2015/12/02 | [
"https://math.stackexchange.com/questions/1557140",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/59734/"
] | Since you asked me to answer here: <http://dbfin.com/topology/munkres/chapter-1/section-7-countable-and-uncountable-sets/problem-6-solution/#comment-2390104583>.
Step 1. We show the inclusions $A\_1\supset B\_1\supset A\_2\supset B\_2\supset\cdots$, you have already shown it in the question.
Step 2. We show that $h$ ... | I understand you didn't finish proving surjectivity of $h$, let me complete it. You want to prove that, that for any $b \in B$ such that $b \in (A\_k - B\_k)$ for some positive integer $k>1$, there exists some $\alpha \in A \; |\,h(\alpha)=b $.
Due to $A\_k=f(A\_{k-1})$, $B\_k = f(B\_{k-1})$ and $f$ is an injective... |
56,904,413 | I am having some doubts with this homework on python. The exercise consists on the following:
>
> This bus has a passenger entry and exit control system to monitor the number of occupants it carries and thus detect when there is too high a capacity.
>
>
> At each stop the entry and exit of passengers is represented... | 2019/07/05 | [
"https://Stackoverflow.com/questions/56904413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11631992/"
] | Change the content in `.npmignore`
`*.ts=>.ts` | I also had this problem, I simply named my `.ts` files as `__typescript__` and then declared `__typescript__` in the template variables, so your file will be: `fight.__typescript__`
```
const templateSource = apply(url('./files'), [
template({
typescript: 'ts',
}),
``` |
139,375 | I have a quick question about updating my references from Bibtex. I am using TexStudio as my Latex editor.
I have to make changes to some of the references. I put the changes in the "references.bib" file. I then compile the Bibtex and the main document I'm working on. Sometimes the changes show up, and sometimes they ... | 2013/10/18 | [
"https://tex.stackexchange.com/questions/139375",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/38466/"
] | Sometimes you need delete all temporary files, like:
>
> .aux, .bbl, .blg, .brf, .dvi, .ilg, .ind, .log, .out, .nav, .snm,
> .toc, .idx, .lof, .lot, .snm, .bcf, .run.xml, .vrb, ...
>
>
>
And recompile your `.tex` file:
```
latex main.tex
bibtex main.aux
latex main.tex
latex main.tex
```
P.S. Look for some ... | Maybe this answer shouldn't be in this topic but i don't know were to put it. I lost a lot of time trying to figure out why I couldn't update the references in my `.bib` files, until I realize that I had to completely disable the UAC (Windows 8). To do this see:
<http://www.eightforums.com/system-security/2434-disable... |
139,375 | I have a quick question about updating my references from Bibtex. I am using TexStudio as my Latex editor.
I have to make changes to some of the references. I put the changes in the "references.bib" file. I then compile the Bibtex and the main document I'm working on. Sometimes the changes show up, and sometimes they ... | 2013/10/18 | [
"https://tex.stackexchange.com/questions/139375",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/38466/"
] | Sometimes you need delete all temporary files, like:
>
> .aux, .bbl, .blg, .brf, .dvi, .ilg, .ind, .log, .out, .nav, .snm,
> .toc, .idx, .lof, .lot, .snm, .bcf, .run.xml, .vrb, ...
>
>
>
And recompile your `.tex` file:
```
latex main.tex
bibtex main.aux
latex main.tex
latex main.tex
```
P.S. Look for some ... | If that doesn't help, make sure you don't have several .bib files with the same name in your path (and you're updating the wrong one). |
139,375 | I have a quick question about updating my references from Bibtex. I am using TexStudio as my Latex editor.
I have to make changes to some of the references. I put the changes in the "references.bib" file. I then compile the Bibtex and the main document I'm working on. Sometimes the changes show up, and sometimes they ... | 2013/10/18 | [
"https://tex.stackexchange.com/questions/139375",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/38466/"
] | If that doesn't help, make sure you don't have several .bib files with the same name in your path (and you're updating the wrong one). | Maybe this answer shouldn't be in this topic but i don't know were to put it. I lost a lot of time trying to figure out why I couldn't update the references in my `.bib` files, until I realize that I had to completely disable the UAC (Windows 8). To do this see:
<http://www.eightforums.com/system-security/2434-disable... |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | Python Webdriver Script:
```
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://sandbox.dev/alert.html")
alert = browser.switch_to_alert()
alert.accept()
browser.close()
```
Webpage (alert.html):
```
<html><body>
<script>alert("hey");</script>
</body></html>
```
Running the webd... | **Try The Code below! Working Fine for me!**
```
alert = driver.switch_to.alert
try:
alert.accept() #If you want to Accept the Alert
except:
alert.dismiss() #If You want to Dismiss the Alert.
``` |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | ```
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
#do something
if EC.alert_is_present:
print "Alert Exists"
driver.switch_to_alert().accept()
print "Alert accepted"
else:
print "No alert exists"
```
More about excepted\_c... | **Try The Code below! Working Fine for me!**
```
alert = driver.switch_to.alert
try:
alert.accept() #If you want to Accept the Alert
except:
alert.dismiss() #If You want to Dismiss the Alert.
``` |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | Python Webdriver Script:
```
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://sandbox.dev/alert.html")
alert = browser.switch_to_alert()
alert.accept()
browser.close()
```
Webpage (alert.html):
```
<html><body>
<script>alert("hey");</script>
</body></html>
```
Running the webd... | I am using Ruby bindings but here what I found in Selenium Python Bindings 2 documentation:
<http://readthedocs.org/docs/selenium-python/en/latest/index.html>
Selenium WebDriver has built-in support for handling popup dialog boxes. After you’ve triggerd and action that would open a popup, you can access the alert with... |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | If you want to Accept or Click the popup, regardless of for what it is then
```
alert.accept
```
Where
`alert` is object of class `selenium.webdriver.common.alert.Alert(driver)`
and `accept` is method of that object
[Source](https://www.selenium.dev/selenium/docs/api/py/webdriver/selenium.webdriver.common.alert.htm... | I am using Ruby bindings but here what I found in Selenium Python Bindings 2 documentation:
<http://readthedocs.org/docs/selenium-python/en/latest/index.html>
Selenium WebDriver has built-in support for handling popup dialog boxes. After you’ve triggerd and action that would open a popup, you can access the alert with... |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | I am using Ruby bindings but here what I found in Selenium Python Bindings 2 documentation:
<http://readthedocs.org/docs/selenium-python/en/latest/index.html>
Selenium WebDriver has built-in support for handling popup dialog boxes. After you’ve triggerd and action that would open a popup, you can access the alert with... | that depends on the javascript function that handles the form submission
if there's no such function try to submit the form using post |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | Python Webdriver Script:
```
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://sandbox.dev/alert.html")
alert = browser.switch_to_alert()
alert.accept()
browser.close()
```
Webpage (alert.html):
```
<html><body>
<script>alert("hey");</script>
</body></html>
```
Running the webd... | If you want to Accept or Click the popup, regardless of for what it is then
```
alert.accept
```
Where
`alert` is object of class `selenium.webdriver.common.alert.Alert(driver)`
and `accept` is method of that object
[Source](https://www.selenium.dev/selenium/docs/api/py/webdriver/selenium.webdriver.common.alert.htm... |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | If you want to Accept or Click the popup, regardless of for what it is then
```
alert.accept
```
Where
`alert` is object of class `selenium.webdriver.common.alert.Alert(driver)`
and `accept` is method of that object
[Source](https://www.selenium.dev/selenium/docs/api/py/webdriver/selenium.webdriver.common.alert.htm... | **Try The Code below! Working Fine for me!**
```
alert = driver.switch_to.alert
try:
alert.accept() #If you want to Accept the Alert
except:
alert.dismiss() #If You want to Dismiss the Alert.
``` |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | Python Webdriver Script:
```
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://sandbox.dev/alert.html")
alert = browser.switch_to_alert()
alert.accept()
browser.close()
```
Webpage (alert.html):
```
<html><body>
<script>alert("hey");</script>
</body></html>
```
Running the webd... | that depends on the javascript function that handles the form submission
if there's no such function try to submit the form using post |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | ```
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
#do something
if EC.alert_is_present:
print "Alert Exists"
driver.switch_to_alert().accept()
print "Alert accepted"
else:
print "No alert exists"
```
More about excepted\_c... | I am using Ruby bindings but here what I found in Selenium Python Bindings 2 documentation:
<http://readthedocs.org/docs/selenium-python/en/latest/index.html>
Selenium WebDriver has built-in support for handling popup dialog boxes. After you’ve triggerd and action that would open a popup, you can access the alert with... |
8,631,524 | Clearly, the intention of this animation is to turn all "editable" elements to a blue color in 300 ms, and then slowly fade back to the body background color over the course of 1000 ms. Basically, make them "blink".
```
$('#highlight_button').click( function (e) {
var x = $('body').css('background-color');
$('... | 2011/12/25 | [
"https://Stackoverflow.com/questions/8631524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927604/"
] | If you want to Accept or Click the popup, regardless of for what it is then
```
alert.accept
```
Where
`alert` is object of class `selenium.webdriver.common.alert.Alert(driver)`
and `accept` is method of that object
[Source](https://www.selenium.dev/selenium/docs/api/py/webdriver/selenium.webdriver.common.alert.htm... | that depends on the javascript function that handles the form submission
if there's no such function try to submit the form using post |
45,976,281 | I'm trying to use google-vision to fetch text from an image (uploaded to AWS S3) and store it in AWS Dynamo DB. I'm encountering dependency conflicts on jackson-core as both google-api and aws-java-sdk are using two different versions.
---
**Dependency Hierarchy**
>
> google-api-client: 1.22.0 uses jackson-core: 2.... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45976281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8541830/"
] | Don't use ordinary Python lists for your stacks. Use Lisp-style linked lists, so your stacks share most of their structure with each other and building a new stack with an additional element is constant time:
```
def empty_stack():
return ()
def push(stack, item):
return (item, stack)
def stack_to_list(stack):... | You can just bulk copy it:
```
def copyList(thelist, number_of_copies):
return tuple(thelist[:] for _ in xrange(number_of_copies))
a, b, c = copyList(range(10), 3)
```
Here you have a [live example](https://repl.it/K9gC/0) |
20,475,309 | I'm trying to do a post of the mapped `KnockoutJS` model. I can see when debugging it, the `JSON` is correct. But the server shows that `Product` is 0 (empty). While it does contain 1 item.
`MVC Controller`:
```
[HttpPost]
public ActionResult Test(MyModel model, FormCollection fc)
{
return RedirectToAction("index"... | 2013/12/09 | [
"https://Stackoverflow.com/questions/20475309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1085263/"
] | Here is a full working tested example (sending a model back from the controller and posting):
**Controller**
```
public ActionResult Test()
{
var model = new MyModel();
model.Products = new List<Product> { new Product { Id = 2, Name = "bread" } };
return View(model);
}
[HttpPost]
public ActionResult Test... | After investigating some more with fiddler, it turned out that I was getting a 500 error with this message:
```
System.MissingMethodException: No parameterless constructor defined for this object.
```
After adding the parameterless constructor in the model, I still got the error message. This was caused because I ha... |
31,471,279 | I'm using QT 5.5.0.
When I compile a program, it shows “no type named 'u16string' in namespace 'std'”. The interesting part is that I compiled it successfully in the past, why is it failing now? It seems to be trouble with `qstring.h`.
How do I fix it? Here is where the error happen
```
#ifndef QSTRING_H
#define Q... | 2015/07/17 | [
"https://Stackoverflow.com/questions/31471279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4041114/"
] | >
> The interesting part is that I compiled it successfully in the past, why is it failing now?
>
>
>
Earlier you would have included some library's header which in turn included `<string>`; this, after some update perhaps, would've stopped including it directly and thus the error.
>
> How to fix it?
>
>
>
I... | The problem is in the file ExpGame.pro.I delete code as bellow:
QMAKE\_CXXFLAGS += -std=c++11
And it is OK. |
31,471,279 | I'm using QT 5.5.0.
When I compile a program, it shows “no type named 'u16string' in namespace 'std'”. The interesting part is that I compiled it successfully in the past, why is it failing now? It seems to be trouble with `qstring.h`.
How do I fix it? Here is where the error happen
```
#ifndef QSTRING_H
#define Q... | 2015/07/17 | [
"https://Stackoverflow.com/questions/31471279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4041114/"
] | To fix it:
1. as the Qt on mac is built by clang, in "Qt Creator" -> "Preferences" -> "Kits", you should set "Compiler" to clang.
2. instead of writing "QMAKE\_CXXFLAGS += -std=c++11", add below config to your .pro file:
```
CONFIG += c++11
```
<https://forum.qt.io/topic/56064/solved-problem-with-qt-5-5/11> | >
> The interesting part is that I compiled it successfully in the past, why is it failing now?
>
>
>
Earlier you would have included some library's header which in turn included `<string>`; this, after some update perhaps, would've stopped including it directly and thus the error.
>
> How to fix it?
>
>
>
I... |
31,471,279 | I'm using QT 5.5.0.
When I compile a program, it shows “no type named 'u16string' in namespace 'std'”. The interesting part is that I compiled it successfully in the past, why is it failing now? It seems to be trouble with `qstring.h`.
How do I fix it? Here is where the error happen
```
#ifndef QSTRING_H
#define Q... | 2015/07/17 | [
"https://Stackoverflow.com/questions/31471279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4041114/"
] | To fix it:
1. as the Qt on mac is built by clang, in "Qt Creator" -> "Preferences" -> "Kits", you should set "Compiler" to clang.
2. instead of writing "QMAKE\_CXXFLAGS += -std=c++11", add below config to your .pro file:
```
CONFIG += c++11
```
<https://forum.qt.io/topic/56064/solved-problem-with-qt-5-5/11> | The problem is in the file ExpGame.pro.I delete code as bellow:
QMAKE\_CXXFLAGS += -std=c++11
And it is OK. |
28,366,665 | I am unable to create Shared Preference file I have been struggling with this for 2 days please help,I am new here.In my app I am having 15 question each on different screens and I want to store the text of the option selected so that I can use it in future.
My Code
public class QuestionPagerFragment extends Fragment ... | 2015/02/06 | [
"https://Stackoverflow.com/questions/28366665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3699550/"
] | Try to change commit() into apply() something like this:
```
public void click(){
SharedPreferences prefs = getActivity().getSharedPreferences( "your.project.package.name", 0 ); // don't use short id because sharedPreferences is a global file
SharedPreferences.Editor editor = prefs.edit();
editor.putString( ... | This code Will help you to store values
```
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
Editor editor = pref.edit();
```
// Storing data as KEY/VALUE pair
```
editor.putBoolean("key_name1", true); // Saving boolean - true/false
editor.putInt("key_name2"... |
28,366,665 | I am unable to create Shared Preference file I have been struggling with this for 2 days please help,I am new here.In my app I am having 15 question each on different screens and I want to store the text of the option selected so that I can use it in future.
My Code
public class QuestionPagerFragment extends Fragment ... | 2015/02/06 | [
"https://Stackoverflow.com/questions/28366665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3699550/"
] | Try to change commit() into apply() something like this:
```
public void click(){
SharedPreferences prefs = getActivity().getSharedPreferences( "your.project.package.name", 0 ); // don't use short id because sharedPreferences is a global file
SharedPreferences.Editor editor = prefs.edit();
editor.putString( ... | Try deleting this line:
SharedPreferences prefs = getActivity().getSharedPreferences( "idValue", 0 ); |
65,793,800 | I am building an Azure Function project, so I cannot target .NET 5. Instead, my project is a `netcoreapp3.1`.
However, when my project is built, anytime there is some information printed, I see dotnet 5 being mentioned. Example:
>
> ##[warning]/usr/share/dotnet/sdk/5.0.101/Microsoft.Common.CurrentVersion.targets(2123... | 2021/01/19 | [
"https://Stackoverflow.com/questions/65793800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5021151/"
] | You need to separate three things:
* the build SDK being used to perform the build steps
* the *target* platform which defines the API features available in the core packages (used by the build SDK)
* the *runtime* platform being used to actually execute your application, which is expected to support the *target* plat... | There's a difference between the .NET Core version Visual Studio (or Rider) uses for *building* the project and the version used for running the target application. By default, the latest installed version is used for building, and it runs against the version specified with the `<TargetFramework>` entry in the .csproj ... |
35,343,689 | I have much data with several timestamps and I just recognized that some are in "dd.mm.YYYY" which works very well with `date("Y-m-d", strtotime($input));` but some are in "dd.mm.YY" and this does not work anymore - it always returns the current date.
My problem is that my data is too huge to fix this problem manually... | 2016/02/11 | [
"https://Stackoverflow.com/questions/35343689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1794338/"
] | Here you go...
```
$date = "20.02.71"; // sample date... (common German format)
$date = DateTime::createFromFormat('d.m.y', $date);
echo $date->format('Y-m-d');
```
will result in:
>
> 1971-02-20
>
>
>
Create a DateTime object, then format it to anything you want... | Well you can replace the `.` by `-`, you could do something like the following:
```
$date = str_replace(".", "-", "mm.dd.YY")
```
This would return
```
mm-dd-YY
```
You could use [date\_parse\_from\_format](http://php.net/manual/en/function.date-parse-from-format.php) which would convert any formate into the form... |
41,021,730 | I have this jQuery code
```
if (date != !date) {
console.log(date);
}
```
The `date` is an array, or `null`. If it's an array, I want to log it, if it is `null` I want to stop it right there. I thought the `!= !var` was exactly for this purpose. Still when I try this, I do also get `null` console logs. How come? | 2016/12/07 | [
"https://Stackoverflow.com/questions/41021730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4632458/"
] | Try this, it should catch everything in the else...
```
if(Array.isArray(date)){
console.log(date);
}
else {
console.log('not array');
}
``` | Try this:
```
if (date){
console.log(date);
}
``` |
41,021,730 | I have this jQuery code
```
if (date != !date) {
console.log(date);
}
```
The `date` is an array, or `null`. If it's an array, I want to log it, if it is `null` I want to stop it right there. I thought the `!= !var` was exactly for this purpose. Still when I try this, I do also get `null` console logs. How come? | 2016/12/07 | [
"https://Stackoverflow.com/questions/41021730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4632458/"
] | x is always not equal to !x (this is what `x!= !x` means).
You want something like : does x exist ? Is it null ?
```
if (date != null) {
console.log(date);
}
```
```js
var x1;
var x2 = [1,2];
if(x1 != null) // <- false
console.log(x1);
if(x2 != null) // <- true
console.log(x2);
``` | Try this:
```
if (date){
console.log(date);
}
``` |
41,021,730 | I have this jQuery code
```
if (date != !date) {
console.log(date);
}
```
The `date` is an array, or `null`. If it's an array, I want to log it, if it is `null` I want to stop it right there. I thought the `!= !var` was exactly for this purpose. Still when I try this, I do also get `null` console logs. How come? | 2016/12/07 | [
"https://Stackoverflow.com/questions/41021730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4632458/"
] | Try this, it should catch everything in the else...
```
if(Array.isArray(date)){
console.log(date);
}
else {
console.log('not array');
}
``` | So you need to find out whether some value is an array or not. Here is another way to do this as recommended by the ECMAScript standard. For more infos about this see this post: [Check if object is array?](https://stackoverflow.com/questions/4775722/check-if-object-is-array)
```js
var date = ['one', 'two', 'three'];
... |
41,021,730 | I have this jQuery code
```
if (date != !date) {
console.log(date);
}
```
The `date` is an array, or `null`. If it's an array, I want to log it, if it is `null` I want to stop it right there. I thought the `!= !var` was exactly for this purpose. Still when I try this, I do also get `null` console logs. How come? | 2016/12/07 | [
"https://Stackoverflow.com/questions/41021730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4632458/"
] | x is always not equal to !x (this is what `x!= !x` means).
You want something like : does x exist ? Is it null ?
```
if (date != null) {
console.log(date);
}
```
```js
var x1;
var x2 = [1,2];
if(x1 != null) // <- false
console.log(x1);
if(x2 != null) // <- true
console.log(x2);
``` | So you need to find out whether some value is an array or not. Here is another way to do this as recommended by the ECMAScript standard. For more infos about this see this post: [Check if object is array?](https://stackoverflow.com/questions/4775722/check-if-object-is-array)
```js
var date = ['one', 'two', 'three'];
... |
44,654,101 | I've built a nested flexbox grid that I'll be using for individual gateways. Currently, presumably due to the use of `outline`, the content within each container is running over into (and being hidden by) the whitespace surrounding each gateway, which acts as spacing between each div.
Is there a better way to handle t... | 2017/06/20 | [
"https://Stackoverflow.com/questions/44654101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2291689/"
] | You can get the functionality done with map/itertools.izip\_longest in python 2.x or itertools.zip\_longest in python 3.x
With that said,
* iterate through all elements in the result of map function
* for `each` sublist, you can use the sum() inbuilt function of python.
* to handle the none values, check if `None` is... | ```
import numpy as np
def Add(a, b):
a, b = map(np.array, (a, b))
if a.size > b.size:
a[:b.size] += b
return a
else:
b[:a.size] += a
return b
```
Example usage:
```
>>> Add([1,2], [3])
array([ 4., 2.])
>>> Add([0,0,0,2], _)
array([ 4., 2., 0., 2.])
```
The first l... |
44,654,101 | I've built a nested flexbox grid that I'll be using for individual gateways. Currently, presumably due to the use of `outline`, the content within each container is running over into (and being hidden by) the whitespace surrounding each gateway, which acts as spacing between each div.
Is there a better way to handle t... | 2017/06/20 | [
"https://Stackoverflow.com/questions/44654101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2291689/"
] | You can get the functionality done with map/itertools.izip\_longest in python 2.x or itertools.zip\_longest in python 3.x
With that said,
* iterate through all elements in the result of map function
* for `each` sublist, you can use the sum() inbuilt function of python.
* to handle the none values, check if `None` is... | Another solution:
```
def add_shortest(a, b):
a = numpy.array(a)
b = numpy.array(b)
common_length = min(a.size, b.size)
a[:common_length] += b[:common_length]
return a
add_shortest(numpy.arange(2), numpy.arange(3)) # array([0, 2])
add_shortest(numpy.arange(3), numpy.arange(3)) # array([0, 2, 4]... |
13,839,254 | I am creating a child process and passing some arguments to it.
Now, the child process starts execution from the next line of code, but will I have to write another int main () separately for the child process, as below, or would it just use the already written code for int main() of the parent process?
```
creat... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13839254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/966739/"
] | Are you confusing Windows `CreateProcess` with UNIX `fork()`? The two operating systems are different in the way that processes are created. With Windows you have to execute an exe file from the beginning, you can't continue as the child process after `CreateProcess` as you can with `fork` on UNIX. Your statement "the ... | Please read the documentation of `[CreateProcess()](http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx)` again.
The function takes the filename of the program to run in the new process. The nested function you're showing is not valid C. |
14,102,007 | note that I am not asking what are the methods to convert lowercase letters to UPPERCASE letters in C++ but instead, I want to know which of these two methods in the codes below (Upper1 and Upper2) are better than the other one and what's the reason, programming wise.
```
#include <string>
#include <iostream>
#include... | 2012/12/31 | [
"https://Stackoverflow.com/questions/14102007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1123627/"
] | The main difference between the two proposed solutions is that
`Upper2` sort of works, regardless of the platform; `Upper1`
makes assumptions concerning the encoding, and doesn't work on
any modern platform that I know of. (It assumes ASCII, and
ASCII is, for all intents and purposes, dead.)
Of course, neither really... | 1. *toupper()* can handle non-ASCII character
2. Syntax wise, *Upper2()* is less error-prone
3. Not too sure about this, but i think *toupper()* is slower |
14,102,007 | note that I am not asking what are the methods to convert lowercase letters to UPPERCASE letters in C++ but instead, I want to know which of these two methods in the codes below (Upper1 and Upper2) are better than the other one and what's the reason, programming wise.
```
#include <string>
#include <iostream>
#include... | 2012/12/31 | [
"https://Stackoverflow.com/questions/14102007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1123627/"
] | The usage of toupper won't make sense if you have letters from other languages than English A-Z alphabet, e.g. the Germanic ä, ö or ü, and various accented letters in French/Spanish, and of course, if the input is a "germano-latin" language at all, for example Russian. [As pointed out by James, that may require Unicode... | 1. *toupper()* can handle non-ASCII character
2. Syntax wise, *Upper2()* is less error-prone
3. Not too sure about this, but i think *toupper()* is slower |
14,102,007 | note that I am not asking what are the methods to convert lowercase letters to UPPERCASE letters in C++ but instead, I want to know which of these two methods in the codes below (Upper1 and Upper2) are better than the other one and what's the reason, programming wise.
```
#include <string>
#include <iostream>
#include... | 2012/12/31 | [
"https://Stackoverflow.com/questions/14102007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1123627/"
] | The main difference between the two proposed solutions is that
`Upper2` sort of works, regardless of the platform; `Upper1`
makes assumptions concerning the encoding, and doesn't work on
any modern platform that I know of. (It assumes ASCII, and
ASCII is, for all intents and purposes, dead.)
Of course, neither really... | The usage of toupper won't make sense if you have letters from other languages than English A-Z alphabet, e.g. the Germanic ä, ö or ü, and various accented letters in French/Spanish, and of course, if the input is a "germano-latin" language at all, for example Russian. [As pointed out by James, that may require Unicode... |
52,199,599 | I'm trying to convert a Visual SourceSafe Repository to Git while keeping the exact version history. So I've tried using <https://github.com/trevorr/vss2git>. It worked, but it didn't keep the history. So I tried using TFS as a middleman. I used The latest version of TFS and its upgrade wizard but it didn't keep the hi... | 2018/09/06 | [
"https://Stackoverflow.com/questions/52199599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789912/"
] | You can try <https://github.com/azarkevich/VssSvnConverter>, but it is not user friendly.
(Despite it`s name it can convert VSS to Git)
Also this tool does not keep history of file/directory moves/renames. File will have history with latest name. | I've found the solution, and the programs I used do work. It's just that I tried to move too much data, so it would just glitch and not store the history. I'm not sure exactly the amount of data I can safely move, but I now have a history |
52,199,599 | I'm trying to convert a Visual SourceSafe Repository to Git while keeping the exact version history. So I've tried using <https://github.com/trevorr/vss2git>. It worked, but it didn't keep the history. So I tried using TFS as a middleman. I used The latest version of TFS and its upgrade wizard but it didn't keep the hi... | 2018/09/06 | [
"https://Stackoverflow.com/questions/52199599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789912/"
] | Here is the solution which worked for me a couple years ago. When I tried the mentioned vss2git, it has blown our 9GB vss database in 103GB over a weekend without reaching the end.
So I took the TFS server (2010) as middleman and it worked. The TFS 2010 could import VSS database directly, I am not sure about newer one... | You can try <https://github.com/azarkevich/VssSvnConverter>, but it is not user friendly.
(Despite it`s name it can convert VSS to Git)
Also this tool does not keep history of file/directory moves/renames. File will have history with latest name. |
52,199,599 | I'm trying to convert a Visual SourceSafe Repository to Git while keeping the exact version history. So I've tried using <https://github.com/trevorr/vss2git>. It worked, but it didn't keep the history. So I tried using TFS as a middleman. I used The latest version of TFS and its upgrade wizard but it didn't keep the hi... | 2018/09/06 | [
"https://Stackoverflow.com/questions/52199599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789912/"
] | Here is the solution which worked for me a couple years ago. When I tried the mentioned vss2git, it has blown our 9GB vss database in 103GB over a weekend without reaching the end.
So I took the TFS server (2010) as middleman and it worked. The TFS 2010 could import VSS database directly, I am not sure about newer one... | I've found the solution, and the programs I used do work. It's just that I tried to move too much data, so it would just glitch and not store the history. I'm not sure exactly the amount of data I can safely move, but I now have a history |
49,476,176 | I know it is possible to use TextureView in ExoPlayer. But I cannot find any sample on how to implement this functionality in a proper way. Could you please help me on this issue? | 2018/03/25 | [
"https://Stackoverflow.com/questions/49476176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4671981/"
] | The `PlayerView` has an xml attribute `surface_type` which let's you choose whether you want to use a `SurfaceView` or a `TextureView`.
(Note: `SimpleExoPlayerView` has been renamed to `PlayerView` in recent versions since it only depends on the `Player` interface and not on SimpelExoPlayerView anymore.)
You can cho... | From [the documentation](https://google.github.io/ExoPlayer/guide.html):
>
> If you require fine-grained control over the player controls and the `Surface` onto which video is rendered, you can set the player’s target `SurfaceView`, `TextureView`, `SurfaceHolder` or `Surface` directly using SimpleExoPlayer’s `setVide... |
49,476,176 | I know it is possible to use TextureView in ExoPlayer. But I cannot find any sample on how to implement this functionality in a proper way. Could you please help me on this issue? | 2018/03/25 | [
"https://Stackoverflow.com/questions/49476176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4671981/"
] | From [the documentation](https://google.github.io/ExoPlayer/guide.html):
>
> If you require fine-grained control over the player controls and the `Surface` onto which video is rendered, you can set the player’s target `SurfaceView`, `TextureView`, `SurfaceHolder` or `Surface` directly using SimpleExoPlayer’s `setVide... | Note, `TextureView` can only be used in a hardware accelerated window. When rendered in software, TextureView will draw nothing. so after set surface type
```
<com.google.android.exoplayer2.ui.PlayerView android:id="@+id/player_view"
app:surface_type="texture_view"
android:layout_width="match_parent"
android:layout... |
49,476,176 | I know it is possible to use TextureView in ExoPlayer. But I cannot find any sample on how to implement this functionality in a proper way. Could you please help me on this issue? | 2018/03/25 | [
"https://Stackoverflow.com/questions/49476176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4671981/"
] | The `PlayerView` has an xml attribute `surface_type` which let's you choose whether you want to use a `SurfaceView` or a `TextureView`.
(Note: `SimpleExoPlayerView` has been renamed to `PlayerView` in recent versions since it only depends on the `Player` interface and not on SimpelExoPlayerView anymore.)
You can cho... | Note, `TextureView` can only be used in a hardware accelerated window. When rendered in software, TextureView will draw nothing. so after set surface type
```
<com.google.android.exoplayer2.ui.PlayerView android:id="@+id/player_view"
app:surface_type="texture_view"
android:layout_width="match_parent"
android:layout... |
141,378 | How can I add custom classes for links into main menu in Drupal 8. This is template for my main menu called `menu--main.html.twig`
```
{% import _self as menus %}
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if... | 2014/12/21 | [
"https://drupal.stackexchange.com/questions/141378",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/24385/"
] | I finally solved it using next syntax in Twig template
```
{{ link(item.title, item.url.setOptions({'set_active_class' : TRUE, 'attributes' : {'class' : 'main-nav__link'}})) }}
``` | file name
/var/www/html/drupal/themes/theme\_name/templates/navigation/menu.html.twig
we are checking menu name in if condition
{% if menu\_name ==’account’ %}
below is the whole code you may copy and replace it
```
{#
/**
* @file
* Theme override to display a menu.
*
* Available variables:
* - me... |
141,378 | How can I add custom classes for links into main menu in Drupal 8. This is template for my main menu called `menu--main.html.twig`
```
{% import _self as menus %}
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if... | 2014/12/21 | [
"https://drupal.stackexchange.com/questions/141378",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/24385/"
] | Just incase someone stumbles upon this, Martin's solve above breaks URL fragments as it overrides the URL options completely. The better approach is here:
```
{{ link(item.title, item.url.setOption('attributes', {'class' : 'main-nav__link'})) }}
``` | file name
/var/www/html/drupal/themes/theme\_name/templates/navigation/menu.html.twig
we are checking menu name in if condition
{% if menu\_name ==’account’ %}
below is the whole code you may copy and replace it
```
{#
/**
* @file
* Theme override to display a menu.
*
* Available variables:
* - me... |
141,378 | How can I add custom classes for links into main menu in Drupal 8. This is template for my main menu called `menu--main.html.twig`
```
{% import _self as menus %}
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if... | 2014/12/21 | [
"https://drupal.stackexchange.com/questions/141378",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/24385/"
] | Just replace
```
{{ link(item.title, item.url) }}
```
by
```
{{ link(item.title, item.url, { 'class':['main-nav__link']}) }}
``` | file name
/var/www/html/drupal/themes/theme\_name/templates/navigation/menu.html.twig
we are checking menu name in if condition
{% if menu\_name ==’account’ %}
below is the whole code you may copy and replace it
```
{#
/**
* @file
* Theme override to display a menu.
*
* Available variables:
* - me... |
70,001,069 | I am trying to extract a specific value from a JSON column in SQL Server. Unfortunately I have read several posts on this topic but still cannot figure out how to translate their solutions to what I need. I am looking to extract "foo testing" but simply do not understand how to get at this with a nested JSON. Can someo... | 2021/11/17 | [
"https://Stackoverflow.com/questions/70001069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6100400/"
] | The statement depends on the structure of the parsed JSON, in your case you need to use two nested `OPENJSON()` calls and additinal `APPLY` operators. Note, that you need to use `AS JSON` in a `"values"` column definition to specify that the referenced property contains an inner JSON array and the type of that column m... | you can use following query
```
;with summery as(
SELECT *
FROM OPENJSON((SELECT value FROM OPENJSON(@json)))
WITH (
id NVARCHAR(50) 'strict $.id',
status NVARCHAR(50) '$.status',
subStatus NVARCHAR(50) '$.subStatus',
[values] NVARCHAR(max) '$.values' AS JSON
)
)
select id,status,subStatus... |
10,915,734 | Have anyone experienced this error, from the Apple's developer console?

The strange thing is that according to the next screen, everything has been perfect:

At last, my push notification does not work,... | 2012/06/06 | [
"https://Stackoverflow.com/questions/10915734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127493/"
] | I have found a workaround for this:
```
sub vcl_fetch {
// Fix a strange problem: HTTP 301 redirects to the same page sometimes go in$
if (beresp.http.Location == "http://" + req.http.host + req.url) {
if (req.restarts > 2) {
unset beresp.http.Location;
#set beresp.http.X-Restarts = req.restarts;
... | The accepted answer by @philip updated for Varnish 4:
```
sub vcl_backend_response {
#Fix a strange problem: HTTP 301 redirects to the same page sometimes go in$
if (beresp.http.Location == "http://" + bereq.http.host + bereq.url) {
if (bereq.retries > 2) {
unset beresp.http.Location;
#set beresp.http... |
28,704,867 | In a PowerShell window:
```none
PS C:\> echo -abc.def.ghi
-abc
.def.ghi
```
For some reason, the combination of a hyphen and period cause Powershell to split the argument into two lines.
It does not occur with without the hyphen:
```none
PS C:\> echo abc.def.ghi
abc.def.ghi
```
Nor does it occur when there are n... | 2015/02/24 | [
"https://Stackoverflow.com/questions/28704867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/634824/"
] | I've disassembled Microsoft.PowerShell.Utility to look at the code of `Write-Output` nothing special there, it just iterates through InputObject and passes each to a `WriteObject` method implemented by the current `ICommandRuntime`.
 (\*) of objects hinges on that yo... | **[One option is to use meteorite impacts](https://pseudoastro.wordpress.com/2008/10/21/dating-planetary-surfaces-with-craters-why-there-is-no-crisis-in-crater-count-dating/)**
miteorite [dating](https://pseudoastro.wordpress.com/2008/10/21/dating-planetary-surfaces-with-craters-why-there-is-no-crisis-in-crater-count-... |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | Extra-solar and extra-terrestrial material is very hard to date, which works for you
====================================================================================
To elaborate on @Gawainuk's comment: **all** [radiometric dating](https://en.wikipedia.org/wiki/Radiometric_dating) (\*) of objects hinges on that yo... | **Date the base by accumulation of solar wind particles.**
The solar wind moves out from the sun and hits everything in the solar system. Our magnetosphere and atmosphere deflect most of the fast moving charged particles. In places like the moon without that protection, fast moving particles hit and accumulate. In thi... |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | Extra-solar and extra-terrestrial material is very hard to date, which works for you
====================================================================================
To elaborate on @Gawainuk's comment: **all** [radiometric dating](https://en.wikipedia.org/wiki/Radiometric_dating) (\*) of objects hinges on that yo... | There are a large number of problems with this scenario. First things first Carbon-14 Dating tops out at around 50,000 years. Second Carbon-14 dating relies on the fact that Earth has a steady rate of Carbon-14 creation and terrestrial creatures have a predictable rate of carbon uptake, thus dates in the nuclear age ar... |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | Carbon dating is problematic, as you need to know level of Carbon 14 in the atmosphere at the time the animal or plant you are studying died. But there are other radiometric dating methods which might work.
The simplest thing would perhaps be if they found a machine similar to a [radioisotope thermoelectric generator... | There are a large number of problems with this scenario. First things first Carbon-14 Dating tops out at around 50,000 years. Second Carbon-14 dating relies on the fact that Earth has a steady rate of Carbon-14 creation and terrestrial creatures have a predictable rate of carbon uptake, thus dates in the nuclear age ar... |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | How about if an artifact is found that dates the base. Something like a calendar left by the occupants of the base and one of your characters puzzles out how to read it. Maybe something related to position of the stars relative to the solar system or something. | **Date the base by accumulation of solar wind particles.**
The solar wind moves out from the sun and hits everything in the solar system. Our magnetosphere and atmosphere deflect most of the fast moving charged particles. In places like the moon without that protection, fast moving particles hit and accumulate. In thi... |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | Extra-solar and extra-terrestrial material is very hard to date, which works for you
====================================================================================
To elaborate on @Gawainuk's comment: **all** [radiometric dating](https://en.wikipedia.org/wiki/Radiometric_dating) (\*) of objects hinges on that yo... | How about if an artifact is found that dates the base. Something like a calendar left by the occupants of the base and one of your characters puzzles out how to read it. Maybe something related to position of the stars relative to the solar system or something. |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | How about if an artifact is found that dates the base. Something like a calendar left by the occupants of the base and one of your characters puzzles out how to read it. Maybe something related to position of the stars relative to the solar system or something. | **[One option is to use meteorite impacts](https://pseudoastro.wordpress.com/2008/10/21/dating-planetary-surfaces-with-craters-why-there-is-no-crisis-in-crater-count-dating/)**
miteorite [dating](https://pseudoastro.wordpress.com/2008/10/21/dating-planetary-surfaces-with-craters-why-there-is-no-crisis-in-crater-count-... |
97,845 | This is for a book. An ancient, badly damaged, base has been found in the asteroid belt. The base has been open to the vacuum of space, although a large proportion of the base is within the body of the asteroid and not on the surface, so has been protected from solar radiations and micro-meteor impacts.
I wanted the p... | 2017/11/14 | [
"https://worldbuilding.stackexchange.com/questions/97845",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/44392/"
] | Extra-solar and extra-terrestrial material is very hard to date, which works for you
====================================================================================
To elaborate on @Gawainuk's comment: **all** [radiometric dating](https://en.wikipedia.org/wiki/Radiometric_dating) (\*) of objects hinges on that yo... | Carbon dating is problematic, as you need to know level of Carbon 14 in the atmosphere at the time the animal or plant you are studying died. But there are other radiometric dating methods which might work.
The simplest thing would perhaps be if they found a machine similar to a [radioisotope thermoelectric generator... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.