text:
Q: Build multiple regression model with Y as a Factor in R I have a data set that rates customer satisfaction based on three options:

*

*Recommend

*Neutral

*Not satisfied

I understand those may not be the best options but that's what I have to work with.
Another caveat is that I must build the model in R so I'm trying to determine how to build a multiple regression model when y is a factor.
Once I understand that I want to use a stepwise approach to determine the variables I should use based on the code below:
install.packages("MASS")
library("MASS")
model <- lm(y~x1+x2+x3+x4, data=DATASET)
step <- stepAIC(model, direction = "both")
summary(step)

I don't have any issues when y is numeric, but I don't think I can just arbitrarily assign values to the customer satisfaction by making Recommend == 1, Neutral == 2, and Not Satisfied == 3.
I was thinking about creating three new variables called Recommend, Neutral and Not Satisfied and assigning 1s under columns where the feedback applies to a customer and a 0 when it doesn't.
For example:
Recommend    Neutral    NotSatisfied
1            0          0
0            1          0
0            1          0
1            0          0
0            0          1
If that is an acceptable approach I'm stuck trying to determine how to incorporate all three variables into my model since all of them represent the output I'm trying to predict.
Thank you for any help you are able to provide.

A: It sounds like your dependent variable is an ordered categorical variable.  That is, you know that Recommend > Neutral > NotSatisfied, but you can't treat the variable as interval or numeric.
If this is the case, ordinal regression is recommended.
The ordinal package in R makes this relatively easy. There are a few tricks to learn, tho. These models are supported by the emmeans package.  An analysis of deviance table can be obtained with the Anova.clm function in the RVAideMemoire package.  For some worked examples, I recommend looking at a couple of webpages of which I'm the author: An overview here and an example here.
A different approach is to treat the dependent variable as unordered categorical, or nominal.  You might look at the VGAM, mlogit, and nnet packages.


text:
Q: can not config rootScope to setup routing address When loading a routing address into the routeProvider in .config stage, I want to sametime setup the route addresses under $rootScope, so that all the other services can access the routing correctly.
for example, like this:
$rootScope.jsModules='js/modules/';
    $rootScope.appModule={
        addressbookHomeModule: {
            mName:'homeController',
            route: 'addressbook-home/',
            template: route+'home.html',
            controller: route+'homeController.js',

        },

However, I found and researched that its not possible to config $rootScope at the point of .config.
If its possible to config $rootScope just by attaching another object onto it, may I ask the way to do that, if possible an example will be a great help.
If no, I wonder if there a better way and more efficient way to store the routing location string like partials/confirmed.html so that all the other services can access the route correctly when I only need to config the string of the routing location once instead of all around the files in all the services?

A: We can use angular.constant..We can inject constants into pretty much anything (factory service provider etc) once its created.for eg
Angular.module('app).constant('routes',{home:'/'})

redpajama_set_name: RedPajamaStackExchange


text:
Q: Resamples (folds) for cross-validation in R I'm using tidymodels framework for creating stratified resample folds for cross-validation in a random forest model. Is it possible to actually access and view / plot the data within each of these folds? Reproducible code below:
library(tidyverse)
library(tidymodels)

df_cv <- vfold_cv(iris, v = 10, strata =Species)

A: The output of vfold_cv is an rsplit object. You can run split1 <- get_rsplit(df_cv, index = 1) to get the split. analysis(split1) will give you the analysis data frame and assessment(split1) will get you the assessment data frame.
You can also run tidy(split1) to get information about which rows went to the analysis set vs. which rows went to the assessment set.
This reference gives a little bit more information about what you do with an rsplit object.
For a more in-depth understanding of the rsplit class, you can check out the code here.


text:
Q: How can I create a 2nd thread, have progressdialog and pause the main thread? Sorry, I am new to Android programming.  I have an xml parser that I don't want running in the UI thread.  I want to display a progressdialog while the parser is running in its own thread but I don't want the main thread to start the next Activity until the parser is finished.  I have code but the progressdialog doesn't display for the full duration.  In place of the while loop, i've tried parserThread.join() with the same results.  Also, I want to avoid timing out the UI thread.  Any help is appreciated.
My method that invokes the thread, followed by the class that implements Runnable:
private void parseGasStationData() {
        gasStations = null;
        StationParser sp = new StationParser(activity);
        Thread parserThread = new Thread(sp);
        parserThread.start();
        while (parserThread.isAlive()) {
            // do nothing
        }
        gasStations = sp.getList();
        Log.v("Parser-Status", "xml parsed successfully: "
                + (gasStations != null));
    }

public class StationParser implements Runnable {
    private Activity activity;
    private final ProgressDialog pd;

    public StationParser(Activity activity) {
        this.activity = activity;
        pd = ProgressDialog.show(activity, "", "Parsing data...", true, false);
    }

    @Override
    public void run() {
        try {
            runParser();
        } catch (XmlPullParserException e) {
            Log.e("Parser-Error", "XmlPullParserException", e);
            e.printStackTrace();
        } catch (IOException e) {
            Log.e("Parser-Error", "IOException", e);
            e.printStackTrace();
        } catch (ParseException e) {
            Log.e("Parser-Error", "ParseException", e);
            e.printStackTrace();
        }
        pd.dismiss();
    }

A: In android we use the AsyncTask class to make background operations an show the results. See the main document page here the first example seems pretty useful for you, just change the doInBackground method for your parser.

A: This code:
while (parserThread.isAlive()) {
    // do nothing
}

needs to go. As long as you have that, you might as well not be using a separate thread at all. (In fact, it's worse, because it's a "busy wait" that hogs the CPU.)
The right way to do this is with a call-back. When the parsing thread is done, it can call post(Runnable) to run a process on the UI thread that will make the progress dialog go away. You can use AsyncTask to help with this. See the guide topic Processes and Threads for more information.


text:
Q: fb sort comments in reverse order based on timestamp In fb Graph Api Explorer how to sort comments by timestamp in reverse chronological order. Fetched comments using object_id/comments
tried using object_id/comments?summary=true&order=chronological as described here.But result is same.

A: Try to use the parameter filter=stream.


text:
Q: JavaScript: Convert time stamp without time zone to milliseconds I got stuck converting below time stamp to milliseconds in JavaScript.
I have time stamp in Postgres DB as
   2019-02-04 15:38:22.529

I get above time stamp in below format in UI when I read from DB
   Mon Feb 04 2019 10:38:22 GMT+0400 (Gulf Standard Time)

How can I convert above UI format time stamp to milliseconds in JavaScript?

A: the Use of Date getTime  function will return time milliseconds since 2019-02-04 15:38:22.529:

const date = new Date("2019-02-04 15:38:22.529");

const time = date.getTime();
console.log(time);

A: Try this, the "Z" means UTC+0:
const time = new Date("2019-02-04T15:38:22.529Z").getTime()

A: You can use getMilliseconds() if you want milliseconds according to local time

const date = new Date("2019-02-04 15:38:22.529");

const time = date.getMilliseconds()
console.log(time);


text:
Q: Formatting a Date String into a Date I want to format a string Date "14/06/2019 12:52" using moment library in order to manipulate a Date object and not a string.
I tried using moment library but didn't succeed to have a Date object
const myDate = moment('14-06-2019 12:52')
the const myDate is not of type Date.

A: You need to provide the format also
const myDate = moment('14-06-2019 12:52', 'DD-MM-YYYY hh:mm');

A: You could use moment().toDate();
Refer here for more info http://momentjs.com/docs/#/displaying/as-javascript-date/


text:
Q: ASP.net Web Form through Serial Port I have done some changes to my coding and tested it. It is still not working perfectly hence i hope to have some guidance here.
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO.Ports

Partial Class Main
    Inherits System.Web.UI.Page

Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load

    Dim Serialport7 As New IO.Ports.SerialPort

    With Serialport7
        .PortName = "COM7"
        .BaudRate = 9600
        .Parity = Parity.None
        .DataBits = 8
        .StopBits = StopBits.One
    End With

    Try
        Serialport7.Open()
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try

    Dim ReceivedData As String

    ReceivedData = Serialport7.ReadLine()

    If ReceivedData.Substring(0, 1) = "T" Then

        TextBox1.Text = ReceivedData.Remove(0, 1)

    ElseIf ReceivedData.Substring(0, 1) = "H" Then

        TextBox2.Text = ReceivedData.Remove(0, 1)

    End If

    TextBox3.Text = System.DateTime.Now

    Serialport7.Close()

End Sub

End Class

The errors i have encountered:

*

*TextBox2 is not displaying the reading, only TextBox1 is showing the reading.

*The Web form is not refreshing hence my readings are not updated. Is there any way i can auto update the Web form ?
Appreciates all guidance.
Thanks.

A: You have a simple solution to refresh your page, it won't be refreshed anytime new data is available since your server can't control the client web browser (well shouldn't, it's not impossible but it's complicated and not very safe) .
So what you can do is add a piece of javascript code to refresh your page periodically.
The best way to go would be to add a javascript function that makes an ajax call to a webservice which would read the serial port data and then send the data back to the client page.
There you can update your textbox values.
To update your page you can use this javascript code: window.location.reload()
If you need to update it periodically you can take a look at this SO question
To add a webservice in webforms and call it periodically, take a look at these links:
http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-web-services
http://api.jquery.com/
If you don't want to refresh your page periodically, and just want to refresh your values when new data is available, take a look at websockets (forgot about them when I started to answer).
EDIT about websockets
[Also, you should consider that your methods can be called by many different users, also in different threads. So you need to make your serial port reading thread safe, and store the results somewhere to avoid sending different data to different users.]
--
Image you have a user A who updates your page, then the user B updates it.
You have already read some data from the serial port when user A called the page, so user A and user B will have different data displayed.
if data is 1, 2, 3, 4
in your current implementation user A will see 1 and user B will see 2


text:
Q: Loss of significance error
Give exact ways of avoiding loss-of-significance errors in the
  following computations:
a. $log(x+1)-log$, with large $x$
b. $\frac{1-cosx}{x^2}$, with $x\approx 0$
c.$(1+x)^{1/3}-1$, with $x\approx 0$

Am I doing this correctly?
a. I got $$log(x+1)-log(x)= log(\frac{x+1}{x})= log(1+\frac{1}{x}) \approx \frac{1}{x}-\frac{1}{2x^2}+\frac{1}{3x^3} ...$$
c. I got $$\frac{x}{(1+x)^{2/3}+(1+x)^{1/3}+1}$$
b. I am stuck

A: As for part (c), You can use the Taylor series to get:
$$(1+x)^{1/3}\sim 1+\frac{x}{3}-\frac{x^2}{9}+O(x^3)$$

A: a)
$$\log{(x+1)} = \log{x} + \log{\left (1 + \frac{1}{x} \right )}$$
Use the Taylor series approximation for $\log{y}$ for small values of $y$:
$$\log{(x+1)} - \log{x} = \frac{1}{x} - \frac{1}{2 x^2} + \frac{1}{3 x^3} + \dots$$
b) Again, use the Taylor series for $\cos{x}$ about $x=0$:
$$\frac{1-\cos{x}}{x^2} = \frac{1}{2} - \frac{x^2}{24} + \dots$$
c) Taylor expansion or a binomial expansion:
$$\begin{align}(1+x)^{1/3}&= 1 + \frac{1}{1!} \frac{1}{3} x + \frac{1}{2!} \frac{1}{3} \left (-\frac{2}{3} \right ) x^2 + \frac{1}{3!} \frac{1}{3} \left (-\frac{2}{3} \right ) \left (-\frac{5}{3} \right ) x^3 + \ldots \\  \end{align} $$
so that
$$(1+x)^{1/3} - 1 = \frac{1}{3} x - \frac{1}{9} x^2 + \frac{5}{81} x^3 - \ldots$$


text:
Q: matplotlib: Unexpected gridspec behavior I try to plot two plots vertically within one figure using gridspec. The upper one is supposed to be twice as high as the lower one (i.e. the ratio is 2:1 with 3 equal vertical parts) and they have to share the x-axis scale. I have the following minimal example, which produces the correct 3-part plot, but it does not span the upper subplot twice as high as the lower one. The first plot is at the top third, the second is in the bottom third, and the middle is emptyWhere is the error?
import matplotlib.gridspec as gridspec
x = y = [1,2,3]
gs = gridspec.GridSpec(3, 1)
ax1 = plt.subplot(gs[0:1, 0])
ax1.plot(x, y)
ax2 = plt.subplot(gs[2, 0], sharex=ax1)
ax2.plot(x,y)
plt.show()

A: When using gridspec the indexing acts similarly to numpy arrays. As such you need gs[0:2, 0] to get the output that you want.
import matplotlib.pyplot as plt
from matplotlib import gridspec

x = y = [1,2,3]

gs = gridspec.GridSpec(3, 1)

ax1 = plt.subplot(gs[0:2, 0])
ax1.plot(x, y)

ax2 = plt.subplot(gs[2, 0], sharex=ax1)
ax2.plot(x,y)

plt.show()

Note that you could use plt.tight_layout() to remove the overlap of axis


text:
Q: TikZ to non-PDF How do I tell TikZ to output to a standalone image file? Like JPG, PNG, etc?
Yes, there is a way to output it to PDF, then do a snapshot. But this is for mathematical-visual comparisons, and I need precision trimming so that I can put the images side-by-side in a Word document.
Here's a sample using the standalone class. It only takes care of the length, but the width stays the same as the textwidth
\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
  \draw [step=0.5] (-1.4,-1.4) grid (1.4,1.4);
\end{tikzpicture}

\end{document}

I want the whole PDF to be trimmed to the edges of the tikzpicture. Or, even better, trim the PDF so that that I can leave (custom) margins around the graphic.

A: You have empty lines between the document and tikzpicture environment which puts the picture in an paragraph (which is \textwidth wide). Simply removing the lines fixes this:
\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \draw [step=0.5] (-1.4,-1.4) grid (1.4,1.4);
\end{tikzpicture}
\end{document}

The rest of your question is already answered in
Compile a LaTeX document into a PNG image that's as short as possible.
In short:
pdflatex file
convert -density 300 file.pdf -quality 90 file.png

or with v1.0 of the standalone class:
\documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone}

compile with:
pdflatex -shell-escape file

You might also want to use the new border option to set the border to 0pt.

A: This is a complement to the Martin Scharrer's answer for the particular case of Windows.
This answer is not exhaustif, but gives a particular configuration that works for me.
Installation under Windows (checked with XP/7/10)

*

*Install GhostScript;

*Put the folder (something like C:\...\Ghostscript\bin) containing gswin32c.exe in the PATH;

*Create a folder named StackExchange where you will put all your questions and answers for TeX.SX;

*In this folder create a file standalone.cfg with the following content
\input{standalone/standalone.cfg}
\standaloneconfig{convert={ghostscript, density=700, command={\gsexe\space -dDownScaleFactor=4 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=\gsdevice\space -r\density\space -sOutputFile=\outfile\space \infile}}}

*Use as model for your question/answer in this folder something like
\documentclass[tikz,border=7pt]{standalone}
% \usetikzlibrary{ }
\begin{document}
  \begin{tikzpicture}
    \fill[red] (0,0) circle (1);
  \end{tikzpicture}
\end{document}

And now just compile your tex file with the option -shell-escape and you will obtain a PNG with the same name and "resonable" default size.


text:
Q: How do you authenticate a GitHub App in Node.js? I've created a new GitHub App and I'm trying to authenticate from Node. I'm new to GitHub Apps, for example, I don't know what "installationId" is supposed to be. Is that the App ID?
I successfully get a token using a private key, but when I try using the API, I get an error both from Node and from curl.
import { createAppAuth } from '@octokit/auth-app';
import { request } from '@octokit/request';

const privateKey = fs.readFileSync(__dirname + 'file.pem');
const auth = createAppAuth({
 id: 1,
 privateKey,
 installationId: 12345,
 clientId: 'xxx.xxxxxx',
 clientSecret: 'xxxxxx',
});

const appAuthentication = await auth({ type: 'app' });
console.log(`Git repo token: ` + appAuthentication.token);

const result = await request('GET /orgs/:org/repos', {
      headers: {
                 authorization: 'token ' + appAuthentication.token,
               },
               org: 'orgname',
               type: 'public',
      });
return res.status(200).json({ message: 'Git result: ' + result });

Here is the curl example I tried after getting the token from the Node code above.
curl -i -X POST -H "Authorization: Bearer xxxxxxxxxx" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app

The result in Node: "Git result: Git repo error: HttpError: Bad credentials"
Result in curl:
{
  "message": "Integration not found",
  "documentation_url": "https://developer.github.com/v3"
}

A: The JSON Web Token (JWT) authentication can only be used for a few endpoints of GitHub's REST API. Mostly the ones listed on https://developer.github.com/v3/apps/
For all others, you need an installation access token.
Can you try this instead?
const { token } = await auth({ type: "installation" });
const result = await request("GET /orgs/:org/repos", {
  headers: {
    authorization: "token " + token
  },
  org: "orgname",
  type: "public"
});

Note that the installationId option must be set to a valid installation ID. You get the installation ID when you install the GitHub app on github.com. For example, you can install the WIP app at https://github.com/apps/wip on your account or any organization you have admin access to. The installation URLs look like this:
https://github.com/settings/installations/90210
In the example above, the installation ID is 90210.
To simplify your code, you can use the auth.hook feature in which case the correct authentication will be set automatically based on the URL
import { createAppAuth } from "@octokit/auth-app";
import { request } from "@octokit/request";

const privateKey = fs.readFileSync(__dirname + "file.pem");
const auth = createAppAuth({
  id: 1,
  privateKey,
  installationId: 12345
});

const requestWithAuth = request.defaults({
  request: {
    hook: auth.hook
  }
})

const result = await requestWithAuth("GET /orgs/:org/repos", {
  org: "orgname",
  type: "public"
});

See https://github.com/octokit/request.js/#authentication for more examples


text:
Q: Read AVRO file using Python I have an AVRO file(created by JAVA) and seems like it is some kind of zipped file for hadoop/mapreduce, i want to 'unzip' (deserialize) it to a flat file. Per record per row.
I learned that there is an AVRO package for python, and I installed it correctly. And run the example to read the AVRO file. However, it came up with the errors below and I am wondering what is going on reading the simplest example? Can anyone help me interpret the errors bellow.
>>> reader = DataFileReader(open("/tmp/Stock_20130812104524.avro", "r"), DatumReader())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../python2.7/site-packages/avro/datafile.py", line 240, in __init__
    raise DataFileException('Unknown codec: %s.' % self.codec)
avro.datafile.DataFileException: Unknown codec: snappy.

btw, if I do 'head' of file, and using VI to open up the first few lines of the AVRO file, I could see the schema definition together with some crappy weird characters - probably the zipped content.
The starting bit of the raw AVRO file looks like below:
bj^A^D^Tavro.codec^Lsnappy^Vavro.schemaØ${"type":"record","name":"Stoc...

I don't know if those schemas would be necessary to read the AVRO file, something like below:
schema = avro.schema.parse(open("schema").read())
# include schema to do sth...
reader = DataFileReader(open("Stock_20130812104524.avro", "r"), DatumReader())

Thanks in advance.

A: Try pip install python-snappy - make sure you have installed snappy first.

A: The problem is that if there is no Xcode command line tools installed you cannot get snappy working. You can check by typing gcc at the command prompt to see if it is installed or not. If not then type xcode-select –-install to install it. Then installing python-snappy should work. Thanks Bin!

A: wget http://www.us.apache.org/dist/avro/avro-1.7.5/java/avro-tools-1.7.5.jar
java -jar avro/avro-tools-1.7.5.jar tojson input.avro > input
More information refers here


text:
Q: QT using QCustomPlot - Need to detect mouse not over chart I am using QCustomPlot in a application which is focused on the graph which displays results from a external device. I have a cursor which uses  the QMouseEvent. Whenever I get the mouse event it draws a horizontal line and vertical line from the mouse position to the axis.
void PlotClass::ChartMouseMove(QMouseEvent* mouse){
    double x = ui->customplot->xAxis->pixelToCoord(mouse->pos().x());
    double y = ui->customplot->yAxis->pixelToCoord(mouse->pos().y());
    //QCPItemStraightLine *infLine = new QCPItemStraightLine(ui->customplot);
//    infLine->point1->setCoords(x, 0);  // location of point 1 in plot coordinate
//    infLine->point2->setCoords(2, 1);  // location of point 2 in plot coordinate
    qDebug() << x << y;
  //  ui->customplot->xAxis->range().minRange();
    double xLow = ui->customplot->xAxis->range().lower;
    double xHigh = ui->customplot->xAxis->range().upper;
    double yLow = ui->customplot->yAxis->range().lower;
    double yHigh = ui->customplot->yAxis->range().upper;

    infLinex->start->setCoords(x, yLow);  // location of point 1 in plot coordinate
    infLinex->end->setCoords(x, yHigh);  // location of point 2 in plot coordinate
    infLiney->start->setCoords(xLow, y);  // location of point 1 in plot coordinate
    infLiney->end->setCoords(xHigh, y);  // location of point 2 in plot coordinate
    ui->customplot->replot();
}

What I need to do is remove the cursor when the mouse is no longer over the chart. Not sure how to do this.
Also would be nice to paint the actual cursor position onto the lines in text (the values from the axis.)

A: Ok figured it out. I just put this function call in the timer event (possibly not the best way but it works)
void PlotClass::CheckHidecursor(void){
    if(!Hidecursor && !ui->customplot->underMouse()){
        Hidecursor = true;
        infLinex->setVisible(false);
        infLiney->setVisible(false);
        yLabel->setVisible(false);
        xLabel->setVisible(false);
        qDebug() <<  "Hide";
        ui->customplot->replot();
    }

}

So it hides the lines and the numbers I am putting on if the mouse is no longer over the chart widget. The key function I found was QWidget::underMouse() which gives a true/false reponse.


text:
Q: 400 (Bad Request) in image url angular js ImageUrl/{{product.thumb_vImage}} 400 (Bad Request)

I getting above error in my console; I want to know the reason of it.

A: It should be like this use {{}} instead of [[]] also ng-src instead of src,


text:
Q: Node.js fails to start with v8 symbol error I installed the nodejs package on CentOS release 6.3 (Final)
But it crashed on startup when run with no arguments:
[root@lcnolw1073 ~]# nodejs

    nodejs: ../src/handle_wrap.cc:65: static v8::Handle<v8::Value> node::HandleWrap::Unref(const v8::Arguments&): Assertion `args.Holder()->InternalFieldCount() > 0' failed.
    Aborted (core dumped)

And also with an empty file:
[root@lcnolw1073 ~]# nodejs /dev/null
Segmentation fault (core dumped)

A: Either the version of Node.js, in whatever repo you're getting it from, is broken, or something went very badly wrong during installation, and yum failed to catch the error.
In either case, I'd recommend uninstalling the package, then cleaning out the yum cache with yum clean, and finally reinstalling to see whether the error persists; if it does, I'd uninstall the package again and then build Node.js from source, which you can find here. (It's not all that hard to build Node from source; I did so just the other day, on Cygwin, yet, and all it required was the usual configure && make && make install invocation.)


text:
Q: React Bootstrap Row issue Ok, so. I am currently following this tutorial: https://www.freecodecamp.org/news/react-movie-app-tutorial/ . I have copied the code verbatim. I have installed bootstrap via the instructions on this website: https://react-bootstrap.github.io/getting-started/introduction#stylesheets . I have tried every configuration in every place of importing 'bootstrap/dist/css/bootstrap.min.css' including the <link>. The Row class is not working. Here is my Code...
import 'bootstrap/dist/css/bootstrap.min.css'
import './index.css'
import MovieList from "./components/MovieList"

const App = () => {

  const [movies, setMovies] = useState([])

  //const [favorite, setFavorite] = useState([])

  //const [searchValue, setSearchValue] = useState("")

  const getMovieRequest = (searchValue) => {

    const url = `http://www.omdbapi.com/?s=jaws&apikey=76fd1ead`

    fetch(url)
      .then(resp => resp.json())
      .then(data => {
        if (data.Search) {
          setMovies(data.Search)
        }
      })
  }

  useEffect(() => {
    getMovieRequest()
  }, [])

  console.log(movies)

  return (

        <MovieList movies={movies} />

  )

}

export default App;

import React from "react"

/*export default function MovieList(props) {

    const displayMovies = props.movies.map(movie => {
        return (

        )
    })

    return(
        <>
            {displayMovies}
        </>
    )
}*/

const MovieList = (props) => {
    return (
        <>
            {props.movies.map((movie, index) => (

            ))}
        </>
    )
}

export default MovieList;

import React, {useState} from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'bootstrap/dist/css/bootstrap.min.css'

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

Any help would be greatly appreciated!

A: There is "bootstrap" itself and it is independent of what kind of framework you are using (React, Vue, Angular or just vanilla). It uses mostly css classes and jQuery for some functionality. Then there is "react-bootstrap", which is a complete re-write of bootstrap logic. It's written in React and offers a collection of components. That's why when you use react-bootstrap you only need the css part of bootstrap, but not the js/jQuery part.
Using only bootstrap?

*

*npm i bootstrap

*import 'bootstrap/dist/css/bootstrap.min.css' in your App.js or index.js

https://codesandbox.io/s/crazy-meninsky-9lmpmr?file=/src/App.js
Using react-bootstrap?

*

*npm i react-bootstrap boostrap

*import 'bootstrap/dist/css/bootstrap.min.css' in your App.js or index.js

https://codesandbox.io/s/serene-heisenberg-1xfvut
When you look into the both sandboxes you see that row is working either way.


text:
Q: Execute combine multiple Linux commands in one line I am trying to merge multiple linux commands in one line to perform deployment operation.
For example
cd /my_folder
rm *.jar
svn co path to repo
mvn compile package install

A: If you want to execute each command only if the previous one succeeded, then combine them using the && operator:
cd /my_folder && rm *.jar && svn co path to repo && mvn compile package install

If one of the commands fails, then all other commands following it won't be executed.
If you want to execute all commands regardless of whether the previous ones failed or not, separate them with semicolons:
cd /my_folder; rm *.jar; svn co path to repo; mvn compile package install

In your case, I think you want the first case where execution of the next command depends on the success of the previous one.
You can also put all commands in a script and execute that instead:
#! /bin/sh

cd /my_folder \
&& rm *.jar \
&& svn co path to repo \
&& mvn compile package install

The backslashes at the end of the line are there to prevent the shell from thinking that the next line is a new command; if you omit the backslashes, you would need to write the whole command in a single line.
A more convenient way compared to using backslashes and && everywhere is to instruct the shell to exit the script if any of the commands fail. You do that using the set built-in function with the -e argument. With that, you can write a script in a much more natural way:
#! /bin/sh
set -e

cd /my_folder
rm *.jar
svn co path to repo
mvn compile package install

Save that to a file, for example myscript, and make it executable:
chmod +x myscript

You can now execute that script like other programs on the machine. But if you don't place it inside a directory listed in your PATH environment variable (for example /usr/local/bin, or on some Linux distributions ~/bin), then you will need to specify the path to that script. If it's in the current directory, you execute it with:
./myscript

The commands in the script work the same way as the commands in the first example; the next command only executes if the previous one succeeded. For unconditional execution of all commands, simply don't call set -e:
#! /bin/sh

cd /my_folder
rm *.jar
svn co path to repo
mvn compile package install

A: I've found that using ; to separate commands only works in the foreground.  eg :
cmd1; cmd2; cmd3 &  -  will only execute cmd3 in the background, whereas
cmd1 && cmd2 && cmd3 & - will execute the entire chain in the background IF there are no errors.
To cater for unconditional execution, using parenthesis solves this :
(cmd1; cmd2; cmd3) & - will execute the chain of commands in the background, even if any step fails.

A: To run them all at once, you can use the pipe line key "|" like so:
$ cd /my_folder | rm *.jar | svn co path to repo | mvn compile package install

A: cd /my_folder && rm *.jar && svn co path to repo && mvn compile package install

A: You can separate your commands using a semi colon:
cd /my_folder;rm *.jar;svn co path to repo;mvn compile package install

Was that what you mean?

A: If you want to execute all the commands, whether the previous one executes or not, you can use  semicolon (;) to separate the commands.
cd /my_folder; rm *.jar; svn co path to repo; mvn compile package install

If you want to execute the next command only if the previous command succeeds, then you can use && to separate the commands.
cd /my_folder && rm *.jar && svn co path to repo && mvn compile package install

In your case, the execution of consecutive commands seems to depend upon the previous commands, so use the second example i.e. use && to join the commands.

A: What is the utility of an only one Ampersand?
This morning, I made a launcher in the XFCE panel (in Manjaro+XFCE) to launch 2 passwords managers simultaneously:
sh -c "keepassx && password-gorilla"
or
sh -c "keepassx; password-gorilla"

But it does not work as I want. I.E., the first app starts but the second starts only when the previous is closed
However, I found that (with only one ampersand):
sh -c "keepassx & password-gorilla"

and it works as I want now...

A: *

*Use ;

*

*No matter the first command cmd1 run successfully or not, always run the second command cmd2:

*

*$ cd myfolder; ls   # no matter cd to myfolder successfully, run ls

*Use &&

*

*Only when the first command cmd1 run successfully, run the second command cmd2:

*

*$ cd myfolder && ls  # run ls only after cd to myfolder

*Use ||

*

*Only when the first command cmd1 failed to run, run the second command cmd2:

*

*$ cd myfolder || ls  # if failed cd to myfolder, `ls` will run

A: You can use as the following code;
cd /my_folder && \
rm *.jar && \
svn co path to repo && \
mvn compile package install

It works...

A: I find lots of answer for this kind of question misleading
Modified from this post:
https://www.webmasterworld.com/linux/3613813.htm
The following code will create bash window and works exactly as a bash window. Hope this helps. Too many wrong/not-working answers out there...
            Process proc;
            try {
                //create a bash window
                proc = Runtime.getRuntime().exec("/bin/bash");
                if (proc != null) {
                       BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
                       PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
                       BufferedReader err = new BufferedReader(new InputStreamReader(
                       proc.getErrorStream()));
                       //input into the bash window
                       out.println("cd /my_folder");
                       out.println("rm *.jar");
                       out.println("svn co path to repo");
                       out.println("mvn compile package install");
                       out.println("exit");
                       String line;
                        System.out.println("----printing output-----");
                          while ((line = in.readLine()) != null) {
                             System.out.println(line);
                          }
                          while((line = err.readLine()) != null) {
                             //read errors
                          }
                          proc.waitFor();
                          in.close();
                          out.close();
                          err.close();
                          proc.destroy();
                }

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

A: FYI,
if you need to run multiple commands in one-line in if-else, you can group the commands with parenthesis. See this page for more details.
You can replace the semicolon (;) with && or || depending on what you need. Please note that parenthesis creates a sub-shell to execute the commands.
Following command executes the cmd1, cmd2, and cmd3 commands if a file called file_name exists; otherwise, cmd4, cmd5, and cmd6.
[ -f file_name ] && (cmd1; cmd2; cmd3) || (cmd4; cmd5; cmd6)


text:
Q: I need to send a POST request to an api using an XML request structure in java String urly = "myurl";
URL url = new URL(myurl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type","application/xml");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(xml);
wr.flush();

i am not sure whether this sends the request using xml request structure which is stored in String "xml". I dont know any other way to send request using XML.
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
BufferedReader iny = new BufferedReader(new InputStreamReader(con.getInputStream()));
          String output;
          StringBuffer res = new StringBuffer();

          while ((output = iny.readLine()) != null) {
           res.append(output);
          }
          iny.close();
           wr.close();
          //printing result from response
          System.out.println(res.toString());

The response i am getting shows Invalid Request.

A: The generated XML was wrong, it needed to be checked.


text:
Q: ASP.net MVC and Entity Framework sites sharing database I've recently started to play around with ASP.net MVC3 and the Entity Framework. I followed tutorials (code, model and database first) and I liked alot of the automagical things happening.
BUT (always a but...), it seem to me that the whole "system" is very much constructed for someone hosting the whole thing by themselves with total control. I'm trying to understand how it can be useful to me in my hobby projects and self learning and so far I've failed.
What I'm getting at is this: I have a pretty regular web hotel, I own a couple of domains there. But I only have 1 MS SQL database. And it seems which every way I go with code, model or database first my sites/projects/tests fight eachother in that database - dropping eachothers tables.
On the web hotel I have to use a package from NuGet so that only tables are being created on model change - no database dropping allowed. But tables that not exist in one sites project are being dropped and conflicts arrise.
Am I missing something or did they really not construct the framework for people like me?
If I had a MS SQL database dedicated for each site I want to work on it would work of course but since that is an extra service it will get very expensive. And my projects are very tiny at this pont so having them share a database is no problem performance-wise.
Can anyone advice me, say what point I'm missing or point me in the right direction?
Thanks in advance!

A: It sounds like you're using the code-first variety of EF.  Try the database-first variety and generate your model from the database, rather than vice versa.


text:
Q: Laravel Querying model in a multi tenant/db I am starting with a new multi-tenant applicaiton, i followed this as guide http://fideloper.com/laravel-multiple-database-connections.
So in my model i have
class Manufacturer extends Model
{
    protected $connection = 'secondDB';
    ...
}

I know i can query the second database like this:
$users = DB::connection('secondDB')->select(...);

But how do i query the model? This doesn't work:
Manufacturer::create($attributes);

A: Try this (removing  Environment Configuration)
http://tutsnare.com/connect-multiple-databases-in-laravel/

A: Hey here you can do like
    $Manufacturer = new Manufacturer;

    $Manufacturer->setConnection('secondDB');

    $result= $Manufacturer->find(1);

    return $result;

You can look at this How to use multiple database in Laravel

A: Try this:
$manufacturer = new Manufacturer();
$manufacturer->setConnection('secondDB');

$this->create($attributes);

Hope this one help you.


text:
Q: I could not understand the value into the xlim and ylim. What is that? library(maps)
library(mapdata)
map("worldHires","Canada", xlim=c(-141,-53), ylim=c(40,85), col="gray90", fill=TRUE)

A: Those stand for 'x axis limits' and 'y axis limits'.  The first number is the minimum value for the axis (all the way at the left side for x, or bottom for y).  The second number is the corresponding maximum value for the axis.  You can set those to display whatever region of the space you prefer.


text:
Q: Memory affect of the objects created in python in the topic, Python variable declaration, @Karl Knechtel explained very well, but I have a doubt that how the unused value objects are getting handled in python. because throught the time whenever I do
id("Any value object which was refered before by a name")

this will still give me the same id at which the value object was stored at the first place in the RAM.
Now if my code is very large and I have some many value objects which I am not using furthermore, these redundant value objects are still using my RAM, right?
And how Python handles it?


text:
Q: Manually drilldown highcharts I have a chart with multiple level drilldowns.
Given series id I would like to drilldown to the corresponding using a function like
function drilldown(id) {
   // function drills down to the series having id
}

Is it possible to do this?

A: You can fire an event manually like this:
chart.series[0].points[0].hcEvents.click[0]();

Try this example: http://jsfiddle.net/kkulig/mqnyy9cu/

A:
Is it possible to do this?

Yes
This is the sample code

chartConfig.chart.events.drilldown = function(e) {

                if (!e.seriesOptions) {

                    var chart = this,

                        drilldowns = drillDownColumChartData,

                        drilldowns2 = drillDownLinChartData,

                        columnSeries = drilldowns[e.point.drilldown],

                        lineSeries = drilldowns2[e.point.drilldown];

                    setTimeout(function() {

                        /*https://github.com/highcharts/highcharts/issues/2989*/

                        if (e.point.x != null) {

                            chart.addSingleSeriesAsDrilldown(e.point, columnSeries);

                            chart.addSingleSeriesAsDrilldown(e.point, lineSeries);

                            chart.yAxis[1].setTitle({

                                text: secondaryYaxisTitle

                            })

                            chart.applyDrilldown();

                        }

                    }, 0);

                }

            };

You can get the selected point details from e.point
Refer Highcharts asyc drilldown


text:
Q: Old reminders are gone from macOS 10.14.6 I'm so confused about what happened to the macOS version of the Reminders app.
Reminders 6.0
macOS Mojave 10.14.6

My mobile version of Reminders has the old data and it seems to work fine.  I don't think it is syncing with the desktop version though, because the desktop version is showing, "The creator of this list has upgraded... learn more here, https://support.apple.com/en-us/HT210220..."
All the reminders are gone, with only two lists, Scheduled and Reminders.
The link isn't super helpful, I followed the iCloud link and signed in there, and I can see the list of my reminders in the browser.
So how do I recover in the desktop app?

A: According to Apple:

To use the new Reminders features in iOS 13—smart lists, a new quick toolbar, and more—you need to upgrade the reminders in your iCloud account.
Upgraded reminders aren't compatible with earlier versions of iOS and macOS. If you upgrade your reminders on your iPhone with iOS 13, your iPad and Mac using the same iCloud account can't access your reminders until iPadOS and macOS 10.15 Catalina are available.

You will need to wait until you upgrade your Mac to Catalina before Reminders start to sync to your Mac again.


text:
Q: Electron - Bypass X-Frame-options in sameorigin Im trying to show a website in electron, but it appears the error that , x-frame-option is in sameorigin, i have read a lot of code about how bypass it, but i have not idea where put it, if in the main, or in what pass, someone can help me a little here? the link is this one
https://mobile.bet365.com

A: Use below lines after initialized BrowserWindow instance:
  win.webContents.session.webRequest.onHeadersReceived({ urls: [ "*://*/*" ] },
    (d, c)=>{
      if(d.responseHeaders['X-Frame-Options']){
        delete d.responseHeaders['X-Frame-Options'];
      } else if(d.responseHeaders['x-frame-options']) {
        delete d.responseHeaders['x-frame-options'];
      }

      c({cancel: false, responseHeaders: d.responseHeaders});
    }
  );

But not recommended, just embed for your testing purpose.


text:
Q: ripping cds to play on stereo Is AIFF still around? Has it been replaced by ALAC?
What is the best format to use to hold fidelity on a home system fidelity on a stereo system, when down the road I can't make CDs?
An analog, (non) digital stereo system that is dance club quality?

A: I prefer ripping to FLAC for backup.
Convert to required target format for the playback hardware,
that is usually MP3 CBR 320Kbps -- which is the best quality most hardware plays.

A: If you don't want to lose any quality at all, you'll need to store in a lossless format.  AIFF/WAV are possible, but most people would prefer to use some sort of compression to reduce the space requirements, and to allow for easier tagging.  ALAC, FLAC, TAK, and WavPack are major players in this space.  Yes, it's technically possible to tag a WAV file, but in practice very little software supports it.
If you don't have the storage available to keep your entire collection in a lossless format, you'll have to use some kind of lossy compression to reduce storage.  MP3 is the most popular and most compatible, and modern encoders have output that's most people will be unable to differentiate from the original CD.  You don't need to use 320 kb/s CBR, most VBR encodings that average >200 kb/s are indistinguishable from the original.
You'll also want ripping software that can ensure that your rips are correct and pop/click/glitch free.  Without getting into a technical explanation about the hows and whys, audio CDs store much less error correction and synchronization information than data CDs do, so it's not easy to ensure that the data read from an audio CD is correct -- even if the CD is flawless.  Your best bet is to look for software that will verify your rips via AccurateRip -- if your CDs match others in AccurateRip's online database, then chances are very good that your rip is OK.  Titles to look for are Exact Audio Copy, dbPowerAmp, and CueTools.  There may be others, but these are the programs I'm familiar with.


text:
Q: How to provide and use varargs or Iterable parameter for custom @Query in Spring Data JPA? I'm using Spring Data JPA (currently 1.11.3.RELEASE) with Hibernate (currently 5.2.10.Final) as JPA implementation
I've got the following scenario as (simplified) example, first a simple User entity class:
@Entity
public class User {

@Id
private Long id;

private boolean active;

// getters/setters (not shown)

}

with a CRUD-based User repository. This user repository should provide methods to deactivate a user identified by its id:
public interface UserRepository extends CrudRepository<User, Long> {

// deactivate single user
@Modifying
@Query("UPDATE User u SET active = false WHERE u.id = ?1")
void deactivate(Long id);

// TODO how to provide a deactivateAll method
}

This solution is well described in the Spring Data JPA documentation using @Query in its modifying form.
What I missed in the docs is how to provide a list of ids as varags or Iterable parameter to allow deactivation of multiple users at once. How can I do that?

A: There is a comparable example of a User repository doing this in the Spring Data JPA source code repository: UserRepository.java e.g. using @Query like this:
@Query("select u from User u where u.id in :ids")
Collection<User> findByIdsCustomWithNamedVarArgs(@Param("ids") Integer... ids);

So you can provide a list of ids either using varargs or Iterable<> as following (in this case using the named parameters variant):
@Modifying
@Query("UPDATE User u SET active = false WHERE u.id IN :ids")
void deactivateAll(@Param("ids") Long... ids);

@Modifying
@Query("UPDATE User u SET active = false WHERE u.id IN :ids")
void deactivateAll(@Param("ids") Iterable<Long> ids);


text:
Q: React Webpack Config error - You may need an appropriate loader to handle this file type I was trying to learn about webpack I follow the instructions on the documentation but it gives me an error of.
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| render.render(
>     <React.Fragment>
|         <App/>
|     </React.Fragment>

here's my webpack.config.js
import path from 'path';

module.exports = {
  entry: path.resolve(__dirname, './src/App.js'),
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: 'bundle.js',
  },
  devServer: {
    historyApiFallback: true,
  },
  module: {
    rules: [
      {
        test: /\.js$|jsx/,
        use: "babel-loader"
      }
    ]

}
};
and here's my babel config.
module.exports = {
    presets: [
        "@babel/preset-env", "@babel/preset-react"
    ]
}


text:
Q: Use replace() selectively? I have hierarhical dropdown which has 3+ steps. Im using very convenient WordPress function which uses   to fake <optgroup> / hierarchy. Don't tell me to use <optgroup> like everybody else, it doesn't work with more than 2 steps in hierarchy.
Strings in HTML looks something like this:
Colors  (21)
  Red  (7)
   Dark  (3)
   Light  (4)
  Blue  (13)
   Dark  (5)
   Light  (8)
  Yellow  (1)
   Light  (1)

Which outputs something like this in dropdown:
Colors (21)
  Red (7)
    Dark (3)
    Light (4)
  Blue (13)
    Dark (5)
    Light (8)
  Yellow (1)
    Light (1)

I need to remove the white space before the word when the item is selected.
Im currently using myString.html.replace( / /g,'' ); but it also removes white space between the word and (count).
How to remove the white space only before the word and not between the word and (count)?

A: You can use the starts with notation, which will select only   at the beginning of the string
myString.html.replace( /^( )+/,'');


text:
Q: Cryptic Python job ad Saw this cryptic job ad in the Tube, but it appears to evaluate to [] which doesn't seem terribly exciting. Any ideas on how to coax a more useful result from it?
bytes(
    map(
        lambda x: x-1,
        filter(
            lambda y: y < sum(2**x for x in {z for z in range(7)}-{2}),
                b'~b{qq}mz!o|px'
        )
    )
)

https://repl.it/KkRj/0

A: in python 2, this code doesn't yield anything (empty list) because of this:
>>> b'a'[0] < 100
False

b prefix doesn't really create a bytes object in python 2. So you're back to comparing a string with an integer, which is always false in python 2 (not sure if the coders overlooked that or did that on purpose)
On the other hand, in python 3, comparison works properly
>>> b'a'[0] < 100
True

so the filter works and the result is "apply now".
Aside: don't you hate this syntax {z for z in range(7)} when it can just be set(range(7)) (faster & shorter) ?


text:
Q: Manual Login flow with Facebook in Mac os App I am learning mac app development and i want to implement login with Facebook in my mac OS app. But i try to find SDK of Facebook in developer account but did not got any SDK for mac. I read somewhere that we can implement manually login flow using Facebook graph API but i don't know how to implement. Any one did Facebook login for mac desktop app than please suggest me how to implement.
Thank you.

A: Manually Build a Login Flow
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow?locale=en_US
Anyone implemented this approach under macOS?


text:
Q: Why would SQL Server get a database stuck in DATABASE_SNAPSHOT_CREATION? I've a database in a production server which has a log that is getting enormous, while trying to understand the reason, I've issued this query:
SELECT name, log_reuse_wait_desc FROM sys.databases

The database in question has DATABASE_SNAPSHOT_CREATION, and even tough the docs say it should be a momentary state, it's been in this state for 10 mins. I'm guessing it's what's keeping the log from becoming manageable.
How can I fix this?
PS: I'm using the SIMPLE recovery mode.

A: OK - Try running DBCC SQLPERF(LOGSPACE).  That will tell you how much of that log file is actually being used.

A: I had a similar issue,
now it is sorted out :)
-> database on simple recovery mode, showing up this DATABASE_SNAPSHOT_CREATION on the log_reuse_wait_desc.
what I did to sort it out was to run the script below:
use Databasename
go

checkpoint

the "checkpoint" part I run many times.
after that no more DATABASE_SNAPSHOT_CREATION.
The scripts that I have used in my quest are the following:
DBCC SQLPERF(LOGSPACE)

select log_reuse_wait_desc, * from sys.databases
where log_reuse_wait_desc != 'NOTHING'

SELECT * FROM sys.dm_exec_requests

checkpoint

A: Do you have any large transactions open? Database snapshots are always taken of the database in a consistent state.  If a large transaction has been running for, say, 10 minutes, the transaction has to be rolled back in the snapshot before the snapshot can be complete.
SELECT * FROM sys.dm_exec_requests

The above query can tell you what's running at the time it is run.


text:
Q: C++ Bool not returning true or false using pointers Im trying to implement a list of nodes on my own using pointers.
So ive this on my class as private:
class cj_enters {

private:
struct node{
  node* next;
  node* prev;
  int info;
};

node* first;
node* last;
node* actual;

int size;

public:
.
.
};

And im trying to implement this method:
bool cj_enters:: operator==(const cj_enters& B) const{
  bool cerca = true;
  node* aux = first;
  while(aux != NULL and cerca){
      if(!B.conte(aux->info)) // this method is working and it tells if object B has the info somewhere of the current node info(aux).
      {
          cerca = false;
      }
      else aux = aux -> next;
  }

return cerca;
}

So I don't know why but this method is returning me strange values like 244 or so when I compare two of these objects, it doesn't matter if they are the same or they are not.
Why is that? Thanks

A: If first==NULL then aux==NULL and then you call delete aux.


text:
Q: Does the order in which you add records to DbSets in EF has any effect in raising Foreign Key conflicts? In working with EF Database first, I am not being able to insert records into a specific table. I get the INSERT statement conflicted with the Foreign Key... error.
My question:
Assuming EF requires you to perform only a single dbContext.SaveChanges() at the end of your changing process, does the order you add records to the DbSets has effect on this ? Or it does not matter since the DbContext keeps track of all the changes made to the data and is itself responsible to apply them in the proper order ?
To illustrate, for 3 tables A, B and C, where B has a FK on A and C a FK on B, if I manually loop over all records I have to add to C, B and A - and do DbSet<C>.Add() before I issue DbSet<B>.Add() is problematic ?
Is it required to issue a dbContext.SaveChanges() for each table additions ?
Adding the create sql script for all 3 tables:
CREATE TABLE [dbo].[A](
    [Id] [int] NOT NULL,
    [a1] [int] IDENTITY(1,1) NOT NULL,
    [a2] [nvarchar](50) NULL,
 CONSTRAINT [PK_A] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [IX_A] UNIQUE NONCLUSTERED
(
    [a1] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[B](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [a1] [int] NULL,
    [b1] [int] NULL,
    [b2] [nvarchar](50) NULL,
 CONSTRAINT [PK_B] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [IX_B] UNIQUE NONCLUSTERED
(
    [b1] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[B]  WITH CHECK ADD  CONSTRAINT [FK_B_A1] FOREIGN KEY([a1])
REFERENCES [dbo].[A] ([a1])
GO

ALTER TABLE [dbo].[B] CHECK CONSTRAINT [FK_B_A1]
GO

CREATE TABLE [dbo].[C](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [b1] [int] NULL,
    [c1] [int] NULL,
    [c2] [nvarchar](50) NULL,
 CONSTRAINT [PK_C] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[C]  WITH CHECK ADD  CONSTRAINT [FK_C_B] FOREIGN KEY([b1])
REFERENCES [dbo].[B] ([b1])
GO

ALTER TABLE [dbo].[C] CHECK CONSTRAINT [FK_C_B]
GO

I know what the error aforementioned means, but I could not find yet which data is incorrectly linked/inconsistent.
And by the way, why such errors (INSERT statement conflicted with the Foreign Key...) are not "caught" in GetValidationErrors() ?

Update:
The problem must be the way I am trying to populate the tables. But how should this be done then ?
For the scenario below:

private static void Main(string[] args)
{
    //Validate_Xml_Against_Xsd.ValidateXmlAgainstXsd example = new Validate_Xml_Against_Xsd.ValidateXmlAgainstXsd();
    //example.Run();

    TestEntities t = new TestEntities();

    A a = new A { a1 = 1000, a2 = "aaa" };
    B b = new B { a1 = 1000, b1 = 87141, b2 = "bbb" };
    C c = new C { b1 = 87141, c1 = 1, c2 = "ccc" };

    t.C.Add(c);
    t.B.Add(b);
    t.A.Add(a);

    //changing the order does not fix it
    //t.A.Add(a);
    //t.B.Add(b);
    //t.C.Add(c);

    int s = t.SaveChanges();

    Console.WriteLine(s);
}

How should the tables be populated ? Both my DbSet.Add() attempts fail with
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_B_A1". The conflict occurred in database "Test", table "dbo.A", column 'a1'.
The statement has been terminated.

A: No, the order is not important. The problem here is that you seem to have foreign keys but you lack navigation properties and you never set relations between entities.
Thus, when B is persisted, it doesn't point to any valid A. A correct code should look somehow like
A a = new A() { ....
B b = new B() { a = a, ...

assuming that your navigation property from B to A is called a.


text:
Q: linux - how to run a selenium-server-standalone? I created a .sh file with the following content:
java -jar selenium-server-standalone-3.3.1.jar -Dwebdriver.gecko.driver=./opt/webdrivers/geckodriver

I already made sure that the file /opt/webdrivers/geckodriver has permission to get executed by using chmod 770 and I even changed the user to root.
But this is the result if I execute my .sh file:
root@mycomputer:/opt/Selenium# ./selenium.sh
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -Dwebdriver.gecko.driver=./opt/webdrivers/geckodriver
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
    at org.openqa.grid.selenium.GridLauncherV3$1.setConfiguration(GridLauncherV3.java:227)
    at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:155)
    at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:75)

What am I doing wrong?

A: You have to specify the parameters right after -jar:
java -jar -Dwebdriver.gecko.driver=./opt/webdrivers/geckodriver selenium-server-standalone-3.3.1.jar

Note: This is a knowledge sharing answer (share your knowledge, Q&A-style)


text:
Q: a connected graph $G=(V,E)$ such that $i(G)> ((3/4)V)-2$ Dominating set for a graph $G=(V,E)$ is a subset $D$ of $V$ such that every vertex not in $D$ is adjacent to at least one member of $D$. The domination number $γ(G)$ is the number of vertices in a smallest dominating set for $G$.
Independent set is also a dominating set if and only if it is a maximal independent set, so any maximal independent set in a graph is necessarily also a minimal dominating set. Thus, the smallest maximal independent set is greater in size than the smallest independent dominating set. The independent domination number $i(G)$ of a graph $G$ is the size of the smallest independent dominating set (or, equivalently, the size of the smallest maximal independent set).
i need a connected graph $G=(V,E)$ such that $i(G)> ((3/4)V)-2$ or $i(G) > ((2/3)V)-1$.
Can you help me?

A: $P_4$, the path on 4 vertices fulfills your condition. We have $i(P_4)=2$ which is bigger than both $4\frac34-2=1$ and $4\frac23-1=\frac43$


text:
Q: How to filter through table using keywords and access that row of information I have an excel sheet that lists all the engineering standard procedures (ESP) my company owns. I am trying to add another sheet to the Excel document to be used as a search bar so that when my colleagues and I type in a keyword that matches the description of the ESP (which is included in the original document) It lists the possible matches and includes the hyperlink for those esps (which is included in the original document), just in a different column then the description. Any help would be appreciated thank you!
I sort of have a solution for my problem, but it does not show any hyperlinks in the extraction table and I am limited to using one column for my data array, which is essentially my description column. So I have to manually re-enter all the esp #'s to that column.
I placed three different components in the new sheet that I added to the excel document. One component is just an two cells that are labeled search, where I could type in the key words I would like to search.
The second component is a count cell with the following formula :
=COUNTIF(Sheet1!A4:B95,"*"&B7&"*")
and the last is my extraction table with the following formula :
=IF(G5>B11,"",INDEX(Sheet1!B4:B95,AGGREGATE(15,6,(ROW(Sheet1!B4:B95)-ROW(Sheet1!$B$5)+2)/ISNUMBER(SEARCH(B7,Sheet1!B4:B95)),G5)))
I basically did what this tutorial told me to do link : https://exceljet.net/formula/extract-all-partial-matches

A: This works for me:

Formula in D2:
=IFERROR(INDEX($A$1:$A$7,AGGREGATE(15,3,IF(ISNUMBER(SEARCH($C$2,$A$2:$A$7)),ROW($A$2:$A$7),""),ROW(A1))),"")

Enter with Ctrl+Shift+Enter
Formula in E2:
=HYPERLINK(IFERROR(INDEX($B$1:$B$7,AGGREGATE(15,3,IF(ISNUMBER(SEARCH($C$2,$A$2:$A$7)),ROW($A$2:$A$7),""),ROW(A1))),""))

Again, enter with Ctrl+Shift+Enter
Drag both formula's down


text:
Q: Why does the line `safecrlf = trueexport` keep getting appended to my .gitconfig file? I have searched the bowels of the internet and have been unable to determine what could be going on here:

*

*For some reason, the line safecrlf = trueexport keeps appending to my [core] global .gitconfig settings

*It will often be appended multiple times

*This causes the following error when I try to run any git command: fatal: bad boolean config value 'trueexport' for 'core.safecrlf'
The rest of my .gitconfig is quite simple:
[user]
    name = myusername
    email = myemail@email.com
[core]
    editor = code --wait
    autocrlf = input
    safecrlf = true
    safecrlf = trueexport // here's the offending line
    safecrlf = trueexport // as you can see, in this instance it appended 4 times
    safecrlf = trueexport
    safecrlf = trueexport

[color]
    ui = auto

[alias]
  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
  type = cat-file -t
  dump = cat-file -p

[init]
    defaultBranch = main

*

*I can resolve this error by deleting this setting, but it keeps reappearing

*I have not been able to identify any pattern that leads to the line getting appended

*It happens quite regularly, but once I delete the offending line I can generally use git with no issues for a bit, but again, there is no consistent pattern that I have been able to recognize (it's not, for example, something like "The line appears once a day and after deleting it I can use git for another 24 hours")

*I have tried adding and removing the following settings as well, but it doesn't seem to impact this behavior:

    autocrlf = input
    safecrlf = true

A: You have a misbehaving program (or IDE plugin for Visual Studio Code or whatever) that runs git config --global --add core.safecrlf trueexport.  Find it and squash its bug.  (The problem is not in Git itself; this would have been found ages ago, if it were.)
I suspect the misbehaving program is supposed to read:
git config --global --add core.safecrlf true
export something

and somehow the export word from the subsequent line got pasted up against the true word from the git config line.


text:
Q: How to find the highest value of each row in a 2d array(matrix) c# Each line represent the grades of a random stundent
Each column represents the grades of a random subject
Find the highest grade obtained by each student
The expected output is:
The student 0 has the highest grade =  10
The student 1 has the highest grade =  10
The student 2 has the highest grade =  10
The student 3 has the highest grade =  10
The student 4 has the highest grade =  10
The student 5 has the highest grade =  9

Here is the array:
double[,] grades;
    grades = new double[6, 4];
    grades[0, 0] = 8; grades[0, 1] = 10; grades[0, 2] = 9; grades[0, 3] = 7;
    grades[1, 0] = 7; grades[1, 1] = 9; grades[1, 2] = 8; grades[1, 3] = 10;
    grades[2, 0] = 6; grades[2, 1] = 6; grades[2, 2] = 7; grades[2, 3] = 10;
    grades[3, 0] = 6; grades[3, 1] = 5; grades[3, 2] = 10; grades[3, 3] = 7;
    grades[4, 0] = 10; grades[4, 1] = 4; grades[4, 2] = 9; grades[4, 3] = 8;
    grades[5, 0] = 9; grades[5, 1] = 7; grades[5, 2] = 5; grades[5, 3] = 9;

Here is my code :
double maxGrade;
maxGrade = grades[0, 0];
    for(int student = 0; student < note.GetLength(0); student++)
{
      for(int subject = 0; subject < note.GetLength(1); subject++)
{
        if (grades[student, subject] > maxGrade)
            maxGrade = grades[student, subject];
}
Console.WriteLine("The student " + student + " has the highest grade =  " + maxGrade);
}
My output is :
The student 0 has the highest grade =  10
The student 1 has the highest grade =  10
The student 2 has the highest grade =  10
The student 3 has the highest grade =  10
The student 4 has the highest grade =  10
The student 5 has the highest grade =  10

A: You keep the maxGrade between students, which causes the wrong result. You need to reinitialize it for each student:
for (int student = 0; student < note.GetLength(0); student++)
{
    double maxGrade = grades[student, 0];

    // Note you can start the iteration at 1, since you already grabbed index 0
    for (int subject = 1; subject < note.GetLength(1); subject++)
    {
        if (grades[student, subject] > maxGrade) {
            maxGrade = grades[student, subject];
        }
    }
    Console.WriteLine("The student " + student + " has the highest grade =  " + maxGrade);
}


text:
Q: How to turn off automatic typing correction in Lion? Since upgrading to Lion I notice that typing is automatically getting "corrected".
For example, I type "I posted to elance that" and the word elance automatically changes to "glance".  I back up and change the 'g' to an 'e' and it changes it back to "glance" again.
I first noticed it in Mail, but I see it's also happening here in Safari too.
How do I turn this off?  Note: I don't mind the 'red-squiggle' when it thinks there's a typo, but I don't want it automatically changing my text.

A: Go to system preferences -> and then language/text
Hit the "Text" tab.
There is a checkbox that says "Correct spelling automatically". Uncheck it.
Look here for more info:
http://www.applegazette.com/mac/how-to-disable-auto-correct-in-os-x-lion/

A: Open a terminal window, and run this:
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool NO

A: User "Gauzy" posted this in a comment.  I'm posting it here and marking it as the correct answer:
For Safari (or any other app with a text input box, for the most part) right click (or control click) the text area, goto Spelling and Grammar, and deselect Correct Spelling Automatically. Screenshot – Gauzy


text:
Q: How do I refer to a word in a vocabulary list in regards to what position it has there? I have a list of vocabulary words (it can also be a list of idioms). Now, how do I refer to a particular word in regards to what position it has in the list? I really don't know how to formulate this properly but it should be something along the lines of, for example, when you receive an invoice and in that invoice there are lines and each line has something written on it (maybe, some kind of service that you paid for). So, you can refer to a particular item listed in the invoice as a line item. Can you think of something similar but for words in a vocabulary list? Does list item sound alright to you guys?
An example of a word list (note: adjectives and nouns):

*

*prehistoric

*naughty

*dough

*shy

*utility

An example of an idiom list:

*

*rain cats and dogs

*cop a plea

*aim high

*my dogs are barking

*count me in

I need this term as a table column name for my database application.

A: "Item" is a generic term for something in a "list".
Each item in a list of words is an "item" or a "word".  Each item is also a "concept", but that does not sound natural to my (American) ear.
Each item in a list of idioms is an "item" or an "idiom" or a "concept".
For example, if your list of words is:

*

*Wolves -- (Plural noun) the wild ancestors of dogs.

*Roc -- (Singular noun) a mythical giant bird.

*Recite -- (Verb) to speak from memory.

*Gigantic -- (Adjective) very large, like a giant.

*Invisibly -- (Adverb) in a way that cannot be seen.

You could say:

*

*The first word is plural.

*The second word is a noun.

*The penultimate word is an adjective.

*The last word is an adverb.

You could store this list (or a similar list of idioms) in a database table with a schema like this:

*

*id (unique number or autonumber, of the row within the table)

*concept (non-nullable string)

*plurality (nullable small integer, such as 1 (for singular), 2 (for paired items), 3 (for plurals))

*part of speech (using a look-up table)

*definition (string)

You could combine the fields for plurality and part of speech into a single field, also using a look-up table.
You could have another table, which maps ids of items in the list to ids of items that are helpful for understanding them.  For example, you could map the idiom "rain cats and dogs" to items for "rain", "cats", and "dogs".

A:
How do I refer to a particular word in regards to what position it has in the list?

You could refer to that as the item's ordinality:

ordinal
  1. Being of a specified position in a numbered series: an ordinal rank of seventh
  2. A numeral which designates the place or position of an object in some particular series, as first, second, third, etc.
(definitions from Wordnik)

So, within their respective lists, naughty and cop a plea both have the same ordinality, because they are both the second item in the list.

A: I'm not sure what is practiced at your place, but here, in India, when I sit with programmer, they often label it as sr_no i.e. serial number.
Here is what something a programmer in India would do. If it looks okay, you may go for it.


text:
Q: ng-repeat is not binding the data I'm new to angularjs and trying to work with ng-repeat directive example to bind the data to HTML table element.
My js file is located in scripts location where it has a module and controller with some data that is attached to the scope object in that controller.
Now what I want is simply bind that data to my HTML table element and display the data using ng-repeat. I'm using ng-repeat because I have multiple rows to be displayed in the table.
Here is my angular code:

`

/// <reference path="angular.min.js" />
/// <reference path="angular.js" />

var angularModule = angular.module("TestMyModule", []);
    angularModule.controller("MyController", function ($scope) {
    var employee  = [
                    {FirstName: "GGG",LastName: "SSS",MiddleName:"G"},
                    {FirstName: "G",LastName: "S",MiddleName: "GG"},
                    {FirstName: "GGS",LastName: "GSS",MiddleName: "GS"},
                    {FirstName: "Go",LastName: "Sa",MiddleName: "Gu"},
                    {FirstName: "Goo",LastName: "SAA",MiddleName: "Gu"}
    ];
    debugger;
    $scope.employee = employee;

});

`
Following is my HTML code
<!DOCTYPE html>

    <title>AngularJS Example</title>

                    First Name
                    Last Name
                    Middle Name

                    {{employees.FirstName}}
                    {{employees.LastName}}
                    {{employees.MiddleName}}

Following is the output that I got:
 First Name                 Last Name            Middle Name

{{employees.FirstName}}  {{employees.LastName}}  {{employees.MiddleName}}
using browser debugger tool, I found the following errors, but not sure how to resolve:
AngularExample.js:6 Uncaught ReferenceError: angular is not defined
angular.js:4631 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.7/$injector/modulerr?p0=angularModule&p1=Er…20c%20(http%3A%2F%2Flocalhost%3A2785%2FScripts%2Fangular.min.js%3A20%3A359)
firebug-lite.js:11883 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
firebug-lite.js:30905 Uncaught TypeError: Cannot read property 'push' of undefined

Can someone please help me??

A: Change the file sequence how you have loaded, angular should have loaded before the AngularExample.js in order to load library API available first.

And ng-app should be ng-app="TestMyModule" which is angular module name.


text:
Q: Stop iPod music by NSTimer on background mode I'm planning to create an application that plays the ipod Music Library, then the app sets a NSTimer that will stop the ipod Music player on a certain time. My question does my timer will still run when I entered the background mode. Is it possible to stop the ipod Music player on background Mode?
Thanks

A: [timer invalidate]

use this in your code.


text:
Q: UINavigationController Broken in IOS 8? I have a series of UIViewControllers in my app, and these are presented using a UINavigationController. The HOME ViewController calls pushViewController to get to the PROFILES ViewController. The PROFILES screen correctly shows the back button to HOME. Then selecting a button on PROFILES will take the user to the DETAIL ViewController. The DETAIL screen correctly shows the back button to PROFILES. But when I press the back button to PROFILES, I do indeed go back to the PROFILES screen but the navigation bar on that screen now shows the title HOME with no back button. In other words, it appears that IOS 8 has popped the ViewController once to go back from DETAIL to PROFILES, but has somehow popped the navigation bar items twice!
Any idea how I can fix this?

A: Apparently the solution outline can be found here:
UINavigationController and UINavigationBarDelegate.ShouldPopItem() with MonoTouch
In my solution, I just have all my view controllers extend CustomUINavigationController, which looks like this:
#import "CustomUINavigationController.h"
#import "IOSVersion.h"

@interface CustomUINavigationController ()

@end

@implementation CustomUINavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.delegate=self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//
// The following two methods are the key to overriding the buggy behavior in IOS 8
// The first method is from here:
// https://stackoverflow.com/questions/6413595/uinavigationcontroller-and-uinavigationbardelegate-shouldpopitem-with-monotouc
//
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {
    NSLog(@"Inside shouldPopItem");
    if (regularPop) {
        NSLog(@"regularPop is TRUE");
    } else {
        NSLog(@"regularPop is FALSE");
    }
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
        if (regularPop) {
            regularPop = FALSE;
            return YES;
        }

        regularPop = TRUE;
        [self popViewControllerAnimated:YES];
        return NO;
    } else {
        return [super navigationBar:navigationBar shouldPopItem:item];
    }
}

- (UIViewController *)popViewControllerAnimated:(BOOL)animated
{
    NSLog(@"Inside popViewControllerAnimated");
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
        NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.viewControllers];
        int cnt=(int)[viewControllers count];
        NSLog(@"Inside popViewControllerAnimated, cnt is %d",cnt);
        UIViewController *vc=[viewControllers objectAtIndex:cnt-2];
        if (regularPop) self.desiredVC=vc;
        [self popToViewController:vc animated:animated];
        return vc;
    } else {
        return [super popViewControllerAnimated:animated];
    }

}

- (UIViewController *)manualpopViewControllerAnimated:(BOOL)animated {
    NSLog(@"Inside manualpopViewControllerAnimated");
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
        regularPop=TRUE;
        return [self popViewControllerAnimated:animated];
    } else {
        return [super popViewControllerAnimated:animated];
    }
}

- (void)navigationController:(UINavigationController *)navigationController
   didShowViewController:(UIViewController *)viewController
                animated:(BOOL)animated {
    NSLog(@"Inside didShowViewController");
    if (viewController==self.desiredVC) {
        NSLog(@"Inside didShowViewController, found desiredVC");
        regularPop = FALSE;
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
Q: UserID in table is 0 i have a user table in this table there is a column userid,name..
and there is another table which is leave in this columns are leaveid,leavetype,userid
when usersignup the his/her info is save in user table like this
userid username:
1 abc
userid is primary key
then when this same user upload documnet like
leaveid leavetype userid :
1         2         0
then i want userid in document like this
leaveid leavetype userid
1         2         1
i try this code to save userid in session
int user_id;
if (Session["UserID"] != null)
{
    user_id =  Convert.ToInt32(Session["UserID"].ToString());

    if (users == 1)
    {
        //Session["UserID"] = aa.SignIn(txt_username.Value, txt_pass.Value);

        Session["Login2"] = txt_username.Value;

        Session["UserTypeID"] = users;

        Response.Redirect("AdminOp.aspx");

    }
}

else if (users == 2)
{
    //Session["UserID"] = aa.SignIn(txt_username.Value, txt_pass.Value);

    Session["Login2"] = txt_username.Value;

    Session["UserTypeID"] = users;

    Response.Redirect("leave.aspx");

}

but in leave table userid column show me 0


text:
Q: Does JMESPath support something like a spread operator? Is it possible to convert this JSON:
{ "message": "Hello!", "contextMap": { "foo": 1, "bar": 2, ...otherInContextMap }, ...someOther }

(where keys of contextMap are not known) into the following JSON:

{ "message": "Hello!", "foo": 1, "bar": 2, ...otherInContextMap  }

using JMESPath?
(Context: I want to scrape Java logs with contextMap using Promtail and store message together with members of contextMap to Loki.)
EDIT: I need to explicitly pick message and members of contextMap. (There are some other unknown/dynamic members ...someOther in JSON.)

A: You can merge a basic query selecting the content of contextMap along with a multiselect hash for the message.
So, given the query:
merge({message: message}, contextMap)

On your given input, it would yield the expected:
{
  "message": "Hello!",
  "foo": 1,
  "bar": 2
}


text:
Q: Git tag pointing to commit that doesn't appear in the logs I ran a script which was supposed to create a git tag.
When I search for that tag: git show-ref --tags
I get a commit: 020795b07753c02034500f10f17dbc82edf refs/tags/my-tag
Then, when I search for the branch containing that commit:
git branch --contains 020795b07753c02034500f10f17dbc82edf

I get a branch: feature/my-feature
The problem is that if I search 020795b07753c02034500f10f17dbc82edf through the logs of feature/my-feature (obtained with git log), I can't find it.
Any idea why the tag is pointing to a commit that isn't in the logs?

A: As Lasse V. Karlsen said in the comments, what you have is an annotated tag.
The part that does not make sense is your comment-answer to what happens if you run git cat-file -p 020795b07753c02034500f10f17dbc82edf.  You said you got:
object 020795b07753c02034500f10f17dbc82edf
type commit
tag my-tag [maven-release-plugin]
copy for tag my-tag

This would imply that you have found another hash collision: a tag object whose ID is 020795b07753c02034500f10f17dbc82edf, yet which one which points to a commit object whose ID is also 020795b07753c02034500f10f17dbc82edf.  This is literally impossible—not that a collision is impossible (see https://shattered.it/), but rather that Git has stored two different objects under a single ID.  This is because Git's "true name" for an object, the way it finds the object's contents, is the hash ID.  Once Git has stored one object with one ID, it refuses to store another, different object with the same ID.  If 020795b07753c02034500f10f17dbc82edf is already a commit, an attempt to drop a tag in under the name 020795b07753c02034500f10f17dbc82edf is simply rejected.

Here is an example of an annotated tag in the Git repository for Git itself:
$ git show-ref --tags
[massive amount of output snipped]
f883596e997fe5bcbc5e89bee01b869721326109 refs/tags/v2.9.3

Here v2.9.3 is a tag name—a reference in the refs/tags/ namespace—pointing to Git object f883596e997fe5bcbc5e89bee01b869721326109.  The object itself is an annotated tag:
$ git cat-file -t f883596e997fe5bcbc5e89bee01b869721326109
tag

and its contents are the tag object, which points to the commit object:
$ git cat-file -p f883596e997fe5bcbc5e89bee01b869721326109
object e0c1ceafc5bece92d35773a75fff59497e1d9bd5
type commit
tag v2.9.3
tagger Junio C Hamano <gitster@pobox.com> 1471018679 -0700

Git 2.9.3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAABAgAGBQJXrfa3AAoJELC16IaWr+bLLY8QANE8ZaL+qyhjC8fHfJhhr4cY
GeZe8x9SSTNv0WzOvXGf34XwdpOYYiVrUrwlgBx6HglhDeYzCp4kObR5sHwtTKgN
r0KKvAuvjlZJm5tWNavu2fDoHKhE+QRP3AagaF5iDX68QLjhGOS8+zAWqNRukh7y
X6tmdUhGhWPtUKr1LBUVd94GdF8v5tggCNDcqZZj+dPIosPvlDqGWT29/IKyCU/a
4o91hD5jWkMybfyTwzZDsSYmtB4TXxML8idJUdZQ5LyyPq9uSU63lgP8ljwivYzy
oiVB1OOawym7+PeyvZEvLvpFW1Ks7YSTCMNQjn4Y3dxYF3szuoPZV3ztCzngoEIG
qSuzA0sn6zfaMWAQF2Yjix2zBfSlBXmxNzA/WqYAyNr3Lsias5A/X9nFtowSEi56
0iFVilSsKWc3bC0oNEyYFlUs1kY4rR2S5kbBXTJ6l75bvDvXP/L+JXm4QcRCr92i
6i7NYxeNqfnZZV72KeG2EqZaL4mrXAY68Mjv8jd/80oogCUDBhlTKd8IK/WG64M9
VjfHpvKmtkBaIq6Zz0cQxO1pe4F64GzSNzlC9l787iQCnUW+4BO7OyEAByJWzHn+
D5oSfWI79MDVdvw2UlHvk1tg4bNNYLcNwTGZGQhcwXudv7hpzW3s1PBNY0LzXGux
LBOdlVeCcsYGr2rsRMbm
=PhTI
-----END PGP SIGNATURE-----

(this particular tag has a GPG signature).  The actual commit is e0c1ceafc5bece92d35773a75fff59497e1d9bd5.  It is this (different) commit object that is contained in various branches.  The tag object is in no branches.  Aside from its hash ID, the way you—or Git—find the tag object is by looking up the tag name, refs/tags/v2.9.3.  One then finds the commit by reading the tag object.
Since this tag object refers to additional Git object e0c1ceafc5bece92d35773a75fff59497e1d9bd5, that is the target (my term) of this annotated tag.  The tag object claims that the target has type commit, so git cat-file -t should say it is a commit, and it does:
$ git cat-file -t e0c1ceafc5bece92d35773a75fff59497e1d9bd5
commit

and the commit object in turn looks normal:
$ git cat-file -p e0c1ceafc5bece92d35773a75fff59497e1d9bd5
tree 3cc4bf42e1b9aaa3c650af7247019890f7e01c95
parent 9b601eafd1437df2e11b032bfbfd1ac5d32d3290
author Junio C Hamano <gitster@pobox.com> 1471018671 -0700
committer Junio C Hamano <gitster@pobox.com> 1471018671 -0700

Git 2.9.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>

and all is well in Git-land.


text:
Q: sequelize.js association accessor I made API server with Node.js
Also I use sequelize.js(version 4) for communicate with MySQL.
My table structure is here.

[Article]

*

*no(PK)

*subject

*content

*created_at

*updated_at

  [Comment]

*

*no(PK)

*content

*created_at

*updated_at

*article_no(FK to Article)

[index.controller.js]
import { Article, Comment } from '../model/model';

export const index = (req, res) => {
    res.send('controller index');
};

export const getArticle = (req, res) => {
    try {
        Article.all()
        .then(article => {
            res.status(200).json({status: true, result: article});
        });
    } catch(e) {
        res.status(500).json({status: false, result: "get article fail"});
    }
}
export const addArticle = (req, res) => {
    const { subject, content } = req.body;
    try {
        Article.create({
            subject: subject,
            content: content
        })
        res.status(200).json({status: true, result: "article write success"});
    } catch(e) {
        res.status(500).json({status: false, result: "article fail"});
    }
}
export const getComment = (req, res) => {
    try {
        Comment.all()
        .then(comment => {
            res.status(200).json({status: true, result: comment})
        });
    } catch(e) {
        res.status(500).json({status: false, result: "get comment fail"});
    }
}
export const addComment = (req, res) => {
    const { content, article_no } = req.body;
    try {
        Comment.create({
            content: content,
            article_no: article_no
        })
        .then(() => res.status(200).json({status: true, result: "comment write success"}))
    } catch(e) {
        console.log(e);
        res.status(500).json({status: false, result: "comment fail"});
    }
}

[index.js]
import express from 'express';
import { index, getArticle, getComment,addArticle, addComment } from './index.controller';
const router = express.Router();

router.get('/', index);

router.get('/article', getArticle);
router.post('/article', addArticle);
router.get('/comment', getComment);
router.post('/comment', addComment);

export default router;

[model.js]
import Sequelize from 'sequelize';

const sequelize = new Sequelize('db', 'id', 'pw', {
    host: '127.0.0.1',
    dialect: 'mysql'
})

export const Article = sequelize.define('article', {
    no: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    subject: {
        type: Sequelize.STRING,
        allowNull: false
    },
    content: {
        type: Sequelize.STRING,
        allowNull: false
    }
}, {
    freezeTableName: true,
    underscored: true
})

export const Comment = sequelize.define('comment', {
    no: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    content: {
        type: Sequelize.STRING,
        allowNull: false
    }
}, {
    freezeTableName: true,
    underscored: true
})

Article.hasMany(Comment, {as: 'Comments'}); // association
Comment.belongsTo(Article); // association

sequelize.sync({
    force: false
});

Because of association(hasMany, belongsTo), article_no column will be added to Comment table.
Refer to this document, http://docs.sequelizejs.com/manual/tutorial/associations.html#one-to-many-associations-hasmany-
It says that Instances of Project will get the accessors getWorkers and setWorkers.
In my case, it will be getComments and setComments.
But I don't know exactly how can I get all the comments related articles with using accessor.
Current output is here. (If I connect to GET /article)
{
   "status":true,
   "result":[
      {
         "no":1,
         "content":"comment test",
         "created_at":"2018-07-18T05:00:45.000Z",
         "updated_at":"2018-07-18T05:00:45.000Z",
         "article_no":1
      }
   ]
}

Desired output is here
{
   "status":true,
   "result":[
      {
         "no":1,
         "content":"comment test",
         "created_at":"2018-07-18T05:00:45.000Z",
         "updated_at":"2018-07-18T05:00:45.000Z",
         "article_no":1,
         "comments": [
            // related comments here!
         ]
      }
   ]
}

Thanks.

A: When you want to join another model you should use include in your query
User.findAll({
  include: [
     { model: Profile, required: true // inner join }
  ],
  limit: 3
});

Check out the Sequelize model usage docs.
To access the comments with accessors you will need do something like this:
const articles = await Article.all();

articles.forEach(article => {
  const comments = await article.getComments();
})

The idea behind is that each article sequelize object will have the accessor getComments but internally what it does when you execute getComments it makes a new request to the database with the prepopulated articleId in the comments where query. This is called lazy loading because you can load the data when you need it. But that is not your case.
For the desired output  I suggest to use the include method cause it will make a single request to the database.


text: Q: Org-mode beamer export: suppressing title slide? How can I suppress the generation of the title slide in org-mode beamer export?  Adding title:nil to an #+options line does not do the trick.  I find plenty of tips on customizing the title page, but what I want is to make the thing go away.


text: Q: How do I create a self-signed S/MIME signing certificate with OpenSSL and then sign a file? I would like to create a certificate with OpenSSL and then use it to create an S/MIME format detached signature of a file. Is this something that makes sense in the context of S/MIME? How do I get OpenSSL to perform this task?


text:
Q: a:focus not working in touch devices like iphone, samsung galaxy I have defined css for a:focus which is working fine in desktops and laptops,but is not working in iphone , samsung galaxy, other touch devices etc.
Do we need to define any alternative css for a:focus in touch devices.
Thanks,
Balaji

A: u may need to write js. ation tap_down tap_up tap_leave.

A: For mobile devices you can use a:active as css selector instead.


text:
Q: set of continuous functions to continuous functions: is $R$ complete?
Hi, I can do part (i) and (ii) but have trouble understanding part (iii). I can't intutively feel what the map R does. It takes continuous function to continuous function? How would I start the proof?
Thanks.

A: By construction, any function  in the image of $R$ can be extended to a function in $C([0,1],\mathbb{R})$. Given a Cauchy sequence in the image of $R$, extend all its elements, and obtain a Cauchy sequence in $C([0,1],\mathbb{R}),$ which is a complete metric space. Reduce the limit function back to $(0,1)$, and get a limit to the initial sequence.


text:
Q: Jmeter Junit request with FirefoxDriver I have an issue using latest firefox browser (50.1.0) with Selenium WebDriver and JMeter Combination. I am trying to fire up my test cases in firefox browser using Jmeter. I am using Selenium webdriver to build a JAR File and calling it in JMeter Junit Request. When I run my test case it fires up browse but get stuck at NEW TAB and doesn't call in my URL to play test scenario. IF I use an old Firefox browser (23) it works fine, but I am reading all articles for this issue, and they all say starting firefox 48 version, and for selenium 3.0 webdriver, we have to use gecko driver. I am using that as well. But still no use. here is my sample code:
public void test() {
    System.setProperty("webdriver.gecko.driver","c:\\Selenium\\FireFox_Driver\\geckodriver.exe");
/*  FirefoxProfile fp=new FirefoxProfile();
    DesiredCapabilities dcap=DesiredCapabilities.firefox();
    dcap.setCapability(FirefoxDriver.MARIONETTE, "c:\\Selenium\\FireFox_Driver\\geckodriver.exe");
    dcap.setCapability(FirefoxDriver.PROFILE, fp);
    WebDriver driver=new FirefoxDriver(dcap);
*/
    WebDriver driver=new FirefoxDriver();
    driver.get("http://gmail.com");
}

Any ideas on how to make use of latest browser?
Thanks

A: Always look into jmeter.log file, it normally contains enough information to guess the failure reason. If you are not able to figure that out yourself - include essential log part into your question as Internet is full of "JMeter doesn't work" questions and no one can answer due to lack of details.
Let's start clean.

*

*Download the latest JMeter version (3.1 as of now) and unpack it somewhere, i.e. in C:\apps\jmeter folder

*Download the latest Selenium Java client (3.0.1 as of now). Put client-combined-3.0.1-nodeps.jar and everything which is in lib folder of the Selenium Java Client somewhere to JMeter Classpath (i.e. C:\apps\jmeter\lib folder)

*This DesiredCapabilities are not required, according to Mozilla Documentation

With Selenium 3.0 and later, you shouldn't need to do anything to use Marionette, as it's enabled by default.

My test code looks like:
System.setProperty("webdriver.gecko.driver","C:\\apps\\jmeter\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
log.info("Browser version:" +  ((JavascriptExecutor)driver).executeScript("return navigator.userAgent"));
driver.get("http://gmail.com");
log.info("Page title: " + driver.getTitle());

And here is the output:

See How to Use JUnit With JMeter article for comprehensive information on JMeter and JUnit integration.


text:
Q: postfix error: open database /var/lib/mailman/data/aliases.db: No such file In trying to follow the Ubuntu guide for postfix and mailman, I do not understand these directions:
This build of mailman runs as list. It must have permission to read /etc/aliases and read and write /var/lib/mailman/data/aliases. Do this with these commands:

sudo chown root:list /var/lib/mailman/data/aliases
sudo chown root:list /etc/aliases

Save and run:

sudo newaliases

I'm getting this kind of error:
root@dur:~#
root@dur:~#
root@dur:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 dur.bounceme.net ESMTP Postfix (Ubuntu)
ehlo dur
250-dur.bounceme.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@dur:~#
root@dur:~# tail /var/log/mail.log
Aug 28 01:16:43 dur postfix/master[19444]: terminating on signal 15
Aug 28 01:16:43 dur postfix/postfix-script[19558]: starting the Postfix mail system
Aug 28 01:16:43 dur postfix/master[19559]: daemon started -- version 2.9.1, configuration /etc/postfix
Aug 28 01:16:45 dur postfix/postfix-script[19568]: stopping the Postfix mail system
Aug 28 01:16:45 dur postfix/master[19559]: terminating on signal 15
Aug 28 01:16:45 dur postfix/postfix-script[19673]: starting the Postfix mail system
Aug 28 01:16:45 dur postfix/master[19674]: daemon started -- version 2.9.1, configuration /etc/postfix
Aug 28 01:17:22 dur postfix/smtpd[19709]: error: open database /var/lib/mailman/data/aliases.db: No such file or directory
Aug 28 01:17:22 dur postfix/smtpd[19709]: connect from localhost[127.0.0.1]
Aug 28 01:18:37 dur postfix/smtpd[19709]: disconnect from localhost[127.0.0.1]
root@dur:~#
root@dur:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
default_transport = smtp
home_mailbox = Maildir/
inet_interfaces = loopback-only
mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -m "${EXTENSION}"
mailbox_size_limit = 0
mailman_destination_recipient_limit = 1
mydestination = dur, dur.bounceme.net, localhost.bounceme.net, localhost
myhostname = dur.bounceme.net
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relay_domains = lists.dur.bounceme.net
relay_transport = relay
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-mail.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-mail.key
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = hash:/etc/postfix/transport
root@dur:~#
root@dur:~#

And am wondering what connection might be.  I do see that I don't have the requisite files:
root@dur:~#
root@dur:~# ll /var/lib/mailman/data/aliases
ls: cannot access /var/lib/mailman/data/aliases: No such file or directory
root@dur:~#

At what stage were those aliases created?  How can I create them?  Is that what's causing the error error: open database /var/lib/mailman/data/aliases.db: No such file or directory
Aug 28 01:17:22 dur postfix/smtpd[19709]: connect from localhost[127.0.0.1]?

A:
At what stage were those aliases created?

Installing mailman only copies the installation files in /var/lib/mailman:
# ls -l /var/lib/mailman/data/
total 16
-rw-rw-r-- 1 root list    10 Aug 28 16:08 last_mailman_version
-rw-r--r-- 1 root list 14100 Jul 18 00:45 sitelist.cfg

How can I create them?

$ sudo /usr/lib/mailman/bin/genaliases

$ ls -l /var/lib/mailman/data/
total 20
-rw-rw---- 1 root list   355 Aug 28 16:46 aliases
-rw-r----- 1 root list  3072 Aug 28 16:46 aliases.db
-rw-rw-r-- 1 root list    10 Aug 28 16:08 last_mailman_version
-rw-r--r-- 1 root list 14100 Jul 18 00:45 sitelist.cfg

Is that what's causing the error error: open database
  /var/lib/mailman/data/aliases.db: No such file or directory Aug 28
  01:17:22 dur postfix/smtpd[19709]: connect from localhost[127.0.0.1]?

Yes.