Issue with iOS Build in Flutter Project .../Flutter/Debug.xcconfig: unable to open file (in target "Runner" in project "Runner")

Question: I am working on a Flutter project. Declared few dependencies in the pubspec.yaml file. Project is building fine on Android, but when I try to run on iOS. I am getting the below error. Searched multiple issues, couldn't figure out the exact issue.
.../Flutter/Debug.xcconfig: unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')

pubspec.yaml dependencies
flutter_svg: ^0.19.1
flutter:
  sdk: flutter
flutter_dash: ^0.0.1
readmore: ^1.0.1
cupertino_icons: ^0.1.3
chopper: ^3.0.6
logging: ^0.11.4
package_info: '>=0.4.3+2 <2.0.0'
provider: ^4.3.2+3
sprintf: ^5.0.0

Comment: Did you run `pod install` in your IOs project?
Comment: try cleaning derived data : File > Workspace settings > Click the circled gray arrow icon > move to trash the "Derived data" folder > clean & build.
Install your pods.
Hope this might help!
Comment: @SnehalLokhande Did that. It didn't work. It is showing the same error.
Comment: @Tobi696 yeah i have run that command
Answer: Somehow the Debug.xcconfig & Release.xcconfig files were missing from ios/Flutter directory. I created them and added the following lines.
Debug.xcconfig file
#include "Generated.xcconfig"

Release.xcconfig file
#include "Generated.xcconfig"


Estimation of joint errors

Question: Suppose we have multiple normal random variables, each which is a normal distribution with it's own mean but joint variance:
$$X_i \sim N(\mu_i, \sigma^2)$$
Now suppose we collect data from these variables, $D=\{x_{i,j}\}$.
What methods can one use to estimate the common parameter $\sigma^2$?
One can assume we have some priors $\mu_i\sim N(0, \sigma_m^2), \sigma \sim Ga(\alpha, \beta)$, and one could then write down the posterior by integrating over all $\mu_i$, but it seems there should be an easier "trick" that I'm missing.
Answer: For independent samples from two such populations with the same variance, consider using the pooled variance $S_p^2 = \frac{(n_1 - 1)S_1^2 + (n_2-1)S_2^2}{n_1 - n_2 - 2}$ of the pooled 2-sample t test.
For $g$ independent samples use the obvious generalization, which is $S_w^2 =$ MS(Error) in an ordinary (unbalanced) one-way ANOVA.
A confidence interval for $\sigma^2$ can be found using $\frac{S_w^2}{\sigma^2} \sim \mathsf{Chisq}(\nu),$ where $\nu = \sum_{i=1}^g n_i - g =$ DF(Error)}.
Because
$$0.95 = P\left(L \le \frac{\nu S_w^2}{\sigma^2} \le U\right) =
P\left(\frac{\nu S_w^2}{U}\le\sigma^2\le\frac{\nu S_w^2}{L}\right)$$
a 95% CI for $\sigma^2$ is of the form
$$\left(\frac{\nu S_w^2}{U},\,\frac{\nu S_w^2}{L}\right),$$
where $L$ and $U$ cut probability $0.025$ from the lower and upper tails,
respectively, of $\mathsf{Chisq}(\nu).$
Here is a numerical example in R with three groups of different sizes $(n_1 = 10, n_2 = 8, n_3 = 15)$ all from
normal populations with $\sigma^2 = 15^2 = 256,$ yielding the 95%
confidence interval $(154.95,\, 433.54)$ for $\sigma^2$ or, upon
taking square roots of endpoints, a 95% CI $(12.45,20.82)$ for $\sigma.$
<code>set.seed(811)
x1 = rnorm(10, 100, 15);  x2 = rnorm(8, 130, 15);  x3 = rnorm(15, 80, 15)
sse = 9*var(x1) + 7*var(x2) + 14*var(x3)
dfe = 9 + 7 + 14
mse = sse/dfe
sse/qchisq(c(.975,.025), dfe)
[1] 154.9513 433.5414
sqrt(sse/qchisq(c(.975,.025), dfe))
[1] 12.44794 20.82166
</code>
Comment: Much simpler. Now I wonder if the gamma posterior gives the same estimate somehow :)
Comment: Very likely, using a relatively non-informative prior would give a 95% Bayesian credible (posterior) interval that is numerically similar to my 95% CI based on a chi-squared distribution. (In addition, recall that chi-squared distn's are members of the gamma family.)

Estimation of joint errors


Issues with tritomising and dichotomising variable

Question: I see that the issue of splitting a variable into two categories has been discussed on this forum and I understand pros, cons as well as some ways of performing it. The issue that I am interested and can't seem to find anything on splitting a variable into three points.
For this to make sense let me briefly explain my data. I have used a psychographic scale (5 Point Likert) which consists of eight items where low scores indicate one trait and high scores indicate a different one. Theoretically, most people should fall into the mid group, with much smaller extreme groups which show clear tendencies for certain behaviour. Thus, I used this scale with an intention of grouping my respondents into low, middle, and high groups. This classification into three groups is supported conceptually by previous research but no study discloses how groups are split.
I tried using a composite score for the scale and e.g. correlate with a dependent variable. However, because extreme groups are relatively small the result for the whole sample indicates asssociation in the expected direction albeit very low. I have considered dichotomising but individuals with top or low scores on the eight variables get muddled up with middle scores that conceptually do not indicate any distinct group.
Having looked into graphical representation of the scale I can conclude that distribution is normal and indeed most people score in the middle. Thus, visually I can identify the cut-off points which seems to make sense, it produces group sizes supported theoretically and any further tests show significant differences between groups on dependent variables of interest. However, I understand that cutting data this way is very arbitrary. Is there any way I can actually justify doing this based on conceptual support for groups? Is there anything else anyone can suggest as I have run out of ideas. Any help will be much appreciated.
Many thanks in advance.
Comment: They say it is possible to say _trochotomising_ [as well](http://www.drbilllong.com/Words/Thrix.html).
Comment: If you've got some external criterion categorical variable you can try _optimal binning_.
Comment: Welcome to the site.  You don't need to add your name, the system does it automatically.
Comment: Closely related topics may be worth some research, George, including [Gaussian mixture models](http://stats.stackexchange.com/search?q=[mixture]+%2Bgaussian) and [Binning sorted data](http://stats.stackexchange.com/search?q=Jenks&submit=search).
Answer: From your description, you seem to have 8 observed responses, each with 5 possible values. Your approach thus far seems to be adding up the total number of points (0-40) and then treating this like a continuous variable. Your question then is how to best categorize this variable.
Another option is to take a latent class approach (synonyms or closely related models you might run across are "model based clustering", "finite mixture modelling", "Gaussian mixture modelling", and "latent profile modelling" - the differences usually are due to the nature of variables used, but the underlying concept is the same for all of these).
The basic idea is to assume that your sample includes a set of unobserved (latent) groups, and that conditional on belonging to a specific group, your observed response items are independent (uncorrelated).  This approach is data driven, in that you only specify the number of groups, and then the model will give you some idea of who goes in which group, based on their observed responses. In practice, you will likely try several different models, each specifying a different number of groups (e.g. 1,2,3,4,5) and select the "best model", usually based on some combination of theory/interpretation and model fit. Group membership can then be related to your dependent variable, assuming that your model does a good job of putting people into groups.
There is a really gentle introduction to this in a small, inexpensive book by Allan McCutcheon (http://books.google.co.uk/books/about/Latent_Class_Analysis.html?id=dCbJ6NcH4mAC). Otherwise search for the terms I listed above. You'll quickly find examples using Likert response data.
Comment: Many thanks for responses - I will look into suggestions made
Answer: If your data is really normally distributed (or as close as can be, given 0-40 count) then it doesn't really split into 3 groups based on the data itself. However, since you say you can visually recognize three groups, it is unlikely that it is really normal.
However, given that, I think you can say that you split the data into three groups based on theory and on visual inspection of the data; you can then show the data (a density plot with a kernel smoother might be good; or a strip plot) and explain how you did this.


Why isn't the identity $\sqrt{ab}$ = $\sqrt{a} \cdot \sqrt{b}$ always true?

Question: If we take $a=b=-1$ then the L.H.S. is $1$ but the R.H.S. is $-1$.

Is this identity not applicable for complex numbers?
How to prove this and prove that this is not applicable for some complex numbers?
Comment: In other words, you make a choice. Which is what I said at the beginning. And, as long as you stick to positive reals, your identity holds, despite of always employing the same manner of choosing. But, as we move from the real to the complex, where negative and positive no longer exist, since the complex numbers aren't ordered, if you persist in making your choice based on the same rigid algorithm, your identity will inevitably break down. If you want to maintain it, you would have to allow for variation in choosing which value to adopt for your radical.
Comment: Each radical of order *n* is a choice between *n* contenders.
Comment: @Lucian Sorry, I cannot understand what you say.
Comment: $\sqrt1=\pm1.\quad\sqrt{-1}=\pm i$.
Comment: @Lucian But I previously read that when we use the sign "√", we take the positive value only.
Answer: It is not true for all complex numbers, no.
You've given precisely a counter-example to the claim that $\sqrt{ab}=\sqrt{a}\cdot \sqrt{b}$ holds.
Comment: Great, then you have your counter-example!  Providing a counter-example is precisely a proof that a claim *does not* hold.
Answer: The root function behaves differently for complex numbers, because:

Over the reals, we only take the positive number, so $\sqrt{9} = 3$, but not $\sqrt{9} = -3$
Over the complex numbers, we take all possible roots, so $\sqrt{-9} = 3i$, but also $\sqrt{-9} = -3i$. That is the fundamental difference. In fact when we say we use the complex square root, we have $\sqrt{9} = 3$ and $\sqrt{9} = -3$.

It is indeed confusing that we use the same symbol for a different function.
Then I want to say that $i^2=1$, but $i$ is not $\sqrt{-1}$. We have that $\sqrt{-1}=\pm i$.


No route found for custom REST resource

Question: I'm trying to create a custom REST GET resource for a specific node type, and I have the class created and enabled via the REST UI module settings (using the current 1.x-dev release so configs are generated w/o me having to manually create a routing.yml file). For reference, here's the class code:
<?php
/**
 * @file
 * Custom Rest resource for video nodes.
 */

namespace Drupal\video_export\Plugin\rest\resource;

use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Drupal\Core\Session\AccountProxyInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Psr\Log\LoggerInterface;

/**
 * Provides a resource for database watchdog log entries.
 *
 * @RestResource(
 *   id = "video_export_source",
 *   label = @Translation("Video Export Source"),
 *   uri_paths = {
 *     "canonical" = "/videos/feed/{site}"
 *   }
 * )
 */

class VideoExportResource extends ResourceBase {
  /**
   *  A curent user instance.
   *
   * @var \Drupal\Core\Session\AccountProxyInterface
   */
  protected $currentUser;

  /**
    * @param array $configuration
    *   A configuration array containing information about the plugin instance.
    * @param string $plugin_id
    *   The plugin_id for the plugin instance.
    * @param mixed $plugin_definition
    *   The plugin implementation definition.
    * @param array $serializer_formats
    *   The available serialization formats.
    * @param \Psr\Log\LoggerInterface $logger
    *   A logger instance.
    * @param \Drupal\Core\Session\AccountProxyInterface $current_user
    *   A current user instance.
  */
  public function __construct(
    array $configuration,
    $plugin_id,
    $plugin_definition,
    array $serializer_formats,
    LoggerInterface $logger,
    AccountProxyInterface $current_user) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);

    $this->currentUser = $current_user;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->getParameter('serializer.formats'),
      $container->get('logger.factory')->get('rest'),
      $container->get('current_user')
    );
  }

  /**
    * Responds to GET requests.
    *
    * Returns a list of video nodes to be imported into the target site.
    *
    * @return \Drupal\rest\ResourceResponse
    *   The response containing a list of bundle names.
    *
    * @throws \Symfony\Component\HttpKernel\Exception\HttpException
 */
  public function get($site = NULL) {
    $response = ['message' => 'Hello, this is a rest service'];
    return new ResourceResponse($response);
  }
}

However, when I access my URL via http://mysite/videos/feed/sourcesite?_format=xml, all I get is this error:

  No route found for "GET /videos/feed/newsbusters"

and my debugger doesn't even hit my get() function. In reading the RESTful Web Services API overview docs it appears that I might be missing the second part of the uri_paths setting in the class annotation. However, the example doesn't make sense to me for my use. if the canonical url is just /videos/export/{site} (where {site} is a parameter), what is the correct second part? Just http://myite.com/videos/export?
Or,
Thanks.
Answer: As far as I can see, the REST UI module is just thought to change the content of the YAML files for the REST resources. It is up to the module correctly define the URL to use.
In your case, the annotation of the class should contains:
 uri_paths = {
   "canonical" = "/videos/feed/{site}",
   "https://www.drupal.org/link-relations/create" = "/videos/feed"
 }

I am not sure the placeholder makes any difference, but all the examples use {id}.
Comment: I don't understand the importance of the `https://www.drupal.org/link-relations/create` path. What is that supposed to do?
Comment: I think this somehow related to fake a bit the core implementation. Otherwise, the API will expect the request to use the /entity/{entity_type} endpoint.
Comment: I'm wondering the same question as wonder95, what is the significance?

No route found for custom REST resource


How to properly parse a dictionary array

Question: I'm trying to parse the observed wind speed value from the following json as a float (5.586995). The code below returns the value as an array (["5.586995"]). Is this the best approach in Swift 3? Any help is much appreciated.
<code>{
   "properties":{
      "platform_type_description":"Weather and Sea Surface Data",
      "parameters":[
         {
            "id":"wind_speed",
            "units":"m s-1",
            "depth":{
               "value":"0",
               "units":"m"
            },
            "observations":{
               "times":[
                  "2017-04-21T14:08:00"
               ],
               "values":[
                  "5.586995"
               ],
               "quality_levels":[
                  "3"
               ]
            }
         },
         {
            "id":"wind_speed_of_gust",
            "units":"m s-1",
            "depth":{
               "value":"0",
               "units":"m"
            },
            "observations":{
               "times":[
                  "2017-04-21T14:08:00"
               ],
               "values":[
                  "7.39788"
               ],
               "quality_levels":[
                  "3"
               ]
            }
         }
      ]
   }
}

func getWind() {

    let url = URL(string: "http://windapp.dev/")!

    URLSession.shared.dataTask(with: url) { (data:Data?, response:URLResponse?, error:Error?) in

        if error == nil {
            if data != nil {
                do {
                    let json = try JSONSerialization.jsonObject(with: data!, options: []) as! [String:Any]

                    guard let properties = json["properties"] as? [String:Any],
                    let parameters = properties["parameters"] as? [Any],
                    let windspeedDict = parameters[0] as? [String:Any],
                    let observationsWindSpeedDict = windspeedDict["observations"] as? [String:[String]]

                        else {
                            print("Error!")
                            return
                        }

                        for (key, value) in observationsWindSpeedDict {
                            if key == "values" {
                                print(value)
                            }
                        }

                        } catch {}

                            }
                    }  else {
                        print("Error: Couldn't connect to server")
                        }
            }.resume()
    }
</code>
Comment: This depends on your data model. Do you ever expect to have more or less than one value?
Comment: Show the code you have so far. If you got the array cast the first item to Double.
Comment: @PedroCastilho No. The value returned will always be a single float value.
Answer: This is the expected result, since the JSON contains the float value as a value of an array with only one element and you make value the whole array when iterating through your dictionary.
If you know your data will always look exactly like this, you should make your parsing function more specific and don't save any values as Any. If this is a response from your own backend and you think your project will get quite complex, you could use a 3rd party service (for example Swagger, though it has quite a few bugs) enabling you to write a more abstract specification of your JSON and generate both server and client side code automatically. However, I would only recommend this for large and complex projects.
Other than that I think your method is an optimal approach for parsing this response.


Adicionar 'swipe to refresh' para WebView

Question: Sou relativamente novo na programação para Android e gostaria de saber como adicionar a funcionalidade Swipe to refresh [puxar para cima para atualizar] no meu app. Quero que ao puxar para cima, a WebView seja atualizada.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="br.com.gamersboard.agoravai.MainActivity">

                <WebView
                    android:id="@+id/webView1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    tools:layout_editor_absoluteX="8dp"
                    tools:layout_editor_absoluteY="8dp" >
                </WebView>
</android.support.constraint.ConstraintLayout>

-
package br.com.gamersboard.agoravai;

import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {

    SwipeRefreshLayout swipe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        getSupportActionBar().hide();

        WebView wv = (WebView) findViewById(R.id.webView1);

        WebSettings ws = wv.getSettings();
        ws.setJavaScriptEnabled(true);
        ws.setSupportZoom(false);

        wv.loadUrl("https://meusite.com");

  }

}

Answer: Você pode usar o SwipeRefreshLayout e o NestedScrollView no seu XML que consta no android.support.v4. Veja abaixo como resultaria seu XML:
XML main:
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <WebView
                android:id="@+id/webView1"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </android.support.v4.widget.NestedScrollView>
    </android.support.v4.widget.SwipeRefreshLayout>
</android.support.constraint.ConstraintLayout>

Para atualizar a página, basta usar o método setOnRefreshListener com o método reload() em relação ao Webview. Veja:
Classe Main:
private WebView wb;
private SwipeRefreshLayout mySwipeRefreshLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    mySwipeRefreshLayout = (SwipeRefreshLayout)this.findViewById(R.id.swipeContainer);
    wb = (WebView) findViewById(R.id.webView1);

    WebSettings ws = wb.getSettings();
    ws.setJavaScriptEnabled(true);
    ws.setSupportZoom(false);
    wb.loadUrl("http://www.globo.com/");
    wb.setWebViewClient(new MyWebViewClient());

    mySwipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            wb.reload();
            }
        }
    );
}
private class MyWebViewClient extends WebViewClient {

    @Override
    public void onPageFinished(WebView view, String url) {
        mySwipeRefreshLayout.setRefreshing(false);
        super.onPageFinished(view, url);
    }
}


Create a probability model from discrete data

Question: I have a set of data about how long a task takes that I expect to be normally distributed (fits a bell curve).  I would like to create a curve/distribution that fits this data as best possible so that I can simulate the task with a computer program.
For example, my data says an individual task took someone 10, 20, 21, 23, and 35 seconds on their various attempts at doing this task.  I'd like to create a function that let's me randomly simulate someone performing this task where the probability of each outcome roughly matches the distribution of the input data.
How would I go about doing this?  Alternatively, what technique should I be searching for that would show me how to do this?  (For reference, I'm a computer programmer too many years removed from college statistics and math courses.  I am having trouble figuring out how to turn the discreet data points into a normally distributed curve that I can feed random numbers to.)
Answer: First of all, this kind of problem is very common.
If your hypothesis of a normal distribution, one must calculate the mean and the variance of the sample provided you have enough data (they are estimators of the mean and the variance).
$m = \frac{1}{N} \sum_i X_i$ for the mean and $\sigma²=\frac{1}{N-1} \sum_i (X_i - m)^2$.
Now you must plot your normal function to check if your model is correct (and the squared difference between the model and the sample):
Comment: Much appreciated!  It might be a very common problem, but for the life of me I couldn't remember the right terms to search for it properly.  This is exactly what I was looking for.
Comment: @LCC : No problem!


How to get the behavior of `git diff master :` in Rust git2

Question: I want to compare my local repository only with a sub-directory of my remote. Though native git command, I can achieve this by:
git diff master :>directory>
How can I achieve this through Rust git2 crate?
Comment: In the C library it should be obvious from the name `git_diff_tree_to_tree`. Does the Rust wrapper pretend that only commits can be diffed or something?
Comment: Or are you confused about the `revparse` part?
Comment: I was confused how to achieve the tree for `:>directory>`. But I think I can achieve that through walking the tree pointed at the given commit thanks
Answer: As mentioned by @o11c, this is exposed in the C library by the git_diff_tree_to_tree function, which corresponds to Repository::diff_tree_to_tree in Rust.
master would be passed in the old_tree parameter,  in new_tree, and <directory> can be specified with the opts parameter, constructed using DiffOptions::pathspec.
Comment: I'm pretty sure `pathspec` is for `git diff tree1 tree2 some/dirs`, which is not what OP wants. The second argument needs to be the *tree*, which I think is looked up using `repo.revparse_single` and then unwrapped somehow.


Add tr element into another table using jquery

Question: How to move some element in table row, into another table with jquery, i'm not sure with 'append' because it need session too, which is the best method, using ajax, json, php (cart), or maybe angular, any advice will be appreciated
like when i click add on the first row, it will shown like this
Fiddle >>

                  Part Number
                  Desc
                  Het
                  Cart

                  1,001
                  Lorem
                  ipsum
                    Add

                  1,002
                  amet
                  consectetur
                  Add

                  1,003
                  Integer
                  nec
                  Add

                  1,003
                  libero
                  Sed
                  Add

                  1,004
                  dapibus
                  diam
                  Add

                  1,005
                  Nulla
                  quis
                  Add

                  1,006
                  nibh
                  elementum
                  Add

                  1,007
                  sagittis
                  ipsum
                  Add

                  1,008
                  Fusce
                  nec
                  Add

                  1,009
                  augue
                  semper
                  Add

                  1,010
                  massa
                  Vestibulum
                  Add

                  1,011
                  eget
                  nulla
                  Add

                  1,012
                  taciti
                  sociosqu
                  Add

                  1,013
                  torquent
                  per
                  Add

                  1,014
                  per
                  inceptos
                  Add

                  1,015
                  sodales
                  ligula
                  Add

                  No
                  Part Number
                  Desc
                  Qty / Unit
                  Desire QTY
                  Het ( $ )
                  Estimate Total ( $ )
                  Delete

                  1
                  Lorem
                  ipsum
                  1
                  JS Spinner ( - ) 3 ( + )
                  $12
                  $36
                    Delete

CSS :

.part-container {
    width: 100%;
    display: block;
    height: 551px;
}
.part-right {
    width: 100%;
    float: left;
}
.red {
    background: red;
}

Comment: Which row you want to add and in which table?
Comment: Give `Add` button a click event. Get the data from it's row. Insert into the next table a row.
Answer: Moving a row over is pretty easy. In your click even for your Add link you need to create a copy of the row that was clicked.
var tr = $(this).closest('tr').clone();

This duplicates the clicked row and with our next line we move it to the second table.
$('.tbl-two').append(tr);

Example
As for sessions you'll need to at least store the Part ID into a variable. If the variable doesn't exist in a session, create it, if it does exist append the Part ID to the end of the variable with a delimiter such as ,.
However creating a 'shopping cart' table is a bit more complicated than copying a row over.
Answer: Well, you have lots of things to understand. What you want to achieve is client side which requires javascript. Jquery or use of other javascript frameworks is up to you to achieve same result. if you are trying to record this action (you can do AJAX style or regular post/get style) to database or session than you need to dive into serverside scripting and again you have many options in that world too. To achieve this client side simply I will bind an event to clicked row and append the row to another table and remove from original one. You need to learn DOM manipulation. JQuery is pretty good with DOM manupilation. I would suggest you to use that.


Is there a way to open two source files simultaneously in Qt Creator 2.3?

Question: I'm using dual monitor, so I would love to drag my current source view to another window so that I can compare it with others. Unfortunately, I couldn't find an option that let me do this in Qt creator 2.3. I wonder is there a way to do this in Qt Creator? My current version is 2.3.1.
Answer: You can split the text editor in "Window" > "Split side by side". Then just make the Qt Creator application spread over your two screens, and manually move the split bar to the center.
Comment: is there a way to scroll both windows?
Answer: <code>Press Ctrl+E, then press 2 to get split view.
Press Ctrl+E, then press 3 to get side-by-side split view.

To go to the other split, use Ctrl+E, then press O (alphabet O)
Delete current split - Ctrl+E then press 0 (number zero)
Delete all splits instead of current - Ctrl+E then press 1
</code>
For more keyboard shortcuts, see https://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html


Why does the C7 chord on guitar omit the G note (5th) in open position?

Question: <code>0 C7
</code>
C7 ( 1-3-5-flat7) is suppose to contain a G as its 5th right?  So how does a guitar get away with this in open position?
Comment: If the G string wasn't fretted, it wouldn't be a C7 chord, now, would it? (it'd just be a C chord)
Comment: It doesn't get away with it. That chord is properly named C7(omit5).
Answer: Two reasons.

You don't have enough fingers to play it.
The fifth is the most expendable note in a 7th chord (1-3-5-7).

Without the 7, it wouldn't be a 7th. Without the 3rd, it wouldn't be major or minor. Without the root, it wouldn't be the chord that it is. But the fifth doesn't contribute any vital property of the chord.
There is this other fretting option which gives you a G:
<code>%X/X.3/1.5/3.3/1.5/4.3/1[C7]
</code>
Comment: @Vigrond: If you have a bass playing the root you may omit that.
Comment: The fifth is usually the first to go, I think. But with an 11th chord, the 7 is still pretty vital, usually. YMMV.
Comment: Once you get past 7th, theoretically, you need to keep that 7 in the chord. However, particularly on guitar, there are not enough fingers, or strings, or handy frets to play all of the 'required' notes.Often, you can put all of the notes in, but the voicing comes out sounding bad.So, put in what sounds good ! 9th needs 7 and 2, 11th needs 7 and 4, 13th needs 7 and 6, as a guide.
Comment: The natural 5th is the second most consonant sounding interval after the octave. Usually the next expendable interval is the natural 11th in case of a 13th chord (the 9th needs to be contained and so does the 7th).
Comment: @Vigrond if you're playing with a band you can often omit the root, as it's covered by the Bass.  And of course it depends what's going on in the melody of the song.  Chords with no third leave the tonality to be determined by the melody instruments.  There are all kinds of creative possibilities for how you want to "voice" your chords.  Spacing between notes is just as important as which notes you choose too.  Thats why the "hendrix chord" (0 7 6 7 8 x) sounds so sweet.  Generally higher up, note clusters sound good, and lower down you need more space, but there are no rules.
Comment: There are enough fingers! The one which plays the low C can (and in my case usually does) spread across to also cover G on the bottom string. It makes it 2nd inversion, but I have no aversion to inversions.
Comment: great answer, thank you.  Are there any other expendable intervals?  Like, can you omit the 5th and 7th of a 11th chord?  and it would be okay?
Answer: One reason why the perfect fifth can be left out is that the note is sounded within the root. It's the second harmonic, so it's there anyway, albeit in a quiet way, although some instruments will let it sound better than others.
However - there's always the option of putting in a G on the bottom string, 3rd fret, using the ring finger across the bottom two strings.A chord doesn't have to have root at the bottom, although a lot of people seem to think it does. Luser's option actually gives the opportunity to play two G notes, if the chord is barred across all six strings - another second inversion, quite acceptable and playable.
Comment: thank you.  I'm not sure if my basic understanding of music theory is enough to understand your answer.  Are you saying the "C" note (root) has underlying "G" tones?
Comment: Yes, the fundamental note of C has - 1st harmonic C (octave higher), 2nd harm.G, 3rd harm.C (another oct.up), 4th harm. E,  5th harm. another G. Tends to be quite weak after that ! To find them on guitar, touch a string at 12th fret (1st h.) 7th fret (2nd h.) 5th fret (3rd h.) 4th fret, (4th h.)


Can someone please help me understand how a regression model with more variables might be sig when a simpler model is not

Question: Basically, I reduced a mixed effects linear model from 16 total factors/interactions down to 7 with most remaining factors being 'significant' (~ .05) or highly relevant to the design (and still close to .10). It looks good and it is theoretically sensible. BUT if I test at least a few of those factors by themselves, their p is closer to .3 or above.
This is apparent in the post-estimation plots for each model as well (obviously), but I am just keen to understand why the complex model results in one outcome, and why I can or cannot trust that versus the simple model with only the single factor.
Many thanks.
Comment: _Can someone please ELI5 why..._  There are some issues with the title. Please check and fix the typos.
Answer: You're conducting two fundamentally different tests. When you fit the full model, in the table of parameter estimates and SEs, each p-value listed corresponds to the test of whether the coefficient of the corresponding predictor is 0 after having adjusted for all the other predictors in the model. In contrast, when you fit a model with just one predictor, you are not adjusting for the effects of the other predictors.
As an aside, I'm concerned about how you "reduced" your model. If you did so by attempting to remove insignificant effects, you technically shouldn't then report p-values associated with the final model. (By doing so, you are effectively assuming that the coefficients of all the predictors you removed are exactly 0 -- which is almost certainly incorrect -- and potentially rendering inference based on your final model invalid.)  Why not just leave all the predictors in the model and then conduct inference?
Comment: @pazmuffin That's called stepwise regression. Yes, people do it, yet there are considerable problems. [This](https://www.stata.com/support/faqs/statistics/stepwise-regression-problems/) explanation of why comes from a Stata webpage, but the statistics theory does not rely on any particular software (it is correct whether you use Stata or SAS or SPSS or Python or R or Julia or…). The gist is that you're calculating the p-value as if you hadn't done the variable screening, and this ruins the inferences downstream of that screening step.
Comment: Thanks for the response. That does make sense. Regarding model reduction, I was taught (and recently read) that one reduction method was to run the model, pull out non-significant effects (typically starting with higher order interactions), and then re-reunning the model with the reduced terms. Then repeating this process until there was a smaller subset only including significant, or near significant terms.
Comment: Thanks Dave. So it's preferable then to just run the complete model, and leave in all factors despite them having very small coefficients and high p-values? The model itself is inherently subjective (I am picking and choosing the factors based on some degree of pertinence) so at what point am I cherry picking effects anyways? Meaningful inference is all I really care about, and fyi these data are exploratory behaviour data.
Comment: Should also point out that it's a relatively small sample (n~35, each with 4 scores), but the best we could do given our constraints/costs.


Axios GET Request Response is Undefined

Question: I'm trying to make an axios call in my Node JS Express app and sending the data to my index.ejs file.
The problem is that i can see the data in my callApijavascript file but i cant access the response in my app.js (undefined value).
This is the relevant code from my app.js file:
 //iNDEX pAGE RENDER
app.get('/', function (req, rep) {
    var response = callApi.GetAll();
    var users = response.users;
    var activities = response.activities;
    console.log('Users ' + users);
    console.log('Activities ' + activities);
    rep.render('index', {
        users: users,
        activities: activities
    });
});

Here's my callApi.js
the logs here return the api data perfectly
var GetAll = function () {
  axios.all([
      axios.get(initGet.uri + 'users/'),
      axios.get(initGet.uri + 'activities/')
    ])
    .then(axios.spread(function (userResponse, activitiesResponse) {
      console.log('User', userResponse.data);
      console.log('Activities', activitiesResponse.data);
      return {
        users: userResponse.data,
        activities: activitiesResponse.data
      };

    }));

};
module.exports = {
  GetAll: GetAll
};

My Error when i run index.ejs
{"error":{"message":"Cannot read property 'users' of undefined"}}
Thanks in advance.
Comment: favor traduzir sua pergunta, este é o Stackoverflow em português
Answer: Se GetAll é uma função ela precisa de ter um return. Neste momento assim como está a função não retorna nada... quando deveria retornar uma Promise.
Adiciona um return aqui:
var GetAll = function () {
  return axios.all([

Repara ainda que para consumires o resultado de uma Promise tens de usar o then. Assim o resto do código tem de estar dentro de um then. Ou seja:
callApi.GetAll().then(response => {
    var users = response.users;
    // o resto do código aqui...
});

Duas sugestões:

usa letras grandes só para construtores. Quando vejo GetAll penso que a intenção é usar new GetAll();, que não é o caso.
usa const e let sempre que possível. Deixa a "velhinha" var ficar para a história.
Comment: Muito obrigado agora funciona!
Consegui tudo o queria!
Comment: @AfonsoMartinho ótimo! Se quiseres podes clicar para marcar a resposta como aceite.

Axios GET Request Response is Undefined


Clarification about the order of variables used in a function

Question: I've been fighting with this PHP-snippet for some hours and I can't figure it out...
How does PHP determines the order when to pass the variables in this snippet:
function myfunction ($left, $right) {
    echo $left;
    echo '
';
    echo $right;

}

$a = array ('one', 'two', 'three', 'four');

usort($a, 'myfunction');

In this case, the variables are passed like this:
$left = 'two'   - $right = 'one';
$left = 'four'  - $right = 'two';
$left = 'three' - $right = 'two';
$left = 'four'  - $right = 'three';

But how is this sequence determined?!? I've been cracking my head and couldn't find any logic...
Comment: Sorry, but why does this matter? `usort()` is designed to sort your data based on the callback, why does it matter what it does internally? If you really want to know you will have to look at the source code. If you are looking at this because you are thinking of using `usort()` to loop your array (or something) I suggest you need to take a hard look at your program structure...
Answer: usort uses the quicksort algorithm. You'll see that if you change your function to return one of the expected values (-1, 0, 1), the results will be different:
function myfunction ($left, $right) {
    echo $left, ', ';
    echo $right, "
";
    if ($left == $right) {
        return 0;
    }
    return ($left  < $right) ? -1 : 1;

}

$a = array (1, 2, 3, 4);

usort($a, 'myfunction');

/* output:
2, 1
2, 3
4, 2
3, 2
4, 3
*/

/* output when null is returned, as your function does:
2, 1
4, 2
3, 2
4, 3
*/

From the article:

Quicksort first divides a large list into two smaller sub-lists: the
  low elements and the high elements. Quicksort can then recursively
  sort the sub-lists.
The steps are:

Pick an element, called a pivot, from the list.
Reorder the list so that all elements with values less than the pivot come before the pivot, while all elements with values greater
  than the pivot come after it (equal values can go either way). After
  this partitioning, the pivot is in its final position. This is called
  the partition operation.
Recursively sort the sub-list of lesser elements and the sub-list of greater elements.
Comment: There are plenty of tutorials out there that break down the quicksort with examples. Basically, it grabs a value in the middle of the array and uses that as the *pivot point*, comparing the other values to it. Here's a good one: http://www.algolist.net/Algorithms/Sorting/Quicksort
Comment: So, if I understand correctly, there is no (easy) way to predict the sequence of `usort`?


Firefox float right behaviour

Question: I have a simple menu (jsFiddle). The float: right css is not working well in FireFox. I think it should work like in Chrome/IE, the red cube should be inline with the menu item.
Somebody knows why is this? Or how to correct it....
Answer: The element you are floating should be defined before the content that you want to float around it. Move the red boxes to be before the text, and it should work fine.

Firefox float right behaviour


Proof of $\operatorname{Corr}\left(X, Y\middle|Z\right) = \operatorname{Corr}(X-\hat X, Y-\hat Y)$

Question: The text I'm reading claims that for multivariate $X$, $Y$, and $Z$, and $\hat X$ and $\hat Y$ are the regression of $X$ and $Y$ on $Z$ we have that

$$\operatorname{Corr}\left(X, Y\middle|Z\right) = \operatorname{Corr}(X-\hat X, Y-\hat Y)$$

However, there was no derivation of this claim. What steps are required to show this identity, and why is the assumption of normal variables required?
Comment: $\operatorname{Corr}(X,Y|Z)$ is perfectly fine notation, see e.g. https://en.wikipedia.org/wiki/Law_of_total_covariance whereas $\operatorname{Corr}(X|Z,Y|Z)$ is not.
Comment: Do you mean $Corr(X|Z, Y|Z)$, or just $Corr(X, Y|Z)$? In the first, you regress Z out of both X and Y; this is the partial correlation between X and Y conditional on Z. In the second, you regress Z out of only Y; this is a semipartial correlation with Y conditional on Z.
Comment: Ah, that's unfortunate notation. I intended $\operatorname{Corr}\left((X,Y)\middle|Z\right)$, which I believe corresponds to $\operatorname{Corr}\left(X|Z,Y|Z\right)$?
Answer: This is definitional and comes from the fact that $$X_i = Z_i\beta_x + \epsilon_{xi}$$, $$\hat{X}_i = Z_i\beta_x$$ and $$X_i|Z_i = \epsilon_{xi} = X_i - Z_i\beta_x = X_i - \hat{X}_i$$ (and the same for $Y$). These all come from the definition of regression. Then you can simply substitute: $$Corr(X,Y|Z) = Corr(X|Z, Y|Z) = Corr(X - \hat{X}, Y - \hat{Y})$$.
Comment: This doesn't look right to me.  Your equation $\hat{X}_i = Z_i \beta_x$ uses the true coefficient $\beta_x$ rather than the corresponding OLS estimator.  You seem to be looking at the true error terms rather than residuals.
Comment: So there is no need to assume the variables to be normal?
Comment: @MartijnWeterings In general $\operatorname{Corr}(X,Y|Z)$ depends on the value $Z$ we condition on.  So the left hand side don't necessarily equal the right hand side (which is just some constant) except in the multvariate normal case.
Comment: Perhaps I'm wrong (I think I received a downvote for this one), but I don't think you need that assumption.
Comment: That's true, and probably an oversimplification, but I believe this identity works on both the error term and the residuals, i.e., in both the population (using the true $\beta_x$) and the sample (using the estimated $\hat{\beta}_x$). The quantity $X|Z$ doesn't imply that we're in sample mode, and nothing about the structure of the proof necessitates examining either the sample or population.
Comment: -1 This equality is certainly not necessarily true unless we are talking about a multivariate normal distribution.
Comment: @JarleTufto why does the distribution matter? If $\hat{X}$ refers to the true mean (instead of estimated mean) then don't we have $$X-\hat{X} - mean{(X-\hat{X})} = X \vert Z - mean{(X \vert Z)}$$?
Comment: @MartijnWeterings I'm not sure I understand your comment.  I believe $\hat X$ in the OP refers to the regression of $X$ on $Z$, or more precicely, the linear minimum mean square error predictor of $X$ based on $Z$.  So $\hat X$ is a function of $Z$.
Answer: For a multivariate normal random vector partitioned as $\mathbf{x}=\left[\begin{matrix}\mathbf{x}_1 \\ \mathbf{x}_2\end{matrix}\right]$, the conditional distribution of $\mathbf{x}_1$ conditional on on $\mathbf{x}_2$ is also multivariate normal with mean vector equal to the general expression for the best linear minimum mean square error predictor $\hat{\mathbf{x}}_1$ of $\mathbf{x}_1$ based on $\mathbf{x}_2$ (applying to any multivariate distribution) and, importantly, a variance-covariance matrix that does not depend on $\mathbf{x}_2$.
In the multivariate normal case we can thus write
$$
\mathbf{x}_1=\hat{\mathbf{x}}_1 + \mathbf{e}_1,
$$
where $\mathbf{e}_1$ is independent of $\hat{\mathbf{x}}_1$ and multivariate normal with zero mean and variance-covariance matrix equal to the the above conditional variance-covariance matrix.
Hence,
$$
\operatorname{Var}(\mathbf{x}_1-\hat{\mathbf{x}}_1) = \operatorname{Var}\mathbf{e}_1=\operatorname{Var}(\mathbf{x}_1|\mathbf{x}_2),
$$
that is, all variances, covariances and correlations of deviations from $\hat{\mathbf{x}}_1$ equals the corresponding conditional quantities.
This equality does not hold in general, however, as we can easily construct a multivariate distribution for which the conditional variance-covariance matrix of $\mathbf{x}_1$ depends on $\mathbf{x}_2$.
Comment: I believe I am a bit stuck in definitions. I get that the $x_2$ dependency of $Var(x_1|x_2)$ but would not equally the distribution of the heterogeneous error-term $Var(x_1-\hat{x}_1)$ change depending on $x_2$? Or is this term related to the residuals? Or is the term not considered to be conditional or evaluated over all $x_2$? It is a bit confusing that $\hat{x}_1$ is ambiguous.
Comment: $\hat x_1=\mu_1 + \Sigma_{12}\Sigma_{22}^{-1}(x_2-\mu_2)$ is just another random variable defined on the same sample space as $x_1$ so $\operatorname{Var}(x_1-\hat x_1)$ is just some constant whereas $\operatorname{Var}(x_1|x_2)$ may depend on $x_2$.


Getting facebook group id from group url

Question: i have tried to get facebook group id (gid) by it's url using C#, with no luck.
I have looked over the facebook graph tables, tried PHP, FQL queries, and even tried P3P to get the feed itself of the group page (To get the 'cid' value) - But again - with no luck, I'm getting a token successfully using facebook SDK but I dont understand how to use it to get the group id or the group source code (which always returns the login page), can you help ?
Comment: Can you give an example of the group url
Comment: For example: https://www.facebook.com/groups/progressivenagars
Answer: You can fetch the username from the url- string after last <code>/</code>. You can find how to do that. Then simply use the Search API.
You'll be needing a valid user access token with the API call-
<code>/search?q={group-username}&type=group
</code>
Example: https://graph.facebook.com/search?q=progressivenagars&type=group&access_token={access-token}
Comment: First of all, thank you for the answer!
Your solution indeed works, but only for some of the groups. And that is the real problem. For example - it won't work for the group 'dirotTA' (Link: https://www.facebook.com/groups/dirotTA).
The reason is probably because there is a user with that name exactly, and the result is the id of that user...
Comment: I'm not sure  but I think that's best what you can do! Since graph api wont give any results directly using the username unlike user's username
Comment: Well there must be a way because for example: lookup-id.com does that, and also other websites as well...
Comment: Well these sites are probably just parsing the webpages and nothing else, since these sites objective is just to get you the id; and parsing is not a big job. As far as what seems to me, using the graph api that's what you can do!
Comment: Any idea on how they are parsing the webpages ? I can't get the source code of the page since it sends me to the login screen when i'm trying.


Retornar uma lista de todas as strings no arquivo que contém a string procurada

Question: estou tentando fazer um método que varre uma lista (minha lista vem de um arquivo externo que uso readlines() para montar uma lista de strings) e compara com uma string passada por parâmetro. O retorno para meu teste funcionar precisa ser uma len(). Já tentei de varias formas e a unica forma que consegui foi essa aqui, porem, só consigo saber a quantidade de caracteres que existem na lista, um por vez e também não consigo calcular um caracter grande. Estou literalmente travado.
def buscar(self, string):
    arq = self.arquivo

    for linha in arq.readlines():
        novaLinha = []
        novaLinha.append(linha.rstrip())
        contTotal = 0

        for string in novaLinha:

            for p in string:
                cont = 0
                for w in string:
                     if w.startswith(p):
                         cont += 1

                     else:
                         cont = 0

                contTotal += cont
                print( p + ' aparece ' + str(cont) + ' vezes nas palavra ' + string)

Esse é o teste que preciso que passe.
    def test_01_buscar(self):
    arquivo = open('texto1.txt', 'r')
    sf = SearchFile(arquivo)
    self.assertEqual(len(sf.buscar('a')), 2)
    self.assertEqual(len(sf.buscar('b')), 1)
    self.assertEqual(len(sf.buscar('c')), 1)
    self.assertEqual(len(sf.buscar('z')), 0)
    self.assertEqual(len(sf.buscar('pinha')), 1)

Comment: "não consigo calcular um caracter grande", o que seria um "caractere grande"? Aliás, tem como explicar melhor o que pretende fazer? Tanto o texto quanto o código ficaram meio confusos de entender.
Answer: def arquivo_ler(search):
   quantidade = 0
   arq = open('lista.txt', 'r')
   texto = arq.readlines()

   #ler cada linha do arquivo
   for linha in texto :
      palavras = linha.split(' ')
      palavras_f = []

      #ler cada plavra da lina
      for p in palavras:
         palavras_f.append(p.replace('\n',''))
      print(palavras_f)
      for p in palavras_f:
         if(p == search):
             quantidade+=1
   arq.close()
   return quantidade

Essa função resolve seu problema localiza todas as ocorrência de uma palavra pesquisada e retorna a quantidade
Comment: Eu precisava que retorna-se uma lista, porem, consegui colocando ainda um método seek(0) no for para voltar no arquivo em sua posição inicial para ler a linha novamente, só então poder resolver o conflito do retorno ter um tamanho da lista para passar no teste.
Answer: Consegui resolver dessa forma, então meus testes passaram v:
    def buscar(self, string):
    lista = []
    texto = self.arquivo.readlines()

    for linha in texto:
        print(linha)
        if string in linha:
            lista.append(string)
    self.arquivo.seek(0)
    return lista


Modes over II-V-I

Question: I was listening to a piece and the bassist talked about playing several different modes over certain chords.
For example, over the first chord he was playing in D Dorian, obviously because it's a minor chord. Then he played D Locrian and phrygian over the V chord, saying these are available, along with many diminished and augmented scales. What I'm not understanding is that a lot of these notes aren't diatonic in the key of C major (the key of this progression). Finally, he played Dorian and mixolydian over the I chord for that #11 tension.
I'm a bassist and i tend to play in scales, arpeggios, and chords but as of late I'm trying to work on my soloing skills, hence this whole ordeal. If someone could help me understand why and how these modes are available that'd be great.
Also, when using this technique, how would you utilize it over a more busy progression? For example how about: IIm7-V7-I6 VIm7- bVI°7 VI7- IIm7 V7- IIIm7 VI7. (4/4 in C major, the dashes represent the end of each bar)
Comment: Not really...it's a question about a certain subject and technique. I give an example and then ask about applying it to another progression, i see that a lot on here. And why space everything out so much? I understand maybe having two paragraphs for this but it's kinda separated now. Please, leave me be.
Comment: MusicMan - when people edit its usually to make it clearer, and having your question split into 4 paragraphs is much easier to read than the block of text you had originally. Remember being easier to read is likely to get you better answers.
Comment: I apologize, my shift key doesn't work on my mobile device and i wasn't on my computer. I edited it though and spaced it out correctly. I just feel a little too criticized sometimes, I've seen far worst posts. Some without punctuation even.
Comment: If you do see ones like that, you can edit them or flag for mod attention - otherwise we may not see it.
Comment: Were you watching Rich Brown's bass lesson video? I just saw it, too, and it's awesome.
Answer: When it comes to soloing anything is "available" at any time. It just depends if it sounds good to you. The more notes that are diatonic to the key the more consonant or "inside" it will sound while more non-diatonic notes will make it sound more dissonant or "outside". As you're probably aware, this tension and release between dissonance and consonance is one of the key aspects of harmony.
What may be less obvious in your example is that a common trick in ii-V-I's is to go outside or purposefully introduce that tension on the V chord. So D Dorian over the Dm7 is diatonic and sets up the consonant sound of the key. Then over the G7 you have your options open to go a bit wild. You specifically want to create dissonance that can later be resolved so try focusing on creating something interesting rather than staying diatonic. Then on the I chord you bring it back home with resolution via consonance (by the way by the #11 I wonder if you mean Lydian which is common to avoid the natural F that sounds bad over a CMaj7).
That's just one way. You could introduce the tension over a different chord, never do it, or make it all dissonant and never resolve it. But what I described is one of the more common approaches.
If you search for something like "soloing over dominant chords" you'll find a lot of scales and modes to try out for that dissonance. But what those all come back to are highlighting extensions or alterations of the G7 in various ways. The less chord tones and/or the crazier the alterations the more outside it will sound. So part of choosing your mode/scale is deciding how far out you want to go.
(Obviously this only applies to solos. You'd stick closer to the diatonic scale and arpeggios when comping for somebody else. Otherwise you'd be stepping on their harmonic choices and creating chaos.)

EDIT: long response to comment

I have one quick question. Why is it all in D? Wouldn't you move to, let's say, G Locrian instead of D Locrian over the V7 chord? That V7 chord is a G after all. Is it preference? Would D Dorian-G Locrian-C Major be suitable?

D Dorian is essentially C Major and the reason that you use it over Dm7 is that Dm7 is the diatonic ii chord in C Major. Over the G7 you could move to G Mixolydian which again comes from C Major. So you're calling it something else but you're basically staying diatonic and thus producing an "inside" sound. If you wanted to play "outside" over the G7 you might pick a different mode/scale.
You'd have to ask said bassist why he chose to reference D modes over a G7. But you can just switch over to G—I personally prefer that—and change the name of the mode along with it. D Locrian is the same as G Phrygian and D Phrygian is the same G Aeolian.
As for why they work or not, I'd refer you back to what I said about it all coming down to chord tones, extensions, and alterations of those tones. You have a harmonic context that you're playing against. That is, the band is playing a chord and no matter what you play you could look at as either you're playing a note that's in that chord or you're not. If you play a chord tone it will sound inside/consonant and if you don't it will sound varying degrees of outside/dissonant depending on which note you play.
Now think of a scale or a mode as a shortcut to tap into that harmonic context without having to think about each note and how it relates to the harmony (not that that's a bad thing, but it's hard to do at first). You're picking a group of notes that are some degree of either inside or outside in a way that you're familiar with. As for how to get familiar with that I'd recommend two things:

Play them against chords to hear them
Write them out paying attention to which chord tones a particular scale gets you.

For example, with that G7 in mind as the context, let's write out the chord tones and the extensions:
G7

G   B   D   F   A   C   E
1   3   5  b7   9   11  13

Now we'll consider G Mixolydian as the prototypical example of "inside" because it has only the chord tones and unaltered extensions. Everything is just diatonic from the V7 chord and it's extensions.
G Mixolydian (C Major)

G   A   B   C   D   E   F
1   9   3   11  5   13 b7

And I guess it's arguable as to what could be considered the prototypical "outside" scale, but we'll use G Altered Dominant (aka G Super Locrian, the 7th mode of melodic/jazz minor). The point of the altered scale is that it has all of the altered extension notes: b9, #9, 3rd (b11 but you wouldn't actually call it that because it's already a chord tone as the 3rd), #11, b13, b7 (#13, same you wouldn't actually call it this).
G Altered (Ab Melodic Minor)

G   Ab   A#   B   C#   Eb   F
1   b9   #9   3  #11  b13  b7
            (b11)        (#13)

Now let's write out your D Locrian and D Phrygian as G Phrygian and G Aeolian, respectively:
G Phrygian (aka D Locrian, aka Eb Major)

G   Ab  Bb  C   D   Eb  F
1   b9  b3  4   5  b13 b7

G Aeolian (aka D Phrygian, aka Bb Major)

G   A   Bb  C   D   Eb  F
1   9   b3  4   5  b13 b7

In both, one thing to note is that they both contain a G Minor Pentatonic scale and some extensions/alterations. The minor pentatonic is a common scale over dominant chords in blues and rock as you may be aware—it's typically the first thing people try soloing with—and the extensions give it some extra outside flavor.
G Minor Penatonic

G   Bb   C   D    F
1   b3   4   5   b7

So as far as inside/outside your examples are going to fit somewhere in the middle between inside and outside leaning a bit more outside but in a familiar way given that they contain the G Minor Pentatonic.
Any time you're unsure if or why a scale/mode works, just write it out and see what chord tones it's getting you. And of course listen to it to see if you even like the sound.

I know many things are available but I'm afraid of taking that concept too far

You'll have to use your ears for that part. There's not much theory to help with it because it's a matter of taste. If it sounds too boring to you, go a bit further outside. If it sounds too dissonant, go back inside a bit. Also pay attention to where you play what notes. Playing outside tends to work better if you use inside notes on strong beats and to resolve to.
Comment: I have one quick question. Why is it all in D? Wouldn't you move to, let's say, G Locrian instead of D Locrian over the V7 chord? That V7 chord is a G after all. Is it preference? Would D Dorian-G Locrian-C Major be suitable?
Comment: Could you help me answer this comment? I'm just feeling very unsure still. I know many things are available but I'm afraid of taking that concept too far
Comment: @MusicMan sure I've responded in an update to my answer above because I had way too many characters for a comment.
Comment: @MusicMan - I just happened to stumble across this video last night and I can confirm that this idea is specific to soloing.  The way he explained it, he was just using the modes in D as an example.  He stated earlier on that you could just solo over C major the whole time, so the use of the modes was another example of that.  A traditional approach to Jazz soloing is to use Chord Scales, a scale assigned to each chord type, where this is an alternate approach.  You could choose to have each mode you use based on the root of the chord it's over but that's just not how his example was framed.
Comment: @user37496 - I'd argue against your labeling of the tones for the altered scale.  b11 and #13 don't really describe the function of those notes.  They are 3 and b7 and function as such in a normal altered setting.  We could argue that there are instances of b11 and #13 but those are not at all common or representative of the function.  I also think that it could bring some confusion for someone trying to learn how to use those chords.  Otherwise, this is a great answer. +1
Comment: @Basstickler Yes I'm aware that the b11 and #13 are just chord tones. I mentioned that for the b11. I forgot to note that for #13, but I'll edit the post. But I chose to use those to emphasize the fact that the altered scale includes all altered extensions. I think that's more clear with the consistent flat and sharp labelling even if you'd never say you're playing a flat 11th.
Comment: But the idea is that that is not what those notes are, nor do those concepts apply to any standard theory.  In all of my schooling, I've never come across any concept of b11 or #13 outside of very obscure theory.  So thinking of them that way is just incorrect.  I get that you tried to specify that those are the chord tones but I think it would be misleading at best for the OP or any others that read this answer in the future.  Do you have any sort of source for this thought process?  I could be swayed by a good source but short of that, it seems like a bad idea to think of it that way.
Comment: @Basstickler Do I have any sort of source that the Altered scale is made up of the altered extensions? Is that what you're asking? Because it's in the name. And consistently illustrating the notes as b11, #11, etc just goes a bit further to make that obvious. I'm a bit baffled by your pedantic opposition to this even when there's an accompanying explanation. I'll switch the non-standard extensions into parens instead. If you still have an objection beyond that we'll just have to agree to disagree and you can add your own answer if you want.
Comment: The source I would be asking for would be one that would legitimize the use of b11 and #13.  This is not pedantry in my opinion.  I seek to provide useful answers or improve upon useful answers to give the best knowledge to the reader.  Referring to these notes as you initially suggested when talking with other musicians, they could potentially question your viability, or using them on a test would be considered wrong.  As a conceptually thought process I have no problem with it but as far as application goes, it's just not how people label those notes.
Comment: With the edits you've made, I don't really see a problem with it any longer.  I'm sorry if this seems pedantic to you but it's about accuracy and real world application to me.

Modes over II-V-I


How to run Crystal Reports with SQL Database Application on Client Machine

Question: I've a developed a desktop application with SQL Server DB. In d**evelopment machine, SQL Server was running with (local). I need to add **Crystal Reports in my application which should be working on client.
Here, question is what is needed to be on client machine to run successfully my application with database. Remember, on client side there is no SQL Server installed.
Help me in this regard.
Comment: Just note: you dont need to bold a lot of words like this
Comment: Is your desktop application pulling the data from the DB or is crystal Reports?  What format is the data comming in?
Comment: @Quinma: Data is in DB and Application uses Crystal Reports to display Data from DB.
Answer: In the case crystal is supposed to connect to the Database you will need to set up a connection in your OS to the database. You can use ODBC or some such with sql server 2008 driver.
Also, you will have to set up the report to use the SQL driver.
Comment: Its working on my machine, I'm talking about the Client machine. How can I setup connection of DB and Crystal Reports there. So, what should be added in pre-req to install and work smoothly for application.


Openapi Generator: Disable enum Unmarshal JSON check for generated Go enum values

Question: Is it possible to disable the check for valid values in the generated model for enum values?
When I have an enum the following code is generated:
<code>func (v *Status) UnmarshalJSON(src []byte) error {
    var value string
    err := json.Unmarshal(src, &value)
    if err != nil {
        return err
    }
    enumTypeValue := Status(value)
    for _, existing := range AllowedStatusEnumValues {
        if existing == enumTypeValue {
            *v = enumTypeValue
            return nil
        }
    }

    return fmt.Errorf("%+v is not a valid Status", value)
}
</code>
I have my own validation logic though, therefore I do not want to throw an error here.
Answer: I had the same issue. The current solution is to use an older generator version like v7.0.1 which isn't generate the method


automorphisms of the free group on two generators

Question: I know the group of outer automorphisms of $F_2$ (the free group on two generators) is isomorphic to $\text{GL}_2(\mathbb{Z})$. Let $\text{Aut}^+(F_2), \text{Out}^+(F_2)$ denote the subgroups of $\text{Aut}(F_2), \text{Out}(F_2)$ with image in $\text{SL}_2(\mathbb{Z})$. Then we have the exact sequences
$$1\longrightarrow \text{Inn}(F_2)\longrightarrow \text{Aut}(F_2)\longrightarrow\text{Out}(F_2)\longrightarrow 1$$
and
$$1\longrightarrow \text{Inn}(F_2)\longrightarrow \text{Aut}^+(F_2)\longrightarrow\text{Out}^+(F_2)\longrightarrow 1$$
I think I have a topological proof that at least the second sequence is split. Ie, there exists a section $\text{Out}^+(F_2)\rightarrow \text{Aut}^+(F_2)$.
Can someone with more background in group theory than me provide a group theoretic answer? (ie, whether or not the two sequences are split).
thanks
Comment: $F_2$ is the free group on two generators
Comment: In principal you could prove it by writing down appropriate automorphisms $\alpha,\beta$ of $F_2$ such that $\alpha^4=\beta^3=1$ and $\alpha^2$ commutes with $\beta$. The obvious choice for $\alpha$ (with $F_2 = \langle x,y \rangle$) is $(x,y) \mapsto (y,x^{-1})$ so $\alpha^2$ is $(x,y) \mapsto (x^{-1},y^{-1})$. I tried $\beta:(x,y) \mapsto(x^{-1}y,x^{-1})$, which has order $3$, but that does not commute with $\alpha^2$.
Comment: What is $F_2$? It's not clear.
Comment: Is it a free (abelian) group with two generators ?
Comment: It is not unusual for group theoretic statements to have hard group theoretical proofs but very easy topological proofs. (E.g. a sub group of a free group is again free)

Maybe you want to post your proof and we can check whether it is correct.
Comment: Unfortunately my topological proof is quite long as well, and involves some geometry as well as topology.

I was hoping that experienced group theory people might just know the answer off the top of their head.
Answer: Neither sequence splits. This is because $F_2$ has no automorphisms of order six but $\operatorname{SL}_2(\mathbb{Z})\cong C_4\ast_{C_2}C_6$ clearly does. For a reference that $\operatorname{Aut}(GF_2)$ has no element of order six see the paper Classification of automorphisms of free group of rank $2$ by ranks of fixed point subgroups by Oleg Bogopolski, J. Group Theory (2000).
(Note: Bogopolski's proof uses train track maps, if my memory serves me correctly. So his proofs are geometric. For an algebraic proof, I think you could use an outer automorphism $\widehat{\phi}$ of order six with representative $\phi$. If there is an automorphism of order $6$ then there exists a word $W(x, y)$ such that $(x, y)\mapsto (W(\phi(x))W^{-1}, W(\phi(y))W^{-1})$ has order six. This means that there exists some word $U$ such that $W=U\phi(U)\phi^2(U)\phi^3(U)\phi^4(U)\phi^5(U)$, and so I would induct on the length of a word $V$ to see how $\phi(V)$ can begin and end (if $V$ begins with $x$ then $\phi(V)$ begins with...etc). Then plug this together and work out if $W$ cannot be formed. This is a very messy approach though...I think, perhaps, the best way would be to think about fixed points (which is what Bogopolski is doing). Some automorphism of order six must fix the word $U\phi(U)\phi^2(U)\phi^3(U)\phi^4(U)\phi^5(U)$, so you have reduced the proof to thinking about fixed points. So look at this old MO question...)


Is it possible to add the same note with different accidentals in Guitar Pro 6?

Question: I want to add (in a single stem) the same note with different accidentals. Like, in the following example, in the third stem I want to have both G sharp and G natural.

Is there any way to do this in Guitar Pro 6?
I know that I can use Ab as G# or Fx as G natural, but I'm wondering if I can insert G with different accidentals somehow.
Answer: There is. I can think of two ways.
The easiest way would be to write the note as the enharmonic equivalent (Ab) and then click on the change accidental button (icon is a sharp and flat symbol, 5th row, 6th icon) in the side menu or press ctrl-alt-8 on the note to change it to a G#.
Secondly, you can use voices (The small 1,2,3,4 at the bottom of the score editor, above the timeline) to add the second note on a second voice.
If you need clearer instructions, I can upload a screenshot but I hope you can follow this.


Existence of an embedding from the rational numbers to $(0,1)$

Question: Is it possible to embed $\mathbb{Q}$ in $(0,1)$ (both with usual topology) ?
Comment: $\mathbb{R}$ is homeomorphic to $(0, 1)$.
Comment: @Theo Buehler: ah, didn't know that. Can you please post your reply as an answer?
Answer: On user10's request I'm posting an earlier comment of mine as an answer—even if it is more than overkill. Of course simply using the fact that $(0,1)$ and $\mathbb{R}$ are homeomorphic is the way to go. You can do this as suggested in Ross's answer.

Sierpiński proved in 1920 (apparently he proved it already in 1915 according to a footnote in the original article) that $\mathbb{Q}$ is up to homeomorphism the only countable metrizable space without isolated points.
In particular $\mathbb{Q}$ is homeomorphic to $\mathbb{Q}^n$, $\mathbb{Q} \cap (0,1)$ or indeed to any countable dense set in a perfect metric space.
The original paper is freely available here:
Wacław Sierpiński, Sur une propriété topologique des ensembles dénombrables denses en soi, Fund. Math. 1 (1920), 11-16 (pdf here).
As ccc points out a simpler proof along these lines would be to appeal to a result of Cantor's (I quote a comment to this answer):

[...] if you feel like using slightly less overkill, you can handle this particular problem with Cantor's theorem on the uniqueness of dense linear orders without endpoints, which I suppose can be viewed as a sort of "one dimensional" precursor to the quoted theorem of Sierpiński's.

A write-up of  Sierpiński's theorem and a few related things is e.g. contained in (jstor-link, needs university subscription):
Carl Eberhart, Some Remarks on the Irrational and Rational Numbers,
The American Mathematical Monthly, 84 (1) (Jan., 1977), pp. 32-35, MR644644.
Bruno recommends the article by Abhijit Dasgupta, Countable metric spaces without isolated points from Topology Explained, June 2005, published by the Topology Atlas which is an excellent source for everything related to topology.
Comment: Aha! I seemed to recall reading about this interesting thereom a couple of years ago. Of course, it was in Henno Brandma's collection of notes on topology. This one in particular is http://at.yorku.ca/p/a/c/a/25.htm .
Comment: thank you a lot, you have been very helpful! love this site.
Comment: I am in awe of your ability to dig up references so quickly.  Anyway, if you feel like using slightly less overkill, you can handle this particular problem with Cantor's theorem on the uniqueness of dense linear orders without endpoints, which I suppose can be viewed as a sort of "one dimensional" precursor to the quoted theorem of Sierpiński's.
Comment: @ccc: Thanks for that pointer, that's certainly easier and a nice way of looking at it. Finding stuff is not so difficult if one knows what one is looking for (I sort of remembered that it was Sierpiński or Kuratowski -- a Polish mathematician for sure)...
Comment: @Bruno: Thanks a lot! I added the reference to the answer.
Answer: Following  Qiaochu Yuan's comment, you can take $x \in \mathbb{Q} \to \frac{1}{2}+\frac{\arctan(x)}{\pi}$ for an explicit solution
Comment: Even $\frac12\left(1+\frac{x}{\sqrt{1+x^2}}\right)$, $\frac12(1+\tanh\,x)$, $\frac1{1+\exp(-x)}$ or any other "sigmoidal curves" ought to work...


How does the Risset Rhythm work?

Question: Many people know about the Shepard-Risset Tone/Glissando, which is a tone that starts low and seems to continue ascending(or descending) when you listen to it, even though it actually is playing the same thing over and over again.
Wikipedia has a nice article on this.
However, I read that Risset also made another sound illusion: The so-called Risset Rhythm, a drum loop that seems to keep on going faster and faster (Wikipedia does have an example of this, but no explanation). However, I'm unable to find any explanation of how this illusion works.
Could somebody explain it to me please?
Comment: It's a self-similar fractal.
Answer: Sounds to me like exactly the same principle.
The first rhythm gets faster and faster until it becomes a blur of noise and is removed from the sound, but over the top of that is superimposed the same rhythm at half speed. While you're listening to the first rhythm get faster, the second does the same, and eventually becomes the main focus of attention. By the time it does so, it's probably got to the point where you can just about hear it again at half speed.
The same piece of audio can contain both the original rhythm and half-speed version, so gets looped to create the illusion.
As you notice the rhythm getting faster, listen out for the same features, but in half-time.
Comment: Yep, definitely seems to be the same principle. I can hear the same thing going on; in fact, I could concentrate and isolate the slower  rhythms fairly easily in this recording: http://swiki.hfbk-hamburg.de:8888/MusicTechnology/uploads/826/Risset_accelerando_beat1.mp3
Comment: It sounds as if the volume of the rhythm is a bell curve function of it's closeness to "correct" speed. So, it fades in at approx half speed, reaches max volume at full speed, then fades out at approx double speed, always mixed in with its previous iteration.
Comment: Plus as the original gets faster and faster it gets shorter and hides (or blends) into the backbeat of the slower one so it's less and less audible. Not to mention that the faster sound exits as a *kind of* octave higher of the original snare accent.
Answer: I think that the effect is actually created solely based on the tone played after each repeat, which is sort of like the glissando in that it increases in tone forever, but the actual rhythm never speeds up. You can test this theory by listening to the sound, then quickly turning the sound off and counting time in your head, then adding sound back in. You will find that your time counting matches up PERFECTLY with the audio upon re-adding the sound back in.
Comment: This is simply false. Try tapping simple crotchets along with the entire recording. You won't be able to, because what are crotchets at the beginning end up as 64ths at the end.

How does the Risset Rhythm work?


Does a time signature imply accents?

Question: Does a time signature imply accents by default? For example, in 4/4 time should I accent every quarter beat? Should I accent the first beat of each bar?
If yes, how should I notate a piece where these beats should be without accents?
Comment: related: [this question](http://music.stackexchange.com/questions/568/is-there-any-real-world-difference-between-time-signatures-such-as-4-4-and-8-8)
Answer: Yes, indeed. The time signature together with an understanding of the musical style of the period in which the music was written tell you what the rhythm is and what the accents are supposed to be in general. Specific notes in specific measures might be written in such a way as to over-ride the default pattern.
For example, in classical music in general, in 4/4 time, the downbeat of the measure, the "1", is the strongest beat, and the other three beats are weaker. However, in rock music in 4/4 time, the strong beats are understood to be "2" and "4".
6/8 is a compound time. There are two beats in the measure, and each beat is further divided into three sub-beats. One beat is represented by a dotted quarter note (three eighth notes) so there are two of those beats in the measure. Among the six sub-beats, the strong beats are "1" and "4", and we generally count them out loud by saying "ONE two three TWO two three".
Comment: So glad to see the "together with an understanding of the musical style of the period..." qualification! I'm an early music and folk music guy and so I play both with very strong downbeat emphasis (for folk dances such as morris) and with no bar-based emphasis at all (earlier baroque chamber music, where all the emphasis comes from understanding the phrase structure, which only coincides with bars sometimes). We struggle a lot with newer people to early music who can't let go of the idea that beat one needs to be strong all the time.
Comment: I'd say in 'rock music' beat 1 is certainly emphasized, as is 3. They're where the kick drum gets played, whereas 2 and 4 will be for snare, so not as emphasised. Reggae, yes, 2 and 4, breaking all the 'rules'!
Comment: are there any ressources folks here would recommend to learn about emphasis depending on time signatures?
Answer: At the start of every measure, no matter the time signature beat one typically gets a stronger accent than the rest of the notes and any musician either consciously or subconsciously will do this. Every beat will have some kind of accent based on the time signature and this can be extended in certain time signatures like 4/4 and 6/8 where there is a second emphasised beat on beat 3 in 4/4 and beat 4 on 6/8. These are ideas that just come along with the idea of a time signature.
There's really no way around this if you are writing with the structure that a time signature provides as this is the way it is. It's like trying to write exact pitches when the pitch doesn't matter. There are pieces with no time signature like Messiaen's Quartet for the End of Time 3rd section as you can see:

Even still in this the bar line which splits measures is used to show if and when something gets an accent.
Answer: A time signature implies a structure of the music, just like spaces in a written sentence imply a structuring into words.  When reading a sentence, you don't make an explicit pause after each word, yet the word structure is related to the conveyed meaning, and somebody reading a written text does it subtly different from somebody reading a continuous phonetic transcription.
It's more important that you feel the meter than that you execute it.  When accents are written in music, more often than not they indicate some temporarily different/shifted meter rather than single louder notes.  When that is the case, it is again more important that the musician feels the changed meter rather than that he "executes" the accents.
So while 4/4 has generally a stronger weight on 1 and a weaker weight on 3 and that's basically the most definite you can say about it generally, that's not all there is to it.
This becomes particularly important with some particular dances where the rhythms are usually rendered unevenly, like a Viennese Waltz where the second and third beat drag somewhat, or swinged rhythms where the off-beat notes are somewhat delayed: in that case the "rules" don't just suggest accents but rather affect the whole rhythmic framework in more or less subtle manners.
Answer: No. Accents can be on each on the crotchet beats like you mention. It can be on the weak part of the pulse (Syncopation) There can be no accents. The accent can be on certain quavers. None of which has all that much to do with the time signature.
There is no concrete place where a accent must be. There are places where an accent would be natural and places where it would not be but even when it is not a natural place for an accent it can still be musically valid depending on what effect the music is trying to achieves
Comment: OK. If time signature doesn't implies accents, what is difference between, say, 2/2 and 4/4, or between 3/4 and 6/8?
Comment: It's correct to say that the time signature does not *determine* the accents, but not that it doesn't *imply* them.  As Wheat's answer says, time signature coupled with period and style will give a strong indication of how the beats are accented -- despite there being exceptions.
Comment: I've read it several times, and I'm still confused by this answer.
Comment: I'm with Neil on this: the question didn't assume understanding of period and style. Time signature for me just suggests when things start repeating, but you can put accents anywhere. To the question of "difference between 3/4 and 6/8... same thing: reduce the fraction. :-)
Answer: There is an implied accent structure in the time signature.  Syncopation - accents that DON'T follow this structure - is frequently used.   But without the implied underlying structure there can be no syncopation, you can only be "off the beat" when there IS a beat!
If you write using barlines, it can be hard to prevent players from noticing them!  There's a direction "Senza misura" meaning "In free time", but that's more about a flexible beat than a lack of accents I think.   You can write without barlines completely of course, as in plainchant.
Answer: When I first started drums it was because I was sent to a teacher for drums. That was over 50 yrs ago, and as I understand it from my memory a time signature denotes how many notes to a measure and each time signature had accents on different beats in the measure, otherwise if all time signatures had a accent on the 1 and 3 then a 4/4 would sound just like a 2/2.  Also I noticed that many don't explain that 3/4 has a quarter note rest where the 4th beat is 1,2,3,-, If I was to try out for an orchestra and didn't know where the accent hits II don't think I would get that job.
Comment: Can you explain what you mean by "3/4 has a quarter note rest where the 4th beat is 1,2,3,-"? It almost sounds like you're saying 3/4 *is* 4/4, just with a rest on beat 4 (!).

Does a time signature imply accents?


Flux Actions to Redux Actions Conversion

Question: Hi I have an action setup but its in flux, and I need to refactor it to match with Redux actions.
Any help would be highly appreciated with migrating both to redux.
Comment: What is your actual question? Can you edit your question to only show one example of an action you have in flux, and how you're doing it in redux, and the problem you're having?
Comment: @AndyRay So I am converting from flux to redux and how do I use my bind functions as in this reducer with redux? Anad how would I go about this.emit("change") in redux?
Answer: Answering your questino from the comments;

How do I use my bind functions as in this reducer with redux? Anad how would I go about this.emit("change") in redux?

In redux, you connect your component to the Redux State as follows:
ReduxEnabledComponent = ReactRedux.connect(
    function(state) {
        return {
            someProp: state.someProp
        },
    {
        someAction: function(){
            return {type: 'action_type', data: {}}
        }
    }
)(Component);

The above code would take a component named Component and connect it to the Redux Store.  This component would receive props of someProp, which is a value of the Redux Store, as well as someAction, which is a method to use for emitting a request to the store.


using jquery on two separate sections of data

Question: I have a page which generates two lists out of SQL.  I'll use example information and setup:
The first list is all records from Memphis, so it pulls Name, Cartype, Year, and Color.
Jeremy, Saturn, 2001, Black
Sue, Buick, 1996, Green
John, Dodge, 2006, Red
The second list is all records not from Memphis.  Again with the same fields.
Bobby, Mercury, 1999, Blue
Mike, Mustang, 1974, White
Robby, Prius, 2009, Silver
I want to let a user match one set from each separate list.  For example, I want to click on Sue (in the first list), and Bobby (in the second list).  For each of those clicks, I want it to hide the rest of /that/ list, and to capture an identifier value.
So if you clicked on Sue, the other rows in that list would vanish, and jquery would capture a value for Sue.
code:

$name, $type, $year, $color

$('li').click(function() {
           $(this).siblings(".items").hide();

           var charID = $(this).attr('class2');
            alert(page);

        });

The above code works -  sortof.  It hides the corresponding items in the list with class of "item", and it captures my IDnumber value.  But I cannot figure out how to do the same (but separate) with the second list.  What's the trick here?
Answer: Add an extra class to the first list elements and a different one to the second list elements(actually not necesarry to add class to 2nd).
When a element get's clicked identify the class and hide the elements with that class.
maybe this is what you wanted to do: http://jsfiddle.net/geko/YtBNz/5/ this is with 2 distinct classes.
http://jsfiddle.net/geko/YtBNz/7/ this is with just an extra class.
And even an easier solution: http://jsfiddle.net/geko/YtBNz/12/ just hide the list based on .parent().hide()
Answer: It sounds like you're not separating your lists properly.  Does your HTML look like this:


Quantifying non-random distribution of label across dendrogram / correlation matrix?

Question: Overview
Given a correlation matrix generated from $n$ observations, each of which is associated with one or categorical binary or multinomial labels, how can one quantify the (non-)random distribution of each such label across the columns of the matrix or, equivalently, across the leaves of a dendrogram associated with such a matrix?
My goal is to compare several different transformations of some input dataset, and to see which one does a better job capturing the underlying signal in the data, as quantified by the non-random distribution of previously known annotations for each datapoint across a dendrogram or correlation matrix generated from that data?
Intuitively, this is similar to quantifying the non-random distribution of a binary label across data clusters (for which one might use something like Fisher's Exact Test / hypergeometric test), except that I would like to avoid the information loss associated with the discretization that occurs during clustering.
Example:
For example, suppose you have $5 \times 10$ matrix with four related variables, all of which have the same "true" underlying label.
In this case, the goal would be to find a method of comparing alternative correlation matrices / dendrograms generated from this data and choosing the one that results in the most non-random distribution / clustering of the related data points.
set.seed(1)
suppressMessages(library(NMF))
suppressMessages(library(viridis))

# create example data (5 x 10 matrix with 4 correlated columns)
num_rows <- 5

x1 <- abs(rnorm(num_rows) * 10)

dat <- matrix(c(
  x1 + rnorm(num_rows),
  x1 + rnorm(num_rows),
  x1 + rnorm(num_rows),
  x1 + rnorm(num_rows),
  rnorm(30)), nrow = num_rows)

colnames(dat) <- c(rep('A', 4), rep('B', 6))

cor_mat <- cor(dat)

# high-score (labels grouped together in dendrogram / correlation matrix)
NMF::aheatmap(cor_mat, annCol = list(group = factor(colnames(dat))),
                                     color = viridis(100))

# low-score (labels more randomly-distributed)
fake_cor_mat <- cor_mat + matrix(rnorm(100), nrow = 10)

NMF::aheatmap(fake_cor_mat, annCol = list(group = factor(colnames(dat))),
                                          color = viridis(100))

Created on 2019-10-27 by the reprex package (v0.3.0)
In the above example, a single binary variable is associated with each input data point, but in the more generalized case, each annotation may contain more than two levels. That said, it's not hard to convert the multinomial variables into multiple binary variables via one-hot encoding, so even a solution that only applies to binary labels would work.
Answer: The dendrogram gives way to several possible clusterings.
You can compare clusterings with multinomial labels using many well-established measures such as ARI.
So one way would be to choose the cut of the dendrogram with the maximum ARI as quality measure.


Existence of Unique Homomorphism Implies Generating Set

Question: The following question is taken from "An Invitation to General Algebra and Universal Constructions", p. 23 Ex. 2.1.2 (available online here).
Let $G$ be a group and let $\{a,b,c\}\subseteq G$ such that for every group $F$ and every $\{x,y,z\}\subseteq F$ there is a unique homomorphism:
\begin{array}{c c c l}
h: & G & \rightarrow & F \\
   & a & \mapsto     & x \\
   & b & \mapsto     & y \\
   & c & \mapsto     & z
\end{array}
Prove that $G$ is generated by $a,b,c$.
Thank you!
Answer: Let $H$ be the subgroup of $G$ generated by $a,b,c$. Then by assumption, there is a unique homomorphism $\phi\colon G\to H$ sending $a\mapsto a$, $b\mapsto b$, $c\mapsto c$. Together with the inclusion $\iota\colon H\to G$, we get a homomorphism $G\to G$ that sends  $a\mapsto a$, $b\mapsto b$, $c\mapsto c$. Of course $\operatorname{id}_G$ is also such a homomorphism. By uniqueness, these are the same, hence have the same image, i.e. $H=G$.
Comment: thank you! I was mind fixed on finding a proof by contradiction; assuming $H\neq G$ and constructing two homomorphisms.
Comment: @sillyme You were on the right track - see my comment - but you needn't have assumed that $H \ne G$.
Answer: Here's an idea to get you on the right track. Suppose some $g \in G$ cannot be formed from $a$, $b$, and $c$. Can you think of multiple homomorphisms from $G$ to itself that act as the identity on $a$, $b$, and $c$?
Comment: @sillyme Consider what $g$ could be mapped to. Because $g$ can't be formed by $a$, $b$, or $c$, where a homomorphism maps them does not determine where it maps $g$.


Git: how to get a list of all revisions since some commit?

Question: Using rev-list, I've figured out how to get a list of all revisions on one branch since some commit. How can I get a list of all revisions on all branches since some commit? Let's say the top of my repository looks like the following. How can I get a list of all commits since bbbbbbb (commits 3, 4, 5, and 6)? I don't care about the order.
* fffffff 6
* ddddddd 4
| * eeeeeee 5
| * ccccccc 3
|/
* bbbbbbb 2
* aaaaaaa 1

cdhowie's answer is nearly what I need, but it also returns commits from unrelated branches. If I expand the tree to this shape, I don't want to see commit 7 listed.
* 0000000 7
| * fffffff 6
| * ddddddd 4
| | * eeeeeee 5
| | * ccccccc 3
| |/
| * bbbbbbb 2
|/
* aaaaaaa 1

Comment: Ah, well then that's not *"a list of all revisions on **all** branches"*.  Don't ask one question and be surprised when someone answers it exactly.  :P  I will update my answer.
Answer: git rev-list ^bbbbbbb branches...
For example, on this test repository:
chris@zack:~/git-test$ git log --all --graph --oneline
* 8daff2c f      <-- test
* 5f57b15 d
| * 764a725 e    <-- master
| * 5889800 c
|/
* 294908b b
* 975d652 a

chris@zack:~/git-test$ git rev-list ^294908b master test
8daff2c59d8cb966bf399de5027fae85ee016081
5f57b1524afeafbf37984f84fa5fe24ee0ac8501
764a7256d40dbefdb6278443fb80266f00358a37
58898005214607e5c53b45954a98891ea599c037
Comment: That actually lists the first commit (and everything earlier)
Comment: @Craig: No it doesn't.  Did you forget to prefix the commit id with `^` like I did in my example?
Comment: Thanks, what does ^ mean here?
Comment: Ah, glad it's working.  And I *just* added an example to my answer to demonstrate that it does work, too.  ;)
Comment: From `man git-rev-parse`, section **SPECIFYING RANGES**: *"To exclude commits reachable from a commit, a prefix ^ notation is used. E.g. ^r1 r2 means commits reachable from r2 but exclude the ones reachable from r1."* "Reachable from a commit" in Git means the commit itself, plus all of its ancestors.
Comment: You can also specify tags instead of commit hashes or branches. To list all the commits between tag `6.1.0` and `6.1.7`, you could say `git rev-list ^6.1.0 6.1.7`
Answer: You can use git rev-list or git log (depending on what you're looking for), but the range is the important part.
git log bbbbbbb..fffffff in your case will give you everything from bbbbbbb to ffffffff but not including bbbbbbb.  If you want to include bbbbbbb, just stick a ^ in front of it.
You don't want all changes since that, you want the ones leading to a particular change.  In my repos (where I rebase a lot), there's a very large list of endpoints that exist that all fall off on their own.