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 |
|---|---|---|---|---|---|
22,094,668 | I have a database, I mapped it via Ado.net entity model, now I want to expose a single class from my model via WCF service. How can it be achieved? | 2014/02/28 | [
"https://Stackoverflow.com/questions/22094668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2606389/"
] | I like the CSS solution of A.Wolff best, but here's an alternative.
The changes are only made in your jQuery code.
```
$(function() {
$("#example-one").append("<div id='slider'></div>");
var $slider = $("#slider");
$slider
.width($(".current_page").width())
.css("left", $(".current_page ... | Here is something much more simple: [Fiddle](http://jsfiddle.net/tomanow/GJQA5/7/)
```
$(function() {
$("#example-one").append("<div id='slider'></div>");
var $slider = $("#slider");
$slider
.width($(".current_page").width())
.css("left", $(".current_page a").position().left)
.dat... |
22,094,668 | I have a database, I mapped it via Ado.net entity model, now I want to expose a single class from my model via WCF service. How can it be achieved? | 2014/02/28 | [
"https://Stackoverflow.com/questions/22094668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2606389/"
] | I like the CSS solution of A.Wolff best, but here's an alternative.
The changes are only made in your jQuery code.
```
$(function() {
$("#example-one").append("<div id='slider'></div>");
var $slider = $("#slider");
$slider
.width($(".current_page").width())
.css("left", $(".current_page ... | Here is the update code:
**new CSS**
```
#slider.blue {
background-color: blue;
}
#slider.orange {
background-color: orange;
}
#slider.yellow {
background-color: yellow;
}
#slider.lime {
background-color: lime;
}
```
**JS COde**
```
$(function() {
$("#example-one").append("<div id='slider'></div>");... |
30,546,943 | ```
<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form">
<div class="jtable-input-field-container">
<div class="jtable-input-label">Type</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configType" type="text" name="configType">
</div>
</div>
<div class... | 2015/05/30 | [
"https://Stackoverflow.com/questions/30546943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1993534/"
] | You can try this:
```
$( "div.jtable-input-label:contains('Key')" )
.closest( "div.jtable-input-field-container" )
.css( "display", "none" );
``` | Because IDs must be unique on document context, you should target specific parent element containing `#Edit-configKey` DIV instead:
```
$('#Edit-configKey').closest('.jtable-input-field-container').hide();
``` |
30,546,943 | ```
<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form">
<div class="jtable-input-field-container">
<div class="jtable-input-label">Type</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configType" type="text" name="configType">
</div>
</div>
<div class... | 2015/05/30 | [
"https://Stackoverflow.com/questions/30546943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1993534/"
] | You can try this:
```
$( "div.jtable-input-label:contains('Key')" )
.closest( "div.jtable-input-field-container" )
.css( "display", "none" );
``` | Try this code
```
$(document).ready(function(){
$( "div.jtable-input-label:contains('Key')" ).parent().hide();
});
```
Hope this will help you. |
30,546,943 | ```
<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form">
<div class="jtable-input-field-container">
<div class="jtable-input-label">Type</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configType" type="text" name="configType">
</div>
</div>
<div class... | 2015/05/30 | [
"https://Stackoverflow.com/questions/30546943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1993534/"
] | try this,
```
$("#jtable-edit-form .jtable-input-label:contains('Key')" ).parent().hide();
```
See this jsfiddle <https://jsfiddle.net/cL4wsL3q/1/> | Because IDs must be unique on document context, you should target specific parent element containing `#Edit-configKey` DIV instead:
```
$('#Edit-configKey').closest('.jtable-input-field-container').hide();
``` |
30,546,943 | ```
<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form">
<div class="jtable-input-field-container">
<div class="jtable-input-label">Type</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configType" type="text" name="configType">
</div>
</div>
<div class... | 2015/05/30 | [
"https://Stackoverflow.com/questions/30546943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1993534/"
] | try this,
```
$("#jtable-edit-form .jtable-input-label:contains('Key')" ).parent().hide();
```
See this jsfiddle <https://jsfiddle.net/cL4wsL3q/1/> | Try this code
```
$(document).ready(function(){
$( "div.jtable-input-label:contains('Key')" ).parent().hide();
});
```
Hope this will help you. |
33,904,005 | I'm trying to modify elements of an array in a function. This works fine when kept in main but when I port it to a function it segfaults after accessing the first member of the array.
The code below is just a reduced version of my actual code to show where I'm getting the segfault.
```
#include <stdio.h>
#include <s... | 2015/11/24 | [
"https://Stackoverflow.com/questions/33904005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5601548/"
] | `votersPtr[i]->id`, which is the same as `(*votersPtr[i]).id` should be `(*votersPtr)[i].id`. | Remember that `votersPtr` is a pointer to a pointer of an array.
So shouldn't the following line:
```
votersPtr[i]->id = (unsigned short) i;
```
Instead be:
```
(*votersPtr)[i].id = (unsigned short) i;
``` |
33,904,005 | I'm trying to modify elements of an array in a function. This works fine when kept in main but when I port it to a function it segfaults after accessing the first member of the array.
The code below is just a reduced version of my actual code to show where I'm getting the segfault.
```
#include <stdio.h>
#include <s... | 2015/11/24 | [
"https://Stackoverflow.com/questions/33904005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5601548/"
] | The type `voter **` is ambiguously either a *pointer to an array of pointers to `voter` objects* or a *pointer to a pointer to an array of `voter` objects*. Your code is using it as the first, but should be using it as the second. Change
```
votersPtr[i]->id = ...
```
to
```
(*votersPtr)[i].id = ...
```
and every... | Remember that `votersPtr` is a pointer to a pointer of an array.
So shouldn't the following line:
```
votersPtr[i]->id = (unsigned short) i;
```
Instead be:
```
(*votersPtr)[i].id = (unsigned short) i;
``` |
33,904,005 | I'm trying to modify elements of an array in a function. This works fine when kept in main but when I port it to a function it segfaults after accessing the first member of the array.
The code below is just a reduced version of my actual code to show where I'm getting the segfault.
```
#include <stdio.h>
#include <s... | 2015/11/24 | [
"https://Stackoverflow.com/questions/33904005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5601548/"
] | `votersPtr[i]->id`, which is the same as `(*votersPtr[i]).id` should be `(*votersPtr)[i].id`. | The type `voter **` is ambiguously either a *pointer to an array of pointers to `voter` objects* or a *pointer to a pointer to an array of `voter` objects*. Your code is using it as the first, but should be using it as the second. Change
```
votersPtr[i]->id = ...
```
to
```
(*votersPtr)[i].id = ...
```
and every... |
397,446 | I want to draw complete binary tree with some portion highlighted. I am able to draw the complete binary tree, but not able to highlight the specified portion.
I want to draw the digram given below:
[](https://i.stack.imgur.com/mj9OZ.jpg)
Till now I... | 2017/10/22 | [
"https://tex.stackexchange.com/questions/397446",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/142684/"
] | I think, in theory, that this should be possible by adding
```
tikz={\node[draw,circle,red,fit=()(!1)(!2)}
```
to the root of the node that you want to circle. Here `()` refers to the node and `(!1)` and `(!2)` its children. Unfortunately, this doesn't quite work because it gives:
[ package. Since the `istgame` environment is (almost) the same as the `tikzpicture` environment, you can use any `TikZ` macros in the `istgame` environment.
[](https://i.stac... |
67,715,975 | I have a website for a project that needs to summarize all of the budget categories in one column.
For example I have a column which contains:
Categories:
Water,Electricity,Gas,Rentals,Hospital Fees,Medicine,Personal Care,Fitness,
I want to select the sum of
water,electricity,gas,rentals
and name it as utility bi... | 2021/05/27 | [
"https://Stackoverflow.com/questions/67715975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16044580/"
] | You'd have some other table perhaps, or another column on this table, that maps the specific bills to a general group or category
You would then run a query like (if you put the category group in the main table)
```
SELECT categorygroup, sum(amount)
FROM bills
GROUP BY categorygroup
```
Or (if you have a separate t... | You may use conditional aggregation. Like
```sql
SELECT project,
SUM(CASE WHEN category IN ('water','electricity','gas','rentals')
THEN spent
ELSE 0
END) AS bills,
SUM(CASE WHEN category IN ('hospital fees','medicine','personal care','fitness')
... |
381,278 | Since I have osxfuse installed it would be nice if I could use it. There are a [lot of](https://apple.stackexchange.com/questions/73156/) (heavily) outdated [articles](https://apple.stackexchange.com/questions/140536/) here, saying that it is not [possible](https://apple.stackexchange.com/questions/128060/). Is this st... | 2020/02/04 | [
"https://apple.stackexchange.com/questions/381278",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/66939/"
] | >
> **Update**: According to this [document in homebrew-core](https://github.com/Homebrew/homebrew-core/pull/64491) from November 2020, Homebrew maintainers no longer update or support macFUSE formulae, and Homebrew's continuous integration doesn't test them. macFUSE formulae will eventually be removed in the indeterm... | With regards to the prior answer by @Udhy only the VM option has any chance of working but with a major caveat that it is VERY slow (I never got better than 30mb/sec).
Paragon simply does not work, refuses to mount any of my EXT4 disks. Not sure why, maybe a Catalina issue? However I'm not going to pay them so they ca... |
381,278 | Since I have osxfuse installed it would be nice if I could use it. There are a [lot of](https://apple.stackexchange.com/questions/73156/) (heavily) outdated [articles](https://apple.stackexchange.com/questions/140536/) here, saying that it is not [possible](https://apple.stackexchange.com/questions/128060/). Is this st... | 2020/02/04 | [
"https://apple.stackexchange.com/questions/381278",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/66939/"
] | >
> **Update**: According to this [document in homebrew-core](https://github.com/Homebrew/homebrew-core/pull/64491) from November 2020, Homebrew maintainers no longer update or support macFUSE formulae, and Homebrew's continuous integration doesn't test them. macFUSE formulae will eventually be removed in the indeterm... | The only way I have been able to read/write ext4 is by using a virtual machine such as Virtual Box, running Linux (e.g., Linuxmint). It's odd that Paragon doesn't work in Catalina. Ext4fuse only gave me errors. |
381,278 | Since I have osxfuse installed it would be nice if I could use it. There are a [lot of](https://apple.stackexchange.com/questions/73156/) (heavily) outdated [articles](https://apple.stackexchange.com/questions/140536/) here, saying that it is not [possible](https://apple.stackexchange.com/questions/128060/). Is this st... | 2020/02/04 | [
"https://apple.stackexchange.com/questions/381278",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/66939/"
] | For newer macs, e.g. Catalina, `brew install macfuse` instead of `brew install osxfuse` will work | With regards to the prior answer by @Udhy only the VM option has any chance of working but with a major caveat that it is VERY slow (I never got better than 30mb/sec).
Paragon simply does not work, refuses to mount any of my EXT4 disks. Not sure why, maybe a Catalina issue? However I'm not going to pay them so they ca... |
381,278 | Since I have osxfuse installed it would be nice if I could use it. There are a [lot of](https://apple.stackexchange.com/questions/73156/) (heavily) outdated [articles](https://apple.stackexchange.com/questions/140536/) here, saying that it is not [possible](https://apple.stackexchange.com/questions/128060/). Is this st... | 2020/02/04 | [
"https://apple.stackexchange.com/questions/381278",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/66939/"
] | For newer macs, e.g. Catalina, `brew install macfuse` instead of `brew install osxfuse` will work | The only way I have been able to read/write ext4 is by using a virtual machine such as Virtual Box, running Linux (e.g., Linuxmint). It's odd that Paragon doesn't work in Catalina. Ext4fuse only gave me errors. |
584,665 | In Excel, if I have two lines in A1:
```
Hello
World
```
but if I go over to A2 and type `=lower(A1)`, I get:
```
helloworld
```
How can I preserve the newline between *Hello* and *World*? | 2013/04/18 | [
"https://superuser.com/questions/584665",
"https://superuser.com",
"https://superuser.com/users/210559/"
] | Use `=lower(A1)` and then turn on `Wrap Text` for that cell. | Oddly enough, the newline is still there in A2, but the formatting of the cell is not showing it. If you click on A1, click `Format Painter` and the click on A2 then the newline will appear. You can also right click and select Format > Text
I don't think you can apply the right format as part of the formula though |
49,572,567 | I'm trying to filter a simple `HTML` table with the filter being determined by multiple radio buttons. The goal is to show/hide any rows that contain/don't contain the words in the filter.
For example if I select "**yes**" on the "`auto`" filter and "**no**" on the "manually" filter it should look in the column named ... | 2018/03/30 | [
"https://Stackoverflow.com/questions/49572567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641691/"
] | I am not sure what do you want to do with Inactive Radio button,
Without inactive following code will solve your problem.
```
$(document).ready(function(){
$('input[type="radio"]').change(function () {
var firstRow = 'name';
var auto = $('input[name="auto"]:checked').prop('value') || '';
v... | **HTML**
```
...
<tr class="header"> // added class here
<th>name</th>
<th>auto</th>
<th>manually</th>
<th>downgrade</th>
</tr>
...
```
**Script**
```
$('input[type="radio"]').change(function () {
var auto = $('input[name="auto"]:checked').prop('value') || '';
var manually = $('input[name="m... |
49,572,567 | I'm trying to filter a simple `HTML` table with the filter being determined by multiple radio buttons. The goal is to show/hide any rows that contain/don't contain the words in the filter.
For example if I select "**yes**" on the "`auto`" filter and "**no**" on the "manually" filter it should look in the column named ... | 2018/03/30 | [
"https://Stackoverflow.com/questions/49572567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641691/"
] | Try this, I think this is what you want:
```js
$(document).ready(function(){
$('input[type="radio"]').change(function () {
var firstRow = 'name';
var auto = $('input[name="auto"]:checked').prop('value') || '';
var manually = $('input[name="manually"]:checked').prop('value') || '';
... | **HTML**
```
...
<tr class="header"> // added class here
<th>name</th>
<th>auto</th>
<th>manually</th>
<th>downgrade</th>
</tr>
...
```
**Script**
```
$('input[type="radio"]').change(function () {
var auto = $('input[name="auto"]:checked').prop('value') || '';
var manually = $('input[name="m... |
49,572,567 | I'm trying to filter a simple `HTML` table with the filter being determined by multiple radio buttons. The goal is to show/hide any rows that contain/don't contain the words in the filter.
For example if I select "**yes**" on the "`auto`" filter and "**no**" on the "manually" filter it should look in the column named ... | 2018/03/30 | [
"https://Stackoverflow.com/questions/49572567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8641691/"
] | Try this, I think this is what you want:
```js
$(document).ready(function(){
$('input[type="radio"]').change(function () {
var firstRow = 'name';
var auto = $('input[name="auto"]:checked').prop('value') || '';
var manually = $('input[name="manually"]:checked').prop('value') || '';
... | I am not sure what do you want to do with Inactive Radio button,
Without inactive following code will solve your problem.
```
$(document).ready(function(){
$('input[type="radio"]').change(function () {
var firstRow = 'name';
var auto = $('input[name="auto"]:checked').prop('value') || '';
v... |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | Just change `+` to `-`:
```
str = str.replace(/[^a-z0-9-]/g, "");
```
You can read it as:
1. `[^ ]`: match NOT from the set
2. `[^a-z0-9-]`: match if not `a-z`, `0-9` or `-`
3. `/ /g`: do global match
**More information:**
* <https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions> | Your character class (the part in the square brackets) is saying that you want to match anything except 0-9 and a-z and +. You aren't explicit about how many a-z or 0-9 you want to match, but I assume the + means you want to replace strings of at least one alphanumeric character. It should read instead:
```
str = str.... |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | This should work :
```
str = str.replace(/[^a-z0-9-]/g, '');
```
Everything between the indicates what your are looking for
1. `/` is here to delimit your pattern so you have one to start and one to end
2. `[]` indicates the pattern your are looking for on one specific character
3. `^` indicates that you want every... | Just change `+` to `-`:
```
str = str.replace(/[^a-z0-9-]/g, "");
```
You can read it as:
1. `[^ ]`: match NOT from the set
2. `[^a-z0-9-]`: match if not `a-z`, `0-9` or `-`
3. `/ /g`: do global match
**More information:**
* <https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions> |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | Just change `+` to `-`:
```
str = str.replace(/[^a-z0-9-]/g, "");
```
You can read it as:
1. `[^ ]`: match NOT from the set
2. `[^a-z0-9-]`: match if not `a-z`, `0-9` or `-`
3. `/ /g`: do global match
**More information:**
* <https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions> | ```
str = str.replace(/\W/g, "");
```
This will be a shorter form |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | Just change `+` to `-`:
```
str = str.replace(/[^a-z0-9-]/g, "");
```
You can read it as:
1. `[^ ]`: match NOT from the set
2. `[^a-z0-9-]`: match if not `a-z`, `0-9` or `-`
3. `/ /g`: do global match
**More information:**
* <https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions> | We can use `/[a-zA-Z]/g` to select small letter and caps letter sting in the word or sentence and replace.
```js
var str = 'MM-DD-yyyy'
var modifiedStr = str.replace(/[a-zA-Z]/g, '_')
console.log(modifiedStr)
``` |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | This should work :
```
str = str.replace(/[^a-z0-9-]/g, '');
```
Everything between the indicates what your are looking for
1. `/` is here to delimit your pattern so you have one to start and one to end
2. `[]` indicates the pattern your are looking for on one specific character
3. `^` indicates that you want every... | Your character class (the part in the square brackets) is saying that you want to match anything except 0-9 and a-z and +. You aren't explicit about how many a-z or 0-9 you want to match, but I assume the + means you want to replace strings of at least one alphanumeric character. It should read instead:
```
str = str.... |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | Your character class (the part in the square brackets) is saying that you want to match anything except 0-9 and a-z and +. You aren't explicit about how many a-z or 0-9 you want to match, but I assume the + means you want to replace strings of at least one alphanumeric character. It should read instead:
```
str = str.... | ```
str = str.replace(/\W/g, "");
```
This will be a shorter form |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | Your character class (the part in the square brackets) is saying that you want to match anything except 0-9 and a-z and +. You aren't explicit about how many a-z or 0-9 you want to match, but I assume the + means you want to replace strings of at least one alphanumeric character. It should read instead:
```
str = str.... | We can use `/[a-zA-Z]/g` to select small letter and caps letter sting in the word or sentence and replace.
```js
var str = 'MM-DD-yyyy'
var modifiedStr = str.replace(/[a-zA-Z]/g, '_')
console.log(modifiedStr)
``` |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | This should work :
```
str = str.replace(/[^a-z0-9-]/g, '');
```
Everything between the indicates what your are looking for
1. `/` is here to delimit your pattern so you have one to start and one to end
2. `[]` indicates the pattern your are looking for on one specific character
3. `^` indicates that you want every... | ```
str = str.replace(/\W/g, "");
```
This will be a shorter form |
13,726,429 | I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no explanation.
I am using `str = str.replace(/[^a-z0-9+]/g, '');` at the moment. But what I would like to do is allow all alp... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13726429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1359306/"
] | This should work :
```
str = str.replace(/[^a-z0-9-]/g, '');
```
Everything between the indicates what your are looking for
1. `/` is here to delimit your pattern so you have one to start and one to end
2. `[]` indicates the pattern your are looking for on one specific character
3. `^` indicates that you want every... | We can use `/[a-zA-Z]/g` to select small letter and caps letter sting in the word or sentence and replace.
```js
var str = 'MM-DD-yyyy'
var modifiedStr = str.replace(/[a-zA-Z]/g, '_')
console.log(modifiedStr)
``` |
5,223,716 | I am trying to insensitive replace string, so I'm using str\_ireplace() but it does something I dont want and I have no clue how to overcome this problem.
so this is my code:
```
$q = "pArty";
$str = "PARty all day long";
echo str_ireplace($q,'<b>' . $q . '</b>',$str);
```
The output will be like that: `"<b>pArty</... | 2011/03/07 | [
"https://Stackoverflow.com/questions/5223716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/519002/"
] | You could do this with `preg_replace`, e.g.:
```
$q = preg_quote($q, '/'); // in case it has characters of significance to PCRE
echo preg_replace('/' . $q . '/i', '<b>$0</b>', $str);
``` | Its because you are asking to replace " P A R t y" with "p A r t y".
As commanded, php obeyed.
However, why do you even want to replace anything? The original is the word you require. |
34,160 | I'm making a malware software in my final thesis at the university. I won't use it ever, and it was made by educational and scientific purposes only. But my university will publish it, giving the opportunity for everyone to use it. If someone commit a crime with my software, can I get in trouble? | 2018/12/07 | [
"https://law.stackexchange.com/questions/34160",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/-1/"
] | >
> my university will publish it, giving the opportunity for everyone to
> use it. If someone commit a crime with my software, can I get in
> trouble?
>
>
>
I would say "No" for three reasons. I will assume that you are in a jurisdiction of the U.S. or reasonably similar thereto.
First, the malware code is par... | There's not much I can say without knowing where you're operating, but I would suspect the charges would fall on the party who used it, not the developer. Especially if you could prove your university sanctioned the project's creation and lack of ill intent. I know this isn't the place for opinions, but I could find no... |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can only truly use `SELECT @@IDENTITY` after an insert - the last insert into a table that has an IDENTITY column is the value you'll get back.
You cannot "limit" it to a table - the value in @@IDENTITY - and by the way, I'd **strongly recommend** using SCOPE\_IDENTITY() instead!! - is the last value on any IDENTI... | I've never known @@IDENTITY to be used this way, i've only ever used it to access the ID of a newly inserted record. |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can use [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx)
```
IDENT_CURRENT( 'table_name' )
```
Note that IDENT\_CURRENT returns the last identity value for the table **in any session and any scope**. This means, that if another identity value was inserted after your identity value then you... | You can only truly use `SELECT @@IDENTITY` after an insert - the last insert into a table that has an IDENTITY column is the value you'll get back.
You cannot "limit" it to a table - the value in @@IDENTITY - and by the way, I'd **strongly recommend** using SCOPE\_IDENTITY() instead!! - is the last value on any IDENTI... |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can only truly use `SELECT @@IDENTITY` after an insert - the last insert into a table that has an IDENTITY column is the value you'll get back.
You cannot "limit" it to a table - the value in @@IDENTITY - and by the way, I'd **strongly recommend** using SCOPE\_IDENTITY() instead!! - is the last value on any IDENTI... | [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx) does what you want. But don't.
This is in addition to marc\_s' answer |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can only truly use `SELECT @@IDENTITY` after an insert - the last insert into a table that has an IDENTITY column is the value you'll get back.
You cannot "limit" it to a table - the value in @@IDENTITY - and by the way, I'd **strongly recommend** using SCOPE\_IDENTITY() instead!! - is the last value on any IDENTI... | That's correct. @@IDENTITY cannot be used the way you think it can be. It can only be used after an INSERT into a table. Let's consider this for a scenario:
You have two tables: Order (Primary Key: OrderID), OrderDetails (Foreign Key: OrderID)
You perform
INSERT INTO Order
VALUES('Pillows')
-- Note that OrderId is n... |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can use [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx)
```
IDENT_CURRENT( 'table_name' )
```
Note that IDENT\_CURRENT returns the last identity value for the table **in any session and any scope**. This means, that if another identity value was inserted after your identity value then you... | I've never known @@IDENTITY to be used this way, i've only ever used it to access the ID of a newly inserted record. |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx) does what you want. But don't.
This is in addition to marc\_s' answer | I've never known @@IDENTITY to be used this way, i've only ever used it to access the ID of a newly inserted record. |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | I've never known @@IDENTITY to be used this way, i've only ever used it to access the ID of a newly inserted record. | That's correct. @@IDENTITY cannot be used the way you think it can be. It can only be used after an INSERT into a table. Let's consider this for a scenario:
You have two tables: Order (Primary Key: OrderID), OrderDetails (Foreign Key: OrderID)
You perform
INSERT INTO Order
VALUES('Pillows')
-- Note that OrderId is n... |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can use [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx)
```
IDENT_CURRENT( 'table_name' )
```
Note that IDENT\_CURRENT returns the last identity value for the table **in any session and any scope**. This means, that if another identity value was inserted after your identity value then you... | [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx) does what you want. But don't.
This is in addition to marc\_s' answer |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | You can use [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx)
```
IDENT_CURRENT( 'table_name' )
```
Note that IDENT\_CURRENT returns the last identity value for the table **in any session and any scope**. This means, that if another identity value was inserted after your identity value then you... | That's correct. @@IDENTITY cannot be used the way you think it can be. It can only be used after an INSERT into a table. Let's consider this for a scenario:
You have two tables: Order (Primary Key: OrderID), OrderDetails (Foreign Key: OrderID)
You perform
INSERT INTO Order
VALUES('Pillows')
-- Note that OrderId is n... |
2,009,437 | How can I get the @@IDENTITY for a specific table?
I have been doing
```
select * from myTable
```
as I assume this sets the scope, from the same window SQL query window in SSMS I then run
```
select @@IDENTITY as identt
```
It returns identt as null which is not expected since myTable has many entrie in it a... | 2010/01/05 | [
"https://Stackoverflow.com/questions/2009437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127257/"
] | [IDENT\_CURRENT](http://msdn.microsoft.com/en-us/library/ms175098.aspx) does what you want. But don't.
This is in addition to marc\_s' answer | That's correct. @@IDENTITY cannot be used the way you think it can be. It can only be used after an INSERT into a table. Let's consider this for a scenario:
You have two tables: Order (Primary Key: OrderID), OrderDetails (Foreign Key: OrderID)
You perform
INSERT INTO Order
VALUES('Pillows')
-- Note that OrderId is n... |
14,225,659 | I have found that one of the Microsoft Reporting controls (the Chart) is inadequate for my needs. Since these controls aren't extensible, I've extended the functionality of a WPF control and am saving the control as a graphic. Unfortunately, ReportViewer's image control doesn't support vector graphics, either. Therefor... | 2013/01/08 | [
"https://Stackoverflow.com/questions/14225659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1435756/"
] | My imperfect, but working solution is to use text item placeholders that match the background to mark the positions in the .RDLC report. After generating the PDF, these are identified by way of inheriting iTextSharp's LocationTextExtractionStrategy (as per [this entry by greenhat](https://stackoverflow.com/questions/45... | * add default images as place holders.
* export your xaml files as images.
* now it's possible to replace these default images with new images. more info here: <https://stackoverflow.com/a/8751517/298573> |
25,428,870 | I'm trying to figure out how to write a decorator to check if the function was called with specific optional argument. This may not be the pythonic way of checking for arguments, but I'd like to know the solution using decorators regardless. Here is an example of what I'm looking for:
```
@require_arguments("N", "p") ... | 2014/08/21 | [
"https://Stackoverflow.com/questions/25428870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249341/"
] | Here you go:
```
def require_arguments(*reqargs):
def decorator(func):
def wrapper(*args, **kwargs):
for arg in reqargs:
if not arg in kwargs:
raise TypeError("Missing %s" % arg)
return func(*args, **kwargs)
return wrapper
return decor... | [dano](https://stackoverflow.com/users/2073595/dano)'s answer is correct, the only suggestions I can add are:
* Use [`functools.wraps`](https://docs.python.org/2/library/functools.html#functools.wraps) to create your decorators, this way the name of the function and its *docstring* will be preserved.
* Generate a list... |
71,165,098 | What is an appropriate way to solve the following example with swift?
I know because of type erasure that you cannot assign `StructB` to `item2` in the constructor. In other languages like *Java* I would solve the problem by not having a generic class parameter `T` in the `Container` struct but let vars `item` and `it... | 2022/02/17 | [
"https://Stackoverflow.com/questions/71165098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3477946/"
] | For the problem as described, the answer is very straightforward:
```
struct Container<T: ProtocolA> {
var item: T
var item2: StructB // This isn't T; you hard-coded it to StructB in init
init(item: T) {
self.item = item
self.item2 = StructB()
}
}
let container = Container(item: Stru... | The only way to do something like you want is :
```
struct Container<T: ProtocolA,U: ProtocolA> {
var item: T
var item2: U
init(item: T, item2: U) {
self.item = item
self.item2 = item2
}
}
``` |
44,386,174 | ```
class Node:
def __init__(self, data = None, next = None):
self.data = data
self.next = next
class LinkedList(Node):
def __init__(self, l_size = 0, head = None, tail = None):
Node.__init__(self)
self.l_size = 0
self.head = head
self.tail = tail
def add(self, data):
n = Node(data, ... | 2017/06/06 | [
"https://Stackoverflow.com/questions/44386174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4982544/"
] | Simply aggregate your table per `user_id` and use `HAVING` to ensure both conditions are met for the user.
```
select user_id
from settings
group by user_id
having count(case when token = 'language' and value = 'en' then 1 end) > 0
and count(case when token = 'newsletter' AND value = 1 then 1 end) > 0
```
You can... | Please try This query :
```
SELECT user_id
FROM settings
WHERE (token = 'language' AND value = 'en')
OR (token = 'newsletter' AND value = '1')
```
There is no use of Group By clause |
69,984,598 | I tried using a lambda expression and `count_if()` to find the same string value in a `vector`, but it didn't work. The error message is:
>
> variable 'str' cannot be implicitly captured in a lambda with no capture-default specified
>
>
>
```cpp
std::vector<std::string> hello{"Mon","Tue", "Wes", "perfect","Sun"};... | 2021/11/16 | [
"https://Stackoverflow.com/questions/69984598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16188928/"
] | @Steven
The brackets `[]` of lambda functions, are called a *capture list*. They define the scope of variables that the lambda function uses. See [this reference](https://en.cppreference.com/w/cpp/language/lambda).
When you use this formatting `[&]`, it means you can see all the variables (by reference) of the current... | This function has the same mechanism, only it uses `<hash>` and `<unordered_map>` to store the values and the number of times each is repeated (if it is greater than `1` *occurrence*).
```
template <typename T>
void elements(vector<T>& e)
{
auto h = [](const T* v) { return std::hash<T>()(*v); };
auto eq = [](... |
11,573,562 | In my current project, I am making a sticky-note type application in which the user can have multiple instances open of the same form. However, I was wondering if there was a way in C# where I can create a new instance of form1 however have the new form's title/text/heading to be form2.
If this is achievable, I would ... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11573562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1539802/"
] | Try accessing the forms properties from the class:
```
MyForm newForm = new MyForm();
newForm.Show();
newForm.Text = "Form2";
```
Or call a method from the current form to set the text:
```
// In MyForm
public void SetTitle(string text)
{
this.Text = text;
}
// Call the Method
MyForm newForm = new MyForm();
ne... | Use a static field to keep a count of how many instances have been opened, and use it to set the form's caption.
Here's a sketch; if you want different behavior you could skip the OnFormClosed override:
```
public class TheFormClass : Form
{
private static int _openCount = 0;
protected override void OnLoad(... |
29,709,291 | Chromecast session status returns undefined on Chrome mobile ios. The session exists and has other properties defined, like sessionID. On the desktop, the session status returns "connected", "disconnected", or "stopped" as expected. Is this a bug with Chrome ios? Is there another way to detect the session status? | 2015/04/17 | [
"https://Stackoverflow.com/questions/29709291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634213/"
] | Here's one alternative using `ifelse`
```
> transform(df, NewSize=ifelse(Month==1, Size*Month1,
ifelse(Month==2, Size*Month2, Size*Month3)))
Orig Dest Month Size Month1 Month2 Month3 NewSize
1 A B 1 30 1.0 0.6 0.0 30
2 B A 1 20 0.2 1.0 1.0 4
3 ... | Here's how I'd handle this using `data.table`.
```
require(data.table)
setkey(setDT(df),
Month)[.(mon = 1:3), ## i
NewSize := Size * get(paste0("Month", mon)), ## j
by=.EACHI] ## by
```
* `setDT` converts `df` from *data.frame* to *data.... |
29,709,291 | Chromecast session status returns undefined on Chrome mobile ios. The session exists and has other properties defined, like sessionID. On the desktop, the session status returns "connected", "disconnected", or "stopped" as expected. Is this a bug with Chrome ios? Is there another way to detect the session status? | 2015/04/17 | [
"https://Stackoverflow.com/questions/29709291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634213/"
] | Here's one alternative using `ifelse`
```
> transform(df, NewSize=ifelse(Month==1, Size*Month1,
ifelse(Month==2, Size*Month2, Size*Month3)))
Orig Dest Month Size Month1 Month2 Month3 NewSize
1 A B 1 30 1.0 0.6 0.0 30
2 B A 1 20 0.2 1.0 1.0 4
3 ... | You can use `apply`:
```
apply(df, 1, function(u) as.numeric(u[paste0('Month', u['Month'])])*as.numeric(u['Size']))
#[1] 30 4 0 6 20 0 0 50 12
```
Or a vectorized solution:
```
bool = matrix(rep(df$Month, each=3)==rep(1:3, nrow(df)), byrow=T, ncol=3)
df[c('Month1', 'Month2', 'Month3')][bool] * df$Size
#[1] 30... |
29,709,291 | Chromecast session status returns undefined on Chrome mobile ios. The session exists and has other properties defined, like sessionID. On the desktop, the session status returns "connected", "disconnected", or "stopped" as expected. Is this a bug with Chrome ios? Is there another way to detect the session status? | 2015/04/17 | [
"https://Stackoverflow.com/questions/29709291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634213/"
] | Here's one alternative using `ifelse`
```
> transform(df, NewSize=ifelse(Month==1, Size*Month1,
ifelse(Month==2, Size*Month2, Size*Month3)))
Orig Dest Month Size Month1 Month2 Month3 NewSize
1 A B 1 30 1.0 0.6 0.0 30
2 B A 1 20 0.2 1.0 1.0 4
3 ... | In base R, fully vectorized:
```
df$Size*df[,5:7][cbind(1:nrow(df),df$Month)]
``` |
29,709,291 | Chromecast session status returns undefined on Chrome mobile ios. The session exists and has other properties defined, like sessionID. On the desktop, the session status returns "connected", "disconnected", or "stopped" as expected. Is this a bug with Chrome ios? Is there another way to detect the session status? | 2015/04/17 | [
"https://Stackoverflow.com/questions/29709291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634213/"
] | Here's how I'd handle this using `data.table`.
```
require(data.table)
setkey(setDT(df),
Month)[.(mon = 1:3), ## i
NewSize := Size * get(paste0("Month", mon)), ## j
by=.EACHI] ## by
```
* `setDT` converts `df` from *data.frame* to *data.... | You can use `apply`:
```
apply(df, 1, function(u) as.numeric(u[paste0('Month', u['Month'])])*as.numeric(u['Size']))
#[1] 30 4 0 6 20 0 0 50 12
```
Or a vectorized solution:
```
bool = matrix(rep(df$Month, each=3)==rep(1:3, nrow(df)), byrow=T, ncol=3)
df[c('Month1', 'Month2', 'Month3')][bool] * df$Size
#[1] 30... |
29,709,291 | Chromecast session status returns undefined on Chrome mobile ios. The session exists and has other properties defined, like sessionID. On the desktop, the session status returns "connected", "disconnected", or "stopped" as expected. Is this a bug with Chrome ios? Is there another way to detect the session status? | 2015/04/17 | [
"https://Stackoverflow.com/questions/29709291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634213/"
] | In base R, fully vectorized:
```
df$Size*df[,5:7][cbind(1:nrow(df),df$Month)]
``` | You can use `apply`:
```
apply(df, 1, function(u) as.numeric(u[paste0('Month', u['Month'])])*as.numeric(u['Size']))
#[1] 30 4 0 6 20 0 0 50 12
```
Or a vectorized solution:
```
bool = matrix(rep(df$Month, each=3)==rep(1:3, nrow(df)), byrow=T, ncol=3)
df[c('Month1', 'Month2', 'Month3')][bool] * df$Size
#[1] 30... |
1,148,807 | How would I solve this differential eqn
$$xdy - ydx = (x^2 + y^2)^{1/2} dx$$
I tried bringing the sq root term to the left and it looked like a trigonometric substitution might do the trick, but apparently no.
Any help would be appreciated. | 2015/02/15 | [
"https://math.stackexchange.com/questions/1148807",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/117251/"
] | $$x\frac{dy}{dx} - y = (x^2 + y^2)^{1/2} $$ is an ODE of the homogeneous kind. The usual method to solve it is to let $y(x)=x\:f(x)$
This leads to an ODE of the separable kind easy to solve.
The final result is $y=c\:x^2-\frac{1}{4\:c}$ | The substitution $y = u x$ makes this into a separable differential equation. |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | To answer the question:
GET and POST are one of the many `request types` in the standards of internet.
The difference is that GET can't post data, parameters will be appended to the url (url-parameters) which has it's limitations. POST does post parameters/data.
The standard is:
* GET for getting data.
* POST for c... | replace
```
isset($_POST['mail_sub'])
```
by
```
isset($_POST['theirname'])
```
The main difference between GET and POST requests is that in GET requests all parameter are part of the url and the user sees the parameters. In POST requests the url is not modified and all form parameter are hidden from the user. ... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | To answer the question:
GET and POST are one of the many `request types` in the standards of internet.
The difference is that GET can't post data, parameters will be appended to the url (url-parameters) which has it's limitations. POST does post parameters/data.
The standard is:
* GET for getting data.
* POST for c... | GET - If form method is GET then on submitting the form, Form will be submitted to
```
xyz.com/submit.php?theirname=john&theirpass=password // CHECK HERE - form elements are in URL so not so secure
```
and can be checked by PHP
as
```
if(isset($_GET['their']))
{
$name=$_GET['their']; //name will return John
}
... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | Post is like "sending" the data to the page without giving the user having any interaction with it, when Get shows the parameters in the URL and making it public for the user. Get is more often used on "unsecure" type of datatransactions like for example a searchform and POST is used when you want to make more secure t... | GET - If form method is GET then on submitting the form, Form will be submitted to
```
xyz.com/submit.php?theirname=john&theirpass=password // CHECK HERE - form elements are in URL so not so secure
```
and can be checked by PHP
as
```
if(isset($_GET['their']))
{
$name=$_GET['their']; //name will return John
}
... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | To answer the question:
GET and POST are one of the many `request types` in the standards of internet.
The difference is that GET can't post data, parameters will be appended to the url (url-parameters) which has it's limitations. POST does post parameters/data.
The standard is:
* GET for getting data.
* POST for c... | Replace Your Code:
```
<form name="mail_sub" method="post">
Name: <input type="text" name="theirname"> <br />
Email: <input type="text" name="theirpass"> <br />
<input type="submit" name="submit" value="Join!" style="width:200px">
</form>
<?php
if (isset($_POST['submit']))
{
echo $_POST['theirname'];
... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | $\_POST isn't working for you because you have the form method set to get.
```
<form name="mail_sub" method="post">
```
There's plenty of better info online as to the difference between post and get so I won't go into that but this will fix the issue for you.
Change your PHP as well.
```
if ( isset( $_POST['theirn... | GET - If form method is GET then on submitting the form, Form will be submitted to
```
xyz.com/submit.php?theirname=john&theirpass=password // CHECK HERE - form elements are in URL so not so secure
```
and can be checked by PHP
as
```
if(isset($_GET['their']))
{
$name=$_GET['their']; //name will return John
}
... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | To answer the question:
GET and POST are one of the many `request types` in the standards of internet.
The difference is that GET can't post data, parameters will be appended to the url (url-parameters) which has it's limitations. POST does post parameters/data.
The standard is:
* GET for getting data.
* POST for c... | you used method as GET in form,so your code should be like this
```
<?php echo $_SERVER['PHP_SELF'];?>//the form and action will be same page
<form name="mail_sub" method="get" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="theirname"> <br />
Email: <input type="text" name="t... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | replace
```
isset($_POST['mail_sub'])
```
by
```
isset($_POST['theirname'])
```
The main difference between GET and POST requests is that in GET requests all parameter are part of the url and the user sees the parameters. In POST requests the url is not modified and all form parameter are hidden from the user. ... | you used method as GET in form,so your code should be like this
```
<?php echo $_SERVER['PHP_SELF'];?>//the form and action will be same page
<form name="mail_sub" method="get" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="theirname"> <br />
Email: <input type="text" name="t... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | $\_POST isn't working for you because you have the form method set to get.
```
<form name="mail_sub" method="post">
```
There's plenty of better info online as to the difference between post and get so I won't go into that but this will fix the issue for you.
Change your PHP as well.
```
if ( isset( $_POST['theirn... | replace
```
isset($_POST['mail_sub'])
```
by
```
isset($_POST['theirname'])
```
The main difference between GET and POST requests is that in GET requests all parameter are part of the url and the user sees the parameters. In POST requests the url is not modified and all form parameter are hidden from the user. ... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | $\_POST isn't working for you because you have the form method set to get.
```
<form name="mail_sub" method="post">
```
There's plenty of better info online as to the difference between post and get so I won't go into that but this will fix the issue for you.
Change your PHP as well.
```
if ( isset( $_POST['theirn... | Post is like "sending" the data to the page without giving the user having any interaction with it, when Get shows the parameters in the URL and making it public for the user. Get is more often used on "unsecure" type of datatransactions like for example a searchform and POST is used when you want to make more secure t... |
21,772,974 | I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't k... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21772974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3077765/"
] | replace
```
isset($_POST['mail_sub'])
```
by
```
isset($_POST['theirname'])
```
The main difference between GET and POST requests is that in GET requests all parameter are part of the url and the user sees the parameters. In POST requests the url is not modified and all form parameter are hidden from the user. ... | Replace Your Code:
```
<form name="mail_sub" method="post">
Name: <input type="text" name="theirname"> <br />
Email: <input type="text" name="theirpass"> <br />
<input type="submit" name="submit" value="Join!" style="width:200px">
</form>
<?php
if (isset($_POST['submit']))
{
echo $_POST['theirname'];
... |
39,350,744 | I created a custom Lucene index in a Sitecore 8.1 environment like this:
```xml
<?xml version="1.0"?>
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hin... | 2016/09/06 | [
"https://Stackoverflow.com/questions/39350744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6144330/"
] | After some research I came to the conclusion that to match all the requirements a custom crawler was the only solution. Blogged the code: <http://ggullentops.blogspot.be/2016/10/custom-sitecore-index-crawler.html>
The main reason was that we really had to be able to set this per index - which is not possible with the ... | You can easily create a custom processor that will let you filter what you want:
```cs
namespace Sitecore.Custom
{
public class CustomInboundIndexFilter : InboundIndexFilterProcessor
{
public override void Process(InboundIndexFilterArgs args)
{
var item = args.IndexableToIndex as ... |
39,386,415 | I wrote a piece of code to learn more about `Comparator` function of java collection. I have two sets having 3 elements in each. and i want to compare.
I post my code below and output of counter variable. Can anyone explain why variable `i` gives this weird output ?? I could not understand flow.
```
public class TestP... | 2016/09/08 | [
"https://Stackoverflow.com/questions/39386415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3042916/"
] | I'm not sure what you are finding strange.
You have **two** TreeSet instances, each having its own `CompareID` instance serving as `Comparator`, and each `CompareID` instance maintains it's own counter.
Therefore it's not a surprise to see each counter values (0,1,2,etc...) appearing twice.
As for the order of appeara... | Here Variable i will be initialize for two comparator object , your are initializing i=0, as per your point here compare method will be executed for both sets not necessary to be in sequence, so whats happen is you are expecting sequence output but actually its not
```
0// for set1(collection1)
1
2
3 // remember this... |
39,386,415 | I wrote a piece of code to learn more about `Comparator` function of java collection. I have two sets having 3 elements in each. and i want to compare.
I post my code below and output of counter variable. Can anyone explain why variable `i` gives this weird output ?? I could not understand flow.
```
public class TestP... | 2016/09/08 | [
"https://Stackoverflow.com/questions/39386415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3042916/"
] | I'm not sure what you are finding strange.
You have **two** TreeSet instances, each having its own `CompareID` instance serving as `Comparator`, and each `CompareID` instance maintains it's own counter.
Therefore it's not a surprise to see each counter values (0,1,2,etc...) appearing twice.
As for the order of appeara... | Adding to @Erans answer.
Change the code to the following and you´ll see which comperator does output when
```
class CompareID implements Comparator<ClassA> {
int i = 0;
String a;
public CompareID(String input) {
a = input;
}
@Override
public int compare(ClassA o1, ClassA o2) {
... |
26,504,553 | I have 5 imageviews and I am updating them based on value but the problem is for updating all of them I have redundant code for eacg image updation expect the specific imageView object. Here is example, I have such 5 methods to update each imageview which I guess is not optimal solution.
```
public void imageThird(i... | 2014/10/22 | [
"https://Stackoverflow.com/questions/26504553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132634/"
] | I just tested it with a sample project. It works fine. There must be something wrong with your wiring up the cell.
Here is my code. Only indicating changes from plain vanilla tab bar project template.

```
// FirstViewController.swift
func tableVi... | for calling the method prepareForSegue you must have to add a segue to connect the prototype cell and the destination Controller! method doesn't called if you navigate to destination controller programmatically! |
26,504,553 | I have 5 imageviews and I am updating them based on value but the problem is for updating all of them I have redundant code for eacg image updation expect the specific imageView object. Here is example, I have such 5 methods to update each imageview which I guess is not optimal solution.
```
public void imageThird(i... | 2014/10/22 | [
"https://Stackoverflow.com/questions/26504553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132634/"
] | This happened with me when I was registering cell in ViewDidLoad method using `tableView.register(AnyClass?, forCellReuseIdentifier: String)` When i commented this line and added the cell class and cell identifier in storyboard, it started working. Again if I uncomment that code in viewdidload, it stops working. | for calling the method prepareForSegue you must have to add a segue to connect the prototype cell and the destination Controller! method doesn't called if you navigate to destination controller programmatically! |
1,787,006 | I am working to integrate data from an external web service in the client side of my appliction. Someone asked me to test the condition when the service is unavailable or down. Anyone have any tips on how to block this site temporarily while we run the test to see how the service degrades?
For those curious we are tes... | 2009/11/24 | [
"https://Stackoverflow.com/questions/1787006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10676/"
] | Create some Mock-Webservice class or interface (and [inject](http://martinfowler.com/articles/injection.html) [it](http://www.youtube.com/watch?v=hBVJbzAagfs)). In there, you could test the response of your system to webservice failures and also what happens, if a web-service request take longer than expected or actual... | How about blocking the domain name(s) in question by putting a nonsense entry into the `hosts` file? |
1,787,006 | I am working to integrate data from an external web service in the client side of my appliction. Someone asked me to test the condition when the service is unavailable or down. Anyone have any tips on how to block this site temporarily while we run the test to see how the service degrades?
For those curious we are tes... | 2009/11/24 | [
"https://Stackoverflow.com/questions/1787006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10676/"
] | You need to be sure to test the most common failure modes for this:
1. DNS lookup fails
2. IP connection fails (once DNS lookup succeeds)
3. HTTP response other than 200
4. HTTP response incomplete or timeout
5. HTTP response 200 but RPC or document returned is invalid
Those are just a few common failure modes I coul... | How about blocking the domain name(s) in question by putting a nonsense entry into the `hosts` file? |
56,761,464 | I need to pick a random number from 31 to 359.
```
rand(31, 359);
```
I need the number is not part from this array of numbers:
```
$badNumbers = array(30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360);
```
How can I do this please?
Thanks. | 2019/06/25 | [
"https://Stackoverflow.com/questions/56761464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10296344/"
] | I would probably do this as it completes when one is found:
```
while(in_array($rand = rand(31, 359), $badNumbers));
echo $rand;
```
Here is another way using an array:
```
$good = array_diff(range(31, 359), $badNumbers);
echo $good[array_rand($good)];
```
Or randomize and choose one:
```
shuffle($good);
echo a... | What you need is a *recursive function* (which is a function that keeps calling itself with a condition to break out once the requirement is met) or an infinite loop that breaks when it finds a number that isn't in the array. What this means is that you try to generate a number, but if that number is in the list, you t... |
56,761,464 | I need to pick a random number from 31 to 359.
```
rand(31, 359);
```
I need the number is not part from this array of numbers:
```
$badNumbers = array(30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360);
```
How can I do this please?
Thanks. | 2019/06/25 | [
"https://Stackoverflow.com/questions/56761464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10296344/"
] | What you need is a *recursive function* (which is a function that keeps calling itself with a condition to break out once the requirement is met) or an infinite loop that breaks when it finds a number that isn't in the array. What this means is that you try to generate a number, but if that number is in the list, you t... | This creates an array containing only the good numbers and returns a random value.
```
$goodNumbers = array_diff(range(31,359),[$badNumbers]);
$randIndex = array_rand($goodNumbers);
$randomGoodNumber = $goodNumbers[$randIndex];
``` |
56,761,464 | I need to pick a random number from 31 to 359.
```
rand(31, 359);
```
I need the number is not part from this array of numbers:
```
$badNumbers = array(30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360);
```
How can I do this please?
Thanks. | 2019/06/25 | [
"https://Stackoverflow.com/questions/56761464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10296344/"
] | I would probably do this as it completes when one is found:
```
while(in_array($rand = rand(31, 359), $badNumbers));
echo $rand;
```
Here is another way using an array:
```
$good = array_diff(range(31, 359), $badNumbers);
echo $good[array_rand($good)];
```
Or randomize and choose one:
```
shuffle($good);
echo a... | This creates an array containing only the good numbers and returns a random value.
```
$goodNumbers = array_diff(range(31,359),[$badNumbers]);
$randIndex = array_rand($goodNumbers);
$randomGoodNumber = $goodNumbers[$randIndex];
``` |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | Make a snake game with it. Make a shooter game with it. Make some simple well known games to start off. Once you've done this, you should be more confident with your engine, and making these games will give you ideas on where to keep going. | This is one of the classic problems of game engine development - your engine most probably is too generic.
Pick your favorite genre, perhaps even your favorite game - and look at how things work there. Try to copy a thing or two. Make something good, make something bad. Create experiments and problems. Experiments are... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | Make a snake game with it. Make a shooter game with it. Make some simple well known games to start off. Once you've done this, you should be more confident with your engine, and making these games will give you ideas on where to keep going. | Proceeding with levels seems like a good next step, it can teach you how to create data structures to fit your game, and file input/output.
Also, I would just have tried to build the engine with a set target game in mind. You don't have to be very specific, but say just make the engine for a specific genre that you li... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | Make a snake game with it. Make a shooter game with it. Make some simple well known games to start off. Once you've done this, you should be more confident with your engine, and making these games will give you ideas on where to keep going. | I disagree with @William 'MindWorX' Mariager regarding the nature of the question. It's game design and game programming related and belong here.
@Tomas, you created the egg before the chicken. You want your coding to have a purpose first. This is how project and business works. Most game development team will create... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | Go to LudumDare and see games that got a lot of positive attention in previous competitions. Play them and see which ones you like and simply develop on those ideas. Taking ideas from one game is stealing, taking from two or more is research. | This is one of the classic problems of game engine development - your engine most probably is too generic.
Pick your favorite genre, perhaps even your favorite game - and look at how things work there. Try to copy a thing or two. Make something good, make something bad. Create experiments and problems. Experiments are... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | This is one of the classic problems of game engine development - your engine most probably is too generic.
Pick your favorite genre, perhaps even your favorite game - and look at how things work there. Try to copy a thing or two. Make something good, make something bad. Create experiments and problems. Experiments are... | Proceeding with levels seems like a good next step, it can teach you how to create data structures to fit your game, and file input/output.
Also, I would just have tried to build the engine with a set target game in mind. You don't have to be very specific, but say just make the engine for a specific genre that you li... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | This is one of the classic problems of game engine development - your engine most probably is too generic.
Pick your favorite genre, perhaps even your favorite game - and look at how things work there. Try to copy a thing or two. Make something good, make something bad. Create experiments and problems. Experiments are... | I disagree with @William 'MindWorX' Mariager regarding the nature of the question. It's game design and game programming related and belong here.
@Tomas, you created the egg before the chicken. You want your coding to have a purpose first. This is how project and business works. Most game development team will create... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | Go to LudumDare and see games that got a lot of positive attention in previous competitions. Play them and see which ones you like and simply develop on those ideas. Taking ideas from one game is stealing, taking from two or more is research. | Proceeding with levels seems like a good next step, it can teach you how to create data structures to fit your game, and file input/output.
Also, I would just have tried to build the engine with a set target game in mind. You don't have to be very specific, but say just make the engine for a specific genre that you li... |
35,349 | I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem | 2012/08/31 | [
"https://gamedev.stackexchange.com/questions/35349",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19462/"
] | Go to LudumDare and see games that got a lot of positive attention in previous competitions. Play them and see which ones you like and simply develop on those ideas. Taking ideas from one game is stealing, taking from two or more is research. | I disagree with @William 'MindWorX' Mariager regarding the nature of the question. It's game design and game programming related and belong here.
@Tomas, you created the egg before the chicken. You want your coding to have a purpose first. This is how project and business works. Most game development team will create... |
40,655,245 | I'm trying to remove gray color outline of images.
I saw that that outline means error because image tags don't have source properties.
but if i add `src="image.jpg"`, hovering doesn't work.
how to fix it? so confused....
this is my code
```css
#item1 {
background-image: url('cushion01.jpg');
height: 300px;
... | 2016/11/17 | [
"https://Stackoverflow.com/questions/40655245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6650139/"
] | Strange thing is that you are trying to set background to `<img>` tag. If I were you I'd use `<div>` instead. Then It would be very simple:
HTML:
```
<div class= "secondary__item" style="width: 100%; height : 850px;">
<ul class="item-images">
<li class="item-image"><div class="item" id="item1" ><... | Have you tried instead of using IDs to use the main identifier?
like...
```
.item-image IMG {
border:none;
}
``` |
40,655,245 | I'm trying to remove gray color outline of images.
I saw that that outline means error because image tags don't have source properties.
but if i add `src="image.jpg"`, hovering doesn't work.
how to fix it? so confused....
this is my code
```css
#item1 {
background-image: url('cushion01.jpg');
height: 300px;
... | 2016/11/17 | [
"https://Stackoverflow.com/questions/40655245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6650139/"
] | Strange thing is that you are trying to set background to `<img>` tag. If I were you I'd use `<div>` instead. Then It would be very simple:
HTML:
```
<div class= "secondary__item" style="width: 100%; height : 850px;">
<ul class="item-images">
<li class="item-image"><div class="item" id="item1" ><... | Place this in your image tag
```
alt=""
``` |
40,655,245 | I'm trying to remove gray color outline of images.
I saw that that outline means error because image tags don't have source properties.
but if i add `src="image.jpg"`, hovering doesn't work.
how to fix it? so confused....
this is my code
```css
#item1 {
background-image: url('cushion01.jpg');
height: 300px;
... | 2016/11/17 | [
"https://Stackoverflow.com/questions/40655245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6650139/"
] | Strange thing is that you are trying to set background to `<img>` tag. If I were you I'd use `<div>` instead. Then It would be very simple:
HTML:
```
<div class= "secondary__item" style="width: 100%; height : 850px;">
<ul class="item-images">
<li class="item-image"><div class="item" id="item1" ><... | Try this:
```css
item1:hover {
border: none !important;
display: block;
}
``` |
40,655,245 | I'm trying to remove gray color outline of images.
I saw that that outline means error because image tags don't have source properties.
but if i add `src="image.jpg"`, hovering doesn't work.
how to fix it? so confused....
this is my code
```css
#item1 {
background-image: url('cushion01.jpg');
height: 300px;
... | 2016/11/17 | [
"https://Stackoverflow.com/questions/40655245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6650139/"
] | Strange thing is that you are trying to set background to `<img>` tag. If I were you I'd use `<div>` instead. Then It would be very simple:
HTML:
```
<div class= "secondary__item" style="width: 100%; height : 850px;">
<ul class="item-images">
<li class="item-image"><div class="item" id="item1" ><... | You can apply a simple hack using `margin` & `overflow` property of CSS.
Something like this:
```
/* Image Container (Parent) */
.item-image {
width: 298px;
height: 298px;
overflow: hidden;
}
/* Image (Child) */
.item-image img {
margin: -1px;
background: #eee; /* To show the area covered by image */
}... |
40,655,245 | I'm trying to remove gray color outline of images.
I saw that that outline means error because image tags don't have source properties.
but if i add `src="image.jpg"`, hovering doesn't work.
how to fix it? so confused....
this is my code
```css
#item1 {
background-image: url('cushion01.jpg');
height: 300px;
... | 2016/11/17 | [
"https://Stackoverflow.com/questions/40655245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6650139/"
] | Strange thing is that you are trying to set background to `<img>` tag. If I were you I'd use `<div>` instead. Then It would be very simple:
HTML:
```
<div class= "secondary__item" style="width: 100%; height : 850px;">
<ul class="item-images">
<li class="item-image"><div class="item" id="item1" ><... | I see the answer to this is given in [chrome/safari display border around image](https://stackoverflow.com/questions/4743127/chrome-safari-display-border-around-image).
```
The reason cited is <img> tag does not have proper value in src attribute.
``` |
37,546,012 | I trying to build a Simon game but I'm messing with CSS.
[](https://i.stack.imgur.com/xWinG.jpg)
(source: [walmartimages.com](http://i5.walmartimages.com/dfw/dce07b8c-837a/k2-_c8eba155-7ff4-45e8-86ab-704862d4a446.v1.jpg))
I don't know my mistakes but inline-block ... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37546012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3531612/"
] | Remove the position absolute:
```css
body {
text-align: center;
}
#box {
width: 500px;
height: 500px;
border-radius: 100%;
position: relative;
margin: auto;
background-color: #333;
top: 10vh;
box-shadow: 0px 0px 12px #222;
}
#box .pad {
width: 240px;
height: 240px;
float: left... | Simply remove `position absolute:`and it works just fine. |
37,546,012 | I trying to build a Simon game but I'm messing with CSS.
[](https://i.stack.imgur.com/xWinG.jpg)
(source: [walmartimages.com](http://i5.walmartimages.com/dfw/dce07b8c-837a/k2-_c8eba155-7ff4-45e8-86ab-704862d4a446.v1.jpg))
I don't know my mistakes but inline-block ... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37546012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3531612/"
] | Remove the position absolute:
```css
body {
text-align: center;
}
#box {
width: 500px;
height: 500px;
border-radius: 100%;
position: relative;
margin: auto;
background-color: #333;
top: 10vh;
box-shadow: 0px 0px 12px #222;
}
#box .pad {
width: 240px;
height: 240px;
float: left... | Firstly, you are setting various unnecessary `float:left`, `position:absolute`, `left:0px;` which conflicts with `inline-block` or just don't do anything in this scenario.
So let's remove those and get the `#box .pad` definition much simpler:
```
#box .pad {
width: 240px;
height: 240px;
border: 5px solid ... |
37,546,012 | I trying to build a Simon game but I'm messing with CSS.
[](https://i.stack.imgur.com/xWinG.jpg)
(source: [walmartimages.com](http://i5.walmartimages.com/dfw/dce07b8c-837a/k2-_c8eba155-7ff4-45e8-86ab-704862d4a446.v1.jpg))
I don't know my mistakes but inline-block ... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37546012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3531612/"
] | Remove the position absolute:
```css
body {
text-align: center;
}
#box {
width: 500px;
height: 500px;
border-radius: 100%;
position: relative;
margin: auto;
background-color: #333;
top: 10vh;
box-shadow: 0px 0px 12px #222;
}
#box .pad {
width: 240px;
height: 240px;
float: left... | You should use `position:relative` for your `#box pad` in CSS.
Here is the updated link <https://jsfiddle.net/gbs4320m/2/> |
37,546,012 | I trying to build a Simon game but I'm messing with CSS.
[](https://i.stack.imgur.com/xWinG.jpg)
(source: [walmartimages.com](http://i5.walmartimages.com/dfw/dce07b8c-837a/k2-_c8eba155-7ff4-45e8-86ab-704862d4a446.v1.jpg))
I don't know my mistakes but inline-block ... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37546012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3531612/"
] | Firstly, you are setting various unnecessary `float:left`, `position:absolute`, `left:0px;` which conflicts with `inline-block` or just don't do anything in this scenario.
So let's remove those and get the `#box .pad` definition much simpler:
```
#box .pad {
width: 240px;
height: 240px;
border: 5px solid ... | Simply remove `position absolute:`and it works just fine. |
37,546,012 | I trying to build a Simon game but I'm messing with CSS.
[](https://i.stack.imgur.com/xWinG.jpg)
(source: [walmartimages.com](http://i5.walmartimages.com/dfw/dce07b8c-837a/k2-_c8eba155-7ff4-45e8-86ab-704862d4a446.v1.jpg))
I don't know my mistakes but inline-block ... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37546012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3531612/"
] | You should use `position:relative` for your `#box pad` in CSS.
Here is the updated link <https://jsfiddle.net/gbs4320m/2/> | Simply remove `position absolute:`and it works just fine. |
16,035,976 | I create a loop in Wordpress with the condition like this:
1. Display a specific post format (example: video)
2. Limiting the post number. In this case, I only want to display 2 posts.
Here my code:
```
<?php $i = 1; if (have_posts()) : while (have_posts() && $i < 3) : the_post(); ?>
<?php get_template_part( 'cont... | 2013/04/16 | [
"https://Stackoverflow.com/questions/16035976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2098167/"
] | You can [use `Assume`](http://junit.sourceforge.net/javadoc/org/junit/Assume.html) to turn tests on/off conditionally:
>
> A set of methods useful for stating assumptions about the conditions in which a test is meaningful. A failed assumption does not mean the code is broken, but that the test provides no useful info... | You can do this with JUnit Rules.
There's a whole blog post dedicated to exactly your question [here](http://www.mikereedell.com/2011/12/15/JUnit-Conditional-Ignore-Using-Rules.html), but in short, you do the following:
1. Create a class that implements the `org.junit.rules.TestRule` interface. This interface conta... |
13,456,834 | I need to execute the following function in a specific context.
```
setTimeout(function () {
myFunction();
}, 1000 * 60);
var changeDateFormat = function () {
console.log(this); // this should be $('.myClass')
// but I need to set it from setTimeout
// any hints
... | 2012/11/19 | [
"https://Stackoverflow.com/questions/13456834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1113216/"
] | You can use [jQuery.proxy](http://api.jquery.com/jQuery.proxy/).
```
setTimeout($.proxy(myFunction, $(".myClass")), 1000 * 60);
```
Here's an example: <http://jsfiddle.net/UwUQD/1/>
As James said you can also use `apply` as jQuery does internally:
```
proxy = function() {
return fn.apply( context, args.concat(... | You can set the scope of a function using the JavaScript call or apply functions. Maybe see this [tutorial](http://odetocode.com/blogs/scott/archive/2007/07/05/function-apply-and-function-call-in-javascript.aspx) for details on how they work.
By setting the scope, you can set "this" to be whatever you want. |
13,456,834 | I need to execute the following function in a specific context.
```
setTimeout(function () {
myFunction();
}, 1000 * 60);
var changeDateFormat = function () {
console.log(this); // this should be $('.myClass')
// but I need to set it from setTimeout
// any hints
... | 2012/11/19 | [
"https://Stackoverflow.com/questions/13456834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1113216/"
] | You can use [jQuery.proxy](http://api.jquery.com/jQuery.proxy/).
```
setTimeout($.proxy(myFunction, $(".myClass")), 1000 * 60);
```
Here's an example: <http://jsfiddle.net/UwUQD/1/>
As James said you can also use `apply` as jQuery does internally:
```
proxy = function() {
return fn.apply( context, args.concat(... | Maybe something like this would help:
```
var changeDateFormat = function () {
console.log(this); // this should be $('.myClass')
// but I need to set it from setTimeout
// any hints
};
function callWithContext() {
changeDateFormat.call($(".class"));
}
setTimeout... |
13,456,834 | I need to execute the following function in a specific context.
```
setTimeout(function () {
myFunction();
}, 1000 * 60);
var changeDateFormat = function () {
console.log(this); // this should be $('.myClass')
// but I need to set it from setTimeout
// any hints
... | 2012/11/19 | [
"https://Stackoverflow.com/questions/13456834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1113216/"
] | You can use [jQuery.proxy](http://api.jquery.com/jQuery.proxy/).
```
setTimeout($.proxy(myFunction, $(".myClass")), 1000 * 60);
```
Here's an example: <http://jsfiddle.net/UwUQD/1/>
As James said you can also use `apply` as jQuery does internally:
```
proxy = function() {
return fn.apply( context, args.concat(... | Call [`call`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call) on the function you want invoked, passing your desired `this` object as the first parameter:
```
setTimeout(function () {
myFunction.call($('.myClass'));
}, 1000 * 60);
``` |
13,456,834 | I need to execute the following function in a specific context.
```
setTimeout(function () {
myFunction();
}, 1000 * 60);
var changeDateFormat = function () {
console.log(this); // this should be $('.myClass')
// but I need to set it from setTimeout
// any hints
... | 2012/11/19 | [
"https://Stackoverflow.com/questions/13456834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1113216/"
] | You can use [jQuery.proxy](http://api.jquery.com/jQuery.proxy/).
```
setTimeout($.proxy(myFunction, $(".myClass")), 1000 * 60);
```
Here's an example: <http://jsfiddle.net/UwUQD/1/>
As James said you can also use `apply` as jQuery does internally:
```
proxy = function() {
return fn.apply( context, args.concat(... | You could use [bind](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind) to bind the callback to the desired context.
The downside to this being that some browsers might not support this. But sticking to the basic principles of JS, a *closure* will serve you just perfectly, t... |
38,753,092 | Say I have two dataframes like the following:
```
n = c(2, 3, 5, 5, 6, 7)
s = c("aa", "bb", "cc", "dd", "ee", "ff")
b = c(2, 4, 5, 4, 3, 2)
df = data.frame(n, s, b)
# n s b
#1 2 aa 2
#2 3 bb 4
#3 5 cc 5
#4 5 dd 4
#5 6 ee 3
#6 7 ff 2
n2 = c(5, 6, 7, 6)
s2 = c("aa", "bb", "cc", "ll")
b2 = c("hh", "nn", "ff", "... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38753092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962535/"
] | A coupld of problems: 1) you have built a couple of dataframes with factors which has a tendency to screw up matching and indexing, so I used stringsAsFactors =FALSE in hte dataframe calls. 2) you have an ambiguous situation with no stated resolution when both s2 and b2 have matches in the s column (as does occur in yo... | If you are familiar with SQL you could use that:
```
library(sqldf)
res <- sqldf("SELECT l.*, r.*
FROM df as l
INNER JOIN df2 as r
on l.s = r.s2 OR l.s = r.b2")
res
n s b n2 s2 b2
1 2 aa 2 5 aa hh
2 3 bb 4 6 bb nn
3 5 cc 5 7 cc ff
4 5 dd 4 6 ll dd
5 7 ff 2 7 cc ff
``... |
38,753,092 | Say I have two dataframes like the following:
```
n = c(2, 3, 5, 5, 6, 7)
s = c("aa", "bb", "cc", "dd", "ee", "ff")
b = c(2, 4, 5, 4, 3, 2)
df = data.frame(n, s, b)
# n s b
#1 2 aa 2
#2 3 bb 4
#3 5 cc 5
#4 5 dd 4
#5 6 ee 3
#6 7 ff 2
n2 = c(5, 6, 7, 6)
s2 = c("aa", "bb", "cc", "ll")
b2 = c("hh", "nn", "ff", "... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38753092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962535/"
] | If you are familiar with SQL you could use that:
```
library(sqldf)
res <- sqldf("SELECT l.*, r.*
FROM df as l
INNER JOIN df2 as r
on l.s = r.s2 OR l.s = r.b2")
res
n s b n2 s2 b2
1 2 aa 2 5 aa hh
2 3 bb 4 6 bb nn
3 5 cc 5 7 cc ff
4 5 dd 4 6 ll dd
5 7 ff 2 7 cc ff
``... | One base approach is rbinding two merges. You need to re-create the corresponding join keys in `df2` to effectively concatenate the frames. Also, #5 row does not emerge in desired results:
```
t1 <- merge(df, df2, by.x=c("s"), by.y=c("s2"))
t1$s2 <- t1$s
t2 <- merge(df, df2, by.x=c("s"), by.y=c("b2"))
t2$b2 <- t2$s
... |
38,753,092 | Say I have two dataframes like the following:
```
n = c(2, 3, 5, 5, 6, 7)
s = c("aa", "bb", "cc", "dd", "ee", "ff")
b = c(2, 4, 5, 4, 3, 2)
df = data.frame(n, s, b)
# n s b
#1 2 aa 2
#2 3 bb 4
#3 5 cc 5
#4 5 dd 4
#5 6 ee 3
#6 7 ff 2
n2 = c(5, 6, 7, 6)
s2 = c("aa", "bb", "cc", "ll")
b2 = c("hh", "nn", "ff", "... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38753092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962535/"
] | A coupld of problems: 1) you have built a couple of dataframes with factors which has a tendency to screw up matching and indexing, so I used stringsAsFactors =FALSE in hte dataframe calls. 2) you have an ambiguous situation with no stated resolution when both s2 and b2 have matches in the s column (as does occur in yo... | One base approach is rbinding two merges. You need to re-create the corresponding join keys in `df2` to effectively concatenate the frames. Also, #5 row does not emerge in desired results:
```
t1 <- merge(df, df2, by.x=c("s"), by.y=c("s2"))
t1$s2 <- t1$s
t2 <- merge(df, df2, by.x=c("s"), by.y=c("b2"))
t2$b2 <- t2$s
... |
38,753,092 | Say I have two dataframes like the following:
```
n = c(2, 3, 5, 5, 6, 7)
s = c("aa", "bb", "cc", "dd", "ee", "ff")
b = c(2, 4, 5, 4, 3, 2)
df = data.frame(n, s, b)
# n s b
#1 2 aa 2
#2 3 bb 4
#3 5 cc 5
#4 5 dd 4
#5 6 ee 3
#6 7 ff 2
n2 = c(5, 6, 7, 6)
s2 = c("aa", "bb", "cc", "ll")
b2 = c("hh", "nn", "ff", "... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38753092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962535/"
] | A coupld of problems: 1) you have built a couple of dataframes with factors which has a tendency to screw up matching and indexing, so I used stringsAsFactors =FALSE in hte dataframe calls. 2) you have an ambiguous situation with no stated resolution when both s2 and b2 have matches in the s column (as does occur in yo... | We could use a fuzzy join, it might not be very efficient in this case if you have big data but it's certainly readable. Using my package [*safejoin*](https://github.com/moodymudskipper/safejoin) which wraps (in this case) around *fuzzyjoin* :
```
# devtools::install_github("moodymudskipper/safejoin")
library(safejoin... |
38,753,092 | Say I have two dataframes like the following:
```
n = c(2, 3, 5, 5, 6, 7)
s = c("aa", "bb", "cc", "dd", "ee", "ff")
b = c(2, 4, 5, 4, 3, 2)
df = data.frame(n, s, b)
# n s b
#1 2 aa 2
#2 3 bb 4
#3 5 cc 5
#4 5 dd 4
#5 6 ee 3
#6 7 ff 2
n2 = c(5, 6, 7, 6)
s2 = c("aa", "bb", "cc", "ll")
b2 = c("hh", "nn", "ff", "... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38753092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962535/"
] | We could use a fuzzy join, it might not be very efficient in this case if you have big data but it's certainly readable. Using my package [*safejoin*](https://github.com/moodymudskipper/safejoin) which wraps (in this case) around *fuzzyjoin* :
```
# devtools::install_github("moodymudskipper/safejoin")
library(safejoin... | One base approach is rbinding two merges. You need to re-create the corresponding join keys in `df2` to effectively concatenate the frames. Also, #5 row does not emerge in desired results:
```
t1 <- merge(df, df2, by.x=c("s"), by.y=c("s2"))
t1$s2 <- t1$s
t2 <- merge(df, df2, by.x=c("s"), by.y=c("b2"))
t2$b2 <- t2$s
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.