qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
59,082,715 | I have two table, **rates** and **criterias**. parent\_id in **criterias** refers to id in **rates**.
I need to select the rates where **ALL** children rows in table criterias WHERE criteria\_1 AND criteria\_2 equal to NULL.
In the example below, only flat rate should be selected
rates
```
id | name
--------... | 2019/11/28 | [
"https://Stackoverflow.com/questions/59082715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1709251/"
] | **this.props.array.map is not a function** occurs when you are trying to map something that is not **Array**
```
axios.get('/api/users')
.then(results =>{
this.setState({
users: results.data
});
})
```
make sure `results.data` is **Array** | 1. Since you have more than one value in your state, you won't want to overwrite the other values in this case `chosenUser:undefined`. That is why you need to first clone the state before setting your `users`.
2. Your initial state is an empty `Array` but `Axios` returns a `JSON` object which means you are setting the ... |
59,082,715 | I have two table, **rates** and **criterias**. parent\_id in **criterias** refers to id in **rates**.
I need to select the rates where **ALL** children rows in table criterias WHERE criteria\_1 AND criteria\_2 equal to NULL.
In the example below, only flat rate should be selected
rates
```
id | name
--------... | 2019/11/28 | [
"https://Stackoverflow.com/questions/59082715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1709251/"
] | **this.props.array.map is not a function** occurs when you are trying to map something that is not **Array**
```
axios.get('/api/users')
.then(results =>{
this.setState({
users: results.data
});
})
```
make sure `results.data` is **Array** | It looks like the property 'users' received by the child component is not an array at the moment. We all don't have the full code/api access permission so you have to do debugging by yourself. The good news is debugging is pretty easy in a React application. Let me show you how I debug usually.
1. Put breakpoints or a... |
38,064,778 | I am trying to implement integration test for wcf service by actually hitting the end points getting the data and validating it. I cannot use Dependency Injection as the code is legacy. Any help will be appreciated. | 2016/06/27 | [
"https://Stackoverflow.com/questions/38064778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209468/"
] | You can create an integration test by creating a test project (in the same solution or not) that adds a service reference to your WCF service and executes methods on that service client generated from WCF.
Just to clarify terminology, an integration test is exercising multiple units in a system and verifying their in... | When I had a WCF service to test I broke down the unit testing into serialization and service tests. A large amount of the issues you encounter in WCF are related to serialization failing. This can be tested separately and quite simply:-
1. Instantiate a DataContract
2. Populate it with test data
3. Serialize the data... |
64,582,028 | I am new to using this Yodlee tool, I created my developer account, and I am wanting to consume the sandbox APIs.
I am not being able to consume by rest with the Talend Api not even the initial method of "auth" (<https://sandbox.api.yodlee.com/ysl/auth/token>) to obtain the token; I'm passing the loginName, Api-version... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64582028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14538854/"
] | I tried munging the snippets together and it actually worked.
```
backend java_container
balance leastconn
dynamic-cookie-key MYKEY
cookie JSESSIONID prefix dynamic nocache
server-template worker- 6 worker:8080 check resolvers docker init-addr libc,none
```
Cookie looks like this now where the first ... | You are looking for the `dynamic` option as part of the `cookie` directive. You will also want to look into `dynamic-cookie-key`. |
21,110,714 | In our app we are displaying Notification Center notifications in alert style.
Displaying notification works fine, as well as we get callback when user interacts with the notification either by clicking on notification or by clicking on Action button.
However, we are interested in getting a callback or event when use... | 2014/01/14 | [
"https://Stackoverflow.com/questions/21110714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2322668/"
] | While the other (close) button is clearly meant to dismiss the notification, regardless of what its custom caption may indicate, there is no elegant way to get notified when the user dismisses the notification by clicking on the close button.
What you could do, however, is to monitor the default user notification cen... | In Swift 2.3:
```
func userNotificationCenter(center: NSUserNotificationCenter, didDeliverNotification notification: NSUserNotification) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
var notificationStillPresent: Bool
repeat {
notificationStillPrese... |
21,110,714 | In our app we are displaying Notification Center notifications in alert style.
Displaying notification works fine, as well as we get callback when user interacts with the notification either by clicking on notification or by clicking on Action button.
However, we are interested in getting a callback or event when use... | 2014/01/14 | [
"https://Stackoverflow.com/questions/21110714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2322668/"
] | While the other (close) button is clearly meant to dismiss the notification, regardless of what its custom caption may indicate, there is no elegant way to get notified when the user dismisses the notification by clicking on the close button.
What you could do, however, is to monitor the default user notification cen... | In Swift 3
```
func userNotificationCenter(_ center: NSUserNotificationCenter, didDismissAlert notification: NSUserNotification) {
print("dismissed")
}
```
This is not part of the `NSUserNotificationDelegate` but works perfectly |
21,110,714 | In our app we are displaying Notification Center notifications in alert style.
Displaying notification works fine, as well as we get callback when user interacts with the notification either by clicking on notification or by clicking on Action button.
However, we are interested in getting a callback or event when use... | 2014/01/14 | [
"https://Stackoverflow.com/questions/21110714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2322668/"
] | While the other (close) button is clearly meant to dismiss the notification, regardless of what its custom caption may indicate, there is no elegant way to get notified when the user dismisses the notification by clicking on the close button.
What you could do, however, is to monitor the default user notification cen... | This helped me out
```
func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
switch (notification.activationType) {
case .none:
print("none CLicked")
break
case .actionButtonClicked:
print("Additional Action Clicked")
... |
21,110,714 | In our app we are displaying Notification Center notifications in alert style.
Displaying notification works fine, as well as we get callback when user interacts with the notification either by clicking on notification or by clicking on Action button.
However, we are interested in getting a callback or event when use... | 2014/01/14 | [
"https://Stackoverflow.com/questions/21110714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2322668/"
] | In Swift 3
```
func userNotificationCenter(_ center: NSUserNotificationCenter, didDismissAlert notification: NSUserNotification) {
print("dismissed")
}
```
This is not part of the `NSUserNotificationDelegate` but works perfectly | In Swift 2.3:
```
func userNotificationCenter(center: NSUserNotificationCenter, didDeliverNotification notification: NSUserNotification) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
var notificationStillPresent: Bool
repeat {
notificationStillPrese... |
21,110,714 | In our app we are displaying Notification Center notifications in alert style.
Displaying notification works fine, as well as we get callback when user interacts with the notification either by clicking on notification or by clicking on Action button.
However, we are interested in getting a callback or event when use... | 2014/01/14 | [
"https://Stackoverflow.com/questions/21110714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2322668/"
] | In Swift 3
```
func userNotificationCenter(_ center: NSUserNotificationCenter, didDismissAlert notification: NSUserNotification) {
print("dismissed")
}
```
This is not part of the `NSUserNotificationDelegate` but works perfectly | This helped me out
```
func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
switch (notification.activationType) {
case .none:
print("none CLicked")
break
case .actionButtonClicked:
print("Additional Action Clicked")
... |
59,571,555 | I have a AWS Fargate task with two containers each running it's own part of a batch job. However, when one of the containers complete and exit, the whole task is killed by ECS. Is it possible to let the task run until both containers exit?
Though it may be anti-pattern, the containers can run independently of each oth... | 2020/01/02 | [
"https://Stackoverflow.com/questions/59571555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7823929/"
] | Amazon ECS will terminate the task if any of the containers marked `essential` exit. You can have a task definition with multiple containers where some are not marked `essential`, but at least one container in every task must be marked `essential`. See [the documentation](https://docs.aws.amazon.com/AmazonECS/latest/de... | You can also go the other direction with this. Say you want to run an ECS Task that runs and then terminates (for example, if you just want a container to deploy something and then die), and you don't care if it dies on the vine.
Rather than deploying this task via a service, you can directly deploy a task to your ECS... |
61,124,414 | I've built many macros but haven't edited so much. I'm trying to filter a spreadsheet in column B for "0", then delete all rows. what's happening is if there are no rows containing "0" in column B, the code ends up deleting all the data I want to keep. My code is:
```
ActiveSheet.ListObjects(1).Range.AutoFilter Fi... | 2020/04/09 | [
"https://Stackoverflow.com/questions/61124414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13270378/"
] | Try this code
```
Sub Test()
Call DelFilterParam(Sheet1, "Table1", 2, "=")
End Sub
Sub DelFilterParam(ByVal wsSheet As Worksheet, ByVal stTable As String, ByVal iField As Integer, ByVal vCriteria As Variant)
With wsSheet
With .ListObjects(stTable).DataBodyRange
.AutoFilter
.Aut... | You can try this code
```
Sub test()
Dim H As ListObject
Set H = Sheet1.ListObjects(1)
H.Parent.Activate
H.AutoFilter.ShowAllData
H.Range.AutoFilter Field:=2, Criteria1:="0"
Application.DisplayAlerts = False
H.DataBodyRange.SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAler... |
25,658 | [Aruch HaShulchan 167:31](http://hebrewbooks.org/pdfpager.aspx?req=7705&st=&pgnum=307&hilite=) and [Be'er Hataiv 167:22](http://hebrewbooks.org/pdfpager.aspx?req=49624&st=&pgnum=126) both say that it is forbidden to throw the (Challah) bread. I have heard that there are some people (I heard that there are some Rabannim... | 2013/01/17 | [
"https://judaism.stackexchange.com/questions/25658",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/200/"
] | I was told orally that the Noda Bihudah, if I recall correctly, defends those who have such a practice as we seek to make our tables similar to the Mizbeach, and the meat that was to be placed on the fire on the Mizbeach (altar) in the Temple was thrown (past a gap between the ramp and Mizbeach). | A rabbi just explained that we throw challah at simchas to differentiate placing it in one's hand at funerals. We don't want to bring bad luck. |
25,658 | [Aruch HaShulchan 167:31](http://hebrewbooks.org/pdfpager.aspx?req=7705&st=&pgnum=307&hilite=) and [Be'er Hataiv 167:22](http://hebrewbooks.org/pdfpager.aspx?req=49624&st=&pgnum=126) both say that it is forbidden to throw the (Challah) bread. I have heard that there are some people (I heard that there are some Rabannim... | 2013/01/17 | [
"https://judaism.stackexchange.com/questions/25658",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/200/"
] | I was told orally that the Noda Bihudah, if I recall correctly, defends those who have such a practice as we seek to make our tables similar to the Mizbeach, and the meat that was to be placed on the fire on the Mizbeach (altar) in the Temple was thrown (past a gap between the ramp and Mizbeach). | i have been told that the actual custom is to not pass it by hand but rather to place on the table or a tray for the others to take, and not necessarily to throw it. the reason being that the challah is zecher for the "mon" that was given directly by Hashem and therefore it (the challah) should not be taken from a pers... |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First: [Embedded Version Numbers - Good or Evil?](https://stackoverflow.com/questions/645008/what-are-the-basic-clearcase-concepts-every-developer-should-know/645424#645424): I find them evil.
You should not use technical internal revision number to represent the version of a document.
"This is the 2.2 revision of my... | You could try Tobi's little script:
<http://insights.oetiker.ch/windows/SvnProperties4MSOffice/> |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First: [Embedded Version Numbers - Good or Evil?](https://stackoverflow.com/questions/645008/what-are-the-basic-clearcase-concepts-every-developer-should-know/645424#645424): I find them evil.
You should not use technical internal revision number to represent the version of a document.
"This is the 2.2 revision of my... | What if you save your Word document as .xml (so called Flat OPC format)?
Then it is just a text document, and svn keywords should just work. |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First: [Embedded Version Numbers - Good or Evil?](https://stackoverflow.com/questions/645008/what-are-the-basic-clearcase-concepts-every-developer-should-know/645424#645424): I find them evil.
You should not use technical internal revision number to represent the version of a document.
"This is the 2.2 revision of my... | VonC's answer has convinced me that doc-open isn't the right time to update the document property. For example, if the file is e-mailed to someone else, or copied a CD, or "exported" then it can't update its SVN revision when it's opened. It would be difficult to ensure the file could never contain an erroneous out-of-... |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First: [Embedded Version Numbers - Good or Evil?](https://stackoverflow.com/questions/645008/what-are-the-basic-clearcase-concepts-every-developer-should-know/645424#645424): I find them evil.
You should not use technical internal revision number to represent the version of a document.
"This is the 2.2 revision of my... | We are actually using a "system" somewhat similar (created by a former collegue), that solves some these issues.
**The desires...**
* We want to be able to see that two printouts are actually of the same version.
* We want to be able to locate the source of a print out (including revision).
* We want to elliminate pr... |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You could try Tobi's little script:
<http://insights.oetiker.ch/windows/SvnProperties4MSOffice/> | What if you save your Word document as .xml (so called Flat OPC format)?
Then it is just a text document, and svn keywords should just work. |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You could try Tobi's little script:
<http://insights.oetiker.ch/windows/SvnProperties4MSOffice/> | VonC's answer has convinced me that doc-open isn't the right time to update the document property. For example, if the file is e-mailed to someone else, or copied a CD, or "exported" then it can't update its SVN revision when it's opened. It would be difficult to ensure the file could never contain an erroneous out-of-... |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We are actually using a "system" somewhat similar (created by a former collegue), that solves some these issues.
**The desires...**
* We want to be able to see that two printouts are actually of the same version.
* We want to be able to locate the source of a print out (including revision).
* We want to elliminate pr... | What if you save your Word document as .xml (so called Flat OPC format)?
Then it is just a text document, and svn keywords should just work. |
781,690 | We would like to run a wireless access point for public use. However, in case of misbehavior, we would like some personal information to be able to pass on to law enforcement.
The proposed solution involves a captive portal where users enter their email addresses, and are then given ten minutes to check their email an... | 2009/04/23 | [
"https://Stackoverflow.com/questions/781690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We are actually using a "system" somewhat similar (created by a former collegue), that solves some these issues.
**The desires...**
* We want to be able to see that two printouts are actually of the same version.
* We want to be able to locate the source of a print out (including revision).
* We want to elliminate pr... | VonC's answer has convinced me that doc-open isn't the right time to update the document property. For example, if the file is e-mailed to someone else, or copied a CD, or "exported" then it can't update its SVN revision when it's opened. It would be difficult to ensure the file could never contain an erroneous out-of-... |
233,296 | We have a server that we want our users to be able to remote into from within the office, but only a -few- (administrators) should be able to login from outside the office.
Currently, anyone who can remote into the desktop, has the ability to remote in from outside the office.
Is there a way to restrict remote deskto... | 2011/02/09 | [
"https://serverfault.com/questions/233296",
"https://serverfault.com",
"https://serverfault.com/users/28414/"
] | We use a login script to check the connecting computer name and if it doesn't match the list we deny the connection. We exclude some users from this check so they're always able to connect, whether in the office or not. So you simply add a line for each office computer (or authorized computer) and add a line for every ... | Not by permissions. You could use the OS firewall to deny all external IP's port 3389 access and allow only certain external IP's (if you know them and they are static). Another option would be to deny all external IP's on you core FW and then only allow RDP if they VPN in to your network. |
233,296 | We have a server that we want our users to be able to remote into from within the office, but only a -few- (administrators) should be able to login from outside the office.
Currently, anyone who can remote into the desktop, has the ability to remote in from outside the office.
Is there a way to restrict remote deskto... | 2011/02/09 | [
"https://serverfault.com/questions/233296",
"https://serverfault.com",
"https://serverfault.com/users/28414/"
] | Consider investigating [IPSec](http://technet.microsoft.com/en-us/network/bb531150) which if I understand it correctly can be used to restrict access based on a combination of rules including network location, client machine identity (assuming it's a member of the domain), and user credentials. So you could theoretical... | Not by permissions. You could use the OS firewall to deny all external IP's port 3389 access and allow only certain external IP's (if you know them and they are static). Another option would be to deny all external IP's on you core FW and then only allow RDP if they VPN in to your network. |
233,296 | We have a server that we want our users to be able to remote into from within the office, but only a -few- (administrators) should be able to login from outside the office.
Currently, anyone who can remote into the desktop, has the ability to remote in from outside the office.
Is there a way to restrict remote deskto... | 2011/02/09 | [
"https://serverfault.com/questions/233296",
"https://serverfault.com",
"https://serverfault.com/users/28414/"
] | Setup a Terminal services gateway. You can set up policies on ehat different groups are allowed to access. Only permitbremote access via the gateway. | Not by permissions. You could use the OS firewall to deny all external IP's port 3389 access and allow only certain external IP's (if you know them and they are static). Another option would be to deny all external IP's on you core FW and then only allow RDP if they VPN in to your network. |
233,296 | We have a server that we want our users to be able to remote into from within the office, but only a -few- (administrators) should be able to login from outside the office.
Currently, anyone who can remote into the desktop, has the ability to remote in from outside the office.
Is there a way to restrict remote deskto... | 2011/02/09 | [
"https://serverfault.com/questions/233296",
"https://serverfault.com",
"https://serverfault.com/users/28414/"
] | We use a login script to check the connecting computer name and if it doesn't match the list we deny the connection. We exclude some users from this check so they're always able to connect, whether in the office or not. So you simply add a line for each office computer (or authorized computer) and add a line for every ... | Consider investigating [IPSec](http://technet.microsoft.com/en-us/network/bb531150) which if I understand it correctly can be used to restrict access based on a combination of rules including network location, client machine identity (assuming it's a member of the domain), and user credentials. So you could theoretical... |
233,296 | We have a server that we want our users to be able to remote into from within the office, but only a -few- (administrators) should be able to login from outside the office.
Currently, anyone who can remote into the desktop, has the ability to remote in from outside the office.
Is there a way to restrict remote deskto... | 2011/02/09 | [
"https://serverfault.com/questions/233296",
"https://serverfault.com",
"https://serverfault.com/users/28414/"
] | We use a login script to check the connecting computer name and if it doesn't match the list we deny the connection. We exclude some users from this check so they're always able to connect, whether in the office or not. So you simply add a line for each office computer (or authorized computer) and add a line for every ... | Setup a Terminal services gateway. You can set up policies on ehat different groups are allowed to access. Only permitbremote access via the gateway. |
19,717,645 | I have a code where I draw some arrows depending on the value of the variable, but sometimes those values are big like 9000 and sometimes the values are smaller for example 400. So how can I do the scales of the chart in logarithmic just to the axes scale change depending of the value of the arrows.
```
from mpl_toolk... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19717645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2562238/"
] | Use Axis method [`set_xscale`](http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_xscale) or [`set_yscale`](http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_yscale).
```
ax.set_xscale('log')
``` | I had this same problem. This appears to be a bug from at least 2011 related to surface plotting with log-scaled axes. The mailing list thread indicates there is no easy work-around aside from log-scaling the data and plotting them linearly.
<https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg22832... |
16,644,445 | I am trying to develope a query to fetch the rows having duplicate values, i need to fetch both records i.e duplicating record and the real one, for example
table
-----
```
id keyword
-------------------
1 Apple
2 Orange
3 Apple
4 Grape
5 Banana
6 Grape
```
The query result should be:
```
id keyword
... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16644445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/670616/"
] | Query:
```
select * from
table where keyword in
(select keyword
from table
group by keyword
having count(keyword)>1)
``` | This might help:
```
SELECT t1.id, t1.keyword
FROM table t1
INNER JOIN table t2
ON t1.id != t2.id
AND t1.keyword=t2.keyword
```
Tested on SQL Fiddle
<http://sqlfiddle.com/#!2/44dbb/1/0> |
16,644,445 | I am trying to develope a query to fetch the rows having duplicate values, i need to fetch both records i.e duplicating record and the real one, for example
table
-----
```
id keyword
-------------------
1 Apple
2 Orange
3 Apple
4 Grape
5 Banana
6 Grape
```
The query result should be:
```
id keyword
... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16644445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/670616/"
] | Query:
```
select * from
table where keyword in
(select keyword
from table
group by keyword
having count(keyword)>1)
``` | One way to do it:
```
SELECT *
FROM `table` t1
WHERE
(SELECT COUNT(*) FROM `table` t2 WHERE t2.keyword = t1.keyword) > 1
```
And another way:
```
SELECT t1.*
FROM `table` t1
JOIN `table` t2 ON t1.keyword = t2.keyword
WHERE t1.id != t2.id
``` |
32,162,674 | In a recent project, I want to debug my program in production use state. The production environment is very complicated so I want to debug the program whenever I find a problem.
This is what I want to achieve: whenever I want to debug, I will send a kill signal to the program and hopefully pdb debugger will appear. It... | 2015/08/23 | [
"https://Stackoverflow.com/questions/32162674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3687718/"
] | If you run the program from a terminal you can use the `tty` command to note the
tty device you are on, and pass it to the program in the environment:
```
TTY=`tty` nohup ./myprog.py
```
and then in the handler open the tty again and set stdin and stdout to the file:
```
import sys,os
def handler(signal, frame):
... | An entirely different approach, which is simpler and more elegant in my opinion, is to use [`rpyc`](https://rpyc.readthedocs.org/en/latest/). I've been using this approach for a long time now in my complex system, and it made real-time debugging vastly easier.
Basically, what you need to do is to define a simple rpyc ... |
60,629,780 | I am having a problem in setting the auto-width. I want to fit all the text in a single cell where all values can be viewed without further clicks. My exported CSV currently looks like this :
[](https://i.stack.imgur.com/zbiYo.png)
And the following is what I want t... | 2020/03/11 | [
"https://Stackoverflow.com/questions/60629780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11363581/"
] | **Comma-Separated Values (CSV)**, as the name suggests, is nothing more than text. separated with commas. According to Wikipedia, CSV is
>
> *a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of ... | You could try this API `RangeFormat.autofitColumns()`, here is the sample code you could try
```
async function main(context: Excel.RequestContext) {
// Auto fit the columns of range: Sheet1!A:A
let workbook = context.workbook;
let worksheets = workbook.worksheets;
let selectedSheet = worksheets.getActiveWorks... |
33,042 | Ist der Satz grammatisch korrekt?
>
> Die Kratzer sind mit einem transparenten Lack zu übermalen, geeignet für die Anwendung auf Aluminium.
>
>
> | 2016/11/04 | [
"https://german.stackexchange.com/questions/33042",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/24370/"
] | Ich denke ein ganzer Nebensatz mit Relativpronomen und Verb ist besser verständlich.
>
> Die Kratzer sind mit einem transparenten Lack zu übermalen, **der** geeignet für die Anwendung auf Aluminium **ist**.
>
>
>
Als eine technische Anleitung/Dokumentation wäre sicherlich auch folgendes Konstrukt denkbar.
>
> D... | Der Satz hat eine ungewöhnliche Wortstellung und ist daher m. E. nicht sofort verständlich, da sich *geeignet für* gefühlt auf das *übermalen* bezieht, was Unsinn ist. Als grammatischen Fehler würde ich das nicht unbedingt bezeichnen, eher schlechten Stil.
Deshalb würde sich diese leicht geänderte Formulierung anbiete... |
4,739 | How would I say phrases like the following in German:
>
> A: Woah, did you delete your one-year-old account?
>
>
> B: Yes, and I am awesome like that\*.
>
>
>
Or
>
> C: What a nice question, how come it got a close-vote?
>
>
> B: Well, people are silly like that.
>
>
>
By "I am awesome like that" I mean... | 2012/06/13 | [
"https://german.stackexchange.com/questions/4739",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/9732/"
] | I would translate it like that:
>
> A: Wow, hast Du Dein 1 Jahr altes Konto gelöscht?
>
>
> B: Ja, weil ich halt so geil/cool/genial/... bin. (hopefully in an ironic meaning!)
>
>
>
and
>
> C: Das war so eine gute Frage, warum wurde sie geschlossen?
>
>
> B: Naja, die Leute sind halt so blöd.
>
>
> | >
> A: Woah, hast du deinen 1 Jahr alten Account gelöscht?
>
>
> B: Ja, ich bin halt so cool.
>
>
>
and
>
> C: Was für eine gute Frage, warum wurde Sie geschlossen?
>
>
> D: Naja, (die) Leute sind halt Deppen.
>
>
> |
32,870,601 | I need to select TOP 10 ACCT rows based on SYS\_CD value. Hence i wrote the below query. The query working fine.
```
SELECT SYS_CD, ACCT, CNTACCT ,rowid
FROM
( SELECT SYS_CD, ACCT, COUNT(ACCT) AS CNTACCT,
ROW_NUMBER() OVER (PARTITION BY SYS_CD
ORDER BY COUNT(ACCT) DESC
... | 2015/09/30 | [
"https://Stackoverflow.com/questions/32870601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3127462/"
] | You need to get all your values for `SYS_CD`, and table of numbers from 1 - 10:
```
SELECT ccd.SYS_CD, n.RowID
FROM (SELECT DISTINCT SYS_CD FROM [FCIDIAL].[dbo].table1 WHERE ERR_CD != 'Y') AS ccd
CROSS JOIN (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10)) AS n (RowID);
```
Once you have this you can `LEF... | If you don't have an existing tally table you can generate one for this on the fly pretty easily. This should work assuming you are on 2008+.
```
with MyData as
(
SELECT SYS_CD
, ACCT
, COUNT(ACCT) AS CNTACCT
, ROW_NUMBER() OVER (PARTITION BY SYS_CD ORDER BY COUNT(ACCT) DESC) AS rowid
F... |
5,341,448 | I have a DateTimeField on a model. In the forms for that model, I use the SplitDateTimeWidget. I want to enable users to enter just a date, and have my code define a default time (like 2 p.m.) if one is not entered.
Is there a simple way to do this? Since this is needed for multiple forms, I would like to have a way t... | 2011/03/17 | [
"https://Stackoverflow.com/questions/5341448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21885/"
] | You may be able to do this by subclassing DateTimeField and over-riding the clean() method. | I tend to do these types of defaults in the models save() method or when the pre\_save signal is called. |
3,353,105 | >
> a=0.2
>
>
> $b=\sqrt 5$
>
>
> $x=\frac 14 + \frac 18 + \frac {1}{16}.....$
>
>
>
Since x is a GP, common ratio ‘r’ is $\frac 12$
Then $$x=\frac 12$$
So
$$(0.2)^{log\_{\sqrt 5}\frac 12}$$
I don’t know how to simply it further. Using a calculator isn’t allowed, and log tables aren’t given either. I don’t th... | 2019/09/11 | [
"https://math.stackexchange.com/questions/3353105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/690228/"
] | $$\log\_\sqrt5(1/2)=\frac{\ln(1/2)}{\ln\sqrt5}=\frac{\ln(2^{-1})}{\ln(5^{1/2})}=\frac{-\ln2}{(1/2)\ln5}=-2\frac{\ln2}{\ln5}=-2\log\_5 2$$
$$(0.2)^{\log\_\sqrt5(1/2)}=(5^{-1})^{-2\log\_5 2}=5^{2\log\_5 2}=5^{\log\_5(2^2)}=2^2=4$$ | Note that $a=\frac{1}{b^2}$. So, you get
$$a^{\log\_b x}=\frac{1}{b^{2\log\_b x}} = \frac{1}{x^2} = 4$$ |
1,343,166 | I'm writing a compiler, and I'm looking for resources on optimization. I'm compiling to machine code, so anything at runtime is out of the question.
What I've been looking for lately is less code optimization and more semantic/high-level optimization. For example:
```
free(malloc(400)); // should be completely optimi... | 2009/08/27 | [
"https://Stackoverflow.com/questions/1343166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66341/"
] | To do an optimization across 2 or more operations, you have to understand the
algebraic relationship of those two operations. If you view operations
in their problem domain, they often have such relationships.
Your free(malloc(400)) is possible because free and malloc are inverses
in the storage allocation domain.
Lo... | The [Broadway](http://www.cs.utexas.edu/users/lin/papers/ieee05.pdf) framework might be in the vein of what you're looking for. Papers on "source-to-source transformation" will probably also be enlightening. |
68,064,739 | It seems Visual Studio 2019 (not tested previous versions) doesn't like `div` tags inside `dl`.
The code copy-pasted from [here](https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element) (3rd example) inside an HTML page in Visual Studio gives warnings.
*The following example illustrates the use of... | 2021/06/21 | [
"https://Stackoverflow.com/questions/68064739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693560/"
] | `<div>` is not an allowed content of `<dl>`
>
> Permitted content
>
>
> Either: Zero or more groups each consisting of one or more `<dt>`
> elements followed by one or more `<dd>` elements, optionally intermixed
> with `<script>` and `<template>` elements. Or: (in WHATWG HTML, W3C HTML
> 5.2 and later) One or more ... | The tag in HTML is used to represent the description list. This tag is used with and tag. So is not an allowed content of |
68,064,739 | It seems Visual Studio 2019 (not tested previous versions) doesn't like `div` tags inside `dl`.
The code copy-pasted from [here](https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element) (3rd example) inside an HTML page in Visual Studio gives warnings.
*The following example illustrates the use of... | 2021/06/21 | [
"https://Stackoverflow.com/questions/68064739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693560/"
] | `<div>` is not an allowed content of `<dl>`
>
> Permitted content
>
>
> Either: Zero or more groups each consisting of one or more `<dt>`
> elements followed by one or more `<dd>` elements, optionally intermixed
> with `<script>` and `<template>` elements. Or: (in WHATWG HTML, W3C HTML
> 5.2 and later) One or more ... | Considering the fact the message is "Element 'div' requires end tag" (for `<div>`) and "End tag is missing start tag" (for `</div>`), not anyhow related to the `<dl>`, it's just a bug. The wrong `<div>` formatting points to a bug as well.
If you want the bug to be fixed, you should probably try reporting the bug in th... |
68,064,739 | It seems Visual Studio 2019 (not tested previous versions) doesn't like `div` tags inside `dl`.
The code copy-pasted from [here](https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element) (3rd example) inside an HTML page in Visual Studio gives warnings.
*The following example illustrates the use of... | 2021/06/21 | [
"https://Stackoverflow.com/questions/68064739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693560/"
] | `<div>` is not an allowed content of `<dl>`
>
> Permitted content
>
>
> Either: Zero or more groups each consisting of one or more `<dt>`
> elements followed by one or more `<dd>` elements, optionally intermixed
> with `<script>` and `<template>` elements. Or: (in WHATWG HTML, W3C HTML
> 5.2 and later) One or more ... | >
> You can not use `div` in `dl` content. [The Description List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl)
>
>
> |
68,064,739 | It seems Visual Studio 2019 (not tested previous versions) doesn't like `div` tags inside `dl`.
The code copy-pasted from [here](https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element) (3rd example) inside an HTML page in Visual Studio gives warnings.
*The following example illustrates the use of... | 2021/06/21 | [
"https://Stackoverflow.com/questions/68064739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693560/"
] | Considering the fact the message is "Element 'div' requires end tag" (for `<div>`) and "End tag is missing start tag" (for `</div>`), not anyhow related to the `<dl>`, it's just a bug. The wrong `<div>` formatting points to a bug as well.
If you want the bug to be fixed, you should probably try reporting the bug in th... | The tag in HTML is used to represent the description list. This tag is used with and tag. So is not an allowed content of |
68,064,739 | It seems Visual Studio 2019 (not tested previous versions) doesn't like `div` tags inside `dl`.
The code copy-pasted from [here](https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element) (3rd example) inside an HTML page in Visual Studio gives warnings.
*The following example illustrates the use of... | 2021/06/21 | [
"https://Stackoverflow.com/questions/68064739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693560/"
] | Considering the fact the message is "Element 'div' requires end tag" (for `<div>`) and "End tag is missing start tag" (for `</div>`), not anyhow related to the `<dl>`, it's just a bug. The wrong `<div>` formatting points to a bug as well.
If you want the bug to be fixed, you should probably try reporting the bug in th... | >
> You can not use `div` in `dl` content. [The Description List element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl)
>
>
> |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | I'd leave out A-z and possibly even 0-9 as these should be obviously allowed. For the *additional* characters I'd go with their names rather than the symbols
>
> You may also use underscore, dash and period.
>
>
> | tl;dr
=====
You should show *all* valid or *all* invalid characters *before* the user starts to type into the field. This should be a hint. Keep it short, easy to understand and straightforward.
Demonstration
=============

[download bmml source](/plugins/mockups/downlo... |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | You could display blocks of each character type, like this:
**Allowed characters:** `A-Z` `a-z` `0-9` `-` `_` `.` | If you use the word "Alphanumeric" instead of writing `A-Z` and `0-9`, it will reduce the amount of clutter and be clearer to the user. |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | You could display blocks of each character type, like this:
**Allowed characters:** `A-Z` `a-z` `0-9` `-` `_` `.` | I'd leave out A-z and possibly even 0-9 as these should be obviously allowed. For the *additional* characters I'd go with their names rather than the symbols
>
> You may also use underscore, dash and period.
>
>
> |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | Clutter is problematic. Emphasizing the valid characters might be enough. E.g.:
>
> Valid characters are **A**-**Z** **a**-**z** **0**-**9** **.** **\_** **-**.
>
>
>
Displaying them with different color might also help. | I'd leave out A-z and possibly even 0-9 as these should be obviously allowed. For the *additional* characters I'd go with their names rather than the symbols
>
> You may also use underscore, dash and period.
>
>
> |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | Here is some advice :
* forbid characters only if it is absolutely necessary (I hate when I
cannot use \_ in my nickname)
* display a message only to the user who tries to use one of these. Other users won't be bothered
* if the user enter a forbidden caracter, just don't consider it and explain him why.
.
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | You could display blocks of each character type, like this:
**Allowed characters:** `A-Z` `a-z` `0-9` `-` `_` `.` | In order to avoid all the clutter, but to still provide all the descriptive information you want ahead of time, you could have a "link" near the input field that says something like "What characters are valid here.". When a person moves their mouse to (hovers their mouse over) the link, a "tooltip" is shown that descri... |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | One way to deal with this is to not say anything at all at first and then let the user know when a disallowed character is entered. If you use in-line validation and apply after each character input, the user (almost) won't even need to be notified of which character was forbidden.
It depends on what should go in the... | If space isn't an issue, then use a vertical list with word and actual cues.
You can use
* Numbers (**0-9**),
* Letters (**A-Z** and **a-z**),
* Underscores (**\_**),
* Hyphens (**-**), and
* Periods (**.**)
In any case, explain the valid characters *before* the user enters data, not after submission or upon typing. |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | I would say that your best bet is to use a table-like structure to clearly label and isolate each rule:
**CSS**
```
table{
border-collapse:collapse;
}
td{
padding:3px 6px 3px 6px;
vertical-align:top;
border:solid 1px #000;
}
```
**HTML**
```
<h3>Allowed characters</h3>
<table>
<tr><td>Alphabet:... | In order to avoid all the clutter, but to still provide all the descriptive information you want ahead of time, you could have a "link" near the input field that says something like "What characters are valid here.". When a person moves their mouse to (hovers their mouse over) the link, a "tooltip" is shown that descri... |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | Here is some advice :
* forbid characters only if it is absolutely necessary (I hate when I
cannot use \_ in my nickname)
* display a message only to the user who tries to use one of these. Other users won't be bothered
* if the user enter a forbidden caracter, just don't consider it and explain him why.
 the link, a "tooltip" is shown that descri... |
57,491 | I'm trying to determine the best way to inform the User that an input accepts certain special characters. Alphanumerics are simple enough, but I feel like I'm losing clarity when I get to characters such as . and -.
One style I've tried is this:
```
Valid characters include A-z, 0-9, and (._-).
```
Where the parenth... | 2014/05/19 | [
"https://ux.stackexchange.com/questions/57491",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/35491/"
] | Clutter is problematic. Emphasizing the valid characters might be enough. E.g.:
>
> Valid characters are **A**-**Z** **a**-**z** **0**-**9** **.** **\_** **-**.
>
>
>
Displaying them with different color might also help. | If you just allow all utf8 characters as input, you don't need to worry about how to explain it to the user. And it will save you a big headache when going global with your app/website.
If they have to enter an email, you can write "this email address is not valid according to internet standard RFC ". That is much eas... |
12,539,742 | I just installed VS 2012. I created a new project to do Code First with. I then used Nuget to add EF5 to the project, as per these instructions:
<http://msdn.microsoft.com/en-us/data/ee712906>
I then verified it's install:
<http://i1048.photobucket.com/albums/s361/usernames_r_stupid/Nuget_zpse7808c9b.png>
Which shows... | 2012/09/22 | [
"https://Stackoverflow.com/questions/12539742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/604389/"
] | You should be looking to `EntityFramework.dll`. `System.Data` is not the EntityFrakework assembly. | Nuget creates a packages folder with the above mentioned EntityFramework.dll. I manually referenced it,but it ended up telling me that it was already referenced. ONce I ran my project fo the first time it showed up in my references. Weird. Was System.Data.Entity not what EF 4 lived in? |
34,065,976 | I was wondering about the most pythonic (and shortest) way to return the variable in an `if else` that evaluates to `FALSE` (or `TRUE`).
```
def foo(a,b)
if a == 0 or b == 0:
# return b
else:
pass;
a = 0
b = 1
print(foo(a,b))
> 1
``` | 2015/12/03 | [
"https://Stackoverflow.com/questions/34065976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3935035/"
] | Make use of the `or` operator short-circuiting:
```
def foo(a, b):
if a == 0 or b == 0:
return a or b
```
This returns `b` if `a` is `0`. Note that if `a` and `b` are both `0`, then `0` is returned.
If you really meant for these values to be *booleans*, then use the Python `bool` type values, `False` and... | Maybe I misunderstood the question, but isn't it the attempt to do this:
```
a = None
b = 123
c = a or b
print(c)
> 123
```
It is a pattern for initializing parameters for the functions with defaults if non-mandatory parameter was not set:
```
def func(a, b=None):
b = b or 'default_value'
print(a, b)
func... |
58,025,460 | Using a fixed statement one can have a pointer to a string. Using that pointer they can modify the string. But is it legally allowed in C# documentation?
```
using System;
class Program
{
static void Main()
{
string s = "hello";
unsafe
{
fixed (char* p = s)
{
... | 2019/09/20 | [
"https://Stackoverflow.com/questions/58025460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029077/"
] | "Legal" may be the wrong word to use here. "Incorrect" is what I'd say. It's *possible*, but Strings are [defined as immutable](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=netframework-4.8) in C#. By mutating one anyway you're violating class invariants. The runtime may react to it anyway it pleases... | Legal is such as strong word, but yes, you can. I'll add one more thing, you don't use it unless it's absolutely necessary. |
58,025,460 | Using a fixed statement one can have a pointer to a string. Using that pointer they can modify the string. But is it legally allowed in C# documentation?
```
using System;
class Program
{
static void Main()
{
string s = "hello";
unsafe
{
fixed (char* p = s)
{
... | 2019/09/20 | [
"https://Stackoverflow.com/questions/58025460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029077/"
] | Per the [language specification](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code#the-fixed-statement):
>
> Modifying objects of managed type through fixed pointers can results *[sic]* in undefined behavior. For example, because strings are immutable, **it is the p... | Legal is such as strong word, but yes, you can. I'll add one more thing, you don't use it unless it's absolutely necessary. |
58,025,460 | Using a fixed statement one can have a pointer to a string. Using that pointer they can modify the string. But is it legally allowed in C# documentation?
```
using System;
class Program
{
static void Main()
{
string s = "hello";
unsafe
{
fixed (char* p = s)
{
... | 2019/09/20 | [
"https://Stackoverflow.com/questions/58025460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029077/"
] | Per the [language specification](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code#the-fixed-statement):
>
> Modifying objects of managed type through fixed pointers can results *[sic]* in undefined behavior. For example, because strings are immutable, **it is the p... | "Legal" may be the wrong word to use here. "Incorrect" is what I'd say. It's *possible*, but Strings are [defined as immutable](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=netframework-4.8) in C#. By mutating one anyway you're violating class invariants. The runtime may react to it anyway it pleases... |
29,941,188 | I am using following code to get different different colors using d3.scale.category10(). Here is my code:
```
function getDrawColor(i)
{
var colors = d3.scale.category10();
// for(var j=0;j<5;j++)
// {
// alert(colors(j));
// }
return colors(i);
}
```
When i try to print colors using th... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29941188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4745093/"
] | Declare that colors in global, and use it inside of the get function like below
```
var colors = d3.scale.category10();
function getDrawColor(i)
{
return colors(i);
}
```
Hope this will work for you... | Check out this link,it may perhaps help you: <http://www.jeromecukier.net/blog/2011/08/11/d3-scales-and-color/>
This section may help you :
Color palettes
Unlike in protovis, which had them under pv.Colors – i.e. pv.Colors.category10(), in d3, built-in color palettes can be accessed through scales. Well, even in pr... |
46,247,961 | I have an array like:
```
-
{"name"=>“A”, "10"=>30, "2" =>40, "90"=>0}
{"name"=>“B”, "10"=>20, "2" =>40, "90"=>0}
{"name"=>“C”, "10"=>20, "2" =>40, "90"=>10}
---
```
I suppose to first sort by highest key (90):
```
-
{"name"=>"C", "10"=>20, "2" =>40, "90"=>10}
{"name"=>"... | 2017/09/15 | [
"https://Stackoverflow.com/questions/46247961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5138081/"
] | I assume that
* as in the example, all elements (hashes) of `arr` have the same keys;
* `A`, `B` and `C` are intended to be literals (e.g., strings or symbols), so I've changed them to `"A"`, `"B"`, `"C"`; and
* by "...by the highest key..." you mean "...by the key other than `'name'` which is largest after having bee... | Yes you can iterate inside `sort_by`:
```
# first sort the arbitrary integer keys in reverse order (assuming those keys will be same across all hashes)
keys = a[0].
keys. # ["name", "10", "2", "90"]
select { |k| k.match?(/^\d+$/) }. # this will basically keep only the integer valued strings: ["10", "... |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Remember that you are iterating over the elements in the list, and not iterating over a number.
For example consider the following:
```
for i in ["cat", "dog"]:
print i
```
What would happen if you did i+1 there? You can see now why it doesn't skip the next element in the list.
Instead of actually iterating over... | You can't trivially "skip the next leg" (you can of course skip *this* leg with a `continue`). If you really insist you can do it with an auxiliary `bool`, e.g.
```
skipping = False
for i in whatever:
if skipping:
skipping = False
continue
skipping = cond
...
```
or for generality with an auxiliary `in... |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | There is an alternate approach to this, depending on the task you are trying to accomplish. If `cond` is entirely a function of the input data you are looping over, you might try something like the following:
```
def check_cond(item):
if item satisfies cond:
return True
return False
for item in filter... | ```
for i in filter(lambda x:x!=2,range(5)):
``` |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Python's for loops are different. `i` gets reassigned to the next value every time through the loop.
The following will do what you want, because it is taking the literal version of what C++ is doing:
```
i = 0
while i < some_value:
if cond...:
i+=1
...code...
i+=1
```
Here's why:
in C++, the f... | You can't trivially "skip the next leg" (you can of course skip *this* leg with a `continue`). If you really insist you can do it with an auxiliary `bool`, e.g.
```
skipping = False
for i in whatever:
if skipping:
skipping = False
continue
skipping = cond
...
```
or for generality with an auxiliary `in... |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | You can't trivially "skip the next leg" (you can of course skip *this* leg with a `continue`). If you really insist you can do it with an auxiliary `bool`, e.g.
```
skipping = False
for i in whatever:
if skipping:
skipping = False
continue
skipping = cond
...
```
or for generality with an auxiliary `in... | ```
for i in filter(lambda x:x!=2,range(5)):
``` |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Python's for loops are different. `i` gets reassigned to the next value every time through the loop.
The following will do what you want, because it is taking the literal version of what C++ is doing:
```
i = 0
while i < some_value:
if cond...:
i+=1
...code...
i+=1
```
Here's why:
in C++, the f... | There is a `continue` keyword which skips the current iteration and advances to the next one (and a `break` keyword which skips all loop iterations and exits the loop):
```
for i in range(10):
if i % 2 == 0:
# skip even numbers
continue
print i
``` |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Remember that you are iterating over the elements in the list, and not iterating over a number.
For example consider the following:
```
for i in ["cat", "dog"]:
print i
```
What would happen if you did i+1 there? You can see now why it doesn't skip the next element in the list.
Instead of actually iterating over... | ```
for i in filter(lambda x:x!=2,range(5)):
``` |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Python's for loops are different. `i` gets reassigned to the next value every time through the loop.
The following will do what you want, because it is taking the literal version of what C++ is doing:
```
i = 0
while i < some_value:
if cond...:
i+=1
...code...
i+=1
```
Here's why:
in C++, the f... | You can explicitly increment the iterator.
```
whatever = iter(whatever)
for i in whatever:
if cond:
whatever.next()
```
You will need to catch StopIteration if cond can be True on the last element. |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Python's for loops are different. `i` gets reassigned to the next value every time through the loop.
The following will do what you want, because it is taking the literal version of what C++ is doing:
```
i = 0
while i < some_value:
if cond...:
i+=1
...code...
i+=1
```
Here's why:
in C++, the f... | There is an alternate approach to this, depending on the task you are trying to accomplish. If `cond` is entirely a function of the input data you are looping over, you might try something like the following:
```
def check_cond(item):
if item satisfies cond:
return True
return False
for item in filter... |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | Python's for loops are different. `i` gets reassigned to the next value every time through the loop.
The following will do what you want, because it is taking the literal version of what C++ is doing:
```
i = 0
while i < some_value:
if cond...:
i+=1
...code...
i+=1
```
Here's why:
in C++, the f... | Remember that you are iterating over the elements in the list, and not iterating over a number.
For example consider the following:
```
for i in ["cat", "dog"]:
print i
```
What would happen if you did i+1 there? You can see now why it doesn't skip the next element in the list.
Instead of actually iterating over... |
2,429,560 | I was wondering how to achieve the following in python:
```
for( int i = 0; cond...; i++)
if cond...
i++; //to skip an run-through
```
I tried this with no luck.
```
for i in range(whatever):
if cond... :
i += 1
``` | 2010/03/12 | [
"https://Stackoverflow.com/questions/2429560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291996/"
] | There is a `continue` keyword which skips the current iteration and advances to the next one (and a `break` keyword which skips all loop iterations and exits the loop):
```
for i in range(10):
if i % 2 == 0:
# skip even numbers
continue
print i
``` | You can explicitly increment the iterator.
```
whatever = iter(whatever)
for i in whatever:
if cond:
whatever.next()
```
You will need to catch StopIteration if cond can be True on the last element. |
72,783,807 | Is there any way to raise multiple exceptions in python? In the following example, only the first exception is raised.
```
l = [0]
try:
1 / 0
except ZeroDivisionError as e:
raise Exception('zero division error') from e
try:
l[1]
except IndexError as e:
raise Exception('Index out of range') from e
```... | 2022/06/28 | [
"https://Stackoverflow.com/questions/72783807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16778384/"
] | Once an exception is raised and not catched, the execution of your program will stop. Hence, only one exception can be launched in such a simple script.
If you really want your program to raise multiple exceptions, you could however create a custom Exception representing multiple exceptions and launch it inside an exc... | Here my solution a bit long but seems to work :
```
class CustomError(Exception):
pass
l = [0]
exeps = []
try:
1 / 0
except ZeroDivisionError as e:
exeps.append(e)
try:
l[1]
except IndexError as e:
exeps.append(e)
if len(exeps)!=0:
[print(i.args[0]) for i in exeps]
raise CustomError("Multiple errors !!... |
498 | I've took some photographs at a photoshoot last week. The lighting conditions weren't right for the shoot (my fault entirely) and the camera we used was a compact. Unfortunately this means that the photograph is quite grainy. Anyone know a good Photoshop (or similar) technique to improve this? | 2011/01/18 | [
"https://graphicdesign.stackexchange.com/questions/498",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/227/"
] | Filter > Noise > Reduce noise.
Reducing noise usually blurs the pixels making the image less sharp. play with the sliders to strike a good balance between sharpness and noise reduction
If the image is shot in RAW (unlikely on a compact) then Camera RAW v6 brought significant updates to the noise reduction engine. You... | Maybe push it in the other direction. Leverage the lo-fi-ness of it and further tweak the imagery in that direction? |
40,832,107 | I want to create event set on mouse click for 30 objects all of them do the same:
```
for(int i=0;i<30;i++){
seats[i].setOnMouseClicked(e->{
seats[i].setEffect(lighting);
});
}
```
But I keep getting these error:
```
error: local variables referenced from a lambda expression must be final... | 2016/11/27 | [
"https://Stackoverflow.com/questions/40832107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5876859/"
] | You cannot reference the variable `i` inside the lambda expression, as its value will have changed when the lambda is executed. Instead, do:
```
for(int i=0;i<30;i++){
Node seat = seats[i];
seat.setOnMouseClicked(e->{
seat.setEffect(lighting);
});
}
```
This assumes `lighting` is either ex... | **A local variable must be final or *effectively final* in a lambda expression.**
What this means is that you can not make *assignments* to local-variables used in a lambda, where local means *defined in the method-scope that contains the lambda expression*.
So this does **not** work:
```
//in method
int a = 5;
x.se... |
219,390 | Consider two frames $S$ and $S'$, moving relative to each other. If I stand still in frame $S$ and watch frame $S'$, I can measure its speed to be $V$. However, why is this speed the same as the observer in $S'$ measured for $S$? (denote as $V'$?) | 2015/11/19 | [
"https://physics.stackexchange.com/questions/219390",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/85883/"
] | This is so because the distance
between those two frame of references measured from both perspectives should be the same at any given point of time. Speed is just the 'change of distance' measured b/w those two frames per unit time, which should obviously also be the same from both . | If you are using scalar speeds, the issue becomes clear: $V$ and $V'$ always equal each other because they both represent the rate of change of separation between two objects, which is a property of the two-object system, not of either object individually. In fact, *every* observer watching $S$ and $S'$ will calculate ... |
219,390 | Consider two frames $S$ and $S'$, moving relative to each other. If I stand still in frame $S$ and watch frame $S'$, I can measure its speed to be $V$. However, why is this speed the same as the observer in $S'$ measured for $S$? (denote as $V'$?) | 2015/11/19 | [
"https://physics.stackexchange.com/questions/219390",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/85883/"
] | You are asking about the so-called *reciprocity principle* of special relativity, and it is actually not as trivial as many people make out. Indeed, a careful examination of the postulates we make about the relativities of inertial frames and the transformations that result from these postulates show that at least thre... | This is so because the distance
between those two frame of references measured from both perspectives should be the same at any given point of time. Speed is just the 'change of distance' measured b/w those two frames per unit time, which should obviously also be the same from both . |
219,390 | Consider two frames $S$ and $S'$, moving relative to each other. If I stand still in frame $S$ and watch frame $S'$, I can measure its speed to be $V$. However, why is this speed the same as the observer in $S'$ measured for $S$? (denote as $V'$?) | 2015/11/19 | [
"https://physics.stackexchange.com/questions/219390",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/85883/"
] | You are asking about the so-called *reciprocity principle* of special relativity, and it is actually not as trivial as many people make out. Indeed, a careful examination of the postulates we make about the relativities of inertial frames and the transformations that result from these postulates show that at least thre... | If you are using scalar speeds, the issue becomes clear: $V$ and $V'$ always equal each other because they both represent the rate of change of separation between two objects, which is a property of the two-object system, not of either object individually. In fact, *every* observer watching $S$ and $S'$ will calculate ... |
22,617,802 | My local storage function always stores the radio button value of "3" in local storage regardless of the selection made and I don't have an idea as of why. Every other element stores properly.
Please see my fiddle to show my problem: <http://jsfiddle.net/3u7Xj/148/>
My function:
```
$('input, select, textarea').each... | 2014/03/24 | [
"https://Stackoverflow.com/questions/22617802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3191137/"
] | The radio buttons all have the same name, because they're radio buttons, and they all have a value. Your code gets the value of each of the radio buttons and saves each value into the same property of the "Survey" object. The last one it sees is the one that ultimately is saved.
You'll have to add code something like ... | As Pointy mentioned without giving any answer, you're iterating on "input, select, textarea" elements. So, after hitting on every one of your radio buttons, the third and last one of them is stored.
Admitting you put your inputs in a `<form>` tag, in pure Javascript, what you're trying to do is something like :
```
... |
96,116 | I have *sous vide* for a while with mixed success. Mostly good, but still mixed. One thing I question which I hoping to get opinion on is time to sous vide beef (steak specifically, e.g. ribeye or strip).
I have read and heard where people have left beef in the bath for 24+ hours and rave about it. All the Anovo guid... | 2019/02/03 | [
"https://cooking.stackexchange.com/questions/96116",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/328/"
] | When cooking low temperature, over time the texture of the protein that you are cooking changes. For a tough cut, like a shank, or short rib, this is desirable, and where you would see cooking times of 12, 24, 48 hours...or longer. Most people want to enjoy a steak that chews like the traditionally cooked product. Afte... | **TLDR**: Just like pork, steak cooked for an extended period of time starts to shred and get mushy. It's not what most would call a traditional steak, but if you're open minded, people like pulled pork as well as pork chops...
**Pictures**:
Serious Eats has very thorough sous vide guides on both [steak](https://www... |
70,115,355 | This is my query:
```
SELECT
*,
CONCAT(
RIGHT( account_no, 4),
RIGHT( customer_id, 5 )
) AS "password for my diplomo"
FROM
account_info;
```
But I get this error:
>
> Error: function `left(bigint, integer)` does not exist;
>
>
>
My table is:
```
CREATE TABLE account_info (
... | 2021/11/25 | [
"https://Stackoverflow.com/questions/70115355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17510009/"
] | Check this codesandbox I made: <https://codesandbox.io/s/stack-70115344-jzhii?file=/src/components/Navbar.vue>
There's no need to use a **v-spacer**. You only need to set the **right** prop to the v-tabs component.
```html
<v-tabs right>
<v-tab>Project</v-tab>
<v-tab>Users</v-tab>
<v-tab>Setting... | Try `<v-tabs right>`
```html
<template>
<v-app-bar
app
dense
dark >
<v-img
alt="Vuetify Logo"
class="shrink mr-2"
contain
src="https://cdn.vuetifyjs.com/images/logos/vuetify-logo-dark.png"
transition="scale-transition"
width="40"
... |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | In my case, I have MacOs Big Sur running with zsh shell.
The first thing you need to do is get the prefix of your npm-global path:
```
npm config get prefix
```
Then this will be return some thing like this:
```
/Users/your_user/npm-global
```
Copy this path, and add the /bin in the end -> */Users/your\_user/npm-... | Error on using port 80 with PM2?
The wrong way of going about this is trying to run with `sudo`.
The correct way of doing this would be to login as root `sudo su`, then run `pm2 start app.js --name "whatever" --watch`.
Logging in as root, there's no need to configure any `bashrc` or profile files. However, as root, ... |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | This option helped me:
```
sudo npm i -g pm2
``` | The same as @Henrique Van Klaveren answer but simpler with using substitution:
`export PATH=$PATH:$(npm config get prefix)/bin` |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | If you install through NPM and it does not work, you can create a symbolic link as well :
```
ln -s /<your-user>/.npm-global/lib/node_modules/pm2/bin/pm2 /usr/bin/pm2
```
After that, you're going to be able to call:
```
pm2
``` | If you used nvm to install node and npm, install pm2 for normal user.
run as root:
```
sudo su
vim ~/.bashrc
```
append below code, change NVM\_DIR to you normal user's home folder:
```
export NVM_DIR="/home/[PLEASE CHANGE]/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# This loads nvm
[ -s "$NVM_DIR/ba... |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | In my case, I have MacOs Big Sur running with zsh shell.
The first thing you need to do is get the prefix of your npm-global path:
```
npm config get prefix
```
Then this will be return some thing like this:
```
/Users/your_user/npm-global
```
Copy this path, and add the /bin in the end -> */Users/your\_user/npm-... | ```sh
yum install npm -y
npm config set strict-ssl false
npm install pm2 -g
``` |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | PM2 the process manager for Node.js applications. PM2 basically manages applications (run them in the background as a service). So this is how we install PM2 globally with sudo permissions account
```
sudo npm install -g pm2
```
The -g option tells npm to install the module globally, so that it's available system-wi... | Error on using port 80 with PM2?
The wrong way of going about this is trying to run with `sudo`.
The correct way of doing this would be to login as root `sudo su`, then run `pm2 start app.js --name "whatever" --watch`.
Logging in as root, there's no need to configure any `bashrc` or profile files. However, as root, ... |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | If you install through NPM and it does not work, you can create a symbolic link as well :
```
ln -s /<your-user>/.npm-global/lib/node_modules/pm2/bin/pm2 /usr/bin/pm2
```
After that, you're going to be able to call:
```
pm2
``` | This option helped me:
```
sudo npm i -g pm2
``` |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | Error on using port 80 with PM2?
The wrong way of going about this is trying to run with `sudo`.
The correct way of doing this would be to login as root `sudo su`, then run `pm2 start app.js --name "whatever" --watch`.
Logging in as root, there's no need to configure any `bashrc` or profile files. However, as root, ... | ```sh
yum install npm -y
npm config set strict-ssl false
npm install pm2 -g
``` |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | This option helped me:
```
sudo npm i -g pm2
``` | ```sh
yum install npm -y
npm config set strict-ssl false
npm install pm2 -g
``` |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | Error on using port 80 with PM2?
The wrong way of going about this is trying to run with `sudo`.
The correct way of doing this would be to login as root `sudo su`, then run `pm2 start app.js --name "whatever" --watch`.
Logging in as root, there's no need to configure any `bashrc` or profile files. However, as root, ... | Install PM2 globally and run everything as a root user
```
sudo apt-get install npm
sudo npm i -g pm2
sudo ln -s /usr/bin/nodejs /usr/bin/node
```
You are good to go |
38,185,590 | I installed node.js and npm to my centOS 7 server. But i have problems with pm2.
Actually real problem is i don't have experiences in linux and i don't know how to change path.
Here is folder structure.
```
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
... | 2016/07/04 | [
"https://Stackoverflow.com/questions/38185590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5690756/"
] | PM2 the process manager for Node.js applications. PM2 basically manages applications (run them in the background as a service). So this is how we install PM2 globally with sudo permissions account
```
sudo npm install -g pm2
```
The -g option tells npm to install the module globally, so that it's available system-wi... | If you used nvm to install node and npm, install pm2 for normal user.
run as root:
```
sudo su
vim ~/.bashrc
```
append below code, change NVM\_DIR to you normal user's home folder:
```
export NVM_DIR="/home/[PLEASE CHANGE]/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# This loads nvm
[ -s "$NVM_DIR/ba... |
51,940,518 | I have a simple loading bar made with css, you update the css and the bar fills, super simple.
I decided to update the bar with jQuery, works great but now I throw it into a practical environment. I have a bunch of files being downloaded and each time a file successfully downloads, it updates the position. The main pro... | 2018/08/21 | [
"https://Stackoverflow.com/questions/51940518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1617564/"
] | The DOM is updated each time the download is completed - it could be a problem.
We should separate upload progress and animation. When file is downloaded you should just change some kind of Model and use [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#Notes) recu... | I think you have the case with the variable **currPos**. Use debug tool to mark the lines and inspect value of currPos. Somehow your code is managed to jump it 0 to articleSize. |
2,352,759 | i've got two tables: `members` and `members_data`.
They both share the same unique auto increment `id` key and unique `username` fields.
I would like to merge the two tables into one `members` table, **BUT** I have ~50 scripts using `members` & `members_data` references. I also need some sort of alias setup to mak... | 2010/02/28 | [
"https://Stackoverflow.com/questions/2352759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/138251/"
] | You can effectively alias a table to another table by creating a view which just does SELECT \* from the other table. This is however, not a good thing to do:
* It confuses future code maintainers by having a view which is really another table (They can of course, look at your view in the source code\*\*)
* It is poss... | >
> They both share the same unique auto increment id key and unique username fields.
>
>
>
This sentence is meaningless gobbledy-gook. There is no way in MySQL (or most rDBMS that two tables could share columns).
I suspect there may be several possible answers to your question but without seeing the actual sche... |
24,117 | My female friend had a son recently, and it is a source of great joy for all of us (friends).
When her son was three months old, we organized a surprise party for him, and the mom was very happy with it.
Now the kid is close to six months old, and she decided to organize a theme party. Problem is: the theme of the pa... | 2020/02/13 | [
"https://interpersonal.stackexchange.com/questions/24117",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/8670/"
] | I can't guarantee your friend will understand your reasons for not wanting to come, you know her best and are, as always, the best judge of her possible reactions to telling her the truth. But there are quite a few things you already did right in your question to make your message as non-confrontational as possible:
... | As I've always thought and witnessed that a humoristic twist is a more powerful weapon than any other confrontation, I'll offer a frame-challenge here. In many situations in my life I've done the same, so I don't see why it wouldn't be a good option in your case.
You have the ["*soccer mom*"](https://www.urbandictiona... |
12,418,427 | I am new to the Spring Framework and I have created a controller with the method
```
@RequestMapping("/fetch/{contactId}")
public String getContact(@PathVariable("contactId") Long contactId,
Map<String, Object> map, HttpServletRequest request,
HttpServletResponse response) {
Contact contact = cont... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12418427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1670437/"
] | Use
```
<c:url var="addUrl" value="/contacts/add.html"/>
<form:form method="post" action="${addUrl}" commandName="contact"
id="contact" onsubmit="return validateContact(this)">
```
In general, it is recomended to use `c:url` in every application internal instead of direct use of the url in a `<a>` tag. | Use `/contacts/add.html` in `action` attribute
Change
```
<form:form method="post" action="add.html" commandName="contact"
id="contact" onsubmit="return validateContact(this)">
```
to
```
<form:form method="post" action="/contacts/add.html" commandName="contact"
id="contact" onsubmit="return va... |
12,418,427 | I am new to the Spring Framework and I have created a controller with the method
```
@RequestMapping("/fetch/{contactId}")
public String getContact(@PathVariable("contactId") Long contactId,
Map<String, Object> map, HttpServletRequest request,
HttpServletResponse response) {
Contact contact = cont... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12418427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1670437/"
] | ```
<form:form method="post" servletRelativeAction="/contacts/add" commandName="contact"
id="contact" onsubmit="return validateContact(this)">
```
Use attribute servletRelativeAction to map to desired controller action. I assume that your desired controller is mapped as '/contacts/add' not 'add.html'. You wan... | Use `/contacts/add.html` in `action` attribute
Change
```
<form:form method="post" action="add.html" commandName="contact"
id="contact" onsubmit="return validateContact(this)">
```
to
```
<form:form method="post" action="/contacts/add.html" commandName="contact"
id="contact" onsubmit="return va... |
12,418,427 | I am new to the Spring Framework and I have created a controller with the method
```
@RequestMapping("/fetch/{contactId}")
public String getContact(@PathVariable("contactId") Long contactId,
Map<String, Object> map, HttpServletRequest request,
HttpServletResponse response) {
Contact contact = cont... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12418427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1670437/"
] | Use
```
<c:url var="addUrl" value="/contacts/add.html"/>
<form:form method="post" action="${addUrl}" commandName="contact"
id="contact" onsubmit="return validateContact(this)">
```
In general, it is recomended to use `c:url` in every application internal instead of direct use of the url in a `<a>` tag. | ```
<form:form method="post" servletRelativeAction="/contacts/add" commandName="contact"
id="contact" onsubmit="return validateContact(this)">
```
Use attribute servletRelativeAction to map to desired controller action. I assume that your desired controller is mapped as '/contacts/add' not 'add.html'. You wan... |
20,410,495 | I need to send some float numbers between some Texas Instrument CC2530 nodes.
This architecture can only send an array of uint8.
What I already tried to do was to assign to an uint8 pointer the float pointer with a cast.
Then I send these bytes and when received, they are copied in a uint8 array.
In the end I create... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20410495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/732471/"
] | The code in the reception section is problematic. You copy bytes into `receiveds` and then use pointer conversions to treat it as a `float`. However, many C implementations use one-byte alignment for character/byte types (as `receiveds` likely is) and four-byte alignment for `float` types. Converting a `uint8` pointer ... | Why not represent your numbers using fixed-point? Whenever I was working with the TI CC2530 I tried to avoid the overhead of floating-point and resorted to representing the numbers in fixed-point. These values are much more straight forward when sending them, but you have to be careful with your representation. |
11,365,527 | I have the following objects defined:
```
public class MyGroup
{
public MyItem[] Items;
}
public class MyItem
{
public int Val;
}
```
Say I have a list as List where each MyGroup object contains a varying number of MyItems; which in turn contains a varying value for Val.
How can I find the subset of MyGrou... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11365527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691226/"
] | ```
int lowestValue = groups.SelectMany(group => group.Items)
.Min(item => item.Val);
IEnumerable<MyGroup> result = groups.Where(group =>
group.Items.Select(item => item.Val).Contains(lowestValue));
```
This will be a two pass algorithm. If you were suitably motivated you could do it in a sing... | Add this to your Linq query: .FirstOrDefault(); and you get only one value. |
11,365,527 | I have the following objects defined:
```
public class MyGroup
{
public MyItem[] Items;
}
public class MyItem
{
public int Val;
}
```
Say I have a list as List where each MyGroup object contains a varying number of MyItems; which in turn contains a varying value for Val.
How can I find the subset of MyGrou... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11365527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691226/"
] | ```
int lowestValue = groups.SelectMany(group => group.Items)
.Min(item => item.Val);
IEnumerable<MyGroup> result = groups.Where(group =>
group.Items.Select(item => item.Val).Contains(lowestValue));
```
This will be a two pass algorithm. If you were suitably motivated you could do it in a sing... | ```
var myGroup1 = new MyGroup();
myGroup1.Items = Enumerable.Range (1,3).Select (x=> new MyItem {Val=x}).ToArray();
var myGroup2 = new MyGroup();
myGroup2.Items = Enumerable.Range (1,4).Select (x=> new MyItem {Val=x}).ToArray();
var myGroup3 = new MyGroup();
myGroup3.Items = Enumerable.Range (3... |
11,365,527 | I have the following objects defined:
```
public class MyGroup
{
public MyItem[] Items;
}
public class MyItem
{
public int Val;
}
```
Say I have a list as List where each MyGroup object contains a varying number of MyItems; which in turn contains a varying value for Val.
How can I find the subset of MyGrou... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11365527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691226/"
] | ```
int lowestValue = groups.SelectMany(group => group.Items)
.Min(item => item.Val);
IEnumerable<MyGroup> result = groups.Where(group =>
group.Items.Select(item => item.Val).Contains(lowestValue));
```
This will be a two pass algorithm. If you were suitably motivated you could do it in a sing... | ```
var query = from gr in myGroups
where gr.Items.Any(x => x.Val ==
(from g in myGroups
from i in g.Items
orderby i.Val
select i.Val).FirstOrDefault())
select gr;
``` |
11,365,527 | I have the following objects defined:
```
public class MyGroup
{
public MyItem[] Items;
}
public class MyItem
{
public int Val;
}
```
Say I have a list as List where each MyGroup object contains a varying number of MyItems; which in turn contains a varying value for Val.
How can I find the subset of MyGrou... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11365527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691226/"
] | ```
int lowestValue = groups.SelectMany(group => group.Items)
.Min(item => item.Val);
IEnumerable<MyGroup> result = groups.Where(group =>
group.Items.Select(item => item.Val).Contains(lowestValue));
```
This will be a two pass algorithm. If you were suitably motivated you could do it in a sing... | Here's the code snippet I just wrote for this. It's an extension method to `IEnumerable<T>`, and it returns a minimum element based on a "sort" function (without actually doing a sort, or performing two passes, and without the race condition that happens when you do two passes).
```
/// <summary>
/// Get the minimum e... |
11,365,527 | I have the following objects defined:
```
public class MyGroup
{
public MyItem[] Items;
}
public class MyItem
{
public int Val;
}
```
Say I have a list as List where each MyGroup object contains a varying number of MyItems; which in turn contains a varying value for Val.
How can I find the subset of MyGrou... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11365527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691226/"
] | ```
var myGroup1 = new MyGroup();
myGroup1.Items = Enumerable.Range (1,3).Select (x=> new MyItem {Val=x}).ToArray();
var myGroup2 = new MyGroup();
myGroup2.Items = Enumerable.Range (1,4).Select (x=> new MyItem {Val=x}).ToArray();
var myGroup3 = new MyGroup();
myGroup3.Items = Enumerable.Range (3... | Add this to your Linq query: .FirstOrDefault(); and you get only one value. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.