qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | You probably need to do floating point calculations or maybe just change the order, to avoid rounding intermediate results down to 0 when everything is done with integers.
```
return 100.0 * girl / boy; // using floating points
// or maybe just
return 100 * girl / boy; // using int, but multiplying first
``` | Your divisions will always return 0 since the dividend is usually smaller than the divisor. It could in rare cases be equal!
Do the multiplication before the division:
```
if( boy > girl )
love = (girl * 100) / boy;
else
love = (boy * 100) / girl;
``` |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | You're always performing *integer* arithmetic - and always dividing one non-negative integer by a greater one. That will always give zero. Multiplying that zero by 100 doesn't help.
The simplest way of fixing this is to just multiply by 100 *first*:
```
return boy > girl ? (girl * 100) / boy : (boy * 100) / girl;
``... | You probably need to do floating point calculations or maybe just change the order, to avoid rounding intermediate results down to 0 when everything is done with integers.
```
return 100.0 * girl / boy; // using floating points
// or maybe just
return 100 * girl / boy; // using int, but multiplying first
``` |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | You probably need to do floating point calculations or maybe just change the order, to avoid rounding intermediate results down to 0 when everything is done with integers.
```
return 100.0 * girl / boy; // using floating points
// or maybe just
return 100 * girl / boy; // using int, but multiplying first
``` | If:
```
boy > girl
```
then:
```
girl/boy
```
always returns `0` because of integer division rounding. Try this:
```
100.0f * girl / boy
```
Which is equivalent but casts `girl` to `float` first and avoiding integer rounding. |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | You're always performing *integer* arithmetic - and always dividing one non-negative integer by a greater one. That will always give zero. Multiplying that zero by 100 doesn't help.
The simplest way of fixing this is to just multiply by 100 *first*:
```
return boy > girl ? (girl * 100) / boy : (boy * 100) / girl;
``... | It's because of this division:
```
(girl/boy)
```
Using int, if this results in a fractionary number, returned int will be 0.
Use floats or double instead. |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | It's because of this division:
```
(girl/boy)
```
Using int, if this results in a fractionary number, returned int will be 0.
Use floats or double instead. | If:
```
boy > girl
```
then:
```
girl/boy
```
always returns `0` because of integer division rounding. Try this:
```
100.0f * girl / boy
```
Which is equivalent but casts `girl` to `float` first and avoiding integer rounding. |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | You're always performing *integer* arithmetic - and always dividing one non-negative integer by a greater one. That will always give zero. Multiplying that zero by 100 doesn't help.
The simplest way of fixing this is to just multiply by 100 *first*:
```
return boy > girl ? (girl * 100) / boy : (boy * 100) / girl;
``... | Your divisions will always return 0 since the dividend is usually smaller than the divisor. It could in rare cases be equal!
Do the multiplication before the division:
```
if( boy > girl )
love = (girl * 100) / boy;
else
love = (boy * 100) / girl;
``` |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | Your divisions will always return 0 since the dividend is usually smaller than the divisor. It could in rare cases be equal!
Do the multiplication before the division:
```
if( boy > girl )
love = (girl * 100) / boy;
else
love = (boy * 100) / girl;
``` | If:
```
boy > girl
```
then:
```
girl/boy
```
always returns `0` because of integer division rounding. Try this:
```
100.0f * girl / boy
```
Which is equivalent but casts `girl` to `float` first and avoiding integer rounding. |
7,398,850 | Why this code always return 0
```
public int loveCal(String bname, String gname) {
char[] boy_name = bname.toLowerCase().toCharArray();
char[] girl_name = gname.toLowerCase().toCharArray();
int boy = 0;
int girl = 0;
int love = 0;
for(int i = 0; i < bname.length(); i++)
boy += (int) ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7398850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757634/"
] | You're always performing *integer* arithmetic - and always dividing one non-negative integer by a greater one. That will always give zero. Multiplying that zero by 100 doesn't help.
The simplest way of fixing this is to just multiply by 100 *first*:
```
return boy > girl ? (girl * 100) / boy : (boy * 100) / girl;
``... | If:
```
boy > girl
```
then:
```
girl/boy
```
always returns `0` because of integer division rounding. Try this:
```
100.0f * girl / boy
```
Which is equivalent but casts `girl` to `float` first and avoiding integer rounding. |
11,358,045 | I'm fairly new to ruby and I've got a hash that looks like so:
```
{ ["key1", "key2"] => 5, ["key1", "key3"] => 2, ... }
```
and I would like to convert it to an array that looks something like
```
[ ["key1", "key2", 5], ["key1", "key3", 2] ... ]
```
How would I go about doing this? | 2012/07/06 | [
"https://Stackoverflow.com/questions/11358045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1506016/"
] | Simply:
```
hash.collect{|k, v| k << v}
```
Of if you need the original hash unchanged:
```
hash.collect{|k, v| k + [v]}
``` | to\_a does exactly that.
```
{ ["key1", "key2"] => 5, ["key1", "key3"] => 2}.to_a
``` |
11,358,045 | I'm fairly new to ruby and I've got a hash that looks like so:
```
{ ["key1", "key2"] => 5, ["key1", "key3"] => 2, ... }
```
and I would like to convert it to an array that looks something like
```
[ ["key1", "key2", 5], ["key1", "key3", 2] ... ]
```
How would I go about doing this? | 2012/07/06 | [
"https://Stackoverflow.com/questions/11358045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1506016/"
] | Simply:
```
hash.collect{|k, v| k << v}
```
Of if you need the original hash unchanged:
```
hash.collect{|k, v| k + [v]}
``` | Another way could be:
```
hash.map(&:flatten)
# => [["key1", "key2", 5], ["key1", "key3", 2]]
``` |
11,358,045 | I'm fairly new to ruby and I've got a hash that looks like so:
```
{ ["key1", "key2"] => 5, ["key1", "key3"] => 2, ... }
```
and I would like to convert it to an array that looks something like
```
[ ["key1", "key2", 5], ["key1", "key3", 2] ... ]
```
How would I go about doing this? | 2012/07/06 | [
"https://Stackoverflow.com/questions/11358045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1506016/"
] | Another way could be:
```
hash.map(&:flatten)
# => [["key1", "key2", 5], ["key1", "key3", 2]]
``` | to\_a does exactly that.
```
{ ["key1", "key2"] => 5, ["key1", "key3"] => 2}.to_a
``` |
4,487,357 | i am trying to consolidate an ienumerable list that i am serializing
i have data that looks like this:
```
Internet explorer 10
Internet explorer 15
Mozille firefox 10
```
I was it to look like:
```
Internet explorer 25
Mozille firefox 10
```
my class looks like:
```
public class BrowserVis... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4487357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115749/"
] | What about:
```
public static IEnumerable<BrowserVisits> SumGroups(
IEnumerable<BrowserVisits> visits)
{
return visits.GroupBy(
i => i.BrowserName,
(name, browsers) => new BrowserVisits() {
BrowserName = name,
Visits = browsers.Sum(i => i.Visits)
});
}
```
This... | ```
var lstBrowserVisits = new List<BrowserVisits>
{
new BrowserVisits{BrowserName = "Internet explorer", Visits = 10},
new BrowserVisits{BrowserName = "Internet explorer", Visits = 15},
new BrowserVisits{BrowserName = "Mozille firefox", Visits = 10}
... |
4,487,357 | i am trying to consolidate an ienumerable list that i am serializing
i have data that looks like this:
```
Internet explorer 10
Internet explorer 15
Mozille firefox 10
```
I was it to look like:
```
Internet explorer 25
Mozille firefox 10
```
my class looks like:
```
public class BrowserVis... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4487357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115749/"
] | What about:
```
public static IEnumerable<BrowserVisits> SumGroups(
IEnumerable<BrowserVisits> visits)
{
return visits.GroupBy(
i => i.BrowserName,
(name, browsers) => new BrowserVisits() {
BrowserName = name,
Visits = browsers.Sum(i => i.Visits)
});
}
```
This... | Name Value
Internet explorer 10
Internet explorer 15
Mozille firefox 10
```
var sum= list.GroupBy(a => a.Name).Select(a => new { Total= a.Sum(b => b.value),Name= a.Key }).OrderByDescending(a => a.Total).ToList();
``` |
4,487,357 | i am trying to consolidate an ienumerable list that i am serializing
i have data that looks like this:
```
Internet explorer 10
Internet explorer 15
Mozille firefox 10
```
I was it to look like:
```
Internet explorer 25
Mozille firefox 10
```
my class looks like:
```
public class BrowserVis... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4487357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115749/"
] | ```
var lstBrowserVisits = new List<BrowserVisits>
{
new BrowserVisits{BrowserName = "Internet explorer", Visits = 10},
new BrowserVisits{BrowserName = "Internet explorer", Visits = 15},
new BrowserVisits{BrowserName = "Mozille firefox", Visits = 10}
... | Name Value
Internet explorer 10
Internet explorer 15
Mozille firefox 10
```
var sum= list.GroupBy(a => a.Name).Select(a => new { Total= a.Sum(b => b.value),Name= a.Key }).OrderByDescending(a => a.Total).ToList();
``` |
25,690,432 | I asked a similair questions and we didn't get to an answer ([here](https://stackoverflow.com/questions/25650175/traverse-a-tree-like-array-to-find-maximum-span-in-php)). This is a simpler question I hope.
I want to find each set of unique values here. It seems like a array flatten, but how do i keep the parent infor... | 2014/09/05 | [
"https://Stackoverflow.com/questions/25690432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1173586/"
] | Personally, I'd flatten out that source structure to something like `array('45'=>array('3'=>...),...);`, to make life easier, but to each their own I suppose.
```
function traverse($arr, &$return, $path=NULL) {
// track the current path through the tree
$path[] = $arr[0];
if( isset($arr[1]) && is_array($ar... | This is a slightly different implementation, each iteration only returns its subpaths and does not modify the caller's data.
The function explores the tree in depth, generating all the possible paths by enumeration. At each return, the current node is prepended to the path of its children, so
```
9 => ( 5, 7 => 3 )
... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | [R](https://www.r-project.org/), ~~50~~ 46 bytes
================================================
```r
function(r)split(r,substr(r,1,regexpr("]",r)))
```
[Try it online!](https://tio.run/##bY5BC4JAFITv/YrHQrCSRGKHCDoFQrfu4mFdxxR1lbfP6t@bFdTF2zDfzDA8laepHJ2VuneaAz@0tWgO/Zh74VlEIeOG58BaZSrkIAimUlut0geMVOCMziMznJCgG450... | Rust, 40 bytes
==============
```rust
|a|a.sort_by_key(|x|x.split("]").next())
```
Takes a mutable reference to a slice of strings and sorts it.
[Try it on the rust playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn%20main()%20%7B%0A%20%20%20%20let%20f%3Afn(%26mut%5B%26str%5D)%3D... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | Scala, 26 bytes
===============
```
_.sortBy(_.split("]")(0))
```
Returns a `List[String]` with no separator in between, but it is sorted by the tag.
[Try it in Scastie](https://scastie.scala-lang.org/DYJSw0dyR8yJIZh3G8h5zQ)
---
Returns a `Map[String,List[String]]`, 26 bytes
======================================... | [Python 3](https://docs.python.org/3/), ~~148~~127 bytes
========================================================
```python
a={}
try:
while 1:
b=input();c=b.split("]")[0]
if 1-(c in a):a[c]=[]
a[c]+=[b]
except:[print(e)for k in a for e in a[k]]
```
[Try it online!](https://tio.run/##XY7BasMwEETv/oolULAJDTHOob... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 10 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") ([SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set"))
=======================================... | AutoHotkey, 74 bytes
====================
```
Loop,Read,f
{
s:=A_LoopReadLine
FileAppend,%s%`n,% StrSplit(s,"]","[")[1]
}
```
Reads from a file named `f` and outputs into multiple files based on the tag. |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | vim, ~~13~~ 11 bytes
====================
```
:sor/\w\+/r
```
bugfix and byte save thanks to @Dingus!
[Try it online!](https://tio.run/##bc5BC4JAEAXge79iLp4EtTQIb1EIHYLuuod1faGYrsyuSr9@s4gO0nU@3nszOZcazWExF37IzuUzpK3Bgk4jM3pLFt2Q0iHONnkpuQUGQVljaloQbGg5rkVz9RFgIWO1aru3W0G3C/lxsE3WiQfkhG/X74Mk8kjVslcgfSeWTU8VLJRFtar... | [Python 3](https://docs.python.org/3/), ~~148~~127 bytes
========================================================
```python
a={}
try:
while 1:
b=input();c=b.split("]")[0]
if 1-(c in a):a[c]=[]
a[c]+=[b]
except:[print(e)for k in a for e in a[k]]
```
[Try it online!](https://tio.run/##XY7BasMwEETv/oolULAJDTHOob... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | [R](https://www.r-project.org/), ~~50~~ 46 bytes
================================================
```r
function(r)split(r,substr(r,1,regexpr("]",r)))
```
[Try it online!](https://tio.run/##bY5BC4JAFITv/YrHQrCSRGKHCDoFQrfu4mFdxxR1lbfP6t@bFdTF2zDfzDA8laepHJ2VuneaAz@0tWgO/Zh74VlEIeOG58BaZSrkIAimUlut0geMVOCMziMznJCgG450... | Scala, 26 bytes
===============
```
_.sortBy(_.split("]")(0))
```
Returns a `List[String]` with no separator in between, but it is sorted by the tag.
[Try it in Scastie](https://scastie.scala-lang.org/DYJSw0dyR8yJIZh3G8h5zQ)
---
Returns a `Map[String,List[String]]`, 26 bytes
======================================... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~14~~ 13 bytes
=============================================================================================================================
```
O$`(\w+).*
$1
```
[Try it online!](https://tio.run/##Xc5BC4JA... | Rust, 40 bytes
==============
```rust
|a|a.sort_by_key(|x|x.split("]").next())
```
Takes a mutable reference to a slice of strings and sorts it.
[Try it on the rust playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn%20main()%20%7B%0A%20%20%20%20let%20f%3Afn(%26mut%5B%26str%5D)%3D... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~14~~ 13 bytes
=============================================================================================================================
```
O$`(\w+).*
$1
```
[Try it online!](https://tio.run/##Xc5BC4JA... | [Perl 5](https://www.perl.org/) -M5.10.0 -Msort=stable, 53 bytes
================================================================
```perl
say sort{(split('\]',$a))[0]cmp(split('\]',$b))[0]}<>
```
[Try it online!](https://tio.run/##XY9Ba8JAEIXv/oo5KBrUEEkEEfVSEHoo9J7uYbN5kmCSXWanSin9691GKYI5zvfxHm8cuFmH4PUXecvyPfOuqW... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | [Pyth](https://github.com/isaacg1/pyth), 3 bytes
================================================
```
ohc
```
[Try it online!](https://tio.run/##Zc4xC8IwEAXgv3IEnBRR2kFchYKbe8gQkycptUm4nIq/PtYOXbre997j8ldCrSm4WrXSH1gJYEOXFzOikGDMZzo1ndopfbc8ANlQ15dAE4MLTce1JfazATMWSW4Y/wkxdLvSttkf23XrCfvGsrj80h425IKNDpQexLaP5CFwAq/M... | [Python 3](https://docs.python.org/3/), ~~148~~127 bytes
========================================================
```python
a={}
try:
while 1:
b=input();c=b.split("]")[0]
if 1-(c in a):a[c]=[]
a[c]+=[b]
except:[print(e)for k in a for e in a[k]]
```
[Try it online!](https://tio.run/##XY7BasMwEETv/oolULAJDTHOob... |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | Scala, 26 bytes
===============
```
_.sortBy(_.split("]")(0))
```
Returns a `List[String]` with no separator in between, but it is sorted by the tag.
[Try it in Scastie](https://scastie.scala-lang.org/DYJSw0dyR8yJIZh3G8h5zQ)
---
Returns a `Map[String,List[String]]`, 26 bytes
======================================... | AutoHotkey, 74 bytes
====================
```
Loop,Read,f
{
s:=A_LoopReadLine
FileAppend,%s%`n,% StrSplit(s,"]","[")[1]
}
```
Reads from a file named `f` and outputs into multiple files based on the tag. |
209,666 | You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
----
Each line will look something like this:
```
[app_name] Something horrible hap... | 2020/08/17 | [
"https://codegolf.stackexchange.com/questions/209666",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/45613/"
] | vim, ~~13~~ 11 bytes
====================
```
:sor/\w\+/r
```
bugfix and byte save thanks to @Dingus!
[Try it online!](https://tio.run/##bc5BC4JAEAXge79iLp4EtTQIb1EIHYLuuod1faGYrsyuSr9@s4gO0nU@3nszOZcazWExF37IzuUzpK3Bgk4jM3pLFt2Q0iHONnkpuQUGQVljaloQbGg5rkVz9RFgIWO1aru3W0G3C/lxsE3WiQfkhG/X74Mk8kjVslcgfSeWTU8VLJRFtar... | [Io](http://iolanguage.org/), 73 bytes
======================================
```
method(i,i map(split first)unique map(I,i select(split first==I))flatten)
```
[Try it online!](https://tio.run/##Zc9Ba8MwDAXgvyIChZiW0tEeSiGnQiC33bscvOSZiDq2Jyvdz8@yHEqh1/c9CYnj7OhS0dc8QofYl7xjGm0qc/Ks5Fiyminwz4Q1bhbO8Oj0tVFVjTHOW1UEM7... |
61,340,027 | Suppose you have an ordered, indexed list of positive values. These positive values are interrupted by 0 values. I want to determine if a consecutive sub-array exists which is not interrupted by 0 values and whose sum exceeds a certain threshold.
Simple example:
```
Index, Value
0 0
1 0
2 3
3 4
4 2
5 6
6 ... | 2020/04/21 | [
"https://Stackoverflow.com/questions/61340027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12434493/"
] | Start with
```
=B2
```
in c2
then put
```
=IF(B3=0,0,B3+C2)
```
in C3 and copy down.
[](https://i.stack.imgur.com/mcBUk.png)
**EDIT 1**
If you were looking for a Google sheets solution, try something like this:
```
=ArrayFormula(max(sumif(A2... | With data in columns **A** and **B**, insure column **B** end with a 0. Then in **C2** enter:
=IF(AND(B3=0,B2<>0),SUM(B$1:$B2)-MAX($C$1:C1),"")
and copy downwards:
[](https://i.stack.imgur.com/mqfIc.png)
Column **C** lists the sums of consecutive n... |
61,340,027 | Suppose you have an ordered, indexed list of positive values. These positive values are interrupted by 0 values. I want to determine if a consecutive sub-array exists which is not interrupted by 0 values and whose sum exceeds a certain threshold.
Simple example:
```
Index, Value
0 0
1 0
2 3
3 4
4 2
5 6
6 ... | 2020/04/21 | [
"https://Stackoverflow.com/questions/61340027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12434493/"
] | With data in columns **A** and **B**, insure column **B** end with a 0. Then in **C2** enter:
=IF(AND(B3=0,B2<>0),SUM(B$1:$B2)-MAX($C$1:C1),"")
and copy downwards:
[](https://i.stack.imgur.com/mqfIc.png)
Column **C** lists the sums of consecutive n... | Thanks to @Tom Sharpe and @Gary's Student for answering the question.
While I admittedly did not specify this in the question, I would prefer to achieve the solution without a helper column because I have to do this operation on 30+ successive columns. I just didn't think it was possible in Excel.
**[Full credit goes... |
61,340,027 | Suppose you have an ordered, indexed list of positive values. These positive values are interrupted by 0 values. I want to determine if a consecutive sub-array exists which is not interrupted by 0 values and whose sum exceeds a certain threshold.
Simple example:
```
Index, Value
0 0
1 0
2 3
3 4
4 2
5 6
6 ... | 2020/04/21 | [
"https://Stackoverflow.com/questions/61340027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12434493/"
] | Start with
```
=B2
```
in c2
then put
```
=IF(B3=0,0,B3+C2)
```
in C3 and copy down.
[](https://i.stack.imgur.com/mcBUk.png)
**EDIT 1**
If you were looking for a Google sheets solution, try something like this:
```
=ArrayFormula(max(sumif(A2... | Thanks to @Tom Sharpe and @Gary's Student for answering the question.
While I admittedly did not specify this in the question, I would prefer to achieve the solution without a helper column because I have to do this operation on 30+ successive columns. I just didn't think it was possible in Excel.
**[Full credit goes... |
4,536,526 | I've been struggling with this for a few hours. Everything just stopped working and I can't get it to work anymore. I'm a noob at Ruby, Ruby on Rails and the Terminal in general. This is really frustrating me so I just try to describe my problem as detailed as possible hoping someone can give me a solution.
I'm on Mac... | 2010/12/27 | [
"https://Stackoverflow.com/questions/4536526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/353644/"
] | Snow Leopard supplies Ruby 1.8.7. Ruby 1.8.7 doesn't automatically add the `require 'rubygems'` command to a Ruby script, like 1.9.2 will, so in general you need to add that to your script. That fixes the problems with Ruby not finding the gems called by your code in a lot of cases. Rails is a different animal, but the... | Make sure to add the MySql gem to that projects gemfile with the following code:
```
gem 'mysql', '2.8.1'
```
Run a bundle install/update and try it. You told it to use MySQL and the gem might even be installed, but you aren't loading it.
Also, you're failing at a couple of points: notice the
```
File not foun... |
39,254,110 | I came across two POSIX documents online.
* <http://pubs.opengroup.org/onlinepubs/009695399/> (IEEE Std 1003.1, 2004 Edition)
>
> **Abstract:** The 2004 edition incorporates Technical Corrigendum Number 1 and Technical Corrigendum 2 addressing problems discovered since the approval of the 2001 edition. These are mai... | 2016/08/31 | [
"https://Stackoverflow.com/questions/39254110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175080/"
] | From [`standards(7)`](http://man7.org/linux/man-pages/man7/standards.7.html):
>
> [POSIX.1-2001] was a 2001 revision and consolidation of the POSIX.1,
> POSIX.2, and SUS standards into a single document, conducted
> under the auspices of the Austin Group.
> [...]
> Two Technical Corrigenda (minor fixes and improv... | Both the wikipedia article and the [`standards(7)`](http://man7.org/linux/man-pages/man7/standards.7.html) manual page (which I wrote) are (were) wrong. "POSIX.1-2004" is not an official standard name. (Neither is "POSIX.1-2013".) I confirmed this with one of the core participants in The Open Group. I've just recently ... |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | Let $I$ be the integral given by
$$\begin{align}
I&=\int\_0^\infty\frac{\log(1+x^2)}{1+x^2}\,dx\\\\
\end{align}$$
Let $x=\tan(\theta)$. Then,
$$\begin{align}
I&=-2\int\_0^{\pi/2} \log(\cos(\theta))\,d\theta\\\\
&=-2\int\_0^{\pi/2}\log(\sin(\theta))\\\\
&=\pi\log(2)
\end{align}$$
---
>
> **IN CASE YOU HAVE NOT S... | Changing variable $x\to\tan x$, one has
$$ \int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}dx=\int\_{0}^{\frac\pi2}\ln(\sec^2x)dx=\frac{\pi}{2}\ln2+\int\_{0}^{\frac\pi2}\ln(\sec x)dx=\pi\ln2.$$
Here
$$ \int\_{0}^{\frac\pi2}\ln(\sec x)dx=\frac\pi2\ln2. $$ |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | Let $I$ be the integral given by
$$\begin{align}
I&=\int\_0^\infty\frac{\log(1+x^2)}{1+x^2}\,dx\\\\
\end{align}$$
Let $x=\tan(\theta)$. Then,
$$\begin{align}
I&=-2\int\_0^{\pi/2} \log(\cos(\theta))\,d\theta\\\\
&=-2\int\_0^{\pi/2}\log(\sin(\theta))\\\\
&=\pi\log(2)
\end{align}$$
---
>
> **IN CASE YOU HAVE NOT S... | A different approach: integrate "a la Feynman". Let
$$
F(t)=\int\_{0}^{\infty}\frac{\ln(1+t^2\,x^2)}{1+x^2}\,dx.
$$
Then, differentiating inside the integral,
\begin{align\*}
F'(t)&=\int\_0^\infty\frac{2\,t\,x^2}{(1+t^2\,x^2)(1+x^2)}\,dx\\
&=\frac{2\,t}{1-t^2}\int\_0^\infty\Bigl(\frac{1}{1+t^2\,x^2}-\frac{1}{1+x^2}\Big... |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | Let $I$ be the integral given by
$$\begin{align}
I&=\int\_0^\infty\frac{\log(1+x^2)}{1+x^2}\,dx\\\\
\end{align}$$
Let $x=\tan(\theta)$. Then,
$$\begin{align}
I&=-2\int\_0^{\pi/2} \log(\cos(\theta))\,d\theta\\\\
&=-2\int\_0^{\pi/2}\log(\sin(\theta))\\\\
&=\pi\log(2)
\end{align}$$
---
>
> **IN CASE YOU HAVE NOT S... | $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\newc... |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | Let $I$ be the integral given by
$$\begin{align}
I&=\int\_0^\infty\frac{\log(1+x^2)}{1+x^2}\,dx\\\\
\end{align}$$
Let $x=\tan(\theta)$. Then,
$$\begin{align}
I&=-2\int\_0^{\pi/2} \log(\cos(\theta))\,d\theta\\\\
&=-2\int\_0^{\pi/2}\log(\sin(\theta))\\\\
&=\pi\log(2)
\end{align}$$
---
>
> **IN CASE YOU HAVE NOT S... | Yet another approach. By Euler's Beta function, for any $a>0$,
$$ f(a)=\int\_{0}^{+\infty}\frac{dx}{(1+x^2)^a} = \frac{\sqrt{\pi}}{2}\cdot\frac{\Gamma\left(a-\frac{1}{2}\right)}{\Gamma(a)}\tag{1}$$
hence by considering $\frac{d}{da}\log(\cdot)$ of both sides and evaluating at $a=1$, we get
$$ -\frac{f'(1)}{f(1)} = \fra... |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | A different approach: integrate "a la Feynman". Let
$$
F(t)=\int\_{0}^{\infty}\frac{\ln(1+t^2\,x^2)}{1+x^2}\,dx.
$$
Then, differentiating inside the integral,
\begin{align\*}
F'(t)&=\int\_0^\infty\frac{2\,t\,x^2}{(1+t^2\,x^2)(1+x^2)}\,dx\\
&=\frac{2\,t}{1-t^2}\int\_0^\infty\Bigl(\frac{1}{1+t^2\,x^2}-\frac{1}{1+x^2}\Big... | Changing variable $x\to\tan x$, one has
$$ \int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}dx=\int\_{0}^{\frac\pi2}\ln(\sec^2x)dx=\frac{\pi}{2}\ln2+\int\_{0}^{\frac\pi2}\ln(\sec x)dx=\pi\ln2.$$
Here
$$ \int\_{0}^{\frac\pi2}\ln(\sec x)dx=\frac\pi2\ln2. $$ |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | A different approach: integrate "a la Feynman". Let
$$
F(t)=\int\_{0}^{\infty}\frac{\ln(1+t^2\,x^2)}{1+x^2}\,dx.
$$
Then, differentiating inside the integral,
\begin{align\*}
F'(t)&=\int\_0^\infty\frac{2\,t\,x^2}{(1+t^2\,x^2)(1+x^2)}\,dx\\
&=\frac{2\,t}{1-t^2}\int\_0^\infty\Bigl(\frac{1}{1+t^2\,x^2}-\frac{1}{1+x^2}\Big... | $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\newc... |
2,191,204 | Just don't know where to start from.
Looks like this integral converges.
$\displaystyle{\int\_{0}^{\infty}\frac{\ln\left(1+x^2\right)}{1+x^2}}dx$ | 2017/03/17 | [
"https://math.stackexchange.com/questions/2191204",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | A different approach: integrate "a la Feynman". Let
$$
F(t)=\int\_{0}^{\infty}\frac{\ln(1+t^2\,x^2)}{1+x^2}\,dx.
$$
Then, differentiating inside the integral,
\begin{align\*}
F'(t)&=\int\_0^\infty\frac{2\,t\,x^2}{(1+t^2\,x^2)(1+x^2)}\,dx\\
&=\frac{2\,t}{1-t^2}\int\_0^\infty\Bigl(\frac{1}{1+t^2\,x^2}-\frac{1}{1+x^2}\Big... | Yet another approach. By Euler's Beta function, for any $a>0$,
$$ f(a)=\int\_{0}^{+\infty}\frac{dx}{(1+x^2)^a} = \frac{\sqrt{\pi}}{2}\cdot\frac{\Gamma\left(a-\frac{1}{2}\right)}{\Gamma(a)}\tag{1}$$
hence by considering $\frac{d}{da}\log(\cdot)$ of both sides and evaluating at $a=1$, we get
$$ -\frac{f'(1)}{f(1)} = \fra... |
366,780 | I'm using the Perl rename command line tool to search recursively through a directory to rename any directories as well as files it finds. The issue I'm running into is the rename command will rename a sub-directory of a file then attempt to rename the parent directory of the same file. This will fail because the sub-d... | 2017/05/23 | [
"https://unix.stackexchange.com/questions/366780",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/232663/"
] | I would go about this in a different way - specifically, using a depth-first search in place of the shell globstar `**`
For example, using GNU `find`, given:
```
$ tree
.
└── dir
├── foo
│ └── baz
│ └── MainFoo.c
└── Foo
├── baz
└── MainFoo.c
5 directories, 2 files
```
then
... | As noted earlier, you are asking about perl and showing the code in sh.
If you want use Perl 5
* Module `File::Find::Rule` will help you find will help you find directories.
* Perl `rename` will do the rest of the job. |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | Good morning! Your puppy is probably sizable and physically immature, so his joints are not really ready for a lot of intense road work. Your veterinarian can probably guide you on this, as your dogs’ conditioning needs to be done carefully. For instance, an overweight dog would probably do well to lose some of the wei... | I have a Siberian Husky that is not much older than your dog. As I take him for a jog/walk, he will do the same thing sometimes such as bite the leash or jump around.
It could very well be the case that your dog is bored of walking and wants to run or at least go faster. This makes sense for a Husky Shepherd. They ha... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | I would definitely ask his vet how much he thinks is too much for the dog's age and physical state.
Then I suggest you see how long does he sleep after he arrives home (if you are not running just before going to bed). Dogs can easily get overexcited and push themselves too hard just to please their owners. What gives... | I have a Siberian Husky that is not much older than your dog. As I take him for a jog/walk, he will do the same thing sometimes such as bite the leash or jump around.
It could very well be the case that your dog is bored of walking and wants to run or at least go faster. This makes sense for a Husky Shepherd. They ha... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | There's not enough information in your post to provide a valid clinical picture. All of the behaviors you mentioned are *natural dog behaviors* that can occur in many situations.
Context Matters
---------------
Consider that digging can be self-rewarding play or prey drive, or it may be stress-displacement behavior. ... | I have a Siberian Husky that is not much older than your dog. As I take him for a jog/walk, he will do the same thing sometimes such as bite the leash or jump around.
It could very well be the case that your dog is bored of walking and wants to run or at least go faster. This makes sense for a Husky Shepherd. They ha... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | There's not enough information in your post to provide a valid clinical picture. All of the behaviors you mentioned are *natural dog behaviors* that can occur in many situations.
Context Matters
---------------
Consider that digging can be self-rewarding play or prey drive, or it may be stress-displacement behavior. ... | Good morning! Your puppy is probably sizable and physically immature, so his joints are not really ready for a lot of intense road work. Your veterinarian can probably guide you on this, as your dogs’ conditioning needs to be done carefully. For instance, an overweight dog would probably do well to lose some of the wei... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | Good morning! Your puppy is probably sizable and physically immature, so his joints are not really ready for a lot of intense road work. Your veterinarian can probably guide you on this, as your dogs’ conditioning needs to be done carefully. For instance, an overweight dog would probably do well to lose some of the wei... | Young dog is very curious about the world surrounding him and if you take him for a walk and force him to walk besides you like a walking robot and not having a chance to examine the world around him - he won't be very happy with that.
You should allow him to sniff around, to take a better look into various details he... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | There's not enough information in your post to provide a valid clinical picture. All of the behaviors you mentioned are *natural dog behaviors* that can occur in many situations.
Context Matters
---------------
Consider that digging can be self-rewarding play or prey drive, or it may be stress-displacement behavior. ... | I would definitely ask his vet how much he thinks is too much for the dog's age and physical state.
Then I suggest you see how long does he sleep after he arrives home (if you are not running just before going to bed). Dogs can easily get overexcited and push themselves too hard just to please their owners. What gives... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | I would definitely ask his vet how much he thinks is too much for the dog's age and physical state.
Then I suggest you see how long does he sleep after he arrives home (if you are not running just before going to bed). Dogs can easily get overexcited and push themselves too hard just to please their owners. What gives... | Young dog is very curious about the world surrounding him and if you take him for a walk and force him to walk besides you like a walking robot and not having a chance to examine the world around him - he won't be very happy with that.
You should allow him to sniff around, to take a better look into various details he... |
5,488 | Our puppy (8 months old, Husky/Shepherd mix) is getting to be good enough on the leash that I can take him for a nice run. I live near a park with a 5K loop road, which I used to run regularly.
When I first started taking him out around the loop road, he'd jump at me and bite and try to get me to play right away, or ... | 2014/06/18 | [
"https://pets.stackexchange.com/questions/5488",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/1222/"
] | There's not enough information in your post to provide a valid clinical picture. All of the behaviors you mentioned are *natural dog behaviors* that can occur in many situations.
Context Matters
---------------
Consider that digging can be self-rewarding play or prey drive, or it may be stress-displacement behavior. ... | Young dog is very curious about the world surrounding him and if you take him for a walk and force him to walk besides you like a walking robot and not having a chance to examine the world around him - he won't be very happy with that.
You should allow him to sniff around, to take a better look into various details he... |
41,702 | I've a requirement to deploy the below fields using ChangeSets from Sandbox to Production,
I have one field `CaseMode__c` visible to all profiles except two profiles and another custom field, `OffsetHour__c` that should be hidden for all profiles. These fields are available on Case Object.
Can I deploy these permissi... | 2014/06/26 | [
"https://salesforce.stackexchange.com/questions/41702",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/10060/"
] | Since its a custom field include the fields as well as profiles also in the changeset to configure permissions .I would recommend all profiles along with this field in one changeset for deployment with permission same as the source org . | If you add profile permissions to a change set, they'll carry over the permissions they have in the sandbox for all and only the objects in the change set. So if you're change set has just two fields plus all profiles, and you've set up the permissions already, it'll deploy the way you want.
That said, IMHO, change se... |
41,702 | I've a requirement to deploy the below fields using ChangeSets from Sandbox to Production,
I have one field `CaseMode__c` visible to all profiles except two profiles and another custom field, `OffsetHour__c` that should be hidden for all profiles. These fields are available on Case Object.
Can I deploy these permissi... | 2014/06/26 | [
"https://salesforce.stackexchange.com/questions/41702",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/10060/"
] | Since its a custom field include the fields as well as profiles also in the changeset to configure permissions .I would recommend all profiles along with this field in one changeset for deployment with permission same as the source org . | @Ralph : Make sure you have your requirements of having **CaseMode\_\_c** visible to all profiles except two and another field **OffsetHour\_\_c** that should be hidden for all profiles completed in your source ORG.
Now while creating a changeset add all the profiles and the two custom fields in the changeset. This wi... |
17,935,277 | I am trying to create some simple buttons. I have managed to get a Jquery code which on click changes the css attributes.
here the code:
```
> $(document).ready(function(){
> $(".but1").click(function(){
> $(this).css("background-color","white");
> $(this).css("font-size", "9px");
>
>... | 2013/07/29 | [
"https://Stackoverflow.com/questions/17935277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2075848/"
] | You can use "transparent" as a valid css background color, which will "remove" the color. Also, you may want to try using the #FFF hex syntax for your colors, although both white and #FFF should work. A lot of great information here, and read all the way down, because it gives the best examples towards the middle. This... | The `background-color` and `font-size` properties are CSS properties. With jQuery (and the normal JavaScript `object.style` attributes), use the `backgroundColor` and `fontSize` properties.
Like this:
`$(this).css('fontSize', 16);`
`$(this).css('backgroundColor', 'red');` |
10,915,019 | In my sql database I have a table like "REG\_DET", This table mainly include 3 data member. NAME,AGE,SSN. Here SSN is a string include more than 10 character. Here my problem is when i read SSN from the table i need only last 4 character that is
Eg. `Rohith , 25 , 1023456457`
result only include `Rohith , 25 ,6457`(l... | 2012/06/06 | [
"https://Stackoverflow.com/questions/10915019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1379647/"
] | You can use `RIGHT` function:
```
SELECT NAME,
AGE,
RIGHT(SSN, 4) As SSN_Short
FROM REG_DET
```
(assuming that you're using [SQL-Server](http://msdn.microsoft.com/en-us/library/ms177532.aspx) or [MySQL](http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_right))
**Edit**: Since you'r... | Yes it is possible with the [`RIGHT`](http://msdn.microsoft.com/en-us/library/ms177532.aspx) function:
```
SELECT NAME, AGE, RIGHT(SSN, 4) FROM REG_DET
``` |
10,915,019 | In my sql database I have a table like "REG\_DET", This table mainly include 3 data member. NAME,AGE,SSN. Here SSN is a string include more than 10 character. Here my problem is when i read SSN from the table i need only last 4 character that is
Eg. `Rohith , 25 , 1023456457`
result only include `Rohith , 25 ,6457`(l... | 2012/06/06 | [
"https://Stackoverflow.com/questions/10915019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1379647/"
] | You can use `RIGHT` function:
```
SELECT NAME,
AGE,
RIGHT(SSN, 4) As SSN_Short
FROM REG_DET
```
(assuming that you're using [SQL-Server](http://msdn.microsoft.com/en-us/library/ms177532.aspx) or [MySQL](http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_right))
**Edit**: Since you'r... | To get the last 4 digits from the `SSN` column , you can also use `SUBSTRING`. If the length of the SSN column is 10, then you can use the following query:
```
SELECT NAME, AGE, SUBSTRING(SSN, 6, 4) FROM REG_DET
``` |
10,915,019 | In my sql database I have a table like "REG\_DET", This table mainly include 3 data member. NAME,AGE,SSN. Here SSN is a string include more than 10 character. Here my problem is when i read SSN from the table i need only last 4 character that is
Eg. `Rohith , 25 , 1023456457`
result only include `Rohith , 25 ,6457`(l... | 2012/06/06 | [
"https://Stackoverflow.com/questions/10915019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1379647/"
] | Yes it is possible with the [`RIGHT`](http://msdn.microsoft.com/en-us/library/ms177532.aspx) function:
```
SELECT NAME, AGE, RIGHT(SSN, 4) FROM REG_DET
``` | To get the last 4 digits from the `SSN` column , you can also use `SUBSTRING`. If the length of the SSN column is 10, then you can use the following query:
```
SELECT NAME, AGE, SUBSTRING(SSN, 6, 4) FROM REG_DET
``` |
7,094,129 | My web application is using Digest authentication. There is no user password on server side. Now I need to authenticate a user in LDAP.
Is it possible? Any example in .Net/C#?
I can modify my Digest implementation algorithm, but I can not change it to Basic or any other authentication due to requirements.
**Edit:**... | 2011/08/17 | [
"https://Stackoverflow.com/questions/7094129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/695797/"
] | Why two constructs?
-------------------
The truth about *print* and *echo* is that while they appear to users as two distinct constructs, they are both really shades of echo if you get down to basics, i.e. look at the internal source code. That source code involves the parser as well as opcode handlers. Consider a sim... | `print` may live as statement without the need of ;, and this is the reason that we may include it in a `$b; print "TRUE": print "FALSE";` |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | Convert the PDF in blocks of 10 pages each time ( 1-10,11-20 and so on ... )
```
from pdf2image import pdfinfo_from_path,convert_from_path
info = pdfinfo_from_path(pdf_file, userpw=None, poppler_path=None)
maxPages = info["Pages"]
for page in range(1, maxPages+1, 10) :
convert_from_path(pdf_file, dpi=200, first_p... | A relatively big PDF will use up all your memory and cause the process to be killed (unless you use an output folder)
<https://github.com/Belval/pdf2image> i guess will help you to understand.
Solution: Break the pdf in small parts and convert it into image. The image could be merge...
```
from PyPDF2 import PdfFile... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | Convert the PDF in blocks of 10 pages each time ( 1-10,11-20 and so on ... )
```
from pdf2image import pdfinfo_from_path,convert_from_path
info = pdfinfo_from_path(pdf_file, userpw=None, poppler_path=None)
maxPages = info["Pages"]
for page in range(1, maxPages+1, 10) :
convert_from_path(pdf_file, dpi=200, first_p... | I am a bit late to this, but the problem is indeed related to the 136 pages going into memory. You can do three things.
1. Specify a format for the converted images.
By default, pdf2image uses PPM as its image format, it is faster, but also takes a lot more memory (over 30MB per image!). What you can do to fix this i... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | Convert the PDF in blocks of 10 pages each time ( 1-10,11-20 and so on ... )
```
from pdf2image import pdfinfo_from_path,convert_from_path
info = pdfinfo_from_path(pdf_file, userpw=None, poppler_path=None)
maxPages = info["Pages"]
for page in range(1, maxPages+1, 10) :
convert_from_path(pdf_file, dpi=200, first_p... | The accepted answer has a small issue.
>
> `maxPages = pdf2image._page_count(pdf_file)`
>
>
>
can no longer be used, as `_page_count` is deprecated. I found the working solution for the same.
```
from PyPDF2 import PdfFileWriter, PdfFileReader
inputpdf = PdfFileReader(open(pdf, "rb"))
maxPages = inputpdf.nu... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | Convert the PDF in blocks of 10 pages each time ( 1-10,11-20 and so on ... )
```
from pdf2image import pdfinfo_from_path,convert_from_path
info = pdfinfo_from_path(pdf_file, userpw=None, poppler_path=None)
maxPages = info["Pages"]
for page in range(1, maxPages+1, 10) :
convert_from_path(pdf_file, dpi=200, first_p... | eventually, combining these techniques, I ended up coding like following, given the goal to convert a pdf into a pptx with avoiding memory overflow and good speed in mind:
```
import os, sys, tempfile, pprint
from PIL import Image
from pdf2image import pdfinfo_from_path,convert_from_path
from pptx import Presentation
... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | I am a bit late to this, but the problem is indeed related to the 136 pages going into memory. You can do three things.
1. Specify a format for the converted images.
By default, pdf2image uses PPM as its image format, it is faster, but also takes a lot more memory (over 30MB per image!). What you can do to fix this i... | A relatively big PDF will use up all your memory and cause the process to be killed (unless you use an output folder)
<https://github.com/Belval/pdf2image> i guess will help you to understand.
Solution: Break the pdf in small parts and convert it into image. The image could be merge...
```
from PyPDF2 import PdfFile... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | The accepted answer has a small issue.
>
> `maxPages = pdf2image._page_count(pdf_file)`
>
>
>
can no longer be used, as `_page_count` is deprecated. I found the working solution for the same.
```
from PyPDF2 import PdfFileWriter, PdfFileReader
inputpdf = PdfFileReader(open(pdf, "rb"))
maxPages = inputpdf.nu... | A relatively big PDF will use up all your memory and cause the process to be killed (unless you use an output folder)
<https://github.com/Belval/pdf2image> i guess will help you to understand.
Solution: Break the pdf in small parts and convert it into image. The image could be merge...
```
from PyPDF2 import PdfFile... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | A relatively big PDF will use up all your memory and cause the process to be killed (unless you use an output folder)
<https://github.com/Belval/pdf2image> i guess will help you to understand.
Solution: Break the pdf in small parts and convert it into image. The image could be merge...
```
from PyPDF2 import PdfFile... | eventually, combining these techniques, I ended up coding like following, given the goal to convert a pdf into a pptx with avoiding memory overflow and good speed in mind:
```
import os, sys, tempfile, pprint
from PIL import Image
from pdf2image import pdfinfo_from_path,convert_from_path
from pptx import Presentation
... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | I am a bit late to this, but the problem is indeed related to the 136 pages going into memory. You can do three things.
1. Specify a format for the converted images.
By default, pdf2image uses PPM as its image format, it is faster, but also takes a lot more memory (over 30MB per image!). What you can do to fix this i... | The accepted answer has a small issue.
>
> `maxPages = pdf2image._page_count(pdf_file)`
>
>
>
can no longer be used, as `_page_count` is deprecated. I found the working solution for the same.
```
from PyPDF2 import PdfFileWriter, PdfFileReader
inputpdf = PdfFileReader(open(pdf, "rb"))
maxPages = inputpdf.nu... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | I am a bit late to this, but the problem is indeed related to the 136 pages going into memory. You can do three things.
1. Specify a format for the converted images.
By default, pdf2image uses PPM as its image format, it is faster, but also takes a lot more memory (over 30MB per image!). What you can do to fix this i... | eventually, combining these techniques, I ended up coding like following, given the goal to convert a pdf into a pptx with avoiding memory overflow and good speed in mind:
```
import os, sys, tempfile, pprint
from PIL import Image
from pdf2image import pdfinfo_from_path,convert_from_path
from pptx import Presentation
... |
56,471,734 | I have a list of dates in an array and I added an option column. What I want to do is get all the selected option of each array and insert it in database when the button "export to excel" is clicked.
When I tried to print all the selected values only the first selected value is the only one that shows.
```
for ($i=0... | 2019/06/06 | [
"https://Stackoverflow.com/questions/56471734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8336261/"
] | The accepted answer has a small issue.
>
> `maxPages = pdf2image._page_count(pdf_file)`
>
>
>
can no longer be used, as `_page_count` is deprecated. I found the working solution for the same.
```
from PyPDF2 import PdfFileWriter, PdfFileReader
inputpdf = PdfFileReader(open(pdf, "rb"))
maxPages = inputpdf.nu... | eventually, combining these techniques, I ended up coding like following, given the goal to convert a pdf into a pptx with avoiding memory overflow and good speed in mind:
```
import os, sys, tempfile, pprint
from PIL import Image
from pdf2image import pdfinfo_from_path,convert_from_path
from pptx import Presentation
... |
31,166,198 | I am programming in Android and am trying to make an SQL database to store highscores. In my `onCreate` method, I have
```
String query = "CREATE TABLE " + TABLE_SCORES + "(" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_SCORE + " TEXT" + ");";
db.execSQL(query);
```
w... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31166198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5058396/"
] | The answer is no.
You need the callback because that's what the method calls when the request is done.
This works with `on` method to, you might be doing something wrong out there in the code.
You could create a helper function for this.
```
function loadSomething(targetElement, uri,callback) {
targetElement.lo... | Try [`$.ajaxSetup`](https://api.jquery.com/jquery.ajaxsetup/):
```
$.ajaxSetup({
complete: function() {
ApplyBindings('#target');
}
});
```
**EDIT**
You could also make a named function like:
```
var ajaxApplyBindings = function() {
ApplyBindings('#Target');
// anything else...
};
```
And then pas... |
31,166,198 | I am programming in Android and am trying to make an SQL database to store highscores. In my `onCreate` method, I have
```
String query = "CREATE TABLE " + TABLE_SCORES + "(" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_SCORE + " TEXT" + ");";
db.execSQL(query);
```
w... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31166198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5058396/"
] | The answer is no.
You need the callback because that's what the method calls when the request is done.
This works with `on` method to, you might be doing something wrong out there in the code.
You could create a helper function for this.
```
function loadSomething(targetElement, uri,callback) {
targetElement.lo... | Yes. Check out the list of [Global AJAX Event Handlers](https://api.jquery.com/category/ajax/global-ajax-event-handlers/).
e.g.
```
$(document).ajaxComplete(function() {
alert('Triggered ajaxComplete handler.');
});
```
That said, you shouldn't need to reapply your bindings after an AJAX call. If you need to do... |
10,581,262 | I inherited a coldfusion8 site, which is using some search functionality.
I'm trying to store standardized database querys into stored procedures. Since I'm a newbie on both Coldfusion and MySQL I'm now wondering whether I can do this in MySQL:
```
<cfquery datasource="db" name="find_cats">
SELECT wg.no, wg.type... | 2012/05/14 | [
"https://Stackoverflow.com/questions/10581262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536768/"
] | From what you described, I am not seeing much benefit to wrapping it in a stored procedure/function. Databases are not really optimized for string manipulation. While looping is possible, the equivalent sql code is usually far less elegant. Plus it may require the use of dynamic sql (or a temp table to do it safely).
... | I think you should try "Full text" index in mysql. |
63,004,105 | I want to create ARM template to deploy Azure VM on its already created dependent resources. Want to deploy a vm on these existing dependent resources : Storage Account, Diagnostic Storage Account, Virtual Network, Network Interface, Public IP Address, Network Security Group. | 2020/07/20 | [
"https://Stackoverflow.com/questions/63004105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13965806/"
] | There are several aspects to this problem. First, you are right the behavior of masks and clip-paths is [different](https://www.w3.org/TR/SVG2/interact.html#PointerEventsProp) in relation to hit-testing.
>
> A clip path is a geometric boundary, and a given point is clearly either inside or outside that boundary; thus... | Clip masks are useful for cropping parts out of complicated objects, but if you're just working with blocks of solid colour then maybe it would be just as easy to create shapes that already have holes in them.
I've added an example below. Does this help?
```html
<svg width="400" heoght="200" viewBox="0 0 400 200">
... |
65,281,559 | I'm trying to understand how and when the .sheet and .fullScreenCover initializers are called. Below is a minimal reproducible example, where the first screen has 3 colored rectangles and the SecondView (shown via .fullScreenCover) has 1 rectangle that changes color based on the selected color from the first screen.
*... | 2020/12/13 | [
"https://Stackoverflow.com/questions/65281559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11279971/"
] | See comments and `print` statements. Especially the `red`
```
import SwiftUI
struct SegueTest: View {
@State var showSheet: Bool = false{
didSet{
print("showSheet :: didSet")
}
willSet{
print("showSheet :: willSet")
}
}
@State var color: Color = .gr... | The problem is that you are not using your @State color inside SegueView, which will not reload your view on State change. Just include your @State somewhere in the code, which will force it to rerender at then update the sheet, with the correct color.
```
RoundedRectangle(cornerRadius: 25)
.fill(color == .red ? C... |
51,315,866 | I'm trying to fetch all rows where the date column's value is a day in july using the code below:
```
$july="07";
$query=$conn->prepare("SELECT * FROM table WHERE date BETWEEN '2018-?-01' AND '2018-?-31'");
$query->execute($july,$july);
$row=$query->setFetchMode();
```
I have also tried like this:
```
$july="07";
... | 2018/07/12 | [
"https://Stackoverflow.com/questions/51315866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6026680/"
] | Query 1 fails because you can't quote a placeholder.
Query 2 fails because the single quotes get escaped by the driver and then the whole escaped string gets wrapped in quotes. Roughly
```
date BETWEEN '\'2018-07-01\''
```
There are a few ways you could accomplish this.
Take the first 7 values of your date column ... | First case error is because you passed two variables to PDO::execute() and its expecting array there.
Suggested Reading...
<http://php.net/manual/en/pdostatement.execute.php>
Second case .. ummm.. you sure it does nothing?
```
Select * from mytable where date <= '2018-07-31' and date >= '2018-07-01'
```
or wh... |
172,023 | The Modrons have the following trait:
>
> **Axiomatic Mind.** The [modron] can't be compelled to act in a manner contrary to its nature or its instructions.
>
>
>
**What does this mean?**
It sounds to me like *nonphysical* means fail to make it act in a *contrary manner*. It is pretty clear that persuasion and i... | 2020/07/16 | [
"https://rpg.stackexchange.com/questions/172023",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/64093/"
] | It keeps the modrons from doing things contrary to their instructions
---------------------------------------------------------------------
**But instructions are not infallible!**
In the general description of Modron's in the MM:
>
> **Absolute Law and Order**. Under the direction of their leader, Primus, modrons ... | This is slightly vague but it's useful to note this general aspect written in the descriptions of each of the various Modron types:
>
> Their own minds are networked in a hierarchal pyramid, in which each
> modron receives commands from superiors and delegates orders to
> underlings. A modron carries out commands wit... |
20,314,996 | For finding the best solution in the assignment problem it's easy to use the Hungarian Algorithm.
For example:
```
A | 3 4 2
B | 8 9 1
C | 7 9 5
```
When using the Hungarian Algorithm on this you become:
```
A | 0 0 1
B | 5 5 0
C | 0 1 0
```
Which means A gets assigned to 'job' 2, B to job 3 and... | 2013/12/01 | [
"https://Stackoverflow.com/questions/20314996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1054677/"
] | What you describe is a special case of the *K best assignments problem* -- there was in fact a solution to this problem proposed by Katta G. Murty in the following 1968 paper "[An Algorithm for Ranking all the Assignments in Order of Increasing Cost.](http://pubsonline.informs.org/doi/abs/10.1287/opre.16.3.682)" Operat... | In [r](/questions/tagged/r "show questions tagged 'r'") there is now an implementation of Murty's algorithm in the `muRty` package.
[CRAN](https://cran.r-project.org/web/packages/muRty/index.html)
[GitHub](https://github.com/arg0naut91/muRty)
It covers:
* Optimization in both minimum and maximum direction;
* out... |
51,362,342 | I have a number of structs that are derived from the same base for the purpose of code reuse, but I do not want any form of polymorphism.
```
struct B {
int field;
void doStuff() {}
bool operator==(const B& b) {
return field == b.field;
}
};
struct D1 : public B {
D1(int field) : B{field} ... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51362342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1021959/"
] | You can use [CRTP](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) to define `operator ==` only on the reference to the base class of the final type:
```
template<typename T>
struct B {
int field;
void doStuff() {}
bool operator==(const B<T>& b) {
return field == b.field;
}
... | You can remove the equality operator from your original definition of the struct and replace it with a function template accepting two identical parameter types:
```
template <class T> bool operator == (const T& lhs, const T& rhs)
{
return lhs.field == rhs.field;
}
```
Note that this function is somewhat "greedy... |
51,362,342 | I have a number of structs that are derived from the same base for the purpose of code reuse, but I do not want any form of polymorphism.
```
struct B {
int field;
void doStuff() {}
bool operator==(const B& b) {
return field == b.field;
}
};
struct D1 : public B {
D1(int field) : B{field} ... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51362342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1021959/"
] | You can use [CRTP](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) to define `operator ==` only on the reference to the base class of the final type:
```
template<typename T>
struct B {
int field;
void doStuff() {}
bool operator==(const B<T>& b) {
return field == b.field;
}
... | Instead of defining your equality operator as part of the base class, you usually need two functions in the derived classes:
```
struct B {
int field;
void doStuff() {}
};
struct D1 : public B {
D1(int field) : B{field} {}
bool operator==(const D1& d) {
return field == d.field;
}
};
struct... |
51,362,342 | I have a number of structs that are derived from the same base for the purpose of code reuse, but I do not want any form of polymorphism.
```
struct B {
int field;
void doStuff() {}
bool operator==(const B& b) {
return field == b.field;
}
};
struct D1 : public B {
D1(int field) : B{field} ... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51362342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1021959/"
] | "Structs D1 and D2 (and more similar structs) derive from B to share common fields and methods"
Then make `B` a `private` base class. Obviously, `D1` and `D2` shouldn't share their equality operator, since the two operators take different arguments. You can of course share part of the implementation as `bool B::equal(... | You can remove the equality operator from your original definition of the struct and replace it with a function template accepting two identical parameter types:
```
template <class T> bool operator == (const T& lhs, const T& rhs)
{
return lhs.field == rhs.field;
}
```
Note that this function is somewhat "greedy... |
51,362,342 | I have a number of structs that are derived from the same base for the purpose of code reuse, but I do not want any form of polymorphism.
```
struct B {
int field;
void doStuff() {}
bool operator==(const B& b) {
return field == b.field;
}
};
struct D1 : public B {
D1(int field) : B{field} ... | 2018/07/16 | [
"https://Stackoverflow.com/questions/51362342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1021959/"
] | "Structs D1 and D2 (and more similar structs) derive from B to share common fields and methods"
Then make `B` a `private` base class. Obviously, `D1` and `D2` shouldn't share their equality operator, since the two operators take different arguments. You can of course share part of the implementation as `bool B::equal(... | Instead of defining your equality operator as part of the base class, you usually need two functions in the derived classes:
```
struct B {
int field;
void doStuff() {}
};
struct D1 : public B {
D1(int field) : B{field} {}
bool operator==(const D1& d) {
return field == d.field;
}
};
struct... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | I think code regions probably wouldn't be supported in method bodies since they, as you put it, would be a (somewhat) "ridiculous feature" - However, in C#, this **does** work, at least in VS 2008 and VS 2010 - just not in VB.NET.
That being said, I would avoid it. Putting regions within a method body would just leads... | *Visual Studio 2003* had them for VB.NET, but feature was removed in *Visual Studio 2005* and later. Really annoying when refactoring large procedures, yet you can split the code window.
Honestly, I wish C# would restrict region use because they are overly used. I have a macro that strips them out of all code files wh... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | This was simply a choice the VB team made when adding the regions feature into version 7 of the Visual Basic language. It was seen as a feature which was useful for organizing at a declaration level and not inside a method and hence was allowed only at that level.
The C# team felt differently about this feature and a... | *Visual Studio 2003* had them for VB.NET, but feature was removed in *Visual Studio 2005* and later. Really annoying when refactoring large procedures, yet you can split the code window.
Honestly, I wish C# would restrict region use because they are overly used. I have a macro that strips them out of all code files wh... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | I don't know about VB, but in C# this has been allowed since 1.0 as far as I'm aware.
Indeed, you can even put code regions in odd places which cross scopes. For example:
```
class Test
{
static void Main()
{
if (DateTime.Now.Hour > 12)
{
#region Foo
Console.WriteLine("Afternoon");... | *Visual Studio 2003* had them for VB.NET, but feature was removed in *Visual Studio 2005* and later. Really annoying when refactoring large procedures, yet you can split the code window.
Honestly, I wish C# would restrict region use because they are overly used. I have a macro that strips them out of all code files wh... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | As of **November 2015:** In **Visual Studio 2015** it is now supported, just do what you like.
**Sample Code:**
```
With frmMain
#region "A sample region in odd place"
.show()
.text = "Sample"
#end region
End With
```
**Note:** In ***earlier versions*** of Visual Studio it seems that it is not working in VB.NET... | I don't know about VB, but in C# this has been allowed since 1.0 as far as I'm aware.
Indeed, you can even put code regions in odd places which cross scopes. For example:
```
class Test
{
static void Main()
{
if (DateTime.Now.Hour > 12)
{
#region Foo
Console.WriteLine("Afternoon");... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | I think code regions probably wouldn't be supported in method bodies since they, as you put it, would be a (somewhat) "ridiculous feature" - However, in C#, this **does** work, at least in VS 2008 and VS 2010 - just not in VB.NET.
That being said, I would avoid it. Putting regions within a method body would just leads... | This was simply a choice the VB team made when adding the regions feature into version 7 of the Visual Basic language. It was seen as a feature which was useful for organizing at a declaration level and not inside a method and hence was allowed only at that level.
The C# team felt differently about this feature and a... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | For anyone looking for the most recent answer to this question, this is now possible in VB.NET (starting from [version 14](https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-VB-14#minor-features-and-fixes) on).
>
> **Region Directives inside Method Bodies**
>
>
> You can put #Region…#End Region delimite... | *Visual Studio 2003* had them for VB.NET, but feature was removed in *Visual Studio 2005* and later. Really annoying when refactoring large procedures, yet you can split the code window.
Honestly, I wish C# would restrict region use because they are overly used. I have a macro that strips them out of all code files wh... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | Another simple alternative method:
What you can do is basically select the code you want to add the `#Region #End Region` and basically click:
`Ctrl`+`M`, `Ctrl`+`H`
This basically wraps the code. And then to make it even neater and easy to find you can comment the code. The end result would look something like this... | This was simply a choice the VB team made when adding the regions feature into version 7 of the Visual Basic language. It was seen as a feature which was useful for organizing at a declaration level and not inside a method and hence was allowed only at that level.
The C# team felt differently about this feature and a... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | As of **November 2015:** In **Visual Studio 2015** it is now supported, just do what you like.
**Sample Code:**
```
With frmMain
#region "A sample region in odd place"
.show()
.text = "Sample"
#end region
End With
```
**Note:** In ***earlier versions*** of Visual Studio it seems that it is not working in VB.NET... | *Visual Studio 2003* had them for VB.NET, but feature was removed in *Visual Studio 2005* and later. Really annoying when refactoring large procedures, yet you can split the code window.
Honestly, I wish C# would restrict region use because they are overly used. I have a macro that strips them out of all code files wh... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | As of **November 2015:** In **Visual Studio 2015** it is now supported, just do what you like.
**Sample Code:**
```
With frmMain
#region "A sample region in odd place"
.show()
.text = "Sample"
#end region
End With
```
**Note:** In ***earlier versions*** of Visual Studio it seems that it is not working in VB.NET... | For anyone looking for the most recent answer to this question, this is now possible in VB.NET (starting from [version 14](https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-VB-14#minor-features-and-fixes) on).
>
> **Region Directives inside Method Bodies**
>
>
> You can put #Region…#End Region delimite... |
3,151,722 | **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.
**ORIGINAL QUESTION:**
Normally I wouldn't "need" or even consider a ridiculous feature such as code regi... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3151722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47550/"
] | As of **November 2015:** In **Visual Studio 2015** it is now supported, just do what you like.
**Sample Code:**
```
With frmMain
#region "A sample region in odd place"
.show()
.text = "Sample"
#end region
End With
```
**Note:** In ***earlier versions*** of Visual Studio it seems that it is not working in VB.NET... | Another simple alternative method:
What you can do is basically select the code you want to add the `#Region #End Region` and basically click:
`Ctrl`+`M`, `Ctrl`+`H`
This basically wraps the code. And then to make it even neater and easy to find you can comment the code. The end result would look something like this... |
17,881,172 | I have a small issue I ran into and would like to figure out the logic behind it. On my website, I have a form where admin will submit various info regarding a user, including some links. Now, I have no idea how many links there will be, maybe 5, maybe 35. Point is I don't know the upper limit, so how would I go about ... | 2013/07/26 | [
"https://Stackoverflow.com/questions/17881172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2609029/"
] | You can make two separate tables, one with the users, one with all links.
```
Table users with columns (ID, name (for example), ...)
Table links with columns (ID, user_id, link, link_status (for example), ...)
```
Example: you have the user 'John Doe' with three properties, let's say hair color (brown), length (180 ... | You can use javascript to add links as you complete the form (like an "add new field button"), which will allow you to create as many inputs as you want. But if you want to keep it simple, just replace all the fields for the links with an textarea, and have the admin to add the links separated by colon or semicolon. Al... |
17,881,172 | I have a small issue I ran into and would like to figure out the logic behind it. On my website, I have a form where admin will submit various info regarding a user, including some links. Now, I have no idea how many links there will be, maybe 5, maybe 35. Point is I don't know the upper limit, so how would I go about ... | 2013/07/26 | [
"https://Stackoverflow.com/questions/17881172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2609029/"
] | As in the comments, you should probably use a javascript based solution:
Just have a button to "add another link":
```
<div class="links-wrap">
<input type="text">
</div>
<a class="new-link">Add another link</a>
```
Then:
```
$('.new-link').click(function() {
$('.links-wrap').append('<input type="text">');... | You can use javascript to add links as you complete the form (like an "add new field button"), which will allow you to create as many inputs as you want. But if you want to keep it simple, just replace all the fields for the links with an textarea, and have the admin to add the links separated by colon or semicolon. Al... |
19,899,154 | I'm trying to use Data.Map to map strings to functions. The issue I'm having is that the main error handling in my program uses an Either monad, and `Map.lookup` will return `Maybe ([SomeVal] -> Either ValError SomeVal)`. How can I make `Map.lookup` play nicely with the Either monad in this case?
```
apply :: String -... | 2013/11/11 | [
"https://Stackoverflow.com/questions/19899154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996620/"
] | The [`Control.Error` package](http://hackage.haskell.org/package/errors-1.2.1/docs/Control-Error-Util.html) has a nice function
```
note :: e -> Maybe a -> Either e a
note e Nothing = Left e
note _ (Just a) = Right a
```
which is useful for "upgrading" `Maybe`-like failures to `Either`-like ones.
```
lookupNote ::... | That depends on how you want to handle the `Nothing` case. If you want to assert that the key will always be there (a bad idea)
```
import Data.Maybe
apply s args = (prims ! s) args
```
But the smarter method is to have a sane value in the case where nothing is found. Likely you'll want some `ValError` constructor
... |
19,899,154 | I'm trying to use Data.Map to map strings to functions. The issue I'm having is that the main error handling in my program uses an Either monad, and `Map.lookup` will return `Maybe ([SomeVal] -> Either ValError SomeVal)`. How can I make `Map.lookup` play nicely with the Either monad in this case?
```
apply :: String -... | 2013/11/11 | [
"https://Stackoverflow.com/questions/19899154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996620/"
] | The other answers have explained how to turn `Maybe` into `Either` in general. However for `Data.Map` specifically, instead of `Map.lookup`, you can use `Map.findWithDefault`, which doesn't wrap in a `Maybe` and allows you to choose what to do with non-existing keys. | That depends on how you want to handle the `Nothing` case. If you want to assert that the key will always be there (a bad idea)
```
import Data.Maybe
apply s args = (prims ! s) args
```
But the smarter method is to have a sane value in the case where nothing is found. Likely you'll want some `ValError` constructor
... |
19,899,154 | I'm trying to use Data.Map to map strings to functions. The issue I'm having is that the main error handling in my program uses an Either monad, and `Map.lookup` will return `Maybe ([SomeVal] -> Either ValError SomeVal)`. How can I make `Map.lookup` play nicely with the Either monad in this case?
```
apply :: String -... | 2013/11/11 | [
"https://Stackoverflow.com/questions/19899154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996620/"
] | The other answers have explained how to turn `Maybe` into `Either` in general. However for `Data.Map` specifically, instead of `Map.lookup`, you can use `Map.findWithDefault`, which doesn't wrap in a `Maybe` and allows you to choose what to do with non-existing keys. | The [`Control.Error` package](http://hackage.haskell.org/package/errors-1.2.1/docs/Control-Error-Util.html) has a nice function
```
note :: e -> Maybe a -> Either e a
note e Nothing = Left e
note _ (Just a) = Right a
```
which is useful for "upgrading" `Maybe`-like failures to `Either`-like ones.
```
lookupNote ::... |
62,026,218 | I have a separate DatePicker and TimePicker component in my app.
Once the user has selected both the desired Date and Time, I construct a new `Date` object like this:
```
let timeStamp = Date(year: selectedDate.year, month: selectedDate.month, day: selectedDate.day, hour: selectedTime.hour, minute: selectedTime.minu... | 2020/05/26 | [
"https://Stackoverflow.com/questions/62026218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2454356/"
] | This line:
```
arr=input("Enter array : ")
```
gives you a `str`, not a list. You might want something more like:
```
arr = list(map(int, input("Enter array : ").split()))
```
which takes the `str` input, `split`s it into a `List[str]`, and then `map`s it to a `List[int]`.
Note that this assumes you're entering... | The first problem of the code is that the result of `input()` is a string independent of what you actually type.
To get `arr` to eventually contain an array of numbers (possibly into a `list`), you should parse the string resulting from `input()` or adopt another input strategy (see below on third issue).
Python libra... |
9,729,426 | I was working on our current release branch "base" which is going to be released pretty soon. Last moment my feature is being pulled out and I have some un-pushed changes on the base branch. This is a big set including a huge merge of around 400 commits. Since it is being pushed, I cannot push it to base. Also, I don't... | 2012/03/15 | [
"https://Stackoverflow.com/questions/9729426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927370/"
] | The standard specialization for `std::string` is probably good enough (probably even extremely good) for strings in general. But if your working with string of a very specific format, you probably could find or design a better algorithm for your particular case. | There's no need to provide your own. If you're using VS 2010 the hash function for `std::string` is in the `xfunctional` header file included by `<functional>` if you want to take a look for yourself about whether it would meet your needs:
```
template<>
class hash<_STD string>
// ...
``` |
9,729,426 | I was working on our current release branch "base" which is going to be released pretty soon. Last moment my feature is being pulled out and I have some un-pushed changes on the base branch. This is a big set including a huge merge of around 400 commits. Since it is being pushed, I cannot push it to base. Also, I don't... | 2012/03/15 | [
"https://Stackoverflow.com/questions/9729426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927370/"
] | The standard specialization for `std::string` is probably good enough (probably even extremely good) for strings in general. But if your working with string of a very specific format, you probably could find or design a better algorithm for your particular case. | You could check the [wiki](http://www.cplusplus.com/reference/algorithm/for_each/) , where you can see that in order to specify the hash function you should write something like :
```
std::unordered_map<X,int,hash_X> my_map;
```
where hash\_X is the definition of the hash function.
For completeness I include the ... |
9,729,426 | I was working on our current release branch "base" which is going to be released pretty soon. Last moment my feature is being pulled out and I have some un-pushed changes on the base branch. This is a big set including a huge merge of around 400 commits. Since it is being pushed, I cannot push it to base. Also, I don't... | 2012/03/15 | [
"https://Stackoverflow.com/questions/9729426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927370/"
] | The standard specialization for `std::string` is probably good enough (probably even extremely good) for strings in general. But if your working with string of a very specific format, you probably could find or design a better algorithm for your particular case. | I still haven't figured out how to add the little comment under an answer...I would prefer to post this under Michael Burr's answer. Anyway, c++11 has `std::hash<string>` as a part of the library. [Here](http://en.cppreference.com/w/cpp/utility/hash) you can view all the supported hash functions. |
4,576,588 | I'm trying to insert information from a form into a database table and then return to the same page with a success or failure alert message. I can't seem to get it to work however. Here's what I currently have...
HTML FORM
```
<form id="add-menu-item">
<input type="text" name="name" class="formbox">
<inp... | 2011/01/02 | [
"https://Stackoverflow.com/questions/4576588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394241/"
] | You need to add a [manifest file](http://msdn.microsoft.com/en-us/library/wwtazz9d%28v=vs.80%29.aspx) that allows the use of comctl32.dll in version 6 and newer. This is usually done automatically when you create a GUI project in Visual Studio. In other IDEs, there are often similar menu options (e.g. [Code::Blocks "Wi... | It could be that you need to add an [application manifest to enable Windows XP+ visual styles](http://msdn.microsoft.com/en-us/library/bb773175%28v=VS.85%29.aspx). |
1,777,066 | >
> Does the following series converge, does it converge absolutely?
> $$\sum\_{n=1}^\infty \frac{n+2}{n^2+4n-7}\left(\frac{4}{7}\right)^n $$
>
>
>
Now I thought about using Dirichlets Test of Uniform Convergence.
I know that $|\sum\_{n=1}^\infty (\frac{4}{7})^n|\leq M < \infty$.
I am left to show that if $\fra... | 2016/05/08 | [
"https://math.stackexchange.com/questions/1777066",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/218189/"
] | **Hint**. One may just observe that
$$0\leq \sum\_{n=2}^\infty \frac{n+2}{n^2+4n-7}\left(\frac{4}{7}\right)^n\leq \sum\_{n=2}^\infty \left(\frac{4}{7}\right)^n<\infty.
$$ | **hint**: $\dfrac{n+2}{n^2+4n-7} < 1 (n \geq 3) $ and $\left|\dfrac{4}{7}\right| < 1$ |
67,643,096 | We've got an Azure DevOps Pipeline running on a self-hosted against without parallelism that is not running it's Deployment Job or Step.
The version I'm posting below will have two stages, but note that I have tried this by removing the second stage and converting the entire stage to a job, and still the same result. ... | 2021/05/21 | [
"https://Stackoverflow.com/questions/67643096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4385580/"
] | I had the same error.
I renamed `- deployment: Deploy` to `- deployment: Deployment`
...and it started to work. | I was facing the same error on a stage with only a **Deployment job**.
A successful workaround is to replace the [Deployment job](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs?view=azure-devops) with a regular [Job](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/pha... |
67,643,096 | We've got an Azure DevOps Pipeline running on a self-hosted against without parallelism that is not running it's Deployment Job or Step.
The version I'm posting below will have two stages, but note that I have tried this by removing the second stage and converting the entire stage to a job, and still the same result. ... | 2021/05/21 | [
"https://Stackoverflow.com/questions/67643096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4385580/"
] | Changed
from *- deployment: Deploy* To *- deployment: Deployment*
[](https://i.stack.imgur.com/axqBS.png) | I was facing the same error on a stage with only a **Deployment job**.
A successful workaround is to replace the [Deployment job](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs?view=azure-devops) with a regular [Job](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/pha... |
67,643,096 | We've got an Azure DevOps Pipeline running on a self-hosted against without parallelism that is not running it's Deployment Job or Step.
The version I'm posting below will have two stages, but note that I have tried this by removing the second stage and converting the entire stage to a job, and still the same result. ... | 2021/05/21 | [
"https://Stackoverflow.com/questions/67643096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4385580/"
] | I had the same error.
I renamed `- deployment: Deploy` to `- deployment: Deployment`
...and it started to work. | Changed
from *- deployment: Deploy* To *- deployment: Deployment*
[](https://i.stack.imgur.com/axqBS.png) |
1,739,125 | I'm building a 3D game but i only plan on using a 2D perspective thus not taking the z axis into the equasion,
i want to be able to limit the movement of one of my models so it doesn't move out of the unmoving field of view,
when i was designing 2D it was simple just use clamp, but i cant seem to figurebout how to do ... | 2009/11/15 | [
"https://Stackoverflow.com/questions/1739125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/211666/"
] | If you simply want to do the same thing as a 2D clamp would - [Vector3.Clamp](http://msdn.microsoft.com/en-us/library/bb195262.aspx) set the Y (usually 'UP') component of the two bounding vectors you pass to be 0.
I'm slightly confused on the question however, it seems that maybe what you are after is a form of collis... | So you want in pseudocode:
```
if (object.position+movementVec is in view of camera)
object.position+=movementVec;
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.