qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
12,318,120 | I would like to add a table of the coordinates of highlighted site in a ggplot.
Using a previous [question](https://stackoverflow.com/questions/11467965/r-ggplot2-highlighting-selected-points-and-strange-behavior) as example data:
```
set.seed(1)
mydata <- data.frame(a=1:50, b=rnorm(50))
ggplot(mydata,aes(x=a,y=b)) +... | 2012/09/07 | [
"https://Stackoverflow.com/questions/12318120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1392044/"
] | @user3206440, @Punintended An easy way of removing row numbers exists: add `rows = NULL` to the call to `tableGrob`.
```
library(ggplot2)
library(gridExtra)
set.seed(1)
mydata <- data.frame(a=1:50, b=rnorm(50))
mytable <-
cbind(sites=c("site 1","site 2","site 3","site 4"), mydata[10:13,])
k <- ggplot(mydata,aes(x=... | @user3206440: I found a work-around that removes row numbers. I formatted my data as a matrix, assigned column names, then had tableGrob call that directly. Whenever I had tableGrob call it as a data frame, the row name persisted.
Below is an example. I'm sure there's an easier way to deal with the chisq.test output
... |
12,318,120 | I would like to add a table of the coordinates of highlighted site in a ggplot.
Using a previous [question](https://stackoverflow.com/questions/11467965/r-ggplot2-highlighting-selected-points-and-strange-behavior) as example data:
```
set.seed(1)
mydata <- data.frame(a=1:50, b=rnorm(50))
ggplot(mydata,aes(x=a,y=b)) +... | 2012/09/07 | [
"https://Stackoverflow.com/questions/12318120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1392044/"
] | With the release of ['ggplot2'](https://cran.r-project.org/package=ggplot2) 3.0.0 and ['ggpmisc'](https://cran.r-project.org/package=ggpmisc) 0.3.0 a new simpler answer is possible:
```
library(ggplot2)
library(ggpmisc)
set.seed(1)
mydata <- data.frame(a = 1:50, b = rnorm(50))
table <- cbind(sites=c("site 1", "site 2... | @user3206440: I found a work-around that removes row numbers. I formatted my data as a matrix, assigned column names, then had tableGrob call that directly. Whenever I had tableGrob call it as a data frame, the row name persisted.
Below is an example. I'm sure there's an easier way to deal with the chisq.test output
... |
912,078 | This is my first time here so please excuse any errors. I have my desktop in storage in my home country and only I have the key. I had some very important family data on my USB hard drive which I was using with my laptop but recently the drive crashed and I lost everything. I don't need this data right now but I can on... | 2015/05/07 | [
"https://superuser.com/questions/912078",
"https://superuser.com",
"https://superuser.com/users/446033/"
] | Rest easy! Although I can't guarantee your hard drives will work, I see little reason why they will not.
There are many factors that wear a hard drive (writing to it, reading from it, turning it on and off, exposing it to shock, et al); but letting a drive sit does not cause wear. And it sounds like how you stored it ... | If it did not move, is packed well.. and not abused before packing it there is quite a good chance its just fine!
Assuming it didnt have issues before and its not in layers of dust i dont think you have anything to fear |
68,871,856 | I need to create variables that should be named exactly like its API response to save data inside them. So that's why I have to create variables like this:
```
val 50: String
val 100: String
```
But as you know I can't do this so how can I create variables which names only contain digits? | 2021/08/21 | [
"https://Stackoverflow.com/questions/68871856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5361964/"
] | You do it by wrapping with `
```
// define
val `50`: String
val `100`: String
// access
`50` = "123"
`100` = "456"
println("${`50`}${`100`}")
``` | If you use `Retrofit` with `Gson`, you should use `@SerializedName` [Check this out](https://github.com/google/gson/blob/master/UserGuide.md#TOC-JSON-Field-Naming-Support) |
68,871,856 | I need to create variables that should be named exactly like its API response to save data inside them. So that's why I have to create variables like this:
```
val 50: String
val 100: String
```
But as you know I can't do this so how can I create variables which names only contain digits? | 2021/08/21 | [
"https://Stackoverflow.com/questions/68871856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5361964/"
] | If you use `Gson` library to convert Json api to kotlin Data class, add the same `@SerializedName("key_api")` annotation.
```
import com.google.gson.annotations.SerializedName
data class YourResponse {
@SerializedName("50")
val firstVariableName: String? = null,
@SerializedName("100")
val secondVaria... | If you use `Retrofit` with `Gson`, you should use `@SerializedName` [Check this out](https://github.com/google/gson/blob/master/UserGuide.md#TOC-JSON-Field-Naming-Support) |
68,871,856 | I need to create variables that should be named exactly like its API response to save data inside them. So that's why I have to create variables like this:
```
val 50: String
val 100: String
```
But as you know I can't do this so how can I create variables which names only contain digits? | 2021/08/21 | [
"https://Stackoverflow.com/questions/68871856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5361964/"
] | If you use `Gson` library to convert Json api to kotlin Data class, add the same `@SerializedName("key_api")` annotation.
```
import com.google.gson.annotations.SerializedName
data class YourResponse {
@SerializedName("50")
val firstVariableName: String? = null,
@SerializedName("100")
val secondVaria... | You do it by wrapping with `
```
// define
val `50`: String
val `100`: String
// access
`50` = "123"
`100` = "456"
println("${`50`}${`100`}")
``` |
36,904,279 | So I keep getting the same error no matter how many times I try to tweak my code here and there. I will be posting every little bit of code that has to do with the error.
**I will not include unnecessary code so if my code doesn't look complete it's because I cut it out to make it easier for people to diagnose the iss... | 2016/04/28 | [
"https://Stackoverflow.com/questions/36904279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5495155/"
] | You should never create activity instance by yourself! Only system should do that.
If you create instance yourself, onCreate will never get called, as this instance won't go through standard activity lifecycle. | do not new instance by yourself. onCreate was br |
36,904,279 | So I keep getting the same error no matter how many times I try to tweak my code here and there. I will be posting every little bit of code that has to do with the error.
**I will not include unnecessary code so if my code doesn't look complete it's because I cut it out to make it easier for people to diagnose the iss... | 2016/04/28 | [
"https://Stackoverflow.com/questions/36904279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5495155/"
] | You should never create activity instance by yourself! Only system should do that.
If you create instance yourself, onCreate will never get called, as this instance won't go through standard activity lifecycle. | Solved
SharedPreferences sf = this.getActivity().getSharedPreferences("your\_prefs", Activity.MODE\_PRIVATE);
because it was in a fragment class I had to add this.getActivity() and I also ended up adding Activity.MODE\_PRIVATE. I probably was getting null pointer exception because it had no way to access my Activity ... |
36,904,279 | So I keep getting the same error no matter how many times I try to tweak my code here and there. I will be posting every little bit of code that has to do with the error.
**I will not include unnecessary code so if my code doesn't look complete it's because I cut it out to make it easier for people to diagnose the iss... | 2016/04/28 | [
"https://Stackoverflow.com/questions/36904279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5495155/"
] | do not new instance by yourself. onCreate was br | Solved
SharedPreferences sf = this.getActivity().getSharedPreferences("your\_prefs", Activity.MODE\_PRIVATE);
because it was in a fragment class I had to add this.getActivity() and I also ended up adding Activity.MODE\_PRIVATE. I probably was getting null pointer exception because it had no way to access my Activity ... |
11,014,302 | I have the following strings:
```
Actual | Expected
"The Actual String" | "The"
| "Actual"
| "String"
| "Other string"
| ...
```
I need to create a method that will `Assert` that any of the `Expected` strings is contain... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11014302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160259/"
] | It returns true if all the values of expected array is found in actual variable:
```
bool foundall = expected.Except(actual.Split(' ')).Count()==0;
```
Return true even if just one value is contained in the actual string:
```
bool ans = expected.Except(actual.Split(' ')).Count() != expected.Length;
``` | An extension method for the string class?
```
public static bool AnyIn(this string s, params string[] values)
{
return values.Any(x => s.Contains(x));
}
```
callable in this way:
```
string test = "The actual string";
if(test.AnyIn("The") == true) // success
...
if(test.AnyIn("... |
11,014,302 | I have the following strings:
```
Actual | Expected
"The Actual String" | "The"
| "Actual"
| "String"
| "Other string"
| ...
```
I need to create a method that will `Assert` that any of the `Expected` strings is contain... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11014302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160259/"
] | It returns true if all the values of expected array is found in actual variable:
```
bool foundall = expected.Except(actual.Split(' ')).Count()==0;
```
Return true even if just one value is contained in the actual string:
```
bool ans = expected.Except(actual.Split(' ')).Count() != expected.Length;
``` | if you did
```
if (actual.Split(' ').Contains(expected)) return true;
```
but I think you would still need to iterate the expected's
```
foreach (string ex in expected)
{
if (actual.Split(' ').Contains(ex)) return true;
}
```
**EDIT** as per Gene S comment
```
expected.Any(ex => actual.Split(' ').Contains(e... |
11,014,302 | I have the following strings:
```
Actual | Expected
"The Actual String" | "The"
| "Actual"
| "String"
| "Other string"
| ...
```
I need to create a method that will `Assert` that any of the `Expected` strings is contain... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11014302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160259/"
] | I think it's possible to use this "StringAssert.Contains(actualString,containsubstring);" in all Framework .NET | An extension method for the string class?
```
public static bool AnyIn(this string s, params string[] values)
{
return values.Any(x => s.Contains(x));
}
```
callable in this way:
```
string test = "The actual string";
if(test.AnyIn("The") == true) // success
...
if(test.AnyIn("... |
11,014,302 | I have the following strings:
```
Actual | Expected
"The Actual String" | "The"
| "Actual"
| "String"
| "Other string"
| ...
```
I need to create a method that will `Assert` that any of the `Expected` strings is contain... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11014302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160259/"
] | I think it's possible to use this "StringAssert.Contains(actualString,containsubstring);" in all Framework .NET | if you did
```
if (actual.Split(' ').Contains(expected)) return true;
```
but I think you would still need to iterate the expected's
```
foreach (string ex in expected)
{
if (actual.Split(' ').Contains(ex)) return true;
}
```
**EDIT** as per Gene S comment
```
expected.Any(ex => actual.Split(' ').Contains(e... |
1,456,566 | Let "cl" denotes closure, "int" denotes interior.I'm looking for a **Single** example of a subset $A$ of some topological space $X$ where all the following sets are unequal:
$1.$A
$2.$ int(A),
$3.$cl(A),
$4.$ int(cl(A)),
$5.$ Cl(int(cl(A))),
$6.$ cl(int(A)),
$7.$ int(cl(int(A)))
It's clear that such a set $A$ ... | 2015/09/29 | [
"https://math.stackexchange.com/questions/1456566",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/175006/"
] | HINT: Do it in pieces. Let $A\_1=[0,1)\cup(1,2)\cup\{3\}$; then $\operatorname{cl}A\_1=[0,2]\cup\{3\}$, $\operatorname{int}\operatorname{cl}A\_1=(0,2)$, and $\operatorname{cl}\operatorname{int}\operatorname{cl}A\_1=[0,2]$. Moreover, $\operatorname{int}A\_1=(0,1)\cup(1,2)$, so we’ve taken care of everything except $\ope... | Try $A = ([0,2] \cap \mathbb{Q}) \cup \{ 3 \} \cup (4,5) \cup (5,6) \subseteq \mathbb{R}$, with the usual topology.
Edit: after looking at the "possible duplicate" above, the comments there show an almost identical solution. |
61,958,244 | how can i remove the green outlines ouf input fields in blazor after submitting the form?
The input modified fields are still green outlined after successful submit.
On my page its possible load another dataset after successful submit.
The new data is loaded correctly into the input fields, but the borders are still g... | 2020/05/22 | [
"https://Stackoverflow.com/questions/61958244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13597334/"
] | Turns out the problem was that I did not put an absolute path in the `user-data-dir`flag.
```py
from selenium import webdriver
import os
options = webdriver.ChromeOptions()
path = os.path.abspath("account-data/account_3")
options.add_argument("user-data-dir=" + path)
# other options...
chromedriver = "./webdrivers/ch... | I don't see any major issue in your code block.
However **`chromedriver=2.41.578700`** is pretty *old* and *ancient*.
---
Solution
--------
Ensure that:
* *Selenium* is upgraded to current levels [Version 3.141.59](https://www.selenium.dev/downloads/).
* *ChromeDriver* is updated to current [ChromeDriver v83.0](h... |
61,958,244 | how can i remove the green outlines ouf input fields in blazor after submitting the form?
The input modified fields are still green outlined after successful submit.
On my page its possible load another dataset after successful submit.
The new data is loaded correctly into the input fields, but the borders are still g... | 2020/05/22 | [
"https://Stackoverflow.com/questions/61958244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13597334/"
] | Turns out the problem was that I did not put an absolute path in the `user-data-dir`flag.
```py
from selenium import webdriver
import os
options = webdriver.ChromeOptions()
path = os.path.abspath("account-data/account_3")
options.add_argument("user-data-dir=" + path)
# other options...
chromedriver = "./webdrivers/ch... | Instead of all your code try this, first download chromedriver, and install it. Then put that path into the line below.
Remember, when you execute the script below, a new chrome window will be opened but do not close it.
```
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\\Users\\sonal\... |
61,958,244 | how can i remove the green outlines ouf input fields in blazor after submitting the form?
The input modified fields are still green outlined after successful submit.
On my page its possible load another dataset after successful submit.
The new data is loaded correctly into the input fields, but the borders are still g... | 2020/05/22 | [
"https://Stackoverflow.com/questions/61958244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13597334/"
] | Turns out the problem was that I did not put an absolute path in the `user-data-dir`flag.
```py
from selenium import webdriver
import os
options = webdriver.ChromeOptions()
path = os.path.abspath("account-data/account_3")
options.add_argument("user-data-dir=" + path)
# other options...
chromedriver = "./webdrivers/ch... | For `Mac` users (M1, M2) cores -
use `seleniarm/standalone-chromium` instead of ~~`selenium/standalone-chrome`~~ |
586,150 | On my Xen host (systemd in Debian Buster, Xen 4.11), I usually start all guest VMs automatically. I added all my VM configs as link in `/etc/xen/auto/` to the underlying config like
```
/etc/xen/auto/proxy.cfg -> /etc/xen/proxy.cfg
/etc/xen/auto/vm04.matrix.cfg -> /etc/xen/vm04.matrix.cfg
...
```
and sometimes some ... | 2020/05/12 | [
"https://unix.stackexchange.com/questions/586150",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20661/"
] | It looks like `xendomains.service` might be starting too early, before all the logical volumes in `vg0` are activated. You might have to add/change some dependencies to as appropriate to your system configuration.
The current configuration is causing `xendomains.service` and thus the VMs to attempt starting *before* c... | I am not sure this is available in 4.11 I know in 6 it is:
```
xe pool-param-set uuid=UUID other-config:auto_poweron=true
```
When you do a "xe vm-list" that will give you the UUIDs. |
586,150 | On my Xen host (systemd in Debian Buster, Xen 4.11), I usually start all guest VMs automatically. I added all my VM configs as link in `/etc/xen/auto/` to the underlying config like
```
/etc/xen/auto/proxy.cfg -> /etc/xen/proxy.cfg
/etc/xen/auto/vm04.matrix.cfg -> /etc/xen/vm04.matrix.cfg
...
```
and sometimes some ... | 2020/05/12 | [
"https://unix.stackexchange.com/questions/586150",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20661/"
] | It looks like `xendomains.service` might be starting too early, before all the logical volumes in `vg0` are activated. You might have to add/change some dependencies to as appropriate to your system configuration.
The current configuration is causing `xendomains.service` and thus the VMs to attempt starting *before* c... | Workaround
==========
If there is no solution to put the starting of all VMs, you can create a new script, that checks all configs in /etc/xen/auto and starts them manually if not started.
1. create a file `/usr/local/sbin/xen-start-all-auto`
-----------------------------------------------------
```
#!/bin/bash
cd /... |
586,150 | On my Xen host (systemd in Debian Buster, Xen 4.11), I usually start all guest VMs automatically. I added all my VM configs as link in `/etc/xen/auto/` to the underlying config like
```
/etc/xen/auto/proxy.cfg -> /etc/xen/proxy.cfg
/etc/xen/auto/vm04.matrix.cfg -> /etc/xen/vm04.matrix.cfg
...
```
and sometimes some ... | 2020/05/12 | [
"https://unix.stackexchange.com/questions/586150",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20661/"
] | Workaround
==========
If there is no solution to put the starting of all VMs, you can create a new script, that checks all configs in /etc/xen/auto and starts them manually if not started.
1. create a file `/usr/local/sbin/xen-start-all-auto`
-----------------------------------------------------
```
#!/bin/bash
cd /... | I am not sure this is available in 4.11 I know in 6 it is:
```
xe pool-param-set uuid=UUID other-config:auto_poweron=true
```
When you do a "xe vm-list" that will give you the UUIDs. |
3,731,208 | Alternatively, I can write a bunch of `Time.now` and print out the subtractions but is there a standard way it can be done by gems or by Rails' standard and conventional method? | 2010/09/16 | [
"https://Stackoverflow.com/questions/3731208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325418/"
] | You might want to take a look at Railscast [98](http://railscasts.com/episodes/98-request-profiling) and [161](http://railscasts.com/episodes/161-three-profiling-tools).
I've used [NewRelic's](http://www.newrelic.com/) hosted plan and it's definitely a great tool if the basic plan meets your needs or you can afford a ... | You could add a statment on the top/end of your application.html.erb?
```
# application_controller.rb
class ApplicationController < ActionController::Base
before_filter :set_start_timer
def set_start_timer
@start_time = Time.now
end
end
# application.html.haml
=@start_time # this is the overall processing time
=... |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | `mysql_real_escape_string()` will escape any malicious characters. In addition, you can use a regex like `/^[A-Za-z]{4}\d{3}$/` to make sure that the user indeed entered a valid input. | To make input safe for an SQL query, `mysql_real_escape_string()` should be sufficient, though I suggest switching to PDO and [prepared statements](http://www.php.net/manual/en/pdo.prepared-statements.php). They tend to be a little nicer to use, and a little more efficient (the statement is only parsed once, and the qu... |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | To make input safe for an SQL query, `mysql_real_escape_string()` should be sufficient, though I suggest switching to PDO and [prepared statements](http://www.php.net/manual/en/pdo.prepared-statements.php). They tend to be a little nicer to use, and a little more efficient (the statement is only parsed once, and the qu... | `mysql_real_escape_string` should do the job for `$_GET['id']`. Also, take a look at prepared statements via [PDO](http://www.php.net/manual/en/pdo.prepare.php). |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | To make input safe for an SQL query, `mysql_real_escape_string()` should be sufficient, though I suggest switching to PDO and [prepared statements](http://www.php.net/manual/en/pdo.prepared-statements.php). They tend to be a little nicer to use, and a little more efficient (the statement is only parsed once, and the qu... | mysql\_real\_escape\_string() is a good start, and I would agree that using prepared statements would be a pretty good choice. [Zend\_Db](http://framework.zend.com/manual/en/zend.db.html) is nice if you want to look into some DB abstraction which can make PDO easier to work with.
I'd also take this as an opportunity t... |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | `mysql_real_escape_string()` will escape any malicious characters. In addition, you can use a regex like `/^[A-Za-z]{4}\d{3}$/` to make sure that the user indeed entered a valid input. | `mysql_real_escape_string` should do the job for `$_GET['id']`. Also, take a look at prepared statements via [PDO](http://www.php.net/manual/en/pdo.prepare.php). |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | `mysql_real_escape_string()` will escape any malicious characters. In addition, you can use a regex like `/^[A-Za-z]{4}\d{3}$/` to make sure that the user indeed entered a valid input. | mysql\_real\_escape\_string() is a good start, and I would agree that using prepared statements would be a pretty good choice. [Zend\_Db](http://framework.zend.com/manual/en/zend.db.html) is nice if you want to look into some DB abstraction which can make PDO easier to work with.
I'd also take this as an opportunity t... |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | `mysql_real_escape_string()` will escape any malicious characters. In addition, you can use a regex like `/^[A-Za-z]{4}\d{3}$/` to make sure that the user indeed entered a valid input. | If you plan on showing you data to users you would like to remove any HTML tags aswell. Maybe someone inserted a malicious javascript in a guestbook post for example?
this can be done with <http://php.net/manual/en/function.htmlentities.php>
Or you can use a inputfilter class to allow certain tags etc.
I found this ... |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | mysql\_real\_escape\_string() is a good start, and I would agree that using prepared statements would be a pretty good choice. [Zend\_Db](http://framework.zend.com/manual/en/zend.db.html) is nice if you want to look into some DB abstraction which can make PDO easier to work with.
I'd also take this as an opportunity t... | `mysql_real_escape_string` should do the job for `$_GET['id']`. Also, take a look at prepared statements via [PDO](http://www.php.net/manual/en/pdo.prepare.php). |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | If you plan on showing you data to users you would like to remove any HTML tags aswell. Maybe someone inserted a malicious javascript in a guestbook post for example?
this can be done with <http://php.net/manual/en/function.htmlentities.php>
Or you can use a inputfilter class to allow certain tags etc.
I found this ... | `mysql_real_escape_string` should do the job for `$_GET['id']`. Also, take a look at prepared statements via [PDO](http://www.php.net/manual/en/pdo.prepare.php). |
1,858,229 | I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id.
Is `mysql_real_escape_string()` all I need in terms of sanitizing this `$_GET['id']` ? Or are there more steps to take to protec... | 2009/12/07 | [
"https://Stackoverflow.com/questions/1858229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188930/"
] | If you plan on showing you data to users you would like to remove any HTML tags aswell. Maybe someone inserted a malicious javascript in a guestbook post for example?
this can be done with <http://php.net/manual/en/function.htmlentities.php>
Or you can use a inputfilter class to allow certain tags etc.
I found this ... | mysql\_real\_escape\_string() is a good start, and I would agree that using prepared statements would be a pretty good choice. [Zend\_Db](http://framework.zend.com/manual/en/zend.db.html) is nice if you want to look into some DB abstraction which can make PDO easier to work with.
I'd also take this as an opportunity t... |
43,063,774 | Hi everyone,
I want to create a docker container with the IBM Informix Developer Database. But everytime, the start script wants to start the Mongo Listener on port 27017, it freezes.
Does anybody has an idea how I can solve this? I followed all instructions of this page:
<https://hub.docker.com/r/ibmcom/informix... | 2017/03/28 | [
"https://Stackoverflow.com/questions/43063774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Ummmmm, why do you think that is hanging there?
Maybe is just the last message in the start-up.
I did a quick test on a fresh linux box following the instructions on the URL you posted:
After running the command in step 1 ("docker run -it --name iif\_developer\_edition ......") I get:
```
....
....
(expression) Ch... | As answered already, you need to attach to the running docker container after you start and exit the shell. In the description page (<https://hub.docker.com/r/ibmcom/informix-developer-database/>), you can see this step:
4 - To attach to the Informix Docker container (shell)
`docker exec -it iif_developer_editio... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | For hard numbers on the performance of `DateTime` read [this blog post](http://www.dotnetperls.com/datetime-performance). As previous answers state it's important to look at your particular configuration and needs when determining performance. | More important than the question of performance is imo the readability and maintainability of code.
unless you don't have performance issues I would follow the rule "pay attention to performance improvements"
Perhaps if you have a loop than a variable could be named appropriate with "today" but again as long as there... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | For hard numbers on the performance of `DateTime` read [this blog post](http://www.dotnetperls.com/datetime-performance). As previous answers state it's important to look at your particular configuration and needs when determining performance. | I would guess that it is a problem if you are calling the code in a loop. But the best way to find out is to time it and see for yourself how long it takes.
```
var sw = new Stopwatch();
sw.Start();
today = DateTime.Today();
sw.Stop();
var ts = stopWatch.Elapsed;
```
[MSDN Stopwatch reference](http://msdn.microsoft.... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | >
> how important is it to store DateTime.Today in a variable
>
>
>
The best answer to that is to benchmark on the hardware you expect your code to be running on. Unless you are calling it in an extremely tight loop, I doubt it will be a problem.
A better reason to store it in a variable is that you just might ro... | More important than the question of performance is imo the readability and maintainability of code.
unless you don't have performance issues I would follow the rule "pay attention to performance improvements"
Perhaps if you have a loop than a variable could be named appropriate with "today" but again as long as there... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | >
> how important is it to store DateTime.Today in a variable
>
>
>
The best answer to that is to benchmark on the hardware you expect your code to be running on. Unless you are calling it in an extremely tight loop, I doubt it will be a problem.
A better reason to store it in a variable is that you just might ro... | I reject the premise that `DateTime.Today` is an expensive call. You should store it in a variable if it's important that it not change over time. If this code runs right around midnight of the end of a month you could have...problems. From a performance perspective I *highly* doubt this would be an issue.
In any case... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | Benchmark (on my machine, using the Stopwatch class):
```
10,000 DateTime.Today calls and assignment to local variable: 0.0125781 seconds.
10,000 Assignment only operations: 0.0001062 seconds.
```
Code:
```
var s = new Stopwatch();
DateTime date = DateTime.Today;
DateTime date2 = DateTime.Today;
s.Start();
for (in... | The real reason to extract `DateTime.Today` as variable is to prevent possible bugs which **will** appear because of [Murphy's law](http://en.wikipedia.org/wiki/Murphy%27s_law), but would never be isolated and fixed..
Idea is that between first and second usage of `Today` actual date **may** be changed, so you can get... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | I reject the premise that `DateTime.Today` is an expensive call. You should store it in a variable if it's important that it not change over time. If this code runs right around midnight of the end of a month you could have...problems. From a performance perspective I *highly* doubt this would be an issue.
In any case... | The real reason to extract `DateTime.Today` as variable is to prevent possible bugs which **will** appear because of [Murphy's law](http://en.wikipedia.org/wiki/Murphy%27s_law), but would never be isolated and fixed..
Idea is that between first and second usage of `Today` actual date **may** be changed, so you can get... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | >
> how important is it to store DateTime.Today in a variable
>
>
>
The best answer to that is to benchmark on the hardware you expect your code to be running on. Unless you are calling it in an extremely tight loop, I doubt it will be a problem.
A better reason to store it in a variable is that you just might ro... | The real reason to extract `DateTime.Today` as variable is to prevent possible bugs which **will** appear because of [Murphy's law](http://en.wikipedia.org/wiki/Murphy%27s_law), but would never be isolated and fixed..
Idea is that between first and second usage of `Today` actual date **may** be changed, so you can get... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | Benchmark (on my machine, using the Stopwatch class):
```
10,000 DateTime.Today calls and assignment to local variable: 0.0125781 seconds.
10,000 Assignment only operations: 0.0001062 seconds.
```
Code:
```
var s = new Stopwatch();
DateTime date = DateTime.Today;
DateTime date2 = DateTime.Today;
s.Start();
for (in... | >
> how important is it to store DateTime.Today in a variable
>
>
>
The best answer to that is to benchmark on the hardware you expect your code to be running on. Unless you are calling it in an extremely tight loop, I doubt it will be a problem.
A better reason to store it in a variable is that you just might ro... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | Benchmark (on my machine, using the Stopwatch class):
```
10,000 DateTime.Today calls and assignment to local variable: 0.0125781 seconds.
10,000 Assignment only operations: 0.0001062 seconds.
```
Code:
```
var s = new Stopwatch();
DateTime date = DateTime.Today;
DateTime date2 = DateTime.Today;
s.Start();
for (in... | I would guess that it is a problem if you are calling the code in a loop. But the best way to find out is to time it and see for yourself how long it takes.
```
var sw = new Stopwatch();
sw.Start();
today = DateTime.Today();
sw.Stop();
var ts = stopWatch.Elapsed;
```
[MSDN Stopwatch reference](http://msdn.microsoft.... |
15,791,550 | I just saw [this upvoted comment](https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820)
>
> IIRC `DateTime.Today` is a quite expensive call, so you better store the value in a variable first.
>
>
>
It was in response to a post that contained t... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15791550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302677/"
] | For hard numbers on the performance of `DateTime` read [this blog post](http://www.dotnetperls.com/datetime-performance). As previous answers state it's important to look at your particular configuration and needs when determining performance. | The real reason to extract `DateTime.Today` as variable is to prevent possible bugs which **will** appear because of [Murphy's law](http://en.wikipedia.org/wiki/Murphy%27s_law), but would never be isolated and fixed..
Idea is that between first and second usage of `Today` actual date **may** be changed, so you can get... |
15,663 | I sold bitcoins worth of $9500 to a person who told me that he made cheque deposit to my account by using SMART ATM of Westpac bank. When I logged into my Westpac, it was showing that $9500 was pending. Normally Westpac shows every other deposits as pending at first and then eventually clears fund within 2/3 business d... | 2016/12/05 | [
"https://law.stackexchange.com/questions/15663",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/10067/"
] | >
> In other words - is the "illegality" of an action restrained to a
> country, from that country perspective? Or does performing this action
> abroad (where it is legal) does not matter?
>
>
>
**Sometimes yes. It depends on the nature of the act.**
It depends. One of the most important questions is whether th... | Countries can prosecute people for their actions in any part of the world, but generally only do so for certain crimes. In other words, whether the country is likely to assert extraterritorial jurisdiction depends a lot on what "action A" is.
For example, many countries reserve the right to prosecute crimes against hu... |
15,663 | I sold bitcoins worth of $9500 to a person who told me that he made cheque deposit to my account by using SMART ATM of Westpac bank. When I logged into my Westpac, it was showing that $9500 was pending. Normally Westpac shows every other deposits as pending at first and then eventually clears fund within 2/3 business d... | 2016/12/05 | [
"https://law.stackexchange.com/questions/15663",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/10067/"
] | Countries can prosecute people for their actions in any part of the world, but generally only do so for certain crimes. In other words, whether the country is likely to assert extraterritorial jurisdiction depends a lot on what "action A" is.
For example, many countries reserve the right to prosecute crimes against hu... | In principle, any country can prosecute you for anything they like (that is have laws that allow them to prosecute you), as long as they can lay their hands on you.
The most common situation is that country X will prosecute you for something that is declared illegal in country X, if you do this action in country X. T... |
15,663 | I sold bitcoins worth of $9500 to a person who told me that he made cheque deposit to my account by using SMART ATM of Westpac bank. When I logged into my Westpac, it was showing that $9500 was pending. Normally Westpac shows every other deposits as pending at first and then eventually clears fund within 2/3 business d... | 2016/12/05 | [
"https://law.stackexchange.com/questions/15663",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/10067/"
] | >
> In other words - is the "illegality" of an action restrained to a
> country, from that country perspective? Or does performing this action
> abroad (where it is legal) does not matter?
>
>
>
**Sometimes yes. It depends on the nature of the act.**
It depends. One of the most important questions is whether th... | In principle, any country can prosecute you for anything they like (that is have laws that allow them to prosecute you), as long as they can lay their hands on you.
The most common situation is that country X will prosecute you for something that is declared illegal in country X, if you do this action in country X. T... |
2,018,486 | I am pretty new to using object/classes in PHP and I am curious about **EXCEPTIONS**, **TRY**, and **CATCH**
In the example below I have all 3 shown in use. Obviously an exception is some sort of way of triggering an error but I do not understand why? In the code below I could easily show some sort of error or someth... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2018486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143030/"
] | To make things short, an exception is a "*special condition that change the normal flow of program execution*" *(quoting wikipedia)*
You might be interested by (at least) those couple of articles :
* [Exception handling - wikipedia](http://en.wikipedia.org/wiki/Exception_handling)
* [Exceptional PHP: Introduction to ... | Exceptions are a way to separate error-handling code from "regular" code. Basically, this strategy lets you write a block of code and not worry about what might go wrong (the `try` block). Then, later, you catch exceptions that might have been thrown during the block's execution and handle them appropriately. It's a cl... |
53,182,533 | How do I set `left` on a `div` so that it always appears centered over another `div` despite varying in width?
jsFiddle: <http://jsfiddle.net/y04nse5x/>
I'm trying to get each label to align perfectly over the dot, without needing a container. I'm sure this is possible with`offsetWidth` and `offsetLeft`, but I just ... | 2018/11/07 | [
"https://Stackoverflow.com/questions/53182533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4237080/"
] | In your CSS, you're setting the `left` of the description. Let's look at what the `left` is equal to.
[](https://i.stack.imgur.com/xYAoo.png)
hopefully my diagram made sense, thus:
```
var leftValue = this.offsetLeft-(description.offsetWidth-this.off... | You have to take account on description width and button width.
Here's a fiddle: <http://jsfiddle.net/khe8j2ms/>
But I would probably use additional container and style:
```
left: 50%;
transform: translateX(-50%);
``` |
37,270,090 | I am loading images from webserver using AQuery
and getting out of memory exception **(java.lang.OutOfMemoryError: thread creation failed)** . I did everything that docs suggest while there are OOM. but i am not able to escape out. can you please suggest me why i am getting OOM after loading 40 images ? | 2016/05/17 | [
"https://Stackoverflow.com/questions/37270090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4461568/"
] | The best way to avoid a OOM especially when dealing with images is as follows:
1. If possible and your api supports, then try to fetch images based on resolution just enough for the viewing on the mobile device.
2. Using volley or Picasso on its own does not solve the OOM issue.. In order to handle the OOM issue, make... | Try Volley Library for this. its much faster and efficient.
and i think your problem is the heap size of your device, if you are running and testing your app on emulator. then you can easily increase the heap size by editing the device configuration. |
37,270,090 | I am loading images from webserver using AQuery
and getting out of memory exception **(java.lang.OutOfMemoryError: thread creation failed)** . I did everything that docs suggest while there are OOM. but i am not able to escape out. can you please suggest me why i am getting OOM after loading 40 images ? | 2016/05/17 | [
"https://Stackoverflow.com/questions/37270090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4461568/"
] | The best way to avoid a OOM especially when dealing with images is as follows:
1. If possible and your api supports, then try to fetch images based on resolution just enough for the viewing on the mobile device.
2. Using volley or Picasso on its own does not solve the OOM issue.. In order to handle the OOM issue, make... | Thrown when a request for memory is made that can not be satisfied using the available platform resources. Such a request may be made by both the running application or by an internal function of the VM.
Add this feild in application tag of manifest file
```
android:largeHeap="true"
``` |
1,782,604 | This is a very basic question, but I somehow manage to confuse myself all the time. So any help is greatly appreciated. Suppose we have two random variables $X$ and $Y$ with joint distribution function $f$ where $f$ is uniform. That is
$$
f(x,y)= \begin{cases} 1 & \text{if $0\leq x\leq 1$ and $0\leq y \leq 1$}, \\ 0... | 2016/05/12 | [
"https://math.stackexchange.com/questions/1782604",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/64066/"
] | the question on how to condition on a set of the form $\{X=p\}$ which has zero probability used to bug as well. It is defined via the conditional expectation given the random variable $X$.
Recall that for a random variable $Y$ and a measurable function $h$ such that $h(Y)$ is integrable the conditional expectation of ... | You should use the probability density functions.
$$\begin{align}\mathsf P(Y>q\mid X=p) &= \int\_{y>q} f\_{\small Y\mid X}(y\mid p)~\mathsf d y\\[2ex]&= \dfrac{\int\_{y>q}f\_{\small X,Y}(p,y)\,\mathsf d y}{\int\_{\Bbb R}f\_{\small X,Y}(p,y)\,\mathrm d y}\\[2ex]&=\left(\dfrac{\int\_q^1\mathrm d y}{\int\_0^1\mathrm dy}\... |
33,700,721 | My code looks like:
```
Session session = sessionFactory.getCurrentSession();
Query countQuery = session.
createSQLQuery(queryString);
Long totalFilteredRecords = ((Number)countQuery.uniqueResult())
.longValue();
```
The `queryString` is:
```
SELECT COUNT(id)
FROM SOM... | 2015/11/13 | [
"https://Stackoverflow.com/questions/33700721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3275167/"
] | Looking at the comment you added below your question, it looks like you were trying to FORWARD to a view (ex: JSP). So, yes, no redirects there. And you can either set these parameters on the HTML FORM (like you did). But you could also set these values by adding them to the model. So, in this case, you should definite... | I used two controllers to render a view having a query param in it's address bar:
```
@GetMapping("/requesting-path")
public String backToApp(Model model) {
return "redirect:/shown-in-addressbar-path?paramKey=paramValue";
}
@GetMapping("/shown-in-addressbar-path")
public String backToApp(Model model) {
return... |
33,700,721 | My code looks like:
```
Session session = sessionFactory.getCurrentSession();
Query countQuery = session.
createSQLQuery(queryString);
Long totalFilteredRecords = ((Number)countQuery.uniqueResult())
.longValue();
```
The `queryString` is:
```
SELECT COUNT(id)
FROM SOM... | 2015/11/13 | [
"https://Stackoverflow.com/questions/33700721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3275167/"
] | Looking at the comment you added below your question, it looks like you were trying to FORWARD to a view (ex: JSP). So, yes, no redirects there. And you can either set these parameters on the HTML FORM (like you did). But you could also set these values by adding them to the model. So, in this case, you should definite... | I made as:
```
ModelAndView modelAndView = new ModelAndView("redirect:/shown-in-addressbar-path?paramKey=paramValue");
return modelAndView.getViewName();
``` |
13,684,167 | I'm using in my app a textview with blue colored background.
When autocorrect is enabled, whenever it corrects a word a white box forms around the word and the text's color changes also.
Any ideas on how to stop this effect? | 2012/12/03 | [
"https://Stackoverflow.com/questions/13684167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1872695/"
] | Nope, I think you can't change the color of the overlay or the textcolor out of the box..
This is a hard one, if you put a breakpoint in `- (void) layoutSubviews {..}` of your view you'll see UIKit has drawn a 'UITextSelectionView' above the text...
I tried to subclass UITextView to see if its layoutSubviews get's f... | This may have other side effects I am currently investigating what else calls this, but overriding firstRect(for range) in UITextView and returning CGrect.Zero removes the highlight.
```
override public func firstRect(for range: UITextRange) -> CGRect {
return CGRect.zero;
}
``` |
68,161,078 | **Hello everyone. Thanks in advance for any help**
I want to compare and classify two columns of numbers based on their digits.
To make it clearer here is a small example:
| nr1 | nr2 |
| --- | --- |
| 1234 | 1234 |
| 1234 | 1235 |
| 1234 | 1335 |
| 1234 | 2347 |
| 2876 | na |
I want to add a new column with t... | 2021/06/28 | [
"https://Stackoverflow.com/questions/68161078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15982725/"
] | You could use some simple maths:
```
foo <- function(x, y) {
z <- abs(x - y)
res <- 3 - floor(log10(z))
res[is.infinite(res)] <- 4
res
}
foo(df1$nr1, df1$nr2)
#[1] 4 3 1 0 NA
``` | You could use nested `ifelse()` statements or something like `fcase()` from the `data.table` package:
```
library(data.table)
df$nr3 <- fcase(
df$nr1 == df$nr2, '4',
substr(df$nr1, 1L, 3L) == substr(df$nr2, 1L, 3L), '3',
substr(df$nr1, 1L, 2L) == substr(df$nr2, 1L, 2L), '2',
substr(df$nr1, 1L, 1L) == substr(d... |
68,161,078 | **Hello everyone. Thanks in advance for any help**
I want to compare and classify two columns of numbers based on their digits.
To make it clearer here is a small example:
| nr1 | nr2 |
| --- | --- |
| 1234 | 1234 |
| 1234 | 1235 |
| 1234 | 1335 |
| 1234 | 2347 |
| 2876 | na |
I want to add a new column with t... | 2021/06/28 | [
"https://Stackoverflow.com/questions/68161078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15982725/"
] | You could use some simple maths:
```
foo <- function(x, y) {
z <- abs(x - y)
res <- 3 - floor(log10(z))
res[is.infinite(res)] <- 4
res
}
foo(df1$nr1, df1$nr2)
#[1] 4 3 1 0 NA
``` | Here is a base R way with `apply`.
```
eq <- function(x, y, which = 1:4){
res <- sapply(which, function(n) n[substr(x, 1, n) == substr(y, 1, n)])
max(0, unlist(res))
}
apply(df1, 1, function(x) eq(x[1], x[2]))
#[1] 4 3 1 0 NA
```
---
Data in `dput` format
---------------------
```
df1 <-
structure(list(nr... |
73,897,965 | I am using react-datepicker as the package for date picker purposes (<https://www.npmjs.com/package/react-datepicker>). Is there an option we could style the ends of the range picker. Also I want the year and month picker as a part of calendar when it is opened. Is this achievable?
Sandbox: <https://codesandbox.io/s/d... | 2022/09/29 | [
"https://Stackoverflow.com/questions/73897965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16860065/"
] | Here's one solution.
```
for s in my_list:
print(f"They call me \"{s}\"")
```
Alternatively, to use the my\_string variable,
```
for s in my_list:
print(f"{my_string}\"{s}\"")
``` | You can use **f-strings**.
```py
my_list = ["foo", "bar", "baz"]
my_string = " They call me "
for i in my_list:
print(f'{my_string}"{i}"')
``` |
73,897,965 | I am using react-datepicker as the package for date picker purposes (<https://www.npmjs.com/package/react-datepicker>). Is there an option we could style the ends of the range picker. Also I want the year and month picker as a part of calendar when it is opened. Is this achievable?
Sandbox: <https://codesandbox.io/s/d... | 2022/09/29 | [
"https://Stackoverflow.com/questions/73897965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16860065/"
] | Here's one solution.
```
for s in my_list:
print(f"They call me \"{s}\"")
```
Alternatively, to use the my\_string variable,
```
for s in my_list:
print(f"{my_string}\"{s}\"")
``` | You can use **double quotes** inside with **single quote** outside in line 1.
```
my_list = ['"foo"', '"bar"', '"baz"']
my_string = "They call me "
for i in my_list:
print(f'{my_string}{i}')
``` |
73,897,965 | I am using react-datepicker as the package for date picker purposes (<https://www.npmjs.com/package/react-datepicker>). Is there an option we could style the ends of the range picker. Also I want the year and month picker as a part of calendar when it is opened. Is this achievable?
Sandbox: <https://codesandbox.io/s/d... | 2022/09/29 | [
"https://Stackoverflow.com/questions/73897965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16860065/"
] | You can use **f-strings**.
```py
my_list = ["foo", "bar", "baz"]
my_string = " They call me "
for i in my_list:
print(f'{my_string}"{i}"')
``` | You can use **double quotes** inside with **single quote** outside in line 1.
```
my_list = ['"foo"', '"bar"', '"baz"']
my_string = "They call me "
for i in my_list:
print(f'{my_string}{i}')
``` |
73,897,965 | I am using react-datepicker as the package for date picker purposes (<https://www.npmjs.com/package/react-datepicker>). Is there an option we could style the ends of the range picker. Also I want the year and month picker as a part of calendar when it is opened. Is this achievable?
Sandbox: <https://codesandbox.io/s/d... | 2022/09/29 | [
"https://Stackoverflow.com/questions/73897965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16860065/"
] | You may use raw strings, `repr` is the function used to convert a string to raw string.
```
my_list = ["foo", "bar", "baz"]
my_string = "They call me "
for i in my_list:
print(my_string,repr(i))
```
output:
```
They call me 'foo'
They call me 'bar'
They call me 'baz'
``` | You can use **f-strings**.
```py
my_list = ["foo", "bar", "baz"]
my_string = " They call me "
for i in my_list:
print(f'{my_string}"{i}"')
``` |
73,897,965 | I am using react-datepicker as the package for date picker purposes (<https://www.npmjs.com/package/react-datepicker>). Is there an option we could style the ends of the range picker. Also I want the year and month picker as a part of calendar when it is opened. Is this achievable?
Sandbox: <https://codesandbox.io/s/d... | 2022/09/29 | [
"https://Stackoverflow.com/questions/73897965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16860065/"
] | You may use raw strings, `repr` is the function used to convert a string to raw string.
```
my_list = ["foo", "bar", "baz"]
my_string = "They call me "
for i in my_list:
print(my_string,repr(i))
```
output:
```
They call me 'foo'
They call me 'bar'
They call me 'baz'
``` | You can use **double quotes** inside with **single quote** outside in line 1.
```
my_list = ['"foo"', '"bar"', '"baz"']
my_string = "They call me "
for i in my_list:
print(f'{my_string}{i}')
``` |
21,520,378 | My question is how do you start one list at the next index when iterating?
```
for elem1, elem2 in zip(unigram_mixture_list, bigram_mixture_list):
print elem1, elem2
```
I want to start looping through `elem1` one index ahead.
How would I achieve this in python? | 2014/02/03 | [
"https://Stackoverflow.com/questions/21520378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2373410/"
] | slice the first list with `[1:]`:
```
for elem1, elem2 in zip(unigram_mixture_list[1:], bigram_mixture_list):
```
You got everything else exactly right
---
Note that if the lists were the same length, but now truncated because you've shortened one, you have a couple choices:
* slice the second list to remove the ... | There is the `zip` approach, but if the lists are the same length the longer will be truncated:
```
>>> li1='abcdefg'
>>> li2='1234567'
>>> zip(li1[1:], li2)
[('b', '1'), ('c', '2'), ('d', '3'), ('e', '4'), ('f', '5'), ('g', '6')]
# NOTE -- '7' is dropped from li2...
```
With Python 2, you can use `map`:
```
>>> ma... |
21,520,378 | My question is how do you start one list at the next index when iterating?
```
for elem1, elem2 in zip(unigram_mixture_list, bigram_mixture_list):
print elem1, elem2
```
I want to start looping through `elem1` one index ahead.
How would I achieve this in python? | 2014/02/03 | [
"https://Stackoverflow.com/questions/21520378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2373410/"
] | slice the first list with `[1:]`:
```
for elem1, elem2 in zip(unigram_mixture_list[1:], bigram_mixture_list):
```
You got everything else exactly right
---
Note that if the lists were the same length, but now truncated because you've shortened one, you have a couple choices:
* slice the second list to remove the ... | [`more_itertools`](https://github.com/erikrose/more-itertools) offers a tool for offsetting iterables called [`more_itertools.zip_offset`](https://more-itertools.readthedocs.io/en/latest/api.html#more_itertools.zip_offset):
```
import more_itertools as mit
it1 = "0123"
it2 = "abcdef"
for elem1, elem2 in mit.zip_offs... |
21,520,378 | My question is how do you start one list at the next index when iterating?
```
for elem1, elem2 in zip(unigram_mixture_list, bigram_mixture_list):
print elem1, elem2
```
I want to start looping through `elem1` one index ahead.
How would I achieve this in python? | 2014/02/03 | [
"https://Stackoverflow.com/questions/21520378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2373410/"
] | There is the `zip` approach, but if the lists are the same length the longer will be truncated:
```
>>> li1='abcdefg'
>>> li2='1234567'
>>> zip(li1[1:], li2)
[('b', '1'), ('c', '2'), ('d', '3'), ('e', '4'), ('f', '5'), ('g', '6')]
# NOTE -- '7' is dropped from li2...
```
With Python 2, you can use `map`:
```
>>> ma... | [`more_itertools`](https://github.com/erikrose/more-itertools) offers a tool for offsetting iterables called [`more_itertools.zip_offset`](https://more-itertools.readthedocs.io/en/latest/api.html#more_itertools.zip_offset):
```
import more_itertools as mit
it1 = "0123"
it2 = "abcdef"
for elem1, elem2 in mit.zip_offs... |
11,233,105 | **Expected result:**
```
Berries: blueberry, raspberry, strawberry
Citrus: grapefruit, lime
Pear
```
---
SQL:
```
CREATE TABLE IF NOT EXISTS `fruits` (
`id` varchar(8) NOT NULL,
`group` varchar(8) NOT NULL,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO ... | 2012/06/27 | [
"https://Stackoverflow.com/questions/11233105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/351900/"
] | If you are building a Metro app in xaml, there are no built in bitmap effects (like drop shadow, blur, glow and reflection). You may be able to create a bitmap image of a drop shadow and use it as a [9 grid](http://blog.xyzzer.me/2011/09/21/image-ninegrid-in-winrt/), but that will only work in some scenarios.
If you u... | For XAML Metro/Modern apps,
[this XAML drop shadow sample works perfectly](http://www.java2s.com/Tutorial/CSharp/0470__Windows-Presentation-Foundation/TextDropShadow.htm) |
11,233,105 | **Expected result:**
```
Berries: blueberry, raspberry, strawberry
Citrus: grapefruit, lime
Pear
```
---
SQL:
```
CREATE TABLE IF NOT EXISTS `fruits` (
`id` varchar(8) NOT NULL,
`group` varchar(8) NOT NULL,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO ... | 2012/06/27 | [
"https://Stackoverflow.com/questions/11233105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/351900/"
] | If you are building a Metro app in xaml, there are no built in bitmap effects (like drop shadow, blur, glow and reflection). You may be able to create a bitmap image of a drop shadow and use it as a [9 grid](http://blog.xyzzer.me/2011/09/21/image-ninegrid-in-winrt/), but that will only work in some scenarios.
If you u... | BCL doesn't support shadow, but win2d(<https://github.com/Microsoft/win2d>) support.
you can use CanvasControl of win2d or try this library based on win2d <https://github.com/brookshi/XPShadow> |
11,233,105 | **Expected result:**
```
Berries: blueberry, raspberry, strawberry
Citrus: grapefruit, lime
Pear
```
---
SQL:
```
CREATE TABLE IF NOT EXISTS `fruits` (
`id` varchar(8) NOT NULL,
`group` varchar(8) NOT NULL,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO ... | 2012/06/27 | [
"https://Stackoverflow.com/questions/11233105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/351900/"
] | Here's a solution for creating a 4 pixel wide shadow, copied from the default template for ChildWindow in Silverlight --
```
<Grid>
<Border BorderBrush="#14000000" BorderThickness="1" Background="#14000000" CornerRadius="2" Margin="1,1,-1,-1"/>
<Border BorderBrush="#0F000000" BorderThickness="1" Background="#0... | For XAML Metro/Modern apps,
[this XAML drop shadow sample works perfectly](http://www.java2s.com/Tutorial/CSharp/0470__Windows-Presentation-Foundation/TextDropShadow.htm) |
11,233,105 | **Expected result:**
```
Berries: blueberry, raspberry, strawberry
Citrus: grapefruit, lime
Pear
```
---
SQL:
```
CREATE TABLE IF NOT EXISTS `fruits` (
`id` varchar(8) NOT NULL,
`group` varchar(8) NOT NULL,
`name` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO ... | 2012/06/27 | [
"https://Stackoverflow.com/questions/11233105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/351900/"
] | Here's a solution for creating a 4 pixel wide shadow, copied from the default template for ChildWindow in Silverlight --
```
<Grid>
<Border BorderBrush="#14000000" BorderThickness="1" Background="#14000000" CornerRadius="2" Margin="1,1,-1,-1"/>
<Border BorderBrush="#0F000000" BorderThickness="1" Background="#0... | BCL doesn't support shadow, but win2d(<https://github.com/Microsoft/win2d>) support.
you can use CanvasControl of win2d or try this library based on win2d <https://github.com/brookshi/XPShadow> |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Usually the commercial ones are more polished than the open-source ones, here are some options:
* [Atlassian JIRA](http://www.atlassian.com/software/jira/) - an industry veteran, very complete solution. If you have a small team (up to 5 people), they also used to have a very low-cost version.
* [JetBrains YouTrack](ht... | Try out [Assembla](http://www.assembla.com/), am not sure whether it is free or what.
Or you may try with googling JIRA |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Or take a loot at [Gemini](http://countersoft.com) -- we have IT hardware, Help Desk and all our software dev projects in one place. Gemini does allow for different "meta data" per project type so this works for us. Look at their "white paper" - may be of help to you in terms of set up. | Try out [Assembla](http://www.assembla.com/), am not sure whether it is free or what.
Or you may try with googling JIRA |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Maybe you're looking for a service like <http://getsatisfaction.com/> or <http://uservoice.com/>. They are very customer-centric, and I've seen them used both for software products and for feedback on other things entirely.
Also, I've made Mantis receive email directly both to new and existing issues - f.ex. if subjec... | Try out [Assembla](http://www.assembla.com/), am not sure whether it is free or what.
Or you may try with googling JIRA |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Strange, no-one mentioned `Trello` [ [www.trello.com](http://www.trello.com) ]
Its :
* General purpose
* Software related tracking can also be done
* Collaboration on anything with multiple people
* Free to use [ Even for multiple users ]
* Aimed at a non-technical user
Perfect for your use-case. | Try out [Assembla](http://www.assembla.com/), am not sure whether it is free or what.
Or you may try with googling JIRA |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Or take a loot at [Gemini](http://countersoft.com) -- we have IT hardware, Help Desk and all our software dev projects in one place. Gemini does allow for different "meta data" per project type so this works for us. Look at their "white paper" - may be of help to you in terms of set up. | Usually the commercial ones are more polished than the open-source ones, here are some options:
* [Atlassian JIRA](http://www.atlassian.com/software/jira/) - an industry veteran, very complete solution. If you have a small team (up to 5 people), they also used to have a very low-cost version.
* [JetBrains YouTrack](ht... |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Strange, no-one mentioned `Trello` [ [www.trello.com](http://www.trello.com) ]
Its :
* General purpose
* Software related tracking can also be done
* Collaboration on anything with multiple people
* Free to use [ Even for multiple users ]
* Aimed at a non-technical user
Perfect for your use-case. | Usually the commercial ones are more polished than the open-source ones, here are some options:
* [Atlassian JIRA](http://www.atlassian.com/software/jira/) - an industry veteran, very complete solution. If you have a small team (up to 5 people), they also used to have a very low-cost version.
* [JetBrains YouTrack](ht... |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Or take a loot at [Gemini](http://countersoft.com) -- we have IT hardware, Help Desk and all our software dev projects in one place. Gemini does allow for different "meta data" per project type so this works for us. Look at their "white paper" - may be of help to you in terms of set up. | Maybe you're looking for a service like <http://getsatisfaction.com/> or <http://uservoice.com/>. They are very customer-centric, and I've seen them used both for software products and for feedback on other things entirely.
Also, I've made Mantis receive email directly both to new and existing issues - f.ex. if subjec... |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Strange, no-one mentioned `Trello` [ [www.trello.com](http://www.trello.com) ]
Its :
* General purpose
* Software related tracking can also be done
* Collaboration on anything with multiple people
* Free to use [ Even for multiple users ]
* Aimed at a non-technical user
Perfect for your use-case. | Or take a loot at [Gemini](http://countersoft.com) -- we have IT hardware, Help Desk and all our software dev projects in one place. Gemini does allow for different "meta data" per project type so this works for us. Look at their "white paper" - may be of help to you in terms of set up. |
4,212,745 | I'm looking for a free or commercial issue tracker. I've looked at a dozen of them, but I can't find what I need.
These are my requirements:
* Not only for software. I need a more general tracker in which "complaints" about products other than software can also be recorded.
* Very easy to use, for non-technical user... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97060/"
] | Strange, no-one mentioned `Trello` [ [www.trello.com](http://www.trello.com) ]
Its :
* General purpose
* Software related tracking can also be done
* Collaboration on anything with multiple people
* Free to use [ Even for multiple users ]
* Aimed at a non-technical user
Perfect for your use-case. | Maybe you're looking for a service like <http://getsatisfaction.com/> or <http://uservoice.com/>. They are very customer-centric, and I've seen them used both for software products and for feedback on other things entirely.
Also, I've made Mantis receive email directly both to new and existing issues - f.ex. if subjec... |
50,144,861 | I have this donut chart currently working in an AngularJS app:
[](https://i.stack.imgur.com/3GVwN.png)
But the design mockup says we would like this, note the border-radius property on the green portion of the arc:
[
.innerRadius(23)
.outerRadius(radius)
.cornerRadius(10);
```
But, the downside is that all arcs' borders are rounded:
[](htt... | Try playing with stroke attributes like:
* stroke
* stroke-dasharray
* stroke-dashoffset
* stroke-linecap
* stroke-linejoin
* stroke-miterlimit
* stroke-opacity
* stroke-width
And set width of bar to lower values, or 0.
Reference: <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute>
But the better way is to... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | [*Universalis*](http://rpggeek.com/rpgitem/44443/universalis-revised-edition) is an interesting edge case. There *is* a mechanical reward cycle, but it doesn't reward the characters. There is a cycle where the players are rewarded for adding interesting conflicts to the on-going story by rewarding them with more story-... | I recently learned about a game called Lexicon played on a wiki... might fit the bill. <http://en.wikipedia.org/wiki/Lexicon_(game>) |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | *Spirit of the Century* approaches the question of character advancement from the premise that you are already extremely awesome, and don't need to get any better. There are optional character advancement rules, but the default assumption is that the reward for adventuring is *adventure*. I've run the game for two diff... | In the fantasy area, **Everway** has no mechanical rewards; characters are powerful when created but don't improve directly. The only experience awards are boons, which are *in-character* rewards for adventure (typically favours owed or magical items).
**[Spirit of the Century](http://www.evilhat.com/home/sotc/)**, li... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | [*Universalis*](http://rpggeek.com/rpgitem/44443/universalis-revised-edition) is an interesting edge case. There *is* a mechanical reward cycle, but it doesn't reward the characters. There is a cycle where the players are rewarded for adding interesting conflicts to the on-going story by rewarding them with more story-... | In the fantasy area, **Everway** has no mechanical rewards; characters are powerful when created but don't improve directly. The only experience awards are boons, which are *in-character* rewards for adventure (typically favours owed or magical items).
**[Spirit of the Century](http://www.evilhat.com/home/sotc/)**, li... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | **[carry. a game about war](http://ndpaoletta.squarespace.com/carry-a-game-about-war/)** has no mechanical reward cycle, really, at least not the way you've defined it. You get to *change* your character by shifting from one Profile to another, but that doesn't necessarily make you more effective. There's also a mechan... | *[GHOST/ECHO](http://www.onesevendesign.com/ghostecho/)* has no reward or advancement system.
It is two artful pages long, and more of a roleplaying poem than a complete game. It requires a fair amount of buy-in and group consensus, and is elegant minimalism at its best.
Despite this, it's definitely a very playable ... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | **[carry. a game about war](http://ndpaoletta.squarespace.com/carry-a-game-about-war/)** has no mechanical reward cycle, really, at least not the way you've defined it. You get to *change* your character by shifting from one Profile to another, but that doesn't necessarily make you more effective. There's also a mechan... | [Montsegur 1244](http://thoughtfulgames.com/montsegur1244/index.html) has no reward cycle at all. There's a sharply delineated narrative arc that all the action takes place within; there's no system for resolving conflicts beyond seizing narration, which is an uncommon last resort.
My own game [Fiasco](http://www.bul... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | *[GHOST/ECHO](http://www.onesevendesign.com/ghostecho/)* has no reward or advancement system.
It is two artful pages long, and more of a roleplaying poem than a complete game. It requires a fair amount of buy-in and group consensus, and is elegant minimalism at its best.
Despite this, it's definitely a very playable ... | [*Mars Colony*](http://tckroleplaying.com/marscolony/) doesn't have a reward cycle. You either save the colony, leave a false saviour, or leave in shame. Only your character's fiction changes—status, emotions, personal relationships—none of which is reflected in the mechanics.
Arguably this is the point of the game. T... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | [Montsegur 1244](http://thoughtfulgames.com/montsegur1244/index.html) has no reward cycle at all. There's a sharply delineated narrative arc that all the action takes place within; there's no system for resolving conflicts beyond seizing narration, which is an uncommon last resort.
My own game [Fiasco](http://www.bul... | In the fantasy area, **Everway** has no mechanical rewards; characters are powerful when created but don't improve directly. The only experience awards are boons, which are *in-character* rewards for adventure (typically favours owed or magical items).
**[Spirit of the Century](http://www.evilhat.com/home/sotc/)**, li... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | *[GHOST/ECHO](http://www.onesevendesign.com/ghostecho/)* has no reward or advancement system.
It is two artful pages long, and more of a roleplaying poem than a complete game. It requires a fair amount of buy-in and group consensus, and is elegant minimalism at its best.
Despite this, it's definitely a very playable ... | [*Universalis*](http://rpggeek.com/rpgitem/44443/universalis-revised-edition) is an interesting edge case. There *is* a mechanical reward cycle, but it doesn't reward the characters. There is a cycle where the players are rewarded for adding interesting conflicts to the on-going story by rewarding them with more story-... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | [Traveller](http://en.wikipedia.org/wiki/Traveller_%28role-playing_game%29) has a fairly intricate "life path" system for character creation, and then once gameplay begins the players don't generally advance at all. It's *possible* to advance mechanically (correspondence school and such to gain a skill, for example), b... | Almost no game has no mechanical reward; any game in which the rules include money has a potential mechanical reward, as is noted in more than one edition of Traveller.
The only onse which comes to mind are Sorcerer and Brute Squad.
Sorcerer even has a reward cycle, albeit a limited one, in that, at the end of the s... |
3,016 | What games have no mechanical reward cycle, leaving character rewards and improvements entirely within the fiction?
By "mechanical reward cycle", I mean a sub-system that:
* ties a **resource gained through play** (e.g., XP, bennies, hero points, karma, opportunities to test skills, etc.)…
* to a way of **improving t... | 2010/09/24 | [
"https://rpg.stackexchange.com/questions/3016",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/321/"
] | **[carry. a game about war](http://ndpaoletta.squarespace.com/carry-a-game-about-war/)** has no mechanical reward cycle, really, at least not the way you've defined it. You get to *change* your character by shifting from one Profile to another, but that doesn't necessarily make you more effective. There's also a mechan... | Almost no game has no mechanical reward; any game in which the rules include money has a potential mechanical reward, as is noted in more than one edition of Traveller.
The only onse which comes to mind are Sorcerer and Brute Squad.
Sorcerer even has a reward cycle, albeit a limited one, in that, at the end of the s... |
2,230,853 | I am working on a navigation based iphone application. I have some information I want to pass on when I push a new view controller on the stack, say myObject. So:
```
aViewController *vc = [[aViewController alloc] initwith....];
vc.object = myObject //myObject is defined in the current view controller
[self.navigation... | 2010/02/09 | [
"https://Stackoverflow.com/questions/2230853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175225/"
] | I had a similar problem.
In my case the NSMutableArray was declared as a private variable within the class.
When I wrapped the variable with a public property of the same name **AND added "self." before the variable name** in didSelectRowAtIndexPath then my error went away. | Ok, really embarassed to announce that I got the problem all wrong. It seems like the object has been out of scope in the first place. the myObject is actually [myObjectList objectForIndex:index] where myObjectList is NSMutableArray \*myObjectList. This is not a synthesized property. Object is a class derived from NSOb... |
33,534,447 | I have a quick little toggle that changes the text of a button when somebody clicks on it. It's working, but not on the first click, for some reason? Second click onward, it works fine. Any thoughts?
```js
$( document ).ready(function() {
$(".btn-archive-header").click(function(){
var text = $(this).text()... | 2015/11/05 | [
"https://Stackoverflow.com/questions/33534447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3385160/"
] | you need to use **$.trim()**
```
$.trim($(this).text());
```
so your code will be
```
$( document ).ready(function() {
$(".btn-archive-header").click(function(){
var text = ($.trim($(this).text()) == 'VIEW ARCHIVE') ? 'CLOSE ARCHIVE' : 'VIEW ARCHIVE';
$(this).text(text);
});
});
```
[**DEMO*... | You have spaces in the value. Remove them and it works.
Change this:
```
<div class="btn-archive-header">
VIEW ARCHIVE
</div>
```
to this:
```
<div class="btn-archive-header">VIEW ARCHIVE</div>
```
Here is how your code should be:
```js
$( document ).ready(function() {
$(".btn-archive-header").click(func... |
33,534,447 | I have a quick little toggle that changes the text of a button when somebody clicks on it. It's working, but not on the first click, for some reason? Second click onward, it works fine. Any thoughts?
```js
$( document ).ready(function() {
$(".btn-archive-header").click(function(){
var text = $(this).text()... | 2015/11/05 | [
"https://Stackoverflow.com/questions/33534447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3385160/"
] | you need to use **$.trim()**
```
$.trim($(this).text());
```
so your code will be
```
$( document ).ready(function() {
$(".btn-archive-header").click(function(){
var text = ($.trim($(this).text()) == 'VIEW ARCHIVE') ? 'CLOSE ARCHIVE' : 'VIEW ARCHIVE';
$(this).text(text);
});
});
```
[**DEMO*... | Use the `.trim()` JavaScript method on the text obtained from the element:
```js
$( document ).ready(function() {
$(".btn-archive-header").click(function(){
var text = $(this).text().trim() == 'VIEW ARCHIVE' ? 'CLOSE ARCHIVE' : 'VIEW ARCHIVE';
$(this).text(text);
});
});
```
```html
<script... |
1,442,216 | I use four displays at work. The windows 10 display control panel allows the user to "select and rearrange displays" but it does not offer fine-grained control over where those displays are positioned.
How display areas touch at, say, a corner, determines whether it is possible to move the mouse easily between them o... | 2019/05/28 | [
"https://superuser.com/questions/1442216",
"https://superuser.com",
"https://superuser.com/users/169034/"
] | To disable the snapping when aligning multiple monitors in Windows 10, hold down CTRL while positioning the monitors in settings.
I discovered the solution to this issue while experimenting. Since I couldn't find it via a simple internet search, I figured I'd note a solution for anyone else struggling to resolve this,... | It appears the problem is actually not display arrangement but rather "sticky corners" that cannot be disabled! However some people have made software to try to address this
[How to disable sticky corners in Windows 10](https://superuser.com/questions/947817/how-to-disable-sticky-corners-in-windows-10) |
1,442,216 | I use four displays at work. The windows 10 display control panel allows the user to "select and rearrange displays" but it does not offer fine-grained control over where those displays are positioned.
How display areas touch at, say, a corner, determines whether it is possible to move the mouse easily between them o... | 2019/05/28 | [
"https://superuser.com/questions/1442216",
"https://superuser.com",
"https://superuser.com/users/169034/"
] | I was facing the same problem, and finally after quite a long search found a freeware tool that allows a pixel-precise fine tune placement of multi-monitor setup in Windows 10.
<https://www.nirsoft.net/utils/multi_monitor_tool.html> | It appears the problem is actually not display arrangement but rather "sticky corners" that cannot be disabled! However some people have made software to try to address this
[How to disable sticky corners in Windows 10](https://superuser.com/questions/947817/how-to-disable-sticky-corners-in-windows-10) |
1,442,216 | I use four displays at work. The windows 10 display control panel allows the user to "select and rearrange displays" but it does not offer fine-grained control over where those displays are positioned.
How display areas touch at, say, a corner, determines whether it is possible to move the mouse easily between them o... | 2019/05/28 | [
"https://superuser.com/questions/1442216",
"https://superuser.com",
"https://superuser.com/users/169034/"
] | To disable the snapping when aligning multiple monitors in Windows 10, hold down CTRL while positioning the monitors in settings.
I discovered the solution to this issue while experimenting. Since I couldn't find it via a simple internet search, I figured I'd note a solution for anyone else struggling to resolve this,... | To make fine-grained monitor position adjustments when aligning multiple monitors in Windows 10 settings, hold down CTRL while adjusting the monitors' relative positions. (This will override the snapping to an invisible grid, that is the default behavior.)
I discovered the solution to this issue while experimenting. S... |
1,442,216 | I use four displays at work. The windows 10 display control panel allows the user to "select and rearrange displays" but it does not offer fine-grained control over where those displays are positioned.
How display areas touch at, say, a corner, determines whether it is possible to move the mouse easily between them o... | 2019/05/28 | [
"https://superuser.com/questions/1442216",
"https://superuser.com",
"https://superuser.com/users/169034/"
] | I was facing the same problem, and finally after quite a long search found a freeware tool that allows a pixel-precise fine tune placement of multi-monitor setup in Windows 10.
<https://www.nirsoft.net/utils/multi_monitor_tool.html> | To make fine-grained monitor position adjustments when aligning multiple monitors in Windows 10 settings, hold down CTRL while adjusting the monitors' relative positions. (This will override the snapping to an invisible grid, that is the default behavior.)
I discovered the solution to this issue while experimenting. S... |
1,442,216 | I use four displays at work. The windows 10 display control panel allows the user to "select and rearrange displays" but it does not offer fine-grained control over where those displays are positioned.
How display areas touch at, say, a corner, determines whether it is possible to move the mouse easily between them o... | 2019/05/28 | [
"https://superuser.com/questions/1442216",
"https://superuser.com",
"https://superuser.com/users/169034/"
] | To disable the snapping when aligning multiple monitors in Windows 10, hold down CTRL while positioning the monitors in settings.
I discovered the solution to this issue while experimenting. Since I couldn't find it via a simple internet search, I figured I'd note a solution for anyone else struggling to resolve this,... | I was facing the same problem, and finally after quite a long search found a freeware tool that allows a pixel-precise fine tune placement of multi-monitor setup in Windows 10.
<https://www.nirsoft.net/utils/multi_monitor_tool.html> |
20,660,462 | I would like to know two things:
**1-** Is it possible by using objective-c introspection to know the return type of a block.
For example: `int (^CountBlock)(NSArray *array)` I would like to know the type it will be returning is `int`.
The second question is:
**2-** Can I hold a reference to a generic block? What ... | 2013/12/18 | [
"https://Stackoverflow.com/questions/20660462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/491239/"
] | 1) [This answer](https://stackoverflow.com/a/10944983/2905299) talks about how to grab the signature of a block. Here's the relevant code:
```
static const char *BlockSig(id blockObj)
{
struct Block *block = (void *)blockObj;
struct BlockDescriptor *descriptor = block->descriptor;
int copyDisposeFlag = 1 ... | I think the problem for number 2 is that blocks are named as part of the type definition, e.g.
```
void (^blockName)(void) = ^{};
```
A workaround is to define a generic block type:
```
typedef void(^BlockType)(void);
BlockType myBlock = ^{};
myBlock();
```
edit: pointed out by @neilco, a much simpler way using ... |
50,991,138 | I want to make a web application which will automate the ISP's bill through payment gateway and connect with mikrotik router. So that if any user doesn't pay in time, his connection will automatically stop.
I have no idea about mikrotic router's datbase. Pease give me an idea how I can implement this. Is there any plug... | 2018/06/22 | [
"https://Stackoverflow.com/questions/50991138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7584160/"
] | RouterOS dose have an API, the documentation is a little too technical to be helpful <https://wiki.mikrotik.com/wiki/API>. But there is a .NET C# library that looks like its maintained and easy enough to use. <https://github.com/danikf/tik4net>
Your site would have to run some scripts at a set time to update router s... | You can't use asp files directly on RouterOS, as RouterOS embedded web server is very simple (no ASP/PHP/etc interpreter). You have to
* install hotspot package on RouterOS
* configure hotspot (several detailed examples in mikrotik wiki, for example <http://wiki.mikrotik.com/wiki/Hotspot_server_setup>)
* RouterOS will... |
12,784,685 | I'm having a problem when I use these 2 FOR to initialize a two dimensional vector/array:
I have these types defined:
```
type
Range9 = 0..8;
Digit = '0'..'9';
Board = array [Range9,Range9] of Digit;
```
and then the part of the code where there are problems with the FOR's is the following:
... | 2012/10/08 | [
"https://Stackoverflow.com/questions/12784685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1710845/"
] | I've found the answer to my own question... well, I didn't exactly found the answer, I've asked this same question in the forum board of the programming course I'm attending and one of the professors gave me this link:
(it's in spanish btw)
<http://www.fing.edu.uy/inco/cursos/prog1/pm/field.php/FAQ/Laboratorio#toc17>
... | I haven't done Pascal in a while, so I might be a bit rusty. The only thing I can think of that is creating your problem is that you created a character range that was interpreted as a byte array, which was then converted to a Digits and then multiplied, which gave you those weird values. But, I could be wrong. I am un... |
1,161,415 | i have a form on a PHP page. All i trying to do is parse out some XML entered into that form (COMMAND) using `simplexml_load_string` here is the test code:
```
<?php
if($_POST){
$Input = $_GET['COMMAND'];
$Data =<<<XML
<?xml version="1.0" encoding="ISO-8859-1"?> .
$Input .XML;
... | 2009/07/21 | [
"https://Stackoverflow.com/questions/1161415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have a closing brace where you want an opening brace:
```
}
else
} // <- BAD!
echo 'WTF!'
}
```
You want:
```
}
else
{ // <- GOOD!
echo 'WTF!'
}
```
This is a personal choice, but I'd recommend following the [PEAR standard](http://pear.php.net/manual/en/standards.php "PEAR coding standard"... | In addition to what hobodave wrote you are missing a ; on your
```
echo 'WTF!';
```
line |
62,736,601 | I am making an api call which sometimes returns strings with special character codes in the string, something like `adiós` is being returned, and I need to display to my user as `adiós` instead. I have tried several combinations of `escape`/`unescape` `encodeURI`/`decodeURI` on their own and together, but no mat... | 2020/07/05 | [
"https://Stackoverflow.com/questions/62736601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5923222/"
] | You could consider using a [DOMParser](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser) to parse the HTML entities for you. The main reason why `dangerouslySetInnerHTML` is considered *dangerous* is if you're displaying user input back to the end-user as this can enable XSS attacks. You can also consider usi... | Maybe this helps
```js
function htmlEntities(str) {
return String(str).replace('ñ', 'ñ')
.replace('Ñ', 'Ñ')
.replace('&', '&')
.replace('Ñ', 'Ñ')
.replace('ñ', 'ñ')
... |
64,951,561 | I am trying Learning Nodejs and MongoDb. So what I did is created a simple Webpage which saves quotes to MongoDb and retrieves it. But I am unable to get data from MongoDb I am getting the Nodejs Error which says
```
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the
client
at ServerResp... | 2020/11/22 | [
"https://Stackoverflow.com/questions/64951561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13998817/"
] | Remove the `res.end()` that's after your call to `res.render()` because `res.render()` already ends the request and trying to end it again is causing your warning message. | Both `Response.prototype.end` and `Response.prototype.render` end the request. You obviously cannot send headers twice (each response sends headers), so remove `res.end()`. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.