qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
9,476,465 | I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error:
```
Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl.... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9476465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/516359/"
] | I just spent the day working through the "bundle format unrecognized, invalid, or unsuitable" error when codesigning a framework. In my case I'm using XCode 4.6.1 and I was trying to code sign Qt frameworks.
First note that the Apple documentation ([TN2206](http://developer.apple.com/library/mac/technotes/tn2206/_inde... | Would it be better if we shipped the sdk unsigned? It'd be a simple change, I'm hesitant to do so now since it's been like this for a little while. |
2,755,384 | Let $X\subseteq\mathbb{R}$ with $\left|X\right|=n$ and define $Y=\left\{ x+y\vert x,y\in X\right\}$. Prove that
$$\left|Y\right|\geq2n-1$$ | 2018/04/26 | [
"https://math.stackexchange.com/questions/2755384",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/389601/"
] | Let $x\_1<x\_2<\dots<x\_n$ be the sorted list of the elements of $X$. Then
$$
x\_1+x\_1<x\_1+x\_2<x\_1+x\_3<\dots<x\_1+x\_n<x\_2+x\_n<x\_3+x\_n<\dots <x\_n+x\_n
$$
are $2n-1$ distinct members of $Y$, so $|Y|\ge 2n-1$. | Use induction on $n$. Write $X = \{x\_1, \ldots, x\_n\}$, where $i<j$ implies $x\_i < x\_j$. Then by induction
$Y\_{n-1} =\{x\_i+x\_j; i,j < n\}$ has at least $2(n-1) - 1$ elements. But the two numbers $x\_n +x\_{n-1}$ and $x\_{n} + x\_{n-2}$ are each larger than any elements in $Y\_{n-1}$, and are both in $Y$. |
426,505 | I have been struggling for some time trying to define a generic interface, but I fail to
achieve what I want. The following is a simplified example of the problem.
Let's say I have a generic *Message* class
```
public class Message<T> {
private T content;
public void setContent(T content) {
this.con... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23118/"
] | It looks to me like you want:
```
public class Carrier<Thing extends Message<Foo>, Foo>
implements Transfer<Thing>
```
That way the compiler will know that `thing` is a `Message<Foo>` and will therefore have a getContent() method.
You'll need to use it as:
```
Carrier<Message<String>, String>
```
But you've ... | Regardless of how you solve your generics problem, your code will not compile because you do not have a print method that takes a type of T as a parameter.
I believe you will have to do instance of checks if you want the functionality you are looking for. So, I don't think you gain any value from the generic type in t... |
426,505 | I have been struggling for some time trying to define a generic interface, but I fail to
achieve what I want. The following is a simplified example of the problem.
Let's say I have a generic *Message* class
```
public class Message<T> {
private T content;
public void setContent(T content) {
this.con... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23118/"
] | It looks to me like you want:
```
public class Carrier<Thing extends Message<Foo>, Foo>
implements Transfer<Thing>
```
That way the compiler will know that `thing` is a `Message<Foo>` and will therefore have a getContent() method.
You'll need to use it as:
```
Carrier<Message<String>, String>
```
But you've ... | You only need to specify T for the class, and then use Message< T > for your argument/return types.
```
public interface Transfer<T> {
public void send(Message<T> message);
}
```
The reason you don't use Message< T > is because you're providing the 'this is a message' context in your arguments and return types. |
39,619 | >
> A three line whip is an ultimatum: "Show up and vote the party line, or suffer the consequences." [source](https://politics.stackexchange.com/a/16647/25686)
>
>
>
What's stopping the leaders of a party from three line whipping *every single vote*? Is there a limit on the frequency of its use, or is [the reason... | 2019/03/20 | [
"https://politics.stackexchange.com/questions/39619",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/25686/"
] | Yes, a party could pass the equivalent of a three line whip on every single division. However most votes in the House of Commons simply aren't important enough *or likely enough to be affected* for such a hardline policy to be effective. The MPs are also members of the parties and tend to share enough ideology to vote ... | Remember what the consequences for defying a whip are, and what they are not.
* The party cannot officially order a MP how to vote. That's why the generally understood convention of underlining suggestions once, twice, or three times developed.
* MPs have the **right** to leave their party. They remain MPs if they do... |
204,717 | How to generate all $ 3 \times 3 $ matrices with $ a,a,a,a,b,b,b,c,c $, which can not be obtained from each other by rotation transformation? | 2019/09/03 | [
"https://mathematica.stackexchange.com/questions/204717",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/60113/"
] | A brute force approach:
For a permutation `p`, `protations[p]` constructs the union of permutations obtained by all possible ***two-step*** rotations of its 8 elements after dropping its middle element. We use `MemberQ[protations[#], #2]&` as the test function in `DeleteDuplicates`. Then using `Partition[#, 3]&` for ... | Let me give a GroupOrbits approach, imitating many aspects of the accepted solution. Start again with all permutations of the elements:
```
list = {a, a, a, a, b, b, b, c, c};
perms = Permutations[list];
```
Again, assume each permutation defines a matrix whose central element is placed last:
```
makeMatrix[{e1_, e... |
32,842,557 | In QML, it's easy write create a property binding, such as:
```
Rectangle {
width: parent.width
}
```
Is it possible to do this in C++ too? | 2015/09/29 | [
"https://Stackoverflow.com/questions/32842557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5006372/"
] | In Qt, some `QObject`s have certain [properties](http://doc.qt.io/qt-5/properties.html) that can be "bound" using signals and slots:
```
auto *someWidget = QPushButton(/* ... */);
auto *otherRelatedWidget = QLabel( /* ... */ );
// windowTitle is a property for both QWidgets
QObject::connect(someWidget, &QWidget::windo... | In Qt6 you can use QProperty to achieve c++ property bindings.
Check out this blog post:
<https://www.qt.io/blog/property-bindings-in-qt-6>
They're slightly different than QML binding since they execute lazily. QML binding execute eagerly on every signal. Under the hood QProperty uses thread local storage (TLS) to ke... |
23,811,687 | I have a query that is providing the correct data to me but if there are multiple records in the `tuitionSubmission` table for the same `empID`, it shows duplicate results (as expected).
I am trying to use a distinct selector on this query on `A.[empID]`
Below is my Query:
`SELECT A.[empID],
A.[id],
A.[empGradDate... | 2014/05/22 | [
"https://Stackoverflow.com/questions/23811687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2628921/"
] | You're not disabling the button after the click.
```
$(this).prop('disabled', true);
```
Here's a fiddle with the code you are after: <http://jsfiddle.net/UT79m/6/> | You could add a class to set a 'selected' state after the first click:
```
$("#once").on("click", function() {
if($(this).hasClass('selected'))
return;
alert('this only happens once');
$(this).addClass('selected');
});
``` |
45,120,359 | In most examples about using secrets in Kubernetes, you can find similar examples:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: User
password: **********
```
What is the purpose of `type: Opaque` in the definition above? What other types (and for which use cases) are po... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45120359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155666/"
] | `type: Opaque` means that from kubernetes's point of view the contents of this Secret is unstructured, it can contain arbitrary key-value pairs.
In contrast, there is the Secret storing `ServiceAccount` credentials, or the ones used as `ImagePullSecret`. These have a constrained contents. | looks like its read only value for clients, clients are not allowed to modify this value.
>
> This value MUST be treated as opaque by clients and passed unmodified
> back to the serve
>
>
>
this page has the details in the resourceVersion filed.
---
edit
----
link change here is the document info:
>
> resou... |
45,120,359 | In most examples about using secrets in Kubernetes, you can find similar examples:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: User
password: **********
```
What is the purpose of `type: Opaque` in the definition above? What other types (and for which use cases) are po... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45120359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155666/"
] | The source code lists all the types:
<https://github.com/kubernetes/kubernetes/blob/release-1.14/pkg/apis/core/types.go#L4447> | looks like its read only value for clients, clients are not allowed to modify this value.
>
> This value MUST be treated as opaque by clients and passed unmodified
> back to the serve
>
>
>
this page has the details in the resourceVersion filed.
---
edit
----
link change here is the document info:
>
> resou... |
45,120,359 | In most examples about using secrets in Kubernetes, you can find similar examples:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: User
password: **********
```
What is the purpose of `type: Opaque` in the definition above? What other types (and for which use cases) are po... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45120359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155666/"
] | All types:
```
SecretType = "Opaque" // Opaque (arbitrary data; default)
SecretType = "kubernetes.io/service-account-token" // Kubernetes auth token
SecretType = "kubernetes.io/dockercfg" // Docker registry auth
SecretType = "kubernetes.io/dockerconfigjson" // ... | looks like its read only value for clients, clients are not allowed to modify this value.
>
> This value MUST be treated as opaque by clients and passed unmodified
> back to the serve
>
>
>
this page has the details in the resourceVersion filed.
---
edit
----
link change here is the document info:
>
> resou... |
45,120,359 | In most examples about using secrets in Kubernetes, you can find similar examples:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: User
password: **********
```
What is the purpose of `type: Opaque` in the definition above? What other types (and for which use cases) are po... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45120359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155666/"
] | `type: Opaque` means that from kubernetes's point of view the contents of this Secret is unstructured, it can contain arbitrary key-value pairs.
In contrast, there is the Secret storing `ServiceAccount` credentials, or the ones used as `ImagePullSecret`. These have a constrained contents. | The source code lists all the types:
<https://github.com/kubernetes/kubernetes/blob/release-1.14/pkg/apis/core/types.go#L4447> |
45,120,359 | In most examples about using secrets in Kubernetes, you can find similar examples:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: User
password: **********
```
What is the purpose of `type: Opaque` in the definition above? What other types (and for which use cases) are po... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45120359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155666/"
] | `type: Opaque` means that from kubernetes's point of view the contents of this Secret is unstructured, it can contain arbitrary key-value pairs.
In contrast, there is the Secret storing `ServiceAccount` credentials, or the ones used as `ImagePullSecret`. These have a constrained contents. | All types:
```
SecretType = "Opaque" // Opaque (arbitrary data; default)
SecretType = "kubernetes.io/service-account-token" // Kubernetes auth token
SecretType = "kubernetes.io/dockercfg" // Docker registry auth
SecretType = "kubernetes.io/dockerconfigjson" // ... |
45,120,359 | In most examples about using secrets in Kubernetes, you can find similar examples:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: User
password: **********
```
What is the purpose of `type: Opaque` in the definition above? What other types (and for which use cases) are po... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45120359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155666/"
] | All types:
```
SecretType = "Opaque" // Opaque (arbitrary data; default)
SecretType = "kubernetes.io/service-account-token" // Kubernetes auth token
SecretType = "kubernetes.io/dockercfg" // Docker registry auth
SecretType = "kubernetes.io/dockerconfigjson" // ... | The source code lists all the types:
<https://github.com/kubernetes/kubernetes/blob/release-1.14/pkg/apis/core/types.go#L4447> |
2,038,226 | I have a quarter 1 test tomorrow and I have looked on many websites containing set builder notation to find domain and range but I still don't understand. Is there anyway to remember it or even how to do it?? | 2016/12/01 | [
"https://math.stackexchange.com/questions/2038226",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/394773/"
] | If you're given a graph the range is all of the $y$ values and the domain is all of the $x$ values where the graph exists.
For example, consider this graph
[](https://i.stack.imgur.com/Maj5S.png)
What are the $x$ values at which the function is defi... | Going off the comment, I assume you want to know how to give the domain and range of a function *using* set builder notation. For a given function $f(x)$, you can think of the domain as everything that you can put into the function, and the range as everything that you can get out of the function. For example, if we ha... |
2,038,226 | I have a quarter 1 test tomorrow and I have looked on many websites containing set builder notation to find domain and range but I still don't understand. Is there anyway to remember it or even how to do it?? | 2016/12/01 | [
"https://math.stackexchange.com/questions/2038226",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/394773/"
] | I'm going to make some assumptions, let me know if this is what you have in mind.
Suppose we are given this graph:
[](https://i.stack.imgur.com/g1mmK.png)
and we are asked to give the domain and range of the function in set builder notation.
We can... | Going off the comment, I assume you want to know how to give the domain and range of a function *using* set builder notation. For a given function $f(x)$, you can think of the domain as everything that you can put into the function, and the range as everything that you can get out of the function. For example, if we ha... |
2,038,226 | I have a quarter 1 test tomorrow and I have looked on many websites containing set builder notation to find domain and range but I still don't understand. Is there anyway to remember it or even how to do it?? | 2016/12/01 | [
"https://math.stackexchange.com/questions/2038226",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/394773/"
] | If you're given a graph the range is all of the $y$ values and the domain is all of the $x$ values where the graph exists.
For example, consider this graph
[](https://i.stack.imgur.com/Maj5S.png)
What are the $x$ values at which the function is defi... | I'm going to make some assumptions, let me know if this is what you have in mind.
Suppose we are given this graph:
[](https://i.stack.imgur.com/g1mmK.png)
and we are asked to give the domain and range of the function in set builder notation.
We can... |
61,779,052 | I am on Ubuntu 20.04 (not on ZFS). However, somehow I got this error:
>
> ERROR couldn't connect to zsys daemon: connection error: desc = "transport: Error while dialing dial unix /run/zsysd.sock: connect: connection refused"
>
>
>
The error screenshot
[ in /etc/apt/apt.conf.d/90\_zsys\_system\_autosnapshot
>
> // Takes a snapshot of the system before package changes.
>
>
> #DPkg::Pre-Invoke {"/usr/l... | Because I have a dual-boot system I agree with the option of "comment out" zsys commands per above. I say this because one could attempt to install the ZFS file system (so I've read) to existing installs of Ubuntu 19.10 (and later?) to make the error go away, but according to the following article attempting to do so w... |
61,779,052 | I am on Ubuntu 20.04 (not on ZFS). However, somehow I got this error:
>
> ERROR couldn't connect to zsys daemon: connection error: desc = "transport: Error while dialing dial unix /run/zsysd.sock: connect: connection refused"
>
>
>
The error screenshot
[ to existing installs of Ubuntu 19.10 (and later?) to make the error go away, but according to the following article attempting to do so w... |
16,145,323 | There appear to be two NuGet packages to use async/await in Silverlight applications. I've used
<http://nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack>
so far, but this didn't show up in the search anymore. Instead I found
<http://nuget.org/packages/Microsoft.Bcl.Async/>
However, both are last cha... | 2013/04/22 | [
"https://Stackoverflow.com/questions/16145323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/870815/"
] | [`Microsoft.Bcl.Async` is a replacement for `Microsoft.CompilerServices.AsyncTargetingPack`.](http://blogs.msdn.com/b/bclteam/archive/2013/04/17/microsoft-bcl-async-is-now-stable.aspx)
It is not typical to supersede one package with another on NuGet unless you change its name. In this particular case, I believe `Async... | I am on Windows XP with VS2010 and .NET 4.0 with Async CTP and other extensions for C# 5.0
Here is my post [how I get/use extensions for C# 5.0 in .NET 4.0](https://stackoverflow.com/a/15972581/2031316), which (.NET 4.0 on machine without installed .NET 4.5) is different from .NET 4.0 on machine with installed .NET ... |
13,722,998 | Now a days in several of my iOS applications I need to get adjacent views recursively. I wonder if we have any thing like `viewAtLocation:(CGPoint)location`? Or there's any way we can implement it.
I have used several ways like C array `id matrix[row][col]` with location decided by size as index value, and retrieving ... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13722998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656600/"
] | It's best to use the standard [`hitTest:withEvent`](https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/instm/UIView/hitTest%3awithEvent%3a) which will handle things like ignoring a view if it's opacity is 0.0. The documentation says to pass in `nil` for... | The following code will do it for you bro
```
UIView *view = <Your View>;
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[view addGestureRecognizer:recognizer];
[recognizer release];
- (void)handleSingleTap:(UITapGestureRecognizer*)recogni... |
37,921,749 | I have searched around, all questions are something about [How to pass props to {this.props.children}](https://stackoverflow.com/questions/32370994/how-to-pass-props-to-this-props-children)
But my situation is different,
I fill `App` with a initial data -- `nodes`, and map `nodes` to a `TreeNode`list, and I want each... | 2016/06/20 | [
"https://Stackoverflow.com/questions/37921749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1637673/"
] | When looping on `nodes` values, you call `TreeNode` and give the property `info`: that is good!
But when your component is rendered, this function is called:
```
function mapStateToProps(state) {
return {
open: state.open,
info: state.info,
nodes: state.nodes
};
}
```
As you can see, the prop `info... | It's because you are rendering a Redux connected component from within a parent Redux connected component and trying to pass props into it as state.
Why does TreeNode.js need to be connected to Redux? Props/Actions should be passed uni-directionally with only the top level component connected to state and all child co... |
7,330,705 | I am editing a field in gridview and would like that the edited value not be allowed to be greater than the old value?
is there a front end validation for this? so as to not use a javascript popup
Thanks
```
<asp:TemplateField HeaderText="FC Amount">
<ItemTemplate>
<asp:Label ID="FCLabel"... | 2011/09/07 | [
"https://Stackoverflow.com/questions/7330705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883937/"
] | This is most likely a problem with the ssh server implementation, as i have tried using two different ssh clients and getting the same result. My solution ended up being a client-side tail logic, instead of "tail -f" to prevent free roaming processes. | openssh doesn't support it <https://bugzilla.mindrot.org/show_bug.cgi?id=1424>
Just use cmd.close(), that should term the process as well |
7,330,705 | I am editing a field in gridview and would like that the edited value not be allowed to be greater than the old value?
is there a front end validation for this? so as to not use a javascript popup
Thanks
```
<asp:TemplateField HeaderText="FC Amount">
<ItemTemplate>
<asp:Label ID="FCLabel"... | 2011/09/07 | [
"https://Stackoverflow.com/questions/7330705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883937/"
] | openssh doesn't support it <https://bugzilla.mindrot.org/show_bug.cgi?id=1424>
Just use cmd.close(), that should term the process as well | Had a similar issue recently. In my specific case it was the OpenSSH issue mentioned by @shikhar.
My solution was to run start another session (sharing the connection) and run a kill command `pgrep mycommand | xargs kill`. |
7,330,705 | I am editing a field in gridview and would like that the edited value not be allowed to be greater than the old value?
is there a front end validation for this? so as to not use a javascript popup
Thanks
```
<asp:TemplateField HeaderText="FC Amount">
<ItemTemplate>
<asp:Label ID="FCLabel"... | 2011/09/07 | [
"https://Stackoverflow.com/questions/7330705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883937/"
] | Allocating a PTY and sending a Ctrl+C character code did the trick for me:
```
final Session session = ssh.startSession();
session.allocateDefaultPTY();
try {
final Command cmd = session.exec("tail -f /var/log/syslog");
// Send Ctrl+C (character code is 0x03):
cmd.getOutputStream().write(3);
cmd.getOu... | openssh doesn't support it <https://bugzilla.mindrot.org/show_bug.cgi?id=1424>
Just use cmd.close(), that should term the process as well |
7,330,705 | I am editing a field in gridview and would like that the edited value not be allowed to be greater than the old value?
is there a front end validation for this? so as to not use a javascript popup
Thanks
```
<asp:TemplateField HeaderText="FC Amount">
<ItemTemplate>
<asp:Label ID="FCLabel"... | 2011/09/07 | [
"https://Stackoverflow.com/questions/7330705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883937/"
] | This is most likely a problem with the ssh server implementation, as i have tried using two different ssh clients and getting the same result. My solution ended up being a client-side tail logic, instead of "tail -f" to prevent free roaming processes. | Had a similar issue recently. In my specific case it was the OpenSSH issue mentioned by @shikhar.
My solution was to run start another session (sharing the connection) and run a kill command `pgrep mycommand | xargs kill`. |
7,330,705 | I am editing a field in gridview and would like that the edited value not be allowed to be greater than the old value?
is there a front end validation for this? so as to not use a javascript popup
Thanks
```
<asp:TemplateField HeaderText="FC Amount">
<ItemTemplate>
<asp:Label ID="FCLabel"... | 2011/09/07 | [
"https://Stackoverflow.com/questions/7330705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883937/"
] | Allocating a PTY and sending a Ctrl+C character code did the trick for me:
```
final Session session = ssh.startSession();
session.allocateDefaultPTY();
try {
final Command cmd = session.exec("tail -f /var/log/syslog");
// Send Ctrl+C (character code is 0x03):
cmd.getOutputStream().write(3);
cmd.getOu... | Had a similar issue recently. In my specific case it was the OpenSSH issue mentioned by @shikhar.
My solution was to run start another session (sharing the connection) and run a kill command `pgrep mycommand | xargs kill`. |
520,146 | Because, physically, if the volume is constant and the pressure increases, won't it mean that there is an increase in that internal energy?
If not, how else should we perceive it? | 2019/12/17 | [
"https://physics.stackexchange.com/questions/520146",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111833/"
] | It’s called an isochoric (constant volume) heat transfer process. For an ideal gas the ratio of pressure to temperature is constant and the change in internal energy is $C\_{V}\Delta T$.
Hope this helps | Let's illustrate this for an ideal gas. (In general, we should be considering thermodynamic potentials.) Using the ideal gas law $pV=nRT$, we can put this in differential form by noting that
$$d(nRT) = d(pV)\Longrightarrow nR dT = Vdp+pdV,$$
where we have assumed that the system is closed ($n=$ constant). Now, during a... |
520,146 | Because, physically, if the volume is constant and the pressure increases, won't it mean that there is an increase in that internal energy?
If not, how else should we perceive it? | 2019/12/17 | [
"https://physics.stackexchange.com/questions/520146",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111833/"
] | It’s called an isochoric (constant volume) heat transfer process. For an ideal gas the ratio of pressure to temperature is constant and the change in internal energy is $C\_{V}\Delta T$.
Hope this helps | For a single phase fluid of constant composition, the change in molar internal energy can be determined for any arbitrary variation of T vs P by integrating the equation $$dU=C\_vdT-\left[P-T\left(\frac{\partial P}{\partial T}\right)\_V\right]\left(\frac{\partial V}{\partial P}\right)\_TdP$$This integral will depend on... |
520,146 | Because, physically, if the volume is constant and the pressure increases, won't it mean that there is an increase in that internal energy?
If not, how else should we perceive it? | 2019/12/17 | [
"https://physics.stackexchange.com/questions/520146",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111833/"
] | If the volume does not change, then there is no work being done on or by the system. Any change in internal energy would be associated with the process which caused the change in pressure: heat or gas being added or removed. | Let's illustrate this for an ideal gas. (In general, we should be considering thermodynamic potentials.) Using the ideal gas law $pV=nRT$, we can put this in differential form by noting that
$$d(nRT) = d(pV)\Longrightarrow nR dT = Vdp+pdV,$$
where we have assumed that the system is closed ($n=$ constant). Now, during a... |
520,146 | Because, physically, if the volume is constant and the pressure increases, won't it mean that there is an increase in that internal energy?
If not, how else should we perceive it? | 2019/12/17 | [
"https://physics.stackexchange.com/questions/520146",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/111833/"
] | If the volume does not change, then there is no work being done on or by the system. Any change in internal energy would be associated with the process which caused the change in pressure: heat or gas being added or removed. | For a single phase fluid of constant composition, the change in molar internal energy can be determined for any arbitrary variation of T vs P by integrating the equation $$dU=C\_vdT-\left[P-T\left(\frac{\partial P}{\partial T}\right)\_V\right]\left(\frac{\partial V}{\partial P}\right)\_TdP$$This integral will depend on... |
7,861,850 | Hello guys i am grabing results from my mysql db and have made a html form and have put a submit button in side the php to submit the form.
```
<form method="post" action="buydo.php">
<label><br />
<br />
</label>
<p>
<?php
$sql = ... | 2011/10/22 | [
"https://Stackoverflow.com/questions/7861850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008843/"
] | Try creating a hidden input just above the submit input (it can go anywhere really, but having it there improves readability). Set the name to something static - for example, "pokemonID" - and set the value attribute to whatever you want to send to the next page. In this case, it would be $v['id']. Something similar to... | If I understand you correct you do load the `buydo.php` page but you don't get the value submitted so that you can access it using `$_POST`?
That's because you don't have any input-elements in your form. Adding a hidden field would do the trick:
```
<input type="hidden" name="vid" value="'.$v['id'].'">
```
Now you ... |
7,861,850 | Hello guys i am grabing results from my mysql db and have made a html form and have put a submit button in side the php to submit the form.
```
<form method="post" action="buydo.php">
<label><br />
<br />
</label>
<p>
<?php
$sql = ... | 2011/10/22 | [
"https://Stackoverflow.com/questions/7861850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008843/"
] | Try creating a hidden input just above the submit input (it can go anywhere really, but having it there improves readability). Set the name to something static - for example, "pokemonID" - and set the value attribute to whatever you want to send to the next page. In this case, it would be $v['id']. Something similar to... | The `id` attribute does not generally get posted, its main use is within the same HTML as an identifier.
What gets submitted via POST (or GET) are the name and value fields:
For example: `<input name='inputname' value='inputvalue' />` would make the submission target page get a $\_POST['inputname']='inputvalue'
You ... |
44,341,721 | I am trying to display the image directly in HTML through a dynamic link I generated by Javascript.
```
function dynamicUrl() {
var url = "http://xxx.xxx.xxx" + dynamic_variables + ".jpg";
return url;}
```
Most of my research, people display image by click on buttons
or what I can do for now is link to the image.
... | 2017/06/03 | [
"https://Stackoverflow.com/questions/44341721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6946522/"
] | Dynamic create DOM for example:
```js
function dynamicUrl() {
var url = "https://is1-ssl.mzstatic.com/image/thumb/Purple111/v4/dd/95/7e/dd957e3a-abd3-da8a-2211-726a67108938/source/256x256bb.jpg";
return url;
}
var img = document.createElement("img");
img.src = dynamicUrl();
document.body.appendChild(img);
`... | Adding a **id** for the link element
```
<a id="link" href="">test</a>
```
Using click event of link element
```
var link = document.getElementById("link");
link.onclick = function goToDynamicUrl() {
var url = "https://image.flaticon.com/teams/new/1-freepik.jpg";
window.location.href = url;
}
``` |
44,341,721 | I am trying to display the image directly in HTML through a dynamic link I generated by Javascript.
```
function dynamicUrl() {
var url = "http://xxx.xxx.xxx" + dynamic_variables + ".jpg";
return url;}
```
Most of my research, people display image by click on buttons
or what I can do for now is link to the image.
... | 2017/06/03 | [
"https://Stackoverflow.com/questions/44341721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6946522/"
] | Dynamic create DOM for example:
```js
function dynamicUrl() {
var url = "https://is1-ssl.mzstatic.com/image/thumb/Purple111/v4/dd/95/7e/dd957e3a-abd3-da8a-2211-726a67108938/source/256x256bb.jpg";
return url;
}
var img = document.createElement("img");
img.src = dynamicUrl();
document.body.appendChild(img);
`... | Here is another method:
```
<div id="dimg">Here add image</div>
<script>
var dimg = document.getElementById('dimg');
function addImg(dv){
dimg.innerHTML ='<img src="http://xxx.xxx.xxx'+ dv +'.jpg'" >';
}
addImg('imgname');
</script>
``` |
71,077,435 | For my wxWidgets project, I am trying to make the switch from my self-written Makefile to Cmake. I develop on macOS.
When I was writing that Makefile I ran into an issue with libtiff. I wanted to statically link my application so that I don't have to distribute any dylibs myself or rely on my users to install them. I ... | 2022/02/11 | [
"https://Stackoverflow.com/questions/71077435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16320854/"
] | Set `wxWidgets_USE_STATIC=ON` before calling `find_package(wxWidgets)`. See the documentation for `wxWidgets` here: <https://cmake.org/cmake/help/latest/module/FindwxWidgets.html>
```
option(wxWidgets_USE_STATIC "Link to wxWidgets statically" ON)
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
i... | My search-and-replace idea turned out to be not so bad. I was able to achieve the same outcome with Cmake as with my Makefile.
My problem was not using double quotes in the appropriate place. So instead of this:
```
string(REPLACE "-ltiff" "/usr/local/opt/libtiff/lib/libtiff.a" wxWidgets_LIBRARIES ${wxWidgets_LIBRARI... |
13,160 | I was just watching a History Channel documentary [on YouTube](http://www.youtube.com/watch?v=R6JOMvOwECo) called "Kingjongilia" about people who have managed to escape North Korea.
Having visited South Korea a bunch of times now, I realize I didn't notice any kind of museum on these people and their plight. Googling ... | 2013/01/30 | [
"https://travel.stackexchange.com/questions/13160",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/140/"
] | Unfortunately, I do not have a positive answer to this question. I have been looking around the web for a few days now and I am almost sure there is no such museum. I have been through the [list of museums in South Korea](http://en.wikipedia.org/wiki/List_of_museums_in_South_Korea) with the help of Google Translate but... | Specific to defectors, not really. I think that would aggravate things more then anything. While South Koreans are aware of the "struggle" of many of their Northern brethren, things like the Ministry of Unification look actively to bond both cultures rather then highlight the differences.
If you're looking for a glim... |
19,617,947 | So I have this Class c, and I want to get the Class object that represents an array of the type c represents. Is it possible? I can't find any way...
Clarifying: somewhere else I have:
```
Class<?> c = Class.forName("data.Person");
```
OK, so I have this class `c` now. And I want to have the `Class` that represents... | 2013/10/27 | [
"https://Stackoverflow.com/questions/19617947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1217989/"
] | I think you want `Array.newInstance(c, 0).getClass()`. | To create Class instance of some array type you can also use Class.forName(). You just need to surround base type with `[L` and `;` (numbers of `[` is number of dimensions), so
* class of one dimensional array of Strings `String[].class` would be `[Ljava.lang.String;`,
* class of two dimensional array of Strings `Str... |
5,069,482 | I have a window with a Grid on.
On this I have some buttons, one of which when clicked will create a new 'PostIt' which is a user control I have created.
What I want to do is click on a 'PostIt' and have that control on top of all the others.
I have tried...
```
Grid.SetZIndex(sender, value);
```
Which seems to b... | 2011/02/21 | [
"https://Stackoverflow.com/questions/5069482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/587730/"
] | Are you calling Grid.SetZIndex(sender, value) in a handler of the PostIt mouse click, or a handler for a control inside the PostIt? What is the value that you are setting?
Here is an example that works:
```
<UserControl x:Class="WpfApplication1.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006... | This may not be the best solution, but it's the one that worked for me; I was re-ordering two grids:
```
GridOnBottom.SetValue(Grid.ZIndexProperty, (int)GridOnTop.GetValue(Grid.ZIndexProperty) + 1);
```
...with GridOnBottom and GridOnTop renamed to the instances of the objects you're re-ordering. Granted, it's not t... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | Not exactly an answer to your question, but of interest:
<https://issues.apache.org/jira/browse/MCOMPILER-75>
I'm afraid there are a number of issues using JSR 269 in Maven, at least with the default compiler plugin. | I had this issue with GWTP Source Generate APT Processing annotations
It was because I didn't set a version for the compiler plugin, my final setup:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<s... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | The plugin was using the harcoded Windows classpath separator to build the classpath, so it was failing on my Linux machine.
Submitted patches:
* [system dependent path separator character](http://code.google.com/p/maven-annotation-plugin/issues/detail?id=1)
* [Allow the default processor discovery mechanism to run](... | I've been using the `maven-processor-plugin` as follows:
```
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process-my-annotations</id>
<goals>
<goal>process</goal>
<... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | Not exactly an answer to your question, but of interest:
<https://issues.apache.org/jira/browse/MCOMPILER-75>
I'm afraid there are a number of issues using JSR 269 in Maven, at least with the default compiler plugin. | I may be missing something but shouldn't you:
1. Generate sources in `target/generated-sources/annotation-processing` during the `generate-sources` phase? The [apt-maven-plugin](http://mojo.codehaus.org/apt-maven-plugin/) or the [maven-annotation-plugin](http://code.google.com/p/maven-annotation-plugin/) could help.
2... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | Not exactly an answer to your question, but of interest:
<https://issues.apache.org/jira/browse/MCOMPILER-75>
I'm afraid there are a number of issues using JSR 269 in Maven, at least with the default compiler plugin. | One reason for this could be that $JAVA\_HOME is pointing to jdk 1.5 version instead of 1.6. (on windows check %JAVA\_HOME% of course) |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | I had this issue with GWTP Source Generate APT Processing annotations
It was because I didn't set a version for the compiler plugin, my final setup:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<s... | I've been using the `maven-processor-plugin` as follows:
```
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process-my-annotations</id>
<goals>
<goal>process</goal>
<... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | I may be missing something but shouldn't you:
1. Generate sources in `target/generated-sources/annotation-processing` during the `generate-sources` phase? The [apt-maven-plugin](http://mojo.codehaus.org/apt-maven-plugin/) or the [maven-annotation-plugin](http://code.google.com/p/maven-annotation-plugin/) could help.
2... | I've been using the `maven-processor-plugin` as follows:
```
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process-my-annotations</id>
<goals>
<goal>process</goal>
<... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | Not exactly an answer to your question, but of interest:
<https://issues.apache.org/jira/browse/MCOMPILER-75>
I'm afraid there are a number of issues using JSR 269 in Maven, at least with the default compiler plugin. | I've been using the `maven-processor-plugin` as follows:
```
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process-my-annotations</id>
<goals>
<goal>process</goal>
<... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | The plugin was using the harcoded Windows classpath separator to build the classpath, so it was failing on my Linux machine.
Submitted patches:
* [system dependent path separator character](http://code.google.com/p/maven-annotation-plugin/issues/detail?id=1)
* [Allow the default processor discovery mechanism to run](... | I had this issue with GWTP Source Generate APT Processing annotations
It was because I didn't set a version for the compiler plugin, my final setup:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<s... |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | The plugin was using the harcoded Windows classpath separator to build the classpath, so it was failing on my Linux machine.
Submitted patches:
* [system dependent path separator character](http://code.google.com/p/maven-annotation-plugin/issues/detail?id=1)
* [Allow the default processor discovery mechanism to run](... | One reason for this could be that $JAVA\_HOME is pointing to jdk 1.5 version instead of 1.6. (on windows check %JAVA\_HOME% of course) |
1,588,038 | I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:
```
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<conf... | 2009/10/19 | [
"https://Stackoverflow.com/questions/1588038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112671/"
] | The plugin was using the harcoded Windows classpath separator to build the classpath, so it was failing on my Linux machine.
Submitted patches:
* [system dependent path separator character](http://code.google.com/p/maven-annotation-plugin/issues/detail?id=1)
* [Allow the default processor discovery mechanism to run](... | Not exactly an answer to your question, but of interest:
<https://issues.apache.org/jira/browse/MCOMPILER-75>
I'm afraid there are a number of issues using JSR 269 in Maven, at least with the default compiler plugin. |
34,165,244 | I want to create a scatterplot in ggplot where there are multiple y values for each x value. I want to add these y values and plot the sum against the x value.
```
>df
a b
1 2
1 2
2 1
2 4
3 1
3 5
```
I want a plot that plots the sums of the b values for each a
```
a b
1 4
2 5
3 6
```
I can do this for a barplot b... | 2015/12/08 | [
"https://Stackoverflow.com/questions/34165244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5009249/"
] | I don't see anything stacked about your bar chart example. If you just want to summarize the values to a single pont, you can use `stat_summary`
```
ggplot(data=df, aes(x=a, y=b)) + stat_summary(fun.y=sum, geom="point")
``` | There are many ways to achieve this effect - of a 'histogram' but without bars, whose height is the sum of all values at the same X.
This type of graph is called a Cleveland Dot Plot, and is used because the conspicuous bars of a histogram can a distraction or at worse be misleading. (see works by Cleveland, Tufte etc... |
537,843 | I understood the concept of cross product with an example of Torque. I understood the concept.
But what confuses me is that how can cross product of two orthogonal vector in a plane give us the product which is in other axis.
i × j =k, how is that possible.
Eg:- This is a spinner.
[ ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and a... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520461/"
] | This does seem to be the problem, but there is a simpler fix I found from perusing the comments at [carlhuda issues 431](https://github.com/carlhuda/bundler/issues/431)
I had the same problem and it worked for me. Simply change the `require` method to be `Kernel.require`.
After that there's no need to pepper your co... | There is a fix, but you'll need to jump through few hoops.
First delay **image\_science** load:
`gem 'image_science', :require => false`
Then monkey patch **ruby-inline** (which **image\_science** relies on). Place this code in config/initializers/ruby\_inline\_hack.rb:
```
class Inline::C
def load
require "#... |
4,280,878 | I had a working (and working well) ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and a... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520461/"
] | There is a fix, but you'll need to jump through few hoops.
First delay **image\_science** load:
`gem 'image_science', :require => false`
Then monkey patch **ruby-inline** (which **image\_science** relies on). Place this code in config/initializers/ruby\_inline\_hack.rb:
```
class Inline::C
def load
require "#... | One note on aremave's answer:
It looks like the original code has a bug! It's not using short-cut-evaluation!
```
class Inline::C
def load
require "#{so_name}" || raise LoadError, "require on #{so_name} failed"
end
end
```
Notice the || , which will stop the evaluation of the logical expression if the first... |
4,280,878 | I had a working (and working well) ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and a... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520461/"
] | There is a fix, but you'll need to jump through few hoops.
First delay **image\_science** load:
`gem 'image_science', :require => false`
Then monkey patch **ruby-inline** (which **image\_science** relies on). Place this code in config/initializers/ruby\_inline\_hack.rb:
```
class Inline::C
def load
require "#... | as seen on [bundler issue tracker](https://github.com/carlhuda/bundler/issues/431#issuecomment-863571), it worked for me.
>
> Point your gem file to <https://github.com/asynchrony/image_science> We rebuilt image science without ruby inline.
>
>
> |
4,280,878 | I had a working (and working well) ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and a... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520461/"
] | This does seem to be the problem, but there is a simpler fix I found from perusing the comments at [carlhuda issues 431](https://github.com/carlhuda/bundler/issues/431)
I had the same problem and it worked for me. Simply change the `require` method to be `Kernel.require`.
After that there's no need to pepper your co... | One note on aremave's answer:
It looks like the original code has a bug! It's not using short-cut-evaluation!
```
class Inline::C
def load
require "#{so_name}" || raise LoadError, "require on #{so_name} failed"
end
end
```
Notice the || , which will stop the evaluation of the logical expression if the first... |
4,280,878 | I had a working (and working well) ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and a... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520461/"
] | This does seem to be the problem, but there is a simpler fix I found from perusing the comments at [carlhuda issues 431](https://github.com/carlhuda/bundler/issues/431)
I had the same problem and it worked for me. Simply change the `require` method to be `Kernel.require`.
After that there's no need to pepper your co... | as seen on [bundler issue tracker](https://github.com/carlhuda/bundler/issues/431#issuecomment-863571), it worked for me.
>
> Point your gem file to <https://github.com/asynchrony/image_science> We rebuilt image science without ruby inline.
>
>
> |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | A register is a storage area inside the CPU. Here are some definitions:
* A register file is an array of registers - see <http://en.wikipedia.org/wiki/Register_file> for a full description.
* The eax register is the accumulator register of the Intel x86 family of CPUs - it's the place where integer maths gets done.
* ... | A "hardware register" might also refer to a location inside some hardware device. For example, a UART (COM port) looks like a D-shaped connector with 9 or 25 pins from outside the cabinet, but to the device driver it looks like several configuration registers, a status register, and data registers holding the next char... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | A register is a storage area inside the CPU. Here are some definitions:
* A register file is an array of registers - see <http://en.wikipedia.org/wiki/Register_file> for a full description.
* The eax register is the accumulator register of the Intel x86 family of CPUs - it's the place where integer maths gets done.
* ... | A register is the most basic data storage device. Now these are the main differences.
A register file is generally a large collection of registers organised in such a way so that they are used for computations. In a modern processor, all computations are performed between values stored in several registers in a regist... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | Well, you have general purpose registers, then you have registers which have special usage (for example, the program counter registers), and you have various others (memory/segment registers, SSE).
EAX, EBX, etc. are the standard general purpose registers. You can use them for whatever you want. Usually, the return va... | A "hardware register" might also refer to a location inside some hardware device. For example, a UART (COM port) looks like a D-shaped connector with 9 or 25 pins from outside the cabinet, but to the device driver it looks like several configuration registers, a status register, and data registers holding the next char... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | A register is a storage area inside the CPU. Here are some definitions:
* A register file is an array of registers - see <http://en.wikipedia.org/wiki/Register_file> for a full description.
* The eax register is the accumulator register of the Intel x86 family of CPUs - it's the place where integer maths gets done.
* ... | a register is a small bit of memory that sits inside the CPU. and is used by assembly language to perform various tasks.
could it be that by program register you mean program counter? |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | A register is the most basic data storage device. Now these are the main differences.
A register file is generally a large collection of registers organised in such a way so that they are used for computations. In a modern processor, all computations are performed between values stored in several registers in a regist... | In relation to the question, there are two general types of registers that you should consider:
* program registers
* hardware registers
The hardware registers are clocked (updated on clock ticks) and are used in the **physical** design of processor circuitry.
The program registers are random-access memory and are... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | A "hardware register" might also refer to a location inside some hardware device. For example, a UART (COM port) looks like a D-shaped connector with 9 or 25 pins from outside the cabinet, but to the device driver it looks like several configuration registers, a status register, and data registers holding the next char... | In relation to the question, there are two general types of registers that you should consider:
* program registers
* hardware registers
The hardware registers are clocked (updated on clock ticks) and are used in the **physical** design of processor circuitry.
The program registers are random-access memory and are... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | a register is a small bit of memory that sits inside the CPU. and is used by assembly language to perform various tasks.
could it be that by program register you mean program counter? | In relation to the question, there are two general types of registers that you should consider:
* program registers
* hardware registers
The hardware registers are clocked (updated on clock ticks) and are used in the **physical** design of processor circuitry.
The program registers are random-access memory and are... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | Well, you have general purpose registers, then you have registers which have special usage (for example, the program counter registers), and you have various others (memory/segment registers, SSE).
EAX, EBX, etc. are the standard general purpose registers. You can use them for whatever you want. Usually, the return va... | In relation to the question, there are two general types of registers that you should consider:
* program registers
* hardware registers
The hardware registers are clocked (updated on clock ticks) and are used in the **physical** design of processor circuitry.
The program registers are random-access memory and are... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | A register is a storage area inside the CPU. Here are some definitions:
* A register file is an array of registers - see <http://en.wikipedia.org/wiki/Register_file> for a full description.
* The eax register is the accumulator register of the Intel x86 family of CPUs - it's the place where integer maths gets done.
* ... | In relation to the question, there are two general types of registers that you should consider:
* program registers
* hardware registers
The hardware registers are clocked (updated on clock ticks) and are used in the **physical** design of processor circuitry.
The program registers are random-access memory and are... |
814,448 | I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register? | 2009/05/02 | [
"https://Stackoverflow.com/questions/814448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92676/"
] | a register is a small bit of memory that sits inside the CPU. and is used by assembly language to perform various tasks.
could it be that by program register you mean program counter? | A "hardware register" might also refer to a location inside some hardware device. For example, a UART (COM port) looks like a D-shaped connector with 9 or 25 pins from outside the cabinet, but to the device driver it looks like several configuration registers, a status register, and data registers holding the next char... |
1,992,494 | The following series converges to exponential.
$\sum\_{i=0}^{\infty} \frac{x^i}{i!} = e^{x}$
Is the convergence of the following series known?
$\sum\_{i=0}^{\infty} \frac{(x-i)^i}{i!}$ | 2016/10/31 | [
"https://math.stackexchange.com/questions/1992494",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | This series diverges. In fact the terms $\frac{(x-i)^i}{i!}$ do not even tend to zero for any fixed $x$. | Your series is [asymptotically equivalent](https://artofproblemsolving.com/wiki/index.php?title=Asymptotic_equivalence) to
$$
\sum\_{i=0}^\infty\frac{(-1)^ii^i}{i!}
$$
Absolute value of each term of the above series is greater than $1$ (except the first two terms) and hence it diverges and so does the original series. |
1,992,494 | The following series converges to exponential.
$\sum\_{i=0}^{\infty} \frac{x^i}{i!} = e^{x}$
Is the convergence of the following series known?
$\sum\_{i=0}^{\infty} \frac{(x-i)^i}{i!}$ | 2016/10/31 | [
"https://math.stackexchange.com/questions/1992494",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | This series diverges. In fact the terms $\frac{(x-i)^i}{i!}$ do not even tend to zero for any fixed $x$. | $$a\_n=\frac{(x-n)^n}{n!}\implies A=\frac{a\_{n+1}}{a\_n}=\frac1{n+1 }\frac{ (x-n-1)^{n+1}} {(x-n)^n }=\frac{-1}{n+1 }\frac{ (n+1-x)^{n+1}} {(n-x)^n }$$ $$B=\frac{ (n+1-x)^{n+1}} {(n-x)^n }\implies\log(B)=(n+1)\log(n+1-x)-n\log(n-x)$$ Now, for large values of $n$, use Taylor$$p \log (p-x)=p \log \left(p\right)-x-\frac{... |
1,992,494 | The following series converges to exponential.
$\sum\_{i=0}^{\infty} \frac{x^i}{i!} = e^{x}$
Is the convergence of the following series known?
$\sum\_{i=0}^{\infty} \frac{(x-i)^i}{i!}$ | 2016/10/31 | [
"https://math.stackexchange.com/questions/1992494",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Your series is [asymptotically equivalent](https://artofproblemsolving.com/wiki/index.php?title=Asymptotic_equivalence) to
$$
\sum\_{i=0}^\infty\frac{(-1)^ii^i}{i!}
$$
Absolute value of each term of the above series is greater than $1$ (except the first two terms) and hence it diverges and so does the original series. | $$a\_n=\frac{(x-n)^n}{n!}\implies A=\frac{a\_{n+1}}{a\_n}=\frac1{n+1 }\frac{ (x-n-1)^{n+1}} {(x-n)^n }=\frac{-1}{n+1 }\frac{ (n+1-x)^{n+1}} {(n-x)^n }$$ $$B=\frac{ (n+1-x)^{n+1}} {(n-x)^n }\implies\log(B)=(n+1)\log(n+1-x)-n\log(n-x)$$ Now, for large values of $n$, use Taylor$$p \log (p-x)=p \log \left(p\right)-x-\frac{... |
25,687,384 | I came across a weird error with std::chrono,
If I do something like this:
```
TimeHandling time(std::chrono::milliseconds(1000 / 125));
time.start();
```
Everything is ok.
But if instead I put the milliseconds value in a variable:
```
int mpl = 1000 / 125;
TimeHandling time(std::chrono::milliseconds(mpl));
time.st... | 2014/09/05 | [
"https://Stackoverflow.com/questions/25687384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2838914/"
] | The second version declares a function with a parameter called `mpl`
See <http://en.wikipedia.org/wiki/Most_vexing_parse> and <https://stackoverflow.com/tags/most-vexing-parse/info>
C++11 allows you to use braces to disambiguate initializations from declarations:
```
TimeHandling time{std::chrono::milliseconds(mpl)}... | This line
```
TimeHandling time(std::chrono::milliseconds(mpl));
```
declares a function that returns a `TimeHandling` object, and take an `std::chrono::milliseconds` parameter named `mpl`.
When a compiler faces the dilemma of considering this kind of statement either as a function declaration or as a constructor ... |
18,890,606 | Is it possible to add a list of latitudes and longitudes in Google Map Version 2 in android?
I have tried using marker options which will add only one at a time. How can I add a list of them all at the same time instead of one by one? | 2013/09/19 | [
"https://Stackoverflow.com/questions/18890606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106452/"
] | Create one HashMap of Latitude and Longitude first like,
```
HashMap<String, String> mapItem;
mapItem=new HashMap<String,String>();
mapItem.put("Latitude",YOUR LATITUDE VALUE);
mapItem.put("Longitude",YOUR LONGITUDE VALUE);
googleMap.addMarker(new MarkerOptions().icon(BitmapDescriptorFactory.defaultMarker(Bitmap... | Since the only method available is `GoogleMap.addMarker(Marker Options options)` there is no way to add more than one at a time as far as I know. Simply iterate through your list of lat and longs, adding a marker at each coordinate.
I also keep an `ArrayList<Marker>` containing each marker I add. This makes it easy to... |
42,810,199 | I've got a ul nav which I've tried to center using `text-center` and failed. Also tried using `margin-auto` which also failed. I need to have the li centered equally. Possibly could use `grid` if it's turns out to be more elegant.
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills mov... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7399312/"
] | Just add `inline-block` to `ul`
**CSS**
```
ul{
display:inline-block;
}
```
**HTML**
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills movie-sel-ul text-center">
<li role="presentation" class="active"><a href="#">Now Showing</a></li>
<li role="presentation"><a href=... | You can set the li to be `inline-block` that allows them to be centered:
```css
ul {
text-align: center;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
```
```html
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills movie-sel-ul text-center">
<li role="p... |
42,810,199 | I've got a ul nav which I've tried to center using `text-center` and failed. Also tried using `margin-auto` which also failed. I need to have the li centered equally. Possibly could use `grid` if it's turns out to be more elegant.
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills mov... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7399312/"
] | You can set the li to be `inline-block` that allows them to be centered:
```css
ul {
text-align: center;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
```
```html
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills movie-sel-ul text-center">
<li role="p... | Add this CSS:
(the padding is just to make it look a bit better, adjust that as you like)
```
ul {
display: inline-block !important;
}
li {
display: inline-block;
padding: 2em;
}
```
<http://codepen.io/anon/pen/mWBJOd> |
42,810,199 | I've got a ul nav which I've tried to center using `text-center` and failed. Also tried using `margin-auto` which also failed. I need to have the li centered equally. Possibly could use `grid` if it's turns out to be more elegant.
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills mov... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7399312/"
] | You can set the li to be `inline-block` that allows them to be centered:
```css
ul {
text-align: center;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
```
```html
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills movie-sel-ul text-center">
<li role="p... | Add:
```
ul.nav {
display: inline-block;
}
```
to your css:
```css
ul.nav {
display: inline-block;
}
```
```html
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin=... |
42,810,199 | I've got a ul nav which I've tried to center using `text-center` and failed. Also tried using `margin-auto` which also failed. I need to have the li centered equally. Possibly could use `grid` if it's turns out to be more elegant.
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills mov... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7399312/"
] | Just add `inline-block` to `ul`
**CSS**
```
ul{
display:inline-block;
}
```
**HTML**
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills movie-sel-ul text-center">
<li role="presentation" class="active"><a href="#">Now Showing</a></li>
<li role="presentation"><a href=... | Add this CSS:
(the padding is just to make it look a bit better, adjust that as you like)
```
ul {
display: inline-block !important;
}
li {
display: inline-block;
padding: 2em;
}
```
<http://codepen.io/anon/pen/mWBJOd> |
42,810,199 | I've got a ul nav which I've tried to center using `text-center` and failed. Also tried using `margin-auto` which also failed. I need to have the li centered equally. Possibly could use `grid` if it's turns out to be more elegant.
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills mov... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7399312/"
] | Just add `inline-block` to `ul`
**CSS**
```
ul{
display:inline-block;
}
```
**HTML**
```
<div class="col-md-12 no-side-padding text-center">
<ul class="nav nav-pills movie-sel-ul text-center">
<li role="presentation" class="active"><a href="#">Now Showing</a></li>
<li role="presentation"><a href=... | Add:
```
ul.nav {
display: inline-block;
}
```
to your css:
```css
ul.nav {
display: inline-block;
}
```
```html
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin=... |
56,725,476 | I would like to pass command line arguments to pycharm script **from file**.
I am aware command line arguments can be passed via `run->edit configurations -> parameters`.
This method is not good enough for me because
1. In some cases the parameters line gets deleted. not sure why, maybe git-pull? maybe other reason.... | 2019/06/23 | [
"https://Stackoverflow.com/questions/56725476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913098/"
] | PyCharm lets you have unlimited named runtime configurations, as you appear to know, so I am a little puzzled that you ask. Click on the current configuraton name to the left of the green Run arrow, top right, then Edit Configurations.
These configurations live in `workspace.xml`. Nothing stopping you from checking i... | Create shell scripts calling the Python script the way you need. |
66,485,714 | `PreparedStatement.executeQuery()` is taking ~20x longer to execute than if it were run directly via the shell. I've logged with timers to determine that this method is the culprit.
The query and some DB info (*ignoring the Java issue for the moment*):
`mysql> SELECT username from users where user_id = 1;` // lightni... | 2021/03/05 | [
"https://Stackoverflow.com/questions/66485714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1955673/"
] | Don't reconnect each time. Open the connection at the start; reuse it until the web page (or program) is finished. | move borrowing connection and Stopwatch related code out of method. then measure as:
```
Stopwatch s = Stopwatch.createStarted();
try (Connection con = ....) {
for (int i=0; i < 1000; i++) {
queryUsername( con );
}
}
s.stop();
print s.elapsed(TimeUnit.MICROSECONDS);
``` |
66,485,714 | `PreparedStatement.executeQuery()` is taking ~20x longer to execute than if it were run directly via the shell. I've logged with timers to determine that this method is the culprit.
The query and some DB info (*ignoring the Java issue for the moment*):
`mysql> SELECT username from users where user_id = 1;` // lightni... | 2021/03/05 | [
"https://Stackoverflow.com/questions/66485714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1955673/"
] | Chances are that you are comparing different realities.
When running mysqlslap you are most likely using Unix Domain Sockets in the communication between the tool and MySQL server. Try changing that to TCP and you should observe an immediate performance drop. Connector/J, on the other hand, creates TCP based connectio... | move borrowing connection and Stopwatch related code out of method. then measure as:
```
Stopwatch s = Stopwatch.createStarted();
try (Connection con = ....) {
for (int i=0; i < 1000; i++) {
queryUsername( con );
}
}
s.stop();
print s.elapsed(TimeUnit.MICROSECONDS);
``` |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | I would pass an [`java.io.InputStream`](http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html) - this makes the code easier to test and doesn't bind it to the file system.
This way your code ends up like:
```
public void normalizeData(InputStream in)
{
...
}
```
And calling it:
```
myObject.normalize... | If you pass the string, you have control in the method over how the file is opened, and the file handle managed. You are centralising that code. If you pass the `File` object, then you are duplicating the file handling code everywhere this is called. So I'd have a strong preference for the former. |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | Think about using multiple overloaded methods to give the user of the API the choose.
Also think about passing an `InputStream` as it is possible that the user of the API wants to use any in memory representation of the data. | If you pass the string, you have control in the method over how the file is opened, and the file handle managed. You are centralising that code. If you pass the `File` object, then you are duplicating the file handling code everywhere this is called. So I'd have a strong preference for the former. |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | The design depends on many parameters, such as, who is going to use this method. Is it going to be overloaded, is it internal, package level or public API. I would tend to be general and offer two overloaded methods:
* one which passes in the `Path` which is a common way of specifying the path to a file
* and one whic... | If you pass the string, you have control in the method over how the file is opened, and the file handle managed. You are centralising that code. If you pass the `File` object, then you are duplicating the file handling code everywhere this is called. So I'd have a strong preference for the former. |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | I would pass an [`java.io.InputStream`](http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html) - this makes the code easier to test and doesn't bind it to the file system.
This way your code ends up like:
```
public void normalizeData(InputStream in)
{
...
}
```
And calling it:
```
myObject.normalize... | It depends whether you want the file hanlde outside the normalizeData method or inside it only. If you want to do something on file prior or after calling your normalizeData method then create a file object outside normalizeData method and pass the reference to the method. If ONLY your normalizeData method need to work... |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | Think about using multiple overloaded methods to give the user of the API the choose.
Also think about passing an `InputStream` as it is possible that the user of the API wants to use any in memory representation of the data. | It depends whether you want the file hanlde outside the normalizeData method or inside it only. If you want to do something on file prior or after calling your normalizeData method then create a file object outside normalizeData method and pass the reference to the method. If ONLY your normalizeData method need to work... |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | The design depends on many parameters, such as, who is going to use this method. Is it going to be overloaded, is it internal, package level or public API. I would tend to be general and offer two overloaded methods:
* one which passes in the `Path` which is a common way of specifying the path to a file
* and one whic... | It depends whether you want the file hanlde outside the normalizeData method or inside it only. If you want to do something on file prior or after calling your normalizeData method then create a file object outside normalizeData method and pass the reference to the method. If ONLY your normalizeData method need to work... |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | I would pass an [`java.io.InputStream`](http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html) - this makes the code easier to test and doesn't bind it to the file system.
This way your code ends up like:
```
public void normalizeData(InputStream in)
{
...
}
```
And calling it:
```
myObject.normalize... | Think about using multiple overloaded methods to give the user of the API the choose.
Also think about passing an `InputStream` as it is possible that the user of the API wants to use any in memory representation of the data. |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | I would pass an [`java.io.InputStream`](http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html) - this makes the code easier to test and doesn't bind it to the file system.
This way your code ends up like:
```
public void normalizeData(InputStream in)
{
...
}
```
And calling it:
```
myObject.normalize... | The design depends on many parameters, such as, who is going to use this method. Is it going to be overloaded, is it internal, package level or public API. I would tend to be general and offer two overloaded methods:
* one which passes in the `Path` which is a common way of specifying the path to a file
* and one whic... |
17,142,469 | I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods.
* Should the parameter be of type `String`
```
void normalizeData(String inFile)
```
* Or should I explicitly declare the parameter as `File`.
```
void normalizeData(File i... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17142469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560302/"
] | Think about using multiple overloaded methods to give the user of the API the choose.
Also think about passing an `InputStream` as it is possible that the user of the API wants to use any in memory representation of the data. | The design depends on many parameters, such as, who is going to use this method. Is it going to be overloaded, is it internal, package level or public API. I would tend to be general and offer two overloaded methods:
* one which passes in the `Path` which is a common way of specifying the path to a file
* and one whic... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | I think we are meant to make the assumption that intelligent life in the Alpha quadrant (at least in a form recognizable to humans) is typically humanoid and therefore typically requires an M-class environment. This idea is supported by the TNG episode that touches on the existence of an ancient race of which most know... | Personally, I don't think they want to explore the worlds. I think they want to meet the people. Humans are social creatures. We saw several times in ST:ENT where Archer chose to go with an inhabited world instead of a astronomical oddity. When they explored that star that was close to supernova, they seemed more inter... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | One reason is philosophical: *Star Trek* was always as much about entertainment and social commentary as about telling science fiction stories -- actually possibly more so. As such, production staff felt that there always needed to be ways to ensure the audience had just enough familiarity with what was going on to fee... | In Universe:
------------
The [original studio pitch](http://50yos.tumblr.com/post/79244934260/original-star-trek-pitch-1964) offered by Gene Roddenberry confirmed that Captain Robert April's standing orders were to investigate Class-M planets due to **the limitations of his ship** (landing craft, standard sensor pack... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | One reason is philosophical: *Star Trek* was always as much about entertainment and social commentary as about telling science fiction stories -- actually possibly more so. As such, production staff felt that there always needed to be ways to ensure the audience had just enough familiarity with what was going on to fee... | Personally, I don't think they want to explore the worlds. I think they want to meet the people. Humans are social creatures. We saw several times in ST:ENT where Archer chose to go with an inhabited world instead of a astronomical oddity. When they explored that star that was close to supernova, they seemed more inter... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | I would probably say out of universe they could not make a full episode on planets that had nothing on them. They could only do so much with an empty planet. Whereas class M/Earth like planets they could introduce new species easily. In universe answer I would say that they did but because the vessels in the episodes w... | Personally, I don't think they want to explore the worlds. I think they want to meet the people. Humans are social creatures. We saw several times in ST:ENT where Archer chose to go with an inhabited world instead of a astronomical oddity. When they explored that star that was close to supernova, they seemed more inter... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | One reason is philosophical: *Star Trek* was always as much about entertainment and social commentary as about telling science fiction stories -- actually possibly more so. As such, production staff felt that there always needed to be ways to ensure the audience had just enough familiarity with what was going on to fee... | I would probably say out of universe they could not make a full episode on planets that had nothing on them. They could only do so much with an empty planet. Whereas class M/Earth like planets they could introduce new species easily. In universe answer I would say that they did but because the vessels in the episodes w... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | In Universe:
------------
The [original studio pitch](http://50yos.tumblr.com/post/79244934260/original-star-trek-pitch-1964) offered by Gene Roddenberry confirmed that Captain Robert April's standing orders were to investigate Class-M planets due to **the limitations of his ship** (landing craft, standard sensor pack... | First your premise is wrong. Starfleet has multiple missions and purposes, but it's the Enterprise specifically that:
>
> Space: the final frontier. These are the voyages of the starship Enterprise. Its five-year mission: to explore strange new worlds
>
>
>
The Enterprise, both TOS and TNG, has a duty to explore ... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | In Universe:
------------
The [original studio pitch](http://50yos.tumblr.com/post/79244934260/original-star-trek-pitch-1964) offered by Gene Roddenberry confirmed that Captain Robert April's standing orders were to investigate Class-M planets due to **the limitations of his ship** (landing craft, standard sensor pack... | Personally, I don't think they want to explore the worlds. I think they want to meet the people. Humans are social creatures. We saw several times in ST:ENT where Archer chose to go with an inhabited world instead of a astronomical oddity. When they explored that star that was close to supernova, they seemed more inter... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | I think we are meant to make the assumption that intelligent life in the Alpha quadrant (at least in a form recognizable to humans) is typically humanoid and therefore typically requires an M-class environment. This idea is supported by the TNG episode that touches on the existence of an ancient race of which most know... | First your premise is wrong. Starfleet has multiple missions and purposes, but it's the Enterprise specifically that:
>
> Space: the final frontier. These are the voyages of the starship Enterprise. Its five-year mission: to explore strange new worlds
>
>
>
The Enterprise, both TOS and TNG, has a duty to explore ... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | One reason is philosophical: *Star Trek* was always as much about entertainment and social commentary as about telling science fiction stories -- actually possibly more so. As such, production staff felt that there always needed to be ways to ensure the audience had just enough familiarity with what was going on to fee... | First your premise is wrong. Starfleet has multiple missions and purposes, but it's the Enterprise specifically that:
>
> Space: the final frontier. These are the voyages of the starship Enterprise. Its five-year mission: to explore strange new worlds
>
>
>
The Enterprise, both TOS and TNG, has a duty to explore ... |
14,222 | Starfleet is supposed to "explore *strange* new worlds and boldly go where no man has gone before", yet most of the time they explore worlds that are more Earth-like than not, and are inhabited by human-like species.
I understand that the out-of-universe reason is that it is difficult to tell a story when the characte... | 2012/04/04 | [
"https://scifi.stackexchange.com/questions/14222",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/3247/"
] | I would probably say out of universe they could not make a full episode on planets that had nothing on them. They could only do so much with an empty planet. Whereas class M/Earth like planets they could introduce new species easily. In universe answer I would say that they did but because the vessels in the episodes w... | First your premise is wrong. Starfleet has multiple missions and purposes, but it's the Enterprise specifically that:
>
> Space: the final frontier. These are the voyages of the starship Enterprise. Its five-year mission: to explore strange new worlds
>
>
>
The Enterprise, both TOS and TNG, has a duty to explore ... |
12,406,461 | I own an rpg and want to add up all the levels of the users monster and get an end number.
So I narrowed it down for one user and works great.
```
$_SESSION['username'] = "smbisme";
$query = "SELECT belongsto, SUM(level) FROM user_pokemon WHERE `belongsto` = '".$_SESSION['username']."' ";
$result = mysql_query($qu... | 2012/09/13 | [
"https://Stackoverflow.com/questions/12406461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1668621/"
] | Make a copy of a suitable number of characters:
```
char * substr = malloc(index + 2);
strncpy(substr, ch, index + 1);
substr[index + 1] = 0;
// ...
free(substr);
```
If you're happy to mutilate the original string, just insert a null byte:
```
ch[index + 1] = 0;
```
The odd `+ 1` comes from the fact that your ... | You can't, because that would imply modifying the string literal, which is illegal.
Alternative:
```
char ch[]="323+465";
int index=2;
ch[index] = '\0';
``` |
12,406,461 | I own an rpg and want to add up all the levels of the users monster and get an end number.
So I narrowed it down for one user and works great.
```
$_SESSION['username'] = "smbisme";
$query = "SELECT belongsto, SUM(level) FROM user_pokemon WHERE `belongsto` = '".$_SESSION['username']."' ";
$result = mysql_query($qu... | 2012/09/13 | [
"https://Stackoverflow.com/questions/12406461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1668621/"
] | Make a copy of a suitable number of characters:
```
char * substr = malloc(index + 2);
strncpy(substr, ch, index + 1);
substr[index + 1] = 0;
// ...
free(substr);
```
If you're happy to mutilate the original string, just insert a null byte:
```
ch[index + 1] = 0;
```
The odd `+ 1` comes from the fact that your ... | First, make the string writable by using a char array instead of a pointer to a string literal. Then
```
char ch[] = "323+456";
int idx = 2;
ch[idx] = 0; /* Now ch holds the string "32" */
```
You should avoid an identifier clash with the classic BSD `index` function, that's why I used `idx` instead.
This solution... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.