qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
1,072,261 | I have a local repository I'm working on and its remote is hosted on GitHub. I recently created a branch and started working on it, making several commits and now wish to push the branch to GitHub and be able to pull it to another cloned repository. How do I do this? | 2009/07/02 | [
"https://Stackoverflow.com/questions/1072261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27025/"
] | ```
git push origin <local-branch-name>:<remote-branch-name>
```
Substitute for `<local-branch-name>` and `<remote-branch-name>`. They may be same or different, as you wish. | As you have set up the remotes already, the command is just
```
git push origin branch-name
```
on the first push.
Afterward, using `git push origin` would push all branches with the matching name on remote. |
1,072,261 | I have a local repository I'm working on and its remote is hosted on GitHub. I recently created a branch and started working on it, making several commits and now wish to push the branch to GitHub and be able to pull it to another cloned repository. How do I do this? | 2009/07/02 | [
"https://Stackoverflow.com/questions/1072261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27025/"
] | As you have set up the remotes already, the command is just
```
git push origin branch-name
```
on the first push.
Afterward, using `git push origin` would push all branches with the matching name on remote. | if you need to pull any branch code from remotely to locally
```
$git pull origin branch_name
```
while if you need to push code to your branch
**you need to check is your code successfully save
you can check by**
```
$git status
```
than
```
$git add -A
```
**after this make commit to your branch**
```
$git... |
1,072,261 | I have a local repository I'm working on and its remote is hosted on GitHub. I recently created a branch and started working on it, making several commits and now wish to push the branch to GitHub and be able to pull it to another cloned repository. How do I do this? | 2009/07/02 | [
"https://Stackoverflow.com/questions/1072261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27025/"
] | ```
git push origin <local-branch-name>:<remote-branch-name>
```
Substitute for `<local-branch-name>` and `<remote-branch-name>`. They may be same or different, as you wish. | Make sure that your remote URL is using SSH syntax and not just Git protocol syntax. If you run,
```
git remote show origin
```
the URL printed should look something like,
```
git@github.com:yourname/projectname.git
```
You need the URL too to look like that if you want to be able to push. If you are just a publi... |
1,072,261 | I have a local repository I'm working on and its remote is hosted on GitHub. I recently created a branch and started working on it, making several commits and now wish to push the branch to GitHub and be able to pull it to another cloned repository. How do I do this? | 2009/07/02 | [
"https://Stackoverflow.com/questions/1072261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27025/"
] | Make sure that your remote URL is using SSH syntax and not just Git protocol syntax. If you run,
```
git remote show origin
```
the URL printed should look something like,
```
git@github.com:yourname/projectname.git
```
You need the URL too to look like that if you want to be able to push. If you are just a publi... | if you need to pull any branch code from remotely to locally
```
$git pull origin branch_name
```
while if you need to push code to your branch
**you need to check is your code successfully save
you can check by**
```
$git status
```
than
```
$git add -A
```
**after this make commit to your branch**
```
$git... |
1,072,261 | I have a local repository I'm working on and its remote is hosted on GitHub. I recently created a branch and started working on it, making several commits and now wish to push the branch to GitHub and be able to pull it to another cloned repository. How do I do this? | 2009/07/02 | [
"https://Stackoverflow.com/questions/1072261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27025/"
] | ```
git push origin <local-branch-name>:<remote-branch-name>
```
Substitute for `<local-branch-name>` and `<remote-branch-name>`. They may be same or different, as you wish. | if you need to pull any branch code from remotely to locally
```
$git pull origin branch_name
```
while if you need to push code to your branch
**you need to check is your code successfully save
you can check by**
```
$git status
```
than
```
$git add -A
```
**after this make commit to your branch**
```
$git... |
43,434,195 | I am trying write a bash file to find a string in a .txt file using shell script and want to replace same with new string.
The string pattern which I am trying find `{{asdf}}` and I want to replace it with `ghjk` from command line arg.
I tried with the following bash file:
```
ptr="\{\{(.*?)\}\}"
username="$1"
pass... | 2017/04/16 | [
"https://Stackoverflow.com/questions/43434195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7873502/"
] | You need double codes before the vars will be replaced by their values.
With a `+` telling at least once, you can use
```
ptr="{{.\+}}"
sed "s/$ptr/${username}/g" usertemplate.txt > new.txt
```
Using `sed` for the password will be a challenge in view of the special characters (don't tell others, my password is `/... | Just use awk:
```
username="$1" awk '
{
gsub(/}}/,"\n")
delete a
if ( match($0,/{{[^\n]+\n/) ) {
a[1] = substr($0,1,RSTART-1)
a[2] = ENVIRON["username"]
a[3] = substr($0,RSTART+RLENGTH)
}
else {
a[1] = $0
}
gsub(/\n/,"}}",a[1])
gsub(/\n/,"}}",a[3])
pr... |
43,434,195 | I am trying write a bash file to find a string in a .txt file using shell script and want to replace same with new string.
The string pattern which I am trying find `{{asdf}}` and I want to replace it with `ghjk` from command line arg.
I tried with the following bash file:
```
ptr="\{\{(.*?)\}\}"
username="$1"
pass... | 2017/04/16 | [
"https://Stackoverflow.com/questions/43434195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7873502/"
] | one thing you should note is that `''` single quotes have special meaning in shell programming. Single quotes negates a variable i.e they don't allow you to access the content of the variable but just the name of the variable.
What you need to do , is to remove the single quotes `'s/$ptr/${username}/g'` and wrap with ... | Just use awk:
```
username="$1" awk '
{
gsub(/}}/,"\n")
delete a
if ( match($0,/{{[^\n]+\n/) ) {
a[1] = substr($0,1,RSTART-1)
a[2] = ENVIRON["username"]
a[3] = substr($0,RSTART+RLENGTH)
}
else {
a[1] = $0
}
gsub(/\n/,"}}",a[1])
gsub(/\n/,"}}",a[3])
pr... |
37,299,630 | I am using APi The access to this api is done with hash key that we need to send to the api but we don't really know how to implement.
I found <https://www.npmjs.com/package/crypto-js> but i dont know how to integrate angular 2
also i found <https://www.npmjs.com/package/angular-md5> but i dont know how to import us... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37299630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6246988/"
] | For angular 2 use
```
npm install ts-md5 --save
```
then import it into component, service or wherever you want
```
import {Md5} from 'ts-md5/dist/md5';
```
When you are using **systemJS** is neccessary set map and package paths.
```
map: {
'ts-md5': 'src/js/ts-md5',
},
packages: ... | You can get a md5.ts file here:
<https://github.com/ManvendraSK/angular2-quickstart/blob/master/app/md5.ts>
import it in your component/service:
```
import {md5} from './md5'; //make sure it points to the folder where the md5.ts file is
```
then you can use it in your component/service:
```
let e = md5(this.email... |
71,473,962 | I know this is probably really basic and there is an easy answer, but I'm not sure how to make two functions call each other. Function A calls Function B on a condition or two, and function B calls function A on a condition or two. Example:
```
def functionA():
if something is true:
functionB()
if some... | 2022/03/14 | [
"https://Stackoverflow.com/questions/71473962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13812746/"
] | #### What you've already written will "work".
This isn't C; you can *define* a function that calls a function that doesn't yet exist, so as long as you don't *call* such a function until the dependencies exist. As long as neither `functionA` nor `functionB` is called until both are defined, this "works".
The reason I... | I think one of the most common way to call a function into another function is use callback. It mean you call a function that will call another function you gave it as a parameter.
Here is an example :
```
def sum_numbers(a, b, callback):
res = a + b
callback(res)
def print_result(res):
print(res)
sum_numbers(1,... |
44,978,196 | I've a data frame that looks like the following
```
x = pd.DataFrame({'user': ['a','a','b','b'], 'dt': ['2016-01-01','2016-01-02', '2016-01-05','2016-01-06'], 'val': [1,33,2,1]})
```
What I would like to be able to do is find the minimum and maximum date within the date column and expand that column to have all the ... | 2017/07/07 | [
"https://Stackoverflow.com/questions/44978196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1210178/"
] | Initial Dataframe:
```
dt user val
0 2016-01-01 a 1
1 2016-01-02 a 33
2 2016-01-05 b 2
3 2016-01-06 b 1
```
First, convert the dates to datetime:
```
x['dt'] = pd.to_datetime(x['dt'])
```
Then, generate the dates and unique users:
```
dates = x.set_inde... | As @ayhan suggests
```
x.dt = pd.to_datetime(x.dt)
```
One-liner using mostly @ayhan's ideas while incorporating `stack`/`unstack` and `fill_value`
```
x.set_index(
['dt', 'user']
).unstack(
fill_value=0
).asfreq(
'D', fill_value=0
).stack().sort_index(level=1).reset_index()
dt user val
0 ... |
44,978,196 | I've a data frame that looks like the following
```
x = pd.DataFrame({'user': ['a','a','b','b'], 'dt': ['2016-01-01','2016-01-02', '2016-01-05','2016-01-06'], 'val': [1,33,2,1]})
```
What I would like to be able to do is find the minimum and maximum date within the date column and expand that column to have all the ... | 2017/07/07 | [
"https://Stackoverflow.com/questions/44978196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1210178/"
] | Initial Dataframe:
```
dt user val
0 2016-01-01 a 1
1 2016-01-02 a 33
2 2016-01-05 b 2
3 2016-01-06 b 1
```
First, convert the dates to datetime:
```
x['dt'] = pd.to_datetime(x['dt'])
```
Then, generate the dates and unique users:
```
dates = x.set_inde... | An old question, with already excellent answers; this is an alternative, using the [complete](https://pyjanitor-devs.github.io/pyjanitor/reference/janitor.functions/janitor.complete.html#janitor.complete) function from [pyjanitor](https://pyjanitor-devs.github.io/pyjanitor/) that could help with the abstraction when ge... |
44,978,196 | I've a data frame that looks like the following
```
x = pd.DataFrame({'user': ['a','a','b','b'], 'dt': ['2016-01-01','2016-01-02', '2016-01-05','2016-01-06'], 'val': [1,33,2,1]})
```
What I would like to be able to do is find the minimum and maximum date within the date column and expand that column to have all the ... | 2017/07/07 | [
"https://Stackoverflow.com/questions/44978196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1210178/"
] | As @ayhan suggests
```
x.dt = pd.to_datetime(x.dt)
```
One-liner using mostly @ayhan's ideas while incorporating `stack`/`unstack` and `fill_value`
```
x.set_index(
['dt', 'user']
).unstack(
fill_value=0
).asfreq(
'D', fill_value=0
).stack().sort_index(level=1).reset_index()
dt user val
0 ... | An old question, with already excellent answers; this is an alternative, using the [complete](https://pyjanitor-devs.github.io/pyjanitor/reference/janitor.functions/janitor.complete.html#janitor.complete) function from [pyjanitor](https://pyjanitor-devs.github.io/pyjanitor/) that could help with the abstraction when ge... |
24,547,252 | I would like to correctly format my help message for my Perl scripts and if possible by using a standard module such as `Pod::Usage`. Unfortunately I do not really like the output format of pod2usage. For instance, with `grep` I get the following help structure:
```
$ grep --help
Usage: grep [OPTION]... PATTERN [FILE... | 2014/07/03 | [
"https://Stackoverflow.com/questions/24547252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2612235/"
] | When you use `=item`, you should prefix it with an `=over x` where `x` is how far you want to move over. After you finish your items, you need to use `=back`. If `=over x` is far enough over, the paragraph for that item will print on the same line as the `=item`. I played around and found `=over 20` looks pretty good:
... | Two things you can try:
The [-noperldoc option](https://metacpan.org/pod/Pod::Usage#noperldoc) to make it switch to Pod::Text, which is a simpler formatter.
or
[Set a different formatter](https://metacpan.org/pod/Pod::Usage#Formatting-base-class)
`Pod::Text` has several formatting options as well, such as the left ... |
17,255,713 | I have various values in a PHP array, that look like below:
```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
```
The first part before the underscore (*news, blog, member*) is dynamic so I would like to get all the matches in a specific section (*news*) followed by the numbers.
Somethin... | 2013/06/22 | [
"https://Stackoverflow.com/questions/17255713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2497987/"
] | ```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
$section = "news";
foreach($values as $value) {
$matches = preg_match("/{$section}_(\\d+)/", $value, $number);
if ($matches)
echo $number[1], PHP_EOL;
}
``` | ```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
function func($type){
$results = null;
foreach($values as $val){
$curr = explode('_',$val);
if($curr[0]==$type){
$results[] = $curr[1];
}
}
return $results;
}
$News = func('news');
```
G... |
17,255,713 | I have various values in a PHP array, that look like below:
```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
```
The first part before the underscore (*news, blog, member*) is dynamic so I would like to get all the matches in a specific section (*news*) followed by the numbers.
Somethin... | 2013/06/22 | [
"https://Stackoverflow.com/questions/17255713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2497987/"
] | ```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
$section = "news";
foreach($values as $value) {
$matches = preg_match("/{$section}_(\\d+)/", $value, $number);
if ($matches)
echo $number[1], PHP_EOL;
}
``` | Note I added two cases:
```
$values = array ("news_24", "news_81", "blog_56", "member_55", "news_27",
"blognews_99", "news_2012_12");
$section = "news";
preg_match_all("/^{$section}_(\\d+)\$/m", implode("\n", $values), $matches);
print_r($matches[1]);
```
The implode might not be super efficient,... |
17,255,713 | I have various values in a PHP array, that look like below:
```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
```
The first part before the underscore (*news, blog, member*) is dynamic so I would like to get all the matches in a specific section (*news*) followed by the numbers.
Somethin... | 2013/06/22 | [
"https://Stackoverflow.com/questions/17255713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2497987/"
] | ```
$values = array("news_24", "news_81", "blog_56", "member_55", "news_27");
function func($type){
$results = null;
foreach($values as $val){
$curr = explode('_',$val);
if($curr[0]==$type){
$results[] = $curr[1];
}
}
return $results;
}
$News = func('news');
```
G... | Note I added two cases:
```
$values = array ("news_24", "news_81", "blog_56", "member_55", "news_27",
"blognews_99", "news_2012_12");
$section = "news";
preg_match_all("/^{$section}_(\\d+)\$/m", implode("\n", $values), $matches);
print_r($matches[1]);
```
The implode might not be super efficient,... |
830,198 | I have 2 Server 2012r2 servers running DNS in failover/loadbalance. They both sync fine but I have noticed that they each claim themselves as SOA. It sounds wrong to me, but is this due to the failover?
Thanks,
Travis | 2017/02/02 | [
"https://serverfault.com/questions/830198",
"https://serverfault.com",
"https://serverfault.com/users/292043/"
] | For AD integrated DNS zones, each server hosting a copy of the zone is the SOA for it's copy of the zone.
This is perfectly normal. | It is typical for systems that do not use DNS to replicate to claim themselves as master. This is true for not only Windows (AD Integrated zones) but also bind (ldap-bind) and powerdns (ldap, database, etc).
More on [Windows](https://support.microsoft.com/en-us/help/282826/active-directory-integrated-dns-zone-serial-n... |
25,714,197 | I'm interested in printing a double as raw hex. I don't want the mantissa and exponent interpreted.
Is there a print function in Java to accomplish it?
If not, how does one extract raw octets from a double in Java? | 2014/09/07 | [
"https://Stackoverflow.com/questions/25714197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/608639/"
] | Use [`Double.doubleToLongBits()`](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#doubleToLongBits(double)) or [`Double.doubleToRawLongBits()`](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#doubleToRawLongBits(double)). | First, get the bits as long, using [Double.doubleToLongBits()](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#doubleToLongBits(double) "javadoc") or [Double.doubleToRawLongBits()](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#doubleToRawLongBits(double) "javadoc").
However if you would... |
17,035,819 | I have a mysql table
```
Table A
--------------------
item_id category_id
--------------------
1 1
1 2
1 4
2 1
2 3
```
Would like to make an sql query that will select all matches in an array
***example:***
```
given category_ids are 1,4 it should return only item_id 1
given cat... | 2013/06/11 | [
"https://Stackoverflow.com/questions/17035819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2472949/"
] | For categories 1, 4:
```
SELECT item_id, COUNT(*) c
FROM TableA
WHERE category_id IN (1, 4)
GROUP BY item_id
HAVING c = 2
```
For category 1:
```
SELECT item_id, COUNT(*) c
FROM TableA
WHERE category_id IN (1)
GROUP BY item_id
HAVING c = 1
```
I think you should be able to see the pattern -- the `HAVING` clause s... | given category\_ids are 1,4
---------------------------
SELECT item\_id, category\_id
FROM TableA
WHERE category\_id IN (1, 4)
given category\_ids are 1
-------------------------
SELECT item\_id, category\_id
FROM TableA
WHERE category\_id IN (1) |
38,720,294 | I have around 21 databases on my SQL Server 2012 machine, which should ideally have the same list of tables but they don't.
Assume:
* Database 1 has tables A,B,C,D,E
* Database 2 has tables A,B,C,D,Z
* Database 3 has tables A,B,C,Y,Z
* Database 4 has tables A,B,X,Y,Z
The output of my final query must be a table list... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38720294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3955698/"
] | You can use `union`:
```
select d.*
from ((select table_name from db1.information_schema.tables) union
(select table_name from db2.information_schema.tables) union
. . .
(select table_name from db21.information_schema.tables)
) d;
```
Actually, the subquery is not really necessary, but it is ... | If I understood your question correctly,
You want to list all the tables for all databases
There is avery simple script which will accomplish this task
as floowing:
```
sp_msforeachdb 'select "?" AS db, * from [?].sys.tables'
```
and getting the list of tables only :
```
sp_msforeachdb 'select "?" AS db, name fr... |
38,720,294 | I have around 21 databases on my SQL Server 2012 machine, which should ideally have the same list of tables but they don't.
Assume:
* Database 1 has tables A,B,C,D,E
* Database 2 has tables A,B,C,D,Z
* Database 3 has tables A,B,C,Y,Z
* Database 4 has tables A,B,X,Y,Z
The output of my final query must be a table list... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38720294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3955698/"
] | Just for those who stumble upon this in future.
```
SET NOCOUNT ON
DECLARE @AllTables TABLE
(
ServerName NVARCHAR(200)
,DBName NVARCHAR(200)
,SchemaName NVARCHAR(200)
,TableName NVARCHAR(200)
)
DECLARE @SearchSvr NVARCHAR(200)
,@SearchDB NVARCHAR(200)
,@Se... | You can use `union`:
```
select d.*
from ((select table_name from db1.information_schema.tables) union
(select table_name from db2.information_schema.tables) union
. . .
(select table_name from db21.information_schema.tables)
) d;
```
Actually, the subquery is not really necessary, but it is ... |
38,720,294 | I have around 21 databases on my SQL Server 2012 machine, which should ideally have the same list of tables but they don't.
Assume:
* Database 1 has tables A,B,C,D,E
* Database 2 has tables A,B,C,D,Z
* Database 3 has tables A,B,C,Y,Z
* Database 4 has tables A,B,X,Y,Z
The output of my final query must be a table list... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38720294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3955698/"
] | Just for those who stumble upon this in future.
```
SET NOCOUNT ON
DECLARE @AllTables TABLE
(
ServerName NVARCHAR(200)
,DBName NVARCHAR(200)
,SchemaName NVARCHAR(200)
,TableName NVARCHAR(200)
)
DECLARE @SearchSvr NVARCHAR(200)
,@SearchDB NVARCHAR(200)
,@Se... | If I understood your question correctly,
You want to list all the tables for all databases
There is avery simple script which will accomplish this task
as floowing:
```
sp_msforeachdb 'select "?" AS db, * from [?].sys.tables'
```
and getting the list of tables only :
```
sp_msforeachdb 'select "?" AS db, name fr... |
2,931,642 | I am trying to simulate a 'HEAD' method using UrlLoader; essentially, I just want to check for the presence of a file without downloading the entire thing. I figured I would just use HttpStatusEvent, but the following code throws an exception (one that I can't wrap in a try/catch block) when you run in debug mode.
```... | 2010/05/28 | [
"https://Stackoverflow.com/questions/2931642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51442/"
] | It's a bug in the URLLoader class, I think.
If you read the error message (at least the one I got, you haven't pasted yorrs!) you will see it:
>
> Error: Error #2029: This URLStream
> object does not have a stream opened
> at flash.net::URLStream/readBytes()
> at flash.net::URLLoader/onComplete()
>
>
>
This g... | I have run into a similary issue.
What I discovered to be the problem was this call:
```
_loader.close();
```
The error occurred when I tried to close a file that I had not even opened. So in "try" clause, do a check for if the file is open before you try to close it.
Mike |
5,174,841 | I wanted to increment a variable, k inside a loop. Each increment is by 0.025. I tried using:
`let "k += 0.025"`
and
`let "$k += 0.025"`
and
`k += 0.025`
and many other variations. Does anyone know how to accomplish this? | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381798/"
] | Use integer math and then convert to decimal when needed.
```
#!/bin/bash
k=25
# Start of loop
#
# Increment variable by 0.025 (times 1000).
#
let k="$k+25"
# Get value as fraction (uses bc).
#
v=$(echo "$k/1000"|bc -l)
# End of loop
#
echo $v
```
Save as `t.sh`, then:
```
$ chmod +x t.sh
$ ./t... | Bash doesn't handle floating point math whatsoever. You need help from an external tool like [bc](http://en.wikipedia.org/wiki/Bc_programming_language). |
5,174,841 | I wanted to increment a variable, k inside a loop. Each increment is by 0.025. I tried using:
`let "k += 0.025"`
and
`let "$k += 0.025"`
and
`k += 0.025`
and many other variations. Does anyone know how to accomplish this? | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381798/"
] | ```
#!/bin/sh
k=1.00
incl=0.025
k=`echo $k + $incl | bc`
echo $k
``` | Bash doesn't handle floating point math whatsoever. You need help from an external tool like [bc](http://en.wikipedia.org/wiki/Bc_programming_language). |
5,174,841 | I wanted to increment a variable, k inside a loop. Each increment is by 0.025. I tried using:
`let "k += 0.025"`
and
`let "$k += 0.025"`
and
`k += 0.025`
and many other variations. Does anyone know how to accomplish this? | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381798/"
] | You may be working on some giant bash masterpiece that can't be rewritten without a king's ransom.
Alternatively, this problem may be telling you "*write me in **Ruby** or **Python** or **Perl** or **Awk***". | Bash doesn't handle floating point math whatsoever. You need help from an external tool like [bc](http://en.wikipedia.org/wiki/Bc_programming_language). |
5,174,841 | I wanted to increment a variable, k inside a loop. Each increment is by 0.025. I tried using:
`let "k += 0.025"`
and
`let "$k += 0.025"`
and
`k += 0.025`
and many other variations. Does anyone know how to accomplish this? | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381798/"
] | Use integer math and then convert to decimal when needed.
```
#!/bin/bash
k=25
# Start of loop
#
# Increment variable by 0.025 (times 1000).
#
let k="$k+25"
# Get value as fraction (uses bc).
#
v=$(echo "$k/1000"|bc -l)
# End of loop
#
echo $v
```
Save as `t.sh`, then:
```
$ chmod +x t.sh
$ ./t... | ```
#!/bin/sh
k=1.00
incl=0.025
k=`echo $k + $incl | bc`
echo $k
``` |
5,174,841 | I wanted to increment a variable, k inside a loop. Each increment is by 0.025. I tried using:
`let "k += 0.025"`
and
`let "$k += 0.025"`
and
`k += 0.025`
and many other variations. Does anyone know how to accomplish this? | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381798/"
] | Use integer math and then convert to decimal when needed.
```
#!/bin/bash
k=25
# Start of loop
#
# Increment variable by 0.025 (times 1000).
#
let k="$k+25"
# Get value as fraction (uses bc).
#
v=$(echo "$k/1000"|bc -l)
# End of loop
#
echo $v
```
Save as `t.sh`, then:
```
$ chmod +x t.sh
$ ./t... | You may be working on some giant bash masterpiece that can't be rewritten without a king's ransom.
Alternatively, this problem may be telling you "*write me in **Ruby** or **Python** or **Perl** or **Awk***". |
110,573 | In the IID case, it is known that all order statistics are positively correlated.\* Thus, we know that $$\text{Cov}(X\_{(i)},X\_{(j)}) \geq 0.$$ Is this known in the INID (independent, non-identically distributed) case? If it is not known, how could this be proved? If it does not seem true, what would be a counter-exam... | 2012/10/24 | [
"https://mathoverflow.net/questions/110573",
"https://mathoverflow.net",
"https://mathoverflow.net/users/27304/"
] | You asked for an example with **independent** variables and **negatively correlated** order statistics. I can come close in two ways.
Here is an example with **uncorrelated** variables and **negatively correlated** order statistics.

Suppose the sta... | If $X\sim N(0,1)$ and $(X\_1,X\_2) = (X,-X)$ the covariance of $(X^{(1)},X^{(2)})=\min(X\_1,X\_2),\max(X\_1,X\_2)$ is negative. |
5,528,295 | I haven't actually came across this situation yet but i will probably have a need for it in the near future. In current frameworks or CMS like joomla I have noticed multiple parameters and values stored in 1 field within a database table. what would be the best way to extract these values as a key => value in an array?... | 2011/04/03 | [
"https://Stackoverflow.com/questions/5528295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/635925/"
] | The easiest way to make round corners is to use `-moz-border-radius` and `webkit-border-radius`, however these properties are only supported on Mozilla and Webkit browsers.
However what I would do is make a main div with a relative position and then have your corners as absolute, like so:
```
<div style="position:re... | Use jQuery round corner plugin.
<http://jquery.malsup.com/corner/>
It's supported in all browsers including IE. It draws corners in IE using nested divs (no images). It also has native border-radius rounding in browsers that support it (Opera 10.5+, Firefox, Safari, and Chrome). So in those browsers the plugin simpl... |
5,528,295 | I haven't actually came across this situation yet but i will probably have a need for it in the near future. In current frameworks or CMS like joomla I have noticed multiple parameters and values stored in 1 field within a database table. what would be the best way to extract these values as a key => value in an array?... | 2011/04/03 | [
"https://Stackoverflow.com/questions/5528295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/635925/"
] | The easiest way to make round corners is to use `-moz-border-radius` and `webkit-border-radius`, however these properties are only supported on Mozilla and Webkit browsers.
However what I would do is make a main div with a relative position and then have your corners as absolute, like so:
```
<div style="position:re... | I recently answered a similar question and the answer might help if you want a pure CSS method, nesting rather than float may be the answer.
[See this answer for possible solution](https://stackoverflow.com/questions/5474951/css-make-divs-inherit-a-height/5480017#5480017) |
5,528,295 | I haven't actually came across this situation yet but i will probably have a need for it in the near future. In current frameworks or CMS like joomla I have noticed multiple parameters and values stored in 1 field within a database table. what would be the best way to extract these values as a key => value in an array?... | 2011/04/03 | [
"https://Stackoverflow.com/questions/5528295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/635925/"
] | I recently answered a similar question and the answer might help if you want a pure CSS method, nesting rather than float may be the answer.
[See this answer for possible solution](https://stackoverflow.com/questions/5474951/css-make-divs-inherit-a-height/5480017#5480017) | Use jQuery round corner plugin.
<http://jquery.malsup.com/corner/>
It's supported in all browsers including IE. It draws corners in IE using nested divs (no images). It also has native border-radius rounding in browsers that support it (Opera 10.5+, Firefox, Safari, and Chrome). So in those browsers the plugin simpl... |
1,965,777 | This seems like a really basic calculus question, which is a tad embarrassing since I'm a graduate student, but what does it mean when a substitution in a definite integral makes the bounds the same? For example, if we have some function of $\sin(x)$:
$$\int\_0^{\pi} f(\sin(x)) \,\mathrm{d}x$$
If we make the substitu... | 2016/10/12 | [
"https://math.stackexchange.com/questions/1965777",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/148555/"
] | For the second integral, note that the substitution $u=\sqrt{x^2+a^2}$ implies:
$$
u\ge 0 \quad \mbox{and}\quad x=\pm\sqrt{u^2-a^2}
$$
so:
$$
dx=\frac{udu}{\sqrt{u^2-a^2}} \mbox{for}\quad x \ge 0
$$
$$
dx=\frac{udu}{-\sqrt{u^2-a^2}} \mbox{for}\quad x < 0
$$
and the integral splits in two parts as $\int\_{-b}^0 +\int... | The first integral is NOT zero! Let $f$ be the identity function, for example.
In the second integral it is wrong to say that $x=\sqrt{u^2-a^2}$ for all values of $x$. In the first integral, the same: $cos(x)=\sqrt{1-u^2}$ is not true for all values of $x$.
When the substitution is not injective, problems arise when ... |
29,632,408 | I have billions records in `patients colletion`,
I have no idea how could I filter it with pipeline.
Or this is a limit on mongoDB, we couldn't aggregate with pipeline on large collection ?
I've already add `allowDiskUse=True` option, but it doesn't work too.
How could I get the filtered result by the pipeline ?
Ho... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29632408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3675188/"
] | Try this:
```
var selected = $(this).find('option:selected').text()
```
See [Fiddle](http://jsfiddle.net/9mt3ag58/) | Here is code :
```php
echo '<select name="country" id="country" />';
echo '<option value="0" selected>Select Country</option>';
echo '<option value = "'.money_format('%.2n', $row2["price"]).'">'.$row2["monday"].'</option>';
}
echo '</select>
``` |
54,283,616 | I've been reading a introduction to java book *(Core Java SE 9, not that it's important)* and it mentioned that you couldn't write a method that changes an object reference to something else.
The code they've provided as an example of what doesn't work is as follows. My question is what is the alternative to this I co... | 2019/01/21 | [
"https://Stackoverflow.com/questions/54283616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7922708/"
] | Do you add `<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />` in AndroidManifest file ?
**UPDATE**:
if you want to save to internal storage, you can use below code:
```
private void storeImage(Bitmap image) {
try {
String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmm").format... | You can use below code to save bitmap to internal storage.It will create dirctory in internal storage `imageDir` , and you have to give the name to save your image i.e `profile.jpg`
```
private String saveToInternalStorage(Bitmap bitmapImage){
ContextWrapper cw = new ContextWrapper(getApplicationContext()... |
5,557,219 | I'm experimenting with ways of creating immutable objects. The following builder objects
are quite attractive because they keep the role of the arguments clear. However I would like
to use the compiler to verify that certain fields are set, like with the `Immutable()` constructor invocation. `StrictImmutableBuilder` pr... | 2011/04/05 | [
"https://Stackoverflow.com/questions/5557219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/682006/"
] | Here's the pattern I use:
```
class YourClass {
// these are final
private final int x;
private final int y;
private int a;
private int b;
// finals are passed into the constructor
private YourClass(int x, int y) {
this.x = x;
this.y = y;
}
public static class Builder {
// int x, int y... | there is this trick: Type-safe Builder Pattern
<http://michid.wordpress.com/2008/08/13/type-safe-builder-pattern-in-java/>
but that's just too crazy. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | I would recommend checking the permissions on `/etc/passwd` and `/etc/group`. If they're not set to 644 (`-rw-r--r--`), then run:
`chmod 644 /etc/passwd; chmod 644 /etc/group` | Check that each and every line in `/etc/passwd` has exactly seven fields. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | I would recommend checking the permissions on `/etc/passwd` and `/etc/group`. If they're not set to 644 (`-rw-r--r--`), then run:
`chmod 644 /etc/passwd; chmod 644 /etc/group` | I know it's right on time, but the reason could be `coreutils` compiled without ACL support. Check it and rebuild the package if needed. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | Notice there is a missing `x`
This is the content of mine on Linux Mint with kernel 3.8.0-35-generic
```
root:x:0:0:root:/root:/bin/zsh
```
The `x` means that the actual password information is being stored in a separate shadow password file, tipically `/etc/shadow`
<https://en.wikipedia.org/wiki/Passwd> | Check that each and every line in `/etc/passwd` has exactly seven fields. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | Notice there is a missing `x`
This is the content of mine on Linux Mint with kernel 3.8.0-35-generic
```
root:x:0:0:root:/root:/bin/zsh
```
The `x` means that the actual password information is being stored in a separate shadow password file, tipically `/etc/shadow`
<https://en.wikipedia.org/wiki/Passwd> | I know it's right on time, but the reason could be `coreutils` compiled without ACL support. Check it and rebuild the package if needed. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | Check that each and every line in `/etc/passwd` has exactly seven fields. | I know it's right on time, but the reason could be `coreutils` compiled without ACL support. Check it and rebuild the package if needed. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | just say my experience
// after check /etc/passwd, /etc/shadow
0. problem
----------
on broken device:
```
cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
```
and
```
whoami
whoami: cannot find name for user ID 0
```
on normal device:
```
whoami
root
```
1. research
-----------
try to find the reason:
`... | Check that each and every line in `/etc/passwd` has exactly seven fields. |
63,182 | When I run `whoami` it says:
>
> whoami: cannot find name for user id 0
>
>
>
My `/etc/passwd` file looks like this:
```
root::0:0:root:/root:/bin/bash
``` | 2013/01/31 | [
"https://unix.stackexchange.com/questions/63182",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/30609/"
] | just say my experience
// after check /etc/passwd, /etc/shadow
0. problem
----------
on broken device:
```
cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
```
and
```
whoami
whoami: cannot find name for user ID 0
```
on normal device:
```
whoami
root
```
1. research
-----------
try to find the reason:
`... | I know it's right on time, but the reason could be `coreutils` compiled without ACL support. Check it and rebuild the package if needed. |
71,704,319 | I'm trying to create a discord bot, specifically the married.
I am using a MongoDB database. Now everything works and is saved, but there is one problem, the data is saved for the second and third rounds, etc.
That is, the checks that I added do not work. I am trying to find data through `const exists = Marry.findOne... | 2022/04/01 | [
"https://Stackoverflow.com/questions/71704319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was facing the same issue.
Root cause was me npm installing `@angular/material-date-fns-adapter` with a different version to the rest of angular/material.
It turns out, date-fns is not possible with my version of material, so I will try to upgrade the website to latest version of material. Wish me luck.
The angula... | That means that when you are providing an adapter object (or a class) for the DateAdapter interface the D in the interface is manadatory... so you have to define D or say it is 'any' like so:
```
{
provide: DateAdapter<any>,
useClass: DateFnsAdapter,
deps: [MAT_DATE_LOCALE],
},
```
that or `DateAdapter<u... |
15,348,516 | I am using Magical Record to help with core data saving and multi threading.
I kick off a new thread with GCD. In that new thread, I check if an Entity exists; if it does not I want to create a new one and save it.
Will `saveUsingCurrentThreadContextWithBlock^(NSManagedObjectContext *localContext){}` return to the ma... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15348516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875498/"
] | In the current version of MagicalRecord, yes, the completion block will return to the main thread. However, your method here is incorrect. There are now more explicit variants of the save method:
```
saveOnlySelf:completion:
saveToPersistentStore:completion:
```
Have a look at these methods in the current version. A... | Yes, the completion block with execute in the main thread. For example:
```
NSOperationQueue *newQueue = [[NSOperationQueue alloc] init];
[newQueue addOperationWithBlock:^{
[MagicalRecord saveUsingCurrentThreadContextWithBlock:^(NSManagedObjectContext *localContext) {
// save something
} completion:^(B... |
15,348,516 | I am using Magical Record to help with core data saving and multi threading.
I kick off a new thread with GCD. In that new thread, I check if an Entity exists; if it does not I want to create a new one and save it.
Will `saveUsingCurrentThreadContextWithBlock^(NSManagedObjectContext *localContext){}` return to the ma... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15348516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875498/"
] | Ok, I got it to work:
```
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
Person *person = [Person MR_findFirstByAttribute:NAME withValue:self.user.username];
if (person == NULL) {
[MagicalRecord saveUsingCurrentThreadContextWithBlock:^(NSManagedObjectContext *loca... | Yes, the completion block with execute in the main thread. For example:
```
NSOperationQueue *newQueue = [[NSOperationQueue alloc] init];
[newQueue addOperationWithBlock:^{
[MagicalRecord saveUsingCurrentThreadContextWithBlock:^(NSManagedObjectContext *localContext) {
// save something
} completion:^(B... |
15,348,516 | I am using Magical Record to help with core data saving and multi threading.
I kick off a new thread with GCD. In that new thread, I check if an Entity exists; if it does not I want to create a new one and save it.
Will `saveUsingCurrentThreadContextWithBlock^(NSManagedObjectContext *localContext){}` return to the ma... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15348516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875498/"
] | Ok, I got it to work:
```
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
Person *person = [Person MR_findFirstByAttribute:NAME withValue:self.user.username];
if (person == NULL) {
[MagicalRecord saveUsingCurrentThreadContextWithBlock:^(NSManagedObjectContext *loca... | In the current version of MagicalRecord, yes, the completion block will return to the main thread. However, your method here is incorrect. There are now more explicit variants of the save method:
```
saveOnlySelf:completion:
saveToPersistentStore:completion:
```
Have a look at these methods in the current version. A... |
62,257,197 | GCS Signed Urls enable you to simply make objects available temporarily public by a signed url.
<https://cloud.google.com/storage/docs/access-control/signed-urls>
As I understand it, you need to calculate a signature based on several parameters, and then you get
access to the object without any other security layer.
... | 2020/06/08 | [
"https://Stackoverflow.com/questions/62257197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12845385/"
] | >
> Unfortunately the documentation is not completely clear if an object gets explicitly activated by the GCS service for that and gets a flag "signature XYZ valid for XX minutes on object ABC" or if GCS serves all files all time, as long as the signature is correct.
>
>
>
The signed URL contains a timestamp after... | Looking at the [library code](https://github.com/googleapis/google-cloud-go/blob/3044f9c9ca84c8baddd2472cce72d0ab73eaa394/storage/storage.go#L551), the signed URLs are created using your service account private key without cooperation from GCP.
Regarding the brute-force, each Signed URL has a [credential attached](htt... |
47,059,537 | I want to use a value stored in the AsyncStorage in another function.
Here's my ValueHandler.js
```
import { AsyncStorage } from 'react-native';
export async function getSavedValue() {
try {
const val = await AsyncStorage.getItem('@MyStore:savedValue');
console.log("#getSavedValue", val);
return val;
... | 2017/11/01 | [
"https://Stackoverflow.com/questions/47059537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5115097/"
] | You can use the regular bootsrap class used to build your layout **and drop the collapsing navbar classes**: see <https://getbootstrap.com/docs/4.0/utilities/flex/>
>
> **Flex**
>
>
> Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive f... | Using CSS *media queries*, you can set specific break-points to change your elements. In this example, if the window is *less than* 480px then we can adjust the width to 100%.
(To see it in action, click run > full page > then resize window)
```css
.navTitle {
width: 20%;
float: left;
background-color: light... |
60,304,126 | I'm new in developement. I'm using VSCode with One Dark+ theme. I would like to change a meta tag name color from "#E06C75" to "#1b1ff0". I tried modified the settings.json but it didn't work. Please help me to resolve this issue.
To make it clear what is "meta tag name" (maybe I use wrong words), it means something l... | 2020/02/19 | [
"https://Stackoverflow.com/questions/60304126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12073199/"
] | Your syntax is just a little off:
```
"editor.tokenColorCustomizations": { // this is different
"textMateRules": [ // this is different
{
"scope": "entity.name.tag",
"settings": {
"foreground": "#1b1ff0"
}
},
{
"... | You can try the [Highlight](https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-highlight) extension to configure the tokens colors. Althought I don't know if this plugin provides a way to says "any token", but since is using Regex I think there is and you should figure it out (maybe something li... |
54,567,047 | I am building a blog by Laravel. I use `migration:refresh` to adjust the name of one of my table.
After that my login is not working and keep saying
>
> "These credentials do not match our records"
>
>
>
though the login information is correct. Here is my seeds
```
App\User::create([
'name'=> 'name',
... | 2019/02/07 | [
"https://Stackoverflow.com/questions/54567047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9452193/"
] | Try changing the the `bcrypt()` to `Hash::make()`
```
use Hash;
App\User::create([
'name'=> 'name',
'email'=>'name@gmail.com',
'password'=> Hash::make('laravel')
]);
```
And run
```
php artisan migrate:fresh
``` | Try this command it works for me
```
php artisan migrate:fresh
php artisan migrate
``` |
43,925,195 | On this page (<http://nate.fm/testing/>) you can see that the text link's bottom border gets pushed down. Can anyone tell me where I can change that in the CSS? | 2017/05/11 | [
"https://Stackoverflow.com/questions/43925195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7024325/"
] | You can set the `<a>` tag to `display: inline-block;` then reduce the `line-height`.
Something like this maybe:
```
.post-content a {
line-height: 15px;
display: inline-block;
}
``` | ```
.post-content a {
/* border-bottom: 3px solid #eee; */
text-decoration: underline;
}
``` |
43,925,195 | On this page (<http://nate.fm/testing/>) you can see that the text link's bottom border gets pushed down. Can anyone tell me where I can change that in the CSS? | 2017/05/11 | [
"https://Stackoverflow.com/questions/43925195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7024325/"
] | You can set the `<a>` tag to `display: inline-block;` then reduce the `line-height`.
Something like this maybe:
```
.post-content a {
line-height: 15px;
display: inline-block;
}
``` | They are using `border-bottom` along with `line-height`, the `line-height` property causes the effect of "pushing" down the border you are mentioning
`.post-content a {
border-bottom: 3px solid #eee;
line-height: 160%;
}` |
644 | Is there any Halacha or Minhag that specifies if red or White wine should be used for the four cups of wine during the Passover seder and does it matter what you use to spill out during the 10 plagues? | 2010/04/01 | [
"https://judaism.stackexchange.com/questions/644",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/17/"
] | Not only it is a Minhag, those who say Yotzros on Shabbos Hagadol say it in there:
>
> יין כי יתאדם למצוה הוא מקדם
>
>
>
Translates as "Wine that is Red for the Mitzvah ahead" Not only that the Rambam says you are not Yotzeh using white wine for kiddush (we do not rule like that) and the [Mishnah Berurah](https:/... | Dittos to YS. The reason that many Ashkenazim stopped using red wine for the seder is because of the blood libels, but today (unless you live in an Arabic country) this is not a concern and therefore it is preferable to use red wine for the four cups at the seder. |
644 | Is there any Halacha or Minhag that specifies if red or White wine should be used for the four cups of wine during the Passover seder and does it matter what you use to spill out during the 10 plagues? | 2010/04/01 | [
"https://judaism.stackexchange.com/questions/644",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/17/"
] | Not only it is a Minhag, those who say Yotzros on Shabbos Hagadol say it in there:
>
> יין כי יתאדם למצוה הוא מקדם
>
>
>
Translates as "Wine that is Red for the Mitzvah ahead" Not only that the Rambam says you are not Yotzeh using white wine for kiddush (we do not rule like that) and the [Mishnah Berurah](https:/... | The Rav, Rabbi Joseph Ber Solovetchik, says to have red wine for the first cup [Kiddush], to signify Cherut (≈freedom). |
644 | Is there any Halacha or Minhag that specifies if red or White wine should be used for the four cups of wine during the Passover seder and does it matter what you use to spill out during the 10 plagues? | 2010/04/01 | [
"https://judaism.stackexchange.com/questions/644",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/17/"
] | Dittos to YS. The reason that many Ashkenazim stopped using red wine for the seder is because of the blood libels, but today (unless you live in an Arabic country) this is not a concern and therefore it is preferable to use red wine for the four cups at the seder. | The Rav, Rabbi Joseph Ber Solovetchik, says to have red wine for the first cup [Kiddush], to signify Cherut (≈freedom). |
88,924 | So I have a recessed nook about 64" wide and 30" deep (it fits my washer and dryer side by side, plus a 6" narrow cabinet pull-out). I'm planning to have a (probably quartz) countertop installed.
[](https://i.stack.imgur.com/cjmZ1.png)
I presume atta... | 2016/04/18 | [
"https://diy.stackexchange.com/questions/88924",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/6581/"
] | The countertop guys will laugh at you if you want to span quartz over a 5' span. Basically quartz and granite can barely span a dishwasher width - meaning we get buy with not having plywood over the counters. And that is given nothing heavy is stored on it on that section. Given you will have a washer and dryer below i... | Quartz weigh's 16-20 lbs per sq. ft. depending if it's 3/4" or 1-1/4". You will be fine with attaching a strip of 3/4" x 2" depth plywood or solid wood strips on all three wall sides and then slide the quartz into place for 1-1/4" (3cm) thickness, all four sides need support for 3/4" (2cm) thickness. I am a professiona... |
13,960 | When we do k-fold cross validation, should we just use the classifier that has the highest test accuracy? What is generally the best approach in getting a classifier from cross validation? | 2016/09/13 | [
"https://datascience.stackexchange.com/questions/13960",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/20635/"
] | No. You don't select any of the k classifiers built during k-fold cross-validation. First of all, the purpose of cross-validation is not to come up with a predictive model, but to evaluate how accurately a predictive model will perform in practice. Second of all, for the sake of argument, let's say you were to use k-fo... | So let us assume you have training out of which you are using 80% as training and rest 20% as validation data. We can train on the 80% and test on the remaining 20% but it is possible that the 20% we took is not in resemblance with the actual testing data and might perform bad latter. So, in order to prevent this we ca... |
13,960 | When we do k-fold cross validation, should we just use the classifier that has the highest test accuracy? What is generally the best approach in getting a classifier from cross validation? | 2016/09/13 | [
"https://datascience.stackexchange.com/questions/13960",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/20635/"
] | You do cross-validation when you want to do any of these two things:
* Model Selection
* Error Estimation of a Model
Model selection can come in different scenarios:
* Selecting one algorithm vs others for a particular problem/dataset
* Selecting hyper-parameters of a particular algorithm for a particular problem/da... | So let us assume you have training out of which you are using 80% as training and rest 20% as validation data. We can train on the 80% and test on the remaining 20% but it is possible that the 20% we took is not in resemblance with the actual testing data and might perform bad latter. So, in order to prevent this we ca... |
13,960 | When we do k-fold cross validation, should we just use the classifier that has the highest test accuracy? What is generally the best approach in getting a classifier from cross validation? | 2016/09/13 | [
"https://datascience.stackexchange.com/questions/13960",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/20635/"
] | You do cross-validation when you want to do any of these two things:
* Model Selection
* Error Estimation of a Model
Model selection can come in different scenarios:
* Selecting one algorithm vs others for a particular problem/dataset
* Selecting hyper-parameters of a particular algorithm for a particular problem/da... | No. You don't select any of the k classifiers built during k-fold cross-validation. First of all, the purpose of cross-validation is not to come up with a predictive model, but to evaluate how accurately a predictive model will perform in practice. Second of all, for the sake of argument, let's say you were to use k-fo... |
53,608,406 | I'm using DataTables with server-side processing to display tens of thousands rows. I need to filter these data by checkboxes. I was able to make one checkbox which is working fine, but I don't know how to add multiple checkboxes to work together. I found [similar solution](https://stackoverflow.com/questions/8912442/q... | 2018/12/04 | [
"https://Stackoverflow.com/questions/53608406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/809973/"
] | Ok, here is working code:
```
Status:<br>
<input type="checkbox" id="0" name="statuses">Open<br>
<input type="checkbox" id="1" name="statuses">Closed<br>
<input type="checkbox" id="2" name="statuses">Solved<br>
<script>
var idsa = 5;
$('input[name=statuses]').click(function(){
idsa = [];
$('inpu... | Try wrapping your `STATUS` column name into backquotes, that seems to be a MySQL keyword |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | Yup. It's a bit of work though, if you want to use something other than circles or squares :)
See: <http://alistapart.com/article/taminglists>
The article I link to describes doing this by first stripping off the original markup:
```
ul.custom-list {
list-style: none;
margin-left: 0;
padding-left: 1em;
text-inde... | Yes you can use
```
list-style
```
style property for that. |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | If you want a simple (and painless) solution for a triangle in your unordered list, then you could use this method. I simply wrote a fiddle where the CSS gives you a UL list with each item marked with a right-pointing triangle instead of a round bullet.
Is this what you were after?
<http://jsfiddle.net/CU5Ry/>
HTML... | Unfortunately there is no triangle available as a standard marker.
A full list of values for `list-style-type` can be found [here](http://www.w3schools.com/cssref/pr_list-style-type.asp). |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | Yup. It's a bit of work though, if you want to use something other than circles or squares :)
See: <http://alistapart.com/article/taminglists>
The article I link to describes doing this by first stripping off the original markup:
```
ul.custom-list {
list-style: none;
margin-left: 0;
padding-left: 1em;
text-inde... | If you want a simple (and painless) solution for a triangle in your unordered list, then you could use this method. I simply wrote a fiddle where the CSS gives you a UL list with each item marked with a right-pointing triangle instead of a round bullet.
Is this what you were after?
<http://jsfiddle.net/CU5Ry/>
HTML... |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | [JSFiddle of triangle bullets](http://jsfiddle.net/2KZja/1/)
Hopefully this is what you mean?
CSS:
```
.ul1 {
margin: 0.75em 0;
padding: 0 1em;
list-style: none;
}
.li1:before {
content: "";
border-color: transparent #111;
border-style: solid;
border-width: 0.35em 0 0.35em 0.45em;
d... | If you want a simple (and painless) solution for a triangle in your unordered list, then you could use this method. I simply wrote a fiddle where the CSS gives you a UL list with each item marked with a right-pointing triangle instead of a round bullet.
Is this what you were after?
<http://jsfiddle.net/CU5Ry/>
HTML... |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | [JSFiddle of triangle bullets](http://jsfiddle.net/2KZja/1/)
Hopefully this is what you mean?
CSS:
```
.ul1 {
margin: 0.75em 0;
padding: 0 1em;
list-style: none;
}
.li1:before {
content: "";
border-color: transparent #111;
border-style: solid;
border-width: 0.35em 0 0.35em 0.45em;
d... | Yes you can use
```
list-style
```
style property for that. |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | Yes you can use
```
list-style
```
style property for that. | Unfortunately there is no triangle available as a standard marker.
A full list of values for `list-style-type` can be found [here](http://www.w3schools.com/cssref/pr_list-style-type.asp). |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | Yup. It's a bit of work though, if you want to use something other than circles or squares :)
See: <http://alistapart.com/article/taminglists>
The article I link to describes doing this by first stripping off the original markup:
```
ul.custom-list {
list-style: none;
margin-left: 0;
padding-left: 1em;
text-inde... | Unfortunately there is no triangle available as a standard marker.
A full list of values for `list-style-type` can be found [here](http://www.w3schools.com/cssref/pr_list-style-type.asp). |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | Yes you can use
```
list-style
```
style property for that. | Yes. Check this out. You can use CSS propriety as discribed here
<http://www.w3schools.com/cssref/playit.asp?filename=playcss_ol_list-style-type&preval=cjk-ideographic> |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | [JSFiddle of triangle bullets](http://jsfiddle.net/2KZja/1/)
Hopefully this is what you mean?
CSS:
```
.ul1 {
margin: 0.75em 0;
padding: 0 1em;
list-style: none;
}
.li1:before {
content: "";
border-color: transparent #111;
border-style: solid;
border-width: 0.35em 0 0.35em 0.45em;
d... | Yup. It's a bit of work though, if you want to use something other than circles or squares :)
See: <http://alistapart.com/article/taminglists>
The article I link to describes doing this by first stripping off the original markup:
```
ul.custom-list {
list-style: none;
margin-left: 0;
padding-left: 1em;
text-inde... |
18,012,956 | Preferably looking for a triangle to replace the circle. I'd rather not use an image but I would if there was no other way. | 2013/08/02 | [
"https://Stackoverflow.com/questions/18012956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2131689/"
] | Yup. It's a bit of work though, if you want to use something other than circles or squares :)
See: <http://alistapart.com/article/taminglists>
The article I link to describes doing this by first stripping off the original markup:
```
ul.custom-list {
list-style: none;
margin-left: 0;
padding-left: 1em;
text-inde... | Yes. Check this out. You can use CSS propriety as discribed here
<http://www.w3schools.com/cssref/playit.asp?filename=playcss_ol_list-style-type&preval=cjk-ideographic> |
18,754,376 | I would like to set up CMake to build qresource files when the contents of files referenced in the .qrc file change. For example I have some qml files that are packaged into a qrc file and the qrc needs to be recompiled if the qml files are changed.
I have the following macro to run the resource compiler but it will o... | 2013/09/12 | [
"https://Stackoverflow.com/questions/18754376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278403/"
] | **This is the snapshot after making changes**:

Remove `float:left;` from
```
<ul class="nav">
```
and add `float:right;` in login and register
```
<li class="login" style="float:right;">
<li class="register.html" style="float:right;">
``` | If you want to shift items to the right, a simple text align should work:
`<li class = "login" style="text-align: right;">`
Or, if you want to use CSS & HTML:
**HTML:** `<li class = "login">`
**CSS:**
```
.login {
text-align: right;
}
``` |
18,754,376 | I would like to set up CMake to build qresource files when the contents of files referenced in the .qrc file change. For example I have some qml files that are packaged into a qrc file and the qrc needs to be recompiled if the qml files are changed.
I have the following macro to run the resource compiler but it will o... | 2013/09/12 | [
"https://Stackoverflow.com/questions/18754376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278403/"
] | In the context of Bootstrap, all previous answers are wrong. There is specifically `navbar-left` and `navbar-right` to handle just this situation. You should not be trying to float elements left and right on your own, you should be using the provided classes.
The reason you are seeing no space between the elements is ... | If you want to shift items to the right, a simple text align should work:
`<li class = "login" style="text-align: right;">`
Or, if you want to use CSS & HTML:
**HTML:** `<li class = "login">`
**CSS:**
```
.login {
text-align: right;
}
``` |
18,754,376 | I would like to set up CMake to build qresource files when the contents of files referenced in the .qrc file change. For example I have some qml files that are packaged into a qrc file and the qrc needs to be recompiled if the qml files are changed.
I have the following macro to run the resource compiler but it will o... | 2013/09/12 | [
"https://Stackoverflow.com/questions/18754376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278403/"
] | **This is the snapshot after making changes**:

Remove `float:left;` from
```
<ul class="nav">
```
and add `float:right;` in login and register
```
<li class="login" style="float:right;">
<li class="register.html" style="float:right;">
``` | In the context of Bootstrap, all previous answers are wrong. There is specifically `navbar-left` and `navbar-right` to handle just this situation. You should not be trying to float elements left and right on your own, you should be using the provided classes.
The reason you are seeing no space between the elements is ... |
43,854,393 | I have the following dictionaries:
```
inicio=[
{"market":"oranges", "Valor":104.58},
{"market":"apples","Valor":42.55}
]
```
I would like to know if it is possible to get value `42.55` if the value of the key `market` is `apples`.
I was trying something like this:
```
for d in inicio:
if key['market']=... | 2017/05/08 | [
"https://Stackoverflow.com/questions/43854393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7836530/"
] | In your example `d` is the dictionary you're looking for:
```
for d in inicio:
if d['market']=='apples':
print(d['Valor'])
```
And use equality operator (`==`) instead of assignment (`=`) | Use this code
```
inicio=[
{"market":"oranges", "Valor":104.58},
{"market":"apples","Valor":42.55}
]
print inicio[1]['Valor']
```
If you have many items with same apples as market then iterate over the list and check if the key equals apples and then the value.
Check this code.
```
for dictionary in inicio:
... |
43,854,393 | I have the following dictionaries:
```
inicio=[
{"market":"oranges", "Valor":104.58},
{"market":"apples","Valor":42.55}
]
```
I would like to know if it is possible to get value `42.55` if the value of the key `market` is `apples`.
I was trying something like this:
```
for d in inicio:
if key['market']=... | 2017/05/08 | [
"https://Stackoverflow.com/questions/43854393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7836530/"
] | In your example `d` is the dictionary you're looking for:
```
for d in inicio:
if d['market']=='apples':
print(d['Valor'])
```
And use equality operator (`==`) instead of assignment (`=`) | Your code works. Just replace the "=" with "==" in this line:
```
if d['market'] =='apples':
``` |
43,854,393 | I have the following dictionaries:
```
inicio=[
{"market":"oranges", "Valor":104.58},
{"market":"apples","Valor":42.55}
]
```
I would like to know if it is possible to get value `42.55` if the value of the key `market` is `apples`.
I was trying something like this:
```
for d in inicio:
if key['market']=... | 2017/05/08 | [
"https://Stackoverflow.com/questions/43854393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7836530/"
] | In your example `d` is the dictionary you're looking for:
```
for d in inicio:
if d['market']=='apples':
print(d['Valor'])
```
And use equality operator (`==`) instead of assignment (`=`) | if you need the lookup only once then the iterative logic you have provided is alright. One optimization can be applied here -
```
for d in inicio:
if d['market']=='apples':
print(d['Valor'])
break # assuming you only need 1 value
```
However if you need to rerun this logic again, I would sugges... |
38,173,722 | I am new in php therefore I cannot figure out how to solve this issue.
```
<?php
// starts a session and checks if the user is logged in
error_reporting(E_ALL & ~E_NOTICE);
session_start();
if (isset($_SESSION['id'])) {
$userId = $_SESSION['id'];
$username = $_SESSION['username'];
... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38173722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4882481/"
] | In the sql use a `WHERE` clause to get only the filtered rows:
```
$sql = "
SELECT
id, name, room, computer_id, date, start_time, end_time
FROM
booked
WHERE
name = '" . $_SESSION['username'] ."'"
;
$result = mysqli_query($con, $sql);
``` | Use the where clause In sql query like this
```
$sql = "select id, name, room, computer_id, date, start_time, end_time from booked where name='".$username."' ";
$result = mysqli_query($con, $sql);
``` |
38,173,722 | I am new in php therefore I cannot figure out how to solve this issue.
```
<?php
// starts a session and checks if the user is logged in
error_reporting(E_ALL & ~E_NOTICE);
session_start();
if (isset($_SESSION['id'])) {
$userId = $_SESSION['id'];
$username = $_SESSION['username'];
... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38173722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4882481/"
] | In the sql use a `WHERE` clause to get only the filtered rows:
```
$sql = "
SELECT
id, name, room, computer_id, date, start_time, end_time
FROM
booked
WHERE
name = '" . $_SESSION['username'] ."'"
;
$result = mysqli_query($con, $sql);
``` | Use a `WHERE` clause like this:
```
$sql =
"
SELECT `id`, `name`, `room`, `computer_id`, `date`, `start_time`, `end_time` FROM booked
WHERE
name = '".$username."'
";
$result = mysqli_query($con, $sql);
```
**Note:** Try to `echo` your query to see what exactly is happening. |
38,173,722 | I am new in php therefore I cannot figure out how to solve this issue.
```
<?php
// starts a session and checks if the user is logged in
error_reporting(E_ALL & ~E_NOTICE);
session_start();
if (isset($_SESSION['id'])) {
$userId = $_SESSION['id'];
$username = $_SESSION['username'];
... | 2016/07/03 | [
"https://Stackoverflow.com/questions/38173722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4882481/"
] | In the sql use a `WHERE` clause to get only the filtered rows:
```
$sql = "
SELECT
id, name, room, computer_id, date, start_time, end_time
FROM
booked
WHERE
name = '" . $_SESSION['username'] ."'"
;
$result = mysqli_query($con, $sql);
``` | >
> *Your best bet is to rethink your approach since you're working with untrusted user data.*
>
>
>
**Creating your Connection object using PDO (pdo\_driver.php):**
```
namespace CompanyName\App\Drivers;
interface DatabaseConnection
{
public function query($statement, array $values = array());
}
class PdoD... |
17,563,756 | i got problem with my web.xml. I m getting following error: "element listener-class not allowed here". Anyone knows where could be problem? thx for answers.
my web.xml:
```
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/... | 2013/07/10 | [
"https://Stackoverflow.com/questions/17563756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2559447/"
] | ```
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
```... | version is wrong,change as below
http://java.sun.com/xml/ns/javaee/web-app\_3\_0.xsd" id="WebApp\_ID" version="3.0"> |
65,780,660 | I have solved a [problem to count pairs of values](https://www.hackerrank.com/challenges/sock-merchant/problem) in an inputted array using dictionaries in Python.
Problem Example:
```
Input:
[1,1,2,3,2]
Output:
2 (since there are a pair of 1's and a pair or 2's)
```
Code Snippet:
```
dict = {}
for i in range(len... | 2021/01/18 | [
"https://Stackoverflow.com/questions/65780660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8729177/"
] | As mentioned by @P.J.Meisch, you have done everything correct, but missed defining your field data type to `text`, when you define them as `keyword`, even though you are explicitly telling ElasticSearch to use your custom-analyzer `isbn_search_analyzer`, it will be ignored.
Working example on your sample data when fie... | Elasticsearch does not analyze fields of type `keyword`. You need to set the type to `text`. |
70,175,807 | I'm working on a new application using vaadin-spring-boot-starter 21.0.7 and trying to render training database information in a Grid. I'd like to have the first column in the list be a checkbox for Active/Inactive, but I can't figure out how to get that done. Everything I've seen has been for Vaadin 7 or 8.
Mostly cur... | 2021/11/30 | [
"https://Stackoverflow.com/questions/70175807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17489131/"
] | You can do it like this for Vaadin 14 and newer. I have no experience with older versions of Vaadin.
```
grid.addComponentColumn(myBean -> {
Checkbox checkbox = new Checkbox();
checkbox.setValue(true); // this you must handle
checkbox.addClickListener(e -> {
// todo
}
return checkbox;
});
```
The lambd... | I'm using some super old version of vaadin, but I guess the same solution should work in the latest one as well, here's how I usually do it:
* column of type `String`
* column has added `ButtonRenderer` (`column.setRenderer`) renderer with event listener, that allows me to handle user's click action
* value would be a... |
1,464 | The problem I solved is a flow-shop scheduling problem with parallel machines.
I solved it with the IBM ILOG CPLEX Optimization framework.
There I used the constraint programming (CP).
The question is now to what kind of field of operations research CP belongs, in particular the described flow-shop problem.
With the... | 2019/09/06 | [
"https://or.stackexchange.com/questions/1464",
"https://or.stackexchange.com",
"https://or.stackexchange.com/users/1278/"
] | In general, I think Constraint Programming or Constraint Satisfaction Problems have their roots in Computer Science/Artificial Intelligence communities that may or may not overlap to some extent with the Operations Research communities. According to "[Artificial Intelligence, A Modern Approach](http://aima.cs.berkeley.... | From a [comment](https://or.stackexchange.com/questions/1464/to-which-area-does-constraint-programming-belong#comment2362_1464):
>
> ... the main question is "how to classify CP within the hierarchy of OR and optimization".
>
>
>
There's a useful graphic on IBM's webpage: "IT Best Kept Secret Is Optimization - [... |
1,464 | The problem I solved is a flow-shop scheduling problem with parallel machines.
I solved it with the IBM ILOG CPLEX Optimization framework.
There I used the constraint programming (CP).
The question is now to what kind of field of operations research CP belongs, in particular the described flow-shop problem.
With the... | 2019/09/06 | [
"https://or.stackexchange.com/questions/1464",
"https://or.stackexchange.com",
"https://or.stackexchange.com/users/1278/"
] | In general, I think Constraint Programming or Constraint Satisfaction Problems have their roots in Computer Science/Artificial Intelligence communities that may or may not overlap to some extent with the Operations Research communities. According to "[Artificial Intelligence, A Modern Approach](http://aima.cs.berkeley.... | Regarding your question “The question is now to what kind of field of operations research CP belongs”, I will say that CP is not a subfield of operations research, but it is another field, closely related to OR, but it is another field.
If you really like to understand the fundamental of Constraint (Logic) Programming... |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | Will this do?
```
[^\r]\n
```
Basically it matches a '\n' that is preceded with a character that is not '\r'.
If you want it to detect lines that start with just a single '\n' as well, then try
```
([^\r]|$)\n
```
Which says that it should match a '\n' but only those that is the first character of a line or thos... | I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives would a... |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | Will this do?
```
[^\r]\n
```
Basically it matches a '\n' that is preceded with a character that is not '\r'.
If you want it to detect lines that start with just a single '\n' as well, then try
```
([^\r]|$)\n
```
Which says that it should match a '\n' but only those that is the first character of a line or thos... | Try this: Replace(Char.ConvertFromUtf32(13), Char.ConvertFromUtf32(10) + Char.ConvertFromUtf32(13)) |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | It might be faster if you use this.
```
(?<!\r)\n
```
It basically looks for any \n that is not preceded by a \r. This would most likely be faster, because in the other case, almost every letter matches [^\r], so it would capture that, and then look for the \n after that. In the example I gave, it would only stop wh... | I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives would a... |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | I was trying to do the code below to a string and it was not working.
```
myStr.Replace("(?<!\r)\n", "\r\n")
```
I used Regex.Replace and it worked
```
Regex.Replace( oldValue, "(?<!\r)\n", "\r\n")
``` | ```
myStr.Replace("([^\r])\n", "$1\r\n");
```
$ may need to be a \ |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | It might be faster if you use this.
```
(?<!\r)\n
```
It basically looks for any \n that is not preceded by a \r. This would most likely be faster, because in the other case, almost every letter matches [^\r], so it would capture that, and then look for the \n after that. In the example I gave, it would only stop wh... | I was trying to do the code below to a string and it was not working.
```
myStr.Replace("(?<!\r)\n", "\r\n")
```
I used Regex.Replace and it worked
```
Regex.Replace( oldValue, "(?<!\r)\n", "\r\n")
``` |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives would a... | If I know the line endings must be one of CRLF or LF, something that works for me is
```
myStr.Replace("\r?\n", "\r\n");
```
This essentially does the same [neslekkiM](https://stackoverflow.com/a/31070/444402)'s answer except it performs only one replace operation on the string rather than two. This is also compatib... |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | I was trying to do the code below to a string and it was not working.
```
myStr.Replace("(?<!\r)\n", "\r\n")
```
I used Regex.Replace and it worked
```
Regex.Replace( oldValue, "(?<!\r)\n", "\r\n")
``` | Try this: Replace(Char.ConvertFromUtf32(13), Char.ConvertFromUtf32(10) + Char.ConvertFromUtf32(13)) |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | It might be faster if you use this.
```
(?<!\r)\n
```
It basically looks for any \n that is not preceded by a \r. This would most likely be faster, because in the other case, almost every letter matches [^\r], so it would capture that, and then look for the \n after that. In the example I gave, it would only stop wh... | ```
myStr.Replace("([^\r])\n", "$1\r\n");
```
$ may need to be a \ |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | I was trying to do the code below to a string and it was not working.
```
myStr.Replace("(?<!\r)\n", "\r\n")
```
I used Regex.Replace and it worked
```
Regex.Replace( oldValue, "(?<!\r)\n", "\r\n")
``` | I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives would a... |
31,053 | How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
I know to do it using plan `String.Replace`, like:
```
myStr.Replace("\n", "\r\n");
myStr.Replace("\r\r\n", "\r\n");
```
However, this is inelegant, and would destroy any "\r+\r\n" already in the text (although t... | 2008/08/27 | [
"https://Stackoverflow.com/questions/31053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] | I guess that "myStr" is an object of type String, in that case, this is not regex.
\r and \n are the equivalents for CR and LF.
My best guess is that if you know that you have an \n for EACH line, no matter what, then you first should strip out every \r. Then replace all \n with \r\n.
The answer chakrit gives would a... | ```
myStr.Replace("([^\r])\n", "$1\r\n");
```
$ may need to be a \ |
47,370,466 | Just starting with SQL and the first all-nighter is already here.
I have three tables:
```
student (student_id, first_name, last_name)
course (course_id, name)
exam (ref_to_student_id, ref_to_course_id, score)
```
How do I make a select statement and list out student name, last name and course name, for all cases ... | 2017/11/18 | [
"https://Stackoverflow.com/questions/47370466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8046711/"
] | You need to join these tables, not `union` them:
```
SELECT last_name, first_name, name, score
FROM student s
JOIN exam e ON s.student_id = e.ref_to_student_id
JOIN course c ON e.red_to_course_id = c.course_id
WHERE score > 50
``` | Friend, try this:
```
SELECT s.first_name, s.last_name, c.name
FROM exam e
JOIN student s ON s.student_id = e.ref_to_student_id
JOIN course c ON c.course_id = e.ref_to_course_id
WHERE e.score > 50
```
I hope to help you! |
47,370,466 | Just starting with SQL and the first all-nighter is already here.
I have three tables:
```
student (student_id, first_name, last_name)
course (course_id, name)
exam (ref_to_student_id, ref_to_course_id, score)
```
How do I make a select statement and list out student name, last name and course name, for all cases ... | 2017/11/18 | [
"https://Stackoverflow.com/questions/47370466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8046711/"
] | You can use inner join between tables like this:
```
SELECT s.first_name AS first_name, s.last_name AS last_name, c.name AS course_name
FROM student s
INNER JOIN exam e ON e.ref_to_student_id = s.student_id
INNER JOIN course ON c.course_id = e.ref_to_course_id
WHERE e.score > 50;
``` | Friend, try this:
```
SELECT s.first_name, s.last_name, c.name
FROM exam e
JOIN student s ON s.student_id = e.ref_to_student_id
JOIN course c ON c.course_id = e.ref_to_course_id
WHERE e.score > 50
```
I hope to help you! |
29,869,602 | Im getting this error: An object reference is required for the non-static field, method or property 'Android.App.FragmentManager.BeginTransaction()' in the line : FragmentTransaction transaction = FragmentManager.BeginTransaction();
```
void mEditar_Click (object sender, EventArgs e )
{
Fra... | 2015/04/25 | [
"https://Stackoverflow.com/questions/29869602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738999/"
] | Better put that template inside angular `$templateCache` in run phase of angular & remove that template from directive
**Run Block**
```
app.run(function($templateCache) {
$templateCache.put('auratree2', '<item-placeholder></item-placeholder>' +
' <div ng-if="item.children">' +
' ... | Your plunkr had JQuery, but your StackOverflow question doesn't, so I'll assume you are using JQuery (you might have to because of JQLite's limitations).
In your HTML file, modify the order of JQuery and Angular so that the former is listed first.
```
<head>
<meta charset="utf-8" />
<title>Aura Tree</title... |
29,869,602 | Im getting this error: An object reference is required for the non-static field, method or property 'Android.App.FragmentManager.BeginTransaction()' in the line : FragmentTransaction transaction = FragmentManager.BeginTransaction();
```
void mEditar_Click (object sender, EventArgs e )
{
Fra... | 2015/04/25 | [
"https://Stackoverflow.com/questions/29869602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738999/"
] | I don't think your approach with `ng-template` works as you expect it. Even if you manage to replace the placeholder in the `ng-template`, if you had multiple `<auratree>` elements in the app, each with a different item template, then all would have the same (last compiled) template.
Using `ng-include` is a clever tri... | Better put that template inside angular `$templateCache` in run phase of angular & remove that template from directive
**Run Block**
```
app.run(function($templateCache) {
$templateCache.put('auratree2', '<item-placeholder></item-placeholder>' +
' <div ng-if="item.children">' +
' ... |
29,869,602 | Im getting this error: An object reference is required for the non-static field, method or property 'Android.App.FragmentManager.BeginTransaction()' in the line : FragmentTransaction transaction = FragmentManager.BeginTransaction();
```
void mEditar_Click (object sender, EventArgs e )
{
Fra... | 2015/04/25 | [
"https://Stackoverflow.com/questions/29869602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738999/"
] | I don't think your approach with `ng-template` works as you expect it. Even if you manage to replace the placeholder in the `ng-template`, if you had multiple `<auratree>` elements in the app, each with a different item template, then all would have the same (last compiled) template.
Using `ng-include` is a clever tri... | Your plunkr had JQuery, but your StackOverflow question doesn't, so I'll assume you are using JQuery (you might have to because of JQLite's limitations).
In your HTML file, modify the order of JQuery and Angular so that the former is listed first.
```
<head>
<meta charset="utf-8" />
<title>Aura Tree</title... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.