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 |
|---|---|---|---|---|---|
165,203 | I recently bought Surgeon Simulator from the App Store and there are a list of achievements you can earn. I was scrolling through the achievements and I happen to see an achievement where you have to create a hammerhead shark. I am confused, so how do I earn this achievement? | 2014/04/21 | [
"https://gaming.stackexchange.com/questions/165203",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/74879/"
] | The answer is quite simple actually. Take this achievement in literal terms and strike the patient in the head during an operation. I hope this helps! | You need to hit the patient in the head with a hammer to get this achievement . You will actually need to perform this procedure during the eye transplant. |
165,203 | I recently bought Surgeon Simulator from the App Store and there are a list of achievements you can earn. I was scrolling through the achievements and I happen to see an achievement where you have to create a hammerhead shark. I am confused, so how do I earn this achievement? | 2014/04/21 | [
"https://gaming.stackexchange.com/questions/165203",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/74879/"
] | The answer is quite simple actually. Take this achievement in literal terms and strike the patient in the head during an operation. I hope this helps! | You can get this by gouging the eye halfway out in Eye surgery then striking the patient on the temple with your hand. I did this with all my fingers contracted. Might've been a glitch but it worked for me. |
165,203 | I recently bought Surgeon Simulator from the App Store and there are a list of achievements you can earn. I was scrolling through the achievements and I happen to see an achievement where you have to create a hammerhead shark. I am confused, so how do I earn this achievement? | 2014/04/21 | [
"https://gaming.stackexchange.com/questions/165203",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/74879/"
] | You need to hit the patient in the head with a hammer to get this achievement . You will actually need to perform this procedure during the eye transplant. | You can get this by gouging the eye halfway out in Eye surgery then striking the patient on the temple with your hand. I did this with all my fingers contracted. Might've been a glitch but it worked for me. |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | **Connecting from a Windows machine:**
With Microsoft's ODBC drivers for SQL Server, `Trusted_connection=yes` tells the driver to use "Windows Authentication" and your script will attempt to log in to the SQL Server using *the Windows credentials of the user running the script*. `UID` and `PWD` cannot be used to suppl... | `Trusted_connection=no` did not helped me. When i removed entire line and added `UID`, `PWD` parameter it worked. My takeaway from this is remove |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | **Connecting from a Windows machine:**
With Microsoft's ODBC drivers for SQL Server, `Trusted_connection=yes` tells the driver to use "Windows Authentication" and your script will attempt to log in to the SQL Server using *the Windows credentials of the user running the script*. `UID` and `PWD` cannot be used to suppl... | I tried everything and this is what eventually worked for me:
```
import pyodbc
driver= '{SQL Server Native Client 11.0}'
cnxn = pyodbc.connect(
Trusted_Connection='Yes',
Driver='{ODBC Driver 11 for SQL Server}',
Server='MyServer,1433',
Database='MyDB'
)
``` |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | I tried everything and this is what eventually worked for me:
```
import pyodbc
driver= '{SQL Server Native Client 11.0}'
cnxn = pyodbc.connect(
Trusted_Connection='Yes',
Driver='{ODBC Driver 11 for SQL Server}',
Server='MyServer,1433',
Database='MyDB'
)
``` | I had similar issue while connecting to the default database (MSSQLSERVER). If you are connecting to the default database, please remove the
>
> *database='DATABASENAME',*
>
>
>
line from the connection parameters section and retry.
Cheers,
Deepak |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | Try this cxn string:
```
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;PORT=1433;DATABASE=testdb;UID=me;PWD=pass')
```
<http://mkleehammer.github.io/pyodbc/> | ```
import pyodbc #For python3 MSSQL
cnxn = pyodbc.connect("Driver={SQL Server};" #For Connection
"Server=192.168.0.***;"
"PORT=1433;"
"Database=***********;"
"UID=****;"
"PWD=********;")
cursor = cnxn.cursor() ... |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | I had similar issue while connecting to the default database (MSSQLSERVER). If you are connecting to the default database, please remove the
>
> *database='DATABASENAME',*
>
>
>
line from the connection parameters section and retry.
Cheers,
Deepak | The first option works if your credentials have been stored using the command prompt. The other option is giving the credentials (UId, Psw) in the connection.
The following worked for me:
```
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=yourServer;DATABASE=yourDatabase;UID=yourUsername;PWD=yourPassword')
``` |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | **Connecting from a Windows machine:**
With Microsoft's ODBC drivers for SQL Server, `Trusted_connection=yes` tells the driver to use "Windows Authentication" and your script will attempt to log in to the SQL Server using *the Windows credentials of the user running the script*. `UID` and `PWD` cannot be used to suppl... | Try this cxn string:
```
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;PORT=1433;DATABASE=testdb;UID=me;PWD=pass')
```
<http://mkleehammer.github.io/pyodbc/> |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | I had similar issue while connecting to the default database (MSSQLSERVER). If you are connecting to the default database, please remove the
>
> *database='DATABASENAME',*
>
>
>
line from the connection parameters section and retry.
Cheers,
Deepak | `Trusted_connection=no` did not helped me. When i removed entire line and added `UID`, `PWD` parameter it worked. My takeaway from this is remove |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | Try this cxn string:
```
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;PORT=1433;DATABASE=testdb;UID=me;PWD=pass')
```
<http://mkleehammer.github.io/pyodbc/> | The first option works if your credentials have been stored using the command prompt. The other option is giving the credentials (UId, Psw) in the connection.
The following worked for me:
```
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=yourServer;DATABASE=yourDatabase;UID=yourUsername;PWD=yourPassword')
``` |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | I tried everything and this is what eventually worked for me:
```
import pyodbc
driver= '{SQL Server Native Client 11.0}'
cnxn = pyodbc.connect(
Trusted_Connection='Yes',
Driver='{ODBC Driver 11 for SQL Server}',
Server='MyServer,1433',
Database='MyDB'
)
``` | Try this cxn string:
```
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;PORT=1433;DATABASE=testdb;UID=me;PWD=pass')
```
<http://mkleehammer.github.io/pyodbc/> |
37,692,780 | I am trying to use Python to connect to a SQL database by using Window authentication. I looked at some of the posts here (e.g., [here](https://stackoverflow.com/questions/10000256/failed-to-login-as-domain-computername-pyodbc-with-py2exe)), but the suggested methods didn't seem to work.
For example, I used the follow... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37692780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368195/"
] | Try this cxn string:
```
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;PORT=1433;DATABASE=testdb;UID=me;PWD=pass')
```
<http://mkleehammer.github.io/pyodbc/> | A slightly different use case than the OP, but for those interested it is possible to connect to a MS SQL Server database using Windows Authentication for a different user account than the one logged in.
This can be achieved using the python jaydebeapi module with the JDBC JTDS driver. See my answer [here](https://st... |
404,418 | What is the relation between potential energy & electric field? | 2018/05/07 | [
"https://physics.stackexchange.com/questions/404418",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/185077/"
] | Redshifts doesn't actually mean the light is red, or was ever red. That's what is confusing you.
"Red" and "blue" in this context are shorthand ways to say "towards longer wavelengths/lower energies" (red) and "towards shorter wavelengths/higher energies" (blue), because in the visible light spectrum, red is at the lo... | There are certain physical processes that always produce a light of the same wavelength. For instance, hydrogen changing from the $n=2$ to the ground state always emits a photon with an energy of $10.2~\rm eV$, corresponding to light with a wavelength of $122~\rm nm$.
There are many processes like this, which form "sp... |
404,418 | What is the relation between potential energy & electric field? | 2018/05/07 | [
"https://physics.stackexchange.com/questions/404418",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/185077/"
] | There are certain physical processes that always produce a light of the same wavelength. For instance, hydrogen changing from the $n=2$ to the ground state always emits a photon with an energy of $10.2~\rm eV$, corresponding to light with a wavelength of $122~\rm nm$.
There are many processes like this, which form "sp... | The other answers (as of this posting) stick mainly to "light"... but the same concepts exist in other forms of "waves"
**Red/Blue Shifts and associated "Doppler effects"**
I want to add associated ideas that you can, literally, hear: Sirens and Train Horns.
The basic idea of "shifts" is that the waves that you see,... |
404,418 | What is the relation between potential energy & electric field? | 2018/05/07 | [
"https://physics.stackexchange.com/questions/404418",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/185077/"
] | Redshifts doesn't actually mean the light is red, or was ever red. That's what is confusing you.
"Red" and "blue" in this context are shorthand ways to say "towards longer wavelengths/lower energies" (red) and "towards shorter wavelengths/higher energies" (blue), because in the visible light spectrum, red is at the lo... | A complementary answer to Chris's, the middle row is the spectrum at rest.
[](https://i.stack.imgur.com/krFch.png)
>
> A blue shift does not mean that the object ends up blue. It just means that the entire spectrum is shifted up in frequency. Note that this is a schemati... |
404,418 | What is the relation between potential energy & electric field? | 2018/05/07 | [
"https://physics.stackexchange.com/questions/404418",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/185077/"
] | A complementary answer to Chris's, the middle row is the spectrum at rest.
[](https://i.stack.imgur.com/krFch.png)
>
> A blue shift does not mean that the object ends up blue. It just means that the entire spectrum is shifted up in frequency. Note that this is a schemati... | The other answers (as of this posting) stick mainly to "light"... but the same concepts exist in other forms of "waves"
**Red/Blue Shifts and associated "Doppler effects"**
I want to add associated ideas that you can, literally, hear: Sirens and Train Horns.
The basic idea of "shifts" is that the waves that you see,... |
404,418 | What is the relation between potential energy & electric field? | 2018/05/07 | [
"https://physics.stackexchange.com/questions/404418",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/185077/"
] | Redshifts doesn't actually mean the light is red, or was ever red. That's what is confusing you.
"Red" and "blue" in this context are shorthand ways to say "towards longer wavelengths/lower energies" (red) and "towards shorter wavelengths/higher energies" (blue), because in the visible light spectrum, red is at the lo... | The other answers (as of this posting) stick mainly to "light"... but the same concepts exist in other forms of "waves"
**Red/Blue Shifts and associated "Doppler effects"**
I want to add associated ideas that you can, literally, hear: Sirens and Train Horns.
The basic idea of "shifts" is that the waves that you see,... |
66,355,341 | I'm trying clean prices out of series of text vectors in r. I'm using gsub to detect and replace the code is as follows:
```
vec <- c('$1.00 car', '2.00 car', 'car')
vec.clean <- gsub(vec, '/$\\D+.\\D+\\D+', 'substitute')
vec.clean
```
I end up with:
```
'substitute'
```
And the following warning:
```
Warning... | 2021/02/24 | [
"https://Stackoverflow.com/questions/66355341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6606057/"
] | We can use `gsub`
```
gsub("([A-Z*]>)\\1+", "\\1", tst)
#[1] "C>B>C>*>C"
```
In order to get the second result, remove the `>`
```
gsub(">", "", gsub("([A-Z*]\\>)\\1+", "\\1", tst) ,fixed = TRUE)
#[1] "CBC*C"
```
Based on the OP's comments below, may be
```
gsub("(.)\\1+", "\\1", gsub(">", "", tst))
#[1] "CBC*C"... | For us allergic to regex:
```
paste(rle(strsplit(tst, ">")[[1]])$values, collapse = ">") # or collapse = ""
[1] "C>B>C>*>C"
```
...which of course fails for strings with runs of *lowercase letters*, like `"A>A>a>a>A>A"` |
66,355,341 | I'm trying clean prices out of series of text vectors in r. I'm using gsub to detect and replace the code is as follows:
```
vec <- c('$1.00 car', '2.00 car', 'car')
vec.clean <- gsub(vec, '/$\\D+.\\D+\\D+', 'substitute')
vec.clean
```
I end up with:
```
'substitute'
```
And the following warning:
```
Warning... | 2021/02/24 | [
"https://Stackoverflow.com/questions/66355341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6606057/"
] | We can use `gsub`
```
gsub("([A-Z*]>)\\1+", "\\1", tst)
#[1] "C>B>C>*>C"
```
In order to get the second result, remove the `>`
```
gsub(">", "", gsub("([A-Z*]\\>)\\1+", "\\1", tst) ,fixed = TRUE)
#[1] "CBC*C"
```
Based on the OP's comments below, may be
```
gsub("(.)\\1+", "\\1", gsub(">", "", tst))
#[1] "CBC*C"... | Another way to get `CBC*C` could be using 2 groups and using group 2 in the replacement.
```
((.)>)\1+
```
[Regex demo](https://regex101.com/r/oeuVA8/1)
Example
```
tst <- "C>C>C>B>B>B>B>C>C>*>*>*>*>*>C"
gsub("((.)>)\\1+", "\\2", tst)
```
Output
```
[1] "CBC*C"
``` |
66,355,341 | I'm trying clean prices out of series of text vectors in r. I'm using gsub to detect and replace the code is as follows:
```
vec <- c('$1.00 car', '2.00 car', 'car')
vec.clean <- gsub(vec, '/$\\D+.\\D+\\D+', 'substitute')
vec.clean
```
I end up with:
```
'substitute'
```
And the following warning:
```
Warning... | 2021/02/24 | [
"https://Stackoverflow.com/questions/66355341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6606057/"
] | We can use `gsub`
```
gsub("([A-Z*]>)\\1+", "\\1", tst)
#[1] "C>B>C>*>C"
```
In order to get the second result, remove the `>`
```
gsub(">", "", gsub("([A-Z*]\\>)\\1+", "\\1", tst) ,fixed = TRUE)
#[1] "CBC*C"
```
Based on the OP's comments below, may be
```
gsub("(.)\\1+", "\\1", gsub(">", "", tst))
#[1] "CBC*C"... | A somewhat universal **base R** approach without regexps.
The idea here is to melt down the string to groups and then remove the repeating patterns successively (which makes it distinct from `unique`):
```
tst <- "C>C>C>B>B>B>B>C>C>*>*>*>*>*>C"
st <- paste(unlist(strsplit(tst,">")),collapse="")
#[1] "CCCBBBBCC*****C"... |
66,355,341 | I'm trying clean prices out of series of text vectors in r. I'm using gsub to detect and replace the code is as follows:
```
vec <- c('$1.00 car', '2.00 car', 'car')
vec.clean <- gsub(vec, '/$\\D+.\\D+\\D+', 'substitute')
vec.clean
```
I end up with:
```
'substitute'
```
And the following warning:
```
Warning... | 2021/02/24 | [
"https://Stackoverflow.com/questions/66355341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6606057/"
] | For us allergic to regex:
```
paste(rle(strsplit(tst, ">")[[1]])$values, collapse = ">") # or collapse = ""
[1] "C>B>C>*>C"
```
...which of course fails for strings with runs of *lowercase letters*, like `"A>A>a>a>A>A"` | A somewhat universal **base R** approach without regexps.
The idea here is to melt down the string to groups and then remove the repeating patterns successively (which makes it distinct from `unique`):
```
tst <- "C>C>C>B>B>B>B>C>C>*>*>*>*>*>C"
st <- paste(unlist(strsplit(tst,">")),collapse="")
#[1] "CCCBBBBCC*****C"... |
66,355,341 | I'm trying clean prices out of series of text vectors in r. I'm using gsub to detect and replace the code is as follows:
```
vec <- c('$1.00 car', '2.00 car', 'car')
vec.clean <- gsub(vec, '/$\\D+.\\D+\\D+', 'substitute')
vec.clean
```
I end up with:
```
'substitute'
```
And the following warning:
```
Warning... | 2021/02/24 | [
"https://Stackoverflow.com/questions/66355341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6606057/"
] | Another way to get `CBC*C` could be using 2 groups and using group 2 in the replacement.
```
((.)>)\1+
```
[Regex demo](https://regex101.com/r/oeuVA8/1)
Example
```
tst <- "C>C>C>B>B>B>B>C>C>*>*>*>*>*>C"
gsub("((.)>)\\1+", "\\2", tst)
```
Output
```
[1] "CBC*C"
``` | A somewhat universal **base R** approach without regexps.
The idea here is to melt down the string to groups and then remove the repeating patterns successively (which makes it distinct from `unique`):
```
tst <- "C>C>C>B>B>B>B>C>C>*>*>*>*>*>C"
st <- paste(unlist(strsplit(tst,">")),collapse="")
#[1] "CCCBBBBCC*****C"... |
10,326,874 | Git newbie here. Using Xcode 4.3.2. Had to move my project file directory. Commit still works fine but when I do a `git push`, I get `Everything up-to-date`, which is incorrect.
How do I get back on track?
Thanks | 2012/04/26 | [
"https://Stackoverflow.com/questions/10326874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/867945/"
] | Check also if you are not in a [DETACHED HEAD mode](https://stackoverflow.com/questions/3965676/why-did-git-detach-my-head).
That happens if you checkout a tag or a file (see [`git checkout` illustration in gotgit](http://www.ossxp.com/doc/gotgit-en/#chapter-8-git-checkout)):
 images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | The HiSRC gem works nicely:
<https://github.com/haihappen/hisrc-rails>
It uses the same naming convention as Apple (@2x for retina images) and automatically serves the correct one.
I used this in conjunction with [CarrierWave](https://github.com/jnicklas/carrierwave), creating two thumbnail versions upon upload:
```... | Is this not the simplest solution - or do I miss something?
```
<%= image_tag("image.png", srcset: { "image@2x.png" => "2x"}) %>
``` |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | The HiSRC gem works nicely:
<https://github.com/haihappen/hisrc-rails>
It uses the same naming convention as Apple (@2x for retina images) and automatically serves the correct one.
I used this in conjunction with [CarrierWave](https://github.com/jnicklas/carrierwave), creating two thumbnail versions upon upload:
```... | I've packaged a solutions as a gem <https://github.com/jhnvz/retina_rails>
Al you have to do is:
1. Add `gem 'retina_rails'` to your Gemfile.
2. Run `bundle install`.
3. Add `//= require retina` to your Javascript manifest file (usually found at app/assets/javascripts/application.js).
**Carrierwave**
1. Add `includ... |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | The HiSRC gem works nicely:
<https://github.com/haihappen/hisrc-rails>
It uses the same naming convention as Apple (@2x for retina images) and automatically serves the correct one.
I used this in conjunction with [CarrierWave](https://github.com/jnicklas/carrierwave), creating two thumbnail versions upon upload:
```... | What do you think about this approach:
Uploading a raw file with high resolution and then just generate the 3 different sizes. Here for an Icon model I want to implement:
```
has_attached_file :attachment,
storage: :s3,
s3_credentials: Rails.configuration.aws,
s3_protocol: :https,
s3_host_name: 's3.amazonaw... |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | Is this not the simplest solution - or do I miss something?
```
<%= image_tag("image.png", srcset: { "image@2x.png" => "2x"}) %>
``` | I've written a rails gem [this](https://github.com/ffaerber/retina_image_tag) should solve the problem |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | I suggest the following:
In your rails app, create different versions of the images when uploaded.
Then in the iOS app, you could have a look at the `scale` property of `UIScreen` and determine which image to load:
```
if ([[UIScreen mainScreen] scale] == 2.0f){
//load retina image
} else {
//load non-retina ima... | Is this not the simplest solution - or do I miss something?
```
<%= image_tag("image.png", srcset: { "image@2x.png" => "2x"}) %>
``` |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | I suggest the following:
In your rails app, create different versions of the images when uploaded.
Then in the iOS app, you could have a look at the `scale` property of `UIScreen` and determine which image to load:
```
if ([[UIScreen mainScreen] scale] == 2.0f){
//load retina image
} else {
//load non-retina ima... | I've written a rails gem [this](https://github.com/ffaerber/retina_image_tag) should solve the problem |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | The HiSRC gem works nicely:
<https://github.com/haihappen/hisrc-rails>
It uses the same naming convention as Apple (@2x for retina images) and automatically serves the correct one.
I used this in conjunction with [CarrierWave](https://github.com/jnicklas/carrierwave), creating two thumbnail versions upon upload:
```... | I've written a rails gem [this](https://github.com/ffaerber/retina_image_tag) should solve the problem |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | Is this not the simplest solution - or do I miss something?
```
<%= image_tag("image.png", srcset: { "image@2x.png" => "2x"}) %>
``` | What do you think about this approach:
Uploading a raw file with high resolution and then just generate the 3 different sizes. Here for an Icon model I want to implement:
```
has_attached_file :attachment,
storage: :s3,
s3_credentials: Rails.configuration.aws,
s3_protocol: :https,
s3_host_name: 's3.amazonaw... |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | I suggest the following:
In your rails app, create different versions of the images when uploaded.
Then in the iOS app, you could have a look at the `scale` property of `UIScreen` and determine which image to load:
```
if ([[UIScreen mainScreen] scale] == 2.0f){
//load retina image
} else {
//load non-retina ima... | I've packaged a solutions as a gem <https://github.com/jhnvz/retina_rails>
Al you have to do is:
1. Add `gem 'retina_rails'` to your Gemfile.
2. Run `bundle install`.
3. Add `//= require retina` to your Javascript manifest file (usually found at app/assets/javascripts/application.js).
**Carrierwave**
1. Add `includ... |
9,299,807 | I'm working on the rails backend of a native app.
In a native app, retina (high resolution) images are automatically loaded using the `@2x` naming convention.
For example, you can have two images called `image.png` and `image@2x.png` (the higher resolution version of the same image). If the app is running on an iPh... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9299807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212187/"
] | I suggest the following:
In your rails app, create different versions of the images when uploaded.
Then in the iOS app, you could have a look at the `scale` property of `UIScreen` and determine which image to load:
```
if ([[UIScreen mainScreen] scale] == 2.0f){
//load retina image
} else {
//load non-retina ima... | What do you think about this approach:
Uploading a raw file with high resolution and then just generate the 3 different sizes. Here for an Icon model I want to implement:
```
has_attached_file :attachment,
storage: :s3,
s3_credentials: Rails.configuration.aws,
s3_protocol: :https,
s3_host_name: 's3.amazonaw... |
217,520 | I have a VMWare VM that directly accesses some disks. In order to run (without running vmware as su which has its own problems) I need to change the ownership of the devices. I've done this manually using [Nemo](https://en.wikipedia.org/wiki/Cinnamon_%28software%29), so I know what needs to be performed.
Writing a she... | 2015/07/22 | [
"https://unix.stackexchange.com/questions/217520",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/106567/"
] | Setuid and setgid flags are ignored for shell scripts, for security reasons. | @hildred noted this in a comment above. I'll expand it into an Answer as I think it's the correct and highly recommended answer.
The [super](http://www.linuxcertif.com/man/1/super/) command
>
> … allows specified users to execute scripts (or other commands) as if they were root; or it can set the uid, gid, and/or su... |
217,520 | I have a VMWare VM that directly accesses some disks. In order to run (without running vmware as su which has its own problems) I need to change the ownership of the devices. I've done this manually using [Nemo](https://en.wikipedia.org/wiki/Cinnamon_%28software%29), so I know what needs to be performed.
Writing a she... | 2015/07/22 | [
"https://unix.stackexchange.com/questions/217520",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/106567/"
] | Following these steps:
* Try `sudo`
* Try `chmod +x script_path`
* If security does not matter, run `chmod 777 script_path` | @hildred noted this in a comment above. I'll expand it into an Answer as I think it's the correct and highly recommended answer.
The [super](http://www.linuxcertif.com/man/1/super/) command
>
> … allows specified users to execute scripts (or other commands) as if they were root; or it can set the uid, gid, and/or su... |
23,823,156 | I have written the following two java classes -
```
public class EmailUtil {
public static void sendEmail(Session session, String toEmail, String subject, String body){
try
{
MimeMessage msg = new MimeMessage(session);
//set message headers
msg.addHeader("Content-typ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23823156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2492264/"
] | Turns out, I had not enabled POP/IMAP for my gmail account. Now, everything is working!
Additional Info - When trying to connect to gmail using an external app use the below mentioned guidelines for a successful connection -
1. Verify that your settings are correct:
a) Server is smtp.gmail.com or smtp.googlemail.com... | **Follow this steps:**
1. Disable "Two factor authentication" in Your Email
2. Navigate to: "<https://myaccount.google.com/lesssecureapps?pli=1>" and turn on "Access
for less secure apps"
3. Download JavaMail API "<https://www.oracle.com/technetwork/java/javamail/index-138643.html>" and Add it to your library
**CODE... |
23,823,156 | I have written the following two java classes -
```
public class EmailUtil {
public static void sendEmail(Session session, String toEmail, String subject, String body){
try
{
MimeMessage msg = new MimeMessage(session);
//set message headers
msg.addHeader("Content-typ... | 2014/05/23 | [
"https://Stackoverflow.com/questions/23823156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2492264/"
] | To make it work I had :
1. Enabled POP/IMAP for my gmail account.
2. Allowing less secure apps to access your account via this url:
<https://www.google.com/settings/security/lesssecureapps>.
I hope this help somebody else. | **Follow this steps:**
1. Disable "Two factor authentication" in Your Email
2. Navigate to: "<https://myaccount.google.com/lesssecureapps?pli=1>" and turn on "Access
for less secure apps"
3. Download JavaMail API "<https://www.oracle.com/technetwork/java/javamail/index-138643.html>" and Add it to your library
**CODE... |
26,611 | I have a question regarding the use of a grouping variable in a non-linear model. Since the nls() function does not allow for factor variables, I have been struggling to figure out if one can test the effect of a factor on the model fit. I have included an example below where I want to fit a "seasonalized von Bertalanf... | 2012/04/17 | [
"https://stats.stackexchange.com/questions/26611",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/10675/"
] | You could stratify by the values of the categorical predictor and compare fits. For example suppose you have continuous predictors $X\_{1}, ..., X\_{p}$ and dependent variable $Y$. I believe nls() gives the maximum likelihood estimate of $f$ such that
$$ Y = f(X\_1, ..., X\_p) + \varepsilon $$
where $\varepsilon \s... | I found that it is possible to code categorical variables with nls(), simply by multiplying true/false vectors into your equation. Example:
```
# null model (no difference between groups; all have the same coefficients)
nls.null <- nls(formula = percent_on_cells ~ vmax*(Time/(Time+km)),
data = mehg,
... |
3,388,855 | In a pom.xml, when specifying a dependency version, what is the difference between LATEST and [0,) ?
In my opinion they should be equivalent, but for some dependencies, LATEST does not match any version, whereas [0,) does. | 2010/08/02 | [
"https://Stackoverflow.com/questions/3388855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408752/"
] | >
> In my opinion they should be equivalent, but for some dependencies, LATEST does not match any version, whereas [0,) does.
>
>
>
In theory, LATEST is the latest released or snapshot version (see Rich Seller's [excellent answer](https://stackoverflow.com/questions/30571/how-do-i-tell-maven-to-use-the-latest-vers... | >
> When you depend on a plugin or a
> dependency, you can use the a version
> value of LATEST or RELEASE. LATEST
> refers to the latest released or
> snapshot version of a particular
> artifact, the most recently deployed
> artifact in a particular repository.
> RELEASE refers to the last
> non-snapshot relea... |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | Since you need to split each occurrence of a date, you need to ascertain where the regex engine is during the matching process. You can use a lookahead `?=` followed by your desired token to be captured in order to achieve this.
Take for instance, this pattern `(?=[a-zA-Z]{3}\s+\d{1,2}\s+[a-zA-Z]{6,9})`
Here, the reg... | I can see that the lines except the first line of each record is indented with several spaces, so you can split with `str.split(/\n(?!\s+)/)`. |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | Ruby has a wonderful method that's part of Array (inherited from Enumerable) called [`slice_before`](http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-slice_before). I'd use it like:
```
str = <<EOT
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV... | Assuming that the OP's description:
>
> three\_letter\_word + whitespace(s) + one\_or\_two\_digit\_number would work
>
>
>
is correct,
```
text.split(/(?=\w{3} +\d{1,2})/)
``` |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | Ruby has a wonderful method that's part of Array (inherited from Enumerable) called [`slice_before`](http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-slice_before). I'd use it like:
```
str = <<EOT
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV... | I can see that the lines except the first line of each record is indented with several spaces, so you can split with `str.split(/\n(?!\s+)/)`. |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | You specified that you want to split on dates. I've therefore not split on any string having the specified date format that cannot be converted to a date, including `"Sep 31 Sat"` and `"Sep 26 Wed"` (the latter, this year, is `"Sat"`). I've assumed the date substrings can appear anywhere in the string. If you wish to d... | There are 12 months and 7 days, so you could select for them:
```
text = <<txt
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:30pm/8:3... |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | Ruby has a wonderful method that's part of Array (inherited from Enumerable) called [`slice_before`](http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-slice_before). I'd use it like:
```
str = <<EOT
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV... | There are 12 months and 7 days, so you could select for them:
```
text = <<txt
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:30pm/8:3... |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | Ruby has a wonderful method that's part of Array (inherited from Enumerable) called [`slice_before`](http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-slice_before). I'd use it like:
```
str = <<EOT
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV... | Since you need to split each occurrence of a date, you need to ascertain where the regex engine is during the matching process. You can use a lookahead `?=` followed by your desired token to be captured in order to achieve this.
Take for instance, this pattern `(?=[a-zA-Z]{3}\s+\d{1,2}\s+[a-zA-Z]{6,9})`
Here, the reg... |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | You specified that you want to split on dates. I've therefore not split on any string having the specified date format that cannot be converted to a date, including `"Sep 31 Sat"` and `"Sep 26 Wed"` (the latter, this year, is `"Sat"`). I've assumed the date substrings can appear anywhere in the string. If you wish to d... | Ruby has a wonderful method that's part of Array (inherited from Enumerable) called [`slice_before`](http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-slice_before). I'd use it like:
```
str = <<EOT
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV... |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | Assuming that the OP's description:
>
> three\_letter\_word + whitespace(s) + one\_or\_two\_digit\_number would work
>
>
>
is correct,
```
text.split(/(?=\w{3} +\d{1,2})/)
``` | I can see that the lines except the first line of each record is indented with several spaces, so you can split with `str.split(/\n(?!\s+)/)`. |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | You specified that you want to split on dates. I've therefore not split on any string having the specified date format that cannot be converted to a date, including `"Sep 31 Sat"` and `"Sep 26 Wed"` (the latter, this year, is `"Sat"`). I've assumed the date substrings can appear anywhere in the string. If you wish to d... | Since you need to split each occurrence of a date, you need to ascertain where the regex engine is during the matching process. You can use a lookahead `?=` followed by your desired token to be captured in order to achieve this.
Take for instance, this pattern `(?=[a-zA-Z]{3}\s+\d{1,2}\s+[a-zA-Z]{6,9})`
Here, the reg... |
32,801,755 | I want to split this text on the dates but without removing the dates from the string:
```
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 fri The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32801755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585520/"
] | There are 12 months and 7 days, so you could select for them:
```
text = <<txt
sep 25 fri The Phenomenauts, The Atom Age, Los Pistoleros, The Shames
at Jub Jubs, 71 S Wells Avenue, Reno, NV 21+ 8pm *** @
sep 25 The Holdup, The Wheeland Brothers
at the El Rey Theatre, Chico 18+ (a/a with adult) 7:30pm/8:3... | I can see that the lines except the first line of each record is indented with several spaces, so you can split with `str.split(/\n(?!\s+)/)`. |
42,359,597 | In viewDidLoad of my chat view controller, I wrote `self.appDelegate.client?.historyForChannel(currentChannel, start: nil, end: nil, limit: 20, withCompletion:` and it retrieves the 20 recent messages. However, I wish to retrieve earlier/old 20 messages before these recent 20 messages for my infinite scrolling feature.... | 2017/02/21 | [
"https://Stackoverflow.com/questions/42359597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4975876/"
] | Store the timestamp of the first message you received from Pubnub history, to receive next 20 messages:
`self.client?.historyForChannel(channel, start: lastStoredTimstamp, end: nil, limit: 20, reverse: false, withCompletion:`
I have tested it and it works well.
*Little Description:
Using only a start parameter alway... | It can be done via `UIScrollViewDelegate` (in your case, it's inside UITableView)
First of all, set the delegate of your `UITableView`.
Then, you have to override `scrollViewDidScroll(_ scrollView: UIScrollView)`, and that's a example code:
```
let currentOffset = scrollView.contentOffset.y
let maximumOffset = scrol... |
21,307,448 | I need to prepare a program which runs in the background without a window or anything on the taskbar. You may compare this to the idea of a program which runs in the background and sends a signal every once in a while to keep the computer from sleeping.
So here are the two ideas that I have on my mind
```
1) Creating... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21307448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232138/"
] | While there is no flavor-specific version of the `build` task, there are flavor-specific versions of the `assemble` and `install` tasks. `assemble` will create the APK; `install` will install it on devices/emulators.
For example, in [this sample project](https://github.com/commonsguy/cw-omnibus/tree/master/Gradle/Hell... | I would simplify the answer given by @CommonsWare because going through the answer i was litte confused.
Consider these are the product flavours
* Dev
* Preprod
* Prod
Run
>
> gradlew task
>
>
>
This will list out all Product flavours along with there build types
```
assemble - Assembles all variants of all ... |
21,307,448 | I need to prepare a program which runs in the background without a window or anything on the taskbar. You may compare this to the idea of a program which runs in the background and sends a signal every once in a while to keep the computer from sleeping.
So here are the two ideas that I have on my mind
```
1) Creating... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21307448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232138/"
] | While there is no flavor-specific version of the `build` task, there are flavor-specific versions of the `assemble` and `install` tasks. `assemble` will create the APK; `install` will install it on devices/emulators.
For example, in [this sample project](https://github.com/commonsguy/cw-omnibus/tree/master/Gradle/Hell... | If your productFlavor is chocolate you can do
```
./gradlew assembleChocolateRelease
```
or
```
./gradlew assembleChocolateDebug
``` |
21,307,448 | I need to prepare a program which runs in the background without a window or anything on the taskbar. You may compare this to the idea of a program which runs in the background and sends a signal every once in a while to keep the computer from sleeping.
So here are the two ideas that I have on my mind
```
1) Creating... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21307448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232138/"
] | While there is no flavor-specific version of the `build` task, there are flavor-specific versions of the `assemble` and `install` tasks. `assemble` will create the APK; `install` will install it on devices/emulators.
For example, in [this sample project](https://github.com/commonsguy/cw-omnibus/tree/master/Gradle/Hell... | To add to the above answers, if you want to build an Android Bundle (AAB) then you can use this
```
# build flavor 'flavorName' only
./gradlew bundleFlavorName
``` |
21,307,448 | I need to prepare a program which runs in the background without a window or anything on the taskbar. You may compare this to the idea of a program which runs in the background and sends a signal every once in a while to keep the computer from sleeping.
So here are the two ideas that I have on my mind
```
1) Creating... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21307448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232138/"
] | I would simplify the answer given by @CommonsWare because going through the answer i was litte confused.
Consider these are the product flavours
* Dev
* Preprod
* Prod
Run
>
> gradlew task
>
>
>
This will list out all Product flavours along with there build types
```
assemble - Assembles all variants of all ... | To add to the above answers, if you want to build an Android Bundle (AAB) then you can use this
```
# build flavor 'flavorName' only
./gradlew bundleFlavorName
``` |
21,307,448 | I need to prepare a program which runs in the background without a window or anything on the taskbar. You may compare this to the idea of a program which runs in the background and sends a signal every once in a while to keep the computer from sleeping.
So here are the two ideas that I have on my mind
```
1) Creating... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21307448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232138/"
] | If your productFlavor is chocolate you can do
```
./gradlew assembleChocolateRelease
```
or
```
./gradlew assembleChocolateDebug
``` | To add to the above answers, if you want to build an Android Bundle (AAB) then you can use this
```
# build flavor 'flavorName' only
./gradlew bundleFlavorName
``` |
18,890,640 | I have months values like below
```
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var objects = {
April:0,
August:4182,
December:0,
February:0,
January:1,
July:2,
June:0,
Ma... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18890640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147188/"
] | Try with:
```
var output = [];
for (var k in months) {
var month = months[k];
output.push({name: month, value: objects[month]});
}
```
It will returns you ordered list of objects that contain `name` and `value` keys which have proper month name and its value. | ```
var values = [];
for(var i = 0; i < months.length; i++) {
vals.push(objects[months[i]]);
}
```
This way you get the object properties' values ordered by the months array. |
18,890,640 | I have months values like below
```
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var objects = {
April:0,
August:4182,
December:0,
February:0,
January:1,
July:2,
June:0,
Ma... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18890640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147188/"
] | Try with:
```
var output = [];
for (var k in months) {
var month = months[k];
output.push({name: month, value: objects[month]});
}
```
It will returns you ordered list of objects that contain `name` and `value` keys which have proper month name and its value. | You can't sort the properties in an object, because the order of the properties is not maintained. If create an object like that, then loop out the properties, you will see that the properties may not be returned in the same order that you put them in the object, and different browsers will return the properties in dif... |
18,890,640 | I have months values like below
```
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var objects = {
April:0,
August:4182,
December:0,
February:0,
January:1,
July:2,
June:0,
Ma... | 2013/09/19 | [
"https://Stackoverflow.com/questions/18890640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147188/"
] | ```
var values = [];
for(var i = 0; i < months.length; i++) {
vals.push(objects[months[i]]);
}
```
This way you get the object properties' values ordered by the months array. | You can't sort the properties in an object, because the order of the properties is not maintained. If create an object like that, then loop out the properties, you will see that the properties may not be returned in the same order that you put them in the object, and different browsers will return the properties in dif... |
12,474,353 | I have a following problem: my page has an image with items. I put hidden divs over the items to create mouseover effects. I do the positioning of divs vith position relative.
Everything works but I get an empty space at the end of the page and a scrollbar :(
```
<div style="height: 620px;">
<?php echo image_tag... | 2012/09/18 | [
"https://Stackoverflow.com/questions/12474353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/888280/"
] | Use **margin-top** instead of **top** because **top** create a opposite gap with **position:relative**. | Set position:relative to their parent div, then use position:absolute on the children. |
5,315 | I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, [quirk](https://algassert.com/quirk). Ideally I would like to generalise this to any simulator. The unitary matrix is
$$U(t)=e^{-iHt}$$
and I've found a way to decompose the Hamiltonian into the following form:
$$U(t)=... | 2019/01/30 | [
"https://quantumcomputing.stackexchange.com/questions/5315",
"https://quantumcomputing.stackexchange.com",
"https://quantumcomputing.stackexchange.com/users/5594/"
] | What you are trying to do is called Hamiltonian Simulation.
If your exponential can be split in a sum of unitary matrices, [@smapers' answer](https://quantumcomputing.stackexchange.com/a/5316/1386) guide you to a good algorithm: the Linear Combination of Unitary (LCU) algorithm.
In addition to the paper linked by @sm... | Below is a recent paper by Gilyén et al on doing "quantum matrix arithmetics", allowing to implement linear combinations of unitary operators. They consider the general case where the linear combination in itself might not be unitary. Since the linear combination in your case is unitary, maybe there's a more efficient ... |
5,315 | I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, [quirk](https://algassert.com/quirk). Ideally I would like to generalise this to any simulator. The unitary matrix is
$$U(t)=e^{-iHt}$$
and I've found a way to decompose the Hamiltonian into the following form:
$$U(t)=... | 2019/01/30 | [
"https://quantumcomputing.stackexchange.com/questions/5315",
"https://quantumcomputing.stackexchange.com",
"https://quantumcomputing.stackexchange.com/users/5594/"
] | Below is a recent paper by Gilyén et al on doing "quantum matrix arithmetics", allowing to implement linear combinations of unitary operators. They consider the general case where the linear combination in itself might not be unitary. Since the linear combination in your case is unitary, maybe there's a more efficient ... | It seems that you need oblivious fixed point amplitude amplification. See Theorem 26-28 in the aforementioned paper: [arXiv:1806.01838 [quant-ph]](https://arxiv.org/abs/1806.01838).
As a first step, you can implement $\frac{A+B(t)}{2}$ as a block of a unitary. This is however not a unitary itself, but then you can tur... |
5,315 | I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, [quirk](https://algassert.com/quirk). Ideally I would like to generalise this to any simulator. The unitary matrix is
$$U(t)=e^{-iHt}$$
and I've found a way to decompose the Hamiltonian into the following form:
$$U(t)=... | 2019/01/30 | [
"https://quantumcomputing.stackexchange.com/questions/5315",
"https://quantumcomputing.stackexchange.com",
"https://quantumcomputing.stackexchange.com/users/5594/"
] | What you are trying to do is called Hamiltonian Simulation.
If your exponential can be split in a sum of unitary matrices, [@smapers' answer](https://quantumcomputing.stackexchange.com/a/5316/1386) guide you to a good algorithm: the Linear Combination of Unitary (LCU) algorithm.
In addition to the paper linked by @sm... | It seems that you need oblivious fixed point amplitude amplification. See Theorem 26-28 in the aforementioned paper: [arXiv:1806.01838 [quant-ph]](https://arxiv.org/abs/1806.01838).
As a first step, you can implement $\frac{A+B(t)}{2}$ as a block of a unitary. This is however not a unitary itself, but then you can tur... |
59,110,629 | I have a simple case of a A-Frame scene using the [buffer-geometry-merger component](https://www.npmjs.com/package/aframe-geometry-merger-component), which seems to work well when writing entities in static HTML, but not when the same entities are injected in the DOM by building a A-Frame component: in this case, the g... | 2019/11/29 | [
"https://Stackoverflow.com/questions/59110629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2075265/"
] | Try sth like below.
```
selectedAttributes = [this.allAttributes[0]];
```
Since
```
{"id": 1,"name": "Hapnikumask"}
```
is a complex object its equality will be checked by references. So you are defining a new object as selected it will be different from the source object. | use compareFn in your nz-select like this.
```
<nz-select
[(ngModel)]="selectedValue"
[compareWith]="compareFn"
(ngModelChange)="log($event)"
nzAllowClear
nzPlaceHolder="Choose"
>
```
in typescript file:-
```
compareFn = (o1: any, o2: any): boolean => (o1 && o2 ? o1.id === o2.id : o1 === o2);
``` |
5,495,855 | I'm a newbie in Android development, and I would just like to know a little bit about the Scroller widget (android.widget.Scroller). How does it animate the view? Can the Animation object, if it exists, be accessed? If so, how? I've read the source code, but could find no clues, or maybe I'm too new?
I just wanted to ... | 2011/03/31 | [
"https://Stackoverflow.com/questions/5495855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685152/"
] | The Scroller widget doesn't actually do much of the work at all for you. It doesn't fire any callbacks, it doesn't animate anything, it just responds to various method calls.
So what good is it? Well, it does all of the calculation for e.g. a fling for you, which is handy. So what you'd generally do is create a Runnab... | Great answer above. Scroller#startScroll(...) indeed works the same way.
For example, the source for a custom scrolling TextView at:
<http://bear-polka.blogspot.com/2009/01/scrolltextview-scrolling-textview-for.html>
Sets a Scroller on a TextView using TextView#setScroller(Scroller).
The source for the SDK's TextVie... |
5,495,855 | I'm a newbie in Android development, and I would just like to know a little bit about the Scroller widget (android.widget.Scroller). How does it animate the view? Can the Animation object, if it exists, be accessed? If so, how? I've read the source code, but could find no clues, or maybe I'm too new?
I just wanted to ... | 2011/03/31 | [
"https://Stackoverflow.com/questions/5495855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685152/"
] | The Scroller widget doesn't actually do much of the work at all for you. It doesn't fire any callbacks, it doesn't animate anything, it just responds to various method calls.
So what good is it? Well, it does all of the calculation for e.g. a fling for you, which is handy. So what you'd generally do is create a Runnab... | We can extend the `Scroller` class then intercept corresponding animation start methods to mark that was started, after **computeScrollOffset()** return false which means animation finished's value, we inform by a Listener to caller :
```
public class ScrollerImpl extends Scroller {
...Constructor...
private ... |
5,495,855 | I'm a newbie in Android development, and I would just like to know a little bit about the Scroller widget (android.widget.Scroller). How does it animate the view? Can the Animation object, if it exists, be accessed? If so, how? I've read the source code, but could find no clues, or maybe I'm too new?
I just wanted to ... | 2011/03/31 | [
"https://Stackoverflow.com/questions/5495855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685152/"
] | The Scroller widget doesn't actually do much of the work at all for you. It doesn't fire any callbacks, it doesn't animate anything, it just responds to various method calls.
So what good is it? Well, it does all of the calculation for e.g. a fling for you, which is handy. So what you'd generally do is create a Runnab... | like Bill Phillips said, Scroller is just an Android SDK class helping with calculating scrolling positions. I have a full working example here:
```
public class SimpleScrollableView extends TextView {
private Scroller mScrollEventChecker;
private int mLastFlingY;
private float mLastY;
private float m... |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | Add attribute [NotMapped] if the property not going to mapped to column. | In order to avoid Discriminator column from table you just need to add annotation [NotMapped] over your derived class. |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | Add attribute [NotMapped] if the property not going to mapped to column. | As you're using subclasses, the Discriminator column is required to distinguish between each type of your subclasses. |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | Could also use Table per Type (TPT).
<http://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-2-table-per-type-tpt>
>
> Table per Type (TPT)
>
>
> Table per Type is about representing inheritance relationships as
> relational foreign key associations. Every class/su... | As you're using subclasses, the Discriminator column is required to distinguish between each type of your subclasses. |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | TPH inheritance needs special column which is used to identify the type of entity. By default this column is called `Discriminator` and contains names of derived entities. You can use Fluent-API to define different column name and different values. You can also use your MyType column directly because it is actually a d... | As you're using subclasses, the Discriminator column is required to distinguish between each type of your subclasses. |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | Add attribute [NotMapped] if the property not going to mapped to column. | Since both "GiftCouponPayment" and "ClubCardPayment" derives from "PaymentComponent" EF will not use separate tables and will need that column. If you want a different behaviour you would have to override the default table access and map the fields to your classes (which I think you don't want to do) Not sure if there ... |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | TPH inheritance needs special column which is used to identify the type of entity. By default this column is called `Discriminator` and contains names of derived entities. You can use Fluent-API to define different column name and different values. You can also use your MyType column directly because it is actually a d... | Could also use Table per Type (TPT).
<http://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-2-table-per-type-tpt>
>
> Table per Type (TPT)
>
>
> Table per Type is about representing inheritance relationships as
> relational foreign key associations. Every class/su... |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | Could also use Table per Type (TPT).
<http://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-2-table-per-type-tpt>
>
> Table per Type (TPT)
>
>
> Table per Type is about representing inheritance relationships as
> relational foreign key associations. Every class/su... | Since both "GiftCouponPayment" and "ClubCardPayment" derives from "PaymentComponent" EF will not use separate tables and will need that column. If you want a different behaviour you would have to override the default table access and map the fields to your classes (which I think you don't want to do) Not sure if there ... |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | In order to avoid Discriminator column from table you just need to add annotation [NotMapped] over your derived class. | Since both "GiftCouponPayment" and "ClubCardPayment" derives from "PaymentComponent" EF will not use separate tables and will need that column. If you want a different behaviour you would have to override the default table access and map the fields to your classes (which I think you don't want to do) Not sure if there ... |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | Could also use Table per Type (TPT).
<http://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-2-table-per-type-tpt>
>
> Table per Type (TPT)
>
>
> Table per Type is about representing inheritance relationships as
> relational foreign key associations. Every class/su... | Sample code to remove Discriminator column and get column named PaymentId as discriminator instead, therefore solving both your questions. Based on Microsofts Fluent Api original documentation.
<https://msdn.microsoft.com/en-us/library/jj591617%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396>
```
public enum MyEnum
{ ... |
11,630,515 | I have the following table created using Entity Framework **Code First** approach.
1. How do I modify the C# code so that the unwanted Discriminator column is not created in the database? Are there any attributes to achieve this?
2. How do I make the foreign key column named `PaymentID` instead of `Payment_ PaymentID... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11630515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696627/"
] | TPH inheritance needs special column which is used to identify the type of entity. By default this column is called `Discriminator` and contains names of derived entities. You can use Fluent-API to define different column name and different values. You can also use your MyType column directly because it is actually a d... | Sample code to remove Discriminator column and get column named PaymentId as discriminator instead, therefore solving both your questions. Based on Microsofts Fluent Api original documentation.
<https://msdn.microsoft.com/en-us/library/jj591617%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396>
```
public enum MyEnum
{ ... |
44,103,962 | I noticed that some of my view controllers have become pretty big and I'd like to avoid the MVC (Massive View Controller).
I found that my view controllers often implement a lot of delegates from other view controllers which I may or may not present at runtime. Also they are often datasources for table- or collection... | 2017/05/22 | [
"https://Stackoverflow.com/questions/44103962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1708462/"
] | ### Original question
The two definitions are not the same.
The types of the variables are different — `unsigned long` versus (signed) `int`. The behaviour of these types is quite different because of the difference in signedness. They also may have quite different ranges of valid values.
Technically, the numeric co... | The long int and int are not necessarily the same, but they might be. Unsigned and signed are not the same thing. Numerical constants can represent the same value without being the same thing, as in 100000 and 100000UL (the former being a signed int, the latter being unsigned long) |
54,848,642 | My PWA has a large data payload. I want to display a 'Please wait...' load page and wait until all caching is complete before launching the full app. Therefore, I need to detect when all caching has completed. The snippet of my service worker is:
```
let appCaches = [{
name: 'pageload-core-2018-02-14.002',
url... | 2019/02/24 | [
"https://Stackoverflow.com/questions/54848642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764397/"
] | Oy! What a silly oversight. After breaking the promise chains into individual promises and stepping through the code, the problem became obvious.
```
self.addEventListener('install', function (event) {
console.log('install');
event.waitUntil(caches.keys().then(function (keys) {
return Promise.all(appCaches.map... | @claytoncarney Do you know how to pass a callback.. or any way to listen to this event from my app?
I try to send a toast message to my user telling them that the data has been cached...
In this case, I send an alert (it's do not work)... |
49,125,238 | I already did one pipe (search) filter the results but I want a second pipe or another way to filter the search values in options select and show the values only once.
What I need is a dynamic search - select options menu with unique (distinct) values.
The problem:
[]="category" placeholder="Categories" [formControl]="panelMargin" panelClass="example-panel">
<mat-option>None</mat-option>
<mat-option value="{{p.category}}" *ngFor=... | There are two ways you can choose:
### First
As the official documentation says, you can chain the pipes:
<https://angular.io/guide/pipes#chaining-pipes>
Then in your template code would look like:
```
<mat-option value="{{p.platform}}" *ngFor="let p of resultCollection | FilterPipe:category:platform | anotherPipe"... |
7,126,527 | Edit: if you're here because you're confused by the polish collation in MySQL, [read this](https://bugs.mysql.com/bug.php?id=9604).
I'm trying to perform a full-text search on a table of polish cities and many of them contain accented characters. It's meant to be used in an ajax call for auto completion so it would be... | 2011/08/19 | [
"https://Stackoverflow.com/questions/7126527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903015/"
] | Change your collation to `utf_general_ci`. It ignores accent when searching and ordering but still stores them correctly. | If you try :
```
select * from cities where cityname like 'zelow'
``` |
7,126,527 | Edit: if you're here because you're confused by the polish collation in MySQL, [read this](https://bugs.mysql.com/bug.php?id=9604).
I'm trying to perform a full-text search on a table of polish cities and many of them contain accented characters. It's meant to be used in an ajax call for auto completion so it would be... | 2011/08/19 | [
"https://Stackoverflow.com/questions/7126527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903015/"
] | MySQL is very flexible in the encoding/collation area, maybe too flexible. When changing your encoding/collation, make sure you are converting the table, not just changing the encoding/collation types.
```
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
```
You can also convert individua... | If you try :
```
select * from cities where cityname like 'zelow'
``` |
7,126,527 | Edit: if you're here because you're confused by the polish collation in MySQL, [read this](https://bugs.mysql.com/bug.php?id=9604).
I'm trying to perform a full-text search on a table of polish cities and many of them contain accented characters. It's meant to be used in an ajax call for auto completion so it would be... | 2011/08/19 | [
"https://Stackoverflow.com/questions/7126527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903015/"
] | Change your collation to `utf_general_ci`. It ignores accent when searching and ordering but still stores them correctly. | Change your collation from binary to utf8\_bin. utf8\_bin should be compatible with utf8\_general\_ci, but will still allow you to store city names with differing accents. |
7,126,527 | Edit: if you're here because you're confused by the polish collation in MySQL, [read this](https://bugs.mysql.com/bug.php?id=9604).
I'm trying to perform a full-text search on a table of polish cities and many of them contain accented characters. It's meant to be used in an ajax call for auto completion so it would be... | 2011/08/19 | [
"https://Stackoverflow.com/questions/7126527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/903015/"
] | MySQL is very flexible in the encoding/collation area, maybe too flexible. When changing your encoding/collation, make sure you are converting the table, not just changing the encoding/collation types.
```
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
```
You can also convert individua... | Change your collation from binary to utf8\_bin. utf8\_bin should be compatible with utf8\_general\_ci, but will still allow you to store city names with differing accents. |
30,969,635 | So I have an app that where you choose a button in the first screen it will bring you to another screen depending on which one you chose on the first one. Because I have these possible different layouts I can't just use a segue from one button to the next view controller because there is a middle screen involved. SO it... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30969635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3708280/"
] | >
> So instead I was thinking to have a value associated with each button
> in the first view, have it sent to the second view via a segue, and
> then sent again to the third view and tell it to use the proper segue
> to the proper third view Controller based on the value associated with
> the first view. But I ca... | Follow these steps...
1: Create a Separate file called Manager.swift and place this code in it...
```
//manager.swift
import Foundation
struct Manager {
static var messageText = String()
}
```
2: Clean your project by pressing Shift+Command+K.
3: In the first view controller set the messageText... |
1,151,787 | Here is my problem: I recently installed Ubuntu (dual boot alongside Windows).
When I tried to run a video or audio in Ubuntu, I don't hear anything. When I open settings and look into the sound tab, I see only my headphones, no speakers (even though they are not connected):
**.
>
> This however just means that I'm unable to use the SD slot
>
>
>
Yeah... fortunatley I don't pla... | I managed to 'solve' this problem by disabling the sdhci modules all together by adding them to the kernel [blacklist](https://www.networkworld.com/article/3270624/blacklisting-modules-on-linux.html) so it won't be started on boot, and then refreshing the blacklist because the old copy was still in [initramfs](https://... |
52,926,171 | Component is used in class level definition by `@Component` annotation where Bean is used in construction or method level definition by `@Bean` annotation. @Component are used to auto-detect and auto-configure beans using classpath scanning. What does that mean? | 2018/10/22 | [
"https://Stackoverflow.com/questions/52926171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6609062/"
] | There is a proposed feature that would allow you to tell the compiler that `T` is one of a number of types instead of a union of them. The [issue](https://github.com/Microsoft/TypeScript/issues/27808) is marked as in discussion, so maybe add a +1 for it.
In the meantime we can force the compiler to give us an error if... | Here is a solution and it is very straightforward. I've spiced it up by adding a return type also - get that over with.
```
type Any = "A" | "B" | "C" | "D" | "E"
type Fn<T> = (arg:T[])=>T
// This distributive conditional operator maps the
// union of elements-of-Any to a union-of-functions with exclusive Parameters... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | Develop it on EC2. If/when you want to move it in-house, set up your own [Eucalyptus](http://www.eucalyptus.com/) cluster and move it to there, which will be easy since Eucalyptus is an open source EC2 infrastructure clone. | Why would you put your web servers in a VM enviroment? It just causes overhead that you dont need, they should all serve data from the same storage and have identical configuration. |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | Develop it on EC2. If/when you want to move it in-house, set up your own [Eucalyptus](http://www.eucalyptus.com/) cluster and move it to there, which will be easy since Eucalyptus is an open source EC2 infrastructure clone. | I can reply for the sizing of the haproxy servers. Use a recent Linux kernel (>= 2.6.27) to benefit from the TCP splicing feature that will save you a lot of CPU on high bandwidth. Use the highest frequency you can find for the CPU. No need for many cores, better find a 3.6 GHz dual-core than a 2 GHz 8-core. For the RA... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | I think you've seriously overestimated your requirements. As a point of reference, a 2 ipvs primary/primary in front of a pair of dual quadcore xeons running nginx+tornado processes 286 million ~2400 byte iframe adblocks + full adstream logging for the 7 elements within the iframe. Utilization of each is <40% (allowing... | Take a look at systemimager
<http://wiki.systemimager.org/index.php/Main_Page> |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | From what I've read on High Scalability, your best strategy is simply to work on the current bottlenecks and start to plan for the next bottlenecks. Unless you're using exactly the same software and hardware as someone has already used, and unless the usage patterns are identical as you scale, you can't plan your entir... | Take a look at systemimager
<http://wiki.systemimager.org/index.php/Main_Page> |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | I think you've seriously overestimated your requirements. As a point of reference, a 2 ipvs primary/primary in front of a pair of dual quadcore xeons running nginx+tornado processes 286 million ~2400 byte iframe adblocks + full adstream logging for the 7 elements within the iframe. Utilization of each is <40% (allowing... | I can reply for the sizing of the haproxy servers. Use a recent Linux kernel (>= 2.6.27) to benefit from the TCP splicing feature that will save you a lot of CPU on high bandwidth. Use the highest frequency you can find for the CPU. No need for many cores, better find a 3.6 GHz dual-core than a 2 GHz 8-core. For the RA... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | From what I've read on High Scalability, your best strategy is simply to work on the current bottlenecks and start to plan for the next bottlenecks. Unless you're using exactly the same software and hardware as someone has already used, and unless the usage patterns are identical as you scale, you can't plan your entir... | I can reply for the sizing of the haproxy servers. Use a recent Linux kernel (>= 2.6.27) to benefit from the TCP splicing feature that will save you a lot of CPU on high bandwidth. Use the highest frequency you can find for the CPU. No need for many cores, better find a 3.6 GHz dual-core than a 2 GHz 8-core. For the RA... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | Develop it on EC2. If/when you want to move it in-house, set up your own [Eucalyptus](http://www.eucalyptus.com/) cluster and move it to there, which will be easy since Eucalyptus is an open source EC2 infrastructure clone. | As far as reading on this topic goes, I highly recommend *Scalable Internet Architectures* by Theo Schlossnagle. It covers HA deployments and horizontal scalability in rather exhaustive detail.
[http://www.amazon.com/Scalable-Internet-Architectures-Theo-Schlossnagle/dp/067232699X](http://rads.stackoverflow.com/amzn/cl... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | Why would you put your web servers in a VM enviroment? It just causes overhead that you dont need, they should all serve data from the same storage and have identical configuration. | I can reply for the sizing of the haproxy servers. Use a recent Linux kernel (>= 2.6.27) to benefit from the TCP splicing feature that will save you a lot of CPU on high bandwidth. Use the highest frequency you can find for the CPU. No need for many cores, better find a 3.6 GHz dual-core than a 2 GHz 8-core. For the RA... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | Develop it on EC2. If/when you want to move it in-house, set up your own [Eucalyptus](http://www.eucalyptus.com/) cluster and move it to there, which will be easy since Eucalyptus is an open source EC2 infrastructure clone. | I think you've seriously overestimated your requirements. As a point of reference, a 2 ipvs primary/primary in front of a pair of dual quadcore xeons running nginx+tornado processes 286 million ~2400 byte iframe adblocks + full adstream logging for the 7 elements within the iframe. Utilization of each is <40% (allowing... |
186,659 | I've been tasked with figuring out how to do a large scale deployment for a high availability, high traffic, dynamic, flash based web application. There is a good possibility that this application can grow to 2 million users or possibly a lot more.
Of course when the time comes to actually do it, I will likely bring ... | 2010/10/01 | [
"https://serverfault.com/questions/186659",
"https://serverfault.com",
"https://serverfault.com/users/55809/"
] | Develop it on EC2. If/when you want to move it in-house, set up your own [Eucalyptus](http://www.eucalyptus.com/) cluster and move it to there, which will be easy since Eucalyptus is an open source EC2 infrastructure clone. | From what I've read on High Scalability, your best strategy is simply to work on the current bottlenecks and start to plan for the next bottlenecks. Unless you're using exactly the same software and hardware as someone has already used, and unless the usage patterns are identical as you scale, you can't plan your entir... |
44,671,295 | ```
WebView webView = (WebView)findViewById(R.id.display);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String path="file:///android_asset/";
String js = "<html><head>"
+ "<link rel='stylesheet' href='"+path+"jqmath-0.4.3.css'>"
+ "<scr... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44671295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660523/"
] | Check this, hope it would help
```css
.main{
height:400px;
background-color:#000;
width:100%;
position:relative;
}
.child{
height:100px;
position:absolute;
background-color:#fff;
width:100px;
}
.button{
height:25px;
position:absolute;
background-color:red;
width:25px;
}
.cente... | Try using following code
**HTML**
```
<div class="parent">
<button class="button">Button</button>
</div>
```
**CSS**
```
body {
position:relative;
}
.parent {
position:absolute;
width:200px;
height:200px;
background:red;
top:50%;
left:50%;
transform:translate(-50%,-50%);
}
.button {
padding... |
44,671,295 | ```
WebView webView = (WebView)findViewById(R.id.display);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String path="file:///android_asset/";
String js = "<html><head>"
+ "<link rel='stylesheet' href='"+path+"jqmath-0.4.3.css'>"
+ "<scr... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44671295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660523/"
] | Check this, hope it would help
```css
.main{
height:400px;
background-color:#000;
width:100%;
position:relative;
}
.child{
height:100px;
position:absolute;
background-color:#fff;
width:100px;
}
.button{
height:25px;
position:absolute;
background-color:red;
width:25px;
}
.cente... | **Here is the simple and less code**
```
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Page</title>
<style>
#buttonWithDiv {
position: fixed;
width: 200px;
height: 200px;
top: 50%;
left: 50%;
margin... |
44,671,295 | ```
WebView webView = (WebView)findViewById(R.id.display);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String path="file:///android_asset/";
String js = "<html><head>"
+ "<link rel='stylesheet' href='"+path+"jqmath-0.4.3.css'>"
+ "<scr... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44671295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660523/"
] | Check this, hope it would help
```css
.main{
height:400px;
background-color:#000;
width:100%;
position:relative;
}
.child{
height:100px;
position:absolute;
background-color:#fff;
width:100px;
}
.button{
height:25px;
position:absolute;
background-color:red;
width:25px;
}
.cente... | Using flexboxes
```css
.main {
height: 400px;
background-color: black;
width: 100%;
}
.child {
height: 100px;
width: 100px;
background-color: red;
}
.main,
.child {
display: flex;
justify-content: center;
align-items: center;
}
```
```html
<div class="main">
<div class="child">
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.