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 |
|---|---|---|---|---|---|
15,114,185 | A software which I (unfortunately) have to use produces an XML file with multiple datasets (see the following example: "Document 1", "Document 2", ...) but without separating them by a wrapping `<document>` tag. It looks like this:
```
<print>
<section>
<col1>*****</col1>
<col2>Document 1</col2>
... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15114185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/792962/"
] | You can use `setdiff` for that :
```
R> v <- c(1,1,2,2,3,4,5)
R> setdiff(v, v[duplicated(v)])
[1] 3 4 5
``` | You could use `count` from the `plyr` package to count the occurences of an item, and delete all who occur more than once.
```
library(plyr)
l = c(1,2,3,3,4,5,6,6,7)
count_l = count(l)
x freq
1 1 1
2 2 1
3 3 2
4 4 1
5 5 1 ... |
15,114,185 | A software which I (unfortunately) have to use produces an XML file with multiple datasets (see the following example: "Document 1", "Document 2", ...) but without separating them by a wrapping `<document>` tag. It looks like this:
```
<print>
<section>
<col1>*****</col1>
<col2>Document 1</col2>
... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15114185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/792962/"
] | You can use `setdiff` for that :
```
R> v <- c(1,1,2,2,3,4,5)
R> setdiff(v, v[duplicated(v)])
[1] 3 4 5
``` | Another way using `table`:
With @juba's data:
```
as.numeric(names(which(table(v) == 1)))
# [1] 3 4 5
```
For OP's data, since its a character output, `as.numeric` is not required.
```
names(which(table(v) == 1))
# [1] "b" "c" "d"
``` |
15,114,185 | A software which I (unfortunately) have to use produces an XML file with multiple datasets (see the following example: "Document 1", "Document 2", ...) but without separating them by a wrapping `<document>` tag. It looks like this:
```
<print>
<section>
<col1>*****</col1>
<col2>Document 1</col2>
... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15114185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/792962/"
] | You could use `count` from the `plyr` package to count the occurences of an item, and delete all who occur more than once.
```
library(plyr)
l = c(1,2,3,3,4,5,6,6,7)
count_l = count(l)
x freq
1 1 1
2 2 1
3 3 2
4 4 1
5 5 1 ... | Another way using `table`:
With @juba's data:
```
as.numeric(names(which(table(v) == 1)))
# [1] 3 4 5
```
For OP's data, since its a character output, `as.numeric` is not required.
```
names(which(table(v) == 1))
# [1] "b" "c" "d"
``` |
300,580 | I try to write a trigger that set case status to "Closed" if thereare more than 2 cases created that same day (today) associated with the same contact. The problem is I don't want to use SOQL queries in for loops or nested for loops. I try to do it via map with a list as value, but can't get it working.
I looked into t... | 2020/03/30 | [
"https://salesforce.stackexchange.com/questions/300580",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/53151/"
] | I don't think you're asking quite the right question here. Generally speaking, using a collection means that you'll also be using loops.
The code that you have right now looks pretty close to correct. Given that you have a `Map<Id, List<Case>>`, you already seem to know that you can use `.get()` on the map to fetch th... | Thanks for your help Derek, and you were completely right. I am a beginning developer so thanks for all the advises. I stored them in a Word document so i can always have it as a reference. As applying the System.debug method to debug my code, i stumbled upon a mistake in my code. Instead of getting the size from all c... |
50,798,277 | Suppose i have a dataframe with numeric values.
how can i find all indexes ("row"+"col"+"Value") of cells above\under certain threshold?
For example:
```
df = pd.DataFrame([[1,2,3],[4,5,6]], columns=['a', 'b', 'c'])
```
and my threshold is 2
i would like to get:
```
[[0,c,3],[1,a,4][1,b,5],[1,c,6]]
``` | 2018/06/11 | [
"https://Stackoverflow.com/questions/50798277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2425224/"
] | Use [`stack`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.stack.html) for reshape, create columns by `MultiIndex`, filter by [`query`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.query.html) and last convert to `nested list`s:
```
c = df.stack().reset_index(name='v... | You can use:
```
df[df.gt(2)].stack().reset_index().values.tolist()
```
Output:
```
[[0, 'c', 3.0], [1, 'a', 4.0], [1, 'b', 5.0], [1, 'c', 6.0]]
``` |
29,432,544 | I have a `published_at` field in my model that I setup as a carbon date.
```
class Model {
protected $dates = ['published_at'];
....
public function setPublishedAtAttribute($val)
{
$this->attributes['published_at'] = \Carbon\Carbon::createFromTimeStamp(strtotime($val));
}
}
```
This i... | 2015/04/03 | [
"https://Stackoverflow.com/questions/29432544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1200670/"
] | This is now fixed with [Laravel 5.5](https://github.com/laravel/framework/blob/282534f39c6eae39caf4f96f003b0aca696a7973/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L1007-L1009).
For everyone using an older Laravel version:
Just overwrite your `getDirty()` method like this:
```
public function getDirt... | The best way to approach this in the end is to just properly format the date in mysql format and let Laravel handle the rest.
So before inputting the date:
```
$data['published_at'] = '2015-03-03'; // format here;
```
Even when hardcoding the date string in the `setPublishedAtAttribute` method it seems to always tr... |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | You are looping through the table of votes? Are you reading the entire database into memory and then looping through it?
Have you tried querying the database only for the relevant data?
```
SELECT vote_comment_id, vote_type
FROM vote
WHERE vote_user_id = 34513
AND vote_comment_id IN (3443145, 3443256, 3443983)
``` | you don't mention which database you're using but i assume some SQL variant.
so, instead of looping through the entire table of votes, you can do something like
```
select vote_type from vote_table where vote_comment_id = $commentId and vote_user_id = $userId
```
or even better, when you're retrieving the actual co... |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | you don't mention which database you're using but i assume some SQL variant.
so, instead of looping through the entire table of votes, you can do something like
```
select vote_type from vote_table where vote_comment_id = $commentId and vote_user_id = $userId
```
or even better, when you're retrieving the actual co... | Try to avoid using subselect specially if you are retrieving large number of rows.
```
select c.*, v.vote_type
from comments c
left join vote v
on v.vote_comment_id = c.comment_id
and v.vote_user_id = $userId
```
Using CASE statement to display/hide vote\_type.
```
select c.*, CASE v.vote_user_id WHEN $userId
... |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | You are looping through the table of votes? Are you reading the entire database into memory and then looping through it?
Have you tried querying the database only for the relevant data?
```
SELECT vote_comment_id, vote_type
FROM vote
WHERE vote_user_id = 34513
AND vote_comment_id IN (3443145, 3443256, 3443983)
``` | Wouldn't you need a column for whatever it is the user voted on, ie post\_id?
You could do a select query, see if a row for the current post and user exists - if a row is returned, they've voted.
---
Actually, I just noticed that vote\_comment\_id isn't what I read it as (vote\_comment).
You just need to check if... |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | Try to avoid using subselect specially if you are retrieving large number of rows.
```
select c.*, v.vote_type
from comments c
left join vote v
on v.vote_comment_id = c.comment_id
and v.vote_user_id = $userId
```
Using CASE statement to display/hide vote\_type.
```
select c.*, CASE v.vote_user_id WHEN $userId
... | Wouldn't you need a column for whatever it is the user voted on, ie post\_id?
You could do a select query, see if a row for the current post and user exists - if a row is returned, they've voted.
---
Actually, I just noticed that vote\_comment\_id isn't what I read it as (vote\_comment).
You just need to check if... |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | Try to avoid using subselect specially if you are retrieving large number of rows.
```
select c.*, v.vote_type
from comments c
left join vote v
on v.vote_comment_id = c.comment_id
and v.vote_user_id = $userId
```
Using CASE statement to display/hide vote\_type.
```
select c.*, CASE v.vote_user_id WHEN $userId
... | My solution is to fetch all user's votes when he's logging in into a session.
Fetch all comments' ids into two arrays:
```
$_SESSION['votes'] = array(
'up' => array(12, 854, 87, 78),
'down' => array(84, 32, 77)
);
```
and when user access some page check if its id exists in any of that arrays. |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | Try to avoid using subselect specially if you are retrieving large number of rows.
```
select c.*, v.vote_type
from comments c
left join vote v
on v.vote_comment_id = c.comment_id
and v.vote_user_id = $userId
```
Using CASE statement to display/hide vote\_type.
```
select c.*, CASE v.vote_user_id WHEN $userId
... | I've a site with a similar logic. I do not track individual votes (for this), I only have a posts (images) table, with a vote count and a text field with userid:vote;userid:vote... pairs, where vote is +/-. This way I do not need to select from the huge votes table and I need to load the row belonging to the post anywa... |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | You are looping through the table of votes? Are you reading the entire database into memory and then looping through it?
Have you tried querying the database only for the relevant data?
```
SELECT vote_comment_id, vote_type
FROM vote
WHERE vote_user_id = 34513
AND vote_comment_id IN (3443145, 3443256, 3443983)
``` | My solution is to fetch all user's votes when he's logging in into a session.
Fetch all comments' ids into two arrays:
```
$_SESSION['votes'] = array(
'up' => array(12, 854, 87, 78),
'down' => array(84, 32, 77)
);
```
and when user access some page check if its id exists in any of that arrays. |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | I've a site with a similar logic. I do not track individual votes (for this), I only have a posts (images) table, with a vote count and a text field with userid:vote;userid:vote... pairs, where vote is +/-. This way I do not need to select from the huge votes table and I need to load the row belonging to the post anywa... | My solution is to fetch all user's votes when he's logging in into a session.
Fetch all comments' ids into two arrays:
```
$_SESSION['votes'] = array(
'up' => array(12, 854, 87, 78),
'down' => array(84, 32, 77)
);
```
and when user access some page check if its id exists in any of that arrays. |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | you don't mention which database you're using but i assume some SQL variant.
so, instead of looping through the entire table of votes, you can do something like
```
select vote_type from vote_table where vote_comment_id = $commentId and vote_user_id = $userId
```
or even better, when you're retrieving the actual co... | My solution is to fetch all user's votes when he's logging in into a session.
Fetch all comments' ids into two arrays:
```
$_SESSION['votes'] = array(
'up' => array(12, 854, 87, 78),
'down' => array(84, 32, 77)
);
```
and when user access some page check if its id exists in any of that arrays. |
2,616,616 | I have a system where registered users can vote up/vote down comments for a picture. It's very similar to Stack Overflow's voting system.
I store the votes in a table with values as such:
```
vote_id | vote_comment_id | vote_user_id | vote_date | vote_type
```
Now I have a few questions concerning the speed and ef... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2616616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222159/"
] | You are looping through the table of votes? Are you reading the entire database into memory and then looping through it?
Have you tried querying the database only for the relevant data?
```
SELECT vote_comment_id, vote_type
FROM vote
WHERE vote_user_id = 34513
AND vote_comment_id IN (3443145, 3443256, 3443983)
``` | I've a site with a similar logic. I do not track individual votes (for this), I only have a posts (images) table, with a vote count and a text field with userid:vote;userid:vote... pairs, where vote is +/-. This way I do not need to select from the huge votes table and I need to load the row belonging to the post anywa... |
32,464,785 | For some reason only the odd numbered lines are spacing correctly. Can someone please explain this? Here is my code.
```
import java.util.Scanner;
public class Triangle {
public static void main(String args[]) {
int i, j, k1;
Scanner in = new Scanner(System.in);
System.out.println("Enter t... | 2015/09/08 | [
"https://Stackoverflow.com/questions/32464785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4084696/"
] | Just add this and change /t to 4 spaces:
```
if(i%2 ==0 && j ==1){
System.out.print(" "); // two spaces
}
```
---
Full code
```
for(i=1; i<=side;i++){
for (k1=0; k1 < (side-i/2);k1++){
System.out.print(" ");
}
for(j=1;j<=i;j++){
if(i%2 ==0 && j ==1){
... | You haven't stated the desired outcome, but remove the `/2` might do the trick.
Maybe replace both `\t` with a space.
Remove the `'\n'` from `println`, unless you want a blank line between lines. |
32,464,785 | For some reason only the odd numbered lines are spacing correctly. Can someone please explain this? Here is my code.
```
import java.util.Scanner;
public class Triangle {
public static void main(String args[]) {
int i, j, k1;
Scanner in = new Scanner(System.in);
System.out.println("Enter t... | 2015/09/08 | [
"https://Stackoverflow.com/questions/32464785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4084696/"
] | Just add this and change /t to 4 spaces:
```
if(i%2 ==0 && j ==1){
System.out.print(" "); // two spaces
}
```
---
Full code
```
for(i=1; i<=side;i++){
for (k1=0; k1 < (side-i/2);k1++){
System.out.print(" ");
}
for(j=1;j<=i;j++){
if(i%2 ==0 && j ==1){
... | How about this:
```
try (final Scanner scanner = new Scanner(System.in, StandardCharsets.UTF_8.name())) {
System.out.print("Enter the length of the side of your equilateral triangle: ");
final int side = scanner.nextInt();
System.out.print("Enter the character you want your triangle to be filled with: ");
f... |
6,073,783 | I'm very new to XSLT and just haven't been able to find a solution yet to my problem. I have an xml file that looks like (and I can't change the way this xml looks, realizing it's a bit odd):
```
<account>
<name>accountA</name>
</account>
<period>
<type>priormonth</type>
</period>
<period>
<type>currentmon... | 2011/05/20 | [
"https://Stackoverflow.com/questions/6073783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/762947/"
] | Try this:
```
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="account">
<xsl:copy>
<xsl:apply-templates />
<period>
<xsl:apply-templates select="following-sibling::period[generate-id(preceding-sibl... | The following XSLT assumes that the xml source is exactly as presented in your question (apart the missing root which makes the source document not well formed). In this case you do not need identity transform. Moreover, if really your `account` needs only the first next two `period` you can use a simpler XPath.
---
... |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | I use [gedit](http://www.gedit.org) for most of my web programming. I know, it's not very hardcore, but it has syntax highlighting and some nice plugins and it's very user-friendly.
I would recommend learning to use bash, ssh, and the mysql console especially. It beats any sort of database gui, hands down.
Besides th... | Eclipse can help you out with Python, MySQL, and JQuery.
[Python ID - Pydev](http://pydev.org/)
[Eclipse Data Tools Platform (MySQL)](http://www.eclipse.org/datatools/)
In addition you could use [MySQL GUI Tools](http://dev.mysql.com/downloads/gui-tools/5.0.html). |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | Eclipse can help you out with Python, MySQL, and JQuery.
[Python ID - Pydev](http://pydev.org/)
[Eclipse Data Tools Platform (MySQL)](http://www.eclipse.org/datatools/)
In addition you could use [MySQL GUI Tools](http://dev.mysql.com/downloads/gui-tools/5.0.html). | I have no idea what you're asking exactly, but I do all my web development with [gedit](http://projects.gnome.org/gedit/) and [Flask](http://flask.pocoo.org/).
**Gedit** has plugins for an embedded terminal, running code with keyboard shortcuts, and a really minimalistic interface. Here's a screenshot with the Oblivio... |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | Eclipse can help you out with Python, MySQL, and JQuery.
[Python ID - Pydev](http://pydev.org/)
[Eclipse Data Tools Platform (MySQL)](http://www.eclipse.org/datatools/)
In addition you could use [MySQL GUI Tools](http://dev.mysql.com/downloads/gui-tools/5.0.html). | In addition to the vote for Eclipse above, if you are looking for an alternative for gedit, I'd recommend Geany: <http://www.geany.org/>
I very much agree on using Firebug, and I'd also add the Web Developer toolbar if you're using Firefox. |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | Eclipse can help you out with Python, MySQL, and JQuery.
[Python ID - Pydev](http://pydev.org/)
[Eclipse Data Tools Platform (MySQL)](http://www.eclipse.org/datatools/)
In addition you could use [MySQL GUI Tools](http://dev.mysql.com/downloads/gui-tools/5.0.html). | You're going to have a lot more problems than your choice of framework if this is your first project on a UNIX. I'd recommend you find a clued in person at your workplace who knows the platform fairly well and use her as a teacher rather than rely completely on the web. |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | I use [gedit](http://www.gedit.org) for most of my web programming. I know, it's not very hardcore, but it has syntax highlighting and some nice plugins and it's very user-friendly.
I would recommend learning to use bash, ssh, and the mysql console especially. It beats any sort of database gui, hands down.
Besides th... | I have no idea what you're asking exactly, but I do all my web development with [gedit](http://projects.gnome.org/gedit/) and [Flask](http://flask.pocoo.org/).
**Gedit** has plugins for an embedded terminal, running code with keyboard shortcuts, and a really minimalistic interface. Here's a screenshot with the Oblivio... |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | I use [gedit](http://www.gedit.org) for most of my web programming. I know, it's not very hardcore, but it has syntax highlighting and some nice plugins and it's very user-friendly.
I would recommend learning to use bash, ssh, and the mysql console especially. It beats any sort of database gui, hands down.
Besides th... | In addition to the vote for Eclipse above, if you are looking for an alternative for gedit, I'd recommend Geany: <http://www.geany.org/>
I very much agree on using Firebug, and I'd also add the Web Developer toolbar if you're using Firefox. |
5,758,354 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | 2011/04/22 | [
"https://Stackoverflow.com/questions/5758354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715283/"
] | I use [gedit](http://www.gedit.org) for most of my web programming. I know, it's not very hardcore, but it has syntax highlighting and some nice plugins and it's very user-friendly.
I would recommend learning to use bash, ssh, and the mysql console especially. It beats any sort of database gui, hands down.
Besides th... | You're going to have a lot more problems than your choice of framework if this is your first project on a UNIX. I'd recommend you find a clued in person at your workplace who knows the platform fairly well and use her as a teacher rather than rely completely on the web. |
78,589 | What is the **main difference** between "`light/thin client`" and "`client`" in sense of "**functionality** and **capability**" ?
I mean, what can a `client` does that a `light/thin client` cannot ? (ex. *sending transactions?* *transaction confirmation?* etc) | 2018/08/24 | [
"https://bitcoin.stackexchange.com/questions/78589",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/41513/"
] | Usually the distinction is made between full nodes and lightweight nodes.
A full node independently validates all transactions. It guarantees that not transactions or blockchain will be accepted which spend funds without authorization (theft), create money out of thin air (inflation), or violate various other rules th... | client vs thin client: a normal client holds the COMPLETE (a hundrets of GB data) blockchain on your disk. The other does not. But due to the bitcoin script which is like a "contract" also a thin client can confirm transactions. also sending transactions is possible. disadvantages are not worth mention it if you would ... |
190,755 | I'm fairly new to bayesian. I'm trying to edit a bayesian python code for $A/B$ test analysis. I'm using uninformative priors as a beta distribution, so my $\alpha$ & $\beta$ parameters are $1$ & $1$ for both control & test for the first observation of the data.
I have a function which takes in priors, visitors for con... | 2016/01/14 | [
"https://stats.stackexchange.com/questions/190755",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/100744/"
] | Firstly, as pointed out in the answer by @AdamO Bayesian updating results in the same answer, if you add new data in multiple steps or all at once - if they are for the same parameter.
Secondly, I'd wonder whether your observations should be treated as indepdent binary events. Are these not some of the same people, a... | If the goal is to obtain $Pr(\theta | Y\_1, Y\_2, \ldots, Y\_n)$ where the $Y$s are the cumulative data, then a simply application of Bayes Rule shows that:
$$Pr(\theta | Y\_1, Y\_2, \ldots, Y\_n) =
\frac{Pr( Y\_1, Y\_2, \ldots, Y\_n | \theta) Pr(\theta)}{Pr(Y\_1, Y\_2, \ldots, Y\_n)}$$
And under the assumption of i... |
34,041,182 | I have the following query as a sub query. I need to bring back a single record per `siteid` with the max `grossinternalarea`. Trouble is this doesn't work where there maybe more than one `buildingid` with the same maximum `grossinternalarea`. I have to include the `buildingid` as this is then used in a subsequent join... | 2015/12/02 | [
"https://Stackoverflow.com/questions/34041182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2746559/"
] | If you are requiring that your facts be as stated in your original post, then you can define the following rules which will determine the employees of a given "boss":
```
% Boss is the boss of Employee if Employee' is a member of Boss' employees
%
boss_of(Boss, Employee) :-
employee(Boss, Employees),
member(Em... | a recursive approach could be:
```
boss_employees(Boss, Employees) :-
employee(Boss, Direct),
findall(L, ( member(D, Direct), boss_employees(D, L) ), Lt),
flatten([Direct, Lt], Sub),
sort(Sub, Employees).
```
instead of flatten/2, we can use append/2, since the nesting is always 1 level
```
...
... |
69,557,353 | I wrote a game of Hang-man, to play with the computer. It picks a word from another python file called 'words' and you guess letters. But it doesn't matter where I define my names, it always says they're not defined.
```
> line 20, in <module>
> while len(word_letters) > 0:
> NameError: name 'word_letters' is... | 2021/10/13 | [
"https://Stackoverflow.com/questions/69557353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10440380/"
] | This should get you started. It's pretty straightforward as the commenter suggested. You'll have to change the logic around as needed.
```
ec2c = boto3.client('ec2')
response = ec2c.describe_instances()
response['Reservations'][0]['Instances']
for inst in response['Reservations'][0]['Instances']:
if not inst.get('... | Thank you for your answers. I have updated the code and now it seems to be working fine. Updated code:
```
available_volumes=[]
for volume in ec2_volume.volumes.filter(
Filters=[
{
'Name': 'status',
'Values': [
'available',
]
}
]
... |
19,865,625 | Has anyone had success using Stripe connect with an iOS app. I have a few questions:
I'm following the guidelines here: <https://stripe.com/docs/connect/getting-started>
Registering an Application: easy, no problem here
Then a little further down:
Send your users to Stripe: again, easy no problem here, I just have ... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19865625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666539/"
] | You should setup a small web app to create stripe charges and storing you customers Authorization Code. Configure two routes in your web app for `redirect_uri` and `webhook_uri` and add the url in your [Stripe Apps settings](https://manage.stripe.com/account/applications/settings). The charges should be created from a ... | You can use UIWebView. You will still need to use redirect urls and monitor the redirect using the delegate "webView:shouldStartLoadWithRequest:navigationType:" |
3,421,233 | Suppose $a \in \mathbb{R^+}$. I need to prove $\exists n \in \mathbb{N}, 2^n > a\cdot n^2$.
Both L'Hôpital's rule and Lambert's W function are **NOT** allowed to use other than inequality or taking logarithm. I understand there is a classical induction proof for $2^n > n^2$, but this one seems to be tricky because of ... | 2019/11/04 | [
"https://math.stackexchange.com/questions/3421233",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/721765/"
] | $\frac 1 {\sqrt {2\pi}}\int\_{-\epsilon}^{\epsilon} e^{-x^{2}/2}dx < \frac 1 {\sqrt {2\pi}}\int\_{-\epsilon}^{\epsilon} dx=\frac {2\epsilon} {\sqrt {2\pi}}<\epsilon $ since $\pi >2$. | Hint: Try using the fact that
$$P(|Z|<\epsilon)=\frac{1}{\sqrt{2\pi}}\int\_{-\epsilon}^{\epsilon}e^{-t^2/2} \ dt$$
in combination with the integral inequality
$$\int\_a^b f(t) \ dt\leq (b-a)M$$
with $f$ a non negative function in $[a,b]$ satisfying $f(t)\leq M$ for every $t\in [a,b]$. |
55,125,782 | I have data of the following form:
```
6460 2001-07-24 00:00:00 67.5 75.1 75.9 71.0 75.2 81.8
6490 2001-06-24 00:00:00 68.4 74.9 76.1 70.9 75.5 82.7
6520 2001-05-25 00:00:00 69.6 74.7 76.3 70.8 75.5 83.2
6550 2001-04-25 00:00:00 69.2 74.6 76.1 70.6 7... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55125782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4045121/"
] | IIUC you could change your date column like this:
```
import datetime
a = df.iloc[0,0] # first date, assuming date col is first
df['date'] = [a + datetime.timedelta(days=30 * i) for i in range(len(df))]
``` | I haven't tested this so not sure it work as smooth as I thought it will =).
You can transform your first day into ordinal, add 30\*i to it and then transform it back.
```
first_day=df.iloc[0]['date_column'].toordinal()
df['date']=(first_day+30*i for i in range(len(df))).fromordinal
``` |
55,125,782 | I have data of the following form:
```
6460 2001-07-24 00:00:00 67.5 75.1 75.9 71.0 75.2 81.8
6490 2001-06-24 00:00:00 68.4 74.9 76.1 70.9 75.5 82.7
6520 2001-05-25 00:00:00 69.6 74.7 76.3 70.8 75.5 83.2
6550 2001-04-25 00:00:00 69.2 74.6 76.1 70.6 7... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55125782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4045121/"
] | You could use `date_range`:
```
df['date'] = pd.date_range(start=df['date'][0], periods=len(df), freq='30D')
``` | IIUC you could change your date column like this:
```
import datetime
a = df.iloc[0,0] # first date, assuming date col is first
df['date'] = [a + datetime.timedelta(days=30 * i) for i in range(len(df))]
``` |
55,125,782 | I have data of the following form:
```
6460 2001-07-24 00:00:00 67.5 75.1 75.9 71.0 75.2 81.8
6490 2001-06-24 00:00:00 68.4 74.9 76.1 70.9 75.5 82.7
6520 2001-05-25 00:00:00 69.6 74.7 76.3 70.8 75.5 83.2
6550 2001-04-25 00:00:00 69.2 74.6 76.1 70.6 7... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55125782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4045121/"
] | You could use `date_range`:
```
df['date'] = pd.date_range(start=df['date'][0], periods=len(df), freq='30D')
``` | I haven't tested this so not sure it work as smooth as I thought it will =).
You can transform your first day into ordinal, add 30\*i to it and then transform it back.
```
first_day=df.iloc[0]['date_column'].toordinal()
df['date']=(first_day+30*i for i in range(len(df))).fromordinal
``` |
10,225,422 | I am trying to write a regular expression to match a form of string :
```
"[A-Za-z][A-Za-z]-[A-Za-z][A-Za-z]_[match all chars]"
```
The string I want to match must be of this form, including the hyphen and underscore. So far I have :
```
Regex regEx = new Regex(@"[A-Za-z]+(-[A-Za-z]+)+*$", RegexOptions.IgnorePatte... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10225422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/963156/"
] | I'd use
```
@"^[A-Za-z]{2}-[A-Za-z]{2}_.*$"
```
Explanation:
* `^` beginning of the line
* `[A-Za-z]{2}` exactly 2 characters must be a-zA-Z
* `-` the dash
* `_` the underscore
* `.*` any character
* `$` end of the line
EDIT:
See also [Regex docs](http://msdn.microsoft.com/en-us/library/az24scfc.aspx) | I believe the Regex you want is:
```
new Regex(@"^[A-Z][A-Z]-[A-Z][A-Z]_", RegexOptions.CaseInsensitive);
```
This should capture:
`^[A-Z][A-Z]` two alpha characters at the start
`-` the literal hyphen character
`[A-Z][A-Z]` two more alpha characters
`_` the literal underscore character
You don't say y... |
10,225,422 | I am trying to write a regular expression to match a form of string :
```
"[A-Za-z][A-Za-z]-[A-Za-z][A-Za-z]_[match all chars]"
```
The string I want to match must be of this form, including the hyphen and underscore. So far I have :
```
Regex regEx = new Regex(@"[A-Za-z]+(-[A-Za-z]+)+*$", RegexOptions.IgnorePatte... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10225422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/963156/"
] | I'd use
```
@"^[A-Za-z]{2}-[A-Za-z]{2}_.*$"
```
Explanation:
* `^` beginning of the line
* `[A-Za-z]{2}` exactly 2 characters must be a-zA-Z
* `-` the dash
* `_` the underscore
* `.*` any character
* `$` end of the line
EDIT:
See also [Regex docs](http://msdn.microsoft.com/en-us/library/az24scfc.aspx) | See this regex.
Tested on nregex.com
```
^[A-Za-z]+(-[A-Za-z]+_[A-Za-z]{2})$
```
Key things here:-
* Last part of string qualified to 2 characters ( replace this with + if you don't care about 2 characters exactly).
This also performs the capture. |
10,225,422 | I am trying to write a regular expression to match a form of string :
```
"[A-Za-z][A-Za-z]-[A-Za-z][A-Za-z]_[match all chars]"
```
The string I want to match must be of this form, including the hyphen and underscore. So far I have :
```
Regex regEx = new Regex(@"[A-Za-z]+(-[A-Za-z]+)+*$", RegexOptions.IgnorePatte... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10225422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/963156/"
] | I'd use
```
@"^[A-Za-z]{2}-[A-Za-z]{2}_.*$"
```
Explanation:
* `^` beginning of the line
* `[A-Za-z]{2}` exactly 2 characters must be a-zA-Z
* `-` the dash
* `_` the underscore
* `.*` any character
* `$` end of the line
EDIT:
See also [Regex docs](http://msdn.microsoft.com/en-us/library/az24scfc.aspx) | Your example pattern uses the + modifier which is "more than 1", not 2. It will match more than you think.
```cs
Regex regEx = new Regex(@"^[A-Za-z]{2}-[A-Za-z]{2}_.*$", RegexOptions.IgnorePatternWhitespace);
```
Or just set the case insensitive option too with:
```cs
Regex regEx = new Regex(@"^[a-z]{2}-[a-z]{2}_.*... |
10,225,422 | I am trying to write a regular expression to match a form of string :
```
"[A-Za-z][A-Za-z]-[A-Za-z][A-Za-z]_[match all chars]"
```
The string I want to match must be of this form, including the hyphen and underscore. So far I have :
```
Regex regEx = new Regex(@"[A-Za-z]+(-[A-Za-z]+)+*$", RegexOptions.IgnorePatte... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10225422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/963156/"
] | Your example pattern uses the + modifier which is "more than 1", not 2. It will match more than you think.
```cs
Regex regEx = new Regex(@"^[A-Za-z]{2}-[A-Za-z]{2}_.*$", RegexOptions.IgnorePatternWhitespace);
```
Or just set the case insensitive option too with:
```cs
Regex regEx = new Regex(@"^[a-z]{2}-[a-z]{2}_.*... | I believe the Regex you want is:
```
new Regex(@"^[A-Z][A-Z]-[A-Z][A-Z]_", RegexOptions.CaseInsensitive);
```
This should capture:
`^[A-Z][A-Z]` two alpha characters at the start
`-` the literal hyphen character
`[A-Z][A-Z]` two more alpha characters
`_` the literal underscore character
You don't say y... |
10,225,422 | I am trying to write a regular expression to match a form of string :
```
"[A-Za-z][A-Za-z]-[A-Za-z][A-Za-z]_[match all chars]"
```
The string I want to match must be of this form, including the hyphen and underscore. So far I have :
```
Regex regEx = new Regex(@"[A-Za-z]+(-[A-Za-z]+)+*$", RegexOptions.IgnorePatte... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10225422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/963156/"
] | Your example pattern uses the + modifier which is "more than 1", not 2. It will match more than you think.
```cs
Regex regEx = new Regex(@"^[A-Za-z]{2}-[A-Za-z]{2}_.*$", RegexOptions.IgnorePatternWhitespace);
```
Or just set the case insensitive option too with:
```cs
Regex regEx = new Regex(@"^[a-z]{2}-[a-z]{2}_.*... | See this regex.
Tested on nregex.com
```
^[A-Za-z]+(-[A-Za-z]+_[A-Za-z]{2})$
```
Key things here:-
* Last part of string qualified to 2 characters ( replace this with + if you don't care about 2 characters exactly).
This also performs the capture. |
8,237,641 | I try to include unsigned char variable into std::string.it throws compiletime error.
```
unsigned char* SrvName;
std::string m_sSMTPSrvName;
//srvName contains "207.45.255.45"
m_sSMTPSrvName.insert(0, SrvName);
```
**Error**
```
error C2664: 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Trait... | 2011/11/23 | [
"https://Stackoverflow.com/questions/8237641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1004807/"
] | Your problem is the `unsigned char* SrvName`. It should be `char* SrvName`
If you are insisting that it be `unsigned char*`, Then cast it.
`m_sSMTPSrvName.insert(0, (char*)SrvName);`
In any case, if the value of `SrvName` is `207.45.255.45` you should just make it `char*`.
You might be confusing the int value 2... | You could use `m_sSMTPSrvName.append(SrvName)` or `m_sSMTPSrvName.assign(SrvName)`, depending on desired behaviour. Mind you, you should have trouble with your original approach either, so I'm not *certain* this will solve your problem.
Reference docs [here](http://www.cplusplus.com/reference/string/string/append/) an... |
8,237,641 | I try to include unsigned char variable into std::string.it throws compiletime error.
```
unsigned char* SrvName;
std::string m_sSMTPSrvName;
//srvName contains "207.45.255.45"
m_sSMTPSrvName.insert(0, SrvName);
```
**Error**
```
error C2664: 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Trait... | 2011/11/23 | [
"https://Stackoverflow.com/questions/8237641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1004807/"
] | Why do you use `unsigned char*` in the first place?
Anyway, if `SrvName` is null-terminated, you can do:
```
std::string m_sSMTPSrvName=reinterpret_cast<const char*>(SrvName);
```
Or if you know `SrvName`'s length, you can do:
```
std::string m_sSMTPSrvName(SrvName, SrvName + Length);
```
---
EDIT:
Aft... | Your problem is the `unsigned char* SrvName`. It should be `char* SrvName`
If you are insisting that it be `unsigned char*`, Then cast it.
`m_sSMTPSrvName.insert(0, (char*)SrvName);`
In any case, if the value of `SrvName` is `207.45.255.45` you should just make it `char*`.
You might be confusing the int value 2... |
8,237,641 | I try to include unsigned char variable into std::string.it throws compiletime error.
```
unsigned char* SrvName;
std::string m_sSMTPSrvName;
//srvName contains "207.45.255.45"
m_sSMTPSrvName.insert(0, SrvName);
```
**Error**
```
error C2664: 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Trait... | 2011/11/23 | [
"https://Stackoverflow.com/questions/8237641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1004807/"
] | Why do you use `unsigned char*` in the first place?
Anyway, if `SrvName` is null-terminated, you can do:
```
std::string m_sSMTPSrvName=reinterpret_cast<const char*>(SrvName);
```
Or if you know `SrvName`'s length, you can do:
```
std::string m_sSMTPSrvName(SrvName, SrvName + Length);
```
---
EDIT:
Aft... | You could use `m_sSMTPSrvName.append(SrvName)` or `m_sSMTPSrvName.assign(SrvName)`, depending on desired behaviour. Mind you, you should have trouble with your original approach either, so I'm not *certain* this will solve your problem.
Reference docs [here](http://www.cplusplus.com/reference/string/string/append/) an... |
23,286,342 | I am trying to use javascript to login to identity server in OAuths Client. I can login and return to the return webpage successful.
I met a problem is why the Thinktecture identity sevrer always return '#' not '?' before parameters in querystring ,is that a bug?
the other question is how can I get the uses claims whe... | 2014/04/25 | [
"https://Stackoverflow.com/questions/23286342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1118730/"
] | You could try creating a public property for your getter such as you have already and then create the private version in your implementation file such as below.
**MyConfig.h**
```
// Public interface that the world can see
@interface MyConfig : NSObject
@property (readonly) NSString *url; // Readonly so the getter ... | The easiest way is to declare this property in your implementation (.m) file:
```
@interface MyConfig () //This declares a category/extension to your header file
@property (nonatomic, strong) NSString * url; //This property is private
@end
@implementation MyConfig
//Your code
@end
``` |
22,226,838 | This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass. In other words, I'd like to be able to do something like this:
```
public class MyBase { ... }
publi... | 2014/03/06 | [
"https://Stackoverflow.com/questions/22226838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | No. Anonymous types always implicitly derive from `object`, and never implement any interfaces.
From section 7.6.10.6 of the C# 5 specificiation:
>
> An anonymous object initializer declares an anonymous type and returns an instance of that type. An anonymous type is a nameless class type that inherits directly from... | No. From the [documentation](http://msdn.microsoft.com/en-us/library/bb397696.aspx):
*Anonymous types are class types that derive directly from object, and that cannot be cast to any type except object.*
To solve your problem, just replace the anonymous type with normal class... |
22,226,838 | This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass. In other words, I'd like to be able to do something like this:
```
public class MyBase { ... }
publi... | 2014/03/06 | [
"https://Stackoverflow.com/questions/22226838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | No. Anonymous types always implicitly derive from `object`, and never implement any interfaces.
From section 7.6.10.6 of the C# 5 specificiation:
>
> An anonymous object initializer declares an anonymous type and returns an instance of that type. An anonymous type is a nameless class type that inherits directly from... | Cannot extend an anonymous but you could declare your method to accept a dynamic parameter if you really need this to work. |
22,226,838 | This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass. In other words, I'd like to be able to do something like this:
```
public class MyBase { ... }
publi... | 2014/03/06 | [
"https://Stackoverflow.com/questions/22226838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | No. Anonymous types always implicitly derive from `object`, and never implement any interfaces.
From section 7.6.10.6 of the C# 5 specificiation:
>
> An anonymous object initializer declares an anonymous type and returns an instance of that type. An anonymous type is a nameless class type that inherits directly from... | Short answer: no
Long answer:
You could use a C# proxy class. There are several tools that can proxy classes. For example Moqs. <https://github.com/moq/moq4> |
22,226,838 | This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass. In other words, I'd like to be able to do something like this:
```
public class MyBase { ... }
publi... | 2014/03/06 | [
"https://Stackoverflow.com/questions/22226838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | No. From the [documentation](http://msdn.microsoft.com/en-us/library/bb397696.aspx):
*Anonymous types are class types that derive directly from object, and that cannot be cast to any type except object.*
To solve your problem, just replace the anonymous type with normal class... | Cannot extend an anonymous but you could declare your method to accept a dynamic parameter if you really need this to work. |
22,226,838 | This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass. In other words, I'd like to be able to do something like this:
```
public class MyBase { ... }
publi... | 2014/03/06 | [
"https://Stackoverflow.com/questions/22226838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | No. From the [documentation](http://msdn.microsoft.com/en-us/library/bb397696.aspx):
*Anonymous types are class types that derive directly from object, and that cannot be cast to any type except object.*
To solve your problem, just replace the anonymous type with normal class... | Short answer: no
Long answer:
You could use a C# proxy class. There are several tools that can proxy classes. For example Moqs. <https://github.com/moq/moq4> |
22,226,838 | This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass. In other words, I'd like to be able to do something like this:
```
public class MyBase { ... }
publi... | 2014/03/06 | [
"https://Stackoverflow.com/questions/22226838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | Cannot extend an anonymous but you could declare your method to accept a dynamic parameter if you really need this to work. | Short answer: no
Long answer:
You could use a C# proxy class. There are several tools that can proxy classes. For example Moqs. <https://github.com/moq/moq4> |
26,072,549 | I am developing a Hospital Management System using Qt. It has options to create Patients, edit Patients and generate Bills. I used a QMainWindow and had three buttons in the Toolbar for each of these three options. Now when user selects one of these three buttons I want to load the form corresponding to that , foreg., ... | 2014/09/27 | [
"https://Stackoverflow.com/questions/26072549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040174/"
] | ```
Add New -> Qt Designer Form Class
```
Set name of your class, mark `"Create form"`, inherit `QDialog`. Create your dialog using Qt Designer or do it by code and call it in MainWindow like this:
```
MyDialog dlg;
dlg.show();
```
To communicate between `MainWindow` and your forms (for example send new data to yo... | you should use [QStackedWidget](http://qt-project.org/doc/qt-5/qstackedwidget.html)
>
> The QStackedWidget class provides a stack of widgets where only one
> widget is visible at a time.
>
>
>
It's possible to manage stacked widgets by index or by their pointers. |
1,689,266 | I need to write a forum application for a friend's web site. I want to write it in C# 3.0 against the ASP.NET MVC framework, with SQL Server database.
So, I've two questions:
* Should I use Linq to SQL or the Entity Framework as a database abstraction?
* Should I use the ASP.NET Membership API or add Users table and ... | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140937/"
] | 1. There are lots of examples around internet which is using ling with ASP.NET MVC. But may be you can add your list NHibernate. If you do not want to add i suggest Entity Framework. Using ORM's is a plus.
2. I always chose write my own membership management layer. If you are a person like (write your own code and be h... | 1. Entity Framework definitely -- see below.
2. ASP.net Membership API -- easy to maintain.
Reason:
[Entity Framework vs LINQ to SQL](https://stackoverflow.com/questions/8676/entity-framework-vs-linq-to-sql) |
1,689,266 | I need to write a forum application for a friend's web site. I want to write it in C# 3.0 against the ASP.NET MVC framework, with SQL Server database.
So, I've two questions:
* Should I use Linq to SQL or the Entity Framework as a database abstraction?
* Should I use the ASP.NET Membership API or add Users table and ... | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140937/"
] | 1. There are lots of examples around internet which is using ling with ASP.NET MVC. But may be you can add your list NHibernate. If you do not want to add i suggest Entity Framework. Using ORM's is a plus.
2. I always chose write my own membership management layer. If you are a person like (write your own code and be h... | 1) How about both? Just create an abstraction and you could just use either. My recommendation is to use the repository pattern.
2) The membership provider has its strengths and weaknesses. For some projects, it was far too complex for my needs. However, it is great if you need to get something running in a short amou... |
1,689,266 | I need to write a forum application for a friend's web site. I want to write it in C# 3.0 against the ASP.NET MVC framework, with SQL Server database.
So, I've two questions:
* Should I use Linq to SQL or the Entity Framework as a database abstraction?
* Should I use the ASP.NET Membership API or add Users table and ... | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140937/"
] | 1. There are lots of examples around internet which is using ling with ASP.NET MVC. But may be you can add your list NHibernate. If you do not want to add i suggest Entity Framework. Using ORM's is a plus.
2. I always chose write my own membership management layer. If you are a person like (write your own code and be h... | I won't answer the first question since i'm a fan of nhibernate
for the second question adding a users table and implement membership yourself i don't think you will be able to do it at least the right way (lot of people tried to make their own membership api but they messed up !) |
1,689,266 | I need to write a forum application for a friend's web site. I want to write it in C# 3.0 against the ASP.NET MVC framework, with SQL Server database.
So, I've two questions:
* Should I use Linq to SQL or the Entity Framework as a database abstraction?
* Should I use the ASP.NET Membership API or add Users table and ... | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140937/"
] | 1. There are lots of examples around internet which is using ling with ASP.NET MVC. But may be you can add your list NHibernate. If you do not want to add i suggest Entity Framework. Using ORM's is a plus.
2. I always chose write my own membership management layer. If you are a person like (write your own code and be h... | 1) Totally depends on how complex things are going to get. If you want a quick DAL that more or less mirrors your tables in a 1:1 fashion, go for L2S (or SubSonic if you want something more mature and supported). If you are going for more of an n-tier type thing where your tables and domain model are completely differe... |
1,689,266 | I need to write a forum application for a friend's web site. I want to write it in C# 3.0 against the ASP.NET MVC framework, with SQL Server database.
So, I've two questions:
* Should I use Linq to SQL or the Entity Framework as a database abstraction?
* Should I use the ASP.NET Membership API or add Users table and ... | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140937/"
] | 1. There are lots of examples around internet which is using ling with ASP.NET MVC. But may be you can add your list NHibernate. If you do not want to add i suggest Entity Framework. Using ORM's is a plus.
2. I always chose write my own membership management layer. If you are a person like (write your own code and be h... | Something to think about, [SubSonic 3](http://www.subsonicproject.com/) is a pretty powerful data access generation tool. From what I understand, it basically wraps Linq to Sql inside of some very useful wrappers and makes using Linq a little more intutive. You can have a pretty powerful application built up in no time... |
45,646,022 | I am trying to validate a REST response. Is it possible to use an array as parameter to containsonly?
Ex:
```
String values[] = line.split(",");
given().
when().
then().
statusCode(200).
body("value", containsOnly(values));
```
Also, can we u... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45646022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696157/"
] | Get the current weekday from 0 (Sunday) to 6 (Saturday):
```
const today = new Date().getDay();
```
Adjust it to match the array, where 0 is Monday:
```
const today = (new Date().getDay() + 6) % 7;
```
Remove the name of the day from the corresponding entry:
```
const values = ["Monday: 11:30 AM – 2:30 PM, 5:30 ... | This also works.
```js
const days = ["Monday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Tuesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Wednesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Thursday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Friday: 11:30 AM – 9:30 PM", "Saturday: 11:30 AM – 9:30 PM",
"Sunday: 11:30 AM... |
45,646,022 | I am trying to validate a REST response. Is it possible to use an array as parameter to containsonly?
Ex:
```
String values[] = line.split(",");
given().
when().
then().
statusCode(200).
body("value", containsOnly(values));
```
Also, can we u... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45646022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696157/"
] | Get the current weekday from 0 (Sunday) to 6 (Saturday):
```
const today = new Date().getDay();
```
Adjust it to match the array, where 0 is Monday:
```
const today = (new Date().getDay() + 6) % 7;
```
Remove the name of the day from the corresponding entry:
```
const values = ["Monday: 11:30 AM – 2:30 PM, 5:30 ... | Try this
```
var x = ["Monday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Tuesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Wednesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Thursday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Friday: 11:30 AM – 9:30 PM", "Saturday: 11:30 AM – 9:30 PM",
"Sunday: 11:30 AM – 9:00 PM"];
for(... |
45,646,022 | I am trying to validate a REST response. Is it possible to use an array as parameter to containsonly?
Ex:
```
String values[] = line.split(",");
given().
when().
then().
statusCode(200).
body("value", containsOnly(values));
```
Also, can we u... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45646022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696157/"
] | Get the current weekday from 0 (Sunday) to 6 (Saturday):
```
const today = new Date().getDay();
```
Adjust it to match the array, where 0 is Monday:
```
const today = (new Date().getDay() + 6) % 7;
```
Remove the name of the day from the corresponding entry:
```
const values = ["Monday: 11:30 AM – 2:30 PM, 5:30 ... | Please try this. I changed the way the data is stored
```js
var array = [
{name: "Monday", value :"11:30 AM – 2:30 PM, 5:30 – 10:30 PM"},
{name: "Tuesday", value :"11:30 AM – 2:30 PM, 5:30 – 10:30 PM"},
{name: "Wednesday", value :"11:30 AM – 2:30 PM, 5:30 – 10:30 PM"},
... |
45,646,022 | I am trying to validate a REST response. Is it possible to use an array as parameter to containsonly?
Ex:
```
String values[] = line.split(",");
given().
when().
then().
statusCode(200).
body("value", containsOnly(values));
```
Also, can we u... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45646022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696157/"
] | This also works.
```js
const days = ["Monday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Tuesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Wednesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Thursday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Friday: 11:30 AM – 9:30 PM", "Saturday: 11:30 AM – 9:30 PM",
"Sunday: 11:30 AM... | Try this
```
var x = ["Monday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Tuesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Wednesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Thursday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Friday: 11:30 AM – 9:30 PM", "Saturday: 11:30 AM – 9:30 PM",
"Sunday: 11:30 AM – 9:00 PM"];
for(... |
45,646,022 | I am trying to validate a REST response. Is it possible to use an array as parameter to containsonly?
Ex:
```
String values[] = line.split(",");
given().
when().
then().
statusCode(200).
body("value", containsOnly(values));
```
Also, can we u... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45646022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696157/"
] | This also works.
```js
const days = ["Monday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Tuesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Wednesday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM", "Thursday: 11:30 AM – 2:30 PM, 5:30 – 10:30 PM",
"Friday: 11:30 AM – 9:30 PM", "Saturday: 11:30 AM – 9:30 PM",
"Sunday: 11:30 AM... | Please try this. I changed the way the data is stored
```js
var array = [
{name: "Monday", value :"11:30 AM – 2:30 PM, 5:30 – 10:30 PM"},
{name: "Tuesday", value :"11:30 AM – 2:30 PM, 5:30 – 10:30 PM"},
{name: "Wednesday", value :"11:30 AM – 2:30 PM, 5:30 – 10:30 PM"},
... |
24,518 | Question for old animators at Hanna Barbara: 1960s - 1980s. Do Hanna Barbara cartoons use 30 frames/s or 24 frames/s, and did they draw most animation on 2s for real 15 frames/s or 12 frames/s?
I guess 30 frame/s (15 frames/s on 2s) because US company make cartoons for TV (US TV during that time is NTSC ≈ 30 frames/s)... | 2018/07/21 | [
"https://avp.stackexchange.com/questions/24518",
"https://avp.stackexchange.com",
"https://avp.stackexchange.com/users/22761/"
] | This may be useful:
<https://www.illustrationhistory.org/essays/hanna-barbera-the-architects-of-saturday-morning>
>
> For a standard Disney feature, the film would be projected at
> the standard 24 frames per second with each frame having different
> animation. Planned animation provided for fewer frames, so that
>... | As far as I can remember Hanna Barbara was not even on 2s! They would hold frames for seconds at a time. I often felt cheated on the hair bear bunch. |
7,897,877 | >
> **Possible Duplicate:**
>
> [Why does this C code work?](https://stackoverflow.com/questions/713963/why-does-this-c-code-work)
>
> [How do you use offsetof() on a struct?](https://stackoverflow.com/questions/7180290/how-do-you-use-offsetof-on-a-struct)
>
>
>
I read about this offsetof macro on the Inte... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7897877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584192/"
] | It has no advantages and should not be used, since it invokes undefined behavior (and uses the wrong type - `int` instead of `size_t`).
The C standard defines an `offsetof` macro in `stddef.h` which actually works, for cases where you need the offset of an element in a structure, such as:
```
#include <stddef.h>
str... | It's finding the byte offset of a particular member of a `struct`. For example, if you had the following structure:
```
struct MyStruct
{
double d;
int i;
void *p;
};
```
Then you'd have `offsetOf(MyStruct, d) == 0`, `offsetOf(MyStruct, i) == 8`, and `offsetOf(MyStruct, p) == 12` (that is, the member nam... |
7,897,877 | >
> **Possible Duplicate:**
>
> [Why does this C code work?](https://stackoverflow.com/questions/713963/why-does-this-c-code-work)
>
> [How do you use offsetof() on a struct?](https://stackoverflow.com/questions/7180290/how-do-you-use-offsetof-on-a-struct)
>
>
>
I read about this offsetof macro on the Inte... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7897877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584192/"
] | R.. is correct in his answer to the second part of your question: this code is not advised when using a modern C compiler.
But to answer the first part of your question, what this is actually doing is:
```
(
(int)( // 4.
&( ( // 3.
(a*)(0) // 1.
)->b ) // 2.
)
)
```
Workin... | It has no advantages and should not be used, since it invokes undefined behavior (and uses the wrong type - `int` instead of `size_t`).
The C standard defines an `offsetof` macro in `stddef.h` which actually works, for cases where you need the offset of an element in a structure, such as:
```
#include <stddef.h>
str... |
7,897,877 | >
> **Possible Duplicate:**
>
> [Why does this C code work?](https://stackoverflow.com/questions/713963/why-does-this-c-code-work)
>
> [How do you use offsetof() on a struct?](https://stackoverflow.com/questions/7180290/how-do-you-use-offsetof-on-a-struct)
>
>
>
I read about this offsetof macro on the Inte... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7897877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584192/"
] | It has no advantages and should not be used, since it invokes undefined behavior (and uses the wrong type - `int` instead of `size_t`).
The C standard defines an `offsetof` macro in `stddef.h` which actually works, for cases where you need the offset of an element in a structure, such as:
```
#include <stddef.h>
str... | The implementation of the offsetof macro is really irrelevant.
The actual C standard defines it as in 7.17.3:
```
offsetof(type, member-designator)
```
which expands to an integer constant expression that has type size\_t, the value of which is the offset in bytes, to the structure member (designated by member-desi... |
7,897,877 | >
> **Possible Duplicate:**
>
> [Why does this C code work?](https://stackoverflow.com/questions/713963/why-does-this-c-code-work)
>
> [How do you use offsetof() on a struct?](https://stackoverflow.com/questions/7180290/how-do-you-use-offsetof-on-a-struct)
>
>
>
I read about this offsetof macro on the Inte... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7897877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584192/"
] | R.. is correct in his answer to the second part of your question: this code is not advised when using a modern C compiler.
But to answer the first part of your question, what this is actually doing is:
```
(
(int)( // 4.
&( ( // 3.
(a*)(0) // 1.
)->b ) // 2.
)
)
```
Workin... | It's finding the byte offset of a particular member of a `struct`. For example, if you had the following structure:
```
struct MyStruct
{
double d;
int i;
void *p;
};
```
Then you'd have `offsetOf(MyStruct, d) == 0`, `offsetOf(MyStruct, i) == 8`, and `offsetOf(MyStruct, p) == 12` (that is, the member nam... |
7,897,877 | >
> **Possible Duplicate:**
>
> [Why does this C code work?](https://stackoverflow.com/questions/713963/why-does-this-c-code-work)
>
> [How do you use offsetof() on a struct?](https://stackoverflow.com/questions/7180290/how-do-you-use-offsetof-on-a-struct)
>
>
>
I read about this offsetof macro on the Inte... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7897877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584192/"
] | It's finding the byte offset of a particular member of a `struct`. For example, if you had the following structure:
```
struct MyStruct
{
double d;
int i;
void *p;
};
```
Then you'd have `offsetOf(MyStruct, d) == 0`, `offsetOf(MyStruct, i) == 8`, and `offsetOf(MyStruct, p) == 12` (that is, the member nam... | The implementation of the offsetof macro is really irrelevant.
The actual C standard defines it as in 7.17.3:
```
offsetof(type, member-designator)
```
which expands to an integer constant expression that has type size\_t, the value of which is the offset in bytes, to the structure member (designated by member-desi... |
7,897,877 | >
> **Possible Duplicate:**
>
> [Why does this C code work?](https://stackoverflow.com/questions/713963/why-does-this-c-code-work)
>
> [How do you use offsetof() on a struct?](https://stackoverflow.com/questions/7180290/how-do-you-use-offsetof-on-a-struct)
>
>
>
I read about this offsetof macro on the Inte... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7897877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584192/"
] | R.. is correct in his answer to the second part of your question: this code is not advised when using a modern C compiler.
But to answer the first part of your question, what this is actually doing is:
```
(
(int)( // 4.
&( ( // 3.
(a*)(0) // 1.
)->b ) // 2.
)
)
```
Workin... | The implementation of the offsetof macro is really irrelevant.
The actual C standard defines it as in 7.17.3:
```
offsetof(type, member-designator)
```
which expands to an integer constant expression that has type size\_t, the value of which is the offset in bytes, to the structure member (designated by member-desi... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | The reason you are having this problem is that the slice maintains the original index numbers of the sequence you got it from. Thus, element 1 is not in this slice.
For example, consider this code:
```
let arr = [1,2,3,4,5,6,7,8,9]
let slice = arr[2...5]
```
Now what is `slice[1]`? It isn't `4`, even though that is... | To iterate over the elements in the slice:
draggingFan?.forEach({ (element)
...
})
As far as I know, the get a specific element, it needs to be converted back to an array e.g.
```
let draggingFanArray = Array(draggingFan!)
```
Here's the playground code I used to toy around with various scenarios:
import Cocoa... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | The indices of the `ArraySlice` still match those of the original array. In your case, you are accessing index `1` which is not in your slice. If you offset the index by `draggingFan.startIndex` it will work:
```
if let draggingFan = draggingFan {
for i in 1 ..< draggingFan.count {
let card = draggingFan... | The reason you are having this problem is that the slice maintains the original index numbers of the sequence you got it from. Thus, element 1 is not in this slice.
For example, consider this code:
```
let arr = [1,2,3,4,5,6,7,8,9]
let slice = arr[2...5]
```
Now what is `slice[1]`? It isn't `4`, even though that is... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | The reason you are having this problem is that the slice maintains the original index numbers of the sequence you got it from. Thus, element 1 is not in this slice.
For example, consider this code:
```
let arr = [1,2,3,4,5,6,7,8,9]
let slice = arr[2...5]
```
Now what is `slice[1]`? It isn't `4`, even though that is... | If I have an array:
```
var arr = [1, 2, 3, 4, 5, 6, 7] // [1, 2, 3, 4, 5, 6, 7]
```
And I take a slice of the array:
```
let slice = arr[3..<arr.count] // [4, 5, 6, 7]
```
This slice will have a `startIndex` of 3, which means that indexing starts at 3 and ends at 6.
Now if I want a slice containing everything b... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | The indices of the `ArraySlice` still match those of the original array. In your case, you are accessing index `1` which is not in your slice. If you offset the index by `draggingFan.startIndex` it will work:
```
if let draggingFan = draggingFan {
for i in 1 ..< draggingFan.count {
let card = draggingFan... | To iterate over the elements in the slice:
draggingFan?.forEach({ (element)
...
})
As far as I know, the get a specific element, it needs to be converted back to an array e.g.
```
let draggingFanArray = Array(draggingFan!)
```
Here's the playground code I used to toy around with various scenarios:
import Cocoa... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | This will access the values from the second element in the slice to the last element in the slice:
```
let original = [1,2,3,4,5,6] // Int array to demonstrate
var draggingFan : ArraySlice<Int>?
draggingFan = original[1...4] // create the slice
if let draggingFan = draggingFan {
// so there's no errors j... | To iterate over the elements in the slice:
draggingFan?.forEach({ (element)
...
})
As far as I know, the get a specific element, it needs to be converted back to an array e.g.
```
let draggingFanArray = Array(draggingFan!)
```
Here's the playground code I used to toy around with various scenarios:
import Cocoa... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | The indices of the `ArraySlice` still match those of the original array. In your case, you are accessing index `1` which is not in your slice. If you offset the index by `draggingFan.startIndex` it will work:
```
if let draggingFan = draggingFan {
for i in 1 ..< draggingFan.count {
let card = draggingFan... | This will access the values from the second element in the slice to the last element in the slice:
```
let original = [1,2,3,4,5,6] // Int array to demonstrate
var draggingFan : ArraySlice<Int>?
draggingFan = original[1...4] // create the slice
if let draggingFan = draggingFan {
// so there's no errors j... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | The indices of the `ArraySlice` still match those of the original array. In your case, you are accessing index `1` which is not in your slice. If you offset the index by `draggingFan.startIndex` it will work:
```
if let draggingFan = draggingFan {
for i in 1 ..< draggingFan.count {
let card = draggingFan... | If I have an array:
```
var arr = [1, 2, 3, 4, 5, 6, 7] // [1, 2, 3, 4, 5, 6, 7]
```
And I take a slice of the array:
```
let slice = arr[3..<arr.count] // [4, 5, 6, 7]
```
This slice will have a `startIndex` of 3, which means that indexing starts at 3 and ends at 6.
Now if I want a slice containing everything b... |
36,457,811 | Below I am trying to fetch the i'th element of the `ArraySlice` `draggignFan`. The code builds fine (no warnings) but the program dies at runtime on the line where I try to index the slice like a normal array:
```
var draggingFan : ArraySlice<Card>?
...
if let draggingFan = draggingFan {
for i in 1 ..< draggingF... | 2016/04/06 | [
"https://Stackoverflow.com/questions/36457811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398461/"
] | This will access the values from the second element in the slice to the last element in the slice:
```
let original = [1,2,3,4,5,6] // Int array to demonstrate
var draggingFan : ArraySlice<Int>?
draggingFan = original[1...4] // create the slice
if let draggingFan = draggingFan {
// so there's no errors j... | If I have an array:
```
var arr = [1, 2, 3, 4, 5, 6, 7] // [1, 2, 3, 4, 5, 6, 7]
```
And I take a slice of the array:
```
let slice = arr[3..<arr.count] // [4, 5, 6, 7]
```
This slice will have a `startIndex` of 3, which means that indexing starts at 3 and ends at 6.
Now if I want a slice containing everything b... |
15,326,985 | I am running into an issue where I'm adding an instance to a set and then later testing to see whether or not that object exists in that set. I've overridden `__eq__()` but it doesn't get called during the inclusion test. Do I have to override `__hash__()` instead? If so, how would I implement `__hash__()` given that I... | 2013/03/10 | [
"https://Stackoverflow.com/questions/15326985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1419236/"
] | From the [documentation on sets](https://docs.python.org/2/library/sets.html):
>
> The set classes are implemented using dictionaries. Accordingly, the
> requirements for set elements are the same as those for dictionary
> keys; namely, that the element defines both \_\_eq\_\_() and \_\_hash\_\_().
>
>
>
The [\... | Well, my guess would be `__eq__` or `__ne__` may not called by python when comparing objects using the 'in' operator. I'm not positive what the specific "rich comparison" operator would be, looking at the documentation, but overriding `__cmp__` should solve your problem as python uses it by default to perform object co... |
17,204,128 | i have created a code for a simple javascript picture slideshow.
so, when i copy the code directly from the website that i learned it from it works. when i try to recreate the code exactly the same way, it does not work. how is this possible? i have revised the code thoroughly. is javascript not working or what? the co... | 2013/06/20 | [
"https://Stackoverflow.com/questions/17204128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2491795/"
] | Change
```
setTimeout=("slider()",10);
```
by
```
setTimeout("slider()",10);
``` | ```
var x=1;
function slider()
{
document.images.slider1.src = eval("image"+x+".src");
x= (x+1)%4 +1;
setTimeout(slider,10);
}
setTimeout(slider,10); // 10 is too fast for a slide show (10ms) use at least 1000ms
``` |
15,203 | What would you call the temporary advisor assigned to a PhD student upon enrolment, who is in charge of the student until the student finds his/her research advisor? "temporary advisor", or "course advisor", or ...? Thanks! | 2013/12/30 | [
"https://academia.stackexchange.com/questions/15203",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/218/"
] | In the program where I currently work, we call such advisors "academic advisors," which makes the distinction with the "research advisor" or "thesis advisor" fairly obvious. | I'd imagine the particular terminology varies from one department to another. I've heard that called a "provisional" advisor. In my department you start with a "provisional committee" of two people. The provisional advisor is assigned based on the student's research interests, so often they wind up being the "real" adv... |
15,203 | What would you call the temporary advisor assigned to a PhD student upon enrolment, who is in charge of the student until the student finds his/her research advisor? "temporary advisor", or "course advisor", or ...? Thanks! | 2013/12/30 | [
"https://academia.stackexchange.com/questions/15203",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/218/"
] | In the program where I currently work, we call such advisors "academic advisors," which makes the distinction with the "research advisor" or "thesis advisor" fairly obvious. | The term when I was a first-year PhD student was a "temporary advisor". There isn't a huge difference on how you call this person; people on the admission committee have been through graduate school too, and they'll get it. Don't worry on the details too much, and spend more time on the SOP. |
52,951,834 | I am experimenting with Spring Cloud APIs as part of microservices course.
To setup server-less task, I am using Cloud Task, Cloud Stream(RabbitMQ), and Spring Web.
For this I have setup following projects:
Serverless task to be executed -
<https://github.com/Omkar-Shetkar/pluralsight-springcloud-m3-task>
Componen... | 2018/10/23 | [
"https://Stackoverflow.com/questions/52951834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441374/"
] | There were two issue with my current implementation:
In intake and sink modules -> *application.properties*, binding property key was wrong.
It should be:
In intake module
```
spring.cloud.stream.bindings.output.destination=tasktopic
```
In sink module
```
spring.cloud.stream.bindings.input.destination=tasktopi... | @EnableTaskLauncher annotation is missing in TaskIntakeApplication.
```
@SpringBootApplication
@EnableTaskLauncher
public class PluralsightSpringcloudM3TaskintakeApplication {
public static void main(String[] args) {
SpringApplication.run(PluralsightSpringcloudM3TaskintakeApplication.class, args);
}
... |
18,267,859 | I have an image and I want to get image url with method .I found this questions on the web.But answer not quite.
Source as follows:
```
<img id="largeImage" src='<%#ShowLast() %>' alt="" />
```
cs file as follows:
```
public string ShowLast()
{
using (DBMLDataContext dc=new DBMLDataContext())
... | 2013/08/16 | [
"https://Stackoverflow.com/questions/18267859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2427414/"
] | Whats happening? If you are using this inside a databound control then `<%#` is right. If not you will want to use `<%=` or better yet one of the variations that encode the output.
Based on your comments it sounds like you should just use an `<asp:Image>` control and then set its `ImageUrl` property in the codebehind.... | You can call the method like this
```
<img id="largeImage" src='<%= ShowLast() %>' alt="" />
```
if method is returning URL in string |
17,971,991 | Trying to expand the sections each section will have two rows when expanded. It is giving crash. Below is code am trying.
```
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
return [self.mArrQues count];
}
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
i... | 2013/07/31 | [
"https://Stackoverflow.com/questions/17971991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2545292/"
] | As you are changing the number of cells at section, you need to wrap the reload operation with `beginUpdates` and `endUpdates` as well as specify the cells insertion and removal with `insertRowsAtIndexPaths:withRowAnimation` and `deleteRowsAtIndexPaths:withRowAnimation:`.
Alternatively you can use 'reloadData` to rel... | Remove this from your code.
```
else{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
```
There is no need to alloc your cell if it is nil, tableview will reuse from previous cell in this line
```
cell = [self.mHelpTable dequeueReusableCellWithIdent... |
6,181,492 | I'm trying to create some functionality akin to .hide in jquery, but just using plain javascript, here's what I have so far:
```
(function() {
addLoadEventHandler(function() {
getByName = (function(name){
return document.getElementsByTagName(name)
})
hide = (function(){
... | 2011/05/30 | [
"https://Stackoverflow.com/questions/6181492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776877/"
] | You need context for the hide function. Either you wrap a DOMElement like jQuery does, or you need to pass it in. I'll give examples for both:
```
var incomplete = (function () {
function hide(DOMElement) {
DOMElement.style.display = 'none';
}
return {
hide: hide
};
}());
// use like... | Sort of, you need to assign it to something
```
mymodule = function () {
//"private" variables:
var privateVar = "only from within this module."
//"private" methods:
var getByName = function(name){
return document.getElementsByTagName(name)
}
hide = function(... |
57,882,040 | I was creating a phonebook in C using single linked list. The issue that I am experiencing in GCC is that at certain lines, GCC is throwing assignment to expression with array type errors. And at certain lines, it is giving me warning like format %s expects an argument of type char\*.
I have tried without the sorting ... | 2019/09/11 | [
"https://Stackoverflow.com/questions/57882040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9204642/"
] | `.show_ticket_preview:not(.ticket_preview_id)` selector will select all elements that has class `show_ticket_preview` but not has class `ticket_preview_id` so it's not working in your case.
To solve your problem, you can use event object in the handle then check if the target has class `ticket_preview_id` or not:
```... | Have another click event which is tied to the `ticket_preview_id` and make use of the `stopPropagation` method.
```
$(document).on('click', '.show_ticket_preview', function() {
// Do Something
})
$(document).on('click', '.ticket_preview_id', function(e) {
e.stopPropagation()
})
```
You can see more about st... |
22,877,567 | I am using the stanford parser in python by doing the following:
```
import os
sentence = "Did Matt win the men slalom?"
os.popen("echo '"+sentence+"' > ~/stanfordtemp.txt")
parser_out = os.popen("~/stanford-parser-2012-11-12/lexparser.sh
~/stanfordtemp.txt").readlines()
for tree in parser_out:
print tree
``... | 2014/04/05 | [
"https://Stackoverflow.com/questions/22877567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1730503/"
] | Here's an example of building a tree and then recursively building a list of the leaves. The sample text is take from [the online standford parser](http://nlp.stanford.edu:8080/parser/).
```
# class for tree nodes
class Node:
def __init__(self,start):
self.start = start
self.children = []
s... | How to extract individual clauses with a sentence as sub-trees?. So whenever a clause starts(S,SBAR, SBARQ etc), extract as a subtree until another clause is encountered. For the last clause its up to end of the sentence.
Here is an example:
(ROOT
(S
(S
(NP (NNP John))
(VP (VBZ lives)
(PP (IN in)
(NP (NNP New)... |
40,849,850 | This question is related to [the previous thread](https://stackoverflow.com/questions/40786904/how-to-extract-timed-out-sessions-using-mapwithstate/40789605?noredirect=1#comment68915662_40789605). I am extracting sessions from the stream of users' click events. For validation purposes, I am *always* waiting on a timeou... | 2016/11/28 | [
"https://Stackoverflow.com/questions/40849850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7116920/"
] | >
> It seems to be related to the version of Java. I have the following version on the cluster, but then how can I deploy my code and how to avoid the erro with java.time.temporal.TemporalField?:
>
>
>
`java.time` was added in Java 8. Search for any uses of `java.time.` in your code. Current Spark version requires... | >
> Caused by: java.io.NotSerializableException:
> org.testconsumer.kafka.KafkaEventsConsumer
>
>
>
Your error trace clearly shows what is the problem. `KafkaProducer` is not serialized so You have to annotate your kafka classes `@transient` or you can get help from [this](https://stackoverflow.com/questions/4050... |
47,313,529 | I have a Spring Boot application which use MongoDB. I would like to use the embedded FongoDB for my JUnit tests. I follow some articles, for example:
<http://dontpanic.42.nl/2015/02/in-memory-mongodb-for-unit-and.html>
My Fongo test configuration looks like
```
package com.myproject.rest;
import com.github.fakemon... | 2017/11/15 | [
"https://Stackoverflow.com/questions/47313529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4771312/"
] | You should be able to to that by simply moving the `sub-query` in `CROSS APPLY` operator. Something like this:
```
SELECT
p.id AS id
,newXML
FROM
st_person p
CROSS APPLY
(
SELECT
jobs_without_price.id AS JobsWithoutPrice
FROM
st_job jobs_without_price
WHERE
jobs_without_... | The scope of table aliases when used in a subquery or common table expression (CTE) is limited to that subquery. They cannot be referenced by an outer query. Consider the following query:
```
declare @table table (id int identity, col1 varchar(10));
insert @table(col1) values ('aaa'),('bbb'),('ccc');
select *
from
... |
47,313,529 | I have a Spring Boot application which use MongoDB. I would like to use the embedded FongoDB for my JUnit tests. I follow some articles, for example:
<http://dontpanic.42.nl/2015/02/in-memory-mongodb-for-unit-and.html>
My Fongo test configuration looks like
```
package com.myproject.rest;
import com.github.fakemon... | 2017/11/15 | [
"https://Stackoverflow.com/questions/47313529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4771312/"
] | You should be able to to that by simply moving the `sub-query` in `CROSS APPLY` operator. Something like this:
```
SELECT
p.id AS id
,newXML
FROM
st_person p
CROSS APPLY
(
SELECT
jobs_without_price.id AS JobsWithoutPrice
FROM
st_job jobs_without_price
WHERE
jobs_without_... | try this:
```
SELECT
p.id AS id,
-- sum(a), max(b), min(c) <--- what you want from JobsWithoutPrice table
FROM st_person p inner join (
(SELECT jobs_without_price.id, -- jobs_without_price.a, jobs_without_price.b, jobs_without_price.c
FROM st_job jobs_without_price
WHERE jobs_without_price.price I... |
12,493,669 | I am exporting data to Excel from within my C# application, using the `Microsoft.Office.Interop.Excel` library.
Calling `sheet.Cells[currentRow, 1])` with an invalid `currentRow` value, results in a `System.Runtime.InteropServices.COMException` with the message:
```
"Exception from HRESULT: 0x800A03EC"
```
and the ... | 2012/09/19 | [
"https://Stackoverflow.com/questions/12493669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/593677/"
] | There is a special version of [Unity for Silverlight](http://msdn.microsoft.com/en-us/library/hh237492.aspx) which you ou can donwload from [here](http://www.microsoft.com/en-us/download/details.aspx?id=1623). (If you use [nuget](http://nuget.org/packages/Unity/2.1.505.2) it will reference the correnct dlls for you aut... | It exist a special version of Unity for Silverlight. You can find it [here](http://www.microsoft.com/en-us/download/details.aspx?id=1623)
The latest version is 2.1 and is supported for Silverlight 3-5 |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | Use either the PHP *`floor()`* function, or the mysql *`FLOOR()`* function
PHP
```
<?php
echo floor(44.62); // will output "44"
```
MySQL
```
SELECT FLOOR(44.62);
-> 44
```
HOWEVER
```
SELECT FLOOR(-44.62);
-> -45
```
So, you can try something like:
```
SELECT IF(day_start < 0, CEIL(day_start), FLOOR(da... | I'd suggest using either [number\_format](http://php.net/manual/en/function.number-format.php) or [floor](http://php.net/manual/en/function.floor.php) |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | You have 2 simple options:
* Round the values when you query the database, using ROUND, FLOOR, CEIL mysql function
e.g.:`SELECT ROUND(day_start, 0) as day_start, ROUND(day_end, 0) as day_end`
* Round the value using php after you query the database, using `round`, `floor` or `ceil` | I'd suggest using either [number\_format](http://php.net/manual/en/function.number-format.php) or [floor](http://php.net/manual/en/function.floor.php) |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | I have actually fixed my problem, I just changed the structure to **INT** and back which removed all the decimals! But thanks for the answers, they will help others looking for this! | I'd suggest using either [number\_format](http://php.net/manual/en/function.number-format.php) or [floor](http://php.net/manual/en/function.floor.php) |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | Use either the PHP *`floor()`* function, or the mysql *`FLOOR()`* function
PHP
```
<?php
echo floor(44.62); // will output "44"
```
MySQL
```
SELECT FLOOR(44.62);
-> 44
```
HOWEVER
```
SELECT FLOOR(-44.62);
-> -45
```
So, you can try something like:
```
SELECT IF(day_start < 0, CEIL(day_start), FLOOR(da... | You can try this (SQL Server)
```
SELECT CONVERT(INT,Day_Start), CONVERT(INT,Day_End)
``` |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | Use either the PHP *`floor()`* function, or the mysql *`FLOOR()`* function
PHP
```
<?php
echo floor(44.62); // will output "44"
```
MySQL
```
SELECT FLOOR(44.62);
-> 44
```
HOWEVER
```
SELECT FLOOR(-44.62);
-> -45
```
So, you can try something like:
```
SELECT IF(day_start < 0, CEIL(day_start), FLOOR(da... | SQL :
```
SELECT SUBSTRING (notetitle,1,4), SUBSTRING(notedescription,1,3) FROM notes
``` |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | You have 2 simple options:
* Round the values when you query the database, using ROUND, FLOOR, CEIL mysql function
e.g.:`SELECT ROUND(day_start, 0) as day_start, ROUND(day_end, 0) as day_end`
* Round the value using php after you query the database, using `round`, `floor` or `ceil` | You can try this (SQL Server)
```
SELECT CONVERT(INT,Day_Start), CONVERT(INT,Day_End)
``` |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | I have actually fixed my problem, I just changed the structure to **INT** and back which removed all the decimals! But thanks for the answers, they will help others looking for this! | You can try this (SQL Server)
```
SELECT CONVERT(INT,Day_Start), CONVERT(INT,Day_End)
``` |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | You have 2 simple options:
* Round the values when you query the database, using ROUND, FLOOR, CEIL mysql function
e.g.:`SELECT ROUND(day_start, 0) as day_start, ROUND(day_end, 0) as day_end`
* Round the value using php after you query the database, using `round`, `floor` or `ceil` | SQL :
```
SELECT SUBSTRING (notetitle,1,4), SUBSTRING(notedescription,1,3) FROM notes
``` |
17,420,555 | Some of the value in two of my columns have decimal places for some reason, this is a bug in my code I need to sort out but its causing problems at the moment.
How can I round numbers with decimal places?
Example Data
============
```
# Table: level_3
|---------------------|
| day_start | day_end |
|-----------|---... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17420555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196030/"
] | I have actually fixed my problem, I just changed the structure to **INT** and back which removed all the decimals! But thanks for the answers, they will help others looking for this! | SQL :
```
SELECT SUBSTRING (notetitle,1,4), SUBSTRING(notedescription,1,3) FROM notes
``` |
760,363 | I can set up password-less SSH for a single user by doing the following:
1) Generate RSA key pair for the local machine in ~/.ssh
2) Copy the local machine's public key to the remote machine's ~/.ssh/authorized\_keys
But is there a way to do this action for *all* users? Perhaps doing the same steps as above in /root... | 2014/05/29 | [
"https://superuser.com/questions/760363",
"https://superuser.com",
"https://superuser.com/users/205914/"
] | If you want to provide password-less access for all users to a single remote host, then OpenSSH supports host-based public key authentication that user's the host key of the client to authenticate to the server and /etc/ssh/shosts.equiv to authorize users.
There is a good guide on how to configure it here: <http://en.... | How about something like this?
```
for u in $USERLIST; do
su $u
ssh-keygen [options] -f /home/$u/.ssh/id_rsa
scp /home/$u/.ssh/id_rsa.pub $REMOTEHOST:/home/$u/.ssh/authorized_keys
exit
done
```
Of course this involves typing a lot of passwords for the scp. You could do it all as root to avoid typing ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.