qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
24,520,243 | I'm looking right at the file I want to download in my current directory. wget wants a FULL url, I don't know what the full url is. im in directory /usr/local/lib/ and want to download php.ini.
I am using putty to log into my web server, and when i say donwload i want to download it from the web server to my pc | 2014/07/01 | [
"https://Stackoverflow.com/questions/24520243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1397417/"
] | The best way to get started with Android Wear is to use the latest Android Studio 0.8.1 or later, and it makes adding the support libraries to your code a lot easier. But it is possible to still use Eclipse, and I'll explain how to do it ...
Since the SDK was just released for Android Wear, you need to firstly make su... | The instructions detailed at the link below were very helpful for my Eclipse setup.
<https://medium.com/@tangtungai/how-to-develop-and-package-android-wear-app-using-eclipse-ef1b34126a5d> |
24,520,243 | I'm looking right at the file I want to download in my current directory. wget wants a FULL url, I don't know what the full url is. im in directory /usr/local/lib/ and want to download php.ini.
I am using putty to log into my web server, and when i say donwload i want to download it from the web server to my pc | 2014/07/01 | [
"https://Stackoverflow.com/questions/24520243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1397417/"
] | The best way to get started with Android Wear is to use the latest Android Studio 0.8.1 or later, and it makes adding the support libraries to your code a lot easier. But it is possible to still use Eclipse, and I'll explain how to do it ...
Since the SDK was just released for Android Wear, you need to firstly make su... | For gradle try
```
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
```
} |
24,520,243 | I'm looking right at the file I want to download in my current directory. wget wants a FULL url, I don't know what the full url is. im in directory /usr/local/lib/ and want to download php.ini.
I am using putty to log into my web server, and when i say donwload i want to download it from the web server to my pc | 2014/07/01 | [
"https://Stackoverflow.com/questions/24520243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1397417/"
] | Create a wearable module with Android Studio 4.0 and ended-up with the exact same issue! And it's 2020, 6 years later LOL.
Followed this guide to add the missing bits and pieces:
<https://developer.android.com/training/wearables/apps/creating>
Basically my project builde.gradle didn't have those:
```
maven { url "ht... | For gradle try
```
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
```
} |
59,278,639 | How to change in nox app player default geo in google map ? Because after create new emulator need every time change pin on google map. | 2019/12/11 | [
"https://Stackoverflow.com/questions/59278639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613393/"
] | c:\Users\YOURUSERNAME\AppData\Local\Nox\conf.ini
```
[Location]
Lat=10.8378886
Lng=106.638701
Map=google
``` | For **Nox** emulator you can setup location and status GPS in files placed on android:
```
> adb shell ls /data/property/persist.nox.gps.*
/data/property/persist.nox.gps.latitude
/data/property/persist.nox.gps.longitude
/data/property/persist.nox.gps.status
``` |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Another approach to this problem might be the following: create an helper object for the async task and copy a completion block when the task is called. Call the completion block using the delegate methods once the async task is finished. As a result we might execute the tasks in order like the following:
```
FSTask ... | You can also pass C in a block like so...
define a custom block
`typedef void(^myCompletion)(BOOL complete);`
Create your B method
```
-(void)performBWithCompletionBlock:(myCompletion)complete;
{
// do your things
[self.delegate delegateCallback];
complete(YES);
}
```
then create BG / async ABC
```
... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Thanks for all the feeback - apologies for not responding sooner. I've now resolved this in a slightly different way to the suggestions:
Firstly, I extended NSObject to have the following method -
```
#import "NSObject+LTExtensions.h"
@implementation NSObject (Testing)
- (void) performSelectorWithBlock: (SEL) sele... | Another approach to this problem might be the following: create an helper object for the async task and copy a completion block when the task is called. Call the completion block using the delegate methods once the async task is finished. As a result we might execute the tasks in order like the following:
```
FSTask ... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Another approach to this problem might be the following: create an helper object for the async task and copy a completion block when the task is called. Call the completion block using the delegate methods once the async task is finished. As a result we might execute the tasks in order like the following:
```
FSTask ... | You can assign a block property to B where it would be used to execute a block of code before calling the delegate method. something like:
@property (nonatomic, copy)void(^yourBlock)(id blockParameter);
So, after calling B's delegate, you could call upon this block and execute it. Inside this block, you can call C's ... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | the way I handled this is.
I created a NSMutableDictionary before the async call.
Then i make the async call. and do a check for the value I am waiting for
```
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[AsyncCallClass asyncCall:^{
@synchronized(dictionary) {
[dictionary setValue... | You can also pass C in a block like so...
define a custom block
`typedef void(^myCompletion)(BOOL complete);`
Create your B method
```
-(void)performBWithCompletionBlock:(myCompletion)complete;
{
// do your things
[self.delegate delegateCallback];
complete(YES);
}
```
then create BG / async ABC
```
... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Here is the typical code I use to do such things (adapt the completionBlock signature and method names to your needs of course)
```
typedef void (^BCompletionBlock)(void);
@interface B : NSObject <BDelegate>
@property(nonatomic, copy) BCompletionBlock completionBlock;
-(void)doAsynchronousActionWithCompletion:(BCompl... | You can also pass C in a block like so...
define a custom block
`typedef void(^myCompletion)(BOOL complete);`
Create your B method
```
-(void)performBWithCompletionBlock:(myCompletion)complete;
{
// do your things
[self.delegate delegateCallback];
complete(YES);
}
```
then create BG / async ABC
```
... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Thanks for all the feeback - apologies for not responding sooner. I've now resolved this in a slightly different way to the suggestions:
Firstly, I extended NSObject to have the following method -
```
#import "NSObject+LTExtensions.h"
@implementation NSObject (Testing)
- (void) performSelectorWithBlock: (SEL) sele... | You can assign a block property to B where it would be used to execute a block of code before calling the delegate method. something like:
@property (nonatomic, copy)void(^yourBlock)(id blockParameter);
So, after calling B's delegate, you could call upon this block and execute it. Inside this block, you can call C's ... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | You can assign a block property to B where it would be used to execute a block of code before calling the delegate method. something like:
@property (nonatomic, copy)void(^yourBlock)(id blockParameter);
So, after calling B's delegate, you could call upon this block and execute it. Inside this block, you can call C's ... | You can also pass C in a block like so...
define a custom block
`typedef void(^myCompletion)(BOOL complete);`
Create your B method
```
-(void)performBWithCompletionBlock:(myCompletion)complete;
{
// do your things
[self.delegate delegateCallback];
complete(YES);
}
```
then create BG / async ABC
```
... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Thanks for all the feeback - apologies for not responding sooner. I've now resolved this in a slightly different way to the suggestions:
Firstly, I extended NSObject to have the following method -
```
#import "NSObject+LTExtensions.h"
@implementation NSObject (Testing)
- (void) performSelectorWithBlock: (SEL) sele... | the way I handled this is.
I created a NSMutableDictionary before the async call.
Then i make the async call. and do a check for the value I am waiting for
```
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[AsyncCallClass asyncCall:^{
@synchronized(dictionary) {
[dictionary setValue... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Another approach to this problem might be the following: create an helper object for the async task and copy a completion block when the task is called. Call the completion block using the delegate methods once the async task is finished. As a result we might execute the tasks in order like the following:
```
FSTask ... | the way I handled this is.
I created a NSMutableDictionary before the async call.
Then i make the async call. and do a check for the value I am waiting for
```
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[AsyncCallClass asyncCall:^{
@synchronized(dictionary) {
[dictionary setValue... |
12,184,068 | Long time lurker, first time poster. I'm relatively new to objective-C so my apologies if I'm asking something fairly simple. My google & stack overflow-fu has let me down here, so I figured somebody could maybe help.
I have a synchronous process executing, say, three functions in a row - call it A -> B-> C , where ta... | 2012/08/29 | [
"https://Stackoverflow.com/questions/12184068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634015/"
] | Thanks for all the feeback - apologies for not responding sooner. I've now resolved this in a slightly different way to the suggestions:
Firstly, I extended NSObject to have the following method -
```
#import "NSObject+LTExtensions.h"
@implementation NSObject (Testing)
- (void) performSelectorWithBlock: (SEL) sele... | Here is the typical code I use to do such things (adapt the completionBlock signature and method names to your needs of course)
```
typedef void (^BCompletionBlock)(void);
@interface B : NSObject <BDelegate>
@property(nonatomic, copy) BCompletionBlock completionBlock;
-(void)doAsynchronousActionWithCompletion:(BCompl... |
8,948,906 | I have created a login for an application. I got it that if you type in the username and password then click on the checkbox it remembers the username and password. However, if you make any changes after you click the checkbox the they are not saved. I am wondering if there is a way to fix this and how would I got abou... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8948906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708678/"
] | I finally got it:
I previously added CSS customisations to Blogger for the `<code>` HTML tag like this:
```
code {
border: 1px solid #ccc;
background-color: #f6f6f6;
font: 0.8em 'Courier New', Courier, Fixed;
border-spacing: 0;
padding: 0.3em;
display: block;
}
```
and the culprit is `displa... | I've tried it on my blog and it works. You should just add all those tags, right before `</head>` tag. This is what I've for my blog:
```
<!--SYNTAX HIGHLIGHTER BEGINS-->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev... |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | Here:
```
#include <stdio.h>
int main ()
{
double decker = 1.0;
unsigned char * desmond = (unsigned char *) & decker;
int i;
for (i = 0; i < sizeof (double); i++) {
printf ("%02X ", desmond[i]);
}
printf ("\n");
return 0;
}
```
You can try it: <http://codepad.org/onHnAcnC> | That isn't going to be very enlightening unless you also know a bit about typical IEEE FP representations.
Most likely the way your machine represents doubles is spelled out [here](http://www.psc.edu/general/software/packages/ieee/ieee.php). |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | A particular bit layout by itself is meaningless. Suppose I have the following: `1101`
Maybe I say that is unsigned and it represents the value 13.
Maybe it is signed and that high bit signifies that the value is a negative which means it is now -5.
Consider further that I consider the high two bits to be a base and... | The key is to convert the `double` to a `long long` (assuming `sizeof(double) == sizeof(long long)`) without changing binary representation. This can be achieved by one of the following methods:
* cast: `double a; long long b = *((long long *)&a);`
* union: `union { double a ; long long b };` |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | Here:
```
#include <stdio.h>
int main ()
{
double decker = 1.0;
unsigned char * desmond = (unsigned char *) & decker;
int i;
for (i = 0; i < sizeof (double); i++) {
printf ("%02X ", desmond[i]);
}
printf ("\n");
return 0;
}
```
You can try it: <http://codepad.org/onHnAcnC> | The key is to convert the `double` to a `long long` (assuming `sizeof(double) == sizeof(long long)`) without changing binary representation. This can be achieved by one of the following methods:
* cast: `double a; long long b = *((long long *)&a);`
* union: `union { double a ; long long b };` |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | A particular bit layout by itself is meaningless. Suppose I have the following: `1101`
Maybe I say that is unsigned and it represents the value 13.
Maybe it is signed and that high bit signifies that the value is a negative which means it is now -5.
Consider further that I consider the high two bits to be a base and... | That isn't going to be very enlightening unless you also know a bit about typical IEEE FP representations.
Most likely the way your machine represents doubles is spelled out [here](http://www.psc.edu/general/software/packages/ieee/ieee.php). |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | A particular bit layout by itself is meaningless. Suppose I have the following: `1101`
Maybe I say that is unsigned and it represents the value 13.
Maybe it is signed and that high bit signifies that the value is a negative which means it is now -5.
Consider further that I consider the high two bits to be a base and... | Another option is to use [bitfields](http://publications.gbdirect.co.uk/c_book/chapter6/bitfields.html). Armed with such a structure and knowledge of how a double is supposed to be stored on your computer you can very easily print out the different parts of the internal representation of the double. A bit like they do ... |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | ```
union {
double d;
unsigned char c[sizeof(double)];
} d;
int main(int ac, char **av) {
int i;
char s1[80], s2[80];
d.d = 1.0;
for(i = 0; i < sizeof d; ++i) {
sprintf(s1 + i * 3, " %02x", d.c[i]);
sprintf(s2 + i * 3, " %02x", d.c[sizeof d - 1 - i]);
}
printf("%s\n%s\n", s1, s2);
return 0;... | A particular bit layout by itself is meaningless. Suppose I have the following: `1101`
Maybe I say that is unsigned and it represents the value 13.
Maybe it is signed and that high bit signifies that the value is a negative which means it is now -5.
Consider further that I consider the high two bits to be a base and... |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | ```
union {
double d;
unsigned char c[sizeof(double)];
} d;
int main(int ac, char **av) {
int i;
char s1[80], s2[80];
d.d = 1.0;
for(i = 0; i < sizeof d; ++i) {
sprintf(s1 + i * 3, " %02x", d.c[i]);
sprintf(s2 + i * 3, " %02x", d.c[sizeof d - 1 - i]);
}
printf("%s\n%s\n", s1, s2);
return 0;... | Another option is to use [bitfields](http://publications.gbdirect.co.uk/c_book/chapter6/bitfields.html). Armed with such a structure and knowledge of how a double is supposed to be stored on your computer you can very easily print out the different parts of the internal representation of the double. A bit like they do ... |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | Here:
```
#include <stdio.h>
int main ()
{
double decker = 1.0;
unsigned char * desmond = (unsigned char *) & decker;
int i;
for (i = 0; i < sizeof (double); i++) {
printf ("%02X ", desmond[i]);
}
printf ("\n");
return 0;
}
```
You can try it: <http://codepad.org/onHnAcnC> | This works for me
```
#include <stdio.h>
#include <string.h> /* memmove */
int main(void) {
unsigned char dontdothis[sizeof (double)];
double x = 62.42;
printf("%f\n", x);
memmove(&dontdothis, &x, sizeof dontdothis);
/* examine/change the array dontdothis */
dontdothis[sizeof x - 1] ^= 0x80;
/* examine/... |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | Here:
```
#include <stdio.h>
int main ()
{
double decker = 1.0;
unsigned char * desmond = (unsigned char *) & decker;
int i;
for (i = 0; i < sizeof (double); i++) {
printf ("%02X ", desmond[i]);
}
printf ("\n");
return 0;
}
```
You can try it: <http://codepad.org/onHnAcnC> | A particular bit layout by itself is meaningless. Suppose I have the following: `1101`
Maybe I say that is unsigned and it represents the value 13.
Maybe it is signed and that high bit signifies that the value is a negative which means it is now -5.
Consider further that I consider the high two bits to be a base and... |
1,572,796 | I want to learn how the computer represents the `double` type in bit, but the `&` and `|` bit operators can't use `double`. And `memcpy(&d, &src, 8)` also doesn't seem to work. Any suggestions? | 2009/10/15 | [
"https://Stackoverflow.com/questions/1572796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/121051/"
] | ```
union {
double d;
unsigned char c[sizeof(double)];
} d;
int main(int ac, char **av) {
int i;
char s1[80], s2[80];
d.d = 1.0;
for(i = 0; i < sizeof d; ++i) {
sprintf(s1 + i * 3, " %02x", d.c[i]);
sprintf(s2 + i * 3, " %02x", d.c[sizeof d - 1 - i]);
}
printf("%s\n%s\n", s1, s2);
return 0;... | This works for me
```
#include <stdio.h>
#include <string.h> /* memmove */
int main(void) {
unsigned char dontdothis[sizeof (double)];
double x = 62.42;
printf("%f\n", x);
memmove(&dontdothis, &x, sizeof dontdothis);
/* examine/change the array dontdothis */
dontdothis[sizeof x - 1] ^= 0x80;
/* examine/... |
5,333,295 | I need to approx (1-x)^0.25 with given accuracy (0.0001 e.g.). I'm using [expansion found on Wikipedia](http://en.wikipedia.org/wiki/Taylor_series#List_of_Maclaurin_series_of_some_common_functions) for (1+x)^0.25. I need to stop approximating when current expression is less than the accuracy.
```
long double s(long do... | 2011/03/17 | [
"https://Stackoverflow.com/questions/5333295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/575657/"
] | See <http://bowlerframework.org/>
Sounds like exactly what you need. | You can just use Scala + Wicket. This is nice combination. |
16,991,728 | I want to subtract the smallest value in each subset of a data frame from each value in that subset i.e.
```
A <- c(1,3,5,6,4,5,6,7,10)
B <- rep(1:4, length.out=length(A))
df <- data.frame(A, B)
df <- df[order(B),]
```
Subtracting would give me:
```
A B
1 0 1
2 3 1
3 9 1
4 0 2
5 2 2
6 0 3
7 1 3
8 0 4
9 1 4
``` | 2013/06/07 | [
"https://Stackoverflow.com/questions/16991728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464725/"
] | I think the output you show is not correct. In any case, from what you explain, I think this is what you want. This uses `ave` base function:
```
within(df, { A <- ave(A, B, FUN=function(x) x-min(x))})
A B
1 0 1
5 3 1
9 9 1
2 0 2
6 2 2
3 0 3
7 1 3
4 0 4
8 1 4
```
Of course there are other alternatives such as `ply... | Echoing Arun's comment above, I think your expected output might be off. In any event, you should be able to use can use `tapply` to calculate subsets and then use `match` to line those subsets up with the original values:
```
subs <- tapply(df$A, df$B, min)
df$A <- df$A - subs[match(df$B, names(subs))]
df
A B
1 0... |
1,195,206 | If root is very near to the max/min, what happens with Newton Raphson method? Does it diverge? Or converges slowly? I know if some iteration involves a stationery point then we can not go further. But is there a possiblity that even in such a case we can avoid the stationery point? | 2015/03/18 | [
"https://math.stackexchange.com/questions/1195206",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/33247/"
] | $$\frac{\sin a - \cos a + 1}{\sin a + \cos a - 1}$$
$$= \frac{(\sin a - \cos a + 1)(\sin a + \cos a + 1)}{(\sin a + \cos a - 1)(\sin a + \cos a + 1)}$$
$$= \frac{\sin^2 a + 2 \sin a + 1 - \cos^2 a}{\sin^2 a + 2 \sin a \cos a + \cos^2 a - 1}$$
$$= \frac{2\sin^2 a + 2\sin a}{2 \sin a \cos a}$$
$$= \frac{\sin a + 1}{\cos ... | Hint : Multiply and divide by $\sin{a}-(\cos{a}-1)$ . |
1,195,206 | If root is very near to the max/min, what happens with Newton Raphson method? Does it diverge? Or converges slowly? I know if some iteration involves a stationery point then we can not go further. But is there a possiblity that even in such a case we can avoid the stationery point? | 2015/03/18 | [
"https://math.stackexchange.com/questions/1195206",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/33247/"
] | $$\frac{\sin a - \cos a + 1}{\sin a + \cos a - 1}$$
$$= \frac{(\sin a - \cos a + 1)(\sin a + \cos a + 1)}{(\sin a + \cos a - 1)(\sin a + \cos a + 1)}$$
$$= \frac{\sin^2 a + 2 \sin a + 1 - \cos^2 a}{\sin^2 a + 2 \sin a \cos a + \cos^2 a - 1}$$
$$= \frac{2\sin^2 a + 2\sin a}{2 \sin a \cos a}$$
$$= \frac{\sin a + 1}{\cos ... | Assume that $\cos(a)\ne0$ and $\sin(a)+\cos(a)-1\ne0$, then cross-multiply:
$$
\begin{align}
&(\sin(a)-\cos(a)+1)\cos(a)-(\sin(a)+\cos(a)-1)(\sin(a)+1)\\
&=\small\overbrace{\color{#C00000}{\sin(a)\cos(a)}\color{#0000F0}{-\cos^2(a)}\color{#00A000}{+\cos(a)}}^{\large(\sin(a)-\cos(a)+1)\cos(a)}\overbrace{\color{#0000F0}{-... |
13,303 | Is there a way to use Twig's `{% spaceless %}` tag only under certain conditions?
For example, say you wanted the HTML to be spaceless in the live environment but wanted it uncompressed in the dev environment. I tried something like:
```
{% if isDev %}
{% spaceless %}
{% endif %}
{# Some code... #}
{% if isDev %}... | 2016/01/19 | [
"https://craftcms.stackexchange.com/questions/13303",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/467/"
] | Yes, Twig (sometimes) complains if you're splitting tags which belong together into different conditionals, I ran into that issue in a similar situation.
But as already noted in the comments, I'm also curious why you want to split the `spaceless` tag. If it's about minifying HTML, the tag isn't very efficient anyways ... | You could do it by buffering your output, i.e.
```
{% set output %}
{# Your code here #}
{% endset %}
{% if isDev %}
{{ output }}
{% else %}
{% spaceless %}
{{ output }}
{% endspaceless %}
{% endif %}
``` |
62,412,163 | Here is the Apache Reverse proxy and load balancer, the website/reports url is not coming up
```
<IfModule mod_proxy.c>
ProxyPreserveHost On
<Proxy balancer://app0102>
BalancerMember https://serverapp01.com
BalancerMember https://serverapp02.com
</Proxy>
ProxyPa... | 2020/06/16 | [
"https://Stackoverflow.com/questions/62412163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1291353/"
] | If your backend server is using SessionCookie then you can use the same cookie for sticky session.
```
<Proxy balancer://app0102>
BalancerMember https://serverapp01.com route=node1
BalancerMember https://serverapp02.com route=node2
</Proxy>
ProxyTimeout 60
ProxyStatus On
ProxyPass / balancer://app0102/ stickys... | I suggest using quotes on both source and destionation,
such as:
>
> ProxyPass "/" "balancer://app0102/"
>
>
> |
18,888,297 | In my application i'm using edit text view in exapandable listview.
When i'm trying to add text in edit text the focus of editext automatically changing.
i'm not able to put text in edit text properly.
what should i do?
edit text xml-
```
<EditText
android:id="@+id/editDetails"
android:layout_width="fill... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18888297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1501644/"
] | See this might help you '
Read from here [LINK TO UNDERSTAND](http://developer.android.com/guide/topics/data/data-storage.html#filesInternal)
```
String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.c... | The correct way to access Android storage is
```
Environment.getExternalStorageDirectory()
```
In your case, this would return `/storage/sdcard1`, and you could code
```
Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"Android/New_Data.xml";
```
to get the pathname.
See [the Environmen... |
18,888,297 | In my application i'm using edit text view in exapandable listview.
When i'm trying to add text in edit text the focus of editext automatically changing.
i'm not able to put text in edit text properly.
what should i do?
edit text xml-
```
<EditText
android:id="@+id/editDetails"
android:layout_width="fill... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18888297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1501644/"
] | See this might help you '
Read from here [LINK TO UNDERSTAND](http://developer.android.com/guide/topics/data/data-storage.html#filesInternal)
```
String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.c... | Try getDir().
Refer [Android getting external storage Absolute Path](https://stackoverflow.com/questions/17546718/android-getting-internal-storage-absolute-path)
```
File getdirectory = context.getDir("Samplefolder", Context.MODE_PRIVATE);
if(!getdirectory .exists)
{
getdirectory .mkdirs();
}
``` |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | The PerlMonks thread [here](http://www.perlmonks.org/?node_id=582868) talks about this problem.
It seems that for your situation, it might be simplest to get **pdftotext** (the command line tool), then you can do something like:
```
my @search_results = `pdftotext myfile.pdf - | grep -i -l \"$string\"`;
``` | You may want to look at [PDF::Core](http://search.cpan.org/perldoc?PDF::Core). |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | The easiest fulltext index/seach I've used is mysql. You just insert into the table with the appropriate index on it. You need to spend some time working out the relative weightings for fields (a match in the title might score higher than a match in the body), but this is all possible, albeit with some hairy sql.
Pluc... | You could try Lucene (the Perl port is called Plucene). The searches are incredibly fast and I know that PDFBox already knows how to index PDF files with Lucene. PDFBox is Java, but chances are there is something very similar somewhere in CPAN. Even if you can't find something that already adds PDF files to a Lucene in... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | My library, [CAM::PDF](http://search.cpan.org/dist/CAM-PDF/), has support for extracting text, but it's an inherently hard problem given the graphical orientation of PDF syntax. So, the output is sometimes gibberish. CAM::PDF bundles a [getpdftext.pl](http://search.cpan.org/dist/CAM-PDF/bin/getpdftext.pl) program, or y... | You could try Lucene (the Perl port is called Plucene). The searches are incredibly fast and I know that PDFBox already knows how to index PDF files with Lucene. PDFBox is Java, but chances are there is something very similar somewhere in CPAN. Even if you can't find something that already adds PDF files to a Lucene in... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | The PerlMonks thread [here](http://www.perlmonks.org/?node_id=582868) talks about this problem.
It seems that for your situation, it might be simplest to get **pdftotext** (the command line tool), then you can do something like:
```
my @search_results = `pdftotext myfile.pdf - | grep -i -l \"$string\"`;
``` | I second Adam Bellaire solution. I used pdftotext utility to create full-text index of my ebook library. It's somewhat slow but does its job. As for full-text, try PLucene or KinoSearch to store full-text index. |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | The PerlMonks thread [here](http://www.perlmonks.org/?node_id=582868) talks about this problem.
It seems that for your situation, it might be simplest to get **pdftotext** (the command line tool), then you can do something like:
```
my @search_results = `pdftotext myfile.pdf - | grep -i -l \"$string\"`;
``` | The easiest fulltext index/seach I've used is mysql. You just insert into the table with the appropriate index on it. You need to spend some time working out the relative weightings for fields (a match in the title might score higher than a match in the body), but this is all possible, albeit with some hairy sql.
Pluc... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | You may want to look at [PDF::Core](http://search.cpan.org/perldoc?PDF::Core). | You could try Lucene (the Perl port is called Plucene). The searches are incredibly fast and I know that PDFBox already knows how to index PDF files with Lucene. PDFBox is Java, but chances are there is something very similar somewhere in CPAN. Even if you can't find something that already adds PDF files to a Lucene in... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | I second Adam Bellaire solution. I used pdftotext utility to create full-text index of my ebook library. It's somewhat slow but does its job. As for full-text, try PLucene or KinoSearch to store full-text index. | The easiest fulltext index/seach I've used is mysql. You just insert into the table with the appropriate index on it. You need to spend some time working out the relative weightings for fields (a match in the title might score higher than a match in the body), but this is all possible, albeit with some hairy sql.
Pluc... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | My library, [CAM::PDF](http://search.cpan.org/dist/CAM-PDF/), has support for extracting text, but it's an inherently hard problem given the graphical orientation of PDF syntax. So, the output is sometimes gibberish. CAM::PDF bundles a [getpdftext.pl](http://search.cpan.org/dist/CAM-PDF/bin/getpdftext.pl) program, or y... | The easiest fulltext index/seach I've used is mysql. You just insert into the table with the appropriate index on it. You need to spend some time working out the relative weightings for fields (a match in the title might score higher than a match in the body), but this is all possible, albeit with some hairy sql.
Pluc... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | The PerlMonks thread [here](http://www.perlmonks.org/?node_id=582868) talks about this problem.
It seems that for your situation, it might be simplest to get **pdftotext** (the command line tool), then you can do something like:
```
my @search_results = `pdftotext myfile.pdf - | grep -i -l \"$string\"`;
``` | My library, [CAM::PDF](http://search.cpan.org/dist/CAM-PDF/), has support for extracting text, but it's an inherently hard problem given the graphical orientation of PDF syntax. So, the output is sometimes gibberish. CAM::PDF bundles a [getpdftext.pl](http://search.cpan.org/dist/CAM-PDF/bin/getpdftext.pl) program, or y... |
139,015 | I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
```
my @search_results = `grep -i -l \"$string\" *.pdf`;
```
where $string is the text to look for.
However this fails for most pdf's because the file... | 2008/09/26 | [
"https://Stackoverflow.com/questions/139015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22654/"
] | I second Adam Bellaire solution. I used pdftotext utility to create full-text index of my ebook library. It's somewhat slow but does its job. As for full-text, try PLucene or KinoSearch to store full-text index. | You could try Lucene (the Perl port is called Plucene). The searches are incredibly fast and I know that PDFBox already knows how to index PDF files with Lucene. PDFBox is Java, but chances are there is something very similar somewhere in CPAN. Even if you can't find something that already adds PDF files to a Lucene in... |
73,886,487 | In Spring Boot 2.7.4, the `WebSecurityConfigurerAdapter`class which contains the `authenticationManagerBean` function is deprecated
What is the alternative? | 2022/09/28 | [
"https://Stackoverflow.com/questions/73886487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14076156/"
] | I found that the alternative is the `getAuthenticationManager` function in the `AuthenticationConfiguration` class
```java
@Bean
protected SecurityFilterChain configure(final HttpSecurity http,
final AuthenticationManagerBuilder auth,
... | I have been facing the same problem as you these days, the only solution found is this
```
@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
return authenticationConfiguration.getAuthenticationManager();
}
```
But this is causing me a... |
24,756 | The title really asks it all: **When can a pilot disobey ATC commands?**.
Of course, the pilot has the final decision, but when would the pilot really disobey someone in ATC with much more knowledge of planes and other potential hazards near by? | 2016/01/29 | [
"https://aviation.stackexchange.com/questions/24756",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/11428/"
] | A pilot can break any rule in the book for the safety of the flight or those on the ground. Ultimately the safety of the flight rests with the pilot in command of the aircraft and therefore not just the right but the duty to diverge from ATC instructions if the situation warrants. Examples of this might be:
* A cabin ... | Others have talked about emergencies, which allows a pilot to take any action he sees fit. This is correct, and you could even argue that it's not really disobeying, as in the moment the emergency was declared, all clearances sort of went out the window.
There's one important part missing and that's the option for a p... |
24,756 | The title really asks it all: **When can a pilot disobey ATC commands?**.
Of course, the pilot has the final decision, but when would the pilot really disobey someone in ATC with much more knowledge of planes and other potential hazards near by? | 2016/01/29 | [
"https://aviation.stackexchange.com/questions/24756",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/11428/"
] | In case of emergencies, yes. The pilot in command has the final authority and responsibility for safety of the flight and can disobey ATC commands in case of emergencies. The reasons for that and the results will decide the consequences.
From [14 CFR §91.123 Compliance with ATC clearances and instructions](https://www... | Others have talked about emergencies, which allows a pilot to take any action he sees fit. This is correct, and you could even argue that it's not really disobeying, as in the moment the emergency was declared, all clearances sort of went out the window.
There's one important part missing and that's the option for a p... |
24,756 | The title really asks it all: **When can a pilot disobey ATC commands?**.
Of course, the pilot has the final decision, but when would the pilot really disobey someone in ATC with much more knowledge of planes and other potential hazards near by? | 2016/01/29 | [
"https://aviation.stackexchange.com/questions/24756",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/11428/"
] | To add one more case to what's been mentioned, if ATC tells you to climb to avoid a conflict and TCAS tells you to descend, pilots are required to follow the TCAS command rather than ATC's.
The reason behind this is that TCAS in the two aircraft can typically coordinate "behind the scenes" which aircraft will do what ... | Others have talked about emergencies, which allows a pilot to take any action he sees fit. This is correct, and you could even argue that it's not really disobeying, as in the moment the emergency was declared, all clearances sort of went out the window.
There's one important part missing and that's the option for a p... |
32,937,943 | I have a points table, where important columns are:
```
id userid orderid
1 10 150
2 10 150
3 15 151
4 12 152
5 11 152
```
I need to find all `orderid` which have multiple/various `userid`. The result w... | 2015/10/04 | [
"https://Stackoverflow.com/questions/32937943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386703/"
] | I had the same problem, I don't think that this is possible at the moment.
My solution was to generate a NuGet package with the target dll.
You will need to install NuGet command line and then:
```
nuget spec YourNameOrCompany.PackageName
```
This will generate a YourNameOrCompany.PackageName.nuspec, open the file ... | Try to use Nuget package as **@Mush** answered.
But thats not always work, because .NET Framework and .NET Core are incompatible.
In that case you will get error message:
`Package DLLNAME is not compatible with netcoreapp1.1`
Which means the package does not support netcoreapp1.1 instead it supports .NET Framework (... |
54,251,200 | Is it possible to use parallelism in Entity Framework's `DbContext`? Basically I have an application that adds thousands of records for each of the 4 tables that I have. And I am thinking that the best way to optimize it is to have the adding of records done in parallel.
```
public void Transact()
{
var context =... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54251200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6435817/"
] | Verbatim content is tricky. You have to ask yourself what the intent is. If it's printing code, then king of the hill would be [`listings`](//ctan.org/pkg/listings). I'd suggest that and define your own environment for large chunks of code-specific output.
Here's an example:
[:
```
\documentclass{article}
\newcommand{\scr}[1]{
\begin{minipage}{0.9\textwidth}
\fbox{
\parbox{\textwidth}{
... |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | It's not getting pushed an infinite number of times. It's a matter of how Firefox Developer Console **presents** the element. Expanding the array and clicking on it again, under itself, will always show you how the array looks like. So you can expand it and click it an infinite number of times, but still, it's there **... | Because the javascript gives the reference to the 'a' variable, and not the actual object, so if you push the a to itself, you push the memory address what hold the object, and it creates a circular reference.
[1, 2, *reference to this object*] |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | It is just pushed once. While the array is referencing itself ([circular refernce](https://en.wikipedia.org/wiki/Circular_reference)), you see more than one inserted arrays. The display is dependent of the browser.
If you try to get a [JSON](http://json.org/) string, then [`JSON.stringify`](https://developer.mozilla.o... | Because the javascript gives the reference to the 'a' variable, and not the actual object, so if you push the a to itself, you push the memory address what hold the object, and it creates a circular reference.
[1, 2, *reference to this object*] |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | You've created a circular reference.
When you push the array onto itself, the last element in the array becomes a reference to the entire array -- including that last element. So the last element in that last element is also a reference to the entire array, and so on.
It's infinite in the same sense that a circle is ... | Because the javascript gives the reference to the 'a' variable, and not the actual object, so if you push the a to itself, you push the memory address what hold the object, and it creates a circular reference.
[1, 2, *reference to this object*] |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | It's not getting pushed an infinite number of times. It's a matter of how Firefox Developer Console **presents** the element. Expanding the array and clicking on it again, under itself, will always show you how the array looks like. So you can expand it and click it an infinite number of times, but still, it's there **... | It is actually pushing it only one time. It doesn't push the array elements, but the address of the array. Firefox console just tries to show what's in there, but ends up showing the same thing infinitely.
Not just Firefox, Chrome also does that. |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | It is just pushed once. While the array is referencing itself ([circular refernce](https://en.wikipedia.org/wiki/Circular_reference)), you see more than one inserted arrays. The display is dependent of the browser.
If you try to get a [JSON](http://json.org/) string, then [`JSON.stringify`](https://developer.mozilla.o... | It is actually pushing it only one time. It doesn't push the array elements, but the address of the array. Firefox console just tries to show what's in there, but ends up showing the same thing infinitely.
Not just Firefox, Chrome also does that. |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | You've created a circular reference.
When you push the array onto itself, the last element in the array becomes a reference to the entire array -- including that last element. So the last element in that last element is also a reference to the entire array, and so on.
It's infinite in the same sense that a circle is ... | It is actually pushing it only one time. It doesn't push the array elements, but the address of the array. Firefox console just tries to show what's in there, but ends up showing the same thing infinitely.
Not just Firefox, Chrome also does that. |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | It is just pushed once. While the array is referencing itself ([circular refernce](https://en.wikipedia.org/wiki/Circular_reference)), you see more than one inserted arrays. The display is dependent of the browser.
If you try to get a [JSON](http://json.org/) string, then [`JSON.stringify`](https://developer.mozilla.o... | It's not getting pushed an infinite number of times. It's a matter of how Firefox Developer Console **presents** the element. Expanding the array and clicking on it again, under itself, will always show you how the array looks like. So you can expand it and click it an infinite number of times, but still, it's there **... |
45,612,366 | I have an `EMP` table in SQL Server that looks something like this
```
ID T_Date Jid Emp_Cost Con_Cost IsActive
--------------------------------------------------------
13178 null 214 0 0 0
12797 null 214 0 55 1
11906 null 214 ... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341159/"
] | It is just pushed once. While the array is referencing itself ([circular refernce](https://en.wikipedia.org/wiki/Circular_reference)), you see more than one inserted arrays. The display is dependent of the browser.
If you try to get a [JSON](http://json.org/) string, then [`JSON.stringify`](https://developer.mozilla.o... | You've created a circular reference.
When you push the array onto itself, the last element in the array becomes a reference to the entire array -- including that last element. So the last element in that last element is also a reference to the entire array, and so on.
It's infinite in the same sense that a circle is ... |
13,796,160 | I have a form with a table.
```
<form >
<div>
<table>
<tr>
<td > <input type="text" id="slno1" size="25" value="10" /> </td>
<td > <input type="text" id="data" size="10" value="this is a test" /> </td>
<td > <input type="radio" value="" id="edit1" name="sample" ... | 2012/12/10 | [
"https://Stackoverflow.com/questions/13796160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1530845/"
] | With JS you can get the position of the topmost window with `top.screenLeft` and `top.screenTop`. | Here's a cool way to do it. It's sorta animated
VBScript
Add this to global variables
```
Dim IntervalMovingWindow
```
then add this OnLoad routine
```
Sub Window_OnLoad
moveTo screen.availWidth/2-200 , screen.availHeight/2-100
IntervalMovingWindow= Setinterval ("MoveTheWindow",100)
End Sub
```
Then Add ... |
45,969,124 | I would like to convert windows .iso to .qcow2 format and use in openstack.
Tried using vbox:
<https://www.virtualbox.org/>
Not sure how to add cloud-init package to the OS, configure grub (steps 11&12)
Also tried using qemu-img commands in windows using ref <https://cloudbase.it/qemu-img-windows/>
able to convert im... | 2017/08/30 | [
"https://Stackoverflow.com/questions/45969124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8539472/"
] | ```
brew/apt install qemu
qemu-img convert xxx.iso xxx.qcow2
``` | I think you have to install it first before converting it, try to install it on virtualbox and then convert virtualbox image to qcow2.
Hope it will help |
45,969,124 | I would like to convert windows .iso to .qcow2 format and use in openstack.
Tried using vbox:
<https://www.virtualbox.org/>
Not sure how to add cloud-init package to the OS, configure grub (steps 11&12)
Also tried using qemu-img commands in windows using ref <https://cloudbase.it/qemu-img-windows/>
able to convert im... | 2017/08/30 | [
"https://Stackoverflow.com/questions/45969124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8539472/"
] | ```
brew/apt install qemu
qemu-img convert xxx.iso xxx.qcow2
``` | ```
qemu-img convert -O qcow2 virtio-win.iso virtio-win.qcow2
``` |
379,093 | Consider the case described below, from Peacock (1972). This passage seems to imply the young statistician is making a smart, correct statement.
But is he?
[](https://i.stack.imgur.com/53Ms6.jpg) | 2018/11/27 | [
"https://stats.stackexchange.com/questions/379093",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | As the statistician did not make any statements, he cannot be wrong. He just asked two questions: 1) Did you have controls? and 2) Which half?
The surgeon is clearly wrong, unless a) Every patient he treated survived and b) No patient who was not treated would survive (or, of course, vice versa).
Both the surgeon an... | This sounds a lot like that story about one of the sons in the fourth generation of the Pearson family, the one that became a paramedic. He used to not help half of his patients with a cardiac arrest in order to test whether helping or not helping was significantly helpful in order to get the heart beating again.
A g... |
379,093 | Consider the case described below, from Peacock (1972). This passage seems to imply the young statistician is making a smart, correct statement.
But is he?
[](https://i.stack.imgur.com/53Ms6.jpg) | 2018/11/27 | [
"https://stats.stackexchange.com/questions/379093",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | As the statistician did not make any statements, he cannot be wrong. He just asked two questions: 1) Did you have controls? and 2) Which half?
The surgeon is clearly wrong, unless a) Every patient he treated survived and b) No patient who was not treated would survive (or, of course, vice versa).
Both the surgeon an... | The statistician sounds like a frequentist, and he's correct if we view things in terms of measures of evidence. In particular, at this point we have no direct evidence in regards to the effectiveness of the surgeon's effectiveness.
Maybe surprising to most statisticians, the surgeon is taking more of a Bayesian pers... |
379,093 | Consider the case described below, from Peacock (1972). This passage seems to imply the young statistician is making a smart, correct statement.
But is he?
[](https://i.stack.imgur.com/53Ms6.jpg) | 2018/11/27 | [
"https://stats.stackexchange.com/questions/379093",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | As the statistician did not make any statements, he cannot be wrong. He just asked two questions: 1) Did you have controls? and 2) Which half?
The surgeon is clearly wrong, unless a) Every patient he treated survived and b) No patient who was not treated would survive (or, of course, vice versa).
Both the surgeon an... | The surgeon is right.
The people who suffered or died because they did not get this operation serve as a control group. It would be better to formalize this and quantify the improved performance (e.g. 70% mortality rate vs 10%), but we do have a group to which we can compare.
Now...if the surgeon is claiming that hi... |
379,093 | Consider the case described below, from Peacock (1972). This passage seems to imply the young statistician is making a smart, correct statement.
But is he?
[](https://i.stack.imgur.com/53Ms6.jpg) | 2018/11/27 | [
"https://stats.stackexchange.com/questions/379093",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | This sounds a lot like that story about one of the sons in the fourth generation of the Pearson family, the one that became a paramedic. He used to not help half of his patients with a cardiac arrest in order to test whether helping or not helping was significantly helpful in order to get the heart beating again.
A g... | The surgeon is right.
The people who suffered or died because they did not get this operation serve as a control group. It would be better to formalize this and quantify the improved performance (e.g. 70% mortality rate vs 10%), but we do have a group to which we can compare.
Now...if the surgeon is claiming that hi... |
379,093 | Consider the case described below, from Peacock (1972). This passage seems to imply the young statistician is making a smart, correct statement.
But is he?
[](https://i.stack.imgur.com/53Ms6.jpg) | 2018/11/27 | [
"https://stats.stackexchange.com/questions/379093",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | The statistician sounds like a frequentist, and he's correct if we view things in terms of measures of evidence. In particular, at this point we have no direct evidence in regards to the effectiveness of the surgeon's effectiveness.
Maybe surprising to most statisticians, the surgeon is taking more of a Bayesian pers... | The surgeon is right.
The people who suffered or died because they did not get this operation serve as a control group. It would be better to formalize this and quantify the improved performance (e.g. 70% mortality rate vs 10%), but we do have a group to which we can compare.
Now...if the surgeon is claiming that hi... |
20,223,188 | I am working on creating a very simple content management system... Unfortunately I'm failing to retrieve posts from my database. My error is:
>
> Notice: Undefined index: title in C:\wamp\www\NightOwlSoftware\index.php
>
>
>
```
<?php
include 'scripts/db_connect.php';
include 'scripts/functions.php';
sec_sessio... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20223188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2610750/"
] | If that's the only error you're getting (ie. date, tag, body all work fine), then you probably mis-typed something in the database creation, and don't actually have a `title` column as a result. Or maybe the column has a different name, like `name`, `subject` or `im_so_bored_i_dont_know_what_im_typing`... (sorry, I'm b... | You are getting an undefined index for `title` because there is no `title` in the array `$row`.
I would recommend you look over your DB structure for the table `blog` but I would also recommend doing some basic data checks in your `while` to ensure you render only the content that exists. Look this over:
```
<?php
in... |
20,223,188 | I am working on creating a very simple content management system... Unfortunately I'm failing to retrieve posts from my database. My error is:
>
> Notice: Undefined index: title in C:\wamp\www\NightOwlSoftware\index.php
>
>
>
```
<?php
include 'scripts/db_connect.php';
include 'scripts/functions.php';
sec_sessio... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20223188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2610750/"
] | If that's the only error you're getting (ie. date, tag, body all work fine), then you probably mis-typed something in the database creation, and don't actually have a `title` column as a result. Or maybe the column has a different name, like `name`, `subject` or `im_so_bored_i_dont_know_what_im_typing`... (sorry, I'm b... | If I could, I would've added this as a comment because this is not really an answer. I agree with other, that most likely - the column name in DB does not match what you have in the code.
In any case, when I am in situations like this, you could use debugger or use print\_r.
In your while loop, add the print\_r sta... |
485,948 | Does it make sense that entropy goes to infinity as temperature goes to infinity?
For an ideal monoatomic 1D gas I have an expression for entropy
\begin{equation}
S=Nk\_{B}Ln(\frac{Ve^{\frac{5}{2}}\sqrt{2\pi m k\_{B}T}}{N h})
\end{equation}
Where $N$ is the number of particles, $h$ the Planck's constant. $V$ the volume... | 2019/06/13 | [
"https://physics.stackexchange.com/questions/485948",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/186136/"
] | You may get answers based on statistical mechanics that are more helpful in resolving your confusion (higher temperature means a steadily increasing number of accessible states), but let me just mention a couple of relations from classical thermodynamics.
Firstly, for the ideal gas, the heat capacity at constant volu... | >
> Does it make sense that entropy goes to infinity as temperature goes to infinity?
>
>
>
At constant volume it makes sense for the entropy to increase with temperature since, at constant volume:
$$
dS = \frac{dU}{T}
$$
and $T$ is positive and we expect $U$ to increase with increasing $T$. However, this does *no... |
485,948 | Does it make sense that entropy goes to infinity as temperature goes to infinity?
For an ideal monoatomic 1D gas I have an expression for entropy
\begin{equation}
S=Nk\_{B}Ln(\frac{Ve^{\frac{5}{2}}\sqrt{2\pi m k\_{B}T}}{N h})
\end{equation}
Where $N$ is the number of particles, $h$ the Planck's constant. $V$ the volume... | 2019/06/13 | [
"https://physics.stackexchange.com/questions/485948",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/186136/"
] | You may get answers based on statistical mechanics that are more helpful in resolving your confusion (higher temperature means a steadily increasing number of accessible states), but let me just mention a couple of relations from classical thermodynamics.
Firstly, for the ideal gas, the heat capacity at constant volu... | It's because kinetic energy, unlike most other forms of energy, is unbounded from above. It can increase without limit. This implies that the heat capacity need not fall to zero as the temperature goes up, and this is confirmed when we look at phase space and the available momentum states. There are more and more state... |
21,000,888 | I want when mouse goes on `li` jquery add a class to the element:
```
<ul class="menu">
<li>Menu Item</li>
<li>Menu Item</li>
<li>Menu Item</li>
<li>Menu Item</li>
</ul>
<script type="text/javascript">
var myMenu = $('.menu').children('li');
myMenu.on({
mouseenter: function() { $( this ).addClass( "is_hove... | 2014/01/08 | [
"https://Stackoverflow.com/questions/21000888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3173809/"
] | Don't use the mouseleave handler in that case, on mouseenter remove the hovered class from other elements
```
var myMenu = $('.menu li');
myMenu.mouseenter(function () {
myMenu.filter('.is_hovered').removeClass("is_hovered");
$(this).addClass("is_hovered");
});
```
Demo: [Fiddle](http://jsfiddle.net/arunpjo... | This will work, when you mouse over li it will add `is_hovered` to li and remove from other li.
```
$(".menu li").mouseover(function(){
$(".menu li").removeClass("is_hovered");
$(this).addClass("is_hovered");
});
``` |
2,095,071 | I am having trouble forming the proof for the following:
Let m>0. We can define operation \* on the equivalence classes of m as follows:
[a]m\*[b]m=[a\*b]m (The m's are subscripts)
---
As an example, we are given the proof for the "+" operation:
[a]m+[b]m=[a+b]m
Proof: We have to show the fns we've claimed to defi... | 2017/01/12 | [
"https://math.stackexchange.com/questions/2095071",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/406400/"
] | HINT: If you're given a word and you change the last letter, what happens to the number of zeros?
---
EDIT: This hint can give the answer without induction. Let $E\_n$ be the number of words of length $n$ with an even number of $0$'s and $O\_n$ the number of words of length $n$ with an odd number of $0$'s. Define $\p... | Two cases: If $n$ is odd, then any word of length $n$ containing an odd number of zeros is a word containing an even number of ones. So under the mapping that turns every one into a zero and every zero into a one, every word that contains an odd number of zeros corresponds to a word with an even number of zeros. That i... |
2,095,071 | I am having trouble forming the proof for the following:
Let m>0. We can define operation \* on the equivalence classes of m as follows:
[a]m\*[b]m=[a\*b]m (The m's are subscripts)
---
As an example, we are given the proof for the "+" operation:
[a]m+[b]m=[a+b]m
Proof: We have to show the fns we've claimed to defi... | 2017/01/12 | [
"https://math.stackexchange.com/questions/2095071",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/406400/"
] | What you are considering are numbers $0000\dots0$ to $1111\dots1$ in binary. Indeed in total there are $2^n$ numbers.
Now, notice it is true for $n=1$. Assume it might be true for the number before your favourite natural number $k-1$.
Now, consider the possibilities for $k$. The last digit is either $0$ or $1$. So ... | Two cases: If $n$ is odd, then any word of length $n$ containing an odd number of zeros is a word containing an even number of ones. So under the mapping that turns every one into a zero and every zero into a one, every word that contains an odd number of zeros corresponds to a word with an even number of zeros. That i... |
2,095,071 | I am having trouble forming the proof for the following:
Let m>0. We can define operation \* on the equivalence classes of m as follows:
[a]m\*[b]m=[a\*b]m (The m's are subscripts)
---
As an example, we are given the proof for the "+" operation:
[a]m+[b]m=[a+b]m
Proof: We have to show the fns we've claimed to defi... | 2017/01/12 | [
"https://math.stackexchange.com/questions/2095071",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/406400/"
] | A proof by induction could be done:
If $n=1, 2^n = 2^0 = 1$ and $1$ word of length $1$ has an even amount of $0$s, which is the word $1$.
Now imagine you have a sequence of length $k-1$. If it has an odd number of $0$s, then you can append a $0$ to the end of it. If it has an even number of $0$s, you can append a $1$... | Two cases: If $n$ is odd, then any word of length $n$ containing an odd number of zeros is a word containing an even number of ones. So under the mapping that turns every one into a zero and every zero into a one, every word that contains an odd number of zeros corresponds to a word with an even number of zeros. That i... |
32,720,527 | I have a loop:
```
result = []
list = ['a', 'b', 'c', 'd', 'e', 'f']
start = 2
step = 5
end = start + step*len(list)
for i in range(start, end, step):
result.append(list[i%len(list)])
print result
```
in this case, the result would be:
```
['c', 'b', 'a', 'f', 'e', 'd']
```
But let's say, i wanted the result ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363349/"
] | You could write your own generator for this sort of thing:
```
from itertools import cycle
def super_range(start, stop, steps):
csteps = cycle(steps)
val = start
while val < stop:
yield val
val += next(csteps)
```
And the usage would look something like:
```
for i in super_range(start, e... | A very simple solution would be to use a separate variable to indicate the index to get from your list , and increase that index manually according to your steps. Example -
```
lst = ['a', 'b', 'c', 'd', 'e', 'f']
i = 1
new_lst = []
for j in range(len(lst)):
new_lst.append(lst[i%len(lst)])
if j%2 == 0:
... |
32,720,527 | I have a loop:
```
result = []
list = ['a', 'b', 'c', 'd', 'e', 'f']
start = 2
step = 5
end = start + step*len(list)
for i in range(start, end, step):
result.append(list[i%len(list)])
print result
```
in this case, the result would be:
```
['c', 'b', 'a', 'f', 'e', 'd']
```
But let's say, i wanted the result ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363349/"
] | A very simple solution would be to use a separate variable to indicate the index to get from your list , and increase that index manually according to your steps. Example -
```
lst = ['a', 'b', 'c', 'd', 'e', 'f']
i = 1
new_lst = []
for j in range(len(lst)):
new_lst.append(lst[i%len(lst)])
if j%2 == 0:
... | Is it a `while` loop rather than a `for` loop? I.e. one when you don't know how many trips around the loop it'll take, but have a good reason to believe that something will terminate the loop. Outline code:
```
i, inc, newlst = 1, 2, []
while i < len(lst) and i >= 0:
newlst.append( lst[i] )
# if some_condition: in... |
32,720,527 | I have a loop:
```
result = []
list = ['a', 'b', 'c', 'd', 'e', 'f']
start = 2
step = 5
end = start + step*len(list)
for i in range(start, end, step):
result.append(list[i%len(list)])
print result
```
in this case, the result would be:
```
['c', 'b', 'a', 'f', 'e', 'd']
```
But let's say, i wanted the result ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363349/"
] | You could write your own generator for this sort of thing:
```
from itertools import cycle
def super_range(start, stop, steps):
csteps = cycle(steps)
val = start
while val < stop:
yield val
val += next(csteps)
```
And the usage would look something like:
```
for i in super_range(start, e... | Based on what you want to do instead of iterating and changing the step you can use and python built-in function or `itertools` module. In this case you can sue `zip` function and `iterools.chain`:
```
>>> list(chain.from_iterable((j,i) for i,j in zip(li[0::2],li[1::2])))
['b', 'a', 'd', 'c', 'f', 'e']
```
In other ... |
32,720,527 | I have a loop:
```
result = []
list = ['a', 'b', 'c', 'd', 'e', 'f']
start = 2
step = 5
end = start + step*len(list)
for i in range(start, end, step):
result.append(list[i%len(list)])
print result
```
in this case, the result would be:
```
['c', 'b', 'a', 'f', 'e', 'd']
```
But let's say, i wanted the result ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363349/"
] | You could write your own generator for this sort of thing:
```
from itertools import cycle
def super_range(start, stop, steps):
csteps = cycle(steps)
val = start
while val < stop:
yield val
val += next(csteps)
```
And the usage would look something like:
```
for i in super_range(start, e... | Is it a `while` loop rather than a `for` loop? I.e. one when you don't know how many trips around the loop it'll take, but have a good reason to believe that something will terminate the loop. Outline code:
```
i, inc, newlst = 1, 2, []
while i < len(lst) and i >= 0:
newlst.append( lst[i] )
# if some_condition: in... |
32,720,527 | I have a loop:
```
result = []
list = ['a', 'b', 'c', 'd', 'e', 'f']
start = 2
step = 5
end = start + step*len(list)
for i in range(start, end, step):
result.append(list[i%len(list)])
print result
```
in this case, the result would be:
```
['c', 'b', 'a', 'f', 'e', 'd']
```
But let's say, i wanted the result ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363349/"
] | Based on what you want to do instead of iterating and changing the step you can use and python built-in function or `itertools` module. In this case you can sue `zip` function and `iterools.chain`:
```
>>> list(chain.from_iterable((j,i) for i,j in zip(li[0::2],li[1::2])))
['b', 'a', 'd', 'c', 'f', 'e']
```
In other ... | Is it a `while` loop rather than a `for` loop? I.e. one when you don't know how many trips around the loop it'll take, but have a good reason to believe that something will terminate the loop. Outline code:
```
i, inc, newlst = 1, 2, []
while i < len(lst) and i >= 0:
newlst.append( lst[i] )
# if some_condition: in... |
10,786,623 | Okay.. I am completely new to this PDO stuff.. I have tried to recreate my mysql script (working) to a PDO script (not working).. I have tested that my DB login informations is correctly programmed for PDO..
This is my PDO script...
```
<?
session_start();
//connect to DB
require_once("connect.php");
//get the post... | 2012/05/28 | [
"https://Stackoverflow.com/questions/10786623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1421945/"
] | The second `factorial` function always returns `1`. The code is built to use an accumulator variable (`acc`), and the first code block gets it right by returning this accumulator variable.
A `factorial` function can be written to return `1`, though, if an accumulator variable is not used. Since this method does not ut... | it's hard to work out what you think should be happening for the question to make sense.
i think maybe you think `loop` is doing more than it does? your code is almost equivalent to:
```
(defn factorial
([n] (factorial n 1)
([n acc]
(if (zero? n)
acc
(recur (dec n) (* n acc)))))
```
which is a ... |
4,860,166 | I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newe... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4860166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205234/"
] | Rather than making a bare clone, I prefer making a **[bundle](http://schacon.github.com/git/git-bundle.html)** (see "[How can I email someone a git repository?](https://stackoverflow.com/questions/2545765/how-can-i-email-someone-a-git-repository/2545784#2545784)"), which generates *one* file, easier to copy around (on ... | See [this blog post "Synchronizing Git repositories without a server "](http://blog.costan.us/2009/02/synchronizing-git-repositories-without.html) (by [Victor Costan](http://www.blogger.com/profile/13804381550088697006)).
>
> This post describes a method for pushing changes between two repositories without using a se... |
4,860,166 | I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newe... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4860166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205234/"
] | See [this blog post "Synchronizing Git repositories without a server "](http://blog.costan.us/2009/02/synchronizing-git-repositories-without.html) (by [Victor Costan](http://www.blogger.com/profile/13804381550088697006)).
>
> This post describes a method for pushing changes between two repositories without using a se... | Direct copy of a repository to the other file system is an alternative to bare clone or to bundle. After copying you can set the copied repo up directly as a local remote - unintuitive as local remote may seem - to fetch and merge into the first repository.
I.e. to merge repo2 from a second computer into ~/repo1, fir... |
4,860,166 | I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newe... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4860166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205234/"
] | See [this blog post "Synchronizing Git repositories without a server "](http://blog.costan.us/2009/02/synchronizing-git-repositories-without.html) (by [Victor Costan](http://www.blogger.com/profile/13804381550088697006)).
>
> This post describes a method for pushing changes between two repositories without using a se... | I'd just like to add a little twist to things. The information in other posts seems right, but I'd like to mention a few extra things I do in practice.
If I do
```
git remote -v
```
I get information like this
```
USB_F file:///f/Git_repositories/projectname.git (fetch)
USB_F file:///f/Git_repositories/project... |
4,860,166 | I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newe... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4860166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205234/"
] | Rather than making a bare clone, I prefer making a **[bundle](http://schacon.github.com/git/git-bundle.html)** (see "[How can I email someone a git repository?](https://stackoverflow.com/questions/2545765/how-can-i-email-someone-a-git-repository/2545784#2545784)"), which generates *one* file, easier to copy around (on ... | Direct copy of a repository to the other file system is an alternative to bare clone or to bundle. After copying you can set the copied repo up directly as a local remote - unintuitive as local remote may seem - to fetch and merge into the first repository.
I.e. to merge repo2 from a second computer into ~/repo1, fir... |
4,860,166 | I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newe... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4860166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205234/"
] | Rather than making a bare clone, I prefer making a **[bundle](http://schacon.github.com/git/git-bundle.html)** (see "[How can I email someone a git repository?](https://stackoverflow.com/questions/2545765/how-can-i-email-someone-a-git-repository/2545784#2545784)"), which generates *one* file, easier to copy around (on ... | I'd just like to add a little twist to things. The information in other posts seems right, but I'd like to mention a few extra things I do in practice.
If I do
```
git remote -v
```
I get information like this
```
USB_F file:///f/Git_repositories/projectname.git (fetch)
USB_F file:///f/Git_repositories/project... |
4,860,166 | I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newe... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4860166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205234/"
] | Direct copy of a repository to the other file system is an alternative to bare clone or to bundle. After copying you can set the copied repo up directly as a local remote - unintuitive as local remote may seem - to fetch and merge into the first repository.
I.e. to merge repo2 from a second computer into ~/repo1, fir... | I'd just like to add a little twist to things. The information in other posts seems right, but I'd like to mention a few extra things I do in practice.
If I do
```
git remote -v
```
I get information like this
```
USB_F file:///f/Git_repositories/projectname.git (fetch)
USB_F file:///f/Git_repositories/project... |
19,852,385 | I am trying to write 2 functions for a single click action, based on the screen width:
```
$(".view_offer_wrapper").click(function(){
var current = $(".compare_wrapper div:last-child").index(this);
$(".product_desc_expand").hide();
});
if ($(window).width() < 480) {
// Different action for same click functi... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19852385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2358234/"
] | The first solution is to check the condition within the click handler
```
$(".view_offer_wrapper").click(function () {
if ($(window).width() < 480) {
//action 1
} else {
//action2
var current = $(".compare_wrapper div:last-child").index(this);
$(".product_desc_expand").hide();
... | Try this
```
$(".view_offer_wrapper").click(function(){
if ($(window).width() < 480) {
alert('width less than 480');
}
else
{
alert('width grater than 480');
}
});
```
You can use **if else** inside click function. |
45,569,682 | I am new to Hadoop and Spark. I am using Spark-2.1.1-bin-hadoop2.7. Using SparkR I want to load (read) data from Hadoop 2.7.3 HDFS.
I know, I can point to my Hadoop file using "hdfs://somepath-to-my-file" but I could not find a function in SparkR to do the job. read.df() doesn't work.
I am using sparkR.session() to ... | 2017/08/08 | [
"https://Stackoverflow.com/questions/45569682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4816088/"
] | It seems that you have copied that line including typographic (?) quotes. Have a look at the output:
>
> resolving cookbooks for run list: ["“apache::server”"]
>
>
>
So fix those quotes in your shell command:
```
$ sudo chef-client -z --runlist "apache::server"
``` | Try with
```
chef-client -z -o apache
``` |
53,877,447 | I'm using `"laravel/lumen-framework": "5.7.*"`
I have two middlewares, first one `AuthTokenAuthenticate` that should be applied to all the routes, so its defined in `bootstrap/app.php` like
```
$app->middleware([
App\Http\Middleware\AuthTokenAuthenticate::class
]);
```
Another middleware is defined like
```
$... | 2018/12/20 | [
"https://Stackoverflow.com/questions/53877447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5329658/"
] | I don't think this is possible in Lumen in the way you want to. What I suggest is using the middleware alongside the [router group middleware options](https://lumen.laravel.com/docs/5.7/routing#route-group-middleware).
---
Remove the global middleware registration
*/bootstrap/app.php*
```
$app->middleware([
//A... | As of now with Lumen v6 (and possibly earlier), you can specify the middleware as an array field when defining your route. In the routes file `web.php`, I have something like the following:
```
$router->get('/api/path/to/thing', [
'uses' => 'FooController@index',
'middleware' => ['etag', 'caching', 'bar']
]);
... |
39,399,338 | I have an array of select boxes, with a unique id like this.
```
<select class="taskcompleted" id="c392018">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
```
I have a JSON in the format
```
{"id":"c392018","value":"Yes"}
```
I am using the following Javascript to set the selecte... | 2016/09/08 | [
"https://Stackoverflow.com/questions/39399338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813813/"
] | If you are just trying to trigger a repair of Smart Ink there are easier approaches. Msiexec allows you to [pass it the guid for the ProductId](https://technet.microsoft.com/en-us/library/bb490936.aspx) instead of a path to an msi. All you need to do is get the guid which should remain the same for all installations of... | Try this...
```
$localPackageName = 'localPackageName'
$command = 'C:\windows\system32\MSIExec.exe /f'
get-wmiobject -class win32_product -filter "name = 'smart ink'" | select-object localpackage -outvariable localPackageName
$packageName = $localPackageName.localpackage
$string = '{0} {1}' -f $command, $packageNam... |
4,242,798 | We have an add in for VS that currently is launched from the tools menu, the add-in consists of a a UI offering the user a few option buttons, which I now want to convert to a top-level menu that would offer the same functionality.
I've read [this](http://msdn.microsoft.com/en-us/library/bb165473.aspx) tutorial, whic... | 2010/11/22 | [
"https://Stackoverflow.com/questions/4242798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428489/"
] | I haven't tried doing hierarchical menu items, but I have had similar problems with the Visual SDK .vcst file. It is a pain. A couple of things you can do.
1. Install the VS Package Editor to Visual Studio Blog Entry for it: <http://blogs.msdn.com/b/visualstudio/archive/2010/09/08/introducing-the-vspackage-builder.as... | **Code example**
```
<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="...">
<!-- Extern section unchanged -->
<Commands package="guidHowToPackagePkg">
<Menus>
<!-- New menu added -->
<Menu guid="guidBasicVSCTSampleCmdSet" id="SubMenu" priority="0x200"
type="Menu">
<Parent... |
4,242,798 | We have an add in for VS that currently is launched from the tools menu, the add-in consists of a a UI offering the user a few option buttons, which I now want to convert to a top-level menu that would offer the same functionality.
I've read [this](http://msdn.microsoft.com/en-us/library/bb165473.aspx) tutorial, whic... | 2010/11/22 | [
"https://Stackoverflow.com/questions/4242798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428489/"
] | I haven't tried doing hierarchical menu items, but I have had similar problems with the Visual SDK .vcst file. It is a pain. A couple of things you can do.
1. Install the VS Package Editor to Visual Studio Blog Entry for it: <http://blogs.msdn.com/b/visualstudio/archive/2010/09/08/introducing-the-vspackage-builder.as... | I assume that nowadays by "add-in" you mean an extension that is a VS package (using the VS SDK) because an "add-in" was an older form of extension for VS 2013 and lower. (If you really mean an "add-in" then see my sample [HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in](https://www... |
4,242,798 | We have an add in for VS that currently is launched from the tools menu, the add-in consists of a a UI offering the user a few option buttons, which I now want to convert to a top-level menu that would offer the same functionality.
I've read [this](http://msdn.microsoft.com/en-us/library/bb165473.aspx) tutorial, whic... | 2010/11/22 | [
"https://Stackoverflow.com/questions/4242798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428489/"
] | I assume that nowadays by "add-in" you mean an extension that is a VS package (using the VS SDK) because an "add-in" was an older form of extension for VS 2013 and lower. (If you really mean an "add-in" then see my sample [HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in](https://www... | **Code example**
```
<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="...">
<!-- Extern section unchanged -->
<Commands package="guidHowToPackagePkg">
<Menus>
<!-- New menu added -->
<Menu guid="guidBasicVSCTSampleCmdSet" id="SubMenu" priority="0x200"
type="Menu">
<Parent... |
72,225,209 | I made a method that search through an array list of objects. Then if the searchKey is found in the array list it will print this certain item.
Here is how I iterate through the array list if it contains the searchKey, but I just realized that it is impossible to compare a string and an object.
```
for(int x = 0; x <... | 2022/05/13 | [
"https://Stackoverflow.com/questions/72225209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18890007/"
] | You need to compare the one property; also you can use a for-each loop to simplify the code
```java
for(Student s : Student.students){
if(s.getName().equals(searchKey))
System.out.print(s);
}
```
---
Note :
When you use a condition `Student.students.contains(searchKey)` in a loop, and it doesn't use th... | You already know comparing Object to String makes no sense. So, most probably what you are trying to do is check if any of the attributes of your Student object(name/course/year etc) has a value that matches your search key. To do that you need to convert your object into a String.
Add a **toString** method to your St... |
72,225,209 | I made a method that search through an array list of objects. Then if the searchKey is found in the array list it will print this certain item.
Here is how I iterate through the array list if it contains the searchKey, but I just realized that it is impossible to compare a string and an object.
```
for(int x = 0; x <... | 2022/05/13 | [
"https://Stackoverflow.com/questions/72225209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18890007/"
] | You need to compare the one property; also you can use a for-each loop to simplify the code
```java
for(Student s : Student.students){
if(s.getName().equals(searchKey))
System.out.print(s);
}
```
---
Note :
When you use a condition `Student.students.contains(searchKey)` in a loop, and it doesn't use th... | You haven't defined what 'contains' means here but I'm going to assume that it means a Student contains the key if it appears as a substring in any of its String members. So let's start with a method that does that. We can define this as part of the Student class itself.
```
public class Student {
.... other stuff .... |
72,225,209 | I made a method that search through an array list of objects. Then if the searchKey is found in the array list it will print this certain item.
Here is how I iterate through the array list if it contains the searchKey, but I just realized that it is impossible to compare a string and an object.
```
for(int x = 0; x <... | 2022/05/13 | [
"https://Stackoverflow.com/questions/72225209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18890007/"
] | You haven't defined what 'contains' means here but I'm going to assume that it means a Student contains the key if it appears as a substring in any of its String members. So let's start with a method that does that. We can define this as part of the Student class itself.
```
public class Student {
.... other stuff .... | You already know comparing Object to String makes no sense. So, most probably what you are trying to do is check if any of the attributes of your Student object(name/course/year etc) has a value that matches your search key. To do that you need to convert your object into a String.
Add a **toString** method to your St... |
69,830,956 | I want to create a function that checks, if a specific time is between two timestamps that are stored in a MySQL database.
The function should be able to ignore the time (`$fullday = true`) or check the time as well.
My presence table has a row with `start = 2021-11-01 10:00:00` and `end = 2021-11-05 18:00:00`.
`is_... | 2021/11/03 | [
"https://Stackoverflow.com/questions/69830956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17023379/"
] | You should be able to simplify this dramatically by getting MySQl to do more of the work. You don't need to format DATETIME columns to do comparisons on them, and BETWEEN will further reduce your PHP effort.
Based on your code above I think this will do the job:
```
function is_available($date, $fullDay = false) {
... | My approach would be to use `strtotime()` function to convert the date into an **int** and then convert the other date from the **db** and then compare those **ints** in php.
```
if($datenow > $dbstartdate && $datenow < $dbenddate){
return true;
}else{
return false;
}
``` |
228,492 | I converted a .tif file into a tileset using the gdal2tiles plugin on QGIS. The resulting files are a bunch of .png files, .html files and a .xml file. I zipped these and tried uploading them to Carto but got the error that the file types were not supported.
What am I doing wrong? How does one upload these tiles? | 2017/02/15 | [
"https://gis.stackexchange.com/questions/228492",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/91630/"
] | CARTO is a location intelligence platform aimed to store vector datasets you want to visualize and analyze. CARTO does not support uploading tilesets. You need to publish them elsewhere on a static web service hosting and then if they fit the technical requirements (projection and so on) you'll be able to add them as a... | You can't import directly file formats such as .png, .html or .xml to CARTO due to those are not supported formats (In [this section](https://carto.com/docs/carto-engine/import-api/importing-geospatial-data#supported-geospatial-data-formats) of the documentation of CARTO, you can find detailed information about the sup... |
23,849,070 | The Windows Phone Toolkit for Windows Phone 8.0 has a control called LongListMultiSelector that offers a really cool way to select items. It shifts the item content to the right slightly so users can tap that area in order to select that item. The default e-mail application has the exact behavior I want to achieve.
I'... | 2014/05/24 | [
"https://Stackoverflow.com/questions/23849070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1462485/"
] | There's no reason to implement your DataTemplate with a CheckBox. ListView already supports multiple selection mode, and has supported it since WinRT and Windows 8.
Essentially, all you need to do is change the SelectionMode to multiple, and the CheckBoxes will appear on the left just like you're used to with LongList... | @konikos, @Benjamin Diele
This in the XAML
```
<ListView SelectionMode="Single" SelectionChanged="ListMovimentos_OnSelectionChanged" Padding="0 0 0 40" ItemsSource="{Binding ListMovimentos}" ItemContainerStyle="{StaticResource ListItemsContainerGeneric}" x:Name="ListMovimentos"></ListView>
```
and this in the c... |
14,160,461 | I know that there are a lot of similar questions, but I cannot really fix it.
I've lost a week and I'm still at square one.
I'm trying to export a very basic app that perform a login on Facebook. The code is the same code as in the sample.
It works in debug but exporting it returns the error `Dalvik format failed with... | 2013/01/04 | [
"https://Stackoverflow.com/questions/14160461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1230711/"
] | My problem was solved by doing this :
**Uncheck** `Project -> Build Automatically`
Now export your apk. It should work without any problem. | See ["Conversion to Dalvik format failed with error 1" on external JAR](https://stackoverflow.com/questions/2680827/conversion-to-dalvik-format-failed-with-error-1-on-external-jar)
>
> Go to Project » Properties » Java Build Path » Libraries and remove
> all except the "Android X.Y" (in my case Android 1.5). click ... |
14,160,461 | I know that there are a lot of similar questions, but I cannot really fix it.
I've lost a week and I'm still at square one.
I'm trying to export a very basic app that perform a login on Facebook. The code is the same code as in the sample.
It works in debug but exporting it returns the error `Dalvik format failed with... | 2013/01/04 | [
"https://Stackoverflow.com/questions/14160461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1230711/"
] | My problem was solved by doing this :
**Uncheck** `Project -> Build Automatically`
Now export your apk. It should work without any problem. | I was having this problem too with an app that used Facebook SDK. I was trying all sorts of stuff, so I'm not sure what exactly fixed but here's settings that worked for me:
FacebookSDK > Properties > Java Build Path > Order and Export
Android 2.2 - NOT CHECKED
Android Private Libraries - CHECKED
Android Dependenci... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.