qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | This problem is pretty common and is usually related to some errors that are not seen in the CLI like custom classes that failed to load, are you sure you have error reporting on?
Edit the file `artisan` and add the following lines just after the PHP opening tag `<?php`:
```
ini_set('display_errors',1);
error_reporti... | Running `composer install` solved the problem. |
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | This problem is pretty common and is usually related to some errors that are not seen in the CLI like custom classes that failed to load, are you sure you have error reporting on?
Edit the file `artisan` and add the following lines just after the PHP opening tag `<?php`:
```
ini_set('display_errors',1);
error_reporti... | The solution for me was like @TheodoreR.Smith mentioned, there was an `exit` in a controller's `__construct()`. I removed it and `route:list` worked fine. |
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | This problem is pretty common and is usually related to some errors that are not seen in the CLI like custom classes that failed to load, are you sure you have error reporting on?
Edit the file `artisan` and add the following lines just after the PHP opening tag `<?php`:
```
ini_set('display_errors',1);
error_reporti... | Came here after a cronjob wouldn't execute because of artisan containing an error in the CLI, thanks to [this](https://stackoverflow.com/a/23647690/4668696) answer. So dropping my answer in case it could help someone.
The [solution](https://stackoverflow.com/questions/56658142/laravelsyntax-error-in-vendor-laravel-fra... |
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | This problem is pretty common and is usually related to some errors that are not seen in the CLI like custom classes that failed to load, are you sure you have error reporting on?
Edit the file `artisan` and add the following lines just after the PHP opening tag `<?php`:
```
ini_set('display_errors',1);
error_reporti... | Make sure you don't have any exit() or die() in your route file.
That was the issue in my case as I was in the middle of testing some code in the route file when I realized that I couldn't run any artisan command. |
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | Running `composer install` solved the problem. | The solution for me was like @TheodoreR.Smith mentioned, there was an `exit` in a controller's `__construct()`. I removed it and `route:list` worked fine. |
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | Running `composer install` solved the problem. | Came here after a cronjob wouldn't execute because of artisan containing an error in the CLI, thanks to [this](https://stackoverflow.com/a/23647690/4668696) answer. So dropping my answer in case it could help someone.
The [solution](https://stackoverflow.com/questions/56658142/laravelsyntax-error-in-vendor-laravel-fra... |
23,641,726 | Whenever I run any `php artisan` command like `php artisan list`, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
* changing permissions for `/root/.composer` to 777
* remove `bootstrap/compiled.php` file
There is nothing in `app/storage/logs/log-cli-... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23641726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2807030/"
] | Running `composer install` solved the problem. | Make sure you don't have any exit() or die() in your route file.
That was the issue in my case as I was in the middle of testing some code in the route file when I realized that I couldn't run any artisan command. |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | Moq does not support mocking delegates. But you can create some interface, with method, which matches your delegate signature:
```
public interface IBar
{
void M(int number);
}
```
Then create mock, which implements this interface, and use this mock object to create delegate:
```
Mock<IBar> bar = new Mock<IBar>... | Since Moq doesn't support mocking delegates, I'll usually handle this with something like:
```
var list = new List<int> ();
var del = i => list.Add (i);
var a = new A(del);
list.ShouldContainOnly (new[] { 5 });
```
where the delegate provided performs some simple, verifiable action. |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | What about using an anonymous function? It can act like an inline mock here, you don't need a mocking framework.
```
bool isDelegateCalled = false;
var a = new A(a => { isDelegateCalled = true});
//do something
Assert.True(isDelegateCalled);
``` | Moq does not support mocking delegates. But you can create some interface, with method, which matches your delegate signature:
```
public interface IBar
{
void M(int number);
}
```
Then create mock, which implements this interface, and use this mock object to create delegate:
```
Mock<IBar> bar = new Mock<IBar>... |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | As of [this commit](https://github.com/Moq/moq4/commit/e614ae5b4a14896503b59e2a70ac799bb66e741b) Moq now supports the mocking of delegates, for your situation you would do it like so:
```
var fooMock = new Mock<Foo>();
var a = new A(fooMock.Object);
```
Then you can verify the delegate was invoked:
```
fooMock.Veri... | Moq does not support mocking delegates. But you can create some interface, with method, which matches your delegate signature:
```
public interface IBar
{
void M(int number);
}
```
Then create mock, which implements this interface, and use this mock object to create delegate:
```
Mock<IBar> bar = new Mock<IBar>... |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | You can do something like that:
```
public interface IWithFOOMethod
{
void FooAlikeMethod(int number);
}
Mock<IWithFOOMethod> myMock = new Mock<IWithFOOMethod>();
A a = new A(myMock.Object.FooAlikeMethod);
myMock.Verify(call => call.Foo(It.IsAny<int>()), Times.Once())
``` | Since Moq doesn't support mocking delegates, I'll usually handle this with something like:
```
var list = new List<int> ();
var del = i => list.Add (i);
var a = new A(del);
list.ShouldContainOnly (new[] { 5 });
```
where the delegate provided performs some simple, verifiable action. |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | What about using an anonymous function? It can act like an inline mock here, you don't need a mocking framework.
```
bool isDelegateCalled = false;
var a = new A(a => { isDelegateCalled = true});
//do something
Assert.True(isDelegateCalled);
``` | You can do something like that:
```
public interface IWithFOOMethod
{
void FooAlikeMethod(int number);
}
Mock<IWithFOOMethod> myMock = new Mock<IWithFOOMethod>();
A a = new A(myMock.Object.FooAlikeMethod);
myMock.Verify(call => call.Foo(It.IsAny<int>()), Times.Once())
``` |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | As of [this commit](https://github.com/Moq/moq4/commit/e614ae5b4a14896503b59e2a70ac799bb66e741b) Moq now supports the mocking of delegates, for your situation you would do it like so:
```
var fooMock = new Mock<Foo>();
var a = new A(fooMock.Object);
```
Then you can verify the delegate was invoked:
```
fooMock.Veri... | You can do something like that:
```
public interface IWithFOOMethod
{
void FooAlikeMethod(int number);
}
Mock<IWithFOOMethod> myMock = new Mock<IWithFOOMethod>();
A a = new A(myMock.Object.FooAlikeMethod);
myMock.Verify(call => call.Foo(It.IsAny<int>()), Times.Once())
``` |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | What about using an anonymous function? It can act like an inline mock here, you don't need a mocking framework.
```
bool isDelegateCalled = false;
var a = new A(a => { isDelegateCalled = true});
//do something
Assert.True(isDelegateCalled);
``` | Since Moq doesn't support mocking delegates, I'll usually handle this with something like:
```
var list = new List<int> ();
var del = i => list.Add (i);
var a = new A(del);
list.ShouldContainOnly (new[] { 5 });
```
where the delegate provided performs some simple, verifiable action. |
10,998,455 | i got a class that gets by argument a delegate.
This class invokes that delegate, and i want to unit test it with Moq.
how do i verify that this method was called ?
example class :
```
public delegate void Foo(int number);
public class A
{
int a = 5;
public A(Foo myFoo)
{
myFoo(a);
}
}
```
and I... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10998455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/960012/"
] | As of [this commit](https://github.com/Moq/moq4/commit/e614ae5b4a14896503b59e2a70ac799bb66e741b) Moq now supports the mocking of delegates, for your situation you would do it like so:
```
var fooMock = new Mock<Foo>();
var a = new A(fooMock.Object);
```
Then you can verify the delegate was invoked:
```
fooMock.Veri... | Since Moq doesn't support mocking delegates, I'll usually handle this with something like:
```
var list = new List<int> ();
var del = i => list.Add (i);
var a = new A(del);
list.ShouldContainOnly (new[] { 5 });
```
where the delegate provided performs some simple, verifiable action. |
40,984,743 | I'm new to working with NetCDF files and I haven't been able to find the answer to my question elsewhere.
Daily precip data for year 2015 (from Gridmet): <https://www.northwestknowledge.net/metdata/data/pr_2015.nc>
My question: Maps are displaying with lat on the x axis and long on the y axis. How do I flip these axe... | 2016/12/05 | [
"https://Stackoverflow.com/questions/40984743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7254273/"
] | you can use the combination of `transpose` and `flip` from raster package:
```
s <- stack("pr_2015.nc", varname="precipitation_amount")
s2 <- t(flip(s, direction='y' ))
``` | You can use the `stars` package to read the data directly from the netcdf file without the "rotation" problem.
```
library(stars)
s2 <- read_ncdf("pr_2015.nc", var = "precipitation_amount")
```
Here's the plot of the first image in the time series, just to show how the images are read using `read_ncdf` (without the... |
62,639,507 | While sending email with attachments I occasionally forget to attach the relevant files.
How do I setup [mutt](http://mutt.org/) and [vim](https://www.vim.org/) to prompt me to attach missing files? | 2020/06/29 | [
"https://Stackoverflow.com/questions/62639507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100129/"
] | There's config option **abort\_noattach** for mutt and neomutt to ask You about missing attachment before sending the message if message body matches regular expression set by **abort\_noattach\_regexp**. In neomutt the option is called **abort\_noattach\_regex** without the trailing *p*. But the mutt config variant sh... | The [CheckAttach](https://github.com/chrisbra/CheckAttach) vim plugin by [Christian Brabandt](http://blog.256bit.org) will check for keywords in mail messages and ask you to attach the files. The plugin will not consider the quoted parts of mail messages.
The plugin will highlight the keyword(s) and prompt you for the... |
675,952 | I'm trying to create a simple connection using the jdbc-odbc bridge:
```
public static Connection getConnection() {
Connection con =null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +
"c:\\m... | 2009/03/24 | [
"https://Stackoverflow.com/questions/675952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1014/"
] | To answer your general question I would say the best way to handle database connections in Java is to avoid the JDBC-ODBC bridge. Its OK for testing or learning about JDBC but not for real production use. Also, if you have a data source that does not have its own JDBC driver but it has an ODBC driver then you may not h... | 1. Go to control panel -- > Administrative tool --> ODBC Data Source Administrator
2. Add database --> Select "Microsoft Driver(\*.mdb, \*.accdb)"
3. Dobule click on new database --> Under "Database" click on "select" --> Select your \*.accdb file which you hv created as MS access database.
4. Say OK and go to your jav... |
675,952 | I'm trying to create a simple connection using the jdbc-odbc bridge:
```
public static Connection getConnection() {
Connection con =null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +
"c:\\m... | 2009/03/24 | [
"https://Stackoverflow.com/questions/675952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1014/"
] | In general, the best way to work with an RDBMS in Java is by using a JDBC driver that is designed to connect directly to the database. Using the JDBC-ODBC bridge tends to be sloww.
If you are trying to do basic read/write manipulations with an Access database, I would also recommend taking a look at the [Jackcess](htt... | 1. Go to control panel -- > Administrative tool --> ODBC Data Source Administrator
2. Add database --> Select "Microsoft Driver(\*.mdb, \*.accdb)"
3. Dobule click on new database --> Under "Database" click on "select" --> Select your \*.accdb file which you hv created as MS access database.
4. Say OK and go to your jav... |
453,492 | Suppose you have $4$ cities $1, 2, 3$ and $4$. You want to find all ways to go from $1$ to $4$ such as $1=4$, $1=2-2=4$, $1=3-3=4$, $1=3-3=2-2=4$ and $1=2-2=3-3=4$. Distances between cities do not matter. What is the name of this TSP variant where I need to only find the possible routes (not requiring to connect all ve... | 2013/07/27 | [
"https://math.stackexchange.com/questions/453492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/5902/"
] | You are looking for the *set of paths between two vertices of a simple, unweighted graph*. This has little to do with the TSP and I don't think there is a name for it, any preciser than I stated it.
Some kind of *depth-first search* might solve this, you may want to look on [this question on Mathoverflow](https://mat... | *I want to draw more attention to this finding...*
>
> *You want to find all ways to go from 1 to 4 such as 1=4, 1=2−2=4, 1=3−3=4, 1=3−3=2−2=4 and 1=2−2=3−3=4.*
>
>
>
There is an exact solution for it, check up the integer sequence [A000522](http://oeis.org/A000522) for the total number of arrangements of a set w... |
20,197 | Specific heat is the amount of heat required to change the temperature of 1 gram of a substance by 1 Celsius.
For instance, the specific heat of water in the solid phase is 2.059 J/gC and 4.184 J/gC in the liquid phase.
That being said, what is the specific heat of copper in all three of its phases (liquid, solid and... | 2014/12/02 | [
"https://chemistry.stackexchange.com/questions/20197",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/10106/"
] | The NIST Webbook is generally a good place to look for thermochemistry data. You can see [here](http://webbook.nist.gov/cgi/cbook.cgi?Name=copper&Units=SI&cTG=on&cTC=on&cTP=on) that there are data for all three phases. It looks a bit daunting, but because heat capacity is not constant with temperature, it's expressed a... | The heat capacity of a material is a measure of the heat energy (in J) that the material (of mass M in g or moles) absorbs or releases for every unit rise or fall in temperature (in °C or K).

Whilst the heat capacity of most materials will generally... |
72,499,175 | I have the following output:
| Username | shortname | data |
| --- | --- | --- |
| test1 | firm | Google |
| test1 | type | IT |
| test1 | agreed | 1 |
| test2 | firm | Facebook |
| test2 | type | IT |
| test2 | agreed | 1 |
| test2 | newsletter | 1 |
I want to make another column that makes the following: if usernam... | 2022/06/04 | [
"https://Stackoverflow.com/questions/72499175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | After doing some reaseach,I finally solved it.
It was a schema error.
**Id** column value is like **149633CM**
I had given data type of **Id** as INTEGER,but when I tried to load json with bq and schema as --autodetect, bq marked datatype of **Id as STRING.**
after that,I changed datatype of **Id column as STRING** in... | because the data type is parsed on the whole field value and not only the first 6 characters. if you drop the last 2 characters, you can put INTEGER |
4,314,638 | This question might be easy but I am really stuck on it.
Let $M$ be compact metric space and $\mathcal B(M)$ the Borel $\sigma$-algebra of M. Consider the discrete-time Markov process,
$$\mathbf{X} =\left(\Omega,\{\mathcal F\_n\}\_{n\in\mathbb N}, \{X\_n\}\_{n\in\mathbb N}, \{P\_n\}\_{n\in\mathbb N} , \{\mathbb P\_x\}... | 2021/11/23 | [
"https://math.stackexchange.com/questions/4314638",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/322499/"
] | Here we establish a general ergodic *pathwise* ergodic theorem and also consider the ergodic case in which the OP seems to be interested.
---
***Concepts and definitions:***
Suppose $(M,\mathscr{B},\mu)$ is a probability space ($M$ is a Polish space with a Borel $\sigma$-algebra for example). Let $\Omega=M^{\mathbb{... | I believe I found an answer. Note that in a similar way that we constructed $P\_\mu,$ we may define $P\_x$ as the unique Borel probability on $M^{\mathbb N}$, such that given $A\_0,\ldots,A\_n \in M,$ then
$$P\_{x}\left(\{x\_n\}\_{n\in\mathbb N} \in M^{\mathbb N}; x\_i\in A\_i, \ \forall \ i\in\{0,1,\ldots,n\}\right) =... |
38,410,620 | I need to analyse web page contents. Page has javascrips.
Can you advice on better way than using Selenium?
If not:
page when loaded in browser has elements:
```
<div class="js-container"> <table class="zebra" style="width: 100%;">
<tbody><tr>
<th>A</th>
<th>B</th>
<th>... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38410620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5499118/"
] | You will be able to achieve it using [reauthenticate](https://firebase.google.com/docs/auth/ios/manage-users) before changing the password.
```
let user = FIRAuth.auth()?.currentUser
let credential = FIREmailPasswordAuthProvider.credentialWithEmail(email, password: currentPassword)
user?.reauthenticateWithCredent... | **For Swift 4:**
```
typealias Completion = (Error?) -> Void
func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping Completion) {
let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
Auth.auth().currentUser?.reauthenticate(... |
38,410,620 | I need to analyse web page contents. Page has javascrips.
Can you advice on better way than using Selenium?
If not:
page when loaded in browser has elements:
```
<div class="js-container"> <table class="zebra" style="width: 100%;">
<tbody><tr>
<th>A</th>
<th>B</th>
<th>... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38410620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5499118/"
] | You will be able to achieve it using [reauthenticate](https://firebase.google.com/docs/auth/ios/manage-users) before changing the password.
```
let user = FIRAuth.auth()?.currentUser
let credential = FIREmailPasswordAuthProvider.credentialWithEmail(email, password: currentPassword)
user?.reauthenticateWithCredent... | **For Swift 5 to change password in firebase**
```
import Firebase
func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping (Error?) -> Void) {
let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
Auth.auth().currentUs... |
38,410,620 | I need to analyse web page contents. Page has javascrips.
Can you advice on better way than using Selenium?
If not:
page when loaded in browser has elements:
```
<div class="js-container"> <table class="zebra" style="width: 100%;">
<tbody><tr>
<th>A</th>
<th>B</th>
<th>... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38410620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5499118/"
] | **For Swift 4:**
```
typealias Completion = (Error?) -> Void
func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping Completion) {
let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
Auth.auth().currentUser?.reauthenticate(... | **For Swift 5 to change password in firebase**
```
import Firebase
func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping (Error?) -> Void) {
let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
Auth.auth().currentUs... |
10,224,624 | I have quite a few js functions
```
mysitename.Nav();
mysitename.Tabs();
mysitename.Overlay();
mysitename.AnimateIntro();
```
Now some of these are triggered on certain pages. How do I include certain functions on specific pages? Of course I could just have different script in the header but wondered if someone had ... | 2012/04/19 | [
"https://Stackoverflow.com/questions/10224624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1002758/"
] | The simplest way is include all your functions, check [window.location](https://developer.mozilla.org/en/DOM/window.location) and based on that, call the relevant function.
The more complicated alternative is to check `window.location`, add the `<script type="text/javascript" src="my_js.js"></script>` tag to your DOM,... | Separate JS do different files and include only those you need. |
1,264,660 | VS Code someone point me to an existing opened file, other times it create a new instance (of VS Code as well as the file). | 2017/11/01 | [
"https://superuser.com/questions/1264660",
"https://superuser.com",
"https://superuser.com/users/16823/"
] | By default, VS Code will open a new Editor with the desired file. If you'd like to instead reveal the already open Editor, set workbench.editor.revealIfOpen to true in your User Settings (CMD+k on OSX).
To be concrete, that means adding the following line:
```json
"workbench.editor.revealIfOpen": true,
```
**See Al... | This worked for me:
```
"window.openFilesInNewWindow": "off",
"window.openFoldersInNewWindow": "off",
"security.workspace.trust.untrustedFiles": "prompt"
``` |
5,259 | I asked a question, which I believed was with a very simple answer and then it got on hold as too broad.
None of the "too-broad" voters actually gave a reason why it would be too broad. And only one of the answers given fits all the clues (the accepted one). I even added two more hints after the first close vote - to ... | 2016/08/20 | [
"https://puzzling.meta.stackexchange.com/questions/5259",
"https://puzzling.meta.stackexchange.com",
"https://puzzling.meta.stackexchange.com/users/29050/"
] | That is the whole problem with riddles. You might have thought of a certain answer but you will find lots of different answers, many of which will make sense because riddles usually are "think out of the box".
And looking at your question, if you see the answers, from a neutral perspective, many of the answers make s... | >
> I asked a question, which I believed was with a very simple answer and then it got on hold as too broad.
>
>
>
The problem is that unless specific clues are given, many different things under the Sun can fit as an answer to a riddle, thus making it a bad one.
>
> And only one of the ... I even added two mo... |
5,259 | I asked a question, which I believed was with a very simple answer and then it got on hold as too broad.
None of the "too-broad" voters actually gave a reason why it would be too broad. And only one of the answers given fits all the clues (the accepted one). I even added two more hints after the first close vote - to ... | 2016/08/20 | [
"https://puzzling.meta.stackexchange.com/questions/5259",
"https://puzzling.meta.stackexchange.com",
"https://puzzling.meta.stackexchange.com/users/29050/"
] | Your riddle, if I understand correctly, works on a simple principle, namely **two different meanings of the same word.** While this is a nice principle, the implementation is, IMHO, a bit weak: there are too few constraints on the desired answer, which broadens the list of possible answers. For example, I can think of ... | >
> I asked a question, which I believed was with a very simple answer and then it got on hold as too broad.
>
>
>
The problem is that unless specific clues are given, many different things under the Sun can fit as an answer to a riddle, thus making it a bad one.
>
> And only one of the ... I even added two mo... |
23,604,599 | It seems I'm getting an "impossible WHERE" on a SELECT query. I've posted two queries below, which differentiate in the subquery. What these queries do is check to see if a user has saved something once before, before updating a count. I am using SELECT for testing purposes, but the actual query would be using UPDATE:
... | 2014/05/12 | [
"https://Stackoverflow.com/questions/23604599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2607047/"
] | ug...better off not use subquery at all.
```
UPDATE articles a,posts p SET article_count = article_count+1
WHERE a.id=p.post_id and a.id = 2343243 AND p.user_id=3;
``` | "Impossible where" means that your table does not include rows with the actual values you use in your EXPLAIN. In other words, in your data that is in the table right now, there is no row with `p.post_id = 2343243` (or perhaps it applies to the `articles.id`).
So when using EXPLAIN, pick a different value that actuall... |
60,125,935 | I am trying to slice a substring from a column and get it in another column. I have read multiple links but this problem exists because my dataframe that I will be working on is Transpose. (This is a minimum reproducible example, the original dataframe is huge and I have to work with the transposed data only).
**df**(... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60125935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11760970/"
] | You added a tag with `jQuery` so we can use it and do:
```
jQuery('.has-mega-menu').hover(() => jQuery('#theme-page').addClass('blur'), () => jQuery('#theme-page').removeClass('blur'))
```
and add some css for our `blur` class:
```
.blur {
filter: blur(8px);
-webkit-filter: blur(8px);
}
``` | You could use the `MutationObserver` to detect the class change.
You can read more about `MutationObserver` [here](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)
```js
function addclass() {
document.getElementById("dropdown").classList.toggle("dropdownOpen");
}
(function() {
var e = docum... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | .NET 3.5 version of Eric's answer with an extra check whether the host exists:
```
private bool IsLocalHost(string input)
{
IPAddress[] host;
//get host addresses
try { host = Dns.GetHostAddresses(input); }
catch (Exception) { return false; }
//get local adresses
... | Here is how I addressed a similar need.
```
internal static bool IsFileRemote(string path)
{
if (String.IsNullOrEmpty(path))
{
return false;
}
if (new Uri(path).IsUnc)
{
return true;
}
if (ne... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | Here is how I addressed a similar need.
```
internal static bool IsFileRemote(string path)
{
if (String.IsNullOrEmpty(path))
{
return false;
}
if (new Uri(path).IsUnc)
{
return true;
}
if (ne... | Maybe
```
var isLocal = Dns.GetHostName() == _host || Dns.GetHostEntry(Dns.GetHostName()).AddressList.Any(i => i.ToString().Equals(_host));
``` |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | .NET 3.5 version of Eric's answer with an extra check whether the host exists:
```
private bool IsLocalHost(string input)
{
IPAddress[] host;
//get host addresses
try { host = Dns.GetHostAddresses(input); }
catch (Exception) { return false; }
//get local adresses
... | The following should work for mapped drives and for UNC paths.
```
private static bool IsLocalPath(String path)
{
if (!PathIsUNC(path))
{
return !PathIsNetworkPath(path);
}
Uri uri = new Uri(path);
return IsLocalHost(uri.Host); // Refer to David's answer
}
[DllImport("Shlwapi.dll")]
[retu... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | This is how I did it.
```
public static bool IsLocal(DirectoryInfo dir)
{
foreach (DriveInfo d in DriveInfo.GetDrives())
{
if (string.Compare(dir.Root.FullName, d.Name, StringComparison.OrdinalIgnoreCase) == 0) //[drweb86] Fix for different case.
{
return... | Maybe
```
var isLocal = Dns.GetHostName() == _host || Dns.GetHostEntry(Dns.GetHostName()).AddressList.Any(i => i.ToString().Equals(_host));
``` |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | Don't know if there's a more efficient way of doing this, but it seems to work for me:
```
IPAddress[] host;
IPAddress[] local;
bool isLocal = false;
host = Dns.GetHostAddresses(uri.Host);
local = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress hostAddress in host)
{
i... | I don't know of a single method to check that. However, you can compare the Uri's `Host` property to either the local host name or IP address.
You can get the local machine name using:
```
string hostName = System.Net.Dns.GetHostName()
```
You can then get an array of IP addresses by passing that string to:
```
Sy... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | .NET 3.5 version of Eric's answer with an extra check whether the host exists:
```
private bool IsLocalHost(string input)
{
IPAddress[] host;
//get host addresses
try { host = Dns.GetHostAddresses(input); }
catch (Exception) { return false; }
//get local adresses
... | I don't know of a single method to check that. However, you can compare the Uri's `Host` property to either the local host name or IP address.
You can get the local machine name using:
```
string hostName = System.Net.Dns.GetHostName()
```
You can then get an array of IP addresses by passing that string to:
```
Sy... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | This is how I did it.
```
public static bool IsLocal(DirectoryInfo dir)
{
foreach (DriveInfo d in DriveInfo.GetDrives())
{
if (string.Compare(dir.Root.FullName, d.Name, StringComparison.OrdinalIgnoreCase) == 0) //[drweb86] Fix for different case.
{
return... | The following should work for mapped drives and for UNC paths.
```
private static bool IsLocalPath(String path)
{
if (!PathIsUNC(path))
{
return !PathIsNetworkPath(path);
}
Uri uri = new Uri(path);
return IsLocalHost(uri.Host); // Refer to David's answer
}
[DllImport("Shlwapi.dll")]
[retu... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | Don't know if there's a more efficient way of doing this, but it seems to work for me:
```
IPAddress[] host;
IPAddress[] local;
bool isLocal = false;
host = Dns.GetHostAddresses(uri.Host);
local = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress hostAddress in host)
{
i... | Here is how I addressed a similar need.
```
internal static bool IsFileRemote(string path)
{
if (String.IsNullOrEmpty(path))
{
return false;
}
if (new Uri(path).IsUnc)
{
return true;
}
if (ne... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | This is how I did it.
```
public static bool IsLocal(DirectoryInfo dir)
{
foreach (DriveInfo d in DriveInfo.GetDrives())
{
if (string.Compare(dir.Root.FullName, d.Name, StringComparison.OrdinalIgnoreCase) == 0) //[drweb86] Fix for different case.
{
return... | I don't know of a single method to check that. However, you can compare the Uri's `Host` property to either the local host name or IP address.
You can get the local machine name using:
```
string hostName = System.Net.Dns.GetHostName()
```
You can then get an array of IP addresses by passing that string to:
```
Sy... |
354,477 | What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
```
new Uri(path).IsUnc
```
That works great for paths that start with C:\ or other drive letter, but what abou... | 2008/12/09 | [
"https://Stackoverflow.com/questions/354477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039/"
] | This is how I did it.
```
public static bool IsLocal(DirectoryInfo dir)
{
foreach (DriveInfo d in DriveInfo.GetDrives())
{
if (string.Compare(dir.Root.FullName, d.Name, StringComparison.OrdinalIgnoreCase) == 0) //[drweb86] Fix for different case.
{
return... | Here is how I addressed a similar need.
```
internal static bool IsFileRemote(string path)
{
if (String.IsNullOrEmpty(path))
{
return false;
}
if (new Uri(path).IsUnc)
{
return true;
}
if (ne... |
21,548,998 | I'm new to C++ but have had experience before with languages like java and I am starting off by making a simple command line Xs and Os game. When it came to creating the grid I found that I could initiate it in two different ways:
```
int grid[3][3] = {{0, 0, 0 },
{0, 0, 0 },
{0, 0,... | 2014/02/04 | [
"https://Stackoverflow.com/questions/21548998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3270037/"
] | In c++ you can write
```
int grid[3][3] = {};
```
This is enough see eg [how does array[100] = {0} set the entire array to 0?](https://stackoverflow.com/questions/629017/how-does-array100-0-set-the-entire-array-to-0) and <http://www.cplusplus.com/doc/tutorial/arrays/> | I like to use [memset](http://www.cplusplus.com/reference/cstring/memset/). It makes the code much nicer. Both the ways you suggested are valid but are more of a `C` dialect. A more object oriented approach could be using a `matrix` class with a constructor. Of course, in a real world you would probably use something l... |
38,165,756 | I'm Building Information Retrieval System that search text in multi files formats,
I have Tried **EPocalipse IFilter** Lirary but it through an exception when trying to read **docx** files, and I tried **Toxy** Library it though an exception for **doc** arabic files, finally I tried **TikaOnDotNet** Libray but it need ... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38165756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3276879/"
] | for version 4 of pubnub the instantiation has changed,
```
from pubnub import pubnub
pnconf = pubnub.PNConfiguration()
pnconf.subscribe_key = 'demo'
pnconf.publish_key = 'demo'
pubnub = pubnub.PubNub(pnconf)
```
for more information read their documentation [v4 upgrading for pubnub](https://www.pubnub.com/docs/pyth... | You have a file in your project called `pubnub.py`, which the importer is finding before your installation of the pubnub module, I think. Rename your file to something else, and everything should work. |
38,165,756 | I'm Building Information Retrieval System that search text in multi files formats,
I have Tried **EPocalipse IFilter** Lirary but it through an exception when trying to read **docx** files, and I tried **Toxy** Library it though an exception for **doc** arabic files, finally I tried **TikaOnDotNet** Libray but it need ... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38165756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3276879/"
] | You have a file in your project called `pubnub.py`, which the importer is finding before your installation of the pubnub module, I think. Rename your file to something else, and everything should work. | I experienced the same problem on my Raspberry Pi 3. It ended up being a very silly issue! I had a file called pubnub.py which is why when I ran my script when it was located in the folder "Desktop" it didn't work. However, after I brought it up to its parent directory "pi" it imported pubnub without an issue! |
38,165,756 | I'm Building Information Retrieval System that search text in multi files formats,
I have Tried **EPocalipse IFilter** Lirary but it through an exception when trying to read **docx** files, and I tried **Toxy** Library it though an exception for **doc** arabic files, finally I tried **TikaOnDotNet** Libray but it need ... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38165756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3276879/"
] | for version 4 of pubnub the instantiation has changed,
```
from pubnub import pubnub
pnconf = pubnub.PNConfiguration()
pnconf.subscribe_key = 'demo'
pnconf.publish_key = 'demo'
pubnub = pubnub.PubNub(pnconf)
```
for more information read their documentation [v4 upgrading for pubnub](https://www.pubnub.com/docs/pyth... | I renamed file, removed python3(it was installed still :D), and removed every \*.pyc files and it is working for now. Thanks |
38,165,756 | I'm Building Information Retrieval System that search text in multi files formats,
I have Tried **EPocalipse IFilter** Lirary but it through an exception when trying to read **docx** files, and I tried **Toxy** Library it though an exception for **doc** arabic files, finally I tried **TikaOnDotNet** Libray but it need ... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38165756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3276879/"
] | I renamed file, removed python3(it was installed still :D), and removed every \*.pyc files and it is working for now. Thanks | I experienced the same problem on my Raspberry Pi 3. It ended up being a very silly issue! I had a file called pubnub.py which is why when I ran my script when it was located in the folder "Desktop" it didn't work. However, after I brought it up to its parent directory "pi" it imported pubnub without an issue! |
38,165,756 | I'm Building Information Retrieval System that search text in multi files formats,
I have Tried **EPocalipse IFilter** Lirary but it through an exception when trying to read **docx** files, and I tried **Toxy** Library it though an exception for **doc** arabic files, finally I tried **TikaOnDotNet** Libray but it need ... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38165756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3276879/"
] | for version 4 of pubnub the instantiation has changed,
```
from pubnub import pubnub
pnconf = pubnub.PNConfiguration()
pnconf.subscribe_key = 'demo'
pnconf.publish_key = 'demo'
pubnub = pubnub.PubNub(pnconf)
```
for more information read their documentation [v4 upgrading for pubnub](https://www.pubnub.com/docs/pyth... | I experienced the same problem on my Raspberry Pi 3. It ended up being a very silly issue! I had a file called pubnub.py which is why when I ran my script when it was located in the folder "Desktop" it didn't work. However, after I brought it up to its parent directory "pi" it imported pubnub without an issue! |
538,879 | I need to monitor network traffic and EtherApe seems to be nice graphical utility. But the Wikipedia [entry](https://en.wikipedia.org/wiki/EtherApe) says sth like this :
`Security:
EtherApe requires root privileges to run. As such, there can be risks to the machine(s) running EtherApe when connected to the internet.`... | 2013/09/14 | [
"https://serverfault.com/questions/538879",
"https://serverfault.com",
"https://serverfault.com/users/141117/"
] | The security risk is that if someone hacks you and manages to shell it, they will have a root shell. Unfortunately, this is the case with quite a lot of things.
There isn't really a way to definitively protect against this, but a reverse proxy might be a good start, as well as keeping up with patches. Additionally, us... | It doesn't need to run as root, it just needs to be able to perform some network-related tasks that exceed the usual user permissions. Just use the linux capabilites to only confer these permissions without giving superuser rights:
```
sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/etherape
```
Of course i... |
15,096,241 | I'm trying to use pjax on my site, which means that for a full page request I render the whole template (this is normal behaviour), but on pjax requests I would like to render just one section. My templates all extend a master template.
How can I most elegantly do that? | 2013/02/26 | [
"https://Stackoverflow.com/questions/15096241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291557/"
] | My best answer right now would be to state in your view that it must only extend the master template (layout) if the request is not being called via AJAX:
```
@if(!Request::ajax())
@extends('master.template')
@endif
```
Note, however, that this solution may not be best for your specific templates (I can only gue... | Inside your controller's action, explicitly return the partial view you wanted to render:
```
public function action_someajax()
{
...
return View::make('mypartial', $data);
}
```
This would render the partial instead of the controller's layout. |
15,096,241 | I'm trying to use pjax on my site, which means that for a full page request I render the whole template (this is normal behaviour), but on pjax requests I would like to render just one section. My templates all extend a master template.
How can I most elegantly do that? | 2013/02/26 | [
"https://Stackoverflow.com/questions/15096241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291557/"
] | Why wouldn't you just replace the actual content in the rendered page using a div or html element?
I do this all the time with jQuery. I simply build my initial page and send content to my views that render sections in my master layout.
Let's say I had a left navigation column and then an article in the right column.... | My best answer right now would be to state in your view that it must only extend the master template (layout) if the request is not being called via AJAX:
```
@if(!Request::ajax())
@extends('master.template')
@endif
```
Note, however, that this solution may not be best for your specific templates (I can only gue... |
15,096,241 | I'm trying to use pjax on my site, which means that for a full page request I render the whole template (this is normal behaviour), but on pjax requests I would like to render just one section. My templates all extend a master template.
How can I most elegantly do that? | 2013/02/26 | [
"https://Stackoverflow.com/questions/15096241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291557/"
] | This is kind of an old question but I would like to throw down another solution.
Lets say you have a view layout called ***main.blade.php*** and another view that extends main called ***page.blade.php***
***main.blade.php***
```
<!DOCTYPE html>
<html lang="en-GB">
<head>
<title>My Title</title>
@section('he... | My best answer right now would be to state in your view that it must only extend the master template (layout) if the request is not being called via AJAX:
```
@if(!Request::ajax())
@extends('master.template')
@endif
```
Note, however, that this solution may not be best for your specific templates (I can only gue... |
15,096,241 | I'm trying to use pjax on my site, which means that for a full page request I render the whole template (this is normal behaviour), but on pjax requests I would like to render just one section. My templates all extend a master template.
How can I most elegantly do that? | 2013/02/26 | [
"https://Stackoverflow.com/questions/15096241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291557/"
] | Why wouldn't you just replace the actual content in the rendered page using a div or html element?
I do this all the time with jQuery. I simply build my initial page and send content to my views that render sections in my master layout.
Let's say I had a left navigation column and then an article in the right column.... | Inside your controller's action, explicitly return the partial view you wanted to render:
```
public function action_someajax()
{
...
return View::make('mypartial', $data);
}
```
This would render the partial instead of the controller's layout. |
15,096,241 | I'm trying to use pjax on my site, which means that for a full page request I render the whole template (this is normal behaviour), but on pjax requests I would like to render just one section. My templates all extend a master template.
How can I most elegantly do that? | 2013/02/26 | [
"https://Stackoverflow.com/questions/15096241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291557/"
] | This is kind of an old question but I would like to throw down another solution.
Lets say you have a view layout called ***main.blade.php*** and another view that extends main called ***page.blade.php***
***main.blade.php***
```
<!DOCTYPE html>
<html lang="en-GB">
<head>
<title>My Title</title>
@section('he... | Inside your controller's action, explicitly return the partial view you wanted to render:
```
public function action_someajax()
{
...
return View::make('mypartial', $data);
}
```
This would render the partial instead of the controller's layout. |
15,096,241 | I'm trying to use pjax on my site, which means that for a full page request I render the whole template (this is normal behaviour), but on pjax requests I would like to render just one section. My templates all extend a master template.
How can I most elegantly do that? | 2013/02/26 | [
"https://Stackoverflow.com/questions/15096241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/291557/"
] | This is kind of an old question but I would like to throw down another solution.
Lets say you have a view layout called ***main.blade.php*** and another view that extends main called ***page.blade.php***
***main.blade.php***
```
<!DOCTYPE html>
<html lang="en-GB">
<head>
<title>My Title</title>
@section('he... | Why wouldn't you just replace the actual content in the rendered page using a div or html element?
I do this all the time with jQuery. I simply build my initial page and send content to my views that render sections in my master layout.
Let's say I had a left navigation column and then an article in the right column.... |
35,302,262 | when im trying to run an emulator on android studio an error pops up - warning dns servers not found. how can I solve this problem? its on android studio | 2016/02/09 | [
"https://Stackoverflow.com/questions/35302262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5790316/"
] | Please make sure that you are **connected to internet**. That should be the problem.
**explanation** : At startup, the emulator reads the list of DNS servers that your system is currently using. It then stores the IP addresses of up to four servers on this list and sets up aliases to them on the emulated addresses `10... | I also faced this same problem few days ago and I am using Wi-fi connection. This is a simple problem.Just set up your wi-fi or LAN connection of primary DNS server 8.8.8.8 and restart your wifi connection. This will solve your problem. This is not an Android emulator problem, this is wi-fi or LAN connection problem. J... |
1,108,007 | Sorry to ask about a (probably) faily easy task, but I am new to integrals and can't solve this one:
I am trying to calculate $\displaystyle \int \frac{dx}{2-x^2}$.
The solution is $\displaystyle \frac{\log(x+\sqrt{2})-\log(\sqrt{2}-x)}{2\sqrt{2}}$, but I don't know how to get there.
It must have something to do w... | 2015/01/17 | [
"https://math.stackexchange.com/questions/1108007",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/186763/"
] | You can do partial fraction decomposition: $$\frac{ 1}{(2 - x^2)} =\frac A{\sqrt 2 - x} + \frac B{\sqrt 2 + x}$$
where $A(\sqrt 2+x) + B(\sqrt 2 - x) = 0\cdot x + 1$.
Then solve for $A, B$. | HINT : Use partial Fraction and use resut you stated |
1,108,007 | Sorry to ask about a (probably) faily easy task, but I am new to integrals and can't solve this one:
I am trying to calculate $\displaystyle \int \frac{dx}{2-x^2}$.
The solution is $\displaystyle \frac{\log(x+\sqrt{2})-\log(\sqrt{2}-x)}{2\sqrt{2}}$, but I don't know how to get there.
It must have something to do w... | 2015/01/17 | [
"https://math.stackexchange.com/questions/1108007",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/186763/"
] | You can do partial fraction decomposition: $$\frac{ 1}{(2 - x^2)} =\frac A{\sqrt 2 - x} + \frac B{\sqrt 2 + x}$$
where $A(\sqrt 2+x) + B(\sqrt 2 - x) = 0\cdot x + 1$.
Then solve for $A, B$. | **Hint:** $\dfrac{1}{2-x^2} = \dfrac{1}{(\sqrt{2})^2 - x^2}= \dfrac{1}{2\sqrt{2}}\cdot \left(\dfrac{1}{\sqrt{2}-x}+\dfrac{1}{\sqrt{2}+x}\right)$ |
1,108,007 | Sorry to ask about a (probably) faily easy task, but I am new to integrals and can't solve this one:
I am trying to calculate $\displaystyle \int \frac{dx}{2-x^2}$.
The solution is $\displaystyle \frac{\log(x+\sqrt{2})-\log(\sqrt{2}-x)}{2\sqrt{2}}$, but I don't know how to get there.
It must have something to do w... | 2015/01/17 | [
"https://math.stackexchange.com/questions/1108007",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/186763/"
] | You can do partial fraction decomposition: $$\frac{ 1}{(2 - x^2)} =\frac A{\sqrt 2 - x} + \frac B{\sqrt 2 + x}$$
where $A(\sqrt 2+x) + B(\sqrt 2 - x) = 0\cdot x + 1$.
Then solve for $A, B$. | $$\int \frac{1}{2-x^2}dx = \int \frac{1}{2} . \frac{1}{1-\frac{x^2}{2}}dx = \frac{1}{2}\int\frac{1}{1-\frac{x^2}{2}}dx$$
Now substitue $u=\frac{x}{\sqrt{2}}$ and $du=\frac{1}{\sqrt{2}}dx$.
Remember that
$$\int \frac{1}{a^2-x^2}dx=\frac{1}{2a} \ln \frac{|a+x|}{|a-x|}+C$$ for $x\neq a$ |
1,108,007 | Sorry to ask about a (probably) faily easy task, but I am new to integrals and can't solve this one:
I am trying to calculate $\displaystyle \int \frac{dx}{2-x^2}$.
The solution is $\displaystyle \frac{\log(x+\sqrt{2})-\log(\sqrt{2}-x)}{2\sqrt{2}}$, but I don't know how to get there.
It must have something to do w... | 2015/01/17 | [
"https://math.stackexchange.com/questions/1108007",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/186763/"
] | HINT : Use partial Fraction and use resut you stated | **Hint:** $\dfrac{1}{2-x^2} = \dfrac{1}{(\sqrt{2})^2 - x^2}= \dfrac{1}{2\sqrt{2}}\cdot \left(\dfrac{1}{\sqrt{2}-x}+\dfrac{1}{\sqrt{2}+x}\right)$ |
1,108,007 | Sorry to ask about a (probably) faily easy task, but I am new to integrals and can't solve this one:
I am trying to calculate $\displaystyle \int \frac{dx}{2-x^2}$.
The solution is $\displaystyle \frac{\log(x+\sqrt{2})-\log(\sqrt{2}-x)}{2\sqrt{2}}$, but I don't know how to get there.
It must have something to do w... | 2015/01/17 | [
"https://math.stackexchange.com/questions/1108007",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/186763/"
] | $$\int \frac{1}{2-x^2}dx = \int \frac{1}{2} . \frac{1}{1-\frac{x^2}{2}}dx = \frac{1}{2}\int\frac{1}{1-\frac{x^2}{2}}dx$$
Now substitue $u=\frac{x}{\sqrt{2}}$ and $du=\frac{1}{\sqrt{2}}dx$.
Remember that
$$\int \frac{1}{a^2-x^2}dx=\frac{1}{2a} \ln \frac{|a+x|}{|a-x|}+C$$ for $x\neq a$ | **Hint:** $\dfrac{1}{2-x^2} = \dfrac{1}{(\sqrt{2})^2 - x^2}= \dfrac{1}{2\sqrt{2}}\cdot \left(\dfrac{1}{\sqrt{2}-x}+\dfrac{1}{\sqrt{2}+x}\right)$ |
15,245,816 | I have a screen with 2 tabs in at the bottom of the screen.
Once I run the app, automatically first tab will be active and the activity related to that screen will be shown (Screen 1). Then when the user clicks on the second tab it opens another activity (Screen 2).
Requirement: I want to show the screen 0 when the ap... | 2013/03/06 | [
"https://Stackoverflow.com/questions/15245816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2021583/"
] | To fix a problem use such code:
```
_road = new int[16] ();
_cars = new int[16] ();
```
It initialises all members of arrays to default value. | ISO C++ does not allow to specify a constructor parameter. The tutorial you linked might refer to a language extension not available in clang. |
50,606,139 | Hi I want to use a simple [AdaBoostClassifier](http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostClassifier.html) on the mushroom dataset which lools smth. like:
```
target cap-shape cap-surface cap-color bruises odor \
3059 0 2 3 2 1 5
195... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50606139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8144295/"
] | In reference to my comment in 2Obe's answer above, I found the correct way to specify the parameter -
```
AdaBoostClassifier(base_estimator=DecisionTreeClassifier(),n_estimators=400,learning_rate=0.01,algorithm='SAMME')
```
It should be a constructor rather than a string | I have found the issue. As base\_estimator I have set 'DecisionTreeClassifier'. THIS is a sting and has no fit() method. The AdaBoost IS NOT a string.
```
from sklearn.ensemble import AdaBoostClassifier
from sklearn.preprocessing import LabelEncoder
for label in dataset.columns:
dataset[label] = LabelEncoder().f... |
15,071,167 | I'm using xslt to convert some xml files. My input data looks like this:
```
<data>
<dataItem>
<value>24014</value>
<date>Feb 11, 2013</date>
</dataItem>
<dataItem>
<value>0</value>
<date>Feb 12, 2013</date>
</dataItem>
<dataItem>
<value>0</value>
<date>Feb 13, 2013</date>
</dataIte... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15071167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016599/"
] | If the `dataItem` elements are already sorted by `date`, you should be able to just grab the last `dataItme` that doesn't have a value of `0`. (Look at the `xsl:apply-temlates` in the `/*` template for the XPath to do this.)
**XML Input**
```
<data>
<dataItem>
<value>24014</value>
<date>Feb 11, 20... | The line `<xsl:value-of select="label"/>` looks suspicious because there aren't any `label` elements in your input XML.
But there's no need for a recursive template. Try the following:
```
<xsl:template match="/">
<root>
<xsl:apply-templates select="data/dataItem[value!=0][last()]"/>
</root>
</xsl:tem... |
22,251,195 | I want to compare 2 lists in different files using python. For this, I am using the following:
```
truepositives = "a.txt"
with open(truepositives) as file1list:
file1l = file1list.read().splitlines()
basepairout = "b.txt"
with open(basepairout) as templist:
templ = templist.read().splitlines()
set1=file1l
... | 2014/03/07 | [
"https://Stackoverflow.com/questions/22251195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3223818/"
] | keep a boolean "exist" before your loops and set it to false... your problem is that you go in the else statement with each iteration in set1 that doesn't respect your conditions
It should look like this:
```
for line2 in set2:
exist = False
for line1 in set1:
if (line2.find(line1) == 1):
... | What about using set difference?
<http://docs.python.org/2/library/stdtypes.html#set> |
13,987,397 | I use all over my code std::string objects, most of them stack allocated. I replaced default new/delete operators to check the average memory allocation size and I was surprised to see that most allocations come from std::string and, this is very important, they are between 12 and 32 bytes! To optimize this(large numbe... | 2012/12/21 | [
"https://Stackoverflow.com/questions/13987397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336578/"
] | Is it reasonable? It depends. Unless you have found yourself actually running out of memory by using `std::string` or identified a *real* (as opposed to perceived) performance problem with continued allocation and deallocation, you're wasting your time doing this.
Don't get me wrong, you can (and I have) made great ga... | I think it's been done before, along the lines you mentioned, in [folly](https://github.com/facebook/folly): "fbstring is a drop-in replacement for std::string. The main benefit of fbstring is significantly increased performance on virtually all important primitives."
<https://github.com/facebook/folly/blob/master/fol... |
13,987,397 | I use all over my code std::string objects, most of them stack allocated. I replaced default new/delete operators to check the average memory allocation size and I was surprised to see that most allocations come from std::string and, this is very important, they are between 12 and 32 bytes! To optimize this(large numbe... | 2012/12/21 | [
"https://Stackoverflow.com/questions/13987397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336578/"
] | I think it's been done before, along the lines you mentioned, in [folly](https://github.com/facebook/folly): "fbstring is a drop-in replacement for std::string. The main benefit of fbstring is significantly increased performance on virtually all important primitives."
<https://github.com/facebook/folly/blob/master/fol... | >
> Did you tried such approach?
>
>
>
No, but I did write my own allocator. It is an alternative I prefer.
>
> Is it resonable to add this memory overhead, most of the time on the stack to save allocation time/memory fragmentation?
>
>
>
The definition of what is "reasonable" varies with your situation. Do ... |
13,987,397 | I use all over my code std::string objects, most of them stack allocated. I replaced default new/delete operators to check the average memory allocation size and I was surprised to see that most allocations come from std::string and, this is very important, they are between 12 and 32 bytes! To optimize this(large numbe... | 2012/12/21 | [
"https://Stackoverflow.com/questions/13987397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/336578/"
] | Is it reasonable? It depends. Unless you have found yourself actually running out of memory by using `std::string` or identified a *real* (as opposed to perceived) performance problem with continued allocation and deallocation, you're wasting your time doing this.
Don't get me wrong, you can (and I have) made great ga... | >
> Did you tried such approach?
>
>
>
No, but I did write my own allocator. It is an alternative I prefer.
>
> Is it resonable to add this memory overhead, most of the time on the stack to save allocation time/memory fragmentation?
>
>
>
The definition of what is "reasonable" varies with your situation. Do ... |
61,062,708 | So yesterday I was developing some sort of offline functionality. Therefore, I added an ApiService that returns Observables.
Currently, I fetch my access\_token for jwt-Authentication and then use this token to generate Headers for my API-Request. After a successful request, I save the result to my storage. This works... | 2020/04/06 | [
"https://Stackoverflow.com/questions/61062708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13239059/"
] | it helped me
```
yum update -y libstdc++.x86_64
yum install libstdc++.i686
``` | do you have try this
yum update --setopt=protected\_multilib=false |
48,785,820 | How do I turn a repeat number such as:
```
999117777774422111
```
Create output: //
```
999, 11, 777777, 44, 22, 111
```
I basically want to separate the value when the digits change from the [i]th place. | 2018/02/14 | [
"https://Stackoverflow.com/questions/48785820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9359238/"
] | You could use a regular expression like: `/(\d)\1*/g`.
`(\d)` means match any digit, `\1*` means match and of the initially matched digit.
```js
// Example:
'999117777774422111'.match(/([0-9])\1*/g)
// Output:
// ["999", "11", "777777", "44", "22", "111"]
console.log('999117777774422111'.match(/([0-9])\1*/g))... | That is not really sorting but more like comparing.
**Here is a solution**:
```js
var str = "999117777774422111";
var out = str[0];
for (var i = 1; i < str.length; i++) {
if (str[i] == str[i-1]) {
out += str[i];
} else {
out += ", " + str[i];
}
}
console.log(out);
```
---
**Or sending the o... |
48,785,820 | How do I turn a repeat number such as:
```
999117777774422111
```
Create output: //
```
999, 11, 777777, 44, 22, 111
```
I basically want to separate the value when the digits change from the [i]th place. | 2018/02/14 | [
"https://Stackoverflow.com/questions/48785820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9359238/"
] | That is not really sorting but more like comparing.
**Here is a solution**:
```js
var str = "999117777774422111";
var out = str[0];
for (var i = 1; i < str.length; i++) {
if (str[i] == str[i-1]) {
out += str[i];
} else {
out += ", " + str[i];
}
}
console.log(out);
```
---
**Or sending the o... | try this:
```js
let num='999117777774422111';
let result=num.match(/(\d)\1*/g);
console.log(result);
``` |
48,785,820 | How do I turn a repeat number such as:
```
999117777774422111
```
Create output: //
```
999, 11, 777777, 44, 22, 111
```
I basically want to separate the value when the digits change from the [i]th place. | 2018/02/14 | [
"https://Stackoverflow.com/questions/48785820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9359238/"
] | You could use a regular expression like: `/(\d)\1*/g`.
`(\d)` means match any digit, `\1*` means match and of the initially matched digit.
```js
// Example:
'999117777774422111'.match(/([0-9])\1*/g)
// Output:
// ["999", "11", "777777", "44", "22", "111"]
console.log('999117777774422111'.match(/([0-9])\1*/g))... | try this:
```js
let num='999117777774422111';
let result=num.match(/(\d)\1*/g);
console.log(result);
``` |
1,277,252 | I'm accessing a database column where a phone number is stored as a varchar in the format +a-b:c where a = country code, b = phone number and c = extension. E.g. +44-07700123456:123
So I have a type that handles serialization along the lines of:
```
public struct PhoneNumber {
public PhoneNumber(string val) { /*..... | 2009/08/14 | [
"https://Stackoverflow.com/questions/1277252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88053/"
] | Run the same query prefixed with EXPLAIN and add the output to your question - this will show what indexes you are using and the number of rows being analyzed.
You can see from your explain that no indexes are being used, and its having to look at thousands of rows to get your result. Try adding an index on the column... | It is simple query. I think everything is ok with it. You can try add indexes on 'stake' fields or make limit lower. |
1,277,252 | I'm accessing a database column where a phone number is stored as a varchar in the format +a-b:c where a = country code, b = phone number and c = extension. E.g. +44-07700123456:123
So I have a type that handles serialization along the lines of:
```
public struct PhoneNumber {
public PhoneNumber(string val) { /*..... | 2009/08/14 | [
"https://Stackoverflow.com/questions/1277252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88053/"
] | Replace the "`masters_tp`.\* " bit by explicitly naming only the fields from that table you actually need. Even if you need them all, name them all. | It is simple query. I think everything is ok with it. You can try add indexes on 'stake' fields or make limit lower. |
1,277,252 | I'm accessing a database column where a phone number is stored as a varchar in the format +a-b:c where a = country code, b = phone number and c = extension. E.g. +44-07700123456:123
So I have a type that handles serialization along the lines of:
```
public struct PhoneNumber {
public PhoneNumber(string val) { /*..... | 2009/08/14 | [
"https://Stackoverflow.com/questions/1277252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88053/"
] | There's actually no reason to do a `left join` here. You're using your filters to whisk away any leftiness of the join. Try this:
```
SELECT
`masters_tp`.*,
`masters_cp`.`cp` as cp,
`masters_cp`.`punti` as punti
FROM
`masters_tp`
INNER JOIN `masters_cp` ON
`masters_tp`.`stake` = `maste... | It is simple query. I think everything is ok with it. You can try add indexes on 'stake' fields or make limit lower. |
203,725 | I'd like to write about the golden age of piracy and this thought came to me: is there a standard way for a 1600's ship to handle a rogue wave, or does this vary by ship design?
My inexistent degree on sailing comes from playing Assassin's Creed. In one of the games in the series, the protagonist's ship deals with rog... | 2021/06/01 | [
"https://worldbuilding.stackexchange.com/questions/203725",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/21222/"
] | It depends on the dimensions of your boat, and of the wave.
Basically, you do not want the wave to roll you ship, nor do you want the wave to break your ship in two.
You want to hit the wave with a part of the ship that is of length a little bit longer than the maximum trough-to-peak of the wave. This way the ship "r... | **Use catamarans**
Catamarans have some drawbacks against monohulls, but handling rough seas is one of their strengths. I don't know if it was possible to build a carrack-sized catamaran, but smaller ships would be very viable. |
13,826,139 | When I execute model.save() in client side, I am getting null values in Spring framework controller. If I use Jquery ajaxSubmit() the values are received fine, how to achieve the same using model.save()
My Login model and view in client side code (Backbone used)
```
$.ready = function() {
var LoginModel, LoginVi... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13826139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529021/"
] | It is 100% always better to write the HTML directly, for more than just performance reasons.
Talking strictly performance, if you write the body directly it is loaded much quicker. If you use JavaScript (jQuery, etc.), it won't be processed until most of the HTML is read, blah blah so it'll be much (relatively) slower... | The markup approach would be faster. Not only do you not need to parse javascript, the browser does not need to wait until the ready() event is fired. |
13,826,139 | When I execute model.save() in client side, I am getting null values in Spring framework controller. If I use Jquery ajaxSubmit() the values are received fine, how to achieve the same using model.save()
My Login model and view in client side code (Backbone used)
```
$.ready = function() {
var LoginModel, LoginVi... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13826139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529021/"
] | It is 100% always better to write the HTML directly, for more than just performance reasons.
Talking strictly performance, if you write the body directly it is loaded much quicker. If you use JavaScript (jQuery, etc.), it won't be processed until most of the HTML is read, blah blah so it'll be much (relatively) slower... | of course without JavaScript/JQuery the rendering is faster. Also the data is a little bit less. |
13,826,139 | When I execute model.save() in client side, I am getting null values in Spring framework controller. If I use Jquery ajaxSubmit() the values are received fine, how to achieve the same using model.save()
My Login model and view in client side code (Backbone used)
```
$.ready = function() {
var LoginModel, LoginVi... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13826139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/529021/"
] | It is 100% always better to write the HTML directly, for more than just performance reasons.
Talking strictly performance, if you write the body directly it is loaded much quicker. If you use JavaScript (jQuery, etc.), it won't be processed until most of the HTML is read, blah blah so it'll be much (relatively) slower... | There's not necessarily a "right" answer here, but I'll weigh in.
Avoid building HTML in JavaScript except when your business model requires it (e.g. building out DOM elements in response to an Ajax query). The primary reason for this is that it's more difficult to support/modify HTML built in JavaSCript (typically). ... |
3,108,226 | Since upgrading 'everything' today to deploy to OS4 devices, it no longer recognizes localized XIBs and plists. (It=neither iPhone simulator or iPhone.) As in, before OS4, switching language caused the correct localized files to be loaded, but not so now. Does something need to be 'recreated', 'nudged', or renamed? It ... | 2010/06/24 | [
"https://Stackoverflow.com/questions/3108226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343825/"
] | For the 64-bit:
```
#include <inttypes.h>
typedef int64_t __int64;
```
As for the TCHAR problem. I actually find TCHARs rather useful so I have a file with all the \_t functions I use in it.
e.g
```
#ifdef UNICODE
#define _tcslen wcslen
#define _tcscpy wcscpy
#define _tcscpy_s wcscpy_s
#define _tcsncpy... | You can use [qint64](http://doc.trolltech.com/4.2/qtglobal.html#qint64-typedef) from Qt framework(Platform independent), but probably there are easier ways. |
3,108,226 | Since upgrading 'everything' today to deploy to OS4 devices, it no longer recognizes localized XIBs and plists. (It=neither iPhone simulator or iPhone.) As in, before OS4, switching language caused the correct localized files to be loaded, but not so now. Does something need to be 'recreated', 'nudged', or renamed? It ... | 2010/06/24 | [
"https://Stackoverflow.com/questions/3108226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343825/"
] | GCC supports `long long` (depending on compilation flags), which is a 64-it integer. Or you can use `std::int64_t` from the `cstdint` header.
Or to be more cross-platform, use `boost/cstdint.hpp`, which defines `boost::int64_t`
`_tmain` is just Microsoft being silly (or nonstandard, if you will) The rest of the world... | You can use [qint64](http://doc.trolltech.com/4.2/qtglobal.html#qint64-typedef) from Qt framework(Platform independent), but probably there are easier ways. |
3,108,226 | Since upgrading 'everything' today to deploy to OS4 devices, it no longer recognizes localized XIBs and plists. (It=neither iPhone simulator or iPhone.) As in, before OS4, switching language caused the correct localized files to be loaded, but not so now. Does something need to be 'recreated', 'nudged', or renamed? It ... | 2010/06/24 | [
"https://Stackoverflow.com/questions/3108226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343825/"
] | For the 64-bit:
```
#include <inttypes.h>
typedef int64_t __int64;
```
As for the TCHAR problem. I actually find TCHARs rather useful so I have a file with all the \_t functions I use in it.
e.g
```
#ifdef UNICODE
#define _tcslen wcslen
#define _tcscpy wcscpy
#define _tcscpy_s wcscpy_s
#define _tcsncpy... | GCC supports `long long` (depending on compilation flags), which is a 64-it integer. Or you can use `std::int64_t` from the `cstdint` header.
Or to be more cross-platform, use `boost/cstdint.hpp`, which defines `boost::int64_t`
`_tmain` is just Microsoft being silly (or nonstandard, if you will) The rest of the world... |
23,991,614 | I am trying to run an `android` application in `Eclipse` using `Maven` .
Some `dependencies` are unfortunately stopping the run (could not be found or resolved).
I have already checked that I have the dependencies in my repository.
Any suggestion is welcome.
Thank you for your time and consideration.
**Pom.xml :**
... | 2014/06/02 | [
"https://Stackoverflow.com/questions/23991614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3014036/"
] | I like to handle this by using a custom `Application` class. For example:
```
public class Helper extends Application {
private Context mContext;
public void onCreate() {
super.onCreate();
mContext = this;
}
public Context getContext() {
return mContext;
}
}
```
This wa... | You can create a singleton application class with getContext function which will return application context. But if you need an activity context, you can pass it as an argument to a constructor. |
23,991,614 | I am trying to run an `android` application in `Eclipse` using `Maven` .
Some `dependencies` are unfortunately stopping the run (could not be found or resolved).
I have already checked that I have the dependencies in my repository.
Any suggestion is welcome.
Thank you for your time and consideration.
**Pom.xml :**
... | 2014/06/02 | [
"https://Stackoverflow.com/questions/23991614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3014036/"
] | I like to handle this by using a custom `Application` class. For example:
```
public class Helper extends Application {
private Context mContext;
public void onCreate() {
super.onCreate();
mContext = this;
}
public Context getContext() {
return mContext;
}
}
```
This wa... | If you want to create a CameraHandler object in the same Activity, you can pass it like this :
```
ch = new CameraHandler(MainActivity.this);
ch.initializeCamera();
```
Else , you have to pass a parameter `Context` to your other class. |
60,530,688 | Let's say I need to generate 100 numerical values. The value that is generated each time must be greater than or equal to the previous generated value. The issue is is that each individual value MUST be generated on the spot when needed, so we do not store any of the data. I have a solution using recursion, but the iss... | 2020/03/04 | [
"https://Stackoverflow.com/questions/60530688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13007265/"
] | >
> The value that is generated each time must be greater than or equal to the previous generated value.
>
>
>
Just generate a random displacement from the previous value; like:
```
next_value = previous_value + get_random_value_from_zero_to_whatever();
previous_value = next_value;
```
The problem you n... | You actually only have to store one value, not all of them. The proof is by induction:
* If you generate a value and it's the very first time, that value is trivially greater or equal to all previous
* If you know the previously generated value *v*, which by induction is greater or equal to all previous values, then y... |
68,683 | I have a SPST relay that I do not have the full datasheet for, but I wish to calculate the time it takes to switch on a current for a particular voltage. Is there any easy general way to do this? My first thought would be to time it for a clicking noise, but I don't think that would be accurate for what I need.
My rel... | 2013/05/09 | [
"https://electronics.stackexchange.com/questions/68683",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/16834/"
] | Do you have an oscilloscope handy? A quick way to measure the switching time would be to operate the relay with probes hooked up to the control coil and the switching side of the relay. You would need to hook up some kind of dummy load so you can see it turn on. You would need to be able to monitor both the channels on... | If you have an Arduino or any other microcontroller devboard handy, you can set up an experiment to measure the delay.
Just hook up the relay coil to a micro via transistor (don't forget the protection diode!) and put a dummy load (something like 10k resistor) on the output of the relay and connect it to input pin of ... |
2,862,338 | I am reading A Concise Introduction to Mathematical Statistics by Dragi Anevski and in chapter 5 about random vectors, he proves that each component of a random vector is a random variable. Unfortunately, I need some help with comprehending the authors proof:
"Suppose that $(\Omega, F, P)$ is a probability space and $... | 2018/07/25 | [
"https://math.stackexchange.com/questions/2862338",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/413348/"
] | A correct proof is as follows:
$$
X\_i(\omega) \le x\_i \Leftrightarrow (X\_1(\omega), \dots, X\_n(\omega)) \in \{(t\_1, \dots, t\_n) : t\_i \le x\_i\} =: B.
$$
Therefore,
$$
\{\omega : X\_i(\omega) \le x\_i\} = \{\omega : (X\_1(\omega), \dots, X\_n(\omega)) \in B\}.
$$
Since $B$ is a Borel set, the above set belongs ... | If $(X\_1,\dots,X\_n)$ is a random vector then sets of the form $\bigcap\_{i=1}^n\{X\_i\leq x\_i\}$ for $x\_i\in(-\infty,\infty]$ are measurable.
This fact can be used to prove that e.g. $X\_1$ is a random variable.
This because the set $\{X\_1\leq x\}$ is exactly the same as the set $\{X\_1\leq x, X\_2\leq\infty,\d... |
20,127,294 | i love screen utility and i use it extensively on my server so i set up my .bashrc file to resume my screen session on login. the only function i am missing is something that logs out from the ssh session without the need of detaching/closing the screen session explicitly.
i was thinking about some script that would r... | 2013/11/21 | [
"https://Stackoverflow.com/questions/20127294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2429588/"
] | ssh supports a mechanism by which you can enter input directly to it instead of to the shell on the other end of the connection. That mechanism is enabled when you type the escape key, which can be set with `-e` and defaults to `~`. This is useful for various functions like setting up port forwarding in an already conn... | Instead of having `ssh` run a login shell (the default), have it run `screen` directly:
```
ssh remoteHost -t screen -dRS "mainScreen"
```
When you detach, the screen client exits, which causes `ssh` to close the connection.
(Note: I include the `screen` command suggested by Steve, but you can use whatever command ... |
51,270,784 | How do you convert a timestamp column to epoch seconds?
```
var df = sc.parallelize(Seq("2018-07-01T00:00:00Z")).toDF("date_string")
df = df.withColumn("timestamp", $"date_string".cast("timestamp"))
df.show(false)
```
DataFrame:
```
+--------------------+---------------------+
|date_string |timestamp ... | 2018/07/10 | [
"https://Stackoverflow.com/questions/51270784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449886/"
] | If you have a timestamp you can cast it to a long to get the epoch seconds
```
df = df.withColumn("epoch_seconds", $"timestamp".cast("long"))
df.show(false)
```
DataFrame
```
+--------------------+---------------------+-------------+
|date_string |timestamp |epoch_seconds|
+--------------------+-... | Use [`unix_timestamp`](https://spark.apache.org/docs/2.0.2/api/java/org/apache/spark/sql/functions.html#unix_timestamp(org.apache.spark.sql.Column)) from `org.apache.spark.functions`. It can a timestamp column or from a string column where it is possible to specify the format. From the documentation:
>
>
> ```
> pub... |
51,270,784 | How do you convert a timestamp column to epoch seconds?
```
var df = sc.parallelize(Seq("2018-07-01T00:00:00Z")).toDF("date_string")
df = df.withColumn("timestamp", $"date_string".cast("timestamp"))
df.show(false)
```
DataFrame:
```
+--------------------+---------------------+
|date_string |timestamp ... | 2018/07/10 | [
"https://Stackoverflow.com/questions/51270784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449886/"
] | If you have a timestamp you can cast it to a long to get the epoch seconds
```
df = df.withColumn("epoch_seconds", $"timestamp".cast("long"))
df.show(false)
```
DataFrame
```
+--------------------+---------------------+-------------+
|date_string |timestamp |epoch_seconds|
+--------------------+-... | It can be easily done with `unix_timestamp` function in spark SQL like this:
```
spark.sql("SELECT unix_timestamp(inv_time) AS time_as_long FROM agg_counts LIMIT 10").show()
```
Hope this helps. |
51,270,784 | How do you convert a timestamp column to epoch seconds?
```
var df = sc.parallelize(Seq("2018-07-01T00:00:00Z")).toDF("date_string")
df = df.withColumn("timestamp", $"date_string".cast("timestamp"))
df.show(false)
```
DataFrame:
```
+--------------------+---------------------+
|date_string |timestamp ... | 2018/07/10 | [
"https://Stackoverflow.com/questions/51270784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449886/"
] | If you have a timestamp you can cast it to a long to get the epoch seconds
```
df = df.withColumn("epoch_seconds", $"timestamp".cast("long"))
df.show(false)
```
DataFrame
```
+--------------------+---------------------+-------------+
|date_string |timestamp |epoch_seconds|
+--------------------+-... | You can use the function `unix_timestamp` and cast it into any datatype.
Example:
```
val df1 = df.select(unix_timestamp($"date_string", "yyyy-MM-dd HH:mm:ss").cast(LongType).as("epoch_seconds"))
``` |
51,270,784 | How do you convert a timestamp column to epoch seconds?
```
var df = sc.parallelize(Seq("2018-07-01T00:00:00Z")).toDF("date_string")
df = df.withColumn("timestamp", $"date_string".cast("timestamp"))
df.show(false)
```
DataFrame:
```
+--------------------+---------------------+
|date_string |timestamp ... | 2018/07/10 | [
"https://Stackoverflow.com/questions/51270784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449886/"
] | Use [`unix_timestamp`](https://spark.apache.org/docs/2.0.2/api/java/org/apache/spark/sql/functions.html#unix_timestamp(org.apache.spark.sql.Column)) from `org.apache.spark.functions`. It can a timestamp column or from a string column where it is possible to specify the format. From the documentation:
>
>
> ```
> pub... | It can be easily done with `unix_timestamp` function in spark SQL like this:
```
spark.sql("SELECT unix_timestamp(inv_time) AS time_as_long FROM agg_counts LIMIT 10").show()
```
Hope this helps. |
51,270,784 | How do you convert a timestamp column to epoch seconds?
```
var df = sc.parallelize(Seq("2018-07-01T00:00:00Z")).toDF("date_string")
df = df.withColumn("timestamp", $"date_string".cast("timestamp"))
df.show(false)
```
DataFrame:
```
+--------------------+---------------------+
|date_string |timestamp ... | 2018/07/10 | [
"https://Stackoverflow.com/questions/51270784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449886/"
] | Use [`unix_timestamp`](https://spark.apache.org/docs/2.0.2/api/java/org/apache/spark/sql/functions.html#unix_timestamp(org.apache.spark.sql.Column)) from `org.apache.spark.functions`. It can a timestamp column or from a string column where it is possible to specify the format. From the documentation:
>
>
> ```
> pub... | You can use the function `unix_timestamp` and cast it into any datatype.
Example:
```
val df1 = df.select(unix_timestamp($"date_string", "yyyy-MM-dd HH:mm:ss").cast(LongType).as("epoch_seconds"))
``` |
51,270,784 | How do you convert a timestamp column to epoch seconds?
```
var df = sc.parallelize(Seq("2018-07-01T00:00:00Z")).toDF("date_string")
df = df.withColumn("timestamp", $"date_string".cast("timestamp"))
df.show(false)
```
DataFrame:
```
+--------------------+---------------------+
|date_string |timestamp ... | 2018/07/10 | [
"https://Stackoverflow.com/questions/51270784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/449886/"
] | It can be easily done with `unix_timestamp` function in spark SQL like this:
```
spark.sql("SELECT unix_timestamp(inv_time) AS time_as_long FROM agg_counts LIMIT 10").show()
```
Hope this helps. | You can use the function `unix_timestamp` and cast it into any datatype.
Example:
```
val df1 = df.select(unix_timestamp($"date_string", "yyyy-MM-dd HH:mm:ss").cast(LongType).as("epoch_seconds"))
``` |
106,784 | I am working on a team that is doing both driver software and FPGA development. The FPGA simulation is being done in Modelsim and driver software is written in C. To minimize integration risk, I would love to be able to model the interaction between the two halves of our product before putting it on hardware.
I know M... | 2014/04/16 | [
"https://electronics.stackexchange.com/questions/106784",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/40447/"
] | [External Control of a ModelSim Simulation Via Unix Named Pipes](http://books.google.com/books/about/External_Control_of_a_ModelSim_Simulatio.html?id=bBSrZwEACAAJ&redir_esc=y)
>
> Abstract: In this thesis, we present a method of controlling a
> ModelSim simulation via an external program. Communication between
> Mo... | You might want to look at [Cocotb](http://cocotb.org). It's a Python based co-simulation library, one of the design goals was to enable the methodology you describe, easily simulating un-modified production software and RTL.
There's an example in the repository of running unmodified `ping` command against a simulation... |
44,123,838 | I have a router
```
routes: [
{
path: '/',
name: 'home',
meta : {
label : 'Home'
},
component: Home
},
{
path: '/usuarios',
name: 'usuarios',
meta : {
label : 'Usuarios'
},
component: Users,
children : [
{
path: '/listar',
meta : {
... | 2017/05/23 | [
"https://Stackoverflow.com/questions/44123838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1332738/"
] | I finally figured it out.
If you have children, the father component should have a `<router-view>` as well
Found the answer here: [Vue router2 not catching deep nested routes](https://stackoverflow.com/questions/41590297/vue-router2-not-catching-deep-nested-routes)
Thanks everybody for trying help | This issue is happening because you have forward slashes `/` prepended to the paths of your nested routes.
From the [documentation on nested routes](https://router.vuejs.org/en/essentials/nested-routes.html):
>
> Note that nested paths that start with / will be treated as a root path. This allows you to leverage the... |
69,001,869 | I have table1 as below.
| num | value |
| --- | --- |
| 1 | 10 |
| 2 | 15 |
| 3 | 20 |
table2
| ver | value |
| --- | --- |
| 1.0 | 5 |
| 2.0 | 15 |
| 3.0 | 18 |
Output should be as below. I need to select all rows from table1 such that table1.value <= table2.value.
| num | value |
| --- | --- |
| 1 | 10 |
| 2 | 1... | 2021/08/31 | [
"https://Stackoverflow.com/questions/69001869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8321026/"
] | From a logical point of view what you're asking kdb to compare is:
```
10 15 20<=5 15 18
```
Because these are equal lengths, kdb assumes you mean pairwise comparison, aka
```
10<=5
15<=15
20<=18
```
to which it would return
```
q)10 15 20<=5 15 18
010b
```
What you actually seem to mean (based on your expecte... | `value` is a keyword so don't assign to it.
Assuming you want all values from `table1` with value less than the `max` value in `table2` you could do:
```
q)table1:([]num:til 3;val:10 15 20)
q)table2:([]ver:`float$til 3;val:5 15 18)
q)select from table1 where val<=max table2`val
num val
-------
0 10
1 15
``` |
1,055,656 | I'm trying to replace a 640GB USB2 drive which I use as my Time Machine backup device with a 1TB FireWire 400 drive without losing the current backup history. Given that the 640GB drive is nearly full and the 400Mbps transfer limit of this combination, I realized that this process could take quite some time and might g... | 2016/03/21 | [
"https://superuser.com/questions/1055656",
"https://superuser.com",
"https://superuser.com/users/573147/"
] | First of all the automatic bracket completion is easy. Just go to **Settings >> Preferences >> Auto Completion** and uncheck the parentheses, brackets, and curly brackets from the list as shown in the following picture. This will stop auto completion of those brackets.
[ solved it and it's behaving correctly now.
(Best guess is the UI was not reflecting the actual set... |
54,057 | I just receive my first "official" drawing/logo project and I'm not sure how to get about doing it.
So this client asked me for a drawing for a brand logo that he's planning on doing (just a drawing for now, but maybe a logo later on, but I'll need to tell him my rates and all). So I'm planning to tell him that I don... | 2015/05/25 | [
"https://graphicdesign.stackexchange.com/questions/54057",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/44301/"
] | If you have access to an iPhone or iPad, you could try using [Adobe Shape](http://www.adobe.com/products/shape.html). It uses the device camera to take pictures and convert the pictures into vectors. | It all depends on the look you want on the logo. If it's very sketchy, or has something like watercolor textures it might be harder to vectorize, but it is possible to achieve a hand-drawn look in all vector using illustrator brushes and textures.
It is also possible to have a hand-drawn version (that you maybe draw b... |
54,057 | I just receive my first "official" drawing/logo project and I'm not sure how to get about doing it.
So this client asked me for a drawing for a brand logo that he's planning on doing (just a drawing for now, but maybe a logo later on, but I'll need to tell him my rates and all). So I'm planning to tell him that I don... | 2015/05/25 | [
"https://graphicdesign.stackexchange.com/questions/54057",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/44301/"
] | If you have access to an iPhone or iPad, you could try using [Adobe Shape](http://www.adobe.com/products/shape.html). It uses the device camera to take pictures and convert the pictures into vectors. | If the logo will be used for commercial purposes then it must be professionally vectorized. Don't even think about automated vector conversion tools. They are providing terrible vector images that can not be used for any company. Check blue link with tutorial that will show you how to vectorize company logo with a pen ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.