qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
31,425 | As any cyclist knows, steel has many advantages over aluminium:
* it's stronger (for the same size)
* it can handle greater forces without needing to be stiffer
* it has better fatigue characteristics
* it's easier to work with
* and most importantly of all, it offers a more responsive and comfortable ride.
On the ot... | 2016/09/11 | [
"https://aviation.stackexchange.com/questions/31425",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/14197/"
] | You are right, on first sight it is actually surprising that aluminium prevailed. It comes with some disadvantages:
* Crack growth must come first in this list. With only a small cyclic load, cracks in aluminium will relentlessly grow. This requires frequent checks and has [caused many accidents](http://www.icas.org/I... | Good strength to weight ratio, manufacutrability, resistance to corrosion, have been the driving factors behind the use of aluminum alloys. However steels are used in high strength applications such as the landing gear. Stainless steels has been used in a few airframes such as the MiG-25 for their higher yield strength... |
31,425 | As any cyclist knows, steel has many advantages over aluminium:
* it's stronger (for the same size)
* it can handle greater forces without needing to be stiffer
* it has better fatigue characteristics
* it's easier to work with
* and most importantly of all, it offers a more responsive and comfortable ride.
On the ot... | 2016/09/11 | [
"https://aviation.stackexchange.com/questions/31425",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/14197/"
] | Good strength to weight ratio, manufacutrability, resistance to corrosion, have been the driving factors behind the use of aluminum alloys. However steels are used in high strength applications such as the landing gear. Stainless steels has been used in a few airframes such as the MiG-25 for their higher yield strength... | Aluminum has a worse fatigue behavior than steel, but it has two important advantages: strength to weight ratio and corrosion resistance. In the beginning of aviation there were some aircraft made of steel. Some of the engines in that era also had cast iron blocks. But the resulting weight was terrible. As for corrosio... |
31,425 | As any cyclist knows, steel has many advantages over aluminium:
* it's stronger (for the same size)
* it can handle greater forces without needing to be stiffer
* it has better fatigue characteristics
* it's easier to work with
* and most importantly of all, it offers a more responsive and comfortable ride.
On the ot... | 2016/09/11 | [
"https://aviation.stackexchange.com/questions/31425",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/14197/"
] | Good strength to weight ratio, manufacutrability, resistance to corrosion, have been the driving factors behind the use of aluminum alloys. However steels are used in high strength applications such as the landing gear. Stainless steels has been used in a few airframes such as the MiG-25 for their higher yield strength... | It really comes down to cost/benefit.
Let's consider two aircraft that were built out of stainless steel, and performed very well: the [XB-70](https://en.wikipedia.org/wiki/North_American_XB-70_Valkyrie) and [X15](https://en.wikipedia.org/wiki/North_American_X-15). Stainless steel was used to resist the heat of Mach ... |
31,425 | As any cyclist knows, steel has many advantages over aluminium:
* it's stronger (for the same size)
* it can handle greater forces without needing to be stiffer
* it has better fatigue characteristics
* it's easier to work with
* and most importantly of all, it offers a more responsive and comfortable ride.
On the ot... | 2016/09/11 | [
"https://aviation.stackexchange.com/questions/31425",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/14197/"
] | You are right, on first sight it is actually surprising that aluminium prevailed. It comes with some disadvantages:
* Crack growth must come first in this list. With only a small cyclic load, cracks in aluminium will relentlessly grow. This requires frequent checks and has [caused many accidents](http://www.icas.org/I... | Aluminum has a worse fatigue behavior than steel, but it has two important advantages: strength to weight ratio and corrosion resistance. In the beginning of aviation there were some aircraft made of steel. Some of the engines in that era also had cast iron blocks. But the resulting weight was terrible. As for corrosio... |
31,425 | As any cyclist knows, steel has many advantages over aluminium:
* it's stronger (for the same size)
* it can handle greater forces without needing to be stiffer
* it has better fatigue characteristics
* it's easier to work with
* and most importantly of all, it offers a more responsive and comfortable ride.
On the ot... | 2016/09/11 | [
"https://aviation.stackexchange.com/questions/31425",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/14197/"
] | You are right, on first sight it is actually surprising that aluminium prevailed. It comes with some disadvantages:
* Crack growth must come first in this list. With only a small cyclic load, cracks in aluminium will relentlessly grow. This requires frequent checks and has [caused many accidents](http://www.icas.org/I... | It really comes down to cost/benefit.
Let's consider two aircraft that were built out of stainless steel, and performed very well: the [XB-70](https://en.wikipedia.org/wiki/North_American_XB-70_Valkyrie) and [X15](https://en.wikipedia.org/wiki/North_American_X-15). Stainless steel was used to resist the heat of Mach ... |
31,425 | As any cyclist knows, steel has many advantages over aluminium:
* it's stronger (for the same size)
* it can handle greater forces without needing to be stiffer
* it has better fatigue characteristics
* it's easier to work with
* and most importantly of all, it offers a more responsive and comfortable ride.
On the ot... | 2016/09/11 | [
"https://aviation.stackexchange.com/questions/31425",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/14197/"
] | It really comes down to cost/benefit.
Let's consider two aircraft that were built out of stainless steel, and performed very well: the [XB-70](https://en.wikipedia.org/wiki/North_American_XB-70_Valkyrie) and [X15](https://en.wikipedia.org/wiki/North_American_X-15). Stainless steel was used to resist the heat of Mach ... | Aluminum has a worse fatigue behavior than steel, but it has two important advantages: strength to weight ratio and corrosion resistance. In the beginning of aviation there were some aircraft made of steel. Some of the engines in that era also had cast iron blocks. But the resulting weight was terrible. As for corrosio... |
15,517,541 | I am using [Parse](http://parse.com) for my app. I want to query a table with column that set to be a pointer to other table. Here is the query:
```
ParseQuery query = new ParseQuery("CategoryAttribute");
query.whereEqualTo("categoryId", categoryId);
query.findInBackground(new FindCallback() {
... | 2013/03/20 | [
"https://Stackoverflow.com/questions/15517541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691423/"
] | Here is the solution to this one:
First you need to create a `ParseObject` from the type of your table:
```
ParseObject sale = ParseObject.createParseObject("Sale");
```
Then you need to get the `ParseObject` from the result:
```
sale = result.getParseObject(pointer_field);
```
Now you can pull from `sale` any ... | @Akshat Agarwal, here is a example in JavaScript:
```
var parseObj = Parse.Object.extend('parseObj');
new Parse.Query(parseObj)
.include('pointerField')
.find(function (data) {
data.get('pointerField').get('fieldName');
});
``` |
15,517,541 | I am using [Parse](http://parse.com) for my app. I want to query a table with column that set to be a pointer to other table. Here is the query:
```
ParseQuery query = new ParseQuery("CategoryAttribute");
query.whereEqualTo("categoryId", categoryId);
query.findInBackground(new FindCallback() {
... | 2013/03/20 | [
"https://Stackoverflow.com/questions/15517541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691423/"
] | Here is the solution to this one:
First you need to create a `ParseObject` from the type of your table:
```
ParseObject sale = ParseObject.createParseObject("Sale");
```
Then you need to get the `ParseObject` from the result:
```
sale = result.getParseObject(pointer_field);
```
Now you can pull from `sale` any ... | For iOS
```
PFQuery *parseQuery = [PFQuery queryWithClassName:@"MyClass"];
[parseQuery whereKey:@"categoryId" equalTo:categoryId];
[parseQuery includeKey:@"pinter_field"];
[parseQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
//
}];
``` |
15,517,541 | I am using [Parse](http://parse.com) for my app. I want to query a table with column that set to be a pointer to other table. Here is the query:
```
ParseQuery query = new ParseQuery("CategoryAttribute");
query.whereEqualTo("categoryId", categoryId);
query.findInBackground(new FindCallback() {
... | 2013/03/20 | [
"https://Stackoverflow.com/questions/15517541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691423/"
] | @Akshat Agarwal, here is a example in JavaScript:
```
var parseObj = Parse.Object.extend('parseObj');
new Parse.Query(parseObj)
.include('pointerField')
.find(function (data) {
data.get('pointerField').get('fieldName');
});
``` | For iOS
```
PFQuery *parseQuery = [PFQuery queryWithClassName:@"MyClass"];
[parseQuery whereKey:@"categoryId" equalTo:categoryId];
[parseQuery includeKey:@"pinter_field"];
[parseQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
//
}];
``` |
90,973 | I have put the shortcuts of virtual machines using vmrun in startup folder as batch file.
Now they are working correctly .
When i use remote desktop coonection to main or host OS(2008 server) using username and password .
It is only then that that startup folder executes and my virtual machine starts othwise not
In ... | 2009/12/04 | [
"https://serverfault.com/questions/90973",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Because of the way workstation works, you need to login and have the account running before your VM's start.
If you keep your login running, then your workstations will always be running unless the server reboots or RDP inactivity session policies.
If you want your workstations to start when the server boots, look at... | I may be misreading your question, but what about setting up the machines to automatically log-in when powered on.
I have done this using a reg file with something like this.
```
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultUserName"="mylogi... |
26,404 | Fog is a form of a cloud and it is said clouds are visible moisture. We all know that mist (baby rain) is also moisture so I am curious when will a METAR say BR (mist) or FG (fog)? | 2016/03/25 | [
"https://aviation.stackexchange.com/questions/26404",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/9491/"
] | Quoting from the [METAR decoder](https://www.aviationweather.gov/static/help/taf-decode.php):
```
BR Mist (Foggy conditions with visibilities greater than 5/8 statute mile)
FG Fog (visibility 5/8 statute mile or less)
```
You may ask "Why 5/8th of a statute mile?" That's because [5/8ths of a mile is 1,006 meters](... | The main difference between the fog and mist is their density and as a consequence, the visibility. From [UK Met office](http://www.metoffice.gov.uk/learning/fog/difference-mist-and-fog):
>
> ... they are two distinct terms for a similar phenomenon. Visibility less than 1,000 metres we call 'fog' and obscurity with v... |
187,676 | I was recently laid off and it was part of a company reduction of force. I slipped into a self doubting mood after this as I’ve never been fired or laid off before.
The first week I was unemployed, a company reached out to me on LinkedIn that is in the same industry I’m in looking for someone to fill an open role I fi... | 2022/10/01 | [
"https://workplace.stackexchange.com/questions/187676",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/136936/"
] | You are likely OK since it does not appear that you intentionally lie to the recruiter or interviewer from the new company.
If the interviewer or recruiter did not ask if you are currently employed, then you don't have to tell them that you currently are not employed.
However, on your resume and LinkedIn profile, you... | >
> told him I would need two weeks if offered the job
>
>
>
While in many places that sounds like you were stating you needed to give two weeks notice, it is also normal for some people to take a week or two for leave between jobs,
>
> Should I inform the recruiter before the final interview this week
> that I ... |
187,676 | I was recently laid off and it was part of a company reduction of force. I slipped into a self doubting mood after this as I’ve never been fired or laid off before.
The first week I was unemployed, a company reached out to me on LinkedIn that is in the same industry I’m in looking for someone to fill an open role I fi... | 2022/10/01 | [
"https://workplace.stackexchange.com/questions/187676",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/136936/"
] | >
> Should I inform the recruiter before the final interview this week
> that I was in fact laid off since it wasn’t a performance based lay
> off?
>
>
>
Unless asked, don't offer the information.
Be prepared with an honest answer if you are asked something like "Why are you leaving your current job?" or "Are you... | >
> told him I would need two weeks if offered the job
>
>
>
While in many places that sounds like you were stating you needed to give two weeks notice, it is also normal for some people to take a week or two for leave between jobs,
>
> Should I inform the recruiter before the final interview this week
> that I ... |
187,676 | I was recently laid off and it was part of a company reduction of force. I slipped into a self doubting mood after this as I’ve never been fired or laid off before.
The first week I was unemployed, a company reached out to me on LinkedIn that is in the same industry I’m in looking for someone to fill an open role I fi... | 2022/10/01 | [
"https://workplace.stackexchange.com/questions/187676",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/136936/"
] | >
> Should I inform the recruiter before the final interview this week
> that I was in fact laid off since it wasn’t a performance based lay
> off?
>
>
>
Unless asked, don't offer the information.
Be prepared with an honest answer if you are asked something like "Why are you leaving your current job?" or "Are you... | You are likely OK since it does not appear that you intentionally lie to the recruiter or interviewer from the new company.
If the interviewer or recruiter did not ask if you are currently employed, then you don't have to tell them that you currently are not employed.
However, on your resume and LinkedIn profile, you... |
14,396,601 | Let's say I have this URL here
```
<s:url action ="profile" var ="profile_url">
<s:param name = "id">${user.userId}</s:param>
</s:url>
<s:a href = "%{profile_url}">My Profile</s:a>
```
Where the parameter id will only have an `int` value. So inside my Action class.
```
public class ViewProfileAction extends Actio... | 2013/01/18 | [
"https://Stackoverflow.com/questions/14396601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/962206/"
] | You have a parameter field as `int` but you have set it as `String` in the URL. To eliminate the errors of that kind you need to put some interceptor before (or after it doesn't matter) the `params` interceptor to check that value. For example you put the `validation` interceptor.
```
@Action(value = "youraction", res... | [ParametersInterceptor](http://struts.apache.org/2.3.4/xwork-core/apidocs/com/opensymphony/xwork2/interceptor/ParametersInterceptor.html), using the [XWorkConverter](http://struts.apache.org/2.3.4/xwork-core/apidocs/com/opensymphony/xwork2/conversion/impl/XWorkConverter.html), would raise an Exception of type
>
> og... |
62,423,748 | I want to drop duplicate value of dataset
ex :
```
+----------+---------------+--------------------+--------------------+---------+----+-------------+
| e_key|f_timestamp_day| key| value|f_country|f_os|received_date|
+----------+---------------+--------------------+------------------... | 2020/06/17 | [
"https://Stackoverflow.com/questions/62423748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13612470/"
] | Try this-
1. Load the test data provided
------------------------------
```java
String data = " e_key|f_timestamp_day| key| value|f_country|f_os|received_date\n" +
" Tryout| 2020-04-01| item_guid_list| a^a^a^b | FR| iOS| 2020-04-01\n" +
... | You can achieve same result using Spark SQL and org.apache.spark.sql.functions:
```
explode_events.select(
$"e_key",
$"f_timestamp_day",
$"key",
explode(split($"value","\\^")),
$"f_country",
$"f_os",
$"received_date"
).show()
``` |
62,423,748 | I want to drop duplicate value of dataset
ex :
```
+----------+---------------+--------------------+--------------------+---------+----+-------------+
| e_key|f_timestamp_day| key| value|f_country|f_os|received_date|
+----------+---------------+--------------------+------------------... | 2020/06/17 | [
"https://Stackoverflow.com/questions/62423748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13612470/"
] | Try this-
1. Load the test data provided
------------------------------
```java
String data = " e_key|f_timestamp_day| key| value|f_country|f_os|received_date\n" +
" Tryout| 2020-04-01| item_guid_list| a^a^a^b | FR| iOS| 2020-04-01\n" +
... | use split function to split the value col and use array\_disticnct and explode function to achieve the result .
```
from pyspark.sql.functions import *
#create df1
df1= df.withColumn("value",explode(array_distinct((split("VALUES","\\^")))))
``` |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Here is a fairly straightforward approach based on a [round robin tournament scheduling algorithm](https://en.wikipedia.org/wiki/Round-robin_tournament#Scheduling_algorithm). Basically, this approach splits the list in half and pairs the first half of the list with a reversed version of the second half of the list. The... | Unless I'm missing something about the question, maybe something like this using `frozenset`s will do?
```py
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
games = set(frozenset(combo) for combo in combinations(teams, 2))
brackets = []
while games:
bracket = []
while games and len... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Here is a fairly straightforward approach based on a [round robin tournament scheduling algorithm](https://en.wikipedia.org/wiki/Round-robin_tournament#Scheduling_algorithm). Basically, this approach splits the list in half and pairs the first half of the list with a reversed version of the second half of the list. The... | I think the following code will work:
```
import copy
def extract_one_list(xdata):
"""
`xdata` .......... `external data`
"""
old_type = type(xdata[0])
# we are going to be testing for whether
# two tuples have any elements in common.
# For example, do (4, 5) and (7, 8) have any elements c... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Here is a fairly straightforward approach based on a [round robin tournament scheduling algorithm](https://en.wikipedia.org/wiki/Round-robin_tournament#Scheduling_algorithm). Basically, this approach splits the list in half and pairs the first half of the list with a reversed version of the second half of the list. The... | My take on the problem:
```
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
sets = []
def is_combo_value_in_set(c, s):
for val in c:
for val_s in s:
for v in val_s:
if val == v:
return True
... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | My take on the problem:
```
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
sets = []
def is_combo_value_in_set(c, s):
for val in c:
for val_s in s:
for v in val_s:
if val == v:
return True
... | Unless I'm missing something about the question, maybe something like this using `frozenset`s will do?
```py
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
games = set(frozenset(combo) for combo in combinations(teams, 2))
brackets = []
while games:
bracket = []
while games and len... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Every team appears 9 times so you will need at least 9 lists (rounds) to ensure that all 45 pairs appear in one of the non-repeating list. It is fairly easy to generate lists of games without repetition if we allow different number of games per list. But if you want 5 games per list on 9 lists, you will need to use a m... | Unless I'm missing something about the question, maybe something like this using `frozenset`s will do?
```py
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
games = set(frozenset(combo) for combo in combinations(teams, 2))
brackets = []
while games:
bracket = []
while games and len... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Every team appears 9 times so you will need at least 9 lists (rounds) to ensure that all 45 pairs appear in one of the non-repeating list. It is fairly easy to generate lists of games without repetition if we allow different number of games per list. But if you want 5 games per list on 9 lists, you will need to use a m... | You can use recursion to generate combinations of `combo` that contain all the elements of `teams` and then use an iterator to filter:
```
import itertools
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(itertools.combinations(teams, 2))
def group(c = [], s = []):
_c = {i for b in c for i in b}
if all(i in ... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Here is a fairly straightforward approach based on a [round robin tournament scheduling algorithm](https://en.wikipedia.org/wiki/Round-robin_tournament#Scheduling_algorithm). Basically, this approach splits the list in half and pairs the first half of the list with a reversed version of the second half of the list. The... | You can use recursion to generate combinations of `combo` that contain all the elements of `teams` and then use an iterator to filter:
```
import itertools
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(itertools.combinations(teams, 2))
def group(c = [], s = []):
_c = {i for b in c for i in b}
if all(i in ... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Try this :
```
d = {}
for i in combo:
s = set(teams) - set(i)
d[i] = [list(s)[k:k+2] for k in range(0, len(s), 2)]
```
**Output** :
```
{(5, 9): [[1, 2], [3, 4], [6, 7], [8, 10]], (4, 7): [[1, 2], [3, 5], [6, 8], [9, 10]], (1, 3): [[2, 4], [5, 6], [7, 8], [9, 10]], (4, 8): [[1, 2], [3, 5], [6, 7], [9, 10]],... | I think the following code will work:
```
import copy
def extract_one_list(xdata):
"""
`xdata` .......... `external data`
"""
old_type = type(xdata[0])
# we are going to be testing for whether
# two tuples have any elements in common.
# For example, do (4, 5) and (7, 8) have any elements c... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Try this :
```
d = {}
for i in combo:
s = set(teams) - set(i)
d[i] = [list(s)[k:k+2] for k in range(0, len(s), 2)]
```
**Output** :
```
{(5, 9): [[1, 2], [3, 4], [6, 7], [8, 10]], (4, 7): [[1, 2], [3, 5], [6, 8], [9, 10]], (1, 3): [[2, 4], [5, 6], [7, 8], [9, 10]], (4, 8): [[1, 2], [3, 5], [6, 7], [9, 10]],... | You can use recursion to generate combinations of `combo` that contain all the elements of `teams` and then use an iterator to filter:
```
import itertools
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(itertools.combinations(teams, 2))
def group(c = [], s = []):
_c = {i for b in c for i in b}
if all(i in ... |
56,428,614 | I have this code:
```
from itertools import groupby
from itertools import combinations
teams = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
combo = list(combinations(teams, 2))
```
The output is a list of 45 tuples.
```
[(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 3), (2, 4), (2, 5), (2, 6), (2... | 2019/06/03 | [
"https://Stackoverflow.com/questions/56428614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879592/"
] | Here is a fairly straightforward approach based on a [round robin tournament scheduling algorithm](https://en.wikipedia.org/wiki/Round-robin_tournament#Scheduling_algorithm). Basically, this approach splits the list in half and pairs the first half of the list with a reversed version of the second half of the list. The... | Try this :
```
d = {}
for i in combo:
s = set(teams) - set(i)
d[i] = [list(s)[k:k+2] for k in range(0, len(s), 2)]
```
**Output** :
```
{(5, 9): [[1, 2], [3, 4], [6, 7], [8, 10]], (4, 7): [[1, 2], [3, 5], [6, 8], [9, 10]], (1, 3): [[2, 4], [5, 6], [7, 8], [9, 10]], (4, 8): [[1, 2], [3, 5], [6, 7], [9, 10]],... |
63,942,072 | I have a grid with two plots, each one consist of two time series of mean values: one come from an elaboration with R `df5` the other one `mmzep` is not (I received this dataset already calculated).
```
library(dplyr)
library(lubridate)
df5 <- data.frame(df$Date, df$Price)
colnames(df5)<- c("date","price")
df5$date <... | 2020/09/17 | [
"https://Stackoverflow.com/questions/63942072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13953730/"
] | that's because TS is unable to figure out what your function will return exactly. TS merges all possible returns.
To make it more straightforward, it is a good practice to overload your function.
Take a look on example:
```js
type SOME_OBJECT = {
propA: string,
propB: number,
}
// here is new player
interface O... | Based on @captain-yossarian's answer, I ended up doing the following:
```
type SOME_OBJECT = {
propA: string,
propB: number,
}
function getPropertyOrFullObject(): SOME_OBJECT;
function getPropertyOrFullObject<K extends keyof SOME_OBJECT>(propName: K): SOME_OBJECT[K];
function getPropertyOrFullObject<K extends key... |
16,919,479 | I have a query in a stored procedure, it works fine. now I want to add a column the it show error.
My stored procedure code is:
```
ALTER PROCEDURE dbo.test
@SDate DATETIME =Null
, @EDate DATETIME=Null
,@period int=Null
AS BEGIN
SET NOCOUNT ON;
if @period = 1
Begin
... | 2013/06/04 | [
"https://Stackoverflow.com/questions/16919479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2440983/"
] | Not sure what you are trying to do, but guessing, if you are trying to add a column to the ***output*** of stored procedure, that is not in the table that the stored procedure is reading data from, then you have to put a literal expression into the select clause, with a defined column name like below: This example uses... | You're getting this error because the column `test` does not exist in this query:
```
CROSS JOIN (
SELECT
TotalQuote = COUNT(quoteid)
, QuoteAmount = SUM(totalamount)
,avgProbQ=SUM(CloseProbability)/COUNT(CloseProbability)
FROM dbo.QuoteBase join dbo.OpportunityBase on dbo.QuoteBase.... |
16,919,479 | I have a query in a stored procedure, it works fine. now I want to add a column the it show error.
My stored procedure code is:
```
ALTER PROCEDURE dbo.test
@SDate DATETIME =Null
, @EDate DATETIME=Null
,@period int=Null
AS BEGIN
SET NOCOUNT ON;
if @period = 1
Begin
... | 2013/06/04 | [
"https://Stackoverflow.com/questions/16919479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2440983/"
] | I am not sure what is your table looked like
it seems you are adding test to your stored procedure but its not added in your database table
This is what I can say by looking the error message. Hope it helps | You're getting this error because the column `test` does not exist in this query:
```
CROSS JOIN (
SELECT
TotalQuote = COUNT(quoteid)
, QuoteAmount = SUM(totalamount)
,avgProbQ=SUM(CloseProbability)/COUNT(CloseProbability)
FROM dbo.QuoteBase join dbo.OpportunityBase on dbo.QuoteBase.... |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | Your example using Boost.Variant and a visitor:
```
#include <string>
#include <list>
#include <boost/variant.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace boost;
typedef variant<string, int, bool> object;
struct vis : public static_visitor<>
{
void operator() (string s) const { /* do s... | I'd just like to point out that using dynamic type casting in order to branch based on type often hints at flaws in the architecture. Most times you can achieve the same effect using virtual functions:
```
class MyData
{
public:
// base classes of polymorphic types should have a virtual destructor
virtual ~MyData(... |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | Sadly there is no easy way of doing this in C++. You have to create a base class yourself and derive all other classes from this class. Create a vector of base class pointers and then use dynamic\_cast (which comes with its own runtime overhead) to find the actual type. | Beside the fact, as most have pointed out, you can't do that, or more importantly, more than likely, you really don't want to.
Let's dismiss your example, and consider something closer to a real-life example. Specifically, some code I saw in a real open-source project. It attempted to emulate a cpu in a character arra... |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | Beside the fact, as most have pointed out, you can't do that, or more importantly, more than likely, you really don't want to.
Let's dismiss your example, and consider something closer to a real-life example. Specifically, some code I saw in a real open-source project. It attempted to emulate a cpu in a character arra... | The short answer is... you can't.
The long answer is... you'd have to define your own new heirarchy of objects that all inherit from a base object. In Java all objects ultimately descend from "Object", which is what allows you to do this. |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | Just for completeness of this topic I want to mention that you can actually do this with pure C by using void\* and then casting it into whatever it has to be (ok, my example isn't pure C since it uses vectors but that saves me some code). This will work if you know what type your objects are, or if you store a field s... | I am a fairly inexperienced, but here's what I'd go with-
1. Create a base class for all classes you need to manipulate.
2. Write container class/ reuse container class.
(Revised after seeing other answers -My previous point was too cryptic.)
3. Write similar code.
I am sure a much better solution is possible. I am ... |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | I'd just like to point out that using dynamic type casting in order to branch based on type often hints at flaws in the architecture. Most times you can achieve the same effect using virtual functions:
```
class MyData
{
public:
// base classes of polymorphic types should have a virtual destructor
virtual ~MyData(... | Beside the fact, as most have pointed out, you can't do that, or more importantly, more than likely, you really don't want to.
Let's dismiss your example, and consider something closer to a real-life example. Specifically, some code I saw in a real open-source project. It attempted to emulate a cpu in a character arra... |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | Your example using Boost.Variant and a visitor:
```
#include <string>
#include <list>
#include <boost/variant.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace boost;
typedef variant<string, int, bool> object;
struct vis : public static_visitor<>
{
void operator() (string s) const { /* do s... | While you cannot store primitive types in containers, you can create primitive type wrapper classes which will be similar to Java's autoboxed primitive types (in your example the primitive typed literals are actually being autoboxed); instances of which appear in C++ code (and can (almost) be used) just like primitive ... |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | Your example using Boost.Variant and a visitor:
```
#include <string>
#include <list>
#include <boost/variant.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace boost;
typedef variant<string, int, bool> object;
struct vis : public static_visitor<>
{
void operator() (string s) const { /* do s... | Sadly there is no easy way of doing this in C++. You have to create a base class yourself and derive all other classes from this class. Create a vector of base class pointers and then use dynamic\_cast (which comes with its own runtime overhead) to find the actual type. |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | [`boost::variant`](http://www.boost.org/doc/libs/1_38_0/doc/html/variant.html) is similar to dirkgently's suggestion of `boost::any`, but supports the Visitor pattern, meaning it's easier to add type-specific code later. Also, it allocates values on the stack rather than using dynamic allocation, leading to slightly mo... | Well, you could create a base class and then create classes which inherit from it. Then, store them in a std::vector. |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | [`boost::variant`](http://www.boost.org/doc/libs/1_38_0/doc/html/variant.html) is similar to dirkgently's suggestion of `boost::any`, but supports the Visitor pattern, meaning it's easier to add type-specific code later. Also, it allocates values on the stack rather than using dynamic allocation, leading to slightly mo... | Sadly there is no easy way of doing this in C++. You have to create a base class yourself and derive all other classes from this class. Create a vector of base class pointers and then use dynamic\_cast (which comes with its own runtime overhead) to find the actual type. |
607,458 | In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
```
List<Object> list = new LinkedList<Object>();
list.add("Hello... | 2009/03/03 | [
"https://Stackoverflow.com/questions/607458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55245/"
] | [`boost::variant`](http://www.boost.org/doc/libs/1_38_0/doc/html/variant.html) is similar to dirkgently's suggestion of `boost::any`, but supports the Visitor pattern, meaning it's easier to add type-specific code later. Also, it allocates values on the stack rather than using dynamic allocation, leading to slightly mo... | Just for completeness of this topic I want to mention that you can actually do this with pure C by using void\* and then casting it into whatever it has to be (ok, my example isn't pure C since it uses vectors but that saves me some code). This will work if you know what type your objects are, or if you store a field s... |
29,963,011 | Is there a way to use `caret` for Survival Analysis. I really like how easy to use it is. I tried fitting a random survival forest using the `party` package, which is on caret's list.
This works:
```
library(survival)
library(caret)
library(party)
fitcforest <- cforest(Surv(futime, death) ~ sex+age, data=flchain,
... | 2015/04/30 | [
"https://Stackoverflow.com/questions/29963011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766391/"
] | Not yet. That is one of two major updates that should be coming soon (the other expands pre-processing).
Contact me offline if you are interested in helping the development and/or testing of those features.
Thanks,
Max | I have found no way to train survival models with caret. As an alternative, the mlr framework (1) has a set of survival learners (2). I have found mlr to be extremely user-friendly and useful.
1. mlr: <http://mlr-org.github.io/mlr-tutorial/release/html/>
2. survival learners in mlr: <http://mlr-org.github.io/mlr-tutor... |
29,963,011 | Is there a way to use `caret` for Survival Analysis. I really like how easy to use it is. I tried fitting a random survival forest using the `party` package, which is on caret's list.
This works:
```
library(survival)
library(caret)
library(party)
fitcforest <- cforest(Surv(futime, death) ~ sex+age, data=flchain,
... | 2015/04/30 | [
"https://Stackoverflow.com/questions/29963011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766391/"
] | Not yet. That is one of two major updates that should be coming soon (the other expands pre-processing).
Contact me offline if you are interested in helping the development and/or testing of those features.
Thanks,
Max | There is an increasing number of packages in R that model survival data, examples;
For lasso and elastic nets: BioSpear.
For random forest: randomForestSRC.
Best, Loic |
21,953,568 | I am using this code in C#
```
System.Diagnostics.Process.Start(“CMD.exe”,@”/C cd\ & mySecondCommandHere“);
```
It works fine, but doesn't tell when it's done.
How could I get the code to alert me when the dos commend has finished? | 2014/02/22 | [
"https://Stackoverflow.com/questions/21953568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/683553/"
] | One way is to call WaitForExit. This will block execution until the process in question has exited.
```
var process = System.Diagnostics.Process.Start("...");
//The next line will block until the process has finished
process.WaitForExit();
``` | You can fetch the process object and subscribe to its Exited event.
```
var process = System.Diagnostics.Process.Start("...");
process.Exited += ...
```
Alternative, you can synchronously wait for the process using `WaitForExit()`. However, this is a blocking call. |
21,953,568 | I am using this code in C#
```
System.Diagnostics.Process.Start(“CMD.exe”,@”/C cd\ & mySecondCommandHere“);
```
It works fine, but doesn't tell when it's done.
How could I get the code to alert me when the dos commend has finished? | 2014/02/22 | [
"https://Stackoverflow.com/questions/21953568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/683553/"
] | One way is to call WaitForExit. This will block execution until the process in question has exited.
```
var process = System.Diagnostics.Process.Start("...");
//The next line will block until the process has finished
process.WaitForExit();
``` | Use a method like below:
```
private bool AlertMe()
{
bool isCompleted = false;
System.Diagnostics.Process.Start(“CMD.exe”,@”/C cd\ & mySecondCommandHere“);
isCompleted = true;
System.Media.SystemSounds.Beep.Play();
return isCompleted;
}
```
System.Media.SystemSounds.Beep.Play() will alert you wi... |
21,953,568 | I am using this code in C#
```
System.Diagnostics.Process.Start(“CMD.exe”,@”/C cd\ & mySecondCommandHere“);
```
It works fine, but doesn't tell when it's done.
How could I get the code to alert me when the dos commend has finished? | 2014/02/22 | [
"https://Stackoverflow.com/questions/21953568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/683553/"
] | You can fetch the process object and subscribe to its Exited event.
```
var process = System.Diagnostics.Process.Start("...");
process.Exited += ...
```
Alternative, you can synchronously wait for the process using `WaitForExit()`. However, this is a blocking call. | Use a method like below:
```
private bool AlertMe()
{
bool isCompleted = false;
System.Diagnostics.Process.Start(“CMD.exe”,@”/C cd\ & mySecondCommandHere“);
isCompleted = true;
System.Media.SystemSounds.Beep.Play();
return isCompleted;
}
```
System.Media.SystemSounds.Beep.Play() will alert you wi... |
1,451,135 | While learning Rails I've created an application with a `Domains` controller nested below a `Customers` controller. I'm using Rails 2.3.4 and it's been a learning experience. I managed to get the below routing set up:
```
customer_domains GET /customers/:customer_id/domains(.:format) {:controller=>"dom... | 2009/09/20 | [
"https://Stackoverflow.com/questions/1451135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35434/"
] | Passing the customer\_id with the requests would do. Something like this :-
```
class DomainsControllerTest < ActionController::TestCase
test "should get index" do
get :index ,:customer_id=> 1
assert_response :success
assert_not_nil assigns(:domains)
end
end
``` | According to your routes, domains don't longer exist outside of the context of a customer. The request needs a `customer_id` for the named routes to match.
The way to do this in your test is:
```
test "should get index" do
get :index, :customer_id=>joe
end
``` |
1,451,135 | While learning Rails I've created an application with a `Domains` controller nested below a `Customers` controller. I'm using Rails 2.3.4 and it's been a learning experience. I managed to get the below routing set up:
```
customer_domains GET /customers/:customer_id/domains(.:format) {:controller=>"dom... | 2009/09/20 | [
"https://Stackoverflow.com/questions/1451135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35434/"
] | Passing the customer\_id with the requests would do. Something like this :-
```
class DomainsControllerTest < ActionController::TestCase
test "should get index" do
get :index ,:customer_id=> 1
assert_response :success
assert_not_nil assigns(:domains)
end
end
``` | There is a gem called [nester](https://github.com/adamonduty/nester) that solves this exact problem. It generates methods that give you back a `domains_path` and similar as if your routes weren't nested. When your views and tests reference, for example, `domain_path(domain)`, the routes are expanded to `customer_domain... |
37,396,548 | I want to have a page that preloads untill the contents of the link/page that is being visited is fully loaded.
here is my code
```
$( document ).ready(function() {
$.ajax({
method: 'GET',
url: "pages/main.html",
success: function(content)
{
$('#contentarea').html (content);
}
});
... | 2016/05/23 | [
"https://Stackoverflow.com/questions/37396548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5702077/"
] | You can use `$(document).ajaxStart().ajaxStop()`:
```
$(document).ajaxStart(function (){
$('#contentarea').prev().append('<span>loading</span>');
}).ajaxStop(function (){
$('#contentarea').prev('span').remove();
});
``` | >
> **css**
>
>
>
```
#loader-wrapper{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10000;
background-color: #ffffff;
opacity: 1;
}
```
>
> **html**.put this div tag below the start of the body tag
>
>
>
```
<div id="loader-wrapper"></div>
```
>
> **javas... |
54,653,400 | I want to resolve every CVE issues from my project. I'm using `org.owasp.dependencycheck` plugin, but even on an empty project it returns few CVE's:
```
bcprov-jdk15on-1.56.jar: ids:(org.bouncycastle:bcprov-jdk15on:1.56, cpe:/a:bouncycastle:legion-of-the-bouncy-castle-java-crytography-api:1.56) : CVE-2017-13098, CVE-2... | 2019/02/12 | [
"https://Stackoverflow.com/questions/54653400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279023/"
] | Those files are used by the Android build system. That's why they get reported even on an "empty" project.
Check the dependency tree to see where those files are used: `./gradlew app:dependencies`
```
...
lintClassPath - The lint embedded classpath
\--- com.android.tools.lint:lint-gradle:26.4.1
+--- com.android.... | I solve the problem by adding lintClassPath to the dependencies
```
dependencies {
...
lintClassPath "org.bouncycastle:bcpkix-jdk15on:1.64"
}
```
It's late but I hope this helps you. |
54,653,400 | I want to resolve every CVE issues from my project. I'm using `org.owasp.dependencycheck` plugin, but even on an empty project it returns few CVE's:
```
bcprov-jdk15on-1.56.jar: ids:(org.bouncycastle:bcprov-jdk15on:1.56, cpe:/a:bouncycastle:legion-of-the-bouncy-castle-java-crytography-api:1.56) : CVE-2017-13098, CVE-2... | 2019/02/12 | [
"https://Stackoverflow.com/questions/54653400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279023/"
] | So the answer from Carsten is absolutely correct but it doesn't explain how to handle this in CI Builds for example.
You have two options which both work. You can exclude the `lintClassPath` from the dependency check or you define `releaseCompileClasspath` as the only module configuration to check. I'd recommend the f... | Those files are used by the Android build system. That's why they get reported even on an "empty" project.
Check the dependency tree to see where those files are used: `./gradlew app:dependencies`
```
...
lintClassPath - The lint embedded classpath
\--- com.android.tools.lint:lint-gradle:26.4.1
+--- com.android.... |
54,653,400 | I want to resolve every CVE issues from my project. I'm using `org.owasp.dependencycheck` plugin, but even on an empty project it returns few CVE's:
```
bcprov-jdk15on-1.56.jar: ids:(org.bouncycastle:bcprov-jdk15on:1.56, cpe:/a:bouncycastle:legion-of-the-bouncy-castle-java-crytography-api:1.56) : CVE-2017-13098, CVE-2... | 2019/02/12 | [
"https://Stackoverflow.com/questions/54653400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3279023/"
] | So the answer from Carsten is absolutely correct but it doesn't explain how to handle this in CI Builds for example.
You have two options which both work. You can exclude the `lintClassPath` from the dependency check or you define `releaseCompileClasspath` as the only module configuration to check. I'd recommend the f... | I solve the problem by adding lintClassPath to the dependencies
```
dependencies {
...
lintClassPath "org.bouncycastle:bcpkix-jdk15on:1.64"
}
```
It's late but I hope this helps you. |
24,489,135 | I'm working whith EXTJS, and i need to modify the style of xtype: 'textarea'.
So what i'm using (which works perfectly for xtype: 'textfield') is this :
```
Ext.getCmp('idOfComponent').getTargetEl().down('input').setStyle('border-width', '0px');
```
The problem is that in the case of a textarea, this code : Ext.get... | 2014/06/30 | [
"https://Stackoverflow.com/questions/24489135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2938581/"
] | You have to use `.down('textarea')` instead. | down() method is a Container's method which should be invoked directly on the Container objects viz (Panels, Windows etc). You're trying to invoke down() method on a Ext.dom.Element class where you should be using select(), hence it does not work. Try changing it to the following.
```
Ext.getCmp('idOfComponent').el.se... |
1,230,780 | Yes, I know there is [MonoDevelop](http://monodevelop.com/). But what if I want to use [Textmate](http://macromates.com/) instead?
So my question here is aimed at the .Net developer who has developed some C# applications using Textmate. I'm curious as to what their process/workflow is with this setup.
* What is the b... | 2009/08/05 | [
"https://Stackoverflow.com/questions/1230780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5716/"
] | To be honest I still do my actual C# building through a Virtual Machine running Windows, but I edit anything that I can through Textmate.
I use the [ASP.Net VB.Net](http://svn.textmate.org/trunk/Bundles/ASP_vb_NET.tmbundle/) tmbundle and I actually just discovered a [C#](http://svn.textmate.org/trunk/Review/Bundles/C%2... | I know this is an old question, but I found it along the way when trying to find a C# bundle for TextMate.
The C# bundle has moved from the macromoates svn repos into github at <https://github.com/wintermi/csharp-tmbundle>.
Hopefully this helps other people looking for the bundle. |
237,169 | Here is the blend file:[](https://blend-exchange.com/b/wLDYGklq/)
So I've been looking everywhere for a way to make this bottle and nozzle cap look as close to the real version as possible. I've used many different node setups I've found online to see it on my... | 2021/09/03 | [
"https://blender.stackexchange.com/questions/237169",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/124401/"
] | I think you can get away with a much simpler node setup. Try something like this:
[](https://i.stack.imgur.com/cPKCj.png) | Tried @Christopher's solutions and the shader looks good to me. I made my own approach:
[](https://i.stack.imgur.com/ZK9Vf.jpg)
* I used a Principled shader, see image
* I changed the model a bit, reduced the thickness of the bottle and scaled the fl... |
237,169 | Here is the blend file:[](https://blend-exchange.com/b/wLDYGklq/)
So I've been looking everywhere for a way to make this bottle and nozzle cap look as close to the real version as possible. I've used many different node setups I've found online to see it on my... | 2021/09/03 | [
"https://blender.stackexchange.com/questions/237169",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/124401/"
] | [](https://i.stack.imgur.com/JlFyi.png)
I think for the proper plastic, you play with mixes here of translucency volume scatter and glass. for glass the ior has a huge effect on the reflections (remind plastic has higher IOR usually).
But also importa... | Tried @Christopher's solutions and the shader looks good to me. I made my own approach:
[](https://i.stack.imgur.com/ZK9Vf.jpg)
* I used a Principled shader, see image
* I changed the model a bit, reduced the thickness of the bottle and scaled the fl... |
46,373,554 | I have a dataset, where the column 'workclass' has the following values:
[](https://i.stack.imgur.com/wADpQ.png)
Now it seems to me that the value 'privat' is really the same as 'Private' and so I would like to change it accordingly
If I run the fol... | 2017/09/22 | [
"https://Stackoverflow.com/questions/46373554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5055821/"
] | With Cloud Functions, HTTPS type functions are obliged to write a result to the client to indicate that the function is done executing. Until a result is written, the function is assumed to still be running something asynchronous work.
So, when your request is complete, you should be sending some response, even if it'... | HTTPS functions don't complete until you send something on the response. Here's an example that just pipes the content from the proxied request as the output (I had to change the name of the variables to avoid shadowing:
```
exports.helloWorld = functions.https.onRequest((req, res) => {
request.get('http://www.googl... |
2,201,113 | Given that we have $N$ consecutive structures that can have a maximum height of $H$, where the individual height $h\_i$ depends on random coin flips (for each structure, an additional height has a probability of 0.5. The probability is given by $p(h\_i=x) = 0.5^{x + 1}$, except when $x=H$, then we get $p(h\_i=x)=0.5^H$... | 2017/03/24 | [
"https://math.stackexchange.com/questions/2201113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/428872/"
] | I'm still looking for a closed form for the probability, but in the mean time, the following recursive Visual Basic code computes the probability:
```
Function PS(H As Integer, N As Integer, hs As Integer) As Double
Dim i As Integer
PS = 0
For i = 0 To hs
If N = 1 Then
PS = PS + PH(H, i)
Else
P... | An alternative way of viewing things:
Initially, we start with all buildings at height $0$. Then we flip a coin for each building. The ones that come up tails, we stop their growth. The ones that come up heads, we grow by $1$ and flip another coin. We continue this process for $H$ steps.
Let $f(n,H)$ be the probabil... |
49,535,398 | I have been using momentJS to detect the future date without day. Here is my code and result:
```
moment('09/2010').isBefore(moment().format('MM/YYYY'), 'day')
```
I'm getting result as `false`. But I'm supposed to get `true`. Is I'm doing wrong ? | 2018/03/28 | [
"https://Stackoverflow.com/questions/49535398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3916953/"
] | Your input (`'09/2010'`) is not in recognized format (ISO 8601 or RFC 2822) so you have to use [`moment(String, String)`](http://momentjs.com/docs/#/parsing/string-format/).
You can use [`startOf('month')`](http://momentjs.com/docs/#/manipulating/start-of/) to get a moment object for the start of the current month.
`... | You have **`moment('09/2010')`** without format it doesn't make sense. you have to provide a **format** for this date like **`moment('09/2010', 'MM/YYYY')`**.
You should see below code:
```
if(moment('09/2010', 'MM/YYYY').isBefore(moment().startOf('month'),'day')){
/*
* Do something here
*/
return ... |
72,602,928 | When I click start I get this error
```none
2:30:55 PM [Apache] Problem detected!
2:30:55 PM [Apache] Port 80 in use by "Unable to open process" with PID 4!
2:30:55 PM [Apache] Apache WILL NOT start without the configured ports free!
2:30:55 PM [Apache] You need to uninstall/disable/reconfigure the blo... | 2022/06/13 | [
"https://Stackoverflow.com/questions/72602928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19126561/"
] | There is a section in the internal documentation under `/documentation/product/slate/writeback-foundry` hinting at passing the pagination offset value as the page token. This means that it can be a changing integer value. No need to prefix by parsing the previous pagingToken. Example:
```
"{{w_tableWidget.gridOptions.... | For case 1:
>
> In the case there is an existing valid page token from the first page
> query?
>
>
>
you need to change the last number of the token `v1.abc-some-uuid-xyz.10`
-> this gives you the second 10 items ( 10 to 19).
you should reach the page with items no. 40 to 49 with this token `v1.abc-some-uuid-xyz... |
71,224,971 | Let's say I have five int variables that are prompted for user input. User keys in the five value and two of those values are 0. I would like to ONLY print out values that are greater than zero.
```
int v1 = 1;
int v2 = 30;
int v3 = 0;
int v4 = 37;
int v5 = 0;
```
I would like to write a dynamic print statement that... | 2022/02/22 | [
"https://Stackoverflow.com/questions/71224971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18280226/"
] | Create a new method `printNonZeroVars(Integer... ints)`.
```
public static void main(String[] args) {
int v1 = 1;
int v2 = 30;
int v3 = 0;
int v4 = 37;
int v5 = 0;
printNonZeroVars(v1, v2, v3, v4, v5)
}
public void printNonZeroVars(int... ints) {
for (int i = 0; i < ints.length; i++) {
if (ints[i] ... | I would use an array.
Iterate over the array and with an if you can check whether your current value is 0. |
71,224,971 | Let's say I have five int variables that are prompted for user input. User keys in the five value and two of those values are 0. I would like to ONLY print out values that are greater than zero.
```
int v1 = 1;
int v2 = 30;
int v3 = 0;
int v4 = 37;
int v5 = 0;
```
I would like to write a dynamic print statement that... | 2022/02/22 | [
"https://Stackoverflow.com/questions/71224971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18280226/"
] | Create a new method `printNonZeroVars(Integer... ints)`.
```
public static void main(String[] args) {
int v1 = 1;
int v2 = 30;
int v3 = 0;
int v4 = 37;
int v5 = 0;
printNonZeroVars(v1, v2, v3, v4, v5)
}
public void printNonZeroVars(int... ints) {
for (int i = 0; i < ints.length; i++) {
if (ints[i] ... | So a simple way of achieving this would be to use some sort of Array/List.
```
ArrayList<Integer> list = new ArrayList<Integer>()
// Or as pointed out by David a better way would be to declare the list as
List<Integer> list = new ArrayList<>();
list.add(5);
list.add(1);
list.add(0);
....
```
Once you have the list y... |
17,386 | The following is from [JIRA](https://www.atlassian.com/agile/delivery-vehicles/):
>
> User stories are sketched out by the product owner, then the full
> product team collectively decide the more detailed requirements.
>
>
> These are the granular pieces of work that help define the
> implementation items for the... | 2016/02/07 | [
"https://pm.stackexchange.com/questions/17386",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/21062/"
] | Jira is just a tool, don't let it dictate your process. Instead, decide how you will do your work and then figure out how to make Jira work to your needs.
**Acceptance Criteria:** You should always use these. They are critical to an effective User Story. Without the AC you don't have a way to measure if the customer ... | **User stories**
They are requirements from user's perspective.
As team discuss the requirements, they will identify the various tasks that need to develop and deliver it.
**Story and Tasks**
You may find it easier to break down a story into tasks/sub tasks to represent the UI, business logic, database tasks if you... |
17,386 | The following is from [JIRA](https://www.atlassian.com/agile/delivery-vehicles/):
>
> User stories are sketched out by the product owner, then the full
> product team collectively decide the more detailed requirements.
>
>
> These are the granular pieces of work that help define the
> implementation items for the... | 2016/02/07 | [
"https://pm.stackexchange.com/questions/17386",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/21062/"
] | Jira is just a tool, don't let it dictate your process. Instead, decide how you will do your work and then figure out how to make Jira work to your needs.
**Acceptance Criteria:** You should always use these. They are critical to an effective User Story. Without the AC you don't have a way to measure if the customer ... | User stories and tasks are different things.
The user story and acceptance criteria answer the who, what, why questions and describe the work in terms of business value to a specific user.
Tasks are implementation details that answer the how questions.
Most tools like Jira, Rally, VersionOne have multiple ways of st... |
17,386 | The following is from [JIRA](https://www.atlassian.com/agile/delivery-vehicles/):
>
> User stories are sketched out by the product owner, then the full
> product team collectively decide the more detailed requirements.
>
>
> These are the granular pieces of work that help define the
> implementation items for the... | 2016/02/07 | [
"https://pm.stackexchange.com/questions/17386",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/21062/"
] | **User stories**
They are requirements from user's perspective.
As team discuss the requirements, they will identify the various tasks that need to develop and deliver it.
**Story and Tasks**
You may find it easier to break down a story into tasks/sub tasks to represent the UI, business logic, database tasks if you... | User stories and tasks are different things.
The user story and acceptance criteria answer the who, what, why questions and describe the work in terms of business value to a specific user.
Tasks are implementation details that answer the how questions.
Most tools like Jira, Rally, VersionOne have multiple ways of st... |
28,346,065 | I have a standard 2x2 table
```
Yes No
Yes a b
No c d
```
I want to create a condition whereby IF(a or b or c or d = 0) then 0.5 is added on to each of the cells a,b,c,d.
I have tried this:
```
if(a && b && c && d == 0){
a=a+0.5, b=b+0.5, c=c+0.5, d=d+0.5
}
```
But I am getting an er... | 2015/02/05 | [
"https://Stackoverflow.com/questions/28346065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4278119/"
] | In R you can't use `,` to separate line, but you can use `;`.
Also, the way you are doing considers `a,b and c` are boolean (`TRUE/FALSE`), which is not the case as they are numbers. Your condition should be :
```
if (a == 0 || b == 0 || c == 0 || d == 0)
```
Note that your code will run nevertheless, even if `a,b ... | The problem is with the commas that separate your variables. R syntax does not allow you to do it. Write it this way:
```
if (a && b && c && d == 0){
a=a+0.5
b=b+0.5
c=c+0.5
d=d+0.5
}
```
Another problem is that the behaviour you described does not match with your code. If you write && it means and, ... |
43,084,071 | Okay, so I'm trying to create a linked list of items by adding them one by one onto the end, and I also wanna print out the results.
I'm only showing part of my code (the part that I need work on), so ignore all the libraries that I'm not really making use of in this snippet:
```
#include <string>
#include <iostream... | 2017/03/29 | [
"https://Stackoverflow.com/questions/43084071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7782833/"
] | If the list is empty then `head->next` will be NULL, yet you say `head->next = addOn;`. Shouldn't it be `head = addOn;` ?
In fact this whole block of code is rubbish:
```
if ( IsEmpty() ) {
// head and tail are both null so both of these lines
// invoke undefined behavior (you cant say NULL->field = something... | I recommend that you single step in a debugger and see exactly which value is null when you crash. The debugger will show you every value at each step in your code. I've been programming for over 30 years and I single step through my code every day. |
15,621,394 | **The Problem**
Error when going to a specific page (in local debug): CS0012: The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Here are the referenced li... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15621394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1800789/"
] | This worked for me:
* Navigate to the web project's References node
* Find the reference to System.Data.Linq
* Open the VS Properties Window
* In the properties window, change Copy Local: False to True
Before this, the System.Data.Linq.dll was not being copied into the bin directory. (Copying it manually into the bi... | Try to add `@using System.Data.Linq` at the top of your problem view and
`<add namespace="System.Data.Linq" />` into `<pages>` section of web.config in your **Views** folder. |
15,621,394 | **The Problem**
Error when going to a specific page (in local debug): CS0012: The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Here are the referenced li... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15621394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1800789/"
] | This worked for me:
* Navigate to the web project's References node
* Find the reference to System.Data.Linq
* Open the VS Properties Window
* In the properties window, change Copy Local: False to True
Before this, the System.Data.Linq.dll was not being copied into the bin directory. (Copying it manually into the bi... | MVC cannot compile your view on the fly. It looks like your view contains a reference to a DataContext. Adding a reference in web.config should tell the compiler to look for the file:
```
<configuration>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Vers... |
54,544,267 | I'm trying to do the same thing as [this question](https://stackoverflow.com/questions/9833853/check-if-parent-element-contains-certain-child-element-using-jquery) but my parent element does not have an id. It does have a class through. Basically I have multiple elements of the same class and some have a child element.... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54544267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8358881/"
] | You can store the objects in a `Map` and use `Map.get(<instructor name>)` to get the corresponding object and `Map.set()` to set or modify the object.
```js
const data = [{"Instructor":"Gondree, Mark","Class":"CS 349","Section":"001","Components":["ACT"],"Title":"Problem Solving in a Team Envn","WTU":1.3,"Units":"1","... | use map on the array (arr stands for original array) of objects and create new array of objects after deleting 'x.Instructor'
```
let new_arr = arr.map(x => ({
[x.Instructor]: (() => {
delete x.Instructor;
return x;
})()
}))
console.log('arr :', arr);
console.log('new_arr :', new_arr);
``` |
54,544,267 | I'm trying to do the same thing as [this question](https://stackoverflow.com/questions/9833853/check-if-parent-element-contains-certain-child-element-using-jquery) but my parent element does not have an id. It does have a class through. Basically I have multiple elements of the same class and some have a child element.... | 2019/02/05 | [
"https://Stackoverflow.com/questions/54544267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8358881/"
] | You just need to create an array of objects like this:
```
let instructors = [
{ Instructor: 'Gondree, Mark', Class: 'CS 349', Section: '001', Components: [ 'ACT' ], Title: 'Problem Solving in a Team Envn', WTU: 1.3, Units: '1', Meeting_Days: 'F', Time: '10:00:00 - 11:50:00', Room: 'STEV1034', Enrollment: 22, FTE:... | use map on the array (arr stands for original array) of objects and create new array of objects after deleting 'x.Instructor'
```
let new_arr = arr.map(x => ({
[x.Instructor]: (() => {
delete x.Instructor;
return x;
})()
}))
console.log('arr :', arr);
console.log('new_arr :', new_arr);
``` |
58,922,013 | `$$f_n(x)=\pi(x)\pi(n-x)$$`
I want to write a program that tells me the distinct values of `$f_n(x)$` for each $n=2,3,4,...,N$ where `$\pi(x)$` is the prime counting function. Here are the first few distinct values:
S={0,0,1,1,2,2,3,2,4,3,4,3,5,4,5,4,6,5,7,5,8,5,7,5,8,7,...}.
How can I write such a program?
I tried... | 2019/11/18 | [
"https://Stackoverflow.com/questions/58922013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11177740/"
] | In `R`, you need the package `primes` and then can define your prime-count function $\pi(x)$ as below:
```
PIx <- Vectorize(function(x) length(generate_primes(max = x)),vectorize.args = "x")
```
For instance, given an input vector `v<-c(0,1,4.5,6.1,10)`, then `PIx(v)` gives:
```
> PIx(v)
[1] 0 0 2 3 4
```
Then fo... | Further to your clarification
```
f[n_, x_] := PrimePi[x]*PrimePi[n - x]
green = {#, PrimePi[#]} & /@ Range[2, 70];
blue = Map[Function[n,
{n, Length[DeleteCases[Union[f[n, #] & /@ Range[2, 70]], 0]]}],
Range[2, 70]];
ListPlot[{blue, green}, PlotStyle -> {Blue, Green}, AxesLabel -> {"n", None},
PlotMarkers ->... |
55,723 | I'm doing an extensive write-up project, and I'm stumped for how an alien species similar to the human analogue morphology (Two Arms, Two Legs, and Plantigrade-Bipedal standing/maneuvering) should be called. I don't want to go for Humanoid, because that's to on the nose and too humancentric for the type of setting I'm ... | 2021/04/28 | [
"https://writers.stackexchange.com/questions/55723",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/49678/"
] | Many, many science fiction writers, biologists, and anthropologists have come up with some creative words and terminology for bipedal creatures that aren't strictly humanoid. Maybe one of them will give you some inspiration. (You can check out ["List of fictional extraterrestrials"](https://en.wikipedia.org/wiki/List_o... | The proper description for a creature that moves on two legs is a biped. Bipedaloid does not make sense as the -oid means "like or resembling (but not exactly the same)". Thus a Vulcan is a humaniod because it has features that resemble a human, but are not the same as humans. Vulcans are not "bipedaloids" because they... |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | Instead of `append()` use `html()` it will replace the content of div.
```
$(".AccountGridHolder").html(Table1);
``` | Try using .html() instead of .append()
```
$(".AccountGridHolder").html(Table1);
``` |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | Your selector is wrong. It should be `$('#AccountGrid')` if you want to match by id. | Instead of `append()` use `html()` it will replace the content of div.
```
$(".AccountGridHolder").html(Table1);
``` |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | Your selector is wrong. It should be `$('#AccountGrid')` if you want to match by id. | Try using .html() instead of .append()
```
$(".AccountGridHolder").html(Table1);
``` |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | ```
$(".AccountGridHolder").empty();
$(".AccountGridHolder").append(Table1);
```
is equivalent to
```
$(".AccountGridHolder").html(Table1);
```
So why to write two lines instead of one ? Go for the latter. | Try using .html() instead of .append()
```
$(".AccountGridHolder").html(Table1);
``` |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | Well I am not sure why but when I moved the empty() line it started to work... here is my code now
```
function GetAcount() {
var CompanyID = get_localstorage("CompanyID");
source:
{
$.ajax({
crossDomain: true,
url: "https://we... | Try using .html() instead of .append()
```
$(".AccountGridHolder").html(Table1);
``` |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | Your selector is wrong. It should be `$('#AccountGrid')` if you want to match by id. | ```
$(".AccountGridHolder").empty();
$(".AccountGridHolder").append(Table1);
```
is equivalent to
```
$(".AccountGridHolder").html(Table1);
```
So why to write two lines instead of one ? Go for the latter. |
23,273,913 | I am using jquery to populate a div with a table with data from a web service but I noticed that If I reloaded the page the div was not being over written but appended to. I looked up the jquery .empty() function but it does not seem to be working for me
here is a sample of my code:
The Div tag
```
<div id="AccountG... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23273913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1182715/"
] | Your selector is wrong. It should be `$('#AccountGrid')` if you want to match by id. | Well I am not sure why but when I moved the empty() line it started to work... here is my code now
```
function GetAcount() {
var CompanyID = get_localstorage("CompanyID");
source:
{
$.ajax({
crossDomain: true,
url: "https://we... |
32,075 | This weekend my wife decided to clean up my office. When she pulled the old filing cabinet away from the way, she noticed the baseboards and carpet carpet were showing signs of water damage.
It's a problem I have seen on the opposite side of the house, in our master closet, where I installed a wooden glue-down floor. ... | 2013/09/23 | [
"https://diy.stackexchange.com/questions/32075",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/15243/"
] | If you don't have gutters and the grading around your house isn't sloped away, I'd start there. It's relatively cheap to do and will eliminate most problems. It's also nice, if you have a door at the bottom of a roof edge, to not enter under a waterfall.
Once you've done that (or if it's not possible to fix the gradin... | There is a product called Radonseal that does a fine job of stopping water wicking or seeping through concrete or cinder block if you can get to the surface of the concrete or cinder block. Note that the concrete/cinderblock surface must be cleared of any previous sealing. The Radonseal website provides a great deal of... |
363,227 | I'm trying to do some questions on the Chinese remainder theorem, I've being reading the Wikipedia explanation but I still don't get it. Can someone explain it to me, please?
Here is the question I'm working with. If you have a simpler example, that would be great.
>
> Find an integer $x$ such that $x\equiv2\bmod5$,... | 2013/04/16 | [
"https://math.stackexchange.com/questions/363227",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/46389/"
] | Considering $x \equiv 1$ (mod 13) and $x \equiv 5$ (mod 17), we get $x = 1 + 13a$ and $x = 5 + 17b$. So, $1+13a=5+17b$.
So, by letting $a=a'-1$ and $b=b'-1$, we get $x = -12 + 13a' = -12 + 17b'$, $x \equiv -12$ (mod $13\times17$). ie. $x\equiv -12$ (mod 221)
Considering $x\equiv -12$ (mod 221) and $x \equiv 2$ (mod 5... | I'd do it as follows (which is, basically, one of the most usual proofs of the CRT): we have the coprime (primes, in fact) integers $5,13,17$:
$$(1)\;\;\;\text{solve}\;\; 13\cdot 17y\_5=1\pmod 5:\;\;\;\color{red}5\cdot(-44)+\color{red}{13\cdot 17}\cdot1=1\;\;\;\implies \color{blue}{y\_5=1}$$
$$(2)\;\;\;\;\text{solve}... |
363,227 | I'm trying to do some questions on the Chinese remainder theorem, I've being reading the Wikipedia explanation but I still don't get it. Can someone explain it to me, please?
Here is the question I'm working with. If you have a simpler example, that would be great.
>
> Find an integer $x$ such that $x\equiv2\bmod5$,... | 2013/04/16 | [
"https://math.stackexchange.com/questions/363227",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/46389/"
] | Considering $x \equiv 1$ (mod 13) and $x \equiv 5$ (mod 17), we get $x = 1 + 13a$ and $x = 5 + 17b$. So, $1+13a=5+17b$.
So, by letting $a=a'-1$ and $b=b'-1$, we get $x = -12 + 13a' = -12 + 17b'$, $x \equiv -12$ (mod $13\times17$). ie. $x\equiv -12$ (mod 221)
Considering $x\equiv -12$ (mod 221) and $x \equiv 2$ (mod 5... | $$\begin{align}
x &\equiv 2 \pmod5 \\
x &\equiv 1 \pmod{13} \\
x &\equiv 5 \pmod{17}
\end{align}$$
---
This is not the fastest way; but it is the most straightforward way. This method only works when the moduli are pairwise prime:
$$\gcd(5,13) = \gcd(5,17) = \gcd(13,17) = 1$$
We start with $ x \equiv 2 \pmod5$. ... |
363,227 | I'm trying to do some questions on the Chinese remainder theorem, I've being reading the Wikipedia explanation but I still don't get it. Can someone explain it to me, please?
Here is the question I'm working with. If you have a simpler example, that would be great.
>
> Find an integer $x$ such that $x\equiv2\bmod5$,... | 2013/04/16 | [
"https://math.stackexchange.com/questions/363227",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/46389/"
] | It's easier than usual because an evident [constant-case optimization of CRT exists.](https://math.stackexchange.com/a/142682/23500) Notice that $\rm\ x \equiv 1\equiv \color{#0a0}{-12}\:\ (mod\ 13),\:$ and $\rm\:x\equiv 5\equiv \color{#0a0}{-12}\ \: (mod\ 17),\:$ so $\rm\:13,17\mid x\!+\!\color{#0a0}{12},\:$ so $\rm\:... | I'd do it as follows (which is, basically, one of the most usual proofs of the CRT): we have the coprime (primes, in fact) integers $5,13,17$:
$$(1)\;\;\;\text{solve}\;\; 13\cdot 17y\_5=1\pmod 5:\;\;\;\color{red}5\cdot(-44)+\color{red}{13\cdot 17}\cdot1=1\;\;\;\implies \color{blue}{y\_5=1}$$
$$(2)\;\;\;\;\text{solve}... |
363,227 | I'm trying to do some questions on the Chinese remainder theorem, I've being reading the Wikipedia explanation but I still don't get it. Can someone explain it to me, please?
Here is the question I'm working with. If you have a simpler example, that would be great.
>
> Find an integer $x$ such that $x\equiv2\bmod5$,... | 2013/04/16 | [
"https://math.stackexchange.com/questions/363227",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/46389/"
] | It's easier than usual because an evident [constant-case optimization of CRT exists.](https://math.stackexchange.com/a/142682/23500) Notice that $\rm\ x \equiv 1\equiv \color{#0a0}{-12}\:\ (mod\ 13),\:$ and $\rm\:x\equiv 5\equiv \color{#0a0}{-12}\ \: (mod\ 17),\:$ so $\rm\:13,17\mid x\!+\!\color{#0a0}{12},\:$ so $\rm\:... | $$\begin{align}
x &\equiv 2 \pmod5 \\
x &\equiv 1 \pmod{13} \\
x &\equiv 5 \pmod{17}
\end{align}$$
---
This is not the fastest way; but it is the most straightforward way. This method only works when the moduli are pairwise prime:
$$\gcd(5,13) = \gcd(5,17) = \gcd(13,17) = 1$$
We start with $ x \equiv 2 \pmod5$. ... |
363,227 | I'm trying to do some questions on the Chinese remainder theorem, I've being reading the Wikipedia explanation but I still don't get it. Can someone explain it to me, please?
Here is the question I'm working with. If you have a simpler example, that would be great.
>
> Find an integer $x$ such that $x\equiv2\bmod5$,... | 2013/04/16 | [
"https://math.stackexchange.com/questions/363227",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/46389/"
] | I'd do it as follows (which is, basically, one of the most usual proofs of the CRT): we have the coprime (primes, in fact) integers $5,13,17$:
$$(1)\;\;\;\text{solve}\;\; 13\cdot 17y\_5=1\pmod 5:\;\;\;\color{red}5\cdot(-44)+\color{red}{13\cdot 17}\cdot1=1\;\;\;\implies \color{blue}{y\_5=1}$$
$$(2)\;\;\;\;\text{solve}... | $$\begin{align}
x &\equiv 2 \pmod5 \\
x &\equiv 1 \pmod{13} \\
x &\equiv 5 \pmod{17}
\end{align}$$
---
This is not the fastest way; but it is the most straightforward way. This method only works when the moduli are pairwise prime:
$$\gcd(5,13) = \gcd(5,17) = \gcd(13,17) = 1$$
We start with $ x \equiv 2 \pmod5$. ... |
6,697,735 | I'm using SQL Server and I've been developing a stored procedure to rename (actually, add a prefix in its name) other stored procedures. I have been trying to do this but I don't know why I'm getting this error.
Take a look at my code:
```
DECLARE @_currentProcedure AS VARCHAR(300)
DECLARE @_newProcedure AS VARCHAR(... | 2011/07/14 | [
"https://Stackoverflow.com/questions/6697735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/316799/"
] | Well that `GO` should be at end .. that is it should be
```
BEGIN
EXEC sp_rename @_currentProcedure , @_newProcedure , 'OBJECT'
END
GO
``` | \_newProcedure is set from @Procedure name, so it is missing the brackets and the `dbo.` that you've added to \_currentProcedure.
Try:
```
SET @_newProcedure = '[dbo].[' + @Prefx + @ProcedureName + ']'
``` |
9,213,737 | I have a problem when using CURL to get MJPEG Stream from IP Camera Panasonic.
Here is my code.
```
int _tmain(int argc, _TCHAR* argv[])
{
CURL *curl;
CURLcode res;
/* Minimalistic http request */
char request[1000];
strcpy(request, "GET /nphMotionJpeg?Resolution=640x480&Quality=Standard HTTP/1.1\... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9213737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820212/"
] | [`File.ReadLines`](http://msdn.microsoft.com/en-us/library/dd413383.aspx) (.NET 4.0+) is probably the most memory efficient way to do this.
It returns an `IEnumerable<string>` meaning that lines will get read lazily in a streaming fashion.
Previous versions do not have the streaming option available in this manner, b... | Reading all rows from a file is always at least O(n). When file size starts becoming an issue then its probably a good time to look at creating a database for the information instead of flat files. |
9,213,737 | I have a problem when using CURL to get MJPEG Stream from IP Camera Panasonic.
Here is my code.
```
int _tmain(int argc, _TCHAR* argv[])
{
CURL *curl;
CURLcode res;
/* Minimalistic http request */
char request[1000];
strcpy(request, "GET /nphMotionJpeg?Resolution=640x480&Quality=Standard HTTP/1.1\... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9213737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820212/"
] | [`File.ReadLines`](http://msdn.microsoft.com/en-us/library/dd413383.aspx) (.NET 4.0+) is probably the most memory efficient way to do this.
It returns an `IEnumerable<string>` meaning that lines will get read lazily in a streaming fashion.
Previous versions do not have the streaming option available in this manner, b... | Not sure this is the most efficient, but it works well for me:
<http://msdn.microsoft.com/en-us/library/system.io.fileinfo.aspx>
```
//Declare a new file and give it the path to your file
FileInfo fi1 = new FileInfo(path);
//Open the file and read the text
using (StreamReader sr = fi1.OpenText())
... |
9,213,737 | I have a problem when using CURL to get MJPEG Stream from IP Camera Panasonic.
Here is my code.
```
int _tmain(int argc, _TCHAR* argv[])
{
CURL *curl;
CURLcode res;
/* Minimalistic http request */
char request[1000];
strcpy(request, "GET /nphMotionJpeg?Resolution=640x480&Quality=Standard HTTP/1.1\... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9213737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820212/"
] | [`File.ReadLines`](http://msdn.microsoft.com/en-us/library/dd413383.aspx) (.NET 4.0+) is probably the most memory efficient way to do this.
It returns an `IEnumerable<string>` meaning that lines will get read lazily in a streaming fashion.
Previous versions do not have the streaming option available in this manner, b... | No matter which operating system you're using, there will be several layers between your code and the actual storage mechanism. Hard drives and tape drives store files in blocks, which these days are usually around 4K each. If you want to read one byte, the device will still read the entire block into memory -- it's ju... |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | The standard containers use allocators to seperate allocation/deallocation from construction/destruction. The standard library supplies a single allocator which allocates on the heap.
This code declares an array big enough to hold `SIZE` elements of type `T` with the correct allignment:
```
typedef typename std::tr1:... | What you are looking for is called an [Allocator](http://www.cplusplus.com/reference/std/memory/allocator/). A good overview can be found here: <http://www.codeproject.com/KB/cpp/allocator.aspx> |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | What you are looking for is called an [Allocator](http://www.cplusplus.com/reference/std/memory/allocator/). A good overview can be found here: <http://www.codeproject.com/KB/cpp/allocator.aspx> | Weird, but should work:
```
long long v[size * sizeof(T)/sizeof(long long)+1];
```
This buffer will be alligned on 64 bits.
But better will be allocate memory by `new`.
In any case, if `size` is variable - compiller will allocate memory dynamically through malloc/new (and not on stack).
EDIT: You can't use `std:... |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | What you are looking for is called an [Allocator](http://www.cplusplus.com/reference/std/memory/allocator/). A good overview can be found here: <http://www.codeproject.com/KB/cpp/allocator.aspx> | What I'd probably do is create an array of char (about like you've already considered), but allocate enough space for one more object than you really need. You'll then need to write a bit of code to find the correct alignment for your objects in that space.
The largest alignment requirement for an object is its own si... |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | What you are looking for is called an [Allocator](http://www.cplusplus.com/reference/std/memory/allocator/). A good overview can be found here: <http://www.codeproject.com/KB/cpp/allocator.aspx> | You can use a struct to handle the alignment issue.
```
struct Tbuffer { char data_[ sizeof( T ) ]; }
struct Tbuffer heap[ SIZE ];
``` |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | What you are looking for is called an [Allocator](http://www.cplusplus.com/reference/std/memory/allocator/). A good overview can be found here: <http://www.codeproject.com/KB/cpp/allocator.aspx> | How I probably will do it (after looking on EASTL fixed\_vector implementation):
```
PRAGMA_PRE_ALIGN(sizeof(T)) char[SIZE * sizeof(T)]; PRAGMA_POST_ALIGN(sizeof(T))
```
...and implement compiler specific PRAGMA\_PRE\_ALIGN and PRAGMA\_POST\_ALIGN macros, that insert the correct #pragmas.
Unfortunately, boost and t... |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | The standard containers use allocators to seperate allocation/deallocation from construction/destruction. The standard library supplies a single allocator which allocates on the heap.
This code declares an array big enough to hold `SIZE` elements of type `T` with the correct allignment:
```
typedef typename std::tr1:... | Weird, but should work:
```
long long v[size * sizeof(T)/sizeof(long long)+1];
```
This buffer will be alligned on 64 bits.
But better will be allocate memory by `new`.
In any case, if `size` is variable - compiller will allocate memory dynamically through malloc/new (and not on stack).
EDIT: You can't use `std:... |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | The standard containers use allocators to seperate allocation/deallocation from construction/destruction. The standard library supplies a single allocator which allocates on the heap.
This code declares an array big enough to hold `SIZE` elements of type `T` with the correct allignment:
```
typedef typename std::tr1:... | What I'd probably do is create an array of char (about like you've already considered), but allocate enough space for one more object than you really need. You'll then need to write a bit of code to find the correct alignment for your objects in that space.
The largest alignment requirement for an object is its own si... |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | The standard containers use allocators to seperate allocation/deallocation from construction/destruction. The standard library supplies a single allocator which allocates on the heap.
This code declares an array big enough to hold `SIZE` elements of type `T` with the correct allignment:
```
typedef typename std::tr1:... | You can use a struct to handle the alignment issue.
```
struct Tbuffer { char data_[ sizeof( T ) ]; }
struct Tbuffer heap[ SIZE ];
``` |
2,273,380 | I am writing a memory-managing template class in which I want to create a C-style array of fixed size, to serve as a heap. I keep the objects stored in an array like this:
```
T v[SIZE];
```
As this only serves the role as a heap that can hold T objects, I don't want the T default constructor to get automatically ca... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | The standard containers use allocators to seperate allocation/deallocation from construction/destruction. The standard library supplies a single allocator which allocates on the heap.
This code declares an array big enough to hold `SIZE` elements of type `T` with the correct allignment:
```
typedef typename std::tr1:... | How I probably will do it (after looking on EASTL fixed\_vector implementation):
```
PRAGMA_PRE_ALIGN(sizeof(T)) char[SIZE * sizeof(T)]; PRAGMA_POST_ALIGN(sizeof(T))
```
...and implement compiler specific PRAGMA\_PRE\_ALIGN and PRAGMA\_POST\_ALIGN macros, that insert the correct #pragmas.
Unfortunately, boost and t... |
45,238,746 | Why does this give a compile error?
```
val autoClosable = MyAutoClosable()
var myVar: MyType
autoClosable.use {
myVar= it.foo()
}
println(myVar) // Error: Variable 'myVar' must be initialized
```
Maybe the compiler just sees `{ myVar= it.foo() }` as a function that is passed to another function and has no knowl... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45238746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443836/"
] | Since `use { ... }` is not a language construct but [is just a library function](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/use.html), the compiler doesn't know (and, currently, does not make effort to prove) that the lambda you pass is **ever executed**. Therefore the usage of the variable that might not b... | In case an exception occurs while executing `it.foo()`, the `use` block will catch the exception, close your `autoClosable`, and then return. In this case, `myVar` will be left uninitialized.
This is why the compiler won't let you do what you're trying to do. |
45,238,746 | Why does this give a compile error?
```
val autoClosable = MyAutoClosable()
var myVar: MyType
autoClosable.use {
myVar= it.foo()
}
println(myVar) // Error: Variable 'myVar' must be initialized
```
Maybe the compiler just sees `{ myVar= it.foo() }` as a function that is passed to another function and has no knowl... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45238746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443836/"
] | Since `use { ... }` is not a language construct but [is just a library function](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/use.html), the compiler doesn't know (and, currently, does not make effort to prove) that the lambda you pass is **ever executed**. Therefore the usage of the variable that might not b... | This is because `use` is an **inline function**, which means the lambda body will be inlined to the call-site function, and the actual type of the variable `myVar` depends on its context.
**IF** the `myVar` is used in lambda for reading, the the type is `MyType` or its supertype. for example:
```
// v--- the act... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.