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 |
|---|---|---|---|---|---|
33,524,696 | I was under the impression that this syntax:
```
import Router from 'react-router';
var {Link} = Router;
```
has the same final result as this:
```
import {Link} from 'react-router';
```
Can someone explain what the difference is?
(I originally thought it was a [React Router Bug](https://github.com/rackt/react-r... | 2015/11/04 | [
"https://Stackoverflow.com/questions/33524696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | To do this:
```
import {purple, grey} from 'themeColors';
```
*Without repeating `export const` for each symbol*, just do:
```
export const
purple = '#BADA55',
grey = '#l0l',
gray = grey,
default = 'this line actually causes an error';
``` | Except for different exports, it may also lead to
different bundled code by WebPack when using two variant ways to destruct ESM modules:
```js
// react-router
export function Link(str) { /* ... */ }
```
1. Destruct within the `import` statement:
```js
import {Link} from 'react-router';
Link('1');
Link('2');
```
... |
17,446,188 | **Problem resolvedby me**
resolve way :i user ko.js for check bining data in java to resolve my problem! thanks to all
I have this code to show my online users in my chat script (x7chat 3, you can [download it free](http://x7chat.com))
This code is in this file in the script:
x7chatDIR\templates\default\pages\chat.ph... | 2013/07/03 | [
"https://Stackoverflow.com/questions/17446188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2178812/"
] | try like this,in button action action method put this code
```
for(UIView *view in self.view.subviews){
if([view isKindOfClass:[UIProgressView class]]))
[view removeFromSuperView];
}
``` | Remove all progress bars from a given view:
```
- (void) removeAllProgressBars:(UIView *)view {
if([view isKindOfClass:[UIProgressView class]]))
[view removeFromSuperView];
else
for (UIView *subView in view.subviews)
[self removeAllProgressBars:view];
}
```
In some other method cal... |
53,685,534 | I have my SQL Server connection string set up like this:
```
String strConnection = @"Data Source=servername;Initial Catalog=dbname; User ID =user; Password =pass;";
```
Then I have a combobox which shows all tables in that database. Connection string works fine with one database (initial catalog). But what if I wa... | 2018/12/08 | [
"https://Stackoverflow.com/questions/53685534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2980341/"
] | If that user does have in fact permissions to access the other database - you could just simply use the `ChangeDatabase` method on your `SqlConnection` - like this:
```
string strConnection = @"Data Source=servername;Initial Catalog=dbname; User ID =user; Password =pass;";
using (SqlConnection conn = new SqlConnectio... | Edit Start
1) If you want to show all the tables in all the data bases please populate the combo box the same.
refer: [How do I list all tables in all databases in SQL Server in a single result set?](https://stackoverflow.com/questions/2875768/how-do-i-list-all-tables-in-all-databases-in-sql-server-in-a-single-result-... |
53,685,534 | I have my SQL Server connection string set up like this:
```
String strConnection = @"Data Source=servername;Initial Catalog=dbname; User ID =user; Password =pass;";
```
Then I have a combobox which shows all tables in that database. Connection string works fine with one database (initial catalog). But what if I wa... | 2018/12/08 | [
"https://Stackoverflow.com/questions/53685534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2980341/"
] | I ended up using two comboboxes on my form. One for databases and one for tables. When i choose a database in first combobox, the second one automaticly shows tabels in that database. It is much easier for me to work wit two comboboxes using different connections.
Here is some part of my code with solution:
```
publi... | Edit Start
1) If you want to show all the tables in all the data bases please populate the combo box the same.
refer: [How do I list all tables in all databases in SQL Server in a single result set?](https://stackoverflow.com/questions/2875768/how-do-i-list-all-tables-in-all-databases-in-sql-server-in-a-single-result-... |
53,685,534 | I have my SQL Server connection string set up like this:
```
String strConnection = @"Data Source=servername;Initial Catalog=dbname; User ID =user; Password =pass;";
```
Then I have a combobox which shows all tables in that database. Connection string works fine with one database (initial catalog). But what if I wa... | 2018/12/08 | [
"https://Stackoverflow.com/questions/53685534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2980341/"
] | If that user does have in fact permissions to access the other database - you could just simply use the `ChangeDatabase` method on your `SqlConnection` - like this:
```
string strConnection = @"Data Source=servername;Initial Catalog=dbname; User ID =user; Password =pass;";
using (SqlConnection conn = new SqlConnectio... | I ended up using two comboboxes on my form. One for databases and one for tables. When i choose a database in first combobox, the second one automaticly shows tabels in that database. It is much easier for me to work wit two comboboxes using different connections.
Here is some part of my code with solution:
```
publi... |
16,305,161 | I have two dictionaries,i want to combine these two int a list in the format keys-->values,keys-->values... remove any None or ['']
currently I have the below where I can combine the dicts but not create a combined lists...i have the expecte output..
any inputs appreeciated
```
dict1={'313115': ['313113'], '311957': ... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16305161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2125827/"
] | This should do it:
```
[i for k, v in (dict1.items() + dict2.items()) for i in [k] + (v or []) if i]
```
walk the combined items of the two dicts, then walk the key plus the list of values, returning each item from the second walk that exists.
Returns `['313115', '313113', '311957', '253036', '12345', '305403']` on... | The following line gives you what you want in as efficient a manner as possible, albeit a little verbose:
```
from itertools import chain, ifilter
list(ifilter(None, dict1.viewkeys() | dict2.viewkeys() | set(chain(chain.from_iterable(ifilter(None, dict1.itervalues())), chain.from_iterable(ifilter(None, dict2.itervalu... |
16,305,161 | I have two dictionaries,i want to combine these two int a list in the format keys-->values,keys-->values... remove any None or ['']
currently I have the below where I can combine the dicts but not create a combined lists...i have the expecte output..
any inputs appreeciated
```
dict1={'313115': ['313113'], '311957': ... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16305161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2125827/"
] | The following line gives you what you want in as efficient a manner as possible, albeit a little verbose:
```
from itertools import chain, ifilter
list(ifilter(None, dict1.viewkeys() | dict2.viewkeys() | set(chain(chain.from_iterable(ifilter(None, dict1.itervalues())), chain.from_iterable(ifilter(None, dict2.itervalu... | ```
[each
if isinstance(each, str) else each[0]
for pair in dict(dict1, **dict2).iteritems()
for each in pair
if each not in [[''], None, []]]
``` |
16,305,161 | I have two dictionaries,i want to combine these two int a list in the format keys-->values,keys-->values... remove any None or ['']
currently I have the below where I can combine the dicts but not create a combined lists...i have the expecte output..
any inputs appreeciated
```
dict1={'313115': ['313113'], '311957': ... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16305161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2125827/"
] | This should do it:
```
[i for k, v in (dict1.items() + dict2.items()) for i in [k] + (v or []) if i]
```
walk the combined items of the two dicts, then walk the key plus the list of values, returning each item from the second walk that exists.
Returns `['313115', '313113', '311957', '253036', '12345', '305403']` on... | ```
[each
if isinstance(each, str) else each[0]
for pair in dict(dict1, **dict2).iteritems()
for each in pair
if each not in [[''], None, []]]
``` |
8,309,498 | A bit confused trying to do a string match that accepts this:
Lets say a string S = "Download" Here, S can be "Download" or "DOWNLOAD" or "DoWNload". Thus, any character in the string can be an uppercase or a lowercase. Its rather easy to write a regex match for all upper case or all lower case letters or even a mix o... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8309498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/105167/"
] | To check if `"download"` appears in a string regardless of case, you don't even need a regular expression.
```
"download" in s.lower()
```
will also work fine. | What's wrong with: `S == "Download"` ?
Your question isn't clear about whether you want to ignore case or not.
`"I found it difficult to write a regex match that follows a particular order"`
A particular order of capitalisation or just a particular order of letters?
If you want to ignore case, just convert to lower... |
8,309,498 | A bit confused trying to do a string match that accepts this:
Lets say a string S = "Download" Here, S can be "Download" or "DOWNLOAD" or "DoWNload". Thus, any character in the string can be an uppercase or a lowercase. Its rather easy to write a regex match for all upper case or all lower case letters or even a mix o... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8309498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/105167/"
] | First, you can covert the string before the match
```
re.search(expr, s.lower())
```
If you want to ingore the case, you can use flag `re.IGNORECASE`
```
re.search(expr, s, re.IGNORECASE)
```
See other available flags here: <http://docs.python.org/library/re.html#module-contents> | What's wrong with: `S == "Download"` ?
Your question isn't clear about whether you want to ignore case or not.
`"I found it difficult to write a regex match that follows a particular order"`
A particular order of capitalisation or just a particular order of letters?
If you want to ignore case, just convert to lower... |
8,309,498 | A bit confused trying to do a string match that accepts this:
Lets say a string S = "Download" Here, S can be "Download" or "DOWNLOAD" or "DoWNload". Thus, any character in the string can be an uppercase or a lowercase. Its rather easy to write a regex match for all upper case or all lower case letters or even a mix o... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8309498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/105167/"
] | To check if `"download"` appears in a string regardless of case, you don't even need a regular expression.
```
"download" in s.lower()
```
will also work fine. | ```
s="Download"
re.findall("^[A-Z][a-z]*$",s)
['Download']
s="DownloaD"
re.findall("^[A-Z][a-z]*$",s)
[]
s="download"
re.findall("^[A-Z][a-z]*$",s)
[]
```
If I understand your question correctly, you want to match a string with the First Cap followed by small case. In such a scenario, the above should work. |
8,309,498 | A bit confused trying to do a string match that accepts this:
Lets say a string S = "Download" Here, S can be "Download" or "DOWNLOAD" or "DoWNload". Thus, any character in the string can be an uppercase or a lowercase. Its rather easy to write a regex match for all upper case or all lower case letters or even a mix o... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8309498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/105167/"
] | First, you can covert the string before the match
```
re.search(expr, s.lower())
```
If you want to ingore the case, you can use flag `re.IGNORECASE`
```
re.search(expr, s, re.IGNORECASE)
```
See other available flags here: <http://docs.python.org/library/re.html#module-contents> | ```
s="Download"
re.findall("^[A-Z][a-z]*$",s)
['Download']
s="DownloaD"
re.findall("^[A-Z][a-z]*$",s)
[]
s="download"
re.findall("^[A-Z][a-z]*$",s)
[]
```
If I understand your question correctly, you want to match a string with the First Cap followed by small case. In such a scenario, the above should work. |
23,545,471 | I'm having a PhoneGap application that downloads a file from my server. The problem is that if I point phonegap FileTransfer.download uri directly to the file, the file can be downloaded. But, if I point the URI of FileTransfer.download to a download.php file that has the following:
```
header ("Content-type: octet/st... | 2014/05/08 | [
"https://Stackoverflow.com/questions/23545471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/786466/"
] | I did not know that i understood you correctly or not. However, you can easily use insert function in vectors Here is simply example:
```
std::vector<int> X;
std::vector<int> Y;
std::vector<int> XandY; // result vector.
XandY.reserve( X.size() + Y.size() ); // allocate memory for result vector
XandY.insert( Xan... | I think I understand what you are getting at - you want something like this:
```
vector<vector<char>> tmp_fof;
vector<char> first_of_first;
first_of_first.insert(first_of_first.end(), tmp_fof.at(1).begin(), tmp_fof.at(1).end())
first_of_first.insert(first_of_first.end(), tmp_fof.at(1).begin(), tmp_fof.at(1).end())
`... |
23,545,471 | I'm having a PhoneGap application that downloads a file from my server. The problem is that if I point phonegap FileTransfer.download uri directly to the file, the file can be downloaded. But, if I point the URI of FileTransfer.download to a download.php file that has the following:
```
header ("Content-type: octet/st... | 2014/05/08 | [
"https://Stackoverflow.com/questions/23545471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/786466/"
] | I don't understand why you need those intermediate vectors. As far as I can understand you have three vectors and you want to copy the content of the first two to the last one. This can be simply achieve with `std::copy`.
```
vector<vector<char>> v1 = {{'a', 'b', 'c'}, {'d', 'e'}};
vector<vector<char>> v2 = {{'e', 'f'... | I think I understand what you are getting at - you want something like this:
```
vector<vector<char>> tmp_fof;
vector<char> first_of_first;
first_of_first.insert(first_of_first.end(), tmp_fof.at(1).begin(), tmp_fof.at(1).end())
first_of_first.insert(first_of_first.end(), tmp_fof.at(1).begin(), tmp_fof.at(1).end())
`... |
104,273 | How can i disable ALL pop-up notification on Xubuntu 11.10
I have tried: `sudo apt-get remove notify-osd`
Which resulted in
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package notify-osd is not installed, so not removed
0 upgraded, 0 newly installed, 0 to rem... | 2012/02/14 | [
"https://askubuntu.com/questions/104273",
"https://askubuntu.com",
"https://askubuntu.com/users/46448/"
] | Obviously removing `notify-osd` won't work because Xubuntu doesn't use it, it uses `xfce4-notifyd`.
So if you want to *remove* them, remove that package.
```
sudo apt-get remove xfce4-notifyd
```
If you only want to disable them use this:
```
sudo mv /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notification... | Try this:
```
sudo mv /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service.disabled
``` |
104,273 | How can i disable ALL pop-up notification on Xubuntu 11.10
I have tried: `sudo apt-get remove notify-osd`
Which resulted in
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package notify-osd is not installed, so not removed
0 upgraded, 0 newly installed, 0 to rem... | 2012/02/14 | [
"https://askubuntu.com/questions/104273",
"https://askubuntu.com",
"https://askubuntu.com/users/46448/"
] | Obviously removing `notify-osd` won't work because Xubuntu doesn't use it, it uses `xfce4-notifyd`.
So if you want to *remove* them, remove that package.
```
sudo apt-get remove xfce4-notifyd
```
If you only want to disable them use this:
```
sudo mv /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notification... | you can also run this command and will be able to edit what you want to be shown or blocked in notifications. I had to do this for SMB4K for drive mounts as it was driving me nuts lol.
xfce4-notifyd-config |
104,273 | How can i disable ALL pop-up notification on Xubuntu 11.10
I have tried: `sudo apt-get remove notify-osd`
Which resulted in
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package notify-osd is not installed, so not removed
0 upgraded, 0 newly installed, 0 to rem... | 2012/02/14 | [
"https://askubuntu.com/questions/104273",
"https://askubuntu.com",
"https://askubuntu.com/users/46448/"
] | you can also run this command and will be able to edit what you want to be shown or blocked in notifications. I had to do this for SMB4K for drive mounts as it was driving me nuts lol.
xfce4-notifyd-config | Try this:
```
sudo mv /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service.disabled
``` |
16,184,782 | Currently I am facing a hell like situation, four of my client websites were hacked before 10 days. I messed up a lot with them and three of them are working fine(running magento) after my long mess up with them, but one of them(running word press) is still facing the same situation and I could not figure out what was ... | 2013/04/24 | [
"https://Stackoverflow.com/questions/16184782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2049618/"
] | That PHP echo this
```
<script type="text/javascript" language="javascript" > e=eval;v="0x";a=0;try{a&=2}catch(q){a=1}if(!a){try{document["body"]^=~1;}catch(q){a2="!"}z="2f!6d!7c!75!6a!7b!70!76!75!27!2f!30!27!82!14!11!27!27!27!27!7d!68!79!27!6a!27!44!27!6b!76!6a!7c!74!6c!75!7b!35!6a!79!6c!68!7b!6c!4c!73!6c!74!6c!75!7b... | You'll have to change the permissions of your root directory files or the files that are being repeatedly hacked to 444. Make sure you change permissions of all index.php/html files and .htaccess files to read only. Also giving a 555 permission js directory and files would help.
This is the quick solution to stop bein... |
9,133,982 | I recently deployed my app engine app and when I went to check it, the css was not showing in Chrome or in my Iphone Safari browser. I simply redeployed (no code changes at all) and now the site is running fine. What is going on here? Is this a bug, or is something wrong with my code but only sometimes? | 2012/02/03 | [
"https://Stackoverflow.com/questions/9133982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190629/"
] | I am experiencing the same issue, sometimes css - sometimes not Interestingly enough, if I use chrome, and select "Request Desktop Site" from the menu, my css loads fine.
I would assume this is something to do with the headers sent in the request, specifying the browser to be mobile.
I'll investigate further and upda... | Sounds like a deployment problem. Speaking in generalities, code doesn't "sometimes" work unless it's written that way.. in which case it's working 100% of the time :) |
9,133,982 | I recently deployed my app engine app and when I went to check it, the css was not showing in Chrome or in my Iphone Safari browser. I simply redeployed (no code changes at all) and now the site is running fine. What is going on here? Is this a bug, or is something wrong with my code but only sometimes? | 2012/02/03 | [
"https://Stackoverflow.com/questions/9133982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190629/"
] | I am experiencing the same issue, sometimes css - sometimes not Interestingly enough, if I use chrome, and select "Request Desktop Site" from the menu, my css loads fine.
I would assume this is something to do with the headers sent in the request, specifying the browser to be mobile.
I'll investigate further and upda... | This has happened to me when the css is cached and out of date. Your browser cannot detect that the css file has changed, and doesn't bother reloading it. Could it be that the CSS showed up the second time, not because you redeployed, but because your browsers were refreshed? |
71,635,991 | I need to pick few keys and values (only name and age) from below array of objects.
```
const studentList = [{"id": "1", "name": "s1". "age": 10, "gender" : "m", "subject": "Maths"},{"id": "2", "name": "s2". "age": 11, "gender" : "m", "subject": "Maths"}]
```
I can achieve that using map and lodash pick as in below.... | 2022/03/27 | [
"https://Stackoverflow.com/questions/71635991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15788977/"
] | The `studentList` assignment is not valid (it contains dots instead of comma). Corrected in the snippet. You can map `name` and `age` in one go using:
```js
const studentList = [
{"id": "1", "name": "s1", "age": 10, "gender" : "m", "subject": "Maths"},
{"id": "2", "name": "s2", "age": 11, "gender" : "m", "subject"... | You can retrieve multiple properties, just like in the example below.
```js
const studentList = [{"id": "1", "name": "s1", "age": 10, "gender" : "m", "subject": "Maths"},{"id": "2", "name": "s2", "age": 11, "gender" : "m", "subject": "Maths"}]
let nameArr = (studentList).map(({ name, age }) => {
return {'name': nam... |
1,397,683 | How can I configure Syncthing from command line to share a folder with another computer with a specific ID?
Hello,
Having looked in a bit into the matter, using Syncthing from command line on Linux seems to be possible but requires either editing the configuration file or using the REST API.
How can I configure Sync... | 2019/01/23 | [
"https://superuser.com/questions/1397683",
"https://superuser.com",
"https://superuser.com/users/610400/"
] | I think with the following commands you should be able to write a script for that.
We have a local machine and a Server. I assume you have ssh access to the Server.
Get your ID and the Server's ID with
```
syncthing cli show system | jq .myID
```
On the Server
```
syncthing cli config devices add --device-id $Loc... | Sorry, I couldn't find the answer to this question either. The best I could do was to [open an SSH tunnel](https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding), so that I could temporarily access the server's web GUI from my local computer:
```
ssh -L 8080:localhost:8384 your.host.name
```
Then you can acce... |
1,397,683 | How can I configure Syncthing from command line to share a folder with another computer with a specific ID?
Hello,
Having looked in a bit into the matter, using Syncthing from command line on Linux seems to be possible but requires either editing the configuration file or using the REST API.
How can I configure Sync... | 2019/01/23 | [
"https://superuser.com/questions/1397683",
"https://superuser.com",
"https://superuser.com/users/610400/"
] | I think with the following commands you should be able to write a script for that.
We have a local machine and a Server. I assume you have ssh access to the Server.
Get your ID and the Server's ID with
```
syncthing cli show system | jq .myID
```
On the Server
```
syncthing cli config devices add --device-id $Loc... | I found a solution to your problem. I documented how to do it in this gist: <https://gist.github.com/Jonny-exe/9bad76c3adc6e916434005755ea70389>
If you don't want to read the whole gist, here are the main commands:
`syncthing cli config devices add --device-id $DEVICE_ID_B`
`syncthing cli config folders $FOLDER_ID d... |
34,674 | Let's say I have standard scenario of commerce site that has categories on the left and items on the right.
What I would like to do is that when user clicks on category it will pass it's ID to js, js will get all items from API by using that id and load them very prettily to my content.
It looks all cool and pro but ... | 2012/09/18 | [
"https://webmasters.stackexchange.com/questions/34674",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/11428/"
] | What URL can users bookmark to get back to that *item* and tell their friends? What URL can search engines index to show that item in the SERPs?
I would have said that an e-commerce site should be implemented initially so that it *works* without any JavaScript at all. You click a category (an HTML anchor) that makes a... | You can use lynx or the tool in google webmaster tools to show you what google is seeing.
(The content you load via AJAX will not be seen by crawlers).
PS, you should also keep in mind that not every user has javascript enabled. |
3,435,502 | Let us suppose $x\_1,...,x\_n$ be $n$ nodes and we interpolate the functions $f$ with lagrange polynomial
Then my book says $$\int\_a^b f(x) dx=\sum A\_i f(x\_i), A\_i=\int\_a^b l\_i(x)dx $$where $ l\_i(x\_j) = \delta\_{ij}$
for all polynomial for degree at most n. Certainly this is true for polynomial of degree $n$... | 2019/11/14 | [
"https://math.stackexchange.com/questions/3435502",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/517603/"
] | Just like with linear differential equations, you have to find a particular solution of the non-homogeneous recurrence equation, and add it to the general solution of the homogeneous recurrence equation.
Now the non-homogeneous part has the standard form of an exponential times a linear polynomial. So a particular sol... | Hint
WLOG $a\_m=b\_m+c\_0+c\_1m+\cdots$
Replace the values of $a\_j, j=n,n+1,n+2$ and compare the coefficients of $n^0,n^1,n^2$
to find $c\_j=0\forall j\ge2$ and the values of $c\_0,c\_1$
so that $$b\_{n+2}-5b\_{n+1}-14b\_n=0$$ |
53,202,892 | 1. I want to remove border of QToolButton when mouse hover.
[](https://i.stack.imgur.com/ndGDE.png)
2. I want to change icon image of QAction when press QToolButton.
[](https://i.stack... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53202892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5977835/"
] | For a “Warm-up”, I started with a `QPushButton`. This class provides the signals `pressed()` and `released()` which can be used to change the icon resp.
`testQPushButtonDownUp.cc`:
```
#include <QtWidgets>
int main(int argc, char **argv)
{
qDebug() << "Qt Version:" << QT_VERSION_STR;
QApplication app(argc, argv)... | For remove border of QToolButton you can use style sheet like this ( i tested it is work ):
```
QToolButton { border: 0px;}
QToolButton:pressed {background-color: red;}
```
It is remove border and fill background of pressed tool button.
You can not change image of pressed button because usally we add QAction on QTo... |
5,511,250 | I'm new in Android and I'm trying to make a program which captures an audio sound and then displays the frequencies that exist within it. I found an example that draws the graphic portion of a graphic equalizer. In this example it is used an object of type
AudioRecord to capture audio sound. The technique used to break... | 2011/04/01 | [
"https://Stackoverflow.com/questions/5511250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/687279/"
] | Here is the working code. I tried it myself. It works fine.
```
package com.example.frequencytest;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.media.AudioFormat;
import android.media.AudioReco... | Yes, I also had this project and i had the same error as you but after adding the permission below all is okay now. Most probably you didn't add it in the correct place in the androidmanifest.xml.It should be outside the application tag.
```
<uses-permission android:name="android.permission.RECORD_AUDIO">
</use... |
5,511,250 | I'm new in Android and I'm trying to make a program which captures an audio sound and then displays the frequencies that exist within it. I found an example that draws the graphic portion of a graphic equalizer. In this example it is used an object of type
AudioRecord to capture audio sound. The technique used to break... | 2011/04/01 | [
"https://Stackoverflow.com/questions/5511250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/687279/"
] | Here is the working code. I tried it myself. It works fine.
```
package com.example.frequencytest;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.media.AudioFormat;
import android.media.AudioReco... | onProgressUpdate method should belong to RecordAudio where as in your code it is belonging to AudioProcessing. Check the braces, it should work based on above correction |
57,729,844 | I want to get the entity Ids of Google Datastore auto generated by Google Datastore (I can't use uuid) in Apache Beam pipeline using python.
I'm using the following code to pass the entity kind and key values when building the entities in Datastore.
```
from googledatastore import helper as datastore_helper
entity =... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57729844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3433050/"
] | It's an artifical limitation imposed by the sdk, by this `if` statement inside `WriteToDatastore`:
```
if client_entity.key.is_partial:
raise ValueError('Entities to be written to Cloud Datastore must '
'have complete keys:\n%s' % client_entity)
```
<https://beam.apache.org/releases/pydoc/... | In Cloud Datastore, if the numeric id for the entity is omitted when an entity is created, then datastore will generate one using the ‘kind’.
The allocateId() from the cloud datastore client API allows you to generate a block of IDs based on an incomplete/partial key, typically when only the namespace is specified. T... |
36,702,702 | I have this javascript that calls a function after a 1.5 second timer. In Chrome, it works great. In Firefox, I get a Reference Error: accessTransition is not defined. Any explanation for why this is the case?
```
$('#next-btn').click(function(e) {
window.setTimeout(accessTransition, 1500);
function accessTra... | 2016/04/18 | [
"https://Stackoverflow.com/questions/36702702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1819315/"
] | Try with:
```
function accessTransition()
{
$('.fact-intro-1').slideUp(1000);
$('.fact-text-1').css('display', 'inline-block');
}
$('#next-btn').click(function(e) {
window.setTimeout(accessTransition, 1500);
}
```
I think timeout cannot get this function because it's nested in event ha... | ```
function accessTransition()
{
$('.fact-intro-1').slideUp(1000);
$('.fact-text-1').css('display', 'inline-block');
}
$('#next-btn').click(function(e) {
window.setTimeout(accessTransition, 1500);
}
```
You should define the function outside the event handler. |
19,523 | Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts? | 2017/03/07 | [
"https://buddhism.stackexchange.com/questions/19523",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | Some Buddhist texts say that there were previous Buddhas (and that there will be others in the distant future): that they too taught Buddhism; and that the current Buddha rediscovered Buddhism.
For example, in the commentary to [Dhammapada verse 183](http://www.tipitaka.net/tipitaka/dhp/verseload.php?verse=183):
>
>... | Because the Buddha discovered reality as it actually is, rather than coming up with a personalised conception of what it is, the Dhamma is open and discoverable to all, whether there is a Buddha to light the path or not.
Specifically within Buddhism there is a concept of [Pratyekabuddha-hood](https://en.m.wikipedia.o... |
19,523 | Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts? | 2017/03/07 | [
"https://buddhism.stackexchange.com/questions/19523",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | Some Buddhist texts say that there were previous Buddhas (and that there will be others in the distant future): that they too taught Buddhism; and that the current Buddha rediscovered Buddhism.
For example, in the commentary to [Dhammapada verse 183](http://www.tipitaka.net/tipitaka/dhp/verseload.php?verse=183):
>
>... | According to Buddhism, there was no way to escape from *samsara* (the cycle of ignorance, craving & ego-becoming) before the Buddha.
What is called 'Hinduism' arose after Buddhism. Before Buddhism, the main religion was called 'Brahmanism', which focused on 'Brahma' (god) & the Brahmin caste. There appears to be no e... |
19,523 | Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts? | 2017/03/07 | [
"https://buddhism.stackexchange.com/questions/19523",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | Some Buddhist texts say that there were previous Buddhas (and that there will be others in the distant future): that they too taught Buddhism; and that the current Buddha rediscovered Buddhism.
For example, in the commentary to [Dhammapada verse 183](http://www.tipitaka.net/tipitaka/dhp/verseload.php?verse=183):
>
>... | According to Theravada tradition, Buddhas come and go over countless eons. Only in the times when their teaching is alive and true will we get a chance of escaping from this endless samsara. Every once in a great while, after a long period of spiritual darkness blankets the world, an individual is eventually born who, ... |
19,523 | Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts? | 2017/03/07 | [
"https://buddhism.stackexchange.com/questions/19523",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | Because the Buddha discovered reality as it actually is, rather than coming up with a personalised conception of what it is, the Dhamma is open and discoverable to all, whether there is a Buddha to light the path or not.
Specifically within Buddhism there is a concept of [Pratyekabuddha-hood](https://en.m.wikipedia.o... | According to Buddhism, there was no way to escape from *samsara* (the cycle of ignorance, craving & ego-becoming) before the Buddha.
What is called 'Hinduism' arose after Buddhism. Before Buddhism, the main religion was called 'Brahmanism', which focused on 'Brahma' (god) & the Brahmin caste. There appears to be no e... |
19,523 | Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts? | 2017/03/07 | [
"https://buddhism.stackexchange.com/questions/19523",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | Because the Buddha discovered reality as it actually is, rather than coming up with a personalised conception of what it is, the Dhamma is open and discoverable to all, whether there is a Buddha to light the path or not.
Specifically within Buddhism there is a concept of [Pratyekabuddha-hood](https://en.m.wikipedia.o... | According to Theravada tradition, Buddhas come and go over countless eons. Only in the times when their teaching is alive and true will we get a chance of escaping from this endless samsara. Every once in a great while, after a long period of spiritual darkness blankets the world, an individual is eventually born who, ... |
19,523 | Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts? | 2017/03/07 | [
"https://buddhism.stackexchange.com/questions/19523",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | According to Theravada tradition, Buddhas come and go over countless eons. Only in the times when their teaching is alive and true will we get a chance of escaping from this endless samsara. Every once in a great while, after a long period of spiritual darkness blankets the world, an individual is eventually born who, ... | According to Buddhism, there was no way to escape from *samsara* (the cycle of ignorance, craving & ego-becoming) before the Buddha.
What is called 'Hinduism' arose after Buddhism. Before Buddhism, the main religion was called 'Brahmanism', which focused on 'Brahma' (god) & the Brahmin caste. There appears to be no e... |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | You can use the [typeof](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) operator:
```
var x = 1;
console.log(typeof x);
x = 'asdf';
console.log(typeof x);
```
Prints:
```
number
string
``` | [`typeof`](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) does the trick *most* of the time. But if your `Number` or `String` is not a primitive, it will return `'object'`. Generally, that is not what you want.
```
var str = new String('Hello');
typeof str; // 'object'
```
`typeof` a... |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | You can use the [typeof](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) operator:
```
var x = 1;
console.log(typeof x);
x = 'asdf';
console.log(typeof x);
```
Prints:
```
number
string
``` | use JavaScript built in `typeof` function
```
var s = "string",
n = 1; // number
if(typeof s == 'string'){
//do stuff for string
}
if(typeof n == 'number'){
//do stuff for number
}
``` |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | You can use the [typeof](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) operator:
```
var x = 1;
console.log(typeof x);
x = 'asdf';
console.log(typeof x);
```
Prints:
```
number
string
``` | Here's a function that favors `typeof`, but defaults to `Object.prototype.toString` *(which is much slower)* when needed.
This way some of those unexpected values you'll get from `new String('x')` or `null` or `/regex/` (in Chrome) are covered.
```
var type = (function () {
var toString = Object.prototype.toStrin... |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | You can use the [typeof](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) operator:
```
var x = 1;
console.log(typeof x);
x = 'asdf';
console.log(typeof x);
```
Prints:
```
number
string
``` | Others have already talked about the `typeof` operator, and use of `Object.prototype.toString`, but if you want to specifically test for an int as compared to any sort of number then you can do some variation of this:
```
function isInt(n) {
return typeof n === "number" && n === Math.floor(n);
}
```
(Insert all t... |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | [`typeof`](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) does the trick *most* of the time. But if your `Number` or `String` is not a primitive, it will return `'object'`. Generally, that is not what you want.
```
var str = new String('Hello');
typeof str; // 'object'
```
`typeof` a... | use JavaScript built in `typeof` function
```
var s = "string",
n = 1; // number
if(typeof s == 'string'){
//do stuff for string
}
if(typeof n == 'number'){
//do stuff for number
}
``` |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | [`typeof`](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof) does the trick *most* of the time. But if your `Number` or `String` is not a primitive, it will return `'object'`. Generally, that is not what you want.
```
var str = new String('Hello');
typeof str; // 'object'
```
`typeof` a... | Others have already talked about the `typeof` operator, and use of `Object.prototype.toString`, but if you want to specifically test for an int as compared to any sort of number then you can do some variation of this:
```
function isInt(n) {
return typeof n === "number" && n === Math.floor(n);
}
```
(Insert all t... |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | Here's a function that favors `typeof`, but defaults to `Object.prototype.toString` *(which is much slower)* when needed.
This way some of those unexpected values you'll get from `new String('x')` or `null` or `/regex/` (in Chrome) are covered.
```
var type = (function () {
var toString = Object.prototype.toStrin... | use JavaScript built in `typeof` function
```
var s = "string",
n = 1; // number
if(typeof s == 'string'){
//do stuff for string
}
if(typeof n == 'number'){
//do stuff for number
}
``` |
7,438,701 | >
> **Possible Duplicate:**
>
> [Finding Variable Type in JavaScript](https://stackoverflow.com/questions/4456336/finding-variable-type-in-javascript)
>
>
>
How can I test if a value is a string or an int? Something like...
X = ?
if X is an Int {}
if X is a String {}
Thanks! | 2011/09/15 | [
"https://Stackoverflow.com/questions/7438701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666564/"
] | Here's a function that favors `typeof`, but defaults to `Object.prototype.toString` *(which is much slower)* when needed.
This way some of those unexpected values you'll get from `new String('x')` or `null` or `/regex/` (in Chrome) are covered.
```
var type = (function () {
var toString = Object.prototype.toStrin... | Others have already talked about the `typeof` operator, and use of `Object.prototype.toString`, but if you want to specifically test for an int as compared to any sort of number then you can do some variation of this:
```
function isInt(n) {
return typeof n === "number" && n === Math.floor(n);
}
```
(Insert all t... |
119,452 | I have a `README.md` in a repository on GitHub that shows a code block of an example `.gitignore`.
I know that one can mark a code block with a language tag in GitHub Flavored Markdown (GFM).
For example, the following would be properly prettified in GFM:
```
json
{
"json": true
}
```
Also, I know that the definit... | 2018/08/07 | [
"https://webapps.stackexchange.com/questions/119452",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/83120/"
] | Short answer
============
Google Forms doesn't include a feature to do this.
Explanation
===========
In contrary as occurs with Google Documents, Sheets and Slides, Google Forms doesn't have the revision history feature.
Unfortunately Google Drive doesn't keep revisions of Google Forms either.
Suggested action
===... | You can undo. Go to the top of the page where you hit send. There are three dots. Click on that to find undo! |
47,802,156 | Is there a way to automatically generate rows with different dates, but keep the rest of the data the same?
For example, I'm trying to generate the below once every 7 weeks? Is there a keen way to do this, or should I repeat the below manually?
```
INSERT INTO courses ( CourseCode ,OrganiserID ,TopicID ,StartDate ,En... | 2017/12/13 | [
"https://Stackoverflow.com/questions/47802156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9095965/"
] | You can simply use `GROUP BY` and `MAX`:
```
SELECT t.PK_DocumentInstanceChapterExpanded
, MAX(t.StatusColumn)
FROM (
SELECT PK_DocumentInstanceChapterExpanded
, STATUSFLAG
FROM SECTION_TABLE1
WHERE PK_DocumentInstanceChapterExpanded = 50734
UNION
SELEC... | Now I don't know how many rows there could be per table per id. But if there can be only 1 why don't you just write:
```
SELECT s.PK_DocumentInstanceChapterExpanded
,case when i.STATUSFLAG is not null then i.STATUSFLAG else s.STATUSFLAG end
FROM SECTION_TABLE s
LEFT JOIN ITEM_TABLE i ON i.FK_SECTIONKEY = s.PK_SECTION... |
3,729,337 | For context, here is the question:
Let $X\_1$ and $X\_2$ form a random sample from a Poisson distribution. The poisson distribution has a mean of 1. Let $Y=\min(X\_1,X\_2)$. P(Y=1)=...
I have the solution, but I just don't understand 1 key aspect of it aspects of it.
Here goes:
The solution starts with $P(Y=1)=\big... | 2020/06/21 | [
"https://math.stackexchange.com/questions/3729337",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/711318/"
] | Alternative Solution
====================
I'm not a fan of the solution you're provided, so I'll approach this in a slightly different way.
So we have this random variable $Y$, which is the smallest of $X\_1$ and $X\_2$. We want the probability that $Y = 1$. This could occur in one of three ways, keeping in mind that... | You want to avoid double counting $P(X\_1=1 \cap X\_2=1)$.
You could write
$$P(Y=1)=P(X\_1=1\cap X\_2 = 1)+P(X\_1=1\cap X\_2 \gt 1)+P(X\_2=1\cap X\_1\gt1)$$
and then use $P(X\_1=1\cap X\_2 = 1)+P(X\_1=1\cap X\_2 \gt 1) = P(X\_1=1\cap X\_2 \geq 1)$, while for a distribution on integers you have $P(X\_2=1\cap X\_1\gt1... |
981,234 | I have to write $\sum\_{k=0}^{\infty} \cos(k \pi / 6)$ in form: $a+bi$.
I think I should consider $z=\cos(k \pi / 6)+i\sin(k \pi / 6)$ and also use the fact that $\sum \_{k=0}^{\infty}x^n=\frac{1}{1-x}$ if $|x|<1$
But i don't know if thats correct and how can I transform this. | 2014/10/19 | [
"https://math.stackexchange.com/questions/981234",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/121568/"
] | $$\cos\frac{k\pi}6=\begin{cases}1&\;,\;\;k=0,12,24,\ldots=0\pmod{12}\\
\frac{\sqrt3}2&\;,\;\;k=1,11,13,23,\ldots=1,11\pmod{12}\\
\frac12&\;,\;\;k=2,10,14,22,\ldots=2,10\pmod{12}\\etc.\end{cases}$$
You can fill up the lines missing in "*etc.*"...and thus the series cannot possibly converge (why?) | You want divergent summation of real numbers written a complex number. Perhaps the goal of the exercise is to check whether this sum is convergent?
If this is the case, some hints:
* complete your summation with $i\sum\_{k=0}^\infty \sin(k\pi/6) $, you want the real part of this new summation.
* Remember that $cis(kx... |
74,146,731 | I am following Cloud Guru K8S course and have issues with the template they provided. I can't see what’s wrong.
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: blue-deployment
spec:
replicas: 1
selector:
matchLabels:
app: bluegreen-test
color: blue
template:
metadata:
labels:... | 2022/10/20 | [
"https://Stackoverflow.com/questions/74146731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4741620/"
] | Your template is correct, it's just YAML that's complaining. YAML doesn't accept tabs, only 2 spaces. If you copied + pasted, it could have caused a discrepancy. If you want to stay on terminal, `vim my-deployment.yml` and make sure each "tab" is 2 spaces. This is quite time-consuming especially in vim so the alternati... | Nothing wrong with the yaml syntax. I just deployed it and it works. see below screenshot. Suggest you to use vi editor and add the manifest and then try. It should work
[](https://i.stack.imgur.com/yirr4.png)
You can validate the syntax at the below... |
238,134 | **Update:** Most answers are about how to write a wrapping interface or what is a good wrapper around ADO. but my question is more about when to do so and when not.
I never found a good rule for deciding when to write a wrapper and when not. As nobody came up with a suggestion I think the reviewers are right in that t... | 2014/05/06 | [
"https://softwareengineering.stackexchange.com/questions/238134",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/129324/"
] | John Gaughan already said it, *"If you need a utility function to wrap the usage of another function, that is a sign that whatever you are wrapping was poorly designed."*
Indeed, ADO.NET is old and requires to write much boilerplate, inelegant code which can easily cause mistakes (like forgetting to open a connection ... | The biggest fallacy in your question is that vendors think that hard about their APIs. :) I (half) kid, but truthfully, vendors don't always write the best APIs. Sometimes this is to provide ultimate low-level flexibility. Other times this is to meet obscure or otherwise unknowable requirements. Yet other times its bec... |
203,644 | Let $\sim$ be an equivalence relation on a set $X$. Also, there is a natural function $p:X\to \tilde X$ where $\tilde X$ is a set of all equivalence classes. (Equivalence classes are defined as, $[x]=\{y \in X |x\sim y\}$ where the equivalence relation is reflexive, symmetric, and transitive $\forall (x,y)$). This natu... | 2012/09/27 | [
"https://math.stackexchange.com/questions/203644",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/40164/"
] | It's always surjective, as every equivalence class contains at least one element. It will fail to be injective any time two different elements are equivalent to each other, as if $x\sim y$ then $[x]=[y]$. So it is only injective if the equivalence relation is that of equality. | It is always surjective, and it is injective exactly when $\sim$ is the relation of equality. |
6,298,861 | We have a web application that creates a web page. In one section of the page, a graph is diplayed. The graph is created by calling graphing program with an "img src=..." tag in the HTML body. The graphing program takes a number of arguments about the height, width, legends, etc., and the data to be graphed. The only w... | 2011/06/09 | [
"https://Stackoverflow.com/questions/6298861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791636/"
] | One solution is to have the page put data into the session, then have the img generation script pull from that session information. For example page stores $\_SESSION['tempdata12345'] and creates an img src="myimage.php?data=tempdata12345". Then myimage.php pulls from the session information. | One solution is to have the web application that generates the entire page to pre-emptively
call the actual graphing program with all the necessary parameters.
Perhaps store the generated image in a /tmp folder.
Then have the web application create the web page and send it to the browser with a "img src=..." tag that, ... |
26,169,446 | I am trying to find a way to obtain the anchor text of all of the incoming links to a wikipedia page (from other pages within wikipedia). I've read a few papers that that have done experiments with this information (eg. <http://web2py.iiit.ac.in/research_centres/publications/download/inproceedings.pdf.809e1550d80bca59.... | 2014/10/02 | [
"https://Stackoverflow.com/questions/26169446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1893354/"
] | Solution
--------
Place your controls in a VBox (or other similar root layout pane) and [set the VBox alignment](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/layout/VBox.html#setAlignment-javafx.geometry.Pos-) to center.
Layout Advice
-------------
This is my personal advice on starting with layout in Jav... | ### Resize Issue
Make sure you are adding a size to your `JFrame`
```
frame.setSize(500, 300);
```
### Center Issue
*I am not sure whether you are taking about centering your frame or the JavaFX controls in the `GridPane`, so I am adding answers for both of them*
### Frame Screen Centering
```
Dimension dim = To... |
58,513,764 | Given a dataframe that looks something like this:
```
date,score
2019-10-01,5
2019-10-02,4
2019-10-03,3
2019-10-04,6
```
How do I go about calculating the mean of `score` using subsequent/following rows, such that it looks/behaves like this:
```
date,score
2019-10-01,5,(5+4+3+6)/4
2019-10-02,4,(4+3+6)/3
2019-10-03,... | 2019/10/23 | [
"https://Stackoverflow.com/questions/58513764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302064/"
] | Try `expanding` on the reversed series
```
df['calc_mean'] = df.score[::-1].expanding(1).mean()
Out[228]:
date score calc_mean
0 2019-10-01 5 4.500000
1 2019-10-02 4 4.333333
2 2019-10-03 3 4.500000
3 2019-10-04 6 6.000000
``` | `cumsum` on reverse series:
```
df['cum_mean'] = (df[::-1].assign(c=1)
.agg({'score':'cumsum', 'c':'cumsum'})
.assign(cum_mean = lambda x: x['score']/x['c'])
['cum_mean']
)
```
Output:
```
date score cum_mean
0 2019-10-01 ... |
58,513,764 | Given a dataframe that looks something like this:
```
date,score
2019-10-01,5
2019-10-02,4
2019-10-03,3
2019-10-04,6
```
How do I go about calculating the mean of `score` using subsequent/following rows, such that it looks/behaves like this:
```
date,score
2019-10-01,5,(5+4+3+6)/4
2019-10-02,4,(4+3+6)/3
2019-10-03,... | 2019/10/23 | [
"https://Stackoverflow.com/questions/58513764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302064/"
] | Use `cumsum` bottom-up and divide by the `arange`
```
df['cummean'] = df.score[::-1].cumsum()[::-1] / np.arange(len(df), 0, -1)
```
---
```
date score cummean
0 2019-10-01 5 4.500000
1 2019-10-02 4 4.333333
2 2019-10-03 3 4.500000
3 2019-10-04 6 6.000000
``` | `cumsum` on reverse series:
```
df['cum_mean'] = (df[::-1].assign(c=1)
.agg({'score':'cumsum', 'c':'cumsum'})
.assign(cum_mean = lambda x: x['score']/x['c'])
['cum_mean']
)
```
Output:
```
date score cum_mean
0 2019-10-01 ... |
4,803,342 | Could someone describe me a solution to implement a plugin inside an Android application and how could it be sold on the Android Market?
Typically, you create a game whose 4 first levels are free. Then, the user should buy something using the Android Market to unlock additional levels.
A solution could be to list the... | 2011/01/26 | [
"https://Stackoverflow.com/questions/4803342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590392/"
] | It's quite simple in your case, since you don't need any extra logic, but just more levels, so I will stick to this specific case:
You can (or probably already do) have your game levels saved as **resources** in your .apk, so a plug in can be a standard .apk, that will not appear in the list of users-apps. To prevent ... | What I've seen so far on the Android Market are entirely different version of apps for free versus paid content of the same application.
I haven't looked into plug-ins yet so I don't know if this feature is available, but if you can't find it a workaround could be to launch applications and hide them from the add appl... |
45,559,968 | I am using `angularjs` I have two list when I click first one I will push the value into another scope and bind the value to second list. Now my requirement is when first list values which are moved to second list, I need to change the color of moved values in `list1`
Here I attached my fiddle
[Fiddle](https://jsfidd... | 2017/08/08 | [
"https://Stackoverflow.com/questions/45559968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7240783/"
] | You can use `findIndex` and `ng-class` together to check if the second list contains the same item as first. If present apply css class to the first list item.
**JS**:
```
$scope.checkColor = function(text) {
var index = $scope.linesTwos.findIndex(x => x.text === text);
if (index > -1) return true;
... | You can do something like this:
```js
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.lines = [{
text: 'res1'
},
{
text: 'res2'
},
{
text: 'res3'
}
];
$scope.linesTwos = [];
$scope.Team = function(index, text) {
var obj = {};
... |
45,559,968 | I am using `angularjs` I have two list when I click first one I will push the value into another scope and bind the value to second list. Now my requirement is when first list values which are moved to second list, I need to change the color of moved values in `list1`
Here I attached my fiddle
[Fiddle](https://jsfidd... | 2017/08/08 | [
"https://Stackoverflow.com/questions/45559968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7240783/"
] | You can use `findIndex` and `ng-class` together to check if the second list contains the same item as first. If present apply css class to the first list item.
**JS**:
```
$scope.checkColor = function(text) {
var index = $scope.linesTwos.findIndex(x => x.text === text);
if (index > -1) return true;
... | you have to achieve it using ng-class and create a dynamic class style for pushed data please check my working example fiddle
[JS fiddle sample](https://jsfiddle.net/7MhLd/2663/)
**in HTML** nedd to do these changes
`<li ng-click="Team($index,line.text,line)" ng-class="{'pushed':line.pushed}">`
```
<li ng-click="Te... |
45,559,968 | I am using `angularjs` I have two list when I click first one I will push the value into another scope and bind the value to second list. Now my requirement is when first list values which are moved to second list, I need to change the color of moved values in `list1`
Here I attached my fiddle
[Fiddle](https://jsfidd... | 2017/08/08 | [
"https://Stackoverflow.com/questions/45559968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7240783/"
] | You can do something like this:
```js
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.lines = [{
text: 'res1'
},
{
text: 'res2'
},
{
text: 'res3'
}
];
$scope.linesTwos = [];
$scope.Team = function(index, text) {
var obj = {};
... | you have to achieve it using ng-class and create a dynamic class style for pushed data please check my working example fiddle
[JS fiddle sample](https://jsfiddle.net/7MhLd/2663/)
**in HTML** nedd to do these changes
`<li ng-click="Team($index,line.text,line)" ng-class="{'pushed':line.pushed}">`
```
<li ng-click="Te... |
55,217,898 | I set the hint programmatically for a purpose `edittext.SetHint("MyHint");` but it does not work.
```
namespace MhylesApp
{
[Activity(Label = "ToExistingCustomer"/*, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Landscape*/)]
public class ToE... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55217898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9950237/"
] | Loop over the `soup.findAll('p')` to find all the `p` tags and then use `.text` to get their text:
Furthermore, do all that under a `div` with the class `rte` since you don't want the footer paragraphs.
```
from bs4 import BeautifulSoup
import requests
url = 'https://fs.blog/mental-models/'
r = requests.get(url)... | If you want the text of all the `p` tag, you can just loop on them using the `find_all` method:
```
from bs4 import BeautifulSoup
import re
import requests
url = 'https://fs.blog/mental-models/'
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
print(soup)
data = soup.find_all('p')
for p in data:... |
55,217,898 | I set the hint programmatically for a purpose `edittext.SetHint("MyHint");` but it does not work.
```
namespace MhylesApp
{
[Activity(Label = "ToExistingCustomer"/*, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Landscape*/)]
public class ToE... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55217898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9950237/"
] | Loop over the `soup.findAll('p')` to find all the `p` tags and then use `.text` to get their text:
Furthermore, do all that under a `div` with the class `rte` since you don't want the footer paragraphs.
```
from bs4 import BeautifulSoup
import requests
url = 'https://fs.blog/mental-models/'
r = requests.get(url)... | Here is the solution:
```
from bs4 import BeautifulSoup
import requests
import Clock
url = 'https://fs.blog/mental-models/'
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
data = soup.find_all('p')
result = []
for p in data:
result.append(p.get_text())
Clock.schedule_interval(print(resul... |
4,808,875 | I have the following code which detects which search engine and what search term has been used:
```
if (document.referrer.search(/google\.*/i) != -1) {
var start = document.referrer.search(/q=/);
var searchTerms = document.referrer.substring(start + 2);
var end = searchTerms.search(/&/);
end = (end == ... | 2011/01/26 | [
"https://Stackoverflow.com/questions/4808875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241654/"
] | You could define an interface for those classes.
```
interface IRecord
{
string RecordID { get; set; }
string OtherProperties { get; set; }
}
```
and make the method receive the model by using that:
```
[HttpPost]
public ActionResult ValidateRecordID(IRecord model)
{
// TODO: Do some verification code ... | There is no direct way of binding data to a interface/abstract class. The DefaultModelBinder will try to instantiate that type, which is (by definition) impossible.
So, IMHO, you should not use that option. And if you still want to share the same controller action between the two views, the usual way of doing that wou... |
4,808,875 | I have the following code which detects which search engine and what search term has been used:
```
if (document.referrer.search(/google\.*/i) != -1) {
var start = document.referrer.search(/q=/);
var searchTerms = document.referrer.substring(start + 2);
var end = searchTerms.search(/&/);
end = (end == ... | 2011/01/26 | [
"https://Stackoverflow.com/questions/4808875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241654/"
] | You could define an interface for those classes.
```
interface IRecord
{
string RecordID { get; set; }
string OtherProperties { get; set; }
}
```
and make the method receive the model by using that:
```
[HttpPost]
public ActionResult ValidateRecordID(IRecord model)
{
// TODO: Do some verification code ... | If you only need the RecordID, you can just have the controller method take int RecordID and it will pull that out of the form post data instead of building the view model back up and providing that to your action method.
```
[HttpPost]
public ActionResult ValidateRecordID(int RecordID) {
// TODO: Do some verifica... |
4,808,875 | I have the following code which detects which search engine and what search term has been used:
```
if (document.referrer.search(/google\.*/i) != -1) {
var start = document.referrer.search(/q=/);
var searchTerms = document.referrer.substring(start + 2);
var end = searchTerms.search(/&/);
end = (end == ... | 2011/01/26 | [
"https://Stackoverflow.com/questions/4808875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241654/"
] | You could define an interface for those classes.
```
interface IRecord
{
string RecordID { get; set; }
string OtherProperties { get; set; }
}
```
and make the method receive the model by using that:
```
[HttpPost]
public ActionResult ValidateRecordID(IRecord model)
{
// TODO: Do some verification code ... | In the case above your action could accept two strings instead of a concrete type.
Another possibility is having two actions. Each action taking one of your types. I'm assuming that functionality each type is basically the same. Once the values have been extracted hand them off to a method. In your case method will p... |
8,502,471 | How can I remove the default spacing on my JLabels? I'm using the following code to put an image on the JLabel.
```
JLabel image = new JLabel(new ImageIcon("myimage.png"));
```
When I add this image to a JPanel, there is a bit of whitespace around the image. How can I reset this padding to zero? | 2011/12/14 | [
"https://Stackoverflow.com/questions/8502471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016416/"
] | >
> there is a bit of whitespace around the image
>
>
>
What 'whitespace'?

```
import java.awt.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.imageio.ImageIO;
import java.net.URL;
class LabelPaddingTest {
public static v... | not clear from your question, I'd suggest to use proper [LayoutManager](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html), |
8,502,471 | How can I remove the default spacing on my JLabels? I'm using the following code to put an image on the JLabel.
```
JLabel image = new JLabel(new ImageIcon("myimage.png"));
```
When I add this image to a JPanel, there is a bit of whitespace around the image. How can I reset this padding to zero? | 2011/12/14 | [
"https://Stackoverflow.com/questions/8502471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016416/"
] | >
> there is a bit of whitespace around the image
>
>
>
What 'whitespace'?

```
import java.awt.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.imageio.ImageIO;
import java.net.URL;
class LabelPaddingTest {
public static v... | As per the given code,there will not be any white space unless `myimage.png` have a white space around it.Please check. If the problem still persists post an [sscce](http://sscce.org) along with your `myimage.png` |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | You will need some assembly. This is becaused there are some privileged instructions that are needed for operating system design that will not be generated by a C/C++ compiler.
One example is when userside code want to make use of an operating system service (like interprocess communication) it needs to switch from us... | You can write all possible programs in C++. In fact, you can write most programs in most languages, especially if you exclude performance concerns. This concept is known as "Turing completeness" |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | You will need some assembly. This is becaused there are some privileged instructions that are needed for operating system design that will not be generated by a C/C++ compiler.
One example is when userside code want to make use of an operating system service (like interprocess communication) it needs to switch from us... | You could program a complete OS in C++ if you were so inclined (and had a decade or so to spare....) since it does compile to machine code.
It's probably not a 'beginner' task though, and to be honest, plain old C would be a better choice for system level stuff (both the Windows and Linux kernels use C). |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Well ... Typically you will need at least some assembly at the very lowest levels, for machine-dependent initialization and so on.
So "no" strictly speaking, but that can really be a very small proportion, making the real answer "yes".
[BeOS](http://en.wikipedia.org/wiki/BeOS) is an example of an operating system wri... | You may be interested in [this book](https://rads.stackoverflow.com/amzn/click/com/0735611319). It explains how computers work, going from the lowest hardware level to a code.
Cannot recommend it enough!
<http://ecx.images-amazon.com/images/I/31VTerGLfML._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA24... |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | No you cannot.
You need low-level services which are not standardized within programming languages. For example, you need system port and DMA IO, that basically look different on all platforms. This is usually done by inline assembly code on the lowest level, though some C++ compilers will provide you with special ke... | Simply, yes you can. |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Well ... Typically you will need at least some assembly at the very lowest levels, for machine-dependent initialization and so on.
So "no" strictly speaking, but that can really be a very small proportion, making the real answer "yes".
[BeOS](http://en.wikipedia.org/wiki/BeOS) is an example of an operating system wri... | You can write all possible programs in C++. In fact, you can write most programs in most languages, especially if you exclude performance concerns. This concept is known as "Turing completeness" |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Well ... Typically you will need at least some assembly at the very lowest levels, for machine-dependent initialization and so on.
So "no" strictly speaking, but that can really be a very small proportion, making the real answer "yes".
[BeOS](http://en.wikipedia.org/wiki/BeOS) is an example of an operating system wri... | No you cannot.
You need low-level services which are not standardized within programming languages. For example, you need system port and DMA IO, that basically look different on all platforms. This is usually done by inline assembly code on the lowest level, though some C++ compilers will provide you with special ke... |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Well ... Typically you will need at least some assembly at the very lowest levels, for machine-dependent initialization and so on.
So "no" strictly speaking, but that can really be a very small proportion, making the real answer "yes".
[BeOS](http://en.wikipedia.org/wiki/BeOS) is an example of an operating system wri... | Simply, yes you can. |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Well ... Typically you will need at least some assembly at the very lowest levels, for machine-dependent initialization and so on.
So "no" strictly speaking, but that can really be a very small proportion, making the real answer "yes".
[BeOS](http://en.wikipedia.org/wiki/BeOS) is an example of an operating system wri... | You will need some assembly. This is becaused there are some privileged instructions that are needed for operating system design that will not be generated by a C/C++ compiler.
One example is when userside code want to make use of an operating system service (like interprocess communication) it needs to switch from us... |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Yes. C++ is [Turing Complete](http://en.wikipedia.org/wiki/Turing_completeness)... So is Excel, which a clever dude discovered while implementing [a realtime 3D engine](http://www.gamasutra.com/view/feature/3563/microsoft_excel_revolutionary_3d_.php). | You could program a complete OS in C++ if you were so inclined (and had a decade or so to spare....) since it does compile to machine code.
It's probably not a 'beginner' task though, and to be honest, plain old C would be a better choice for system level stuff (both the Windows and Linux kernels use C). |
1,913,551 | I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:
```
SAXParserFactory sf = SAXParserFactory.newInstance();
SAXParser sax = sf.newSAXParser();
sax.parse("english.xml", new DefaultElementHandler("page"){
public void processElement(Element ... | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232814/"
] | Well ... Typically you will need at least some assembly at the very lowest levels, for machine-dependent initialization and so on.
So "no" strictly speaking, but that can really be a very small proportion, making the real answer "yes".
[BeOS](http://en.wikipedia.org/wiki/BeOS) is an example of an operating system wri... | Yes. C++ is [Turing Complete](http://en.wikipedia.org/wiki/Turing_completeness)... So is Excel, which a clever dude discovered while implementing [a realtime 3D engine](http://www.gamasutra.com/view/feature/3563/microsoft_excel_revolutionary_3d_.php). |
8,562,609 | Recently I saw that you could use either
```
$('document').ready(function() {
//Do Code
});
```
or
```
$('window').load(function() {
//Do Code
});
```
for jQuery.
However, they seem the same to me! But clearly aren't.
So my question is: Which one should I use for a website sort of based on animation and asyn... | 2011/12/19 | [
"https://Stackoverflow.com/questions/8562609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1020773/"
] | **`$('document').ready`** runs the code when the DOM is ready, but not when the page itself has loaded, that is, the site has not been painted and content like images have not been loaded.
**`$(window).load`** runs the code when the page has been painted and all content has been loaded. This can be helpful when you ne... | Well first of all you may want to consider using the "ready" event, which you can handler like this:
```
$().ready(function() {
...
});
```
Or, more succinctly and idiomatically:
```
$(function() {
...
});
```
The "load" handler really relates to an actual event, and can be handled on several different sorts ... |
176,351 | My Circuit is:
USBTinyISP <-usi/icsp-> ATTiny85 <-usi/i2c-> [MCP4725](https://www.adafruit.com/products/935).
That is, the [USI](http://www.atmel.com/Images/doc4300.pdf) pins used to program the t85 are also used for i2c in the final circuit.
When I try to flash-program the t85 in-circuit, it fails. If I disconnect ... | 2015/06/19 | [
"https://electronics.stackexchange.com/questions/176351",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/77667/"
] | Add a suitable resistor between any external circuit *that drives an ICSP pin* and the AT chip. The resistor must be high enough that the ISP circuit can override the the external circuit, yet low enough that the external circuit can still drive the AT fast enough. You could start with 1k.
An ICSP capability is a comb... | There are very many options, that you may not think of right away.
One is:

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2ffSE4Z.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
This way the Tiny will still ... |
24,744 | What is the explicit form of the inverse of the function $f:\mathbb{Z}^+\times\mathbb{Z}^+\rightarrow\mathbb{Z}^+$ where $$f(i,j)=\frac{(i+j-2)(i+j-1)}{2}+i?$$ | 2011/03/03 | [
"https://math.stackexchange.com/questions/24744",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1004/"
] | Let $i+j-2 = n$.
We have $f = 1 + 2 + 3 + \cdots + n + i$ with $1 \leq i \leq n+1$. Note that the constraint $1 \leq i \leq n+1$ forces $n$ to be the maximum possible $n$ such that the sum is strictly less than $f$.
Hence given $f$, find the maximum $n\_{max}$ such that $$1 + 2 + 3 + \cdots + n\_{max} < f \leq 1 + 2 ... | Since your function seems to be Cantor's pairing function $p(x,y) = \frac{(x+y)(x+y+1)}{2} + y$ applied to $x= j-2, y = i$, and since the inverse of the pairing function is $p^{-1}(z) = (\frac{\lfloor \frac{\sqrt{8z+1}-1}{2} \rfloor^2 + 3\lfloor \frac{\sqrt{8z+1}-1}{2} \rfloor}{2}-z,z-\frac{\lfloor \frac{\sqrt{8z+1}-1}... |
22,454,696 | I am relatively new to batch scripting particularly in a windows environment. I would like to be able to gather the HDD information about a specific machine through the following command:
```
wmic idecontroller
```
However when I run that command, the output that I recieve looks like this:
```
Availability Captio... | 2014/03/17 | [
"https://Stackoverflow.com/questions/22454696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1424125/"
] | Here you go. Batch doesn't have arrays per se, but you can duplicate an array like this:
```
@echo off
setlocal enabledelayedexpansion
set cnt=0
for /f "tokens=2 delims==" %%a in ('wmic idecontroller get description /value^| Find "="') do (
set /a cnt+=1
set Ide[!cnt!]=%%a
)
for /L %%a in (1,1,%cnt%) do echo !Id... | ```dos
@ECHO OFF
SETLOCAL enabledelayedexpansion
SET "columnname=%~1"
IF NOT DEFINED columnname ECHO require column name as parameter&GOTO :EOF
:: make a tempfile
:maketemp
SET "tempfile=%temp%\%random%"
IF EXIST "%tempfile%*" (GOTO maketemp) ELSE (ECHO.>"%tempfile%a")
:: remove variables starting $
FOR /F "delims==... |
8,374 | Nowadays, everyone talks about it: climate change, and more importantly, how to stop it from happening. Although there's a lot of debate around the topic, the consensus is that by inventing a way of generating clean energy, we can slow down (and maybe even reverse) the effects global warming has on the planet. Using en... | 2019/07/23 | [
"https://sustainability.stackexchange.com/questions/8374",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/6811/"
] | **tl;dr -- For the west coast of the U.S., a 20% decrease in heating demand and 18% increase in cooling demand results in a 5% reduction in carbon emissions from electricity and natural gas usage**
Here's the approach I came up with to try and answer this question with some hard data.
### 1. Find a region of the U.S... | The US isn't the only land mass in the world you know. In much of Africa people and animals are dying in the heat. And on a global scale the man made energy requirements are rising exponentially because of global warming. In Britain for instance people are busy installing air conditioning which they never needed before... |
8,374 | Nowadays, everyone talks about it: climate change, and more importantly, how to stop it from happening. Although there's a lot of debate around the topic, the consensus is that by inventing a way of generating clean energy, we can slow down (and maybe even reverse) the effects global warming has on the planet. Using en... | 2019/07/23 | [
"https://sustainability.stackexchange.com/questions/8374",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/6811/"
] | **tl;dr -- For the west coast of the U.S., a 20% decrease in heating demand and 18% increase in cooling demand results in a 5% reduction in carbon emissions from electricity and natural gas usage**
Here's the approach I came up with to try and answer this question with some hard data.
### 1. Find a region of the U.S... | >
> Wouldn't it therefore be better to have a small rise in global temperature?
>
**No.** The radiative forcing by carbon dioxide does not increase solar radiation that can be captured by solar cells. The warmer temperatures actually **decrease** solar cell output, because solar cells really like cold temperatures a... |
8,374 | Nowadays, everyone talks about it: climate change, and more importantly, how to stop it from happening. Although there's a lot of debate around the topic, the consensus is that by inventing a way of generating clean energy, we can slow down (and maybe even reverse) the effects global warming has on the planet. Using en... | 2019/07/23 | [
"https://sustainability.stackexchange.com/questions/8374",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/6811/"
] | **tl;dr -- For the west coast of the U.S., a 20% decrease in heating demand and 18% increase in cooling demand results in a 5% reduction in carbon emissions from electricity and natural gas usage**
Here's the approach I came up with to try and answer this question with some hard data.
### 1. Find a region of the U.S... | This question seems to have several components.
Firstly, in terms of PV energy production, a rise in temperature would most likely have a slightly negative effect due to decreased efficiency of solar cells at higher temperatures and perhaps an even greater decrease caused by an increase of cloud cover created by ocea... |
8,374 | Nowadays, everyone talks about it: climate change, and more importantly, how to stop it from happening. Although there's a lot of debate around the topic, the consensus is that by inventing a way of generating clean energy, we can slow down (and maybe even reverse) the effects global warming has on the planet. Using en... | 2019/07/23 | [
"https://sustainability.stackexchange.com/questions/8374",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/6811/"
] | >
> Wouldn't it therefore be better to have a small rise in global temperature?
>
**No.** The radiative forcing by carbon dioxide does not increase solar radiation that can be captured by solar cells. The warmer temperatures actually **decrease** solar cell output, because solar cells really like cold temperatures a... | The US isn't the only land mass in the world you know. In much of Africa people and animals are dying in the heat. And on a global scale the man made energy requirements are rising exponentially because of global warming. In Britain for instance people are busy installing air conditioning which they never needed before... |
8,374 | Nowadays, everyone talks about it: climate change, and more importantly, how to stop it from happening. Although there's a lot of debate around the topic, the consensus is that by inventing a way of generating clean energy, we can slow down (and maybe even reverse) the effects global warming has on the planet. Using en... | 2019/07/23 | [
"https://sustainability.stackexchange.com/questions/8374",
"https://sustainability.stackexchange.com",
"https://sustainability.stackexchange.com/users/6811/"
] | >
> Wouldn't it therefore be better to have a small rise in global temperature?
>
**No.** The radiative forcing by carbon dioxide does not increase solar radiation that can be captured by solar cells. The warmer temperatures actually **decrease** solar cell output, because solar cells really like cold temperatures a... | This question seems to have several components.
Firstly, in terms of PV energy production, a rise in temperature would most likely have a slightly negative effect due to decreased efficiency of solar cells at higher temperatures and perhaps an even greater decrease caused by an increase of cloud cover created by ocea... |
60,241,626 | I am new to CI/CD and trying to deploy a simple serverless function through Jenkins and getting error.
Here are my steps
1. Create a new project using dotnet new serverless.AspNetCoreWebAPI
2. Configured Git source {GitHub} where this project is located.
3. Added following lines in Build Step
`export PATH=$PATH:/usr... | 2020/02/15 | [
"https://Stackoverflow.com/questions/60241626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10949523/"
] | Install first below command in CMD
>
> dotnet tool install -g Amazon.Lambda.Tools
>
>
>
Then you can find dotnet command in cmd. | Solved the issue finally.
>
> Compared the .csproj files one for successful lambda deployment and one where it was failing. Noticed that following lines were the difference. It worked as soon as I added the below in my project file.
>
>
>
```
<ItemGroup><DotNetCliToolReference Include="Amazon.Lambda.Tools" Versio... |
33,261,824 | google map api is loaded asynchroneously
```
jQuery(function($) {
// Asynchronously Load the map API
var script = document.createElement('script');
script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
});
```
i then do
```
... | 2015/10/21 | [
"https://Stackoverflow.com/questions/33261824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1412620/"
] | Note that all your dummies would be created as 1 or missing. It is almost always more useful to create them directly as 1 or 0. Indeed, that is the usual **definition** of dummies.
In general, it's a loop over the possibilities using `forvalues` or `foreach`, but the shortcut is too easy not to be preferred in this c... | Use `i.<dummy_variable_name>`
For example, in your case, you can use following command for regression:
```
reg y i.year
``` |
33,261,824 | google map api is loaded asynchroneously
```
jQuery(function($) {
// Asynchronously Load the map API
var script = document.createElement('script');
script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
});
```
i then do
```
... | 2015/10/21 | [
"https://Stackoverflow.com/questions/33261824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1412620/"
] | Note that all your dummies would be created as 1 or missing. It is almost always more useful to create them directly as 1 or 0. Indeed, that is the usual **definition** of dummies.
In general, it's a loop over the possibilities using `forvalues` or `foreach`, but the shortcut is too easy not to be preferred in this c... | I also recommend using
```
egen year_dum = group(year)
reg y i.year_dum
```
This can be generalized arbitrarily, and you can easily create, e.g., year-by-state fixed effects this way:
```
egen year_state_dum = group(year state)
reg y i.year_state_dum
``` |
74,639,356 | I get a timeout when trying to connect to my newly set up amazon redshift database.
I tried telnet:
```
telnet redshift-cluster-1.foobar.us-east-1.redshift.amazonaws.com 5439
```
With the same result.
I set the database configuration to "Publicly accessible".
Note that I am just experimenting. I have set up aws se... | 2022/12/01 | [
"https://Stackoverflow.com/questions/74639356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2474025/"
] | I had to add a new inbound rule to the security group and set the source to "anywhere-ipv4" or "my ip". The default inbound rule has a source with the name of the security group itself, which might mean that it is only accessible from within the VPC. At least it is not accessible from the outside.
I set the protocol t... | Another option you can try is to connect to it through an API. To connect to this database using a Java client, you need these values:
```
private static final String database = "dev";
private static final String dbUser ="awsuser";
private static final String clusterId = "redshift-cluster-1";
```
I have nev... |
63,485,869 | I want to group a `data.table` but use a different name for the grouping variable in the final output.
### Data
```r
library(data.table)
set.seed(1)
d <- data.table(grp = sample(4, 100, TRUE))
```
### Options
I can use chaining like this:
```r
d[, .(Frequency = .N), keyby = grp][
, .("My Fancy Group Name" = grp... | 2020/08/19 | [
"https://Stackoverflow.com/questions/63485869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4125751/"
] | You can actually do similar to your attempt but use `list` instead of `c` :
```
library(data.table)
d[, .(Frequency = .N), keyby = list(`My Fancy Group Name` = grp)]
#Also works with quotes
#d[, .(Frequency = .N), keyby = list("My Fancy Group Name" = grp)]
# My Fancy Group Name Frequency
#1: 1 ... | Using `setnames()` should also be efficient:
```
setnames(d[, .N, keyby = grp], c("My Fancy Group Name", "Frequency"))
``` |
33,764,325 | I'm pretty new to Python programming, just started this year. I'm currently doing a project surrounding functions within python and i'm getting stuck. Heres what I have done so far but it gets stuck around the 3rd definition.
```
def userWeight():
weight = input("Enter your weight in pounds:")
def userHeight():
... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33764325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5573398/"
] | In your `main` function you're passing in `weight` but haven't defined it. You probably want to save the value from `userWeight`:
```
def userWeight():
weight = input("Enter your weight in pounds:")
return weight
def main():
weight = userWeight()
...
convertWeightFloat(weight)
```
You're also re... | in main() you call
convertWeightFloat(weight)
but there is no weight defined |
33,764,325 | I'm pretty new to Python programming, just started this year. I'm currently doing a project surrounding functions within python and i'm getting stuck. Heres what I have done so far but it gets stuck around the 3rd definition.
```
def userWeight():
weight = input("Enter your weight in pounds:")
def userHeight():
... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33764325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5573398/"
] | There are a few problems here.
At first, you call `convertWeightFloat(weight)` while `weight` has not been defined. That's because `weight` only exists within your function `userWeight` (it's called the scope of the function). If you want `weight` to be known in the main part of your program, you need to define it the... | In your `main` function you're passing in `weight` but haven't defined it. You probably want to save the value from `userWeight`:
```
def userWeight():
weight = input("Enter your weight in pounds:")
return weight
def main():
weight = userWeight()
...
convertWeightFloat(weight)
```
You're also re... |
33,764,325 | I'm pretty new to Python programming, just started this year. I'm currently doing a project surrounding functions within python and i'm getting stuck. Heres what I have done so far but it gets stuck around the 3rd definition.
```
def userWeight():
weight = input("Enter your weight in pounds:")
def userHeight():
... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33764325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5573398/"
] | There are a few problems here.
At first, you call `convertWeightFloat(weight)` while `weight` has not been defined. That's because `weight` only exists within your function `userWeight` (it's called the scope of the function). If you want `weight` to be known in the main part of your program, you need to define it the... | in main() you call
convertWeightFloat(weight)
but there is no weight defined |
35,598,671 | I have the following header I am trying to code responsively using Twitter Bootstrap:
[](https://i.stack.imgur.com/3DIeA.jpg)
Now for the purple menu bar I am going to use a navbar. However, for the content above, I am really trying to determine the... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35598671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5645843/"
] | ***EDIT***
Use [Volley](https://stackoverflow.com/a/32093822/1921263) if httpclient you can't find.
Moreover parsing script is same which mentioned below.
I already written a [Blog](http://shadowhelios.blogspot.in/2014/10/hot-to-load-json-file-and-display.html). Refer that. Hope it helps. Let me clone my blog to mat... | Like this:
```
String myURL = "https://www.myurl.com/file.json";
String jsonResponse = null;
try {
jsonResponse = (String) new RetrieveJSONTask(myURL).execute().get();
} catch (ExecutionException | InterruptedException e) {
// Do something
}
```
If you need to get an object you can do:
```
JSONObject jsonOb... |
35,598,671 | I have the following header I am trying to code responsively using Twitter Bootstrap:
[](https://i.stack.imgur.com/3DIeA.jpg)
Now for the purple menu bar I am going to use a navbar. However, for the content above, I am really trying to determine the... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35598671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5645843/"
] | ```
{
"Employee":[
{
"id":"101",
"name":"Sonoo Jaiswal",
"salary":"50000"
},
{
"id":"102",
"name":"Vimal Jaiswal",
"salary":"60000"
}
]
}
```
Remove "\" from your string data like above.then try to parse.your json is not valid... | Like this:
```
String myURL = "https://www.myurl.com/file.json";
String jsonResponse = null;
try {
jsonResponse = (String) new RetrieveJSONTask(myURL).execute().get();
} catch (ExecutionException | InterruptedException e) {
// Do something
}
```
If you need to get an object you can do:
```
JSONObject jsonOb... |
35,598,671 | I have the following header I am trying to code responsively using Twitter Bootstrap:
[](https://i.stack.imgur.com/3DIeA.jpg)
Now for the purple menu bar I am going to use a navbar. However, for the content above, I am really trying to determine the... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35598671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5645843/"
] | ***EDIT***
Use [Volley](https://stackoverflow.com/a/32093822/1921263) if httpclient you can't find.
Moreover parsing script is same which mentioned below.
I already written a [Blog](http://shadowhelios.blogspot.in/2014/10/hot-to-load-json-file-and-display.html). Refer that. Hope it helps. Let me clone my blog to mat... | Try this code:
```
try {
URL url = new URL("http://www.zippytrailers.com/funlearn/topicsMap");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader reader = new BufferedReader(new InputStrea... |
35,598,671 | I have the following header I am trying to code responsively using Twitter Bootstrap:
[](https://i.stack.imgur.com/3DIeA.jpg)
Now for the purple menu bar I am going to use a navbar. However, for the content above, I am really trying to determine the... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35598671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5645843/"
] | ```
{
"Employee":[
{
"id":"101",
"name":"Sonoo Jaiswal",
"salary":"50000"
},
{
"id":"102",
"name":"Vimal Jaiswal",
"salary":"60000"
}
]
}
```
Remove "\" from your string data like above.then try to parse.your json is not valid... | Try this code:
```
try {
URL url = new URL("http://www.zippytrailers.com/funlearn/topicsMap");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader reader = new BufferedReader(new InputStrea... |
35,598,671 | I have the following header I am trying to code responsively using Twitter Bootstrap:
[](https://i.stack.imgur.com/3DIeA.jpg)
Now for the purple menu bar I am going to use a navbar. However, for the content above, I am really trying to determine the... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35598671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5645843/"
] | ***EDIT***
Use [Volley](https://stackoverflow.com/a/32093822/1921263) if httpclient you can't find.
Moreover parsing script is same which mentioned below.
I already written a [Blog](http://shadowhelios.blogspot.in/2014/10/hot-to-load-json-file-and-display.html). Refer that. Hope it helps. Let me clone my blog to mat... | ```
{
"Employee":[
{
"id":"101",
"name":"Sonoo Jaiswal",
"salary":"50000"
},
{
"id":"102",
"name":"Vimal Jaiswal",
"salary":"60000"
}
]
}
```
Remove "\" from your string data like above.then try to parse.your json is not valid... |
53,061,169 | I have a piece of code that is used to split up the text in a cell. The data is outputted by a survey program that doesn't make use of any useful delimiter, so unfortunately converting text to columns isn't of any help to me.
I wrote this piece of code, but it turns out that the outcomes are different in two cases.
1... | 2018/10/30 | [
"https://Stackoverflow.com/questions/53061169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1481116/"
] | The difference is because the `Cells` and the `Range` are not fully qualified. Thus, when you go step-by-step you are also selecting the correct worksheet and automatically you are not.
Whenever you have something like this:
```
ws.Cells(1, col_to_add + j - 1) = Cells(1, col_to_add + j - 2).Value + 1
```
make sure ... | TextToColumns can accomplish that split and DataSeries can put a sequence of numbers into row 1.
```
Sub Macro4()
Dim lc As Long
With Worksheets("sheet9")
.Range(.Cells(2, "A"), .Cells(.Rows.Count, "A").End(xlUp)).TextToColumns _
Destination:=.Cells(2, "B"), DataType:=xlDelimited, _
... |
47,550,350 | This is a rather simple question but somehow my code either takes long time or consumes more resource. It is a question asked in www.codewars.com which I use for R Programming practice.
Below are the two versions of the problem I coded:
Version 1 :
===========
```
f <- function(n, m){
# Your code here
if(n<=0) retur... | 2017/11/29 | [
"https://Stackoverflow.com/questions/47550350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7459047/"
] | The optimisation is mathematical, not programmatical (though as others have mentioned, loops are *slow* in R.)
Firstly, note that `sum(0:(m-1)) = m*(m-1)/2`.
You are being asked to calculate this `n%/%m` times, and add a remainder of `(n - n%/%m)(n - n%/%m + 1)/2`. So you might try
```
f <- function(n,m){
k <- n%/... | EDIT: Just Realized it is actually a trick question
I would do
```
n%/%m *sum(1:(m-1)) + sum( 0:(n%%m))
```
Loop are real slow in R. Also, from my experience recursive function in R doesnt help much with the speed and it takes lots of memory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.