qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
9,571,231 | I know how to use preg\_match and preg\_match\_all to find the actual matches of regex patterns in a given string, but the function that I am writing not only needs the text of the matches, but to be able to traverse the string AROUND the matches...
Therefore, I need to know the position of the match in the string, ba... | 2012/03/05 | [
"https://Stackoverflow.com/questions/9571231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54408/"
] | You can use the flag [`PREG_OFFSET_CAPTURE`](http://php.net/manual/en/function.preg-match.php) for that:
```
preg_match('/bar/', 'Foobar', $matches, PREG_OFFSET_CAPTURE);
var_export($matches);
```
Result is:
```
array (
0 =>
array (
0 => 'bar',
1 => 3, // <-- the string offset of the match
),
)
... | With use of PREG\_OFFSET\_CAPTURE on preg\_match() you will get number of times on matches on pattern. When there is a match this will have the offset value which starts from 0.
Using this value you can call preg\_match again using offset parameter. |
9,571,231 | I know how to use preg\_match and preg\_match\_all to find the actual matches of regex patterns in a given string, but the function that I am writing not only needs the text of the matches, but to be able to traverse the string AROUND the matches...
Therefore, I need to know the position of the match in the string, ba... | 2012/03/05 | [
"https://Stackoverflow.com/questions/9571231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54408/"
] | preg\_match has an optional flag, `PREG_OFFSET_CAPTURE`, that records the string position of the match's occurence in the original 'haystack'. See the 'flags' section: <http://php.net/preg_match> | With use of PREG\_OFFSET\_CAPTURE on preg\_match() you will get number of times on matches on pattern. When there is a match this will have the offset value which starts from 0.
Using this value you can call preg\_match again using offset parameter. |
13,608,394 | I'm searching for a php algorithm that efficiently test if one cidr notated network overlaps another.
Basically I have the following situation:
Array of cidr adresses:
```
$cidrNetworks = array(
'192.168.10.0/24',
'10.10.0.30/20',
etc.
);
```
I have a method that adds networks to the array, but this me... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13608394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472389/"
] | As discussed briefly in PHP chat, here's how I would implement it, to compare any two addresses.
1. Convert the IP addresses to their binary form
2. Extract the masks from the CIDR format
3. Take the minimum mask of the two (least specific =
contains more addresses)
4. Use the mask on both binary representations.
5. C... | Intuitively I would suggest you'd want to do something like:
1. Let the new entry be `X`
2. Convert `X` to single integer form, let that integer be `Y`
3. Let mask length of any entry `A` be `mask(A)`
4. Compare any existing entries where `mask(entry) = mask(Y)`
5. Mask off existing entries where `mask(entry) > mask(Y... |
13,608,394 | I'm searching for a php algorithm that efficiently test if one cidr notated network overlaps another.
Basically I have the following situation:
Array of cidr adresses:
```
$cidrNetworks = array(
'192.168.10.0/24',
'10.10.0.30/20',
etc.
);
```
I have a method that adds networks to the array, but this me... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13608394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472389/"
] | Here is an updated version of the class previously discussed in chat. It can do what you require, as well as many other useful things.
```
<?php
class IPv4Subnet implements ArrayAccess, Iterator {
/*
* Address format constants
*/
const ADDRESS_BINARY = 0x01;
const ADDRES... | Intuitively I would suggest you'd want to do something like:
1. Let the new entry be `X`
2. Convert `X` to single integer form, let that integer be `Y`
3. Let mask length of any entry `A` be `mask(A)`
4. Compare any existing entries where `mask(entry) = mask(Y)`
5. Mask off existing entries where `mask(entry) > mask(Y... |
13,608,394 | I'm searching for a php algorithm that efficiently test if one cidr notated network overlaps another.
Basically I have the following situation:
Array of cidr adresses:
```
$cidrNetworks = array(
'192.168.10.0/24',
'10.10.0.30/20',
etc.
);
```
I have a method that adds networks to the array, but this me... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13608394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472389/"
] | As discussed briefly in PHP chat, here's how I would implement it, to compare any two addresses.
1. Convert the IP addresses to their binary form
2. Extract the masks from the CIDR format
3. Take the minimum mask of the two (least specific =
contains more addresses)
4. Use the mask on both binary representations.
5. C... | ```
<?php
function checkOverlap ($net1, $net2) {
$mask1 = explode("/", $net1)[1];
$net1 = explode("/", $net1)[0];
$netArr1 = explode(".",$net1);
$mask2 = explode("/", $net2)[1];
$net2 = explode("/", $net2)[0];
$netArr2 = explode(".",$net2);
$newnet1 = $newn... |
13,608,394 | I'm searching for a php algorithm that efficiently test if one cidr notated network overlaps another.
Basically I have the following situation:
Array of cidr adresses:
```
$cidrNetworks = array(
'192.168.10.0/24',
'10.10.0.30/20',
etc.
);
```
I have a method that adds networks to the array, but this me... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13608394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472389/"
] | Here is an updated version of the class previously discussed in chat. It can do what you require, as well as many other useful things.
```
<?php
class IPv4Subnet implements ArrayAccess, Iterator {
/*
* Address format constants
*/
const ADDRESS_BINARY = 0x01;
const ADDRES... | As discussed briefly in PHP chat, here's how I would implement it, to compare any two addresses.
1. Convert the IP addresses to their binary form
2. Extract the masks from the CIDR format
3. Take the minimum mask of the two (least specific =
contains more addresses)
4. Use the mask on both binary representations.
5. C... |
13,608,394 | I'm searching for a php algorithm that efficiently test if one cidr notated network overlaps another.
Basically I have the following situation:
Array of cidr adresses:
```
$cidrNetworks = array(
'192.168.10.0/24',
'10.10.0.30/20',
etc.
);
```
I have a method that adds networks to the array, but this me... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13608394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472389/"
] | Here is an updated version of the class previously discussed in chat. It can do what you require, as well as many other useful things.
```
<?php
class IPv4Subnet implements ArrayAccess, Iterator {
/*
* Address format constants
*/
const ADDRESS_BINARY = 0x01;
const ADDRES... | ```
<?php
function checkOverlap ($net1, $net2) {
$mask1 = explode("/", $net1)[1];
$net1 = explode("/", $net1)[0];
$netArr1 = explode(".",$net1);
$mask2 = explode("/", $net2)[1];
$net2 = explode("/", $net2)[0];
$netArr2 = explode(".",$net2);
$newnet1 = $newn... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | To read an .jpg file from non-relative path you could use this:
```
BufferedImage img = null;
try
{
img = ImageIO.read(new File("C:/ImageTest/pic2.jpg")); // eventually C:\\ImageTest\\pic2.jpg
}
catch (IOException e)
{
e.printStackTrace();
}
```
I do not have any Java environment at the moment, so hope i... | `getResource` & `getResourceAsStream` do not work with file paths, but paths relative the code base. If the code base is `C:` then a relative path that would locate the resource is `/ImageTest/pic2.jpg`.
>
> ..difference between load file by `FileInputStream` and `getResourceAsStream`?
>
>
>
One major difference ... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | `getResource` & `getResourceAsStream` do not work with file paths, but paths relative the code base. If the code base is `C:` then a relative path that would locate the resource is `/ImageTest/pic2.jpg`.
>
> ..difference between load file by `FileInputStream` and `getResourceAsStream`?
>
>
>
One major difference ... | You cannot use `Class#getResource(String)` or `Class#getResourceAsStream(String)` in this case. The rules for searching resources associated with a given class are implemented by the defining class loader of the class. This method delegates to this object's class loader. If this object was loaded by the bootstrap class... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | `getResource` & `getResourceAsStream` do not work with file paths, but paths relative the code base. If the code base is `C:` then a relative path that would locate the resource is `/ImageTest/pic2.jpg`.
>
> ..difference between load file by `FileInputStream` and `getResourceAsStream`?
>
>
>
One major difference ... | ```
//This code snippet read an image from location on the computer and writes it to a different location on the disk
try {
byte[] imageInByte;
BufferedImage imageOnDisk = ImageIO.read(new File("C:\\ImageTest\\pic2.jpg"));
//Create a ByteArrayOutputStrea object to write image to
ByteArrayOutputStream ... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | `getResource` & `getResourceAsStream` do not work with file paths, but paths relative the code base. If the code base is `C:` then a relative path that would locate the resource is `/ImageTest/pic2.jpg`.
>
> ..difference between load file by `FileInputStream` and `getResourceAsStream`?
>
>
>
One major difference ... | To find the image Width, height and size
```
BufferedImage image = null;
int imageWidth = -1;
int imageHeight = -1;
int fileSize = -1;
try {
File imageFile = new File(imagePath);
int fileSize = (int) imageFile.length();
image = ImageIO.read(imageFile); // Reading the Image from the file system
ima... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | To read an .jpg file from non-relative path you could use this:
```
BufferedImage img = null;
try
{
img = ImageIO.read(new File("C:/ImageTest/pic2.jpg")); // eventually C:\\ImageTest\\pic2.jpg
}
catch (IOException e)
{
e.printStackTrace();
}
```
I do not have any Java environment at the moment, so hope i... | You cannot use `Class#getResource(String)` or `Class#getResourceAsStream(String)` in this case. The rules for searching resources associated with a given class are implemented by the defining class loader of the class. This method delegates to this object's class loader. If this object was loaded by the bootstrap class... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | To read an .jpg file from non-relative path you could use this:
```
BufferedImage img = null;
try
{
img = ImageIO.read(new File("C:/ImageTest/pic2.jpg")); // eventually C:\\ImageTest\\pic2.jpg
}
catch (IOException e)
{
e.printStackTrace();
}
```
I do not have any Java environment at the moment, so hope i... | ```
//This code snippet read an image from location on the computer and writes it to a different location on the disk
try {
byte[] imageInByte;
BufferedImage imageOnDisk = ImageIO.read(new File("C:\\ImageTest\\pic2.jpg"));
//Create a ByteArrayOutputStrea object to write image to
ByteArrayOutputStream ... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | To read an .jpg file from non-relative path you could use this:
```
BufferedImage img = null;
try
{
img = ImageIO.read(new File("C:/ImageTest/pic2.jpg")); // eventually C:\\ImageTest\\pic2.jpg
}
catch (IOException e)
{
e.printStackTrace();
}
```
I do not have any Java environment at the moment, so hope i... | To find the image Width, height and size
```
BufferedImage image = null;
int imageWidth = -1;
int imageHeight = -1;
int fileSize = -1;
try {
File imageFile = new File(imagePath);
int fileSize = (int) imageFile.length();
image = ImageIO.read(imageFile); // Reading the Image from the file system
ima... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | You cannot use `Class#getResource(String)` or `Class#getResourceAsStream(String)` in this case. The rules for searching resources associated with a given class are implemented by the defining class loader of the class. This method delegates to this object's class loader. If this object was loaded by the bootstrap class... | ```
//This code snippet read an image from location on the computer and writes it to a different location on the disk
try {
byte[] imageInByte;
BufferedImage imageOnDisk = ImageIO.read(new File("C:\\ImageTest\\pic2.jpg"));
//Create a ByteArrayOutputStrea object to write image to
ByteArrayOutputStream ... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | You cannot use `Class#getResource(String)` or `Class#getResourceAsStream(String)` in this case. The rules for searching resources associated with a given class are implemented by the defining class loader of the class. This method delegates to this object's class loader. If this object was loaded by the bootstrap class... | To find the image Width, height and size
```
BufferedImage image = null;
int imageWidth = -1;
int imageHeight = -1;
int fileSize = -1;
try {
File imageFile = new File(imagePath);
int fileSize = (int) imageFile.length();
image = ImageIO.read(imageFile); // Reading the Image from the file system
ima... |
19,447,104 | I have a problem with Java application, particular in loading a image from a location in my computer.
Following [this post](http://www.dreamincode.net/forums/topic/162999-java-image-manipulation-part-3-math-and-swingworker/) I used a `BufferedImage` and a `InputFileStream` to load an image on my computer. First, I put... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19447104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2764127/"
] | ```
//This code snippet read an image from location on the computer and writes it to a different location on the disk
try {
byte[] imageInByte;
BufferedImage imageOnDisk = ImageIO.read(new File("C:\\ImageTest\\pic2.jpg"));
//Create a ByteArrayOutputStrea object to write image to
ByteArrayOutputStream ... | To find the image Width, height and size
```
BufferedImage image = null;
int imageWidth = -1;
int imageHeight = -1;
int fileSize = -1;
try {
File imageFile = new File(imagePath);
int fileSize = (int) imageFile.length();
image = ImageIO.read(imageFile); // Reading the Image from the file system
ima... |
15,121,098 | I am using the jQuery UI Menu as a context menu, so when a user clicks on a cell in a table, it brings it up with relevant options. The problem is, it wasn't really designed to be used like this, so it doesn't hide when the user clicks outside of the menu.
I tried using the blur method:
```
$("#menu").menu({
blur... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15121098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1322359/"
] | ```
$('body:not(#menu)').click(function(){
$("#menu").css({ 'top' : '-1000px', 'left' : '-1000px' });
});
```
I think this way is a little sexier | how about something like:
```
$('body').not($('#menu').find('*'))
.bind('click',function(){
$("#menu").css('top', '-1000px');
$("#menu").css('left', '-1000px');
});
```
Lets handle clicks on the body, and if the click happens NOT anywhere on the m... |
15,121,098 | I am using the jQuery UI Menu as a context menu, so when a user clicks on a cell in a table, it brings it up with relevant options. The problem is, it wasn't really designed to be used like this, so it doesn't hide when the user clicks outside of the menu.
I tried using the blur method:
```
$("#menu").menu({
blur... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15121098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1322359/"
] | ```
$('body:not(#menu)').click(function(){
$("#menu").css({ 'top' : '-1000px', 'left' : '-1000px' });
});
```
I think this way is a little sexier | I'm using this to hide my jquery-ui menu when the user clicks outside of the menu.
```
$('body:not(#menu)')
.off('click')
.on( 'click', function() {
$('body:not(#menu)')
.off('click');
$('#menu')
.hide();
});
```
Similar to the above answer but hides the menu elements instead of moving them out of th... |
5,433,473 | I'm stuck with a code. I admit I´m not an expert programmer, but despite already having spent a good bit of time searching in the internet, I am not able to build the code. The situation is this.
I've got in SheetB 2 columns (A and C). In column A I have a bunch of ID numbers and there are always more rows with the sa... | 2011/03/25 | [
"https://Stackoverflow.com/questions/5433473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/676827/"
] | I'll start with the easy part, your wildcard SSL certificate should be fine for these sites. You'll just need to make sure that you add a https endpoint to your role and select the appropriate certificate.
From what I can see, you'll need three sites defined in your service definition. First the default one while will... | It's worth mentioning that deploying multiple sites to a web role has recently been made much easier with the help of the Windows Azure Accelerator for web roles - more info at <http://waawebroles.codeplex.com/> |
2,581,047 | I have a function using strtok like this
```
void f1(char *name)
{
...
char *tmp;
tmp = strtok(names, " ,");
while(tmp)
{
...
tmp = strtok(NULL, " ,");
}
...
}
```
And i have a call f1("abc,def");
Problem is that in first call f1 gets abc,def
and in 2nd call gets just abc
I am confused.. Why is this so? | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309512/"
] | You say:
>
> And i have a call f1("abc,def");
>
>
>
That call is illegal - strtok modifies its first parameter and you are not allowed to modify string literals. What you get is undefined behaviour - anything could happen. You want:
```
char a[] = "abc,def";
f1( a );
``` | `strtok` puts a null terminator after each token it returns. This means that it destroys the original string: After calling it, your string will be terminated after the first token, resulting in the behavior you see.
To keep the original string unchanged, you will need to make a copy of it before calling `strtok`. |
2,581,047 | I have a function using strtok like this
```
void f1(char *name)
{
...
char *tmp;
tmp = strtok(names, " ,");
while(tmp)
{
...
tmp = strtok(NULL, " ,");
}
...
}
```
And i have a call f1("abc,def");
Problem is that in first call f1 gets abc,def
and in 2nd call gets just abc
I am confused.. Why is this so? | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309512/"
] | Are you truly passing in a string literal?
```
f1("abc,def");
```
will pass a pointer to the string literal to the `strtok()` in `f1()` - since `strtok()` modifies the string, and a string literal can't be modified, so you'll get undefined behavior (though I would expect a crash or fault instead of unexpected result... | `strtok` puts a null terminator after each token it returns. This means that it destroys the original string: After calling it, your string will be terminated after the first token, resulting in the behavior you see.
To keep the original string unchanged, you will need to make a copy of it before calling `strtok`. |
2,581,047 | I have a function using strtok like this
```
void f1(char *name)
{
...
char *tmp;
tmp = strtok(names, " ,");
while(tmp)
{
...
tmp = strtok(NULL, " ,");
}
...
}
```
And i have a call f1("abc,def");
Problem is that in first call f1 gets abc,def
and in 2nd call gets just abc
I am confused.. Why is this so? | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309512/"
] | `strtok()` modifies its input string by overwriting the delimiters with a 0; so, assuming your code looks something like this:
```
char parm[] = "abc,def";
f1(parm);
f1(parm);
```
after the first call to f1, the ',' character is overwritten with a 0, which is a string terminator, so the second call only sees "abc" ... | `strtok` puts a null terminator after each token it returns. This means that it destroys the original string: After calling it, your string will be terminated after the first token, resulting in the behavior you see.
To keep the original string unchanged, you will need to make a copy of it before calling `strtok`. |
2,581,047 | I have a function using strtok like this
```
void f1(char *name)
{
...
char *tmp;
tmp = strtok(names, " ,");
while(tmp)
{
...
tmp = strtok(NULL, " ,");
}
...
}
```
And i have a call f1("abc,def");
Problem is that in first call f1 gets abc,def
and in 2nd call gets just abc
I am confused.. Why is this so? | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309512/"
] | You say:
>
> And i have a call f1("abc,def");
>
>
>
That call is illegal - strtok modifies its first parameter and you are not allowed to modify string literals. What you get is undefined behaviour - anything could happen. You want:
```
char a[] = "abc,def";
f1( a );
``` | Are you truly passing in a string literal?
```
f1("abc,def");
```
will pass a pointer to the string literal to the `strtok()` in `f1()` - since `strtok()` modifies the string, and a string literal can't be modified, so you'll get undefined behavior (though I would expect a crash or fault instead of unexpected result... |
2,581,047 | I have a function using strtok like this
```
void f1(char *name)
{
...
char *tmp;
tmp = strtok(names, " ,");
while(tmp)
{
...
tmp = strtok(NULL, " ,");
}
...
}
```
And i have a call f1("abc,def");
Problem is that in first call f1 gets abc,def
and in 2nd call gets just abc
I am confused.. Why is this so? | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309512/"
] | `strtok()` modifies its input string by overwriting the delimiters with a 0; so, assuming your code looks something like this:
```
char parm[] = "abc,def";
f1(parm);
f1(parm);
```
after the first call to f1, the ',' character is overwritten with a 0, which is a string terminator, so the second call only sees "abc" ... | You say:
>
> And i have a call f1("abc,def");
>
>
>
That call is illegal - strtok modifies its first parameter and you are not allowed to modify string literals. What you get is undefined behaviour - anything could happen. You want:
```
char a[] = "abc,def";
f1( a );
``` |
2,581,047 | I have a function using strtok like this
```
void f1(char *name)
{
...
char *tmp;
tmp = strtok(names, " ,");
while(tmp)
{
...
tmp = strtok(NULL, " ,");
}
...
}
```
And i have a call f1("abc,def");
Problem is that in first call f1 gets abc,def
and in 2nd call gets just abc
I am confused.. Why is this so? | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309512/"
] | `strtok()` modifies its input string by overwriting the delimiters with a 0; so, assuming your code looks something like this:
```
char parm[] = "abc,def";
f1(parm);
f1(parm);
```
after the first call to f1, the ',' character is overwritten with a 0, which is a string terminator, so the second call only sees "abc" ... | Are you truly passing in a string literal?
```
f1("abc,def");
```
will pass a pointer to the string literal to the `strtok()` in `f1()` - since `strtok()` modifies the string, and a string literal can't be modified, so you'll get undefined behavior (though I would expect a crash or fault instead of unexpected result... |
71,936,366 | How can we iterate over the output of the query `show databases` in snowflake using JDBC. If there is another way to check if database is present or not over jdbc? | 2022/04/20 | [
"https://Stackoverflow.com/questions/71936366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13154754/"
] | If the requirement is for validating the list of DB's and use it for some kind of audit purpose, you may can do the following:
1. First run the following command:
**show databases;**
2. Then use the result\_scan() function to get the DB name and the owner from the result of the previous command:
**select $2 as DB\_N... | you mean like:
```
select distinct database_name from information_schema.databases;
``` |
12,733,600 | i have this menu:
```
<div class="nav">
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">AMORTECIMENTO</a></li>
</ul>
</div>
```
the normal apearance:

and this is the apearance when users hover the menu:
;
}
```
EDIT:
You've got a lot more issues than just a background image...
* You need to vertically center your nav text set a min-width for the
nav cells so that the left and right of the ball aren't cut off
* set a so... | on your nav class all you have to do is write your css like this:
```
.nav ul li:hover
{
background-image:url('yourimage.jpg');
}
``` |
12,733,600 | i have this menu:
```
<div class="nav">
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">AMORTECIMENTO</a></li>
</ul>
</div>
```
the normal apearance:

and this is the apearance when users hover the menu:
;
}
``` |
12,733,600 | i have this menu:
```
<div class="nav">
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">AMORTECIMENTO</a></li>
</ul>
</div>
```
the normal apearance:

and this is the apearance when users hover the menu:
;
}
```
EDIT:
You've got a lot more issues than just a background image...
* You need to vertically center your nav text set a min-width for the
nav cells so that the left and right of the ball aren't cut off
* set a so... | To fix the cut-off images, you can simply put a `min-width` on your `.nav li` elements. Make sure the value is at least as wide as your background images.
You'll probably also want to add `text-align: center`. |
12,733,600 | i have this menu:
```
<div class="nav">
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">AMORTECIMENTO</a></li>
</ul>
</div>
```
the normal apearance:

and this is the apearance when users hover the menu:
;
}
```
EDIT:
You've got a lot more issues than just a background image...
* You need to vertically center your nav text set a min-width for the
nav cells so that the left and right of the ball aren't cut off
* set a so... |
12,733,600 | i have this menu:
```
<div class="nav">
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">AMORTECIMENTO</a></li>
</ul>
</div>
```
the normal apearance:

and this is the apearance when users hover the menu:
:
File "/Users/user_name/Desktop/ABCo/EEM/EntityManagement/lodurr/data_lake/hive_db.py", line 56, in wrapper
auth_mechanism='PLAIN')
File "/Users/user_name/.virtualenvs/entity1/lib/python3.6... | 2017/10/04 | [
"https://Stackoverflow.com/questions/46573180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8722495/"
] | Not sure what the issue is but can you try with
thrift-sasl==0.2.1 | This also got resolved by installing the latest versions of of Impyla (0.16.2) and thrift-sasl (0.4.2) using:
```
pip install --upgrade impyla
pip install --upgrade thrift-sasl
``` |
46,573,180 | I am getting the following error while trying to create a connection to HiveServer
```
Traceback (most recent call last):
File "/Users/user_name/Desktop/ABCo/EEM/EntityManagement/lodurr/data_lake/hive_db.py", line 56, in wrapper
auth_mechanism='PLAIN')
File "/Users/user_name/.virtualenvs/entity1/lib/python3.6... | 2017/10/04 | [
"https://Stackoverflow.com/questions/46573180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8722495/"
] | I had the same issue and useed the following packages:
```
pip uninstall thrift-sasl
pip uninstall impyla
pip uninstall thrift
pip install thrift-sasl==0.2.1
pip install thrift==0.9.3
pip install impyla==0.13.8
``` | This also got resolved by installing the latest versions of of Impyla (0.16.2) and thrift-sasl (0.4.2) using:
```
pip install --upgrade impyla
pip install --upgrade thrift-sasl
``` |
37,132,269 | I have installed HBase 1.1.3 on multi cluster configuration and wanted to run Apache phoenix over it. I download phoenix 4.7, installed it as per the guidelines mentioned here: <https://phoenix.apache.org/installation.html>
>
> But when i am running the following command: sqlline.py
> it is getting hanged till the... | 2016/05/10 | [
"https://Stackoverflow.com/questions/37132269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5808464/"
] | Well it seems that the Phoenix client is unable to connect to the Hbase z-node present at zookeeper cluster. Please do the following :
1. Check if zookeeper is up .
2. Check with what name you have registered hbase at the zookeeper.If the name is not hbase we need to specify it to the client. in that case the command ... | You need to add following jars to Hbase/lib directory.
* **phoenix-spark-4.7.0-HBase-1.1.jar**
* **phoenix-4.7.0-HBase-1.1-server.jar** |
5,277,526 | I know about using `co-` and `contravariance` in the standard library (e.g. collections and trait `Function`) I wonder how `co-` and `contravariance` are used in design of "real world" business applications. | 2011/03/11 | [
"https://Stackoverflow.com/questions/5277526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650444/"
] | The classic example is functions, taking the Scala interface for a function with a single argument:
```
trait Function1[-T1, +R]
```
Which is contravariant (the `-`) for the argument, and covariant (the `+`) for the return type.
Why?
Imagine you have these classes:
```
class Timelord { ... }
class Doctor extends ... | Essentially anywhere where you want to make use of both [parametric polymorphism](http://en.wikipedia.org/wiki/Parametric_polymorphism) *(generics)* and inheritance, you will probably end up wanting either [declaration site variance](http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29#Decl... |
8,758,891 | I am Computer Science student and working on a project in java through netbeans 7.0.1 to be submitted in college, Today my faculty asked me how much your project is completed and i confidently replied that, Yes sir approx 50% completed already, he said how many lines u code, and i just go "Ummmm don't know exactly Sir"... | 2012/01/06 | [
"https://Stackoverflow.com/questions/8758891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803285/"
] | Since a 'nix-based answer has been given, in Windows you could accomplish something similar with Powershell:
```
get-content *.java | measure-object -line
``` | If you are on a unix system the following would work:
```
$ find . -name *.java | xargs cat | wc
1262 2862 37780
```
That will merge all the files together into a stream and pass it to **wc** which will do various counts. The first number is the number of lines.
In the above example, my codebase (from the dire... |
8,758,891 | I am Computer Science student and working on a project in java through netbeans 7.0.1 to be submitted in college, Today my faculty asked me how much your project is completed and i confidently replied that, Yes sir approx 50% completed already, he said how many lines u code, and i just go "Ummmm don't know exactly Sir"... | 2012/01/06 | [
"https://Stackoverflow.com/questions/8758891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803285/"
] | It's not part of Netbeans, but I use [CLOC](http://cloc.sourceforge.net/) for this and find it does a nice job - identifies different languages well, reports on how many lines are comments, how many are code and so on. | If you are on a unix system the following would work:
```
$ find . -name *.java | xargs cat | wc
1262 2862 37780
```
That will merge all the files together into a stream and pass it to **wc** which will do various counts. The first number is the number of lines.
In the above example, my codebase (from the dire... |
8,758,891 | I am Computer Science student and working on a project in java through netbeans 7.0.1 to be submitted in college, Today my faculty asked me how much your project is completed and i confidently replied that, Yes sir approx 50% completed already, he said how many lines u code, and i just go "Ummmm don't know exactly Sir"... | 2012/01/06 | [
"https://Stackoverflow.com/questions/8758891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803285/"
] | Since a 'nix-based answer has been given, in Windows you could accomplish something similar with Powershell:
```
get-content *.java | measure-object -line
``` | I'd like to suggest an answer to a different question:
>
> How do I quantify progress in a programming project?
>
>
>
I have a preference for agile methodologies, so I would present a burn-down chart - which takes into consideration the total number of user stories/cards/tasks, the complexity/estimated time, and ... |
8,758,891 | I am Computer Science student and working on a project in java through netbeans 7.0.1 to be submitted in college, Today my faculty asked me how much your project is completed and i confidently replied that, Yes sir approx 50% completed already, he said how many lines u code, and i just go "Ummmm don't know exactly Sir"... | 2012/01/06 | [
"https://Stackoverflow.com/questions/8758891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803285/"
] | It's not part of Netbeans, but I use [CLOC](http://cloc.sourceforge.net/) for this and find it does a nice job - identifies different languages well, reports on how many lines are comments, how many are code and so on. | I'd like to suggest an answer to a different question:
>
> How do I quantify progress in a programming project?
>
>
>
I have a preference for agile methodologies, so I would present a burn-down chart - which takes into consideration the total number of user stories/cards/tasks, the complexity/estimated time, and ... |
8,758,891 | I am Computer Science student and working on a project in java through netbeans 7.0.1 to be submitted in college, Today my faculty asked me how much your project is completed and i confidently replied that, Yes sir approx 50% completed already, he said how many lines u code, and i just go "Ummmm don't know exactly Sir"... | 2012/01/06 | [
"https://Stackoverflow.com/questions/8758891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803285/"
] | It's not part of Netbeans, but I use [CLOC](http://cloc.sourceforge.net/) for this and find it does a nice job - identifies different languages well, reports on how many lines are comments, how many are code and so on. | Since a 'nix-based answer has been given, in Windows you could accomplish something similar with Powershell:
```
get-content *.java | measure-object -line
``` |
52,559,553 | I'm trying to create this simple logic whereas I want the array value to add to the previous value. For example the code below, the 18 should carry the 1 and add to the the 9 and the 9 will be 10 then carry the one and add to the 7 and will be 8 and so on. I think I'm on the right track but I can't figure out the rest.... | 2018/09/28 | [
"https://Stackoverflow.com/questions/52559553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10430450/"
] | You appear to have parenthesis out of place.
`arr2.append(''+str(int(n)+' ' + str(int(m)+'')`
should be
`arr2.append(''+str(int(n))+' ' + str(int(m))+'')` | In line `25` change `'arr2.append(''+str(int(n)+' ' + str(int(m)+'')'` to `arr2.append(''+str(int(n)) +' ' + str(int(m))+'')`
**Note** : after i runned your code i see a error
```
n=(((6 * foo) - (m * (m + 1) * (2 * m + 1))) / (3 * ((m * m) + m))) + m
ZeroDivisionError: division by zero
```
That's because you us... |
45,091 | I came across a recipe for skillet potatoes that asked for "cooked potatoes cut into 1/4-inch chunks". While the 1/4-inch chunk part was easy to understand, I'm not sure what is meant by "cooked". Boiled? Sauteed? Baked? | 2014/06/23 | [
"https://cooking.stackexchange.com/questions/45091",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/14147/"
] | Usually that would mean potatoes that have been simmered to fork tender, but you could use potatoes that have been baked too. It's faster to dice the potato before simmering, but for some things it actually tastes better (tiny difference) to simmer first, then dice.
Be careful if you dice first, they will overcook an... | The best way to pre cook potatoes is to do a rough chop and cook in boiling salted water until fork tender, not mushy. A 1/4 inch dice is way too small to do that.
Try dicing the potatoes into 1/4 inch pieces, place in a pile wrapped in wet paper towels into a micro safe bowl and microwave for 3 minutes, add time and ... |
45,091 | I came across a recipe for skillet potatoes that asked for "cooked potatoes cut into 1/4-inch chunks". While the 1/4-inch chunk part was easy to understand, I'm not sure what is meant by "cooked". Boiled? Sauteed? Baked? | 2014/06/23 | [
"https://cooking.stackexchange.com/questions/45091",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/14147/"
] | Usually that would mean potatoes that have been simmered to fork tender, but you could use potatoes that have been baked too. It's faster to dice the potato before simmering, but for some things it actually tastes better (tiny difference) to simmer first, then dice.
Be careful if you dice first, they will overcook an... | If you have enough time for preparation, just put the potatoes into the pot without peeling them, bring them to a boil and leave for an hour or so. If they are still hard when you prick them with a fork or knife, bring them to a boil once more. this way you can get them cooked gently without much energy expenditure. Co... |
45,091 | I came across a recipe for skillet potatoes that asked for "cooked potatoes cut into 1/4-inch chunks". While the 1/4-inch chunk part was easy to understand, I'm not sure what is meant by "cooked". Boiled? Sauteed? Baked? | 2014/06/23 | [
"https://cooking.stackexchange.com/questions/45091",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/14147/"
] | The best way to pre cook potatoes is to do a rough chop and cook in boiling salted water until fork tender, not mushy. A 1/4 inch dice is way too small to do that.
Try dicing the potatoes into 1/4 inch pieces, place in a pile wrapped in wet paper towels into a micro safe bowl and microwave for 3 minutes, add time and ... | If you have enough time for preparation, just put the potatoes into the pot without peeling them, bring them to a boil and leave for an hour or so. If they are still hard when you prick them with a fork or knife, bring them to a boil once more. this way you can get them cooked gently without much energy expenditure. Co... |
42,036,753 | >
> I am trying to connect spark with cassandra database but I got the error mentioned below. I think there should some mismatch with the versions.
>
>
>
code:
```
SparkConf conf = new SparkConf().setAppName("kafka-sandbox").setMaster("local[2]");
conf.set("spark.cassandra.connection.host", "192.168.34.1... | 2017/02/04 | [
"https://Stackoverflow.com/questions/42036753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6439341/"
] | zero() on scala.runtime.VolatileObjectRef has been introduced in Scala 2.11 You probably have a library compiled against Scala 2.11 and running on a Scala 2.10 runtime.
See
v2.10: <https://github.com/scala/scala/blob/2.10.x/src/library/scala/runtime/VolatileObjectRef.java>
v2.11: <https://github.com/scala/scala/blob/... | ```
In my pom.xml I changed sacala version from 2.10 to 2.11.
Given below is the updated pom.xml
----------
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<mod... |
42,036,753 | >
> I am trying to connect spark with cassandra database but I got the error mentioned below. I think there should some mismatch with the versions.
>
>
>
code:
```
SparkConf conf = new SparkConf().setAppName("kafka-sandbox").setMaster("local[2]");
conf.set("spark.cassandra.connection.host", "192.168.34.1... | 2017/02/04 | [
"https://Stackoverflow.com/questions/42036753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6439341/"
] | According to your `pom.xml` you mix scala version for different dependencies:
* spark-streaming\_**2.10**
* spark-core\_**2.10**
* spark-streaming-kafka-0-8\_**2.10**
* spark-cassandra-connector\_**2.11**
* spark-sql\_**2.11**
All dependencies should have same scala version. Please, try to change everything to `_2.11... | ```
In my pom.xml I changed sacala version from 2.10 to 2.11.
Given below is the updated pom.xml
----------
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<mod... |
71,755,430 | I have been trying to run a query where I want to group all the records by a specific property, then select the first from each list. I've been through a few iterations of this but it's safe to say the EF Core 3.0 onwards makes this a very hard activity to achieve. I think I might be hitting up against limitations of t... | 2022/04/05 | [
"https://Stackoverflow.com/questions/71755430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18609695/"
] | If you're trying to get rid of `NaN` and `Inf` of `-Inf`, you're better off using `is.finite`. In the context of a data frame, you could eliminate the offending rows with:
```r
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The follo... | You can use `!is.nan()`. Here is an example:
```
x1<-sample(1:50, 10)
x2<-sample(c(0, 5,4), 10, replace=TRUE)
x3<-x2*0.5
x4<-x1/x2 #will generate Inf because we are dividing by 0
x5<-x1/x3 #will generate Inf because we are dividing by 0
x6<-x5-x4 #will generate NaNs because we are subtracting Inf from Inf
x7<-x6[!is... |
17,497,821 | I'm trying to prepend a tag to each h2 based on the content that specific h2. Here's what I've tried:
```
jQuery(document).ready(function() {
jQuery( "h2" ).each(function(){
var $headingcontent = jQuery('h2').html().toLowerCase();
jQuery('h2').prepend('<a id="'+ $headingcontent +'"></a>');
});
... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17497821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319940/"
] | ```
jQuery( "h2" ).each(function(){
var $headingcontent = jQuery(this).html().toLowerCase();
jQuery(this).prepend('<a id="'+ $headingcontent +'"></a>');
});
```
Btw, you don't need an additional `a` element at all:
```
jQuery( "h2" ).each(function(){
var $this = jQuery(this);
$this.attr('id', $this.h... | I would instead nest the anchor inside the `H2` element.
```
$( "h2" ).each(function(_,el){//Get each element as el and _ as index
el = $(el); // Cache for performance
var $headingcontent = el.text().toLowerCase();//Get the text
//Replace h2 content with the an anchor element with same content;
el.html... |
17,497,821 | I'm trying to prepend a tag to each h2 based on the content that specific h2. Here's what I've tried:
```
jQuery(document).ready(function() {
jQuery( "h2" ).each(function(){
var $headingcontent = jQuery('h2').html().toLowerCase();
jQuery('h2').prepend('<a id="'+ $headingcontent +'"></a>');
});
... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17497821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319940/"
] | ```
jQuery( "h2" ).each(function(){
var $headingcontent = jQuery(this).html().toLowerCase();
jQuery(this).prepend('<a id="'+ $headingcontent +'"></a>');
});
```
Btw, you don't need an additional `a` element at all:
```
jQuery( "h2" ).each(function(){
var $this = jQuery(this);
$this.attr('id', $this.h... | First i'd make sure it only applies to the H2's you intend, down the line you/someone else may add a h2 somewhere else and get unexpected results...
```
<h2 class='content'>Heading 1</h2>
<h2 class='content'>Heading 2</h2>
```
code:
```
jQuery(document).ready(function() {
jQuery('h2.content').each(function(){
v... |
17,497,821 | I'm trying to prepend a tag to each h2 based on the content that specific h2. Here's what I've tried:
```
jQuery(document).ready(function() {
jQuery( "h2" ).each(function(){
var $headingcontent = jQuery('h2').html().toLowerCase();
jQuery('h2').prepend('<a id="'+ $headingcontent +'"></a>');
});
... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17497821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319940/"
] | I would instead nest the anchor inside the `H2` element.
```
$( "h2" ).each(function(_,el){//Get each element as el and _ as index
el = $(el); // Cache for performance
var $headingcontent = el.text().toLowerCase();//Get the text
//Replace h2 content with the an anchor element with same content;
el.html... | First i'd make sure it only applies to the H2's you intend, down the line you/someone else may add a h2 somewhere else and get unexpected results...
```
<h2 class='content'>Heading 1</h2>
<h2 class='content'>Heading 2</h2>
```
code:
```
jQuery(document).ready(function() {
jQuery('h2.content').each(function(){
v... |
187,059 | I have a plug in leaf blower/vacuum and would like to convert it to battery power. here is a link to the equipment in question. [http://www.amazon.com/Factory-Reconditioned-Ryobi-ZRRY42110-Electric-Mulcher/dp/B004NC014Q/ref=cm\_cr\_pr\_product\_top?ie=UTF8](http://rads.stackoverflow.com/amzn/click/B004NC014Q). 12amp is... | 2015/08/24 | [
"https://electronics.stackexchange.com/questions/187059",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/83918/"
] | Providing the circuit with a larger capacitors is a good start. To determine the required capacity you need the energy used during the spike. To do this one can measure voltage and current as a function of time with an oscilloscope.
The energy the capacitor has to provide during the spike is roughly \$W\_S \approx \in... | There are 3 solutions to your problem as far as I can see:
1. Turn off the low voltage drop detection function in your MCU.
2. Limit the current draw, i.e. remove some of the LEDs, or add higher value resistors.
3. Use super-capacitor such as 1F rated at 5V. |
5,832,222 | I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already existing version, I need to show the confirmation dialog like " Version already exists do you wants to overwrite..?" ok, Cancel.
I am using Mozarra 2... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5832222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685577/"
] | It's not possible to get confirmation from the client *during* processing on server.
You have two options:
1. Get overwrite permission before calling your action method e.g. with a checkbox "Overwrite file if exists?" or
2. You have to stop processing, set a flag and return null to reload current page in browser.
Th... | Case
Validate that there is a selected item by pressing the Delete button. If you open a popup, if not shown in the error message, growl.
**Alternative**:
(Sorry I had trouble posting the code)
**XHTML**:
[View xhtml](http://screencast.com/t/qklgsYoIMKw)
**TestManageBean**:
[Manage bean](http://screencast.com/t/SF... |
5,832,222 | I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already existing version, I need to show the confirmation dialog like " Version already exists do you wants to overwrite..?" ok, Cancel.
I am using Mozarra 2... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5832222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685577/"
] | It's not possible to get confirmation from the client *during* processing on server.
You have two options:
1. Get overwrite permission before calling your action method e.g. with a checkbox "Overwrite file if exists?" or
2. You have to stop processing, set a flag and return null to reload current page in browser.
Th... | You are facing in typical Primefaces Problem.
When your page is displayed and buttonBean.showConfirm = false, this element is not rendered. This means, it will not appear in the DOM-Tree. No matter what you do afterwards, a non existing element cannot be shown or hidden.
There are actually two ways to solve you probl... |
5,832,222 | I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already existing version, I need to show the confirmation dialog like " Version already exists do you wants to overwrite..?" ok, Cancel.
I am using Mozarra 2... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5832222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685577/"
] | It's not possible to get confirmation from the client *during* processing on server.
You have two options:
1. Get overwrite permission before calling your action method e.g. with a checkbox "Overwrite file if exists?" or
2. You have to stop processing, set a flag and return null to reload current page in browser.
Th... | I faced very similar question. The solution I came up with was to split the logic into 2 - first, when the button is pressed use 'action' to prepare the data for the validation and use 'oncomplete' to run a remote command which displays the confirmation dialog in which 'OK' is the real action. |
5,832,222 | I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already existing version, I need to show the confirmation dialog like " Version already exists do you wants to overwrite..?" ok, Cancel.
I am using Mozarra 2... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5832222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685577/"
] | You are facing in typical Primefaces Problem.
When your page is displayed and buttonBean.showConfirm = false, this element is not rendered. This means, it will not appear in the DOM-Tree. No matter what you do afterwards, a non existing element cannot be shown or hidden.
There are actually two ways to solve you probl... | Case
Validate that there is a selected item by pressing the Delete button. If you open a popup, if not shown in the error message, growl.
**Alternative**:
(Sorry I had trouble posting the code)
**XHTML**:
[View xhtml](http://screencast.com/t/qklgsYoIMKw)
**TestManageBean**:
[Manage bean](http://screencast.com/t/SF... |
5,832,222 | I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already existing version, I need to show the confirmation dialog like " Version already exists do you wants to overwrite..?" ok, Cancel.
I am using Mozarra 2... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5832222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685577/"
] | I faced very similar question. The solution I came up with was to split the logic into 2 - first, when the button is pressed use 'action' to prepare the data for the validation and use 'oncomplete' to run a remote command which displays the confirmation dialog in which 'OK' is the real action. | Case
Validate that there is a selected item by pressing the Delete button. If you open a popup, if not shown in the error message, growl.
**Alternative**:
(Sorry I had trouble posting the code)
**XHTML**:
[View xhtml](http://screencast.com/t/qklgsYoIMKw)
**TestManageBean**:
[Manage bean](http://screencast.com/t/SF... |
5,832,222 | I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already existing version, I need to show the confirmation dialog like " Version already exists do you wants to overwrite..?" ok, Cancel.
I am using Mozarra 2... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5832222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685577/"
] | You are facing in typical Primefaces Problem.
When your page is displayed and buttonBean.showConfirm = false, this element is not rendered. This means, it will not appear in the DOM-Tree. No matter what you do afterwards, a non existing element cannot be shown or hidden.
There are actually two ways to solve you probl... | I faced very similar question. The solution I came up with was to split the logic into 2 - first, when the button is pressed use 'action' to prepare the data for the validation and use 'oncomplete' to run a remote command which displays the confirmation dialog in which 'OK' is the real action. |
41,986 | I would like to quote a few lines of a lyric from St. Vincent's song "New York", for an 'in memoriam' I want to put in a newspaper on the anniversary day of my friend's death. Do I need to get permission for this? (i'm in new York, the paper is in massacusetts) | 2019/02/06 | [
"https://writers.stackexchange.com/questions/41986",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/36543/"
] | **Ask the newspaper. They will know this stuff backwards and forwards.**
If you put the lyrics into a program to hand out at a memorial service or other event, you're good.
If you put the lyrics (well credited) on your personal blog, and you're only quoting a small percentage, you're almost certainly fine. Given the ... | A few lines is not a problem. What you will want to do is cite the lines. As long as they are properly attributed and not used in a way that could be damaging to the work you should be fine.
IANAL |
53,700,541 | What I want is to add and remove new value to the existing value in Sqlite android.
What I've read from the android documentation is this method, but it's not working in my case cause it's removing the existing value with the new one that's being provided.
here's my code:
```
public boolean updateCigaretteStock(Strin... | 2018/12/10 | [
"https://Stackoverflow.com/questions/53700541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10769184/"
] | If I understand your question correctly, you are trying to *increment* certain columns values along the lines of the following query:
```
UPDATE CigaretteStock
SET
qty = qty + ?,
totalcost = totalcost + ?;
```
The problem with the particular API you are using is that it only allows for clobbering (completely... | Try modifying your code as below:
```
public boolean updateCigaretteStock(String cigaretteName, int quantity, int totalCost) {
ContentValues values = new ContentValues();
values.put(CigaretteStockEntry.COLUMN_QTY, quantity + "");
values.put(CigaretteStockEntry.COLUMN_TOTAL_COST, totalCost + "");
Stri... |
388,682 | Increased temperature lowers viscosity of gases like air but also decreases density.
So then drag force would be lower if an object is thrown in higher temperatures but what about viscosity? I thought viscosity was drag. | 2018/02/25 | [
"https://physics.stackexchange.com/questions/388682",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/182938/"
] | Depends on how fast the object is traveling through the fluid a.k.a. the value of the [Reynold's number](https://en.wikipedia.org/wiki/Reynolds_number).
If the flow around the object is turbulent (high Reynold's number) then [density is the key fluid property.](http://hyperphysics.phy-astr.gsu.edu/hbase/airfri.html#c1... | Viscosity of air increases as we increase the temperature.
This is because velocity of air molecules increases making the air molecules to collide frequently with the object .
So drag force increases because viscosity increases. |
10,722,669 | If I use opencover to provide coverage anaylsis that runs on the buildserver for all builds of my product.
I'm under the impression that opencover (and presumably all the others) "instrument" the code to record hits.
Is this instrumented code "not safe" and/or slower and therefore I should not be using this code on t... | 2012/05/23 | [
"https://Stackoverflow.com/questions/10722669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077232/"
] | [OpenCover](https://github.com/sawilde/opencover) (and NCover and [PartCover](https://github.com/sawilde/partcover.net4)) do not modify your binaries that you have produced via the build. They use the profiler API to instrument the binaries in-memory as they are being JITted (just-in-time compiled).
As such your bina... | I have running unit tests and openCover for multiples projects in **Release** mode (in a build machine). You do not need make this for **Debug** mode if you do not have code dependent of that mode (like pre-compiled directives etc.).
I hope to help you. |
22,122,498 | I have a library that only interacts in static scope with an application. This requires me to link the library with the `--whole-archive` option to avoid the linker from "optimizing" out the library (this is done because the linker never actually sees my library being used).
The issue is that I haven't found a way to ... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22122498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45581/"
] | Reworded Question:
==================
**How do I link a static library into a shared library with the --whole-archive link flag, with scons, while maintaining dependencies.**
I am restating your question just to make sure we both have a clear understanding of what you are trying to accomplish. Please comment if I am ... | You can add LIBS and LINKFLAGS to your linker statement.
```
env.SharedLibrary('target',sources,LIBS=['mylib'],LINKFLAGS=env['LINKFLAGS']+['-Wl,--whole-archive','-lmylib'])
```
For example. |
22,122,498 | I have a library that only interacts in static scope with an application. This requires me to link the library with the `--whole-archive` option to avoid the linker from "optimizing" out the library (this is done because the linker never actually sees my library being used).
The issue is that I haven't found a way to ... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22122498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45581/"
] | Scons *still* doesn't support link flags such as `-Wl,--whole-archive`. Using the solution provided by Kenneth E. Bellock is has been working well for many years. The downside is that this is error prone. You have to be careful to manage your manual dependency list.
There is an alternate workaround. Add the following ... | You can add LIBS and LINKFLAGS to your linker statement.
```
env.SharedLibrary('target',sources,LIBS=['mylib'],LINKFLAGS=env['LINKFLAGS']+['-Wl,--whole-archive','-lmylib'])
```
For example. |
22,122,498 | I have a library that only interacts in static scope with an application. This requires me to link the library with the `--whole-archive` option to avoid the linker from "optimizing" out the library (this is done because the linker never actually sees my library being used).
The issue is that I haven't found a way to ... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22122498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45581/"
] | Reworded Question:
==================
**How do I link a static library into a shared library with the --whole-archive link flag, with scons, while maintaining dependencies.**
I am restating your question just to make sure we both have a clear understanding of what you are trying to accomplish. Please comment if I am ... | Scons *still* doesn't support link flags such as `-Wl,--whole-archive`. Using the solution provided by Kenneth E. Bellock is has been working well for many years. The downside is that this is error prone. You have to be careful to manage your manual dependency list.
There is an alternate workaround. Add the following ... |
20,282,813 | I saw my regional language named [Malayalam](http://en.wikipedia.org/wiki/Malayalam) in the `Supported Languages list` of my Windows Phone application `WMManifest` file.
Is that means that i could display 'Malayalam' language on my WP8 application ? How can i build an application in my Regional language ?
![ent... | 2013/11/29 | [
"https://Stackoverflow.com/questions/20282813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731921/"
] | Just try with this function ,
```
private string GetFirstParagraph(string yourHtmltext)
{
Match m = Regex.Match(yourHtmltext, @"<p>\s*(.+?)\s*</p>");
if (m.Success)
{
return m.Groups[1].Value;
}
else
{
return yourHtmltext;
}
}
``... | Try This:
```
String str1 = "/*your data*/";
int index1=str1.IndexOf("<p>");
int index2=str1.IndexOf("</p>");
if(index1!=-1 && index2!=-1)
String finalStr=str1.Substring(index1+3,index2-3));
``` |
43,593,734 | I have an array of objects that has an array property that I am trying to union together. I have already solved the problem with the code below, which shows what I am trying to do:
```
var dest = [];
_.forEach(parentArray, function (parentItem) {
_.forEach(parentItem.arrayProperty, function(arrayPropertyItem) {
... | 2017/04/24 | [
"https://Stackoverflow.com/questions/43593734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1426342/"
] | Take a look at [flatMap](https://lodash.com/docs/4.17.4#flatMap) and [flatten](https://lodash.com/docs/4.17.4#flatten). If I understand your data structure (and what you are trying to accomplish) you should be able to do something like this
```
var dest = _.flatMap(parentArray, function(item) {
return item.arrayProp... | You could use `flatMap` with the *name* of the nested property as second argument:
```
_.flatMap(parentArray, 'arrayProperty')
```
```js
var parentArray = [{
arrayProperty: [1, 2]
}, {
arrayProperty: [3, 4]
}];
console.log( _.flatMap(parentArray, 'arrayProperty') );
```
```html
<script src="https://cd... |
9,636,679 | I have this strange issue going on with my CSS on my site, and I'm hoping someone can help me out. I have a sharer box to the left of each of my posts. When you click the box to share (for instance the twitter box) the pop up box goes behind the post content, instead of in front of it. Anyone have any ideas on how to f... | 2012/03/09 | [
"https://Stackoverflow.com/questions/9636679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1204414/"
] | Try with z-index:99999; on pop up box. | For the video shown in the post, add wmode="opaque" to the `<object> / <embed>` tag. |
24,151,732 | I'm trying to make an RPG in Java, and I'm trying to make a random encounter system. I need to display the names of enemies into the eclipse console, and I know that the values are set because I printed the names before, but Java gives me a nullpointerexception.
```
public class Enemies {
static Enemies Slime = null;
... | 2014/06/10 | [
"https://Stackoverflow.com/questions/24151732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3609119/"
] | `json_decode()` in PHP will be your friend, see the docs:
<http://docs.php.net/manual/de/function.json-decode.php>
Something like this:
```
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
``` | You need to json decode the result
```
$image_intro = json_decode($image);
$image = $image_intro->image_intro;
```
To simply display the result once decoded, you can use
```
echo $image;
```
or maybe if you wanted to display the actual image, you could use this:
```
<img src="<?php echo JUri::root() . $image; ?... |
3,890,671 | I was reading about physics and came across the method of using separation of variables to solve specific PDEs, but I can't figure out why the specific solutions give rise to the general solution (the book didn't give any explanation for all these).
The specific example in the book was the Laplace Equation in $2$ vari... | 2020/11/01 | [
"https://math.stackexchange.com/questions/3890671",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/452655/"
] | There are several key ingredients I will briefly describe here. I won't go into too much detail as you've mentioned that you don't have a graduate real analysis background yet. But indeed a full description of the theory is a standard part of a graduate course in linear PDE. So I hope that answers your side question as... | The answer by @Christopher is very complete and definitely better than what this answer will be. But I would like to make some comments on Separation of Variables.
Separation of Variables is a process of splitting a multi-dimensional problem, into several single dimensional problems. However, this relies on an inheren... |
3,890,671 | I was reading about physics and came across the method of using separation of variables to solve specific PDEs, but I can't figure out why the specific solutions give rise to the general solution (the book didn't give any explanation for all these).
The specific example in the book was the Laplace Equation in $2$ vari... | 2020/11/01 | [
"https://math.stackexchange.com/questions/3890671",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/452655/"
] | There are several key ingredients I will briefly describe here. I won't go into too much detail as you've mentioned that you don't have a graduate real analysis background yet. But indeed a full description of the theory is a standard part of a graduate course in linear PDE. So I hope that answers your side question as... | Separation of variables relies on being able to choose an orthogonal coordinate system in which the Laplace operator separates. That is a rather strong restriction. For example, the 3d Laplacian splits in only a couple dozen different orthogonal coordinate systems. And the solid in which you are solving the Laplace equ... |
3,890,671 | I was reading about physics and came across the method of using separation of variables to solve specific PDEs, but I can't figure out why the specific solutions give rise to the general solution (the book didn't give any explanation for all these).
The specific example in the book was the Laplace Equation in $2$ vari... | 2020/11/01 | [
"https://math.stackexchange.com/questions/3890671",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/452655/"
] | The answer by @Christopher is very complete and definitely better than what this answer will be. But I would like to make some comments on Separation of Variables.
Separation of Variables is a process of splitting a multi-dimensional problem, into several single dimensional problems. However, this relies on an inheren... | Separation of variables relies on being able to choose an orthogonal coordinate system in which the Laplace operator separates. That is a rather strong restriction. For example, the 3d Laplacian splits in only a couple dozen different orthogonal coordinate systems. And the solid in which you are solving the Laplace equ... |
49,750,424 | I have following html for a wordpress custom plugin which is loaded to a wordpress editor
```
<div class="container-fluid">
<div class="outer">
<div class="job_details">
```
But when its saved to a database its changes as follows
```
<div class=\"container-fluid\">
<div class=\"outer\">
<div class=\"job_details\">
... | 2018/04/10 | [
"https://Stackoverflow.com/questions/49750424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6757248/"
] | ```
Try this:
stripslashes_deep. <?php wp_editor( stripslashes($content), $editor-id ); ?>
``` | Please try `wp_kses_stripslashes` function. This function changes the character sequence `\"` to just `"`.
```
<?php wp_kses_stripslashes( $string ) ?>
``` |
7,060,435 | I was thinking to start Java enterprise development, so I started with Spring framework. I have already worked on some simple applications like CRUD apps and web services with STS(Spring Tool Suite). I know that there are lot more IDEs available like Myeclipse, intelliJ IDEA, Netbeans, Eclipse ee etc, and all of them h... | 2011/08/14 | [
"https://Stackoverflow.com/questions/7060435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893197/"
] | I haven't tried STS (<http://www.springsource.com/developer/sts>), but for Spring development I would guess that the IDE written by those that write Spring may have the best support.
But, if you are going to pick an IDE based on one technology you should be careful, otherwise you may find that you will need to use sev... | The best IDE, hands down, is IntelliJ. It has terrific Spring support. |
7,060,435 | I was thinking to start Java enterprise development, so I started with Spring framework. I have already worked on some simple applications like CRUD apps and web services with STS(Spring Tool Suite). I know that there are lot more IDEs available like Myeclipse, intelliJ IDEA, Netbeans, Eclipse ee etc, and all of them h... | 2011/08/14 | [
"https://Stackoverflow.com/questions/7060435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893197/"
] | I haven't tried STS (<http://www.springsource.com/developer/sts>), but for Spring development I would guess that the IDE written by those that write Spring may have the best support.
But, if you are going to pick an IDE based on one technology you should be careful, otherwise you may find that you will need to use sev... | The answer is that there is no answer. It comes down to personal preference, what you get used to or policies in work.
Personally I like to know what is going on under the hood, so any old text editor might do, though I quite like STS Spring Roo support (though don't know what netbeans or intellij have to offer. |
7,203,816 | I have a problem with timer, the problem is only in chrome and not in firefox
I Start the timer, when i change the tab in chrome the timer pauses till i switch back to the tab where i started the timer
**Can be tested as...**
Open the file(code attached below) in chrome, start the timer, after 5 secs open a new tab a... | 2011/08/26 | [
"https://Stackoverflow.com/questions/7203816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367016/"
] | It seems like chrome just stops all (javascript) activity if the tab isn't active.
But the problem of time can be solved differently (I had the same problem before). When starting, you could have a var startTime = new Date().getTime();
The number of seconds passed since the start can then be calculated
```
var secon... | generally speaking, timeouts aren't guaranteed to fire at the specified time. |
20,432,976 | Trying to download a file in Java from a Http server (nginx)
The exact same link java is attempting to download works in the browser and downloads, but java responds with:
```
java.io.IOException: <URL WOULD BE HERE> returned response code -1
at com.atlauncher.data.Downloadable.getConnection(Downloadable.java:149... | 2013/12/06 | [
"https://Stackoverflow.com/questions/20432976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/780128/"
] | Instead of a TableLayout you should use a more basic layout (possibly LinearLayout) with a ListView embedded within that layout. Once you have a ListView you can use an ArrayAdapter to populate the sub-views of that ListView. Take a look at the [List View](http://developer.android.com/guide/topics/ui/layout/listview.ht... | Make sure you are using `TableRow.LayoutParams` for your `TextView`. In fact, you should just remove all the lines with `LayoutParams` and use the default, which is going to be `match_parent` width and `wrap_content` height for `TableRow`, and `wrap_content` width and `wrap_content` height for `TextView`.
To enable sc... |
3,140,895 | I have a custom `DataGridViewCell` with a user-control as its editing control. The cell was built in the style of this article: <http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.initializeeditingcontrol.aspx>
For the most part, this works great. The problem is that the regular behavior of ... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/276120/"
] | I figured it out!
The custom control has a `TextBox` on it that *always* has focus (at least, within the usercontrol). When the user types, the keystrokes are going directly to the `TextBox`. But when the `DataGridViewCell` passes the keystroke to the control, it goes to the *user control*, **not** the `TextBox`.
I a... | Trap the keystroke in the form:
```
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If MyGrid.Focused AndAlso MyGrid.CurrentRow IsNot Nothing Then
MyGrid.CurrentCell = MyGrid(4, MyGrid.CurrentRow.Index)
MyGrid.BeginEdit(True)
En... |
52,858,289 | I have been reading posts about `Expression<Func<TModel,TResult>>` for about an hour and I really do not understand this. My apologizes, but I just don't.
I have an issue that I have a abstract class that has a call to EF6 where I need to order by some property that I would like to define in the child class. That sai... | 2018/10/17 | [
"https://Stackoverflow.com/questions/52858289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3120232/"
] | Declare your property as
```
protected Expression<Func<TModel, object>> OrderBy { get; set; }
```
Assign it in `PersonController`
```
OrderBy = p => p.LastName
```
And use it like
```
Repository.Get().OrderBy(OrderBy).ToList()
``` | Under the hood (of EF/LINQ query translation engine) `Expression` (actually all methods call chain) is translated to SQL query. There is expression visitor (see pattern 'visitor'), which does the job.
To get things work:
method `Get` of `IRepository` should return type `DbSet<TModel>` (for EF) or `Table<TModel>` (f... |
9,220,799 | I cannot figure out how to pass the text from a `<SelectListItem>` with a DropDownList from one view to another.
I am using the following in a view:
```
@using (Html.BeginFormAntiForgeryPost())
{
@Html.Hidden("myData", new MvcSerializer().Serialize(Model, SerializationMode.Signed))
...
@Html.DropDownList... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9220799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624479/"
] | No. PHP is run on the server, buy the time it gets to the browser, the PHP code is gone and it is only HTML/CSS/JS etc.
What you are using it the proper way to do it. | You must take into consideration how the web works. You need to make a REQUEST before the web server can build/send a RESPONSE. Therefore, if you don't have AJAX interaction, you can't make a request, and therefore will never receive a response. If all of your data is known ahead of time, you can put it all on the orig... |
9,220,799 | I cannot figure out how to pass the text from a `<SelectListItem>` with a DropDownList from one view to another.
I am using the following in a view:
```
@using (Html.BeginFormAntiForgeryPost())
{
@Html.Hidden("myData", new MvcSerializer().Serialize(Model, SerializationMode.Signed))
...
@Html.DropDownList... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9220799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624479/"
] | No, there is no possible way to auto-refresh div without using external file...but you don't want external file include....then you have to use... ".html"...instand of ".load"...and get all html data from another file and replace fresh data. | No. PHP is run on the server, buy the time it gets to the browser, the PHP code is gone and it is only HTML/CSS/JS etc.
What you are using it the proper way to do it. |
9,220,799 | I cannot figure out how to pass the text from a `<SelectListItem>` with a DropDownList from one view to another.
I am using the following in a view:
```
@using (Html.BeginFormAntiForgeryPost())
{
@Html.Hidden("myData", new MvcSerializer().Serialize(Model, SerializationMode.Signed))
...
@Html.DropDownList... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9220799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624479/"
] | No. You need to issue AJAX request every time in order to refresh content of the element. (as you described using `setInterval()`) | You must take into consideration how the web works. You need to make a REQUEST before the web server can build/send a RESPONSE. Therefore, if you don't have AJAX interaction, you can't make a request, and therefore will never receive a response. If all of your data is known ahead of time, you can put it all on the orig... |
9,220,799 | I cannot figure out how to pass the text from a `<SelectListItem>` with a DropDownList from one view to another.
I am using the following in a view:
```
@using (Html.BeginFormAntiForgeryPost())
{
@Html.Hidden("myData", new MvcSerializer().Serialize(Model, SerializationMode.Signed))
...
@Html.DropDownList... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9220799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624479/"
] | No, there is no possible way to auto-refresh div without using external file...but you don't want external file include....then you have to use... ".html"...instand of ".load"...and get all html data from another file and replace fresh data. | No. You need to issue AJAX request every time in order to refresh content of the element. (as you described using `setInterval()`) |
9,220,799 | I cannot figure out how to pass the text from a `<SelectListItem>` with a DropDownList from one view to another.
I am using the following in a view:
```
@using (Html.BeginFormAntiForgeryPost())
{
@Html.Hidden("myData", new MvcSerializer().Serialize(Model, SerializationMode.Signed))
...
@Html.DropDownList... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9220799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/624479/"
] | No, there is no possible way to auto-refresh div without using external file...but you don't want external file include....then you have to use... ".html"...instand of ".load"...and get all html data from another file and replace fresh data. | You must take into consideration how the web works. You need to make a REQUEST before the web server can build/send a RESPONSE. Therefore, if you don't have AJAX interaction, you can't make a request, and therefore will never receive a response. If all of your data is known ahead of time, you can put it all on the orig... |
2,491,258 | How to control process affinity in .NET 2.0 ? I am newbie in .Net.
please help ! | 2010/03/22 | [
"https://Stackoverflow.com/questions/2491258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298852/"
] | Please have a look at my post @[How to use hardware threads in C# dot net code running on multicore machine?](https://stackoverflow.com/questions/2490711/how-to-use-hardware-threads-in-c-dot-net-code-running-on-multicore-machine/2491143#2491143) | Using the [Process.ProcessorAffinity](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity(v=VS.90).aspx) property.
```
// this will cause the process to run only on CPU 1
Process.ProcessorAffinity = new IntPtr(1 << 0);
// this will cause the process to run only on CPU 1+2
Process.Proce... |
2,491,258 | How to control process affinity in .NET 2.0 ? I am newbie in .Net.
please help ! | 2010/03/22 | [
"https://Stackoverflow.com/questions/2491258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298852/"
] | Please have a look at my post @[How to use hardware threads in C# dot net code running on multicore machine?](https://stackoverflow.com/questions/2490711/how-to-use-hardware-threads-in-c-dot-net-code-running-on-multicore-machine/2491143#2491143) | In general, you do not. Sorry if that is not what you expect, but I do a LOT of server overview here and there and rarely - really rarely - see a need for that.
If you ahve to, look at the Process class - the ProcessAffinity property. But really make sure you have to in the first place. |
17,157,516 | I checked and the font files are on the server:
```
@font-face {
font-family: 'DroidSerifRegular';
src: url('fontface/DroidSerif-Regular-webfont.eot');
src: url('fontface/DroidSerif-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fontface/DroidSerif-Regular-webfont.woff') format('wo... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17157516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147915/"
] | Try to remove this part:
```
local('☺')
```
Or add the rest of fonts in this part too, like
```
src: local('☺'),
url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');
```
And can you confirm you have all these fonts on server too?
---
Try to use this tool to create yout fonts:
<htt... | I had the same problem on an IIS-Server and finally realized, that I had to add the mime-type "woff" to the ISS, so that the file is delivered. It seemed like the other browsers supportet other filetypes, so that they took others when they could not access the woff, but ie11 needed the woff. |
17,157,516 | I checked and the font files are on the server:
```
@font-face {
font-family: 'DroidSerifRegular';
src: url('fontface/DroidSerif-Regular-webfont.eot');
src: url('fontface/DroidSerif-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fontface/DroidSerif-Regular-webfont.woff') format('wo... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17157516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147915/"
] | Try to remove this part:
```
local('☺')
```
Or add the rest of fonts in this part too, like
```
src: local('☺'),
url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');
```
And can you confirm you have all these fonts on server too?
---
Try to use this tool to create yout fonts:
<htt... | IIS-Server versions prior to 8 seem to not have the mime-type "woff" added by default. Add it to the list (server > your site > mime-types) and you should be fine. This at least solved the CSS3114 error in IE 11 for me. FF and Chrome never had a problem with it, as they seem to be less restrictive in this point. |
17,157,516 | I checked and the font files are on the server:
```
@font-face {
font-family: 'DroidSerifRegular';
src: url('fontface/DroidSerif-Regular-webfont.eot');
src: url('fontface/DroidSerif-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fontface/DroidSerif-Regular-webfont.woff') format('wo... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17157516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147915/"
] | I had the same problem on an IIS-Server and finally realized, that I had to add the mime-type "woff" to the ISS, so that the file is delivered. It seemed like the other browsers supportet other filetypes, so that they took others when they could not access the woff, but ie11 needed the woff. | IIS-Server versions prior to 8 seem to not have the mime-type "woff" added by default. Add it to the list (server > your site > mime-types) and you should be fine. This at least solved the CSS3114 error in IE 11 for me. FF and Chrome never had a problem with it, as they seem to be less restrictive in this point. |
50,712,131 | I'm trying to implement middleware in an express server that sets custom uid/admin headers on the incoming request. This modified request will then be used after the middleware to see if an authenticated user/admin is accessing that particular resource.
To do this for a client, I just grab the token on the Authorizati... | 2018/06/06 | [
"https://Stackoverflow.com/questions/50712131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7929314/"
] | Jeeped beat me to it. VBA is not strongly typed, so unless you explicitly tell it that the variable you are assigning is an object-type by using 'Set', the value that A takes is, in this case, the contents of the cell instead of the cell itself.
You don't even need to Dim it, although it is good practice.
```
Sub r... | You're assigning cells(1, 1).value to A. If you want the range object properties of cells(1, 1) (like 'characters') you need to Set a range-type var to cells(1,1).
```
Sub remove()
dim A as range
set A = Cells(1, 1)
pos = InStr(A.value, "e")
A.characters(pos,1).delete'
End Sub
``` |
68,116,082 | I have 2 columns started\_at and ended\_at (both timestamps) and try to calculate the exact difference in minutes, but somehow it dont wanna work.
I've already looked for similar questions but it doesnt work for me..
| started\_at | ended\_at |
| --- | --- |
| 2021-01-02 16:22:53 UTC | 2021-01-02 16:43:40 UTC |
| ... ... | 2021/06/24 | [
"https://Stackoverflow.com/questions/68116082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16185637/"
] | I think you doesn't link your .css file
```
<link rel="stylesheet" href="css/your.css">
``` | Tweak your CSS like this
```
.attachment-label {
font-size: 10px;
font-style: italic;
color: rgba(0, 0, 0, 0.5);}
```
You need to add single space after comma and expected a leading zero |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | Yes, we definitely need be. **I think we even need to be a little more strict on the quality of answers in general, not only the one-liners. An answer of 4 or 5 lines can be just as bad.**
Take a look at these answers to 1 question:
* [A one-liner suggesting online shopping](https://interpersonal.stackexchange.com/q... | **Delete them.**
We don't want users, especially new users, think that one-liner is tolerated here.
Just like putting a question on-hold allows some time for the owner to improve their question, deleting an answer prevent the answer from gaining upvotes (and downvotes, which rarely get reversed later) and allows impr... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | **Delete them.**
We don't want users, especially new users, think that one-liner is tolerated here.
Just like putting a question on-hold allows some time for the owner to improve their question, deleting an answer prevent the answer from gaining upvotes (and downvotes, which rarely get reversed later) and allows impr... | >
> Should we be more strict about one-line answers?
>
>
>
One line answer: If the answer is simply "Try this: ..." and there is no "irrefutable source" (Example: [Help Center > Answering](https://interpersonal.stackexchange.com/help/how-to-answer)) then we run the risk of going against [the purpose of the Stack E... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | **Delete them.**
We don't want users, especially new users, think that one-liner is tolerated here.
Just like putting a question on-hold allows some time for the owner to improve their question, deleting an answer prevent the answer from gaining upvotes (and downvotes, which rarely get reversed later) and allows impr... | The [accepted answer](https://interpersonal.meta.stackexchange.com/a/2019/9053) says,
>
> Provide some evidence, experience or back-up for their suggestions
>
>
>
I'd like to reference [Good Subjective, Bad Subjective](https://stackoverflow.blog/2010/09/29/good-subjective-bad-subjective/) -- which suggests that g... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | Yes, we definitely need be. **I think we even need to be a little more strict on the quality of answers in general, not only the one-liners. An answer of 4 or 5 lines can be just as bad.**
Take a look at these answers to 1 question:
* [A one-liner suggesting online shopping](https://interpersonal.stackexchange.com/q... | As an alternative to @vylix's answer, I'd offer that *education* through commenting is a better teacher than a simple vote for deletion. [This very thing happened to me](https://interpersonal.stackexchange.com/a/6188/3013) - no comment was offered. Just a down vote and vote for deletion. Fortunately apaul linked to thi... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | Yes, we definitely need be. **I think we even need to be a little more strict on the quality of answers in general, not only the one-liners. An answer of 4 or 5 lines can be just as bad.**
Take a look at these answers to 1 question:
* [A one-liner suggesting online shopping](https://interpersonal.stackexchange.com/q... | >
> Should we be more strict about one-line answers?
>
>
>
One line answer: If the answer is simply "Try this: ..." and there is no "irrefutable source" (Example: [Help Center > Answering](https://interpersonal.stackexchange.com/help/how-to-answer)) then we run the risk of going against [the purpose of the Stack E... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | Yes, we definitely need be. **I think we even need to be a little more strict on the quality of answers in general, not only the one-liners. An answer of 4 or 5 lines can be just as bad.**
Take a look at these answers to 1 question:
* [A one-liner suggesting online shopping](https://interpersonal.stackexchange.com/q... | The [accepted answer](https://interpersonal.meta.stackexchange.com/a/2019/9053) says,
>
> Provide some evidence, experience or back-up for their suggestions
>
>
>
I'd like to reference [Good Subjective, Bad Subjective](https://stackoverflow.blog/2010/09/29/good-subjective-bad-subjective/) -- which suggests that g... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | As an alternative to @vylix's answer, I'd offer that *education* through commenting is a better teacher than a simple vote for deletion. [This very thing happened to me](https://interpersonal.stackexchange.com/a/6188/3013) - no comment was offered. Just a down vote and vote for deletion. Fortunately apaul linked to thi... | >
> Should we be more strict about one-line answers?
>
>
>
One line answer: If the answer is simply "Try this: ..." and there is no "irrefutable source" (Example: [Help Center > Answering](https://interpersonal.stackexchange.com/help/how-to-answer)) then we run the risk of going against [the purpose of the Stack E... |
2,003 | There have been a lot of one or two line answers (very brief) on the main site. Most of them, almost all of them IMO, only suggest one or two things to do and never explain why they would work. Though, such answers might be correct, but since sometimes they get upvoted and stick around longer, it is projecting an image... | 2017/11/02 | [
"https://interpersonal.meta.stackexchange.com/questions/2003",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/29/"
] | As an alternative to @vylix's answer, I'd offer that *education* through commenting is a better teacher than a simple vote for deletion. [This very thing happened to me](https://interpersonal.stackexchange.com/a/6188/3013) - no comment was offered. Just a down vote and vote for deletion. Fortunately apaul linked to thi... | The [accepted answer](https://interpersonal.meta.stackexchange.com/a/2019/9053) says,
>
> Provide some evidence, experience or back-up for their suggestions
>
>
>
I'd like to reference [Good Subjective, Bad Subjective](https://stackoverflow.blog/2010/09/29/good-subjective-bad-subjective/) -- which suggests that g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.