qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
14,336,734 | Because of some reasons I have a spring application which has two client applications written in extjs. One only contains the login page and the other the application logic. In Spring I include them into two jsp pages which I'm using in the controller.
The login and the redirect to the application page works fine. But... | 2013/01/15 | [
"https://Stackoverflow.com/questions/14336734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1979942/"
] | It certainly is. The type is a [NameValueCollection](http://msdn.microsoft.com/en-us/library/system.collections.specialized.namevaluecollection.aspx):
```
public string extract(NameValueCollection form) {
...
}
``` | Yes you can, It's of type `FormCollection`, which inherits from `NameValueCollection` |
14,336,734 | Because of some reasons I have a spring application which has two client applications written in extjs. One only contains the login page and the other the application logic. In Spring I include them into two jsp pages which I'm using in the controller.
The login and the redirect to the application page works fine. But... | 2013/01/15 | [
"https://Stackoverflow.com/questions/14336734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1979942/"
] | It certainly is. The type is a [NameValueCollection](http://msdn.microsoft.com/en-us/library/system.collections.specialized.namevaluecollection.aspx):
```
public string extract(NameValueCollection form) {
...
}
``` | Using the [example in the documentaion](http://msdn.microsoft.com/en-us/library/system.web.httprequest.form.aspx)
```
public string extract(NameValueCollection myRequest) {
int loop1;
StringBuilder processed_data= new StringBuilder();
// Get names of all forms into a string array.
String[] arr1 = myReq... |
66,029,135 | Consider the table below: ([here's a db-fiddle with this example](https://www.db-fiddle.com/f/nVZp5EagiiEgqPYNLvQnKd/0))
```
id primary_sort record_id record_sort alt_sort
1 2 1 11 100
2 2 2 10 101
3 3 1 12 ... | 2021/02/03 | [
"https://Stackoverflow.com/questions/66029135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4171429/"
] | I normally use a structure like below, `/src/scss/core` is my custom sass directory:
```
// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)
@import "../../node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/variables";
// 2. Include any default variable overri... | I think you'd have to set any other vars that use `$link-color` (ie: `$btn-link-color`) and merge the new colors into the `$theme-colors` map...
```
@import "functions";
@import "variables";
@import "mixins";
$primary: $red;
$link-color: $primary;
$btn-link-color: $primary;
$theme-colors: map-merge(
$theme-colors,... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | If you have Microsoft Office:
1. **RIGHT**-drag the drive, folder or file from Windows Explorer into the body of a Word document or Outlook email
2. Select '**Create Hyperlink Here**'
The inserted text will be the full UNC of the dragged item. | my 5 cents: a powershell script when run via PowerShell will create a short cut pointing to PowerShell and itself such that you can drop files onto it to get the UNC path (or local normal file path) into the clipboard
<https://inmood.ch/get-unc-path-of-fileserver-file/>
```
# run without arguments will create a file ... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (*Start → Run → cmd.exe*) and use the `net use` command to list your mapped drives and their UNC paths:
```
C:\>net use
New connections will be remembered.
Status Local Remote ... | ```
$CurrentFolder = "H:\Documents"
$Query = "Select * from Win32_NetworkConnection where LocalName = '" + $CurrentFolder.Substring( 0, 2 ) + "'"
( Get-WmiObject -Query $Query ).RemoteName
```
OR
```
$CurrentFolder = "H:\Documents"
$Tst = $CurrentFolder.Substring( 0, 2 )
( Get-WmiObject -Query "Select * from Win32_N... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (*Start → Run → cmd.exe*) and use the `net use` command to list your mapped drives and their UNC paths:
```
C:\>net use
New connections will be remembered.
Status Local Remote ... | ```
wmic path win32_mappedlogicaldisk get deviceid, providername
```
Result:
```
DeviceID ProviderName
I: \\server1\Temp
J: \\server2\Corporate
Y: \\Server3\Dev_Repo
Z: \\Server3\Repository
```
As a batch file ([src](https://github.com/maphew/code/blob/master/other/get-unc-path.bat)):
... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | If you have Microsoft Office:
1. **RIGHT**-drag the drive, folder or file from Windows Explorer into the body of a Word document or Outlook email
2. Select '**Create Hyperlink Here**'
The inserted text will be the full UNC of the dragged item. | The answer is a simple `PowerShell` one-liner:
```
Get-WmiObject Win32_NetworkConnection | ft "RemoteName","LocalName" -A
```
If you only want to pull the `UNC` for one particular drive, add a where statement:
```
Get-WmiObject Win32_NetworkConnection | where -Property 'LocalName' -eq 'Z:' | ft "RemoteName","Local... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (*Start → Run → cmd.exe*) and use the `net use` command to list your mapped drives and their UNC paths:
```
C:\>net use
New connections will be remembered.
Status Local Remote ... | This question has been answered already, but since there is a **more convenient way** to get the UNC path and some more I recommend using Path Copy, which is free and you can practically get any path you want with one click:
<https://pathcopycopy.github.io/>
Here is a screenshot demonstrating how it works. The latest... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (*Start → Run → cmd.exe*) and use the `net use` command to list your mapped drives and their UNC paths:
```
C:\>net use
New connections will be remembered.
Status Local Remote ... | If you have Microsoft Office:
1. **RIGHT**-drag the drive, folder or file from Windows Explorer into the body of a Word document or Outlook email
2. Select '**Create Hyperlink Here**'
The inserted text will be the full UNC of the dragged item. |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | This question has been answered already, but since there is a **more convenient way** to get the UNC path and some more I recommend using Path Copy, which is free and you can practically get any path you want with one click:
<https://pathcopycopy.github.io/>
Here is a screenshot demonstrating how it works. The latest... | ```
$CurrentFolder = "H:\Documents"
$Query = "Select * from Win32_NetworkConnection where LocalName = '" + $CurrentFolder.Substring( 0, 2 ) + "'"
( Get-WmiObject -Query $Query ).RemoteName
```
OR
```
$CurrentFolder = "H:\Documents"
$Tst = $CurrentFolder.Substring( 0, 2 )
( Get-WmiObject -Query "Select * from Win32_N... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | If you have Microsoft Office:
1. **RIGHT**-drag the drive, folder or file from Windows Explorer into the body of a Word document or Outlook email
2. Select '**Create Hyperlink Here**'
The inserted text will be the full UNC of the dragged item. | ```
$CurrentFolder = "H:\Documents"
$Query = "Select * from Win32_NetworkConnection where LocalName = '" + $CurrentFolder.Substring( 0, 2 ) + "'"
( Get-WmiObject -Query $Query ).RemoteName
```
OR
```
$CurrentFolder = "H:\Documents"
$Tst = $CurrentFolder.Substring( 0, 2 )
( Get-WmiObject -Query "Select * from Win32_N... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | If you have Microsoft Office:
1. **RIGHT**-drag the drive, folder or file from Windows Explorer into the body of a Word document or Outlook email
2. Select '**Create Hyperlink Here**'
The inserted text will be the full UNC of the dragged item. | ```
wmic path win32_mappedlogicaldisk get deviceid, providername
```
Result:
```
DeviceID ProviderName
I: \\server1\Temp
J: \\server2\Corporate
Y: \\Server3\Dev_Repo
Z: \\Server3\Repository
```
As a batch file ([src](https://github.com/maphew/code/blob/master/other/get-unc-path.bat)):
... |
21,482,825 | I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are w... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21482825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2487995/"
] | In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (*Start → Run → cmd.exe*) and use the `net use` command to list your mapped drives and their UNC paths:
```
C:\>net use
New connections will be remembered.
Status Local Remote ... | The answer is a simple `PowerShell` one-liner:
```
Get-WmiObject Win32_NetworkConnection | ft "RemoteName","LocalName" -A
```
If you only want to pull the `UNC` for one particular drive, add a where statement:
```
Get-WmiObject Win32_NetworkConnection | where -Property 'LocalName' -eq 'Z:' | ft "RemoteName","Local... |
57,946,590 | I am trying to add google sign-in feature to my app. This is working fine with an android emulator but I am running the app in the real device it is not working. The problem is after the sign-in process google redirect to its own home page instead to app.
The step I follow.
Function I use to open google sign in page
... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57946590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917268/"
] | I manage to fix it. below is what I did. I pass the redirectUrl in config
```
import * as AppAuth from 'expo-app-auth';
const result = await Google.logInAsync({
androidStandaloneAppClientId: 'myKey,
iosStandaloneAppClientId: 'myKey,
scopes: ['profile', 'email'],
behavior: 'web',
redirectUrl: `${AppAuth.OAut... | Open the gradle and change the redirect scheme
```
android {
defaultConfig {
manifestPlaceholders = [
appAuthRedirectScheme: 'com.example.yourpackagename'
]
}
}
``` |
57,946,590 | I am trying to add google sign-in feature to my app. This is working fine with an android emulator but I am running the app in the real device it is not working. The problem is after the sign-in process google redirect to its own home page instead to app.
The step I follow.
Function I use to open google sign in page
... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57946590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917268/"
] | I manage to fix it. below is what I did. I pass the redirectUrl in config
```
import * as AppAuth from 'expo-app-auth';
const result = await Google.logInAsync({
androidStandaloneAppClientId: 'myKey,
iosStandaloneAppClientId: 'myKey,
scopes: ['profile', 'email'],
behavior: 'web',
redirectUrl: `${AppAuth.OAut... | Okay, I'll put this here since this cost me a ton of lifetime. If you happen to test it with an Android device: Make sure you have selected Chrome as default browser. Others might not redirect you correctly! |
57,946,590 | I am trying to add google sign-in feature to my app. This is working fine with an android emulator but I am running the app in the real device it is not working. The problem is after the sign-in process google redirect to its own home page instead to app.
The step I follow.
Function I use to open google sign in page
... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57946590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2917268/"
] | I manage to fix it. below is what I did. I pass the redirectUrl in config
```
import * as AppAuth from 'expo-app-auth';
const result = await Google.logInAsync({
androidStandaloneAppClientId: 'myKey,
iosStandaloneAppClientId: 'myKey,
scopes: ['profile', 'email'],
behavior: 'web',
redirectUrl: `${AppAuth.OAut... | In app.json,
package name has to be as all small letters like com.app.cloneapp |
72,194,499 | I've got a generic task in my Gradle build that copies some configuration files to be included in the build, but aren't required for compiling or anything else (they're used at runtime). Basically:
```
val copyConfiguration by tasks.registering(Copy::class) {
from("${projectDir}/configuration")
into("${buildDi... | 2022/05/11 | [
"https://Stackoverflow.com/questions/72194499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7041558/"
] | Given (emphasis mine to show what to look for)
>
> Execution optimizations have been disabled for task 'spotlessJava' to ensure correctness due to the following reasons:
>
>
> * Gradle detected a problem with the following location: '...\build\generated\source\proto\main\grpc'. Reason: Task **'spotlessJava'** uses ... | I had a similar issue and funny that it started with a task related to Jacoco.
I documented a solution here <https://discuss.gradle.org/t/task-a-uses-this-output-of-task-b-without-declaring-an-explicit-or-implicit-dependency/42896>
In short, what worked for me was to get the location with the problem using the task pr... |
45,174,184 | I'm a little new to python 2.7 and I was wondering if there was a way I could search within a folder (and all its subfolders, PDFs, and Word docs) for a certain word. I need to compile all PDF and Word files that contain a certain keyword into a new folder so I thought python might be the best way to do this instead of... | 2017/07/18 | [
"https://Stackoverflow.com/questions/45174184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8327139/"
] | It should be obvious that without any information on the function at hand, the poor man's approach is optimal (in some probabilistic sense).
Because the roots of general functions a spread uniformly and independently of each other, so that unequal steps, possibly based on the function values, would be a waste of time.... | I do not think there is a magical method that would find **all roots** of a general equation. Your "poor man's approach" is not too bad to start with. I would use product instead of `|data|<eps`. For example,
```
dp = data[1:] * data[:-1]
indices = np.where(dp <= 0)
```
would provide the location of the "suspicious"... |
3,041,922 | I have a small question regarding rails. I have a search controller which searches for a name in database, if found shows the details about it or else I am redirecting to the new name page. Is there anyway after redirection that the name searched for to automatically appear in the new form page?
Thanks in advance. | 2010/06/15 | [
"https://Stackoverflow.com/questions/3041922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357010/"
] | You can add the imports to `$HOME/.groovy/groovysh.rc` | From <http://groovy.codehaus.org/Groovy+Shell>:
This script, if it exists, is loaded when the shell starts up:
```
$HOME/.groovy/groovysh.profile
```
This script, if it exists, is loaded when the shell enters interactive mode:
```
$HOME/.groovy/groovysh.rc
```
Edit-line history is stored in this file:
```
$HOME... |
17,809,819 | I have a python class in PyCharm containing an overriding method and want to see its documentation as quickly as possible. How can I do it? | 2013/07/23 | [
"https://Stackoverflow.com/questions/17809819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2510374/"
] | I didn't check your code but I always use the following snippet and it works till now.
**JSONParser.java**
```
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpEntity;
impor... | From my point of view, you must call `close()` to `InputStream` and `reader` before returning the response as:
```
stream.close();
reader.close();
return sb.toString();
```
It would be better if you specify what kind of error you are getting while running the above piece of code to analyse the issue.
Thanks! |
17,809,819 | I have a python class in PyCharm containing an overriding method and want to see its documentation as quickly as possible. How can I do it? | 2013/07/23 | [
"https://Stackoverflow.com/questions/17809819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2510374/"
] | I didn't check your code but I always use the following snippet and it works till now.
**JSONParser.java**
```
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpEntity;
impor... | Try the following:-
```
static InputStream is = null;
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEnt... |
17,809,819 | I have a python class in PyCharm containing an overriding method and want to see its documentation as quickly as possible. How can I do it? | 2013/07/23 | [
"https://Stackoverflow.com/questions/17809819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2510374/"
] | I didn't check your code but I always use the following snippet and it works till now.
**JSONParser.java**
```
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpEntity;
impor... | Found the problem!
I was getting back an array and had to use JSONArray rather than JSONObject |
50,249,002 | After several problems, I decided to purge Docker to reinstall it in a second time. Here's the steps that I did to purge all the packages related to Docker:
```
- dpkg -l | grep -i docker
- sudo apt-get purge docker-engine docker docker-compose
- sudo apt-get autoremove --purge docker docker-compose docker-engin
```... | 2018/05/09 | [
"https://Stackoverflow.com/questions/50249002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3652210/"
] | **EDIT :** This solution is for systems using Debian packages (Debian, Ubuntu, Mint, ...).
You saw that the docker binary is still present in your system.
You can locate it using the `whereis` command :
```
# whereis docker
docker: /usr/bin/docker /usr/lib/docker /etc/docker /usr/share/man/man1/docker.1.gz
```
Now ... | That version number looks like the last release of the snap package. If you installed by snap, then the uninstall uses the same tool:
```
sudo snap remove docker
``` |
34,398,588 | hello i try to create an object named 'gerant'
```
class gerant
{
public double CIN_GERANT, NUM_TEL_GERANT, MOBILE_GERANT;
public string NOM_GERANT, PRENOM_GERANT, ADRESSE__GERANT, MAIL_GERANT, VILLE_GERANT;
public int CP_GERANT;
public DateTime DATE_GERANT;
public gerant(double _Cin_gerant, str... | 2015/12/21 | [
"https://Stackoverflow.com/questions/34398588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441811/"
] | No way to do it using standard DbMigration methods.
The best way is to include a "select fieldToCheck from myTable where 1=2" into a try catch then add the field if required (in catch).
The other way is to write a custom migration generator that extends the Migration generator (i.e. adding an AddColumnIfNotExists ... | Basic example with sql:
```
// add colun if not exists
migrationBuilder.Sql(
@"IF COL_LENGTH('schemaName.TableName', 'ColumnName') IS NULL
ALTER TABLE[TableName] ADD[ColumnName] int NULL
GO
");
``` |
34,398,588 | hello i try to create an object named 'gerant'
```
class gerant
{
public double CIN_GERANT, NUM_TEL_GERANT, MOBILE_GERANT;
public string NOM_GERANT, PRENOM_GERANT, ADRESSE__GERANT, MAIL_GERANT, VILLE_GERANT;
public int CP_GERANT;
public DateTime DATE_GERANT;
public gerant(double _Cin_gerant, str... | 2015/12/21 | [
"https://Stackoverflow.com/questions/34398588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441811/"
] | I have worked on creating a custom migration method, AddColumnIfNotExists
You need a custom MigrationOperation class:
```
public class AddColumnIfNotExistsOperation : MigrationOperation
{
public readonly string Table;
public readonly string Name;
public readonly ColumnModel ColumnModel;
public AddCol... | Basic example with sql:
```
// add colun if not exists
migrationBuilder.Sql(
@"IF COL_LENGTH('schemaName.TableName', 'ColumnName') IS NULL
ALTER TABLE[TableName] ADD[ColumnName] int NULL
GO
");
``` |
437,800 | I've designed a Likert-scale survey with 4 measurements:
* x (it has 6 items/questions)
* y (it has 9 items/questions)
* z (it has 7 items/questions)
* w (it has 3 items/questions)
How can I rank these measurements?
In other words: how can I understand which measurement is more important to the respondents? In what ... | 2019/11/25 | [
"https://stats.stackexchange.com/questions/437800",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/266770/"
] | A couple things:
>
> ...following two methods can be used for feature selection prior to model development
>
>
>
Those are actually *part of the model development and should be cross validated*. What most people do is look at the correlations, select only the most correlated with the output, and then move on to d... | I think by saying correlation you are referring to SIS, developed by Jianqing Fan and Jinchi Lv. Actually, the logic behind the two methods is different. LASSO does the selection by using a penalized loss function and sparsity of the variables is required. Normally, for ultra-high dimensional data, we perform SIS first... |
22,039,373 | I'm usign the xsd 3.3.0 Compiler in order to parse a xsd (xml best friend) file to C++ class. (see last weblink)
The comand name is
>
> xsd cxx-tree (options) file.xsd
>
>
>
(+ info <http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/>)
I've seen some examples provided by codesynthesis wher... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22039373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3355390/"
] | I found the solution by myself!
I used different options for compiling. I used the option "--root-element library" and it caused that the methods to "Parse a URI or a local file." wasn't created.
I delete this option and I added "--root-element-all" that create parse methods for all principals objects!
Now my progra... | I use this product all the time.
Here is an example of what you're trying to do (I think):
`xsd cxx-tree hello.xsd`
Which generates the `hello.hxx` and the `hello.cxx`, as you've said. I think where you're falling short is understanding how to use these files to load an XML file (e.g., loading a "local file").
I l... |
33,156,051 | It seems like despite the fact we're not using transactions at all we get random deadlock error from SQL Azure.
Are there no transnational situation when SQL Azure can get into a deadlock?
It seems like when we are running a batch of UPDATE queries it acts like the batch is a one big transaction.
All the updates ar... | 2015/10/15 | [
"https://Stackoverflow.com/questions/33156051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/593425/"
] | There is no such things as "not using transactions". There's always a transaction, wether you start one explicitly or not. Read [Tracking down Deadlocks in SQL Database](http://blogs.msdn.com/b/sqldatabasetalk/archive/2013/05/01/tracking-down-deadlocks-in-sql-database.aspx) for how to obtain the deadlock graph in SQL A... | When you have concurrent transactions running (either implicit or explicit) you encounter deadlocks. Probably when you you said no transactions that means your transactions are implicit. |
25,703,878 | I have a price database that stores numbers as floating point. These are presented on a website. Prices can be in the format.
```
x.x (e.g. 1.4)
x.xx (e.g. 1.99)
x.xxx (e.g. 1.299) <-- new price format
```
I used to use the string format or `%.2f` to standardize the prices to two decimal places but now I n... | 2014/09/06 | [
"https://Stackoverflow.com/questions/25703878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/333661/"
] | I would just format it to three places, then trim a final 0.
```
$formatted = number_format($value, 3, ".", "");
if (substr($formatted, -1) === "0") $formatted = substr($formatted, 0, -1);
``` | Use this dude
```
number_format($data->price, 0, ',', '.');
```
<http://php.net/manual/en/function.number-format.php> |
25,703,878 | I have a price database that stores numbers as floating point. These are presented on a website. Prices can be in the format.
```
x.x (e.g. 1.4)
x.xx (e.g. 1.99)
x.xxx (e.g. 1.299) <-- new price format
```
I used to use the string format or `%.2f` to standardize the prices to two decimal places but now I n... | 2014/09/06 | [
"https://Stackoverflow.com/questions/25703878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/333661/"
] | I would just format it to three places, then trim a final 0.
```
$formatted = number_format($value, 3, ".", "");
if (substr($formatted, -1) === "0") $formatted = substr($formatted, 0, -1);
``` | Here is what I did due to the need to cope with some special cases I had in the app.
1. count the number of dec places ($prices is a float from the database).
2. format based on the count in the places using a switch statement.
3. For all cases with less than 3 decimal places format with 2 (except zero)
4. For all oth... |
37,138 | I'm using the standalone GeoWebCache to serve tiles from a remote GeoServer. My problem is that the polygon label is added to each one of the tiles served, instead of only once in the polygon centroid.
I found a post which discusses the issue:
<http://osgeo-org.1560.n6.nabble.com/polygon-label-repeated-for-each-til... | 2012/10/19 | [
"https://gis.stackexchange.com/questions/37138",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/12096/"
] | Below is an example of an SLD rule that places a label at the center of a feature's geometry. This uses the ogc:Function called "centroid" to place the label. You can read more about SLD functions in the GeoServer [docs](http://docs.geoserver.org/latest/en/user/filter/function_reference.html), and some examples are giv... | Computing labels with collision resolution (moving labels out of the way or removing lower priority ones so they don't overlap) requires knowing about every label that might collide with the label you are drawing, every label that might collide with them, and so on. So, in general, you either need to compute all the la... |
41,588,101 | Can anyone help me with adding an additional models.CharField to my Django cities\_light\_region table.
This is what i want to implement:
```
class MyRegion(Region):
state_code = models.CharField(max_length=100, default='XXX', blank=True)
class Meta:
proxy = True
```
Error:
?: (models.E017) Proxy ... | 2017/01/11 | [
"https://Stackoverflow.com/questions/41588101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774814/"
] | We can do this with below trick
```
class Model(object):
'''
Skip extra field validation "models.E017"
'''
@classmethod
def _check_model(cls):
errors = []
return errors
class MyRegion(Model, Region):
state_code = models.CharField(max_length=100, default='XXX', blank=True)
... | Well, the error message say it all : a proxy model cannot contain model fields, for the very obvious reason that [a proxy model is a class that uses the table of another model and only add or override behaviour](https://docs.djangoproject.com/en/1.10/topics/db/models/#proxy-models). |
127,142 | I know is not the best, but I'd like to display an image before another already referred. I mean I'd like to cite image 2 before image 1 but display them in the correct order. This is becasue image 1 is very small and I want to display it at the top (or bottom of the page) while image 2 is very big and is iserted in it... | 2013/08/07 | [
"https://tex.stackexchange.com/questions/127142",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/32689/"
] | This works. But don't do this.
```
\documentclass{article}
\usepackage{graphicx}
\begin{document}
Text text text see Image~\ref{fig:B}. Text text text see Image~\ref{fig:A}.
\begin{figure}[htb]
\centering
\includegraphics[width=4in]{example-image-a}
\caption{Caption here}
\label{fig:A}
\end{f... | This can easily be resolved by using the `float` package in conjunction with the parameter `[H]`:
```
\documentclass{article}
\usepackage{float}
\begin{document}
\begin{figure}[H]
...picture code...
\label{fig:figA}
\end{figure}
\begin{figure}[H]
...picture code...
\label{fig:figB}
\end{figure}
\end{document}
```... |
4,583,607 | here's a very simple js but i don't know where to begin.
in a html page, if some text is enclosed by angle brackets, like this:
```
〈some text〉
```
i want the text to be colored (but not the brackets).
in normal html, i'd code it like this
```
〈<span class="booktitle">some text</span>〉
```
So, my question is, h... | 2011/01/03 | [
"https://Stackoverflow.com/questions/4583607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369203/"
] | It depends partially on how cautious you need to be not to disturb event handlers on the elements you're traversing. If it's your page and you're in control of the handlers, you may not need to worry; if you're doing a library or bookmarklet or similar, you need to be *very* careful.
For example, consider this markup:... | If the text could be anywhere in the page, you have to traverse through each DOM element, split the text when you found a match using a regex.
I have put my code up there on jsfiddle: <http://jsfiddle.net/thai/RjHqe/>
**What it does:** It looks at the node you put it in,
* If it's an **element**, then it looks into ... |
140,903 | I am having a bit of trouble with my survival data.
Basically I am trying to assess whether or not the cox proportional hazard assumption is met, by ploting the schoenfeld residuals in R.
I have several variables and some of them have 3 or more categories.
As far as I know, Schoenfeld residuals are adjusted for each ... | 2015/03/08 | [
"https://stats.stackexchange.com/questions/140903",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/70688/"
] | Occasionally it is a good idea to concentrate the effects of a categorical predictor just for the purpose of checking proportional hazards or interaction. If you don't want 3 d.f. for the PH test you can use `predict(fit, type='terms')` to get one column for each predictor, then run `cox.cph`. This doesn't exactly pres... | There is a separate Schoenfeld residual *for each covariate* for every uncensored individual.
In the case of a categorical covariate with $k$ levels, $k-1$ dummy variates appear in the model. |
416,108 | For an ideal OpAmp the voltages at the inputs are said to be of equal value and the currents 0, however, for we also know that $$V\_\text{out}=A(V\_p-V\_n)$$ but if the voltages are the same the output should always be 0!
I know that what I'm saying is wrong, but I don't know where the loophole is, and I can't find it... | 2019/01/09 | [
"https://electronics.stackexchange.com/questions/416108",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/201757/"
] | >
> For an ideal op-amp the voltages at the inputs are said to be of equal value ...
>
>
>
No. If negative feedback is applied and the output is not driven into saturation then the inputs will be very, very close to equal.
>
> ... and the currents 0, ...
>
>
>
Yes, due to the high and sometimes very, very hi... | The loophole is that, for an **ideal** op-amp, \$A = +\infty\$. Hence, unless you reach saturation, \$V\_p - V\_n = {V\_{out} \over A} = {V\_{out} \over +\infty} = 0\$.
**Edit:**
If that helps you, you can consider a non-ideal op-amp with a finite \$A\$ gain, using it in an inverter configuration, as you suggested in... |
416,108 | For an ideal OpAmp the voltages at the inputs are said to be of equal value and the currents 0, however, for we also know that $$V\_\text{out}=A(V\_p-V\_n)$$ but if the voltages are the same the output should always be 0!
I know that what I'm saying is wrong, but I don't know where the loophole is, and I can't find it... | 2019/01/09 | [
"https://electronics.stackexchange.com/questions/416108",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/201757/"
] | The loophole is that, for an **ideal** op-amp, \$A = +\infty\$. Hence, unless you reach saturation, \$V\_p - V\_n = {V\_{out} \over A} = {V\_{out} \over +\infty} = 0\$.
**Edit:**
If that helps you, you can consider a non-ideal op-amp with a finite \$A\$ gain, using it in an inverter configuration, as you suggested in... | One formula often used in thinking about opamp behavior is
Closed Loop Gain = G /(1 + G \* H)
where G = the open-loop-gain and H is the feedback-factor.
Suppose the G rolls off with frequency, and suppose the H is 0.0001 (purpose is to produce a precision gain of 10,000x).
What happens in a real opamp?
[![enter ima... |
416,108 | For an ideal OpAmp the voltages at the inputs are said to be of equal value and the currents 0, however, for we also know that $$V\_\text{out}=A(V\_p-V\_n)$$ but if the voltages are the same the output should always be 0!
I know that what I'm saying is wrong, but I don't know where the loophole is, and I can't find it... | 2019/01/09 | [
"https://electronics.stackexchange.com/questions/416108",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/201757/"
] | >
> For an ideal op-amp the voltages at the inputs are said to be of equal value ...
>
>
>
No. If negative feedback is applied and the output is not driven into saturation then the inputs will be very, very close to equal.
>
> ... and the currents 0, ...
>
>
>
Yes, due to the high and sometimes very, very hi... | The assumption that the input voltages are always the same only applies when the op amp is used with **negative feedback**. It is the feedback that causes the input voltages to be the same (or nearly so, in the real world). Of course, we also assume that the output voltage is within the operating limits of the amplifie... |
416,108 | For an ideal OpAmp the voltages at the inputs are said to be of equal value and the currents 0, however, for we also know that $$V\_\text{out}=A(V\_p-V\_n)$$ but if the voltages are the same the output should always be 0!
I know that what I'm saying is wrong, but I don't know where the loophole is, and I can't find it... | 2019/01/09 | [
"https://electronics.stackexchange.com/questions/416108",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/201757/"
] | The assumption that the input voltages are always the same only applies when the op amp is used with **negative feedback**. It is the feedback that causes the input voltages to be the same (or nearly so, in the real world). Of course, we also assume that the output voltage is within the operating limits of the amplifie... | One formula often used in thinking about opamp behavior is
Closed Loop Gain = G /(1 + G \* H)
where G = the open-loop-gain and H is the feedback-factor.
Suppose the G rolls off with frequency, and suppose the H is 0.0001 (purpose is to produce a precision gain of 10,000x).
What happens in a real opamp?
[![enter ima... |
416,108 | For an ideal OpAmp the voltages at the inputs are said to be of equal value and the currents 0, however, for we also know that $$V\_\text{out}=A(V\_p-V\_n)$$ but if the voltages are the same the output should always be 0!
I know that what I'm saying is wrong, but I don't know where the loophole is, and I can't find it... | 2019/01/09 | [
"https://electronics.stackexchange.com/questions/416108",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/201757/"
] | >
> For an ideal op-amp the voltages at the inputs are said to be of equal value ...
>
>
>
No. If negative feedback is applied and the output is not driven into saturation then the inputs will be very, very close to equal.
>
> ... and the currents 0, ...
>
>
>
Yes, due to the high and sometimes very, very hi... | One formula often used in thinking about opamp behavior is
Closed Loop Gain = G /(1 + G \* H)
where G = the open-loop-gain and H is the feedback-factor.
Suppose the G rolls off with frequency, and suppose the H is 0.0001 (purpose is to produce a precision gain of 10,000x).
What happens in a real opamp?
[![enter ima... |
828,931 | I have been trying to configure Postfix to use SMTP authentication. When I telnet on port 587, I appear to be authenticating correctly, but the mail fails to reach its destination and instead comes back as 553 rejected by Spamhaus because my IP is on the PBL. When I read the documentation on Spamhaus, I am told that be... | 2017/01/27 | [
"https://serverfault.com/questions/828931",
"https://serverfault.com",
"https://serverfault.com/users/395531/"
] | The log shows that authentication is properly configured and working
```
235 2.7.0 Authentication successful
```
but the reply says you are getting blocked
```
553-mail rejected because your IP is in the PBL. See 553 http://www.spamhaus.org/pbl (in reply to RCPT TO command)
```
Go to spamhaus web site and follow... | Proving that authentication is working is not the same thing as proving that unauthenticated requests are blocked. However that's not relevant to the problem you are having (unable to deliver email to remote systems).
>
> when I try to disable port 25
>
>
>
It's rather worrying that you think this has any part in... |
22,052,258 | I am building an authentication system using Passport.js using [Easy Node Authentication: Setup and Local tutorial](https://scotch.io/tutorials/easy-node-authentication-setup-and-local).
I am confused about what `passport.session()` does.
After playing around with the different middleware I came to understand that `e... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22052258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1835903/"
] | `passport.session()` acts as a middleware to alter the req object and change the 'user' value that is currently the session id (from the client cookie) into the true deserialized user object.
Whilst the other answers make some good points I thought that some more specific detail could be provided.
```
app.use(passpor... | From the [documentation](http://passportjs.org/guide/configure/)
>
> In a Connect or Express-based application, passport.initialize()
> middleware is required to initialize Passport. If your application
> uses persistent login sessions, passport.session() middleware must
> also be used.
>
>
>
and
>
> Session... |
22,052,258 | I am building an authentication system using Passport.js using [Easy Node Authentication: Setup and Local tutorial](https://scotch.io/tutorials/easy-node-authentication-setup-and-local).
I am confused about what `passport.session()` does.
After playing around with the different middleware I came to understand that `e... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22052258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1835903/"
] | `passport.session()` acts as a middleware to alter the req object and change the 'user' value that is currently the session id (from the client cookie) into the true deserialized user object.
Whilst the other answers make some good points I thought that some more specific detail could be provided.
```
app.use(passpor... | It simply authenticates the session (which is populated by `express.session()`). It is equivalent to:
```
passport.authenticate('session');
```
as can be seen in the code here:
<https://github.com/jaredhanson/passport/blob/42ff63c/lib/authenticator.js#L233> |
22,052,258 | I am building an authentication system using Passport.js using [Easy Node Authentication: Setup and Local tutorial](https://scotch.io/tutorials/easy-node-authentication-setup-and-local).
I am confused about what `passport.session()` does.
After playing around with the different middleware I came to understand that `e... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22052258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1835903/"
] | `passport.session()` acts as a middleware to alter the req object and change the 'user' value that is currently the session id (from the client cookie) into the true deserialized user object.
Whilst the other answers make some good points I thought that some more specific detail could be provided.
```
app.use(passpor... | While you will be using `PassportJs` for validating the user as part of your login URL, you still need some mechanism to store this user information in the session and retrieve it with every subsequent request (i.e. serialize/deserialize the user).
So in effect, you are authenticating the user with every request, eve... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | Possibly a duplicate of [Bulk Publishing of Android Apps](https://stackoverflow.com/questions/4740319/bulk-publishing-of-android-apps/4740728#4740728).
Android Library projects will do this for you nicely. You'll end up with 1 library project and then a project for each edition (free/full) with those really just conta... | Gradle allows to use generated BuildConfig.java to pass some data to code.
```
productFlavors {
paid {
packageName "com.simple.paid"
buildConfigField 'boolean', 'PAID', 'true'
buildConfigField "int", "THING_ONE", "1"
}
free {
packageName "com.simple.free"
buildConfig... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | The best way is to use "Android Studio" -> gradle.build -> [productFlavors + generate manifest file from template]. This combination allows to build free/paid versions and bunch of editions for different app markets from one source.
---
This is a part of templated manifest file:
---
```
<manifest android:versionCod... | If you want another application name, depending of the flavor, you can also add this:
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
resValue "string", "app_name", "test lite"
versionCode 1
versionName '1.0.0'
}
pro {
applicationId = 'com.project.... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | Possibly a duplicate of [Bulk Publishing of Android Apps](https://stackoverflow.com/questions/4740319/bulk-publishing-of-android-apps/4740728#4740728).
Android Library projects will do this for you nicely. You'll end up with 1 library project and then a project for each edition (free/full) with those really just conta... | If you want another application name, depending of the flavor, you can also add this:
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
resValue "string", "app_name", "test lite"
versionCode 1
versionName '1.0.0'
}
pro {
applicationId = 'com.project.... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | Gradle allows to use generated BuildConfig.java to pass some data to code.
```
productFlavors {
paid {
packageName "com.simple.paid"
buildConfigField 'boolean', 'PAID', 'true'
buildConfigField "int", "THING_ONE", "1"
}
free {
packageName "com.simple.free"
buildConfig... | For everyone who want to use the solution by Denis:
In the new gradle version `packageName` is now `applicationId` and don't forget to put `productFlavors { ... }` in `android { ... }`
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
versionCode 1
versionName '1.0.0'
... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | It's very simple by using build.gradle in Android Studio. Read about [productFlavors](http://tools.android.com/tech-docs/new-build-system/user-guide). It is a very usefull feature. Just simply add following lines in build.gradle:
```
productFlavors {
lite {
packageName = 'com.project.test.app'
vers... | The best way is to use "Android Studio" -> gradle.build -> [productFlavors + generate manifest file from template]. This combination allows to build free/paid versions and bunch of editions for different app markets from one source.
---
This is a part of templated manifest file:
---
```
<manifest android:versionCod... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | For everyone who want to use the solution by Denis:
In the new gradle version `packageName` is now `applicationId` and don't forget to put `productFlavors { ... }` in `android { ... }`
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
versionCode 1
versionName '1.0.0'
... | One approach I'm experimenting with is using fully-qualified names for activities, and just changing the package attribute. It avoids any real refactoring (1 file copy, 1 text sub).
This almost works, but the generated R class isn't picked up, as the package for this is pulled out of AndroidManifest.xml, so ends up in... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | For everyone who want to use the solution by Denis:
In the new gradle version `packageName` is now `applicationId` and don't forget to put `productFlavors { ... }` in `android { ... }`
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
versionCode 1
versionName '1.0.0'
... | If you want another application name, depending of the flavor, you can also add this:
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
resValue "string", "app_name", "test lite"
versionCode 1
versionName '1.0.0'
}
pro {
applicationId = 'com.project.... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | The best way is to use "Android Studio" -> gradle.build -> [productFlavors + generate manifest file from template]. This combination allows to build free/paid versions and bunch of editions for different app markets from one source.
---
This is a part of templated manifest file:
---
```
<manifest android:versionCod... | For everyone who want to use the solution by Denis:
In the new gradle version `packageName` is now `applicationId` and don't forget to put `productFlavors { ... }` in `android { ... }`
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
versionCode 1
versionName '1.0.0'
... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | Possibly a duplicate of [Bulk Publishing of Android Apps](https://stackoverflow.com/questions/4740319/bulk-publishing-of-android-apps/4740728#4740728).
Android Library projects will do this for you nicely. You'll end up with 1 library project and then a project for each edition (free/full) with those really just conta... | One approach I'm experimenting with is using fully-qualified names for activities, and just changing the package attribute. It avoids any real refactoring (1 file copy, 1 text sub).
This almost works, but the generated R class isn't picked up, as the package for this is pulled out of AndroidManifest.xml, so ends up in... |
5,590,203 | So I'm coming down to release-time for my application. We plan on releasing two versions, a free ad-based play-to-unlock version, and a paid fully unlocked version. I have the code set up that I can simply set a flag on startup to enable/disable ads and lock/unlock all the features. So literally only one line of code w... | 2011/04/08 | [
"https://Stackoverflow.com/questions/5590203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615779/"
] | Gradle allows to use generated BuildConfig.java to pass some data to code.
```
productFlavors {
paid {
packageName "com.simple.paid"
buildConfigField 'boolean', 'PAID', 'true'
buildConfigField "int", "THING_ONE", "1"
}
free {
packageName "com.simple.free"
buildConfig... | If you want another application name, depending of the flavor, you can also add this:
```
productFlavors {
lite {
applicationId = 'com.project.test.app'
resValue "string", "app_name", "test lite"
versionCode 1
versionName '1.0.0'
}
pro {
applicationId = 'com.project.... |
1,439,686 | Prove that $|a^2-b^2| < 2|a| + 1$ given that $|a-b|<1$
I understand that a variant of the triangle inequality is used in the solution: $|b| - |a| \le |a-b|$
I'm confused as to how it's derived, can anybody help me understand
Thank you for your time | 2015/09/17 | [
"https://math.stackexchange.com/questions/1439686",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/189897/"
] | $$|a^2-b^2|=|a-b||a+b|<1.|a+b|\leq|a|+|b|<|a|+|a|+1=2|a|+1$$ where we used $|b|\leq |a|+|a-b|<|a|+1$. The last one follows from triangle inequality again:
Substitute in $|x+y|\leq |x|+|y|$ $x=b-a$ and $y=a$ to get $|b-a+a|\leq |b-a|+|a|$ | $$2|a|+1>|a^2-b^2|\ge|b^2|-|a^2|$$
$$\iff(|a|+1)^2\ge|b^2|\iff |a|+1\ge |b|$$
$$1\ge |b|-|a|\ge|b-a|$$ |
1,439,686 | Prove that $|a^2-b^2| < 2|a| + 1$ given that $|a-b|<1$
I understand that a variant of the triangle inequality is used in the solution: $|b| - |a| \le |a-b|$
I'm confused as to how it's derived, can anybody help me understand
Thank you for your time | 2015/09/17 | [
"https://math.stackexchange.com/questions/1439686",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/189897/"
] | $$|a^2-b^2|=|a-b||a+b|<1.|a+b|\leq|a|+|b|<|a|+|a|+1=2|a|+1$$ where we used $|b|\leq |a|+|a-b|<|a|+1$. The last one follows from triangle inequality again:
Substitute in $|x+y|\leq |x|+|y|$ $x=b-a$ and $y=a$ to get $|b-a+a|\leq |b-a|+|a|$ | We have
$$|a^2-b^2|=|a-b|\cdot|a+b|<|a+b|\le |a|+|b|\tag1$$
moreover,
$$|b|-|a|\le|a-b|<1\implies |b|<|a|+1\tag2$$
We deduce the desired result from $(1)$ and $(2)$. |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | you can bind the same function of `Save` button to `keydown.enter` of texterea, and call `$event.preventDefault` to avoid the newline.
sample [plunker](https://plnkr.co/edit/J2DwmYBcD2D0evSGcQMX?p=preview). | You can create a service which can send a notification to other components that will handle the command. The service could look like this:
```
import { Injectable } from "@angular/core";
import { Subject } from "rxjs/Subject";
@Injectable()
export class DataSavingService {
private dataSavingRequested = new Subje... |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | Extending the answer by @Pengyy
You can bind the bind the enter key to a pseudoSave function, and preventDefault inside of that, thus preventing both the Save function and the newline. Then you can either call the save function from there(assuming it is accessible such as a service) or you can emit an EventEmitter, an... | you can bind the same function of `Save` button to `keydown.enter` of texterea, and call `$event.preventDefault` to avoid the newline.
sample [plunker](https://plnkr.co/edit/J2DwmYBcD2D0evSGcQMX?p=preview). |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | you can bind the same function of `Save` button to `keydown.enter` of texterea, and call `$event.preventDefault` to avoid the newline.
sample [plunker](https://plnkr.co/edit/J2DwmYBcD2D0evSGcQMX?p=preview). | it could be 2 solutions:
1. Use javascript to handle enter event and trigger Save function in it
or
2. Use Same thing from Angular side as describe in [this](https://stackoverflow.com/questions/17470790/how-to-use-a-keypress-event-in-angularjs).
[This](https://stackoverflow.com/questions/2099661/enter-key-in-textar... |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | Assuming that your `textarea` is inside a `form` element.
[**{Plunker Demo}**](https://plnkr.co/edit/0ojy8fQdP2abzfQZNZud?p=preview)
You can achieve it by using a **hidden submit** input, like this
```
@Component({
selector: 'my-app',
template: `
<form (submit)="formSubmitted($event)">
<input #proxySub... | You can create a service which can send a notification to other components that will handle the command. The service could look like this:
```
import { Injectable } from "@angular/core";
import { Subject } from "rxjs/Subject";
@Injectable()
export class DataSavingService {
private dataSavingRequested = new Subje... |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | Extending the answer by @Pengyy
You can bind the bind the enter key to a pseudoSave function, and preventDefault inside of that, thus preventing both the Save function and the newline. Then you can either call the save function from there(assuming it is accessible such as a service) or you can emit an EventEmitter, an... | You can create a service which can send a notification to other components that will handle the command. The service could look like this:
```
import { Injectable } from "@angular/core";
import { Subject } from "rxjs/Subject";
@Injectable()
export class DataSavingService {
private dataSavingRequested = new Subje... |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | Extending the answer by @Pengyy
You can bind the bind the enter key to a pseudoSave function, and preventDefault inside of that, thus preventing both the Save function and the newline. Then you can either call the save function from there(assuming it is accessible such as a service) or you can emit an EventEmitter, an... | Assuming that your `textarea` is inside a `form` element.
[**{Plunker Demo}**](https://plnkr.co/edit/0ojy8fQdP2abzfQZNZud?p=preview)
You can achieve it by using a **hidden submit** input, like this
```
@Component({
selector: 'my-app',
template: `
<form (submit)="formSubmitted($event)">
<input #proxySub... |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | Assuming that your `textarea` is inside a `form` element.
[**{Plunker Demo}**](https://plnkr.co/edit/0ojy8fQdP2abzfQZNZud?p=preview)
You can achieve it by using a **hidden submit** input, like this
```
@Component({
selector: 'my-app',
template: `
<form (submit)="formSubmitted($event)">
<input #proxySub... | it could be 2 solutions:
1. Use javascript to handle enter event and trigger Save function in it
or
2. Use Same thing from Angular side as describe in [this](https://stackoverflow.com/questions/17470790/how-to-use-a-keypress-event-in-angularjs).
[This](https://stackoverflow.com/questions/2099661/enter-key-in-textar... |
43,752,286 | A bit tricky situation. For the code below, I have added `(keydown.enter)="false"` to ignore the break line/enter button in textarea
This is causing a user issue and would like the existing behaviour where Pressing enter should automatically trigger the "Save button"
Any idea how to trigger the Save button when still... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485445/"
] | Extending the answer by @Pengyy
You can bind the bind the enter key to a pseudoSave function, and preventDefault inside of that, thus preventing both the Save function and the newline. Then you can either call the save function from there(assuming it is accessible such as a service) or you can emit an EventEmitter, an... | it could be 2 solutions:
1. Use javascript to handle enter event and trigger Save function in it
or
2. Use Same thing from Angular side as describe in [this](https://stackoverflow.com/questions/17470790/how-to-use-a-keypress-event-in-angularjs).
[This](https://stackoverflow.com/questions/2099661/enter-key-in-textar... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | >
> The current answer(s) are out-of-date and require revision given recent changes.
>
>
>
There is no *practical* difference of `Thread.yield()` between Java versions since 6 to 9.
**TL;DR;**
Conclusions based on OpenJDK source code (<http://hg.openjdk.java.net/>).
If not to take into account HotSpot support o... | yield() main use is for putting a multi-threading application on hold.
all these methods differences are yield() puts thread on hold while executing another thread and returning back after the completion of that thread, join() will bring the beginning of threads together executing until the end and of another thread ... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | **Source: <http://www.javamex.com/tutorials/threads/yield.shtml>**
>
> ### Windows
>
>
> In the Hotspot implementation, the way that `Thread.yield()` works has
> changed between Java 5 and Java 6.
>
>
> In Java 5, `Thread.yield()` calls the Windows API call `Sleep(0)`. This
> has the special effect of **clearin... | I see the question has been reactivated with a bounty, now asking what the practical uses for `yield` are. I'll give an example from my experience.
As we know, `yield` forces the calling thread to give up the processor that it's running on so that another thread can be scheduled to run. This is useful when the current... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | >
> The current answer(s) are out-of-date and require revision given recent changes.
>
>
>
There is no *practical* difference of `Thread.yield()` between Java versions since 6 to 9.
**TL;DR;**
Conclusions based on OpenJDK source code (<http://hg.openjdk.java.net/>).
If not to take into account HotSpot support o... | `Thread.yield();` frees the bottom thread.
`Thread` is using OS threads, so `Thread.yield();` might free the hardware thread.
Bad implementation for `sleep(millis)`
```
public class MySleep {
public static void sleep(long millis) throws InterruptedException {
long start = System.currentTimeMillis();
... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | `Thread.yield();` frees the bottom thread.
`Thread` is using OS threads, so `Thread.yield();` might free the hardware thread.
Bad implementation for `sleep(millis)`
```
public class MySleep {
public static void sleep(long millis) throws InterruptedException {
long start = System.currentTimeMillis();
... | yield() main use is for putting a multi-threading application on hold.
all these methods differences are yield() puts thread on hold while executing another thread and returning back after the completion of that thread, join() will bring the beginning of threads together executing until the end and of another thread ... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | About the differences between `yield()`, `interrupt()` and `join()` - in general, not just in Java:
1. **yielding**: Literally, to 'yield' means to let go, to give up, to surrender. A yielding thread tells the operating system (or the virtual machine, or what not) it's willing to let other threads be scheduled in its ... | First, the actual description is
>
> Causes the currently executing thread object to temporarily pause and
> allow other threads to execute.
>
>
>
Now, it is very likely that your main thread will execute the loop five times before the `run` method of the new thread is being executed, so all the calls to `yield`... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | >
> What are, in fact, the main uses of yield()?
>
>
>
Yield suggests to the CPU that you may stop the current thread and start executing threads with higher priority. In other words, assigning a low priority value to the current thread to leave room for more critical threads.
>
> I believe the code below result... | `Thread.yield()` causes thread to go from "Running" state to "Runnable" state.
Note: It doesn't cause thread to go "Waiting" state. |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | `Thread.yield()` causes thread to go from "Running" state to "Runnable" state.
Note: It doesn't cause thread to go "Waiting" state. | Thread.yield()
>
> When we invoke Thread.yield() method, the thread scheduler keep the currently running thread to Runnable state and picks another thread of equal priority or higher priority. If there is no equal and higher priority thread then it reschedule the calling yield() thread. Remember yield method does not... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | >
> What are, in fact, the main uses of yield()?
>
>
>
Yield suggests to the CPU that you may stop the current thread and start executing threads with higher priority. In other words, assigning a low priority value to the current thread to leave room for more critical threads.
>
> I believe the code below result... | `Thread.yield();` frees the bottom thread.
`Thread` is using OS threads, so `Thread.yield();` might free the hardware thread.
Bad implementation for `sleep(millis)`
```
public class MySleep {
public static void sleep(long millis) throws InterruptedException {
long start = System.currentTimeMillis();
... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | >
> What are, in fact, the main uses of yield()?
>
>
>
Yield suggests to the CPU that you may stop the current thread and start executing threads with higher priority. In other words, assigning a low priority value to the current thread to leave room for more critical threads.
>
> I believe the code below result... | Thread.yield()
>
> When we invoke Thread.yield() method, the thread scheduler keep the currently running thread to Runnable state and picks another thread of equal priority or higher priority. If there is no equal and higher priority thread then it reschedule the calling yield() thread. Remember yield method does not... |
6,979,796 | I am a little bit confused about the use of [`Thread.yield()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#yield()) method in Java, specifically in the example code below. I've also read that yield() is 'used to prevent execution of a thread'.
My questions are:
1. I believe the ... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6979796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827583/"
] | About the differences between `yield()`, `interrupt()` and `join()` - in general, not just in Java:
1. **yielding**: Literally, to 'yield' means to let go, to give up, to surrender. A yielding thread tells the operating system (or the virtual machine, or what not) it's willing to let other threads be scheduled in its ... | >
> What are, in fact, the main uses of yield()?
>
>
>
Yield suggests to the CPU that you may stop the current thread and start executing threads with higher priority. In other words, assigning a low priority value to the current thread to leave room for more critical threads.
>
> I believe the code below result... |
30,435,317 | I have single polyline on my map. I add dblclick event to it. It is working but also map is zooming. How to disable zooming when double click on polyline? (Or anything else with dblclick event);
Any event propagation, event stop or something?
I know and I can use `map.setOptions({disableDoubleClickZoom: true });` but... | 2015/05/25 | [
"https://Stackoverflow.com/questions/30435317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4554009/"
] | This is the way to do this through the api:
```
google.maps.event.addListener(polygonObject,'dblclick',function(e){e.stop();})
```
[Disabling zoom when double click on polygon](https://stackoverflow.com/questions/11278409/disabling-zoom-when-double-click-on-polygon) | **STUPID HACK**
In polyline 'dblclick' event just added at start : map.setZoom(map.getZoom-1);
So first u deacrease zoom and then increase. |
25,730,046 | I have a controller that outputs data from the database in raw JSON format.
I want this to function as an API and allow anyone to make views with any technology that can consume the JSON i.e. Angular, Jquery/Ajax.
However I also want to make a view in Laravel.
So what's the best practice for creating a view from Lar... | 2014/09/08 | [
"https://Stackoverflow.com/questions/25730046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821450/"
] | You are probably using NTFS or FAT32 on Windows, and those filesystems do not support the *executable* permission. Instead, [cygwin looks at the file name and contents to determine whether it's executable](https://cygwin.com/cygwin-ug-net/using-filemodes.html):
>
> Files are considered to be executable if the filenam... | If you're updating scripts in a windows environment that are being deployed to a linux filesystem, even though they are permitted to run locally, you may still find yourself needing to grant execute before pushing.
From this article on [Change file permissions when working with git repo's on windows](https://medium.co... |
25,730,046 | I have a controller that outputs data from the database in raw JSON format.
I want this to function as an API and allow anyone to make views with any technology that can consume the JSON i.e. Angular, Jquery/Ajax.
However I also want to make a view in Laravel.
So what's the best practice for creating a view from Lar... | 2014/09/08 | [
"https://Stackoverflow.com/questions/25730046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821450/"
] | You are probably using NTFS or FAT32 on Windows, and those filesystems do not support the *executable* permission. Instead, [cygwin looks at the file name and contents to determine whether it's executable](https://cygwin.com/cygwin-ug-net/using-filemodes.html):
>
> Files are considered to be executable if the filenam... | Very likely you do not have "shebang" at the beginning of your script. So Windows does not know which binary should be used to run the script. Thus the permissions gets silently ignored.
For example:
```
#!/usr/bin/sh
```
or
```
#!/usr/bin/bash
```
It looks like git-bash detects it automaticly, because the execu... |
25,730,046 | I have a controller that outputs data from the database in raw JSON format.
I want this to function as an API and allow anyone to make views with any technology that can consume the JSON i.e. Angular, Jquery/Ajax.
However I also want to make a view in Laravel.
So what's the best practice for creating a view from Lar... | 2014/09/08 | [
"https://Stackoverflow.com/questions/25730046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821450/"
] | If you're updating scripts in a windows environment that are being deployed to a linux filesystem, even though they are permitted to run locally, you may still find yourself needing to grant execute before pushing.
From this article on [Change file permissions when working with git repo's on windows](https://medium.co... | Very likely you do not have "shebang" at the beginning of your script. So Windows does not know which binary should be used to run the script. Thus the permissions gets silently ignored.
For example:
```
#!/usr/bin/sh
```
or
```
#!/usr/bin/bash
```
It looks like git-bash detects it automaticly, because the execu... |
49,585,618 | **Task:**
```
id | title | description |
---------------------------------------------------------------------
1 | Task1 | Descr1 |
2 | Task2 | Descr1 |
3 | Task2 | Descr1 |
4 | Task2 | Descr1 |
5 | Task2 | Descr1 |
```
**Message:**
```
id | task_id | message | stat... | 2018/03/31 | [
"https://Stackoverflow.com/questions/49585618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2100323/"
] | You could use a selective aggregation baded on sum and CASE when
```
select task.id
, task.title
, task.description
, sum(case when Message.status = 1 then 1 else 0 end ) status1
, sum(case when Message.status = 2 then 1 else 0 end ) status2
, sum(case when Message.status = 3 then 1 else ... | Another way
```
SELECT task.id, task.title, task.description,
SUM(DECODE (status, 'HOLD',1,0 end)) AS "HOLD_COUNT"
SUM(DECODE (status, OK,1, 0 end)) AS "OK_COUNT"
SUM(DECODE (status, ERROR,1, 0 end ) AS "ERROUR_COUNT"
FROM task
JOIN Message ON Task.id = Message.task_id
group by task.id, task.title , task.descriptio... |
49,585,618 | **Task:**
```
id | title | description |
---------------------------------------------------------------------
1 | Task1 | Descr1 |
2 | Task2 | Descr1 |
3 | Task2 | Descr1 |
4 | Task2 | Descr1 |
5 | Task2 | Descr1 |
```
**Message:**
```
id | task_id | message | stat... | 2018/03/31 | [
"https://Stackoverflow.com/questions/49585618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2100323/"
] | You could use a selective aggregation baded on sum and CASE when
```
select task.id
, task.title
, task.description
, sum(case when Message.status = 1 then 1 else 0 end ) status1
, sum(case when Message.status = 2 then 1 else 0 end ) status2
, sum(case when Message.status = 3 then 1 else ... | I believe the correct solution is:
```
select t.id, t.title, t.description,
coalesce(sum( m.status = 'Hold' ), 0) as num_hold,
coalesce(sum( m.status = 'OK' ), 0) as num_ok,
coalesce(sum( m.status = 'Error' ), 0) as num_error
from task t left join
message m
on m.task_id = t.id
group by t... |
51,984 | I observed the below behavior of echo
```
#!/bin/bash
x=" hello"
echo $x
echo "$x"
```
Now when I run the above code I get
```
ronnie@ronnie:~$ bash test.sh
hello
hello
ronnie@ronnie:~$
```
So, can someone explain to me why `whitespace` in first case is not present in output and also points me to the document... | 2012/10/16 | [
"https://unix.stackexchange.com/questions/51984",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/24545/"
] | It is not the `echo` behavior. It is a bash behavior. When you use `echo $x` form the bash get the following command to process (treat `␣` as space):
```
echo␣␣hello
```
Then this command is tokenized and bash get two tokens: `echo` and `hello` thus the output is just `hello`
When you use the `echo "$x"` form then... | The reason you see different output is because the `echo[1 space]Hello` line is syntactically equal
to `echo[5 spaces]Hello`. The whitespace is ignored, and the word 'Hello' is treated as the argument to `echo`. The first line, in it's simplest form, is much the same as if you had said `echo "Hello"`. In the second li... |
95,587 | I need to get every UTC day stamp in yyyy-MM-dd format (e.g. "2015-07-02") between any two arbitrary Date fields.
My first attempt is this:
```
public static Set<String> getUTCDayStringsBetween(Date startDt, Date endDt) {
if (!startDt.before(endDt)) {
throw new IllegalArgumentException("Start date (" + st... | 2015/07/02 | [
"https://codereview.stackexchange.com/questions/95587",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/52425/"
] | >
> *No, but I welcome answers that use Java8 features* - [bradvido](https://codereview.stackexchange.com/questions/95587/getting-all-the-utc-day-stamps-between-2-dates#comment174428_95587)
>
>
>
In Java 8, the new [`Instant`](https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html) class is analogous to ... | Instead of an infinite `while` loop + an `if` to break out, it would be more natural to convert this to a do-while loop.
The comment "//reached the end of our range. set time to the endDt and get the final day string" is pointless, it just says the same thing with words that the code already tells us perfectly clearly... |
288,935 | I know this is a very basic question but I cant seem to find the answer with Google. What is the difference between a hotfix and a bugfix? | 2015/07/07 | [
"https://softwareengineering.stackexchange.com/questions/288935",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/134708/"
] | The term hotfix is generally used when client has found an issue within the current release of the product and can not wait to be fixed until the next big release. Hence a hotfix issue is created to fix it and is released as a part of update to the current release usually called Cumulative Update(CU). CUs are nothing b... | A bugfix is just that: a fix for a bug. This could happen at almost any time in a product's lifetime: during development, during testing, or after release.
A hotfix can be one or more bugfixes. The important part is the hot, which refers to when it is applied. Originally, it referred to patching an actively running sy... |
288,935 | I know this is a very basic question but I cant seem to find the answer with Google. What is the difference between a hotfix and a bugfix? | 2015/07/07 | [
"https://softwareengineering.stackexchange.com/questions/288935",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/134708/"
] | The term hotfix is generally used when client has found an issue within the current release of the product and can not wait to be fixed until the next big release. Hence a hotfix issue is created to fix it and is released as a part of update to the current release usually called Cumulative Update(CU). CUs are nothing b... | From my experience in support at a large software company the two terms are unrelated.
`Bug fix` is an action on the source code, it is a code change or set of changes to address a reported code defect (a bug.)
A `hotfix` is generally a patch or update for clients / deployed systems but more specifically they are pat... |
288,935 | I know this is a very basic question but I cant seem to find the answer with Google. What is the difference between a hotfix and a bugfix? | 2015/07/07 | [
"https://softwareengineering.stackexchange.com/questions/288935",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/134708/"
] | From my experience in support at a large software company the two terms are unrelated.
`Bug fix` is an action on the source code, it is a code change or set of changes to address a reported code defect (a bug.)
A `hotfix` is generally a patch or update for clients / deployed systems but more specifically they are pat... | A bugfix is just that: a fix for a bug. This could happen at almost any time in a product's lifetime: during development, during testing, or after release.
A hotfix can be one or more bugfixes. The important part is the hot, which refers to when it is applied. Originally, it referred to patching an actively running sy... |
54,624 | sorry if I'm asking stupid questions but I really spent days trying to figure out how to add functionality to my map so that when user clicks on some map object he gets the attribute table on the side with the attribute data of that object. Is it even possible? I don't speak about popups, I speak about actual table.
Th... | 2013/03/15 | [
"https://gis.stackexchange.com/questions/54624",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/-1/"
] | You could use the FeatureGrid :
<http://api.geoext.org/1.1/examples/feature-grid.html> | You can try this code, this will display a pop-up containing attribute information of layers on that particular point.
```
controls.push(new OpenLayers.Control.WMSGetFeatureInfo({
autoActivate: true,
infoFormat: "application/vnd.ogc.gml",
maxFeatures: 10,
eventListeners:... |
46,634,279 | I'm new to clojure and want to accomplish the following:
I have some functions with a one letter name, a string "commands"
and an argument arg
```
(defn A [x] ...)
(defn B [x] ...)
(defn C [x] ...)
```
I want to have a function (let's call it `apply-fns`) that, given the string with the names of the functions, app... | 2017/10/08 | [
"https://Stackoverflow.com/questions/46634279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741941/"
] | Being a literal genie, I'll give you exactly what you're asking:
```
(defn A [x])
(defn B [x])
(defn C [x])
(def commands "AACCBB")
(defmacro string-fns [arg]
(let [cs (map (comp symbol str) commands)]
`(-> ~arg ~@cs)))
(comment
(macroexpand
'(string-fns :foo)) ;;=> (B (B (C (C (A (A :foo))))))
)
``... | Your aim is to apply a series of functions (in order), so that the following function is applied to the result of the previous one. The result should be the same as nesting the forms (i.e., function calls), like in your example: `(B (B (C (C (A arg)))))`
If you can use a sequence of the commands (or can extract the se... |
70,832,568 | I'm trying to get data from the database using ajax to insert it in other element but the post data not passing to **get-data.php**
so what the reason can be and the solution
[](https://i.stack.imgur.com/RTCbi.png)
[![passed data shown here but no resp... | 2022/01/24 | [
"https://Stackoverflow.com/questions/70832568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13661132/"
] | You need to echo the results in get-data.php
```
<?php
while ($row = $res->fetch_assoc()) {
?>
echo "<option value='". $row["id"]."'>".$row['ilce_adi']."</option>";
<?php
}
}
?>
``` | 1- Get data by serialize from form:
```
$("form").serialize()
```
2- Add dataType: "json" to ajax option:
```
$.ajax({
type: "POST",
url:"get-data.php",
data:$(city).serialize(),
dataType: "json",
success: function(result) {
$("#district").append(result);
}
});
``` |
34,717,787 | We are having a Analytics product. For each of our customer we give one JavaScript code, they put that in their web sites. If a user visit our customer site the java script code hit our server so that we store this page visit on behalf of this customer. Each customer contains unique domain name.
we are storing this pa... | 2016/01/11 | [
"https://Stackoverflow.com/questions/34717787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/619097/"
] | First, a critique if the **excessively large datatypes**:
```
`domain` varchar(50) DEFAULT NULL, -- normalize to MEDIUMINT UNSIGNED (3 bytes)
`guid` varchar(100) DEFAULT NULL, -- what is this for?
`sid` varchar(100) DEFAULT NULL, -- varchar?
`url` varchar(2500) DEFAULT NULL,
`ip` varchar(20) DEFAULT NULL,... | I wouldn't do this if i were you. First thing that come to mind would be, on receive a pageview message, i send the message to a queue so that a worker can pickup and insert to database later (in bulk maybe); also i increase the counter of `siteid:date` in redis (for example). Doing `count` in sql is just a bad idea fo... |
23,629,204 | I'm using KineticJS in my MVC application.
In order to retrieve data from database, I'm making some ajax calls to web services in the API controller. There is an API that returns an id, which I want to assign to the current `Kinetic.Group` id attribute on success.
After drag and drop, a popup `PopUpAddRoom(FloorId)` ... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23629204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3365233/"
] | No, they are not supported. You should use separate struct declarations and regular fields:
```
struct Foo {}
struct Test {
foo: Foo,
}
``` | They are not supported by Rust.
But you can write yourself a proc macro that emulates them. I [have](https://lib.rs/structstruck), it turns
```rust
structstruck::strike!{
struct Test {
foo: struct {}
}
}
```
into
```
struct Foo {}
struct Test {
foo: Foo,
}
```
You haven't explicitly said so, ... |
23,629,204 | I'm using KineticJS in my MVC application.
In order to retrieve data from database, I'm making some ajax calls to web services in the API controller. There is an API that returns an id, which I want to assign to the current `Kinetic.Group` id attribute on success.
After drag and drop, a popup `PopUpAddRoom(FloorId)` ... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23629204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3365233/"
] | No, they are not supported. You should use separate struct declarations and regular fields:
```
struct Foo {}
struct Test {
foo: Foo,
}
``` | I found the optional answer for your request.
Maybe it can help you:
<https://internals.rust-lang.org/t/nested-struct-declaration/13314/4>
[Structural records](https://github.com/rust-lang/rfcs/pull/2584) 592 would give you the nesting (without the privacy controls or naming).
```
// From the RFC
struct RectangleTidy... |
23,629,204 | I'm using KineticJS in my MVC application.
In order to retrieve data from database, I'm making some ajax calls to web services in the API controller. There is an API that returns an id, which I want to assign to the current `Kinetic.Group` id attribute on success.
After drag and drop, a popup `PopUpAddRoom(FloorId)` ... | 2014/05/13 | [
"https://Stackoverflow.com/questions/23629204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3365233/"
] | They are not supported by Rust.
But you can write yourself a proc macro that emulates them. I [have](https://lib.rs/structstruck), it turns
```rust
structstruck::strike!{
struct Test {
foo: struct {}
}
}
```
into
```
struct Foo {}
struct Test {
foo: Foo,
}
```
You haven't explicitly said so, ... | I found the optional answer for your request.
Maybe it can help you:
<https://internals.rust-lang.org/t/nested-struct-declaration/13314/4>
[Structural records](https://github.com/rust-lang/rfcs/pull/2584) 592 would give you the nesting (without the privacy controls or naming).
```
// From the RFC
struct RectangleTidy... |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | My guess is that you'll need to wait for the release of MVC3 (when it becomes open-source) before that can be answered perfectly.
I'm sure the Mono team will make it work, though. | It looks like we're getting there:
<http://gonzalo.name/blog/archive/2011/Jan-21.html>
Looks like it isn't in any of the published versions yet, but you can run it from source control. |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | Yes, it does. I have it working with mono on Linux.
You need mono 2.10.2+ from the stable sources from
~~<http://ftp.novell.com/pub/mono/sources-stable/>~~
<http://download.mono-project.com/sources/mono/>
Then, you need to localcopy these assemblies into your app's bin directory (you take them from Visual Stud... | My guess is that you'll need to wait for the release of MVC3 (when it becomes open-source) before that can be answered perfectly.
I'm sure the Mono team will make it work, though. |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | [Not yet.](http://lists.ximian.com/pipermail/mono-list/2010-November/046052.html) | It looks like we're getting there:
<http://gonzalo.name/blog/archive/2011/Jan-21.html>
Looks like it isn't in any of the published versions yet, but you can run it from source control. |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | Yes, it does. I have it working with mono on Linux.
You need mono 2.10.2+ from the stable sources from
~~<http://ftp.novell.com/pub/mono/sources-stable/>~~
<http://download.mono-project.com/sources/mono/>
Then, you need to localcopy these assemblies into your app's bin directory (you take them from Visual Stud... | [Not yet.](http://lists.ximian.com/pipermail/mono-list/2010-November/046052.html) |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | Mono 2.10 onwards fully supports MVC3 and Razor, albeit the Mono Project cannot currently ship Mono with an open-source implementation of the MVC3/Razor stack included (in the same way as MVC1 and MVC2 are included) just yet.
From the [Release Notes](http://www.mono-project.com/Release_Notes_Mono_2.10#ASP.NET_MVC3_Sup... | It looks like we're getting there:
<http://gonzalo.name/blog/archive/2011/Jan-21.html>
Looks like it isn't in any of the published versions yet, but you can run it from source control. |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | Yes, it does. I have it working with mono on Linux.
You need mono 2.10.2+ from the stable sources from
~~<http://ftp.novell.com/pub/mono/sources-stable/>~~
<http://download.mono-project.com/sources/mono/>
Then, you need to localcopy these assemblies into your app's bin directory (you take them from Visual Stud... | It looks like we're getting there:
<http://gonzalo.name/blog/archive/2011/Jan-21.html>
Looks like it isn't in any of the published versions yet, but you can run it from source control. |
4,239,645 | I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono? | 2010/11/21 | [
"https://Stackoverflow.com/questions/4239645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69742/"
] | Yes, it does. I have it working with mono on Linux.
You need mono 2.10.2+ from the stable sources from
~~<http://ftp.novell.com/pub/mono/sources-stable/>~~
<http://download.mono-project.com/sources/mono/>
Then, you need to localcopy these assemblies into your app's bin directory (you take them from Visual Stud... | Mono 2.10 onwards fully supports MVC3 and Razor, albeit the Mono Project cannot currently ship Mono with an open-source implementation of the MVC3/Razor stack included (in the same way as MVC1 and MVC2 are included) just yet.
From the [Release Notes](http://www.mono-project.com/Release_Notes_Mono_2.10#ASP.NET_MVC3_Sup... |
22,104,670 | I am writing data to a table and allocating a "group-id" for each batch of data that is written. To illustrate, consider the following table.
```
GroupId Value
------- -----
1 a
1 b
1 c
2 a
2 b
3 a
3 b
3 c
3 d
```
In... | 2014/02/28 | [
"https://Stackoverflow.com/questions/22104670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/131407/"
] | This is a set-within-sets query. I like to solve it using `group by` and `having`:
```
select groupid
from GroupValues gv
group by groupid
having sum(case when value = 'a' then 1 else 0 end) > 0 and
sum(case when value = 'b' then 1 else 0 end) > 0 and
sum(case when value = 'c' then 1 else 0 end) > 0 and
... | This is kind of ugly, but it works. On larger datasets I'm not sure what performance would look like, but the nested instances of `#GroupValues` key off `GroupID` in the main table so I think as long as you have a good index on `GroupID` it probably wouldn't be too horrible.
```
If Object_ID('tempdb..#GroupValues... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.