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 |
|---|---|---|---|---|---|
8,724,119 | I'm responsible for delivering pages to display primary results for the US elections State by State. Each page needs a banner with an image of the State, approx 250px by 250px. Now all I need to do is figure out how to serve / generate those images...
1. I've dug into the docs / examples for [Protovis](http://mbostock... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8724119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526133/"
] | You are going up to `s.length()` in the for loop but accessing `s.charAt(i + 1)` in the second if statement. Try to only go up to `s.length() - 1`:
```
for (int i = 0; i < s.length() - 1; i++) {
if (!Character.isWhitespace(s.charAt(i))) {
buf.append(s.charAt(i));
} else if (Character.isWhitespace(s.cha... | You are using this statement
```
Character.isWhitespace(s.charAt(i + 1)
```
meaning you are accessing an character of your string length plus 1. |
8,724,119 | I'm responsible for delivering pages to display primary results for the US elections State by State. Each page needs a banner with an image of the State, approx 250px by 250px. Now all I need to do is figure out how to serve / generate those images...
1. I've dug into the docs / examples for [Protovis](http://mbostock... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8724119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526133/"
] | You are going up to `s.length()` in the for loop but accessing `s.charAt(i + 1)` in the second if statement. Try to only go up to `s.length() - 1`:
```
for (int i = 0; i < s.length() - 1; i++) {
if (!Character.isWhitespace(s.charAt(i))) {
buf.append(s.charAt(i));
} else if (Character.isWhitespace(s.cha... | `s.charAt(i + 1)` in `!Character.isWhitespace(s.charAt(i + 1))`
It fails when `i == s.length() - 1`
You might want to use `s.replaceAll("\\s\\s+"," ")` instead of reinventing the wheel. |
8,724,119 | I'm responsible for delivering pages to display primary results for the US elections State by State. Each page needs a banner with an image of the State, approx 250px by 250px. Now all I need to do is figure out how to serve / generate those images...
1. I've dug into the docs / examples for [Protovis](http://mbostock... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8724119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526133/"
] | `s.charAt(i + 1)` in `!Character.isWhitespace(s.charAt(i + 1))`
It fails when `i == s.length() - 1`
You might want to use `s.replaceAll("\\s\\s+"," ")` instead of reinventing the wheel. | ```
hi i hope you can use the below one, instead the above
//StringBuilder buf = new StringBuilder();
/* These lines are not needed
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i))) {
buf.append(s.charAt(i));
} else if (Character.isWhitespace(s.charAt(i))... |
8,724,119 | I'm responsible for delivering pages to display primary results for the US elections State by State. Each page needs a banner with an image of the State, approx 250px by 250px. Now all I need to do is figure out how to serve / generate those images...
1. I've dug into the docs / examples for [Protovis](http://mbostock... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8724119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526133/"
] | You are going up to `s.length()` in the for loop but accessing `s.charAt(i + 1)` in the second if statement. Try to only go up to `s.length() - 1`:
```
for (int i = 0; i < s.length() - 1; i++) {
if (!Character.isWhitespace(s.charAt(i))) {
buf.append(s.charAt(i));
} else if (Character.isWhitespace(s.cha... | ```
hi i hope you can use the below one, instead the above
//StringBuilder buf = new StringBuilder();
/* These lines are not needed
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i))) {
buf.append(s.charAt(i));
} else if (Character.isWhitespace(s.charAt(i))... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Another way to accomplish this
```
#!/usr/bin/env python
code_dict = {
'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-',
'L': '.-..', 'M': '--', 'N': '-.',
'O': '---', 'P': '.--.', 'Q': '--.-',
'R': '.-.', '... | Ok ty already for the help, it was my first question here and I am pretty new to python and kinda struggle with easy things, but I will take notice for future. My biggest problem is that the code need to be solved with the exact parameter. The insep and outsep should define the input and output separator and must be ba... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Here's one approach using (generator) comprehension and `dict.get`; I am not sure what `insep` and `outsep` are supposed to mean.
```py
def encode(text, code_table):
return ''.join(code_table.get(c.upper(), c) for c in text)
# output: ......-...-..--- .-----.-..-..-..
```
Note that `code_table.get(..., c)` retu... | Ok ty already for the help, it was my first question here and I am pretty new to python and kinda struggle with easy things, but I will take notice for future. My biggest problem is that the code need to be solved with the exact parameter. The insep and outsep should define the input and output separator and must be ba... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Another way to accomplish this
```
#!/usr/bin/env python
code_dict = {
'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-',
'L': '.-..', 'M': '--', 'N': '-.',
'O': '---', 'P': '.--.', 'Q': '--.-',
'R': '.-.', '... | You should try to explain in what way your code is not working. But, I suspect the problem is that your `return` statement is indented so that it is inside the `for` loop. This means that the function will return after processing the first character. You should unindent the `return` so that it will execute after the `f... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | You should try to explain in what way your code is not working. But, I suspect the problem is that your `return` statement is indented so that it is inside the `for` loop. This means that the function will return after processing the first character. You should unindent the `return` so that it will execute after the `f... | Ok ty already for the help, it was my first question here and I am pretty new to python and kinda struggle with easy things, but I will take notice for future. My biggest problem is that the code need to be solved with the exact parameter. The insep and outsep should define the input and output separator and must be ba... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Another way to accomplish this
```
#!/usr/bin/env python
code_dict = {
'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-',
'L': '.-..', 'M': '--', 'N': '-.',
'O': '---', 'P': '.--.', 'Q': '--.-',
'R': '.-.', '... | Hrm... Maybe something like this assuming the input/output separator.
```
#!/usr/bin/env python
code_dict = {
'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-',
'L': '.-..', 'M': '--', 'N': '-.',
'O': '---', 'P':... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Here's one approach using (generator) comprehension and `dict.get`; I am not sure what `insep` and `outsep` are supposed to mean.
```py
def encode(text, code_table):
return ''.join(code_table.get(c.upper(), c) for c in text)
# output: ......-...-..--- .-----.-..-..-..
```
Note that `code_table.get(..., c)` retu... | Hrm... Maybe something like this assuming the input/output separator.
```
#!/usr/bin/env python
code_dict = {
'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-',
'L': '.-..', 'M': '--', 'N': '-.',
'O': '---', 'P':... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Here's a simple way to do it. You can iterate over the hw string and check to see if each letter is a key in morse\_dict. I added the .upper() string method to account for the string containing a mix of upper and lowercase letters, while all the dict keys are uppercase.
```
morse_dict = {'A': '.-', 'B': '-...', 'C': '... | Ok ty already for the help, it was my first question here and I am pretty new to python and kinda struggle with easy things, but I will take notice for future. My biggest problem is that the code need to be solved with the exact parameter. The insep and outsep should define the input and output separator and must be ba... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Hrm... Maybe something like this assuming the input/output separator.
```
#!/usr/bin/env python
code_dict = {
'A': '.-', 'B': '-...',
'C': '-.-.', 'D': '-..', 'E': '.',
'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-',
'L': '.-..', 'M': '--', 'N': '-.',
'O': '---', 'P':... | Ok ty already for the help, it was my first question here and I am pretty new to python and kinda struggle with easy things, but I will take notice for future. My biggest problem is that the code need to be solved with the exact parameter. The insep and outsep should define the input and output separator and must be ba... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Here's one approach using (generator) comprehension and `dict.get`; I am not sure what `insep` and `outsep` are supposed to mean.
```py
def encode(text, code_table):
return ''.join(code_table.get(c.upper(), c) for c in text)
# output: ......-...-..--- .-----.-..-..-..
```
Note that `code_table.get(..., c)` retu... | Here's a simple way to do it. You can iterate over the hw string and check to see if each letter is a key in morse\_dict. I added the .upper() string method to account for the string containing a mix of upper and lowercase letters, while all the dict keys are uppercase.
```
morse_dict = {'A': '.-', 'B': '-...', 'C': '... |
70,933,424 | I'm working on matching last names between two tables. However, there are some variations that I have to take into account. For instance, I found that "Smith" in db1 can potentially have other forms in db2:
>
> Smith, Smith-Whatever, Smith Jr., Smith Sr., Smith III (any Roman numeral)
>
>
>
Lower/uppercase is als... | 2022/01/31 | [
"https://Stackoverflow.com/questions/70933424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971881/"
] | Here's one approach using (generator) comprehension and `dict.get`; I am not sure what `insep` and `outsep` are supposed to mean.
```py
def encode(text, code_table):
return ''.join(code_table.get(c.upper(), c) for c in text)
# output: ......-...-..--- .-----.-..-..-..
```
Note that `code_table.get(..., c)` retu... | You should try to explain in what way your code is not working. But, I suspect the problem is that your `return` statement is indented so that it is inside the `for` loop. This means that the function will return after processing the first character. You should unindent the `return` so that it will execute after the `f... |
52,275,076 | I need to check if the user is signing in for the first time, and initialize their account with extra properties (points, membership, etc) if true.
May user change his device and wants login again on another device.
I'm using google sign-in method. I tried something like this.
```
if(FirebaseAuth.getInstance().getCu... | 2018/09/11 | [
"https://Stackoverflow.com/questions/52275076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9972363/"
] | >
> How can I detect if user first time in Firebase?
>
>
>
If you want to check if the user logs in for the first time, it's the same thing if you check if a user is new. So to solve this, you can simply call AdditionalUserInfo's [isNewUser()](https://developers.google.com/android/reference/com/google/firebase/aut... | You can have `user node` in your database on which you can add `key` as `uuid` and value as its unique `uuid`, If your user comes for first time you will not get the `uuid` on the user node and hence you can add `uuid` there with initialization of your user in the database |
52,275,076 | I need to check if the user is signing in for the first time, and initialize their account with extra properties (points, membership, etc) if true.
May user change his device and wants login again on another device.
I'm using google sign-in method. I tried something like this.
```
if(FirebaseAuth.getInstance().getCu... | 2018/09/11 | [
"https://Stackoverflow.com/questions/52275076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9972363/"
] | >
> How can I detect if user first time in Firebase?
>
>
>
If you want to check if the user logs in for the first time, it's the same thing if you check if a user is new. So to solve this, you can simply call AdditionalUserInfo's [isNewUser()](https://developers.google.com/android/reference/com/google/firebase/aut... | Make a `isFirstTime = false` type of flag in database. When the app is installed first time set it to `true`. |
52,275,076 | I need to check if the user is signing in for the first time, and initialize their account with extra properties (points, membership, etc) if true.
May user change his device and wants login again on another device.
I'm using google sign-in method. I tried something like this.
```
if(FirebaseAuth.getInstance().getCu... | 2018/09/11 | [
"https://Stackoverflow.com/questions/52275076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9972363/"
] | >
> How can I detect if user first time in Firebase?
>
>
>
If you want to check if the user logs in for the first time, it's the same thing if you check if a user is new. So to solve this, you can simply call AdditionalUserInfo's [isNewUser()](https://developers.google.com/android/reference/com/google/firebase/aut... | Just to share my previous implementation on the new user issue.
I have used *Firebase Cloud Firestore* in my project, so I have created another table to store my users' basic info.
First, I create a method namely `createUser()` but basically, it checks whether it is a first time user by querying the Firebase Cloud ... |
241,103 | Just want to know what is the Limits and Boundaries of SharePoint Online for Bulk operations. Is there any authentic document I can refer? I am trying to insert 20,000 items with 5 text fields in a batch of 100. sometimes it throws Error "The Operation has timed out" I am using jquery + rest api to perform this bulk op... | 2018/05/03 | [
"https://sharepoint.stackexchange.com/questions/241103",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/42216/"
] | This does not give you the limits but maybe a solution for your problem.
The bulk limits for SharePoint 2013 is 100 items per operation so i guess it is around that number in Online aswell. [SharePoint 2013 Software boundaries](https://docs.microsoft.com/en-us/sharepoint/install/software-boundaries-and-limits)
[![ent... | Are you doing real bulk requests, or do you make a request per item?
If it is the later, try to schedule your requests and give SP some time. I don't think there are official hard numbers, since there are a lot of relevant factors that are not limited to the service for a timeout to occur.
Had the same problem with g... |
82,126 | I was helping a friend of mine with the following question from Knight's book and I was not able to answer part (**c**).
>
> 9. The two metal spheres in FIGURE Q30.9 are connected by a metal wire with a switch in the middle. Initially the switch is open. Sphere 1, with the larger radius, is given a positive charge. S... | 2013/10/25 | [
"https://physics.stackexchange.com/questions/82126",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/28535/"
] | The field strength is the force on a unit charge, so the field strength at the surface of sphere 1 is:
$$ F\_1 = \frac{1}{4\pi\epsilon\_0} \frac{Q\_1 . 1}{r\_1^2} $$
and the field strength at the surface of the second sphere is:
$$ F\_2 = \frac{1}{4\pi\epsilon\_0} \frac{Q\_2 . 1}{r\_2^2} $$
Lets take the ratio $F\_... | For physical interpretation, I understand you are confusing the field to be related to surface charge density only. But, At a sufficient distance from the sphere one can consider the charge to behave as point charge, hence when more charge is accunulated on 1st sphere, it corresponds to greater electric field.
Note :... |
82,126 | I was helping a friend of mine with the following question from Knight's book and I was not able to answer part (**c**).
>
> 9. The two metal spheres in FIGURE Q30.9 are connected by a metal wire with a switch in the middle. Initially the switch is open. Sphere 1, with the larger radius, is given a positive charge. S... | 2013/10/25 | [
"https://physics.stackexchange.com/questions/82126",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/28535/"
] | >
> I want to say that the surface charge density is greater for sphere 2
> than sphere 1 since sphere 1 is larger than sphere 2. But I am not
> sure
>
>
>
Don't forget that the surface area goes as the square of the radius. As you wrote:
$$ Q\_2 = Q\_1 (R\_2/R\_1)$$
but the surface area of sphere 2 is:
$$A\_... | For physical interpretation, I understand you are confusing the field to be related to surface charge density only. But, At a sufficient distance from the sphere one can consider the charge to behave as point charge, hence when more charge is accunulated on 1st sphere, it corresponds to greater electric field.
Note :... |
82,126 | I was helping a friend of mine with the following question from Knight's book and I was not able to answer part (**c**).
>
> 9. The two metal spheres in FIGURE Q30.9 are connected by a metal wire with a switch in the middle. Initially the switch is open. Sphere 1, with the larger radius, is given a positive charge. S... | 2013/10/25 | [
"https://physics.stackexchange.com/questions/82126",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/28535/"
] | The field strength is the force on a unit charge, so the field strength at the surface of sphere 1 is:
$$ F\_1 = \frac{1}{4\pi\epsilon\_0} \frac{Q\_1 . 1}{r\_1^2} $$
and the field strength at the surface of the second sphere is:
$$ F\_2 = \frac{1}{4\pi\epsilon\_0} \frac{Q\_2 . 1}{r\_2^2} $$
Lets take the ratio $F\_... | >
> I want to say that the surface charge density is greater for sphere 2
> than sphere 1 since sphere 1 is larger than sphere 2. But I am not
> sure
>
>
>
Don't forget that the surface area goes as the square of the radius. As you wrote:
$$ Q\_2 = Q\_1 (R\_2/R\_1)$$
but the surface area of sphere 2 is:
$$A\_... |
48,121,792 | I have this block of XML:
```
<Books>
<BookData id="BookID_100">
<Name>The Catcher and the Rye</Name>
<Description>This is a neat book that you might have had to read in school</Description>
<Date>1/1/1900</Date>
<IsHardcover>1</IsHardcover>
</BookData>
<BookData id="BookID_101">
<Name>Harry ... | 2018/01/05 | [
"https://Stackoverflow.com/questions/48121792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1513629/"
] | You will have to call `Element` method and pass the element name of which you want to get from the `XElement`:
```
IEnumerable<XElement> book =
from el in root.Elements("BookData")
where el.Attribute("id").Value == "BookID_100"
select el.Element("Name");
```
This will return you only the element `Name` of your... | Why are you getting a collection of book elements when you clearly only want the book with the specified ID? If you only want the one book you can just use `FirstOrDefault()`
Try this instead:
```
//This will return the first book matching: "BookID_100" or NULL
var book = root.Elements("BookData")
.... |
43,554,548 | I am trying to run multiple instances of a console-based game (dungeon crawl stone soup -- for research purposes naturally) using a multiprocessing pool to evaluate each run.
In the past when I've used a pool to evaluate similar code (genetic algorithms), I've used `subprocess.call` to split off each process. However... | 2017/04/22 | [
"https://Stackoverflow.com/questions/43554548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/74562/"
] | You can indeed associate stdin and stdout to files, as in the answer from @napuzba:
```
fout = open('stdout.txt','w')
ferr = open('stderr.txt','w')
subprocess.call(cmd, stdout=fout, stderr=ferr)
```
Another option would be to use [Popen](https://docs.python.org/2/library/subprocess.html#subprocess.Popen) instead of ... | Specify the standard input, standard output and standard error with unique file handles for each call:
```
import subprocess
cmd = ""
fout = open('stdout.txt','w')
fin = open('stdin.txt','r')
ferr = open('stderr.txt','w')
subprocess.call(cmd, stdout=fout , stdin = fin , stderr=ferr )
``` |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | View > Other Windows > Task Runner Explorer and click refresh
[](https://i.stack.imgur.com/1oOeG.png)
or just `Ctrl + Alt + Bkspace` | In your bash, go to the directory gulpfile.js is installed in and run:
```
npm install gulp
```
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself ... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | View > Other Windows > Task Runner Explorer and click refresh
[](https://i.stack.imgur.com/1oOeG.png)
or just `Ctrl + Alt + Bkspace` | Barryman9000's answer helped me on the right track. I started with an empty ASP.NET 5 project in VS2015 and had no package.json file at the project root. Running `npm install` gave me an error message about missing package.json. After adding that file with the default dependencies from another ASP.NET 5 project, the De... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | Well I solved the problem with several restarts of VS2015. Finally the task runner appeared for my gulpfile. I still have no idea why it did not appear from the start but it's a preview version so maybe something is not quite right yet. | In your bash, go to the directory gulpfile.js is installed in and run:
```
npm install gulp
```
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself ... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | Well I solved the problem with several restarts of VS2015. Finally the task runner appeared for my gulpfile. I still have no idea why it did not appear from the start but it's a preview version so maybe something is not quite right yet. | I had this same problem with VS2015 - TRX was showing "no tasks found" even though I had a valid, linted, gulpfile.js in the site root. I found the answer here: <http://www.roelvanlisdonk.nl/?p=4258>
Steps: Close VS. Open a cmd prompt from the site root and run `npm install`. Re-open VS and you should see your tasks i... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | Barryman9000's answer helped me on the right track. I started with an empty ASP.NET 5 project in VS2015 and had no package.json file at the project root. Running `npm install` gave me an error message about missing package.json. After adding that file with the default dependencies from another ASP.NET 5 project, the De... | In your bash, go to the directory gulpfile.js is installed in and run:
```
npm install gulp
```
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself ... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | The Preview version of VS2015 requires Gulp to be installed globally and has a few other issues with auto-discovery of the gulpfile.js. These issues will all be addressed by the time VS2015 ships. | Barryman9000's answer helped me on the right track. I started with an empty ASP.NET 5 project in VS2015 and had no package.json file at the project root. Running `npm install` gave me an error message about missing package.json. After adding that file with the default dependencies from another ASP.NET 5 project, the De... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | View > Other Windows > Task Runner Explorer and click refresh
[](https://i.stack.imgur.com/1oOeG.png)
or just `Ctrl + Alt + Bkspace` | Well I solved the problem with several restarts of VS2015. Finally the task runner appeared for my gulpfile. I still have no idea why it did not appear from the start but it's a preview version so maybe something is not quite right yet. |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | The Preview version of VS2015 requires Gulp to be installed globally and has a few other issues with auto-discovery of the gulpfile.js. These issues will all be addressed by the time VS2015 ships. | In your bash, go to the directory gulpfile.js is installed in and run:
```
npm install gulp
```
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself ... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | I had this same problem with VS2015 - TRX was showing "no tasks found" even though I had a valid, linted, gulpfile.js in the site root. I found the answer here: <http://www.roelvanlisdonk.nl/?p=4258>
Steps: Close VS. Open a cmd prompt from the site root and run `npm install`. Re-open VS and you should see your tasks i... | In your bash, go to the directory gulpfile.js is installed in and run:
```
npm install gulp
```
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself ... |
27,553,077 | I'm doing a fairly straightforward xyplot lattice graph, using both points and a line connecting them for clarity. However, in some of my panels, data is sparse and I don't want to connect the points. I want to be able to specify which panels should have a line. I've tried using par.settings and panel.superpose, but I ... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27553077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375368/"
] | View > Other Windows > Task Runner Explorer and click refresh
[](https://i.stack.imgur.com/1oOeG.png)
or just `Ctrl + Alt + Bkspace` | I had this same problem with VS2015 - TRX was showing "no tasks found" even though I had a valid, linted, gulpfile.js in the site root. I found the answer here: <http://www.roelvanlisdonk.nl/?p=4258>
Steps: Close VS. Open a cmd prompt from the site root and run `npm install`. Re-open VS and you should see your tasks i... |
7,171,816 | Its not working. I don't know regEx, but I need use it.
```
if ($('input[name="due_date"]').val().match("^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d$")) {
$('input[name="due_date"]').after("<span class='v_error'>Must fill</span>");
}
``` | 2011/08/24 | [
"https://Stackoverflow.com/questions/7171816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716371/"
] | ```
$('input[name="due_date"]').val().match.......
``` | You're trying to match with the HTML object, you might add .val() after the jQuery Selector, like
```
$('input[name="due_date"]').val().match(/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d$/);
``` |
7,171,816 | Its not working. I don't know regEx, but I need use it.
```
if ($('input[name="due_date"]').val().match("^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d$")) {
$('input[name="due_date"]').after("<span class='v_error'>Must fill</span>");
}
``` | 2011/08/24 | [
"https://Stackoverflow.com/questions/7171816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716371/"
] | ```
$('input[name="due_date"]').val().match.......
``` | A regex is surrounded with slashes. I just found that your regex is incorrect, too... So, coupled with the jQuery error pointed out by xdazz:
```
$('input[name="due_date"]').val().match(/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$/);
```
The regex is from [this website](http://www.regular-expres... |
7,171,816 | Its not working. I don't know regEx, but I need use it.
```
if ($('input[name="due_date"]').val().match("^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d$")) {
$('input[name="due_date"]').after("<span class='v_error'>Must fill</span>");
}
``` | 2011/08/24 | [
"https://Stackoverflow.com/questions/7171816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716371/"
] | A regex is surrounded with slashes. I just found that your regex is incorrect, too... So, coupled with the jQuery error pointed out by xdazz:
```
$('input[name="due_date"]').val().match(/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$/);
```
The regex is from [this website](http://www.regular-expres... | You're trying to match with the HTML object, you might add .val() after the jQuery Selector, like
```
$('input[name="due_date"]').val().match(/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d$/);
``` |
65,340,659 | Where can I find a list of the strings that represent all available kernels for GridSearchCV from sklearn?
I have looked into the main doc page <https://scikit-earn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html> and wasn't able to find it.
For example: 'poly' (stands for Polynomial kernel), '... | 2020/12/17 | [
"https://Stackoverflow.com/questions/65340659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2573717/"
] | GridSearchCV has nothing to to with kernels.
`kernel` is a parameter of your estimator (e.g. sklearn.svm.SVC can use a kernel).
GridSearchCV just gives you the option to try different combinations of parameters for your estimator.
Long story short: you have to look at the estimator you use, eg. for sklearn.svm.SVC:
... | here is the list of kernels
```
['linear', 'poly', 'rbf', 'sigmoid']
```
you can check more detail in [this link](https://www.vebuso.com/2020/03/svm-hyperparameter-tuning-using-gridsearchcv/) |
7,555,052 | I have a (somewhat long) single page website that uses some CSS (e.g. each content item is a div) I would like to move this to a "set of separate pages" which are navigable by means of a menu.
so instead of
```
<head>...</head>
<body>
<div>stuff</div>
<div>more stuff</div>
<div>even more stuff</div>
</body>
`... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7555052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/936887/"
] | A lot will depend on the context and what it is you're actually presenting, but if you're looking to break up the content, sometimes a tabbed interface is an acceptable solution. jQuery UI has some [Tab functionality](http://jqueryui.com/demos/tabs/) built in, and there are other plug-ins to accomplish similar function... | There are several options depending on the result that you want to achieve.
Separating a long page into several pages is your standard method.
Another method is to show/hide the sections with some javascript. This will make the page look nicer (e.g. less long).
Another method would be to load in the content via some... |
7,555,052 | I have a (somewhat long) single page website that uses some CSS (e.g. each content item is a div) I would like to move this to a "set of separate pages" which are navigable by means of a menu.
so instead of
```
<head>...</head>
<body>
<div>stuff</div>
<div>more stuff</div>
<div>even more stuff</div>
</body>
`... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7555052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/936887/"
] | A lot will depend on the context and what it is you're actually presenting, but if you're looking to break up the content, sometimes a tabbed interface is an acceptable solution. jQuery UI has some [Tab functionality](http://jqueryui.com/demos/tabs/) built in, and there are other plug-ins to accomplish similar function... | Something like this should work in jQuery. I don't know of a way to get the same result with pure CSS.
```
$(document).ready(function() {
// get the hash (the part after the '#') from the URL
var hstr = window.location.hash.slice(1);
if (hstr && $("#"+hstr).length)
// 'hstr' is exactly the ID of th... |
7,555,052 | I have a (somewhat long) single page website that uses some CSS (e.g. each content item is a div) I would like to move this to a "set of separate pages" which are navigable by means of a menu.
so instead of
```
<head>...</head>
<body>
<div>stuff</div>
<div>more stuff</div>
<div>even more stuff</div>
</body>
`... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7555052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/936887/"
] | This should get you started:
```
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function () {
var menu = $("<ul>").prependTo($("body"))
$("body > div").each(function () {
var div = this
... | A lot will depend on the context and what it is you're actually presenting, but if you're looking to break up the content, sometimes a tabbed interface is an acceptable solution. jQuery UI has some [Tab functionality](http://jqueryui.com/demos/tabs/) built in, and there are other plug-ins to accomplish similar function... |
7,555,052 | I have a (somewhat long) single page website that uses some CSS (e.g. each content item is a div) I would like to move this to a "set of separate pages" which are navigable by means of a menu.
so instead of
```
<head>...</head>
<body>
<div>stuff</div>
<div>more stuff</div>
<div>even more stuff</div>
</body>
`... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7555052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/936887/"
] | This should get you started:
```
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function () {
var menu = $("<ul>").prependTo($("body"))
$("body > div").each(function () {
var div = this
... | There are several options depending on the result that you want to achieve.
Separating a long page into several pages is your standard method.
Another method is to show/hide the sections with some javascript. This will make the page look nicer (e.g. less long).
Another method would be to load in the content via some... |
7,555,052 | I have a (somewhat long) single page website that uses some CSS (e.g. each content item is a div) I would like to move this to a "set of separate pages" which are navigable by means of a menu.
so instead of
```
<head>...</head>
<body>
<div>stuff</div>
<div>more stuff</div>
<div>even more stuff</div>
</body>
`... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7555052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/936887/"
] | This should get you started:
```
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function () {
var menu = $("<ul>").prependTo($("body"))
$("body > div").each(function () {
var div = this
... | Something like this should work in jQuery. I don't know of a way to get the same result with pure CSS.
```
$(document).ready(function() {
// get the hash (the part after the '#') from the URL
var hstr = window.location.hash.slice(1);
if (hstr && $("#"+hstr).length)
// 'hstr' is exactly the ID of th... |
13,200,136 | I'm using node-csv-parser (<http://www.adaltas.com/projects/node-csv/from.html>) in order to parse a CSV file uploaded to a node+express instance.
When an error ocurrs into the 'record' event I want to stop the file parsing and return the error to the client, but the 'error' event is called several times (for each reco... | 2012/11/02 | [
"https://Stackoverflow.com/questions/13200136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1698640/"
] | ```
$(window).bind( 'orientationchange', function(e){
var ori = window.orientation,
width = (ori==90 || ori==-90) ? screen.height : screen.width;
});
``` | If you are using the meta tag viewport you could also update that tag (with jquery example:)
```
function adapt_to_orientation() {
var ori = window.orientation;
var screenwidth = (ori==90 || ori==-90) ? screen.height : screen.width;
var screenheight = (ori==90 || ori==-90) ? screen.widt... |
13,200,136 | I'm using node-csv-parser (<http://www.adaltas.com/projects/node-csv/from.html>) in order to parse a CSV file uploaded to a node+express instance.
When an error ocurrs into the 'record' event I want to stop the file parsing and return the error to the client, but the 'error' event is called several times (for each reco... | 2012/11/02 | [
"https://Stackoverflow.com/questions/13200136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1698640/"
] | ```
$(window).bind( 'orientationchange', function(e){
var ori = window.orientation,
width = (ori==90 || ori==-90) ? screen.height : screen.width;
});
``` | Also you can use `screen.availWidth`. It gets changed with orientation. |
13,200,136 | I'm using node-csv-parser (<http://www.adaltas.com/projects/node-csv/from.html>) in order to parse a CSV file uploaded to a node+express instance.
When an error ocurrs into the 'record' event I want to stop the file parsing and return the error to the client, but the 'error' event is called several times (for each reco... | 2012/11/02 | [
"https://Stackoverflow.com/questions/13200136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1698640/"
] | ```
$(window).bind( 'orientationchange', function(e){
var ori = window.orientation,
width = (ori==90 || ori==-90) ? screen.height : screen.width;
});
``` | Use **$(window).resize**, it runs after **orientationchange**
```
$(window).resize(function(){
//your logic
});
``` |
34,065,817 | Is it possible to initialize an object with a block as follows?
```
class Foo
attr_reader :bar,:baz
def initialize(bar,baz)
@bar, @baz = bar, baz
end
end
Foo.new do |bar, baz|
# some logic to be implemented
# @bar, @baz to be assigned
end
``` | 2015/12/03 | [
"https://Stackoverflow.com/questions/34065817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3657027/"
] | Of course, you can `yield` from within `initialize`, there's nothing special about it:
```
class Foo
attr_accessor :bar, :baz
def initialize
yield self
end
end
Foo.new do |f|
f.bar = 123
f.baz = 456
end
#=> <Foo:0x007fed8287b3c0 @bar=123, @baz=456>
```
You could also evaluate the block in the context ... | If the constructor's arguments are optional and the same attributes are writable, you can achieve something similar with [tap](https://ruby-doc.org/core-2.5.3/Object.html#method-i-tap). `tap` is especially nice when you need to set instance values that are not set by the constructor.
```
class Foo
attr_accessor :bar... |
6,826,362 | I used **scroll view** to display many controls.while designing it hides some controls. **I know it is must,** but it leads to problem, becoz **scroll bar is not working at design time.** how can i see all the control at design time? or how can i scroll down? | 2011/07/26 | [
"https://Stackoverflow.com/questions/6826362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617302/"
] | create your own custom preview, go to Graphical Layout> editing config: select Custom Screen, then create new screen preview according to your maximum size | >
> Scrollbar cannot visible in graphical layout but yet want to see layout then
> please change your screen size from graphical layout top bar and if you cannot
> see graphical layout then choose maximum api level in graphical layout.
>
>
> |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Another alternatve would be to convert them into `int`s (i.e. 0 and 1) and use `switch` statement to identify all the scenarios, e.g.:
```
public static void main(String[] args) throws Exception{
boolean white = true, tall = false;
StringBuilder result = new StringBuilder();
result.append(white ? 1 : 0);
... | This is an often seen pattern where properties define different cases, by some business logic (founded in the real world).
That kind of control flow is hard to test, to verify, to track bugs from.
The best way is to make it more or less a declarative list.
Maybe remotely something like:
```
{ false, false, (isWhite,... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Your second solution is more readable. But you should use if-else instead of just if-statements. Consider if the first case is already true. The other 3 if statements still will be computed. If you use if-else statements and the first case is true, the other 3 statements will be just skipped.
```
if (isWhite && isTall... | I would prefer the first if/else arrangement unless you can use an `enum` Say your booleans were `a` and `b`
```
enum Combination {
A_B, NA_B, A_NB, NA_NB;
}
```
where NA\_NB is not A, not B.
```
switch(comb) {
case A_B:
//
break;
// more cases
case NA_NB:
//
break;
... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Another alternatve would be to convert them into `int`s (i.e. 0 and 1) and use `switch` statement to identify all the scenarios, e.g.:
```
public static void main(String[] args) throws Exception{
boolean white = true, tall = false;
StringBuilder result = new StringBuilder();
result.append(white ? 1 : 0);
... | Yet another possibility is to calculate your caseNumber directly from the booleans :
```
int caseNumber = 1 + (isWhite ? 0 : 2) + (isTall ? 0 : 1);
```
Here's an [example](http://ideone.com/4uayBJ) :
```
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static void main (String[] ... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Your second solution is more readable. But you should use if-else instead of just if-statements. Consider if the first case is already true. The other 3 if statements still will be computed. If you use if-else statements and the first case is true, the other 3 statements will be just skipped.
```
if (isWhite && isTall... | This is an often seen pattern where properties define different cases, by some business logic (founded in the real world).
That kind of control flow is hard to test, to verify, to track bugs from.
The best way is to make it more or less a declarative list.
Maybe remotely something like:
```
{ false, false, (isWhite,... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | I would prefer the first if/else arrangement unless you can use an `enum` Say your booleans were `a` and `b`
```
enum Combination {
A_B, NA_B, A_NB, NA_NB;
}
```
where NA\_NB is not A, not B.
```
switch(comb) {
case A_B:
//
break;
// more cases
case NA_NB:
//
break;
... | Yet another possibility is to calculate your caseNumber directly from the booleans :
```
int caseNumber = 1 + (isWhite ? 0 : 2) + (isTall ? 0 : 1);
```
Here's an [example](http://ideone.com/4uayBJ) :
```
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static void main (String[] ... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | I would prefer the first if/else arrangement unless you can use an `enum` Say your booleans were `a` and `b`
```
enum Combination {
A_B, NA_B, A_NB, NA_NB;
}
```
where NA\_NB is not A, not B.
```
switch(comb) {
case A_B:
//
break;
// more cases
case NA_NB:
//
break;
... | How about this? Similar to the previous answers, but I use `else if` to shorten my code when handling the two instances in which the booleans don't have the same value.
```
if(isWhite && isTall){/**case 1*/}
else if(isWhite){/**case 2*/} // only need one boolean
else if(isTall){/**case 3*/} // on each o... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Your second solution is more readable. But you should use if-else instead of just if-statements. Consider if the first case is already true. The other 3 if statements still will be computed. If you use if-else statements and the first case is true, the other 3 statements will be just skipped.
```
if (isWhite && isTall... | Yet another possibility is to calculate your caseNumber directly from the booleans :
```
int caseNumber = 1 + (isWhite ? 0 : 2) + (isTall ? 0 : 1);
```
Here's an [example](http://ideone.com/4uayBJ) :
```
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static void main (String[] ... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | I would prefer the first if/else arrangement unless you can use an `enum` Say your booleans were `a` and `b`
```
enum Combination {
A_B, NA_B, A_NB, NA_NB;
}
```
where NA\_NB is not A, not B.
```
switch(comb) {
case A_B:
//
break;
// more cases
case NA_NB:
//
break;
... | This is an often seen pattern where properties define different cases, by some business logic (founded in the real world).
That kind of control flow is hard to test, to verify, to track bugs from.
The best way is to make it more or less a declarative list.
Maybe remotely something like:
```
{ false, false, (isWhite,... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Your second solution is more readable. But you should use if-else instead of just if-statements. Consider if the first case is already true. The other 3 if statements still will be computed. If you use if-else statements and the first case is true, the other 3 statements will be just skipped.
```
if (isWhite && isTall... | How about this? Similar to the previous answers, but I use `else if` to shorten my code when handling the two instances in which the booleans don't have the same value.
```
if(isWhite && isTall){/**case 1*/}
else if(isWhite){/**case 2*/} // only need one boolean
else if(isTall){/**case 3*/} // on each o... |
41,531,686 | I am using vertical progress bar which works fine on desktop but I want to change back to horizontal on mobile which is also working fine by removing "progress-bar-vertical" class from below div only on mobile.
```
<div class="progress progress-bar-vertical">
<div class="progress-bar progress-bar-striped active" ro... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41531686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6455405/"
] | Your second solution is more readable. But you should use if-else instead of just if-statements. Consider if the first case is already true. The other 3 if statements still will be computed. If you use if-else statements and the first case is true, the other 3 statements will be just skipped.
```
if (isWhite && isTall... | Another alternatve would be to convert them into `int`s (i.e. 0 and 1) and use `switch` statement to identify all the scenarios, e.g.:
```
public static void main(String[] args) throws Exception{
boolean white = true, tall = false;
StringBuilder result = new StringBuilder();
result.append(white ? 1 : 0);
... |
44,206,714 | I have a dataset like this:
```
id_1 <- c(1, 1, 1)
id_2 <- c(2, NA, NA)
day <- c("Mon", "Mon", "Mon")
month <- c("May", NA, "May")
year <- c("2017", NA, NA)
df <- cbind(id_1, id_2, day, month, year)
```
These rows are duplicate observations in my data. I would like to keep only the most complete row (i.e. row 1). M... | 2017/05/26 | [
"https://Stackoverflow.com/questions/44206714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8070631/"
] | If `id_1` is an identifier for each "subject", then you could do this:
```
library(tidyverse)
df %>%
group_by(id_1) %>%
filter(rowSums(is.na(.)) == min(rowSums(is.na(.))))
```
Do you have situations where there are two rows with the same number of missing values, but different values are missing in each row? I... | eipi10's solution certainly looks neater but this one is base R.
```
df[ apply(df, 1, function(x) length(na.omit(x))) ==
max( apply(df, 1, function(x) length(na.omit(x))) )
, ]
#----------------
id_1 id_2 day month year
"1" "2" "Mon" "May" "2017"
```
You didn't say that this ... |
44,206,714 | I have a dataset like this:
```
id_1 <- c(1, 1, 1)
id_2 <- c(2, NA, NA)
day <- c("Mon", "Mon", "Mon")
month <- c("May", NA, "May")
year <- c("2017", NA, NA)
df <- cbind(id_1, id_2, day, month, year)
```
These rows are duplicate observations in my data. I would like to keep only the most complete row (i.e. row 1). M... | 2017/05/26 | [
"https://Stackoverflow.com/questions/44206714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8070631/"
] | If `id_1` is an identifier for each "subject", then you could do this:
```
library(tidyverse)
df %>%
group_by(id_1) %>%
filter(rowSums(is.na(.)) == min(rowSums(is.na(.))))
```
Do you have situations where there are two rows with the same number of missing values, but different values are missing in each row? I... | If the initial dataset is a `data.frame`, we can also try with `Reduce` in `data.table`
```
library(data.table)
setDT(df)[, .SD[which.min(Reduce(`+`, lapply(.SD, is.na)))], id_1]
# id_1 id_2 day month year
#1: 1 2 Mon May 2017
```
### data
```
df <- data.frame(id_1, id_2, day, month, year, stringsAsFactor... |
44,206,714 | I have a dataset like this:
```
id_1 <- c(1, 1, 1)
id_2 <- c(2, NA, NA)
day <- c("Mon", "Mon", "Mon")
month <- c("May", NA, "May")
year <- c("2017", NA, NA)
df <- cbind(id_1, id_2, day, month, year)
```
These rows are duplicate observations in my data. I would like to keep only the most complete row (i.e. row 1). M... | 2017/05/26 | [
"https://Stackoverflow.com/questions/44206714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8070631/"
] | eipi10's solution certainly looks neater but this one is base R.
```
df[ apply(df, 1, function(x) length(na.omit(x))) ==
max( apply(df, 1, function(x) length(na.omit(x))) )
, ]
#----------------
id_1 id_2 day month year
"1" "2" "Mon" "May" "2017"
```
You didn't say that this ... | If the initial dataset is a `data.frame`, we can also try with `Reduce` in `data.table`
```
library(data.table)
setDT(df)[, .SD[which.min(Reduce(`+`, lapply(.SD, is.na)))], id_1]
# id_1 id_2 day month year
#1: 1 2 Mon May 2017
```
### data
```
df <- data.frame(id_1, id_2, day, month, year, stringsAsFactor... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | The content of the table will be constant. Easily checked with this code.
```
#include<stdio.h>
typedef int table_t[3];
void doSomething(const table_t t)
{
t++; //No error, it's a non-const pointer.
t[1]=3; //Error, it's a pointer to const.
}
int main()
{
table_t t={1,2,3};
printf("%d %d %d %ld",... | The standard 6.7.6.3 says:
>
> A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’
>
>
>
Meaning that when you declare a function parameter as a `const int` array type, it decays into a pointer to `const int` (first element in array). Equivalent to `const int*` in ... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | The content of the table will be constant. Easily checked with this code.
```
#include<stdio.h>
typedef int table_t[3];
void doSomething(const table_t t)
{
t++; //No error, it's a non-const pointer.
t[1]=3; //Error, it's a pointer to const.
}
int main()
{
table_t t={1,2,3};
printf("%d %d %d %ld",... | >
> The merit of the first construction is that it enforces N as the size of the table.
>
>
>
I'm not sure what you mean here. In what contexts would it "enforce" it? If you declare a function as
```
int doSomething(table_t t);
```
array size will *not* be enforced. I order to enforce the size, you'd have to go... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | The content of the table will be constant. Easily checked with this code.
```
#include<stdio.h>
typedef int table_t[3];
void doSomething(const table_t t)
{
t++; //No error, it's a non-const pointer.
t[1]=3; //Error, it's a pointer to const.
}
int main()
{
table_t t={1,2,3};
printf("%d %d %d %ld",... | Array types and pointer types are not 100% equivalent, even in this context where you do ultimately get *a* pointer type for the function parameter. Your mistake is in assuming that `const` would have acted the same way if it *were* a pointer type.
To expand on ARBY's example:
```
typedef int table_t[3];
typedef int ... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | First, you are mistaken, the function prototypes
```
int doSomething(table_t t);
int doSomething(int* t);
```
are exactly equivalent. For function parameters, the first array dimension is always rewritten as a pointer. So there is no guarantee for the size of the array that is received.
`const`-qualification on arr... | The standard 6.7.6.3 says:
>
> A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’
>
>
>
Meaning that when you declare a function parameter as a `const int` array type, it decays into a pointer to `const int` (first element in array). Equivalent to `const int*` in ... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | First, you are mistaken, the function prototypes
```
int doSomething(table_t t);
int doSomething(int* t);
```
are exactly equivalent. For function parameters, the first array dimension is always rewritten as a pointer. So there is no guarantee for the size of the array that is received.
`const`-qualification on arr... | >
> The merit of the first construction is that it enforces N as the size of the table.
>
>
>
I'm not sure what you mean here. In what contexts would it "enforce" it? If you declare a function as
```
int doSomething(table_t t);
```
array size will *not* be enforced. I order to enforce the size, you'd have to go... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | First, you are mistaken, the function prototypes
```
int doSomething(table_t t);
int doSomething(int* t);
```
are exactly equivalent. For function parameters, the first array dimension is always rewritten as a pointer. So there is no guarantee for the size of the array that is received.
`const`-qualification on arr... | Array types and pointer types are not 100% equivalent, even in this context where you do ultimately get *a* pointer type for the function parameter. Your mistake is in assuming that `const` would have acted the same way if it *were* a pointer type.
To expand on ARBY's example:
```
typedef int table_t[3];
typedef int ... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | Array types and pointer types are not 100% equivalent, even in this context where you do ultimately get *a* pointer type for the function parameter. Your mistake is in assuming that `const` would have acted the same way if it *were* a pointer type.
To expand on ARBY's example:
```
typedef int table_t[3];
typedef int ... | The standard 6.7.6.3 says:
>
> A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’
>
>
>
Meaning that when you declare a function parameter as a `const int` array type, it decays into a pointer to `const int` (first element in array). Equivalent to `const int*` in ... |
31,108,968 | In C, it's possible to `typedef` an array, using this construction :
`typedef int table_t[N];`
Here, `table_t` is now defined as an array of N `int`. Any variable declared such as `table_t t;` will now behave as a normal array of `int`.
The point of such construction is to be used as an argument type in a function,... | 2015/06/29 | [
"https://Stackoverflow.com/questions/31108968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646947/"
] | Array types and pointer types are not 100% equivalent, even in this context where you do ultimately get *a* pointer type for the function parameter. Your mistake is in assuming that `const` would have acted the same way if it *were* a pointer type.
To expand on ARBY's example:
```
typedef int table_t[3];
typedef int ... | >
> The merit of the first construction is that it enforces N as the size of the table.
>
>
>
I'm not sure what you mean here. In what contexts would it "enforce" it? If you declare a function as
```
int doSomething(table_t t);
```
array size will *not* be enforced. I order to enforce the size, you'd have to go... |
22,454,004 | In Java project I use [Maven](https://maven.apache.org/) as a project manager.
To my project's pom.xml file I add the following dependency:
```
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.1.0-M01</version>
</dependency>
```
When I try to run the project... | 2014/03/17 | [
"https://Stackoverflow.com/questions/22454004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3095195/"
] | On Debian (probably other linux too) you should remove ~/~/.m2/repository folder and in Eclipse right-click on project Maven->Update Project... | In Eclipse work bench mode select the project and then click Alt+F5 to update Maven dependencies for the project.Please let me know if it resolves the issue |
495,794 | I would like to create a class that creates and manages log files. I would like the log file to be truncated when it exceeds a certain amount of text lines. Does any one have any recommendations on best practices to remove lines from the beginning of a text file. | 2009/01/30 | [
"https://Stackoverflow.com/questions/495794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54009/"
] | Unless this is for a class assignment, why not use available open-source alternatives? Log4net allows you to roll between a specified number of log files. | In short: Don't
The long version
When you reach the limit of lines, create a new log file, keep the previous log file, but remove the one before that.
You are now guarenteed to have at leat n lines of log file at any given time. |
495,794 | I would like to create a class that creates and manages log files. I would like the log file to be truncated when it exceeds a certain amount of text lines. Does any one have any recommendations on best practices to remove lines from the beginning of a text file. | 2009/01/30 | [
"https://Stackoverflow.com/questions/495794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54009/"
] | Unless this is for a class assignment, why not use available open-source alternatives? Log4net allows you to roll between a specified number of log files. | I created a simple Logfile class in C# at <http://www.blackbeltcoder.com/Articles/files/a-convenient-logfile-class>.
However, files are truncated at the end--not the start. So if you truncated the file, you'd keep the old data and lose the new data. That's probably not what you want.
I would recommend either deleting... |
22,428,494 | I am looking for a way to delete empty matrices within a multidimensional array in MATLAB.
For example, I have a 4-D array such as:
```
N = 5;
Arr = zeros(2,2,4,N);
```
Lets assume only N = 2 and N = 4 have values (i.e the four 2x2 matrices in N = 1, 3 and 5 are zeros), how can I create another multidimensional ar... | 2014/03/15 | [
"https://Stackoverflow.com/questions/22428494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2550888/"
] | Figured out quite a neat way to do it:
```
ArrFin = Arr(:,:,:,any(any(any(Arr,3))));
```
This picks out the non zero matrices and saves them into ArrFin. | **Code**
```
%%// Create data
Arr= rand(2,2,4,5);
Arr(:,:,:,[1 3 5]) = 0;
%%// Get new reduced matrix and check for its size
ArrFin = Arr(:,:,:,find(sum(reshape(sum(Arr,3),size(Arr,3),size(Arr,4)),1)));
size_check = size(ArrFin)
```
**Output**
```
size_check =
2 2 4 2
``` |
30,912,139 | I am working on a small app that should sign documents using digital signature and quit.
The signature can be in a PKCS#12 archive (.pfx file) or on a smartcard device.
Working with the pfx file is easy and working fine.
However, sometimes using the smartcard device, the process hangs on Windows 8 PCs.
The document ... | 2015/06/18 | [
"https://Stackoverflow.com/questions/30912139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342483/"
] | A simple `match` call that will identify the instances that match `df2$id` within `df1$id` (in the correct appearance order) will solve this problem
```
df1[match(df2$id, df1$id), ] <- df2
df1
# id V1 V2 V3
# 1 210 4 3 7
# 2 220 NA NA NA
# 3 230 2 0 1
# 4 240 4 3 NA
# 5 250 1 9 2
# 6 260 6 5 NA
# 7 270... | I had a matching syntax similar to @DavidArenburg with
```
df1[df1$id %in% df2$id, ] <- df2
```
Could it help to not have to create the extra data frame? If `df2` is being created to fill in `df1`, you can quickly assign `3` to the appropriate regions without creating a new dataframe.
```
indx <- apply(df1, 1, func... |
30,912,139 | I am working on a small app that should sign documents using digital signature and quit.
The signature can be in a PKCS#12 archive (.pfx file) or on a smartcard device.
Working with the pfx file is easy and working fine.
However, sometimes using the smartcard device, the process hangs on Windows 8 PCs.
The document ... | 2015/06/18 | [
"https://Stackoverflow.com/questions/30912139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342483/"
] | A simple `match` call that will identify the instances that match `df2$id` within `df1$id` (in the correct appearance order) will solve this problem
```
df1[match(df2$id, df1$id), ] <- df2
df1
# id V1 V2 V3
# 1 210 4 3 7
# 2 220 NA NA NA
# 3 230 2 0 1
# 4 240 4 3 NA
# 5 250 1 9 2
# 6 260 6 5 NA
# 7 270... | In case someone needs dataframes to match in several columns using the using df1[match(dfid, dfid), ] <- df2 solution, as was my case, I used this trick
```
df1$aux1<-paste(df1$id1,df1$id2)
df2$aux1<-paste(df2$id1,df2$id2)
df1[match(df2$aux1, df1$aux1), ] <- df2
df1 <- df1[ , names(df1)!="aux1"]
```
This i... |
30,912,139 | I am working on a small app that should sign documents using digital signature and quit.
The signature can be in a PKCS#12 archive (.pfx file) or on a smartcard device.
Working with the pfx file is easy and working fine.
However, sometimes using the smartcard device, the process hangs on Windows 8 PCs.
The document ... | 2015/06/18 | [
"https://Stackoverflow.com/questions/30912139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342483/"
] | I had a matching syntax similar to @DavidArenburg with
```
df1[df1$id %in% df2$id, ] <- df2
```
Could it help to not have to create the extra data frame? If `df2` is being created to fill in `df1`, you can quickly assign `3` to the appropriate regions without creating a new dataframe.
```
indx <- apply(df1, 1, func... | In case someone needs dataframes to match in several columns using the using df1[match(dfid, dfid), ] <- df2 solution, as was my case, I used this trick
```
df1$aux1<-paste(df1$id1,df1$id2)
df2$aux1<-paste(df2$id1,df2$id2)
df1[match(df2$aux1, df1$aux1), ] <- df2
df1 <- df1[ , names(df1)!="aux1"]
```
This i... |
16,417,986 | As a beginner in python, I was trying to test the function range() in the IDLE terminal.
I wrote in the terminal the below posted code and I expected to see result like this:
```
range(10)==>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```
But unfortunately, i do not get the expected result
Python Code I Tried:
```
range(10)
pr... | 2013/05/07 | [
"https://Stackoverflow.com/questions/16417986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2346661/"
] | In python 3, `range()` returns a generator, that's why it shows you the object rather than the values:
```
>>> print(range(10))
range(0, 10)
```
If you were expecting a list, you will need to convert it to one before printing it:
```
>>> print(list(range(10)))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```
Generators only cr... | Cross version solution
======================
```
C:\Documents and Settings\U009071\Desktop>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> print(list(range(10)))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | >
> What was the need of introducing such abstract concept in semi conductors?
>
>
>
Electrical physics and electrical engineering have been around much longer than knowledge of the electron has. For most things in electrical engineering, the circuits they design work *exactly the same* whether the charge-carrier ... | Yes, they are positive.The hole is the absence of electron(hole is not a particle but a vacancy) According to quantum mechanics anything that can have a wave function, a probability amplitude for being at different locations is a particle, so we assume that hole is a particle because it satisfies the definition of a pa... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | It is impossible to answer in terms of Bohr model. The important part of the concept which is out of the scope of the school approach is the degenerate electron gas. Below Fermi level all states at zero temperature are filled. If you take an electron out of this filled place you get a hole. Which behaves exactly as an ... | Yes, they are positive.The hole is the absence of electron(hole is not a particle but a vacancy) According to quantum mechanics anything that can have a wave function, a probability amplitude for being at different locations is a particle, so we assume that hole is a particle because it satisfies the definition of a pa... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | The notion of a particle in nonrelativistic quantum mechanics is very general: anything that can have a wavefunction, a probability amplitude for being at different locations, is a particle. In a metal, electrons and their associated elastic lattice deformation clouds travel as a particle. These effective electron-like... | >
> What was the need of introducing such abstract concept in semi conductors?
>
>
>
Electrical physics and electrical engineering have been around much longer than knowledge of the electron has. For most things in electrical engineering, the circuits they design work *exactly the same* whether the charge-carrier ... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | The notion of a particle in nonrelativistic quantum mechanics is very general: anything that can have a wavefunction, a probability amplitude for being at different locations, is a particle. In a metal, electrons and their associated elastic lattice deformation clouds travel as a particle. These effective electron-like... | Yes, they are positive.The hole is the absence of electron(hole is not a particle but a vacancy) According to quantum mechanics anything that can have a wave function, a probability amplitude for being at different locations is a particle, so we assume that hole is a particle because it satisfies the definition of a pa... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | It is impossible to answer in terms of Bohr model. The important part of the concept which is out of the scope of the school approach is the degenerate electron gas. Below Fermi level all states at zero temperature are filled. If you take an electron out of this filled place you get a hole. Which behaves exactly as an ... | When the elctron is free in outermost orbit that empty place is called is holes.. |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | The notion of a particle in nonrelativistic quantum mechanics is very general: anything that can have a wavefunction, a probability amplitude for being at different locations, is a particle. In a metal, electrons and their associated elastic lattice deformation clouds travel as a particle. These effective electron-like... | It is impossible to answer in terms of Bohr model. The important part of the concept which is out of the scope of the school approach is the degenerate electron gas. Below Fermi level all states at zero temperature are filled. If you take an electron out of this filled place you get a hole. Which behaves exactly as an ... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | >
> What was the need of introducing such abstract concept in semi conductors?
>
>
>
Electrical physics and electrical engineering have been around much longer than knowledge of the electron has. For most things in electrical engineering, the circuits they design work *exactly the same* whether the charge-carrier ... | When the elctron is free in outermost orbit that empty place is called is holes.. |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | The notion of a particle in nonrelativistic quantum mechanics is very general: anything that can have a wavefunction, a probability amplitude for being at different locations, is a particle. In a metal, electrons and their associated elastic lattice deformation clouds travel as a particle. These effective electron-like... | The convention is that current flows in an electrical circuit from positive to negative. This was decided before electrons were discovered and before they were discovered to be negatively charged.
You can identically consider the flow of electrical charge as either the movement of a negative electron from left to rig... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | The convention is that current flows in an electrical circuit from positive to negative. This was decided before electrons were discovered and before they were discovered to be negatively charged.
You can identically consider the flow of electrical charge as either the movement of a negative electron from left to rig... | Yes, they are positive.The hole is the absence of electron(hole is not a particle but a vacancy) According to quantum mechanics anything that can have a wave function, a probability amplitude for being at different locations is a particle, so we assume that hole is a particle because it satisfies the definition of a pa... |
15,640 | I'm tutoring senior high school students. So far I've explained them the concepts of atomic structure (Bohr's model & Quantum mechanical model) very clearly. Now the next topic to be taught is semiconductors.
I myself am not conviced with the concept of electron holes. If there is no electron then there is no electron... | 2011/10/12 | [
"https://physics.stackexchange.com/questions/15640",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/447/"
] | The notion of a particle in nonrelativistic quantum mechanics is very general: anything that can have a wavefunction, a probability amplitude for being at different locations, is a particle. In a metal, electrons and their associated elastic lattice deformation clouds travel as a particle. These effective electron-like... | When the elctron is free in outermost orbit that empty place is called is holes.. |
74,465 | The title says it all in signal switching applications - besides choosing a different device, how can I reduce the turn-off delay of (N-channel) MOSFETs? Is there something similar to the Baker Clamp used for BJTs? | 2013/06/29 | [
"https://electronics.stackexchange.com/questions/74465",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7685/"
] | There are a number of things you can do to speed up turn-off for a MOSFET.
1) Use a lower impedance gate driver that is capable of discharging the gate capacitance faster.
2) If you have a resistor in series from the gate driver to the gate try lowering the value of this resistance some.
3) If there is a resistor ... | Apart from what Michael Karas says there's no point in applying more gate voltage than what you need. This, in a roundabout way is what the baker clamp does to a BJT.
So, you find that to adequately turn the FET on you need (say) 5V but you apply 10V - 5 of those volts have to be "discharged" before the FET begins the... |
74,465 | The title says it all in signal switching applications - besides choosing a different device, how can I reduce the turn-off delay of (N-channel) MOSFETs? Is there something similar to the Baker Clamp used for BJTs? | 2013/06/29 | [
"https://electronics.stackexchange.com/questions/74465",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7685/"
] | A MOSFET gate and driver look something like this:

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fsg0DV.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
\$C\_G\$ is mostly the gate capacitance of the MOSFET ... | There are a number of things you can do to speed up turn-off for a MOSFET.
1) Use a lower impedance gate driver that is capable of discharging the gate capacitance faster.
2) If you have a resistor in series from the gate driver to the gate try lowering the value of this resistance some.
3) If there is a resistor ... |
74,465 | The title says it all in signal switching applications - besides choosing a different device, how can I reduce the turn-off delay of (N-channel) MOSFETs? Is there something similar to the Baker Clamp used for BJTs? | 2013/06/29 | [
"https://electronics.stackexchange.com/questions/74465",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7685/"
] | Not trying to compete with Phil's answer, because it is really good. But, a couple of things to think about.
You don't mention what kind of part you are using, but if you really need to reduce turn-off delay you might need to use a surface mount part. A part in a TO-220, for example will have built into the package 7... | There are a number of things you can do to speed up turn-off for a MOSFET.
1) Use a lower impedance gate driver that is capable of discharging the gate capacitance faster.
2) If you have a resistor in series from the gate driver to the gate try lowering the value of this resistance some.
3) If there is a resistor ... |
74,465 | The title says it all in signal switching applications - besides choosing a different device, how can I reduce the turn-off delay of (N-channel) MOSFETs? Is there something similar to the Baker Clamp used for BJTs? | 2013/06/29 | [
"https://electronics.stackexchange.com/questions/74465",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7685/"
] | A MOSFET gate and driver look something like this:

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fsg0DV.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
\$C\_G\$ is mostly the gate capacitance of the MOSFET ... | Apart from what Michael Karas says there's no point in applying more gate voltage than what you need. This, in a roundabout way is what the baker clamp does to a BJT.
So, you find that to adequately turn the FET on you need (say) 5V but you apply 10V - 5 of those volts have to be "discharged" before the FET begins the... |
74,465 | The title says it all in signal switching applications - besides choosing a different device, how can I reduce the turn-off delay of (N-channel) MOSFETs? Is there something similar to the Baker Clamp used for BJTs? | 2013/06/29 | [
"https://electronics.stackexchange.com/questions/74465",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7685/"
] | Not trying to compete with Phil's answer, because it is really good. But, a couple of things to think about.
You don't mention what kind of part you are using, but if you really need to reduce turn-off delay you might need to use a surface mount part. A part in a TO-220, for example will have built into the package 7... | Apart from what Michael Karas says there's no point in applying more gate voltage than what you need. This, in a roundabout way is what the baker clamp does to a BJT.
So, you find that to adequately turn the FET on you need (say) 5V but you apply 10V - 5 of those volts have to be "discharged" before the FET begins the... |
74,465 | The title says it all in signal switching applications - besides choosing a different device, how can I reduce the turn-off delay of (N-channel) MOSFETs? Is there something similar to the Baker Clamp used for BJTs? | 2013/06/29 | [
"https://electronics.stackexchange.com/questions/74465",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7685/"
] | A MOSFET gate and driver look something like this:

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fsg0DV.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
\$C\_G\$ is mostly the gate capacitance of the MOSFET ... | Not trying to compete with Phil's answer, because it is really good. But, a couple of things to think about.
You don't mention what kind of part you are using, but if you really need to reduce turn-off delay you might need to use a surface mount part. A part in a TO-220, for example will have built into the package 7... |
35,960,948 | Find regular expressions representing the following set:
1. The set of all strings over {a,b} in which the number of
occurrences of a is divided by 3.
2. The set of all strings over {0,1} beginning with 00 | 2016/03/12 | [
"https://Stackoverflow.com/questions/35960948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6054606/"
] | Remove the `has_one` declarations from your comment model. In this relationship, a comment will only ever have one user and one micropost, as denoted by `belongs_to`. Add has\_one is confusing it.
Simplifying it should remove your error.
```
# app/models/comment.rb
class Comment < ActiveRecord::Base
belongs_to :use... | From your code what i understand your comment model would be.
```
class Comment < ActiveRecord::Base
attr_accessible :id, :content, :user_id, :micropost_id
belongs_to :user
belongs_to :micropost
end
```
Then in your comments controller, which you access through the micropost\_comments\_path(@micropost) URL he... |
35,666,698 | if I want to tokenize a long list using DCG, what is the preferable methode between the two predicate below ;
**1- using ['terminal']**
```
some_terminals(T) -->
['this('],end(T),[')END'].
```
**2-using "terminal"**
```
some_terminals(T) -->
"this(",end(T),")END".
end(T)-->[T].
```
**Other question**
... | 2016/02/27 | [
"https://Stackoverflow.com/questions/35666698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5719394/"
] | It depends on what method will be available to read raw input.
The second one it's what is immediately useful after a read\_line, while the first requires a tokenizer.
But a tokenizer, at least a reusable one, should return instead these tokens.
```
some_terminals(T) -->
[this,'('],end(T),[')','END'].
```
Also... | In the first case you can use atom type and second case better for string type.If you do more functions then the first is the best.If there are handing with string type second is good.methods are depend on the specification.
Then `;` and `|` are functionally same both are used for `or` operation. but `list-->[a;b;c]`... |
571,356 | I want to have the right column not to be stretched by using `\vfill`. The source code I used is this.
```
\begin{multicols}{2}
\noindent
\begin{enumerate}
\item $ x^{2} - 7x + 10 = 0 $
\item $ 2x^{2} - 5x - 9 = 0 $
\item $ 7x^{2} + x - 1 = 0 $
\item $ x^{2} + 4x + 4 = 0 $
... | 2020/11/18 | [
"https://tex.stackexchange.com/questions/571356",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/229149/"
] | For growing down is your tree to wide. Try to make it grow to right, reduce font size and enable split long names into two lines:
```
\documentclass[12pt, letterpaper]{article}
\usepackage{fullpage}
\usepackage{tikz-qtree}
\usetikzlibrary{shapes.geometric}
\begin{document}
Paragraph paragraph paragraph
\begin{center... | [](https://i.stack.imgur.com/tHgzs.png)
```
\documentclass[border=10pt,tikz]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{fit}
\usetikzlibrary{shadows.blur}
\begin{document}
\begin{forest}
for tree={
grow... |
65,025,779 | I'm new to webdesign (and coding) and this afternoon I bumped into a problem I can't solve alone. I hope one of you could help me.
I want to create text elements that change to green when a user hovers over it with her mouse, and to red when the mouse goes out again. (Later, audio files will start to play when a mouse... | 2020/11/26 | [
"https://Stackoverflow.com/questions/65025779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14714581/"
] | You face a closure problem, title is not declared
```
window.onload = () => {
elements.forEach(element => {
title = document.getElementById(element.title);
//add event listeners
title.addEventListener("mouseover", handleMouseOver = () => {
mouseOver(title);
});
t... | I understand that you need to play audio files later, but that is an awful lot of work when you could probably just [solve the problem with CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/:hover). In general, you don't want to do with JavaScript what you can do with CSS. Save JavaScript for things you can't do wi... |
628,524 | How can I create or resize the swap memory on a linux device (Amazon Linux AMI). The problem came when I run a program and it gave me that errors:
```
IOError: [Errno 28] No space left on device
INFO (theano.gof.compilelock): Waiting for existing lock by unknown process (I am process '947')
INFO (theano.gof.compilel... | 2013/08/06 | [
"https://superuser.com/questions/628524",
"https://superuser.com",
"https://superuser.com/users/241903/"
] | I don't know if this will be the same for you but I tried this and it worked.
You can try to use a swap file :
1. Create a file that will be used as the swap file with count being equal to the desired block size (here the size is 64MB)
```
dd if=/dev/zero of=/swapfile bs=1024 count=65536
```
2. Enable the swap using... | Sorry I found the answer. What I had to do is that below to create the swap file:
```
dd if=/dev/zero of=/swapfile bs=1024 count=10930193
```
Then to enable it just do:
```
mkswap /swapfile
``` |
3,310,252 | Prove that $\dim L(F) + \dim \ker(L)=\dim(F+\ker(L))$ for every subspace $F$ and every linear transformation $L$ of finite dimensional vector space $V$.
Any idea would be appreciated. | 2019/08/01 | [
"https://math.stackexchange.com/questions/3310252",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/571193/"
] | To determine that two vectors are equal depends of the kind of vector you are working with. For example, in $\textsf{F}^n$, the set of all $ n $-tuples with entries in the field $F$, two vectors $(x\_1,x\_2,\dots,x\_n)$ and $(y\_1,y\_2,\dots,y\_n)$ are equal if and only if $x\_j=y\_j$ for all $j=1,2,\dots,n$. Similarly... | You're confusing equality and free families. If a family is free, then a linear combination of elements of the family is zero if and only if all the coefficients are zero. In the same vein, two vector which are linear combination of the elements of a free family are equal if and only if they have the same coefficients.... |
3,310,252 | Prove that $\dim L(F) + \dim \ker(L)=\dim(F+\ker(L))$ for every subspace $F$ and every linear transformation $L$ of finite dimensional vector space $V$.
Any idea would be appreciated. | 2019/08/01 | [
"https://math.stackexchange.com/questions/3310252",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/571193/"
] | To determine that two vectors are equal depends of the kind of vector you are working with. For example, in $\textsf{F}^n$, the set of all $ n $-tuples with entries in the field $F$, two vectors $(x\_1,x\_2,\dots,x\_n)$ and $(y\_1,y\_2,\dots,y\_n)$ are equal if and only if $x\_j=y\_j$ for all $j=1,2,\dots,n$. Similarly... | Equality of polynomials means they are equal for every $x$.
So, for example, if $ax^2 + bx = cx^2 - d$ then $a=c$ and $b=d=0$.
I think the best thing to do for vector spaces of polynomials (of degree $d$) is to forget the polynomials altogether and only think of the coefficients.
This way $1+2x-x^2$ is simply $(-1,2,1)... |
15,566,084 | I would like to get the average value of each day. For example, I would like to get 4 instead of getting 3 and 5 on "20130511". How can I do that on a single query? (Not hard code)
```
Select Val from Table 1 where??????????
```
**Table1 :**
```
Date Val
----------------
20130511 | 3
20130511 | 5
20130512 ... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15566084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2053558/"
] | You have to group the date
```
SELECT Date, AVG(Val) FROM TABLE GROUP BY Date
``` | You can group by date and do it in a single pass
```
SELECT DATE, SUM(VALUE)/COUNT(*) AS AVERAGE
FROM TABLE
GROUP BY DATE
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.