qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | As others have mentioned, here's an extract from [C: A Reference Manual](https://rads.stackoverflow.com/amzn/click/com/013089592X) by Harbison and Steele:
>
> Structures and unions cannot be compared for equality, even though assignment for these types is allowed. The gaps in structures and unions caused by alignment... | Comparison is unsupported for the same reason `memcmp` fails.
Due to padding fields the comparison would fail in unpredictable ways which would be unacceptable for most programmers. Assignment changes the invisible padding fields, but these are invisible anyway, so nothing unexpected there.
Obviously, you may ask: so... |
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | Comparison is unsupported for the same reason `memcmp` fails.
Due to padding fields the comparison would fail in unpredictable ways which would be unacceptable for most programmers. Assignment changes the invisible padding fields, but these are invisible anyway, so nothing unexpected there.
Obviously, you may ask: so... | To add to the existing good answers:
```
struct foo {
union {
uint32_t i;
float f;
} u;
} a, b;
a.u.f = -0.0;
b.u.f = 0.0;
if (a==b) // what to do?!
```
The problem arises inherently from unions not being able to store/track which member is current. |
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | As others have mentioned, here's an extract from [C: A Reference Manual](https://rads.stackoverflow.com/amzn/click/com/013089592X) by Harbison and Steele:
>
> Structures and unions cannot be compared for equality, even though assignment for these types is allowed. The gaps in structures and unions caused by alignment... | Auto-generate comparison operator is bad idea. Imagine how comparison would work for this structure:
```
struct s1 {
int len;
char str[100];
};
```
This is pascal like string with maximum length 100
Another case
```
struct s2 {
char a[100];
}
```
How can the compiler know how to compare a field? If this... |
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | Auto-generate comparison operator is bad idea. Imagine how comparison would work for this structure:
```
struct s1 {
int len;
char str[100];
};
```
This is pascal like string with maximum length 100
Another case
```
struct s2 {
char a[100];
}
```
How can the compiler know how to compare a field? If this... | To add to the existing good answers:
```
struct foo {
union {
uint32_t i;
float f;
} u;
} a, b;
a.u.f = -0.0;
b.u.f = 0.0;
if (a==b) // what to do?!
```
The problem arises inherently from unions not being able to store/track which member is current. |
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | As others have mentioned, here's an extract from [C: A Reference Manual](https://rads.stackoverflow.com/amzn/click/com/013089592X) by Harbison and Steele:
>
> Structures and unions cannot be compared for equality, even though assignment for these types is allowed. The gaps in structures and unions caused by alignment... | I found this in the C rationale ([C99 rationale V5.10](http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf)), 6.5.9:
>
> The C89 Committee considered, on more than one occasion, permitting comparison of structures
> for equality. Such proposals foundered on the problem of holes in structures. A byte-wis... |
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | As others have mentioned, here's an extract from [C: A Reference Manual](https://rads.stackoverflow.com/amzn/click/com/013089592X) by Harbison and Steele:
>
> Structures and unions cannot be compared for equality, even though assignment for these types is allowed. The gaps in structures and unions caused by alignment... | To add to the existing good answers:
```
struct foo {
union {
uint32_t i;
float f;
} u;
} a, b;
a.u.f = -0.0;
b.u.f = 0.0;
if (a==b) // what to do?!
```
The problem arises inherently from unions not being able to store/track which member is current. |
7,179,174 | As most C programmers know, you can't directly compare two structures.
Consider:
```
void isequal(MY_STRUCT a, MY_STRUCT b)
{
if (a == b)
{
puts("equal");
}
else
{
puts("not equal");
}
}
```
The `a==b` comparison will AFAIK throw a compile error on any sensible C compiler, b... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7179174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152962/"
] | I found this in the C rationale ([C99 rationale V5.10](http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf)), 6.5.9:
>
> The C89 Committee considered, on more than one occasion, permitting comparison of structures
> for equality. Such proposals foundered on the problem of holes in structures. A byte-wis... | To add to the existing good answers:
```
struct foo {
union {
uint32_t i;
float f;
} u;
} a, b;
a.u.f = -0.0;
b.u.f = 0.0;
if (a==b) // what to do?!
```
The problem arises inherently from unions not being able to store/track which member is current. |
36,647,703 | I would like to convert scalar tensor (`tf.constant([4])` for example) to python scalar (4) inside a computational graph so without use `tf.eval()`. | 2016/04/15 | [
"https://Stackoverflow.com/questions/36647703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4851438/"
] | Constant values are hardwired into the graph, so you can see it by inspecting graph definition.
IE
```
tf.reset_default_graph()
tf.constant(42)
print tf.get_default_graph().as_graph_def()
```
This gives you
```
node {
name: "Const"
op: "Const"
attr {
key: "dtype"
value {
type: DT_INT32
}
... | You can also use the Session.run() method.
```
In [1]: import tensorflow as tf
In [2]: sess = tf.InteractiveSession()
In [3]: x = tf.constant(4)
In [4]: sess.run(x)
Out[4]: 4
``` |
5,144,775 | I have the latest version of code in my website(Quite a few PHP files are modified). but the code that i have in my local host is bit older.
Are there any file-comparison applications to find the latest modified code? | 2011/02/28 | [
"https://Stackoverflow.com/questions/5144775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521710/"
] | Yes, It is [WinMerge](http://winmerge.org/) | You want `diff` to compare files, but more to the point, you should be using a version control system so you don't have these sorts of problems. |
5,144,775 | I have the latest version of code in my website(Quite a few PHP files are modified). but the code that i have in my local host is bit older.
Are there any file-comparison applications to find the latest modified code? | 2011/02/28 | [
"https://Stackoverflow.com/questions/5144775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521710/"
] | Yes, It is [WinMerge](http://winmerge.org/) | [ExamDiff](http://www.prestosoft.com/edp_examdiff.asp)... One .exe file that would solve your problem. |
5,144,775 | I have the latest version of code in my website(Quite a few PHP files are modified). but the code that i have in my local host is bit older.
Are there any file-comparison applications to find the latest modified code? | 2011/02/28 | [
"https://Stackoverflow.com/questions/5144775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521710/"
] | You want `diff` to compare files, but more to the point, you should be using a version control system so you don't have these sorts of problems. | [ExamDiff](http://www.prestosoft.com/edp_examdiff.asp)... One .exe file that would solve your problem. |
50,557,650 | I'm trying to achieve a layout that shows a view pager when the device is shown on portrait and show two panes when device is on landscape.
So I made two different layout files, one with only a ViewPager, the other with a LinearLayout and the other with two FrameLayouts, I don't think it is necessary to show them here... | 2018/05/28 | [
"https://Stackoverflow.com/questions/50557650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5288316/"
] | The solution I found is very simple, override `getPageWidth` in my pager adapter like this:
```
@Override
public float getPageWidth(int position) {
boolean hasTwoPanes = getResources().getBoolean(R.bool.hasTwoPanes);
return hasTwoPanes ? 0.5f : 1.0f;
}
```
`R.bool.hasTwoPanes` being a boolean resources avail... | Try this
Portrait Xml:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android... |
50,557,650 | I'm trying to achieve a layout that shows a view pager when the device is shown on portrait and show two panes when device is on landscape.
So I made two different layout files, one with only a ViewPager, the other with a LinearLayout and the other with two FrameLayouts, I don't think it is necessary to show them here... | 2018/05/28 | [
"https://Stackoverflow.com/questions/50557650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5288316/"
] | The solution I found is very simple, override `getPageWidth` in my pager adapter like this:
```
@Override
public float getPageWidth(int position) {
boolean hasTwoPanes = getResources().getBoolean(R.bool.hasTwoPanes);
return hasTwoPanes ? 0.5f : 1.0f;
}
```
`R.bool.hasTwoPanes` being a boolean resources avail... | Have you tried using PagerAdapter instead of FragmentPagerAdapter? You will get better control over creation and handling of fragments. Otherwise you dont know what is the FragmentPagerAdapter doing (hes doing it for you, but probably wrong).
You cam move much of that logic into that class making the activity cleaner,... |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | You should be able to attach a handler to the Bootstrap tab show event..
```
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
initialize();
});
```
Working demo: <http://bootply.com/102241>
----------------------------------------- | ```
$('#myTab a[href="#location"]').one('shown.bs.tab', function (e) {
initialize();
});
```
Use **.one()** instead of **.on()**. This will prevent from reloading map again and again ;) |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | You should be able to attach a handler to the Bootstrap tab show event..
```
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
initialize();
});
```
Working demo: <http://bootply.com/102241>
----------------------------------------- | ```
$('#myTab a[href="#location"]').on('shown.bs.tab', function (e) {
initialize();
});
``` |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | ```
$('#myTab a[href="#location"]').on('shown.bs.tab', function (e) {
initialize();
});
``` | This might be helpful, no JavaScript tricks needed.
```
.tab-content.tab-pane,
.tab-pane {
/* display: none; */
display: block;
visibility: hidden;
position: absolute;
}
.tab-content.active,
.tab-content .tab-pane.active,
.tab-pane.active {
/* display: block; */
visibility: visible;
positi... |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | You should be able to attach a handler to the Bootstrap tab show event..
```
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
initialize();
});
```
Working demo: <http://bootply.com/102241>
----------------------------------------- | I tried to make it to center on each tab click.. but seems need to initialize everytime ...
@MrUpsidown any other way we can center the actual location without initializing everytime?
**Possible solution ..**
<https://stackoverflow.com/a/25347742/3752338> |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | <http://bootply.com/102479>
Add an id to your map tab link so it's easier to identify. Trigger a map resize event when the corresponding tab content is shown.
This way the map is only initialized once, which is not the case with the previous answer.
Note that you need to define the map variable outside of the initia... | Bootstrap tabs (and carousels and modals) are initially set to display none, until they become active, so the parent element of your map has height / width of 0.
I had the same problem with Bootstrap3 as you. finally I ended up with the simple CSS solution.
```
.tab-content.tab-pane,
.tab-pane {
/* display: none;... |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | <http://bootply.com/102479>
Add an id to your map tab link so it's easier to identify. Trigger a map resize event when the corresponding tab content is shown.
This way the map is only initialized once, which is not the case with the previous answer.
Note that you need to define the map variable outside of the initia... | ```
$('#myTab a[href="#location"]').one('shown.bs.tab', function (e) {
initialize();
});
```
Use **.one()** instead of **.on()**. This will prevent from reloading map again and again ;) |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | ```
$('#myTab a[href="#location"]').on('shown.bs.tab', function (e) {
initialize();
});
``` | I tried to make it to center on each tab click.. but seems need to initialize everytime ...
@MrUpsidown any other way we can center the actual location without initializing everytime?
**Possible solution ..**
<https://stackoverflow.com/a/25347742/3752338> |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | <http://bootply.com/102479>
Add an id to your map tab link so it's easier to identify. Trigger a map resize event when the corresponding tab content is shown.
This way the map is only initialized once, which is not the case with the previous answer.
Note that you need to define the map variable outside of the initia... | This might be helpful, no JavaScript tricks needed.
```
.tab-content.tab-pane,
.tab-pane {
/* display: none; */
display: block;
visibility: hidden;
position: absolute;
}
.tab-content.active,
.tab-content .tab-pane.active,
.tab-pane.active {
/* display: block; */
visibility: visible;
positi... |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | ```
$('#myTab a[href="#location"]').on('shown.bs.tab', function (e) {
initialize();
});
``` | Bootstrap tabs (and carousels and modals) are initially set to display none, until they become active, so the parent element of your map has height / width of 0.
I had the same problem with Bootstrap3 as you. finally I ended up with the simple CSS solution.
```
.tab-content.tab-pane,
.tab-pane {
/* display: none;... |
20,746,711 | I am able to convert a bytestream to its JSON representation. This is a JSONArray. I would like it to be converted to `bb_test` objects in a Vector instead. How do I do that?
I used this example of json
<http://codeoncloud.blogspot.com/2013/05/blackberry-java-json-tutorial.html>
I am getting data from server like thi... | 2013/12/23 | [
"https://Stackoverflow.com/questions/20746711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648752/"
] | <http://bootply.com/102479>
Add an id to your map tab link so it's easier to identify. Trigger a map resize event when the corresponding tab content is shown.
This way the map is only initialized once, which is not the case with the previous answer.
Note that you need to define the map variable outside of the initia... | I tried to make it to center on each tab click.. but seems need to initialize everytime ...
@MrUpsidown any other way we can center the actual location without initializing everytime?
**Possible solution ..**
<https://stackoverflow.com/a/25347742/3752338> |
37,623,346 | I have stumbled upon this pure python implementation for calculating percentiles [here](https://stackoverflow.com/a/2753343/6421279) and [here](http://code.activestate.com/recipes/51):
```
import math
import functools
def percentile(N, percent, key=lambda x:x):
"""
Find the percentile of a list of values.
@parameter... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37623346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4685799/"
] | The answer is right there in the docstring (the string that starts on the line after the `def` statement):
```
@parameter key - optional key function to compute value from each element of N.
```
This allows you to use a list of something other than numbers. For example, your lambda could be `lambda x:x.getRelevantVa... | It's a tie-breaker in case `f` ever equals `c`. You haven't come across such a case, so your code never blows up (since `key` now doesn't exist). |
37,623,346 | I have stumbled upon this pure python implementation for calculating percentiles [here](https://stackoverflow.com/a/2753343/6421279) and [here](http://code.activestate.com/recipes/51):
```
import math
import functools
def percentile(N, percent, key=lambda x:x):
"""
Find the percentile of a list of values.
@parameter... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37623346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4685799/"
] | It's right there in the documentation of the function:
```
@parameter key - optional key function to compute value from each element of N.
```
Basically, the `percentile` function allows the user to *optionally* pass a key function which will be applied to the elements of N. Since it is optional, it has been given t... | It's a tie-breaker in case `f` ever equals `c`. You haven't come across such a case, so your code never blows up (since `key` now doesn't exist). |
37,623,346 | I have stumbled upon this pure python implementation for calculating percentiles [here](https://stackoverflow.com/a/2753343/6421279) and [here](http://code.activestate.com/recipes/51):
```
import math
import functools
def percentile(N, percent, key=lambda x:x):
"""
Find the percentile of a list of values.
@parameter... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37623346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4685799/"
] | The answer is right there in the docstring (the string that starts on the line after the `def` statement):
```
@parameter key - optional key function to compute value from each element of N.
```
This allows you to use a list of something other than numbers. For example, your lambda could be `lambda x:x.getRelevantVa... | It's right there in the documentation of the function:
```
@parameter key - optional key function to compute value from each element of N.
```
Basically, the `percentile` function allows the user to *optionally* pass a key function which will be applied to the elements of N. Since it is optional, it has been given t... |
35,697,513 | I'm trying to create an dictionary with names and points from a textfile called "score.txt".
The contents of the file is stuctured like this:
```
Anders Johansson 1
Karin Johansson 1
Anders Johansson 2
Eva Johansson 0
```
+ 2000 names and points in total
My method of getting the scores, calculating and finding the ... | 2016/02/29 | [
"https://Stackoverflow.com/questions/35697513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5996975/"
] | It already looks non too crazy, but I have a few suggestions:
* Naming [Python convention](https://www.python.org/dev/peps/pep-0008/) is descriptive names (scores instead of d).
* [File opening](http://www.pythonforbeginners.com/files/with-statement-in-python) is best done with the `with` stanza.
* You can iterate ove... | Small changes to your code. This will improve the performance a little .
**Code:**
```
from collections import defaultdict
datas ="""Anders Johansson 1
Karin Johansson 1
Anders Johansson 2
Eva Johansson 0""".split()
dic = defaultdict(int)
for i in range(0, len(f), 3):
name, value = ' '.join([datas[i], datas[i+... |
35,697,513 | I'm trying to create an dictionary with names and points from a textfile called "score.txt".
The contents of the file is stuctured like this:
```
Anders Johansson 1
Karin Johansson 1
Anders Johansson 2
Eva Johansson 0
```
+ 2000 names and points in total
My method of getting the scores, calculating and finding the ... | 2016/02/29 | [
"https://Stackoverflow.com/questions/35697513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5996975/"
] | It already looks non too crazy, but I have a few suggestions:
* Naming [Python convention](https://www.python.org/dev/peps/pep-0008/) is descriptive names (scores instead of d).
* [File opening](http://www.pythonforbeginners.com/files/with-statement-in-python) is best done with the `with` stanza.
* You can iterate ove... | The only semantic problem your code could present is that if you need to deal with [composite names](https://en.wikipedia.org/wiki/Spanish_naming_customs), e.g., *Pablo Ruiz Picasso*. In this case the program will break. Also, if your file is large, for improving the performance would be better to compute the high scor... |
65,812,597 | I'm doing a command where you need to confirm something with emojis.
I have a `wait_for("reaction_add")` with a check as a lambda function.
The following code I have is:
```
try:
reaction, user = await self.client.wait_for("reaction_add",
check=lambda react, usr: str(reaction.emoji) == "✅" and usr.id == ctx.a... | 2021/01/20 | [
"https://Stackoverflow.com/questions/65812597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13793359/"
] | ```py
try:
reaction, user = await self.client.wait_for("reaction_add",
check=lambda reaction, user: str(reaction.emoji) == "✅" and user.id == ctx.author.id, timeout=60)
print(reaction.emoji)
except asyncio.TimeoutError:
await confirm_msg.edit(content="This message has timed out!", embed=None)
``` | You can try this, without the lambda function:
```
@client.event
async def on_raw_reaction_add(payload):
reaction = str(payload.emoji)
if reaction == "✅" and usr.id == ctx.author.id:
print('do something')
else:
print('something else')
``` |
65,812,597 | I'm doing a command where you need to confirm something with emojis.
I have a `wait_for("reaction_add")` with a check as a lambda function.
The following code I have is:
```
try:
reaction, user = await self.client.wait_for("reaction_add",
check=lambda react, usr: str(reaction.emoji) == "✅" and usr.id == ctx.a... | 2021/01/20 | [
"https://Stackoverflow.com/questions/65812597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13793359/"
] | A **lambda** function is esentially the same as a normal function.
Your lambda:
```
lambda react, usr: str(reaction.emoji) == "✅" and usr.id == ctx.author.id
```
Would be equal to defining the following function:
```
# Here we are within the wait_for(reaction_add)
def f(react, usr):
return str(reaction.emoji) ... | You can try this, without the lambda function:
```
@client.event
async def on_raw_reaction_add(payload):
reaction = str(payload.emoji)
if reaction == "✅" and usr.id == ctx.author.id:
print('do something')
else:
print('something else')
``` |
48,308,839 | I was using LIquibase 3.2 and am trying to upgrade to 3.3 and I'm using MySql 5.5. However, upgrading is failing for the following types of change sets ...
```
<changeSet author="me" id="my_changeset">
<addColumn tableName="my_table">
<column name="STUFF_VISIBLE" type="BOOLEAN" defaultValueNumeric="0">
... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48308839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1235929/"
] | Don't use `preg_split()`, use `preg_match_all().`
```
preg_match_all('/\*\*(.*?)\*\*/', $termsNOMaString, $match, PREG_PATTERN_ORDER);
```
`$match[0]` will contain the full matches, `$match[1]` contains just the capture group, which is the matches without the surrounding `**`.
BTW, in your code, note that there's ... | You can use `preg_split` like this with a simple regex that matches `**` surrounded by whitespaces:
```
$str = '** All quoted material is subject to prior sale **
** All quotes are valid for 30 days **
** No manufacturer\'s warranty provided unless otherwise specified **';
print_r(preg_split('/\s*\*\*\s*/', $str, -1,... |
14,718,414 | I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt:
pyinstaller.py [opts] nameofscript.py
The prompt then tells me:
Error: PyInstaller for Python 2.6+ on windows needs pywin32.
Please install from <http://sourcefor... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14718414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2044837/"
] | Got it! Found this useful tutorial:
<http://bojan-komazec.blogspot.ca/2011/08/how-to-create-windows-executable-from.html>
The 3rd paragraph tells you the how to get around the problem. The link he points to is tricky though. You need to go here to get the pywin32 installer.
<http://sourceforge.net/projects/pywin32/f... | You should install pywin32 to the Python path first and then verify if it has succeeded by running this Python command:
```
import win32com
```
if there is no error, pywin32 is installed. |
14,718,414 | I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt:
pyinstaller.py [opts] nameofscript.py
The prompt then tells me:
Error: PyInstaller for Python 2.6+ on windows needs pywin32.
Please install from <http://sourcefor... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14718414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2044837/"
] | If you are using Python 2.7, the compat.py in the C:/Python27/Lib/site-packages/PyInstaller file need to be changed to:
```
if is_win:
try:
#from win32ctypes.pywin32 import pywintypes # noqa: F401
#from win32ctypes.pywin32 import win32api
import pywintypes
import win32api
except ImportError:
# Thi... | Got it! Found this useful tutorial:
<http://bojan-komazec.blogspot.ca/2011/08/how-to-create-windows-executable-from.html>
The 3rd paragraph tells you the how to get around the problem. The link he points to is tricky though. You need to go here to get the pywin32 installer.
<http://sourceforge.net/projects/pywin32/f... |
14,718,414 | I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt:
pyinstaller.py [opts] nameofscript.py
The prompt then tells me:
Error: PyInstaller for Python 2.6+ on windows needs pywin32.
Please install from <http://sourcefor... | 2013/02/05 | [
"https://Stackoverflow.com/questions/14718414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2044837/"
] | If you are using Python 2.7, the compat.py in the C:/Python27/Lib/site-packages/PyInstaller file need to be changed to:
```
if is_win:
try:
#from win32ctypes.pywin32 import pywintypes # noqa: F401
#from win32ctypes.pywin32 import win32api
import pywintypes
import win32api
except ImportError:
# Thi... | You should install pywin32 to the Python path first and then verify if it has succeeded by running this Python command:
```
import win32com
```
if there is no error, pywin32 is installed. |
8,782,665 | What is the most practical way of exchanging data between web sites (format, medium, protocol ...) ?
For example say an open-source online game has been designed such that each site where it's installed acts as a separate world. How would you go about transferring the profile of a character between two sites? | 2012/01/09 | [
"https://Stackoverflow.com/questions/8782665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225899/"
] | this is a generic question so it probably belongs somewhere else, regardless what you normally do is to provide an API for external non-human clients to communicate, the details of it are completely up to you but the current popular choice is to make a [RESTful API](https://en.wikipedia.org/wiki/Representational_State_... | open-API maybe the bast way. Because your website client is more and more.
And send each website a code.check the code in your online game and the request times every day. |
8,782,665 | What is the most practical way of exchanging data between web sites (format, medium, protocol ...) ?
For example say an open-source online game has been designed such that each site where it's installed acts as a separate world. How would you go about transferring the profile of a character between two sites? | 2012/01/09 | [
"https://Stackoverflow.com/questions/8782665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225899/"
] | this is a generic question so it probably belongs somewhere else, regardless what you normally do is to provide an API for external non-human clients to communicate, the details of it are completely up to you but the current popular choice is to make a [RESTful API](https://en.wikipedia.org/wiki/Representational_State_... | I think you can use web service to exchange data between web sites.In web world web service soap is global format which is understand by all web framwork like php,asp,dotnet and other web framworks |
8,782,665 | What is the most practical way of exchanging data between web sites (format, medium, protocol ...) ?
For example say an open-source online game has been designed such that each site where it's installed acts as a separate world. How would you go about transferring the profile of a character between two sites? | 2012/01/09 | [
"https://Stackoverflow.com/questions/8782665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225899/"
] | I think you can use web service to exchange data between web sites.In web world web service soap is global format which is understand by all web framwork like php,asp,dotnet and other web framworks | open-API maybe the bast way. Because your website client is more and more.
And send each website a code.check the code in your online game and the request times every day. |
28,254,857 | I'm trying to make an alphabetically sorted array of objects from a class that contains also another int variable, but I can't make work qsort function properly.
Here's my code:
```
#include <iostream>
#include <stdlib.h>
#include <string.h>
int cmp (char **str1 , char **str2 )
{
return strcmp(*str1,*str2);
}
cla... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28254857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4515210/"
] | First, your comparison function needs to be able to access the private member *text* of *myclass*.
You could either make *text* public or add
```
friend int cmp (const void *, const void*);
```
in the class definition.
Second, your comparison function is wrong. It takes pointers to the members of the array to be s... | Your comparison function is wrong. It receives a pointer to each array element, which is a pointer to `myclass`, not the `text`.You also shouldn't cast the function pointer when calling `qsort`, you should cast the arguments in the comparison function.
```
int cmp (void *a, void *b) {
myclass **c1 = (myclass **)a;... |
28,254,857 | I'm trying to make an alphabetically sorted array of objects from a class that contains also another int variable, but I can't make work qsort function properly.
Here's my code:
```
#include <iostream>
#include <stdlib.h>
#include <string.h>
int cmp (char **str1 , char **str2 )
{
return strcmp(*str1,*str2);
}
cla... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28254857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4515210/"
] | Right now, your code looks like a warped version of C code, with just enough C++ "sprinkled" in to keep it from working with a C compiler. At least IMO, this gives pretty much the worst of both worlds--it removes most of the best features of C, and the best features of C++. If you're going to write C++, write C++, not ... | Your comparison function is wrong. It receives a pointer to each array element, which is a pointer to `myclass`, not the `text`.You also shouldn't cast the function pointer when calling `qsort`, you should cast the arguments in the comparison function.
```
int cmp (void *a, void *b) {
myclass **c1 = (myclass **)a;... |
28,254,857 | I'm trying to make an alphabetically sorted array of objects from a class that contains also another int variable, but I can't make work qsort function properly.
Here's my code:
```
#include <iostream>
#include <stdlib.h>
#include <string.h>
int cmp (char **str1 , char **str2 )
{
return strcmp(*str1,*str2);
}
cla... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28254857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4515210/"
] | First, your comparison function needs to be able to access the private member *text* of *myclass*.
You could either make *text* public or add
```
friend int cmp (const void *, const void*);
```
in the class definition.
Second, your comparison function is wrong. It takes pointers to the members of the array to be s... | Right now, your code looks like a warped version of C code, with just enough C++ "sprinkled" in to keep it from working with a C compiler. At least IMO, this gives pretty much the worst of both worlds--it removes most of the best features of C, and the best features of C++. If you're going to write C++, write C++, not ... |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | First of all, I doubt anybody can give a definitive answer -- there's just no way to tell exactly how much any particular language is really used. Nearly anything you can measure is a secondary measurement, such as how many people are advertising jobs using that language. The problem is that this tends to show relative... | More often than not, we get lost in the hype cycle. First there was Java, then came PHP, and currently is Python. But the fact of the matter is development of general purpose desktop application still requires use of libraries like Carbon/Cocoa for mac, GTK/QT for Linux, MFC for Windows. All of which are C/C++ based. S... |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | If I take a look at the applications I have installed on the laptop I am writing this message on, I see a lot of C/C++ and few (if any) managed apps. Examples? Google Chrome, Firefox, iTunes, uTorrent, Spotify, Picasa, Google Earth, OpenOffice, Notepad++, IrfanView... this list goes on and on. I write desktop applicati... | Different languages are prevalent in different domains. It is interesting that you think it might be rendered unimportant by being *relegated* to embedded systems when in fact that is where most software development occurs; at least in terms of number of projects/products.
There are many ways of measuring, and a numbe... |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | C++ is still used everywhere you want the best performance. Its major advantage is that you can use literally for everything. In addition to what other people have said you can also use it to power websites, for instance [OkCupid](http://okcupid.com/faq) uses it almost exclusively.
As the recent Hip Hop of Facebook sh... | C++ is still very popular. For instance, combined with Qt it is often used. |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | C++ is still valuable for many high performance apps. There are other technologies, and depends on the situation different languages are better suited for your needs. But if you want strong performance, good control of what your code is doing, and flexible networking and programming stack, C++ is still a good choice.
... | C++ is still used everywhere you want the best performance. Its major advantage is that you can use literally for everything. In addition to what other people have said you can also use it to power websites, for instance [OkCupid](http://okcupid.com/faq) uses it almost exclusively.
As the recent Hip Hop of Facebook sh... |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | Different languages are prevalent in different domains. It is interesting that you think it might be rendered unimportant by being *relegated* to embedded systems when in fact that is where most software development occurs; at least in terms of number of projects/products.
There are many ways of measuring, and a numbe... | C++ is still very popular. For instance, combined with Qt it is often used. |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | "C++ effectively relegated to embedded systems, OS, Browser"
"other special purpose development"
You mean 99% of the code people run on a daily basis? | It hasn't gone away if you need to do something really, really fast. If "fast enough" is OK, then C# and Java are fine, but if you have a calculation that takes hours or days, or you need something to happen on the microsecond timescale (i.e. high frequency trading) C++ is still the language to use. |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | C++ is still heavily used in many mission critical financial applications. For example, most of Bloomberg's platforms are based on C++ with very little front end in other languages. Many investment banks and hedge funds use algorithmic trading systems written completely in C++ (e.g., Tower Research Capital, Knight Capi... | C++ is still very popular. For instance, combined with Qt it is often used. |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | First of all, I doubt anybody can give a definitive answer -- there's just no way to tell exactly how much any particular language is really used. Nearly anything you can measure is a secondary measurement, such as how many people are advertising jobs using that language. The problem is that this tends to show relative... | I'm not sure whether the gaming industry falls under "general purpose development", but if you want to develop anything that you intend to get working on more than a single console, C++ is what's for lunch. While many gaming and 3D libraries have extensions for other languages, they -all- have extensions for C/C++. |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | First of all, I doubt anybody can give a definitive answer -- there's just no way to tell exactly how much any particular language is really used. Nearly anything you can measure is a secondary measurement, such as how many people are advertising jobs using that language. The problem is that this tends to show relative... | If I take a look at the applications I have installed on the laptop I am writing this message on, I see a lot of C/C++ and few (if any) managed apps. Examples? Google Chrome, Firefox, iTunes, uTorrent, Spotify, Picasa, Google Earth, OpenOffice, Notepad++, IrfanView... this list goes on and on. I write desktop applicati... |
2,373,861 | >
> **Possible Duplicate:**
>
> [Which sector of software industry uses C++?](https://stackoverflow.com/questions/537595/which-sector-of-software-industry-uses-c)
>
>
>
C++ was for many years the holy grail of mission critical high performance development. However, it seems that for the past 10 years like much... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2373861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135952/"
] | "C++ effectively relegated to embedded systems, OS, Browser"
"other special purpose development"
You mean 99% of the code people run on a daily basis? | C++ is usually used for systems work, generally defined as software where the UI is not central, not application work -- where the UI *is* central. So, for general business use it's probably not very interesting and those problems are better solved with a higher level language. However, there will always be low level s... |
53,283,195 | I am trying to upload a file and well as take an input from the user in json format using Swagger UI. I have written the below code for the same.
```
upload_parser = api.parser()
upload_parser.add_argument('file', location='files',
type=FileStorage, required=True)
type = api.model("tax", {
"ta... | 2018/11/13 | [
"https://Stackoverflow.com/questions/53283195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8635591/"
] | I got the issue solved. Used reqparse for inputting the argument. See the code snippet as below
```
upload_parser = api.parser()
upload_parser.add_argument('file', location='files',
type=FileStorage, required=True)
parser = reqparse.RequestParser()
parser.add_argument('tax_form', required = True)
... | I recommend using list of models and parsers in api.expect with validate=True(if required). This will remove the dependency of defining the expected query parameter (in your case) in the class level as you may have GET/PUT/DELETE API on the same route which may not even need this parameter.
Have modified your code to ... |
682,256 | Streamlining the boot sequence for Windows 10 / Ubuntu 14 dual boot.
Ok. Ubuntu installed quite easily on my Windows 10 laptop despite the secure boot stuff. Evidently Microsoft signs Ubuntu loaders so that it is acceptable for their secure boot system. Whatever. It works.
Now I have a different problem. Firstly, I ... | 2015/10/06 | [
"https://askubuntu.com/questions/682256",
"https://askubuntu.com",
"https://askubuntu.com/users/279269/"
] | You may find solace in this [link from Microsoft Answers](http://answers.microsoft.com/en-us/windows/forum/windows_7-update/time-to-display-list-of-operating-systems/094d778f-90db-4b90-a28f-11f477c5e779). *I take no credit for this answer*:
I suggest you to boot the computer to WinRE from the elevated command prompt,... | Well, I fixed the issue rather easily.
Booting, pressed F2 to get into Bios. This used to be impossible in win 8 but for some reason in win 10 this is easy.
Under the BOOT tab, I simply selected "UbuntuWDC WD10JPVX-22JC310" and move it to position 3, above "Windows Boot Manager"
Now the boot sequence bypasses the ... |
60,594,144 | Requirement:
My pdf has 5 pages, I need to start the split on the second page and end at the last page, in a single pdf. Currently, I have made it so that it splits one pdf per page.
Current code:
```
public static boolean SepararFC(String sequence, String pathfrom, String pathto) {
try (PDDocument document = ... | 2020/03/09 | [
"https://Stackoverflow.com/questions/60594144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5728714/"
] | Since you don't want page 1, you can just remove it and save a new file
```
try (PDDocument document = PDDocument.load(new File(pathfrom))) {
//Listing the number of existing pages
int noOfPages= document.getNumberOfPages();
System.out.print(noOfPages);
//Removing the pages
document.removePage(0);
Syst... | Assuming your code is correct:
```
public static boolean SepararFC(String sequence, String pathfrom, String pathto) {
int start = 1;
int end = 4;
try (PDDocument document = PDDocument.load(new File(pathfrom))) {
Splitter splitter = new Splitter();
List<PDDocument> Pages = splitter.split(do... |
294,261 | I have class with a member function that takes a default argument.
```
struct Class
{
void member(int n = 0)
{}
};
```
By means of std::tr1::mem\_fn I can invoke it:
```
Class object;
std::tr1::mem_fn(&Class::member)(object,10);
```
That said, if I want to invoke the *callable* member on the object with ... | 2008/11/16 | [
"https://Stackoverflow.com/questions/294261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19630/"
] | Default functions are bound at call time, but can't be bound into any sort of wrapper implicitly, because of the way they are implemented. When you pass `&Class::member`, `mem_fn` only sees a `void (Class::*)(int)`, and can't see the default argument. Using `tr1::bind`, you can bind the default argument explictly: `std... | The reason is that any default arguments do not change the function type of a function.
`mem_fn` has no way to know the function only requires 1 argument, or that the functions' second argument is optional, since all the knowledge it gets is given to it by the type of `&Class::member` (which stays `void(Class::*)(int... |
45,140,226 | How would I handle the following kind of scenario using Cucumber Java with Selenium:
```
Scenario: Raise Invoice by User according to Raise Invoice Type.
When I select the Raise Invoice Type as "RaiseInvoiceType"
IF RaiseInvoiceType == 'ABC'
Method ABC()
else if RaiseInvoiceType == 'XYZ'
Method XYZ()... | 2017/07/17 | [
"https://Stackoverflow.com/questions/45140226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8287292/"
] | **Background**
Cucumber feature files are all about bridging the conversational gap between the business and the development team, and thus, code and conditional statements should never appear inside them.
**The Solution**
The solution to your problem is how you write the step definition.
Using Cucumber's Ruby impl... | The important thing here is the difference between the two invoice types. Each type is important to your business so I would create a step for each type e.g.
`When I raise an ABC invoice` and `When I raise an XYZ invoice`
When implementing the step definitions I might then think about using the same helper method to ... |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | Instead you can hide the scrolling from the body itself.
Try this
```
<style type="text/css">
body {
overflow:hidden;
}
</style>
``` | Try this
JS Code
```
$("body").css("overflow", "hidden");
```
Css Code
```
body {width:100%; height:100%; overflow:hidden, margin:0}
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | The reason your code only works in Chrome is that you are using `-webkit-scrollbar`. Chrome is built upon the (modified) webkit rendering engine, so this tag will only affect Chrome (and Safari, incidentally). Typically, the `-webkit-scrollbar` property is used to style scrollbars. To hide them, instead use the `overfl... | Instead you can hide the scrolling from the body itself.
Try this
```
<style type="text/css">
body {
overflow:hidden;
}
</style>
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | Instead you can hide the scrolling from the body itself.
Try this
```
<style type="text/css">
body {
overflow:hidden;
}
</style>
``` | ```
<style>
/* width */
::-webkit-scrollbar {
width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 0px transparent;
border-radius: 0px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 0px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hov... |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | The reason your code only works in Chrome is that you are using `-webkit-scrollbar`. Chrome is built upon the (modified) webkit rendering engine, so this tag will only affect Chrome (and Safari, incidentally). Typically, the `-webkit-scrollbar` property is used to style scrollbars. To hide them, instead use the `overfl... | Yo can try the code below:
```
$("body").css("overflow", "hidden");
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | The reason your code only works in Chrome is that you are using `-webkit-scrollbar`. Chrome is built upon the (modified) webkit rendering engine, so this tag will only affect Chrome (and Safari, incidentally). Typically, the `-webkit-scrollbar` property is used to style scrollbars. To hide them, instead use the `overfl... | Try this code:
```
$('body').css({
'overflow': 'hidden'
});
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | Try this
JS Code
```
$("body").css("overflow", "hidden");
```
Css Code
```
body {width:100%; height:100%; overflow:hidden, margin:0}
``` | Try this code:
```
$('body').css({
'overflow': 'hidden'
});
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | The reason your code only works in Chrome is that you are using `-webkit-scrollbar`. Chrome is built upon the (modified) webkit rendering engine, so this tag will only affect Chrome (and Safari, incidentally). Typically, the `-webkit-scrollbar` property is used to style scrollbars. To hide them, instead use the `overfl... | Try this
JS Code
```
$("body").css("overflow", "hidden");
```
Css Code
```
body {width:100%; height:100%; overflow:hidden, margin:0}
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | ```
<style>
/* width */
::-webkit-scrollbar {
width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 0px transparent;
border-radius: 0px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 0px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hov... | Try this code:
```
$('body').css({
'overflow': 'hidden'
});
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | Instead you can hide the scrolling from the body itself.
Try this
```
<style type="text/css">
body {
overflow:hidden;
}
</style>
``` | Try this code:
```
$('body').css({
'overflow': 'hidden'
});
``` |
32,565,304 | I want to hide the scroll bar by using Jquery. Can anyone help me with it?
```
$
::-webkit-scrollbar {
display: none;
}
```
This works for Chrome but I want my scroll to hide for all browsers, how can I do that? | 2015/09/14 | [
"https://Stackoverflow.com/questions/32565304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5176401/"
] | The reason your code only works in Chrome is that you are using `-webkit-scrollbar`. Chrome is built upon the (modified) webkit rendering engine, so this tag will only affect Chrome (and Safari, incidentally). Typically, the `-webkit-scrollbar` property is used to style scrollbars. To hide them, instead use the `overfl... | ```
<style>
/* width */
::-webkit-scrollbar {
width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 0px transparent;
border-radius: 0px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 0px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hov... |
2,578,858 | I have to find the limit : (let $k\in \mathbb{R}$)
>
> $$\lim\_{n\to \infty}n^k \left(\Big(1+\frac{1}{n+1}\Big)^{n+1}-\Big(1+\frac{1}{n}\Big)^n \right)=?$$
>
>
>
My Try :
$$\lim\_{n\to \infty}\frac{n^k}{\Big(1+\frac{1}{n}\Big)^n} \left(\frac{\Big(1+\frac{1}{n+1}\Big)^{n+1}}{\Big(1+\frac{1}{n}\Big)^n}-1\right)$$
... | 2017/12/24 | [
"https://math.stackexchange.com/questions/2578858",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/505955/"
] | $$\left(1+\frac{1}{n}\right)^n = \exp\left[n\log\left(1+\frac{1}{n}\right)\right]=e-\frac{e}{2n}+O\left(\frac{1}{n^2}\right) $$
hence
$$ \left(1+\frac{1}{n+1}\right)^{n+1}-\left(1+\frac{1}{n}\right)^n = \frac{e}{2n^2}+O\left(\frac{1}{n^3}\right) $$
and for a fixed $k\in\mathbb{R}$
$$ \lim\_{n\to +\infty}n^k\left[\left(... | $$\lim\_{n\to \infty}n^k \left((1+\frac{1}{n+1})^{n+1}-(1+\frac{1}{n})^n \right)=
\lim\_{n\to \infty}n^k \left(\frac{e}{2n^2}+O((\frac{1}{n^3})) \right)$$
for n<2 limit is 0, for n=2 limit is e/2, for n>2 limit is infinity |
2,578,858 | I have to find the limit : (let $k\in \mathbb{R}$)
>
> $$\lim\_{n\to \infty}n^k \left(\Big(1+\frac{1}{n+1}\Big)^{n+1}-\Big(1+\frac{1}{n}\Big)^n \right)=?$$
>
>
>
My Try :
$$\lim\_{n\to \infty}\frac{n^k}{\Big(1+\frac{1}{n}\Big)^n} \left(\frac{\Big(1+\frac{1}{n+1}\Big)^{n+1}}{\Big(1+\frac{1}{n}\Big)^n}-1\right)$$
... | 2017/12/24 | [
"https://math.stackexchange.com/questions/2578858",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/505955/"
] | $$\left(1+\frac{1}{n}\right)^n = \exp\left[n\log\left(1+\frac{1}{n}\right)\right]=e-\frac{e}{2n}+O\left(\frac{1}{n^2}\right) $$
hence
$$ \left(1+\frac{1}{n+1}\right)^{n+1}-\left(1+\frac{1}{n}\right)^n = \frac{e}{2n^2}+O\left(\frac{1}{n^3}\right) $$
and for a fixed $k\in\mathbb{R}$
$$ \lim\_{n\to +\infty}n^k\left[\left(... | Using only the Binomial Theorem and Bernoulli's Inequality:
$$
\begin{align}
\hspace{-1cm}\left(1+\frac1{n+1}\right)^{n+1}\!\!-\left(1+\frac1n\right)^n
&=\left(\frac{n+2}{n+1}\right)^{n+1}-\left(\frac{n+1}n\right)^n\tag{1a}\\
&=\color{#C00}{\left(\frac{n+1}n-\frac1{(n+1)n}\right)^{n+1}}-\color{#090}{\left(\frac{n+1}n\r... |
58,252,839 | Why the below is not a valid Lambda Expression?
```
(Integer i) -> return "Alan" + i;
```
I expect it to be valid, But it is actually Invalid , Please Explain | 2019/10/05 | [
"https://Stackoverflow.com/questions/58252839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3431510/"
] | It would be a valid lambda expression if you got the syntax right.
```
Function<Integer, String> f1 = (Integer i) -> { return "Alan" + i; };
Function<Integer, String> f2 = (Integer i) -> "Alan" + i;
Function<Integer, String> f3 = (i) -> "Alan" + i;
Function<Integer, String> f4 = i -> "Alan" + i;
```
A lambda body i... | A bit more context is needed, about how you're using it. But for starters, try removing the `return`:
```
(Integer i) -> "Alan" + i
```
Also, the `Integer` declaration might be redundant - but we really need to see what you're trying to accomplish, and the expected type of the lambda. Are you sure that the lambda is... |
63,159,456 | >
> This is my function
>
>
>
```
const clicker = (input) => {
setoutput((prev) => {
return [...prev, input];
});
};
```
>
> I passed above function as a prop
>
>
>
```
<Createcard click={clicker} />
```
>
> this is my component where i m using that functi... | 2020/07/29 | [
"https://Stackoverflow.com/questions/63159456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13985314/"
] | How about something like:
**XSLT 1.0**
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/Records">
<xsl:copy>
<xsl:for-each select="Record">
<xsl:variable name="comm... | This is another XSLT-1.0 solution:
```
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" />
<xsl:strip-space elements="*" />
<!-- Identity template -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"... |
16,136,904 | If I create a function that loops through executing a bunch of dynamic queries, the process time seems to get exponentially larger. For the sake of an example, im going to use the following code. Keep in mind, I HAVE to use an execute statement in my code.
```
FOR i IN 0..10 LOOP
EXECUTE 'SELECT AVG(val) FROM some_tab... | 2013/04/21 | [
"https://Stackoverflow.com/questions/16136904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1385338/"
] | ### Why the slowdown?
Calculating an average for row that qualify for `x < 100` is obviously *much more* expensive than calculating the same for `x < 1`. How much, we do not know, there is *nothing* in your question.
Without knowing the data distribution in your table, we can only guess. There could be 5 rows for `x ... | First I want to echo Craig's request for real information. In my experience, loops become exponentially slower based on very nitty gritty details. I don't know if this will answer the question but I will give an example I ran across in my own work. If nothing else it will give a good example of something to look for wh... |
411,700 | **Background:**
At 3.20.2 I am unable to manually adjust the raster histogram minimum and maximum X-values, as shown in the screen shot below.
There are fill-in boxes (within the red graphic box) which lead me to believe that a manual adjustment is possible. However, changing those values does not change the histogra... | 2021/09/14 | [
"https://gis.stackexchange.com/questions/411700",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/12840/"
] | Click `Prefs/Actions`, then activate `Zoom to min/max`:
[](https://i.stack.imgur.com/AESIi.png) | By default, bands are stretched to Min/Max. You can adjust this from the symbology tab.
[](https://i.stack.imgur.com/UnC5Q.png)
If you leave the render type in Singleband Gray, you can simply input your desired Min/Max values and update the setting... |
161,546 | ```
Argument 1 passed to Magento\Framework\App\Action\Action::__construct() must be an instance of Magento\Framework\App\Action\Context, instance of Magento\Framework\ObjectManager\ObjectManager given
```
Banging my head over this. I have cleared both
`var/di` and `var/generation`, flushed cache and then recompiled... | 2017/02/23 | [
"https://magento.stackexchange.com/questions/161546",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/47792/"
] | make you need to change your code to this:
```
<?php
namespace MyNamespace\MyModule\Controller\Loginas;
class Index extends \Magento\Framework\App\Action\Action
{
public function __construct(
\Magento\Framework\App\Action\Context $context)
{
return parent::__construct($context);
}
pub... | Seems like \_\_construct() method is missing in your controller.
```
public function __construct(
\Magento\Framework\App\Action\Context $context,
) {
parent::__construct($context);
}
```
Also, your controller file should be inside appropriate folder like "Index" or "Adminhtml" |
161,546 | ```
Argument 1 passed to Magento\Framework\App\Action\Action::__construct() must be an instance of Magento\Framework\App\Action\Context, instance of Magento\Framework\ObjectManager\ObjectManager given
```
Banging my head over this. I have cleared both
`var/di` and `var/generation`, flushed cache and then recompiled... | 2017/02/23 | [
"https://magento.stackexchange.com/questions/161546",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/47792/"
] | Seems like \_\_construct() method is missing in your controller.
```
public function __construct(
\Magento\Framework\App\Action\Context $context,
) {
parent::__construct($context);
}
```
Also, your controller file should be inside appropriate folder like "Index" or "Adminhtml" | Try this, I have injected object manager check the code, run `di:compile` comment after adding this code.
```
namespace MyModule\Service\Controller\Module;
class Version extends \MyModule\Service\Controller\Module {
protected $resultJsonFactory;
protected $objectManager;
protected $helper = null;
pro... |
161,546 | ```
Argument 1 passed to Magento\Framework\App\Action\Action::__construct() must be an instance of Magento\Framework\App\Action\Context, instance of Magento\Framework\ObjectManager\ObjectManager given
```
Banging my head over this. I have cleared both
`var/di` and `var/generation`, flushed cache and then recompiled... | 2017/02/23 | [
"https://magento.stackexchange.com/questions/161546",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/47792/"
] | make you need to change your code to this:
```
<?php
namespace MyNamespace\MyModule\Controller\Loginas;
class Index extends \Magento\Framework\App\Action\Action
{
public function __construct(
\Magento\Framework\App\Action\Context $context)
{
return parent::__construct($context);
}
pub... | Try this, I have injected object manager check the code, run `di:compile` comment after adding this code.
```
namespace MyModule\Service\Controller\Module;
class Version extends \MyModule\Service\Controller\Module {
protected $resultJsonFactory;
protected $objectManager;
protected $helper = null;
pro... |
60,850,234 | Although I have created a Firebase in-app messaging click listener, it tries to open the android system when the button is clicked.
The url like that : <https://site_url/product_id>
I want to open this url after a logic operation.
```
class MainActivity : AppCompatActivity() : FirebaseInAppMessagingClickListener {
... | 2020/03/25 | [
"https://Stackoverflow.com/questions/60850234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3103437/"
] | I'm struggling with this as well.
Unfortunately it looks like there's no way around it at the moment. Firebase will call your custom `FirebaseInAppMessagingClickListener`, but then it'll try to navigate to the provided action URL regardless.
This is an extract from [`FirebaseInAppMessagingDisplay`](https://github.com... | I solved it by adding a transparent activity which handles the deeplink.
1. Create empty activity;
```
class FirebaseEmptyActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
finish()
}
}
```
2. Declare it in manifest:
```
<activi... |
60,850,234 | Although I have created a Firebase in-app messaging click listener, it tries to open the android system when the button is clicked.
The url like that : <https://site_url/product_id>
I want to open this url after a logic operation.
```
class MainActivity : AppCompatActivity() : FirebaseInAppMessagingClickListener {
... | 2020/03/25 | [
"https://Stackoverflow.com/questions/60850234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3103437/"
] | I'm struggling with this as well.
Unfortunately it looks like there's no way around it at the moment. Firebase will call your custom `FirebaseInAppMessagingClickListener`, but then it'll try to navigate to the provided action URL regardless.
This is an extract from [`FirebaseInAppMessagingDisplay`](https://github.com... | Firebase In-App Messaging (FIAM) is in Beta and doesn't support actions other than dynamic links as of now. And dynamic links are still links, so it will always try to navigate to the web first. Jumps outside the app then back (which makes it look like a virus)
I think a better alternative is to use Firebase Cloud Mes... |
2,381,377 | I got the following definition:
>
> Let $f:X\to Y$ and $B\subseteq Y,A\subseteq X$
>
>
> The image of $A,F(A)$ is defined as $f(A)=\{f(a):a \in A\}$
>
>
> The Pre-image of $B, f^{-1}(B)$ is defined as $f^{-1}(B)=\{x\in X:f(x)\in B\}$
>
>
>
In the pre-image is there a reason that we look at $x\in X$ and not $a... | 2017/08/03 | [
"https://math.stackexchange.com/questions/2381377",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/103441/"
] | $A$ is irrelevant to the definition; we are defining the pre-image for *arbitrary* subsets of $Y$. | $f[A]$ answers the question: "what points in $Y$ do we reach with $f$ from $A$"?
$f^{-1}[B]$ answers the question "what points from $X$ map inside $B$"?
The $A$ is just meant as arbitrary subset of $X$.
The $B$ is just meant as an arbitrary subset of $Y$. They are not related.
Exercise in the definitions: $$f[f^{-1}... |
2,381,377 | I got the following definition:
>
> Let $f:X\to Y$ and $B\subseteq Y,A\subseteq X$
>
>
> The image of $A,F(A)$ is defined as $f(A)=\{f(a):a \in A\}$
>
>
> The Pre-image of $B, f^{-1}(B)$ is defined as $f^{-1}(B)=\{x\in X:f(x)\in B\}$
>
>
>
In the pre-image is there a reason that we look at $x\in X$ and not $a... | 2017/08/03 | [
"https://math.stackexchange.com/questions/2381377",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/103441/"
] | $f^{-1}(B) \not\subset A $ in general . $A \text { and } B$ are just arbitrary sets, and there's no reason to assume the preimage of $B$ is contained in $A$. | $f[A]$ answers the question: "what points in $Y$ do we reach with $f$ from $A$"?
$f^{-1}[B]$ answers the question "what points from $X$ map inside $B$"?
The $A$ is just meant as arbitrary subset of $X$.
The $B$ is just meant as an arbitrary subset of $Y$. They are not related.
Exercise in the definitions: $$f[f^{-1}... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | why not try like this with [forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
```js
var residents = [{
name: "Pyrus",
room: "32"
}, {
name: "Ash Ketchum",
room: "22"
}];
function people(residents) {
residents.forEach((element) => {
for (v... | You can avoid some of the `for` loops and make the code a little easier to read using `forEach` and `Object.entries`:
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
residents.forEach(res => {
Object.entries(res).forEach(([key, value]) => {
console.log(key + ": " + va... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | You have chained two loops together so your function needs to access the parents index then the property that you wish to reference.
```
function people() {
for (let i = 0; i < residents.length; i++) {
for (let j in residents[i]) {
document.write(j + ": " + residents[i][j] + "<br>");
}... | This is the simplest way I think(Use [`foreach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)):
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
function people() {
residents.forEach(function(resident) {
document.write(... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | You have chained two loops together so your function needs to access the parents index then the property that you wish to reference.
```
function people() {
for (let i = 0; i < residents.length; i++) {
for (let j in residents[i]) {
document.write(j + ": " + residents[i][j] + "<br>");
}... | Using a regular for-loop it would go like the below code. Also, I strongly recommend you to check if all the properties (`j`) are own properties (with [`hasOwnProperty`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)), otherwise this will look up in the prototype... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | This is the simplest way I think(Use [`foreach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)):
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
function people() {
residents.forEach(function(resident) {
document.write(... | You can avoid some of the `for` loops and make the code a little easier to read using `forEach` and `Object.entries`:
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
residents.forEach(res => {
Object.entries(res).forEach(([key, value]) => {
console.log(key + ": " + va... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | This is the simplest way I think(Use [`foreach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)):
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
function people() {
residents.forEach(function(resident) {
document.write(... | You need to access `residents[i][j]` since you are iterating residents in the first place.
so your code becomes :
`document.write(j + ": " + residents[i][j] + "<br>");`
See this [working js fiddle](https://jsfiddle.net/Lo1m07us/)
You could also write it like this :
```
function people(){
residents.forEach(r =>... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | why not try like this with [forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
```js
var residents = [{
name: "Pyrus",
room: "32"
}, {
name: "Ash Ketchum",
room: "22"
}];
function people(residents) {
residents.forEach((element) => {
for (v... | You need to access `residents[i][j]` since you are iterating residents in the first place.
so your code becomes :
`document.write(j + ": " + residents[i][j] + "<br>");`
See this [working js fiddle](https://jsfiddle.net/Lo1m07us/)
You could also write it like this :
```
function people(){
residents.forEach(r =>... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | You have chained two loops together so your function needs to access the parents index then the property that you wish to reference.
```
function people() {
for (let i = 0; i < residents.length; i++) {
for (let j in residents[i]) {
document.write(j + ": " + residents[i][j] + "<br>");
}... | You need to access `residents[i][j]` since you are iterating residents in the first place.
so your code becomes :
`document.write(j + ": " + residents[i][j] + "<br>");`
See this [working js fiddle](https://jsfiddle.net/Lo1m07us/)
You could also write it like this :
```
function people(){
residents.forEach(r =>... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | why not try like this with [forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
```js
var residents = [{
name: "Pyrus",
room: "32"
}, {
name: "Ash Ketchum",
room: "22"
}];
function people(residents) {
residents.forEach((element) => {
for (v... | Using a regular for-loop it would go like the below code. Also, I strongly recommend you to check if all the properties (`j`) are own properties (with [`hasOwnProperty`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)), otherwise this will look up in the prototype... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | You have chained two loops together so your function needs to access the parents index then the property that you wish to reference.
```
function people() {
for (let i = 0; i < residents.length; i++) {
for (let j in residents[i]) {
document.write(j + ": " + residents[i][j] + "<br>");
}... | You can avoid some of the `for` loops and make the code a little easier to read using `forEach` and `Object.entries`:
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
residents.forEach(res => {
Object.entries(res).forEach(([key, value]) => {
console.log(key + ": " + va... |
51,597,820 | I am using VBA to clear certain cells in an excel file, but when it clears them the value remains. When I click on the cell value disappears but I need it to do it once the cell is cleared in the code. Edit: As requested, more code. The cells still do not empty until I have clicked them even with setting the value to e... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51597820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10145155/"
] | This is the simplest way I think(Use [`foreach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)):
```js
var residents = [{name: "Pyrus", room: "32"},{name: "Ash Ketchum", room: "22"}];
function people() {
residents.forEach(function(resident) {
document.write(... | why not try like this with [forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
```js
var residents = [{
name: "Pyrus",
room: "32"
}, {
name: "Ash Ketchum",
room: "22"
}];
function people(residents) {
residents.forEach((element) => {
for (v... |
46,012,272 | I am currently building an electron app. I have a PDF on my local file system which I need to silently print out (on the default printer). I came across the node-printer library, but it doesn't seem to work for me. Is there an easy solution to achieve this? | 2017/09/02 | [
"https://Stackoverflow.com/questions/46012272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5609492/"
] | Well first of all it is near impossible to understand what you mean with "silent" print. Because once you send a print order to your system printer it will be out of your hand to be silent at all. On Windows for example once the order was given, at least the systemtray icon will indicate that something is going on. Tha... | To my knowledge there is currently no way to do this directly using Electron because while using `contents.print([])` does allow for 'silently' printing HTML files, it isn't able to print PDF views. This is currently an open feature request: <https://github.com/electron/electron/issues/9029>
**Edit**: I managed to wor... |
46,012,272 | I am currently building an electron app. I have a PDF on my local file system which I need to silently print out (on the default printer). I came across the node-printer library, but it doesn't seem to work for me. Is there an easy solution to achieve this? | 2017/09/02 | [
"https://Stackoverflow.com/questions/46012272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5609492/"
] | I recently published NPM package to print PDF files from Node.js and Electron. You can send a PDF file to the default printer or to a specific one. Works fine on Windows and Unix-like operating systems: <https://github.com/artiebits/pdf-to-printer>.
It's easy to install, just (if using **yarn**):
```
yarn add pdf-to-... | To my knowledge there is currently no way to do this directly using Electron because while using `contents.print([])` does allow for 'silently' printing HTML files, it isn't able to print PDF views. This is currently an open feature request: <https://github.com/electron/electron/issues/9029>
**Edit**: I managed to wor... |
1,377,132 | [This Question](https://superuser.com/q/1088165/212610) asks about getting the [fingerprint of a SSH key](https://en.wikipedia.org/wiki/Public_key_fingerprint) while generating the new key with `ssh-keygen`.
But how does one get determine the fingerprint of an *existing* public key in a `.pub` file?
➥ How to get:
... | 2018/11/20 | [
"https://superuser.com/questions/1377132",
"https://superuser.com",
"https://superuser.com/users/212610/"
] | Install **openssh** and **openssl** packages which contain the commands.
```
# get the SHA256 and ascii art
ssh-keygen -l -v -f /path/to/publickey
# get the MD5 for private key
openssl pkey -in /path/to/privatekey -pubout -outform DER | openssl md5 -c
# get the MD5 for public key
openssl pkey -in /path/to/public... | The above works if you have access to the remote host. If not, to get the default sha256 hashes and Art from the remote host 'pi' (for example) you can do this:
```
$ ssh-keyscan pi | ssh-keygen -lvf -
# pi:22 SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u4
# pi:22 SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u4
# pi:22 SSH-2.0-Ope... |
1,377,132 | [This Question](https://superuser.com/q/1088165/212610) asks about getting the [fingerprint of a SSH key](https://en.wikipedia.org/wiki/Public_key_fingerprint) while generating the new key with `ssh-keygen`.
But how does one get determine the fingerprint of an *existing* public key in a `.pub` file?
➥ How to get:
... | 2018/11/20 | [
"https://superuser.com/questions/1377132",
"https://superuser.com",
"https://superuser.com/users/212610/"
] | In recent versions of ssh-keygen, one gets an RSA public key fingerprint
on Unix-based systems with something like:
`$ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub`
where the path refers to a public key file. | Install **openssh** and **openssl** packages which contain the commands.
```
# get the SHA256 and ascii art
ssh-keygen -l -v -f /path/to/publickey
# get the MD5 for private key
openssl pkey -in /path/to/privatekey -pubout -outform DER | openssl md5 -c
# get the MD5 for public key
openssl pkey -in /path/to/public... |
1,377,132 | [This Question](https://superuser.com/q/1088165/212610) asks about getting the [fingerprint of a SSH key](https://en.wikipedia.org/wiki/Public_key_fingerprint) while generating the new key with `ssh-keygen`.
But how does one get determine the fingerprint of an *existing* public key in a `.pub` file?
➥ How to get:
... | 2018/11/20 | [
"https://superuser.com/questions/1377132",
"https://superuser.com",
"https://superuser.com/users/212610/"
] | Install **openssh** and **openssl** packages which contain the commands.
```
# get the SHA256 and ascii art
ssh-keygen -l -v -f /path/to/publickey
# get the MD5 for private key
openssl pkey -in /path/to/privatekey -pubout -outform DER | openssl md5 -c
# get the MD5 for public key
openssl pkey -in /path/to/public... | If you need just the fingerprint without anything else for something like adding your key to digital ocean via doctl and a new server you can do this.
```
FINGERPRINT="$(ssh-keygen -l -E md5 -f ~/.ssh/${DROPLET_NAME}.pub | awk '{print $2}'| sed 's|MD5:||')"
```
```
DROPLET_TAG="machineid-${tagname}"
DROPLET_NAME="${... |
1,377,132 | [This Question](https://superuser.com/q/1088165/212610) asks about getting the [fingerprint of a SSH key](https://en.wikipedia.org/wiki/Public_key_fingerprint) while generating the new key with `ssh-keygen`.
But how does one get determine the fingerprint of an *existing* public key in a `.pub` file?
➥ How to get:
... | 2018/11/20 | [
"https://superuser.com/questions/1377132",
"https://superuser.com",
"https://superuser.com/users/212610/"
] | In recent versions of ssh-keygen, one gets an RSA public key fingerprint
on Unix-based systems with something like:
`$ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub`
where the path refers to a public key file. | The above works if you have access to the remote host. If not, to get the default sha256 hashes and Art from the remote host 'pi' (for example) you can do this:
```
$ ssh-keyscan pi | ssh-keygen -lvf -
# pi:22 SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u4
# pi:22 SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u4
# pi:22 SSH-2.0-Ope... |
1,377,132 | [This Question](https://superuser.com/q/1088165/212610) asks about getting the [fingerprint of a SSH key](https://en.wikipedia.org/wiki/Public_key_fingerprint) while generating the new key with `ssh-keygen`.
But how does one get determine the fingerprint of an *existing* public key in a `.pub` file?
➥ How to get:
... | 2018/11/20 | [
"https://superuser.com/questions/1377132",
"https://superuser.com",
"https://superuser.com/users/212610/"
] | The above works if you have access to the remote host. If not, to get the default sha256 hashes and Art from the remote host 'pi' (for example) you can do this:
```
$ ssh-keyscan pi | ssh-keygen -lvf -
# pi:22 SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u4
# pi:22 SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u4
# pi:22 SSH-2.0-Ope... | If you need just the fingerprint without anything else for something like adding your key to digital ocean via doctl and a new server you can do this.
```
FINGERPRINT="$(ssh-keygen -l -E md5 -f ~/.ssh/${DROPLET_NAME}.pub | awk '{print $2}'| sed 's|MD5:||')"
```
```
DROPLET_TAG="machineid-${tagname}"
DROPLET_NAME="${... |
1,377,132 | [This Question](https://superuser.com/q/1088165/212610) asks about getting the [fingerprint of a SSH key](https://en.wikipedia.org/wiki/Public_key_fingerprint) while generating the new key with `ssh-keygen`.
But how does one get determine the fingerprint of an *existing* public key in a `.pub` file?
➥ How to get:
... | 2018/11/20 | [
"https://superuser.com/questions/1377132",
"https://superuser.com",
"https://superuser.com/users/212610/"
] | In recent versions of ssh-keygen, one gets an RSA public key fingerprint
on Unix-based systems with something like:
`$ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub`
where the path refers to a public key file. | If you need just the fingerprint without anything else for something like adding your key to digital ocean via doctl and a new server you can do this.
```
FINGERPRINT="$(ssh-keygen -l -E md5 -f ~/.ssh/${DROPLET_NAME}.pub | awk '{print $2}'| sed 's|MD5:||')"
```
```
DROPLET_TAG="machineid-${tagname}"
DROPLET_NAME="${... |
3,124 | Quando se diz algo como "itens filtrados", o que foi retido (o que interessa, o objetivo) é o que teria passado através do filtro ou o que seria bloqueado (não passou)?
Isso também acontece com outras palavas parecidas, como "peneirado" e "coado".
Procurei nos dicionários, mas não deixam claro se é o que fica ou o q... | 2016/04/24 | [
"https://portuguese.stackexchange.com/questions/3124",
"https://portuguese.stackexchange.com",
"https://portuguese.stackexchange.com/users/47/"
] | *Filtrar* tem estes dois significados (entre outros, [Aulete](http://www.aulete.com.br/filtrar)):
>
> **1.** Fazer passar ou passar por um filtro [td. : *Filtrar a água*] [int. : *A água ainda não filtrou.*]
>
> **2.** Impedir que passe inteira ou parcialmente [td. : *Filtrar raios solares*]
>
>
>
Portanto se ... | Penso que em língua portuguesa corrente não existem palavras específicas derivadas de filtro (ou de peneira ou coar) para referir todos os diversos elementos participantes no processo,tanto quanto sei.
Quando de diz filtrado penso que geralmente diz respeito a algo que participou no processo sem especificar que tipo ... |
1,615,998 | What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute?
NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis.... | 2009/10/23 | [
"https://Stackoverflow.com/questions/1615998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119382/"
] | `timeIntervalSinceReferenceDate` is perfectly fine.
However, unless it's a long-running method, this won't bear much fruit. Execution times can vary wildly when you're talking about a few millisecond executions. If your thread/process gets preempted mid-way through, you'll have non-deterministic spikes. Essentially, y... | If you're trying to tune your code's performance, you would do better to use Instruments or Shark to get an overall picture of where your app is spending its time. |
1,615,998 | What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute?
NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis.... | 2009/10/23 | [
"https://Stackoverflow.com/questions/1615998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119382/"
] | *Do not use `NSDate` for this.* You're loosing a lot of precision to call methods and instantiate objects, maybe even releasing something internal. You just don't have enough control.
Use either `time.h` or as [Stephen Canon](https://stackoverflow.com/questions/1615998/rudimentary-ways-to-measure-execution-time-of-a-m... | I will repost my answer from another post here. Note that my admittedly simple solution to this complex problem uses NSDate and NSTimeInterval as its foundation:
---
I know this is an old one but even I found myself wandering past it again, so I thought I'd submit my own option here.
Best bet is to check out my blog... |
1,615,998 | What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute?
NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis.... | 2009/10/23 | [
"https://Stackoverflow.com/questions/1615998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119382/"
] | Actually, `+[NSDate timeIntervalSinceReferenceDate]` returns an `NSTimeInterval`, which is a typedef for a double. The docs say
>
> NSTimeInterval is always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years.
>
>
>
So it's safe to use for millisecond-precision timing. I do so ... | `timeIntervalSinceReferenceDate` is perfectly fine.
However, unless it's a long-running method, this won't bear much fruit. Execution times can vary wildly when you're talking about a few millisecond executions. If your thread/process gets preempted mid-way through, you'll have non-deterministic spikes. Essentially, y... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.