qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
22,035,867 | i am developing one application in that i want to display map on my device Android 2.3.3, it not display shows error in my log cat
i got steps
got SHA1 code from debug.keystore
create a new project in google apis console
register a new id
enabled google maps android api v2
create an android key using as input SHA1;it.m... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22035867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3081942/"
] | I believe
```
set autoread
```
should do it. It tells Vim to automatically re-reads the file changed outside Vim. | Add this to your `~/.vimrc` file:
```
set autoread
nnoremap <C-u> :checktime<CR>
```
Now whenever you want vim to reload external changes, just click `CTRL-U` :) |
22,035,867 | i am developing one application in that i want to display map on my device Android 2.3.3, it not display shows error in my log cat
i got steps
got SHA1 code from debug.keystore
create a new project in google apis console
register a new id
enabled google maps android api v2
create an android key using as input SHA1;it.m... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22035867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3081942/"
] | I saw this in a mailing list. Apparently it is called if the file has changed timestamp, after a call to an external shell command.
```
function! ProcessFileChangedShell()
if v:fcs_reason == 'mode' || v:fcs_reason == 'time'
let v:fcs_choice = ''
else
let v:fcs_choice = 'ask'
endif
endfuncti... | Add this to your `~/.vimrc` file:
```
set autoread
nnoremap <C-u> :checktime<CR>
```
Now whenever you want vim to reload external changes, just click `CTRL-U` :) |
45,977,978 | According to the style guide - is there a rule of thumb what one should use for typeclasses in Scala - `context bound` or `implicit ev` notation?
These two examples do the same
Context bound has more concise function signature, but requires `val` evaluation with `implicitly` call:
```
def empty[T: Monoid, M[_] : Mo... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45977978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/760620/"
] | This is very opinion-based, but one pratical reason for using an implicit parameter list directly is that you perform fewer implicit searches.
When you do
```
def empty[T: Monoid, M[_] : Monad]: M[T] = {
val M = implicitly[Monad[M]]
val T = implicitly[Monoid[T]]
M.point(T.zero)
}
```
this gets desugared by th... | Note that on top of doing the same, your 2 examples *are* the same. Context bounds is just syntactic sugar for adding implicit parameters.
I am being opportunistic, using context bound as much as I can i.e., when I don't already have implicit function parameters. When I already have some, it is impossible to use conte... |
45,977,978 | According to the style guide - is there a rule of thumb what one should use for typeclasses in Scala - `context bound` or `implicit ev` notation?
These two examples do the same
Context bound has more concise function signature, but requires `val` evaluation with `implicitly` call:
```
def empty[T: Monoid, M[_] : Mo... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45977978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/760620/"
] | This is very opinion-based, but one pratical reason for using an implicit parameter list directly is that you perform fewer implicit searches.
When you do
```
def empty[T: Monoid, M[_] : Monad]: M[T] = {
val M = implicitly[Monad[M]]
val T = implicitly[Monoid[T]]
M.point(T.zero)
}
```
this gets desugared by th... | FP libraries usually give you syntax extensions for typeclasses:
```
import scalaz._, Scalaz._
def empty[T: Monoid, M[_]: Monad]: M[T] = mzero[T].point[M]
```
I use this style as much as possible. This gives me syntax consistent with standard library methods and also lets me write `for`-comprehensions over generic `... |
45,977,978 | According to the style guide - is there a rule of thumb what one should use for typeclasses in Scala - `context bound` or `implicit ev` notation?
These two examples do the same
Context bound has more concise function signature, but requires `val` evaluation with `implicitly` call:
```
def empty[T: Monoid, M[_] : Mo... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45977978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/760620/"
] | One caveat you need to be aware of when working with `implicitly` is when using dependently typed functions. I'll quote from the book "The type astronauts guide to shapeless". It looks at the `Last` type class from Shapeless which retrieves the last type of an `HList`:
```
package shapeless.ops.hlist
trait Last[L <: ... | Note that on top of doing the same, your 2 examples *are* the same. Context bounds is just syntactic sugar for adding implicit parameters.
I am being opportunistic, using context bound as much as I can i.e., when I don't already have implicit function parameters. When I already have some, it is impossible to use conte... |
45,977,978 | According to the style guide - is there a rule of thumb what one should use for typeclasses in Scala - `context bound` or `implicit ev` notation?
These two examples do the same
Context bound has more concise function signature, but requires `val` evaluation with `implicitly` call:
```
def empty[T: Monoid, M[_] : Mo... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45977978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/760620/"
] | One caveat you need to be aware of when working with `implicitly` is when using dependently typed functions. I'll quote from the book "The type astronauts guide to shapeless". It looks at the `Last` type class from Shapeless which retrieves the last type of an `HList`:
```
package shapeless.ops.hlist
trait Last[L <: ... | FP libraries usually give you syntax extensions for typeclasses:
```
import scalaz._, Scalaz._
def empty[T: Monoid, M[_]: Monad]: M[T] = mzero[T].point[M]
```
I use this style as much as possible. This gives me syntax consistent with standard library methods and also lets me write `for`-comprehensions over generic `... |
35,364,707 | Given the following setup:
```
public class TestType {
public static void main(String[] args) {
List<Constants> list = new ArrayList<>();
accept(list); //Does not compile
}
static void accept(Iterable<MyInterface> values) {
for (MyInterface value : values) {
value.doStuff();
}
}
}
in... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35364707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617458/"
] | The problem is with how Generics work. Specifically, Generics are non-reified... meaning that the compiler will not see an `Iterable<enum.Constants>` as an `Iterable<enum.MyInterface>` even if Constants is a sub-class of MyInterface.
However, there is a way to get around it: [Generic wildcards](https://stackoverflow.c... | Generic types do not inherit this way, although it may seem counter-intuitive at first glance. Using `Iterable<? extends MyInterface>` will allow you to use any `Iterable` (e.g., a `List`) of a type that extends `MyInterface` (e.g. `Constants`). |
35,364,707 | Given the following setup:
```
public class TestType {
public static void main(String[] args) {
List<Constants> list = new ArrayList<>();
accept(list); //Does not compile
}
static void accept(Iterable<MyInterface> values) {
for (MyInterface value : values) {
value.doStuff();
}
}
}
in... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35364707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617458/"
] | The problem is with how Generics work. Specifically, Generics are non-reified... meaning that the compiler will not see an `Iterable<enum.Constants>` as an `Iterable<enum.MyInterface>` even if Constants is a sub-class of MyInterface.
However, there is a way to get around it: [Generic wildcards](https://stackoverflow.c... | You need to use `Iterable<? extends MyInterface>` instead of `Iterable<MyInterface>` because even though `Constants` is a subtype of `MyInterface`, `Iterable<Constants>` is not a subtype of `Iterable<MyInterface>` - and I'll show you why:
If it was so (let's use `List` instead of `Iterable` for the next example), I wo... |
35,364,707 | Given the following setup:
```
public class TestType {
public static void main(String[] args) {
List<Constants> list = new ArrayList<>();
accept(list); //Does not compile
}
static void accept(Iterable<MyInterface> values) {
for (MyInterface value : values) {
value.doStuff();
}
}
}
in... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35364707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617458/"
] | You need to use `Iterable<? extends MyInterface>` instead of `Iterable<MyInterface>` because even though `Constants` is a subtype of `MyInterface`, `Iterable<Constants>` is not a subtype of `Iterable<MyInterface>` - and I'll show you why:
If it was so (let's use `List` instead of `Iterable` for the next example), I wo... | Generic types do not inherit this way, although it may seem counter-intuitive at first glance. Using `Iterable<? extends MyInterface>` will allow you to use any `Iterable` (e.g., a `List`) of a type that extends `MyInterface` (e.g. `Constants`). |
30,202,375 | I know this question has been asked often but I'm unable to find a solution.
How can I get a generic type class name in a Spring injected repository?
Here it is my base repository
```
public interface UserRepository extends JpaRepository<User, Long>, IUserRepository<User>{
User findByUsername(String username);
}
... | 2015/05/12 | [
"https://Stackoverflow.com/questions/30202375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2929757/"
] | The general answer to you question can be seen in the documentation -> <http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.custom-implementations> in the chapter Custom implementations for Spring Data repositories
But I think that should not be necessary in your case. You should be able to... | Basically you can't get the generic type because of [type erasure](https://docs.oracle.com/javase/tutorial/java/generics/erasure.html).
What I would do is add an abstract method to `UserRepositoryImpl` that returns the relevant type:
```
public abstract Class getType();
```
And then I would create specific instance... |
30,202,375 | I know this question has been asked often but I'm unable to find a solution.
How can I get a generic type class name in a Spring injected repository?
Here it is my base repository
```
public interface UserRepository extends JpaRepository<User, Long>, IUserRepository<User>{
User findByUsername(String username);
}
... | 2015/05/12 | [
"https://Stackoverflow.com/questions/30202375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2929757/"
] | Considering that you're using Spring Framework, use the code snippet bellow, I've tested and it worked just fine:
```
ResolvableType resolvableType = ResolvableType.forClass(UserRepository.class).as(JpaRepository.class);
System.out.println(resolvableType.getGeneric(0));//User
System.out.println(resolvableType.getGener... | Basically you can't get the generic type because of [type erasure](https://docs.oracle.com/javase/tutorial/java/generics/erasure.html).
What I would do is add an abstract method to `UserRepositoryImpl` that returns the relevant type:
```
public abstract Class getType();
```
And then I would create specific instance... |
5,558,151 | There's a sample ASP.NET project with this controller:
```
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("te... | 2011/04/05 | [
"https://Stackoverflow.com/questions/5558151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108533/"
] | Not with WGET. From [bugs.debian.org](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=407526)
>
> Wget has zero support for chunked transfer encodings (and therefore, for
> HTTP/1.1). It will only ever send HTTP/1.0 requests, which means that a
> HTTP/1.1 response is illegal (as is the chunked encoding).
>
>
>
... | Ah, solved with
curl -v URL... |
5,558,151 | There's a sample ASP.NET project with this controller:
```
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("te... | 2011/04/05 | [
"https://Stackoverflow.com/questions/5558151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108533/"
] | Wget has a support of HTTP/1.1 and chunked transfer since version 1.13 | Ah, solved with
curl -v URL... |
18,785,032 | I am trying to replace a string i.e. "H3" in a file with "H1" but I want only "H3" to get replaced and not "mmmoleculeH3" to become "mmmoleculeH1". I tried re but my limited knowledge in python didn't get me anywhere. If there is any other method than that would be great.script that i am using now is:
```
#!/usr/bin/p... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18785032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776185/"
] | As others have said, this is a case when regexes are the proper tool.
You can replace only whole words by using `\b`:
```
>>> text = 'H3 foo barH3 H3baz H3 quH3ux'
>>> re.sub(r'\bH3\b', 'H1', text)
'H1 foo barH3 H3baz H1 quH3ux'
``` | Since I had been curious about doing this without regex, here's an version without:
```
MYSTR = ["H3", "H3b", "aH3", "H3 mmmoleculeH3 H3",
"H3 mmmoleculeH3 H3b", "H3 mmmoleculeH3 H3b H3"]
FIND = "H3"
LEN_FIND = len( FIND )
REPLACE = "H1"
for entry in MYSTR:
index = 0
foundat = []
# Get all positi... |
33,424,133 | I am writing code in SSMS using SQL Server 2012.
Is it possible to have a case statement in the where clause that is skipped under certain conditions?
For example this is what I tried 1st:
```
Where
Case Substring(@@Servername,1,3)
when 'BCR' Then SM.ItemCode in (1,3)
When 'DCR' Then 'Some code to... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33424133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4083998/"
] | default type for POST tool is XML
-type (default: application/xml)
Try this
```
X:\solr\solr-5.3.1\bin>java -Dc=bookcore -jar ..\example\exampledoc
s\post.jar ..\example\exampledocs\books.json -Dtype=application/json
```
Try it this way. | so this works
curl "<http://localhost:8983/solr/bookcore/update?commit=true>" --data-binary @books.json -H "Content-type:application/json"
also, windows command line does not like single quotes! i would still like to know how to get post using the JAR. |
33,424,133 | I am writing code in SSMS using SQL Server 2012.
Is it possible to have a case statement in the where clause that is skipped under certain conditions?
For example this is what I tried 1st:
```
Where
Case Substring(@@Servername,1,3)
when 'BCR' Then SM.ItemCode in (1,3)
When 'DCR' Then 'Some code to... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33424133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4083998/"
] | You are using post.jar directly. It is not recommended anymore, and the **post** tool is slightly smarter. The tutorial linked actually uses that approach.
So you could do
>
> .\post -c bookcore ..\example\exampledocs\books.json
>
>
>
or if you insist on using post.jar, you need to set the type as explained in ... | default type for POST tool is XML
-type (default: application/xml)
Try this
```
X:\solr\solr-5.3.1\bin>java -Dc=bookcore -jar ..\example\exampledoc
s\post.jar ..\example\exampledocs\books.json -Dtype=application/json
```
Try it this way. |
33,424,133 | I am writing code in SSMS using SQL Server 2012.
Is it possible to have a case statement in the where clause that is skipped under certain conditions?
For example this is what I tried 1st:
```
Where
Case Substring(@@Servername,1,3)
when 'BCR' Then SM.ItemCode in (1,3)
When 'DCR' Then 'Some code to... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33424133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4083998/"
] | You are using post.jar directly. It is not recommended anymore, and the **post** tool is slightly smarter. The tutorial linked actually uses that approach.
So you could do
>
> .\post -c bookcore ..\example\exampledocs\books.json
>
>
>
or if you insist on using post.jar, you need to set the type as explained in ... | so this works
curl "<http://localhost:8983/solr/bookcore/update?commit=true>" --data-binary @books.json -H "Content-type:application/json"
also, windows command line does not like single quotes! i would still like to know how to get post using the JAR. |
28,177,902 | I must create a desktop java client that comunicate to a servlet in order to receive some notificationes.
The servlet is an async servlet but my doubt is with the client.
How is the best way to "listen" a response from the server. I looked to the httpcomponents-asyncclient from apache, but I´m not trully convinced abou... | 2015/01/27 | [
"https://Stackoverflow.com/questions/28177902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2217011/"
] | You might want to check out [netty](http://netty.io/), it's what we use for our IntelliJ IDEA real time collaboration plugin to communicate with our remote server. It's very simple to get started with and abstracts all the hard parts, including creating secure connections. [This is the netty user guide](http://netty.io... | [HttpComponents](http://hc.apache.org/) from Apache is very common
(be careful not to use [the old one](http://hc.apache.org/httpclient-3.x/)). [Check a simple example.](https://hc.apache.org/httpcomponents-asyncclient-dev/httpasyncclient/examples/org/apache/http/examples/nio/client/AsyncClientHttpExchange.java)
Do yo... |
15,577,052 | I'm trying to have multiple commands executed in one ShellExecuteEx.
Each command has its own parameters.
How do I do this ? | 2013/03/22 | [
"https://Stackoverflow.com/questions/15577052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/382591/"
] | The simplest way is to write the commands to a temporary file with .bat extension and pass that file name to ShellExecuteEx.
The alternative involves trying to do it with arguments to cmd.exe. That's going to involve /C, the [& or && operators](http://www.robvanderwoude.com/condexec.php) and argument quoting hell.
M... | There are **3 syntaxes** for conditional execution. Command 1 and 2 you would replace with different commands.
**1 -** Place an ampersand `&` in between two command to make command2 execute right after command1.
**2 -** Place two ampersands `&&` between two command to make command2 execute only if command1 finished s... |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | At first glance I would say the primary problem is that you're escaping the `'` character around your alert. Since your string is defined by the double quotes, you don't need to escape this character. | Adding a `@` at the beginning should help. |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I'm not sure, but I think that \n is escaped in the string.Format method, like \". Maybe you should use \\n instead.
Edited : and the first \ of \\n has been escaped when i posted that. xD | The code looks fine, so I'm going to guess that you're using a message that itself has a `'` quote in it, causing the JS syntax error. For inserting dynamic text into a Javascript code block, you really should use JSON to make your C# strings 'safe' for use in JS.
Consider JSON the go-to method for preventing the JS e... |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | At first glance I would say the primary problem is that you're escaping the `'` character around your alert. Since your string is defined by the double quotes, you don't need to escape this character. | add "@" at the beginning of your string - like this:
```
string msg = @"Your session ....";
``` |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I would suspect that you need to change your code to;
```
string msg = "Your session will expire in 10 minutes. \\n Please save your work to avoid this.";
```
And escape the `\n` otherwise your code outputted would actually include the line break rather than `\n`
Your output code would look like:
```
setTimeout('a... | At first glance I would say the primary problem is that you're escaping the `'` character around your alert. Since your string is defined by the double quotes, you don't need to escape this character. |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I would suspect that you need to change your code to;
```
string msg = "Your session will expire in 10 minutes. \\n Please save your work to avoid this.";
```
And escape the `\n` otherwise your code outputted would actually include the line break rather than `\n`
Your output code would look like:
```
setTimeout('a... | I'm not sure, but I think that \n is escaped in the string.Format method, like \". Maybe you should use \\n instead.
Edited : and the first \ of \\n has been escaped when i posted that. xD |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I would suspect that you need to change your code to;
```
string msg = "Your session will expire in 10 minutes. \\n Please save your work to avoid this.";
```
And escape the `\n` otherwise your code outputted would actually include the line break rather than `\n`
Your output code would look like:
```
setTimeout('a... | add "@" at the beginning of your string - like this:
```
string msg = @"Your session ....";
``` |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I'm not sure, but I think that \n is escaped in the string.Format method, like \". Maybe you should use \\n instead.
Edited : and the first \ of \\n has been escaped when i posted that. xD | add "@" at the beginning of your string - like this:
```
string msg = @"Your session ....";
``` |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I would suspect that you need to change your code to;
```
string msg = "Your session will expire in 10 minutes. \\n Please save your work to avoid this.";
```
And escape the `\n` otherwise your code outputted would actually include the line break rather than `\n`
Your output code would look like:
```
setTimeout('a... | The code looks fine, so I'm going to guess that you're using a message that itself has a `'` quote in it, causing the JS syntax error. For inserting dynamic text into a Javascript code block, you really should use JSON to make your C# strings 'safe' for use in JS.
Consider JSON the go-to method for preventing the JS e... |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | At first glance I would say the primary problem is that you're escaping the `'` character around your alert. Since your string is defined by the double quotes, you don't need to escape this character. | The code looks fine, so I'm going to guess that you're using a message that itself has a `'` quote in it, causing the JS syntax error. For inserting dynamic text into a Javascript code block, you really should use JSON to make your C# strings 'safe' for use in JS.
Consider JSON the go-to method for preventing the JS e... |
12,603,700 | I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.
```
string msg = "Your session will expire in 10 minutes. \n Please save you... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12603700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949512/"
] | I'm not sure, but I think that \n is escaped in the string.Format method, like \". Maybe you should use \\n instead.
Edited : and the first \ of \\n has been escaped when i posted that. xD | Adding a `@` at the beginning should help. |
9,672,343 | In Ruby 1.9.x, what might be a simple way to either not allow my Ruby script to run again, or wait for the previous instance to finish?\*\*
I'm hoping to avoid messy file-locking or process table checking.
Is there something like a [global mutex](https://stackoverflow.com/a/171220/1069375) or semaphore already in the... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9672343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1069375/"
] | This very short code will freeze in place until a lockfile in /tmp named after your script is locked exclusively:
```
File.open("/tmp/#{File.basename $0}.lock", File::RDWR|File::CREAT, 0644).flock(File::LOCK_EX)
```
Any other program locking it, Ruby or not, needs only to terminate or be killed, for the newer proces... | This is usually solved at the OS level, by checking for a flag-file and not trying to launch again, not in the script itself.
But, if you want to check in the script, look for a semaphore file in a known location. If it exists and it's not within a given time window that fits in your launch window, then delete the fil... |
231,592 | We are using a custom activity (Urban Airship integration) that sends push notifications to our customers. The Custom Activity is hosted on AWS.
We are seeing a throughput of about 6-10 emails per minute with a journey that looks like the following:
Data Extension Entry Source -> 15 min wait -> Split -> Email Send -... | 2018/09/07 | [
"https://salesforce.stackexchange.com/questions/231592",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/59997/"
] | @Robs, You can convert the blob value of ContentVersion to string as below:-
```
ContentVersion cv=[select id,ContentDocumentId,versiondata from Contentversion where ContentDocumentId='0697E000000HW12' ];
Blob csvFileBody =cv.VersionData;
String csvAsString= csvFileBody.toString();
List<String> csvFileLine... | Using EncodingUtil. Please check this code
```
EncodingUtil.base64Encode(contentVersions[0].VersionData);
``` |
231,592 | We are using a custom activity (Urban Airship integration) that sends push notifications to our customers. The Custom Activity is hosted on AWS.
We are seeing a throughput of about 6-10 emails per minute with a journey that looks like the following:
Data Extension Entry Source -> 15 min wait -> Split -> Email Send -... | 2018/09/07 | [
"https://salesforce.stackexchange.com/questions/231592",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/59997/"
] | VersionData is a blob, You want to convert blob into actual data and not encoded base64 String data.
The way you can do it is just call the **toString** method on blob.
So code to convert blob to actual data is
```
String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString); //Assume my blob is your versi... | Using EncodingUtil. Please check this code
```
EncodingUtil.base64Encode(contentVersions[0].VersionData);
``` |
231,592 | We are using a custom activity (Urban Airship integration) that sends push notifications to our customers. The Custom Activity is hosted on AWS.
We are seeing a throughput of about 6-10 emails per minute with a journey that looks like the following:
Data Extension Entry Source -> 15 min wait -> Split -> Email Send -... | 2018/09/07 | [
"https://salesforce.stackexchange.com/questions/231592",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/59997/"
] | @Robs, You can convert the blob value of ContentVersion to string as below:-
```
ContentVersion cv=[select id,ContentDocumentId,versiondata from Contentversion where ContentDocumentId='0697E000000HW12' ];
Blob csvFileBody =cv.VersionData;
String csvAsString= csvFileBody.toString();
List<String> csvFileLine... | VersionData is a blob, You want to convert blob into actual data and not encoded base64 String data.
The way you can do it is just call the **toString** method on blob.
So code to convert blob to actual data is
```
String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString); //Assume my blob is your versi... |
25,021,782 | I'd like to set the ng-class of a optiones-element as active. Unfortunately it doesn't work.
This is my option-menu:
```
<select>
<option ng-repeat="item in items">{{item}}</option>
</select>
```
and the item "one" should be active
```
<select>
<option ng-repeat="item in items" ng-class="{selected: item==... | 2014/07/29 | [
"https://Stackoverflow.com/questions/25021782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2329592/"
] | Below is the right way "select" works in Angularjs, notice the included ng-model directive, if missing it doesn't work.
```
<select ng-model="selectedItemId" ng-options="item.id as item.name for item in items">
<option value="">-- choose item--</option>
</select>
```
to make an item of the list active, just set Se... | I see that you want to loop over the options using ng-repeat and then manually select the right option. It is nicer to use the select directive of Angular in that case:
```
<select ng-model="selectedItem" ng-options="items"></select>
```
See <https://docs.angularjs.org/api/ng/directive/select> for more information. |
49,390,653 | If I want project `A` to compile and tests to run but when I place it as a dependency into project `B` then project `A`'s dependencies should not be available to project `B`.
For example:
1. Add `org.example.foo` as a dependency into project `A` (not `B`)
2. Add project `A` as a dependency inside project `B`
3. Add t... | 2018/03/20 | [
"https://Stackoverflow.com/questions/49390653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4887806/"
] | You can exclude particular transitive dependencies via exclusions like this:
```
<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
... | For Gradle, you can use the [gradle-dependency-analyze](https://github.com/wfhartford/gradle-dependency-analyze) plugin, it will add the `analyzeClassesDependencies` task :
>
> This task depends on the `classes` task and analyzes the dependencies
> of the main source set's output directory. This ensures that all
> ... |
49,390,653 | If I want project `A` to compile and tests to run but when I place it as a dependency into project `B` then project `A`'s dependencies should not be available to project `B`.
For example:
1. Add `org.example.foo` as a dependency into project `A` (not `B`)
2. Add project `A` as a dependency inside project `B`
3. Add t... | 2018/03/20 | [
"https://Stackoverflow.com/questions/49390653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4887806/"
] | You can exclude particular transitive dependencies via exclusions like this:
```
<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
... | The Readme of [gradle-dependency-analyze](https://github.com/wfhartford/gradle-dependency-analyze) plugin mentioned in this [answer](https://stackoverflow.com/a/49693428/2438951) here mentions:
>
> This plugin attempts to replicate the functionality of the maven
> dependency plugin's analyze goals which fail the bui... |
49,390,653 | If I want project `A` to compile and tests to run but when I place it as a dependency into project `B` then project `A`'s dependencies should not be available to project `B`.
For example:
1. Add `org.example.foo` as a dependency into project `A` (not `B`)
2. Add project `A` as a dependency inside project `B`
3. Add t... | 2018/03/20 | [
"https://Stackoverflow.com/questions/49390653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4887806/"
] | You should specifiy the dependencies in project "A" with `<scope>provided</scope>`. This way the respective dependency is used for compilation & testing, but is not transitively used in project "B".
Here you find the different scopes on maven dependencies: <https://maven.apache.org/pom.html#Dependencies> | For Gradle, you can use the [gradle-dependency-analyze](https://github.com/wfhartford/gradle-dependency-analyze) plugin, it will add the `analyzeClassesDependencies` task :
>
> This task depends on the `classes` task and analyzes the dependencies
> of the main source set's output directory. This ensures that all
> ... |
49,390,653 | If I want project `A` to compile and tests to run but when I place it as a dependency into project `B` then project `A`'s dependencies should not be available to project `B`.
For example:
1. Add `org.example.foo` as a dependency into project `A` (not `B`)
2. Add project `A` as a dependency inside project `B`
3. Add t... | 2018/03/20 | [
"https://Stackoverflow.com/questions/49390653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4887806/"
] | You should specifiy the dependencies in project "A" with `<scope>provided</scope>`. This way the respective dependency is used for compilation & testing, but is not transitively used in project "B".
Here you find the different scopes on maven dependencies: <https://maven.apache.org/pom.html#Dependencies> | The Readme of [gradle-dependency-analyze](https://github.com/wfhartford/gradle-dependency-analyze) plugin mentioned in this [answer](https://stackoverflow.com/a/49693428/2438951) here mentions:
>
> This plugin attempts to replicate the functionality of the maven
> dependency plugin's analyze goals which fail the bui... |
349,034 | When I'm copying a copying a large file to a 8GB pendrive, the write crawls at some 10's of kB/s. Even after killing the process with Ctrl+C, the writing continues for several minutes. (the task manager applet and the "bo" field of `vmstat`)
This happens intermittently and sometimes can be fixed by remounting the driv... | 2013/09/23 | [
"https://askubuntu.com/questions/349034",
"https://askubuntu.com",
"https://askubuntu.com/users/178914/"
] | This does maybe not apply to 12.04 anymore (I think it does though). The easiest version by now (Using ubuntu 14.04.2) is:
```
sudo apt-get install emacs24
```
Then, inside of emacs, use the package manager:
```
M-x package-list-packages
```
Search (`C-s`) "org", there may be a few entries but the one with the da... | To install the latest, make sure that Emacs is installed on your machine.
If not, just press `Ctrl`+`Alt`+`T` on your keyboard to open Terminal. When it opens, run the command(s) below:
```
sudo apt-get install emacs23
```
Once the installation is done. download the latest org-mode from [Ubuntu Updates](http://www... |
349,034 | When I'm copying a copying a large file to a 8GB pendrive, the write crawls at some 10's of kB/s. Even after killing the process with Ctrl+C, the writing continues for several minutes. (the task manager applet and the "bo" field of `vmstat`)
This happens intermittently and sometimes can be fixed by remounting the driv... | 2013/09/23 | [
"https://askubuntu.com/questions/349034",
"https://askubuntu.com",
"https://askubuntu.com/users/178914/"
] | This does maybe not apply to 12.04 anymore (I think it does though). The easiest version by now (Using ubuntu 14.04.2) is:
```
sudo apt-get install emacs24
```
Then, inside of emacs, use the package manager:
```
M-x package-list-packages
```
Search (`C-s`) "org", there may be a few entries but the one with the da... | Here is a solution that uses the latest source code, borrowed from two Emacs StackExchange threads ([here](https://emacs.stackexchange.com/questions/55324/how-to-install-latest-version-of-org-mode/55415#55415) and [here](https://emacs.stackexchange.com/questions/55410/error-when-loading-new-version-of-org-mode/55411#55... |
343,060 | I have set up a home network behind a router a while ago and use openssh to access the network consisting of my laptop, wife's netbook and my desktop all running l/x/ubuntu 12.04. This worked perfectly for some time.
I am now only able to access from and to the netbook and the other 2, but no access between the lapto... | 2013/09/08 | [
"https://askubuntu.com/questions/343060",
"https://askubuntu.com",
"https://askubuntu.com/users/156765/"
] | Thnx for the help. That solved it. My permissions needed to be set as 700 for .ssh. 600 for .ssh/*, **making sure you do it on both machines**. Also change the ownership of .ssh/. and .ssh/* to the user from root, otherwise any information in the config file will not be accessible to the user.
```
sudo chmod 700 ~/.s... | Also check if you don't have a config file in `~/.ssh` and there is no entry `PubkeyAuthentication=no` |
343,060 | I have set up a home network behind a router a while ago and use openssh to access the network consisting of my laptop, wife's netbook and my desktop all running l/x/ubuntu 12.04. This worked perfectly for some time.
I am now only able to access from and to the netbook and the other 2, but no access between the lapto... | 2013/09/08 | [
"https://askubuntu.com/questions/343060",
"https://askubuntu.com",
"https://askubuntu.com/users/156765/"
] | Thnx for the help. That solved it. My permissions needed to be set as 700 for .ssh. 600 for .ssh/*, **making sure you do it on both machines**. Also change the ownership of .ssh/. and .ssh/* to the user from root, otherwise any information in the config file will not be accessible to the user.
```
sudo chmod 700 ~/.s... | I know that this may sounds as a stupid advice.
But we had this issue: the connection was ok, and after sometime, it stopped to work.
As once the connection is active, it was impossible to know when the authentication stopped to effective.
In our case, while changing the keys for other users, that specific key was al... |
66,360,497 | I'm creating a music bot discord but I figured out a miss. My bot can be only once on one voice channel. Is there way to connect this bot to more then one voice channel ? | 2021/02/24 | [
"https://Stackoverflow.com/questions/66360497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15242307/"
] | You cannot have a discord bot be two different voice chats in the same server. Instead, you can make multiple bots that have the exact code (different bot tokens) and invite them all to the server, then allow them to join different voice chats. However, you can have one bot join multiple voice chats that are in **diffe... | That's true that you can't play discord bot on two voice channel on this same server. Instead you can play on different voice chanel if these channels are on different servers. Here is an example:
```
const Discord = require("discord.js");
const fs = require('fs');
const ytdl = require("ytdl-core");
const client = new... |
6,399,257 | I built a quick jQuery image slider today, but there's one problem. The images, which are inside divs, have a gap between them, offsetting them.
I've isolated the problem here: <http://jsfiddle.net/UgzsH/>
`float: left;` gets rid of that gap, but apparently because of the elements they are in, they stack vertically.
... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6399257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/804908/"
] | something like
```
select distinct category, video_id from table_name order by id DESC
```
If you have 6 categories in the db, you would get 6 rows, all having highest id in their category | You have two options:
1. Determine common WHERE clause that will result in what you need.
2. (probably preferred one) Make some query involving UNION (`SELECT ... FROM ... WHERE ... UNION SELECT ... FROM ... WHERE ...` etc.)
Let me know if you have any questions. I believe without your database structure it would be ... |
6,399,257 | I built a quick jQuery image slider today, but there's one problem. The images, which are inside divs, have a gap between them, offsetting them.
I've isolated the problem here: <http://jsfiddle.net/UgzsH/>
`float: left;` gets rid of that gap, but apparently because of the elements they are in, they stack vertically.
... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6399257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/804908/"
] | Please share your table structure. Nevertheless, i think the following query should do the trick:
```
SELECT category_id, MAX(movie_id) most_recent_movie_for_category FROM movies GROUP BY category_id
``` | You have two options:
1. Determine common WHERE clause that will result in what you need.
2. (probably preferred one) Make some query involving UNION (`SELECT ... FROM ... WHERE ... UNION SELECT ... FROM ... WHERE ...` etc.)
Let me know if you have any questions. I believe without your database structure it would be ... |
6,399,257 | I built a quick jQuery image slider today, but there's one problem. The images, which are inside divs, have a gap between them, offsetting them.
I've isolated the problem here: <http://jsfiddle.net/UgzsH/>
`float: left;` gets rid of that gap, but apparently because of the elements they are in, they stack vertically.
... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6399257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/804908/"
] | Thanks for posting the table structure. This is just a simple `GROUP BY` with a `MAX` aggregate on video\_id.
```
SELECT video_category, MAX(video_id) AS video_id FROM videos GROUP BY video_category;
``` | You have two options:
1. Determine common WHERE clause that will result in what you need.
2. (probably preferred one) Make some query involving UNION (`SELECT ... FROM ... WHERE ... UNION SELECT ... FROM ... WHERE ...` etc.)
Let me know if you have any questions. I believe without your database structure it would be ... |
3,093,990 | I'm reading a proof of the Lévy-Ciesielski construction of the Brownian Motion, from the book by "Brownian Motion: An Introduction To Stochastic Processes" by Schilling. There, the authors state a similar reasoning to the following:
We have a sequence of continuous (in $t$) functions $\{W\_n(t)\}$, such that $W\_n(t,\... | 2019/01/30 | [
"https://math.stackexchange.com/questions/3093990",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105100/"
] | My guess is that the first edition meant something like "for all sufficiently large $N$, there exist arbitrarily large $n$ such that $\sup\_t |\dots| < \epsilon$" and the liminf was a sloppy way to write it. Formally, something like:
$$\forall \epsilon > 0\, \exists N'\, \forall N \ge N'\, \forall n' \ge N\, \exists n ... | This is not an answer for your original problem. After reading the book you mentioned above, I can explain why $\{W\_{2^j}(w,t)\}$ has a subsequence that uniformly converges.
Our task is to show there exists $\Omega\_0$ with $\mathbb P(\Omega\_0)=1$ such that for any $w\in\Omega\_0$, the sample paths $\{W\_{2^j}(w,t)... |
220,590 | could any one tell me the following statement is true or false? and any reference for proof or counter examples?
The subset of $C^{\infty}$ functions with compact support in $\mathbb{R}$ in the space of bounded real valued continuous function on $\mathbb{R}$ is dense | 2012/10/25 | [
"https://math.stackexchange.com/questions/220590",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/24690/"
] | Obviously false. There is no sequence in $C\_c(\mathbb R)$ (of smooth or "rough" functions) that converges uniformly to the constant function $1$.
Indeed if $(f\_n)$ is any sequence in $C\_c(\mathbb R)$, then $\displaystyle \lim\_{n\to\infty} \lVert 1-f\_n\rVert\_\infty \geq 1$ since each $f\_n$ is compactly supported... | First, when you say "dense" you need to specify with respect to what norm. I'm assuming you mean the uniform norm (the sup norm).
That said, the statement is false. To see that, take $f(x)=c$, where $c\neq0$. Clearly $f\in C(\mathbb{R})\cap L^\infty(\mathbb{R})$ (continuous and bounded).
Now, for every function $\var... |
70,114,036 | beginner to Pyspark and trying to calculate year over year percentage change w.r.t to product count by grouping product.
I've got this data frame
```
prod_desc year prod_count
0 product_a 2019 53
1 product_b 2019 44
2 product_c 2019 36
3 product_a 2020 52
4 product_b... | 2021/11/25 | [
"https://Stackoverflow.com/questions/70114036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6398900/"
] | Use `flex: display;` and `justify-content: center;`. This will align the `p` tag to center.
Align `h1` with `position: absolute;` to required position.
You should add `position: relative;` to `.card` for the `h1` with style `position: absolute;` to stay inside `.card`
```css
.card {
height: 300px;
background-col... | Since you want to **vertically** center `<p>` you can do that by using **absolute** position. First set your `.card` to `position:relative;` so that `<p>` remains inside it, now give `.card p` `position:absolute;` and set `top:50%;` but this will only center it to its parent element, to make it perfectly center we need... |
53,407,587 | What I currently do:
--------------------
I have a graph with a variable amount of nodes.
>
> between 10 and max. 30 nodes (lets call this n)
>
>
>
The layout I use is the dagre layout (not that it matters) and, depending on the data, between 1 and n tippy's. The code works fine and I can display all the data I... | 2018/11/21 | [
"https://Stackoverflow.com/questions/53407587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8918721/"
] | It works fine.
```
select from_unixtime(unix_timestamp('01/15/2018 15:26:37', 'MM/dd/yyyy HH:mm:ss')-4*3600, 'MM/dd/yyyy HH:mm:ss')
``` | In addition to [the answer of @StrongYoung](https://stackoverflow.com/a/53408280/9145106).
I find it very useful to define such long expressions as a macros and place in the initialization file (e.g. `hive -i init-file.hql ...`).
```
hive> create temporary macro sub_hours(dt string, hours int)
from_unixtime(unix_tim... |
53,407,587 | What I currently do:
--------------------
I have a graph with a variable amount of nodes.
>
> between 10 and max. 30 nodes (lets call this n)
>
>
>
The layout I use is the dagre layout (not that it matters) and, depending on the data, between 1 and n tippy's. The code works fine and I can display all the data I... | 2018/11/21 | [
"https://Stackoverflow.com/questions/53407587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8918721/"
] | It works fine.
```
select from_unixtime(unix_timestamp('01/15/2018 15:26:37', 'MM/dd/yyyy HH:mm:ss')-4*3600, 'MM/dd/yyyy HH:mm:ss')
``` | E.g. Your current time in your specific timezone - 1 hour:
```
select date_format(
from_utc_timestamp(CURRENT_TIMESTAMP(),'Europe/Madrid') - INTERVAL 1 hours,
'yyyy-MM-dd HH:mm:ss')
as PREVIOUS_HOUR
``` |
53,407,587 | What I currently do:
--------------------
I have a graph with a variable amount of nodes.
>
> between 10 and max. 30 nodes (lets call this n)
>
>
>
The layout I use is the dagre layout (not that it matters) and, depending on the data, between 1 and n tippy's. The code works fine and I can display all the data I... | 2018/11/21 | [
"https://Stackoverflow.com/questions/53407587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8918721/"
] | In addition to [the answer of @StrongYoung](https://stackoverflow.com/a/53408280/9145106).
I find it very useful to define such long expressions as a macros and place in the initialization file (e.g. `hive -i init-file.hql ...`).
```
hive> create temporary macro sub_hours(dt string, hours int)
from_unixtime(unix_tim... | E.g. Your current time in your specific timezone - 1 hour:
```
select date_format(
from_utc_timestamp(CURRENT_TIMESTAMP(),'Europe/Madrid') - INTERVAL 1 hours,
'yyyy-MM-dd HH:mm:ss')
as PREVIOUS_HOUR
``` |
3,852,138 | As much as I love rails, I've always hated dealing with dates in an html form...especially when the date isn't an object's property.
The select\_date helper is nice, but it always generates this:
```
<select name="date[year]" id="date_year">
<select name="date[month]" id="date_month">
<select name="date[day]" id="dat... | 2010/10/04 | [
"https://Stackoverflow.com/questions/3852138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/202875/"
] | You can use the :prefix option to do this.
```
<%= select_date(nil, :prefix => 'payday') %>
```
Which generates this:
```
<select id="payday_year" name="payday[year]">
<select id="payday_month" name="payday[month]">
<select id="payday_day" name="payday[day]">
```
More examples here
<http://api.rubyonrails.org/cl... | if it's not an object property, are you just using the rails date helpers? You can probably do better.
I'd just have a simple textfield, and use jquery to decorate it as a date .. check out [this jQuery date drop-down](http://jquerytools.github.io/documentation/dateinput/index.html).
You'd then parse it in the contro... |
4,500,322 | I have a procedure which receive a bit variable called `@FL_FINALIZADA`.
If it is null or false I want to restrict my select to show only the rows that contain null `DT_FINALIZACAO` values. Otherwise I want to show the rows containing not null `DT_FINALIZACAO` values.
Something like this:
```
SELECT
*
FROM
... | 2010/12/21 | [
"https://Stackoverflow.com/questions/4500322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514556/"
] | Change the AND to be:
```
AND (((@FL_FINALIZADA <> 1) AND (OPE.DT_FINALIZACAO IS NULL)) OR ( (@FL_FINALIZADA = 1) AND (OPE.DT_FINALIZACAO IS NOT NULL)))
```
If the bit flag is 1 then DT\_FINALIZACAO can't be null. | My detailed SQL is a little rusty, but have you tried using 0 insted of NULL? I would expect 0 to evaluate the same as NULL in that select |
4,500,322 | I have a procedure which receive a bit variable called `@FL_FINALIZADA`.
If it is null or false I want to restrict my select to show only the rows that contain null `DT_FINALIZACAO` values. Otherwise I want to show the rows containing not null `DT_FINALIZACAO` values.
Something like this:
```
SELECT
*
FROM
... | 2010/12/21 | [
"https://Stackoverflow.com/questions/4500322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514556/"
] | ```
SELECT
*
FROM
MyTable
WHERE
(ISNULL(@FL_FINALIZADA, 0) = 0
AND
OPE.DT_FINALIZACAO IS NULL
)
OR
(@FL_FINALIZADA = 1
AND
OPE.DT_FINALIZACAO IS NOT NULL
)
``` | Change the AND to be:
```
AND (((@FL_FINALIZADA <> 1) AND (OPE.DT_FINALIZACAO IS NULL)) OR ( (@FL_FINALIZADA = 1) AND (OPE.DT_FINALIZACAO IS NOT NULL)))
```
If the bit flag is 1 then DT\_FINALIZACAO can't be null. |
4,500,322 | I have a procedure which receive a bit variable called `@FL_FINALIZADA`.
If it is null or false I want to restrict my select to show only the rows that contain null `DT_FINALIZACAO` values. Otherwise I want to show the rows containing not null `DT_FINALIZACAO` values.
Something like this:
```
SELECT
*
FROM
... | 2010/12/21 | [
"https://Stackoverflow.com/questions/4500322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514556/"
] | ```
SELECT
*
FROM
MyTable
WHERE
(ISNULL(@FL_FINALIZADA, 0) = 0
AND
OPE.DT_FINALIZACAO IS NULL
)
OR
(@FL_FINALIZADA = 1
AND
OPE.DT_FINALIZACAO IS NOT NULL
)
``` | My detailed SQL is a little rusty, but have you tried using 0 insted of NULL? I would expect 0 to evaluate the same as NULL in that select |
4,500,322 | I have a procedure which receive a bit variable called `@FL_FINALIZADA`.
If it is null or false I want to restrict my select to show only the rows that contain null `DT_FINALIZACAO` values. Otherwise I want to show the rows containing not null `DT_FINALIZACAO` values.
Something like this:
```
SELECT
*
FROM
... | 2010/12/21 | [
"https://Stackoverflow.com/questions/4500322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514556/"
] | ```
IF @FL_FINALIZADA IS NULL
SET @FL_FINALIZADA = 0
SELECT * FROM NewsletterSubscribers
WHERE
(@FL_FINALIZADA = 0 AND OPE.DT_FINALIZACAO IS NULL)
OR
(@FL_FINALIZADA = 1 AND OPE.DT_FINALIZACAO IS NOT NULL)
``` | My detailed SQL is a little rusty, but have you tried using 0 insted of NULL? I would expect 0 to evaluate the same as NULL in that select |
4,500,322 | I have a procedure which receive a bit variable called `@FL_FINALIZADA`.
If it is null or false I want to restrict my select to show only the rows that contain null `DT_FINALIZACAO` values. Otherwise I want to show the rows containing not null `DT_FINALIZACAO` values.
Something like this:
```
SELECT
*
FROM
... | 2010/12/21 | [
"https://Stackoverflow.com/questions/4500322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514556/"
] | ```
SELECT
*
FROM
MyTable
WHERE
(ISNULL(@FL_FINALIZADA, 0) = 0
AND
OPE.DT_FINALIZACAO IS NULL
)
OR
(@FL_FINALIZADA = 1
AND
OPE.DT_FINALIZACAO IS NOT NULL
)
``` | ```
IF @FL_FINALIZADA IS NULL
SET @FL_FINALIZADA = 0
SELECT * FROM NewsletterSubscribers
WHERE
(@FL_FINALIZADA = 0 AND OPE.DT_FINALIZACAO IS NULL)
OR
(@FL_FINALIZADA = 1 AND OPE.DT_FINALIZACAO IS NOT NULL)
``` |
26,345,020 | I have the requirement to insert records into a SQL table that contains varbinary and image columns.
How do I get 0x00120A011EFD89F94DDA363BA64F57441DE9 (This is the same for all records)
into this
BLOB\_TYPE (MY\_UDDT(varbinary(18))?
This is what I have so far, everything being very straightforward except for the... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26345020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408989/"
] | The problem is that the parameter value is a byte array, not an instance of the UDT you are claiming is going to be passed in, and `System.Byte[]` is, unsurprisingly, not a registered UDT.
It's confusing, but the "UDT" on the .NET side is used only for UDTs that are created in assemblies (`CREATE TYPE ... EXTERNAL NAM... | SqlDbType.Udt is for SQLCLR types. In this case, you have a varbinary column so specify SqlDbType.VarBinary along with the max size (18). For the value, pass the byte array containing the raw binary value.
You mention an 18-byte varbinary data type but the data looks to be much longer. If your intent is to convert a s... |
26,345,020 | I have the requirement to insert records into a SQL table that contains varbinary and image columns.
How do I get 0x00120A011EFD89F94DDA363BA64F57441DE9 (This is the same for all records)
into this
BLOB\_TYPE (MY\_UDDT(varbinary(18))?
This is what I have so far, everything being very straightforward except for the... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26345020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408989/"
] | There are several things being misunderstood here:
* There is a big difference between User-Defined Data Types (UDDTs) and User-Defined Types (UDTs), though it is understandable that people get confused given the similarity of the names.
+ What you created via `CREATE TYPE` is a UDDT, not a UDT. This is a T-SQL only ... | SqlDbType.Udt is for SQLCLR types. In this case, you have a varbinary column so specify SqlDbType.VarBinary along with the max size (18). For the value, pass the byte array containing the raw binary value.
You mention an 18-byte varbinary data type but the data looks to be much longer. If your intent is to convert a s... |
26,345,020 | I have the requirement to insert records into a SQL table that contains varbinary and image columns.
How do I get 0x00120A011EFD89F94DDA363BA64F57441DE9 (This is the same for all records)
into this
BLOB\_TYPE (MY\_UDDT(varbinary(18))?
This is what I have so far, everything being very straightforward except for the... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26345020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408989/"
] | There are several things being misunderstood here:
* There is a big difference between User-Defined Data Types (UDDTs) and User-Defined Types (UDTs), though it is understandable that people get confused given the similarity of the names.
+ What you created via `CREATE TYPE` is a UDDT, not a UDT. This is a T-SQL only ... | The problem is that the parameter value is a byte array, not an instance of the UDT you are claiming is going to be passed in, and `System.Byte[]` is, unsurprisingly, not a registered UDT.
It's confusing, but the "UDT" on the .NET side is used only for UDTs that are created in assemblies (`CREATE TYPE ... EXTERNAL NAM... |
124,190 | I want to know all the times a user logs since last year into my system?
I used `last` command but it is not useful. | 2014/04/11 | [
"https://unix.stackexchange.com/questions/124190",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/64956/"
] | The login logs on redhat-style linux are called `wtmp` (`man wtmp`), stored in `/var/log/` by default, and you can retrieve them using `utmpdump` (on RHEL6).
```
[root@server ~]# utmpdump /var/log/wtmp* | awk '$4~"root" {print}'
Utmp dump of /var/log/wtmp
[7] [01320] [ts/0] [root ] [pts/0 ] [192.168.1.101 ... | It seems `last` can be used to achieve what you are trying to do. You need to append the date to the last command to extract the information.
```
last | while read line; do date=`date -d "$(echo $line | awk '{ print $5" "$6" "$7 }')" +%s`; [[ $date -ge `date -d "Aug 25 00:00" +%s` && $date -le `date -d "Aug 28 00:00" ... |
960 | We currently have: [multi-player](https://boardgames.stackexchange.com/questions/tagged/multi-player "show questions tagged 'multi-player'"), [two-players](https://boardgames.stackexchange.com/questions/tagged/two-players "show questions tagged 'two-players'"), [extra-players](https://boardgames.stackexchange.com/quest... | 2012/11/12 | [
"https://boardgames.meta.stackexchange.com/questions/960",
"https://boardgames.meta.stackexchange.com",
"https://boardgames.meta.stackexchange.com/users/1315/"
] | Nuke them all.
They add nothing, in my opinion (besides opportunities for people to go tagging everything in sight).
For me, nearly any tag that groups multiple unrelated games together is probably a meta-tag, and we shouldn't use it. | I think we should merge all of these into [player-number](https://boardgames.stackexchange.com/questions/tagged/player-number "show questions tagged 'player-number'") and write a wiki for it. This tag should almost always be accompanied by a game-specific tag. (The exception there would be questions of the form "what g... |
960 | We currently have: [multi-player](https://boardgames.stackexchange.com/questions/tagged/multi-player "show questions tagged 'multi-player'"), [two-players](https://boardgames.stackexchange.com/questions/tagged/two-players "show questions tagged 'two-players'"), [extra-players](https://boardgames.stackexchange.com/quest... | 2012/11/12 | [
"https://boardgames.meta.stackexchange.com/questions/960",
"https://boardgames.meta.stackexchange.com",
"https://boardgames.meta.stackexchange.com/users/1315/"
] | I can only see one valid use for multi-player. That would be with [mtg](https://boardgames.stackexchange.com/questions/tagged/mtg "show questions tagged 'mtg'"). The rules differ in some respects, and the answers differ too when offering advice about about a duel deck versus a multi-player deck. As for a tag, mtg-free-... | I think we should merge all of these into [player-number](https://boardgames.stackexchange.com/questions/tagged/player-number "show questions tagged 'player-number'") and write a wiki for it. This tag should almost always be accompanied by a game-specific tag. (The exception there would be questions of the form "what g... |
960 | We currently have: [multi-player](https://boardgames.stackexchange.com/questions/tagged/multi-player "show questions tagged 'multi-player'"), [two-players](https://boardgames.stackexchange.com/questions/tagged/two-players "show questions tagged 'two-players'"), [extra-players](https://boardgames.stackexchange.com/quest... | 2012/11/12 | [
"https://boardgames.meta.stackexchange.com/questions/960",
"https://boardgames.meta.stackexchange.com",
"https://boardgames.meta.stackexchange.com/users/1315/"
] | Nuke them all.
They add nothing, in my opinion (besides opportunities for people to go tagging everything in sight).
For me, nearly any tag that groups multiple unrelated games together is probably a meta-tag, and we shouldn't use it. | I can only see one valid use for multi-player. That would be with [mtg](https://boardgames.stackexchange.com/questions/tagged/mtg "show questions tagged 'mtg'"). The rules differ in some respects, and the answers differ too when offering advice about about a duel deck versus a multi-player deck. As for a tag, mtg-free-... |
146,781 | I have title part in latex code and i want to put image in left side. Page is in center.
```
\title{\vspace{-15mm}
\fontsize{25pt}{10pt}\selectfont
\textbf{\hspace*{-1pt}
\includegraphics[width=0.15\textwidth]{./img/logo.png}\hfill
\hspace*{-100pt} This Text}}
```
But After this code "This Text" is going to left s... | 2013/11/25 | [
"https://tex.stackexchange.com/questions/146781",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/41639/"
] | Sorry, corected now. One of `\hfill`'s on both sides can be removed, but now it is easier to understand, how the centering is obtained: one hidden plus one explicit, corrected by two on the right hand side.
```
\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\title{\vspace{-15mm}
\... | If the title is only on one line, then this should work:
```
\documentclass{article}
\usepackage{lmodern}
\usepackage{graphicx}
\begin{document}
\author{A. U. Thor}
\title{%
\fontsize{25}{32}\bfseries % boldface 25pt
\makebox[\textwidth][s]{%
\makebox[0pt][l]{\includegraphics[width=0.15\textwidth]{duck}}%
... |
146,781 | I have title part in latex code and i want to put image in left side. Page is in center.
```
\title{\vspace{-15mm}
\fontsize{25pt}{10pt}\selectfont
\textbf{\hspace*{-1pt}
\includegraphics[width=0.15\textwidth]{./img/logo.png}\hfill
\hspace*{-100pt} This Text}}
```
But After this code "This Text" is going to left s... | 2013/11/25 | [
"https://tex.stackexchange.com/questions/146781",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/41639/"
] | Sorry, corected now. One of `\hfill`'s on both sides can be removed, but now it is easier to understand, how the centering is obtained: one hidden plus one explicit, corrected by two on the right hand side.
```
\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\title{\vspace{-15mm}
\... | Yet another answer using the `tcolorbox` package.
My answer constructs a sidebyside box named `imagetextbox` which will take the image to its lefthand (upper) side und the text to the righthand (lower) side.
The macro `\imagetext` takes one image and the text as arguments. All dimensions could be adapated if needed.
... |
16,733,946 | Is there any possiblity to obtain the list of constraints from web.xml ?
```
<security-constraint>
<web-resource-collection>
<web-resource-name>admin</web-resource-name>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
... | 2013/05/24 | [
"https://Stackoverflow.com/questions/16733946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341314/"
] | If you have a `ServletContainerInitializer`, in its `onStartup()` method, you would basically do what your container does when it parses your web.xml. For example:
```
@Override
public void onStartup(Set<Class<?>> classes, ServletContext ctx) throws ServletException {
ServletRegistration.Dynamic servlet = ctx.addS... | As per [Servlet 3.0 on Annotations and Deployment descriptors](https://today.java.net/pub/a/today/2008/10/14/introduction-to-servlet-3.html#annotations-vs-deployment-descriptor) there is no mention of adding new `security-constraints` programatically. So, I doubt if you can add security contraints programatically. |
7,483,128 | I have two columns. when i am dividing values of both table i am getting column of integer value. But I want the exact float values in the column after division.
One more query i have is that when i runing this query in shell its working fine but it is giving me error when i am using it in code. Please suggest some thi... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7483128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/919470/"
] | This should get you what you want:
select ((**cast(Forecasted\_Qty as REAL)** - **cast(Actual\_Sales\_Qty as REAL)**) \* 100)/forecasted\_qty
or better yet:
select ((**cast(Forecasted\_Qty - Actual\_Sales\_Qty as REAL)**) \* 100)/forecasted\_qty | I got the answer.
```
c= myDataBase.rawQuery("select ((cast(Forecasted_Qty - Actual_Sales_Qty as real)) * 100)/forecasted_qty,Mrkt_Segment_Key from sales_forecast,customer,market_segment,org_location where sales_forecast.Mrkt_Segment_Key=market_segment.market_seg_key and market_segment.market_seg_code=? group by sale... |
250 | Are Dalcrose Eurhythmics concepts appropriate for newly beginning instrumentalists or do they rely on instrumental techniques that are only acquired later? If they are appropriate, what are some of the benefits that have been said to come from beginning Eurhythmics at an early stage? | 2011/04/29 | [
"https://music.stackexchange.com/questions/250",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/156/"
] | The preparatory school at one of the music schools I attended offered this for children learning music. I can't point you towards any studies, but there are two things that come to mind why I think that this is a great idea.
* Learning good rhythm from the start by feeling it in your whole body makes a lot of sense. T... | I've come across Dalcroze Eurhythmics as part of a class on Kodaly - our teacher gave us a taster of some DE exercises. My impression is that (rather like Alexander Technique) it could be extremely useful to beginner musicians/performers because it embodies good habits before you have a chance to develop the bad ones!
... |
31,916,109 | I have a list in which I show a few options to the user. I also have two buttons for next and previous. On next new options are bound from the database.
**Issue:**
On press of the previous button I want to show the previously selected state. Sadly I am unable to highlight the selected row.
```
listviewoptions = (Li... | 2015/08/10 | [
"https://Stackoverflow.com/questions/31916109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5290978/"
] | Two ways you can show the selection.
1] set choicemode as "SingleChoice"to listView and use a custom "Checkable" View [find here](http://developer.android.com/intl/ru/reference/android/widget/Checkable.html.) .
2] Override getView() and change the background based on some member variable.
```
public View ge... | **Step 1**
yourlistview.setItemChecked(iposition, true);
//here iposition is an int to the selected position
**Step 2**
```
List<String> options = db.getAllOptions(QuestionID);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.simple_list_item_activated_1, R.id.te... |
72,195 | I have a custom button called massdelete on listview. I don't want everyone to see this button but only selected profiles or roles..How to do this?
Thanks in Advance.. | 2015/04/14 | [
"https://salesforce.stackexchange.com/questions/72195",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/18741/"
] | You said the button execute's javascript. So, in the javascript code itself is where you first need to check the current user, maybe by profile, and give the ability or restrict using an alert message. You can use something like {!$Profile.UserType} == 'Profile Name ABC' in the JS code, really any of the $Profile or $U... | If you want to restrict the visibility of the Mass Delete button you can replicate the Javascript logic within the visualforce page and restrict user access to the visualforce page at a profile or permission set level. |
72,195 | I have a custom button called massdelete on listview. I don't want everyone to see this button but only selected profiles or roles..How to do this?
Thanks in Advance.. | 2015/04/14 | [
"https://salesforce.stackexchange.com/questions/72195",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/18741/"
] | There once lived (prolly still lives) a sorcerer who taught us this secret recipe:
[Changing the color of a custom button](https://salesforce.stackexchange.com/questions/10516/changing-the-color-of-a-custom-button)
Follow this link to implement the same
I created a javascript function to hide the button as below
`... | If you want to restrict the visibility of the Mass Delete button you can replicate the Javascript logic within the visualforce page and restrict user access to the visualforce page at a profile or permission set level. |
67,045,386 | I have a table in snowflake which has some data like below
Table 1(snowflake table)
```
LOCATIONID OBSERVATION_TIME_UTC source_record_id Value
LFOB 201001000001.00 cw_altdata:LFOB_historical_hourly.txt:2020-12-23_003400:1 3
LFOB 201001000002.00 ... | 2021/04/11 | [
"https://Stackoverflow.com/questions/67045386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14126479/"
] | >
> Using IActionResult with Azure Functions in .NET 5?
>
>
>
You [can't return `IActionResult` with Azure Functions in .NET 5](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#bindings). Or more generally, you can't return `IActionResult` with Azure Functions using the isolate... | To return an object from .NET 5 Azure Functions, use the following code:
```
var response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync(obj);
return response;
``` |
67,045,386 | I have a table in snowflake which has some data like below
Table 1(snowflake table)
```
LOCATIONID OBSERVATION_TIME_UTC source_record_id Value
LFOB 201001000001.00 cw_altdata:LFOB_historical_hourly.txt:2020-12-23_003400:1 3
LFOB 201001000002.00 ... | 2021/04/11 | [
"https://Stackoverflow.com/questions/67045386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14126479/"
] | >
> Using IActionResult with Azure Functions in .NET 5?
>
>
>
You [can't return `IActionResult` with Azure Functions in .NET 5](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#bindings). Or more generally, you can't return `IActionResult` with Azure Functions using the isolate... | Was pleasantly surprised to find that returning Task from a "dotnet-isolated" function workins in Core 6. Saved me a few hours as I do not need to change to Task in a number of functions |
67,045,386 | I have a table in snowflake which has some data like below
Table 1(snowflake table)
```
LOCATIONID OBSERVATION_TIME_UTC source_record_id Value
LFOB 201001000001.00 cw_altdata:LFOB_historical_hourly.txt:2020-12-23_003400:1 3
LFOB 201001000002.00 ... | 2021/04/11 | [
"https://Stackoverflow.com/questions/67045386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14126479/"
] | >
> Using IActionResult with Azure Functions in .NET 5?
>
>
>
You [can't return `IActionResult` with Azure Functions in .NET 5](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#bindings). Or more generally, you can't return `IActionResult` with Azure Functions using the isolate... | After searching around and wanting to stay in the context of the IActionResult object, I ended up leveraging the ObjectResult object so that I can standardize all the service responses with the standardize JSON messages. |
67,045,386 | I have a table in snowflake which has some data like below
Table 1(snowflake table)
```
LOCATIONID OBSERVATION_TIME_UTC source_record_id Value
LFOB 201001000001.00 cw_altdata:LFOB_historical_hourly.txt:2020-12-23_003400:1 3
LFOB 201001000002.00 ... | 2021/04/11 | [
"https://Stackoverflow.com/questions/67045386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14126479/"
] | To return an object from .NET 5 Azure Functions, use the following code:
```
var response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync(obj);
return response;
``` | Was pleasantly surprised to find that returning Task from a "dotnet-isolated" function workins in Core 6. Saved me a few hours as I do not need to change to Task in a number of functions |
67,045,386 | I have a table in snowflake which has some data like below
Table 1(snowflake table)
```
LOCATIONID OBSERVATION_TIME_UTC source_record_id Value
LFOB 201001000001.00 cw_altdata:LFOB_historical_hourly.txt:2020-12-23_003400:1 3
LFOB 201001000002.00 ... | 2021/04/11 | [
"https://Stackoverflow.com/questions/67045386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14126479/"
] | To return an object from .NET 5 Azure Functions, use the following code:
```
var response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync(obj);
return response;
``` | After searching around and wanting to stay in the context of the IActionResult object, I ended up leveraging the ObjectResult object so that I can standardize all the service responses with the standardize JSON messages. |
48,055,596 | I have tried using sudo easy\_install sqlalchemy, pip install sqlalchemy and pip install flask-sqlalchemy. I have also tried installing and uninstalling sqlalchemy and flask. I get the error
```
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
self.... | 2018/01/02 | [
"https://Stackoverflow.com/questions/48055596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2714453/"
] | I finally found a workaround for the issue. Although I am not satisfied with the strategy since it is not self contained in the widget itself, but it works. The solution involves trapping `fzf-completion` after it is invoked and calling `zle reset-prompt`.
For registering the trap add the following snippet to your `.z... | I was getting the same error when trying to use `bindkey` for a widget to use vim to open the `fzf` selected file. Turns out I have to open the file in `function1` and then have a `function2` calling function1 and then `reset-prompt` to avoid this `widgets can only be called when ZLE is active` error. Like you said, it... |
48,055,596 | I have tried using sudo easy\_install sqlalchemy, pip install sqlalchemy and pip install flask-sqlalchemy. I have also tried installing and uninstalling sqlalchemy and flask. I get the error
```
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
self.... | 2018/01/02 | [
"https://Stackoverflow.com/questions/48055596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2714453/"
] | After two days, I finally managed to find a hint on how to achieve it thanks to the excellent fzf-tab-completion project:
<https://github.com/lincheney/fzf-tab-completion/blob/c91959d81320935ae88c090fedde8dcf1ca70a6f/zsh/fzf-zsh-completion.sh#L120>
So actually, all that you need to do is:
```bash
#compdef takenote
l... | I was getting the same error when trying to use `bindkey` for a widget to use vim to open the `fzf` selected file. Turns out I have to open the file in `function1` and then have a `function2` calling function1 and then `reset-prompt` to avoid this `widgets can only be called when ZLE is active` error. Like you said, it... |
23,160,522 | Been working with Wicket for a few weeks now and I'm stumped on the best way to maintain styles on panels in markup. For example, pretend I have the following panel (ignore the Java side, I don't believe it is relevant):
```
<wicket:panel>
<div class="brick"></div>
</wicket:panel>
```
Now I'm building a new compon... | 2014/04/18 | [
"https://Stackoverflow.com/questions/23160522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1563125/"
] | If you want to save photo then you can use Alloy.Globals to save data globally so you can use it later.
Alloy.Globals.photo = blob object; | Here is how I am currently solving my problem:
```
takePhotoButton.addEventListener('click', function(){
Titanium.Media.showCamera({
success:function(event) {
if(event.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) {
// Store the file in a variable
var image = event.media;
... |
23,160,522 | Been working with Wicket for a few weeks now and I'm stumped on the best way to maintain styles on panels in markup. For example, pretend I have the following panel (ignore the Java side, I don't believe it is relevant):
```
<wicket:panel>
<div class="brick"></div>
</wicket:panel>
```
Now I'm building a new compon... | 2014/04/18 | [
"https://Stackoverflow.com/questions/23160522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1563125/"
] | *Note that I tried to edit the answer from Mitul Bhalia with the following, but the edit got knocked back. So here's how you do it:*
After taking the image, you can store it as a variable in the global object, `Alloy.Globals`. You can then access this else where or later on in your app.
For example:
```
takePhotoBut... | If you want to save photo then you can use Alloy.Globals to save data globally so you can use it later.
Alloy.Globals.photo = blob object; |
23,160,522 | Been working with Wicket for a few weeks now and I'm stumped on the best way to maintain styles on panels in markup. For example, pretend I have the following panel (ignore the Java side, I don't believe it is relevant):
```
<wicket:panel>
<div class="brick"></div>
</wicket:panel>
```
Now I'm building a new compon... | 2014/04/18 | [
"https://Stackoverflow.com/questions/23160522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1563125/"
] | *Note that I tried to edit the answer from Mitul Bhalia with the following, but the edit got knocked back. So here's how you do it:*
After taking the image, you can store it as a variable in the global object, `Alloy.Globals`. You can then access this else where or later on in your app.
For example:
```
takePhotoBut... | Here is how I am currently solving my problem:
```
takePhotoButton.addEventListener('click', function(){
Titanium.Media.showCamera({
success:function(event) {
if(event.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) {
// Store the file in a variable
var image = event.media;
... |
3,348,058 | How does one prove the following limit without integration?
$$\lim\_{n\rightarrow\infty}\frac{1}{n}\sum\_{i=1}^{n}\Bigl(\frac{i}{n}\Bigr)^k=\frac{1}{k+1}$$
I was doing some calculus in my free time and tried to prove $\int\_{0}^{x}x^kdx=\frac{x^{k+1}}{k+1}$ using the Riemann Sum but got stumped at this infinite sum.
E... | 2019/09/08 | [
"https://math.stackexchange.com/questions/3348058",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/570475/"
] | There is a typo in your limit, the correct version should be
$$\lim\_{n\to\infty}\frac{1}{n}\sum\_{i=1}^n \left(\frac{i}
{n}\right)^k = \frac{1}{k+1}$$
When $k$ is a positive integer, there is an elementary proof of this without using any concept of Riemann sums.
For positive integers $i$ and $k$, we have
$$\begin{a... | Using generalize harmonic numbers
$$S\_n=\sum\_{i=1}^{n}\Bigl(\frac{i}{n}\Bigr)^k=\frac1 {n^k}\sum\_{i=1}^{n}i ^k=\frac1 {n^k} H\_n^{(-k)}$$
Using asymptotics
$$H\_n^{(-k)}=n^k \left(\frac{n}{k+1}+\frac{1}{2}+\frac{k}{12
n}+O\left(\frac{1}{n^3}\right)\right)+\zeta (-k)$$ So
$$\frac 1 n S\_n=n^{-k-1} \zeta (-k)+\left(\... |
3,348,058 | How does one prove the following limit without integration?
$$\lim\_{n\rightarrow\infty}\frac{1}{n}\sum\_{i=1}^{n}\Bigl(\frac{i}{n}\Bigr)^k=\frac{1}{k+1}$$
I was doing some calculus in my free time and tried to prove $\int\_{0}^{x}x^kdx=\frac{x^{k+1}}{k+1}$ using the Riemann Sum but got stumped at this infinite sum.
E... | 2019/09/08 | [
"https://math.stackexchange.com/questions/3348058",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/570475/"
] | There is a typo in your limit, the correct version should be
$$\lim\_{n\to\infty}\frac{1}{n}\sum\_{i=1}^n \left(\frac{i}
{n}\right)^k = \frac{1}{k+1}$$
When $k$ is a positive integer, there is an elementary proof of this without using any concept of Riemann sums.
For positive integers $i$ and $k$, we have
$$\begin{a... | If you want to prove $$\int\_0^x u^kdu={x^{k+1}\over k+1}$$I think you would better prove that $$\int\_0^x f(u)du=F(x)$$by proving that $$f(x)=\lim\_{h\to 0}{\int\_{x}^{x+h}f(u)du\over h}$$ |
3,348,058 | How does one prove the following limit without integration?
$$\lim\_{n\rightarrow\infty}\frac{1}{n}\sum\_{i=1}^{n}\Bigl(\frac{i}{n}\Bigr)^k=\frac{1}{k+1}$$
I was doing some calculus in my free time and tried to prove $\int\_{0}^{x}x^kdx=\frac{x^{k+1}}{k+1}$ using the Riemann Sum but got stumped at this infinite sum.
E... | 2019/09/08 | [
"https://math.stackexchange.com/questions/3348058",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/570475/"
] | There is a typo in your limit, the correct version should be
$$\lim\_{n\to\infty}\frac{1}{n}\sum\_{i=1}^n \left(\frac{i}
{n}\right)^k = \frac{1}{k+1}$$
When $k$ is a positive integer, there is an elementary proof of this without using any concept of Riemann sums.
For positive integers $i$ and $k$, we have
$$\begin{a... | As per the comment I posted a while ago (considering the question was updated), using [Riemann sum](https://math.stackexchange.com/questions/2118515/if-f-is-riemann-integrable-on-0-1-then-lim-limits-n-rightarrow-infty-f/2121640#2121640)
$$\lim\limits\_{n\rightarrow\infty} \frac{1}{n}\sum\limits\_{i=1}^n f\left(\frac{i}... |
39,372,886 | [Document.importNode in specification](https://www.w3.org/TR/dom/#dom-document-importnode)
[Node.cloneNode in specification](https://www.w3.org/TR/dom/#concept-node-clone)
This two methods work equally. Please give me real example in which I can see the difference between this methods. | 2016/09/07 | [
"https://Stackoverflow.com/questions/39372886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2702805/"
] | Alohci is right: there's not much of a difference, since [web compatibility forced the browsers to implicitly `adoptNode()` before inserting a node into another document](https://lists.w3.org/Archives/Public/www-dom/2010JulSep/0111.html).
*Before* you insert the cloned node into a new document, there's a difference: t... | Simply put:
`element.cloneNode()` is used to clone a node from current `document`, for instance, with shadow DOM when you append any DOM element such as a `template`. There you call `shadowDOM.appendChild(template.content.cloneNode(true))`, where `template` is an instance of `<template>` defined in your HTML. Here you... |
39,372,886 | [Document.importNode in specification](https://www.w3.org/TR/dom/#dom-document-importnode)
[Node.cloneNode in specification](https://www.w3.org/TR/dom/#concept-node-clone)
This two methods work equally. Please give me real example in which I can see the difference between this methods. | 2016/09/07 | [
"https://Stackoverflow.com/questions/39372886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2702805/"
] | Alohci is right: there's not much of a difference, since [web compatibility forced the browsers to implicitly `adoptNode()` before inserting a node into another document](https://lists.w3.org/Archives/Public/www-dom/2010JulSep/0111.html).
*Before* you insert the cloned node into a new document, there's a difference: t... | I started learning JavaScript a few months ago in my classes and came upon one distinction between those two methods today. Since [Iaroslav Baranov](https://stackoverflow.com/users/2702805/iaroslav-baranov) wanted an example, here it is:
I was trying to clone an HTML template tag with its content to create a gallery o... |
39,372,886 | [Document.importNode in specification](https://www.w3.org/TR/dom/#dom-document-importnode)
[Node.cloneNode in specification](https://www.w3.org/TR/dom/#concept-node-clone)
This two methods work equally. Please give me real example in which I can see the difference between this methods. | 2016/09/07 | [
"https://Stackoverflow.com/questions/39372886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2702805/"
] | Simply put:
`element.cloneNode()` is used to clone a node from current `document`, for instance, with shadow DOM when you append any DOM element such as a `template`. There you call `shadowDOM.appendChild(template.content.cloneNode(true))`, where `template` is an instance of `<template>` defined in your HTML. Here you... | I started learning JavaScript a few months ago in my classes and came upon one distinction between those two methods today. Since [Iaroslav Baranov](https://stackoverflow.com/users/2702805/iaroslav-baranov) wanted an example, here it is:
I was trying to clone an HTML template tag with its content to create a gallery o... |
5,918,016 | I am making a website that sends with jQuery.ajax a lot of information which is inside many inputs.
In order to be able to send this ajax with any character in the inputs, I want to replace the values I send to something that can be sent via ajax. So for this I need to know which characters I can send and which charact... | 2011/05/06 | [
"https://Stackoverflow.com/questions/5918016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/458152/"
] | You don't need to care about which characters. Jquery encodes them for you. For example, if you do:
```
$.ajax({
url: "your_url",
data: {
name: $("#txtName").val(),
lastName: $("#txtName").val(),
}
});
```
`$.ajax` will urlencode your '`name`' and '`lastName`' params automagically, so you don't ... | There are no restrictions on which characters can be sent via HTTP requests. However, you do need to *encode* your input values. How you do this depends on how exactly you're making the requests. If you're doing an HTTP GET and are placing the values in the query string, you should use `encodeURIComponent`. This is req... |
120,334 | Many characters in *DC* have alliterative names, such as Billy Batson, Lex Luthor. and Wally West.
Is there a complete list of DC characters whose first and last names begin with the same letter?
---
Yes, this is a list question, but it has a limited scope: If you're finding an unreasonable amount of names then we c... | 2016/02/23 | [
"https://scifi.stackexchange.com/questions/120334",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/55866/"
] | Given DC's long history, there's no feasable way to compile a complete list of all the charatcers with alliterative names. Taken largely from this [List of human superheroes in DC Comics](https://en.wikipedia.org/wiki/List_of_human_superheroes_in_DC_Comics) and many helpful comments from Wad Cheber, I have put together... | Too many to count, let alone name in an answer. To highlight my point, I will restrict myself to just SOME entities with alliterative names that appear in Batman media (and **only** those not mentioned in the excellent previous answer at the time I wrote this answer).
* Arkham Asylum (place)
* Bag O'Bones
* Bat Bane
... |
120,334 | Many characters in *DC* have alliterative names, such as Billy Batson, Lex Luthor. and Wally West.
Is there a complete list of DC characters whose first and last names begin with the same letter?
---
Yes, this is a list question, but it has a limited scope: If you're finding an unreasonable amount of names then we c... | 2016/02/23 | [
"https://scifi.stackexchange.com/questions/120334",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/55866/"
] | Given DC's long history, there's no feasable way to compile a complete list of all the charatcers with alliterative names. Taken largely from this [List of human superheroes in DC Comics](https://en.wikipedia.org/wiki/List_of_human_superheroes_in_DC_Comics) and many helpful comments from Wad Cheber, I have put together... | Here's a new list of more than 1400 alliterative characters from Marvel and DC
<https://github.com/mroughan/AlephZeroHeroesData/blob/master/Comics/alli_data3_names.csv>
Description of the source of the list is here:
<https://aleph-zero-heroes.netlify.com/posts/alliteration/>
Turns out DC uses alliterative names more ... |
120,334 | Many characters in *DC* have alliterative names, such as Billy Batson, Lex Luthor. and Wally West.
Is there a complete list of DC characters whose first and last names begin with the same letter?
---
Yes, this is a list question, but it has a limited scope: If you're finding an unreasonable amount of names then we c... | 2016/02/23 | [
"https://scifi.stackexchange.com/questions/120334",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/55866/"
] | Too many to count, let alone name in an answer. To highlight my point, I will restrict myself to just SOME entities with alliterative names that appear in Batman media (and **only** those not mentioned in the excellent previous answer at the time I wrote this answer).
* Arkham Asylum (place)
* Bag O'Bones
* Bat Bane
... | Here's a new list of more than 1400 alliterative characters from Marvel and DC
<https://github.com/mroughan/AlephZeroHeroesData/blob/master/Comics/alli_data3_names.csv>
Description of the source of the list is here:
<https://aleph-zero-heroes.netlify.com/posts/alliteration/>
Turns out DC uses alliterative names more ... |
10,601 | In this sentence:
>
> Nehmen Sie den Wein aus Deutschland.
>
>
>
what would "aus" mean? "outside" or "from" ? And is this a question? I see the verb and pronoun are switched.
In other words, should I translate this as
>
> 1. "Do you take wine from Germany?"
> 2. "Do you take wine outside Germany?"
> 3. "You ta... | 2014/02/23 | [
"https://german.stackexchange.com/questions/10601",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/5514/"
] | It depends on the (in your example omitted) punctuation. If the waiter asks you
>
> Nehmen Sie den Wein aus Deutschland?
>
>
>
he means: "Do you take the wine from Germany?" If he says
>
> Nehmen Sie den Wein aus Deutschland!
>
>
>
he means: "Do take the wine from Germany! I suggest it!". In either case, th... | Many, many words don't have a single translation into another language. I think "ablegen" has over a dozen totally different translations from German to English. "Aus" is not far off :-)
"aus " means "originating from ". You take the meaning and translate it to the best possible English you can :-) "from Germany" seem... |
48,670,187 | I'm developing an iOS application and I want to know my actual country (like: US-ES-EN-etc) or in my application (without using location) or on the web side (php) through http request.
It's possible? | 2018/02/07 | [
"https://Stackoverflow.com/questions/48670187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986255/"
] | Here is another way of doing this using ROW\_NUMBER. It only hits the base table one time.
```
select myid
, myname
, possition
from
(
select myid
, myname
, possition
, RowNum = ROW_NUMBER() over (partition by possition order by LEN(myname) desc)
from testsql
) x
where x.RowNum... | I had thought to use a subquery with an alias.
And finally, it would be the best option; because, after that, I make a join to link the MAX(LEN(myname) of the subquery with the myname of the normal table.
This is the solution. I am sure that maybe it is not the best.
```
select myid, myname, testsql.possition, LEN(m... |
544,989 | I have a reproducible problem:
1. set up my PATH in Bash .profile
2. start tmux by `tmux`, `tmux attach` or any variant
3. echo $PATH and see it with the same components but in different order
How to stop this? What explains it? | 2013/02/01 | [
"https://superuser.com/questions/544989",
"https://superuser.com",
"https://superuser.com/users/95801/"
] | If you're on a Mac and have been wondering why `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin` keeps getting prepended to PATH when you run tmux, it's because of a utility called path\_helper that's run from your `/etc/profile` file.
You can't easily persuade tmux (or rather, bash) not to source `/etc/profile` (for som... | No; sorting `$PATH` would be a too crazy thing to do, since many systems depend on its user-set order.
However, tmux *does* start your shell in "login" mode, causing `~/.profile` to be sourced *again*. This means that if you have something like `PATH=/my/dir:/another/dir:$PATH` in that file, *it will be done again*, r... |
544,989 | I have a reproducible problem:
1. set up my PATH in Bash .profile
2. start tmux by `tmux`, `tmux attach` or any variant
3. echo $PATH and see it with the same components but in different order
How to stop this? What explains it? | 2013/02/01 | [
"https://superuser.com/questions/544989",
"https://superuser.com",
"https://superuser.com/users/95801/"
] | No; sorting `$PATH` would be a too crazy thing to do, since many systems depend on its user-set order.
However, tmux *does* start your shell in "login" mode, causing `~/.profile` to be sourced *again*. This means that if you have something like `PATH=/my/dir:/another/dir:$PATH` in that file, *it will be done again*, r... | @Graham Ashton Thanks for your idea
My suggestion would be that you put
```
if [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi
```
at your .zshrc file at the top of it.
MAKE SURE that your
```
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
```
is below. |
544,989 | I have a reproducible problem:
1. set up my PATH in Bash .profile
2. start tmux by `tmux`, `tmux attach` or any variant
3. echo $PATH and see it with the same components but in different order
How to stop this? What explains it? | 2013/02/01 | [
"https://superuser.com/questions/544989",
"https://superuser.com",
"https://superuser.com/users/95801/"
] | If you're on a Mac and have been wondering why `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin` keeps getting prepended to PATH when you run tmux, it's because of a utility called path\_helper that's run from your `/etc/profile` file.
You can't easily persuade tmux (or rather, bash) not to source `/etc/profile` (for som... | @Graham Ashton Thanks for your idea
My suggestion would be that you put
```
if [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi
```
at your .zshrc file at the top of it.
MAKE SURE that your
```
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
```
is below. |
9,830,548 | I have made a java script which uses the runtime.exec() to execute a batch file, and that works fine but when i get the output stream and use the write() function it does not execute the command i put into it.
```
Runtime runtime = Runtime.getRuntime();
Process p;
p = runtime.exec("cmd /c start batchfile.bat");
o... | 2012/03/22 | [
"https://Stackoverflow.com/questions/9830548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1286947/"
] | With the start command, a separate command window will be opened, and any output from the batch file will be displayed there. It should also work as just cmd /c build.bat, in which case you can read the output from the subprocess in Java if desired. | You're writing into an output stream. I think you mean to write to an input stream.
Try this:
```
Runtime runtime = Runtime.getRuntime();
Process p;
p = runtime.exec("cmd /c start batchfile.bat");
in = p.getInputStream();
in.write("command".getBytes());
``` |
15,191,103 | C++ allows non-type template parameters to be of integral or enumeration type (with integral including boolean and character), as well as pointers and references to arbitrary types.
I have seen integer, boolean, and enumeration parameters used widely and I appreciate their utility. I've even seen a clever use of chara... | 2013/03/03 | [
"https://Stackoverflow.com/questions/15191103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/141719/"
] | Using a pointer-to-member-function as a template parameter makes it possible for the compiler to inline a call to that function. An example of this usage can be seen in my answer to this question: [How to allow templated functor work on both member and non-member functions](https://stackoverflow.com/questions/17218712/... | if you know the address of a buffer at compile time, you can make a decision (at compile time) based on its alignment, especially for things such as memcpy, this allows you to skip any run-time checking, and just jump straight to copying the data using the most efficiently sized types.
(I'm guessing) You might also b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.