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 |
|---|---|---|---|---|---|
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | You would need to extend KeyedDecodingContainer and add an implementation for Decimal.Type.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: str... | That decoding strategy has nothing to do with numbers being represented as strings. What you need to do is to implement `init(from:)` and convert from string there
```
class MyClass : Codable {
var decimal: Double?
enum CodingKeys: String, CodingKey {
case decimal = "test"
}
required init(fro... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | ```
struct Root: Codable {
let decimal: Decimal
}
```
---
```
extension Root {
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
decimal = try Decimal(string: container.decode(String.self, forKey: .decimal)) ?? .zero
}
}
```
---
... | The type should be Double and define also in the parsing as Double. Swift will figure out the rest
```
struct MyClass: Decodable {
let decimal: Double
//can be renamed to follow the API name.
enum CodingKeys: String, CodingKey {
case decimal
}
}
extension MyClass {... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | You would need to extend KeyedDecodingContainer and add an implementation for Decimal.Type.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: str... | I just add the following code.
It supports optional as well.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: stringValue) else {
let context = Dec... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | ```
struct Root: Codable {
let decimal: Decimal
}
```
---
```
extension Root {
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
decimal = try Decimal(string: container.decode(String.self, forKey: .decimal)) ?? .zero
}
}
```
---
... | I believe that a cleaner solution is declare value not like a string but like a value:
```
"test": 0.007
```
having a struct like that:
```
struct Stuff {
var test: Decimal
}
```
and then:
```
let decoder = JSONDecoder()
let stuff = try decoder.decode(Stuff.self, from: json)
```
otherwise you can use t... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | ```
struct Root: Codable {
let decimal: Decimal
}
```
---
```
extension Root {
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
decimal = try Decimal(string: container.decode(String.self, forKey: .decimal)) ?? .zero
}
}
```
---
... | I just add the following code.
It supports optional as well.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: stringValue) else {
let context = Dec... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | You would need to extend KeyedDecodingContainer and add an implementation for Decimal.Type.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: str... | The type should be Double and define also in the parsing as Double. Swift will figure out the rest
```
struct MyClass: Decodable {
let decimal: Double
//can be renamed to follow the API name.
enum CodingKeys: String, CodingKey {
case decimal
}
}
extension MyClass {... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | I just add the following code.
It supports optional as well.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: stringValue) else {
let context = Dec... | That decoding strategy has nothing to do with numbers being represented as strings. What you need to do is to implement `init(from:)` and convert from string there
```
class MyClass : Codable {
var decimal: Double?
enum CodingKeys: String, CodingKey {
case decimal = "test"
}
required init(fro... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | I just add the following code.
It supports optional as well.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: stringValue) else {
let context = Dec... | I believe that a cleaner solution is declare value not like a string but like a value:
```
"test": 0.007
```
having a struct like that:
```
struct Stuff {
var test: Decimal
}
```
and then:
```
let decoder = JSONDecoder()
let stuff = try decoder.decode(Stuff.self, from: json)
```
otherwise you can use t... |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=get... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | You would need to extend KeyedDecodingContainer and add an implementation for Decimal.Type.
```
extension KeyedDecodingContainer {
func decode(_ type: Decimal.Type, forKey key: K) throws -> Decimal {
let stringValue = try decode(String.self, forKey: key)
guard let decimalValue = Decimal(string: str... | I believe that a cleaner solution is declare value not like a string but like a value:
```
"test": 0.007
```
having a struct like that:
```
struct Stuff {
var test: Decimal
}
```
and then:
```
let decoder = JSONDecoder()
let stuff = try decoder.decode(Stuff.self, from: json)
```
otherwise you can use t... |
33,459,558 | So I am relatively new with using Google Maps and I have no idea what I am doing wrong. As I am following [Google Maps - iOS documentation](https://developers.google.com/maps/documentation/ios-sdk/map#accessibility). Under the subtitle of Camera Position I have used this block of code:
```
- (void)mapView:(GMSMapView ... | 2015/11/01 | [
"https://Stackoverflow.com/questions/33459558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4137154/"
] | Try like this
```
UPDATE employee
SET Salary=
CASE WHEN Salary < 10000 THEN Salary + 500
CASE WHEN Salary >= 10000 and Salary < 20000 then Salary+600
CASE WHEN Salary >= 20000 and Salary < 30000 then Salary+700
ELSE Salary END
``` | Your description doesn't say what to do if the salary is above 30000. I'll assume the salary is to be updated by 800 in that case. With that assumption, you can do:
```
SELECT *, (
(Salary<10000)?(Salary+500):(
(Salary>=10000 AND Salary < 20000)? (Salary + 600):(
(Salary>=20000 AND Salary < 30000)? (Salar... |
47,161,088 | I want to insert new records into a table called `[dbo].[Local]` that has these columns:
```
[id] [uniqueidentifier] NOT NULL,
[Component] [varchar](100) NULL,
[Language] [varchar](10) NULL,
[IsText] [bit] NULL,
[key] [varchar](100) NULL,
[value] [varchar](max) NULL,
```
And the primary key called [id] is key cluste... | 2017/11/07 | [
"https://Stackoverflow.com/questions/47161088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8343348/"
] | You need to cast the value you want to insert to `UNIQUEIDENTIFIER`-type:
```
INSERT INTO [dbo].[Local]
(
[id],
[Component],
[Language],
[IsText],
[key],
[value])
VALUES
(
CAST('00000000-0000-0000-0000-000000000000' AS UNIQUEIDENTIFIER),
'Transport.Web',
'en',
... | the insert select face :
```
INSERT INTO foo
([UNIQUEIDENTIFIER_col] ,[col2] , [...])
select NEWID() , [bar.selected_col1] , [...] from bar
where (condition)
``` |
15,350,007 | I am a little confused about the differences between call by value and const call by reference. Could someone please explain this to me. For example, do they both protect against changing the callers argument, are they fast for all object sizes, do either copy the argument while one doesnt, and which use more memory wh... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15350007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207457/"
] | >
> do they both protect against changing the callers argument
>
>
>
Passing by value creates a *copy* of the argument provided by the caller, so whatever the function does, it does it on a separate objects. This means the original object won't ever be touched, so in this case the answer is "**Yes**".
Passing by ... | The main difference is that passing by `const` reference (or non-const) doesn't make a copy of the argument. (the copy is actually subject to copy elision, but theoretically it's a copy that's passed to the function when you pass by value)
In some cases, passing by value is just as fast, or even faster (typically when... |
15,350,007 | I am a little confused about the differences between call by value and const call by reference. Could someone please explain this to me. For example, do they both protect against changing the callers argument, are they fast for all object sizes, do either copy the argument while one doesnt, and which use more memory wh... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15350007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207457/"
] | >
> do they both protect against changing the callers argument
>
>
>
Passing by value creates a *copy* of the argument provided by the caller, so whatever the function does, it does it on a separate objects. This means the original object won't ever be touched, so in this case the answer is "**Yes**".
Passing by ... | call by value will copy all the elements of the object it does protect the callers argument because if you are going to change something it is only a copy you are changing.
calling by const reference does not copy elements but because of the "const" it will protect caller's argument.
You const reference. |
15,350,007 | I am a little confused about the differences between call by value and const call by reference. Could someone please explain this to me. For example, do they both protect against changing the callers argument, are they fast for all object sizes, do either copy the argument while one doesnt, and which use more memory wh... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15350007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207457/"
] | >
> do they both protect against changing the callers argument
>
>
>
Passing by value creates a *copy* of the argument provided by the caller, so whatever the function does, it does it on a separate objects. This means the original object won't ever be touched, so in this case the answer is "**Yes**".
Passing by ... | I suppose that you mean the difference between:
```
void Fn1(MyType x);
```
and
```
void Fn2(const MyType& x);
```
In former case, a copy of the object is always created, which makes it slower especially if the type has a non-trivial constructor. The original object will be unaffected by any changes done on the c... |
15,350,007 | I am a little confused about the differences between call by value and const call by reference. Could someone please explain this to me. For example, do they both protect against changing the callers argument, are they fast for all object sizes, do either copy the argument while one doesnt, and which use more memory wh... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15350007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207457/"
] | >
> do they both protect against changing the callers argument
>
>
>
Passing by value creates a *copy* of the argument provided by the caller, so whatever the function does, it does it on a separate objects. This means the original object won't ever be touched, so in this case the answer is "**Yes**".
Passing by ... | One other point worth mentioning is that call-by-reference functions are converted into inline functions. |
318,977 | A (real) polynomial *function* can be defined as a function $f : \mathbb{R} \rightarrow \mathbb{R}$ such that there exists a sequence $a : \mathbb{N} \rightarrow \mathbb{R}$ such that the terms of $a$ are ultimately zero, and for all $x \in \mathbb{R}$ it holds that $$f(x)=\sum\_{i=0}^{\infty}a\_ix^i.$$
We can also de... | 2013/03/02 | [
"https://math.stackexchange.com/questions/318977",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42339/"
] | The root multiset arises naturally from the factorization of the polynomial
$$\rm f(x) = (x-r)^j \cdots (x-s)^k g(x)\ \to\ \{\, j\cdot r,\:\ldots,\: k\cdot s\,\}$$
where $\rm\:g(x)\:$ has no roots over the coefficient ring.
More precisely, define $\rm\ e\_r(f(x)) := max\{n\in\Bbb N\ :\ (x\!−\!r)^n\!\mid f(x)\,\ in\,... | **Not an answer but an alternative**.
Instead of multiset, a rigorous way to deal with roots of polynomial over
$\mathbb{C}$ with degree $n$ is to model the of roots of a polynomial as an element
in a quotient space of $\mathbb{C}^n$.
Two $n$-tuples $\lambda = (\lambda\_1,\ldots,\lambda\_n)$ and $\mu = (\mu\_1,\ldots,... |
99,285 | I have a inline VF page and trying to reload the parent window.
I am getting
>
> Uncaught SecurityError: Blocked a frame with origin
> "<https://ratan.ap1.visual.force.com>" from accessing a frame with
> origin "<https://ap1.salesforce.com>". Protocols, domains, and ports
> must match.
>
>
>
Error.
Yaah i c... | 2015/11/13 | [
"https://salesforce.stackexchange.com/questions/99285",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/18731/"
] | I believe the problem is different. In salesforce you can talk to only those servers which includes digital certificates which are signed by Certificate Authorities to which salesforce trusts.
Here certificate authority for your endpoint- <https://apps.daikinapplied.com/McQuayToolsSrvc/Authentication.asmx>
is "Kaspersk... | Thank you for posting the hostname of the server you were trying to connect to, it makes debugging this easier.
It looks like the server is [currently configured](https://www.ssllabs.com/ssltest/analyze.html?d=apps.daikinapplied.com) to respond to SSL2, SSL3, and TLS1.0.
This is most likely the reason for your issue... |
11,847,891 | relatively self explanatory, I have a `JTable (table)` and the `DefaultTableModel (model)`. I would like to save the contents of the **JTable** to a file, then read them into the **JTable** at a later time. How can i do this?
More Details: the JTable contains short strings, and there shouldn't be more than, say 50KB o... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11847891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1332495/"
] | `DefaultTableModel` implements Serializable. So the simplest solution would be to use an `ObjectOutputStream` and to call `writeObject()` with your model.
**Note:** Remember that objects which are hold by the `DefaultDataModel` needs to be `Serialazable` | Hmmm There are a couple of factors on that decision. Mainly how big the data are, and how often the data are going to be read/write
Some ideas that pop into my head are to store the data into
1- XML files
the simplest way to do that is to use the built in dom
<http://www.roseindia.net/xml/dom/>
2- database
I person... |
40,912,072 | I'm using mintty via Git-for-Windows and CPython35-32. Why does Python think it's not attached to a terminal?
```
$ python -c "import sys; print(sys.stdout.isatty())"
False
```
Interestingly, I also have a problem that I can not start an interactive session of Python inside the mintty. It might be related to this is... | 2016/12/01 | [
"https://Stackoverflow.com/questions/40912072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791713/"
] | [mintty's console emulation uses pipes to emulate a tty](https://github.com/mintty/mintty/issues/56#issuecomment-108887055) behind the scenes which confuses native programs checking to see if they are attached to a tty. In your case Python's `isatty()` sees stdout as being attached to pipe due to the fake tty and retur... | You might want to try that with Git 2.12 (Q1 2017)
See [commit a9b8a09](https://github.com/git/git/commit/a9b8a09c3c30886c79133da9f48ef9f98c21c3b2) (22 Dec 2016) by [Jeff Hostetler (`jeffhostetler`)](https://github.com/jeffhostetler).
See [commit 8692483](https://github.com/git/git/commit/86924838e3d881cda2192fd79a... |
58,754,401 | I am trying to avoid inserting duplicate value into sqlite in android but I couldn't figure out what is the way to avoid inserting duplicate value as I am newbie in android sqlite.i have tried to find out the solution in online but i didn't get any satifactory answer.
please help me out for solving this problem.
My co... | 2019/11/07 | [
"https://Stackoverflow.com/questions/58754401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7741722/"
] | Because you haven't specified the type(s) that the `CodeEntry::getButton*` methods return, I'm going to denote it `T` for my example.
---
Your second `enum` parameter can be a `Function<CodeEntry, T>`, which will allow you to use a method reference:
```
private enum Radio {
SPACE(" ", CodeEntry::getButtonWhite),... | Here is a solution using an `abstract` method:
```
private enum Radio {
SPACE(" ") {
@Override
public void setSelection(final CodeEntry entry, final String flag) {
// do whatever
}
},
...
public abstract void setSelection(final CodeEntry entry, final String flag);
... |
39,596,496 | I'm sure I'm overlooking something in the [`Settings`](https://developer.android.com/reference/android/provider/Settings.html#constants) class documentation. What `Intent` can open the Settings app in the "Do not disturb" section?
I expected it to be the [`ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS`](https://developer... | 2016/09/20 | [
"https://Stackoverflow.com/questions/39596496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467650/"
] | ### Update
Looking at the [`AndroidManifest.xml` for the *Settings* app](https://cs.android.com/android/platform/superproject/+/android-5.0.0_r1.0.1:packages/apps/Settings/AndroidManifest.xml;l=599) there is an `Activity` `Settings$ZenModeSettingsActivity` already from Android 5.0.
To send the user to the "Do not dis... | You have to use the following `Intent`: [ACTION\_VOICE\_CONTROL\_DO\_NOT\_DISTURB\_MODE](https://developer.android.com/reference/android/provider/Settings.html#ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE) and then pass a `boolean` through [EXTRA\_DO\_NOT\_DISTURB\_MODE\_ENABLED](https://developer.android.com/reference/and... |
37,761,327 | I am working on ionic project where i have to implement push notification
but practically what to do i have no idea
again my app is going to be used in corporate environment
so what to do .
Kindly suggest. | 2016/06/11 | [
"https://Stackoverflow.com/questions/37761327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6522259/"
] | Lvalue points to a storage location which can be assigned with new values. All variables including `const` variables are lvalues. Lvalues persist beyond the expression that uses it. On the other hand, an rvalue is a temporary value that does not persist beyond the expression that uses it.
Lvalues may appear on the lef... | According to the [C Standard, section 6.3.2.1](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=72):
>
> An *lvalue* is an expression (with an object type other than void) that potentially designates an object.
>
>
>
Although this is rather vague, it continues with
>
> The name ‘‘lvalue’’ comes or... |
21,771,386 | I have developed an application that has one preferences activity for application setting so I want know about can we set custom graphics layout (XML) on preferences layout like CheckBox has own color Button while check and unchecked and list has own color if possible then how? | 2014/02/14 | [
"https://Stackoverflow.com/questions/21771386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try this:
```
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
```
and then :
```
protecte... | Example : txtCity.text = "Mysore,Bangalore,Delhi"
```
protected void txtCity_TextChanged(object sender, EventArgs e)
{
string[] _cities=this.txtCity.text.split(',');
int _maxCities = _cities.count();
for (int _item = 1; _item <= _maxCities; _item++)
{
this.ddlCity.Items.Add(_item.ToString());
... |
277,350 | Accidentaly touched PCB of motherboard,so if it got damaged by esd would it boot? | 2016/12/29 | [
"https://electronics.stackexchange.com/questions/277350",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/133462/"
] | The answer is *Yes* and *No*. The failure type due to static can be **immediate** (which is easy to detect or perceive) or can be **latent**(hard to detect, but may surface up over a period of time). Hence the effect of ESD need not be immediate.
The PCB on the mother board have several components. The particular com... | Electrostatic damage is not always immediately obvious, and when it does manifest sometimes it only effects some operations.
Maybe one of the RAM slots, SATA interfaces, front panel controls, or indicators stops working, but the system still passes POST if those features aren't being used. |
34,817,344 | I see both of these styles for inserting the contents of an expression in a map. For example:
```
imap ,9 <c-r>=1+1<cr>
imap <expr> ,9 1+1
```
Both of these do the same thing as far as I can tell: they insert `2` if you type `,9` in insert mode.
I see some scripts use the first style and others the second. Are ther... | 2016/01/15 | [
"https://Stackoverflow.com/questions/34817344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438615/"
] | Your two examples are equivalent. You should prefer the second style as `<c-r>=` behaves differently in some case. One recent example would be [<Plug> function failing, inserting as literal "<t\_ý>S"](https://stackoverflow.com/q/34487155/1890567), where using `<c-r>=<Plug>Func()<CR>` did something different and unexpec... | My biggest issues with `:map-<expr>` are the one explained in the documentation:
* We cannot modify the buffer, nor play with other buffers
* We cannot use `:normal`
* We cannot move the cursor around (as an observable property of the mapping) -- which I sometime do with `:normal`...
Moreover, `i_CTRL-R` has been aro... |
14,604,659 | Scenario
--------
I have three elements in this problem. One is an array of ids in this format: (1,3,5,6,8). That array is a list of id of users I want to display. The second element is table that contains user information something simple like: *id name surname email*. The third element is a second table that contain... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14604659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310648/"
] | A query such as this gets you the information you want:
```
select u.*,
(select usraction from configuration c where c.userid = u.userid and c.lid = 3 order by datetime limit 1
) as lastLid3Action
from users u
where u.userid in (1,3,5,6,8)
```
If you only want "accepted" values, then make this a subqu... | You question is somewhat vague, but if you are asking how to select a number of records when you have a list of ids, the answer is:
```
select column, list, goes, here from tablename
where id in (1,5,8,12,413);
```
That will get you the values of the columns you list for just the records that match your array of ids... |
14,604,659 | Scenario
--------
I have three elements in this problem. One is an array of ids in this format: (1,3,5,6,8). That array is a list of id of users I want to display. The second element is table that contains user information something simple like: *id name surname email*. The third element is a second table that contain... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14604659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310648/"
] | As I understand you have two tables in the first table, where the user information is stored; and the second table, where the user permission is stored. And you want to get information from the first table using permission from the second table, then you need this query:
```
SELECT a.*
FROM first-table-name AS a
RIGHT... | You question is somewhat vague, but if you are asking how to select a number of records when you have a list of ids, the answer is:
```
select column, list, goes, here from tablename
where id in (1,5,8,12,413);
```
That will get you the values of the columns you list for just the records that match your array of ids... |
14,604,659 | Scenario
--------
I have three elements in this problem. One is an array of ids in this format: (1,3,5,6,8). That array is a list of id of users I want to display. The second element is table that contains user information something simple like: *id name surname email*. The third element is a second table that contain... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14604659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310648/"
] | A query such as this gets you the information you want:
```
select u.*,
(select usraction from configuration c where c.userid = u.userid and c.lid = 3 order by datetime limit 1
) as lastLid3Action
from users u
where u.userid in (1,3,5,6,8)
```
If you only want "accepted" values, then make this a subqu... | As I understand you have two tables in the first table, where the user information is stored; and the second table, where the user permission is stored. And you want to get information from the first table using permission from the second table, then you need this query:
```
SELECT a.*
FROM first-table-name AS a
RIGHT... |
38,090,429 | I have an STL map that has String keys and int values. I need to put the items into a new map with int keys and String values, such that the keys are sorted from lowest to greatest.
For example I have a map with these values(key, value):
```
"A", 5
"B", 2
"C", 8
"D", 4
```
I would like them to then be arranged in s... | 2016/06/29 | [
"https://Stackoverflow.com/questions/38090429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/926319/"
] | Something along these lines perhaps:
```
std::map<std::string, int> old_map = ...; // initialized somehow
std::map<int, std::string> new_map;
std::transform(old_map.begin(), old_map.end(),
std::inserter(new_map, new_map.end()),
[](decltype(old_map)::iterator it) {
return std::make_pair(it->second, it->first)... | For each pair in the original map, reverse the pair and insert into the other map. The sorting is automatic because [`std::map`](http://en.cppreference.com/w/cpp/container/map) is sorted by key.
Also, if you might have multiple keys in the original map with the same data (for example both `"A"` and `"E"` have the data... |
38,090,429 | I have an STL map that has String keys and int values. I need to put the items into a new map with int keys and String values, such that the keys are sorted from lowest to greatest.
For example I have a map with these values(key, value):
```
"A", 5
"B", 2
"C", 8
"D", 4
```
I would like them to then be arranged in s... | 2016/06/29 | [
"https://Stackoverflow.com/questions/38090429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/926319/"
] | Something along these lines perhaps:
```
std::map<std::string, int> old_map = ...; // initialized somehow
std::map<int, std::string> new_map;
std::transform(old_map.begin(), old_map.end(),
std::inserter(new_map, new_map.end()),
[](decltype(old_map)::iterator it) {
return std::make_pair(it->second, it->first)... | For `std:map`, it is order by key default.
```
Internally, the elements in a map are always sorted by its key following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).
```
Please read the link:<http://www.cplusplus.com/reference/map/map/>
```
#include <iostre... |
71,906,782 | I have a dataset of n samples and 6 attributes and two classes.
I am currently using the KNeighborsClassifier from Scikit Learn in order to classify a dataset's two classes.
I am looking to plot the values of the dataset (across an arbitrary two attributes/domains of the dataset) and would look the plot to show the s... | 2022/04/18 | [
"https://Stackoverflow.com/questions/71906782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7802550/"
] | Installing Microsoft Visual C++ 2015-2019 Redistributable could help | Are running vanilla Python or some distribution? |
1,899,228 | On a trip, four friends want to play a card game, where $n$ cards must be dealt among the players before the game starts. However, they forgot the cards, so they HAVE TO play with imaginary cards (there is no paper etc. at hand).
The game cannot be played with less than four players, so the friends cannot choose one o... | 2016/08/21 | [
"https://math.stackexchange.com/questions/1899228",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73561/"
] | One can use a slight modification of the random coin flip algorithm. As in the latter, it is essential that the cryptographic protocols used by the players are commutative, i.e. it does not matter in which order decryption/encryption with different keys is performed. (E.g. they can XOR the plaintext deck with their own... | Theoretically possible solution for the values of $n$ big enough, is the following:
1. Players injectively map the cards to the set of prime numbers, i.e., every card $j$ gets its own prime number $p\_j$.
2. Each player $i$ chooses his $n/4$ cards and computes the product $\Pi\_i$ of the corresponding primes and repor... |
4,548,887 | I'm new to [jQTouch](http://jqtouch.com/) -- it's pretty awesome -- but I'm finding that I'm not able to get it to work out of the box for my HTML, even though I'm following the [getting started](https://github.com/senchalabs/jQTouch/wiki/gettingstarted) guide as well as the [markup guidelines](https://github.com/sench... | 2010/12/28 | [
"https://Stackoverflow.com/questions/4548887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132978/"
] | I created an test from your provided example (with the addition of the style imports). Simply removing the <nav> elements resolved the issue for me. | I believe your main elements have to be div's. Additionally, you need a class of "current" on the div that should be displayed first.
I don't know if the version you are using requires this, but what I pulled via git a while back requires that all of your main elements be contained in a div with an id of "jqt".
```
<d... |
62,188,651 | My project was successfully building and all of a sudden I got the below error in Android studio.
**Unable to find method 'org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal.getPublishableFiles()Lorg/gradle/api/file/FileCollection;'.
Possible causes for this unexpected error include:
Gradle's d... | 2020/06/04 | [
"https://Stackoverflow.com/questions/62188651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3665376/"
] | Try to update the [com.jfrog.artifactory](https://plugins.gradle.org/plugin/com.jfrog.artifactory) version. | My resolution for this was to update the artifactory version like @disha4mourya suggested - add this block to your project's `build.gradle`, directly after your buildscript block:
```
plugins {
id "com.jfrog.artifactory" version "4.18.3"
}
``` |
43,729,583 | ```
{map(arr, (obj,index) =>
<div key={index}>{obj.name}</div>
</div>)}
```
What's wrong with my jsx above? couldn't get the index using map? | 2017/05/02 | [
"https://Stackoverflow.com/questions/43729583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7934660/"
] | Here is the proper way to use map.
```
array.map((x, index)=>{
return (<div key={index}>{x.name}</div>);
});
```
or
```
Array.prototype.map.call(arr, function(x, index) {
return (<div key={index}>{x.name}</div>);
});
```
Mozilla
[Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaSc... | You are not wrapping your JSX content within `()` . Also you need to have the `(` on the same line as `=>` and you have an extra closing `div`
```
{map(arr, (obj,index) => (
<div key={index}>{obj.name}</div>
))}
``` |
385 | Luke 2:52 (ESV) states that "Jesus increased in wisdom and in stature and in favor with God and man." The word "favor" in this passage is translated from the Greek word "charis" (Strong's G5485), which the Strong's defines as "graciousness (as gratifying), of manner or act."
In my modern, American, English-speaking co... | 2011/10/22 | [
"https://hermeneutics.stackexchange.com/questions/385",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/78/"
] | You might be interested in [Moral Transformation](http://rads.stackoverflow.com/amzn/click/1456389807), page 166ff, in which Wallace and Rusk argue that "charis" did not have the technical sense many now give it, but always meant "favor" in a reciprocity system, or "favorable" as we would understand it, and that most o... | There's no doubt that the word is primarily translated as "grace" (130 times in the King James version). However, there are a few times (6 in total) that this word is translated as "favor".
[Luke 1:30](http://www.biblegateway.com/passage/?search=Luke%201:30&version=NASB), [Acts 2:47](http://www.biblegateway.com/passag... |
385 | Luke 2:52 (ESV) states that "Jesus increased in wisdom and in stature and in favor with God and man." The word "favor" in this passage is translated from the Greek word "charis" (Strong's G5485), which the Strong's defines as "graciousness (as gratifying), of manner or act."
In my modern, American, English-speaking co... | 2011/10/22 | [
"https://hermeneutics.stackexchange.com/questions/385",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/78/"
] | There's no doubt that the word is primarily translated as "grace" (130 times in the King James version). However, there are a few times (6 in total) that this word is translated as "favor".
[Luke 1:30](http://www.biblegateway.com/passage/?search=Luke%201:30&version=NASB), [Acts 2:47](http://www.biblegateway.com/passag... | So, let's consider that Greek word, "charis" means "(God's) divine influence in the heart and its (subsequent) reflection in the life", as defined in Strong's Greek dictionary.
Then let's consider that in the early translations into English (Geneva and King James Bibles) the language is absent of words that equate wit... |
385 | Luke 2:52 (ESV) states that "Jesus increased in wisdom and in stature and in favor with God and man." The word "favor" in this passage is translated from the Greek word "charis" (Strong's G5485), which the Strong's defines as "graciousness (as gratifying), of manner or act."
In my modern, American, English-speaking co... | 2011/10/22 | [
"https://hermeneutics.stackexchange.com/questions/385",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/78/"
] | You might be interested in [Moral Transformation](http://rads.stackoverflow.com/amzn/click/1456389807), page 166ff, in which Wallace and Rusk argue that "charis" did not have the technical sense many now give it, but always meant "favor" in a reciprocity system, or "favorable" as we would understand it, and that most o... | So, let's consider that Greek word, "charis" means "(God's) divine influence in the heart and its (subsequent) reflection in the life", as defined in Strong's Greek dictionary.
Then let's consider that in the early translations into English (Geneva and King James Bibles) the language is absent of words that equate wit... |
31,515,562 | I am trying to run a calabash script on iOS but continually getting the following errors:
```
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (http://localhost:37265))
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (http://localhost:37265))
Failing... Errno::ECONNREFUSED
Given I ... | 2015/07/20 | [
"https://Stackoverflow.com/questions/31515562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/646818/"
] | I don't know if you are running on iOS or Android.
Running on Android, this can be caused by the device disconnecting from USB (unstable USB connection), or becoming invisible to ADB in some other way. | In this instance I fixed this by commenting ount 'APP\_BUNDLE\_PATH' within 01\_launch.rb file. All working now.
So looks like the path to the APP\_BUNDLE\_PATH was set incorrectly. Hopefully this answer might help others. |
25,051,733 | In the following example the j++ both acts as a variable and a function
```
var j = 0;
var arr = [];
arr[j++] = "a1";
arr[j++] = "a2";
console.log(arr[0]);
console.log(arr[1]);
```
is there a way to write this without using the ++ like:
```
function addx(i)
{
return i+1;
}
var j=0;
arr[addx(j)] = "a1";
a... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25051733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1476796/"
] | This is the place where reference helps.
Like bellow
```
function addx(i)
{
return i.val++;
}
var j={val:0};
arr[addx(j)] = "a1";
arr[addx(j)] = "a2";
``` | You can do this:
```
var oldj;
var j = 0;
var arr = [];
arr[oldj = j, j = addx(j), oldj] = "a1";
arr[oldj = j, j = addx(j), oldj] = "a2";
```
This makes use of the rarely-used comma operator to combine a sequence of expressions into a single expression. We save the old value of `j`, update `j` with the result of `ad... |
25,051,733 | In the following example the j++ both acts as a variable and a function
```
var j = 0;
var arr = [];
arr[j++] = "a1";
arr[j++] = "a2";
console.log(arr[0]);
console.log(arr[1]);
```
is there a way to write this without using the ++ like:
```
function addx(i)
{
return i+1;
}
var j=0;
arr[addx(j)] = "a1";
a... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25051733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1476796/"
] | You can do this:
```
var oldj;
var j = 0;
var arr = [];
arr[oldj = j, j = addx(j), oldj] = "a1";
arr[oldj = j, j = addx(j), oldj] = "a2";
```
This makes use of the rarely-used comma operator to combine a sequence of expressions into a single expression. We save the old value of `j`, update `j` with the result of `ad... | You can add subsequent elements to an array with the push method:
```
arr.push("a1");
arr.push("a2");
```
This makes `j` unnecessary and also avoids gaps in the array indices. |
25,051,733 | In the following example the j++ both acts as a variable and a function
```
var j = 0;
var arr = [];
arr[j++] = "a1";
arr[j++] = "a2";
console.log(arr[0]);
console.log(arr[1]);
```
is there a way to write this without using the ++ like:
```
function addx(i)
{
return i+1;
}
var j=0;
arr[addx(j)] = "a1";
a... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25051733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1476796/"
] | This is the place where reference helps.
Like bellow
```
function addx(i)
{
return i.val++;
}
var j={val:0};
arr[addx(j)] = "a1";
arr[addx(j)] = "a2";
``` | You can add subsequent elements to an array with the push method:
```
arr.push("a1");
arr.push("a2");
```
This makes `j` unnecessary and also avoids gaps in the array indices. |
25,051,733 | In the following example the j++ both acts as a variable and a function
```
var j = 0;
var arr = [];
arr[j++] = "a1";
arr[j++] = "a2";
console.log(arr[0]);
console.log(arr[1]);
```
is there a way to write this without using the ++ like:
```
function addx(i)
{
return i+1;
}
var j=0;
arr[addx(j)] = "a1";
a... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25051733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1476796/"
] | This is the place where reference helps.
Like bellow
```
function addx(i)
{
return i.val++;
}
var j={val:0};
arr[addx(j)] = "a1";
arr[addx(j)] = "a2";
``` | I assume from the constraint that this is some sort of homework problem? Otherwise it appears to be a completely artificial constraint.
One solution is to use a closure to maintain your variable state that supports a post increment function:
```
function NumberWrapper() {
var value; // initially undefined
re... |
25,051,733 | In the following example the j++ both acts as a variable and a function
```
var j = 0;
var arr = [];
arr[j++] = "a1";
arr[j++] = "a2";
console.log(arr[0]);
console.log(arr[1]);
```
is there a way to write this without using the ++ like:
```
function addx(i)
{
return i+1;
}
var j=0;
arr[addx(j)] = "a1";
a... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25051733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1476796/"
] | I assume from the constraint that this is some sort of homework problem? Otherwise it appears to be a completely artificial constraint.
One solution is to use a closure to maintain your variable state that supports a post increment function:
```
function NumberWrapper() {
var value; // initially undefined
re... | You can add subsequent elements to an array with the push method:
```
arr.push("a1");
arr.push("a2");
```
This makes `j` unnecessary and also avoids gaps in the array indices. |
35,064,532 | ```
Node0x7fd34984d728:s1 -> Node0x7fd34984d600:d0;
Node0x7fd34984d850 [shape=record,shape=Mrecord,label="{Register %vreg13|0x7fd34984d850|{<d0>i32}}"];
Node0x7fd34984d978 [shape=record,shape=Mrecord,label="{{<s0>0|<s1>1}|CopyFromReg [ORD=1]|0x7fd34984d978|{<d0>i32|<d1>ch}}"];
Node0x7fd34984d978:s0 -> N... | 2016/01/28 | [
"https://Stackoverflow.com/questions/35064532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/713777/"
] | Test code that relies on grabbing the current time is not a good idea. You'll need rewrite things so that you can mock out or inject a date. Some good examples of doing that at ([Unit Tests, How to Write Testable Code and Why it Matters](http://www.toptal.com/qa/how-to-write-testable-code-and-why-it-matters)). That art... | I think you need to build in some tolerance into your tests, as some amount of time will inevitably pass between dispatching an action and receiving a response. Even if your faking it, there will still be a difference in execution time. How you actually go about doing this depends on your assertion library. |
35,064,532 | ```
Node0x7fd34984d728:s1 -> Node0x7fd34984d600:d0;
Node0x7fd34984d850 [shape=record,shape=Mrecord,label="{Register %vreg13|0x7fd34984d850|{<d0>i32}}"];
Node0x7fd34984d978 [shape=record,shape=Mrecord,label="{{<s0>0|<s1>1}|CopyFromReg [ORD=1]|0x7fd34984d978|{<d0>i32|<d1>ch}}"];
Node0x7fd34984d978:s0 -> N... | 2016/01/28 | [
"https://Stackoverflow.com/questions/35064532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/713777/"
] | You can mock Date.now() function like this:
```
describe('>>> Test Name', () => {
const literallyJustNow = Date.now();
const realDateNow = Date.now.bind(global.Date);
const dateNowStub = jest.fn(() => literallyJustNow);
beforeEach(() => {
global.Date.now = dateNowStub;
});
afterEach((... | I think you need to build in some tolerance into your tests, as some amount of time will inevitably pass between dispatching an action and receiving a response. Even if your faking it, there will still be a difference in execution time. How you actually go about doing this depends on your assertion library. |
35,064,532 | ```
Node0x7fd34984d728:s1 -> Node0x7fd34984d600:d0;
Node0x7fd34984d850 [shape=record,shape=Mrecord,label="{Register %vreg13|0x7fd34984d850|{<d0>i32}}"];
Node0x7fd34984d978 [shape=record,shape=Mrecord,label="{{<s0>0|<s1>1}|CopyFromReg [ORD=1]|0x7fd34984d978|{<d0>i32|<d1>ch}}"];
Node0x7fd34984d978:s0 -> N... | 2016/01/28 | [
"https://Stackoverflow.com/questions/35064532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/713777/"
] | Test code that relies on grabbing the current time is not a good idea. You'll need rewrite things so that you can mock out or inject a date. Some good examples of doing that at ([Unit Tests, How to Write Testable Code and Why it Matters](http://www.toptal.com/qa/how-to-write-testable-code-and-why-it-matters)). That art... | You can mock Date.now() function like this:
```
describe('>>> Test Name', () => {
const literallyJustNow = Date.now();
const realDateNow = Date.now.bind(global.Date);
const dateNowStub = jest.fn(() => literallyJustNow);
beforeEach(() => {
global.Date.now = dateNowStub;
});
afterEach((... |
57,038,347 | I am very new to databases and I'm currently working with Microsoft Access 2013. The situation is that I have a huge amount of data which I wanna fill in in an already created table (Inventory) by using an SQL-statement in a query.
What I have is the following:
```
INSERT INTO Inventory (Col 1, Col 2, Col 3, Col 4)
... | 2019/07/15 | [
"https://Stackoverflow.com/questions/57038347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10765169/"
] | I think MS Access only allows you to insert one record at a time using `INSERT . . . VALUES`:
```
INSERT INTO Inventory (Col 1, Col 2, Col 3, Col 4)
VALUES ("Val 1", "Val 2", "Val 3", "Val 4");
INSERT INTO Inventory (Col 1, Col 2, Col 3, Col 4)
VALUES ("Val 5", "Val 6", "Val 7", "Val 8");
....
INSERT INTO I... | You can bulk insert using `INSERT INTO ... SELECT` and a union query:
```
INSERT INTO Inventory (Col 1, Col 2, Col 3, Col 4)
SELECT "Val 1", "Val 2", "Val 3", "Val 4"
FROM (SELECT First(ID) FROM MSysObjects) dummy
UNION ALL
SELECT "Val 5", "Val 6", "Val 7", "Val 8"
FROM (SELECT First(ID) FROM MSysObjects) dummy
UNION ... |
23,591,705 | I just did a clean install of Ubuntu 14.04 and also installed pycharm. Pycharm said setuptools and pip weren't installed and offered to install it. I simply clicked "Ÿes" and it seemed to install it. A bit after that I wanted to install Flask (which is awesome btw) using pip, so I did `sudo pip install flask`. To my su... | 2014/05/11 | [
"https://Stackoverflow.com/questions/23591705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1650012/"
] | Had the same problem under 12.04.
Did `sudo easy_install pip==1.4.1` and it worked. | Faced the same problem with ubuntu 14.04 ,python2.7 and pip 1.5.4
```
sudo apt-get install --reinstall python2.7
sudo apt-get purge python-pip
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
sudo pip install package-name
```
This worked! |
19,707 | Is it possible to USB-tether my WiFi-only Galaxy Tab to my Galaxy S?
I know how to WiFi tether but it is a huge battery hog. Is there a mini-USB version of the Galaxy Tab cable? If so, can it be used to tether? | 2012/02/20 | [
"https://android.stackexchange.com/questions/19707",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/11872/"
] | There is a bit tricky method suggested by one of the XDA members. Rooting is required.
1. Download & install a Terminal Emulator on your Android tablet.
2. Run the Emulator & enter the following commands:
```
dhcpcd usb1
setprop net.dns1 8.8.8.8
```
The Android phone from which the internet connection is to be sour... | Yes! First, attach an OTG cable to your tablet. Then, attach a MicroUSB and connect both devices. Now download one of the numerous apps which make tethering possible and you're done!
If your devices support Bluetooth tethering, you can use it. It doesn't consume too beach battery also. :)
P.S. isn't creating a WiFi h... |
19,707 | Is it possible to USB-tether my WiFi-only Galaxy Tab to my Galaxy S?
I know how to WiFi tether but it is a huge battery hog. Is there a mini-USB version of the Galaxy Tab cable? If so, can it be used to tether? | 2012/02/20 | [
"https://android.stackexchange.com/questions/19707",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/11872/"
] | There is a bit tricky method suggested by one of the XDA members. Rooting is required.
1. Download & install a Terminal Emulator on your Android tablet.
2. Run the Emulator & enter the following commands:
```
dhcpcd usb1
setprop net.dns1 8.8.8.8
```
The Android phone from which the internet connection is to be sour... | I did it by connecting an ethernet dongle to each device and an e-cable to the dongles. I imagine it would use less power than wireless, and I can place the hotspot device away for the best reception. |
19,707 | Is it possible to USB-tether my WiFi-only Galaxy Tab to my Galaxy S?
I know how to WiFi tether but it is a huge battery hog. Is there a mini-USB version of the Galaxy Tab cable? If so, can it be used to tether? | 2012/02/20 | [
"https://android.stackexchange.com/questions/19707",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/11872/"
] | Yes! First, attach an OTG cable to your tablet. Then, attach a MicroUSB and connect both devices. Now download one of the numerous apps which make tethering possible and you're done!
If your devices support Bluetooth tethering, you can use it. It doesn't consume too beach battery also. :)
P.S. isn't creating a WiFi h... | I did it by connecting an ethernet dongle to each device and an e-cable to the dongles. I imagine it would use less power than wireless, and I can place the hotspot device away for the best reception. |
36,478 | [Deuteronomy 24:16](http://www.mechon-mamre.org/p/pt/pt0524.htm#16) says “The fathers shall not be put to death for the children, neither shall the children be put to death for the fathers; every man shall be put to death for his own sin." Why then did the whole family of Achan have to die by stoning in [Joshua 7:24-25... | 2014/03/19 | [
"https://judaism.stackexchange.com/questions/36478",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/4999/"
] | According to Rashi they were not killed. In his commentary to [Joshua 7:24](http://www.chabad.org/library/bible_cdo/aid/15791#showrashi=true&v=24), Rashi writes that they were taken to see in order that they not copy his actions. Verse 25 says "וירגמו אותו" - they stoned *him*, in singular. "וישרפו אותם", they burned t... | Gersonides (Ralbag) is puzzled by this. He offers two answers. The first is that the children were minors, and that they consequently came under the category of Achen's property, with regard to the punishment. We must then say that the verse in Deuteronomy takes apllies only once the child becomes an adult by Jewish La... |
4,103,623 | I'm writing my first jQuery plug-in, but I've run into a couple of problems. In my first attempt I successfully implemented the basic plug-in, but now I need to expose additional methods for the client to use.
After numerous articles, stackoverflow posts, and reading the documentation I thought I could create an objec... | 2010/11/05 | [
"https://Stackoverflow.com/questions/4103623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115021/"
] | Moving files between different filesystems requires you to copy them. The vanilla JDK doesn't have any method to do that, you'll have to do it yourself (e.g. by using FileInputStream / FileOutputStream).
Also check out [this thread](https://stackoverflow.com/questions/300559/move-copy-file-operations-in-java). | If you want to move files on different file Systems. Copy and Delete.
[Apache IO FileUtils](http://commons.apache.org/io/api-1.4/org/apache/commons/io/FileUtils.html#moveFile%28java.io.File,%20java.io.File%29) |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | Depends on the OS. The standard c runtime on windows and unices uses a shared heap across threads. This means locking every malloc/free.
On Symbian, for example, each thread comes with its own heap, although threads can share pointers to data allocated in any heap. Symbian's design is better in my opinion since it no... | It depends on what exactly you mean when saying "heap".
All threads share the address space, so heap-allocated objects are accessible from all threads. Technically, stacks are shared as well in this sense, i.e. nothing prevents you from accessing other thread's stack (though it would almost never make any sense to do ... |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | By default, C has only a single heap.
That said, some allocators that are thread aware will partition the heap so that each thread has it's own area to allocate from. The idea is that this should make the heap scale better.
One example of such a heap is [Hoard](http://www.hoard.org/). | On FreeRTOS Operating system, tasks(threads) share the same heap but each one of them has its own stack. This comes in very handy when dealing with low power low RAM architectures,because the same pool of memory can be accessed/shared by several threads, but this comes with a small catch , the developer needs to keep i... |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | No. All threads share a common heap.
Each [thread has a private stack](http://en.wikipedia.org/wiki/Stack-based_memory_allocation), which it can quickly add and remove items from. This makes stack based memory fast, but if you use too much stack memory, as occurs in infinite recursion, you will get a stack overflow.
... | By default, C has only a single heap.
That said, some allocators that are thread aware will partition the heap so that each thread has it's own area to allocate from. The idea is that this should make the heap scale better.
One example of such a heap is [Hoard](http://www.hoard.org/). |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | Depends on the OS. The standard c runtime on windows and unices uses a shared heap across threads. This means locking every malloc/free.
On Symbian, for example, each thread comes with its own heap, although threads can share pointers to data allocated in any heap. Symbian's design is better in my opinion since it no... | Each thread has its own stack and call stack.
Each thread shares the same heap. |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | By default, C has only a single heap.
That said, some allocators that are thread aware will partition the heap so that each thread has it's own area to allocate from. The idea is that this should make the heap scale better.
One example of such a heap is [Hoard](http://www.hoard.org/). | Generally speaking, all threads use the same address space and therefore usually have just one heap.
However, it can be a bit more complicated. You might be looking for [Thread Local Storage](http://en.wikipedia.org/wiki/Thread-local_storage) (TLS), but it stores single values only.
Windows-Specific:
TLS-space can be... |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | By default, C has only a single heap.
That said, some allocators that are thread aware will partition the heap so that each thread has it's own area to allocate from. The idea is that this should make the heap scale better.
One example of such a heap is [Hoard](http://www.hoard.org/). | Each thread has its own stack and call stack.
Each thread shares the same heap. |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | Each thread has its own stack and call stack.
Each thread shares the same heap. | Generally speaking, all threads use the same address space and therefore usually have just one heap.
However, it can be a bit more complicated. You might be looking for [Thread Local Storage](http://en.wikipedia.org/wiki/Thread-local_storage) (TLS), but it stores single values only.
Windows-Specific:
TLS-space can be... |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | It depends on what exactly you mean when saying "heap".
All threads share the address space, so heap-allocated objects are accessible from all threads. Technically, stacks are shared as well in this sense, i.e. nothing prevents you from accessing other thread's stack (though it would almost never make any sense to do ... | On FreeRTOS Operating system, tasks(threads) share the same heap but each one of them has its own stack. This comes in very handy when dealing with low power low RAM architectures,because the same pool of memory can be accessed/shared by several threads, but this comes with a small catch , the developer needs to keep i... |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | Depends on the OS. The standard c runtime on windows and unices uses a shared heap across threads. This means locking every malloc/free.
On Symbian, for example, each thread comes with its own heap, although threads can share pointers to data allocated in any heap. Symbian's design is better in my opinion since it no... | Typically, threads share the heap and other resources, however there are thread-like constructions that don't. Among these thread-like constructions are Erlang's lightweight processes, and UNIX's full-on processes (created with a call to `fork()`). You might also be working on multi-machine concurrency, in which case y... |
1,665,425 | I have 5 different infopath forms.on sharepoint site , i want to upload them in single document library. But when i am going to do this it is overwriting existing form. What i have to do. Is that possible to upload all 5 forms in single Document library ? I do not want to create 5 different Document libraries for 5 for... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1665425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165309/"
] | Depends on the OS. The standard c runtime on windows and unices uses a shared heap across threads. This means locking every malloc/free.
On Symbian, for example, each thread comes with its own heap, although threads can share pointers to data allocated in any heap. Symbian's design is better in my opinion since it no... | Generally speaking, all threads use the same address space and therefore usually have just one heap.
However, it can be a bit more complicated. You might be looking for [Thread Local Storage](http://en.wikipedia.org/wiki/Thread-local_storage) (TLS), but it stores single values only.
Windows-Specific:
TLS-space can be... |
152,542 | I have a video which I read in a loop frame by frame. For every frame, I want to do temporal kernel filtering, the coefficients of which come from the input variable model (a dictionary). The temporal kernel is an array that has size of 15. So, basically, for every frame we apply this function. The variables scale, cli... | 2017/01/13 | [
"https://codereview.stackexchange.com/questions/152542",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/128120/"
] | Switched
========
Let's start with the obvious things we can improve. A `return` statement terminates the current function. Therefore, all your
```
case XY: return AB; break;
```
can be rewritten as
```
case XY: return AB;
```
However, you don't have any `default` cases in both `switch` statements. What happens ... | Overall your solution is straightforward and clear.
A few areas might be improved including
* consistency of formatting,
* enabling and addressing compiler warnings,
* considering brevity/efficiency/constancy of your algorithm.
Formatting
==========
Whitespace
----------
From experience, even though whitespace do... |
99,742 | I have seen a number of these, and hate to ask another one, but when I count my accepted answers, it seems that I should have the Tenacious badge. The fact that I haven;t means I have probably misunderstood something about it.
I have 6 zero score accepted answers, and 13 scored accepted answers. This should therefore ... | 2011/07/25 | [
"https://meta.stackexchange.com/questions/99742",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/164650/"
] | We only check for answers *more than 10 days old* in this badge...so your earning it doesn't depend on luck of when the job ran (it doesn't run as often as others)...before an answer has the opportunity to get upvotes just after being posted.
As it stands now, you'd get the badge in 6 days. | The [mega-list of all badges with full descriptions](https://meta.stackexchange.com/questions/67397/list-of-all-badges-with-full-descriptions) says of the **Tenacious badge:**
>
> * silver; awarded once; same family as Unsung Hero (gold)
> * have more than five accepted answers with a score of zero, and have those ze... |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | ```
System.out.println("Enter the option");
i=Integer.parseInt(bf.readLine());
```
Problem is here.
You are reading some non numeric input and trying to parse it into int. Thats the exceptional case. | Maybe because readline string is like '123\n'. |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | This problem i have faced in my daytoday work. The `bf.readLine()` gives you the empty string(`""`) or character values `[A-Z]`.So do a precondition check like
>
>
> ```
> // To allow only Integer to be parsed.
>
> ```
>
>
```
String rawText = br.readLine().trim();
if ( isNumeric (rawText) ... | Maybe because readline string is like '123\n'. |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | This problem i have faced in my daytoday work. The `bf.readLine()` gives you the empty string(`""`) or character values `[A-Z]`.So do a precondition check like
>
>
> ```
> // To allow only Integer to be parsed.
>
> ```
>
>
```
String rawText = br.readLine().trim();
if ( isNumeric (rawText) ... | ```
System.out.println("Enter the option");
i=Integer.parseInt(bf.readLine());
```
Problem is here.
You are reading some non numeric input and trying to parse it into int. Thats the exceptional case. |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | ```
System.out.println("Enter the option");
i=Integer.parseInt(bf.readLine());
```
Problem is here.
You are reading some non numeric input and trying to parse it into int. Thats the exceptional case. | I replaced the inputstream with a Scanner.
```
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
Scanner s=new Scanner(System.in);
System.out.println("ch before while:::"+ch);
while(ch=='y'||ch=='Y'){
System.out.println("Enter the option");
... |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | ```
System.out.println("Enter the option");
i=Integer.parseInt(bf.readLine());
```
Problem is here.
You are reading some non numeric input and trying to parse it into int. Thats the exceptional case. | We can only use Explicit Type Conversion for data types which are type compatible with each other. But as you are trying to do type conversion on
```
ch=(char)bf.read();
```
you are actually trying to cast an Integer as char(since return type of bf.read() is int). But Integer and char are not compatible, hence the e... |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | This problem i have faced in my daytoday work. The `bf.readLine()` gives you the empty string(`""`) or character values `[A-Z]`.So do a precondition check like
>
>
> ```
> // To allow only Integer to be parsed.
>
> ```
>
>
```
String rawText = br.readLine().trim();
if ( isNumeric (rawText) ... | I replaced the inputstream with a Scanner.
```
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
Scanner s=new Scanner(System.in);
System.out.println("ch before while:::"+ch);
while(ch=='y'||ch=='Y'){
System.out.println("Enter the option");
... |
3,811,356 | Hi When I run the following code I am getting `NumberFormatException` can anybody help me out in debugging code.
```
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3811356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240698/"
] | This problem i have faced in my daytoday work. The `bf.readLine()` gives you the empty string(`""`) or character values `[A-Z]`.So do a precondition check like
>
>
> ```
> // To allow only Integer to be parsed.
>
> ```
>
>
```
String rawText = br.readLine().trim();
if ( isNumeric (rawText) ... | We can only use Explicit Type Conversion for data types which are type compatible with each other. But as you are trying to do type conversion on
```
ch=(char)bf.read();
```
you are actually trying to cast an Integer as char(since return type of bf.read() is int). But Integer and char are not compatible, hence the e... |
13,299,195 | I've been trying to test my Flask application that uses PyMongo. The application works fine, but when I execute unit tests, I constantly get an error message saying "working outside of application context". This message is thrown every time I run any unit test that requires access to the Mongo database.
I've been foll... | 2012/11/08 | [
"https://Stackoverflow.com/questions/13299195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/715321/"
] | I've finally fixed the issue, which was due to the application context. It seems that when using PyMongo, as it manages the connection for you, the connection object must be used within the same context which initialized the PyMongo instance.
I had to modify the code, thus the PyMongo instance is initialized in the t... | Review Context Locals and test\_request\_context():
<http://flask.pocoo.org/docs/quickstart/#context-locals> |
20,380,597 | (As a follow up to [this question](https://stackoverflow.com/questions/20378549/how-to-run-all-gtest-files-at-once-using-cmake))
My cmake file looks like this:
```
include(CTest)
add_subdirectory(/usr/src/gtest gtest)
include_directories(${GTEST_INCLUDE_DIR})
add_executable(TestA TestA.cpp)
target_link_libraries(Tes... | 2013/12/04 | [
"https://Stackoverflow.com/questions/20380597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408351/"
] | It might make sense to have a "default" implementation, which concrete classes can use if it's useful to them. They still need to override it, but can call the base-class version non-virtually:
```
struct B : A {
void interface() {
A::interface(); // call the default implementation
// and maybe do ... | >
> I can't think up a reason for this. If one virtual function is defined as pure, then what's the reason to implement it?
>
>
>
The purpose of a pure virtual function is *not* to prohibit definitions. It is to mark the class as uninstantiable.
Providing a definition may be useful for deriving classes:
```
stru... |
20,380,597 | (As a follow up to [this question](https://stackoverflow.com/questions/20378549/how-to-run-all-gtest-files-at-once-using-cmake))
My cmake file looks like this:
```
include(CTest)
add_subdirectory(/usr/src/gtest gtest)
include_directories(${GTEST_INCLUDE_DIR})
add_executable(TestA TestA.cpp)
target_link_libraries(Tes... | 2013/12/04 | [
"https://Stackoverflow.com/questions/20380597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408351/"
] | It might make sense to have a "default" implementation, which concrete classes can use if it's useful to them. They still need to override it, but can call the base-class version non-virtually:
```
struct B : A {
void interface() {
A::interface(); // call the default implementation
// and maybe do ... | You apparently completely misunderstood the meaning of the term "statically" in this context.
Yes, pure virtual functions can still have bodies, i.e. they can still be *defined*.
And no, you cannot invoke such function "without an object instance", as you seem to incorrectly believe. A pure virtual function with a bo... |
20,380,597 | (As a follow up to [this question](https://stackoverflow.com/questions/20378549/how-to-run-all-gtest-files-at-once-using-cmake))
My cmake file looks like this:
```
include(CTest)
add_subdirectory(/usr/src/gtest gtest)
include_directories(${GTEST_INCLUDE_DIR})
add_executable(TestA TestA.cpp)
target_link_libraries(Tes... | 2013/12/04 | [
"https://Stackoverflow.com/questions/20380597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408351/"
] | It might make sense to have a "default" implementation, which concrete classes can use if it's useful to them. They still need to override it, but can call the base-class version non-virtually:
```
struct B : A {
void interface() {
A::interface(); // call the default implementation
// and maybe do ... | A pure virtual function simply means that the function must be overidden by all derived classes it does not mean that the function cannot/should not have a implementation of its own. Two most obvious cases for such a pure virtual function having implementation are:
* A Derived class implementation can call Base class ... |
20,380,597 | (As a follow up to [this question](https://stackoverflow.com/questions/20378549/how-to-run-all-gtest-files-at-once-using-cmake))
My cmake file looks like this:
```
include(CTest)
add_subdirectory(/usr/src/gtest gtest)
include_directories(${GTEST_INCLUDE_DIR})
add_executable(TestA TestA.cpp)
target_link_libraries(Tes... | 2013/12/04 | [
"https://Stackoverflow.com/questions/20380597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408351/"
] | It might make sense to have a "default" implementation, which concrete classes can use if it's useful to them. They still need to override it, but can call the base-class version non-virtually:
```
struct B : A {
void interface() {
A::interface(); // call the default implementation
// and maybe do ... | interface() = 0 means derived classes **must** provide an implementation, so the definition effects derived classes, but the base class is permitted to have an implementation of the method so that derived classes can always call base::interface(). |
180,012 | I have been hanging around SO for a year and a bit and hugely appreciate the quality of the questions and answers, and the ethos of the site. The polite and constructive atmosphere is very welcome. One thing that I also appreciate about SO is the intention that questions should be specific *and* have more general appli... | 2013/05/13 | [
"https://meta.stackexchange.com/questions/180012",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/206685/"
] | Every now and then I introduce someone new to the network. We pick a site from [the list](https://stackexchange.com/sites#questionsperday), usually the one that's closer to their professional interests, and go through the site's:
* About page
* FAQ
* Top questions
All in all, my "intro to SE" process takes about 20 m... | No, I can't really see the benefit of doing so. The "advantage" is that the bad questions don't appear on the site at all, but you're also limiting the number of eyes on a question and potentially alienating new users who can't get their good questions answers as quickly.
On a site the size of StackOverflow the bad qu... |
41,736,481 | I am stuck,
we want to display value in H18 by adding cell(D18 & H17)
this is the formula I tried "=IF(ISBLANK(D18),0,(SUM(D18+H17)))"
once we are giving value in "D" Row then only we need to display value in H Row. including "zero"
"H" Row fully taking value as "0"
[)
```
This is working for me, give it a try. | So, as per comment in view : show zero values - can be ticked or not... |
26,645,612 | I need to pass both a flash value and a session value into one view in Play Framework. Is this possible? | 2014/10/30 | [
"https://Stackoverflow.com/questions/26645612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3145170/"
] | Both the session and the flash objects are accessible from the request. Simply pass request from a controller to a view. Usually it's done by an implicit parameter:
```
@()(implicit request: RequestHeader)
@request.session.get("yourSessionKey")
@request.flash.get("yourFlashKey")
``` | ```
@()(implicit flash : Flash, request: RequestHeader)
```
And then you can use it like this:
```
@if(request.session.get("example").toList(0) == example2){
<a href="#example>"><h5>example</h5></a>
}
``` |
25,032,716 | I have a Maven project and inside a method I want to create a path for a directory in my resources folder. This is done like this:
```
try {
final URI uri = getClass().getResource("/my-folder").toURI();
Path myFolderPath = Paths.get(uri);
} catch (final URISyntaxException e) {
...
}
```
The generated `UR... | 2014/07/30 | [
"https://Stackoverflow.com/questions/25032716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183192/"
] | You need to create the file system before you can access the path within the zip like
```
final URI uri = getClass().getResource("/my-folder").toURI();
Map<String, String> env = new HashMap<>();
env.put("create", "true");
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
Path myFolderPath = Paths.get(uri);
``... | If you intend to read the resource file, you can directly use `getClass.getResourceAsStream`. This will set up the file system implictly.
The function returns `null` if your resource could not be found, otherwise you directly have an input stream to parse your resource. |
25,032,716 | I have a Maven project and inside a method I want to create a path for a directory in my resources folder. This is done like this:
```
try {
final URI uri = getClass().getResource("/my-folder").toURI();
Path myFolderPath = Paths.get(uri);
} catch (final URISyntaxException e) {
...
}
```
The generated `UR... | 2014/07/30 | [
"https://Stackoverflow.com/questions/25032716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183192/"
] | You need to create the file system before you can access the path within the zip like
```
final URI uri = getClass().getResource("/my-folder").toURI();
Map<String, String> env = new HashMap<>();
env.put("create", "true");
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
Path myFolderPath = Paths.get(uri);
``... | Expanding on @Uwe Allner 's excellent answer, a failsafe method to use is
```
private FileSystem initFileSystem(URI uri) throws IOException
{
try
{
return FileSystems.getFileSystem(uri);
}
catch( FileSystemNotFoundException e )
{
Map<String, String> env = new HashMap<>();
e... |
25,032,716 | I have a Maven project and inside a method I want to create a path for a directory in my resources folder. This is done like this:
```
try {
final URI uri = getClass().getResource("/my-folder").toURI();
Path myFolderPath = Paths.get(uri);
} catch (final URISyntaxException e) {
...
}
```
The generated `UR... | 2014/07/30 | [
"https://Stackoverflow.com/questions/25032716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183192/"
] | You need to create the file system before you can access the path within the zip like
```
final URI uri = getClass().getResource("/my-folder").toURI();
Map<String, String> env = new HashMap<>();
env.put("create", "true");
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
Path myFolderPath = Paths.get(uri);
``... | In addition to @Uwe Allner and @mvreijn:
Be careful with the `URI`. Sometimes the `URI` has a wrong format (e.g. `"file:/path/..."` and correct one would be `"file:///path/..."`) and you cant get a proper `FileSystem`.
In this case it helps that the `URI` is created from the `Path`'s `toUri()` method.
In my case I ... |
25,032,716 | I have a Maven project and inside a method I want to create a path for a directory in my resources folder. This is done like this:
```
try {
final URI uri = getClass().getResource("/my-folder").toURI();
Path myFolderPath = Paths.get(uri);
} catch (final URISyntaxException e) {
...
}
```
The generated `UR... | 2014/07/30 | [
"https://Stackoverflow.com/questions/25032716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183192/"
] | If you intend to read the resource file, you can directly use `getClass.getResourceAsStream`. This will set up the file system implictly.
The function returns `null` if your resource could not be found, otherwise you directly have an input stream to parse your resource. | In addition to @Uwe Allner and @mvreijn:
Be careful with the `URI`. Sometimes the `URI` has a wrong format (e.g. `"file:/path/..."` and correct one would be `"file:///path/..."`) and you cant get a proper `FileSystem`.
In this case it helps that the `URI` is created from the `Path`'s `toUri()` method.
In my case I ... |
25,032,716 | I have a Maven project and inside a method I want to create a path for a directory in my resources folder. This is done like this:
```
try {
final URI uri = getClass().getResource("/my-folder").toURI();
Path myFolderPath = Paths.get(uri);
} catch (final URISyntaxException e) {
...
}
```
The generated `UR... | 2014/07/30 | [
"https://Stackoverflow.com/questions/25032716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183192/"
] | Expanding on @Uwe Allner 's excellent answer, a failsafe method to use is
```
private FileSystem initFileSystem(URI uri) throws IOException
{
try
{
return FileSystems.getFileSystem(uri);
}
catch( FileSystemNotFoundException e )
{
Map<String, String> env = new HashMap<>();
e... | In addition to @Uwe Allner and @mvreijn:
Be careful with the `URI`. Sometimes the `URI` has a wrong format (e.g. `"file:/path/..."` and correct one would be `"file:///path/..."`) and you cant get a proper `FileSystem`.
In this case it helps that the `URI` is created from the `Path`'s `toUri()` method.
In my case I ... |
42,292,315 | I was given this problem during a phone interview:
>
> Suppose there is a list of ranges. For example, [[1-6],[10-19],[5-8]].
> Write a function that returns the list of combined ranges
> such that input [[1-6],[10-19],[5-8]] to the function returns
> [[1,8],[10,19]] (only the start and end number). Note, the inp... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42292315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4718049/"
] | First of all, the solution mentioned in the question is not O(nlgn), where n is the number of segments. This is O(Xlg(X))where, `X = length of the segment*num of segments`, which is terribly slow.
An O(NlgN) solution exists where N is the number of segments.
1. Sort the segments by their starting point.
2. Sweep acros... | You could use [`heapq`](https://docs.python.org/3.6/library/heapq.html) to create a heap from the ranges. Then pop range from a heap and if it overlaps with the top of the heap replace the top with merged range. If there's no overlap or there's no more ranges append it to result:
```
import heapq
def merge(ranges):
... |
42,292,315 | I was given this problem during a phone interview:
>
> Suppose there is a list of ranges. For example, [[1-6],[10-19],[5-8]].
> Write a function that returns the list of combined ranges
> such that input [[1-6],[10-19],[5-8]] to the function returns
> [[1,8],[10,19]] (only the start and end number). Note, the inp... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42292315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4718049/"
] | You could use [`heapq`](https://docs.python.org/3.6/library/heapq.html) to create a heap from the ranges. Then pop range from a heap and if it overlaps with the top of the heap replace the top with merged range. If there's no overlap or there's no more ranges append it to result:
```
import heapq
def merge(ranges):
... | In case range is [x,y] and max\_x,y is less probably within a few millions you can do this
The idea is that I use the technique of hashing to put them in sorted order taking advantage of lower max\_y.
We then iterate and keep the current 'good' range is variables mn and mx.
When a new range comes if it is entirely o... |
42,292,315 | I was given this problem during a phone interview:
>
> Suppose there is a list of ranges. For example, [[1-6],[10-19],[5-8]].
> Write a function that returns the list of combined ranges
> such that input [[1-6],[10-19],[5-8]] to the function returns
> [[1,8],[10,19]] (only the start and end number). Note, the inp... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42292315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4718049/"
] | First of all, the solution mentioned in the question is not O(nlgn), where n is the number of segments. This is O(Xlg(X))where, `X = length of the segment*num of segments`, which is terribly slow.
An O(NlgN) solution exists where N is the number of segments.
1. Sort the segments by their starting point.
2. Sweep acros... | In case range is [x,y] and max\_x,y is less probably within a few millions you can do this
The idea is that I use the technique of hashing to put them in sorted order taking advantage of lower max\_y.
We then iterate and keep the current 'good' range is variables mn and mx.
When a new range comes if it is entirely o... |
622,140 | I am getting stuck in a really easy problem in Statistical Mechanics that involves elastic collisions, it is really very shameful that I am getting stuck at such a simple thing, but from:
$$\|\vec{v\_1}\|^2 +\|\vec{v\_2}\|^2 = \|\vec{u\_1}\|^2 +\|\vec{u\_2}\|^2$$
and $$\vec{v\_1}+\vec{v\_2} = \vec{u\_1} + \vec{u\_2}$$... | 2021/03/18 | [
"https://physics.stackexchange.com/questions/622140",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/164849/"
] | You are certainly correct that the Lie algebra of $U(d)$ consists of skew-Hermitian $d \times d$ matrices. However, physicists will often implicitly complexify Lie algebras, without ever bothering to mention that they are doing it. The complexification of $u(d)$ is indeed $gl(d, \mathbb{C})$. That's because multiplying... | As far as I remember, it is only a matter of definition of the term "generator". If $H$ is hermitian
$$H^+=H$$
then $G=iH$ is skew hermitian:
$$H^+=(iG)^+=-iG=-H$$
So after all, the parameter inside the exponential differs only by an imaginary unit, which doesn't change a lot, at least notation-wise. Instead of generat... |
622,140 | I am getting stuck in a really easy problem in Statistical Mechanics that involves elastic collisions, it is really very shameful that I am getting stuck at such a simple thing, but from:
$$\|\vec{v\_1}\|^2 +\|\vec{v\_2}\|^2 = \|\vec{u\_1}\|^2 +\|\vec{u\_2}\|^2$$
and $$\vec{v\_1}+\vec{v\_2} = \vec{u\_1} + \vec{u\_2}$$... | 2021/03/18 | [
"https://physics.stackexchange.com/questions/622140",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/164849/"
] | As it is often the case the issue lies in conventions. For mathematicians the Lie Algebra generators are any basis that can span the algebra as a vector space, for physicist we usually require the generators themselves to be hermitian (e.g. think about the Pauli matrices), because of their interpretation as observables... | As far as I remember, it is only a matter of definition of the term "generator". If $H$ is hermitian
$$H^+=H$$
then $G=iH$ is skew hermitian:
$$H^+=(iG)^+=-iG=-H$$
So after all, the parameter inside the exponential differs only by an imaginary unit, which doesn't change a lot, at least notation-wise. Instead of generat... |
3,823,961 | I am using the following code for charater encoding of unicode charater. It is giving me the different string value of MD5EncryptedString when I use the value of the DataToEncrypt as 'abc' & 'ABC'
```
String DataToEncrypt="abc";
String MD5EncryptedString = String.Empty;
MD5 md5 = new MD5CryptoServiceProvider();
B... | 2010/09/29 | [
"https://Stackoverflow.com/questions/3823961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265103/"
] | Your current code isn't using *either* `ASCIIEncoding` *or* `UTF8Encoding`... it's using the default encoding on the system, because it's equivalent to just `Encoding.Default`. Accessing that static property via the two subclasses makes no difference.
To use ASCII or UTF-8, use `Encoding.ASCII` or `Encoding.UTF8`.
No... | All character encodings encode upper and lower case letters using different bytes, so there is no way to get an encoding that will do that for you.
You can always upper/lower case the string *before* hashing. |
3,823,961 | I am using the following code for charater encoding of unicode charater. It is giving me the different string value of MD5EncryptedString when I use the value of the DataToEncrypt as 'abc' & 'ABC'
```
String DataToEncrypt="abc";
String MD5EncryptedString = String.Empty;
MD5 md5 = new MD5CryptoServiceProvider();
B... | 2010/09/29 | [
"https://Stackoverflow.com/questions/3823961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265103/"
] | Your current code isn't using *either* `ASCIIEncoding` *or* `UTF8Encoding`... it's using the default encoding on the system, because it's equivalent to just `Encoding.Default`. Accessing that static property via the two subclasses makes no difference.
To use ASCII or UTF-8, use `Encoding.ASCII` or `Encoding.UTF8`.
No... | Translating character symbols to ordinals (bytes) will ALWAYS give you a different answer when you encode uppercase vs lowercase, because those two symbols are represented by two different bytecodes in the codepage. That's true for any character encoding, whether it's ASCII, Unicode, etc.
To get a case-insensitive has... |
3,823,961 | I am using the following code for charater encoding of unicode charater. It is giving me the different string value of MD5EncryptedString when I use the value of the DataToEncrypt as 'abc' & 'ABC'
```
String DataToEncrypt="abc";
String MD5EncryptedString = String.Empty;
MD5 md5 = new MD5CryptoServiceProvider();
B... | 2010/09/29 | [
"https://Stackoverflow.com/questions/3823961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265103/"
] | Translating character symbols to ordinals (bytes) will ALWAYS give you a different answer when you encode uppercase vs lowercase, because those two symbols are represented by two different bytecodes in the codepage. That's true for any character encoding, whether it's ASCII, Unicode, etc.
To get a case-insensitive has... | All character encodings encode upper and lower case letters using different bytes, so there is no way to get an encoding that will do that for you.
You can always upper/lower case the string *before* hashing. |
177,295 | My daughter is in the process of buying her first home and she paid for an inspection. The inspector found that the joists under one of the bedrooms in the center of the house that sits on a basement foundation is sagging. We both have been told this is very easily fixed however I feel like she is getting ready to buy ... | 2019/10/28 | [
"https://diy.stackexchange.com/questions/177295",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/108535/"
] | Our lawnmower shipped with pins that look like this.
[](https://i.stack.imgur.com/4IFvP.png)
I took them off because I thought they were used because they were cheap (somebody at Sears was laughing all the way to the bank over the 1" less of spring ... | I spent some time driving tractors as a contractor and also repairing them, most of the agricultural suppliers had clips like both that you show with loops or chains to stop them getting lost.
We also used to use zip ties aka cable ties to hold the free ends. |
177,295 | My daughter is in the process of buying her first home and she paid for an inspection. The inspector found that the joists under one of the bedrooms in the center of the house that sits on a basement foundation is sagging. We both have been told this is very easily fixed however I feel like she is getting ready to buy ... | 2019/10/28 | [
"https://diy.stackexchange.com/questions/177295",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/108535/"
] | I have a few trailers I rent out which use the pin with the snap-down ring -- the latter type pictured in the question. To avoid the pins being lost I made tethers from a length of 1/16" wire rope and crimp bands. Each tether fastens the ring part of the pin to the body of the trailer or door where the pin is used. Mos... | I spent some time driving tractors as a contractor and also repairing them, most of the agricultural suppliers had clips like both that you show with loops or chains to stop them getting lost.
We also used to use zip ties aka cable ties to hold the free ends. |
177,295 | My daughter is in the process of buying her first home and she paid for an inspection. The inspector found that the joists under one of the bedrooms in the center of the house that sits on a basement foundation is sagging. We both have been told this is very easily fixed however I feel like she is getting ready to buy ... | 2019/10/28 | [
"https://diy.stackexchange.com/questions/177295",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/108535/"
] | Get some Velcro cable ties and attach them to the looped end of the R clip. When you install the R clip, turn the pin so the R clip is parallel to the cross-member and wrap the strap around. | I spent some time driving tractors as a contractor and also repairing them, most of the agricultural suppliers had clips like both that you show with loops or chains to stop them getting lost.
We also used to use zip ties aka cable ties to hold the free ends. |
3,312,009 | Is it possible to use a XML element from other file in another XML?
For instance, instead of having:
```
<document>
<a><!-- huge content --></a>
<b/>
</document>
```
I would like to have:
```
<document>
<a ref="aDef"/>
<b/>
</document>
```
Where is defined in its own XML and reused where needed.
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/203801/"
] | This is what the [xinclude](http://www.w3.org/TR/xinclude/) W3C standard is for. Similar to the external entities approach (as in above answer), you can encode the content-to-be-included in a separate file, like e.g. (frag.xml):
```
<a><!-- huge content --></a>
```
In the main XML file, an xinclude instruction refer... | This is one option:
Fragment XML file (frag.xml):
```
<a><!-- huge content --></a>
```
Main XML file:
```
<!DOCTYPE document [
<!ENTITY aDef SYSTEM "frag.xml">
]>
<document>
&aDef;
<b/>
</document>
``` |
1,481 | Over the last days, I had a few attempts of vandalizing questions/answers in my "approve edit" queue. This morning, it was the user "gnu" for three times and I wonder what to do about this. Just rejecting the edit helps the immediate problem of course, but I feel this shouldn't be all.
Edit:
With Iain's help I got t... | 2011/05/06 | [
"https://meta.serverfault.com/questions/1481",
"https://meta.serverfault.com",
"https://meta.serverfault.com/users/8897/"
] | The edit
>
> sdfsfsdfsfsfsfsfsffsdfsfs df sf sf s f asf s fs df asf
>
>
>
convinced me that these edits were pretty intentional. So, in this case the user will be suspended for at least one day. Also, he'll receive a warning email.
If there are similar cases, please just flag them and add a short explanation. Mo... | Remember that if you get enough edit suggestion rejections, you cannot suggest edits for 7 days.
This is enforced both by account and by IP address. |
11,828,045 | let's say I have a interface IPerson that expose a collection of another interface ICar. ICar is implemented by the Car class, and the IPerson is implemented by the Person class. I would like that Person could expose a collection of Car, and not of ICar, but this does not seem possible without changing the IPerson inte... | 2012/08/06 | [
"https://Stackoverflow.com/questions/11828045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472131/"
] | I don't know if this solution will fit your needs, however depending on what language you are using, you could use a generic solution to achieve this kind of behavior.
For example in java
```
interface IPerson<T extends ICar> {
public T[] getCars();
// ...
}
```
This will insure that the generic type `T` m... | If I understood correctly you can just add a collection of type ICar to your Person class. Because a collection of ICar or Car are (ALMOST) the same thing. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.